blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
38759a1ea5f976aaee7c892b4d3768fae7624186
fad0e50bba9e366c91093d9dcfd9173864a80c3f
/CG_CoreJava/src/com/capgemini/oops/dev/Test.java
7d9738c1998f8df483c5ac5a5e92a0085af0e842
[]
no_license
infochef/CoreJava
64a36e79381feb1f039a9eb63d5a5bd13d83e8be
e92f0c7e43350cea9e78956d0cc58eedac0e4767
refs/heads/master
2022-01-14T21:36:34.676366
2019-06-20T05:40:44
2019-06-20T05:40:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package com.capgemini.oops.dev; import java.util.Scanner; public class Test { public static void main(String[] args) { String s1 = "OG"; String s2 = "og"; boolean i = s1.equalsIgnoreCase(s2); System.out.println(i); } }
[ "Admin@DESKTOP-L6RC05T" ]
Admin@DESKTOP-L6RC05T
17a9a947f56a5dfd2cb818e3b6e7571daa7f3021
aafbde5bd068da3aedc6d5c360eb2532cdc88ec7
/app/src/main/java/com/example/alisehomeproject/Activity/OtpverifactionActivity.java
5feca938066432f1ced30e9713b1b436719a6670
[]
no_license
sumanta87/AliseHomeProject
6fbe709596c9593792332523672e5f9832f39291
bbb69dfe5c763b3f7692977cafb289042cb774ed
refs/heads/master
2023-06-14T04:47:27.251995
2021-07-06T16:04:36
2021-07-06T16:04:36
383,515,312
0
0
null
null
null
null
UTF-8
Java
false
false
6,199
java
package com.example.alisehomeproject.Activity; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.CountDownTimer; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ImageView; import com.example.alisehomeproject.Pojo.Authentication; import com.example.alisehomeproject.Pojo.Otpsubmit; import com.example.alisehomeproject.R; import com.example.alisehomeproject.Viewsmode.HighBoldEditText; import com.example.alisehomeproject.Viewsmode.HighSemiBoldTextView; import com.example.alisehomeproject.utils.ApiService; import com.example.alisehomeproject.utils.GlobalMethod; import com.example.alisehomeproject.utils.SessionManager; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class OtpverifactionActivity extends AppCompatActivity { HighSemiBoldTextView tv_number,tv_time; HighBoldEditText et_otp; ImageView iv_editnumber; Button bu_submit; static final String BASE_URL = "https://testa2.aisle.co/V1/users/"; static Retrofit retrofit = null; final static String Cookie = "cfduid=df9b865983bd04a5de2cf5017994bbbc71618565720"; String number; CountDownTimer cdt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_otpverifaction); initializeViews(); Bundle b = getIntent().getExtras(); if (b != null) { tv_number.setText(b.getString("phonenumber")); number=b.getString("phonenumber"); } setTimer(); } public void initializeViews() { tv_number=findViewById(R.id.tv_number); tv_time=findViewById(R.id.tv_time); et_otp=findViewById(R.id.et_otp); iv_editnumber=findViewById(R.id.iv_editnumber); bu_submit=findViewById(R.id.bu_submit); bu_submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (GlobalMethod.checkNetworkState(OtpverifactionActivity.this)) { if (et_otp.getText().toString().trim().equals("")) { et_otp.setError("ENTER OTP"); } else { et_otp.clearFocus(); if (et_otp.getText().toString().trim().length()!=4) { et_otp.setError("ENTER VALID 4 DIGIT OTP"); } else { et_otp.clearFocus(); connect(); GlobalMethod.DialogShow_Spin(OtpverifactionActivity.this,"Loading..."); } } } else { GlobalMethod.showSettingsAlert(OtpverifactionActivity.this); } } }); iv_editnumber.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } private void connect() { if (retrofit == null) { retrofit = new Retrofit.Builder() .baseUrl(BASE_URL) .addConverterFactory(GsonConverterFactory.create()) .build(); } Otpsubmit otpsubmit=new Otpsubmit(); otpsubmit.setNumber(number); otpsubmit.setOtp(et_otp.getText().toString().trim()); ApiService apiService = retrofit.create(ApiService.class); Call<JsonObject> call = apiService.getSubmitOtpStatus(Cookie, otpsubmit); call.enqueue(new Callback<JsonObject>() { @Override public void onResponse(Call<JsonObject> call, Response<JsonObject> response) { GlobalMethod.DialogEnd(); et_otp.setText(""); Log.d("response", String.valueOf(response)); Log.d("responsebnody", String.valueOf(response.body())); Gson gson = new Gson(); Authentication authentication= new Authentication(); Type type = new TypeToken<Authentication>() { }.getType(); authentication = gson.fromJson(response.body(), type); if (authentication.getToken()!=null) { SessionManager sessionManager= new SessionManager(OtpverifactionActivity.this); sessionManager.setSessionID(authentication.getToken()); sessionManager.commit(); Intent nextpage= new Intent(OtpverifactionActivity.this,HomePageActivity.class); overridePendingTransition(R.anim.push_right_in,R.anim.push_right_out); startActivity(nextpage); finish(); } else { GlobalMethod.getAlertErrorCode(OtpverifactionActivity.this,"SOMTHING WENT TO WRONG",""); } } @Override public void onFailure(Call<JsonObject> call, Throwable t) { Log.d("response", String.valueOf(t)); GlobalMethod.DialogEnd(); GlobalMethod.getAlertErrorCode(OtpverifactionActivity.this,"SOMTHING WENT TO WRONG",""); } }); } private void setTimer() { if (cdt != null) { cdt.cancel(); } cdt = new CountDownTimer(60000, 1000) { public void onTick(long millisUntilFinished) { tv_time.setText( "00."+ millisUntilFinished / 1000); } public void onFinish() { } }.start(); } }
bc9822bb717c183a4206e42ae7fc646e7ec9f642
06494e3b76ee6f960397e05205ea23050ae2ac5b
/exercise42/src/test/java/baseline/FileParserTest.java
7700e79551b6e27eada26a3572fd2e4b1e76646b
[]
no_license
DavidABeers/beers-a04
6ae6064fca7bce874bb004b71dfa847850c1f659
90417f2cc54bcc9c4ff4dba603738c8c71389cc0
refs/heads/master
2023-08-30T14:41:08.071792
2021-10-17T20:50:43
2021-10-17T20:50:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,622
java
package baseline; import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.junit.jupiter.api.Assertions.*; class FileParserTest { @Test void testReadData() { FileParser fp = new FileParser(); List<String> expected = new ArrayList<>(); expected.add("Ling,Mai,55900"); expected.add("Johnson,Jim,56500"); expected.add("Jones,Aaron,46000"); expected.add("Jones,Chris,34500"); expected.add("Swift,Geoffrey,14200"); expected.add("Xiong,Fong,65000"); expected.add("Zarnecki,Sabrina,51500"); fp.readData("data/exercise42_input.txt"); List<String> actual = fp.getData(); for(int i = 0; i<expected.size();i++){ assertEquals(expected.get(i), actual.get(i)); } } @Test void mapData() { ParsedDataPrinter pdp = new ParsedDataPrinter(); List<Map<String, String>> expected = new ArrayList<>(); Map<String, String> map1 = new HashMap<>(); Map<String, String> map2 = new HashMap<>(); Map<String, String> map3 = new HashMap<>(); Map<String, String> map4 = new HashMap<>(); Map<String, String> map5 = new HashMap<>(); Map<String, String> map6 = new HashMap<>(); Map<String, String> map7 = new HashMap<>(); map1.put("lName", "Ling"); map1.put("fName", "Mai"); map1.put("salary", "55900"); expected.add(map1); map2.put("lName", "Johnson"); map2.put("fName", "Jim"); map2.put("salary", "56500"); expected.add(map2); map3.put("lName", "Jones"); map3.put("fName", "Aaron"); map3.put("salary", "46000"); expected.add(map3); map4.put("lName", "Jones"); map4.put("fName", "Chris"); map4.put("salary", "34500"); expected.add(map4); map5.put("lName", "Swift"); map5.put("fName", "Geoffrey"); map5.put("salary", "14200"); expected.add(map5); map6.put("lName", "Xiong"); map6.put("fName", "Fong"); map6.put("salary", "65000"); expected.add(map6); map7.put("lName", "Zarnecki"); map7.put("fName", "Sabrina"); map7.put("salary", "51500"); expected.add(map7); pdp.readData("data/exercise42_input.txt"); pdp.mapData(); List<Map<String, String>> actual = pdp.getMappedData(); for(short i = 0; i< expected.size();i++){ assertEquals(expected.get(i), actual.get(i)); } } }
98217ac547816659c364ad12f38ed73f144a219f
c11dfb8d82ae0660e3ef5b0a753562b1f72cf5e1
/fresco-2.5.0/imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/StagingAreaTest.java
e1be4d0676dd316d3ae308531e3bb2429fcde3e3
[ "MIT" ]
permissive
Poomipat-Ch/Software-Architecture-and-Design-Fresco
8e7cad0b64fa1f7c5ae672da1bc6484d68639afb
fac688c6406738970780ef965c0fc2a13eacc600
refs/heads/main
2023-09-01T23:47:48.348929
2021-11-21T18:20:50
2021-11-21T18:20:50
430,391,642
0
0
null
null
null
null
UTF-8
Java
false
false
4,490
java
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.facebook.imagepipeline.cache; import com.facebook.cache.common.CacheKey; import com.facebook.cache.common.SimpleCacheKey; import com.facebook.common.memory.PooledByteBuffer; import com.facebook.common.references.CloseableReference; import com.facebook.imagepipeline.image.EncodedImage; import org.junit.*; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; import static org.junit.Assert.*; import static org.mockito.Mockito.*; @RunWith(RobolectricTestRunner.class) @Config(manifest = Config.NONE) public class StagingAreaTest { private StagingArea mStagingArea; private com.facebook.common.references.CloseableReference<PooledByteBuffer> mCloseableReference; private com.facebook.common.references.CloseableReference<PooledByteBuffer> mCloseableReference2; private com.facebook.imagepipeline.image.EncodedImage mEncodedImage; private com.facebook.imagepipeline.image.EncodedImage mSecondEncodedImage; private com.facebook.cache.common.CacheKey mCacheKey; @Before public void setUp() { mStagingArea = StagingArea.getInstance(); mCloseableReference = CloseableReference.of(mock(PooledByteBuffer.class)); mCloseableReference2 = CloseableReference.of(mock(PooledByteBuffer.class)); mEncodedImage = new EncodedImage(mCloseableReference); mSecondEncodedImage = new EncodedImage(mCloseableReference2); mCacheKey = new SimpleCacheKey("http://this.is/uri"); mStagingArea.put(mCacheKey, mEncodedImage); } @Test public void testContains() { assertTrue(mStagingArea.containsKey(mCacheKey)); assertFalse(mStagingArea.containsKey(new SimpleCacheKey("http://this.is.not.uri"))); } @Test public void testDoesntContainInvalid() { mEncodedImage.close(); assertTrue(mStagingArea.containsKey(mCacheKey)); assertTrue(EncodedImage.isValid(mStagingArea.get(mCacheKey))); } @Test public void testGetValue() { assertSame( mCloseableReference.getUnderlyingReferenceTestOnly(), mStagingArea.get(mCacheKey).getByteBufferRef().getUnderlyingReferenceTestOnly()); } @Test public void testBumpsRefCountOnGet() { mStagingArea.get(mCacheKey); assertEquals(4, mCloseableReference.getUnderlyingReferenceTestOnly().getRefCountTestOnly()); } @Test public void testAnotherPut() { mStagingArea.put(mCacheKey, mSecondEncodedImage); assertEquals(2, mCloseableReference.getUnderlyingReferenceTestOnly().getRefCountTestOnly()); assertSame( mCloseableReference2.getUnderlyingReferenceTestOnly(), mStagingArea.get(mCacheKey).getByteBufferRef().getUnderlyingReferenceTestOnly()); } @Test public void testSamePut() { assertEquals(3, mCloseableReference.getUnderlyingReferenceTestOnly().getRefCountTestOnly()); mStagingArea.put(mCacheKey, mEncodedImage); assertEquals(3, mCloseableReference.getUnderlyingReferenceTestOnly().getRefCountTestOnly()); assertSame( mCloseableReference.getUnderlyingReferenceTestOnly(), mStagingArea.get(mCacheKey).getByteBufferRef().getUnderlyingReferenceTestOnly()); } @Test public void testRemove() { assertTrue(mStagingArea.remove(mCacheKey, mEncodedImage)); assertEquals(2, mCloseableReference.getUnderlyingReferenceTestOnly().getRefCountTestOnly()); assertFalse(mStagingArea.remove(mCacheKey, mEncodedImage)); } @Test public void testRemoveWithBadRef() { assertFalse(mStagingArea.remove(mCacheKey, mSecondEncodedImage)); assertTrue(CloseableReference.isValid(mCloseableReference)); assertTrue(CloseableReference.isValid(mCloseableReference2)); } @Test public void testRemoveWithoutValueCheck() { assertTrue(mStagingArea.remove(mCacheKey)); assertEquals(2, mCloseableReference.getUnderlyingReferenceTestOnly().getRefCountTestOnly()); assertFalse(mStagingArea.remove(mCacheKey)); } @Test public void testClearAll() { mStagingArea.put(new SimpleCacheKey("second"), mSecondEncodedImage); mStagingArea.clearAll(); assertEquals(2, mCloseableReference.getUnderlyingReferenceTestOnly().getRefCountTestOnly()); assertEquals(2, mCloseableReference2.getUnderlyingReferenceTestOnly().getRefCountTestOnly()); assertFalse(mStagingArea.remove(mCacheKey)); } }
94f6671b05be981f5d50e79cc4bdecee8ed5e8a8
7706d8e5326463ec6f44e772295b435d9b608489
/2.JavaCore/src/com/javarush/task/task13/task1313/Solution.java
451b15b20bbaf6a79bb96af8f9ae641b2bc4e65c
[]
no_license
tolikt22/JavaRUSHtasks
5df9bb7ef8ca1c4d9bcb57c60d540c34146d92d1
753232bc771cc1b7f6b9bb62266e03be87fddaf7
refs/heads/master
2021-01-20T09:54:48.511074
2018-04-24T19:44:23
2018-04-24T19:44:23
90,299,356
1
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.javarush.task.task13.task1313; import java.awt.*; /* Интерфейс Animal */ public class Solution { public static void main(String[] args) throws Exception { } public interface Animal { Color getColor(); } public static abstract class Fox implements Animal{ public String getName() { return "Fox"; } } }
0a2a5c9f6fa42346e483719c3ca2c8027a0efc77
4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849
/aliyun-java-sdk-iot/src/main/java/com/aliyuncs/iot/transform/v20180120/CreateEdgeDriverVersionResponseUnmarshaller.java
3fbbb68d48e08b0d7faa7f698cbc5563b9c0592e
[ "Apache-2.0" ]
permissive
aliyun/aliyun-openapi-java-sdk
a263fa08e261f12d45586d1b3ad8a6609bba0e91
e19239808ad2298d32dda77db29a6d809e4f7add
refs/heads/master
2023-09-03T12:28:09.765286
2023-09-01T09:03:00
2023-09-01T09:03:00
39,555,898
1,542
1,317
NOASSERTION
2023-09-14T07:27:05
2015-07-23T08:41:13
Java
UTF-8
Java
false
false
1,438
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.iot.transform.v20180120; import com.aliyuncs.iot.model.v20180120.CreateEdgeDriverVersionResponse; import com.aliyuncs.transform.UnmarshallerContext; public class CreateEdgeDriverVersionResponseUnmarshaller { public static CreateEdgeDriverVersionResponse unmarshall(CreateEdgeDriverVersionResponse createEdgeDriverVersionResponse, UnmarshallerContext _ctx) { createEdgeDriverVersionResponse.setRequestId(_ctx.stringValue("CreateEdgeDriverVersionResponse.RequestId")); createEdgeDriverVersionResponse.setSuccess(_ctx.booleanValue("CreateEdgeDriverVersionResponse.Success")); createEdgeDriverVersionResponse.setCode(_ctx.stringValue("CreateEdgeDriverVersionResponse.Code")); createEdgeDriverVersionResponse.setErrorMessage(_ctx.stringValue("CreateEdgeDriverVersionResponse.ErrorMessage")); return createEdgeDriverVersionResponse; } }
00f7c31f33030d5c0fcac3aa657ff0b20d32f499
3f1751a9b197b5ffb1fa2e76d048e431c957eae5
/redismanager-core/src/main/java/com/tz/redismanager/service/impl/CaptchaServiceImpl.java
86ca0c7d02ef3080b1f23dabe8da19896bf400e8
[ "MIT" ]
permissive
tuanzuo/redismanager
8d5e8bbe6c986594e24783fc64ee2be518c2d9c4
75eff2d090616c068e1d93f180cb9bfefdeb05b6
refs/heads/master
2023-06-22T08:10:11.244693
2022-10-01T11:33:54
2022-10-01T11:33:54
189,426,773
17
3
MIT
2022-10-01T11:33:54
2019-05-30T14:18:42
Java
UTF-8
Java
false
false
2,544
java
package com.tz.redismanager.service.impl; import com.tz.redismanager.constant.ConstInterface; import com.tz.redismanager.domain.ApiResult; import com.tz.redismanager.domain.vo.CaptchaResp; import com.tz.redismanager.domain.vo.CaptchaVO; import com.tz.redismanager.enm.ResultCode; import com.tz.redismanager.service.ICaptchaService; import com.tz.redismanager.util.UUIDUtils; import com.wf.captcha.ArithmeticCaptcha; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import java.util.concurrent.TimeUnit; /** * <p>验证码服务实现</p> * {@link https://github.com/whvcse/EasyCaptcha } * * @author tuanzuo * @version 1.6.0 * @time 2020-12-19 19:11 **/ @Service public class CaptchaServiceImpl implements ICaptchaService { @Autowired private StringRedisTemplate stringRedisTemplate; @Override public CaptchaResp captcha() { // 算术类型 ArithmeticCaptcha captcha = new ArithmeticCaptcha(120, 35); // 几位数运算,默认是两位 captcha.setLen(2); // 获取运算的公式:3+2=? captcha.getArithmeticString(); // 获取运算的结果:5 String verCode = captcha.text().toLowerCase(); String key = UUIDUtils.generateId(); // 验证码放入缓存 stringRedisTemplate.opsForValue().set(StringUtils.join(ConstInterface.CacheKey.CAPTCHA_KEY, key), verCode, 30, TimeUnit.SECONDS); return this.buildCaptchaResp(captcha, key); } @Override public ApiResult<?> validCaptcha(CaptchaVO vo) { String captchaCacheKey = StringUtils.join(ConstInterface.CacheKey.CAPTCHA_KEY, vo.getCaptchaKey()); String captchaCode = stringRedisTemplate.opsForValue().get(captchaCacheKey); if (StringUtils.isBlank(captchaCode)) { return new ApiResult<>(ResultCode.CAPTCHA_EXPIRE); } if (!captchaCode.equalsIgnoreCase(vo.getCaptcha())) { return new ApiResult<>(ResultCode.CAPTCHA_ERROR); } stringRedisTemplate.delete(captchaCacheKey); return new ApiResult<>(ResultCode.SUCCESS); } private CaptchaResp buildCaptchaResp(ArithmeticCaptcha captcha, String key) { CaptchaResp resp = new CaptchaResp(); //验证码的缓存key resp.setKey(key); //图形验证码 resp.setImage(captcha.toBase64()); return resp; } }
7c0c18aac785772ad5cd499b8eea4d2b0163735c
ae8da069a48e4c4780e88c33d7dac11b641836ae
/src/main/java/com/mortbay/iwiki/YyyyMmDd.java
f92dbddf66bb9abfa4bce9df406ae3870e02410d
[]
no_license
gregw/colletta
00a6801ce58df5dec0d1930703c3d32296313e3d
a5fb84627d1876adae0e93d6938075b6d12e9976
refs/heads/master
2021-08-15T22:14:43.750247
2021-07-08T01:02:36
2021-07-08T01:02:36
46,703,488
0
1
null
2021-07-19T15:17:07
2015-11-23T07:23:53
Java
UTF-8
Java
false
false
3,213
java
/* ============================================== * Copyright 2003 Mort Bay Consulting Pty Ltd. All rights reserved. * Distributed under the artistic license. * Created on 28/03/2004 * $Id: YyyyMmDd.java,v 1.1 2006/01/21 17:28:01 gregw Exp $ * ============================================== */ package com.mortbay.iwiki; /* ------------------------------------------------------------------------------- */ /** * * @version $Revision: 1.1 $ * @author gregw */ public class YyyyMmDd extends YyyyMmDdHM { private static YyyyMmDd[] easters = new YyyyMmDd[100]; public static YyyyMmDd easter(int yyyy) { int e=yyyy-2000; if (e>=0 && e<easters.length && easters[e]!=null) return easters[e]; int century=yyyy/100; int g=yyyy%19; int k = ((century - 17) / 25); int i = (century - (century / 4) - ((century - k) / 3) + 19 * g + 15) % 30; i = i - (i/28) * (1 - (i/28) * (29/(i+1)) * ((21-g)/11)); int j= (yyyy + (yyyy/4) + i + 2 - century + (century/4)) % 7; int l = i - j; int mm = 3 + (l+40)/44; int dd = l + 28 - 31 * (mm/4); YyyyMmDd ymd=new YyyyMmDd(yyyy,mm,dd,true); if (e>=0 && e<easters.length) easters[e]=ymd; return ymd; } public YyyyMmDd() { super(); setH(0); setM(0); } public YyyyMmDd(long msFromEpoch) { super(msFromEpoch); setH(0); setM(0); } public YyyyMmDd(String ymd) { super(ymd+" 0:0"); } public YyyyMmDd(int yyyy,int mm, int dd) { super(yyyy,mm,dd,0,0); } public YyyyMmDd(int yyyy,int mm, int dd, boolean readonly) { super(yyyy,mm,dd,0,0,readonly); } public YyyyMmDd(YyyyMmDd ymd) { super(ymd); } public YyyyMmDd(YyyyMmDd ymd, boolean readonly) { super(ymd,readonly); } /* ------------------------------------------------------------------------------- */ /** * @see java.lang.Object#clone() */ public Object clone() throws CloneNotSupportedException { return new YyyyMmDd(this); } /* ------------------------------------------------------------------------------- */ /** * @return Returns the yyyymm. */ public int getYyyymm() { return getYyyy()*100+getMm(); } /* ------------------------------------------------------------------------------- */ /** * @return Returns the yyyymmdd. */ public int getYyyymmdd() { return getYyyy()*10000+getMm()*100+getDd(); } /* ------------------------------------------------------------------------------- */ public void setToNow() { super.setToNow(); setH(0); setM(0); } /* ------------------------------------------------------------------------------- */ /** * @see java.lang.Object#toString() */ public String toString() { return getYyyy()+ (getMm()<10?"-0":"-")+getMm()+ (getDd()<10?"-0":"-")+getDd(); } }
50d9384af19f801488fd4f559e8ac8a64264d56a
139bd5665142aa77a6fb8ee6ac7001904b9247f3
/libs/feifanlocate/locatelib/src/main/java/com/feifan/locatelib/network/UrlUtils.java
f65590f454cf9acb576a1fc716ea1d85cc322c56
[]
no_license
ffan-story/locate-android
4d7bc67220645fc70d06fbbf50c906a4919c9ce6
c9ef6c7fcc8b8ad3c4327bc9e746003220b861c8
refs/heads/master
2023-02-15T00:14:40.925782
2017-01-24T03:40:23
2021-01-05T07:39:46
61,765,860
0
1
null
null
null
null
UTF-8
Java
false
false
2,808
java
package com.feifan.locatelib.network; import android.text.TextUtils; import android.util.Base64; import com.feifan.baselib.utils.LogUtils; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; /** * Created by xuchunlei on 2016/11/17. */ public class UrlUtils { private UrlUtils() { } /** * 获取 * @param params * @return */ public static String computeSignValue(Map<String, String> params) { List<String> paramCache = new ArrayList<>(); for(Map.Entry<String, String> param : params.entrySet()) { paramCache.add(param.getKey() + "=" + param.getValue()); } Collections.sort(paramCache); String queryContent = ""; for(String query : paramCache) { queryContent += query + "&"; } queryContent = queryContent + "callSecret=A9F3948C48481EF35F346790CA136C9A"; LogUtils.e(queryContent); try { return getSHA(queryContent); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return null; } /** * Base64编码 * <p> * example: * UrlUtils.encodeToBase64("[[\"A3FCE438-627C-42B7-AB72-DC6E55E137AC\",\"11000\"],[\"A3FCE438-627C-42B7-AB72-DC6E55E137AC\",\"21000\"]]"); * Base64 code : W1siQTNGQ0U0MzgtNjI3Qy00MkI3LUFCNzItREM2RTU1RTEzN0FDIiwiMTEwMDAiXSxbIkEzRkNFNDM4LTYyN0MtNDJCNy1BQjcyLURDNkU1NUUxMzdBQyIsIjIxMDAwIl1d * </p> * @param content * @return */ public static String encodeToBase64(String content) { String result = ""; if(!TextUtils.isEmpty(content)) { try { result = Base64.encodeToString(content.getBytes("utf-8"), Base64.DEFAULT); LogUtils.d(content + " base64 to " + result); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return result; } private static String getSHA(String val) throws NoSuchAlgorithmException{ MessageDigest md5 = MessageDigest.getInstance("SHA-1"); md5.update(val.getBytes()); byte[] m = md5.digest();//加密 return byte2hex(m); } //二进制转字符串 private static String byte2hex(byte[] b) { String hs=""; String stmp=""; for (int n=0;n<b.length;n++) { stmp=(Integer.toHexString(b[n] & 0XFF)); if (stmp.length()==1) { hs= hs + "0" + stmp; } else { hs = hs + stmp; } } return hs; } }
c91ce6b9585edab0bd6c640c9fce2bc828a7676b
5d42811eb9d45a93b80c4f57fd6f703dcb73f590
/src/interfete/View.java
bf9ed97a28ce1d5a7970d348b7275235fc080f60
[]
no_license
LiviaGusatu/SETema6
436ab083dc15a070d08d6bcc901bdd0a030e49cf
70f41da85dc366c97901fbe597e7f65332482839
refs/heads/master
2020-05-18T14:13:04.773454
2014-11-23T21:41:49
2014-11-23T21:41:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
135
java
package interfete; /** * Created by Livia on 11/23/2014. */ public interface View { public void mesaj(boolean err, String m); }
7f781b824531c0613104bb75eabb4870dad63ea6
be608e227e7e385cd8e68bdfae4c79283ee88595
/service-claimisubmision/target/generated-sources/xjc/org/delta/b2b/edi/t837/SAMTCoordinationOfBenefitsCOBTotalNonCoveredAmount.java
f85112f1ec0a2d2012e5389222575cc17befadb2
[]
no_license
msen2000/services
4867cdc3e2be12e9b5f54f2568e7c9844e91af25
cb84c48792aee88ab8533f407b8150430c5da2dd
refs/heads/master
2016-08-04T19:08:09.872078
2014-02-16T08:11:16
2014-02-16T08:11:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,863
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2011.10.25 at 02:23:02 PM PDT // package org.delta.b2b.edi.t837; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlType; /** * To indicate the total monetary amount * * <p>Java class for S-AMT-Coordination_of_Benefits__COB__Total_Non-covered_Amount complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="S-AMT-Coordination_of_Benefits__COB__Total_Non-covered_Amount"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="E-AMT01-Amount_Qualifier_Code" type="{http://www.delta.org/b2b/edi/t837}E-AMT01-Amount_Qualifier_Code_3"/> * &lt;element name="E-AMT02-Monetary_Amount" type="{http://www.delta.org/b2b/edi/t837}E-AMT02-Monetary_Amount"/> * &lt;element name="E-AMT03-Credit_Debit_Flag_Code" type="{http://www.delta.org/b2b/edi/t837}E-AMT03-Credit_Debit_Flag_Code" minOccurs="0"/> * &lt;/sequence> * &lt;attribute name="ID" type="{http://www.w3.org/2001/XMLSchema}string" default="AMT" /> * &lt;attribute name="Name" type="{http://www.w3.org/2001/XMLSchema}string" default="Coordination of Benefits (COB) Total Non-covered Amount" /> * &lt;attribute name="Type" type="{http://www.w3.org/2001/XMLSchema}string" default="Segment" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "S-AMT-Coordination_of_Benefits__COB__Total_Non-covered_Amount", propOrder = { "eamt01AmountQualifierCode", "eamt02MonetaryAmount", "eamt03CreditDebitFlagCode" }) public class SAMTCoordinationOfBenefitsCOBTotalNonCoveredAmount { @XmlElement(name = "E-AMT01-Amount_Qualifier_Code", required = true) protected EAMT01AmountQualifierCode3 eamt01AmountQualifierCode; @XmlElement(name = "E-AMT02-Monetary_Amount", required = true) protected EAMT02MonetaryAmount eamt02MonetaryAmount; @XmlElementRef(name = "E-AMT03-Credit_Debit_Flag_Code", namespace = "http://www.delta.org/b2b/edi/t837", type = JAXBElement.class) protected JAXBElement<EAMT03CreditDebitFlagCode> eamt03CreditDebitFlagCode; @XmlAttribute(name = "ID") protected String id; @XmlAttribute(name = "Name") protected String name; @XmlAttribute(name = "Type") protected String type; /** * Gets the value of the eamt01AmountQualifierCode property. * * @return * possible object is * {@link EAMT01AmountQualifierCode3 } * */ public EAMT01AmountQualifierCode3 getEAMT01AmountQualifierCode() { return eamt01AmountQualifierCode; } /** * Sets the value of the eamt01AmountQualifierCode property. * * @param value * allowed object is * {@link EAMT01AmountQualifierCode3 } * */ public void setEAMT01AmountQualifierCode(EAMT01AmountQualifierCode3 value) { this.eamt01AmountQualifierCode = value; } /** * Gets the value of the eamt02MonetaryAmount property. * * @return * possible object is * {@link EAMT02MonetaryAmount } * */ public EAMT02MonetaryAmount getEAMT02MonetaryAmount() { return eamt02MonetaryAmount; } /** * Sets the value of the eamt02MonetaryAmount property. * * @param value * allowed object is * {@link EAMT02MonetaryAmount } * */ public void setEAMT02MonetaryAmount(EAMT02MonetaryAmount value) { this.eamt02MonetaryAmount = value; } /** * Gets the value of the eamt03CreditDebitFlagCode property. * * @return * possible object is * {@link JAXBElement }{@code <}{@link EAMT03CreditDebitFlagCode }{@code >} * */ public JAXBElement<EAMT03CreditDebitFlagCode> getEAMT03CreditDebitFlagCode() { return eamt03CreditDebitFlagCode; } /** * Sets the value of the eamt03CreditDebitFlagCode property. * * @param value * allowed object is * {@link JAXBElement }{@code <}{@link EAMT03CreditDebitFlagCode }{@code >} * */ public void setEAMT03CreditDebitFlagCode(JAXBElement<EAMT03CreditDebitFlagCode> value) { this.eamt03CreditDebitFlagCode = ((JAXBElement<EAMT03CreditDebitFlagCode> ) value); } /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getID() { if (id == null) { return "AMT"; } else { return id; } } /** * Sets the value of the id property. * * @param value * allowed object is * {@link String } * */ public void setID(String value) { this.id = value; } /** * Gets the value of the name property. * * @return * possible object is * {@link String } * */ public String getName() { if (name == null) { return "Coordination of Benefits (COB) Total Non-covered Amount"; } else { return name; } } /** * Sets the value of the name property. * * @param value * allowed object is * {@link String } * */ public void setName(String value) { this.name = value; } /** * Gets the value of the type property. * * @return * possible object is * {@link String } * */ public String getType() { if (type == null) { return "Segment"; } else { return type; } } /** * Sets the value of the type property. * * @param value * allowed object is * {@link String } * */ public void setType(String value) { this.type = value; } }
3500d3fbcaa6c975cb37dcf84eb8cfa246466805
751ce96dd6e58dbd67c69f130b7fb4f0250e8a07
/private-class-data/src/test/java/com/iluwatar/AppTest.java
48818f5ad5f0cfa08c2dde02cea3dea5c3d8b63c
[ "MIT" ]
permissive
grysh/java-design-patterns
d4886d7553c6d4be299019232c4b63ec006408b3
8656e954bdfe2caeead7d53b2ad4a87b3cfe677d
refs/heads/master
2021-01-20T17:23:32.266803
2015-05-24T10:00:32
2015-05-24T10:00:32
36,184,715
1
0
null
2015-05-24T17:47:31
2015-05-24T17:47:31
null
UTF-8
Java
false
false
158
java
package com.iluwatar; import org.junit.Test; public class AppTest { @Test public void test() { String[] args = {}; App.main(args); } }
9a366d1df079629b247d2f50ae991b11f15f54b6
7fd1a21e414d96964ec86c8107bf25e210b40d34
/Bwagner/greenfoot/scenarios/Mario Climb - key/Ladder.java
6c7dbcdda8f1fe3afd68b618715cfefaff0342f7
[]
no_license
HebronHS/HebronHS.github.io
7b58575003ad09931616c5f3de60b780244129a5
f6ae8a8887f821a501814f96f9ac4f02a3ecc355
refs/heads/master
2023-07-04T18:13:39.146975
2021-08-19T14:23:10
2021-08-19T14:23:10
305,490,650
1
0
null
null
null
null
UTF-8
Java
false
false
480
java
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Ladder here. * * @author (your name) * @version (a version number or a date) */ public class Ladder extends Actor { /** * Act - do whatever the Ladder wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { // Add your action code here. } }
e012281fd2acda938bfde4ac907de34fcb6fe4ae
d3eefa5d9c4be591a13ce46b4631feec6e8d9fda
/20200217_1/practice/src/NET/udp_server.java
99a50d4b4ec6f72a2fff652e1a78d54c2b3289fe
[]
no_license
zxq19970820/code
3fb7b8013c5b42a4ee752433b3506e7f3f00f5a7
9238dac8b8a09e4d457ef310bc3e30e5cfaed32e
refs/heads/master
2023-01-18T17:59:39.609751
2020-11-18T05:47:15
2020-11-18T05:47:15
313,832,991
0
0
null
null
null
null
GB18030
Java
false
false
991
java
package NET; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; public class udp_server { public static void main(String[] args) throws IOException { System.out.println("接收端启动"); DatagramSocket ds = new DatagramSocket(14752); while (true) { byte[] by = new byte[1024]; DatagramPacket dp = new DatagramPacket(by, by.length); ds.receive(dp); String ip = dp.getAddress().getHostAddress(); //ip地址 int port = dp.getPort(); //端口号 int num=dp.getLength(); String data = new String(dp.getData(), 0, num); //内容 System.out.println(ip); System.out.println(port); System.out.println(data); // System.out.println("--------分割线--------"); // System.out.println("接收端关闭"); // ds.close(); } } }
bf314bc318b6d9b22156244d0f17fbb0e1a8632f
1e8458752c6fe505b61abd2d6e7fcd157d50e8f6
/common/src/main/java/com/skyworthdigital/voice/common/utils/RsaUtil.java
a80cad4fef808fbdb6a99757b3c58c1fa3f4020d
[]
no_license
yangyongjie8/beevideo3
1e47818496476e5ea782e070e0346f5b8b42060f
a0fa0eee8feb0bc0c8d782d97bcf4ce315883b39
refs/heads/master
2022-11-09T03:19:19.860331
2020-06-22T15:29:42
2020-06-22T15:29:42
274,174,469
0
0
null
null
null
null
UTF-8
Java
false
false
29,819
java
package com.skyworthdigital.voice.common.utils; import android.text.TextUtils; import android.util.Base64; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; import org.bouncycastle.util.io.pem.PemObject; import org.bouncycastle.util.io.pem.PemWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.StringWriter; import java.math.BigInteger; import java.security.Key; import java.security.KeyFactory; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.Security; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.RSAPrivateKeySpec; import java.security.spec.RSAPublicKeySpec; import java.security.spec.X509EncodedKeySpec; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import javax.crypto.Cipher; /** * 私钥加密,公钥解密 * 基于安卓的pkcs8对pkcs1进行支持 * (可行) * http://defned.com/post/java-rsa-pkcs1/ * * (转秘钥可行,但缺少加解密) * https://www.cnblogs.com/whoislcj/p/5470095.html * * https://codeday.me/bug/20181016/293302.html */ public class RsaUtil { public static final String RSA = "RSA";// 非对称加密密钥算法 public static final String ECB_PKCS1_PADDING = "RSA/ECB/PKCS1Padding";//加密填充方式 public static final int DEFAULT_KEY_SIZE = 1024;//秘钥默认长度 public static final byte[] DEFAULT_SPLIT = "#PART#".getBytes(); // 当要加密的内容超过bufferSize,则采用partSplit进行分块加密 public static final int DEFAULT_BUFFERSIZE = (DEFAULT_KEY_SIZE / 8) - 11;// 当前秘钥支持加密的最大字节数 private static final int MAX_ENCRYPT_BLOCK = 64; private static final int MAX_DECRYPT_BLOCK = 128; //===================== 本地秘钥对创建 ========================= /** * 生成pem格式的随机秘钥对 * @return [私钥,公钥] */ public static String[] generatePairPem() throws IOException { KeyPair pair = generateRSAKeyPair(DEFAULT_KEY_SIZE); String privateKey = privatePkcs1ToPem(privatePkcs8ToPkcs1(pair.getPrivate())); String publicKey = publicPkcs1ToPem(publicX509ToPkcs1(pair.getPublic())); return new String[]{privateKey,publicKey}; } /** * * @return [私钥,公钥] */ private static ASN1Primitive[] generateKeyPair() { try { KeyPair pair = generateRSAKeyPair(DEFAULT_KEY_SIZE); ASN1Primitive[] asn1Pair = new ASN1Primitive[]{privateToPkcs1(pair.getPrivate()), publicToPkcs1(pair.getPublic())}; return asn1Pair; } catch (IOException e) { e.printStackTrace(); } return null; } /** * 随机生成RSA密钥对 * * @param keyLength 密钥长度,范围:512~2048 * 一般1024 * @return */ public static KeyPair generateRSAKeyPair(int keyLength) { try { KeyPairGenerator kpg = KeyPairGenerator.getInstance(RSA, "BC"); kpg.initialize(keyLength); return kpg.genKeyPair(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchProviderException e) { e.printStackTrace(); } return null; } public static KeyPair generateRSAKeyPair() { try { KeyPairGenerator kpg = KeyPairGenerator.getInstance(RSA, "BC"); kpg.initialize(DEFAULT_KEY_SIZE); return kpg.genKeyPair(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchProviderException e) { e.printStackTrace(); } return null; } public static byte[] privatePkcs8ToPkcs1(PrivateKey privateKey) throws IOException { byte[] privBytes = privateKey.getEncoded(); PrivateKeyInfo pkInfo = PrivateKeyInfo.getInstance(privBytes); ASN1Encodable encodable = pkInfo.parsePrivateKey(); final ASN1Primitive primitive = encodable.toASN1Primitive(); byte[] privateKeyPKCS1 = primitive.getEncoded(); return privateKeyPKCS1; } public static String privatePkcs1ToPem(byte[] privateKeyPKCS1) throws IOException { PemObject pemObject = new PemObject("RSA PRIVATE KEY", privateKeyPKCS1); StringWriter stringWriter = new StringWriter(); PemWriter pemWriter = new PemWriter(stringWriter); pemWriter.writeObject(pemObject); pemWriter.close(); String pemString = stringWriter.toString(); return pemString; } public static byte[] publicX509ToPkcs1(PublicKey publicKey) throws IOException { byte[] pubBytes = publicKey.getEncoded(); SubjectPublicKeyInfo spkInfo = SubjectPublicKeyInfo.getInstance(pubBytes); ASN1Primitive primitive = spkInfo.parsePublicKey(); byte[] publicKeyPKCS1 = primitive.getEncoded(); return publicKeyPKCS1; } public static String publicPkcs1ToPem(byte[] publiceKeyPKCS1) throws IOException { PemObject pemObject = new PemObject("RSA PUBLIC KEY", publiceKeyPKCS1); StringWriter stringWriter = new StringWriter(); PemWriter pemWriter = new PemWriter(stringWriter); pemWriter.writeObject(pemObject); pemWriter.close(); String pemString = stringWriter.toString(); return pemString; } public static ASN1Primitive privateToPkcs1(PrivateKey privateKey) throws IOException { byte[] privBytes = privateKey.getEncoded(); PrivateKeyInfo pkInfo = PrivateKeyInfo.getInstance(privBytes); ASN1Encodable encodable = pkInfo.parsePrivateKey(); ASN1Primitive primitive = encodable.toASN1Primitive(); return primitive; } public static ASN1Primitive publicToPkcs1(PublicKey publicKey) throws IOException { byte[] pubBytes = publicKey.getEncoded(); SubjectPublicKeyInfo spkInfo = SubjectPublicKeyInfo.getInstance(pubBytes); ASN1Primitive primitive = spkInfo.parsePublicKey(); return primitive; } // ============================= 秘钥加解密 ================================ /** * 私钥加密 * * @param data 待加密数据 * @param privateKey 密钥 * @return byte[] 加密数据 */ private static byte[] encryptByPrivateKey(byte[] data, byte[] privateKey) throws Exception { // 得到私钥 PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKey); KeyFactory kf = KeyFactory.getInstance(RSA); PrivateKey keyPrivate = kf.generatePrivate(keySpec); // 数据加密 Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding", "BC"); // Cipher cipher = Cipher.getInstance(ECB_PKCS1_PADDING, "BC"); cipher.init(Cipher.ENCRYPT_MODE, keyPrivate); return cipher.doFinal(data); } /** * 使用私钥进行解密 */ private static byte[] decryptByPrivateKey(byte[] encrypted, byte[] privateKey) throws Exception { // 得到私钥 PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKey); KeyFactory kf = KeyFactory.getInstance(RSA); PrivateKey keyPrivate = kf.generatePrivate(keySpec); // 解密数据 Cipher cp = Cipher.getInstance(ECB_PKCS1_PADDING); cp.init(Cipher.DECRYPT_MODE, keyPrivate); byte[] arr = cp.doFinal(encrypted); return arr; } /** * 公钥解密 * * @param data 待解密数据 * @param publicKey 密钥 * @return byte[] 解密数据 */ private static byte[] decryptByPublicKey(byte[] data, byte[] publicKey) throws Exception { // 得到公钥 X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKey); KeyFactory kf = KeyFactory.getInstance(RSA); PublicKey keyPublic = kf.generatePublic(keySpec); // 数据解密 Cipher cipher = Cipher.getInstance(ECB_PKCS1_PADDING); cipher.init(Cipher.DECRYPT_MODE, keyPublic); return cipher.doFinal(data); } /** * 用公钥对字符串进行加密 * * @param data 原文 */ private static byte[] encryptByPublicKey(byte[] data, byte[] publicKey) throws Exception { // 得到公钥 X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKey); KeyFactory kf = KeyFactory.getInstance(RSA); PublicKey keyPublic = kf.generatePublic(keySpec); // 加密数据 Cipher cp = Cipher.getInstance(ECB_PKCS1_PADDING); cp.init(Cipher.ENCRYPT_MODE, keyPublic); return cp.doFinal(data); } /** * 分段加密 * * @param data 要加密的原始数据 * @param privateKey 秘钥 */ public static byte[] encryptByPrivateKeyForSpilt(byte[] data, byte[] privateKey) throws Exception { int dataLen = data.length; if (dataLen <= DEFAULT_BUFFERSIZE) { return encryptByPrivateKey(data, privateKey); } List<Byte> allBytes = new ArrayList<Byte>(2048); int bufIndex = 0; int subDataLoop = 0; byte[] buf = new byte[DEFAULT_BUFFERSIZE]; for (int i = 0; i < dataLen; i++) { buf[bufIndex] = data[i]; if (++bufIndex == DEFAULT_BUFFERSIZE || i == dataLen - 1) { subDataLoop++; if (subDataLoop != 1) { for (byte b : DEFAULT_SPLIT) { allBytes.add(b); } } byte[] encryptBytes = encryptByPrivateKey(buf, privateKey); for (byte b : encryptBytes) { allBytes.add(b); } bufIndex = 0; if (i == dataLen - 1) { buf = null; } else { buf = new byte[Math.min(DEFAULT_BUFFERSIZE, dataLen - i - 1)]; } } } byte[] bytes = new byte[allBytes.size()]; { int i = 0; for (Byte b : allBytes) { bytes[i++] = b.byteValue(); } } return bytes; } /** * 公钥分段解密 * * @param encrypted 待解密数据 * @param publicKey 密钥 */ public static byte[] decryptByPublicKeyForSpilt(byte[] encrypted, byte[] publicKey) throws Exception { int splitLen = DEFAULT_SPLIT.length; if (splitLen <= 0) { return decryptByPublicKey(encrypted, publicKey); } int dataLen = encrypted.length; List<Byte> allBytes = new ArrayList<Byte>(1024); int latestStartIndex = 0; for (int i = 0; i < dataLen; i++) { byte bt = encrypted[i]; boolean isMatchSplit = false; if (i == dataLen - 1) { // 到data的最后了 byte[] part = new byte[dataLen - latestStartIndex]; System.arraycopy(encrypted, latestStartIndex, part, 0, part.length); byte[] decryptPart = decryptByPublicKey(part, publicKey); for (byte b : decryptPart) { allBytes.add(b); } latestStartIndex = i + splitLen; i = latestStartIndex - 1; } else if (bt == DEFAULT_SPLIT[0]) { // 这个是以split[0]开头 if (splitLen > 1) { if (i + splitLen < dataLen) { // 没有超出data的范围 for (int j = 1; j < splitLen; j++) { if (DEFAULT_SPLIT[j] != encrypted[i + j]) { break; } if (j == splitLen - 1) { // 验证到split的最后一位,都没有break,则表明已经确认是split段 isMatchSplit = true; } } } } else { // split只有一位,则已经匹配了 isMatchSplit = true; } } if (isMatchSplit) { byte[] part = new byte[i - latestStartIndex]; System.arraycopy(encrypted, latestStartIndex, part, 0, part.length); byte[] decryptPart = decryptByPublicKey(part, publicKey); for (byte b : decryptPart) { allBytes.add(b); } latestStartIndex = i + splitLen; i = latestStartIndex - 1; } } byte[] bytes = new byte[allBytes.size()]; { int i = 0; for (Byte b : allBytes) { bytes[i++] = b.byteValue(); } } return bytes; } /** * 用公钥对字符串进行分段加密 * */ public static byte[] encryptByPublicKeyForSpilt(byte[] data, byte[] publicKey) throws Exception { int dataLen = data.length; if (dataLen <= DEFAULT_BUFFERSIZE) { return encryptByPublicKey(data, publicKey); } List<Byte> allBytes = new ArrayList<Byte>(2048); int bufIndex = 0; int subDataLoop = 0; byte[] buf = new byte[DEFAULT_BUFFERSIZE]; for (int i = 0; i < dataLen; i++) { buf[bufIndex] = data[i]; if (++bufIndex == DEFAULT_BUFFERSIZE || i == dataLen - 1) { subDataLoop++; if (subDataLoop != 1) { for (byte b : DEFAULT_SPLIT) { allBytes.add(b); } } byte[] encryptBytes = encryptByPublicKey(buf, publicKey); for (byte b : encryptBytes) { allBytes.add(b); } bufIndex = 0; if (i == dataLen - 1) { buf = null; } else { buf = new byte[Math.min(DEFAULT_BUFFERSIZE, dataLen - i - 1)]; } } } byte[] bytes = new byte[allBytes.size()]; { int i = 0; for (Byte b : allBytes) { bytes[i++] = b.byteValue(); } } return bytes; } /** * 使用私钥分段解密 * */ public static byte[] decryptByPrivateKeyForSpilt(byte[] encrypted, byte[] privateKey) throws Exception { int splitLen = DEFAULT_SPLIT.length; if (splitLen <= 0) { return decryptByPrivateKey(encrypted, privateKey); } int dataLen = encrypted.length; List<Byte> allBytes = new ArrayList<Byte>(1024); int latestStartIndex = 0; for (int i = 0; i < dataLen; i++) { byte bt = encrypted[i]; boolean isMatchSplit = false; if (i == dataLen - 1) { // 到data的最后了 byte[] part = new byte[dataLen - latestStartIndex]; System.arraycopy(encrypted, latestStartIndex, part, 0, part.length); byte[] decryptPart = decryptByPrivateKey(part, privateKey); for (byte b : decryptPart) { allBytes.add(b); } latestStartIndex = i + splitLen; i = latestStartIndex - 1; } else if (bt == DEFAULT_SPLIT[0]) { // 这个是以split[0]开头 if (splitLen > 1) { if (i + splitLen < dataLen) { // 没有超出data的范围 for (int j = 1; j < splitLen; j++) { if (DEFAULT_SPLIT[j] != encrypted[i + j]) { break; } if (j == splitLen - 1) { // 验证到split的最后一位,都没有break,则表明已经确认是split段 isMatchSplit = true; } } } } else { // split只有一位,则已经匹配了 isMatchSplit = true; } } if (isMatchSplit) { byte[] part = new byte[i - latestStartIndex]; System.arraycopy(encrypted, latestStartIndex, part, 0, part.length); byte[] decryptPart = decryptByPrivateKey(part, privateKey); for (byte b : decryptPart) { allBytes.add(b); } latestStartIndex = i + splitLen; i = latestStartIndex - 1; } } byte[] bytes = new byte[allBytes.size()]; { int i = 0; for (Byte b : allBytes) { bytes[i++] = b.byteValue(); } } return bytes; } // ======================================== PKCS1第二版 ============================================ public static byte[] encrypt(String data, final org.bouncycastle.asn1.pkcs.RSAPublicKey rsaPublicKey) throws Exception { Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); Cipher cipher = Cipher.getInstance("RSA/None/PKCS1Padding", "BC"); Key publicKey = new java.security.interfaces.RSAPublicKey() { @Override public BigInteger getPublicExponent() { return rsaPublicKey.getPublicExponent(); } @Override public String getAlgorithm() { return "RSA"; } @Override public String getFormat() { return null; } @Override public byte[] getEncoded() { return new byte[0]; } @Override public BigInteger getModulus() { return rsaPublicKey.getModulus(); } }; cipher.init(Cipher.ENCRYPT_MODE, publicKey); // 对数据分段 byte[] b = data.getBytes(); int inputLen = b.length; ByteArrayOutputStream out = new ByteArrayOutputStream(); int offSet = 0; byte[] cache; int i = 0; while (inputLen - offSet > 0) { if (inputLen - offSet > MAX_ENCRYPT_BLOCK) { cache = cipher.doFinal(b, offSet, MAX_ENCRYPT_BLOCK); } else { cache = cipher.doFinal(b, offSet, inputLen - offSet); } out.write(cache, 0, cache.length); i++; offSet = i * MAX_ENCRYPT_BLOCK; } return out.toByteArray(); } public static byte[] decrypt(byte[] data, final org.bouncycastle.asn1.pkcs.RSAPublicKey rsaPublicKey) throws Exception { Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); Cipher cipher = Cipher.getInstance("RSA/None/PKCS1Padding", "BC"); Key publicKey = new java.security.interfaces.RSAPublicKey() { @Override public BigInteger getPublicExponent() { return rsaPublicKey.getPublicExponent(); } @Override public String getAlgorithm() { return "RSA"; } @Override public String getFormat() { return null; } @Override public byte[] getEncoded() { return new byte[0]; } @Override public BigInteger getModulus() { return rsaPublicKey.getModulus(); } }; cipher.init(Cipher.DECRYPT_MODE, publicKey); // 对数据分段解密 byte[] b = data; int inputLen = b.length; ByteArrayOutputStream out = new ByteArrayOutputStream(); int offSet = 0; byte[] cache; int i = 0; while (inputLen - offSet > 0) { if (inputLen - offSet > MAX_DECRYPT_BLOCK) { cache = cipher.doFinal(b, offSet, MAX_DECRYPT_BLOCK); } else { cache = cipher.doFinal(b, offSet, inputLen - offSet); } out.write(cache, 0, cache.length); i++; offSet = i * MAX_DECRYPT_BLOCK; } return out.toByteArray(); } public static byte[] encrypt(String data, final org.bouncycastle.asn1.pkcs.RSAPrivateKey rsaPrivateKey) throws Exception { Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); Cipher cipher = Cipher.getInstance("RSA/None/PKCS1Padding", "BC"); Key privateKey = new java.security.interfaces.RSAPrivateKey() { @Override public BigInteger getPrivateExponent() { return rsaPrivateKey.getPrivateExponent(); } @Override public String getAlgorithm() { return null; } @Override public String getFormat() { return null; } @Override public byte[] getEncoded() { return new byte[0]; } @Override public BigInteger getModulus() { return rsaPrivateKey.getModulus(); } }; cipher.init(Cipher.ENCRYPT_MODE, privateKey); // 对数据分段 byte[] b = data.getBytes(); int inputLen = b.length; ByteArrayOutputStream out = new ByteArrayOutputStream(); int offSet = 0; byte[] cache; int i = 0; while (inputLen - offSet > 0) { if (inputLen - offSet > MAX_ENCRYPT_BLOCK) { cache = cipher.doFinal(b, offSet, MAX_ENCRYPT_BLOCK); } else { cache = cipher.doFinal(b, offSet, inputLen - offSet); } out.write(cache, 0, cache.length); i++; offSet = i * MAX_ENCRYPT_BLOCK; } return out.toByteArray(); } public static byte[] decrypt(byte[] data, final org.bouncycastle.asn1.pkcs.RSAPrivateKey rsaPrivateKey) throws Exception{ Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); Cipher cipher = Cipher.getInstance("RSA/None/PKCS1Padding", "BC"); Key privateKey = new java.security.interfaces.RSAPrivateKey() { @Override public BigInteger getPrivateExponent() { return rsaPrivateKey.getPrivateExponent(); } @Override public String getAlgorithm() { return null; } @Override public String getFormat() { return null; } @Override public byte[] getEncoded() { return new byte[0]; } @Override public BigInteger getModulus() { return rsaPrivateKey.getModulus(); } }; cipher.init(Cipher.DECRYPT_MODE, privateKey); // 对数据分段解密 byte[] b = data; int inputLen = b.length; ByteArrayOutputStream out = new ByteArrayOutputStream(); int offSet = 0; byte[] cache; int i = 0; while (inputLen - offSet > 0) { if (inputLen - offSet > MAX_DECRYPT_BLOCK) { cache = cipher.doFinal(b, offSet, MAX_DECRYPT_BLOCK); } else { cache = cipher.doFinal(b, offSet, inputLen - offSet); } out.write(cache, 0, cache.length); i++; offSet = i * MAX_DECRYPT_BLOCK; } return out.toByteArray(); } // ================================== 获取pem ================================ public static ASN1Primitive getPublicKeyFromPem2(String pem) throws Exception { if(TextUtils.isEmpty(pem))throw new Exception("pem文件为空"); String privKeyPEM = pem.replace( "-----BEGIN RSA PUBLIC KEY-----\n", "") .replace("-----END RSA PUBLIC KEY-----", ""); // Base64 decode the data byte[] encodedPrivateKey = Base64.decode(privKeyPEM, Base64.DEFAULT); ASN1Sequence primitive = (ASN1Sequence) ASN1Sequence .fromByteArray(encodedPrivateKey); return primitive.parser().getLoadedObject(); } public static ASN1Primitive getPrivateKeyFromPem2(String pem) throws Exception { if(TextUtils.isEmpty(pem))throw new Exception("pem文件为空"); String privKeyPEM = pem.replace( "-----BEGIN RSA PRIVATE KEY-----\n", "") .replace("-----END RSA PRIVATE KEY-----", ""); // Base64 decode the data byte[] encodedPrivateKey = Base64.decode(privKeyPEM, Base64.DEFAULT); ASN1Sequence primitive = (ASN1Sequence) ASN1Sequence .fromByteArray(encodedPrivateKey); return primitive.parser().getLoadedObject(); } public static PrivateKey getPrivateKeyFromPem(String pem) throws Exception { String privKeyPEM = pem.replace( "-----BEGIN RSA PRIVATE KEY-----\n", "") .replace("-----END RSA PRIVATE KEY-----", ""); // Base64 decode the data byte[] encodedPrivateKey = Base64.decode(privKeyPEM, Base64.DEFAULT); try { ASN1Sequence primitive = (ASN1Sequence) ASN1Sequence .fromByteArray(encodedPrivateKey); Enumeration<?> e = primitive.getObjects(); BigInteger v = ((ASN1Integer) e.nextElement()).getValue(); int version = v.intValue(); if (version != 0 && version != 1) { throw new IllegalArgumentException("wrong version for RSA private key"); } /** * In fact only modulus and private exponent are in use. */ BigInteger modulus = ((ASN1Integer) e.nextElement()).getValue(); // BigInteger publicExponent = ((ASN1Integer) e.nextElement()).getValue(); BigInteger privateExponent = ((ASN1Integer) e.nextElement()).getValue(); // BigInteger prime1 = ((ASN1Integer) e.nextElement()).getValue(); // BigInteger prime2 = ((ASN1Integer) e.nextElement()).getValue(); // BigInteger exponent1 = ((ASN1Integer) e.nextElement()).getValue(); // BigInteger exponent2 = ((ASN1Integer) e.nextElement()).getValue(); // BigInteger coefficient = ((ASN1Integer) e.nextElement()).getValue(); RSAPrivateKeySpec spec = new RSAPrivateKeySpec(modulus, privateExponent); KeyFactory kf = KeyFactory.getInstance("RSA"); PrivateKey pk = kf.generatePrivate(spec); return pk; } catch (IOException e2) { throw new IllegalStateException(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } catch (InvalidKeySpecException e) { throw new IllegalStateException(e); } } public static PublicKey getPublicKeyFromPem(String pem) throws Exception { String privKeyPEM = pem.replace( "-----BEGIN RSA PUBLIC KEY-----\n", "") .replace("-----END RSA PUBLIC KEY-----", ""); // Base64 decode the data byte[] encodedPrivateKey = Base64.decode(privKeyPEM, Base64.DEFAULT); try { ASN1Sequence primitive = (ASN1Sequence) ASN1Sequence .fromByteArray(encodedPrivateKey); Enumeration<?> e = primitive.getObjects(); BigInteger v = ((DERInteger) e.nextElement()).getValue(); int version = v.intValue(); if (version != 0 && version != 1) { throw new IllegalArgumentException("wrong version for RSA private key"); } /** * In fact only modulus and private exponent are in use. */ BigInteger modulus = ((DERInteger) e.nextElement()).getValue(); BigInteger publicExponent = ((DERInteger) e.nextElement()).getValue(); BigInteger privateExponent = ((DERInteger) e.nextElement()).getValue(); BigInteger prime1 = ((DERInteger) e.nextElement()).getValue(); BigInteger prime2 = ((DERInteger) e.nextElement()).getValue(); BigInteger exponent1 = ((DERInteger) e.nextElement()).getValue(); BigInteger exponent2 = ((DERInteger) e.nextElement()).getValue(); BigInteger coefficient = ((DERInteger) e.nextElement()).getValue(); RSAPublicKeySpec spec = new RSAPublicKeySpec(modulus, publicExponent); KeyFactory kf = KeyFactory.getInstance("RSA"); PublicKey pk = kf.generatePublic(spec); return pk; } catch (IOException e2) { throw new IllegalStateException(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } catch (InvalidKeySpecException e) { throw new IllegalStateException(e); } } }
92350d25d8ff8180bbac6070e9b2874a0204bf63
21d2407421597848a7259936785a82afa77d8cec
/src/main/java/com/rsoft/app/model/UserDetails.java
7d0ed6dc2eab84c7496f32fc217d310ba0a0e132
[ "Apache-2.0" ]
permissive
Kirtish/spring-data-jpa
8c544ff0293974a99fa0196fc048a82c3eb98a26
1fec24713b618710f9a30db2717efb34a6c1747a
refs/heads/master
2016-09-10T18:24:29.100922
2015-10-13T16:09:02
2015-10-13T16:09:02
28,299,252
0
0
null
null
null
null
UTF-8
Java
false
false
3,348
java
package com.rsoft.app.model; import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.social.security.SocialUser; import com.rsoft.app.domain.SocialMediaService; import com.rsoft.app.domain.SocialRole; public class UserDetails extends SocialUser { public UserDetails(String username, String password, Collection<? extends GrantedAuthority> authorities) { super(username, password, authorities); } private Long id; private String firstName; private String lastName; private SocialRole role; private SocialMediaService socialSignInProvider; private String email; public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public static Builder getBuilder(){ return new Builder(); } // Getters are omitted for the sake of clarity. 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 SocialRole getRole() { return role; } public void setRole(SocialRole role) { this.role = role; } public SocialMediaService getSocialSignInProvider() { return socialSignInProvider; } public void setSocialSignInProvider(SocialMediaService socialSignInProvider) { this.socialSignInProvider = socialSignInProvider; } public static class Builder { private Long id; private String username; private String firstName; private String lastName; private String password; private SocialRole role; private SocialMediaService socialSignInProvider; private Set<GrantedAuthority> authorities; private String email; public Builder email(String email) { this.email = email; return this; } public Builder() { this.authorities = new HashSet<GrantedAuthority>(); } public Builder firstName(String firstName) { this.firstName = firstName; return this; } public Builder id(Long id) { this.id = id; return this; } public Builder lastName(String lastName) { this.lastName = lastName; return this; } public Builder password(String password) { if (password == null) { password = "SocialUser"; } this.password = password; return this; } public Builder role(SocialRole role) { this.role = role; SimpleGrantedAuthority authority = new SimpleGrantedAuthority( role.toString()); this.authorities.add(authority); return this; } public Builder socialSignInProvider( SocialMediaService socialSignInProvider) { this.socialSignInProvider = socialSignInProvider; return this; } public Builder username(String username) { this.username = username; return this; } public UserDetails build() { UserDetails user = new UserDetails(username, password, authorities); user.id = id; user.firstName = firstName; user.lastName = lastName; user.role = role; user.socialSignInProvider = socialSignInProvider; return user; } } }
f313dc0658d53ed9fd0dbd308e9fb34ecddb12b4
b9f4249b905f423c6ebb905babcf3c64b523248f
/src/main/java/ua/edu/ucu/smartarr/DistinctDecorator.java
3df50a4eb763bb1aaf00d5c0a6c37aca694d9ff9
[]
no_license
LvivD/apps19sahaidak-hw3
4a786953d47cbb0c5054b25316a03cf0b14d7366
b8bc75534e6104222b8a1cde092617f0f04b3eb5
refs/heads/master
2021-07-20T06:27:40.686236
2019-11-22T20:30:03
2019-11-22T20:30:03
222,085,413
0
0
null
2020-10-13T17:30:22
2019-11-16T10:53:29
Java
UTF-8
Java
false
false
1,135
java
package ua.edu.ucu.smartarr; import java.util.Arrays; // Remove duplicates from SmartArray. Use method equals() to compare objects public class DistinctDecorator extends SmartArrayDecorator { public DistinctDecorator(SmartArray smartArray) { super(smartArray); } private Object[] arrWithoutRepeats(Object[] arr) { Object[] newArr = new Object[arr.length]; int n = 0; for (int i = 0; i < arr.length; i++) { boolean ifRepeats = false; for (int j = 0; j < i; j++) { if (arr[i].equals(arr[j])) { ifRepeats = true; break; } } if (!ifRepeats) { newArr[n] = arr[i]; n++; } } return Arrays.copyOf(newArr, n); } @Override public Object[] toArray() { return arrWithoutRepeats(this.smartArray.toArray()); } @Override public String operationDescription() { return "DistinctDecorator"; } @Override public int size() { return this.toArray().length; } }
5d86545ffa5c34866e04160d99a57d7d0cc533f7
33b2f42275f3e02db4a5afdb31593952ce195d28
/src/main/java/com/sissi/server/exchange/ExchangerContext.java
02b0d377e346353614076011afd7117b66974a5c
[ "Apache-2.0" ]
permissive
xintao222/sissi
6c41d8aac0c6c0d843ba504ecfed3f99a62a536f
1b2da0676ba54596d2e9a8b3f09038b46d04190d
refs/heads/master
2020-12-06T19:15:54.396294
2014-04-11T11:10:05
2014-04-11T11:10:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package com.sissi.server.exchange; import com.sissi.write.Transfer; /** * @author kim 2013年12月22日 */ public interface ExchangerContext { public Exchanger join(String host, boolean induct, Transfer transfer); public Exchanger active(String host); public boolean exists(String host); }
0681d904a1008cbb7977d65f05d411b3659e0d9e
2a9555370d95d2ae0cbfa2243ee7a3fc75821564
/src/main/java/com/tmassalski/bankapp/infrastructure/account/AccountRepository.java
b49d7b529171498c5865f230383da11a0efb59e1
[]
no_license
tmassalski/Bank-app
57536cded064d13cbd8a56dcf5368cee1c0cb13d
0ae0c2465f0687f2dce5e987b07596ce4dbf171e
refs/heads/master
2023-01-22T13:15:16.748235
2020-06-12T00:50:47
2020-06-12T00:50:47
315,434,726
0
0
null
null
null
null
UTF-8
Java
false
false
343
java
package com.tmassalski.bankapp.infrastructure.account; import com.tmassalski.bankapp.domain.account.Account; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; public interface AccountRepository extends JpaRepository<Account, Long> { Optional<Account> findByAccountNumber(String accountNumber); }
77dce77a526d67755541877d771a6c40cb42cde8
8ef5fb2159169885a644eabbe7159727307a083a
/client.java
d9fef77ea4fb3900acf8635ba308ee0d144f1f0e
[ "Apache-2.0" ]
permissive
retq/PasswordCracker
ac7f3417988fd660dd7d9a39a64ac657efa35016
11cda6925f43fe61019232d1b5d1e39c01f295ed
refs/heads/main
2023-04-25T23:08:45.149867
2021-06-03T14:23:35
2021-06-03T14:23:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,057
java
import java.io.*; import java.net.*; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.logging.Level; import java.util.logging.Logger; public class Client { static final int portNumber = 8003; static final String serverIP = "127.0.0.1"; // localhost static int clientTrialNumber = 0; static String date, actualHashPassword; static BufferedReader brIN; static PrintStream psOUT; static Socket clientSocket; static MessageDigest md; static String mesgSentToServer; static int range; public static void main(String args[]){ System.out.println("\n**** Distributed Password Breaker ****"); System.out.println("**************** Client **************"); try { md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException ex) { Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex); } date = getSystemDate(); getConnectedToServer(); clientTrialNumber++; while(clientTrialNumber <= 4){ range = getRangeFromServer(); printIntoSystem(clientTrialNumber); mesgSentToServer = doCrackingPassword(); if(mesgSentToServer.equals("fail")){ System.out.print("\nCan't find password."); if(clientTrialNumber != 4) System.out.print(" request for another packet..."); psOUT.println(mesgSentToServer); clientTrialNumber++; }else{ System.out.println("Got password. It is: " + mesgSentToServer); psOUT.println("success"); while(true){} } } getDisconnectedFromServer(); } /** * this method crack the password * @return "success" if password matches or "fail" if password doesn't match */ public static String doCrackingPassword(){ String value, temp, generatedHash; int value_length; long lower_limit, upper_limit; lower_limit = 1000000 * range; //1,000,000 upper_limit = lower_limit + (1000000-1); for (long i = lower_limit; i <= upper_limit; i++) { value = Long.toString(i, 36); StringBuilder sb = new StringBuilder(value); //if generating password is less than 5 character if ((value.length()) < 5) { for (int j = 0; j < 5 - (value.length()); j++) { sb.insert(j, "0"); } temp = sb.toString().toUpperCase(); generatedHash = generateHash(temp); } else { temp = value.toUpperCase(); generatedHash = generateHash(temp); } if(compareHash(actualHashPassword, generatedHash)){ return temp; } } return "fail"; } /** * this method is for getting system date. */ public static String getSystemDate(){ DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); Calendar cal = Calendar.getInstance(); String date = (dateFormat.format(cal.getTime())).toString(); return date; } /** * this method is for generating password hash. */ public static String generateHash(String crackPassword) { byte[] byteData; StringBuffer sb = new StringBuffer(); md.update((crackPassword + date).getBytes()); byteData = md.digest(); for (int i = 0; i < byteData.length; i++) { sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1)); } return new String(sb); } /** * this method is for comparing given hash from server with generating password hash. */ public static boolean compareHash(String givenHash, String generatedHash){ if(givenHash.equals(generatedHash)) return true; else return false; } /** * this method is for getting connected form server. */ public static void getConnectedToServer() { try { clientSocket = new Socket(serverIP, portNumber); System.out.println("Server connection established\n"); brIN = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); psOUT = new PrintStream(clientSocket.getOutputStream()); //for writing } catch (IOException ex) { } } /** * this method is for getting disconnected form server. */ public static void getDisconnectedFromServer(){ try { clientSocket.close(); brIN.close(); psOUT.close(); System.out.println("\nConnection lost from server"); } catch (IOException ex) { } } /** * this method is for getting range from server. */ public static int getRangeFromServer(){ String sendMsg = "", receiveRange = ""; try { receiveRange = brIN.readLine(); actualHashPassword = brIN.readLine(); } catch (IOException ex) { } return Integer.parseInt(receiveRange); } /** * this method print client range and data packet in command prompt. * @param dataReceiveNo */ public static void printIntoSystem(int dataReceiveNo) { long lower_limit = 1000000 * range; //1,000,000 long upper_limit = lower_limit + (1000000 - 1); String sLower_limit = Long.toString(lower_limit, 36); String sUpper_limit = Long.toString(upper_limit, 36); if ((sLower_limit.length()) < 5) { StringBuilder sb = new StringBuilder(sLower_limit); for (int j = 0; j < 5 - (sLower_limit.length()); j++) { sb.insert(j, "0"); } sLower_limit = sb.toString().toUpperCase(); } if ((sUpper_limit.length()) < 5) { StringBuilder sb = new StringBuilder(sUpper_limit); for (int j = 0; j < 5 - (sUpper_limit.length()); j++) { sb.insert(j, "0"); } sUpper_limit = sb.toString().toUpperCase(); } System.out.println("\n" + "Get data packet_" + dataReceiveNo +" from server"); System.out.println("Start cracking password with given Range: " + sLower_limit.toUpperCase() + " to " + sUpper_limit.toUpperCase()); } }
ad921a780b7aae3c6c3065647bb68bffd30a82a3
87cb582539377c162ca3cd2d38d15740293f0966
/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSource.java
f57b60017ca32395854acaaf13ef032869660ffa
[ "Apache-2.0" ]
permissive
TACHAI/study_spring_source
37723b9d63c303063f4cb72f28dd36984f96593b
ca59f2e922aaebe0de4fd5dea112dbe6daa5bfe9
refs/heads/master
2022-11-07T15:39:02.557035
2020-06-17T13:08:17
2020-06-17T13:08:17
272,933,657
0
0
null
null
null
null
UTF-8
Java
false
false
5,642
java
/* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.jdbc.core.namedparam; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import org.springframework.jdbc.core.SqlParameterValue; import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.StringUtils; /** * {@link SqlParameterSource} implementation that holds a given Map of parameters. * * <p>This class is intended for passing in a simple Map of parameter values * to the methods of the {@link NamedParameterJdbcTemplate} class. * * <p>The {@code addValue} methods on this class will make adding several values * easier. The methods return a reference to the {@link MapSqlParameterSource} * itself, so you can chain several method calls together within a single statement. * * @author Thomas Risberg * @author Juergen Hoeller * @since 2.0 * @see #addValue(String, Object) * @see #addValue(String, Object, int) * @see #registerSqlType * @see NamedParameterJdbcTemplate */ public class MapSqlParameterSource extends AbstractSqlParameterSource { private final Map<String, Object> values = new LinkedHashMap<>(); /** * Create an empty MapSqlParameterSource, * with values to be added via {@code addValue}. * @see #addValue(String, Object) */ public MapSqlParameterSource() { } /** * Create a new MapSqlParameterSource, with one value * comprised of the supplied arguments. * @param paramName the name of the parameter * @param value the value of the parameter * @see #addValue(String, Object) */ public MapSqlParameterSource(String paramName, Object value) { addValue(paramName, value); } /** * Create a new MapSqlParameterSource based on a Map. * @param values a Map holding existing parameter values (can be {@code null}) */ public MapSqlParameterSource(@Nullable Map<String, ?> values) { addValues(values); } /** * Add a parameter to this parameter source. * @param paramName the name of the parameter * @param value the value of the parameter * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValue(String paramName, Object value) { Assert.notNull(paramName, "Parameter name must not be null"); this.values.put(paramName, value); if (value instanceof SqlParameterValue) { registerSqlType(paramName, ((SqlParameterValue) value).getSqlType()); } return this; } /** * Add a parameter to this parameter source. * @param paramName the name of the parameter * @param value the value of the parameter * @param sqlType the SQL type of the parameter * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValue(String paramName, Object value, int sqlType) { Assert.notNull(paramName, "Parameter name must not be null"); this.values.put(paramName, value); registerSqlType(paramName, sqlType); return this; } /** * Add a parameter to this parameter source. * @param paramName the name of the parameter * @param value the value of the parameter * @param sqlType the SQL type of the parameter * @param typeName the type name of the parameter * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValue(String paramName, Object value, int sqlType, String typeName) { Assert.notNull(paramName, "Parameter name must not be null"); this.values.put(paramName, value); registerSqlType(paramName, sqlType); registerTypeName(paramName, typeName); return this; } /** * Add a Map of parameters to this parameter source. * @param values a Map holding existing parameter values (can be {@code null}) * @return a reference to this parameter source, * so it's possible to chain several calls together */ public MapSqlParameterSource addValues(@Nullable Map<String, ?> values) { if (values != null) { values.forEach((key, value) -> { this.values.put(key, value); if (value instanceof SqlParameterValue) { registerSqlType(key, ((SqlParameterValue) value).getSqlType()); } }); } return this; } /** * Expose the current parameter values as read-only Map. */ public Map<String, Object> getValues() { return Collections.unmodifiableMap(this.values); } @Override public boolean hasValue(String paramName) { return this.values.containsKey(paramName); } @Override @Nullable public Object getValue(String paramName) { if (!hasValue(paramName)) { throw new IllegalArgumentException("No value registered for key '" + paramName + "'"); } return this.values.get(paramName); } @Override @Nullable public String[] getParameterNames() { return StringUtils.toStringArray(this.values.keySet()); } }
2f2b101cfa36eabfcae6f0ccadd0deb6229e6c84
066461f5a76e30db723bbdcdcaa49ab4fb3f1c77
/DataStructures/src/com/rockwellcollins/cs/hcms/core/CoreException.java
c9b884c0cce4a2763168611c3bceeba0abb3da3f
[]
no_license
faizalsheriffk/freetime-coding
36cfb7887e74ca2d90fa6b7bc384de02159660cb
a621a54da0ec3f50b27deb4a12e51b67ff95523a
refs/heads/master
2021-05-31T15:21:21.368916
2016-03-11T04:35:24
2016-03-11T04:35:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
898
java
package com.rockwellcollins.cs.hcms.core; /** * Base exception for the Core Framework * @author getownse * */ public class CoreException extends Exception { private static final long serialVersionUID = 1L; /** * Create a new core exception */ public CoreException() { super(); } /** * Create a new core exception with descriptive error * @param error descriptive error */ public CoreException(final String error) { super(error); } /** * Create a new core exception with descriptive error and inner exception * @param error descriptive error * @param exception inner exception */ public CoreException(final String error, final Throwable exception) { super(error, exception); } /** * Create a new core exception with inner exception * @param exception inner exception */ public CoreException(final Throwable exception) { super(exception); } }
aa0b1776ca343b79c5839be2dd6ab3229c658284
ca6ed1b41ccc5d8ac491aaa077c9974f443d8c94
/mall-geteway/src/test/java/com/yp/mallgeteway/MallGetewayApplicationTests.java
17212a8387f475f2c6c09df362cfdab30fdf7a8a
[]
no_license
yanping1/guli-mall
2b7996f6f5477c315ac7ad8ef8076913d3081fe9
60a0a6d9283f29bb1c0295639497ef76a9ed8f46
refs/heads/master
2023-07-01T12:56:57.413042
2021-08-06T09:26:23
2021-08-06T09:26:23
388,312,493
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
package com.yp.mallgeteway; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class MallGetewayApplicationTests { @Test void contextLoads() { } }
fd9483d0643d23855cced0a4d9ba8445e3f0c2ec
ba18cc56ca3d0497225b0b7c72485ee4f74ef797
/src/test/java/org/gsc/core/operator/ExchangeTransactionOperatorTest.java
597657f3e79fb2f71a1da4f8e5d45f085b69602f
[]
no_license
EvanYip/gsc-core
491e4f2bfba5ea5beca04273c4deaaf974122450
cb55c725c9fd5a9766a56bae0ab669a688221830
refs/heads/master
2020-04-12T22:35:18.455258
2019-01-15T01:38:31
2019-01-15T01:38:31
162,792,931
1
0
null
2018-12-22T07:59:11
2018-12-22T07:59:11
null
UTF-8
Java
false
false
23,667
java
package org.gsc.core.operator; import static org.testng.Assert.fail; import com.google.protobuf.Any; import com.google.protobuf.ByteString; import java.io.File; import java.util.Arrays; import java.util.Map; import lombok.extern.slf4j.Slf4j; import org.gsc.config.DefaultConfig; import org.gsc.config.args.Args; import org.gsc.core.wrapper.AccountWrapper; import org.gsc.core.wrapper.ExchangeWrapper; import org.gsc.core.wrapper.TransactionResultWrapper; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.gsc.common.utils.ByteArray; import org.gsc.common.utils.FileUtil; import org.gsc.core.Constant; import org.gsc.core.Wallet; import org.gsc.db.Manager; import org.gsc.core.exception.ContractExeException; import org.gsc.core.exception.ContractValidateException; import org.gsc.core.exception.ItemNotFoundException; import org.gsc.protos.Contract; import org.gsc.protos.Protocol.AccountType; import org.gsc.protos.Protocol.Transaction.Result.code; @Slf4j public class ExchangeTransactionOperatorTest { private static AnnotationConfigApplicationContext context; private static Manager dbManager; private static final String dbPath = "output_ExchangeTransaction_test"; private static final String ACCOUNT_NAME_FIRST = "ownerF"; private static final String OWNER_ADDRESS_FIRST; private static final String ACCOUNT_NAME_SECOND = "ownerS"; private static final String OWNER_ADDRESS_SECOND; private static final String URL = "https://gscan.social"; private static final String OWNER_ADDRESS_INVALID = "aaaa"; private static final String OWNER_ADDRESS_NOACCOUNT; private static final String OWNER_ADDRESS_BALANCENOTSUFFIENT; static { Args.setParam(new String[]{"--output-directory", dbPath}, Constant.TEST_CONF); context = new AnnotationConfigApplicationContext(DefaultConfig.class); OWNER_ADDRESS_FIRST = Wallet.getAddressPreFixString() + "abd4b9367799eaa3197fecb144eb71de1e049abc"; OWNER_ADDRESS_SECOND = Wallet.getAddressPreFixString() + "548794500882809695a8a687866e76d4271a1abc"; OWNER_ADDRESS_NOACCOUNT = Wallet.getAddressPreFixString() + "548794500882809695a8a687866e76d4271a1aed"; OWNER_ADDRESS_BALANCENOTSUFFIENT = Wallet.getAddressPreFixString() + "548794500882809695a8a687866e06d4271a1ced"; } /** * Init data. */ @BeforeClass public static void init() { dbManager = context.getBean(Manager.class); } /** * Release resources. */ @AfterClass public static void destroy() { Args.clearParam(); if (FileUtil.deleteDir(new File(dbPath))) { logger.info("Release resources successful."); } else { logger.info("Release resources failure."); } context.destroy(); } /** * create temp Capsule test need. */ @Before public void initTest() { AccountWrapper ownerAccountFirstCapsule = new AccountWrapper( ByteString.copyFromUtf8(ACCOUNT_NAME_FIRST), ByteString.copyFrom(ByteArray.fromHexString(OWNER_ADDRESS_FIRST)), AccountType.Normal, 10000_000_000L); AccountWrapper ownerAccountSecondCapsule = new AccountWrapper( ByteString.copyFromUtf8(ACCOUNT_NAME_SECOND), ByteString.copyFrom(ByteArray.fromHexString(OWNER_ADDRESS_SECOND)), AccountType.Normal, 20000_000_000L); ExchangeWrapper exchangeWrapper = new ExchangeWrapper( ByteString.copyFrom(ByteArray.fromHexString(OWNER_ADDRESS_FIRST)), 1, 1000000, "_".getBytes(), "abc".getBytes()); exchangeWrapper.setBalance(1_000_000_000_000L, 10_000_000L); // 1M TRX == 10M abc ExchangeWrapper exchangeWrapper2 = new ExchangeWrapper( ByteString.copyFrom(ByteArray.fromHexString(OWNER_ADDRESS_FIRST)), 2, 1000000, "abc".getBytes(), "def".getBytes()); exchangeWrapper2.setBalance(100000000L, 200000000L); dbManager.getAccountStore() .put(ownerAccountFirstCapsule.getAddress().toByteArray(), ownerAccountFirstCapsule); dbManager.getAccountStore() .put(ownerAccountSecondCapsule.getAddress().toByteArray(), ownerAccountSecondCapsule); dbManager.getExchangeStore() .put(exchangeWrapper.createDbKey(), exchangeWrapper); dbManager.getExchangeStore() .put(exchangeWrapper2.createDbKey(), exchangeWrapper2); dbManager.getDynamicPropertiesStore().saveLatestBlockHeaderTimestamp(1000000); dbManager.getDynamicPropertiesStore().saveLatestBlockHeaderNumber(10); dbManager.getDynamicPropertiesStore().saveNextMaintenanceTime(2000000); } private Any getContract(String address, long exchangeId, String tokenId, long quant) { return Any.pack( Contract.ExchangeTransactionContract.newBuilder() .setOwnerAddress(ByteString.copyFrom(ByteArray.fromHexString(address))) .setExchangeId(exchangeId) .setTokenId(ByteString.copyFrom(tokenId.getBytes())) .setQuant(quant) .build()); } /** * first transaction Exchange,result is success. */ @Test public void successExchangeTransaction() { long exchangeId = 1; String tokenId = "_"; long quant = 100_000_000L; // use 100 TRX to buy abc byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); Map<String, Long> assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L, accountWrapper.getBalance()); Assert.assertEquals(null, assetMap.get("def")); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_SECOND, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { ExchangeWrapper exchangeWrapper = dbManager.getExchangeStore() .get(ByteArray.fromLong(exchangeId)); Assert.assertNotNull(exchangeWrapper); long firstTokenBalance = exchangeWrapper.getFirstTokenBalance(); long secondTokenBalance = exchangeWrapper.getSecondTokenBalance(); Assert.assertEquals(exchangeId, exchangeWrapper.getID()); Assert.assertEquals(tokenId, ByteArray.toStr(exchangeWrapper.getFirstTokenId())); Assert.assertEquals(1_000_000_000_000L, firstTokenBalance); Assert.assertEquals("abc", ByteArray.toStr(exchangeWrapper.getSecondTokenId())); Assert.assertEquals(10_000_000L, secondTokenBalance); actuator.validate(); actuator.execute(ret); Assert.assertEquals(ret.getInstance().getRet(), code.SUCESS); exchangeWrapper = dbManager.getExchangeStore().get(ByteArray.fromLong(exchangeId)); Assert.assertNotNull(exchangeWrapper); Assert.assertEquals(exchangeId, exchangeWrapper.getID()); Assert.assertEquals(1000000, exchangeWrapper.getCreateTime()); Assert.assertTrue(Arrays.equals(tokenId.getBytes(), exchangeWrapper.getFirstTokenId())); Assert.assertEquals(tokenId, ByteArray.toStr(exchangeWrapper.getFirstTokenId())); Assert.assertEquals(firstTokenBalance + quant, exchangeWrapper.getFirstTokenBalance()); Assert.assertEquals("abc", ByteArray.toStr(exchangeWrapper.getSecondTokenId())); Assert.assertEquals(9999001L, exchangeWrapper.getSecondTokenBalance()); accountWrapper = dbManager.getAccountStore().get(ownerAddress); assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L - quant, accountWrapper.getBalance()); Assert.assertEquals(999L, assetMap.get("abc").longValue()); } catch (ContractValidateException e) { logger.info(e.getMessage()); Assert.assertFalse(e instanceof ContractValidateException); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } catch (ItemNotFoundException e) { Assert.assertFalse(e instanceof ItemNotFoundException); } } /** * second transaction Exchange,result is success. */ @Test public void successExchangeTransaction2() { long exchangeId = 2; String tokenId = "abc"; long quant = 1_000L; String buyTokenId = "def"; byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); accountWrapper.addAssetAmount(tokenId.getBytes(), 10000); Map<String, Long> assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L, accountWrapper.getBalance()); Assert.assertEquals(null, assetMap.get(buyTokenId)); dbManager.getAccountStore().put(accountWrapper.createDbKey(), accountWrapper); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_SECOND, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { ExchangeWrapper exchangeWrapper = dbManager.getExchangeStore() .get(ByteArray.fromLong(exchangeId)); Assert.assertNotNull(exchangeWrapper); long firstTokenBalance = exchangeWrapper.getFirstTokenBalance(); long secondTokenBalance = exchangeWrapper.getSecondTokenBalance(); Assert.assertEquals(exchangeId, exchangeWrapper.getID()); Assert.assertEquals(tokenId, ByteArray.toStr(exchangeWrapper.getFirstTokenId())); Assert.assertEquals(100000000L, firstTokenBalance); Assert.assertEquals("def", ByteArray.toStr(exchangeWrapper.getSecondTokenId())); Assert.assertEquals(200000000L, secondTokenBalance); actuator.validate(); actuator.execute(ret); Assert.assertEquals(ret.getInstance().getRet(), code.SUCESS); exchangeWrapper = dbManager.getExchangeStore().get(ByteArray.fromLong(exchangeId)); Assert.assertNotNull(exchangeWrapper); Assert.assertEquals(exchangeId, exchangeWrapper.getID()); Assert.assertEquals(1000000, exchangeWrapper.getCreateTime()); Assert.assertTrue(Arrays.equals(tokenId.getBytes(), exchangeWrapper.getFirstTokenId())); Assert.assertEquals(tokenId, ByteArray.toStr(exchangeWrapper.getFirstTokenId())); Assert.assertEquals(firstTokenBalance + quant, exchangeWrapper.getFirstTokenBalance()); Assert.assertEquals("def", ByteArray.toStr(exchangeWrapper.getSecondTokenId())); Assert.assertEquals(199998001L, exchangeWrapper.getSecondTokenBalance()); accountWrapper = dbManager.getAccountStore().get(ownerAddress); assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(9000L, assetMap.get("abc").longValue()); Assert.assertEquals(1999L, assetMap.get("def").longValue()); } catch (ContractValidateException e) { logger.info(e.getMessage()); Assert.assertFalse(e instanceof ContractValidateException); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } catch (ItemNotFoundException e) { Assert.assertFalse(e instanceof ItemNotFoundException); } } /** * use Invalid Address, result is failed, exception is "Invalid address". */ @Test public void invalidAddress() { long exchangeId = 2; String tokenId = "abc"; long quant = 1_000L; String buyTokenId = "def"; byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); accountWrapper.addAssetAmount(tokenId.getBytes(), 10000); Map<String, Long> assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L, accountWrapper.getBalance()); Assert.assertEquals(null, assetMap.get(buyTokenId)); dbManager.getAccountStore().put(accountWrapper.createDbKey(), accountWrapper); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_INVALID, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { actuator.validate(); actuator.execute(ret); fail("Invalid address"); } catch (ContractValidateException e) { Assert.assertTrue(e instanceof ContractValidateException); Assert.assertEquals("Invalid address", e.getMessage()); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } } /** * use AccountStore not exists, result is failed, exception is "account not exists". */ @Test public void noAccount() { long exchangeId = 2; String tokenId = "abc"; long quant = 1_000L; String buyTokenId = "def"; byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); accountWrapper.addAssetAmount(tokenId.getBytes(), 10000); Map<String, Long> assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L, accountWrapper.getBalance()); Assert.assertEquals(null, assetMap.get(buyTokenId)); dbManager.getAccountStore().put(accountWrapper.createDbKey(), accountWrapper); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_NOACCOUNT, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { actuator.validate(); actuator.execute(ret); fail("account[+OWNER_ADDRESS_NOACCOUNT+] not exists"); } catch (ContractValidateException e) { Assert.assertTrue(e instanceof ContractValidateException); Assert.assertEquals("account[" + OWNER_ADDRESS_NOACCOUNT + "] not exists", e.getMessage()); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } } /** * Exchange not exists */ @Test public void exchangeNotExist() { long exchangeId = 3; String tokenId = "abc"; long quant = 1_000L; String buyTokenId = "def"; byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); accountWrapper.addAssetAmount(tokenId.getBytes(), 10000); Map<String, Long> assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L, accountWrapper.getBalance()); Assert.assertEquals(null, assetMap.get(buyTokenId)); dbManager.getAccountStore().put(accountWrapper.createDbKey(), accountWrapper); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_SECOND, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { actuator.validate(); actuator.execute(ret); fail("Exchange not exists"); } catch (ContractValidateException e) { Assert.assertTrue(e instanceof ContractValidateException); Assert.assertEquals("Exchange[3] not exists", e.getMessage()); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } } /** * token is not in exchange */ @Test public void tokenIsNotInExchange() { long exchangeId = 1; String tokenId = "ddd"; long quant = 1_000L; String buyTokenId = "def"; byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); accountWrapper.addAssetAmount(tokenId.getBytes(), 10000); Map<String, Long> assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L, accountWrapper.getBalance()); Assert.assertEquals(null, assetMap.get(buyTokenId)); dbManager.getAccountStore().put(accountWrapper.createDbKey(), accountWrapper); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_SECOND, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { actuator.validate(); actuator.execute(ret); fail(); } catch (ContractValidateException e) { Assert.assertTrue(e instanceof ContractValidateException); Assert.assertEquals("token is not in exchange", e.getMessage()); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } } /** * Token balance in exchange is equal with 0, the exchange has been closed" */ @Test public void tokenBalanceZero() { long exchangeId = 2; String tokenId = "abc"; long quant = 1_000L; String buyTokenId = "def"; byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); accountWrapper.addAssetAmount(tokenId.getBytes(), 10000); Map<String, Long> assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L, accountWrapper.getBalance()); Assert.assertEquals(null, assetMap.get(buyTokenId)); dbManager.getAccountStore().put(accountWrapper.createDbKey(), accountWrapper); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_SECOND, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { ExchangeWrapper exchangeWrapper = dbManager.getExchangeStore() .get(ByteArray.fromLong(exchangeId)); exchangeWrapper.setBalance(0, 0); dbManager.getExchangeStore().put(exchangeWrapper.createDbKey(), exchangeWrapper); actuator.validate(); actuator.execute(ret); fail(); } catch (ContractValidateException e) { Assert.assertTrue(e instanceof ContractValidateException); Assert.assertEquals("Token balance in exchange is equal with 0," + "the exchange has been closed", e.getMessage()); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } catch (ItemNotFoundException e) { Assert.assertFalse(e instanceof ItemNotFoundException); } } /** * withdraw token quant must greater than zero */ @Test public void tokenQuantLessThanZero() { long exchangeId = 2; String tokenId = "abc"; long quant = -1_000L; String buyTokenId = "def"; byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); accountWrapper.addAssetAmount(tokenId.getBytes(), 10000); Map<String, Long> assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L, accountWrapper.getBalance()); Assert.assertEquals(null, assetMap.get(buyTokenId)); dbManager.getAccountStore().put(accountWrapper.createDbKey(), accountWrapper); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_SECOND, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { actuator.validate(); actuator.execute(ret); fail(); } catch (ContractValidateException e) { Assert.assertTrue(e instanceof ContractValidateException); Assert.assertEquals("transaction token balance must greater than zero", e.getMessage()); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } } /** * token balance must less than balanceLimit */ @Test public void tokenBalanceGreaterThanBalanceLimit() { long exchangeId = 2; String tokenId = "abc"; long quant = 1_000_000_000_000_001L; String buyTokenId = "def"; byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); accountWrapper.addAssetAmount(tokenId.getBytes(), 10000); Map<String, Long> assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L, accountWrapper.getBalance()); Assert.assertEquals(null, assetMap.get(buyTokenId)); dbManager.getAccountStore().put(accountWrapper.createDbKey(), accountWrapper); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_SECOND, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { actuator.validate(); actuator.execute(ret); fail(); } catch (ContractValidateException e) { Assert.assertTrue(e instanceof ContractValidateException); Assert.assertEquals("token balance must less than 1000000000000000", e.getMessage()); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } } /** * balance is not enough */ @Test public void balanceNotEnough() { long exchangeId = 1; String tokenId = "_"; long quant = 100_000000L; String buyTokenId = "abc"; byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); Map<String, Long> assetMap = accountWrapper.getAssetMap(); accountWrapper.setBalance(quant - 1); Assert.assertEquals(null, assetMap.get(buyTokenId)); dbManager.getAccountStore().put(ownerAddress, accountWrapper); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_SECOND, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { actuator.validate(); actuator.execute(ret); fail(); } catch (ContractValidateException e) { Assert.assertTrue(e instanceof ContractValidateException); Assert.assertEquals("balance is not enough", e.getMessage()); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } } /** * first token balance is not enough */ @Test public void tokenBalanceNotEnough() { long exchangeId = 2; String tokenId = "abc"; long quant = 1_000L; String buyTokenId = "def"; byte[] ownerAddress = ByteArray.fromHexString(OWNER_ADDRESS_SECOND); AccountWrapper accountWrapper = dbManager.getAccountStore().get(ownerAddress); accountWrapper.addAssetAmount(tokenId.getBytes(), quant - 1); Map<String, Long> assetMap = accountWrapper.getAssetMap(); Assert.assertEquals(20000_000000L, accountWrapper.getBalance()); Assert.assertEquals(null, assetMap.get(buyTokenId)); dbManager.getAccountStore().put(accountWrapper.createDbKey(), accountWrapper); ExchangeTransactionOperator actuator = new ExchangeTransactionOperator(getContract( OWNER_ADDRESS_SECOND, exchangeId, tokenId, quant), dbManager); TransactionResultWrapper ret = new TransactionResultWrapper(); try { actuator.validate(); actuator.execute(ret); fail(); } catch (ContractValidateException e) { Assert.assertTrue(e instanceof ContractValidateException); Assert.assertEquals("token balance is not enough", e.getMessage()); } catch (ContractExeException e) { Assert.assertFalse(e instanceof ContractExeException); } } }
d8ab2183634ac2c9712221b9667eb99e2445173c
a65f8bea27695fd6b60f6b418831463b89296f27
/src/main/java/lk/ijse/dep/pos/dao/impl/QueryDAOImpl.java
9012ae562188e1e4ddc65e436bdc1bc59f6f256e
[]
no_license
leelk/SpirngBoot_POS
47ac77aaf8c89e2e015a603e640ad550c7e59c8a
4ae02678f779a3c342e252c7d7e8fba1980bc461
refs/heads/master
2022-04-09T02:49:16.494755
2020-02-18T18:21:31
2020-02-18T18:21:31
241,412,506
1
0
null
null
null
null
UTF-8
Java
false
false
2,488
java
package lk.ijse.dep.pos.dao.impl; import lk.ijse.dep.pos.dao.QueryDAO; import lk.ijse.dep.pos.entity.CustomEntity; import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import java.util.ArrayList; import java.util.Date; import java.util.List; @Repository public class QueryDAOImpl implements QueryDAO { @PersistenceContext private EntityManager entityManager; @Override public CustomEntity getOrderInfo(int orderId) { return null; // ResultSet rst = CrudUtil.execute("SELECT C.customerId, C.name, O.date FROM Customer C INNER JOIN `Order` O ON C.customerId=O.customerId WHERE O.id=?", orderId); // if (rst.next()){ // return new CustomEntity(orderId, // rst.getString(1), // rst.getString(2), // rst.getDate(3)); // }else{ // return null; // } } @Override public CustomEntity getOrderInfo2(int orderId) { return null; // ResultSet rst = CrudUtil.execute("SELECT O.id, C.customerId, C.name, O.date, SUM(OD.qty * OD.unitPrice) AS Total FROM Customer C INNER JOIN `Order` O ON C.customerId=O.customerId\" +\n" + // " \" INNER JOIN OrderDetail OD on O.id = OD.orderId WHERE O.id=? GROUP BY orderId", orderId); // if (rst.next()){ // return new CustomEntity(rst.getInt(1), // rst.getString(2), // rst.getString(3), // rst.getDate(4), // rst.getDouble(5)); // }else{ // return null; // } } @Override public List<CustomEntity> getOrdersInfo(String query) { List<Object[]> resultList = entityManager.createNativeQuery("SELECT O.id, C.customerId, C.name, O.date, SUM(OD.qty * OD.unitPrice) AS Total FROM Customer C INNER JOIN `Order` O ON C.customerId=O.customerId " + "INNER JOIN OrderDetail OD on O.id = OD.orderId WHERE O.id LIKE ?1 OR C.customerId LIKE ?1 OR C.name LIKE ?1 OR O.date LIKE ?1 GROUP BY O.id") .setParameter(1, query) .getResultList(); List<CustomEntity> al = new ArrayList<>(); for (Object[] cols : resultList) { al.add(new CustomEntity((int) cols[0], (String) cols[1], (String) cols[2], (Date) cols[3], (Double) cols[4])); } return al; } }
336bf0897434f1946d9a4d4a95eca53b42d0e110
644575077c6eb3e61062c72130b61d31dc3c9781
/app/src/test/java/com/capton/colofulprogressbardemo/ExampleUnitTest.java
a5beea9dfbd6a0da1357b868d1da98d15f5ef9bf
[]
no_license
cavin2012/Android-ColorfulProgressBar
340e17be5ae6449d6c4d820c043e5de9fa99cc4e
993c358a118166c3263bd7bfd38376bc8add17c0
refs/heads/master
2020-09-14T11:02:37.709623
2018-08-18T06:14:18
2018-08-18T06:14:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package com.capton.colofulprogressbardemo; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
b8d7cefe77ade91ec008e7b1bb7f68e468c26dc7
9bc2e16bd25461ee4fa641aafb268b5029f9b0e2
/autotest.report.excel/src/main/java/com/surenpi/autotest/report/excel/writer/ExcelReportWriter.java
0ea918ef70de5998a704cb603c2d795b798ff902
[]
no_license
sergueik/selenium_java
775432bb23f418893551d73d82acd210bf07e43c
18eca29cd2e87b4e0bdf9f450e7608aae97b8e8d
refs/heads/master
2023-08-31T21:56:41.765828
2023-08-28T23:14:28
2023-08-28T23:14:28
40,056,997
25
14
null
2023-02-22T08:44:35
2015-08-01T19:00:35
Java
UTF-8
Java
false
false
3,775
java
/* * * * Copyright 2002-2007 the original author or authors. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * */ package com.surenpi.autotest.report.excel.writer; import java.io.File; import java.util.LinkedHashMap; import java.util.Map; import javax.annotation.PreDestroy; import org.modelmapper.ModelMapper; import com.surenpi.autotest.report.RecordReportWriter; import com.surenpi.autotest.report.ReportStatus; import com.surenpi.autotest.report.excel.model.ExcelReport; import com.surenpi.autotest.report.excel.util.ExcelUtils; import com.surenpi.autotest.report.record.ExceptionRecord; import com.surenpi.autotest.report.record.NormalRecord; import com.surenpi.autotest.report.record.ProjectRecord; import com.surenpi.autotest.report.util.DateUtils; /** * Excel格式报告导出 * @author suren */ public class ExcelReportWriter implements RecordReportWriter { private ExcelUtils utils; private ProjectRecord projectRecord; @Override public void write(ExceptionRecord record) { NormalRecord normalRecord = record.getNormalRecord(); ModelMapper mapper = new ModelMapper(); ExcelReport excelReport = mapper.map(normalRecord, ExcelReport.class); excelReport.setDetail(record.getStackTraceText()); fillReport(normalRecord, ReportStatus.EXCEPTION, excelReport); utils.export(excelReport); } @Override public void write(NormalRecord normalRecord) { ExcelReport excelReport = new ModelMapper().map(normalRecord, ExcelReport.class); fillReport(normalRecord, ReportStatus.NORMAL, excelReport); utils.export(excelReport); } /** * 填充公共数据 * @param normalRecord * @param reportStatus * @param excelReport */ private void fillReport(NormalRecord normalRecord, ReportStatus reportStatus, ExcelReport excelReport) { excelReport.setStatus(reportStatus.name()); excelReport.setBeginTime(DateUtils.getDateText(normalRecord.getBeginTime())); excelReport.setEndTime(DateUtils.getDateText(normalRecord.getEndTime())); excelReport.setTotalTime(((normalRecord.getEndTime() - normalRecord.getBeginTime()) / 1000) + "秒"); } @Override public void write(ProjectRecord projectRecord) { utils = new ExcelUtils( new File(projectRecord.getName() + "-" + System.currentTimeMillis() + ".xls")); utils.init(); this.projectRecord = projectRecord; } /** * 保存文件 */ @PreDestroy public void saveFile() { Map<String,String> info = new LinkedHashMap<String, String>(); info.put("测试流程", projectRecord.getName()); info.put("IP", projectRecord.getAddressInfo()); info.put("操作系统", projectRecord.getOsName() + "-" + projectRecord.getOsArch() + "-" + projectRecord.getOsVersion()); info.put("项目地址", "https://github.com/LinuxSuRen/phoenix.webui.framework"); if(projectRecord.getUserInfo() != null) { info.putAll(projectRecord.getUserInfo()); } utils.fillStaticInfo(info, "环境信息"); utils.save(); } }
9525cceddab0910dd9eead4a9d95eb4623a07d60
383044fcb0ba26a27a97ad9a4aa1b446b8a00b44
/Advanty/app/src/main/java/games/adventure/com/advanty/ObstacleJumpd.java
0c3236548c3625079783f406d1994d659f7fce0a
[]
no_license
sam797493/advanty-android
d39bfa8fe0b16fb548693d5e8f6d43bb8441b0b9
7ab88ef7da7f38636c8456e34f6ae569a6b494dc
refs/heads/master
2021-06-27T21:40:51.786892
2017-09-15T08:16:34
2017-09-15T08:16:34
103,399,406
0
0
null
null
null
null
UTF-8
Java
false
false
682
java
package games.adventure.com.advanty; import android.graphics.Bitmap; import games.adventure.com.advanty.Sprite; import games.adventure.com.advanty.Util; public class ObstacleJumpd extends Obstacle { public Bitmap jumpSpriteImg; public Sprite jumpSprite = null; public ObstacleJumpd(float _x, float _y, float _z, float _width, float _height, char type, int _FrameUpdateTime, int _numberOfFrames){ super(_x, _y, _z, _width, _height, type); jumpSprite = new Sprite(_x, _y, _z, 200, 280, _FrameUpdateTime, _numberOfFrames); jumpSprite.loadBitmap(Util.loadBitmapFromAssets("game_obstacle_jump_animated4.png")); Util.getAppRenderer().addMesh(jumpSprite); } }
3167b2c46061951c35742a91fcc4fbfadab229ea
96d06bfbeff740f661e7ef409183f348f551a414
/myjetty/myjetty-server/src/main/java/io/leopard/myjetty/LoggerConstant.java
c85406ecbc4c4645a5c96fab960231dc848809d8
[ "Apache-2.0" ]
permissive
cuidd2018/leopard
135648152202f00b405af1f0039f3dd95ee1689c
bcc6c394d5a7246384c666f94ac3c5e494e777a3
refs/heads/master
2021-09-22T11:11:37.093267
2018-09-09T05:24:19
2018-09-09T05:24:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
366
java
package io.leopard.myjetty; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class LoggerConstant { public static Log getJettyLogger(Class<?> clazz) { // return Log4jUtil.getLogger("JETTYLOG." + clazz.getName(), Level.DEBUG, "/data2/log/resin/jetty.log", false); return LogFactory.getLog(clazz); } }
4aa9113cf9e38bcd4247628dfb2ef257f17f36ce
0ecdee156ec7b06d4374519446837ad6f44f7bd8
/src/main/java/com/epam/task1/JavaFundamentalsTask2.java
1c4a5215b435a1768de44c5bac418acd83d977b6
[]
no_license
KatyaS91/TATJAVA01_2017_Task01_Katsiaryna_Skarzhynskaya
342b2f732aeb331f0ac344cf2c6aad71eb68a5aa
9a84c396e33e3f210d33140f6fd0216446bd12f8
refs/heads/master
2021-06-10T09:16:20.556959
2017-01-21T11:58:43
2017-01-21T11:58:43
79,643,053
1
0
null
null
null
null
UTF-8
Java
false
false
357
java
package com.epam.task1; /** * Created by skarzhynskaya_katya on 1/18/17. */ public class JavaFundamentalsTask2 { public static void main(String[] args) { int b = 2; int a = 3; int c = 4; double result = (b + Math.sqrt(b*b + 4*a*c)/2*a) - Math.pow(a,3)*c + Math.pow(b, -2); System.out.println(result); } }
6cdab8e049a7719bd7c526374d974fd61f9bd9da
381ec2f9382daf9fe2e1954b1936c38c209a1dd5
/sqa_espresso/common/UtaPassUtil.java
c2746fab7bd6c186c585cb08412eab1634763259
[]
no_license
graysonbai/Practice
a445eaab8d41183458f5f76e5d10d26e0d12f291
65d93c94e3c28f3b2f4af7d2bc361dd876691580
refs/heads/master
2020-05-16T03:08:42.726698
2019-04-22T08:31:38
2019-04-22T08:31:38
182,655,174
0
0
null
null
null
null
UTF-8
Java
false
false
12,259
java
package com.kddi.android.UtaPass.sqa_espresso.common ; import android.app.Activity; import android.content.pm.ActivityInfo; import android.content.res.Resources ; import android.graphics.* ; import android.graphics.drawable.Drawable ; import android.support.test.InstrumentationRegistry; import android.support.test.espresso.* ; import android.support.test.espresso.action.* ; import android.support.test.rule.ActivityTestRule ; import android.support.test.runner.lifecycle.ActivityLifecycleMonitorRegistry; import android.support.test.uiautomator.UiDevice; import android.support.test.uiautomator.UiObject; import android.support.test.uiautomator.UiObjectNotFoundException; import android.support.test.uiautomator.UiSelector; import android.util.Log ; import android.view.View ; import android.widget.ImageView ; import com.kddi.android.UtaPass.main.MainActivity; import com.kddi.android.UtaPass.sqa_espresso.common.exceptions.BasicException; import com.kddi.android.UtaPass.sqa_espresso.common.exceptions.NoMatchViewException; import com.kddi.android.UtaPass.sqa_espresso.common.exceptions.NotReadyException; import com.kddi.android.UtaPass.sqa_espresso.pages.common.SongNowPlayingBar; import com.squareup.spoon.Spoon; import org.hamcrest.* ; import java.util.Collection; import static android.support.test.InstrumentationRegistry.getInstrumentation; import static android.support.test.runner.lifecycle.Stage.RESUMED; public class UtaPassUtil { private static final int RETRY_INTERVAL = 5 ; private static final int RETRY_MAX_COUNT = 6 ; private static boolean takeScreenShot = true ; public static void dprint( String msg ) { android.util.Log.d( "UtapassAutomation", String.format( "<%s> %s", RunningStatus.caseName, msg ) ) ; } public static void dprint_tap( String label ) { UtaPassUtil.dprint( label + " > tap" ) ; } public static void dprint_type( String label, String text ) { UtaPassUtil.dprint( label + " > type '" + text + "'" ) ; } private static void _sleep( int seconds ) { try { Thread.sleep( seconds * 1000 ) ; } catch( InterruptedException ex ) { UtaPassUtil.dprint( ex.toString() ) ; } } public static void sleep( int seconds, String info ) { UtaPassUtil.dprint( String.format( "Sleep %s second(s): %s", seconds, info ) ) ; UtaPassUtil._sleep( seconds ) ; } public static void sleep( int seconds ) { UtaPassUtil.dprint( String.format( "Sleep %s second(s)...", seconds ) ) ; UtaPassUtil._sleep( seconds ) ; } public static Matcher<View> withIndex(final Matcher<View> matcher, final int index) { return new TypeSafeMatcher<View>() { int currentIndex = 0; @Override public void describeTo(Description description) { description.appendText("with index: "); description.appendValue(index); matcher.describeTo(description); } @Override public boolean matchesSafely(View view) { return matcher.matches(view) && currentIndex++ == index; } }; } public static Matcher<View> withDrawable( final int resourceId ) { return new TypeSafeMatcher<View>() { @Override public void describeTo(Description description) { description.appendText( "with drawable from resource id: " ) ; description.appendValue( resourceId ) ; // if( resourceName != null ) { // description.appendText( "[" ) ; // description.appendText( resourceName ) ; // description.appendText( "]" ) ; // } } @Override public boolean matchesSafely( View view ) { if( ! ( view instanceof ImageView ) ) { return false ; } ImageView imageView = (ImageView) view ; if( resourceId < 0 ) { return imageView.getDrawable() == null; } Resources resources = view.getContext().getResources() ; Drawable expectedDrawable = resources.getDrawable( resourceId ) ; if( imageView.getDrawable() == null || expectedDrawable == null ) { return false; } if( imageView.getDrawable().getIntrinsicHeight() < 0 || imageView.getDrawable().getIntrinsicWidth() < 0 ) { return false ; } Bitmap bitmap = getBitmap( imageView.getDrawable() ) ; Bitmap otherBitmap = getBitmap( expectedDrawable ) ; return bitmap.sameAs(otherBitmap); } private Bitmap getBitmap( Drawable drawable ) { Bitmap bitmap = Bitmap.createBitmap( drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); drawable.draw(canvas); return bitmap; } }; } public static ViewAction swipeUp() { return new GeneralSwipeAction( Swipe.FAST, GeneralLocation.CENTER, GeneralLocation.TOP_CENTER, Press.FINGER); } public static ViewAction swipeDown() { return new GeneralSwipeAction( Swipe.FAST, GeneralLocation.CENTER, GeneralLocation.BOTTOM_CENTER, Press.FINGER); } public static ViewAction swipeToBottom() { Log.d("xxxxxxxxxx", "swipToBottom()" ) ; return new GeneralSwipeAction( Swipe.FAST, GeneralLocation.CENTER, new CoordinatesProvider() { @Override public float[] calculateCoordinates(View view) { float[] coordinates = GeneralLocation.CENTER.calculateCoordinates(view); coordinates[1] = view.getContext().getResources().getDisplayMetrics().heightPixels; return coordinates; } }, Press.FINGER); } public static void pressBack() { Espresso.pressBack() ; } public static void closeApp() { UtaPassUtil.getUiDeviceInstance().pressHome() ; UtaPassUtil.sleep( 5, "for launching next case" ) ; } public static void closesoftboard(){ Espresso.closeSoftKeyboard(); UtaPassUtil.sleep( 2, "for Stability" ); } public static UiDevice getUiDeviceInstance() { return UiDevice.getInstance( InstrumentationRegistry.getInstrumentation() ) ; } public static UiObject findObjectByClassName( String className ) { return UtaPassUtil.findObjectByClassName( className, 0 ) ; } public static UiObject findObjectByClassName( String className, int index ) { return UtaPassUtil.getUiDeviceInstance().findObject( new UiSelector() .className( className ) .instance( index ) ) ; } public static UiObject findObjectByClassName( String className, int index, String text ) { return UtaPassUtil.getUiDeviceInstance().findObject( new UiSelector() .className( className ) .instance( index ) .text( text ) ) ; } public static UiObject findObject( UiSelector selector ) { return UtaPassUtil.getUiDeviceInstance().findObject( selector ) ; } public static UiObject findObjectByResourceId( String id ) { return UtaPassUtil.findObjectByResourceId( id, 0 ) ; } public static UiObject findObjectByResourceId( String id, int index ) { return UtaPassUtil.getUiDeviceInstance().findObject( new UiSelector() .resourceId( id ) .instance( index ) ) ; } public static UiObject findObjectByResourceIdMatches( String id ) { return UtaPassUtil.findObjectByResourceIdMatches( id, 0 ) ; } public static UiObject findObjectByResourceIdMatches( String id, int index ) { return UtaPassUtil.getUiDeviceInstance().findObject( new UiSelector() .resourceIdMatches( ".*:id/" + id ) .instance( index ) ) ; } public static void setScreenOrientationPortrait( ActivityTestRule<MainActivity> mActivityRule ) { mActivityRule.getActivity().setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ) ; } public static void setScreenOrientationNatural( ActivityTestRule<MainActivity> mActivityRule ) { mActivityRule.getActivity().setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR ) ; } public static void retry( RetryUnit unit ) { UtaPassUtil.retry( unit, true, UtaPassUtil.RETRY_INTERVAL, UtaPassUtil.RETRY_MAX_COUNT ) ; } public static void retry( RetryUnit unit, boolean isRetry ) { UtaPassUtil.retry( unit, isRetry, UtaPassUtil.RETRY_INTERVAL, UtaPassUtil.RETRY_MAX_COUNT ) ; } public static void retry( RetryUnit unit, boolean isRetry, int interval, int maxCount ) { if( isRetry ) { UtaPassUtil.retry( unit, interval, maxCount ) ; return ; } UtaPassUtil.runStep( unit ) ; } public static void retry( RetryUnit unit, int interval, int maxCount ) { int count = 0 ; UtaPassUtil.disableScreenShot() ; while( true ) { try { UtaPassUtil.runStep( unit ) ; UtaPassUtil.enableScreenShot() ; return ; } catch( Exception e ) { String expName = e.getClass().getSimpleName().replace( "Exception", "" ) ; boolean isBasicExp = e instanceof BasicException ; String msg = isBasicExp ? String.format( "%s: %s", expName, e.getMessage() ) : expName ; UtaPassUtil.dprint( msg ) ; if( count++ == maxCount ) { UtaPassUtil.enableScreenShot() ; throw new NotReadyException( msg ) ; } String nextTryMsg = String.format( "NextTry (%s/%s)", count, maxCount ) ; UtaPassUtil.sleep( interval, nextTryMsg ) ; } } } public static void runStep( RetryUnit unit ) throws RuntimeException { if( ! unit.execute() ) { throw new RuntimeException() ; } } public static void enableScreenShot() { UtaPassUtil.takeScreenShot = true ; } public static void disableScreenShot() { UtaPassUtil.takeScreenShot = false ; } public static void takeScreenshot( String tag ) { if( ! UtaPassUtil.takeScreenShot ) { return ; } UtaPassUtil.dprint( "takeScreenShot: " + tag ) ; Spoon.screenshot( UtaPassUtil.getCurrentActivity(), tag ) ; } // copied from google public static Activity getCurrentActivity() { final Activity[] currentActivity = new Activity[ 1 ] ; getInstrumentation().runOnMainSync( () -> { Collection resumedActivities = ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage( RESUMED ) ; if( resumedActivities.iterator().hasNext() ) { currentActivity[0] = (Activity) resumedActivities.iterator().next() ; } } ) ; return currentActivity[ 0 ] ; } }
c2913ad40ef4c6c47e28386dec43f47417e32c45
c8f42ebfc546cc82820781ceef48826e19856e7f
/QEModule_SpringMVC_SoftwareDeveloperClubExercise2/src/main/java/com/perscholas/software_developer_club/config/WebAppConfig.java
6f3cb8608d5ea07b172daf475080bf67285bacca
[]
no_license
sravanthi1986/PerScholasCode
7089567a238a3f1dcf762c79089989f042379a08
78fb4939b45bc84fbd7308ec3ac44787d83963fa
refs/heads/master
2022-12-21T13:04:21.505336
2019-12-06T18:23:51
2019-12-06T18:23:51
226,383,647
0
0
null
2022-12-16T00:38:03
2019-12-06T18:05:36
Java
UTF-8
Java
false
false
917
java
package com.perscholas.software_developer_club.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @ComponentScan("com.perscholas.software_developer_club.controllers") public class WebAppConfig implements WebMvcConfigurer { @Bean InternalResourceViewResolver resolver() { return new InternalResourceViewResolver("/WEB-INF/views/", ".jsp"); // public InternalResourceViewResolver viewResolver() { // InternalResourceViewResolver resolver = new InternalResourceViewResolver(); // resolver.setPrefix("/WEB-INF/views/"); // resolver.setSuffix(".jsp"); // //return resolver; } }
b48a235ef2e2de4df7e699f6a176878fa57c7137
1ad5b90e952c4c1d0152ff21a4d25185dfecf0cf
/Naib_ReedExhibitions_Back-JHVentas/src/main/java/com/naib/sinapsist/api/app/models/service/ICarteraCrmService.java
c5369069b4b97bb222b63003bffcf4b6850349dc
[]
no_license
CarlitosLeon/CarlosBackEmail
3415ed83076ea94c6bc54f9eb3e0bcfc15b9a44f
d79c2ba83dc63d8b8c4e34270ca502f704e6c403
refs/heads/main
2023-04-16T07:29:53.054512
2021-04-29T21:09:03
2021-04-29T21:09:03
362,311,328
0
0
null
null
null
null
UTF-8
Java
false
false
506
java
package com.naib.sinapsist.api.app.models.service; import java.util.List; import com.naib.sinapsist.api.app.models.entity.CarteraEvento; public interface ICarteraCrmService { public List<CarteraEvento> getExpositoresCartera(int id, int idE); public List<CarteraEvento> getAllExpositoresCartera(int idE); public CarteraEvento findById(int id); public List<CarteraEvento> getRelacionVendedor(int idEx); public void deleteById(int idCa); public CarteraEvento save(CarteraEvento cartera); }
380294eb928ef07791a30499793ca8a4d5d70fcf
694d574b989e75282326153d51bd85cb8b83fb9f
/google-ads/src/main/java/com/google/ads/googleads/v2/resources/FeedMapping.java
fec0ff500569ef5e7d9175b0e22ca06d0c719270
[ "Apache-2.0" ]
permissive
tikivn/google-ads-java
99201ef20efd52f884d651755eb5a3634e951e9b
1456d890e5c6efc5fad6bd276b4a3cd877175418
refs/heads/master
2023-08-03T13:02:40.730269
2020-07-17T16:33:40
2020-07-17T16:33:40
280,845,720
0
0
Apache-2.0
2023-07-23T23:39:26
2020-07-19T10:51:35
null
UTF-8
Java
false
true
67,087
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/ads/googleads/v2/resources/feed_mapping.proto package com.google.ads.googleads.v2.resources; /** * <pre> * A feed mapping. * </pre> * * Protobuf type {@code google.ads.googleads.v2.resources.FeedMapping} */ public final class FeedMapping extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.ads.googleads.v2.resources.FeedMapping) FeedMappingOrBuilder { private static final long serialVersionUID = 0L; // Use FeedMapping.newBuilder() to construct. private FeedMapping(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private FeedMapping() { resourceName_ = ""; attributeFieldMappings_ = java.util.Collections.emptyList(); status_ = 0; } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private FeedMapping( 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; case 10: { java.lang.String s = input.readStringRequireUtf8(); resourceName_ = s; break; } case 18: { com.google.protobuf.StringValue.Builder subBuilder = null; if (feed_ != null) { subBuilder = feed_.toBuilder(); } feed_ = input.readMessage(com.google.protobuf.StringValue.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(feed_); feed_ = subBuilder.buildPartial(); } break; } case 24: { int rawValue = input.readEnum(); targetCase_ = 3; target_ = rawValue; break; } case 32: { int rawValue = input.readEnum(); targetCase_ = 4; target_ = rawValue; break; } case 42: { if (!((mutable_bitField0_ & 0x00000004) != 0)) { attributeFieldMappings_ = new java.util.ArrayList<com.google.ads.googleads.v2.resources.AttributeFieldMapping>(); mutable_bitField0_ |= 0x00000004; } attributeFieldMappings_.add( input.readMessage(com.google.ads.googleads.v2.resources.AttributeFieldMapping.parser(), extensionRegistry)); break; } case 48: { int rawValue = input.readEnum(); status_ = rawValue; break; } default: { if (!parseUnknownField( 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 { if (((mutable_bitField0_ & 0x00000004) != 0)) { attributeFieldMappings_ = java.util.Collections.unmodifiableList(attributeFieldMappings_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.ads.googleads.v2.resources.FeedMappingProto.internal_static_google_ads_googleads_v2_resources_FeedMapping_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.ads.googleads.v2.resources.FeedMappingProto.internal_static_google_ads_googleads_v2_resources_FeedMapping_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.ads.googleads.v2.resources.FeedMapping.class, com.google.ads.googleads.v2.resources.FeedMapping.Builder.class); } private int bitField0_; private int targetCase_ = 0; private java.lang.Object target_; public enum TargetCase implements com.google.protobuf.Internal.EnumLite { PLACEHOLDER_TYPE(3), CRITERION_TYPE(4), TARGET_NOT_SET(0); private final int value; private TargetCase(int value) { this.value = value; } /** * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated public static TargetCase valueOf(int value) { return forNumber(value); } public static TargetCase forNumber(int value) { switch (value) { case 3: return PLACEHOLDER_TYPE; case 4: return CRITERION_TYPE; case 0: return TARGET_NOT_SET; default: return null; } } public int getNumber() { return this.value; } }; public TargetCase getTargetCase() { return TargetCase.forNumber( targetCase_); } public static final int RESOURCE_NAME_FIELD_NUMBER = 1; private volatile java.lang.Object resourceName_; /** * <pre> * The resource name of the feed mapping. * Feed mapping resource names have the form: * `customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}` * </pre> * * <code>string resource_name = 1;</code> */ public java.lang.String getResourceName() { java.lang.Object ref = resourceName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); resourceName_ = s; return s; } } /** * <pre> * The resource name of the feed mapping. * Feed mapping resource names have the form: * `customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}` * </pre> * * <code>string resource_name = 1;</code> */ public com.google.protobuf.ByteString getResourceNameBytes() { java.lang.Object ref = resourceName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); resourceName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int FEED_FIELD_NUMBER = 2; private com.google.protobuf.StringValue feed_; /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public boolean hasFeed() { return feed_ != null; } /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public com.google.protobuf.StringValue getFeed() { return feed_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : feed_; } /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public com.google.protobuf.StringValueOrBuilder getFeedOrBuilder() { return getFeed(); } public static final int ATTRIBUTE_FIELD_MAPPINGS_FIELD_NUMBER = 5; private java.util.List<com.google.ads.googleads.v2.resources.AttributeFieldMapping> attributeFieldMappings_; /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public java.util.List<com.google.ads.googleads.v2.resources.AttributeFieldMapping> getAttributeFieldMappingsList() { return attributeFieldMappings_; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public java.util.List<? extends com.google.ads.googleads.v2.resources.AttributeFieldMappingOrBuilder> getAttributeFieldMappingsOrBuilderList() { return attributeFieldMappings_; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public int getAttributeFieldMappingsCount() { return attributeFieldMappings_.size(); } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public com.google.ads.googleads.v2.resources.AttributeFieldMapping getAttributeFieldMappings(int index) { return attributeFieldMappings_.get(index); } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public com.google.ads.googleads.v2.resources.AttributeFieldMappingOrBuilder getAttributeFieldMappingsOrBuilder( int index) { return attributeFieldMappings_.get(index); } public static final int STATUS_FIELD_NUMBER = 6; private int status_; /** * <pre> * Status of the feed mapping. * This field is read-only. * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus status = 6;</code> */ public int getStatusValue() { return status_; } /** * <pre> * Status of the feed mapping. * This field is read-only. * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus status = 6;</code> */ public com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus getStatus() { @SuppressWarnings("deprecation") com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus result = com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus.valueOf(status_); return result == null ? com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus.UNRECOGNIZED : result; } public static final int PLACEHOLDER_TYPE_FIELD_NUMBER = 3; /** * <pre> * The placeholder type of this mapping (i.e., if the mapping maps feed * attributes to placeholder fields). * </pre> * * <code>.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType placeholder_type = 3;</code> */ public int getPlaceholderTypeValue() { if (targetCase_ == 3) { return (java.lang.Integer) target_; } return 0; } /** * <pre> * The placeholder type of this mapping (i.e., if the mapping maps feed * attributes to placeholder fields). * </pre> * * <code>.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType placeholder_type = 3;</code> */ public com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType getPlaceholderType() { if (targetCase_ == 3) { @SuppressWarnings("deprecation") com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType result = com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType.valueOf( (java.lang.Integer) target_); return result == null ? com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType.UNRECOGNIZED : result; } return com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType.UNSPECIFIED; } public static final int CRITERION_TYPE_FIELD_NUMBER = 4; /** * <pre> * The criterion type of this mapping (i.e., if the mapping maps feed * attributes to criterion fields). * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType criterion_type = 4;</code> */ public int getCriterionTypeValue() { if (targetCase_ == 4) { return (java.lang.Integer) target_; } return 0; } /** * <pre> * The criterion type of this mapping (i.e., if the mapping maps feed * attributes to criterion fields). * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType criterion_type = 4;</code> */ public com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType getCriterionType() { if (targetCase_ == 4) { @SuppressWarnings("deprecation") com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType result = com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType.valueOf( (java.lang.Integer) target_); return result == null ? com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType.UNRECOGNIZED : result; } return com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType.UNSPECIFIED; } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getResourceNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, resourceName_); } if (feed_ != null) { output.writeMessage(2, getFeed()); } if (targetCase_ == 3) { output.writeEnum(3, ((java.lang.Integer) target_)); } if (targetCase_ == 4) { output.writeEnum(4, ((java.lang.Integer) target_)); } for (int i = 0; i < attributeFieldMappings_.size(); i++) { output.writeMessage(5, attributeFieldMappings_.get(i)); } if (status_ != com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus.UNSPECIFIED.getNumber()) { output.writeEnum(6, status_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getResourceNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, resourceName_); } if (feed_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, getFeed()); } if (targetCase_ == 3) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(3, ((java.lang.Integer) target_)); } if (targetCase_ == 4) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(4, ((java.lang.Integer) target_)); } for (int i = 0; i < attributeFieldMappings_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(5, attributeFieldMappings_.get(i)); } if (status_ != com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus.UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(6, status_); } 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 com.google.ads.googleads.v2.resources.FeedMapping)) { return super.equals(obj); } com.google.ads.googleads.v2.resources.FeedMapping other = (com.google.ads.googleads.v2.resources.FeedMapping) obj; if (!getResourceName() .equals(other.getResourceName())) return false; if (hasFeed() != other.hasFeed()) return false; if (hasFeed()) { if (!getFeed() .equals(other.getFeed())) return false; } if (!getAttributeFieldMappingsList() .equals(other.getAttributeFieldMappingsList())) return false; if (status_ != other.status_) return false; if (!getTargetCase().equals(other.getTargetCase())) return false; switch (targetCase_) { case 3: if (getPlaceholderTypeValue() != other.getPlaceholderTypeValue()) return false; break; case 4: if (getCriterionTypeValue() != other.getCriterionTypeValue()) return false; break; case 0: default: } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + RESOURCE_NAME_FIELD_NUMBER; hash = (53 * hash) + getResourceName().hashCode(); if (hasFeed()) { hash = (37 * hash) + FEED_FIELD_NUMBER; hash = (53 * hash) + getFeed().hashCode(); } if (getAttributeFieldMappingsCount() > 0) { hash = (37 * hash) + ATTRIBUTE_FIELD_MAPPINGS_FIELD_NUMBER; hash = (53 * hash) + getAttributeFieldMappingsList().hashCode(); } hash = (37 * hash) + STATUS_FIELD_NUMBER; hash = (53 * hash) + status_; switch (targetCase_) { case 3: hash = (37 * hash) + PLACEHOLDER_TYPE_FIELD_NUMBER; hash = (53 * hash) + getPlaceholderTypeValue(); break; case 4: hash = (37 * hash) + CRITERION_TYPE_FIELD_NUMBER; hash = (53 * hash) + getCriterionTypeValue(); break; case 0: default: } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.ads.googleads.v2.resources.FeedMapping parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v2.resources.FeedMapping parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v2.resources.FeedMapping parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v2.resources.FeedMapping parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v2.resources.FeedMapping parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v2.resources.FeedMapping parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v2.resources.FeedMapping parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.ads.googleads.v2.resources.FeedMapping 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 com.google.ads.googleads.v2.resources.FeedMapping parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.google.ads.googleads.v2.resources.FeedMapping 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 com.google.ads.googleads.v2.resources.FeedMapping parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.ads.googleads.v2.resources.FeedMapping parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.ads.googleads.v2.resources.FeedMapping prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override 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; } /** * <pre> * A feed mapping. * </pre> * * Protobuf type {@code google.ads.googleads.v2.resources.FeedMapping} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.ads.googleads.v2.resources.FeedMapping) com.google.ads.googleads.v2.resources.FeedMappingOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.ads.googleads.v2.resources.FeedMappingProto.internal_static_google_ads_googleads_v2_resources_FeedMapping_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.ads.googleads.v2.resources.FeedMappingProto.internal_static_google_ads_googleads_v2_resources_FeedMapping_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.ads.googleads.v2.resources.FeedMapping.class, com.google.ads.googleads.v2.resources.FeedMapping.Builder.class); } // Construct using com.google.ads.googleads.v2.resources.FeedMapping.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { getAttributeFieldMappingsFieldBuilder(); } } @java.lang.Override public Builder clear() { super.clear(); resourceName_ = ""; if (feedBuilder_ == null) { feed_ = null; } else { feed_ = null; feedBuilder_ = null; } if (attributeFieldMappingsBuilder_ == null) { attributeFieldMappings_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); } else { attributeFieldMappingsBuilder_.clear(); } status_ = 0; targetCase_ = 0; target_ = null; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.ads.googleads.v2.resources.FeedMappingProto.internal_static_google_ads_googleads_v2_resources_FeedMapping_descriptor; } @java.lang.Override public com.google.ads.googleads.v2.resources.FeedMapping getDefaultInstanceForType() { return com.google.ads.googleads.v2.resources.FeedMapping.getDefaultInstance(); } @java.lang.Override public com.google.ads.googleads.v2.resources.FeedMapping build() { com.google.ads.googleads.v2.resources.FeedMapping result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.ads.googleads.v2.resources.FeedMapping buildPartial() { com.google.ads.googleads.v2.resources.FeedMapping result = new com.google.ads.googleads.v2.resources.FeedMapping(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.resourceName_ = resourceName_; if (feedBuilder_ == null) { result.feed_ = feed_; } else { result.feed_ = feedBuilder_.build(); } if (attributeFieldMappingsBuilder_ == null) { if (((bitField0_ & 0x00000004) != 0)) { attributeFieldMappings_ = java.util.Collections.unmodifiableList(attributeFieldMappings_); bitField0_ = (bitField0_ & ~0x00000004); } result.attributeFieldMappings_ = attributeFieldMappings_; } else { result.attributeFieldMappings_ = attributeFieldMappingsBuilder_.build(); } result.status_ = status_; if (targetCase_ == 3) { result.target_ = target_; } if (targetCase_ == 4) { result.target_ = target_; } result.bitField0_ = to_bitField0_; result.targetCase_ = targetCase_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.ads.googleads.v2.resources.FeedMapping) { return mergeFrom((com.google.ads.googleads.v2.resources.FeedMapping)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.ads.googleads.v2.resources.FeedMapping other) { if (other == com.google.ads.googleads.v2.resources.FeedMapping.getDefaultInstance()) return this; if (!other.getResourceName().isEmpty()) { resourceName_ = other.resourceName_; onChanged(); } if (other.hasFeed()) { mergeFeed(other.getFeed()); } if (attributeFieldMappingsBuilder_ == null) { if (!other.attributeFieldMappings_.isEmpty()) { if (attributeFieldMappings_.isEmpty()) { attributeFieldMappings_ = other.attributeFieldMappings_; bitField0_ = (bitField0_ & ~0x00000004); } else { ensureAttributeFieldMappingsIsMutable(); attributeFieldMappings_.addAll(other.attributeFieldMappings_); } onChanged(); } } else { if (!other.attributeFieldMappings_.isEmpty()) { if (attributeFieldMappingsBuilder_.isEmpty()) { attributeFieldMappingsBuilder_.dispose(); attributeFieldMappingsBuilder_ = null; attributeFieldMappings_ = other.attributeFieldMappings_; bitField0_ = (bitField0_ & ~0x00000004); attributeFieldMappingsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getAttributeFieldMappingsFieldBuilder() : null; } else { attributeFieldMappingsBuilder_.addAllMessages(other.attributeFieldMappings_); } } } if (other.status_ != 0) { setStatusValue(other.getStatusValue()); } switch (other.getTargetCase()) { case PLACEHOLDER_TYPE: { setPlaceholderTypeValue(other.getPlaceholderTypeValue()); break; } case CRITERION_TYPE: { setCriterionTypeValue(other.getCriterionTypeValue()); break; } case TARGET_NOT_SET: { break; } } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.ads.googleads.v2.resources.FeedMapping parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.ads.googleads.v2.resources.FeedMapping) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int targetCase_ = 0; private java.lang.Object target_; public TargetCase getTargetCase() { return TargetCase.forNumber( targetCase_); } public Builder clearTarget() { targetCase_ = 0; target_ = null; onChanged(); return this; } private int bitField0_; private java.lang.Object resourceName_ = ""; /** * <pre> * The resource name of the feed mapping. * Feed mapping resource names have the form: * `customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}` * </pre> * * <code>string resource_name = 1;</code> */ public java.lang.String getResourceName() { java.lang.Object ref = resourceName_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); resourceName_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * The resource name of the feed mapping. * Feed mapping resource names have the form: * `customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}` * </pre> * * <code>string resource_name = 1;</code> */ public com.google.protobuf.ByteString getResourceNameBytes() { java.lang.Object ref = resourceName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); resourceName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * The resource name of the feed mapping. * Feed mapping resource names have the form: * `customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}` * </pre> * * <code>string resource_name = 1;</code> */ public Builder setResourceName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } resourceName_ = value; onChanged(); return this; } /** * <pre> * The resource name of the feed mapping. * Feed mapping resource names have the form: * `customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}` * </pre> * * <code>string resource_name = 1;</code> */ public Builder clearResourceName() { resourceName_ = getDefaultInstance().getResourceName(); onChanged(); return this; } /** * <pre> * The resource name of the feed mapping. * Feed mapping resource names have the form: * `customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}` * </pre> * * <code>string resource_name = 1;</code> */ public Builder setResourceNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); resourceName_ = value; onChanged(); return this; } private com.google.protobuf.StringValue feed_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> feedBuilder_; /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public boolean hasFeed() { return feedBuilder_ != null || feed_ != null; } /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public com.google.protobuf.StringValue getFeed() { if (feedBuilder_ == null) { return feed_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : feed_; } else { return feedBuilder_.getMessage(); } } /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public Builder setFeed(com.google.protobuf.StringValue value) { if (feedBuilder_ == null) { if (value == null) { throw new NullPointerException(); } feed_ = value; onChanged(); } else { feedBuilder_.setMessage(value); } return this; } /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public Builder setFeed( com.google.protobuf.StringValue.Builder builderForValue) { if (feedBuilder_ == null) { feed_ = builderForValue.build(); onChanged(); } else { feedBuilder_.setMessage(builderForValue.build()); } return this; } /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public Builder mergeFeed(com.google.protobuf.StringValue value) { if (feedBuilder_ == null) { if (feed_ != null) { feed_ = com.google.protobuf.StringValue.newBuilder(feed_).mergeFrom(value).buildPartial(); } else { feed_ = value; } onChanged(); } else { feedBuilder_.mergeFrom(value); } return this; } /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public Builder clearFeed() { if (feedBuilder_ == null) { feed_ = null; onChanged(); } else { feed_ = null; feedBuilder_ = null; } return this; } /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public com.google.protobuf.StringValue.Builder getFeedBuilder() { onChanged(); return getFeedFieldBuilder().getBuilder(); } /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ public com.google.protobuf.StringValueOrBuilder getFeedOrBuilder() { if (feedBuilder_ != null) { return feedBuilder_.getMessageOrBuilder(); } else { return feed_ == null ? com.google.protobuf.StringValue.getDefaultInstance() : feed_; } } /** * <pre> * The feed of this feed mapping. * </pre> * * <code>.google.protobuf.StringValue feed = 2;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder> getFeedFieldBuilder() { if (feedBuilder_ == null) { feedBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.StringValue, com.google.protobuf.StringValue.Builder, com.google.protobuf.StringValueOrBuilder>( getFeed(), getParentForChildren(), isClean()); feed_ = null; } return feedBuilder_; } private java.util.List<com.google.ads.googleads.v2.resources.AttributeFieldMapping> attributeFieldMappings_ = java.util.Collections.emptyList(); private void ensureAttributeFieldMappingsIsMutable() { if (!((bitField0_ & 0x00000004) != 0)) { attributeFieldMappings_ = new java.util.ArrayList<com.google.ads.googleads.v2.resources.AttributeFieldMapping>(attributeFieldMappings_); bitField0_ |= 0x00000004; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.ads.googleads.v2.resources.AttributeFieldMapping, com.google.ads.googleads.v2.resources.AttributeFieldMapping.Builder, com.google.ads.googleads.v2.resources.AttributeFieldMappingOrBuilder> attributeFieldMappingsBuilder_; /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public java.util.List<com.google.ads.googleads.v2.resources.AttributeFieldMapping> getAttributeFieldMappingsList() { if (attributeFieldMappingsBuilder_ == null) { return java.util.Collections.unmodifiableList(attributeFieldMappings_); } else { return attributeFieldMappingsBuilder_.getMessageList(); } } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public int getAttributeFieldMappingsCount() { if (attributeFieldMappingsBuilder_ == null) { return attributeFieldMappings_.size(); } else { return attributeFieldMappingsBuilder_.getCount(); } } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public com.google.ads.googleads.v2.resources.AttributeFieldMapping getAttributeFieldMappings(int index) { if (attributeFieldMappingsBuilder_ == null) { return attributeFieldMappings_.get(index); } else { return attributeFieldMappingsBuilder_.getMessage(index); } } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public Builder setAttributeFieldMappings( int index, com.google.ads.googleads.v2.resources.AttributeFieldMapping value) { if (attributeFieldMappingsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAttributeFieldMappingsIsMutable(); attributeFieldMappings_.set(index, value); onChanged(); } else { attributeFieldMappingsBuilder_.setMessage(index, value); } return this; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public Builder setAttributeFieldMappings( int index, com.google.ads.googleads.v2.resources.AttributeFieldMapping.Builder builderForValue) { if (attributeFieldMappingsBuilder_ == null) { ensureAttributeFieldMappingsIsMutable(); attributeFieldMappings_.set(index, builderForValue.build()); onChanged(); } else { attributeFieldMappingsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public Builder addAttributeFieldMappings(com.google.ads.googleads.v2.resources.AttributeFieldMapping value) { if (attributeFieldMappingsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAttributeFieldMappingsIsMutable(); attributeFieldMappings_.add(value); onChanged(); } else { attributeFieldMappingsBuilder_.addMessage(value); } return this; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public Builder addAttributeFieldMappings( int index, com.google.ads.googleads.v2.resources.AttributeFieldMapping value) { if (attributeFieldMappingsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAttributeFieldMappingsIsMutable(); attributeFieldMappings_.add(index, value); onChanged(); } else { attributeFieldMappingsBuilder_.addMessage(index, value); } return this; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public Builder addAttributeFieldMappings( com.google.ads.googleads.v2.resources.AttributeFieldMapping.Builder builderForValue) { if (attributeFieldMappingsBuilder_ == null) { ensureAttributeFieldMappingsIsMutable(); attributeFieldMappings_.add(builderForValue.build()); onChanged(); } else { attributeFieldMappingsBuilder_.addMessage(builderForValue.build()); } return this; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public Builder addAttributeFieldMappings( int index, com.google.ads.googleads.v2.resources.AttributeFieldMapping.Builder builderForValue) { if (attributeFieldMappingsBuilder_ == null) { ensureAttributeFieldMappingsIsMutable(); attributeFieldMappings_.add(index, builderForValue.build()); onChanged(); } else { attributeFieldMappingsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public Builder addAllAttributeFieldMappings( java.lang.Iterable<? extends com.google.ads.googleads.v2.resources.AttributeFieldMapping> values) { if (attributeFieldMappingsBuilder_ == null) { ensureAttributeFieldMappingsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, attributeFieldMappings_); onChanged(); } else { attributeFieldMappingsBuilder_.addAllMessages(values); } return this; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public Builder clearAttributeFieldMappings() { if (attributeFieldMappingsBuilder_ == null) { attributeFieldMappings_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); onChanged(); } else { attributeFieldMappingsBuilder_.clear(); } return this; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public Builder removeAttributeFieldMappings(int index) { if (attributeFieldMappingsBuilder_ == null) { ensureAttributeFieldMappingsIsMutable(); attributeFieldMappings_.remove(index); onChanged(); } else { attributeFieldMappingsBuilder_.remove(index); } return this; } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public com.google.ads.googleads.v2.resources.AttributeFieldMapping.Builder getAttributeFieldMappingsBuilder( int index) { return getAttributeFieldMappingsFieldBuilder().getBuilder(index); } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public com.google.ads.googleads.v2.resources.AttributeFieldMappingOrBuilder getAttributeFieldMappingsOrBuilder( int index) { if (attributeFieldMappingsBuilder_ == null) { return attributeFieldMappings_.get(index); } else { return attributeFieldMappingsBuilder_.getMessageOrBuilder(index); } } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public java.util.List<? extends com.google.ads.googleads.v2.resources.AttributeFieldMappingOrBuilder> getAttributeFieldMappingsOrBuilderList() { if (attributeFieldMappingsBuilder_ != null) { return attributeFieldMappingsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(attributeFieldMappings_); } } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public com.google.ads.googleads.v2.resources.AttributeFieldMapping.Builder addAttributeFieldMappingsBuilder() { return getAttributeFieldMappingsFieldBuilder().addBuilder( com.google.ads.googleads.v2.resources.AttributeFieldMapping.getDefaultInstance()); } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public com.google.ads.googleads.v2.resources.AttributeFieldMapping.Builder addAttributeFieldMappingsBuilder( int index) { return getAttributeFieldMappingsFieldBuilder().addBuilder( index, com.google.ads.googleads.v2.resources.AttributeFieldMapping.getDefaultInstance()); } /** * <pre> * Feed attributes to field mappings. These mappings are a one-to-many * relationship meaning that 1 feed attribute can be used to populate * multiple placeholder fields, but 1 placeholder field can only draw * data from 1 feed attribute. Ad Customizer is an exception, 1 placeholder * field can be mapped to multiple feed attributes. Required. * </pre> * * <code>repeated .google.ads.googleads.v2.resources.AttributeFieldMapping attribute_field_mappings = 5;</code> */ public java.util.List<com.google.ads.googleads.v2.resources.AttributeFieldMapping.Builder> getAttributeFieldMappingsBuilderList() { return getAttributeFieldMappingsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.ads.googleads.v2.resources.AttributeFieldMapping, com.google.ads.googleads.v2.resources.AttributeFieldMapping.Builder, com.google.ads.googleads.v2.resources.AttributeFieldMappingOrBuilder> getAttributeFieldMappingsFieldBuilder() { if (attributeFieldMappingsBuilder_ == null) { attributeFieldMappingsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.ads.googleads.v2.resources.AttributeFieldMapping, com.google.ads.googleads.v2.resources.AttributeFieldMapping.Builder, com.google.ads.googleads.v2.resources.AttributeFieldMappingOrBuilder>( attributeFieldMappings_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); attributeFieldMappings_ = null; } return attributeFieldMappingsBuilder_; } private int status_ = 0; /** * <pre> * Status of the feed mapping. * This field is read-only. * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus status = 6;</code> */ public int getStatusValue() { return status_; } /** * <pre> * Status of the feed mapping. * This field is read-only. * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus status = 6;</code> */ public Builder setStatusValue(int value) { status_ = value; onChanged(); return this; } /** * <pre> * Status of the feed mapping. * This field is read-only. * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus status = 6;</code> */ public com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus getStatus() { @SuppressWarnings("deprecation") com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus result = com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus.valueOf(status_); return result == null ? com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus.UNRECOGNIZED : result; } /** * <pre> * Status of the feed mapping. * This field is read-only. * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus status = 6;</code> */ public Builder setStatus(com.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus value) { if (value == null) { throw new NullPointerException(); } status_ = value.getNumber(); onChanged(); return this; } /** * <pre> * Status of the feed mapping. * This field is read-only. * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingStatusEnum.FeedMappingStatus status = 6;</code> */ public Builder clearStatus() { status_ = 0; onChanged(); return this; } /** * <pre> * The placeholder type of this mapping (i.e., if the mapping maps feed * attributes to placeholder fields). * </pre> * * <code>.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType placeholder_type = 3;</code> */ public int getPlaceholderTypeValue() { if (targetCase_ == 3) { return ((java.lang.Integer) target_).intValue(); } return 0; } /** * <pre> * The placeholder type of this mapping (i.e., if the mapping maps feed * attributes to placeholder fields). * </pre> * * <code>.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType placeholder_type = 3;</code> */ public Builder setPlaceholderTypeValue(int value) { targetCase_ = 3; target_ = value; onChanged(); return this; } /** * <pre> * The placeholder type of this mapping (i.e., if the mapping maps feed * attributes to placeholder fields). * </pre> * * <code>.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType placeholder_type = 3;</code> */ public com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType getPlaceholderType() { if (targetCase_ == 3) { @SuppressWarnings("deprecation") com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType result = com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType.valueOf( (java.lang.Integer) target_); return result == null ? com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType.UNRECOGNIZED : result; } return com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType.UNSPECIFIED; } /** * <pre> * The placeholder type of this mapping (i.e., if the mapping maps feed * attributes to placeholder fields). * </pre> * * <code>.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType placeholder_type = 3;</code> */ public Builder setPlaceholderType(com.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType value) { if (value == null) { throw new NullPointerException(); } targetCase_ = 3; target_ = value.getNumber(); onChanged(); return this; } /** * <pre> * The placeholder type of this mapping (i.e., if the mapping maps feed * attributes to placeholder fields). * </pre> * * <code>.google.ads.googleads.v2.enums.PlaceholderTypeEnum.PlaceholderType placeholder_type = 3;</code> */ public Builder clearPlaceholderType() { if (targetCase_ == 3) { targetCase_ = 0; target_ = null; onChanged(); } return this; } /** * <pre> * The criterion type of this mapping (i.e., if the mapping maps feed * attributes to criterion fields). * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType criterion_type = 4;</code> */ public int getCriterionTypeValue() { if (targetCase_ == 4) { return ((java.lang.Integer) target_).intValue(); } return 0; } /** * <pre> * The criterion type of this mapping (i.e., if the mapping maps feed * attributes to criterion fields). * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType criterion_type = 4;</code> */ public Builder setCriterionTypeValue(int value) { targetCase_ = 4; target_ = value; onChanged(); return this; } /** * <pre> * The criterion type of this mapping (i.e., if the mapping maps feed * attributes to criterion fields). * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType criterion_type = 4;</code> */ public com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType getCriterionType() { if (targetCase_ == 4) { @SuppressWarnings("deprecation") com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType result = com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType.valueOf( (java.lang.Integer) target_); return result == null ? com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType.UNRECOGNIZED : result; } return com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType.UNSPECIFIED; } /** * <pre> * The criterion type of this mapping (i.e., if the mapping maps feed * attributes to criterion fields). * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType criterion_type = 4;</code> */ public Builder setCriterionType(com.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType value) { if (value == null) { throw new NullPointerException(); } targetCase_ = 4; target_ = value.getNumber(); onChanged(); return this; } /** * <pre> * The criterion type of this mapping (i.e., if the mapping maps feed * attributes to criterion fields). * </pre> * * <code>.google.ads.googleads.v2.enums.FeedMappingCriterionTypeEnum.FeedMappingCriterionType criterion_type = 4;</code> */ public Builder clearCriterionType() { if (targetCase_ == 4) { targetCase_ = 0; target_ = null; onChanged(); } return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.ads.googleads.v2.resources.FeedMapping) } // @@protoc_insertion_point(class_scope:google.ads.googleads.v2.resources.FeedMapping) private static final com.google.ads.googleads.v2.resources.FeedMapping DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.ads.googleads.v2.resources.FeedMapping(); } public static com.google.ads.googleads.v2.resources.FeedMapping getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<FeedMapping> PARSER = new com.google.protobuf.AbstractParser<FeedMapping>() { @java.lang.Override public FeedMapping parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new FeedMapping(input, extensionRegistry); } }; public static com.google.protobuf.Parser<FeedMapping> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<FeedMapping> getParserForType() { return PARSER; } @java.lang.Override public com.google.ads.googleads.v2.resources.FeedMapping getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
620d9558088ff7ca448615f704d855d1654eb9b9
21fcfe2e5874ec3e1291ee80150bdd075d34bc93
/PA5/PA5Start/Examples/Test.java
17edaba2507b2f3c64c3e7a67023436d457db3d3
[]
no_license
Linxx-0212/Compiler
4a1d82848fe1fea81be051679da2eff9eadacb6f
1e5a2418f49219639d8ea75aad9cda65ffa2ed22
refs/heads/master
2020-04-17T02:22:03.712502
2019-04-30T01:59:00
2019-04-30T01:59:00
166,130,597
0
0
null
null
null
null
UTF-8
Java
false
false
1,997
java
import meggy.Meggy; class Test { public static void main(String[] whatever){ { new A().call(); } } } class A { int a; Meggy.Color[] array; int[] int_array; public int call(){ a=new B().call(); array=new Meggy.Color[3]; int_array=new int[30]; array[2]=Meggy.Color.BLUE; a=int_array.length; int_array[20]=3; int_array[array.length]=int_array.length; return 1; } } class B{ int a; public int call(){ C c; c=new C(); c.init(); // return c.call().call(); return new E().call(c.call()).getE().kall(c.call()).call(); // return new E().kall(new D()).call(); } } class C{ D d; public void init(){ d=new D(); } public D call(){ return d; } } class D{ public int call(){ return 4; } public E getE(){ return new E(); } } class E{ public D call(D d){ int[] index_array; Meggy.Color[] color_array; int index; index=0; index_array=new int[10]; color_array=new Meggy.Color[10]; index_array[0]=0; index_array[1]=1; index_array[2]=2; while(index<index_array.length){ if(index_array[index]==0){ color_array[index]=Meggy.Color.BLUE; }else if(index_array[index]==1){ color_array[index]=Meggy.Color.ORANGE; }else if(index_array[index]==2){ color_array[index]=Meggy.Color.YELLOW; }else{ color_array[index]=Meggy.Color.WHITE; } index=index+1; } return d; } public D kall(D d){ int[] index_array; Meggy.Color[] color_array; int index; index=0; index_array=new int[10]; color_array=new Meggy.Color[10]; color_array[0]=Meggy.Color.BLUE; color_array[1]=Meggy.Color.ORANGE; color_array[2]=Meggy.Color.YELLOW; while(index<index_array.length){ if(color_array[index]==Meggy.Color.BLUE){ index_array[index]=0; }else if(color_array[index]==Meggy.Color.ORANGE){ index_array[index]=1; }else if(color_array[index]==Meggy.Color.YELLOW){ index_array[index]=2; }else{ index_array[index]=3; } index=index+1; } return d; } }
1c476339ed56220f5dc7cf0bea20f25754ef4f29
4e721c6f4651c27ba1e8f4358d9086b458f2962a
/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/JettyFaultInjectorFactory.java
00ebaa6c3bd2b0bd38eeeed08c2190e2f941d1a8
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
WhyINeedToFillUsername/spring-cloud-contract
1a3f08402d3e9b6d5eb1c103c1d3988846622b66
5381ef8447d1dfc4439c7415874ab79e10961854
refs/heads/master
2021-01-20T21:32:09.605070
2017-08-29T13:40:30
2017-08-29T13:40:30
101,644,996
0
0
null
2017-08-28T13:17:52
2017-08-28T13:17:52
null
UTF-8
Java
false
false
1,202
java
/* * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.cloud.contract.wiremock; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.github.tomakehurst.wiremock.core.FaultInjector; import com.github.tomakehurst.wiremock.servlet.FaultInjectorFactory; /** * @author Dave Syer * */ public class JettyFaultInjectorFactory implements FaultInjectorFactory { @Override public FaultInjector buildFaultInjector(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { return new JettyFaultInjector(httpServletResponse); } }
6e9a08c3e29866ec6f0eb9d27c566ee09361b3b6
66a252023853ab938f7d412fd5dda42162afac14
/union-invoke-trace/src/main/java/com/chengxuunion/invoketrace/common/util/InvokeTracePropertiesUtils.java
86701091f5c9ca127df9f39abc86986f4a265f66
[]
no_license
youpanpan/invoke-trace
7aab123df5784c3b459e16b6da4fd46cfd0828d2
7414e4014df2895d05044a59dddc1d706a05e6b0
refs/heads/master
2020-05-03T14:16:57.841681
2019-03-31T12:02:07
2019-03-31T12:02:07
178,673,340
0
0
null
null
null
null
UTF-8
Java
false
false
1,097
java
package com.chengxuunion.invoketrace.common.util; import com.chengxuunion.util.properties.PropertiesReader; import org.aspectj.weaver.Dump; import org.slf4j.LoggerFactory; import java.io.IOException; /** * union-invoke-trace.properties文件读取工具类 * * @author youpanpan * @date 2018年8月31日 * @version V1.0 */ public class InvokeTracePropertiesUtils { /** * properties文件读取器 */ private PropertiesReader reader; private static InvokeTracePropertiesUtils instance = null; private InvokeTracePropertiesUtils() { try { reader = new PropertiesReader("/union-invoke-trace.properties"); } catch (IOException e) { LoggerFactory.getLogger(this.getClass()).error("初始化union-invoke-trace.properties文件读取器出现异常", e); } } /** * 获取PropertiesReader对象 * * @return */ public static PropertiesReader getInstance() { if (instance == null) { synchronized (InvokeTracePropertiesUtils.class) { if (instance == null) { instance = new InvokeTracePropertiesUtils(); } } } return instance.reader; } }
82395c3a7454ca6f5c385331019e95b8c613fb6f
4f12d12ed3e9809eff54e58eb23f62e0a953153a
/gp_java/src/main/java/com/jeffheaton/dissertation/experiments/payloads/ExperimentPayload.java
99ec5c20a30180d8dac4dea54c16c67d3aa05506
[]
no_license
solversa/phd-dissertation
e5fd1aacfc6614025b072daff9affa26c906b20a
9041a907da3c1b62a67ce847b284f9528480076d
refs/heads/master
2022-02-22T03:49:30.565294
2017-04-21T15:29:15
2017-04-21T15:29:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.jeffheaton.dissertation.experiments.payloads; import com.jeffheaton.dissertation.experiments.manager.ExperimentTask; import org.encog.ml.data.MLDataSet; public interface ExperimentPayload { boolean isVerbose(); void setVerbose(boolean theVerbose); PayloadReport run(ExperimentTask task); MLDataSet obtainCommonProcessing(ExperimentTask task); }
cb349489d974f566243c4aa453518674231d2fbd
08c0ea11d3ca153f580fc13c0afc5dc39e7b1d06
/src/main/java/servlet/EditAdsServlet.java
a588d49d502f25e2f45598b9bef0103606be8db9
[]
no_license
zhanata88/microservice-client
85c810b515d984c8d9c601325076be4c2cddccbf
95667fcfc5731ef213eb346660e272dea93cc9fa
refs/heads/master
2020-04-21T14:26:13.258988
2019-02-07T20:19:06
2019-02-07T20:19:06
169,635,040
0
0
null
null
null
null
UTF-8
Java
false
false
1,405
java
package servlet; import beans.Advertisement; import client.AdsClient; import test.TestServlet; 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 java.io.IOException; import java.util.ArrayList; @WebServlet("/EditAdsServlet") public class EditAdsServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Integer adsId = Integer.parseInt(request.getParameter("Adsid")); Advertisement ads = new Advertisement(); /** * For testing web-app TestServlet forTesting= new TestServlet(); ArrayList<Advertisement> userlist = forTesting.getUserTestList(); Long userId1="1"; Long userId2="2"; **/ Long id = (Long) request.getSession().getAttribute("id"); AdsClient adsClient = new AdsClient(); ArrayList<Advertisement> userlist = adsClient.getUserAds(id); for (Advertisement advertisement : userlist) { if (adsId.equals(advertisement.getId())) ads = advertisement; } request.setAttribute("ads", ads); request.getRequestDispatcher("editAds.jsp").include(request, response); } }
6ada152f0a4d519e855e28f658be0b5bc4444888
4c13f414de9b45142c703d2b80d116cc638d58f9
/src/main/java/com/google/code/guice/repository/configuration/RepositoriesGroup.java
bf15eaa6c0358acee0f0ba08ef2e7d40d0df3ee8
[ "Apache-2.0" ]
permissive
dongwise/guice-repository
5a89c19caed54a51a84472185b351c85108fd1fb
192445abaaf3ae1697027ef4ea0bdc5e2d468530
refs/heads/master
2021-01-10T19:36:59.138676
2013-03-14T20:43:16
2013-03-14T20:43:16
34,669,813
1
0
null
null
null
null
UTF-8
Java
false
false
8,264
java
/* * Copyright (C) 2012 the original author or authors. * See the notice.md file distributed with this work for additional * information regarding copyright ownership. * * 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.google.code.guice.repository.configuration; import com.google.common.base.Predicate; import org.springframework.util.Assert; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.regex.Pattern; /** * Represents set of Repository search criterias bound to persistence unit. * Should be created via {@link RepositoriesGroupBuilder}. * Used tighly in {@link ScanningJpaRepositoryModule}. * * @author Alexey Krylov * @since 07.12.12 */ public class RepositoriesGroup { /*===========================================[ INSTANCE VARIABLES ]===========*/ private String persistenceUnitName; private Collection<String> repositoriesPackages; private Pattern inclusionPattern; private Pattern exclusionPattern; private Predicate<Class> inclusionPredicate; private Predicate<Class> exclusionPredicate; /*===========================================[ CONSTRUCTORS ]=================*/ protected RepositoriesGroup(String repositoriesPackage, String persistenceUnitName) { this(Arrays.asList(repositoriesPackage), persistenceUnitName); } protected RepositoriesGroup(Collection<String> repositoriesPackages, String persistenceUnitName) { this.repositoriesPackages = new ArrayList<String>(repositoriesPackages); this.persistenceUnitName = persistenceUnitName; } /*===========================================[ CLASS METHODS ]================*/ public Collection<String> getRepositoriesPackages() { return Collections.unmodifiableCollection(repositoriesPackages); } protected void setIncusionPattern(String inclusionPattern) { if (inclusionPattern != null && !inclusionPattern.isEmpty()) { this.inclusionPattern = Pattern.compile(inclusionPattern); if (inclusionPredicate == null) { // inclusionPattern is a strict parameter - we need to deny other matcher possibilities inclusionPredicate = RepositoriesGroupFilterPredicates.DenyAll; } } } protected void setExclusionPattern(String exclusionPattern) { if (exclusionPattern != null && !exclusionPattern.isEmpty()) { this.exclusionPattern = Pattern.compile(exclusionPattern); } } protected void setInclusionFilterPredicate(Predicate<Class> inclusionPredicate) { if (inclusionPredicate != null) { this.inclusionPredicate = inclusionPredicate; if (inclusionPattern == null) { // strict parameters set - we need to deny other matcher possibilities inclusionPattern = Pattern.compile(RepositoriesGroupPatterns.DenyAll); } } } protected void setExclusionFilterPredicate(Predicate<Class> exclusionPredicate) { if (exclusionPredicate != null) { this.exclusionPredicate = exclusionPredicate; } } public Predicate<Class> getInclusionFilterPredicate() { return inclusionPredicate; } public Predicate<Class> getExclusionFilterPredicate() { return exclusionPredicate; } public boolean matches(Class<?> repositoryClass) { Assert.notNull(repositoryClass); String className = repositoryClass.getName(); boolean matches = false; if (isInclusionPatternMatches(className) || isInclusionFilterPredicateMatches(repositoryClass)) { matches = true; } if (matches) { if (isExclusionPatternMatches(className) || isXxclusionFilterPredicateMatches(repositoryClass)) { matches = false; } } return matches; } private boolean isInclusionPatternMatches(CharSequence className) { return inclusionPattern == null || inclusionPattern.matcher(className).matches(); } private boolean isInclusionFilterPredicateMatches(Class<?> repositoryClass) { return inclusionPredicate == null || inclusionPredicate.apply(repositoryClass); } private boolean isExclusionPatternMatches(CharSequence className) { return exclusionPattern != null && exclusionPattern.matcher(className).matches(); } private boolean isXxclusionFilterPredicateMatches(Class<?> repositoryClass) { return exclusionPredicate != null && exclusionPredicate.apply(repositoryClass); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof RepositoriesGroup)) { return false; } RepositoriesGroup repositoriesGroup = (RepositoriesGroup) o; if (exclusionPattern != null ? !exclusionPattern.equals(repositoriesGroup.exclusionPattern) : repositoriesGroup.exclusionPattern != null) { return false; } if (exclusionPredicate != null ? !exclusionPredicate.equals(repositoriesGroup.exclusionPredicate) : repositoriesGroup.exclusionPredicate != null) { return false; } if (inclusionPattern != null ? !inclusionPattern.equals(repositoriesGroup.inclusionPattern) : repositoriesGroup.inclusionPattern != null) { return false; } if (inclusionPredicate != null ? !inclusionPredicate.equals(repositoriesGroup.inclusionPredicate) : repositoriesGroup.inclusionPredicate != null) { return false; } if (persistenceUnitName != null ? !persistenceUnitName.equals(repositoriesGroup.persistenceUnitName) : repositoriesGroup.persistenceUnitName != null) { return false; } if (repositoriesPackages != null ? !repositoriesPackages.equals(repositoriesGroup.repositoriesPackages) : repositoriesGroup.repositoriesPackages != null) { return false; } return true; } @Override public int hashCode() { int result = persistenceUnitName != null ? persistenceUnitName.hashCode() : 0; result = 31 * result + (repositoriesPackages != null ? repositoriesPackages.hashCode() : 0); result = 31 * result + (inclusionPattern != null ? inclusionPattern.hashCode() : 0); result = 31 * result + (exclusionPattern != null ? exclusionPattern.hashCode() : 0); result = 31 * result + (inclusionPredicate != null ? inclusionPredicate.hashCode() : 0); result = 31 * result + (exclusionPredicate != null ? exclusionPredicate.hashCode() : 0); return result; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("RepositoriesGroup"); sb.append("{persistenceUnitName='").append(persistenceUnitName).append('\''); sb.append(", repositoriesPackages=").append(repositoriesPackages); sb.append(", inclusionPattern=").append(inclusionPattern); sb.append(", exclusionPattern=").append(exclusionPattern); sb.append('}'); return sb.toString(); } /*===========================================[ GETTER/SETTER ]================*/ public String getPersistenceUnitName() { return persistenceUnitName; } public Pattern getInclusionPattern() { return inclusionPattern; } public Pattern getExclusionPattern() { return exclusionPattern; } }
[ "[email protected]@2f7b4ad1-e6e1-6709-36a2-3d7a233e2e58" ]
[email protected]@2f7b4ad1-e6e1-6709-36a2-3d7a233e2e58
1e7d5ff2835d864ed3dd26e7b6bb639abaa36e56
4e4161f68d698fd952ef351865e187b0cbe95023
/app/src/main/java/techy/ap/scan/imageScan.java
3630fd1f910186c58453d1d09e057aca0186ef72
[]
no_license
parivendhan8/scan
9ecea7a5270f26781c7b04b7978fef500d825763
fd2fab4bdb5cbef048d0aaba6576172ba5e7f38e
refs/heads/master
2020-06-18T07:08:32.396521
2019-07-10T13:11:11
2019-07-10T13:11:11
196,207,733
0
0
null
null
null
null
UTF-8
Java
false
false
55
java
package techy.ap.scan; public class imageScan { }
ad72a15aaea21b16048873bbd8d9312d31ab1ef4
f1ea6295577540b922829ac1e0d835133da5fdd4
/app/src/main/java/com/example/riderpanel/Dashbord.java
928c4792448ebb88f4959e56d6d6b2035f5b45f7
[]
no_license
alikhan1999/Riderapp1122
096b97864a1e81a9059ceb38b261daf8e5aaf979
041e240aac060c62a50267fd360563cdf0541a5c
refs/heads/master
2023-02-24T04:38:03.988076
2021-01-31T19:31:28
2021-01-31T19:31:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
777
java
package com.example.riderpanel; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageButton; import androidx.appcompat.app.AppCompatActivity; public class Dashbord extends AppCompatActivity { ImageButton bookride; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dashbord); getSupportActionBar().hide(); bookride=findViewById(R.id.imageButton2); bookride.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(Dashbord.this,TimeSelection.class)); } }); } }
02b42f1ba3d99cd815ecebcb86c1b9e2152e8e19
1b3a12676482551822436580bdca3f529d8597ce
/src/UI/GameWindow/Square.java
fa482184d2c226f4f9e8ae726889759b4ca832bd
[]
no_license
HadronCollider/6303-Practice-DND
39d140549ec478ca9311d497272935db753d9884
a426b9ece5308f6f1e38eea7b96d9864c52b3222
refs/heads/master
2020-03-21T20:31:24.369294
2019-05-16T21:54:01
2019-05-16T21:54:01
139,012,599
3
2
null
2018-07-11T15:48:29
2018-06-28T12:03:41
null
UTF-8
Java
false
false
4,563
java
package UI.GameWindow; import Logic.Cell; import Logic.Position; import Logic.StrTransform; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; public class Square extends JButton { private boolean pressed; private boolean selected; private boolean wrong; private SquareType type; private FieldPanel parent; private Position position; private Timer timer; private Cell cell = null; public Square(FieldPanel parent, Cell cell) { this.parent = parent; setCell(cell); init(); } public void setCell(Cell cell) { this.cell = cell; this.removeAll(); if(cell != null) { this.position = cell.getPosition(); if(cell.getFlag()) { this.type = SquareType.RIGHT; StrTransform.transform(this, cell.getPair().getSecond(), (int)(getHeight() * 0.9)); } else { this.type = SquareType.LEFT; StrTransform.transform(this, cell.getPair().getFirst(), getHeight()); } } else { this.type = SquareType.FINAL; } this.selected = false; this.pressed = false; redraw(); } void redraw() { removeAll(); if(type == SquareType.FINAL) { setBackground(new Color(34, 139, 34)); } else if(type == SquareType.LEFT){ setBackground(new Color(150, 238, 238)); StrTransform.transform(this, cell.getPair().getFirst(), getHeight()); } else { setBackground(Color.WHITE); StrTransform.transform(this, cell.getPair().getSecond(), (int)(getHeight() * 0.9)); } updateUI(); update(getGraphics()); } private void init() { setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 2)); addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { if(e.getX() < 0 || e.getY() < 0 || e.getX() > getSize().width || e.getY() > getSize().height) { return; } if (type == SquareType.FINAL || wrong) { return; } clicked(); } @Override public void mouseEntered(MouseEvent e) { setBorder(BorderFactory.createLineBorder(Color.BLACK, 2)); } @Override public void mouseExited(MouseEvent e) { setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 2)); } }); } public void clicked() { if(selected) { unselect(); parent.setSelected(null); } else { if(parent.isSelectedExists()) { if(parent.getSelected().getType() == this.type) { parent.getSelected().unselect(); parent.setSelected(this); select(); } else { parent.checkTwoSquares(this); } } else { parent.setSelected(this); select(); } } } private SquareType getType() { return type; } private void select() { selected = true; setBackground(Color.YELLOW); } private void unselect() { selected = false; if(type == SquareType.LEFT) { setBackground(new Color(150, 238, 238)); } else { setBackground(Color.WHITE); } } public void setFinal() { type = SquareType.FINAL; removeAll(); setBackground(new Color(34, 139, 34)); setText(""); } public Position getPosition() { return position; } void setWrong() { setBackground(Color.RED); wrong = true; selected = false; timer = new Timer(1000, e -> setNormal()); timer.start(); } private void setNormal() { timer.stop(); wrong = false; if(type == SquareType.LEFT) { setBackground(new Color(150, 238, 238)); } else { setBackground(Color.WHITE); } } private enum SquareType{ LEFT, RIGHT, FINAL } }
0bda67753cd86f726ec619d562f8a040cbb96052
baefa34cf59cda04db5b9637185972e95da40dd5
/src/main/java/com/snowwolf/demojava8/mode/util/designmode/strategy/impl/WeiChatPay.java
1580538aacc82511baa58a1f519a880fe8382fcd
[]
no_license
topsnowwolf/demojava8
6ead864e3819c636c732d88678d3791483a5fc8b
5c459c706a7998b1c87f77c3887fc93dbf32a322
refs/heads/master
2020-04-08T06:09:21.514747
2018-12-11T00:40:56
2018-12-11T00:40:56
159,087,347
0
0
null
null
null
null
UTF-8
Java
false
false
438
java
package com.snowwolf.demojava8.mode.util.designmode.strategy.impl; import com.snowwolf.demojava8.mode.util.designmode.strategy.PayStrategy; /** * @author: topsnowwolf * @description: 微信支付 * @date: Create in 2018/12/2 22:13 * @modified by: * @versions:0.1.0 */ public class WeiChatPay implements PayStrategy { @Override public boolean payMoney(String payMode) { return payMode.matches("WEICHAT"); } }
5d13b3e0e3cb9b593b6b425310e757bf614dbe05
b0610e01214c11cbb13a64afb1413f2dcb0ab5e2
/DesignPatterns/src/main/java/proxy/RealImage.java
cfcdd3108321b9dfafe88c1a2f0d66258001b902
[]
no_license
YifeiCN/PragmaticLearning
083cc64a2c984ae4fbb867a622b217b953218088
49b03d2f7699b678805ac9a8e39395b503a356a6
refs/heads/master
2022-11-08T11:34:25.791562
2020-06-22T03:58:26
2020-06-22T03:58:26
274,028,756
0
0
null
2020-06-22T03:13:13
2020-06-22T03:13:12
null
UTF-8
Java
false
false
254
java
package proxy; public class RealImage implements Image { public RealImage() { load(); } @Override public void display() { // why not load here System.out.println("displaying"); } private void load() { System.out.println("loaded"); } }
1c56131cccbf29902223bb4dfb4b9f3e4954e539
32f599246710e0fc7639d7d68e05ea6ff420c9f2
/MDFS4/src/edu/tamu/lenss/mdfs/models/TaskSchedule.java
eaa2ae67886f8163e374a211d902ff88e5ba76a5
[]
no_license
LENSS/MobileCloudComputing
ad5bec0a52879025f25b0ba8e989320b1b0d7aa4
abd9756ccc94e938b6e46fea6f5bb93b576d8d55
refs/heads/master
2021-01-17T10:08:23.164126
2016-08-16T23:19:57
2016-08-16T23:19:57
65,860,006
0
0
null
null
null
null
UTF-8
Java
false
false
1,305
java
package edu.tamu.lenss.mdfs.models; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import adhoc.aodv.pdu.AODVDataContainer; import adhoc.etc.IOUtilities; public class TaskSchedule extends AODVDataContainer { private static final long serialVersionUID = 1L; private Map<Integer, List<MDFSFileInfo>> schedule = new HashMap<Integer, List<MDFSFileInfo>>(); //private SparseArray<List<MDFSFileInfo>> schedule = new SparseArray<List<MDFSFileInfo>>(); public TaskSchedule(){ super(MDFSPacketType.JOB_SCHEDULE, IOUtilities.parseNodeNumber(IOUtilities.getLocalIpAddress()), 255); this.setBroadcast(true); this.setMaxHop(5); } public void insertTask(int nodeId, MDFSFileInfo file){ if(schedule.containsKey(nodeId)){ schedule.get(nodeId).add(file); } else{ List<MDFSFileInfo> list = new ArrayList<MDFSFileInfo>(); list.add(file); schedule.put(nodeId, list); } } public List<MDFSFileInfo> getTaskList(int nodeId){ if(schedule.containsKey(nodeId)) { return schedule.get(nodeId); } return null; } public Map<Integer, List<MDFSFileInfo>> getScheduleMap(){ return schedule; } @Override public byte[] toByteArray() { return super.toByteArray(this); } }
805ddb773f1099f0f9020963a55b6f594033dd59
7f8438c3e8dbb9b611096b7762a7be7b2453c42b
/Bicycle/src/main/java/com/school/bicycle/entity/Pay_wallet.java
24ab9630997bbdb2724e64a713237c7a9a06022e
[]
no_license
ytzht/SchoolBicycle
21c974e438031f1b5992aa7fdfa6f3436f4d7fab
6aba89e417dea9ef80d02be44a51657e4678e6d8
refs/heads/master
2021-01-25T06:56:29.734691
2017-09-23T14:31:13
2017-09-23T14:31:13
93,630,542
0
0
null
null
null
null
UTF-8
Java
false
false
677
java
package com.school.bicycle.entity; /** * Created by Administrator on 2017/7/27. */ public class Pay_wallet { /** * code : 1 * msg : 交费成功 * pay_type : wallet */ private int code; private String msg; private String pay_type; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getPay_type() { return pay_type; } public void setPay_type(String pay_type) { this.pay_type = pay_type; } }
ac2dea5f6c8918f38c0174363c681e7a93f88429
ec8a204d9f078d12ed95f7975adbde4d51ad55ec
/07.NA-Stream/EA/20141229EA/EA/src/org/eredlab/g4/rif/taglib/util/TagConstant.java
5b324f85cb6293b49d91d9e4048bdb39665e1ef3
[]
no_license
yyd01245/bbcv_SM
77c2e0b3519ee064cce8a8764e46959265903b06
25bb6c622fd9a1d54cb3865daf0e259e56bbb352
refs/heads/master
2016-09-05T14:55:03.118908
2015-09-18T04:09:51
2015-09-18T04:09:51
42,697,679
1
1
null
null
null
null
UTF-8
Java
false
false
1,056
java
package org.eredlab.g4.rif.taglib.util; /** * 常量表 * @author XiongChun * @since 2010-01-13 */ public interface TagConstant { /** * Ext运行模式<br> * prod.nebula.run:生产模式 */ public static final String Ext_Mode_Run = "prod.nebula.run"; /** * Ext运行模式<br> * prod.nebula.run:调试模式 */ public static final String Ext_Mode_debug = "debug"; /** * 系统运行模式 * 0:演示模式 */ public static final String RUN_MODE_DEMO = "0"; /** * 系统运行模式 * 0:正常模式 */ public static final String RUN_MODE_NORMAL = "1"; /** * 模板变量输出模式<br> * on:打开 */ public static final String Tpl_Out_On = "on"; /** * 模板变量输出模式<br> * off:关闭 */ public static final String Tpl_Out_Off = "off"; /** * JS头<br> */ public static final String SCRIPT_START = "<script type=\"text/javascript\">\n"; /** * JS尾<br> */ public static final String SCRIPT_END = "\n</script>"; }
9244f6bf887607f2917d0809622cd4736c28254f
18c442b41a56ece9b364b66f2f1a875d2382d8b3
/workspace/javatest/src/day08/URLConnectionMain.java
dd3a06fe6e2fd9eb8b20b54771b06bfda3ec4c22
[]
no_license
tjshin/AIstudy_java
9de9c6f46ab72568a74c19b9b0a6b3156dd3b465
5865690c2aadbf385d8c6acf5177ccad7b3750c7
refs/heads/master
2023-09-04T02:38:27.966678
2021-10-18T08:07:00
2021-10-18T08:07:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
601
java
package day08; /** URLConnection을 이용한 입력 스트림 개설 **/ import java.net.*; import java.io.*; public class URLConnectionMain { public static void main(String args[]) throws MalformedURLException, IOException { URL url = new URL("http://www.daum.net"); URLConnection con = url.openConnection(); String temp; BufferedReader br; br = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); while ((temp = br.readLine()) != null) { System.out.println(temp); } br.close(); } // end of main } // end of URLConnectionMain class
5d580088898776f62abacb6cbd7f87bad194ca74
c573c711708137fc8bb1311d22606280e5c91cf0
/src/org/dvaletin/apps/nabludatel/utils/SectionFinalMeeting.java
662f1fbefbd607a3a30d6d710e098e3b2a9565a7
[]
no_license
webnabludatel/watcher-android
ce27b6ff172219f9392e8653a527cbb257992859
d8b53c3e7922b89c837153b802cf3d1852757054
refs/heads/master
2021-04-12T04:14:00.139015
2012-03-04T13:02:09
2012-03-04T13:02:09
3,056,128
3
0
null
null
null
null
UTF-8
Java
false
false
1,233
java
package org.dvaletin.apps.nabludatel.utils; import org.dvaletin.apps.nabludatel.R; import org.dvaletin.apps.nabludatel.ViolationCheckListActivity; public class SectionFinalMeeting extends SectionList { public SectionFinalMeeting() { listItems = new ListViewActivityItem[] { new ListViewActivityItem("Жалобы", ViolationCheckListActivity.class, R.layout.section_final_meeting_complains), new ListViewActivityItem("Итоговое заседание", ViolationCheckListActivity.class, R.layout.section_final_meeting_meeting), new ListViewActivityItem("Наблюдатели на заседании", ViolationCheckListActivity.class, R.layout.section_final_meeting_observers), new ListViewActivityItem("Упаковки бюллетеней", ViolationCheckListActivity.class, R.layout.section_final_meeting_ballots), new ListViewActivityItem("Протокол и увеличенная форма", ViolationCheckListActivity.class, R.layout.section_final_meeting_protocol), new ListViewActivityItem("Копия протокола", ViolationCheckListActivity.class, R.layout.section_final_meeting_protocol_copy), }; }; }
65febae30e97a72ca37052b6c76e2b3883b17165
af21e93a5c904708963a31582ff0a5412bbe4098
/201802 3UI/Summative/Rowan's stuff to show people so he doesn't have to leave it open on his computer all class/SS2/src/E2F.java
d37ba50d7a75afff9f8ded131730e7920efa1863
[]
no_license
Mrgfhci/201802-projects
56deaa95c56befebcba2542d12013d23ebf2e491
7712a9136277f92db3ffa3836cf0b6c2fea3bbd0
refs/heads/master
2020-03-21T05:35:44.103163
2018-06-21T12:37:34
2018-06-21T12:37:34
138,168,018
0
0
null
null
null
null
UTF-8
Java
false
false
1,054
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author vanrr7750 */ import java.util.*; public class E2F { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here double dNum1, dNum2; Scanner sin = new Scanner (System.in); System.out.println ("Gimme a number..."); dNum1 = sin.nextDouble(); System.out.println ("And another..."); dNum2 = sin.nextDouble(); if (dNum1 == dNum2){ System.out.println ("The two numbers are equal."); } else if (dNum1 > dNum2){ System.out.println ("The first number is greater than the second number."); } else if (dNum1 < dNum2){ System.out.println ("The second number is greater than the first number."); } else { System.out.println ("Well I don't know how but you fucked the program. Cool."); } } }
b07f5580b8115d7be97be8b827f3e9ab7b960c5d
3632f4bf89324f8f22f8868500fa429f20d8d28a
/Assignments/src/main/java/cput/ac/za/model/admin/City.java
1b30bdc319020ae4f99ca01ff72f0ebbb718a2a9
[]
no_license
kev0330/Assignment5-Assignment6
9ec81214123061e584a92112e8d7916e8270933b
c20be7a9553cbd069666445a15da519af139daa7
refs/heads/master
2021-07-01T18:56:54.644684
2019-09-22T16:51:19
2019-09-22T16:51:19
180,533,376
0
0
null
2020-10-13T12:46:49
2019-04-10T08:07:52
Java
UTF-8
Java
false
false
825
java
package cput.ac.za.domain.admin; import java.util.Objects; public class City { private String cityName; private City(){} private City(Builder builder){ this.cityName = builder.cityName; } public String getCityName() { return cityName; } public static class Builder{ private String cityName; public Builder cityName(String cityName){ this.cityName = cityName; return this; } public Builder copy(City city){ this.cityName = city.cityName; return this; } public City build() { return new City(this); } } @Override public String toString() { return "City Name :" + cityName; } }
ae66f3aad7d6dbe4ec4c39f1780ed33453053d0f
150e00db697b9aa3b473f29083e165a50f5fc867
/src/Model/Emp.java
0a37c18d440e66e49a69adf6541ca13f13458d64
[]
no_license
KavinduLiyanage/Vehicle-Service-and-Fuel-Management-System
d9e06c675e9843d394fdbe7ec148ab7ba38298e9
3d10ec0a32e13ceeda883441bb45e23c7e179238
refs/heads/master
2022-11-19T08:59:32.119710
2020-07-03T05:06:09
2020-07-03T05:06:09
276,811,512
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package Model; public class Emp { private int id; private String name,password,address,contactNumber,email,gender,designation,branch; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getContactNumber() { return contactNumber; } public void setContactNumber(String contactNumber) { this.contactNumber = contactNumber; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getDesignation() { return designation; } public void setDesignation(String designation) { this.designation = designation; } public String getBranch() { return branch; } public void setBranch(String branch) { this.branch = branch; } }
59089517fb058597473c97f27277ad66c7bc40f9
61cefcbe9f1fbbcddc5eeba256ffa2e12eedcba1
/app/src/main/java/com/zhengyi/adapter/PulmImplAdapter.java
8725a87514371c60e27e5fdbf13a99208dc7f5f5
[]
no_license
luckyly/PulmListView
de832a9ef2b5925bed512096474380446d03b38e
7a967d111cb5d591f779b6abc7ea2b86b1e09a51
refs/heads/master
2020-06-29T05:15:49.457390
2016-09-18T08:19:41
2016-09-18T08:19:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,663
java
package com.zhengyi.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.zhengyi.R; import com.zhengyi.library.PulmBaseAdapter; import java.util.List; public class PulmImplAdapter extends PulmBaseAdapter<String> { private LayoutInflater inflater; public PulmImplAdapter(Context context, List<String> items) { super(items); inflater = LayoutInflater.from(context); } @Override public int getCount() { return items.size(); } @Override public Object getItem(int position) { return items.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { viewHolder = new ViewHolder(); convertView = inflater.inflate(R.layout.lv_item_layout, parent, false); viewHolder.imageView = (ImageView) convertView.findViewById(R.id.id_img); viewHolder.textView = (TextView) convertView.findViewById(R.id.id_title); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.textView.setText(items.get(position)); viewHolder.imageView.setImageResource(R.drawable.huoying); return convertView; } static class ViewHolder { ImageView imageView; TextView textView; } }
591eb1e256d9303133c3ba100ff9e23fc3312857
243eaf02e124f89a21c5d5afa707db40feda5144
/src/unk/com/tencent/mm/modelvideo/a.java
ecf7aadad3827e83ee1382fb89b1565cc51aa660
[]
no_license
laohanmsa/WeChatRE
e6671221ac6237c6565bd1aae02f847718e4ac9d
4b249bce4062e1f338f3e4bbee273b2a88814bf3
refs/heads/master
2020-05-03T08:43:38.647468
2013-05-18T14:04:23
2013-05-18T14:04:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
900
java
package unk.com.tencent.mm.modelvideo; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; public final class a { String N = null; c YE = null; String YF = null; String YG = null; String YH = null; final AsyncTask YI = new b(this); Context context = null; int duration = 0; Intent intent = null; public final void a(Context paramContext, Intent paramIntent, c paramc) { this.context = paramContext; this.intent = paramIntent; this.N = aa.fl((String)com.tencent.mm.k.b.b(2, "")); this.YG = w.qP().fn(this.N); this.YH = w.qP().fm(this.N); this.YE = paramc; this.YI.execute(new String[0]); } public final void cancel() { this.YE = null; } } /* Location: /home/danghvu/0day/WeChat/WeChat_4.5_dex2jar.jar * Qualified Name: com.tencent.mm.modelvideo.a * JD-Core Version: 0.6.2 */
83763cac957d86abf19d798c577fb04cde4fda37
dadecfaf88b4ee69915731edbdb3d1dc4da08e4b
/pensionmanager/src/ng/com/justjava/epayment/model/CollectionItem.java
686f9a5bf53d659d2cbf7de8ffef1e0c5de83880
[]
no_license
JustJavaConsultancyNG/Pension-Contribution-Management-System
23af826edf925eb61ceed905d153a07ccb3c941b
f1d6a5b20d2cedc02808f8255430ba2b15a2ddbb
refs/heads/master
2020-04-15T12:43:13.495235
2016-09-17T21:57:18
2016-09-17T21:57:18
63,818,104
0
2
null
2016-09-17T21:57:20
2016-07-20T22:09:22
CSS
UTF-8
Java
false
false
1,814
java
package ng.com.justjava.epayment.model; import java.math.*; import javax.persistence.*; import javax.xml.bind.annotation.*; import ng.com.justjava.filter.*; import org.openxava.annotations.*; @Entity @View(members="name;identifier;expectedAmount") @XmlAccessorType(XmlAccessType.NONE) /*@Tabs({@Tab(filter=LoginUserCorporateFilter.class,baseCondition = "${enable}=1 AND ${corporate.id}=?"), @Tab(name="allUsers",properties="user.givenName,user.familyName,corporate.name")})*/ //@Tab(filter=CollectionItemFilter.class,baseCondition = "${name} IN ?") public class CollectionItem { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Hidden private Long id; private String name; @ManyToOne @Embedded private Account account; private BigDecimal expectedAmount; @ManyToOne private Biller biller; @ManyToOne @AsEmbedded private CustomerIdentifier identifier; public Long getId() { return id; } public void setId(Long id) { this.id = id; } @XmlElement(name = "ExpectedAmount") public BigDecimal getExpectedAmount() { return expectedAmount; } public void setExpectedAmount(BigDecimal expectedAmount) { this.expectedAmount = expectedAmount; } @XmlElement(name = "CustomerIdentifier") public CustomerIdentifier getIdentifier() { return identifier; } public void setIdentifier(CustomerIdentifier identifier) { this.identifier = identifier; } public Biller getBiller() { return biller; } public void setBiller(Biller biller) { this.biller = biller; } @XmlElement(name = "Name") public String getName() { return name; } public void setName(String name) { this.name = name; } @XmlElement(name = "Account") public Account getAccount() { return account; } public void setAccount(Account account) { this.account = account; } }
5ec28039563990ff4aa845ea9750e77f84656080
05102319b57b59ac4c72296f126e7deab8aa4285
/src/main/java/net/imglib2/meta/DefaultTypedSpace.java
7c926545e2ac3e8c0e84595c1011da67335188b1
[ "BSD-2-Clause" ]
permissive
imagej/imagej-deprecated
2874c811f0ac1056785903d337542a7745d53127
484e5885a23cdc43a746f08fbae6823dfda88d61
refs/heads/master
2023-09-05T17:46:38.321427
2023-04-21T21:21:42
2023-04-21T21:21:42
42,454,800
0
2
BSD-2-Clause
2023-04-21T21:19:58
2015-09-14T14:45:39
Java
UTF-8
Java
false
false
2,056
java
/* * #%L * ImageJ2 software for multidimensional image processing and analysis. * %% * Copyright (C) 2009 - 2023 ImageJ2 developers. * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * #L% */ package net.imglib2.meta; import java.util.List; /** * Simple, default {@link TypedSpace} implementation. * * @author Curtis Rueden * @deprecated Use {@link net.imagej.space.DefaultTypedSpace} instead. */ @Deprecated public class DefaultTypedSpace extends AbstractTypedSpace<TypedAxis> { public DefaultTypedSpace(final int numDims) { super(numDims); for (int d = 0; d < numDims; d++) { setAxis(new DefaultTypedAxis(), d); } } public DefaultTypedSpace(final TypedAxis... axes) { super(axes); } public DefaultTypedSpace(final List<TypedAxis> axes) { super(axes); } }
b373a95929d70a58566794b4b54d1807b8bb4629
c2f9077086d1fa50296da2d684d345e1496bf51e
/src/ZhenTi/HostroyOf2013/Question1.java
4aa5de03fc29fd5d5506646e1757faec322befbe
[]
no_license
shahui2106/LanQiaoBei
dec38699d1b33800103166c5b8a3fb4a5a4813e2
18411a6536ec932ef7004a5984cf1ad055fe40a5
refs/heads/master
2020-12-07T12:28:48.793739
2020-10-18T09:29:51
2020-10-18T09:29:51
232,721,912
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package ZhenTi.HostroyOf2013; import java.util.Calendar; import java.util.Date; /** * 2013年省赛真题1: * 1999年12月31日(星期五)之后最近的哪一个世纪末的12月31日是星期日? * 输出四位数,即年份即可。 * * @author zhu * @datetime 2020-02-25 15:45 */ public class Question1 { public static void main(String[] args) { Calendar instance = Calendar.getInstance(); Date date = new Date(); int year = 1999; while (true) { instance.set(year, 11, 31); date = instance.getTime(); if (date.getDay() == 0) { System.out.println(year); break; } year += 100; } } }
cf54278815d066112070d3c0121f454288851318
9b2dd61be5949db83680c07036c511c03170697c
/app/src/main/java/com/lambdaschool/congressdetails/ItemListActivity.java
07e3183c1e427e3913876f85d325606a7a4a2435
[]
no_license
VivekV95/Android_Congress
e62448faf3f55c5e3f073560364ba9ad47e2306d
9cf3aecf89756ea1e079563a17b3da66fd82ca4f
refs/heads/master
2020-05-18T20:37:33.847949
2019-05-02T22:54:41
2019-05-02T22:54:41
184,638,891
0
0
null
2019-05-02T19:22:36
2019-05-02T19:22:35
null
UTF-8
Java
false
false
6,254
java
package com.lambdaschool.congressdetails; import android.arch.lifecycle.Observer; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.arch.lifecycle.ViewModelProviders; import com.lambdaschool.congressdataapiaccess.CongresspersonOverview; import java.util.ArrayList; /** * An activity representing a list of Items. This activity * has different presentations for handset and tablet-size devices. On * handsets, the activity presents a list of items, which when touched, * lead to a {@link ItemDetailActivity} representing * item details. On tablets, the activity presents the list of items and * item details side-by-side using two vertical panes. */ public class ItemListActivity extends AppCompatActivity { /** * Whether or not the activity is in two-pane mode, i.e. running on a tablet * device. */ private boolean mTwoPane; private CPOViewModel viewModel; Context context; RecyclerView recyclerView; SimpleItemRecyclerViewAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_item_list); context = this; viewModel = ViewModelProviders.of(this).get(CPOViewModel.class); viewModel.getLiveData(this).observe(this, new Observer<ArrayList<CongresspersonOverview>>() { @Override public void onChanged(@Nullable ArrayList<CongresspersonOverview> congresspersonOverviews) { adapter.notifyDataSetChanged(); } }); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setTitle(getTitle()); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); if (findViewById(R.id.item_detail_container) != null) { // The detail container view will be present only in the // large-screen layouts (res/values-w900dp). // If this view is present, then the // activity should be in two-pane mode. mTwoPane = true; } recyclerView = findViewById(R.id.item_list); assert recyclerView != null; adapter = new SimpleItemRecyclerViewAdapter(this, viewModel.getLiveData(context).getValue(), mTwoPane); recyclerView.setAdapter(adapter); } public static class SimpleItemRecyclerViewAdapter extends RecyclerView.Adapter<SimpleItemRecyclerViewAdapter.ViewHolder> { private final ItemListActivity mParentActivity; private final ArrayList<CongresspersonOverview> mValues; private final boolean mTwoPane; private final View.OnClickListener mOnClickListener = new View.OnClickListener() { @Override public void onClick(View view) { String item = (String) view.getTag(); if (mTwoPane) { Bundle arguments = new Bundle(); arguments.putString(ItemDetailFragment.ARG_ITEM_ID, item); ItemDetailFragment fragment = new ItemDetailFragment(); fragment.setArguments(arguments); mParentActivity.getSupportFragmentManager().beginTransaction() .replace(R.id.item_detail_container, fragment) .commit(); } else { Context context = view.getContext(); Intent intent = new Intent(context, ItemDetailActivity.class); intent.putExtra(ItemDetailFragment.ARG_ITEM_ID, item); context.startActivity(intent); } } }; SimpleItemRecyclerViewAdapter(ItemListActivity parent, ArrayList<CongresspersonOverview> items, boolean twoPane) { mValues = items; mParentActivity = parent; mTwoPane = twoPane; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_list_content, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(final ViewHolder holder, int position) { holder.firstName.setText(mValues.get(position).getFirstName()); holder.lastName.setText(mValues.get(position).getLastName()); holder.state.setText(mValues.get(position).getState()); holder.party.setText(mValues.get(position).getParty()); holder.itemView.setTag(mValues.get(position).getId()); holder.itemView.setOnClickListener(mOnClickListener); } @Override public int getItemCount() { return mValues.size(); } class ViewHolder extends RecyclerView.ViewHolder { final TextView firstName; final TextView lastName; final TextView party; final TextView state; ViewHolder(View view) { super(view); firstName = view.findViewById(R.id.first_name); lastName = view.findViewById(R.id.last_name); party = view.findViewById(R.id.party); state = view.findViewById(R.id.state); } } } }
7fd07623c2e0e4797f945710e6be83e70ae3054e
22db961e768f0163ba30f75446a51d8f75cb6153
/app/src/main/java/in/dsij/acemomentum/net/res/ResGetProducts.java
f5ee23081d44ee56b9dff7ab4deffd8f70d5e822
[]
no_license
sandipDSIJ/DSIJ-ACE_MomentumApp
d291376646c063383c400cc297a4e4545b40b402
3da5a1a62b04b8db86cbd8098bfd4bece9404ec1
refs/heads/master
2020-04-01T12:54:07.141505
2018-10-16T06:04:27
2018-10-16T06:04:27
153,228,761
0
0
null
null
null
null
UTF-8
Java
false
false
1,844
java
package in.dsij.acemomentum.net.res; import java.util.List; /** * Created by Vikas on 10/10/2017. */ public class ResGetProducts { private List<ProductBean> Product; public List<ProductBean> getProduct() { return Product; } public void setProduct(List<ProductBean> Product) { this.Product = Product; } public static class ProductBean { /** * ProductName : ACE Momentum * ProductId : 202 * PriorityId : 1 * Subscribed : false * Trial : false * New : false */ private String ProductName; private long ProductId; private int PriorityId; private boolean Subscribed; private boolean Trial; private boolean New; public String getProductName() { return ProductName; } public void setProductName(String ProductName) { this.ProductName = ProductName; } public long getProductId() { return ProductId; } public void setProductId(long ProductId) { this.ProductId = ProductId; } public int getPriorityId() { return PriorityId; } public void setPriorityId(int PriorityId) { this.PriorityId = PriorityId; } public boolean isSubscribed() { return Subscribed; } public void setSubscribed(boolean Subscribed) { this.Subscribed = Subscribed; } public boolean isTrial() { return Trial; } public void setTrial(boolean Trial) { this.Trial = Trial; } public boolean isNew() { return New; } public void setNew(boolean New) { this.New = New; } } }
6f0702c65c1b1e89a1001424e3628f51bd808e42
fd2635bcd0890903bd8841694e46244c4c51bfe1
/src/descartesj/ImageList.java
5b00c18236f376dbd70317cb0fdfd01c22cbcff2
[]
no_license
tupolev/DescartesJ
010137bd634c08b2a711f904dcc9b9d1632f0609
e2da3cc633cfeb8b5d287b78abfbdee65ce2ae02
refs/heads/master
2021-01-10T19:54:16.275374
2012-08-29T22:10:26
2012-08-29T22:10:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,280
java
package descartesj; import java.util.*; public class ImageList { private int current = 0; private List<DImage> imageList; public int getCurrent() { return current; } public void setCurrent(int current) { this.current = current; } private List<DImage> getImageList() { return imageList; } private void setImageList(List<DImage> imageList) { this.imageList = imageList; } public List<DImage> getList() { return this.getImageList(); } public ImageList() { this.setImageList(new ArrayList<DImage>()); } public boolean add(DImage image) { this.getImageList().add(image); return (this.getImageList().lastIndexOf(image) >= 0); } public int count() { return this.getImageList().size(); } public String selectCurrent() { this.getImageList().get(this.getCurrent()).setStatus("selected"); return this.getImageList().get(this.getCurrent()).getStatus(); } public String discardCurrent() { this.getImageList().get(this.getCurrent()).setStatus("discarded"); return this.getImageList().get(this.getCurrent()).getStatus(); } }
935c327bcac56ee5265e2e9502ff6adab43ee8de
b61b1f508d0d763150210fd55f85a98704725a09
/gulimall-product/src/main/java/com/atguigu/gulimall/product/exception/GulimallExceptionControllerAdvice.java
8a1504f8045598fd0b3d3ae959c39f0a93079127
[ "Apache-2.0" ]
permissive
changsongyang/gulimall
e03578c1ee342417227df74a6393beda78f8c411
3364335bca6cbb8af2efbf72d5e1103eb21207e0
refs/heads/main
2023-01-04T06:36:39.849550
2020-10-22T13:46:01
2020-10-22T13:46:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,619
java
package com.atguigu.gulimall.product.exception; import com.atguigu.common.exception.BizCodeEnume; import com.atguigu.common.utils.R; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.BindingResult; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import java.util.HashMap; import java.util.Map; /** * 统一异常处理 * @author dengzhiming * @date 2020/10/11 20:46 */ @Slf4j //@ControllerAdvice @RestControllerAdvice(basePackages = "com.atguigu.gulimall.product.controller") public class GulimallExceptionControllerAdvice { //@ResponseBody + @ControllerAdvice = @RestControllerAdvice @ExceptionHandler(value = MethodArgumentNotValidException.class) public R handleVaildException(MethodArgumentNotValidException e){ log.error("数据校验出现问题: ",e); BindingResult bindingResult = e.getBindingResult(); Map<String,String> errorMap = new HashMap<>(); bindingResult.getFieldErrors().forEach(fieldError -> { errorMap.put(fieldError.getField(),fieldError.getDefaultMessage()); }); return R.error(BizCodeEnume.VAILD_EXCEPTION.getCode(),BizCodeEnume.VAILD_EXCEPTION.getMessage()).put("data",errorMap); } @ExceptionHandler(value = Exception.class) public R handleException(Exception e){ log.error("系统未知异常: ",e); return R.error(BizCodeEnume.UNKNOW_EXCEPTION.getCode(),BizCodeEnume.UNKNOW_EXCEPTION.getMessage()); } }
11ea237a03d927bd9bbb994dc0fe1f8bb7358377
21e610a87b7a055a108353cacea976bf3c9c9c4a
/Core/src/me/shawlaf/varlight/spigot/nms/NmsAdapter.java
b17f29b7f38ae9c86bb4be8f7a8cb7e5a50ad1d6
[]
no_license
R4z0rX/VarLight
6b08981d4690614b652671235783f850fc02d067
e383a0639724c53c110a833220e0d65df4730551
refs/heads/master
2020-12-03T22:52:19.808601
2020-01-03T04:39:24
2020-01-03T04:39:24
231,512,629
0
0
null
2020-01-03T04:35:19
2020-01-03T04:35:18
null
UTF-8
Java
false
false
2,212
java
package me.shawlaf.varlight.spigot.nms; import me.shawlaf.varlight.spigot.VarLightPlugin; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collection; @ForMinecraft(version = "UNDEFINED") public class NmsAdapter implements INmsAdapter { public NmsAdapter(VarLightPlugin plugin) { throw new AbstractMethodError(); } @Override public @Nullable Material keyToType(String namespacedKey, MaterialType type) { throw new AbstractMethodError(); } @Override public String materialToKey(Material material) { throw new AbstractMethodError(); } @Override public Collection<String> getTypes(MaterialType type) { throw new AbstractMethodError(); } @Override public boolean isIllegalLightUpdateItem(Material material) { throw new AbstractMethodError(); } @Override public boolean isBlockTransparent(@NotNull Block block) { throw new AbstractMethodError(); } @Override public void updateBlockLight(@NotNull Location at, int lightLevel) { throw new AbstractMethodError(); } @Override public int getEmittingLightLevel(@NotNull Block block) { throw new AbstractMethodError(); } @Override public void sendChunkUpdates(@NotNull Chunk chunk, int mask) { throw new AbstractMethodError(); } @Override public boolean isIllegalBlock(@NotNull Block block) { throw new AbstractMethodError(); } @Override public void sendActionBarMessage(Player player, String message) { throw new AbstractMethodError(); } @Override public ItemStack getVarLightDebugStick() { throw new AbstractMethodError(); } @NotNull @Override public String getNumericMinecraftVersion() { throw new AbstractMethodError(); } @Override public Block getTargetBlockExact(Player player, int maxDistance) { throw new AbstractMethodError(); } }
830d3bbd93823efce7500990412747f703d9444f
0013a10ff59696a7122cc7c3ba78e21efab0d267
/bus-image/src/main/java/org/aoju/bus/image/metric/ImageException.java
547f77ccb4ccbb894261e24d3bd701ccc32bbbef
[ "MIT" ]
permissive
smile2049/bus
3ce28ab6631f5a26394b9370658e1b761a73ae68
9f95d736f23a40a3463a59f0b41b6ad6d7b0c129
refs/heads/master
2022-11-18T09:05:04.318261
2020-07-07T06:40:36
2020-07-07T06:40:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,453
java
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2020 aoju.org and other contributors. * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * * THE SOFTWARE. * ********************************************************************************/ package org.aoju.bus.image.metric; import org.aoju.bus.core.lang.exception.RelevantException; import org.aoju.bus.image.Status; import org.aoju.bus.image.Tag; import org.aoju.bus.image.galaxy.Property; import org.aoju.bus.image.galaxy.data.Attributes; import org.aoju.bus.image.galaxy.data.VR; import org.aoju.bus.image.galaxy.data.ValidationResult; /** * 自定义异常: 影像异常 * * @author Kimi Liu * @version 6.0.2 * @since JDK 1.8+ */ public class ImageException extends RelevantException { private final Attributes rsp; private Attributes data; public ImageException(int status) { rsp = new Attributes(); rsp.setInt(Tag.Status, VR.US, status); } public ImageException(int status, String message) { super(message); rsp = new Attributes(); rsp.setInt(Tag.Status, VR.US, status); setErrorComment(getMessage()); } public ImageException(int status, Throwable cause) { super(cause); rsp = new Attributes(); rsp.setInt(Tag.Status, VR.US, status); setErrorComment(getMessage()); } public static ImageException valueOf(ValidationResult result, Attributes attrs) { if (result.hasNotAllowedAttributes()) return new ImageException(Status.NoSuchAttribute) .setAttributeIdentifierList(result.tagsOfNotAllowedAttributes()); if (result.hasMissingAttributes()) return new ImageException(Status.MissingAttribute) .setAttributeIdentifierList(result.tagsOfMissingAttributes()); if (result.hasMissingAttributeValues()) return new ImageException(Status.MissingAttributeValue) .setDataset(new Attributes(attrs, result.tagsOfMissingAttributeValues())); if (result.hasInvalidAttributeValues()) return new ImageException(Status.InvalidAttributeValue) .setDataset(new Attributes(attrs, result.tagsOfInvalidAttributeValues())); return null; } public ImageException setErrorComment(String val) { if (val != null) rsp.setString(Tag.ErrorComment, VR.LO, Property.truncate(val, 64)); return this; } public ImageException setErrorID(int val) { rsp.setInt(Tag.ErrorID, VR.US, val); return this; } public ImageException setEventTypeID(int val) { rsp.setInt(Tag.EventTypeID, VR.US, val); return this; } public ImageException setActionTypeID(int val) { rsp.setInt(Tag.ActionTypeID, VR.US, val); return this; } public ImageException setOffendingElements(int... tags) { rsp.setInt(Tag.OffendingElement, VR.AT, tags); return this; } public ImageException setAttributeIdentifierList(int... tags) { rsp.setInt(Tag.AttributeIdentifierList, VR.AT, tags); return this; } public ImageException setUID(int tag, String value) { rsp.setString(tag, VR.UI, value); return this; } public final Attributes getDataset() { return data; } public final ImageException setDataset(Attributes data) { this.data = data; return this; } public Attributes mkRSP(int cmdField, int msgId) { rsp.setInt(Tag.CommandField, VR.US, cmdField); rsp.setInt(Tag.MessageIDBeingRespondedTo, VR.US, msgId); return rsp; } }
a35b544379c600763a3576e5e409fe7fb771f9f0
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_56b2154df85502e888676e2c01cf2391bd00807c/VersionedGraph/2_56b2154df85502e888676e2c01cf2391bd00807c_VersionedGraph_s.java
7a789fe9c0c1f75f50904c224a38d9e7e4bde282
[]
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
27,594
java
/** * Copyright (c) 2012-2013 "Vertix Technologies, ltd." * * This file is part of Antiquity. * * Antiquity is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.vertixtech.antiquity.graph; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Strings; import com.google.common.collect.ImmutableSet; import com.tinkerpop.blueprints.Direction; import com.tinkerpop.blueprints.Edge; import com.tinkerpop.blueprints.Element; import com.tinkerpop.blueprints.Graph; import com.tinkerpop.blueprints.TransactionalGraph; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.util.wrappers.event.EventEdge; import com.tinkerpop.blueprints.util.wrappers.event.EventElement; import com.tinkerpop.blueprints.util.wrappers.event.EventGraph; import com.tinkerpop.blueprints.util.wrappers.event.EventVertex; import com.tinkerpop.blueprints.util.wrappers.event.listener.GraphChangedListener; import com.vertixtech.antiquity.graph.identifierBehavior.GraphIdentifierBehavior; import com.vertixtech.antiquity.range.Range; import com.vertixtech.antiquity.utils.ExceptionFactory; /** * Versioned graph implementation, * * <p> * The underline graph must support transactions. * </p> * * @see Graph * @see TransactionalGraph */ public abstract class VersionedGraph<T extends Graph, V extends Comparable<V>> extends EventGraph<T> implements GraphChangedListener { Logger log = LoggerFactory.getLogger(VersionedGraph.class); private final static Set<String> internalProperties; /** * The property key which stores the last graph version */ public static final String LATEST_GRAPH_VERSION_PROP_KEY = "__LATEST_GRAPH_VERSION__"; /** * A marker property key which indicates that the {@link Element} is removed. */ public static final String REMOVED_PROP_KEY = "__REMOVED__"; /** * A property key which holds the minimum valid version of this element. */ public static final String VALID_MIN_VERSION_PROP_KEY = "__VALID_MIN_VERSION__"; /** * A property key which holds the maximum valid version of this element. */ public static final String VALID_MAX_VERSION_PROP_KEY = "__VALID_MAX_VERSION__"; /** * The identifier of the graph configuration vertex */ public static final String GRAPH_CONF_VERTEX_ID = "VERSIONED_GRAPH_CONF_VERTEX"; /** * The label name of the edge which creates the chain of a vertex revisions */ public static final String PREV_VERSION_CHAIN_EDGE_TYPE = "PREV_VERSION"; /** * An element property key which indicates whether the element is for historical purposes or not. * * Historical elements are elements which were created for audit purposes and are not the active/alive data. */ public static final String HISTORIC_ELEMENT_PROP_KEY = "__HISTORIC__"; /** * The key name of the private hash calculation */ public static final String PRIVATE_HASH_PROP_KEY = "__PRIVATE_HASH__"; /** * The identifier behavior associated with this graph */ protected final GraphIdentifierBehavior<V> identifierBehavior; /** * The graph configuration */ protected final Configuration conf; static { internalProperties = ImmutableSet.of(LATEST_GRAPH_VERSION_PROP_KEY, REMOVED_PROP_KEY, VALID_MIN_VERSION_PROP_KEY, VALID_MAX_VERSION_PROP_KEY, HISTORIC_ELEMENT_PROP_KEY, PRIVATE_HASH_PROP_KEY); } public VersionedGraph(T baseGraph, GraphIdentifierBehavior<V> identifierBehavior) { this(baseGraph, identifierBehavior, null); } /** * Create an instance of {@link VersionedGraph} with the specified underline {@link Graph}. * * @param baseGraph * The underline base graph */ public VersionedGraph(T baseGraph, GraphIdentifierBehavior<V> identifierBehavior, Configuration conf) { super(baseGraph); addListener(this); this.identifierBehavior = identifierBehavior; identifierBehavior.setGraph(this); if (conf == null) this.conf = new Configuration(); else this.conf = conf; // TODO: A better approach to do that // Create the conf vertex if it does not exist if (getVersionConfVertex() == null) { Vertex v = baseGraph.addVertex(GRAPH_CONF_VERTEX_ID); v.setProperty("GRAPH_CONF_VERTEX_ID", "GRAPH_CONF_VERTEX_ID"); } } // Operation Overrides // -------------------------------------------------------------- @Override public Vertex addVertex(final Object id) { final Vertex vertex = this.baseGraph.addVertex(id); if (vertex == null) { return null; } else { VersionedVertex vv = new VersionedVertex<V>(vertex, this.graphChangedListeners, this.trigger, this, getLatestGraphVersion()); this.onVertexAdded(vv); return vv; } } @Override public Vertex getVertex(final Object id) { return getVertex(id, getLatestGraphVersion()); } @Override public Iterable<Vertex> getVertices() { return getVertices(getLatestGraphVersion()); } @Override public Iterable<Vertex> getVertices(final String key, final Object value) { return getVertices(key, value, getLatestGraphVersion()); } @Override public Iterable<Edge> getEdges() { return getEdges(getLatestGraphVersion()); } @Override public Iterable<Edge> getEdges(final String key, final Object value) { return getEdges(key, value, getLatestGraphVersion()); } @Override public void removeVertex(final Vertex vertex) { raiseExceptionIfNotVersionedElement(vertex); this.onVertexRemoved(vertex); } @Override public void removeEdge(final Edge edge) { raiseExceptionIfNotVersionedElement(edge); this.onEdgeRemoved(edge); } // Enhanced methods for the standard blueprint graph API // ------------------------------------------------------ /** * <p> * Get a vertex by id for the specified version. * </p> * * <p> * A vertex revision must be available for the specified version, otherwise a null will be returned. * </p> * * @param id * The unique id of the vertex * @param version * The version to get the vertex for * @return The found vertex, or null if not found */ public Vertex getVertex(final Object id, V version) { final Vertex vertex = this.baseGraph.getVertex(id); if (vertex == null) { return null; } else { if (isHistoricalOrInternal(vertex)) { return vertex; } else { return new VersionedVertex<V>(vertex, this.graphChangedListeners, this.trigger, this, version); } } } /** * Get all vertices for the specified version. * * @param version * The version to get the vertices for * @return An {@link Iterable} of the found vertices for the specified version. */ public Iterable<Vertex> getVertices(V version) { return new VersionedVertexIterable<V>(this.baseGraph.getVertices(), this.graphChangedListeners, this.trigger, this, version); } /** * Return an iterable to all the vertices in the graph that have a particular key/value property for the specified * version. * * @param key * The key of the property to filter vertices by * @param value * The value of the property to filter vertices by * @param version * The version to get the vertices for * @return An {@link Iterable} of the found vertices for the specified criteria. */ public Iterable<Vertex> getVertices(final String key, final Object value, V version) { return new VersionedVertexIterable<V>(this.baseGraph.getVertices(key, value), this.graphChangedListeners, this.trigger, this, version); } /** * Return an iterable to all the edges in the graph for the specified version * * @param version * The version to get the edges for * @return An {@link Iterable} of the found edges for the specified version. */ public Iterable<Edge> getEdges(V version) { return new VersionedEdgeIterable<V>(this.baseGraph.getEdges(), this.graphChangedListeners, this.trigger, this, version); } /** * Return an iterable to all the edges in the graph that have a particular key/value property for the specified * version. * * @param key * The key of the property to filter edges by * @param value * The value of the property to filter edges by * @param version * The version to get the edges for * @return An {@link Iterable} of the found edges for the specified criteria */ public Iterable<Edge> getEdges(final String key, final Object value, V version) { return new VersionedEdgeIterable<V>(this.baseGraph.getEdges(key, value), this.graphChangedListeners, this.trigger, this, version); } // Get/Set Version Methods // -------------------------------------------------------------- /** * Set a version range of the specified element. * * @param versionedElement * The element to set the version range. * @param range * The version {@link Range} */ public void setVersion(Element versionedElement, Range<V> range) { setStartVersion(versionedElement, range.min()); setEndVersion(versionedElement, range.max()); } /** * Set the start version range of the specified element. * * @param versionedElement * The element to set the start version range. * @param startVersion * The start version to set */ public void setStartVersion(Element versionedElement, V startVersion) { setVersion(StartOrEnd.START, versionedElement, startVersion); } /** * Set the end version range of the specified element. * * @param versionedElement * The element to set the end version range. * @param endVersion * The end version to set */ public void setEndVersion(Element versionedElement, V endVersion) { setVersion(StartOrEnd.END, versionedElement, endVersion); } public void setPrivateHash(Vertex vertex) { String newHash = ElementUtils.calculateElementPrivateHash(vertex, getInternalProperties()); if (vertex instanceof VersionedVertex) { VersionedVertex<V> versionedVertex = ((VersionedVertex<V>) vertex); String oldHash = (String) versionedVertex.getBaseVertex() .getProperty(VersionedGraph.PRIVATE_HASH_PROP_KEY); if (Strings.isNullOrEmpty(oldHash) && (!oldHash.equals(newHash))) { ((VersionedVertex<V>) vertex).getBaseVertex() .setProperty(VersionedGraph.PRIVATE_HASH_PROP_KEY, newHash); } else { log.debug("Calculated hash of vertex[{}] is equal to the existing hash, nothing to set."); } } else { vertex.setProperty(VersionedGraph.PRIVATE_HASH_PROP_KEY, newHash); } } public String getPrivateHash(Vertex vertex) { if (vertex instanceof VersionedVertex) return (String) vertex.getProperty(VersionedGraph.PRIVATE_HASH_PROP_KEY); else throw new IllegalArgumentException("The specified vertex is not a versioned graph."); } /** * An enum which indicates the start or the end edges of a range. */ enum StartOrEnd { START, END } /** * Set the start or end version of the element * * @param startOrEnd * Whether to set the start or the end of the version range. * @param versionedElement * The graph {@link Element} to set the version for * @param version * The version to set */ public void setVersion(StartOrEnd startOrEnd, Element versionedElement, V version) { // TODO: A more appropriate way to handle element types Element e = getNonEventElement(versionedElement); if (startOrEnd == StartOrEnd.START) e.setProperty(VALID_MIN_VERSION_PROP_KEY, version); else e.setProperty(VALID_MAX_VERSION_PROP_KEY, version); } /** * Get the start version of the specified element * * @param versionedElement * The element to get the start version. * @return The start version of the specified element. */ @SuppressWarnings("unchecked") public V getStartVersion(Element versionedElement) { return (V) getNonEventElement(versionedElement).getProperty(VALID_MIN_VERSION_PROP_KEY); } /** * Get the end version of the specified element * * @param versionedElement * The element to get the end version. * @return The end version of the specified element. */ @SuppressWarnings("unchecked") public V getEndVersion(Element versionedElement) { return (V) getNonEventElement(versionedElement).getProperty(VALID_MAX_VERSION_PROP_KEY); } /** * Get the version range of the specified element. * * @param versionedElement * The element to get the version range for. * @return a {@link Range} of version of the specified element. */ public Range<V> getVersionRange(Element versionedElement) { return Range.range(getStartVersion(versionedElement), getEndVersion(versionedElement)); } /** * Determine whether the specified version is the start version of the specified element. * * @param version * The version to determine as the start of the version range. * @param versionedElement * The element to check * @return true if the specified version is the start version of the specified element. */ public boolean isStartVersion(V version, Element versionedElement) { return version.equals(getStartVersion(versionedElement)); } /** * Determine whether the specified version is the end version of the specified element. * * @param version * The version to determine as the end of the version range. * @param versionedElement * The element to check * @return true if the specified version is the end version of the specified element. */ public boolean isEndVersion(V version, Element versionedElement) { return version.equals(getEndVersion(versionedElement)); } // Graph Version Identifier Methods // -------------------------------------------------------------- protected V getLatestGraphVersion() { return identifierBehavior.getLatestGraphVersion(); } /** * Get the maximum possible graph version. * * @see GraphIdentifierBehavior#getMaxPossibleGraphVersion() * @return The maximum possible graph version */ public V getMaxPossibleGraphVersion() { return identifierBehavior.getMaxPossibleGraphVersion(); } /** * Get the next graph version. * * @see #allocateNextGraphVersion(Comparable) * @param allocate * Whether to allocate the next version or not. * @return The next version of the graph */ protected V getNextGraphVersion(boolean allocate) { V nextGraphVersion = identifierBehavior.getNextGraphVersion(getLatestGraphVersion()); if (allocate) allocateNextGraphVersion(nextGraphVersion); // TODO: Unlock the configuration vertex if allocate=false, otherwise unlock should occur during transaction // commit return nextGraphVersion; } /** * Allocate (persist) the specified next version in the graph in the configuration vertex. * * @param nextVersion * The next version to allocate. */ protected void allocateNextGraphVersion(V nextVersion) { // TODO: Unlock the configuration vertex getVersionConfVertex().setProperty(LATEST_GRAPH_VERSION_PROP_KEY, nextVersion); } /** * Get the version configuration {@link Vertex}. * * <p> * Configuration vertex is queried very often and recommended to be cached. * </p> * * @return The configuration vertex of the versioned graph. */ public Vertex getVersionConfVertex() { Vertex v = getBaseGraph().getVertex(GRAPH_CONF_VERTEX_ID); if (v == null) { Iterable<Vertex> vs = getBaseGraph().getVertices("GRAPH_CONF_VERTEX_ID", "GRAPH_CONF_VERTEX_ID"); if (vs.iterator().hasNext()) { v = vs.iterator().next(); return v; } else { return null; } } else { return v; } // if (v == null) // throw new RuntimeException("Could not find the graph configuration vertex"); } // Methods used by events responses // -------------------------------------------------------------- /** * Version vertices in the graph. * * @param version * The graph version that created the specified vertices * @param vertices * The vertices to be versioned. */ protected void versionAddedVertices(V version, Iterable<Vertex> vertices) { Range<V> range = Range.range(version, identifierBehavior.getMaxPossibleGraphVersion()); for (Vertex v : vertices) { getNonEventElement(v).setProperty(HISTORIC_ELEMENT_PROP_KEY, false); setVersion(v, range); if (conf.getPrivateHashEnabled()) { setPrivateHash(v); } } } /** * Version edges in the graph. * * @param version * The graph version that created the specified edges * @param edges * The edges to be versioned. */ protected void versionAddedEdges(V version, Iterable<Edge> edges) { Range<V> range = Range.range(version, identifierBehavior.getMaxPossibleGraphVersion()); for (Edge e : edges) { setVersion(e, range); } } protected void versionRemovedVertices(V nextVer, V maxVer, Iterable<Vertex> vertices) { for (Vertex v : vertices) { getNonEventElement(v).setProperty(REMOVED_PROP_KEY, nextVer); getNonEventElement(v).setProperty(VALID_MAX_VERSION_PROP_KEY, maxVer); } } protected void versionRemovedEdges(V nextVer, V maxVer, Iterable<Edge> edges) { for (Edge e : edges) { getNonEventElement(e).setProperty(REMOVED_PROP_KEY, nextVer); getNonEventElement(e).setProperty(VALID_MAX_VERSION_PROP_KEY, maxVer); } } /** * Create a historical vertex which contains the modified vertex content before it was modified. * * TODO return vertex should be immutable. * * @param modifiedVertex * The modified {@link VersionedVertex}. * @param oldValues * The old properties values of the modified versioned vertex. * @return {@link Vertex} containing the old data before the vertex was modified. */ private Vertex createHistoricalVertex(VersionedVertex<V> modifiedVertex, Map<String, Object> oldValues) { // TODO: Auto identifier? Vertex hv = getBaseGraph().addVertex(modifiedVertex.getId() + "-" + getLatestGraphVersion()); hv.setProperty(HISTORIC_ELEMENT_PROP_KEY, true); // ElementHelper.copyProperties(modifiedVertex, hv); // Iterate on the base prop keys as we'r currently working on an active vertex for (final String key : modifiedVertex.getBaseElement().getPropertyKeys()) { if (isInternalProperty(key)) continue; hv.setProperty(key, modifiedVertex.getBaseElement().getProperty(key)); } for (Map.Entry<String, Object> prop : oldValues.entrySet()) { String key = prop.getKey(); Object value = prop.getValue(); if (value == null) { hv.removeProperty(key); } else { hv.setProperty(key, value); } } return hv; } /** * Add the historical vertex in the vertex versions chain * * @param latestGraphVersion * The latest graph version * @param newVersion * The new version to be committed * @param modifiedVertex * The modified vertex * @param newHistoricalVertex * The historical vertex of the modified vertex */ private void addHistoricalVertexInChain(V latestGraphVersion, V newVersion, VersionedVertex<V> modifiedVertex, Vertex newHistoricalVertex) { Iterable<Edge> currEdges = modifiedVertex.getBaseVertex().getEdges(Direction.OUT, PREV_VERSION_CHAIN_EDGE_TYPE); Iterator<Edge> currEdgesIterator = currEdges.iterator(); if (currEdges.iterator().hasNext()) { Edge currEdge = currEdgesIterator.next(); if (currEdgesIterator.hasNext()) throw new IllegalStateException("Multiple versioned edges in vertex chain exist"); // TODO: Edge id? getBaseGraph().addEdge(null, newHistoricalVertex, currEdge.getVertex(Direction.IN), PREV_VERSION_CHAIN_EDGE_TYPE); getBaseGraph().removeEdge((currEdge instanceof EventEdge) ? ((EventEdge) currEdge).getBaseEdge() : currEdge); } // TODO: Edge id? getBaseGraph().addEdge(null, ((EventVertex) modifiedVertex).getBaseVertex(), newHistoricalVertex, PREV_VERSION_CHAIN_EDGE_TYPE); setStartVersion(newHistoricalVertex, getStartVersion(modifiedVertex)); setEndVersion(newHistoricalVertex, latestGraphVersion); } /** * Version the specified modified vertex. * * TODO return vertex should be immutable. * * @param latestGraphVersion * The latest graph version * @param newVersion * The new version to be committed * @param vertex * The modified vertex * @param oldValues * The old properties values of the modified vertex * * @return The historical created vertex */ protected Vertex versionModifiedVertex(V latestGraphVersion, V newVersion, VersionedVertex<V> vertex, Map<String, Object> oldValues) { Vertex historicalV = createHistoricalVertex(vertex, oldValues); addHistoricalVertexInChain(latestGraphVersion, newVersion, vertex, historicalV); setStartVersion(vertex, newVersion); if (conf.getPrivateHashEnabled()) setPrivateHash(vertex); return historicalV; } /** * Get the relevant vertex revision from the history for the specified vertex and version. TODO return vertex should * be immutable. * * @param vertex * The vertex to find the appropriate version for * @param version * The version to find the revision for * @return A vertex revision for the specified version * @throws NotFoundException * In case no vertex revision was found for the specified vertex and version */ public Vertex getVertexForVersion(Vertex vertex, V version) { // TODO: Find a better approach to force versioning for vertex versions. if (vertex instanceof VersionedVertex) ((VersionedVertex<V>) vertex).setForVersion(version); Range<V> verRange = getVersionRange(vertex); log.debug("Finding vertex[{}] in revision history for version [{}].", vertex, version); log.debug("Is vertex [{}] with range [{}] contains version [{}]?", vertex, verRange, version); if (!verRange.contains(version)) { log.debug("No, seeking for previous vertex version"); // Iterate over the base (non filtered) edges to seek for the revision chain edge Iterable<Edge> prevVerEdges = getNonEventElement(vertex).getEdges(Direction.OUT, PREV_VERSION_CHAIN_EDGE_TYPE); if (!prevVerEdges.iterator().hasNext()) { throw ExceptionFactory.notFoundException(String.format("Cannot find vertex %s in revision history for version [%s].", vertex, version)); } Edge edge = prevVerEdges.iterator().next(); return getVertexForVersion(edge.getVertex(Direction.IN), version); } log.debug("Found vertex[{}] in revision history for version [{}].", vertex, version); return vertex; } /** * Returns the property value of {@link VersionedVertex} for the specified key. Please note that this method will * return the value of the property for the specific version set in the {@link VersionedVertex}. * * A null will be returned if property doesn't exist for the specified {@link VersionedVertex} in its set version. * * @see VersionedVertex#getForVersion() * @param vertex * The {@link VersionedVertex} to get the property value of. * @param key * The proeprty key * @return The value of the specified property key for the specified @{link {@link VersionedVertex} or null if not * found. */ public Object getProperty(VersionedVertex<V> vertex, String key) { try { log.debug("Getting property [{}] for vertex [{}] for version [{}]", key, vertex, vertex.getForVersion()); Vertex v = getVertexForVersion(vertex, vertex.getForVersion()); // Return the value from the base element return getNonEventElement(v).getProperty(key); } catch (NotFoundException e) { return null; } } public Set<String> getPropertyKeys(VersionedVertex<V> vertex) { try { Vertex v = getVertexForVersion(vertex, vertex.getForVersion()); // Return the keys from the base element return getNonEventElement(v).getPropertyKeys(); } catch (NotFoundException e) { return null; } } // Internal Utils // -------------------------------------------------------------- /** * If the specified element supports Events, then return its base element. * * @param element * The element to check whether it supports Events or not. * @return If the specified element supports Events, then return its base element. */ @SuppressWarnings("unchecked") private <G extends Element> G getNonEventElement(G element) { if (element instanceof EventElement) { return (G) ((EventElement) element).getBaseElement(); } else { return element; } } /** * Raise an exception of the specified {@link Element} does not support events. * * @param element * The element to be checked */ private void raiseExceptionIfNotVersionedElement(Element element) { if (!(element instanceof EventElement)) { throw new IllegalArgumentException(String.format("Element [%s] does not support events.", element)); } } /** * Returns whether the specified property key is used internally by the versioned graph or not. * * @param key * The property key to determine * @return true if property is for internal usage only */ public boolean isInternalProperty(String key) { return internalProperties.contains(key); } /** * Return the key names of internal properties used by the {@code}VersionedGraph to version the {@link Graph} * {@link Element}s. * * @return An immutable set containing the internal property keys */ public Set<String> getInternalProperties() { return VersionedGraph.internalProperties; } /** * Identify whether the specified {@link Element} is an historical/internal * * @param e * The element to check * @return true if the specified element is historical/internal */ public boolean isHistoricalOrInternal(Element e) { return ((e.getProperty(HISTORIC_ELEMENT_PROP_KEY) != null) && ((Boolean) e.getProperty(HISTORIC_ELEMENT_PROP_KEY))); } }
0506f9998bae0be64a5fe6c59f710a37fba7505a
0c028654b1394f091cfe03756ddb19122453937c
/src/main/java/com/epam/ilya/web/filter/EncodingFilter.java
f36d06273aa0a1a636bfa60a10485bce5961c5f7
[]
no_license
BondarenkoIlya/bets
648f1910fcee7c7129975a252952d95361892562
4ed006e145852c3d6e88dbf9cb1e809ad9f82de2
refs/heads/master
2021-03-22T04:38:00.540967
2016-10-05T03:43:29
2016-10-05T03:43:29
51,829,056
2
0
null
null
null
null
UTF-8
Java
false
false
1,095
java
package com.epam.ilya.web.filter; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import java.io.IOException; /** * Class-filter for work with view's character encoding. * * @author Bondarenko Ilya */ @WebFilter(filterName = "EncodingFilter", urlPatterns = "/do/*") public class EncodingFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } /** * Method sets character encoding to all request. * * @param servletRequest request that come from view * @param servletResponse response that go to view * @param filterChain parameter for work with next filters * @throws IOException * @throws ServletException */ @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { servletRequest.setCharacterEncoding("UTF-8"); filterChain.doFilter(servletRequest, servletResponse); } @Override public void destroy() { } }
e604b7f8b400cc962f56b43ad0388548460f6ad1
9ee64600d23a5dd0a612318a032b4ed1c98a6358
/src/main/java/online/masterji/honchiSolution/activity/ChatActivityMain2.java
108d4266ed3a08ab28a02266653efba9b3bf1ac7
[]
no_license
DeepaMalviya/app
deb117f94a75a4d01b7dde623bed90dd2739ceaf
967e6bf5b3952ffeac1e750810873771a0c14b61
refs/heads/master
2020-07-20T00:26:10.443447
2019-09-05T10:33:45
2019-09-05T10:33:45
206,537,392
0
0
null
null
null
null
UTF-8
Java
false
false
26,286
java
package online.masterji.honchiSolution.activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.text.Html; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; import com.firebase.client.ChildEventListener; import com.firebase.client.DataSnapshot; import com.firebase.client.Firebase; import com.firebase.client.FirebaseError; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.Timestamp; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.firestore.FirebaseFirestore; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import de.hdodenhof.circleimageview.CircleImageView; import online.masterji.honchiSolution.R; import online.masterji.honchiSolution.constant.Constants; import online.masterji.honchiSolution.domain.MessageList; import online.masterji.honchiSolution.domain.UserChatting; import online.masterji.honchiSolution.util.WaitDialog; public class ChatActivityMain extends AppCompatActivity { private static final String TAG = "ChatActivityMain"; LinearLayout layout; ImageView sendButton; EditText messageArea; ScrollView scrollView; Firebase referenceNew, reference1, reference2, reference3, reference; String MainActivityStr, name, image, id; private String messageReceiverID, messageSenderName, messageReceiverName, messageReceiverImage, messageSenderID; private FirebaseAuth mAuth; private FirebaseFirestore RootRef; WaitDialog waitDialog; private DatabaseReference mDatabase; private TextView userName, userLastSeen; private CircleImageView userImage; private Toolbar ChatToolBar; Long tsLong; String ts; List<String> uniqueNumbers = new ArrayList<>(); List<String> msg = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat_main); Firebase.setAndroidContext(this); ChatToolBar = (Toolbar) findViewById(R.id.chat_toolbarr); mAuth = FirebaseAuth.getInstance(); messageSenderID = mAuth.getCurrentUser().getUid(); tsLong = System.currentTimeMillis() / 1000; ts = tsLong.toString(); Log.e(TAG, "onCreate: ===========" + ts); setSupportActionBar(ChatToolBar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowCustomEnabled(true); LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View actionBarView = layoutInflater.inflate(R.layout.custom_chat_bar, null); actionBar.setCustomView(actionBarView); userName = (TextView) findViewById(R.id.custom_profile_name); userLastSeen = (TextView) findViewById(R.id.custom_user_last_seen); userImage = (CircleImageView) findViewById(R.id.custom_profile_image); waitDialog = new WaitDialog(ChatActivityMain.this); layout = (LinearLayout) findViewById(R.id.layout11); sendButton = (ImageView) findViewById(R.id.sendButtonn); messageArea = (EditText) findViewById(R.id.messageArea); scrollView = (ScrollView) findViewById(R.id.scrollView); /* reference1 = new Firebase("https://android-chat-app-e711d.firebaseio.com/messages/" + UserDetails.username + "_" + UserDetails.chatWith); reference2 = new Firebase("https://android-chat-app-e711d.firebaseio.com/messages/" + UserDetails.chatWith + "_" + UserDetails.username); */ Intent intent = getIntent(); MainActivityStr = intent.getStringExtra("MainActivity"); name = intent.getStringExtra("list"); image = intent.getStringExtra("imagesstrings"); id = intent.getStringExtra("id"); Log.e(TAG, "onCreate: name " + name); Log.e(TAG, "onCreate: image " + image); Log.e(TAG, "onCreate: id " + id); mAuth = FirebaseAuth.getInstance(); messageSenderID = mAuth.getCurrentUser().getUid(); RootRef = FirebaseFirestore.getInstance(); // updateDatabase(name, image, id); /* messageReceiverID = FirebaseAuth.getInstance().getCurrentUser().getUid(); */ messageReceiverID = id; messageReceiverName = name; messageReceiverImage = image; userName.setText(messageReceiverName); Picasso.get().load(messageReceiverImage).placeholder(R.drawable.user_image).into(userImage); Log.e(TAG, "onCreate: Constants.NAME=== " + Constants.NAME); Log.e(TAG, "onCreate: messageReceiverName=== " + messageReceiverName); // messageReceiverName = FirebaseAuth.getInstance().getCurrentUser().getDisplayName(); messageSenderName = Constants.NAME; Log.e(TAG, "onCreate: messageSenderName=== " + messageSenderName); Log.e(TAG, "onCreate: messageReceiverID=== " + messageReceiverID); Log.e(TAG, "onCreate: messageReceiverImage=== " + messageReceiverID); //messageReceiverImage = String.valueOf(FirebaseAuth.getInstance().getCurrentUser().getPhotoUrl()); referenceNew = new Firebase("https://project-masterji.firebaseio.com/messagesList/" + messageReceiverName); // reference1 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageSenderID /*+ "_" + messageReceiverID*/); reference3 = new Firebase("https://project-masterji.firebaseio.com/user") /*+ messageSenderName + "_" + messageReceiverName)*/; reference2 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageReceiverID + "_" + messageSenderID); Log.e(TAG, "onCreate: reference2" + reference2); Log.e(TAG, "onCreate: reference1" + reference1); Log.e(TAG, "onCreate: reference3" + reference3); getChattingData(); sendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String messageText = messageArea.getText().toString(); Log.e(TAG, "onClick:Timestamp " + String.valueOf(Timestamp.now())); if (!messageText.equals("")) { sendDataToFirebase(messageText); setChattingData(messageText); AddNumberToList(name); // String key = mDatabase.child("messages").push().getKey(); /* Date currentTime = Calendar.getInstance().getTime(); Map<String, Object> map = new HashMap<String, Object>(); map.put("message", Arrays.asList(messageText)); map.put("SenderName", messageSenderName); map.put("SenderID", messageSenderID); map.put("ReceiverID", messageReceiverID); map.put("ReceiverImage", messageReceiverImage); map.put("ReceiverName", messageReceiverName); map.put("timestamp", String.valueOf(FieldValue.serverTimestamp())); reference1.push().setValue(map); reference1.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Map map = dataSnapshot.getValue(Map.class); String message = null; String userName = null; try { message = map.get("message").toString(); userName = map.get("SenderName").toString(); String SenderID = map.get("SenderID").toString(); String ReceiverID = map.get("ReceiverID").toString(); String ReceiverImage = map.get("ReceiverImage").toString(); String ReceiverName = map.get("ReceiverName").toString(); String timestamp = map.get("timestamp").toString(); } catch (Exception e) { e.printStackTrace(); } try { if (userName.equals(messageSenderName)) { addMessageBox(messageSenderName + " :-\n" + message, 1); } else { addMessageBox(messageReceiverName + " :-\n" + message, 2); } } catch (Exception e) { e.printStackTrace(); } } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(FirebaseError firebaseError) { } }); */ // reference2.push().setValue(map); Log.e(TAG, "onClick: after set dtaa"); messageArea.setText(""); uniqueNumbers.clear(); } messageArea.setText(""); } }); } private void setChattingData(String messageText) { Log.e(TAG, "setChattingData: "); Log.e(TAG, "setChattingData: messageSenderName==" + messageSenderName); Log.e(TAG, "setChattingData: messageReceiverName==" + messageReceiverName); reference1 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageReceiverName + "_" + messageSenderName); reference2 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageSenderName + "_" + messageReceiverName); // reference2 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageSenderName + "_" + "Masterji"); // reference1 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageSenderID + "_" + messageReceiverID); Log.e(TAG, "setChattingData:reference1 " + reference2); Date currentTime = Calendar.getInstance().getTime(); Log.e(TAG, "setChattingData: "); Map<String, String> map = new HashMap<String, String>(); map.put("message", messageText); map.put("SenderName", messageSenderName); map.put("SenderID", messageSenderID); map.put("ReceiverID", messageReceiverID); map.put("ReceiverImage", messageReceiverImage); map.put("ReceiverName", messageReceiverName); map.put("timestamp", String.valueOf(currentTime)); reference1.push().setValue(map); reference2.push().setValue(map); // reference2.push().setValue(map); Log.e(TAG, "setChattingData: after"); // getChattingData(); reference2.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Log.e(TAG, "onChildAdded:======s====== " + s); Map map = dataSnapshot.getValue(Map.class); Log.e(TAG, "onChildAdded: map" + map); String messageValue = null; String userNameValue = null; String SenderIDValue = null; String ReceiverIDValue = null; String ReceiverImageValue = null; String ReceiverNameValue = null; String timestampValue = null; try { messageValue = map.get("message").toString(); userNameValue = map.get("user").toString(); SenderIDValue = map.get("SenderID").toString(); ReceiverIDValue = map.get("ReceiverID").toString(); ReceiverImageValue = map.get("ReceiverImage").toString(); ReceiverNameValue = map.get("ReceiverName").toString(); timestampValue = map.get("timestamp").toString(); } catch (Exception e) { e.printStackTrace(); } try { String title = "<b>" + "Masterji" + "</b>"; String title2 = "<b>" + "You" + "</b>"; if (userNameValue.equals(messageSenderName)) { addMessageBox(Html.fromHtml(title2) + " \n" + messageValue, 2); } else { addMessageBox(Html.fromHtml(title) + " \n" + messageValue, 1); } } catch (Exception e) { e.printStackTrace(); } } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(FirebaseError firebaseError) { } }); } String messageValue = null; String userNameValue = null; String SenderIDValue = null; String ReceiverIDValue = null; String ReceiverImageValue = null; String ReceiverNameValue = null; String timestampValue = null; private void getChattingData() { Log.e(TAG, "getChattingData: "); Log.e(TAG, "getChattingData: messageSenderName==" + messageSenderName); Log.e(TAG, "getChattingData: messageReceiverName==" + messageReceiverName); Log.e(TAG, "getChattingData: messageSenderID==" + messageSenderID); Log.e(TAG, "getChattingData: messageReceiverID===" + messageReceiverID); //reference1 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageSenderID + "_" + messageReceiverID); //reference1 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageSenderName + "_" + "Masterji"); reference1 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageReceiverName + "_" + messageSenderName); reference2 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageSenderName + "_" + messageReceiverName); Log.e(TAG, "getChattingData: reference1" + reference1); reference1.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Map map = dataSnapshot.getValue(Map.class); String messageValue = null; String userNameValue = null; String SenderIDValue = null; String ReceiverIDValue = null; String ReceiverImageValue = null; String ReceiverNameValue = null; String timestampValue = null; try { messageValue = map.get("message").toString(); userNameValue = map.get("SenderName").toString(); SenderIDValue = map.get("SenderID").toString(); ReceiverIDValue = map.get("ReceiverID").toString(); ReceiverImageValue = map.get("ReceiverImage").toString(); ReceiverNameValue = map.get("ReceiverName").toString(); timestampValue = map.get("timestamp").toString(); } catch (Exception e) { e.printStackTrace(); } try { Log.e(TAG, "onChildAdded:userName " + userNameValue); Log.e(TAG, "onChildAdded:messageSenderName " + messageSenderName); Log.e(TAG, "onChildAdded:message " + messageValue); // String title = "<b>You</b>"; String title = "<b>" + "Masterji" + "</b>"; String title2 = "<b>" + "You" + "</b>"; if (userNameValue.equals(messageSenderName)) { addMessageBox(Html.fromHtml(title2) + " \n" + messageValue, 2); } else { addMessageBox(Html.fromHtml(title) + " \n" + messageValue, 1); } } catch (Exception e) { e.printStackTrace(); } } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(FirebaseError firebaseError) { } }); } MessageList messageList = new MessageList(); private void sendDataToFirebase(String messageText) { Log.e(TAG, "sendDataToFirebase: "); Log.e(TAG, "sendDataToFirebase: " + id); Map<String, String> map1 = new HashMap<String, String>(); // messageList.setSender(messageSenderName); // messageList.setReceiver(messageReceiverName); // messageList.setSenderId(messageSenderID); // messageList.setReceiverId(messageReceiverID); messageList.setFullname(name); messageList.setPhoto(image); messageList.setUid(id); messageList.setCount(msg.size()); // messageList.setMsg(messageText); FirebaseFirestore db = FirebaseFirestore.getInstance(); String ID = FirebaseAuth.getInstance().getCurrentUser().getUid(); String getId = db.collection("MessageList").document().getId(); db.collection("MessageList").document(messageReceiverName).set(messageList) .addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { Log.e(TAG, "onSuccess: "); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.e(TAG, "Error writing document", e); } }); } private void AddNumberToList(String name) { Log.e(TAG, "AddNumberToList: " + uniqueNumbers.size()); for (int i = 0; i < uniqueNumbers.size(); i++) { if (!uniqueNumbers.get(i).equals(name)) { Map<String, String> map1 = new HashMap<String, String>(); map1.put("sender", messageSenderName); map1.put("receiver", messageReceiverName); map1.put("SenderID", messageSenderID); map1.put("ReceiverID", messageReceiverID); map1.put("fullname", name); map1.put("photo", image); map1.put("id", id); reference3.push().setValue(map1); } else { Toast.makeText(this, "Already exist", Toast.LENGTH_SHORT).show(); } } } private void updateDatabase(String fullname, String photo, String id) { UserChatting user = new UserChatting(fullname, photo, id); // String key = reference.push().getKey(); //reference = new Firebase("https://project-masterji.firebaseio.com/UserList/" + messageSenderID); /* reference = new Firebase("https://project-masterji.firebaseio.com/UserList"); Log.e(TAG, "updateDatabase:fullname+photo+id " + fullname + photo + id); String Uid = FirebaseAuth.getInstance().getCurrentUser().getUid(); Log.e(TAG, "getUserDAtaID: " + Constants.Uid); Map<String, String> map = new HashMap<String, String>(); map.put("fullname", fullname); map.put("photo", photo); map.put("id", id); // reference.child(key).push().setValue(map); reference.push().setValue(map); reference.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Map map = dataSnapshot.getValue(Map.class); String fullname = null; try { fullname = map.get("fullname").toString(); } catch (Exception e) { e.printStackTrace(); } String photo = null; try { photo = map.get("photo").toString(); } catch (Exception e) { e.printStackTrace(); } String id = map.get("id").toString(); Log.e(TAG, "onChildAdded:fullname " + fullname); Log.e(TAG, "onChildAdded:photo " + photo); Log.e(TAG, "onChildAdded:id " + id); } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(FirebaseError firebaseError) { } });*/ /* Map messageTextBody = new HashMap(); messageTextBody.put("fullname", fullname); messageTextBody.put("photo", photo); messageTextBody.put("id", id); messageTextBody.put("time", saveCurrentTime); messageTextBody.put("date", saveCurrentDate); reference.updateChildren(messageTextBody).addOnCompleteListener(new OnCompleteListener() { @Override public void onComplete(@NonNull Task task) { if (task.isSuccessful()) { Toast.makeText(getContext(), "Message Sent Successfully...", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getContext(), "Error", Toast.LENGTH_SHORT).show(); } } });*/ } private void getDatata() { Log.e(TAG, "getDatata: "); // reference1 = new Firebase("https://project-masterji.firebaseio.com/messages/" + messageSenderID + "_" + messageReceiverID); referenceNew.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Map map = dataSnapshot.getValue(Map.class); String message = map.get("message").toString(); /* String userName = map.get("user").toString(); if (userName.equals(messageReceiverID)) { addMessageBox("You:-\n" + message, 1); } else { addMessageBox(messageSenderID + ":-\n" + message, 2); }*/ } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(FirebaseError firebaseError) { } }); } public void addMessageBox(String message, int type) { Log.e(TAG, "addMessageBox: "); Log.e(TAG, "addMessageBox:message " + message); TextView textView = new TextView(ChatActivityMain.this); textView.setText(message); LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp2.weight = 1.0f; if (type == 1) { lp2.gravity = Gravity.LEFT; textView.setBackgroundResource(R.drawable.bubble_in); } else { lp2.gravity = Gravity.RIGHT; textView.setBackgroundResource(R.drawable.bubble_out); } textView.setLayoutParams(lp2); layout.addView(textView); scrollView.fullScroll(View.FOCUS_DOWN); } @Override public boolean onSupportNavigateUp() { onBackPressed(); return true; } }
c6d16a0f57fdeee44213a34044fdc66cec07621e
38de576b5d5b3d12e25323acec63711b345063b6
/src/main/java/Pages/ManageProject.java
4adaa98f2a80a07dde824e31e23497a0b52e7608
[]
no_license
romilpatel13/Demo
d7c8519ef488473c9770769d2f3ce509eb317012
a10feffb8d8f8df56277d144692df07814559dc0
refs/heads/master
2023-05-13T21:29:09.815562
2020-01-22T01:03:56
2020-01-22T01:03:56
235,471,632
0
0
null
2023-05-09T18:18:35
2020-01-22T00:54:37
HTML
UTF-8
Java
false
false
1,948
java
package Pages; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import Pages.CreateProject; public class ManageProject { WebDriver dr; CreateProject c=new CreateProject(dr); public ManageProject(WebDriver driver) { this.dr=driver; PageFactory.initElements(dr, this); } @FindBy(xpath="//*[@title='Manage Projects']/descendant::span[text()='Manage Projects']") private WebElement manageProject; @FindBy(xpath="//table/tbody/tr/td/div/div/div/a[text()='Kozey Solution']") private WebElement projectName; private void clickOnManageProject() { waitForElementClickable(manageProject); //manageProject.click(); new Actions(dr).pause(5000).perform(); new Actions(dr).click(manageProject).perform(); } public boolean verifyProjectCreated() { boolean b=false; clickOnManageProject(); WebElement readName=dr.findElement(By.xpath("//table/tbody/tr/td/div/div/div/a[text()='"+c.readProjectName()+"']")); try { waitForElementVisible(readName); b=readName.isDisplayed(); }catch(Exception e) {} return b; } public String getProjectNameFromApp() { return dr.findElement(By.xpath("//table/tbody/tr/td/div/div/div/a[text()='"+c.readProjectName()+"']")).getText(); } public void waitForElementVisible(WebElement element) { WebDriverWait wait=new WebDriverWait(dr, 10); wait.until(ExpectedConditions.visibilityOf(element)); } public void waitForElementClickable(WebElement element) { WebDriverWait wait=new WebDriverWait(dr, 10); wait.until(ExpectedConditions.elementToBeClickable(element)); } }
1dc85085e99ef76ac457af9ab831ce76e3c77fb5
cb904b49241974c8c58b05e4f42399c2ad46926b
/broccoli/src/com/kh/review/controller/SelectUserReviewController.java
1a19ed4178e10a8bae6e4db3f37a5583a5ca3d56
[]
no_license
b-bok/Team_broccoli
0ce77daadcf5eed0d09c7905788b1ef0bc5b23e9
f778e09323dfef17e6d08c4005391262e9653d2a
refs/heads/main
2023-02-13T07:36:38.690874
2021-01-08T11:56:46
2021-01-08T11:56:46
305,257,051
1
0
null
null
null
null
UTF-8
Java
false
false
1,880
java
package com.kh.review.controller; import java.io.IOException; import java.util.ArrayList; 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 com.google.gson.Gson; import com.kh.product.model.service.ProductService; import com.kh.review.model.vo.Review; /** * Servlet implementation class SelectUserReviewController */ @WebServlet("/selectReview.rv") public class SelectUserReviewController extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public SelectUserReviewController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int pno = Integer.parseInt(request.getParameter("pno")); String sort = request.getParameter("sort"); ArrayList<Review> list = new ArrayList<>(); if(sort.equals("all")) { list = new ProductService().selectUserReview(pno); }else if(sort.equals("photo")) { list = new ProductService().selectPhotoReview(pno); }else { list = new ProductService().selectSortReview(pno,sort); } response.setContentType("application/json; charset=utf-8"); Gson gson = new Gson(); gson.toJson(list, response.getWriter()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
ccd2c0948675b3948c7bf0c395d7f6a736c467fc
cef085b2261453c177e2d57a6c584c027b8b6c18
/src/kata3/HistogramDisplay.java
f98171b0232eaa12b061a2997abd9533d3f94a13
[]
no_license
DanielMM1997/Kata3
6aff299bb6d5ac246ec21f5f377a0f673eb451c3
4b2819e4990c1d5865e8c3e3551731c237d24759
refs/heads/master
2020-08-26T13:48:47.218238
2019-10-23T11:18:18
2019-10-23T11:18:18
217,031,317
0
0
null
null
null
null
UTF-8
Java
false
false
1,864
java
package kata3; import java.awt.Dimension; import javax.swing.JPanel; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.ui.ApplicationFrame; public class HistogramDisplay extends ApplicationFrame{ private final Histogram<String> histogram; public HistogramDisplay(Histogram histogram) { super("HSITOGRAMA"); this.histogram = histogram; this.setContentPane(createPanel()); this.pack(); } public void execute() { setVisible(true); } private JPanel createPanel() { ChartPanel chartPanel = new ChartPanel(createChart(createDataset())); chartPanel.setPreferredSize(new Dimension (500,400)); return chartPanel; } private JFreeChart createChart (DefaultCategoryDataset dataSet) { JFreeChart chart; chart = ChartFactory.createBarChart("Histograma JFreeChart", "Dominio email", "Nยบ de emails", dataSet, PlotOrientation.VERTICAL, false, false, rootPaneCheckingEnabled); return chart; } private DefaultCategoryDataset createDataset() { DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); for (String key : histogram.keySet()) { dataSet.addValue(histogram.get(key), "", key); } /* dataSet.addValue(300, "", "ulpgc.es"); dataSet.addValue(400, "", "dis.ulpgc.es"); dataSet.addValue(200, "", "gmail.com"); */ return dataSet; } }
f9813912c50942a55eee33e5dc2d408090731348
c6b9098aaf0d3687d65ac113ba9441cb4fffb5e0
/app/src/main/java/rx/tkb/com/rxandroid/retrofit_simple/models/update.java
ad03c347e0848c8992579a642bd2aaa5bcc15a3a
[]
no_license
taruncse/RXAndroid
2b02cf5b772f156d2cde85201404e1235058387e
62cf35cf9201ec58bd36aa0132895ac74d4ff419
refs/heads/master
2021-07-21T08:22:45.067640
2019-05-17T18:24:58
2019-05-17T18:24:58
115,778,353
3
0
null
null
null
null
UTF-8
Java
false
false
114
java
package rx.tkb.com.rxandroid.retrofit_simple.models; public interface update { void updatePost(Post post); }
e43bccc9419ed3cd7e59477b7790a52bac5733c8
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-lookoutmetrics/src/main/java/com/amazonaws/services/lookoutmetrics/model/AnomalyDetectorConfigSummary.java
5739fc5fd12b8ce8f890e5cdcfc3394be7aca065
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
5,344
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.lookoutmetrics.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * Contains information about a detector's configuration. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/lookoutmetrics-2017-07-25/AnomalyDetectorConfigSummary" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class AnomalyDetectorConfigSummary implements Serializable, Cloneable, StructuredPojo { /** * <p> * The interval at which the detector analyzes its source data. * </p> */ private String anomalyDetectorFrequency; /** * <p> * The interval at which the detector analyzes its source data. * </p> * * @param anomalyDetectorFrequency * The interval at which the detector analyzes its source data. * @see Frequency */ public void setAnomalyDetectorFrequency(String anomalyDetectorFrequency) { this.anomalyDetectorFrequency = anomalyDetectorFrequency; } /** * <p> * The interval at which the detector analyzes its source data. * </p> * * @return The interval at which the detector analyzes its source data. * @see Frequency */ public String getAnomalyDetectorFrequency() { return this.anomalyDetectorFrequency; } /** * <p> * The interval at which the detector analyzes its source data. * </p> * * @param anomalyDetectorFrequency * The interval at which the detector analyzes its source data. * @return Returns a reference to this object so that method calls can be chained together. * @see Frequency */ public AnomalyDetectorConfigSummary withAnomalyDetectorFrequency(String anomalyDetectorFrequency) { setAnomalyDetectorFrequency(anomalyDetectorFrequency); return this; } /** * <p> * The interval at which the detector analyzes its source data. * </p> * * @param anomalyDetectorFrequency * The interval at which the detector analyzes its source data. * @return Returns a reference to this object so that method calls can be chained together. * @see Frequency */ public AnomalyDetectorConfigSummary withAnomalyDetectorFrequency(Frequency anomalyDetectorFrequency) { this.anomalyDetectorFrequency = anomalyDetectorFrequency.toString(); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAnomalyDetectorFrequency() != null) sb.append("AnomalyDetectorFrequency: ").append(getAnomalyDetectorFrequency()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AnomalyDetectorConfigSummary == false) return false; AnomalyDetectorConfigSummary other = (AnomalyDetectorConfigSummary) obj; if (other.getAnomalyDetectorFrequency() == null ^ this.getAnomalyDetectorFrequency() == null) return false; if (other.getAnomalyDetectorFrequency() != null && other.getAnomalyDetectorFrequency().equals(this.getAnomalyDetectorFrequency()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAnomalyDetectorFrequency() == null) ? 0 : getAnomalyDetectorFrequency().hashCode()); return hashCode; } @Override public AnomalyDetectorConfigSummary clone() { try { return (AnomalyDetectorConfigSummary) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.lookoutmetrics.model.transform.AnomalyDetectorConfigSummaryMarshaller.getInstance().marshall(this, protocolMarshaller); } }
[ "" ]
7bd4a978e427e31f17a5475dab2cd2d586373983
79595075622ded0bf43023f716389f61d8e96e94
/app/src/main/java/com/android/internal/app/ISoundTriggerService.java
5e51fbf0eedd33b4940f35d32f84e9684dd527a2
[]
no_license
dstmath/OppoR15
96f1f7bb4d9cfad47609316debc55095edcd6b56
b9a4da845af251213d7b4c1b35db3e2415290c96
refs/heads/master
2020-03-24T16:52:14.198588
2019-05-27T02:24:53
2019-05-27T02:24:53
142,840,716
7
4
null
null
null
null
UTF-8
Java
false
false
21,586
java
package com.android.internal.app; import android.app.PendingIntent; import android.hardware.soundtrigger.IRecognitionStatusCallback; import android.hardware.soundtrigger.SoundTrigger.GenericSoundModel; import android.hardware.soundtrigger.SoundTrigger.KeyphraseSoundModel; import android.hardware.soundtrigger.SoundTrigger.RecognitionConfig; import android.os.Binder; import android.os.IBinder; import android.os.IInterface; import android.os.Parcel; import android.os.ParcelUuid; import android.os.RemoteException; public interface ISoundTriggerService extends IInterface { public static abstract class Stub extends Binder implements ISoundTriggerService { private static final String DESCRIPTOR = "com.android.internal.app.ISoundTriggerService"; static final int TRANSACTION_deleteSoundModel = 3; static final int TRANSACTION_getSoundModel = 1; static final int TRANSACTION_isRecognitionActive = 11; static final int TRANSACTION_loadGenericSoundModel = 6; static final int TRANSACTION_loadKeyphraseSoundModel = 7; static final int TRANSACTION_startRecognition = 4; static final int TRANSACTION_startRecognitionForIntent = 8; static final int TRANSACTION_stopRecognition = 5; static final int TRANSACTION_stopRecognitionForIntent = 9; static final int TRANSACTION_unloadSoundModel = 10; static final int TRANSACTION_updateSoundModel = 2; private static class Proxy implements ISoundTriggerService { private IBinder mRemote; Proxy(IBinder remote) { this.mRemote = remote; } public IBinder asBinder() { return this.mRemote; } public String getInterfaceDescriptor() { return Stub.DESCRIPTOR; } public GenericSoundModel getSoundModel(ParcelUuid soundModelId) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { GenericSoundModel _result; _data.writeInterfaceToken(Stub.DESCRIPTOR); if (soundModelId != null) { _data.writeInt(1); soundModelId.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(1, _data, _reply, 0); _reply.readException(); if (_reply.readInt() != 0) { _result = (GenericSoundModel) GenericSoundModel.CREATOR.createFromParcel(_reply); } else { _result = null; } _reply.recycle(); _data.recycle(); return _result; } catch (Throwable th) { _reply.recycle(); _data.recycle(); } } public void updateSoundModel(GenericSoundModel soundModel) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (soundModel != null) { _data.writeInt(1); soundModel.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(2, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } public void deleteSoundModel(ParcelUuid soundModelId) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (soundModelId != null) { _data.writeInt(1); soundModelId.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(3, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } public int startRecognition(ParcelUuid soundModelId, IRecognitionStatusCallback callback, RecognitionConfig config) throws RemoteException { IBinder iBinder = null; Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (soundModelId != null) { _data.writeInt(1); soundModelId.writeToParcel(_data, 0); } else { _data.writeInt(0); } if (callback != null) { iBinder = callback.asBinder(); } _data.writeStrongBinder(iBinder); if (config != null) { _data.writeInt(1); config.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(4, _data, _reply, 0); _reply.readException(); int _result = _reply.readInt(); return _result; } finally { _reply.recycle(); _data.recycle(); } } public int stopRecognition(ParcelUuid soundModelId, IRecognitionStatusCallback callback) throws RemoteException { IBinder iBinder = null; Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (soundModelId != null) { _data.writeInt(1); soundModelId.writeToParcel(_data, 0); } else { _data.writeInt(0); } if (callback != null) { iBinder = callback.asBinder(); } _data.writeStrongBinder(iBinder); this.mRemote.transact(5, _data, _reply, 0); _reply.readException(); int _result = _reply.readInt(); return _result; } finally { _reply.recycle(); _data.recycle(); } } public int loadGenericSoundModel(GenericSoundModel soundModel) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (soundModel != null) { _data.writeInt(1); soundModel.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(6, _data, _reply, 0); _reply.readException(); int _result = _reply.readInt(); return _result; } finally { _reply.recycle(); _data.recycle(); } } public int loadKeyphraseSoundModel(KeyphraseSoundModel soundModel) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (soundModel != null) { _data.writeInt(1); soundModel.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(7, _data, _reply, 0); _reply.readException(); int _result = _reply.readInt(); return _result; } finally { _reply.recycle(); _data.recycle(); } } public int startRecognitionForIntent(ParcelUuid soundModelId, PendingIntent callbackIntent, RecognitionConfig config) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (soundModelId != null) { _data.writeInt(1); soundModelId.writeToParcel(_data, 0); } else { _data.writeInt(0); } if (callbackIntent != null) { _data.writeInt(1); callbackIntent.writeToParcel(_data, 0); } else { _data.writeInt(0); } if (config != null) { _data.writeInt(1); config.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(8, _data, _reply, 0); _reply.readException(); int _result = _reply.readInt(); return _result; } finally { _reply.recycle(); _data.recycle(); } } public int stopRecognitionForIntent(ParcelUuid soundModelId) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (soundModelId != null) { _data.writeInt(1); soundModelId.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(9, _data, _reply, 0); _reply.readException(); int _result = _reply.readInt(); return _result; } finally { _reply.recycle(); _data.recycle(); } } public int unloadSoundModel(ParcelUuid soundModelId) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (soundModelId != null) { _data.writeInt(1); soundModelId.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(10, _data, _reply, 0); _reply.readException(); int _result = _reply.readInt(); return _result; } finally { _reply.recycle(); _data.recycle(); } } public boolean isRecognitionActive(ParcelUuid parcelUuid) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(Stub.DESCRIPTOR); if (parcelUuid != null) { _data.writeInt(1); parcelUuid.writeToParcel(_data, 0); } else { _data.writeInt(0); } this.mRemote.transact(11, _data, _reply, 0); _reply.readException(); boolean _result = _reply.readInt() != 0; _reply.recycle(); _data.recycle(); return _result; } catch (Throwable th) { _reply.recycle(); _data.recycle(); } } } public Stub() { attachInterface(this, DESCRIPTOR); } public static ISoundTriggerService asInterface(IBinder obj) { if (obj == null) { return null; } IInterface iin = obj.queryLocalInterface(DESCRIPTOR); if (iin == null || !(iin instanceof ISoundTriggerService)) { return new Proxy(obj); } return (ISoundTriggerService) iin; } public IBinder asBinder() { return this; } public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { ParcelUuid _arg0; GenericSoundModel _arg02; RecognitionConfig _arg2; int _result; switch (code) { case 1: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg0 = (ParcelUuid) ParcelUuid.CREATOR.createFromParcel(data); } else { _arg0 = null; } GenericSoundModel _result2 = getSoundModel(_arg0); reply.writeNoException(); if (_result2 != null) { reply.writeInt(1); _result2.writeToParcel(reply, 1); } else { reply.writeInt(0); } return true; case 2: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg02 = (GenericSoundModel) GenericSoundModel.CREATOR.createFromParcel(data); } else { _arg02 = null; } updateSoundModel(_arg02); reply.writeNoException(); return true; case 3: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg0 = (ParcelUuid) ParcelUuid.CREATOR.createFromParcel(data); } else { _arg0 = null; } deleteSoundModel(_arg0); reply.writeNoException(); return true; case 4: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg0 = (ParcelUuid) ParcelUuid.CREATOR.createFromParcel(data); } else { _arg0 = null; } IRecognitionStatusCallback _arg1 = android.hardware.soundtrigger.IRecognitionStatusCallback.Stub.asInterface(data.readStrongBinder()); if (data.readInt() != 0) { _arg2 = (RecognitionConfig) RecognitionConfig.CREATOR.createFromParcel(data); } else { _arg2 = null; } _result = startRecognition(_arg0, _arg1, _arg2); reply.writeNoException(); reply.writeInt(_result); return true; case 5: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg0 = (ParcelUuid) ParcelUuid.CREATOR.createFromParcel(data); } else { _arg0 = null; } _result = stopRecognition(_arg0, android.hardware.soundtrigger.IRecognitionStatusCallback.Stub.asInterface(data.readStrongBinder())); reply.writeNoException(); reply.writeInt(_result); return true; case 6: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg02 = (GenericSoundModel) GenericSoundModel.CREATOR.createFromParcel(data); } else { _arg02 = null; } _result = loadGenericSoundModel(_arg02); reply.writeNoException(); reply.writeInt(_result); return true; case 7: KeyphraseSoundModel _arg03; data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg03 = (KeyphraseSoundModel) KeyphraseSoundModel.CREATOR.createFromParcel(data); } else { _arg03 = null; } _result = loadKeyphraseSoundModel(_arg03); reply.writeNoException(); reply.writeInt(_result); return true; case 8: PendingIntent _arg12; data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg0 = (ParcelUuid) ParcelUuid.CREATOR.createFromParcel(data); } else { _arg0 = null; } if (data.readInt() != 0) { _arg12 = (PendingIntent) PendingIntent.CREATOR.createFromParcel(data); } else { _arg12 = null; } if (data.readInt() != 0) { _arg2 = (RecognitionConfig) RecognitionConfig.CREATOR.createFromParcel(data); } else { _arg2 = null; } _result = startRecognitionForIntent(_arg0, _arg12, _arg2); reply.writeNoException(); reply.writeInt(_result); return true; case 9: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg0 = (ParcelUuid) ParcelUuid.CREATOR.createFromParcel(data); } else { _arg0 = null; } _result = stopRecognitionForIntent(_arg0); reply.writeNoException(); reply.writeInt(_result); return true; case 10: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg0 = (ParcelUuid) ParcelUuid.CREATOR.createFromParcel(data); } else { _arg0 = null; } _result = unloadSoundModel(_arg0); reply.writeNoException(); reply.writeInt(_result); return true; case 11: data.enforceInterface(DESCRIPTOR); if (data.readInt() != 0) { _arg0 = (ParcelUuid) ParcelUuid.CREATOR.createFromParcel(data); } else { _arg0 = null; } boolean _result3 = isRecognitionActive(_arg0); reply.writeNoException(); reply.writeInt(_result3 ? 1 : 0); return true; case 1598968902: reply.writeString(DESCRIPTOR); return true; default: return super.onTransact(code, data, reply, flags); } } } void deleteSoundModel(ParcelUuid parcelUuid) throws RemoteException; GenericSoundModel getSoundModel(ParcelUuid parcelUuid) throws RemoteException; boolean isRecognitionActive(ParcelUuid parcelUuid) throws RemoteException; int loadGenericSoundModel(GenericSoundModel genericSoundModel) throws RemoteException; int loadKeyphraseSoundModel(KeyphraseSoundModel keyphraseSoundModel) throws RemoteException; int startRecognition(ParcelUuid parcelUuid, IRecognitionStatusCallback iRecognitionStatusCallback, RecognitionConfig recognitionConfig) throws RemoteException; int startRecognitionForIntent(ParcelUuid parcelUuid, PendingIntent pendingIntent, RecognitionConfig recognitionConfig) throws RemoteException; int stopRecognition(ParcelUuid parcelUuid, IRecognitionStatusCallback iRecognitionStatusCallback) throws RemoteException; int stopRecognitionForIntent(ParcelUuid parcelUuid) throws RemoteException; int unloadSoundModel(ParcelUuid parcelUuid) throws RemoteException; void updateSoundModel(GenericSoundModel genericSoundModel) throws RemoteException; }
a9360b76bfc2715be84cea69f6aff7e2a9a944c6
3fcdd573921787e4a2f0fe77955a1481bee5cdb7
/Lok Sabha ELection Poll/app/src/main/java/com/viratara/android/barmer2019electionspoll/MainActivity.java
358cc1dddd4aff6a4c8db2c6ac19d856da95f152
[]
no_license
ShailendraRathore/ElectionOpinionPollAndroid
fd80233955dbe1029bdbc660cd74805231988b71
f9edef3206ed8e168f7ee6bc5514954f08801b3e
refs/heads/master
2020-04-19T17:44:04.297599
2019-01-30T13:03:38
2019-01-30T13:03:38
168,343,547
0
1
null
null
null
null
UTF-8
Java
false
false
6,859
java
package com.viratara.android.barmer2019electionspoll; import android.content.Intent; import android.content.SharedPreferences; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.WindowManager; import android.widget.ImageButton; import android.widget.ProgressBar; import android.widget.Toast; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { int count = 0; public static ArrayList<Integer> voteList = new ArrayList<>(); private FirebaseDatabase mFirebaseDatabase; private DatabaseReference mVotesRef; private ProgressBar spinner; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.poll); mFirebaseDatabase = FirebaseDatabase.getInstance(); spinner = (ProgressBar)findViewById(R.id.progressBar1); spinner.setVisibility(View.VISIBLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE); mVotesRef = mFirebaseDatabase.getReference("votes"); mVotesRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { count=0; for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) { int vote = postSnapshot.getValue(Integer.class); voteList.add(count,vote); count++; } if(count >= dataSnapshot.getChildrenCount()){ final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { // Do something after 5s = 5000ms spinner.setVisibility(View.GONE); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE); } }, 2000); } } @Override public void onCancelled(DatabaseError databaseError) { System.out.println("The read failed: " + databaseError.getCode()); } }); ImageButton bjpButton = (ImageButton)findViewById(R.id.bjp); bjpButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); if(pref.getInt("flag", 0) !=1) { mVotesRef.child("bjp").setValue(voteList.get(0) + 1); editor.putInt("flag", 1); editor.apply(); } else { Toast.makeText(getBaseContext(), "You have already participated in the poll!", Toast.LENGTH_LONG).show(); } Intent i = new Intent(MainActivity.this, Main2Activity.class); startActivity(i); = } }); ImageButton congressButton = (ImageButton)findViewById(R.id.congress); congressButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); if(pref.getInt("flag", 0) !=1) { mVotesRef.child("congress").setValue(voteList.get(1)+1); editor.putInt("flag", 1); editor.apply(); } else { Toast.makeText(getBaseContext(), "You have already participated in the poll!", Toast.LENGTH_LONG).show(); } Intent i = new Intent(MainActivity.this, Main2Activity.class); startActivity(i); = } }); ImageButton othersButton = (ImageButton)findViewById(R.id.others); othersButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); if(pref.getInt("flag", 0) !=1) { mVotesRef.child("others").setValue(voteList.get(2)+1); editor.putInt("flag", 1); editor.apply(); } else { Toast.makeText(getBaseContext(), "You have already participated in the poll!", Toast.LENGTH_LONG).show(); } Intent i = new Intent(MainActivity.this, Main2Activity.class); startActivity(i); } }); ImageButton natoButton = (ImageButton)findViewById(R.id.nato); natoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); if(pref.getInt("flag", 0) !=1) { mVotesRef.child("nato").setValue(voteList.get(3)+1); editor.putInt("flag", 1); editor.apply(); } else { Toast.makeText(getBaseContext(), "You have already participated in the poll!", Toast.LENGTH_LONG).show(); } Intent i = new Intent(MainActivity.this, Main2Activity.class); startActivity(i); } }); } public static ArrayList<Integer> getList() { return voteList; } }
a0b33c9bf6e5d314282670c796d6d6352e5e070f
60cf0ad8eacc879befc47c460d6efd1475363849
/3-Arrays1/zadacha13.java
1501ad678b67f16e8f63cacd351ba3b6828c20ed
[]
no_license
AleksandarMutafchiev/Homework
431470c1a6a737670594e0b1a20770e587e3b52d
49bc5079aa157232827793eba06333cc17371df3
refs/heads/master
2020-04-15T02:55:56.785544
2019-01-30T17:08:36
2019-01-30T17:08:36
164,329,414
0
0
null
null
null
null
UTF-8
Java
false
false
580
java
import java.util.Scanner; public class zadacha13 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter number:"); int num=sc.nextInt(); int[] arr=new int[10]; int del=num; for(int i=0;i<arr.length;i++){ if(del%2==0){ arr[i]=0; }else{ arr[i]=1; } del=del/2; if(del<1){ break; } } System.out.print("["); for(int i=arr.length-1;i>=0;i--){ if(i!=0){ System.out.print(arr[i]+", "); }else{ System.out.print(arr[i]); } } System.out.println("]"); sc.close(); } }
f6d083b380f1eaa40b202fc89026b062495a46d8
6967c2073db7d198efbdc20b27d0db70f4c0a70d
/src/main/java/pl/damrob/votas/infrastructure/persistance/UserRepositoryImpl.java
a167b14ab5b7ab5146d5655c259012c4f3fcf189
[]
no_license
Farius93/votas
e80fd5018fdd0e9206ad16e3e3dae288c8b7735d
7f075f1576ed66bcdfe5c408695b49cf2c733f45
refs/heads/master
2023-06-04T21:11:58.944120
2021-06-21T20:13:54
2021-06-21T20:13:54
311,979,887
1
0
null
null
null
null
UTF-8
Java
false
false
1,127
java
package pl.damrob.votas.infrastructure.persistance; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; import pl.damrob.votas.domain.User; import pl.damrob.votas.domain.UserRepository; @Component @RequiredArgsConstructor public class UserRepositoryImpl implements UserRepository { private final UserJpaRepository userJpaRepository; private final UserTupleFactory userTupleFactory; private final UserFactory userFactory; @Override public void insert(User user) { userJpaRepository.save(userTupleFactory.from(user)); } @Override public User getByName(String name) { return userJpaRepository.findByName(name) .map(userFactory::from) .orElseThrow(() -> new NotFoundException(name)); } @Override public boolean existByName(String name) { return userJpaRepository.existsByName(name); } public static class NotFoundException extends RuntimeException { NotFoundException(String name) { super(String.format("User with name=%s not found", name)); } } }
c6357f9b9a963222094ce2dd6227adf940075f4b
edaada4375161e3ad9c9596ef880bbb06d88181d
/app/src/main/java/com/research/itsl/ism_d2d/WiFiP2pBroadcastReceiver.java
5065f262a010c0b85bb81ca07bcd1c9ee7d67374
[]
no_license
charleyc94/ISM_D2D
a392e4ff2c2161baf0f8e952d47f49ee0ffd2e1d
1693cba9f93013ad642719980fcbc025332e6009
refs/heads/master
2021-01-18T00:40:36.367075
2015-11-07T07:39:03
2015-11-07T07:39:03
33,687,760
0
0
null
null
null
null
UTF-8
Java
false
false
3,651
java
package com.research.itsl.ism_d2d; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.NetworkInfo; import android.net.wifi.p2p.WifiP2pDevice; import android.net.wifi.p2p.WifiP2pInfo; import android.net.wifi.p2p.WifiP2pManager; import android.net.wifi.p2p.WifiP2pManager.Channel; import android.net.wifi.p2p.WifiP2pManager.PeerListListener; import android.widget.Toast; import java.net.InetAddress; /** * A BroadcastReceiver that notifies of important wifi p2p events. */ public class WiFiP2pBroadcastReceiver extends BroadcastReceiver { private WifiP2pManager manager; private Channel channel; private MainActivity activity; /** * @param manager WifiP2pManager system service * @param channel Wifi p2p channel * @param activity activity associated with the receiver */ public WiFiP2pBroadcastReceiver(WifiP2pManager manager, Channel channel, MainActivity activity) { super(); this.manager = manager; this.channel = channel; this.activity = activity; } /* * (non-Javadoc) * @see android.content.BroadcastReceiver#onReceive(android.content.Context, * android.content.Intent) */ @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) { // UI update to indicate wifi p2p status. int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1); if (state == WifiP2pManager.WIFI_P2P_STATE_ENABLED) { // Wifi Direct mode is enabled activity.setIsWifiP2pEnabled(true); } else { activity.setIsWifiP2pEnabled(false); //activity.resetData(); } } else if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) { // request available peers from the wifi p2p manager. This is an // asynchronous call and the calling activity is notified with a // callback on PeerListListener.onPeersAvailable() if (manager != null) { manager.requestPeers(channel, (PeerListListener) this.activity); } } else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) { if (manager == null) { return; } NetworkInfo networkInfo = (NetworkInfo) intent .getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO); if (networkInfo.isConnected()) { manager.requestConnectionInfo(channel, new WifiP2pManager.ConnectionInfoListener() { @Override public void onConnectionInfoAvailable(WifiP2pInfo info) { InetAddress groupOwnerAddress = info.groupOwnerAddress; activity.groupOwnerAddress=groupOwnerAddress.getHostAddress(); } }); } else { // It's a disconnect //activity.resetData(); } } else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) { /*DeviceListFragment fragment = (DeviceListFragment) activity.getFragmentManager() .findFragmentById(R.id.frag_list); fragment.updateThisDevice((WifiP2pDevice) intent.getParcelableExtra( WifiP2pManager.EXTRA_WIFI_P2P_DEVICE));*/ } } }
f39d5f706dffb0f5b72c42f1de7fac7caa6d8cbd
5417ea09478690a4945c7d98971beab7fbc865c9
/CMSContainer_Modules/import-excelmenu/src/java/com/finalist/cmsc/excel2menu/Excel2Menu.java
5e4a841d64aa60de1f227131c2d1c4fe34de6ba6
[]
no_license
mmbase/CMSContainer
b20f3ef7b1f86cc4c2907c58d166f59237513b35
e63817408e060d4cff1a99cdeff23a8f953f8892
refs/heads/master
2023-03-11T07:18:24.184666
2022-07-08T21:46:25
2022-07-08T21:46:25
201,436,616
1
0
null
2023-02-22T08:03:48
2019-08-09T09:29:32
Java
UTF-8
Java
false
false
9,894
java
package com.finalist.cmsc.excel2menu; import java.io.*; import java.util.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.mmbase.bridge.*; import com.finalist.cmsc.excel2menu.ExcelConfig.*; import com.finalist.cmsc.mmbase.TreeUtil; import com.finalist.cmsc.navigation.*; import com.finalist.cmsc.repository.RepositoryUtil; /** * Convert a excel file to CMSC specific content * * @author Wouter Heijke */ public class Excel2Menu { private static Log log = LogFactory.getLog(Excel2Menu.class); private Cloud cloud; private ExcelConfig config; public Excel2Menu(Cloud cloud, ExcelConfig config) { this.cloud = cloud; this.config = config; } public void convert(String name) { try { log.info("Convert xls file:" + name); InputStream inputStream = new FileInputStream(name); convert(inputStream); } catch (IOException e) { log.error(e.getMessage(), e); } } private void checkConfig() { for (View view : config.getViews()) { checkView(view); } for (Portlet portlet : config.getPortlets()) { checkPortlet(portlet); } for (Layout layout : config.getLayouts()) { checklayout(layout); } checkSite(config.getSite()); } private void checkView(View view) { Node viewNode = PortletUtil.findViewWithResource(cloud, view.resource); if (viewNode == null) { viewNode = PortletUtil.createView(cloud, view.title, view.resource); } view.nodeNumber = viewNode.getNumber(); } private void checkPortlet(ExcelConfig.Portlet portlet) { Node defNode = PortletUtil.findDefinitionWithTitle(cloud, portlet.title); if (defNode == null) { defNode = PortletUtil.createDefinition(cloud, portlet.title, portlet.definition, PortletUtil.SINGLE); } Node portletNode = PortletUtil.getPortletForDefinition(defNode); if (portletNode == null) { View view = config.getView(portlet.view); if (view == null) { throw new IllegalStateException("View " + portlet.view + " is not found"); } Node viewNode = cloud.getNode(view.nodeNumber); PortletUtil.createPortlet(cloud, portlet.title, defNode, viewNode); } portlet.nodeNumber = defNode.getNumber(); } private void checklayout(Layout layout) { Node layoutNode = PagesUtil.findLayoutWithResource(cloud, layout.resource); if (layoutNode == null) { layoutNode = PagesUtil.createLayout(cloud, layout.title, layout.resource); for (Map.Entry<String, String> position : layout.positions.entrySet()) { Portlet portlet = config.getPortlet(position.getValue()); if (portlet == null) { throw new IllegalStateException("Portlet " + position.getValue() + " is not found"); } Node definitionNode = cloud.getNode(portlet.nodeNumber); PagesUtil.addAllowedNamedRelation(layoutNode, definitionNode, position.getKey()); } } layout.nodeNumber = layoutNode.getNumber(); } private void checkSite(Site site) { Node siteNode = SiteUtil.getSite(cloud, site.path); if (siteNode == null) { Layout layout = config.findLayout(0); Node layoutNode = cloud.getNode(layout.nodeNumber); siteNode = SiteUtil.createSite(cloud, site.title, site.path, layoutNode); } site.nodeNumber = siteNode.getNumber(); } public void convert(InputStream inputStream) { Node siteNode = SiteUtil.getSite(cloud, config.getSite().path); if (siteNode == null) { checkConfig(); siteNode = cloud.getNode(config.getSite().nodeNumber); try { Map<String, Node> parents = new HashMap<String, Node>(); POIFSFileSystem file = new POIFSFileSystem(inputStream); HSSFWorkbook workbook = new HSSFWorkbook(file); int numSheets = workbook.getNumberOfSheets(); for (int i = 0; i < numSheets; i++) { HSSFSheet sheet = workbook.getSheetAt(i); int last = sheet.getLastRowNum(); for (int rowNum = sheet.getFirstRowNum(); rowNum < last; rowNum++) { HSSFRow menuRow = sheet.getRow(rowNum); if (menuRow != null) { short firstCellNum = menuRow.getFirstCellNum(); short lastCellNum = menuRow.getLastCellNum(); int maxCell = Math.min(lastCellNum, config.getMaxLevel()); for (short cellNum = firstCellNum; cellNum < maxCell; cellNum++) { if (cellNum == 0) { HSSFCell menuCell = findMenu(menuRow, cellNum); ; if (menuCell != null) { String cellValue = getCellValue(menuCell); Node menu = createMenu(cellValue, 1, siteNode); registerMenu(parents, menuCell.getCellNum(), menu); } } else { HSSFCell cell = findMenu(menuRow, cellNum); if (cell != null) { String cellValue = getCellValue(cell); Node parentMenu = requestMenu(parents, cellNum - 1); Node submenu = createMenu(cellValue, cellNum + 1, parentMenu); registerMenu(parents, cellNum, submenu); } } } } } } } catch (IOException e) { log.error(e.getMessage(), e); } } if (config.isCreateChannels()) { Node rootNode = RepositoryUtil.getRootNode(cloud); if (!RepositoryUtil.hasChild(rootNode, config.getSite().path)) { Node contentChannel = createContentChannelForSite(cloud, siteNode); createContentChannelChildren(cloud, siteNode, contentChannel); } } } /** * Request a parent for a certain menu level * * @param parents * @param id * Menu level * @return Node for a menu level */ private Node requestMenu(Map<String, Node> parents, int id) { return parents.get(Integer.toString(id)); } /** * Keep track of parent menu's for all menu levels * * @param parents * @param id * Menu level * @param menu * Node of menu to register */ private void registerMenu(Map<String, Node> parents, int id, Node menu) { parents.put(Integer.toString(id), menu); } /** * Find a submenu in this row in a specific cell * * @param row * Row to look into * @param s * Cell # to look into * @return Cell */ private HSSFCell findMenu(HSSFRow row, short s) { HSSFCell result = null; HSSFCell menuCell = row.getCell(s); if (menuCell != null) { String cellValue = getCellValue(menuCell); if (cellValue != null) { result = menuCell; } } return result; } private Node createMenu(String pageTitle, int level, Node parentMenu) { String fragment = TreeUtil.convertToFragment(pageTitle); if (!NavigationUtil.hasChild(parentMenu, fragment)) { Layout layout = config.findLayout(level); Node layoutNode = cloud.getNode(layout.nodeNumber); Node newPage = PagesUtil.createPage(cloud, pageTitle, layoutNode); NavigationUtil.appendChild(parentMenu, newPage); return newPage; } else { return NavigationUtil.getChild(parentMenu, fragment); } } private String getCellValue(HSSFCell menuCell) { String result = null; if (menuCell.getCellType() != HSSFCell.CELL_TYPE_BLANK) { if (menuCell.getCellType() == HSSFCell.CELL_TYPE_STRING) { String cellValue = menuCell.getStringCellValue().trim(); cellValue = cellValue.replaceAll("-", ""); cellValue = cellValue.replaceAll("\"", ""); if (cellValue != null && cellValue.length() > 0) { result = cellValue; } } } return result; } private Node createContentChannelForSite(Cloud cloud, Node parent) { Node rootNode = RepositoryUtil.getRootNode(cloud); return createContentChannelForPage(cloud, parent, rootNode); } private Node createContentChannelForPage(Cloud cloud, Node parent, Node parentChannel) { String fragmentFieldname = NavigationUtil.getFragmentFieldname(parent); String fragment = parent.getStringValue(fragmentFieldname); if (!RepositoryUtil.hasChild(parentChannel, fragment)) { Node contentChannel = RepositoryUtil.createChannel(cloud, parent.getStringValue(PagesUtil.TITLE_FIELD), fragment); RepositoryUtil.appendChild(parentChannel, contentChannel); return contentChannel; } else { return RepositoryUtil.getChild(parentChannel, fragment); } } private void createContentChannelChildren(Cloud cloud, Node parent, Node parentChannel) { NodeList pages = NavigationUtil.getChildren(parent); for (Iterator<Node> pagesiter = pages.iterator(); pagesiter.hasNext();) { Node page = pagesiter.next(); Node contentChannel = createContentChannelForPage(cloud, page, parentChannel); createContentChannelChildren(cloud, page, contentChannel); } } }
[ "nico@91430c5f-d668-0410-9e7d-dd663366dcfd" ]
nico@91430c5f-d668-0410-9e7d-dd663366dcfd
0b8065e433d29c0ebd34ae3e043278900205f5b1
9776d548e90f4eb99ab89fa840027dadaa2b3edd
/src/main/java/org/nepu/metro/service/MetroPaymentService.java
0c46a08ad8b267a9e7d2570bde259f07b8808a3f
[]
no_license
sunilpulugula/NepuMetroPaymentSystem
8443aa705b92a04a0de7ba2da2af3791dea26a80
b9560d36df5e285b2ba5893120bb5aa0ea0c95b7
refs/heads/master
2023-06-29T09:31:38.403410
2021-08-03T05:11:46
2021-08-03T05:11:46
392,197,306
0
0
null
null
null
null
UTF-8
Java
false
false
1,552
java
package org.nepu.metro.service; import org.nepu.metro.constant.WeekDay; import org.nepu.metro.exception.JourneyInvalidInputException; import org.nepu.metro.manager.MetroPaymentManager; import org.nepu.metro.model.Journey; import org.nepu.metro.model.JourneyCalculatedFare; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * Created By Sunil Kumar Pulugula on date 02/08/21 **/ @Service public class MetroPaymentService { @Autowired private MetroPaymentManager metroPaymentManager; public JourneyCalculatedFare calculateDailyFare(List<Journey> journeys){ validate(journeys); validateDay(journeys); return metroPaymentManager.calculateDailyFare(journeys); } public JourneyCalculatedFare calculateWeeklyFare(List<Journey> journeys){ validate(journeys); return metroPaymentManager.calculateWeeklyFare(journeys); } private void validateDay(List<Journey> journeys) { WeekDay firstWeekDay = journeys.get(0).getDay(); for(Journey journey : journeys){ if(!firstWeekDay.equals(journey.getDay()) ){ throw new JourneyInvalidInputException("Please check journey day, it should be same in daily journey list"); } } } private void validate(List<Journey> journeys) { if(journeys == null || journeys.size() == 0) { throw new IllegalArgumentException("Input cannot be null or empty"); } } }
efde9051ca884c309a79626303511df013b7c3a0
1ccfabde873ae715ee20ba1ed8b53f41e28eb103
/src/main/java/edu/boisestate/cs/reporting/MCReporter.java
d17e743703beab9db27fffcc3563f32df15c9ad0
[]
no_license
BoiseState/string-constraint-counting
defc1ad5f8d72d8630204a713eb46bc133bb0af1
1f57bde6c13ae8d72584b21eb23e572cacee8153
refs/heads/master
2023-02-07T18:54:33.447505
2021-05-17T22:51:27
2021-05-17T22:51:27
208,510,594
0
1
null
2021-07-27T20:59:54
2019-09-14T22:16:42
Java
UTF-8
Java
false
false
9,069
java
package edu.boisestate.cs.reporting; import edu.boisestate.cs.BasicTimer; import edu.boisestate.cs.Parser; import edu.boisestate.cs.automatonModel.AcyclicWeightedAutomatonModel; import edu.boisestate.cs.automatonModel.WeightedAutomatonModel; import edu.boisestate.cs.graph.PrintConstraint; import edu.boisestate.cs.graph.SymbolicEdge; import edu.boisestate.cs.solvers.ExtendedSolver; import edu.boisestate.cs.solvers.ModelCountSolver; import edu.boisestate.cs.util.DotToGraph; import org.jgrapht.DirectedGraph; import java.util.*; public class MCReporter extends Reporter { private final ModelCountSolver modelCountSolver; public MCReporter(DirectedGraph<PrintConstraint, SymbolicEdge> graph, Parser parser, ExtendedSolver extendedSolver, boolean debug, ModelCountSolver modelCountSolver) { super(graph, parser, extendedSolver, debug); this.modelCountSolver = modelCountSolver; } @Override protected void calculateStats(PrintConstraint constraint) { // get constraint info as variables Map<String, Integer> sourceMap = constraint.getSourceMap(); StringBuilder stats = new StringBuilder(); String actualVal = constraint.getActualVal(); int base = sourceMap.get("t"); long tTime, fTime, inMCTime, tMCTime, fMCTime = 0; // get id of second symbolic string if it exists int arg = -1; if (sourceMap.get("s1") != null) { arg = sourceMap.get("s1"); } // initialize boolean flags boolean isSingleton = false; boolean trueSat = false; boolean falseSat = false; // determine if symbolic strings are singletons boolean argIsSingleton = false; if(arg != -1) { argIsSingleton = solver.isSingleton(sourceMap.get("s1")); } if (solver.isSingleton(base, actualVal) && (sourceMap.get("s1") == null || argIsSingleton)) { isSingleton = true; } //System.out.printf("%d Predicate: %s\n", base, constraint.getSplitValue().split("!!")[0]); //System.out.printf("Calculating IN MC for Constraint %d\n", base); long initialCount = this.modelCountSolver.getModelCount(base); inMCTime = BasicTimer.getRunTime(); // store symbolic string values solver.setLast(base, arg); //System.out.printf("Asserting True Predicate for Constraint %d\n", base); // test if true branch is SAT parser.assertBooleanConstraint(true, constraint); tTime = BasicTimer.getRunTime(); if (solver.isSatisfiable(base)) { trueSat = true; } // System.out.printf("Calculating T MC for Constraint %d\n", base); long trueModelCount = this.modelCountSolver.getModelCount(base); tMCTime = BasicTimer.getRunTime(); // revert symbolic string values solver.revertLastPredicate(); // store symbolic string values solver.setLast(base, arg); //System.out.printf("Asserting False Predicate for Constraint %d\n", base); // test if false branch is SAT parser.assertBooleanConstraint(false, constraint); fTime = BasicTimer.getRunTime(); if (solver.isSatisfiable(base)) { falseSat = true; } // System.out.printf("Calculating F MC for Constraint %d\n", base); long falseModelCount = this.modelCountSolver.getModelCount(base); fMCTime = BasicTimer.getRunTime(); // revert symbolic string values solver.revertLastPredicate(); // if actual execution did not produce either true or false if (!actualVal.equals("true") && !actualVal.equals("false")) { System.err.println("warning constraint detected without " + "true/false value"); return; } // determine result of actual execution boolean result = true; if (actualVal.equals("false")) { result = false; } //System.out.printf("Asserting Predicate to determine disjoint branches for Constraint %d\n", base); // branches disjoint? parser.assertBooleanConstraint(result, constraint); // update accumulated timer for base long prevTime = 0; if (timerMap.containsKey(base)) { prevTime = timerMap.get(base); } long lastTime = BasicTimer.getRunTime(); timerMap.put(base, lastTime + prevTime); // update accumulated timer for arg prevTime = 0; if (timerMap.containsKey(arg)) { prevTime = timerMap.get(arg); } timerMap.put(arg, lastTime + prevTime); // store symbolic string values solver.setLast(base, arg); // System.out.printf("Asserting Negation of Predicate to determine disjoint branches for Constraint %d\n", base); parser.assertBooleanConstraint(!result, constraint); //System.out.printf("After assering for Constraint %d\n", base); // set yes or no for disjoint branches String disjoint = "yes"; if (solver.isSatisfiable(base)) { disjoint = "no"; } //System.out.printf("Calculating Disjoint MC for Constraint %d\n", base); // set yes or no for disjoint branches long overlap = this.modelCountSolver.getModelCount(base); // revert symbolic string values solver.revertLastPredicate(); // get percentages // float truePercent = 100 * (float) trueModelCount / (float) initialCount; // float falsePercent = 100 * (float) falseModelCount / (float) initialCount; // get accumulated time long accTime = 0; if (timerMap.containsKey(base)) { accTime = timerMap.get(base); } // get constraint function name String constName = constraint.getSplitValue().split("!!")[0]; // add boolean operation to operation list addBooleanOperation(base, arg, constName, constraint.getId(), argIsSingleton); // get operations String[] opsArray = this.operationsMap.get(base); String ops = joinStrings(Arrays.asList(opsArray), " -> "); // gather column data in list List<String> columns = new ArrayList<>(); // id columns.add(String.valueOf(constraint.getId())); // actual value columns.add(String.format("\\\"%s\\\"", constraint.getActualVal())); // is singleton? columns.add(String.valueOf(isSingleton)); // true sat? columns.add(String.valueOf(trueSat)); // false sat? columns.add(String.valueOf(falseSat)); // disjoint? columns.add(String.format("%8s", disjoint)); // accumulated time columns.add(String.valueOf(accTime)); // id of initial model columns.add(String.valueOf(base)); // initial model count columns.add(String.valueOf(initialCount)); // initial model count time columns.add(String.valueOf(inMCTime)); // true model count columns.add(String.valueOf(trueModelCount)); // true model count time columns.add(String.valueOf(tMCTime)); // true predicate time columns.add(String.valueOf(tTime)); // false model count columns.add(String.valueOf(falseModelCount)); // false model count time columns.add(String.valueOf(fMCTime)); // false predicate time columns.add(String.valueOf(fTime)); // overlap count columns.add(String.valueOf(overlap)); // previous operations columns.add(ops); // generate row string String row = joinStrings(columns, "\t"); // output row System.out.println(row); // System.out.println(((AcyclicWeightedAutomatonModel) solver.getValue(base)).getAutomaton()); // System.out.println(((AcyclicWeightedAutomatonModel) solver.getValue(arg)).getAutomaton()); // System.exit(2); } @Override protected void outputHeader() { // gather headers in list List<String> headers = new ArrayList<>(); headers.add("ID"); headers.add("ACT VAL"); headers.add("SING"); headers.add("TSAT"); headers.add("FSAT"); headers.add("DISJOINT"); headers.add("ACC IN TIME"); headers.add("IN ID"); headers.add("IN COUNT"); headers.add("IN TIME"); headers.add("T COUNT"); headers.add("T MC TIME"); headers.add("T PRED TIME"); headers.add("F COUNT"); headers.add("F MC TIME"); headers.add("F PRED TIME"); headers.add("OVERLAP"); headers.add("PREV OPS"); // generate headers string String header = joinStrings(headers, "\t"); // output header System.out.println(header); } }
8287272ab05eb9600f69ff376dad2aef2465209d
684d8f2c9f3c0e8177ffebbbdf996156504fcb35
/src/main/java/br/com/camiloporto/tenant/model/ImovelMedia.java
dcd42bbb86a22a530a5f3f2824e6a4a9d825ce0a
[]
no_license
camiloporto/tenant
0c98daa2eede13a567d0724d20956879512ac03b
31b81fe8e34c472f680ee2bededc9c83236a00a5
refs/heads/master
2021-01-23T08:56:30.866479
2013-03-17T18:39:16
2013-03-17T18:39:16
7,148,689
1
0
null
null
null
null
UTF-8
Java
false
false
401
java
package br.com.camiloporto.tenant.model; import org.springframework.roo.addon.javabean.RooJavaBean; import org.springframework.roo.addon.json.RooJson; import org.springframework.roo.addon.serializable.RooSerializable; @RooJavaBean @RooJson @RooSerializable public class ImovelMedia { private String id; private String imovelId; private String fileName; private String fileExtension; }
af323780e5cb8349a04151ffbdf4b88bbe834aa5
b7009f6d310caa2f79c0628f50b364ed484c578f
/CricketDemo/src/main/java/com/example/cricket/util/Validation.java
bc9c7e9e3c0fdddcc11d470ad357548458549841
[]
no_license
Ashfi17/Spring-Framework-Projects
e25fe2c7d08569c238347d91630eb8a9993d28e9
11faf56b55ea31cc07b628618698823fd833dc80
refs/heads/master
2021-04-07T10:15:37.001924
2020-03-20T04:24:43
2020-03-20T04:24:43
248,667,627
0
0
null
null
null
null
UTF-8
Java
false
false
960
java
package com.example.cricket.util; import java.util.HashMap; public class Validation { public HashMap<String, String> validateTeam(String team_name,int matches_won,int matches_lost){ HashMap<String,String> errors = new HashMap<String, String>(); if(team_name.length() < 4) errors.put("team_name", "name should be grater than 2 char"); if(matches_won < 0) errors.put("team_matches_won", "matches won field cannot be less than 0"); if(matches_lost < 0) errors.put("team_matches_lost", "matches lost field cannot be less than 0"); // // String matches_lost = String.valueOf(team.getTeam_matches_lost()); // // if( matches_lost == "") // errors.put("team_matches_lost", "matches lost field cannot be empty"); // // String matches_draw = String.valueOf(team.getTeam_matches_draw()); // // if( matches_draw == "") // errors.put("team_matches_draw", "matches draw field cannot be empty"); return errors; } }
faef7c4557cbc8dcddbdc44ec0f19732552a3a5a
2a3411f5c5c8e2b7f7d4f36626e66bc4a5009080
/src/main/java/com/ryan/io/CountingReader.java
6ecf53d9c88cea8e4a5581e6095e2996b6d30036
[]
no_license
chucheng92/jplus
059d94aa06791517ba214a9b941c1069b1e76f79
c071799c481ca8f46377e94cbf52f4002e22c7fa
refs/heads/master
2021-09-12T11:55:50.701624
2018-04-16T13:25:52
2018-04-16T13:25:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,562
java
package com.ryan.io; import com.ryan.util.Parameters; import java.io.IOException; import java.io.Reader; import java.util.concurrent.atomic.AtomicLong; /** * A decorating {@code Reader} that counts the number of characters that have * been read from its underlying {@code Reader}. Characters read multiple times * are counted as many times as they have been read. Skipped characters are not * counted. * * @author Osman KOCAK */ public final class CountingReader extends Reader { private final Reader reader; private final AtomicLong counter; /** * Creates a new {@code CountingReader}. * * @param reader the underlying reader. * @throws NullPointerException if {@code reader} is {@code null}. */ public CountingReader(Reader reader) { Parameters.checkNotNull(reader); this.reader = reader; this.counter = new AtomicLong(); } /** * Returns the number of characters that have been read from the * underlying stream so far. * * @return the number of characters that have been read so far. */ public long getCount() { return counter.get(); } /** * Sets the counter to 0 and returns its value before resetting it. * * @return the number of characters that have been read so far. */ public long resetCount() { return counter.getAndSet(0); } @Override public boolean ready() throws IOException { return reader.ready(); } @Override public int read() throws IOException { int b = reader.read(); count(b != -1 ? 1 : -1); return b; } @Override public int read(char[] buf) throws IOException { int n = reader.read(buf); count(n); return n; } @Override public int read(char[] buf, int off, int len) throws IOException { int n = reader.read(buf, off, len); count(n); return n; } @Override public boolean markSupported() { return reader.markSupported(); } @Override public void mark(int readLimit) throws IOException { reader.mark(readLimit); } @Override public void reset() throws IOException { reader.reset(); } @Override public long skip(long n) throws IOException { return reader.skip(n); } @Override public void close() throws IOException { reader.close(); } private void count(int n) { if (n != -1) { counter.addAndGet(n); } } }
41b8e674fa1b813f27acc268213aef1e3773bfa0
72c7f8920942a4814e965f8f72222eca2ee102dc
/src/main/java/com/alexandre/cursomc/services/exceptions/ObjectNotFoundException.java
e69b27c06e7fdb750c3c2652c55c022e557cb336
[]
no_license
Alexandre-Azvdo/UdemyCursoSpringBoot
72135970ea6f1bf4889a571cb35d2c68f7972097
df2e693d13e45394f0995c1c734eac2765619bc6
refs/heads/master
2020-12-12T08:11:38.773812
2020-02-07T14:44:55
2020-02-07T14:44:55
234,086,797
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package com.alexandre.cursomc.services.exceptions; public class ObjectNotFoundException extends RuntimeException { private static final long serialVersionUID = 1L; public ObjectNotFoundException(String msg) { super(msg); } public ObjectNotFoundException(String msg, Throwable cause) { super(msg, cause); } }
f45d8d3d4476af0e7caaff9538ba5f06aca3056f
b6e54074e6457d7ce1eb64b0fd555868991719bb
/arbor-demo/spring-aop/src/main/java/com/suncafly/cglib/load/PropertyBean.java
ea796b0a0548779ec8fbb6ac0f5a6ec34242e226
[]
no_license
suncafly/arbor
7163730aa824b284429fbc570f697f7a64338c0a
47c30c2533e39a889f76ffd1713dc6afacd265f7
refs/heads/master
2020-03-07T00:20:45.623211
2018-07-21T07:13:54
2018-07-21T07:13:54
127,155,032
0
0
null
null
null
null
UTF-8
Java
false
false
579
java
package com.suncafly.cglib.load; /** * ${TODO} * * @author LiFang * @create 2018-07-20 5:15 PM */ public class PropertyBean { private String key; private Object value; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } @Override public String toString() { return "PropertyBean [key=" + key + ", value=" + value + "]" + getClass(); } }
414748a84ef9cb5d4e31f60f916ab7c4a1d13631
ded280aa185aa8fabba078af0aa2ea2851f6cd43
/src/com/jonasermert/Reservation.java
2b98fbadf7d29386173610036487dcd7dbe3a80e
[]
no_license
jonasermert/Hotel-Reservation-Console-Application-Udacity
22135420e58adedde39dd7607d424478ce41125f
44254ff0c3f86cdf956e80cc5b591e3676b66a98
refs/heads/master
2023-06-02T19:11:59.203714
2021-06-22T18:49:28
2021-06-22T18:49:28
379,370,079
1
0
null
null
null
null
UTF-8
Java
false
false
806
java
package com.jonasermert; import java.util.Date; public class Reservation { private Customer customer; private IRoom room; private Date checkIn; private Date checkOut; public Reservation(Customer customer, IRoom room, Date checkIn, Date checkOut){ this.customer = customer; this.room = room; this.checkIn = checkIn; this.checkOut = checkOut; } public Customer getCustomer() {return customer;} public IRoom getRoom() {return room;} public Date getCheckIn() {return checkIn;} public Date getCheckOut() {return checkOut;} @Override public String toString() { return "Customer{" + customer + "}, room{" + room + "}, checkIn{" + checkIn + "}, checkOut{" + checkOut + "}"; }
7a75ecd0f3454d11e3dd706c401502faeb7f2f85
4424c8a177a5e4d62ac18d1c93517ca44acf31f1
/src/main/java/org/smart4j/chapter1/HelloServlet.java
4640f7b2347183ef93162b6d3b045bae29c1a779
[]
no_license
swordcui/chapter1
c17994545c1aafbc9316d0494a0cc5c157767c66
f2d3d1fb4407b0ee72b9ba6b9c02569f47d99ba1
refs/heads/master
2020-03-24T02:45:42.272129
2018-07-26T04:42:40
2018-07-26T04:42:40
141,435,954
0
0
null
null
null
null
UTF-8
Java
false
false
838
java
package org.smart4j.chapter1; 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 java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; @WebServlet("/hello") public class HelloServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException{ DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String currentTime = dateformat.format(new Date()); req.setAttribute("currentTime", currentTime ); req.getRequestDispatcher("WEB-INF/jsp/hello.jsp").forward(req,resp); } }
6244675d05e703300ceae9529c6a9c06feeabc9d
6f36eb5566829075d340c760c4d0f84b5e37031f
/src/main/java/jpabook/jpashop/JpaMain.java
25a7b3e7cb59a1de01c9dd24b519ed41f2aef6ed
[]
no_license
yshjft/jpashop
0c49f9a86d9b2db783fc078a2c07a33747dae707
f893a85841d3fb1bda4e634ce9c5dfbb7d57504d
refs/heads/main
2023-07-17T05:32:55.929446
2021-09-05T18:29:23
2021-09-05T18:29:23
398,204,132
0
0
null
null
null
null
UTF-8
Java
false
false
838
java
package jpabook.jpashop; import jpabook.jpashop.domain.item.Book; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; public class JpaMain { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("hello"); EntityManager em = emf.createEntityManager(); EntityTransaction tx = em.getTransaction(); tx.begin(); try{ Book book = new Book(); book.setName("JPA"); book.setAuthor("김영한"); em.persist(book); tx.commit(); }catch(Exception e) { tx.rollback(); }finally { em.close(); } emf.close(); } }
1852fa502b5eab564b7441b4ddd7d966bdb68492
f7f2497d7b051bad3fe328d7b1136abef4433a37
/bh-java/accessLogs/src/main/java/com/deeaae/bh/al/model/Pong.java
1a1b94d840c5c0fd1cf64e1c1d050f76a5aa82df
[]
no_license
Anunay-Sinha/bigHouse
d6de33201efbabc7bd036e2732be7da5e891f2f1
b8f6c189e27db0db2cfccf21188a132f26863b0d
refs/heads/master
2022-11-23T13:19:04.878369
2020-07-19T19:05:36
2020-07-19T19:05:36
280,739,552
0
0
null
null
null
null
UTF-8
Java
false
false
504
java
package com.deeaae.bh.al.model; import java.util.Map; import lombok.Data; @Data public class Pong { public Pong() { } public Pong(String time, String requestParam, String pathParam, Map postBody, Map headers) { this.headers = headers; this.postBody = postBody; this.pathParam = pathParam; this.requestParam = requestParam; this.serverTime = time; } String requestParam; String pathParam; Map postBody; Map headers; String serverTime; String pong = "pong"; }
e085c46900f4131326df1e9e639e575f259e2221
70f7e371a1198f8b82b7f503fdfdf4c5493b5113
/src/main/java/com/lhiot/healthygood/feign/type/InventorySpecification.java
ab5b24d46926a26f8efb4fd3a41f5f6506ece906
[]
no_license
Msyang123/healthy-good
6bf40db2d22902c4c2311fd9fce688d528c0a8c3
91b91b8fbc25a1bf17a86c7d05ee35ef3489e670
refs/heads/master
2020-04-21T23:16:44.997459
2019-02-10T08:02:57
2019-02-10T08:02:57
169,941,624
0
1
null
null
null
null
UTF-8
Java
false
false
150
java
package com.lhiot.healthygood.feign.type; /** * @Author zhangfeng created in 2018/9/20 15:34 **/ public enum InventorySpecification { YES,NO }
72aee9b5e80338a16cde30a2ed276d73737d730d
5119e765dd896a1e091b30519252716e55e54ca1
/PFE-master/PFE-ejb/src/main/java/entities/Category.java
3a8b3277415d14dcb65d2da4afc9e13d0bb7745a
[]
no_license
faxteam/PFE
da12dfa994be022eb5e12a1602f04bac7cf4d373
6dc7c538a9c4f4174cff7f25c78bb9be2f8160a9
refs/heads/master
2020-05-04T22:38:44.214848
2019-04-10T03:45:13
2019-04-10T03:45:13
179,518,393
0
1
null
2019-04-09T18:56:14
2019-04-04T14:47:02
Java
UTF-8
Java
false
false
1,850
java
package entities; import java.io.Serializable; import java.util.List; import javax.persistence.*; /** * Entity implementation class for Entity: Category * */ @Entity public class Category implements Serializable { @Override public String toString() { return "Category [category_id=" + category_id + ", category_name=" + category_name + ", category_available=" + category_available + "]"; } private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long category_id; private String category_name; @OneToMany(mappedBy = "category",cascade=CascadeType.REMOVE) private List<Employee> employees; @OneToMany(mappedBy = "category",cascade=CascadeType.REMOVE) private List<Form> forms; private boolean category_available; public Category() { super(); } public long getCategory_id() { return category_id; } public void setCategory_id(long category_id) { this.category_id = category_id; } public String getCategory_name() { return category_name; } public void setCategory_name(String category_name) { this.category_name = category_name; } public List<Employee> getEmployees() { return employees; } public void setEmployees(List<Employee> employees) { this.employees = employees; } public List<Form> getForms() { return forms; } public void setForms(List<Form> forms) { this.forms = forms; } public Category(String category_name) { this.category_name = category_name; } public boolean isCategory_available() { return category_available; } public void setCategory_available(boolean category_available) { this.category_available = category_available; } }
8e8dcf74b4d46aba40db5cabe33cb8d8bb52365b
c74d463ffaaf8f4490e23c07c0fb1c23db522922
/src/main/java/com/medp/array/MergeSort.java
dab32e428b8ac4cc88f2e7f08fead6c8d2617dc3
[]
no_license
KrisZhaoQiankun/Algorithm
4ff86da477f17bc8834e9f9e10a8860636d9eeb7
b4c8583aa0eb35be7afd3287a95fd1664bf9185d
refs/heads/master
2022-05-16T14:52:41.138189
2022-03-31T13:59:43
2022-03-31T13:59:43
198,119,438
0
0
null
null
null
null
UTF-8
Java
false
false
2,429
java
package com.medp.array; /** * @author MEDP * @date 2022/3/6 21:57 */ public class MergeSort { public static void mergeSort(int[] a,int n) { mergeSortInternally(a, 0, n-1); } // 调用递归函数 private static void mergeSortInternally(int[] a, int p, int r) { // 递归终止条件 if (p >= r) return; // 取p到r之间的中见微知q,防止(p+r)的和超过int类型最大值 int q = p + (r - p)/2; //分治递归 mergeSortInternally(a, p, q); mergeSortInternally(a, q+1, r); merge(a, p, q, r); } private static void merge(int[] a, int p, int q, int r) { int i = p; int j = q + 1; int k = 0;// 初始化变量i,j,k int[] tmp = new int[r-p+1]; //申请一个跟a[p.r]一样的临时数组 while (i <= q && j <= r) { if (a[i] <= a[j]) { tmp[k++] = a[i++]; } else { tmp[k++] = a[j++]; } } //判断哪个子数组中还有剩余的数据 int start = i; int end = q; if (j <= r) { start = j; end = r; } //将剩余的数据拷贝到临时数组tmp中 while (start <= end) { tmp[k++] = a[start++]; } // 将tmp中的数组拷贝回a[p...r] for (i = 0; i <= r-p; ++i) { a[p+i] = tmp[i]; } } /** * 合并排序(哨兵) */ private static void mergeBySentry(int[] arr, int p, int q, int r) { int[] leftArr = new int[q - p + 2]; int[] rightArr = new int[r - q + 1]; for (int i = 0; i <= q - p; i++) { leftArr[i] = arr[p + i]; } // 第一个数组添加哨兵(最大值) leftArr[q - p + 1] = Integer.MAX_VALUE; for (int i = 0; i < r - q; i++) { rightArr[i] = arr[q + 1 + i]; } // 第二个数组添加哨兵 rightArr[r - q] = Integer.MAX_VALUE; int i = 0; int j = 0; int k = p; while (k <= r) { // 当左边数组达到哨兵值时,i不再增加,知道右边数组读取完剩余值,同理右边数组也一样 if (leftArr[i] <= rightArr[j]) { arr[k++] = leftArr[i++]; } else { arr[k++] = rightArr[j++]; } } } }
298cf0d555de9ef6cb893353a11554854c047a57
f686e2f19ccd64d7645016d488f65c99afb87344
/app/src/main/java/nitish/build/com/freemium/NotificationRecive.java
42a5b0878614a05d502853f9b30ffccf7c7263d1
[ "MIT" ]
permissive
AbreuY/Freemium-Music-App-Src
befcb64860eddc709e3772c7a51698a9b3ac57b7
1c3c8335fe3247616922f3633c3d6eb437695f81
refs/heads/master
2022-11-05T03:04:00.220833
2020-06-14T07:18:10
2020-06-14T07:18:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,165
java
package nitish.build.com.freemium; // ____ _ _ _ _ _ _ // /\ | _ \ | \ | (_) | (_) | | // / \ _ __ _ __ ___| |_) |_ _| \| |_| |_ _ ___| |__ // / /\ \ | '_ \| '_ \/ __| _ <| | | | . ` | | __| / __| '_ \ // / ____ \| |_) | |_) \__ \ |_) | |_| | |\ | | |_| \__ \ | | | // /_/ \_\ .__/| .__/|___/____/ \__, |_| \_|_|\__|_|___/_| |_| // | | | | __/ | // |_| |_| |___/ // // Freemium Music // Developed and Maintained by Nitish Gadangi import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import com.tonyodev.fetch2.Fetch; import com.tonyodev.fetch2.FetchConfiguration; public class NotificationRecive extends BroadcastReceiver { Fetch fetch; int notifId = 100; @Override public void onReceive(Context context, Intent intent) { //Toast.makeText(context,"recieved",Toast.LENGTH_SHORT).show(); FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(context) .setDownloadConcurrentLimit(1) .build(); fetch = Fetch.Impl.getInstance(fetchConfiguration); String action=intent.getStringExtra("action"); notifId = intent.getIntExtra("notifID",100); Log.i("resuB1",action); Log.i("resuB2",Integer.toString(notifId)); if(action.equals("onClick")){ } else if(action.equals("cancel")){ cancel_d(notifId); } else if(action.equals("resume")){ resume_d(notifId); } //This is used to close the notification tray // Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); // context.sendBroadcast(it); } public void pause_d(int downId){ // fetch.pause(downId); Log.i("resu1","pa"); } public void cancel_d(int downId){ fetch.cancel(downId); Log.i("resu1","ca"); } public void resume_d(int downId){ // fetch.resume(downId); Log.i("resu1","res"); } }
2a51b5355b49a1f5ca102402b0b92cf40b8db682
e4f68a2880e43317ceab826eb5ab26ea6d93a82b
/src/main/java/com/pong/line/todolist/model/Todo.java
aec674547b76144cbc6435806f3f2e2c873a4177
[]
no_license
pongsatt/linetodolist
77bfaa80043dfc1f39340a8570aa1afd48c98e10
57e62dad67d3da3578d8f2db36a24fd1eab5c66a
refs/heads/master
2020-04-16T06:33:15.586302
2019-01-12T19:00:30
2019-01-12T19:00:30
165,352,271
0
0
null
null
null
null
UTF-8
Java
false
false
1,797
java
package com.pong.line.todolist.model; import com.pong.line.todolist.utils.DateUtil; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.time.LocalDateTime; import java.util.Date; @Entity public class Todo { @Id @GeneratedValue(strategy=GenerationType.AUTO) private String id; private String task; private Date date; private boolean completed; private boolean reported; private boolean important; private String userId; public Todo() { } public Todo(String task, Date date) { this.task = task; this.date = date; } public String getTask() { return task; } public void setTask(String task) { this.task = task; } public Date getDate() { return date; } public LocalDateTime getDateToLocalDateTime() { return DateUtil.dateToLocalDateTime(date); } public void setDate(Date date) { this.date = date; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public boolean isCompleted() { return completed; } public void setCompleted(boolean completed) { this.completed = completed; } public boolean isImportant() { return important; } public void setImportant(boolean important) { this.important = important; } public boolean isReported() { return reported; } public void setReported(boolean reported) { this.reported = reported; } }
31f9a81d0c061e07dd01f263671ab3f8949e8ba0
25b5a489812fe30e015fdc18a2b5cb03ad2d2ca7
/src/toorla/ast/statement/localVarStats/LocalVarDef.java
3cd9876ff7a5e83b04c79bd6080f2160676116bd
[]
no_license
Shakiba-Bolbolian-Khah/Compiler-Phase2
d7e876f0eb8bfda7ef6c8186831e854c9519eec9
d774cc5d6ddf757c559250052f286e2f81f8df3c
refs/heads/master
2022-12-11T15:51:24.671936
2020-09-13T12:36:15
2020-09-13T12:36:15
295,147,194
0
0
null
null
null
null
UTF-8
Java
false
false
974
java
package toorla.ast.statement.localVarStats; import toorla.ast.expression.Expression; import toorla.ast.expression.Identifier; import toorla.ast.statement.Statement; import toorla.symbolTable.exceptions.ItemAlreadyExistsException; import toorla.visitor.Visitor; public class LocalVarDef extends Statement { private Identifier localVarName; private Expression initialValue; public LocalVarDef( Identifier localVarName , Expression initialValue ) { this.localVarName = localVarName; this.initialValue = initialValue; } public <R> R accept( Visitor<R> visitor ){ return visitor.visit( this ); } @Override public String toString() { return "localVarDef"; } public Expression getInitialValue() { return initialValue; } public Identifier getLocalVarName() { return localVarName; } public void setLocalVarName(String localVarName) { this.localVarName.setName(localVarName); } }
9dd1d2ea77eddb34234e0786e85e66d04dc17c2e
21d70bfeb8139da4c458351463d3059ddeabcdf3
/框架阶段/Mybatis框架/2_mybatis_CRUD,动态代理等/3.代码/mybatis_day02_4_config/src/main/java/com/itheima/domain/QueryVO.java
9ab0e790f0614d020514d29f5144baa15d86f230
[]
no_license
Zhangxb1111/techSource
92322e1fba28da1fa067b629c7926bbde34c3014
9e3e690ea380323ff857249a699f62414eb8bfd2
refs/heads/master
2023-01-20T00:18:50.703877
2020-11-17T12:57:47
2020-11-17T12:57:47
299,050,652
1
0
null
null
null
null
UTF-8
Java
false
false
592
java
package com.itheima.domain; public class QueryVO { private Integer startIndex; private Integer pageSize; private User user; public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Integer getStartIndex() { return startIndex; } public void setStartIndex(Integer startIndex) { this.startIndex = startIndex; } public Integer getPageSize() { return pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } }
479551175ca29b437e74157b9ccdb5696864d11b
4d99fd29b58d5486d731dd371fb24d60ff753f46
/kodilla-good-patterns/src/main/java/com/kodilla/good/patterns/challenges/food2door/GlutenFreeShop.java
1627e72e6a8bbbed7ff373a09a6d6bc6fa963787
[]
no_license
radoslawwojtyla/radoslaw-wojtyla-kodilla-java
81f0d5aca225a2918a3457ac9a1adaacd18b5fa5
68d0c8309e84300c682f029ccaeeb5c5847cfc67
refs/heads/master
2020-12-28T06:26:31.693204
2020-09-16T13:07:00
2020-09-16T13:07:00
238,211,117
0
0
null
null
null
null
UTF-8
Java
false
false
1,552
java
package com.kodilla.good.patterns.challenges.food2door; import java.util.List; public class GlutenFreeShop implements OrderService { ShopOfferDataBase shopOfferDataBase = new ShopOfferDataBase(); List<ShopOffer> shopOfferList = shopOfferDataBase.addShopOffer(); boolean confirmation = false; @Override public void process(OrderRequest orderRequest) { for (ShopOffer offer : shopOfferList) { if (orderRequest.getShopOffer().getSupplier().getSupplierName().equals(offer.getSupplier().getSupplierName())) { if (orderRequest.getShopOffer().getProduct().getProductName().equals(offer.getProduct().getProductName())) { if (orderRequest.getQuantity() <= offer.getAvailableQuantity()) { confirmation = true; } } } } if (confirmation) { double price = orderRequest.getQuantity() * orderRequest.getShopOffer().getPrice(); System.out.println("Wartosc Twojego zamowienia: " + orderRequest.getShopOffer().getProduct() + "\n" + "wynosi: " + price); System.out.println("Smacznego!"); } else { System.out.println("Twoje zamowienie: " + orderRequest.getShopOffer().getProduct() + " nie moze byc zrealizowane"); System.out.println("Zamowiona ilosc produktu: " + orderRequest.getQuantity()); System.out.println("Dostepna ilosc: " + orderRequest.getShopOffer().getAvailableQuantity()); } } }
1a8f06acd9570fee88532aeced3ebba7b1138c1a
17a9a368673bbe9e78fbd6fce46324613961da2c
/src/main/java/com/tekraze/config/AsyncConfiguration.java
37f36511fc9b24e009d198a3261ce1b9b30b682a
[]
no_license
balvinder294/cachingJhipster
b39c956e08bee09ab325505aaf0c88fbbaa4ac4a
ba111204a68ba153d8e03d67547761bcbca73d34
refs/heads/redisCacheCassandra
2022-07-23T16:31:21.060561
2020-01-22T12:07:32
2020-01-22T12:07:32
235,571,024
0
0
null
2022-07-07T15:57:03
2020-01-22T12:41:15
Java
UTF-8
Java
false
false
1,995
java
package com.tekraze.config; import io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; import org.springframework.boot.autoconfigure.task.TaskExecutionProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.AsyncConfigurer; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.concurrent.Executor; @Configuration @EnableAsync @EnableScheduling public class AsyncConfiguration implements AsyncConfigurer { private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class); private final TaskExecutionProperties taskExecutionProperties; public AsyncConfiguration(TaskExecutionProperties taskExecutionProperties) { this.taskExecutionProperties = taskExecutionProperties; } @Override @Bean(name = "taskExecutor") public Executor getAsyncExecutor() { log.debug("Creating Async Task Executor"); ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(taskExecutionProperties.getPool().getCoreSize()); executor.setMaxPoolSize(taskExecutionProperties.getPool().getMaxSize()); executor.setQueueCapacity(taskExecutionProperties.getPool().getQueueCapacity()); executor.setThreadNamePrefix(taskExecutionProperties.getThreadNamePrefix()); return new ExceptionHandlingAsyncTaskExecutor(executor); } @Override public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { return new SimpleAsyncUncaughtExceptionHandler(); } }
b749fedf2f9ce2cbf7073a9a26452f8b13de6cd9
3ef55e152decb43bdd90e3de821ffea1a2ec8f75
/large/module0619/src/java/module0619/a/IFoo1.java
cee56f3c3bffeb76b4a42e1f94147b34f9c8dbe2
[ "BSD-3-Clause" ]
permissive
salesforce/bazel-ls-demo-project
5cc6ef749d65d6626080f3a94239b6a509ef145a
948ed278f87338edd7e40af68b8690ae4f73ebf0
refs/heads/master
2023-06-24T08:06:06.084651
2023-03-14T11:54:29
2023-03-14T11:54:29
241,489,944
0
5
BSD-3-Clause
2023-03-27T11:28:14
2020-02-18T23:30:47
Java
UTF-8
Java
false
false
817
java
package module0619.a; import java.rmi.*; import java.nio.file.*; import java.sql.*; /** * Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut * labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. * Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. * * @see java.util.logging.Filter * @see java.util.zip.Deflater * @see javax.annotation.processing.Completion */ @SuppressWarnings("all") public interface IFoo1<Z> extends module0619.a.IFoo0<Z> { javax.lang.model.AnnotatedConstruct f0 = null; javax.management.Attribute f1 = null; javax.naming.directory.DirContext f2 = null; String getName(); void setName(String s); Z get(); void set(Z e); }
8788972e9e50e27c56602fb78c4e2afb2ac7bcdb
d052793718f235220b53cc57d2049710f3ea7b83
/SiLomba/app/src/main/java/com/example/fandyaditya/silomba/ListLomba/ListLombaAdapter.java
a626ef49c76c5f316b872a1efa2706eff7bd0216
[]
no_license
irfanhanif/SI-Lomba
962c3cf9767088886a5e080340005853832575e6
2fb0895dc4320a8236b4e332817ddbf78af4eb26
refs/heads/master
2021-01-19T20:02:36.395724
2017-05-25T22:11:02
2017-05-25T22:11:02
88,476,567
1
0
null
null
null
null
UTF-8
Java
false
false
3,856
java
package com.example.fandyaditya.silomba.ListLomba; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.example.fandyaditya.silomba.R; import java.util.List; /** * Created by Fandy Aditya on 4/24/2017. */ public class ListLombaAdapter extends RecyclerView.Adapter<ListLombaAdapter.ViewHolder> { private List<ListLombaObjek> listItem; private Context context; public ListLombaAdapter(Context context, List<ListLombaObjek> listItem) { this.listItem = listItem; this.context = context; } @Override public ListLombaAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_lomba_objek,parent,false); return new ViewHolder(v); } @Override public void onBindViewHolder(ListLombaAdapter.ViewHolder holder, int position) { ListLombaObjek listLombaObjek = listItem.get(position); final String idLomba = listLombaObjek.getId(); final String namaLomba = listLombaObjek.getNama(); final String penyelenggaraLomba = listLombaObjek.getPenyelenggara(); final String kategoriLomba = listLombaObjek.getKategori(); final String hadiahLomba = listLombaObjek.getHadiah(); final String syaratLomba = listLombaObjek.getSyarat(); final String deskripsiLomba = listLombaObjek.getDeskripsiLomba(); holder.namaLomba.setText(listLombaObjek.getNama()); holder.penyelenggaraLomba.setText(listLombaObjek.getPenyelenggara()); holder.hadiahLomba.setText(listLombaObjek.getHadiah()); // Glide.with(context).load(listLombaObjek.getImg()).into(holder.imgLomba); holder.viewMore.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openIntent(idLomba,namaLomba,penyelenggaraLomba,kategoriLomba,hadiahLomba,syaratLomba,deskripsiLomba); } }); } @Override public int getItemCount() { return listItem.size(); } public class ViewHolder extends RecyclerView.ViewHolder { public TextView namaLomba; public TextView penyelenggaraLomba; public TextView hadiahLomba; public TextView viewMore; public ImageView imgLomba; public ViewHolder(View itemView) { super(itemView); namaLomba = (TextView)itemView.findViewById(R.id.lomba_objek_nama); penyelenggaraLomba = (TextView)itemView.findViewById(R.id.lomba_objek_penyelenggara); hadiahLomba = (TextView)itemView.findViewById(R.id.lomba_objek_hadiah); viewMore = (TextView)itemView.findViewById(R.id.lomba_objek_viewmore); imgLomba = (ImageView)itemView.findViewById(R.id.lomba_objek_img); } } private void openIntent(String idLomba, String namaLomba, String penyelenggaraLomba, String kategoriLomba, String hadiahLomba,String syaratLomba, String deskripsiLomba){ Bundle bundle = new Bundle(); Intent openPage = new Intent(context, DetailLomba.class); bundle.putString("idLomba",idLomba); bundle.putString("namaLomba",namaLomba); bundle.putString("penyelenggaraLomba",penyelenggaraLomba); bundle.putString("kategoriLomba",kategoriLomba); bundle.putString("hadiahLomba",hadiahLomba); bundle.putString("syaratLomba",syaratLomba); bundle.putString("deskripsiLomba",deskripsiLomba); openPage.putExtras(bundle); context.startActivity(openPage); } }