blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
0
313
2b6b0b56809d04322759172b5b7121c356ce6240
2a6f3137916981df89bf6bab3373e13793de0e4a
/seata-test-springcloud-sample/bussiness/src/test/java/com/example/seata/test/samples/springcloud/bussiness/BussinessApplicationTests.java
01505ce91191cf5b6e5aec87f7630ff7ca7a1ec6
[]
no_license
liangxiaobo/seata-test-samples
372cf4b7d34bc78e1233a21331c70e6337145b2f
38ca3a8e75924b772221bc0bfe12596ff0a798cd
refs/heads/master
2020-06-29T20:24:54.008508
2019-08-05T09:10:55
2019-08-05T09:10:55
200,615,575
0
1
null
null
null
null
UTF-8
Java
false
false
381
java
package com.example.seata.test.samples.springcloud.bussiness; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class BussinessApplicationTests { @Test public void contextLoads() { } }
e33d146ae7e2d12a0cd16c05b66fec1cc2b88a42
00838bc0c2c387c2651c4da5322172eb59ff0b9c
/src/main/java/com/centime/greeting/service/GreetingService.java
0d18ba0d6191911b65da767347ccccecae31a7a9
[]
no_license
pulgamprem/greeting-service
0b4018b4d08ed8e7309fdb2b21f3803428119190
33cd1e2eae8da67b32abaa008b42ed3a5998026e
refs/heads/master
2022-12-28T15:32:04.949915
2020-07-21T01:09:42
2020-07-21T01:09:42
280,379,943
0
0
null
2020-10-13T23:45:18
2020-07-17T09:12:12
Java
UTF-8
Java
false
false
169
java
package com.centime.greeting.service; import com.centime.greeting.dto.PersonDTO; public interface GreetingService { public String greetPerson(PersonDTO person); }
f6f50e7970b59b79bfe935d330eabb1eb500b4f1
f93455242ba2da03fe7365d54e44aea4ab98c22a
/src/main/java/com/example/demo/models/enums/ProductType.java
99769da422db61e466617ffad3e5b73072102fe9
[]
no_license
KarinaSkirmante/SpringSecurityExample
a37815b8c0090f246eb0d4be98950169fdd4d49e
032fecbb0b152fdd606d909a7be6eb5a9ce63da3
refs/heads/master
2022-11-13T13:59:14.668702
2020-07-13T12:12:03
2020-07-13T12:12:03
279,293,385
0
1
null
null
null
null
UTF-8
Java
false
false
105
java
package com.example.demo.models.enums; public enum ProductType { BakeryType, ComputerType, OtherType }
f44259fc45f318ab358959d439d4646c2d0b140c
b755a269f733bc56f511bac6feb20992a1626d70
/qiyun-lottery/lottery-service/src/main/java/com/qiyun/service/BasketballDataService.java
6d27a8e25288c5f57d03266773bb2425349cca31
[]
no_license
yysStar/dubbo-zookeeper-SSM
55df313b58c78ab2eaa3d021e5bb201f3eee6235
e3f85dea824159fb4c29207cc5c9ccaecf381516
refs/heads/master
2022-12-21T22:50:33.405116
2020-05-09T09:20:41
2020-05-09T09:20:41
125,301,362
2
0
null
2022-12-16T10:51:09
2018-03-15T02:27:17
Java
UTF-8
Java
false
false
800
java
package com.qiyun.service; import com.qiyun.model.BasketBallBase; import com.qiyun.model.basketball.BasketBallGame; import com.qiyun.model.basketball.BasketballDxp; import com.qiyun.model.basketball.BasketballOp; import com.qiyun.model.basketball.BasketballYp; import org.springframework.stereotype.Service; import java.util.List; @Service public interface BasketballDataService { List<BasketBallBase> findByIds(List<Integer> oddIdList); List<BasketballYp> getYpListByintTimes(String s); List<BasketballOp> getOpListByintTimes(List<String> intTimeList, String avgCompany); List<BasketballDxp> getDxpListByintTimes(String s); BasketBallGame findGameByStandardName(String matchName); void attachDirty(BasketBallGame game); void saveIfChange(BasketBallBase base); }
dcba8f7f2ddba4eaeced3732ff2dc678a52375ff
c17d8872e0b333652635a4d44f8fbac364be0bc6
/src/com/meitu/mtxxwz/view/BubbleView.java
0293c833d4693b30e9c83ac5f4cd7fb1c76bd8a5
[]
no_license
Yellow5A5/MTXXWZ
b904f1ad621e1d0ddb5de32d47ad703baa2ee5ed
de1a02970df9d29bb3e17ef5d6e6e277e247e2a6
refs/heads/master
2016-09-16T06:32:16.631842
2015-11-17T10:05:17
2015-11-17T10:05:17
41,492,112
5
2
null
null
null
null
UTF-8
Java
false
false
11,303
java
package com.meitu.mtxxwz.view; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.Typeface; import android.os.Build; import android.text.TextPaint; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; import android.widget.RelativeLayout; import com.meitu.mtxxwz.activities.R; import com.meitu.mtxxwz.dialog.InputContentDialog; import com.meitu.mtxxwz.dialog.InputContentDialog.OnInputClickListener; import com.meitu.mtxxwz.interfaces.OnUpdataControlBtnPostion; import com.meitu.mtxxwz.util.CalculationTool; public class BubbleView extends RelativeLayout { private int FLAG_DRAW_FINISH = 0; private View view; private Context mContext; private AutoAjustSizeTextView labelContent; private ImageView imgBubble; private RelativeLayout rlBubble; private int imgId; /** 屏幕宽高 */ private int displayWidth, displayHeight; /** temp[0]为点击位置到图片左边界的距离,temp[1]为点击位置到图片上边界的距离 */ private int[] temp = new int[] { 0, 0 }; /** 记录按下时对应的屏幕坐标,以计算偏移 */ private int downX = 0, downY = 0; /** 中心点坐标 */ private int centerX, centerY; /** 当前的图片左上角XY坐标*/ private int currentX,currentY; /** 无气泡模式时固定的宽度*/ private int fixedTextWidth; private int currentWidth; private int currentHeight; /** 当前旋转角度 */ private float currentRotation = 0; /** 当前大小比例 */ private float currentScale = 1; /** 图片原宿的边角到中心距离 */ private float vectorStart; private int[] bubbleId = {R.drawable.bubble00,R.drawable.bg01,R.drawable.bg02}; private OnUpdataControlBtnPostion mOnUpdataControlBtnPostion; public void setOnUpdataControlBtnPostion(OnUpdataControlBtnPostion onUpdataControlBtnPostion) { this.mOnUpdataControlBtnPostion = onUpdataControlBtnPostion; } public BubbleView(Context context, int imgId) { super(context); this.mContext = context; this.imgId = imgId; view = LayoutInflater.from(context).inflate(R.layout.bubble_view, this, true); initParameterStart(); initView(); initSticker(imgId); } /** * 基本参数初始化化 */ private void initParameterStart() { displayWidth = getResources().getDisplayMetrics().widthPixels; displayHeight = getResources().getDisplayMetrics().heightPixels; fixedTextWidth = displayWidth / 4 * 3;// 初始化宽度 currentWidth = fixedTextWidth; centerX = displayWidth / 2;// 屏幕中心位置 centerY = displayHeight / 2; } private void initView() { rlBubble = (RelativeLayout) view.findViewById(R.id.rl_bubble); labelContent = (AutoAjustSizeTextView) view.findViewById(R.id.label_content); imgBubble = (ImageView) view.findViewById(R.id.img_bubble); } private void initSticker(int imgId) {// 未设置旋转比例!TODO if (imgId != bubbleId[0]) {// 表示第一个气泡图标为空。 initBubbleMode(imgId); } else { initNoBubbleMode(); } if (currentHeight != FLAG_DRAW_FINISH) {//View已更新 updataAfterRotate(currentWidth, currentHeight); } vectorStart = (int) Math.sqrt(Math.pow(currentWidth / 2, 2) + Math.pow(currentHeight / 2, 2)); this.imgId = imgId; } /** * 无气泡初始化贴纸 */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void initBubbleMode(int imgId) { if (this.imgId == imgId) { return; } labelContent.setFixedFlag(false);// 多行模式 Bitmap bm = BitmapFactory.decodeResource(getResources(), imgId); imgBubble.setImageResource(imgId); labelContent.setWidth(bm.getWidth()); labelContent.setHeight(bm.getHeight()); if (imgId == bubbleId[1]) { labelContent.setPaddingRelative(0, 0, 160, 0); }else { labelContent.setPaddingRelative(128, 0, 0, 0); } currentX = centerX - bm.getWidth() / 2;// 设置XY坐标 currentY = centerY - bm.getHeight() / 2; this.setX(currentX); this.setY(currentY); currentWidth = bm.getWidth(); currentHeight = bm.getHeight(); } /** * 存在气泡初始化贴纸 */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void initNoBubbleMode() { labelContent.setFixedFlag(true);// 单行模式 imgBubble.setImageBitmap(null); labelContent.setPaddingRelative(0, 0, 0, 0); labelContent.setWidth(fixedTextWidth); currentWidth = fixedTextWidth;// 单行模式宽度固定 currentHeight = labelContent.getcurrentHeight(); Log.e("currentWidth currentHeight", currentWidth + " " + currentHeight); currentX = (int) (centerX - fixedTextWidth/ 2);// 设置XY坐标 currentY = (int) (centerY - currentHeight/ 2); this.setX(currentX); this.setY(currentY); Log.e("currentX", "currentX:" + currentX + " currentY:" + currentY); } /** * 更新旋转后的旋转图标位置,利用三角函数进行坐标的换算 * @param perWidth 图片宽度 * @param peiHeight 图片高度 */ private void updataAfterRotate(int perWidth, int perHeight) { float toCenter =(int) Math.sqrt(Math.pow(currentWidth*currentScale / 2, 2) + Math.pow(currentHeight*currentScale / 2, 2)); // Log.e("perWidth / perHeight", perWidth + " " + perHeight + ""); float degree = (float) (Math.atan((float)perWidth / (float)perHeight) / Math.PI * 180); float sumDegree = degree - currentRotation; int diffX = (int) (toCenter * Math.sin(sumDegree / 180f * Math.PI)); int diffY = (int) (toCenter * Math.cos(sumDegree / 180f * Math.PI)); // Log.e("currentRotation", currentRotation + " " + sumDegree); // Log.e("diffX diffY", diffX + " " + diffY); // Log.e("sin ", Math.sin(sumDegree / 180f * Math.PI) + ""); // Log.e("cos ", Math.cos(sumDegree / 180f * Math.PI) + ""); // Log.e("degree ", degree + ""); if (mOnUpdataControlBtnPostion != null) { mOnUpdataControlBtnPostion.setRotationBtnXY((int) (centerX + diffX), (int) (centerY + diffY)); } } @Override public void onWindowFocusChanged(boolean hasWindowFocus) { super.onWindowFocusChanged(hasWindowFocus); initSticker(imgId);//TODO } @SuppressLint("ClickableViewAccessibility") @Override public boolean onTouchEvent(MotionEvent event) { int x = (int) event.getRawX(); int y = (int) event.getRawY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: downX = (int) event.getRawX(); downY = (int) event.getRawY(); temp[0] = (int) (x - this.getX()); temp[1] = (int) (y - this.getY()); System.out.println(getX() + " get " + getY()); break; case MotionEvent.ACTION_MOVE: this.setTranslationX(x - temp[0]); this.setTranslationY(y - temp[1]); mOnUpdataControlBtnPostion.updataOnMoving( (int) (event.getRawX() - downX), (int) (event.getRawY() - downY)); break; case MotionEvent.ACTION_UP: this.setTranslationX(x - temp[0]); this.setTranslationY(y - temp[1]); mOnUpdataControlBtnPostion.updataOnUp((int) (event.getRawX() - downX), (int) (event.getRawY() - downY)); centerX += event.getRawX() - downX; centerY += event.getRawY() - downY; if (Math.abs(downX - event.getRawX()) < 10 && Math.abs(downY - event.getRawY()) < 10) { showInputDiaLog(); } break; default: break; } return true; } /** * 显示输入编辑框 */ private void showInputDiaLog() { InputContentDialog mInputContentDialog = new InputContentDialog( mContext, labelContent.getText().toString()); mInputContentDialog.setOnInputClickListener(new OnInputClickListener() { @Override public void OnClickOK(String input) { if (!input.trim().equals("")) { labelContent.setText(input); } else { labelContent.setText("点击输入内容"); } } }); mInputContentDialog.show(); } /** * 重新计算并设置当前缩放比例 * * @param nowX * 边界点X坐标 * @param nowY * 边界点Y坐标 */ public void resetScale(float nowX, float nowY) { float vector = vectorToCenter(nowX, nowY); currentScale = vector / vectorStart; setScaleX(currentScale); setScaleY(currentScale); } /** * 根据点坐标计算点到贴纸中心的距离 * * @param X * 点的X坐标 * @param Y * 点的Y坐标 * @return 点到中心的距离 */ public float vectorToCenter(float X, float Y) { return CalculationTool.vectorToPoint(X, Y, centerX, centerY); } /** * 通过余弦定理计算出角度重置旋转 * * @param nowX * 当前旋转按钮的X坐标 * @param nowY * 当前旋转按钮的Y坐标 */ public void resetRotation(float nowX, float nowY) { // vectorNow、vectorStart、vectorToPoint为三角形的三条边 float vectorNow = vectorToCenter(nowX, nowY); float vectorToPoint = CalculationTool.vectorToPoint(nowX, nowY, centerX + currentWidth / 2, centerY + currentHeight / 2); double yuXianDingLi = (Math.pow(vectorStart, 2) + Math.pow(vectorNow, 2) - Math .pow(vectorToPoint, 2)) / (2 * vectorStart * vectorNow); if (yuXianDingLi > 0.995) { yuXianDingLi = 0.9999999; } while (yuXianDingLi < -1) { yuXianDingLi += 0.0001; } if (isPositionRotate(nowX, nowY)) { currentRotation = (int) CalculationTool.arccos(yuXianDingLi); } else { currentRotation = -(int) CalculationTool.arccos(yuXianDingLi); } setRotation(currentRotation); if (currentRotation == 0) { rlBubble.setBackgroundResource(R.drawable.border_img_degree_right); }else { rlBubble.setBackgroundResource(R.drawable.border_img_degree_wrong); } } /** 判断是否为正向旋转 */ private boolean isPositionRotate(float nowX, float nowY) { float isPosition = ((-currentHeight / 2) * (nowX - centerX)) - ((-currentWidth / 2) * (nowY - centerY)); return isPosition > 0 ? true : false; } public String getText() { return String.valueOf(labelContent.getText()); } public void setText(String input) { labelContent.setText(input); } public void setTextColor(int color) { labelContent.setTextColor(color); } public void setFontStyle(Typeface typeFace) { labelContent.setTypeface(typeFace); } public void setBold(boolean isBold) { TextPaint tp = labelContent.getPaint(); tp.setFakeBoldText(isBold); labelContent.invalidate(); } /** * 设置是否阴影 * * @param isShadow */ public void setShadow(boolean isShadow) { if (isShadow) { labelContent.setShadowLayer(10f, 3f, 3f, Color.BLACK); } else { labelContent.setShadowLayer(0, 0, 0, Color.BLACK); } } public void setBubbleImg(int imgId) { initSticker(imgId); } public ImageView getBubbleView() { return imgBubble; } }
613c7f68e93a7ad728dc741c8163a4ce85096ef4
7d1e79dc260a89e6ebbe65253884cee504998411
/spring/src/main/java/com/kaishengit/aspect/AspectAdvice.java
489ac80cd5f60e1d427b0adcbc5b1251a7c4035b
[]
no_license
wangpengfei66/learn-SSM
4af9a5276c968aa702b16e6d1449ed01d05fd5c2
61b977e650be25f1ad73c53307e989ac23abb836
refs/heads/master
2020-12-02T22:42:42.111271
2017-08-29T14:58:01
2017-08-29T14:58:01
96,170,383
0
0
null
null
null
null
UTF-8
Java
false
false
1,372
java
package com.kaishengit.aspect; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.*; import org.springframework.stereotype.Component; /** * Created by Administrator on 2017/7/10. */ @Component @Aspect public class AspectAdvice { @Pointcut("execution(* com.kaishengit.service..*.*(..))") public void pointCut() {} @Before("pointCut()") public void beforeAdvice() { System.out.println("前置通知"); } @AfterReturning(value = "pointCut()",returning = "res") public void afterResultAdvice(Object res){ System.out.println("后置通知" + res); } @AfterThrowing(value = "pointCut()",throwing = "e") public void exceptionResultAdvice(Exception e) { System.out.println("异常通知" + e.getMessage()); } @After("pointCut()") public void finallyAdvice() { System.out.println("最终通知"); } @Around("pointCut()") public void aroundAdvice(ProceedingJoinPoint joinPoint){ try { System.out.println("before"); joinPoint.proceed();//目标对象方法的执行 System.out.println("around after"); } catch (Throwable throwable) { throwable.printStackTrace(); System.out.println("异常"); }finally { System.out.println("最终通知"); } } }
ba7fe560c18abb5f62f7883d6c253b1796e86897
2e859842f523f13d491cfdbbc1eaf3495b27eac1
/HelloWorld.java
28ba35fb39d73e1c3a807c50269b97671f2e08f8
[]
no_license
camilla28/HelloWorldJenkins
11dde8a2ae46c664487507ff0e53eaf890af3f85
b46e059bee2e91d97364d23dd0a27f0e7de4ae6f
refs/heads/master
2021-01-07T06:38:27.778830
2020-02-19T12:06:12
2020-02-19T12:06:12
241,608,907
0
0
null
null
null
null
UTF-8
Java
false
false
109
java
public class HelloWorld{ public static void main(String[] args){ System.out.println("Hello,World"); } }
ec6b29cc7c6ce863ea3294ab457649a4fe32799e
a458e0a85b39d7ba02ac117e416c79f54f2dfefa
/sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/GovernanceRulesOperationDeleteSamples.java
fbbed032aadee2b62f66faf33bd5f3e8f5811fb1
[ "LGPL-2.1-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "CC0-1.0", "LicenseRef-scancode-generic-cla" ]
permissive
kyle-patterson/azure-sdk-for-java
eada6c5c769063b49e7b0b397f0266b9d9484163
c53e29e48d477e1f0abc547b2472f4e8040ccac6
refs/heads/main
2023-03-17T22:53:37.544823
2023-03-07T21:34:33
2023-03-07T21:34:33
321,455,126
0
0
MIT
2020-12-14T19:44:42
2020-12-14T19:44:41
null
UTF-8
Java
false
false
916
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.security.generated; import com.azure.core.util.Context; /** Samples for GovernanceRulesOperation Delete. */ public final class GovernanceRulesOperationDeleteSamples { /* * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/DeleteGovernanceRule_example.json */ /** * Sample code: Delete security GovernanceRule. * * @param manager Entry point to SecurityManager. */ public static void deleteSecurityGovernanceRule(com.azure.resourcemanager.security.SecurityManager manager) { manager.governanceRulesOperations().deleteWithResponse("ad9a8e26-29d9-4829-bb30-e597a58cdbb8", Context.NONE); } }
7ef7ce267c840a61f37aa86bdfd66766f32b4f59
2b7adb7870ce7c79fd4cabb13be5847468984c91
/app/src/main/java/com/zaher/base/presentation/newsdetails/NewsDetailsViewModel.java
9f17685cd9046f364b79af4769fc562b2cc87e7a
[]
no_license
MahmoudZaherDeveloper/NewsApi
c5be976a59ea8c0bf3163e3400ce74f6f5a8160f
e3be743183a532a4ef5f6de30ca9fbbafc41c129
refs/heads/master
2020-12-23T00:57:31.426561
2020-01-29T13:24:55
2020-01-29T13:24:55
236,983,160
1
0
null
null
null
null
UTF-8
Java
false
false
88
java
package com.zaher.base.presentation.newsdetails; public class NewsDetailsViewModel { }
fea3f0735185fe2c3e5ba8f8836d0b2776ea3a77
66cb218292435112808afc6a7b79efc6dcdfd231
/Again0924/src/com/icss/moto/biz/MotoType.java
ac93a3cce2954c08b354df9427f4ee531bd7e0b7
[]
no_license
liucheng612/Again
eb5917b1c262e39ea428c27a2dd3b76fffae10d1
01e23c93597270052b86e0d11fe4ea2effb1b6aa
refs/heads/master
2020-07-29T13:45:46.016873
2019-10-10T09:40:12
2019-10-10T09:40:12
209,827,278
0
0
null
null
null
null
GB18030
Java
false
false
318
java
package com.icss.moto.biz; public class MotoType { public static final String BK_GL8 ="別克商务GL8"; public static final String BM_550 ="宝马550"; public static final String BK_LYDA ="別克林荫大道"; public static final String GOLD_CUP ="金杯"; public static final String GOLD_LONG ="金龙"; }
f24c2632155efc3285c57ae77410f701c5e9b71b
13c2d3db2d49c40c74c2e6420a9cd89377f1c934
/program_data/JavaProgramData/38/367.java
533ea01303721541ca333d14746615eb98b574c8
[ "MIT" ]
permissive
qiuchili/ggnn_graph_classification
c2090fefe11f8bf650e734442eb96996a54dc112
291ff02404555511b94a4f477c6974ebd62dcf44
refs/heads/master
2021-10-18T14:54:26.154367
2018-10-21T23:34:14
2018-10-21T23:34:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,077
java
package <missing>; public class GlobalMembers { public static int Main() { int k; int n; int i; int j; double[] s; String tempVar = ConsoleInput.scanfRead(); if (tempVar != null) { k = Integer.parseInt(tempVar); } s = new double[k]; for (i = 0;i < k;i++) { String tempVar2 = ConsoleInput.scanfRead(); if (tempVar2 != null) { n = Integer.parseInt(tempVar2); } double[] x; x = new double[n]; double a = 0; double b = 0; for (j = 0;j < n;j++) { String tempVar3 = ConsoleInput.scanfRead(); if (tempVar3 != null) { x[j] = Double.parseDouble(tempVar3); } a += x[j]; } a = a / n; for (j = 0;j < n;j++) { b += (x[j] - a) * (x[j] - a); } s[i] = (sqrt)(b / n); //C++ TO JAVA CONVERTER TODO TASK: The memory management function 'free' has no equivalent in Java: free(x); } for (i = 0;i < k;i++) { System.out.printf("%.5lf\n",s[i]); } //C++ TO JAVA CONVERTER TODO TASK: The memory management function 'free' has no equivalent in Java: free(s); return 0; } }
4754c87969de8b9f9dc000b29ea1565afff8eab5
0f23178a62f1692e3f4a94efeedd21d3142efd7d
/net.menthor.ontouml2alloy/src/net/menthor/ontouml2alloy/scenarios/QuantifiedScenario.java
0659f77d05eda427cdeea40bf40d92d8d75ace24
[ "MIT" ]
permissive
EdeysonGomes/menthor-editor
b59ca520eea89de3f7c28a923a9a483cca0b4a21
1618b272d8976688dff46fc9e9e35eb9371cd0f4
refs/heads/master
2023-03-13T15:29:56.984131
2021-03-10T20:49:35
2021-03-10T20:49:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package net.menthor.ontouml2alloy.scenarios; import RefOntoUML.parser.OntoUMLParser; public abstract class QuantifiedScenario extends ContentScenario{ WorldQuantification q; public QuantifiedScenario (OntoUMLParser parser, WorldQuantification q){ super(parser); this.q = q; } public WorldQuantification getWorldQuantification() { return q; } }
c6d3e53d09e8441b7ee99aeeb08d06b7608c52d2
45aa185db0da492170bb959ac60567f6358da239
/app/src/main/java/org/coolapk/gmsinstaller/ui/main/presenter/PanelPresenter.java
3b69d6c37353adac09bf4ec4a205dff0059b0cea
[]
no_license
xxxifan/GmsInstaller
30b804b62a5864c668d3c6cf18eed0183e1be1e8
91547116abe538c5aa590a7040d862d66362a661
refs/heads/master
2021-01-15T10:50:44.229972
2015-04-18T07:19:37
2015-04-18T07:19:37
31,689,263
4
0
null
null
null
null
UTF-8
Java
false
false
10,302
java
package org.coolapk.gmsinstaller.ui.main.presenter; import android.content.Intent; import android.os.AsyncTask; import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; import com.sothree.slidinguppanel.SlidingUpPanelLayout; import com.sothree.slidinguppanel.SlidingUpPanelLayout.PanelState; import org.coolapk.gmsinstaller.R; import org.coolapk.gmsinstaller.app.AppHelper; import org.coolapk.gmsinstaller.cloud.CloudHelper; import org.coolapk.gmsinstaller.model.Gpack; import org.coolapk.gmsinstaller.model.PackageInfo; import org.coolapk.gmsinstaller.ui.CardAdapter; import org.coolapk.gmsinstaller.ui.UiPresenter; import org.coolapk.gmsinstaller.ui.main.InstallConfirmCallback; import org.coolapk.gmsinstaller.ui.main.MainActivity; import org.coolapk.gmsinstaller.util.ViewUtils; import org.coolapk.gmsinstaller.util.ZipUtils; import java.io.File; import java.util.ArrayList; import java.util.List; import static org.coolapk.gmsinstaller.ui.main.presenter.StatusPresenter.STATUS_EXTENSION_INSTALLED; import static org.coolapk.gmsinstaller.ui.main.presenter.StatusPresenter.STATUS_EXTENSION_NOT_INSTALLED; import static org.coolapk.gmsinstaller.ui.main.presenter.StatusPresenter.STATUS_MINIMAL_INSTALLED; import static org.coolapk.gmsinstaller.ui.main.presenter.StatusPresenter.STATUS_MINIMAL_NOT_INSTALLED; /** * Created by BobPeng on 2015/3/27. */ public class PanelPresenter extends UiPresenter implements View.OnClickListener { private SlidingUpPanelLayout mPanel; private TextView mSlidingTitle; private TextView mUpdateTimeText; private TextView mPackageSizeText; private TextView mPackageDetailsText; private TextView mInstallBtn; private StatusListener mStatusListener; private int mDisplayIndex; private int mColorDisabled; private int mColorAccent; private int mWorkingIndex = -1; private List<PackageInfo> mPackageInfos; public PanelPresenter(View rootView) { super(rootView); mPackageInfos = new ArrayList<>(); mColorDisabled = getContext().getResources().getColor(R.color.diabled_text); mColorAccent = getContext().getResources().getColor(R.color.pink); String[] descriptions = getContext().getResources().getStringArray(R.array.gapps_description); for (String descriptor : descriptions) { PackageInfo info = new PackageInfo(); info.setPackageDescription(descriptor); mPackageInfos.add(info); } } @Override protected void initView(View rootView) { mPanel = (SlidingUpPanelLayout) rootView.findViewById(R.id.sliding_up_panel); mSlidingTitle = (TextView) rootView.findViewById(R.id.sliding_title); mUpdateTimeText = (TextView) rootView.findViewById(R.id.update_time); mPackageSizeText = (TextView) rootView.findViewById(R.id.package_size); mPackageDetailsText = (TextView) rootView.findViewById(R.id.package_detail); mInstallBtn = (TextView) rootView.findViewById(R.id.package_install_btn); mPanel.setPanelState(PanelState.HIDDEN); mInstallBtn.setOnClickListener(this); } public void display(int position) { mSlidingTitle.setText(CardAdapter.CARD_ITEMS[position]); PackageInfo packageInfo = mPackageInfos.get(position); Gpack pack = packageInfo.getGpack(); if (pack == null) { mUpdateTimeText.setText(R.string.title_no_info); mPackageSizeText.setText(R.string.title_no_info); mPackageDetailsText.setText(getContext().getString(R.string.title_no_info) + "\n\n\n"); toggleBtnState(mInstallBtn, false); } else { mUpdateTimeText.setText(pack.updateTime); mPackageSizeText.setText(ZipUtils.getFormatSize(pack.packageSize)); mPackageDetailsText.setText(packageInfo.getPackageDescription()); toggleBtnState(mInstallBtn, true); } showPanel(); mDisplayIndex = position; // delay check update if (pack == null) { postEvent(new MainActivity.CheckUpdateEvent()); } } public void setGappsDetail(List<Gpack> gpackList) { // get proper packages from raw data. if (gpackList != null) { List<Gpack> list = CloudHelper.getProperPackages(gpackList); if (list != null) { for (int i = 0; i < list.size(); i++) { mPackageInfos.get(i).setGpack(list.get(i)); } if (isPanelExpanded()) { display(mDisplayIndex); } } } } public void setInstallStatus(boolean installed) { setInstallStatus(mWorkingIndex, installed); } public void setInstallStatus(int position, boolean installed) { if (position > -1) { mPackageInfos.get(position).setInstallState(installed); int status = position == 0 ? (installed ? STATUS_MINIMAL_INSTALLED : STATUS_MINIMAL_NOT_INSTALLED) : (installed ? STATUS_EXTENSION_INSTALLED : STATUS_EXTENSION_NOT_INSTALLED); postStickyEvent(new MainActivity.StatusEvent(status)); } } public void setStatusListener(StatusListener listener) { mStatusListener = listener; } /** * @param type package type * @return package position in ui list with this type */ public int getTypePosition(int type) { return type == 1 ? 0 : 1; } /** * @param position package position in ui list * @return package type in ui list with this position. */ public int getPositionType(int position) { return position + 1; } public boolean isPanelExpanded() { return mPanel.getPanelState() == PanelState.ANCHORED || mPanel.getPanelState() == PanelState.EXPANDED; } public void collapsePanel() { mPanel.setPanelState(PanelState.COLLAPSED); } public void showPanel() { mPanel.setPanelState(PanelState.EXPANDED); } private void toggleBtnState(TextView btn, boolean on) { if (on) { btn.setEnabled(true); btn.setTextColor(mColorAccent); } else { btn.setEnabled(false); btn.setTextColor(mColorDisabled); } } @Override public void onClick(View v) { if (v == mInstallBtn) { onInstallClick(); } } private void onInstallClick() { if (mStatusListener.isWorking()) { Toast.makeText(getContext(), R.string.msg_worker_busy, Toast.LENGTH_SHORT).show(); } else { if (mPackageInfos.get(mDisplayIndex).isInstalled()) { MaterialDialog.ButtonCallback buttonCallback = new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { startInstallTask(); } }; new MaterialDialog.Builder(getContext()) .content(R.string.msg_already_installed) .positiveText(R.string.btn_ok) .negativeText(R.string.btn_cancel) .callback(buttonCallback) .build() .show(); } else { if (mDisplayIndex == 1 && !mPackageInfos.get(0).isInstalled()) { new MaterialDialog.Builder(getContext()) .content(R.string.msg_framework_need) .positiveText(R.string.btn_ok) .build() .show(); } else { // start to work :) startInstallTask(); } } } collapsePanel(); } private void startInstallTask() { new AsyncTask<Void, Void, String>() { protected String doInBackground(Void... params) { if (mDisplayIndex < 0) { Toast.makeText(getContext(), R.string.msg_error_interrupt, Toast.LENGTH_SHORT).show(); return null; } mWorkingIndex = mDisplayIndex; Gpack gpack = mPackageInfos.get(mWorkingIndex).getGpack(); String packageName = gpack.packageName; File targetFile = new File(AppHelper.getAppExternalPath(), packageName); if (targetFile.exists() && checkDownload(gpack, targetFile)) { return packageName; } else { // start download Intent data = new Intent(); data.putExtra("path", targetFile.getPath()); CloudHelper.downloadPackage(packageName, data); } return null; } @Override protected void onPostExecute(String packageName) { super.onPostExecute(packageName); if (packageName != null) { ViewUtils.showInstallDialog(getContext(), new InstallConfirmCallback(new MainActivity.InstallEvent(packageName))); } } }.execute(); } private boolean checkDownload(Gpack gpack, File file) { boolean lengthMatch = file.length() == gpack.packageSize; if (lengthMatch && ZipUtils.getFileMd5(file).equals(gpack.md5)) { return true; } // clear unexpected file if (AppHelper.getPrefs(AppHelper.PREFERENCE_DOWNLOAD_FILES).getLong(gpack .packageName, 0l) == 0l) { file.delete(); } return false; } public void onInstallFinished() { mWorkingIndex = -1; } public Gpack getGpack(String packageName) { Gpack gpack; for (PackageInfo info : mPackageInfos) { gpack = info.getGpack(); if (info.getGpack().packageName.equals(packageName)) { return gpack; } } return null; } public interface StatusListener { boolean isWorking(); } }
adfcd46d962b014597f96f2974508221a93f82c6
580d07ef3d66c49b11ccca2c2d26ff8d0ff154ca
/common/source/java/org/alfresco/email/server/handler/AbstractEmailMessageHandler.java
b952cbc65ac2e6ba82356c2a56525570a05039b4
[]
no_license
p4535992/delta
946864ab5a0f305fe9db75e4ea6f604801e7bbda
539a9f1add1990c8cfd29a63c802af4771a75574
refs/heads/master
2020-05-20T07:21:41.859253
2019-05-07T08:59:25
2019-05-07T08:59:25
185,449,469
0
0
null
null
null
null
UTF-8
Java
false
false
13,529
java
/* * Copyright (C) 2005-2007 Alfresco Software Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * As a special exception to the terms and conditions of version 2.0 of * the GPL, you may redistribute this Program in connection with Free/Libre * and Open Source Software ("FLOSS") applications as described in Alfresco's * FLOSS exception. You should have recieved a copy of the text describing * the FLOSS exception, and it is also available here: * http://www.alfresco.com/legal/licensing" */ package org.alfresco.email.server.handler; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.Map; import org.alfresco.email.server.EmailServerModel; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.encoding.ContentCharsetFinder; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.email.EmailMessage; import org.alfresco.service.cmr.email.EmailMessagePart; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.MimetypeService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.sun.star.auth.InvalidArgumentException; /** * Abstract class implements common logic for processing email messages. * * @author maxim * @since 2.2 */ public abstract class AbstractEmailMessageHandler implements EmailMessageHandler { private static final Log log = LogFactory.getLog(EmailMessageHandler.class); private DictionaryService dictionaryService; private NodeService nodeService; private SearchService searchService; private ContentService contentService; private MimetypeService mimetypeService; /** * @return Alfresco Content Service. */ protected ContentService getContentService() { return contentService; } /** * @param contentService Alfresco Content Service. */ public void setContentService(ContentService contentService) { this.contentService = contentService; } /** * @return the Alfresco dictionary service */ protected DictionaryService getDictionaryService() { return dictionaryService; } /** * @param dictionaryService Alfresco dictionary service */ public void setDictionaryService(DictionaryService dictionaryService) { this.dictionaryService = dictionaryService; } /** * @return Alfresco Node Service. */ protected NodeService getNodeService() { return nodeService; } /** * @param nodeService Alfresco Node Service. */ public void setNodeService(NodeService nodeService) { this.nodeService = nodeService; } /** * @param searchService Alfresco Search Service. */ public void setSearchService(SearchService searchService) { this.searchService = searchService; } /** * @return the service used to determine mimeypte and encoding */ protected MimetypeService getMimetypeService() { return mimetypeService; } /** * @param mimetypeService the the service to determine mimetype and encoding */ public void setMimetypeService(MimetypeService mimetypeService) { this.mimetypeService = mimetypeService; } /** * @param to Email address which user part specifies node-dbid * @return Referance to requested node. * @throws InvalidArgumentException The exception is thrown if input string has incorrect format or empty. */ protected NodeRef getTargetNode(String to) throws InvalidArgumentException { if (to == null || to.length() == 0) { throw new InvalidArgumentException("Input string has to contain email address."); } String[] parts = to.split("@"); if (parts.length != 2) { throw new InvalidArgumentException("Incorrect email address format."); } StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); String query = "@sys\\:node-dbid:" + parts[0]; ResultSet resultSet = searchService.query(storeRef, SearchService.LANGUAGE_LUCENE, query); try { if (resultSet.length() == 1) { return resultSet.getNodeRef(0); } } finally { if (resultSet != null) { resultSet.close(); log.error("Closed resultSet"); } } return null; } /** * Write the content to the node * * @param nodeRef Target node * @param content Content */ protected void writeContent(NodeRef nodeRef, String content) { writeContent(nodeRef, content, MimetypeMap.MIMETYPE_TEXT_PLAIN); } /** * Write the string as content to the node. * * @param nodeRef Target node. * @param content Text for writting. * @param mimetype MIME content type. For exaple you can set this parameter to "text/html" or "text/xml", etc. */ protected void writeContent(NodeRef nodeRef, String content, String mimetype) { try { InputStream inputStream = new ByteArrayInputStream(content.getBytes("UTF-8")); writeContent(nodeRef, inputStream, mimetype, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new AlfrescoRuntimeException("Failed to write content", e); } } /** * Write content to the node from InputStream. * * @param nodeRef Target node. * @param content Content stream. * @param mimetype MIME content type. * @param encoding Encoding. Can be null for non text based content. */ protected void writeContent(NodeRef nodeRef, InputStream content, String mimetype, String encoding) { InputStream bis = new BufferedInputStream(content, 4092); // Guess the encoding if it is text if (mimetypeService.isText(mimetype)) { ContentCharsetFinder charsetFinder = mimetypeService.getContentCharsetFinder(); encoding = charsetFinder.getCharset(bis, mimetype).name(); } else if (encoding == null) { encoding = "UTF-8"; } if (log.isDebugEnabled()) { log.debug("Write content (MimeType=\"" + mimetype + "\", Encoding=\"" + encoding + "\""); } ContentService contentService = getContentService(); ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); writer.setMimetype(mimetype); writer.setEncoding(encoding); writer.putContent(bis); } /** * Add emailed aspect to the specified node. * * @param nodeService Alfresco Node Service. * @param nodeRef Target node. * @param mailParser Mail message that will be used for extracting necessary information */ protected void addEmailedAspect(NodeRef nodeRef, EmailMessage message) { Map<QName, Serializable> emailProps = new HashMap<QName, Serializable>(); emailProps.put(ContentModel.PROP_SENTDATE, message.getSentDate()); emailProps.put(ContentModel.PROP_ORIGINATOR, message.getFrom()); emailProps.put(ContentModel.PROP_ADDRESSEE, message.getTo()); emailProps.put(ContentModel.PROP_SUBJECT, message.getSubject()); nodeService.addAspect(nodeRef, EmailServerModel.ASPECT_EMAILED, emailProps); if (log.isDebugEnabled()) { log.debug("Emailed aspect has been added."); } } /** * Add new node into Alfresco repository with specified parameters. Node content isn't added. * * @param nodeService Alfresco Node Service * @param parent Parent node * @param name Name of the new node * @param assocType Association type that should be set between parent node and the new one. * @return Reference to created node */ protected NodeRef addContentNode(NodeService nodeService, NodeRef parent, String name, QName assocType) { NodeRef childNodeRef = nodeService.getChildByName(parent, assocType, name); if (childNodeRef != null) { // The node is present already. Make sure the name csae is correct nodeService.setProperty(childNodeRef, ContentModel.PROP_NAME, name); } else { Map<QName, Serializable> contentProps = new HashMap<QName, Serializable>(); contentProps.put(ContentModel.PROP_NAME, name); ChildAssociationRef associationRef = nodeService.createNode( parent, assocType, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), ContentModel.TYPE_CONTENT, contentProps); childNodeRef = associationRef.getChildRef(); } return childNodeRef; } /** * Add new node into Alfresco repository with specified parameters. * Node content isn't added. New node will be created with ContentModel.ASSOC_CONTAINS association with parent. * * @param nodeService Alfresco Node Service * @param parent Parent node * @param name Name of the new node * @return Reference to created node */ protected NodeRef addContentNode(NodeService nodeService, NodeRef parent, String name) { return addContentNode(nodeService, parent, name, ContentModel.ASSOC_CONTAINS); } /** * Adds new node into Alfresco repository and mark its as an attachment. * * @param nodeService Alfresco Node Service. * @param folder Space/Folder to add. * @param mainContentNode Main content node. Any mail is added into Alfresco as one main content node and several its attachments. Each attachment related with its main node. * @param fileName File name for the attachment. * @return Reference to created node. */ protected NodeRef addAttachment(NodeService nodeService, NodeRef folder, NodeRef mainContentNode, String fileName) { if (log.isDebugEnabled()) { log.debug("Adding attachment node (name=" + fileName + ")."); } NodeRef attachmentNode = addContentNode(nodeService, folder, fileName); // Add attached aspect nodeService.addAspect(mainContentNode, ContentModel.ASPECT_ATTACHABLE, null); // Add the association nodeService.createAssociation(mainContentNode, attachmentNode, ContentModel.ASSOC_ATTACHMENTS); if (log.isDebugEnabled()) { log.debug("Attachment has been added."); } return attachmentNode; } /** * Extracts the attachments from the given message and adds them to the space. All attachments * are linked back to the original node that they are attached to. * * @param spaceNodeRef the space to add the documents into * @param nodeRef the node to which the documents will be attached * @param message the email message */ protected void addAttachments(NodeRef spaceNodeRef, NodeRef nodeRef, EmailMessage message) { // Add attachments EmailMessagePart[] attachments = message.getAttachments(); for (EmailMessagePart attachment : attachments) { String fileName = attachment.getFileName(); InputStream contentIs = attachment.getContent(); MimetypeService mimetypeService = getMimetypeService(); String mimetype = mimetypeService.guessMimetype(fileName); String encoding = attachment.getEncoding(); NodeRef attachmentNode = addAttachment(getNodeService(), spaceNodeRef, nodeRef, fileName); writeContent(attachmentNode, contentIs, mimetype, encoding); } } }
cca03adefb9814bde5e6afba21fa240952d815bc
09a097b68fa4c57db88055b45400946ead2144db
/src/main/java/desktop_fields/Ownable.java
b85598434e84a0576c35bcbf38ccc05c2c8eb67d
[]
no_license
group-18/CDIO2
ddfffd174b624bdb42f208c12784b4c44dcb6358
8a49d1c5fd1f2638f1a599f88971654969ad8d6b
refs/heads/master
2021-08-08T15:19:09.017312
2017-11-10T16:15:02
2017-11-10T16:15:02
106,712,534
0
0
null
null
null
null
UTF-8
Java
false
false
1,885
java
package desktop_fields; import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.border.Border; import desktop_board.Center; import desktop_codebehind.Player; import desktop_codebehind.SwingComponentFactory; public abstract class Ownable extends Field{ public static final String OWNABLELABEL = "Ejes af: "; protected Player owner; private String leje; public Ownable(Color bgColor, Color fgColor, String title, String subText, String description, String leje){ super(bgColor, fgColor, title, subText, description); this.leje = leje; } public Player getOwner(){return this.owner; } public void setOwner(Player owner){ this.owner = owner; Border border; if(owner == null){ border = BorderFactory.createLineBorder(Color.BLACK, 1); this.subTextLabel.setText(this.subText); }else{ SwingComponentFactory factory = new SwingComponentFactory(); Color c1 = this.owner.getPrimaryColor(); Color c2 = this.owner.getSecondaryColor(); border = factory.createDashedBorder(2, 5, c1, c2); String nameToUse = owner.getName(); nameToUse = (nameToUse.length() > 11) ? nameToUse.substring(0, 8)+"..." : nameToUse; this.subTextLabel.setText(nameToUse); } this.layered.setBorder(border); } public String getLeje(){ return this.leje; } @Override public void displayOnCenter(){ super.displayOnCenter(); Border border; if(this.owner != null){ SwingComponentFactory factory = new SwingComponentFactory(); Color c1 = this.owner.getPrimaryColor(); Color c2 = this.owner.getSecondaryColor(); border = factory.createDashedBorder(3, 10, c1, c2); Center.getInstance().getCenterPanel().setBorder(border); }else{ border = javax.swing.BorderFactory.createLineBorder(Color.BLACK, 3); } Center.getInstance().getCenterPanel().setBorder(border); } }
dd2dcb3adb4f563edcd7e2db1318ab20894688a5
5218f0b265d84b6053a8c4b3b1fc9f598fdcb5a3
/src/main/java/co/com/sofka/reto/punto5/Punto5.java
1142330d422bfa88dee3a971493b11cf1a44ea29
[]
no_license
jdan2/RetoJava
8c7ea4bf3c52bf91ab97cd2563770462e0cff108
9610a0e3258ea2d750b47a6908ac2c510545f33a
refs/heads/master
2023-05-01T21:14:38.191815
2021-05-28T01:09:10
2021-05-28T01:09:10
371,504,787
0
0
null
null
null
null
UTF-8
Java
false
false
347
java
package co.com.sofka.reto.punto5; public class Punto5 { public static void main(String[] args) { int i = 1; while (i<101){ if( i%2 == 0){ System.out.println(i + " Es par"); }else { System.out.println(i + " Es impar"); } i++; } } }
3b8a6635dcd74e91df38f7b2b01103bbaa70a3fb
16329d961b768fa41eeab9503b691e7656568147
/perenc/perenc.ups/src/main/java/com/perenc/xh/lsp/controller/admin/tcOrder/AdminTcOrderTempController.java
0fe7bf150b9b5aee2e2cfac7ab7294383f53d171
[]
no_license
chenlongd/wlc-park
ff558d422f788f119620e7584b1b85be9f34ee94
2c46a5b00a92feb7daf0bbf59cc5e9af7f0dd594
refs/heads/master
2022-12-21T21:01:18.795624
2020-03-12T07:26:46
2020-03-12T07:26:46
246,764,097
0
3
null
2022-12-16T03:19:05
2020-03-12T06:53:26
Java
UTF-8
Java
false
false
2,639
java
package com.perenc.xh.lsp.controller.admin.tcOrder; import com.perenc.xh.commonUtils.model.ReturnJsonData; import com.perenc.xh.commonUtils.model.mongoPage.PageHelper; import com.perenc.xh.lsp.service.order.SysOrderService; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.Map; @Controller @RequestMapping("orderTemp") public class AdminTcOrderTempController { @Autowired(required = false) private SysOrderService orderService; /** * 停车定单查询 * @param request * @param response * @return * @throws Exception */ @RequestMapping("page") @ResponseBody public ReturnJsonData page(HttpServletRequest request, HttpServletResponse response) throws Exception{ Map<String,Object> map = new HashMap<>(); //支付类型 商品、停车场 String payType = ServletRequestUtils.getStringParameter(request,"payType",""); if(StringUtils.isNotEmpty(payType)){ map.put("payType",payType); } //订单号 String orderNo = ServletRequestUtils.getStringParameter(request,"orderNo",""); if(StringUtils.isNotEmpty(orderNo)){ map.put("orderNo",orderNo); } //车牌号 String carNum = ServletRequestUtils.getStringParameter(request,"carNum",""); if(StringUtils.isNotEmpty(carNum)){ map.put("carNum",carNum); } //创建开始时间 String createSdate = ServletRequestUtils.getStringParameter(request,"createSdate",""); if(StringUtils.isNotEmpty(createSdate)){ map.put("createSdate",createSdate); } //创建结束时间 String createEdate = ServletRequestUtils.getStringParameter(request,"createEdate",""); if(StringUtils.isNotEmpty(createEdate)){ map.put("createEdate",createEdate); } int current = ServletRequestUtils.getIntParameter(request, "current", 1); int pageSize = ServletRequestUtils.getIntParameter(request, "pageSize", 10); PageHelper pageHelper = new PageHelper(); pageHelper.setPage(current); pageHelper.setRows(pageSize); return orderService.getTcList(map,pageHelper); } }
ada7ae4a196b784d1fd21bd7fd802d50c76bd496
95edae1b67646ed1f6b4b462fa3e6b26712a4b8d
/Eventon/src/main/java/de/eventon/validator/bankAccount/IbanValidator.java
24c944cd072f72e8f5ed890a5d5f303b6dc03d32
[]
no_license
Le00n/JEE_DF_LS
70c49db10de5b451d2e01c661df37840ad963484
dbb88dcb8c76f284da91fb141b0ffc5436c486d6
refs/heads/master
2021-01-21T06:24:07.573897
2017-03-31T21:41:55
2017-03-31T21:41:55
83,221,062
0
0
null
null
null
null
UTF-8
Java
false
false
1,039
java
package de.eventon.validator.bankAccount; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; @FacesValidator ("ibanValidator") public class IbanValidator implements Validator { @Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { if(value == null || value.toString().equals("")) { FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "IBAN nicht gefüllt.", "Die IBAN ist nicht gefüllt."); throw new ValidatorException(msg); } else { String regex = "^[A-Z]{2}\\d{20}"; if(!value.toString().matches(regex)) { FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "IBAN ungültig.", "Die IBAN ist nicht korrekt gefüllt."); throw new ValidatorException(msg); } } } }
d66f11e537ab3d70c6201c47c63c598a22d3b243
92773d97c3622ff3de58ab998e039a1dd6d0b929
/Strategie/src/GameElement/Role.java
9aaa13189268a2be52bda46d6d5d679e384e9c70
[]
no_license
todungnguyen/Strategie
d8e43857c844e81705f5fd27860dbb1ac3ebadaf
3268b4cfcf31f1d1671b3e3de610206a632d2f5e
refs/heads/master
2020-04-14T20:36:19.893246
2019-02-19T13:40:21
2019-02-19T13:40:21
164,099,956
0
0
null
null
null
null
UTF-8
Java
false
false
1,787
java
package GameElement; import Deplacement.GetWay; import Deplacement.Way; import Main.Content; import Main.RunThread; import Map.Cell; import Map.Map; import Map.Or; public enum Role { SENTINELLE { @Override public void action(Player owner, int x, int y, Cell cell, Map m, Unite u, Content content) { // TODO Auto-generated method stub } public int getPrix() { return 20; } }, ATTAQUANT { @Override //besoin que x,y,m,u, u <-> attack public void action(Player owner, int x, int y, Cell cell, Map m, Unite u, Content content) { //System.out.println(" action: Attack "+x+" "+y); Unite unite = m.player1.isUnite(x,y); //defend if(unite == null) { unite = m.player2.isUnite(x,y); } if(unite != null) { if(unite.getOwner() != u.getOwner()) { unite.defend(); } } } public int getPrix() { return 30; } }, RECOLTEUR { @Override public void action(Player owner, int x, int y, Cell cell, Map m, Unite u, Content content) { Or or = (Or) cell; GetWay getway = new GetWay(); Way way = getway.parcour(x, y, owner.getHouseStart().getX() + 2, owner.getHouseStart().getY() + 2, m); Way way1 = getway.parcour(owner.getHouseStart().getX() + 2, owner.getHouseStart().getY() + 2, x, y, m); if (or.getCapacite() > 0) { or.action(u); owner.incGold(); RunThread thread1 = new RunThread(content, m, way1, u, null); RunThread thread = new RunThread(content, m, way, u, thread1); thread.start(); } else { m.winner(); } } public int getPrix() { return 0; } }; public abstract void action(Player owner, int x, int y, Cell cell, Map m, Unite u, Content content); public abstract int getPrix(); }
77935e4da7662ff02662422dc805d216cd8810f1
4d010f8d56439a694a923d0affb1299f9ecf5d78
/src/main/java/BisectionSolver.java
df29daf70c834aa928164030b8807d0de79f9c69
[]
no_license
mackrze/MN_Projekt_1
8647f61aa1520e18f3b3e3ec8695192eb967bcc2
eb81c255aaff9ebeeb9f6b7d1090058acb1d4f11
refs/heads/master
2020-09-22T14:58:49.451299
2019-12-13T09:07:01
2019-12-13T09:07:01
225,249,696
0
0
null
null
null
null
UTF-8
Java
false
false
3,076
java
import java.util.ArrayList; /** * @author mackr * @version 1.0 * Class which method find root of function by bisection method */ public class BisectionSolver { private Function function; /** * Constructor * @param function */ public BisectionSolver(Function function) { this.function = function; } /** * Main public method which find root of function and true value error and approximate error * @param xL lower border * @param xU upper border * @param ea value of approximate error: if error is lower than that method stops * @return ArrayList of double[]. In double [] are: xL,xU,xR,number of iteration, approximate error, true value error */ public ArrayList<double[]> solver(double xL, double xU, double ea, double e,double M) { //start solver ArrayList<double[]> solver = new ArrayList<>(); double[] solve = new double[4]; solve[0] = xL; solve[1] = xU; solve[2] = calculateXR(xL, xU,e,M); solve[3]=100; solver.add(solve); while (solver.get(solver.size()-1)[3]>ea) { solve=calculateBoundaries(solve,e,M); solve[2]=calculateXR(solve[0],solve[1],e,M); solve[3]=calculateaproximateError(solve[2],solver.get(solver.size()-1)[2]); solver.add(solve); } return solver; } //end solver /** * Calculate xR * @param xL lower border * @param xU upper border * @return new xR */ private double calculateXR(double xL, double xU,double e,double M) {//start calculateXR double xR = 0; if (function.function(e,xL,M) * function.function(e,xU,M) > 0) { System.out.println("error: f(xL)*f(xU)>0"); } else { xR = (xL + xU) / 2; } return xR; } //end calculateXR /** * Set new borders of iteration depends of value of xR * @param solve * @return changed xL and xU */ private double[] calculateBoundaries(double[] solve,double e,double M) { //start calculateBoundaries if (function.function(e,solve[0],M) * function.function(e,solve[2],M) < 0) { double countBoundaries[] = new double[solve.length]; countBoundaries[0] = solve[0]; countBoundaries[1] = solve[2]; return countBoundaries; } else { double countBoundaries[] = new double[solve.length]; countBoundaries[0] = solve[2]; countBoundaries[1] = solve[1]; return countBoundaries; } } //end calculateBoundaries /** * calculate approximate error * @param presentApproximation * @param previousApproximation * @return approximate error */ private double calculateaproximateError(double presentApproximation,double previousApproximation){ return Math.abs((presentApproximation-previousApproximation)/presentApproximation*100); } }
4d7739c11131349f687e352e29e8aa37b2e3ac27
022c70327f7da3edd8a67d12a047b9c65ba7a2b0
/src/main/java/com/cisco/cmad/event/services/EventService.java
25f65cb29c76632950276d983ab7fd979ff166d4
[]
no_license
TulasiGupta/awseventmonitor
896ca4266104613893ad5ada6029ccaf1fc636e6
db141549099f916fbc1c50e5eb2dcee39d0bdcbc
refs/heads/master
2020-04-28T08:47:37.713786
2019-03-12T05:36:13
2019-03-12T05:36:13
175,141,983
0
0
null
null
null
null
UTF-8
Java
false
false
8,274
java
/** * https://examples.javacodegeeks.com/enterprise-java/spring/data/spring-data-jparepository-example/ */ package com.cisco.cmad.event.services; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort.Direction; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; import com.cisco.cmad.event.constants.DummyConstants; import com.cisco.cmad.event.dao.Event; import com.cisco.cmad.event.dao.EventType; import com.cisco.cmad.event.dao.EventTypeWithCount; import com.cisco.cmad.event.dao.JsonEvent; import com.cisco.cmad.event.enums.EventTypeEnum; import com.cisco.cmad.event.logger.CMADLogger; import com.cisco.cmad.event.mongo.dao.IPAddresses; import com.cisco.cmad.event.repositories.EventRepository; import com.cisco.cmad.event.repositories.IPAddressRepository; /** * @author sakahuja * @author tcheedel */ @Repository public class EventService implements EventServiceIntf { @Autowired private EventRepository eventRepository; @Autowired private IPAddressRepository ipAddressRepository; @Autowired private ApplicationContext context; @Autowired private JdbcTemplate jdbcTemplate; public JdbcTemplate getJdbcTemplate() { return jdbcTemplate; } private DateFormat df = new SimpleDateFormat("dd MMM yyyy HH:mm:ss z"); public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } public EventService() { System.out.println("jdbcTemplate " + jdbcTemplate); } public void deleteEvents() { try { eventRepository.deleteAll(); } catch(Exception e) { e.printStackTrace(); CMADLogger.logError(this.getClass().getName(), "Exception while deleting the events "+e.getMessage()); } } public void generateEvents() { try { List<IPAddresses> ipAddresses = ipAddressRepository.findAll(); short min = 0; int max = ipAddresses.size() - 1; List<String> ipaddrs = ipAddresses.stream().map(ipaddress -> ipaddress.getIpaddress()) .collect(Collectors.toList()); Random r = new Random(); int totalcount = (int) eventRepository.count(); List<String> messages = new DummyConstants().getMessages(); List<Event> events = new ArrayList<Event>(); for (int i = 0; i < 20; i++) { Event event = new Event(); System.out.println(r.nextInt(10)); System.out.println(messages); String msg = messages.get(r.nextInt(10)); event.setId(++totalcount); event.setIpaddress(ipaddrs.get(r.nextInt(max - min))); event.setTimestamp(System.currentTimeMillis()); event.setMessage(msg.split(":")[0]); event.setType(msg.split(":")[1]); events.add(event); } eventRepository.saveAll(events); } catch (Exception e) { e.printStackTrace(); CMADLogger.logError(this.getClass().getName(), "Exception while generating Events " + e.getMessage()); } } @Override public void addEvent(Event event) { /* * List<School> schoollist = new ArrayList<School>(); * * for(School school: city.getSchools()) { school.setCity(city); * schoollist.add(school); } city.setSchools(new HashSet<School>(schoollist)); */ eventRepository.save(event); } @Override public List<JsonEvent> getEvents(EventTypeEnum eventTypeEnum, int page, int limit) { List<JsonEvent> eventsList = null; if (EventTypeEnum.ALL == eventTypeEnum) { PageRequest pg = PageRequest.of(page, limit, Direction.ASC, "id"); Iterable<Event> events = eventRepository.findAll(pg); eventsList = new ArrayList<JsonEvent>(); for (Event event : events) { eventsList.add(this.getJsonEvent(event)); } } return eventsList; } @Override public Map<String, Long> getEventCountByType() { List<EventTypeWithCount> listofEventTypesWithCount = eventRepository.getCountGroupByType(); Map<String, Long> eventCountMapByType = new HashMap<String, Long>(); for (EventTypeWithCount eventTypeByCount : listofEventTypesWithCount) { eventCountMapByType.put(eventTypeByCount.getType(), eventTypeByCount.getCnt()); } return eventCountMapByType; } @Override public List<JsonEvent> getEventsByType(String eventType) { List<EventType> eventsByType = eventRepository.getEventByType(eventType); List<JsonEvent> events = new ArrayList<JsonEvent>(); for (EventType event : eventsByType) { events.add(this.getJsonEvent(event.getEvent())); } return events; } @Override public List<JsonEvent> sortEvents(String sortColumn, String sortByDesc, int page, int limit) { PageRequest pg = null; if (sortByDesc.equalsIgnoreCase("true")) { pg = PageRequest.of(page, limit, Direction.DESC, sortColumn); } else { pg = PageRequest.of(page, limit, Direction.ASC, sortColumn); } List<JsonEvent> events = new ArrayList<JsonEvent>(); Page<Event> pageEvents = eventRepository.findAll(pg); for (Event event : pageEvents) { events.add(this.getJsonEvent(event)); } return events; } @Override public List<JsonEvent> getEvents(EventTypeEnum eventTypeEnum, String filter, int page, int limit) { System.out.println("in get...."); List<JsonEvent> eventsList = null; PageRequest pg = PageRequest.of(page, limit); if (EventTypeEnum.ALL == eventTypeEnum) { System.out.println("Filter: " + filter); Iterable<Event> events = eventRepository.findByFilterValue(filter, pg); eventsList = new ArrayList<JsonEvent>(); for (Event event : events) { eventsList.add(this.getJsonEvent(event)); } } return eventsList; } @Override public List<JsonEvent> sortEvents(String sortColumn, String filter, String sortByDesc, int page, int limit) { String sortBy = "ASC"; if (sortByDesc.equalsIgnoreCase("true")) { sortBy = "DESC"; } String sql = "SELECT * FROM syslogevents WHERE TYPE LIKE '%" + filter + "%' OR MESSAGE LIKE '%" + filter + "%' OR IPADDRESS LIKE '%" + filter + "%' OR ID LIKE '%" + filter + "%' ORDER BY " + sortColumn + " " + sortBy + " LIMIT " + page + ", " + limit; System.out.println("sql " + sql); List<Map<String, Object>> eventMap = getJdbcTemplate().queryForList(sql); List<JsonEvent> events = new ArrayList<JsonEvent>(); for (Map<String, Object> event : eventMap) { JsonEvent js = new JsonEvent(); js.setId((int) event.get("id")); js.setIpaddress((String) event.get("ipaddress")); js.setType((String) event.get("type")); js.setMessage((String) event.get("message")); js.setTimestamp(df.format(new Date((long) event.get("timestamp")))); events.add(js); } return events; } private JsonEvent getJsonEvent(Event event) { JsonEvent js = new JsonEvent(); System.out.println(js); js.setId(event.getId()); js.setIpaddress(event.getIpaddress()); js.setMessage(event.getMessage()); js.setType(event.getType()); js.setTimestamp(df.format(new Date(event.getTimestamp()))); return js; } }
d2bfe5af380f51ca8f30a1543ae400afdf263f69
564df4191f62558c55183de9aeef45e0ff986068
/humanresource-core/src/test/java/br/com/hrs/core/HrsCoreSuitTest.java
c27908a4cda84126a58480ab8e5a124163ac38ae
[]
no_license
rs-renato/humanresource
1382c9ce249ae6af1529c2b0fce3e09f89fa19fd
6484e211fbee085a325ee65293f5310e77820119
refs/heads/master
2023-09-01T23:00:21.819967
2021-10-18T01:03:01
2021-10-18T01:03:01
416,525,074
0
0
null
2021-10-17T21:15:36
2021-10-12T23:13:44
Java
UTF-8
Java
false
false
353
java
package br.com.hrs.core; import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectPackages; import org.junit.platform.suite.api.SuiteDisplayName; import org.junit.runner.RunWith; @RunWith(JUnitPlatform.class) @SelectPackages("br.com.hrs.core") @SuiteDisplayName("HRS Core Suite Test") public class HrsCoreSuitTest { }
8e656734708fdf471436aba8db8184edce95eb90
f6267d1e999cce1bb3ae30c562f32da049314305
/src/main/java/ru/levelUp/qa/homework_7/IssueFiles/IssueCategory.java
0e9e75fa5aac04b1c6843f455170f03cd85983f5
[]
no_license
ValeraBulatova/ValeraBulatova_LevelUp
c0668246d59124460d3b4ce4f8d191e8ff9a7696
4e05e3ee04e025b5040afdf089b4e0528de52e32
refs/heads/master
2020-05-03T05:20:53.033513
2019-05-20T18:39:37
2019-05-20T18:39:37
178,445,535
0
1
null
2019-05-17T19:33:59
2019-03-29T17:03:07
Java
UTF-8
Java
false
false
352
java
package ru.levelUp.qa.homework_7.IssueFiles; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; @Data @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public class IssueCategory { private int id; private String name; }
925d10931883d1a9b4c5bccdcb2a111bdfb1eb74
28529815d30d4c18aa1dc8cdf4cc2f8b6cd70f13
/week7-week7_04.ThingSuitcaseAndContainer/src/Container.java
6dd523323495fd8b721f26e114f498205b96b365
[]
no_license
KevinKerin/mooc-part-ii
7a4682948b1ddfe872fe33401eee5dae89adea1b
5f799fe112f08dc45a1557a0a538a6c4b3e15b4d
refs/heads/master
2020-08-27T14:37:15.394507
2019-11-01T18:03:05
2019-11-01T18:03:05
217,407,719
0
0
null
null
null
null
UTF-8
Java
false
false
1,214
java
import java.util.ArrayList; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author kevinkerin */ public class Container { private int maxWeight; private ArrayList<Suitcase> suitcases; public Container(int maxWeight){ this.maxWeight = maxWeight; suitcases = new ArrayList<Suitcase>(); } public void addSuitcase(Suitcase suitcase){ int currentWeight = 0; for (Suitcase sc : suitcases){ currentWeight += sc.totalWeight(); } if ((currentWeight + suitcase.totalWeight()) <= maxWeight){ suitcases.add(suitcase); currentWeight += suitcase.totalWeight(); } } public void printThings(){ for (Suitcase sc : suitcases){ sc.printThings(); } } @Override public String toString(){ int totalWeight = 0; for (Suitcase sc : suitcases){ totalWeight += sc.totalWeight(); } return(suitcases.size() + " suitcases (" + totalWeight + " kg)"); } }
3fa5d12d76af9ef362b682a0b00b405f4575244a
d4427009115987909c55e29e0ad9a747e8f680d4
/src/9_Abstract_Class_dan_Interface/Ikan1841720207Bayu.java
1768804da958cebf1a7221e1a2d7804c37641c46
[]
no_license
BayuTeguh/laporan-praktikum-pbo-2019
e1d7b0e21eac48438847579c6ad3368cea1fed3d
ef99e6b23227c1935cb2d4d940179d47d2c38ab9
refs/heads/master
2020-07-16T14:10:48.533484
2019-12-14T18:56:11
2019-12-14T18:56:11
205,803,743
0
0
null
null
null
null
UTF-8
Java
false
false
223
java
package AbstractandInterface; public class Ikan1841720207Bayu extends Hewan1841720207Bayu{ @Override public void bergerakBayu() { System.out.println("Berenang dengan SIRIP,\"wush..wush..\""); } }
50ab2d3759a49a5d3c5f9b28e1fb4a90f1540ff7
7ce6660f341351db176c843a9507281027ecea93
/lib/src/test/java/com/xinghai/log/lib/ExampleUnitTest.java
d956662577e836d30e272b44619cadacafaac33e
[ "Apache-2.0" ]
permissive
eastcompeaceqxh/AndroidFileLogger
3b12da3ece3da8666cf7a9ee80e638169bbae790
f95a68b8f5e62f98c1e75c811ecb72eb5e0fa872
refs/heads/main
2023-02-28T10:04:53.862873
2021-02-01T09:47:39
2021-02-01T09:47:39
334,627,059
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.xinghai.log.lib; 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() { assertEquals(4, 2 + 2); } }
a3d8b10431223e367064dbcfd96620d72fb82fb2
eef8c73e37a58b74bfcae0e40165b0e8b4475308
/OrangeHrmDemo/src/main/java/app/dashboardMethods/Dashboard_Page.java
d69132b3dd8a4d21640b07b030fe468eb638812b
[]
no_license
gayatrimallareddy/OrangeHRMDemo
a96bdf0c540b117324923aca6426309df995337a
0cd66a2bf34105db65ea57bede7e612f0acfc3d3
refs/heads/master
2021-01-18T18:37:08.218429
2016-07-21T07:05:43
2016-07-21T07:05:43
63,767,965
0
0
null
null
null
null
UTF-8
Java
false
false
1,490
java
package app.dashboardMethods; import java.util.List; import org.apache.poi.ss.usermodel.Sheet; import org.openqa.selenium.WebElement; import org.testng.Reporter; import com.reusableMethods.Excel_Methods; import app.reusableMethods.Application_Methods; public class Dashboard_Page extends Application_Methods{ Excel_Methods excelObj = new Excel_Methods(); public void dashboard() throws Exception{ String[] subMenus = MenuBar("Dashboard"); Sheet sheet = excelObj.Read_Excel_Sheet("OrangeHRM.xlsx", "Menu_Bar"); String[] excelSubMenus = excelObj.Read_Column(sheet, "Dashboard"); if(subMenus.length!=0){ for(int i=0;i<subMenus.length;i++){ if(subMenus[i].equals(excelSubMenus[i])){ System.out.println(subMenus[i] + " Is Verified."); } else { System.out.println(subMenus[i] + " Is Not Verified."); } } } } public void legend() throws Exception{ List<WebElement> legends = cssSelectorElements("legendsCss"); Sheet sheet = excelObj.Read_Excel_Sheet("OrangeHRM.xlsx", "Dashboard"); String[] excelLegends = excelObj.Read_Column(sheet, "Legends"); int i=0; for(WebElement legend : legends){ String legendText = legend.getText(); if(legendText.equalsIgnoreCase(excelLegends[i])){ Reporter.log(legendText + " Is Verified."); System.out.println(legendText + " Is Verified."); } else{ Reporter.log(legendText + " Is Not Verified."); System.out.println(legendText + " Is Not Verified."); } i++; } } }
[ "Rahul Gunda@vendskp54" ]
Rahul Gunda@vendskp54
3715c4e9b87f5f6c96ef959dc26bd47e722e858e
215cb9de76ea51a462ce050a7c4e3a0e11692fef
/AnimalPound/AnimalPoundj/src/main/java/za/ac/innocentmphokeli/DomainInterfaces/IScheduleType.java
71388bfd63a28ed80e9e3436ff37930a177d315b
[]
no_license
innothetechgeek/Assignement5
fd3a298b95d5a18a992c6c7b8c48207bdaf89813
d085380f229c583327a9f48941f203b9dc086420
refs/heads/master
2021-01-10T09:47:58.273057
2016-04-15T16:35:26
2016-04-15T16:35:26
55,614,223
0
0
null
null
null
null
UTF-8
Java
false
false
310
java
package za.ac.innocentmphokeli.DomainInterfaces; import za.ac.innocentmphokeli.Domain.Schedule; import java.util.List; /** * Created by Admin on 2016/04/03. */ public interface IScheduleType { int getScheduleTypeId(); String getName(); boolean isActive(); List<Schedule> getSchedules(); }
3d9950e86536852397eaefdf3295aa5d909d6831
5305314181464af553a75770bcdd493e0b419e73
/src/main/java/pages/MyAccountPage.java
7d4fbf678a3ab6efe91a5cd107be96ada21c9d95
[]
no_license
amado-saladino/seleniunm-maven-java
9ac7bab0bd739eeb555be3e047834463d14185ca
68c3c6e5e9310d8932dedceebd108c1ca6a8daf4
refs/heads/master
2023-06-23T14:50:50.435913
2023-06-15T05:32:04
2023-06-15T05:32:04
169,706,575
2
0
null
2023-06-15T05:32:05
2019-02-08T08:45:34
Java
UTF-8
Java
false
false
1,066
java
package pages; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; public class MyAccountPage extends Page { public MyAccountPage(WebDriver driver) { super(driver); } @FindBy(linkText="Change password") WebElement changePasswordLink ; @FindBy(id = "OldPassword") WebElement oldPasswordTxt; @FindBy(id = "NewPassword") WebElement newPasswordTxt; @FindBy(id = "ConfirmNewPassword") WebElement confirmPasswordTxt; @FindBy(css = "input.button-1.change-password-button") WebElement ChangePasswordBtn; @FindBy(css = "div.result") public WebElement resultLbl; public void openChangePasswordPage() { clickButton(changePasswordLink); } public void ChangePassword(String oldpassword, String newpassword) { setTextElementText(oldPasswordTxt, oldpassword); setTextElementText(newPasswordTxt, newpassword); setTextElementText(confirmPasswordTxt, newpassword); clickButton(ChangePasswordBtn); } }
0ebb984690785fffe36516989862c21e31fb9dc0
f34bb510f83974d0e37fef2b9c6c756b49c6ad0e
/src/java/model/Users.java
aed38f7803764f5ca413b920b5430a20c6c17356
[]
no_license
himanshubhat333/foodyfood
d7464d64a168dce0b64fe705776ecf3de6e22ecf
483ef8485b4c925c8970e15ce0ba3f30f58ccd46
refs/heads/master
2020-03-30T07:48:15.343207
2018-09-30T13:05:23
2018-09-30T13:05:23
150,967,641
0
0
null
null
null
null
UTF-8
Java
false
false
1,458
java
package model; public class Users { private int id; private String name; private String email; private String phone; private String address; private String password; private String cpassword; public String getCpassword() { return cpassword; } public void setCpassword(String cpassword) { this.cpassword = cpassword; } 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 getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Users() { } @Override public String toString() { return "Users{" + "id=" + id + ", name=" + name + ", email=" + email + ", phone=" + phone + ", address=" + address + ", password=" + password + '}'; } }
fa48ddab47fd10286c3112c12d1c58d388cb3489
ea72416c66f87e07c82bdac959fbb8d1ccef224b
/ghana-national-functional-tests/src/main/java/org/motechproject/functional/pages/openmrs/OpenMRSLoginPage.java
577dd7dfb37a982992b8f6025a9d30c2a203938c
[]
no_license
kishoreyekkanti/GHANA-National
e80a1768f92ef2ed177c322fa107defbc86184f7
810bc12ee4acd88dd494c06df71fdd71db66127b
refs/heads/master
2021-01-15T17:46:25.160471
2012-01-13T05:34:21
2012-01-13T05:34:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
992
java
package org.motechproject.functional.pages.openmrs; import org.motechproject.functional.data.OpenMRSTestUser; import org.motechproject.functional.data.TestUser; import org.motechproject.functional.pages.BasePage; import org.motechproject.functional.util.ElementPoller; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.CacheLookup; import org.openqa.selenium.support.FindBy; public class OpenMRSLoginPage extends BasePage<OpenMRSLoginPage> { @FindBy(id = "username") @CacheLookup private WebElement userName; @FindBy(id = "password") @CacheLookup private WebElement password; @FindBy(xpath = "//input[3]") @CacheLookup private WebElement submit; public OpenMRSLoginPage(WebDriver webDriver) { super(webDriver); } public void login(OpenMRSTestUser user) { enter(this.userName, user.name()).enter(this.password, user.password()); submit.click(); } }
9e9cfd8a48f3d2f104e852e1e8d385081ee8aba3
b55d8d2e9581179fd146febbc8766d526a6745f9
/src/main/java/day1_12_20210405/exer2/AccountTest.java
d28faa67ad4f23d185f72e5f56b6f82967392be2
[ "Apache-2.0" ]
permissive
liguangyuaaa/bigdatajava
07765ce53da711b21e52f092685b80a73e28ff02
607dafb501e26c890c95ebddcef108c113a47a5b
refs/heads/master
2023-04-29T11:36:14.735930
2021-05-09T16:15:30
2021-05-09T16:15:30
351,970,488
0
0
null
null
null
null
UTF-8
Java
false
false
870
java
package day1_12_20210405.exer2; /* * 写一个用户程序测试Account类。在用户程序中, * 创建一个账号为1122、余额为20000、年利率4.5%的Account对象。 * 使用withdraw方法提款30000元,并打印余额。 * 再使用withdraw方法提款2500元, * 使用deposit方法存款3000元,然后打印余额和月利率。 * */ public class AccountTest { public static void main(String[] args) { Account acct = new Account(1122, 20000, 0.045); acct.withdraw(30000); System.out.println("您的账户余额为:" + acct.getBalance()); acct.withdraw(2500); System.out.println("您的账户余额为:" + acct.getBalance()); acct.deposit(3000); System.out.println("您的账户余额为:" + acct.getBalance()); System.out.println("月利率为:" + (acct.getMonthlyInterest() * 100) +"%"); } }
898a6aab54112977adf4d3f4d51a128b307cb759
1648e6acfc9b7efe3edfb0f146b1f8c576492dd2
/src/main/java/se/iths/martin/demo2/ProductRepository.java
e53e60de6e5b93751e36cf41bd4039c37a28802a
[]
no_license
AdamBremholm/demo2
1109d903cce814d9f6c89d878b66fe2a5d7cf34e
72303226e11b8fb7d5776421cccceb62bc3f0fdf
refs/heads/master
2020-04-25T03:24:45.787183
2019-02-25T10:52:59
2019-02-25T10:52:59
172,475,966
0
0
null
2019-02-25T09:32:39
2019-02-25T09:32:39
null
UTF-8
Java
false
false
172
java
package se.iths.martin.demo2; import org.springframework.data.jpa.repository.JpaRepository; public interface ProductRepository extends JpaRepository<Product, Long> { }
eaa7f1ad86efc4fea5ec032178ebec497c861d3f
6e1a2978420e5c14984e29f0ccccd87917426d39
/legolas/src/main/java/com/yepstudio/legolas/response/OnErrorListener.java
63a0feffd69a5184cb3d57e600a067437398a6a7
[]
no_license
zzljob/legolas
1d90130baec8cfc210b73730eb3f988339410699
4598f5326ea6f9bafff5929833d411e376220b39
refs/heads/master
2016-09-06T18:01:41.754924
2015-03-04T06:16:11
2015-03-04T06:16:11
15,733,339
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
package com.yepstudio.legolas.response; import com.yepstudio.legolas.LegolasException; public interface OnErrorListener { public void onError(LegolasException error); }
1432b87a08bebd2140de9dad6f757defc175dd61
34637870b54fee48d5d65ddd0b43564a32eb4520
/backend/src/main/java/com/devsuperior/dsvendas/dto/SaleSumDTO.java
437fe4ad66154bc5ac4052425b071450905b841f
[]
no_license
akmazurok/projeto-sds3
c21f5256c2c92316b761bd60655795184656d329
013fc60b45d0bf6f32b562110da382b628375a89
refs/heads/main
2023-04-17T03:31:57.139528
2021-05-09T14:55:23
2021-05-09T14:55:23
363,953,536
0
0
null
null
null
null
UTF-8
Java
false
false
668
java
package com.devsuperior.dsvendas.dto; import java.io.Serializable; import com.devsuperior.dsvendas.entities.Seller; public class SaleSumDTO implements Serializable{ /** * */ private static final long serialVersionUID = 1L; private String sellerName; private Double sum; public SaleSumDTO() {} public SaleSumDTO(Seller seller, Double sum) { this.sellerName = seller.getName(); this.sum = sum; } public String getSellerName() { return sellerName; } public void setSellerName(String sellerName) { this.sellerName = sellerName; } public Double getSum() { return sum; } public void setSum(Double sum) { this.sum = sum; } }
a12ca5322119d6bc14840771d2bae719d3da283f
0708d2857f33bf0e003bccdf84c241be4c33aee1
/hrms/src/main/java/kodlamaio/hrms/entities/concretes/User.java
429594ba8fc035c88c7a50210f5133c5b38f2fbe
[]
no_license
hilal-bstn/Hrms
7a2e4a5bc8a9bf1f29d0e38623a393299cd86d57
da591d40e3695281ed344183ac2f52dba7d70291
refs/heads/main
2023-06-18T13:43:48.087846
2021-05-29T14:49:04
2021-05-29T14:49:04
369,016,884
1
0
null
null
null
null
UTF-8
Java
false
false
1,045
java
package kodlamaio.hrms.entities.concretes; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="users") public class User { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") private int id; @Column(name="email") private String email; @Column(name="password") private String password; public User() {} public User(int id, String email, String password) { super(); this.id = id; this.email = email; this.password = password; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
d66131c1e295d8df6dca9fea05a0125d31a8db62
e526b894c558855510c9631b70c1b41b509efe21
/src/main/java/com/example/RestTemplateClient/web/config/SecurityConfig.java
7f1fe7315f050c55b35b0ae7a76ec600810edda7
[]
no_license
Hudognik/RestTemplateClient
7e126d2214c1f25609dab24c594a2f251424942c
4121f00a639d4345f9227124fdcebb92ba5aa6df
refs/heads/master
2021-01-06T02:27:16.354703
2020-02-17T20:28:48
2020-02-17T20:28:48
241,201,060
0
0
null
null
null
null
UTF-8
Java
false
false
3,471
java
package com.example.RestTemplateClient.web.config; import com.example.RestTemplateClient.web.config.handler.LoginSuccessHandler; import com.example.RestTemplateClient.web.service.UserDetailsServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.password.NoOpPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UserDetailsServiceImpl userDetailsService; @Autowired private LoginSuccessHandler loginSuccessHandler; @Override public void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService); } @Override protected void configure(HttpSecurity http) throws Exception { http.formLogin() // указываем страницу с формой логина .loginPage("/login") //указываем логику обработки при логине .successHandler(loginSuccessHandler) // указываем action с формы логина .loginProcessingUrl("/login") // Указываем параметры логина и пароля с формы логина .usernameParameter("j_username") .passwordParameter("j_password") // даем доступ к форме логина всем .permitAll(); http.logout() // разрешаем делать логаут всем .permitAll() // указываем URL логаута .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) // указываем URL при удачном логауте .logoutSuccessUrl("/login?logout") //выклчаем кроссдоменную секьюрность (на этапе обучения неважна) .and().csrf().disable(); http // делаем страницу регистрации недоступной для авторизированных пользователей .authorizeRequests() //страницы аутентификаци доступна всем .antMatchers("/registration").anonymous() // защищенные URL .antMatchers("/admin", "/update", "/delete").access("hasAnyRole('ROLE_ADMIN')").anyRequest().authenticated(); } @Bean public PasswordEncoder passwordEncoder() { return NoOpPasswordEncoder.getInstance(); } }
70f641218b9eb9cffbafd2137d276c2ffdf91940
103af3b46f257ddc2dc3308202beb84abf996a12
/src/OneProvider2OneConsumerVal/C.java
f68f8151b2700e4c4d1037b87095696503556492
[]
no_license
dads546/ThreadPro
21959ba436f57ab96242e7fc948c023e66f4f7ac
12b987a362461e062a8d39dcdd9bf5008819fe1a
refs/heads/master
2021-05-15T05:23:29.502922
2018-01-14T10:03:31
2018-01-14T10:03:31
117,074,192
0
0
null
null
null
null
GB18030
Java
false
false
596
java
package OneProvider2OneConsumerVal; public class C { private String lock; public C(String lock) { super(); this.lock = lock; } public void setValue() { try { synchronized (lock) { if (ValueObject.value.equals("")) { System.out.println(Thread.currentThread().getName()+"阻塞了"); lock.wait(); } System.out.println(Thread.currentThread().getName()+"消费了产品"); ValueObject.value = ""; lock.notify(); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
d1cb4fe9385f0a9668184bdcfa60aebb29e6cb51
d38db59c2a427c1bd3885909b1f524c1b44463c6
/src/main/java/com/roamer/contacts/configuration/JpaConfiguration.java
5ddb564da4c309ccb7f5de2d5122fe3b5471285e
[]
no_license
592146505/contacts
e74176769783883c5a07bead59ad8dec00e30ae8
2e91c1b621b26e56ff66d004cd9662bcddb1fac7
refs/heads/master
2020-03-17T15:05:20.375468
2018-05-23T07:01:32
2018-05-23T07:01:32
133,697,842
0
0
null
null
null
null
UTF-8
Java
false
false
1,121
java
package com.roamer.contacts.configuration; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.transaction.annotation.EnableTransactionManagement; /** * JPA配置类 * @author roamer */ @Order(Ordered.HIGHEST_PRECEDENCE) @Configuration @EnableTransactionManagement(proxyTargetClass = true) @EnableJpaRepositories(basePackages = "com.roamer.contacts.**.repository") @EntityScan(basePackages = "com.roamer.contacts.**.entity") public class JpaConfiguration { /** * Repository异常转换功能 * @return */ @Bean PersistenceExceptionTranslationPostProcessor persistenceExceptionTranslationPostProcessor(){ return new PersistenceExceptionTranslationPostProcessor(); } }
dd3a4b4c0f00e519950f85a4bd542a3ed324d619
d8c03dfc21e1b3d89ee4702430a98a4de8d841b4
/src/main/java/com/habibsweb/commons/components/event/ScrollableListItemSelectionEvent.java
abac3a896fd769f81efeb62773fb04315aba7f38
[]
no_license
lespaul361/Habib-Commons-SelectList
35948b5f2cdeb5922e4efc2dfbfec23d1fa84979
61302704a035bcc29d7ce79c3f8cbef9b57a93cf
refs/heads/master
2021-09-05T21:02:36.430978
2018-01-31T01:29:49
2018-01-31T01:29:49
114,521,788
0
0
null
null
null
null
UTF-8
Java
false
false
1,334
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.habibsweb.commons.components.event; import java.util.EventObject; /** * * @author Charles Hamilton */ public class ScrollableListItemSelectionEvent extends EventObject { /** * Item has been selected */ public static final int SELECTED = 1; /** * item has been unselected */ public static final int UNSELECTED = 0; private final int index; private final int mode; /** * Constructs a new <code>ScrollableListItemSelectionEvent</code> * * @param source the <code>ScrollableList</code> that created the event * @param selection the mode of selected or unselected * @param index the index of the item */ public ScrollableListItemSelectionEvent(Object source,int selection, int index) { super(source); this.index=index; this.mode=selection; } /** * Gets the index of the item * @return the index of the item */ public int getIndex() { return index; } /** * Gets the selection mode * @return the selection mode */ public int getMode() { return mode; } }
677b8db7a2a9bb41ed944dd924f0484e6c9e571e
6baf1fe00541560788e78de5244ae17a7a2b375a
/hollywood/com.oculus.userserver2-UserServer2/sources/X/ep.java
b2bf8a5738df99053f57eba7d25b33de7df0f107
[]
no_license
phwd/quest-tracker
286e605644fc05f00f4904e51f73d77444a78003
3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba
refs/heads/main
2023-03-29T20:33:10.959529
2021-04-10T22:14:11
2021-04-10T22:14:11
357,185,040
4
2
null
2021-04-12T12:28:09
2021-04-12T12:28:08
null
UTF-8
Java
false
false
361
java
package X; import android.net.Uri; import java.util.List; import javax.annotation.Nullable; import org.json.JSONObject; public class ep { @Nullable public List<Uri> A00; @Nullable public JSONObject A01; public ep(@Nullable JSONObject jSONObject, @Nullable List<Uri> list) { this.A01 = jSONObject; this.A00 = list; } }
5eb5fe1afca081e8ed101b12ecee79f03b5dcfe6
9e5e380320b8087dbda285274fcc9756d500e15b
/Redundant Connection.java
3fb18fee5f16fc497b38a5b8b9a3826869d5fb34
[]
no_license
Sumit-Budhiraja/June-LeetCode-Challenge
8cdde1c517a89fb91d3d3fd73134912bb80caf3e
235e32e833c6e8efc7692151007ca4fc8c64b183
refs/heads/main
2023-06-07T16:59:48.440162
2021-06-29T10:22:38
2021-06-29T10:22:38
372,974,365
1
0
null
null
null
null
UTF-8
Java
false
false
722
java
class Solution { public int[] findRedundantConnection(int[][] edges) { if (edges == null) { return null; } int[] graph = new int[1001]; int[] output = null; for (int i = 0; i < edges.length; i++) { int src = edges[i][0]; int dst = edges[i][1]; int parentSrc = src; while (graph[parentSrc] != 0) { parentSrc = graph[parentSrc]; } int parentDst = dst; while (graph[parentDst] != 0) { parentDst = graph[parentDst]; } if (parentSrc == parentDst) { output = edges[i]; } else { if (parentSrc < parentDst) { graph[parentDst] = parentSrc; } else { graph[parentSrc] = parentDst; } } } return output; } }
dd5ab88722ba078f882a2819bae3ec2a95d4c75d
179b00f1198e5a6c321ae52b68a27a06168ffc93
/RestProject/src/main/java/com/spring/rest/model/Instructor.java
76d5665886e16d0feaf421950b15c6ffcc268496
[]
no_license
khandelia7/SpringMVCBoot_Learning6
70457387c33219a3475173602f88c20641a07fdb
ebb220096e6baf44b1817a5c184fb20a9439c24c
refs/heads/master
2022-11-27T23:32:35.463676
2020-08-03T11:47:55
2020-08-03T11:47:55
284,685,111
0
0
null
null
null
null
UTF-8
Java
false
false
1,191
java
package com.spring.rest.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity //make this class as table in database @Table(name = "instructor") //change table name public class Instructor { @Id //primary key @GeneratedValue(strategy = GenerationType.AUTO) //auto increment private Long id; private String name; private Double salary; // One Instructor has Many Course [Instructor side] : 1:M // One Course has many Instructor [Course Side] : M to 1 // Note In Instructor no need to mention course /** * @return the id */ public Long getId() { return id; } /** * @param id the id to set */ public void setId(Long id) { this.id = id; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the salary */ public Double getSalary() { return salary; } /** * @param salary the salary to set */ public void setSalary(Double salary) { this.salary = salary; } }
b7a31f5d0e8f002a8f75bb424fec1011c690e395
d7214ffeb6339668885a4fc7735c7c3efa37950e
/Order.java
fd05c3e64fb6192e724503dd8c2cb2c6e3be43f8
[]
no_license
itwasntzak/delivery_tracking-java
6423b1ed77339232929657a079cf3c5c4e5e89a9
b63744bd3d9bb836255e98d842a903c6fe505f6f
refs/heads/master
2022-08-05T08:51:47.260655
2020-06-04T02:48:10
2020-06-04T02:48:10
269,235,006
0
0
null
null
null
null
UTF-8
Java
false
false
8,332
java
import java.util.ArrayList; import java.util.Calendar; import java.io.File; import java.net.URI; import java.nio.channels.WritableByteChannel; public class Order { // initialize attributes for this class int id; Delivery parent; Calendar endTime = Calendar.getInstance(); Tip tip; double milesTraveled; // list of all local files File idFile; File orderInfoFile; File tipFile; File milesFile; File endtimeFile; File startIndicator; // constructor for new orders public Order(Delivery delivery) { this.parent = delivery; this.idFile = new File(parent.directory.getAbsolutePath(), "order_id.txt"); this.tipFile = new File(parent.directory.getAbsolutePath(), "tip.txt"); this.milesFile = new File(parent.directory.getAbsolutePath(), "order_miles_traveled.txt"); this.endtimeFile = new File(parent.directory.getAbsolutePath(), "order_end_time.txt"); this.startIndicator = new File(parent.directory.getAbsolutePath(), "order"); } // constructor to load completed orders public Order(int id, Delivery delivery) { this.id = id; this.parent = delivery; this.orderInfoFile = new File(parent.directory.getAbsolutePath(), Integer.toString(id) + ".txt"); this.tipFile = new File(parent.directory.getAbsolutePath(), "tip.txt"); this.milesFile = new File(parent.directory.getAbsolutePath(), "order_miles_traveled.txt"); this.endtimeFile = new File(parent.directory.getAbsolutePath(), "order_end_time.txt"); } // method to consolidate data from indavidule files to one file public void consolidate() { this.orderInfoFile = new File(this.parent.directory.getAbsolutePath(), Integer.toString(id) + ".txt"); String data = String.format("%s,%s,%s,%s,%s", this.tip.card, this.tip.cash, this.tip.unknown, this.milesTraveled, Utility.pyTimeFormat.format(this.endTime.getTime())); Utility.writeData(this.orderInfoFile, data); this.updateIdsFile(); // delete temporary files after consolidating the data to one file this.idFile.delete(); this.tipFile.delete(); this.milesFile.delete(); this.endtimeFile.delete(); this.startIndicator.delete(); } // method to load order data after already consolidating to one file public void load() { ArrayList<String> tempList = Utility.commaScanner(this.orderInfoFile); this.tip = new Tip( Double.parseDouble(tempList.get(0)), Double.parseDouble(tempList.get(1)), Double.parseDouble(tempList.get(2))); this.milesTraveled = Double.parseDouble(tempList.get(3)); this.endTime.setTime(Utility.parsePyTime(tempList.get(4))); } // method to start entering data for an order public void start() { Utility.writeData(new File(this.parent.directory.getAbsolutePath(), "order"), ""); inputIdNumber(); inputTip(); inputMilesTraveled(); this.endTime = Calendar.getInstance(); Utility.writeData(this.endtimeFile, Utility.pyTimeFormat.format(this.endTime.getTime())); consolidate(); String timeTaken = Utility.timeTaken(this.parent.startTime, this.endTime); System.out.println("\nThis order was completed in:\t" + timeTaken); } // method to update/create the order ids file for the delivery private void updateIdsFile() { if (this.parent.orderIdsFile.exists()) { Utility.appendData(this.parent.orderIdsFile, Integer.toString(this.id), ","); } else { Utility.writeData(this.parent.orderIdsFile, Integer.toString(this.id)); } } // methods for inputting data private void inputMilesTraveled() { String prompt = "\nOrder miles traveled:\t#.#"; this.milesTraveled = Utility.inputDouble(prompt); while (!Utility.userConfirmation(Double.toString(this.milesTraveled) + " miles")) { this.milesTraveled = Utility.inputDouble(prompt); } Utility.writeData(this.milesFile, Double.toString(this.milesTraveled)); } private void inputIdNumber() { String prompt = "\nEnter order number:\t#-####"; this.id = Utility.inputInt(prompt); while (!Utility.userConfirmation(Integer.toString(this.id))) { this.id = Utility.inputInt(prompt); } Utility.writeData(this.idFile, Integer.toString(this.id)); } private void inputTip() { double noTip = 0.0; String prompt = "\nWas there a split tip?\t[Y/N]"; String userResponse = Utility.getInput(prompt, "[yYnN]{1,1}"); if (userResponse.matches("[yY]{1,1}")) { double cardAmount = Utility.inputDouble("\nEnter card tip amount:\t$#.##"); while (!Utility.userConfirmation("$" + Double.toString(cardAmount) + " card tip")) { cardAmount = Utility.inputDouble("\nEnter card tip amount:\t$#.##"); } double cashAmount = Utility.inputDouble("\nEnter cash tip amount:\t$#.##"); while (!Utility.userConfirmation("$" + Double.toString(cashAmount) + " cash tip")) { cashAmount = Utility.inputDouble("\nEnter cash tip amount:\t$#.##"); } this.tip = new Tip(cardAmount, cashAmount); } else { double amount = Utility.inputDouble("\nEnter tip amount:\t$#.##\n(Enter 0 for no tip)"); while (!Utility.userConfirmation("$" + Double.toString(amount))) { amount = Utility.inputDouble("\nEnter tip amount:\t$#.##\n(Enter 0 for no tip)"); } if (amount == noTip) { this.tip = new Tip(); } else { String type = Utility.getInput("\nSelect a tip type:\n1. Card\n2. Cash", "1|2{1,1}"); String data; if (type.matches("[1]{1,1}")) { data = "Card"; } else { data = "Cash"; } while (!Utility.userConfirmation(data)) { type = Utility.getInput("\nSelect a tip type:\n1. Card\n2. Cash", "1|2{1,1}"); if (type.matches("[1]{1,1}")) { data = "Card"; } else { data = "Cash"; } } if (type.matches("[1]{1,1}")) { this.tip = new Tip(amount, Tip.typeCard); } else { this.tip = new Tip(amount, Tip.typeCash); } } } this.tip.save(this.tipFile); } // method to load order data while a order is in progress public void loadCurrent() { if (this.idFile.exists()) { this.id = Integer.parseInt(Utility.readLine(this.idFile)); } if (this.tipFile.exists()) { ArrayList<String> tempList = Utility.commaScanner(this.tipFile); ArrayList<Double> tipList = new ArrayList<>(); for (String tip: tempList) { tipList.add(Double.parseDouble(tip)); } tip = new Tip(tipList.get(0), tipList.get(1), tipList.get(2)); } if (this.milesFile.exists()) { this.milesTraveled = Double.parseDouble(Utility.readLine(this.milesFile)); } if (this.endtimeFile.exists()) { this.endTime.setTime(Utility.parsePyTime(Utility.readLine(this.endtimeFile))); } resume(); } // method to comlete entering data for started order private void resume() { if (!this.idFile.exists()) { inputIdNumber(); } if (!this.tipFile.exists()) { inputTip(); } if (!this.milesFile.exists()) { inputMilesTraveled(); } if (!this.endtimeFile.exists()) { this.endTime = Calendar.getInstance(); Utility.writeData(this.endtimeFile, Utility.pyTimeFormat.format(this.endTime.getTime())); } consolidate(); String timeTaken = Utility.timeTaken(this.parent.startTime, this.endTime); System.out.println("\nThis order was completed in:\t" + timeTaken); } public void saveChanges() { String data = String.format("%s,%s,%s,%s,%s", this.tip.card, this.tip.cash, this.tip.unknown, this.milesTraveled, Utility.pyTimeFormat.format(this.endTime)); Utility.writeData(this.orderInfoFile, data); } } // todo: need to write function that allows the user to change data
36de74f583646ae58795b36aef7a203264e0df16
f42854d2995e8530c5b023e927e36775883cefac
/splash_library/src/main/java/com/zhboy/ycwwz/splash_library/service/data/SplashBean.java
a5f9cfa13af340d3a7c0e1e36ab8fa7ab016271c
[]
no_license
ZHBoy/AndroidBaseT
5827ef4d165af627480c0087bf97ab700fa8265c
ae3e6178ed20fc88d5a924b4d6f09ab2ff2ac53c
refs/heads/master
2022-11-18T03:34:46.980430
2020-07-10T07:59:27
2020-07-10T07:59:27
278,567,981
2
0
null
null
null
null
UTF-8
Java
false
false
2,995
java
package com.zhboy.ycwwz.splash_library.service.data; import java.util.List; public class SplashBean { /** * state : 1 * message : success * data : [{"id":1,"pageImage":"http://calendar.yhzm.cc/qr/open00.jpg","type":0,"isUsing":1,"createTime":"1969-12-31T16:00:00.000+0000","description":"太特么多"},{"id":5,"pageImage":"http://calendar.yhzm.cc/qr/open01.jpg","type":0,"isUsing":1,"createTime":"1969-12-31T16:00:00.000+0000","description":"好的"},{"id":6,"pageImage":"http://calendar.yhzm.cc/qr/open02.jpg","type":0,"isUsing":1,"createTime":"1969-12-31T16:00:00.000+0000","description":"我马上做完"},{"id":7,"pageImage":"http://calendar.yhzm.cc/qr/open03.jpg","type":0,"isUsing":1,"createTime":"1969-12-31T16:00:00.000+0000","description":"真尼玛多"}] */ private int state; private String message; private List<DataBean> data; public int getState() { return state; } public void setState(int state) { this.state = state; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class DataBean { /** * id : 1 * pageImage : http://calendar.yhzm.cc/qr/open00.jpg * type : 0 * isUsing : 1 * createTime : 1969-12-31T16:00:00.000+0000 * description : 太特么多 */ private int id; private String pageImage; private int type; private int isUsing; private String createTime; private String description; private String jumpUrl; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getPageImage() { return pageImage; } public void setPageImage(String pageImage) { this.pageImage = pageImage; } public int getType() { return type; } public void setType(int type) { this.type = type; } public int getIsUsing() { return isUsing; } public void setIsUsing(int isUsing) { this.isUsing = isUsing; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getJumpUrl() { return jumpUrl; } public void setJumpUrl(String jumpUrl) { this.jumpUrl = jumpUrl; } } }
470d2245130bfedceaf52bc181542776b53cf79f
d88496bf9951bbe8177955a3ae8f904c552d9cd1
/frontgoo-orm/src/main/java/org/frontgoo/orm/hibernate/base/ResultBean.java
875d90b5293c3ad78cb7cc897c9703e912df039c
[]
no_license
sdgdsffdsfff/rep
ac034247b9b6c73d1cc7a804921a117213751291
0811ddef49c5b41064e3508993b854878cb25e6a
refs/heads/master
2020-12-25T04:37:24.360104
2015-08-12T08:15:07
2015-08-12T08:15:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,107
java
package org.frontgoo.orm.hibernate.base; import java.io.Serializable; import java.util.Arrays; import java.util.List; /** * 业务执行结果对象 * * ResultBean * * * @version 1.0.0 * */ public class ResultBean<T> implements Serializable{ /** * */ private static final long serialVersionUID = 4329054640002077889L; private boolean success = false;// 执行结果 private T returnObject;// 执行返回结果 private List<T> returnSet;// 执行结果集 private long total;// 结果集总数 private int start;// 结果集索引开始位置 private int limit = 50;// 结果集数量限制 private String errorMessage;// 执行错误描述 private String msg;// 描述信息 private String[] msgList;// 描述信息集合 private int page;//当前页码 private int totalPage; private boolean hasNext = false; //是否有下一页 public String[] getMsgList() { return msgList; } public ResultBean<T> setMsgList(String[] msgList) { this.msgList = msgList; return this; } public List<T> getReturnSet() { return returnSet; } /** * 打印集合 * @return */ public void printReturnSet() { if(returnSet == null) return; for(T t:returnSet){ System.out.println(t); } } public ResultBean<T> setReturnSet(List<T> returnSet) { this.returnSet = returnSet; return this; } public long getTotal() { return total; } public ResultBean<T> setTotal(long total) { this.total = total; return this; } public int getStart() { return start; } public ResultBean<T> setStart(int start) { this.start = start; return this; } public int getLimit() { return limit; } public ResultBean<T> setLimit(int limit) { this.limit = limit; return this; } public Object getReturnObject() { return returnObject; } public ResultBean<T> setReturnObject(T returnObject) { this.returnObject = returnObject; return this; } public boolean isSuccess() { return success; } public ResultBean<T> setSuccess(boolean success) { this.success = success; return this; } public String getErrorMessage() { return errorMessage; } public ResultBean<T> setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; return this; } public String getMsg() { return msg; } public ResultBean<T> setMsg(String msg) { this.msg = msg; return this; } public void setPage(int page) { this.page = page; } public int getPage() { return page; } public void setTotalPage(int totalPage) { this.totalPage = totalPage; } public int getTotalPage() { totalPage = (int) (total/limit); if(total%limit != 0){ totalPage++; } return totalPage; } public void setHasNext(Boolean hasNext) { this.hasNext = hasNext; } public Boolean getHasNext() { return hasNext; } @Override public String toString() { return "ResultBean [success=" + success + ", returnObject=" + returnObject + ", returnSet=" + returnSet + ", total=" + total + ", start=" + start + ", limit=" + limit + ", errorMessage=" + errorMessage + ", msg=" + msg + ", msgList=" + Arrays.toString(msgList) + "]"; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((errorMessage == null) ? 0 : errorMessage.hashCode()); result = prime * result + (hasNext ? 1231 : 1237); result = prime * result + limit; result = prime * result + ((msg == null) ? 0 : msg.hashCode()); result = prime * result + Arrays.hashCode(msgList); result = prime * result + page; result = prime * result + ((returnObject == null) ? 0 : returnObject.hashCode()); result = prime * result + ((returnSet == null) ? 0 : returnSet.hashCode()); result = prime * result + start; result = prime * result + (success ? 1231 : 1237); result = prime * result + (int) (total ^ (total >>> 32)); result = prime * result + totalPage; return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ResultBean other = (ResultBean) obj; if (errorMessage == null) { if (other.errorMessage != null) return false; } else if (!errorMessage.equals(other.errorMessage)) return false; if (hasNext != other.hasNext) return false; if (limit != other.limit) return false; if (msg == null) { if (other.msg != null) return false; } else if (!msg.equals(other.msg)) return false; if (!Arrays.equals(msgList, other.msgList)) return false; if (page != other.page) return false; if (returnObject == null) { if (other.returnObject != null) return false; } else if (!returnObject.equals(other.returnObject)) return false; if (returnSet == null) { if (other.returnSet != null) return false; } else if (!returnSet.equals(other.returnSet)) return false; if (start != other.start) return false; if (success != other.success) return false; if (total != other.total) return false; if (totalPage != other.totalPage) return false; return true; } }
fd0d854c34036ba809ab352ce3801d9b11d2be31
0046a33ba3a0482adda704fd18317abcd092bdab
/src/netbeanstypescript/TSCodeCompletion.java
37db80053d7dce2560cff4228a597563224353ee
[ "Apache-2.0" ]
permissive
alesak/nbts
a422d7a3ab102adedb90935efa7e14b1a39f1b14
eba556d8ac6b0608a8aa310040d9363456c95ea1
refs/heads/master
2022-04-23T08:22:37.779582
2020-04-21T15:02:08
2020-04-21T15:02:08
257,625,312
0
0
Apache-2.0
2020-04-21T14:40:05
2020-04-21T14:40:04
null
UTF-8
Java
false
false
12,017
java
/* * Copyright 2015-2017 Everlaw * * 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 netbeanstypescript; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import javax.swing.text.Document; import javax.swing.text.JTextComponent; import netbeanstypescript.lexer.api.JsTokenId; import netbeanstypescript.lexer.api.LexUtilities; import netbeanstypescript.options.OptionsUtils; import org.json.simple.JSONObject; import org.netbeans.api.lexer.TokenId; import org.netbeans.api.lexer.TokenSequence; import org.netbeans.lib.editor.codetemplates.api.CodeTemplate; import org.netbeans.lib.editor.codetemplates.spi.CodeTemplateFilter; import org.netbeans.modules.csl.api.*; import org.netbeans.modules.csl.spi.DefaultCompletionResult; import org.netbeans.modules.csl.spi.ParserResult; import org.openide.filesystems.FileObject; /** * * @author jeffrey */ public class TSCodeCompletion implements CodeCompletionHandler { public static class TSCompletionProposal extends TSElementHandle implements CompletionProposal { FileObject fileObj; int caretOffset; int anchorOffset; String type; TSCompletionProposal(FileObject fileObj, int caretOffset, int anchorOffset, JSONObject m) { super(OffsetRange.NONE, m); this.fileObj = fileObj; this.caretOffset = caretOffset; this.anchorOffset = anchorOffset; type = (String) m.get("type"); // may be null } @Override public int getAnchorOffset() { return anchorOffset; } @Override public ElementHandle getElement() { // Keywords don't have documentation or location info. Calling getCompletionEntryDetails // may show irrelevant info about a symbol with the same name. // https://github.com/Microsoft/TypeScript/issues/3921 return kind == ElementKind.KEYWORD ? null : this; } @Override public String document() { Object info = TSService.call("getCompletionEntryDetails", fileObj, caretOffset, name); return info == null ? null : new TSElementHandle(OffsetRange.NONE, (JSONObject) info).document(); } @Override public String getInsertPrefix() { return name; } @Override public String getSortText() { return null; } @Override public String getLhsHtml(HtmlFormatter hf) { if (modifiers.contains(Modifier.DEPRECATED)) { hf.deprecated(true); hf.appendText(name); hf.deprecated(false); } else { hf.appendText(name); } return hf.getText(); } @Override public String getRhsHtml(HtmlFormatter hf) { hf.setMaxLength(OptionsUtils.forLanguage(JsTokenId.javascriptLanguage()).getCodeCompletionItemSignatureWidth()); if (type == null) { return null; } hf.type(true); hf.appendText(type); hf.type(false); return hf.getText(); } @Override public boolean isSmart() { return false; } @Override public int getSortPrioOverride() { return 0; } @Override public String getCustomInsertTemplate() { String suffix = ""; switch (getKind()) { case METHOD: suffix = "(${cursor})"; break; case PACKAGE: suffix = "/"; break; } return getInsertPrefix() + suffix; } private JSONObject location; @Override public FileObject getFileObject() { location = (JSONObject) TSService.call("getCompletionEntryLocation", fileObj, caretOffset, name); if (location == null) return null; return TSService.findAnyFileObject((String) location.get("fileName")); } @Override public String getMimeType() { return "text/typescript"; } @Override public OffsetRange getOffsetRange(ParserResult pr) { // This method only gets called when the location is in the same file that the // completion was done in. Otherwise, csl.api's UiUtils.open just opens the file // and doesn't set the offset, even though we have it. :( if (location == null) return OffsetRange.NONE; return new OffsetRange(((Number) location.get("start")).intValue(), ((Number) location.get("end")).intValue()); } } static long lastCompletionTime; static boolean lastCompletionWasGlobal; @Override public CodeCompletionResult complete(CodeCompletionContext ccc) { FileObject fileObj = ccc.getParserResult().getSnapshot().getSource().getFileObject(); int caretOffset = ccc.getCaretOffset(); String prefix = ccc.getPrefix(); if (! ccc.isCaseSensitive()) prefix = prefix.toLowerCase(); JSONObject info; synchronized (TSCodeCompletion.class) { info = (JSONObject) TSService.call("getCompletions", fileObj, caretOffset); lastCompletionTime = System.currentTimeMillis(); lastCompletionWasGlobal = info != null && Boolean.TRUE.equals(info.get("isGlobalCompletion")); TSCodeCompletion.class.notify(); } if (info == null) { return CodeCompletionResult.NONE; } List<CompletionProposal> lst = new ArrayList<>(); for (JSONObject entry: (List<JSONObject>) info.get("entries")) { String name = (String) entry.get("name"); if (! ccc.isCaseSensitive()) name = name.toLowerCase(); if (ccc.isPrefixMatch() ? name.startsWith(prefix) : name.equals(prefix)) { lst.add(new TSCodeCompletion.TSCompletionProposal( fileObj, caretOffset, caretOffset - prefix.length(), entry)); } } return new DefaultCompletionResult(lst, false); } @Override public String document(ParserResult pr, ElementHandle eh) { return ((TSElementHandle) eh).document(); } @Override public ElementHandle resolveLink(String string, ElementHandle eh) { return null; } @Override public String getPrefix(ParserResult info, int caretOffset, boolean upToOffset) { CharSequence seq = info.getSnapshot().getText(); int i = caretOffset, j = i; while (i > 0 && Character.isJavaIdentifierPart(seq.charAt(i - 1))) { i--; } while (! upToOffset && j < seq.length() && Character.isJavaIdentifierPart(seq.charAt(j))) { j++; } return seq.subSequence(i, j).toString(); } // CHARS_NO_AUTO_COMPLETE and getAutoQuery from javascript2.editor JsCodeCompletion private static final String CHARS_NO_AUTO_COMPLETE = ";,/+-\\:={}[]()"; //NOI18N @Override public QueryType getAutoQuery(JTextComponent component, String typedText) { if (typedText.length() == 0) { return QueryType.NONE; } int offset = component.getCaretPosition(); TokenSequence<? extends JsTokenId> ts = LexUtilities.getJsTokenSequence(component.getDocument(), offset); if (ts != null) { int diff = ts.move(offset); TokenId currentTokenId = null; if (diff == 0 && ts.movePrevious() || ts.moveNext()) { currentTokenId = ts.token().id(); } char lastChar = typedText.charAt(typedText.length() - 1); if (currentTokenId == JsTokenId.BLOCK_COMMENT || currentTokenId == JsTokenId.DOC_COMMENT || currentTokenId == JsTokenId.LINE_COMMENT) { if (lastChar == '@') { //NOI18N return QueryType.COMPLETION; } } else if (currentTokenId == JsTokenId.STRING && lastChar == '/') { return QueryType.COMPLETION; } else { switch (lastChar) { case '.': //NOI18N if (OptionsUtils.forLanguage(JsTokenId.javascriptLanguage()).autoCompletionAfterDot()) { return QueryType.COMPLETION; } break; default: if (OptionsUtils.forLanguage(JsTokenId.javascriptLanguage()).autoCompletionFull()) { if (!Character.isWhitespace(lastChar) && CHARS_NO_AUTO_COMPLETE.indexOf(lastChar) == -1) { return QueryType.COMPLETION; } } return QueryType.NONE; } } } return QueryType.NONE; } @Override public String resolveTemplateVariable(String string, ParserResult pr, int i, String string1, Map map) { return null; } @Override public Set<String> getApplicableTemplates(Document dcmnt, int i, int i1) { return null; } @Override public ParameterInfo parameters(ParserResult pr, int i, CompletionProposal cp) { return ParameterInfo.NONE; } public static class TemplateFilterFactory implements CodeTemplateFilter.ContextBasedFactory { @Override public CodeTemplateFilter createFilter(JTextComponent component, int offset) { if (! Thread.currentThread().getName().equals("Code Completion")) { // Called from AbbrevDetection or SurroundWithFix - just allow it return createFilter(true); } // This is a code completion (called from CodeTemplateCompletionProvider). To determine // whether code templates should show up, we need the result from .complete(), but it's // running in a different thread. To make matters even worse, typing or backspacing // characters during a completion may re-run this method without re-running .complete(). synchronized (TSCodeCompletion.class) { // Assume that if .complete() is called, the two synchronized blocks are entered // within 50ms of each other. if (lastCompletionTime < System.currentTimeMillis() - 50) { try { // .complete() has not yet entered its sync block; wait for it. TSCodeCompletion.class.wait(50); // If it was called, it'll have finished its sync block now. If not, we're // still in the same completion and lastCompletionWasGlobal is still valid. } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } return createFilter(lastCompletionWasGlobal); } } private CodeTemplateFilter createFilter(final boolean accept) { return new CodeTemplateFilter() { @Override public boolean accept(CodeTemplate template) { return accept; } }; } @Override public List<String> getSupportedContexts() { return Collections.singletonList("JavaScript-Code"); } } }
aeea3ec575967d091a62d8b151b267b619b3f43d
e9e577e7f2618f9267148fa1eeb30df771934bd6
/app/src/main/java/com/tech20/mobiledelivery/activities/ActivityOrders.java
1d7b2c19824c7798ca8ae683f3929bc6b365a200
[]
no_license
punampawar27/OrdersDelivery
f975baaa1bb403b99e4d65e85fe58646faf9ce96
3aa115880fddfa249895d31b5f03db2507b8f158
refs/heads/master
2021-05-09T19:21:13.552156
2018-01-23T16:42:43
2018-01-23T16:42:43
118,638,459
0
0
null
null
null
null
UTF-8
Java
false
false
7,015
java
package com.tech20.mobiledelivery.activities; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import com.tech20.mobiledelivery.R; import com.tech20.mobiledelivery.adapters.AdapterOrders; import com.tech20.mobiledelivery.contracts.ContractOrders; import com.tech20.mobiledelivery.contracts.ContractOrders.IViewOrders; import com.tech20.mobiledelivery.database.DatabaseHouse; import com.tech20.mobiledelivery.database.dataentities.DbModelOrders; import com.tech20.mobiledelivery.enums.EnumOrderStatus; import com.tech20.mobiledelivery.enums.EnumPushNotificationType; import com.tech20.mobiledelivery.helpers.Constants; import com.tech20.mobiledelivery.helpers.NetworkHelper; import com.tech20.mobiledelivery.helpers.PreferenceUtils; import com.tech20.mobiledelivery.helpers.ToastUtils; import com.tech20.mobiledelivery.helpers.UtilDateFormat; import com.tech20.mobiledelivery.presenter.PresneterOrders; import com.tech20.mobiledelivery.retrofitclient.ErrorMessage; import com.tech20.mobiledelivery.retrofitclient.ordersclient.Order; import com.tech20.mobiledelivery.retrofitclient.ordersclient.OrdersResponse; import java.util.ArrayList; import java.util.Calendar; import java.util.List; public class ActivityOrders extends BaseActivity implements IViewOrders { //Database not implementedyet for Orders private ContractOrders.IPresenterOrders iPresenterOrders = null; private RecyclerView recyclerView = null; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_orders); initView(); getOrders(); } private void initView(){ setupToolbar(findViewById(R.id.detail_toolbar),getString(R.string.title_deliveries)); iPresenterOrders = new PresneterOrders(); iPresenterOrders.attach(this); recyclerView = findViewById(R.id.recyclerViewOrders); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.addItemDecoration(new DividerItemDecoration(this,LinearLayoutManager.VERTICAL)); } private void getOrders(){ if(NetworkHelper.isOnline(this)){ PreferenceUtils.getINSTANCE(getApplicationContext()).putBoolean(Constants.PreferenceConstants.IS_ORDER_REFRESHED,false); iPresenterOrders.getOrders(DatabaseHouse.getSingleTon(getApplicationContext()), PreferenceUtils.getINSTANCE(getApplicationContext()), getTodayDateString()); }else{ ToastUtils.showSnackBar(findViewById(android.R.id.content),getString(R.string.err_network)); } } private void startOrderDetail(DbModelOrders order){ Intent intent = new Intent(this,ActivityOrderDetails.class); intent.putExtra(ActivityOrderDetails.EXTRA_ORDER,order); startActivity(intent); } private String getTodayDateString(){ return UtilDateFormat.format(UtilDateFormat.yyyy_MM_dd_T_HH_mm_ss, Calendar.getInstance().getTime()); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case android.R.id.home: onBackPressed(); break; case R.id.action_refresh: getOrders(); break; } return true; } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_orders,menu); return true; } @Override public void onOrdersLoadedSuccess(List<DbModelOrders> listOrders) { Log.d(Constants.LogConstants.TAG_WASTE,"Number of Orders : "+(listOrders!=null?listOrders.size():0)); recyclerView.setAdapter(new AdapterOrders(onClick,this,(listOrders!=null)?listOrders:new ArrayList <>())); } @Override public void onOrdersLoadedFail(ErrorMessage errorMessage) { ToastUtils.showSnackBar(findViewById(android.R.id.content), TextUtils.isEmpty(errorMessage.getMessage())?getString(R.string.err_network):errorMessage.getMessage()); } private View.OnClickListener onClick = (View v)->{ DbModelOrders orders = null; switch (v.getId()){ case R.id.imgCall: orders = ((AdapterOrders)recyclerView.getAdapter()).getItem(Integer.parseInt(String.valueOf(v.getTag()))); Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + orders.getContactNumber())); startActivity(intent); break; case R.id.imgMap: orders = ((AdapterOrders)recyclerView.getAdapter()).getItem(Integer.parseInt(String.valueOf(v.getTag()))); showAddressOnMap(orders.getShippingAddress()); break; case R.id.relParent: orders = ((AdapterOrders)recyclerView.getAdapter()).getItem(Integer.parseInt(String.valueOf(v.getTag()))); //Only show order details if order is assigned or placed if(orders.getStatus() == EnumOrderStatus.Assigned.getValue() || orders.getStatus() == EnumOrderStatus.Placed.getValue() || orders.getStatus() == EnumOrderStatus.UnDelivered.getValue()){ startOrderDetail(orders); } break; } }; private void showAddressOnMap(String shippingAddress){ String uri = Constants.MAPCONST.MAP_STRING + shippingAddress; Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(intent); } @Override protected void onResume() { super.onResume(); if(PreferenceUtils.getINSTANCE(this).getBoolean(Constants.PreferenceConstants.IS_ORDER_REFRESHED)){ getOrders(); } register(); } @Override protected void onPause() { super.onPause(); unRegister(); } private void register(){ registerReceiver(receiverPushNotificationBroadcast,new IntentFilter(Constants.INTENTACTIONS.ACTION_PUSH_RECEIVED)); } private void unRegister(){ unregisterReceiver(receiverPushNotificationBroadcast); } private BroadcastReceiver receiverPushNotificationBroadcast = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { //Constants.INTENTEXTRAS.EXTRA_PUSHNOTIFICATOIN_FLAG getOrders(); } }; }
d4b03602b038ce2a26bb13b8cd21dca098fe8d03
42f345cf266712da06f7a5205ebb92ac8d6db5ed
/ssm-demo/src/main/java/com/zhougl/algo/HeapIfy.java
18d2bb52029183eea97b1286c2e85bf416d483a0
[]
no_license
zhouguanglong1/ssm-maven
e648797029e6754cc075307701039496ca9c42d6
658a675709be8533ec978c87928934cc130c0088
refs/heads/master
2022-11-25T06:59:09.998682
2020-10-30T03:53:18
2020-10-30T03:53:18
142,732,040
0
0
null
2022-11-16T10:26:32
2018-07-29T04:57:44
Java
UTF-8
Java
false
false
2,857
java
package com.zhougl.algo; import lombok.Data; import java.util.Arrays; /** * 堆是一个完全二叉树(除了最后一层,其他层的节点都是满的,且最后一层的子节点都靠左排列)可以使用数组存储 * 堆中每个节点的值,都大于等于(小于等于)左右子节点的值 * * @author zhougl * @version v1.0.0 * @since 2020/8/29 15:05 */ @Data public class HeapIfy { /** * 存放数据的数组 */ private int[] a; /** * 数组最大存放的个数 */ private int n; /** * 数组当前存放的个数 */ private int count; public HeapIfy(int capacity){ a = new int[capacity + 1]; n = capacity; count = 0; } /** * 往堆中插入数据,从下往上堆化 * @param data */ public void insert(int data){ if(count >= n){ return; } count ++; a[count] = data; int i = count; while(i/2 > 0 && a[i/2] < a[i]){ swap(a,i,i/2); i = i/2; } } private void swap(int[] a,int i,int j) { int temp = a[i]; a[i] = a[j]; a[j] = temp; } public void removeMax(){ if(count == 0){ return; } a[1] = a[count]; -- count; heapIfy(a,count,1); } /** * 从上往下堆化 */ private void heapIfy(int[] a,int n,int i) { while (true){ int maxPos = i; if(i*2 <= n && a[i] < a[i*2]){ maxPos = maxPos *2; } else if(i*2+1 <= n && a[i] < a[i * 2 + 1]){ maxPos = maxPos * 2 + 1; } if(maxPos == i){ break; } swap(a,i,maxPos); i = maxPos; } } public static void main(String[] args) { HeapIfy heapIfy = new HeapIfy(10); heapIfy.insert(3); heapIfy.insert(7); heapIfy.insert(1); heapIfy.insert(2); heapIfy.insert(5); heapIfy.insert(4); heapIfy.insert(6); heapIfy.insert(8); heapIfy.insert(10); heapIfy.insert(9); Arrays.stream(heapIfy.getA()).forEach(System.out::println); System.out.println("==============================="); heapIfy.removeMax(); Arrays.stream(heapIfy.getA()).forEach(System.out::println); int[] nums = {2,2,1}; int i = singleNumber(nums); System.out.println(i); int a = 10; a = a += a -= a*= 10; System.out.println(a); } public static int singleNumber(int[] nums) { if(nums.length == 0){ return -1; } for(int i=1;i<nums.length;i++){ nums[0] ^= nums[i]; } return nums[0]; } }
149b4454d427d818dd7b0c88066cd8ddbde6fdb9
e6d4cba8bb57bdcbca5b2674803d728df4744152
/app/src/main/java/com/eeseetech/nagrand/player/PlayerFragment.java
8b48f223c0133683da9c341527a4f702f0c483fd
[]
no_license
jpdong/ad-player
e9e4c28ff044a5de3efb267c56ffc31c59611a09
b3f5533a64c52857a5ec75c0a6f9a31664e925d4
refs/heads/master
2020-03-25T20:33:16.407963
2018-08-29T03:15:33
2018-08-29T03:15:33
144,135,870
0
0
null
null
null
null
UTF-8
Java
false
false
12,687
java
package com.eeseetech.nagrand.player; import android.app.Fragment; import android.content.Context; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.annotation.Nullable; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.RelativeLayout; import android.widget.VideoView; import com.eeseetech.nagrand.Global; import com.eeseetech.nagrand.R; import com.eeseetech.nagrand.entity.MessageInfo; import com.eeseetech.nagrand.view.IMessage; import com.eeseetech.nagrand.view.MediaView; import com.eeseetech.nagrand.view.MessageView; import com.google.android.exoplayer2.DefaultLoadControl; import com.google.android.exoplayer2.DefaultRenderersFactory; import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.LoadControl; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.RenderersFactory; import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory; import com.google.android.exoplayer2.extractor.ExtractorsFactory; import com.google.android.exoplayer2.source.ExtractorMediaSource; import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.trackselection.DefaultTrackSelector; import com.google.android.exoplayer2.ui.PlayerView; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.util.Util; import java.io.File; import java.lang.ref.WeakReference; import java.util.List; import io.reactivex.disposables.CompositeDisposable; /** * Created by [email protected] on 2017/4/6. */ public class PlayerFragment extends Fragment implements MediaView,IMessage { private static final int MSG_READY = 10; private static final int MSG_PLAYING = 11; private static final int MSG_COMPLETED = 12; private static final int MSG_ERROR = 13; private static final int READY = 14; private static final int PLAYING = 15; private static final int IDLE = 17; private int mCurrentState = IDLE; private int mCurrentVideoPosition = 0; private int mCurrentMsgPosition = 0; private boolean isPlaying = false; private boolean isMessageShowing = false; private String mCurrentFileName; private List<String> mPlayList; private List<MessageInfo> mMsgList; private PlayerStateHandler mHandler; private FrameLayout mIdleStateView; private MessageView mMessageView; private CompositeDisposable mCompositeDisposable; private PlayerView mPlayerView; private SimpleExoPlayer mExoPlayer; private PlayerPresenter mPresenter; private ViewController.EventListener mEventListener = new ViewController.EventListener() { @Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { Log.d(Global.TAG, "ViewController/onPlayerStateChanged:playWhenReady:" + playWhenReady + ",playbackState:" + playbackState); switch (playbackState) { case Player.STATE_ENDED: if (mCurrentState == PLAYING) { mHandler.sendEmptyMessage(MSG_COMPLETED); } break; case Player.STATE_READY: if (mCurrentState == IDLE) { mHandler.sendEmptyMessage(MSG_READY); } break; } } @Override public void onPlayerError(ExoPlaybackException error) { super.onPlayerError(error); mHandler.sendEmptyMessage(MSG_ERROR); } }; public PlayerFragment() { } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = new PlayerStateHandler(this); mCompositeDisposable = new CompositeDisposable(); mPresenter = new PlayerPresenter(this); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_exoplayer, container, false); setPlayerView(view); setIdleView(view); setMessageView(view); return view; } @Override public void onStart() { super.onStart(); if (Global.LOG) { Log.d(Global.TAG, "PlayerFragment/onStart:"); } mPresenter.start(); } @Override public void onResume() { super.onResume(); } @Override public void onStop() { super.onStop(); if (Global.LOG) { Log.d(Global.TAG, "PlayerFragment/onStop:"); } mPresenter.stop(); mExoPlayer.stop(); isPlaying = false; } @Override public void onDestroyView() { super.onDestroyView(); if (Global.LOG) { Log.d(Global.TAG, "PlayerFragment/onDestroyView:"); } } @Override public void onDestroy() { super.onDestroy(); } private void setPlayerView(View view) { mPlayerView = view.findViewById(R.id.exoplayer_view); RenderersFactory renderersFactory = new DefaultRenderersFactory(getContext()); DefaultTrackSelector trackSelector = new DefaultTrackSelector(); LoadControl loadControl = new DefaultLoadControl(); mExoPlayer = ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector, loadControl); mExoPlayer.addListener(mEventListener); mPlayerView.setPlayer(mExoPlayer); mPlayerView.setUseController(false); } private void setIdleView(View view) { mIdleStateView = (FrameLayout) view.findViewById(R.id.layout_idle_state); mIdleStateView.setVisibility(View.VISIBLE); } private void setMessageView(View view) { mMessageView = (MessageView) view.findViewById(R.id.message_view); mMessageView.setSingleLine(); mMessageView.setStatusCallback(new MessageView.StatusCallback() { @Override public void finish() { isMessageShowing = false; showNextMessage(); } }); } private void playVideo() { mExoPlayer.setPlayWhenReady(true); } private void play() { Log.d(Global.TAG, "PlayerFragment/play:"); mIdleStateView.setVisibility(View.GONE); isPlaying = true; playVideo(); mCurrentState = PLAYING; mPresenter.sendPlayerStatus("play"); mPresenter.addPlayHistory(mCurrentFileName, String.valueOf(System.currentTimeMillis())); } private void complete() { mCurrentState = IDLE; isPlaying = false; mIdleStateView.setVisibility(View.VISIBLE); mPresenter.sendPlayerStatus("idle"); if (!Global.hasXServer) { playNext(); } } private void error() { mCurrentState = IDLE; mPresenter.sendPlayerStatus("error"); mPresenter.deleteFile(mCurrentFileName); } private void ready() { mCurrentState = READY; mPresenter.sendPlayerStatus("ready"); mHandler.sendEmptyMessage(MSG_PLAYING); } public void replaceList(final List<String> playList) { //Log.d(Global.TAG, "PlayerFragment/replaceList:"); mHandler.post(new Runnable() { @Override public void run() { if (playList == null || playList.size() == 0) { return; } mPlayList = playList; if (!isPlaying) { playNext(); } } }); } @Override public void prepareFile(String fileName) { fileReady(fileName); } @Override public Context getContext() { return getActivity(); } public void playNext() { Log.d(Global.TAG, "PlayerFragment/playNext:"); if (mPlayList == null || mPlayList.size() == 0) { return; } if (mCurrentVideoPosition >= mPlayList.size()) { mCurrentVideoPosition = 0; } String videoName = mPlayList.get(mCurrentVideoPosition); mCurrentVideoPosition++; fileReady(videoName); } private void fileReady(final String videoName) { Log.d(Global.TAG, "PlayerFragment/fileReady:"); if (videoName == null) { return; } mCurrentFileName = videoName; File file = new File(Global.LOCAL_MEDIA_DIR + videoName); Uri fileUri; if (getContext() != null) { if (file.exists()) { fileUri = Uri.fromFile(file); DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(getContext(), Util.getUserAgent(getContext(), "com.eeseetech.nagrand")); ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory(); final MediaSource mediaSource = new ExtractorMediaSource.Factory(dataSourceFactory).setExtractorsFactory(extractorsFactory).createMediaSource(fileUri); mHandler.post(new Runnable() { @Override public void run() { mExoPlayer.prepare(mediaSource); } }); } else { mPresenter.deleteFile(videoName); mPlayList.remove(videoName); playNext(); Log.e(Global.TAG, "PlayerFragment/fileReady:" + videoName + " not exist."); } } else { Log.e(Global.TAG, "PlayerFragment/fileReady: context is null"); } } public void playDelay(long delay) { mHandler.sendEmptyMessageDelayed(MSG_PLAYING, delay); } public boolean playerState() { return isPlaying; } @Override public void replaceMessages(final List<MessageInfo> msgList) { mHandler.post(new Runnable() { public void run() { if (msgList == null) { return; } mMsgList = msgList; if (!isMessageShowing) { showNextMessage(); } } }); } public void showNextMessage() { if (mMsgList.size() == 0) { return; } if (mCurrentMsgPosition >= mMsgList.size()) { mCurrentMsgPosition = 0; } MessageInfo messageInfo = mMsgList.get(mCurrentMsgPosition); mCurrentMsgPosition++; mMessageView.setText(messageInfo.message); setPosition(messageInfo.position); mMessageView.showMessage(); isMessageShowing = true; } private void setPosition(String position) { RelativeLayout.LayoutParams messageParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); if ("0".equals(position)) { //messageParams.setMargins(0, 0, 0, 0); messageParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); } else { //messageParams.setMargins(0, getActivity().getWindowManager().getDefaultDisplay().getHeight() - 35, 0, 0); messageParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } mMessageView.setLayoutParams(messageParams); } static class PlayerStateHandler extends Handler { private WeakReference<PlayerFragment> playerFragmentWR; public PlayerStateHandler(PlayerFragment playerFragment) { this.playerFragmentWR = new WeakReference<>(playerFragment); } @Override public void handleMessage(Message msg) { PlayerFragment fragment = playerFragmentWR.get(); if (fragment == null) { return; } switch (msg.what) { case MSG_READY: fragment.ready(); break; case MSG_PLAYING: fragment.play(); break; case MSG_COMPLETED: fragment.complete(); break; case MSG_ERROR: fragment.error(); break; default: break; } } } }
4edd9d6b7704af2ecf5e7933d9ae6d00dbbf4f1e
b96ce6d875adf1e0a02d30de246d5409ae06f8da
/src/day34_Inheritance/Isci.java
5d65ea57b34115449086b1d806eedd6ca79814b4
[]
no_license
Adnancan02/JavaDersleri
dc08803cab9bc251cc76f057492c391c884be492
8c052036116f59611534e6c03ed5e047a60c8517
refs/heads/master
2023-04-07T00:39:30.712655
2021-04-14T11:20:25
2021-04-14T11:20:25
357,877,951
0
0
null
null
null
null
ISO-8859-9
Java
false
false
1,024
java
package day34_Inheritance; public class Isci extends Muhasebe { public static void main(String[] args) { Isci isci1= new Isci(); isci1.isim= "Omer"; isci1.soyisim="Aydın"; isci1.id= 1001; isci1.izindeMi=false; isci1.saatUcreti=10; isci1.statu= "Isci"; isci1.maas=isci1.maasHesaola(); System.out.println(isci1.id+" "+isci1.isim+ " "+isci1.soyisim+" "+isci1.statu+ " "+ isci1.maas + " tl"); // Bu derse kadar hangi class da bilgi elde etmek istiyorsak o class tan obje olustururuz // INheritance ile bu mecburiyet ortadan kalktı. // Child class da olusturdugum obje ile tum parent class larda // bulunan variable ve method ları inherit edebilirim. Isci isci2= new Isci(); isci2.isim= "Esad"; isci2.soyisim="Okumus"; isci2.id= 1002; isci2.izindeMi=false; isci2.saatUcreti=15; isci2.statu= "Isci"; isci2.maas=isci2.maasHesaola(); System.out.println(isci2.id+" "+isci2.isim+ " "+isci2.soyisim+" "+isci2.statu+ " "+ isci2.maas + " tl"); } }
fb23acc6e4d5352bdb274b570e1209c53723a55c
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/hazelcast/2015/4/MultiMapClientRequestTest.java
0d8c1ac50c34431df428211e47a828389309fe07
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
18,670
java
/* * Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hazelcast.multimap; import com.hazelcast.client.ClientTestSupport; import com.hazelcast.client.SimpleClient; import com.hazelcast.config.Config; import com.hazelcast.core.MultiMap; import com.hazelcast.multimap.impl.client.AddEntryListenerRequest; import com.hazelcast.multimap.impl.client.ClearRequest; import com.hazelcast.multimap.impl.client.ContainsRequest; import com.hazelcast.multimap.impl.client.EntrySetRequest; import com.hazelcast.multimap.impl.client.GetAllRequest; import com.hazelcast.multimap.impl.client.KeyBasedContainsRequest; import com.hazelcast.multimap.impl.client.KeySetRequest; import com.hazelcast.multimap.impl.client.PortableEntrySetResponse; import com.hazelcast.multimap.impl.client.PutRequest; import com.hazelcast.multimap.impl.client.RemoveAllRequest; import com.hazelcast.multimap.impl.client.SizeRequest; import com.hazelcast.multimap.impl.client.ValuesRequest; import com.hazelcast.nio.serialization.Data; import com.hazelcast.nio.serialization.DefaultSerializationServiceBuilder; import com.hazelcast.nio.serialization.SerializationService; import com.hazelcast.spi.impl.PortableCollection; import com.hazelcast.spi.impl.PortableEntryEvent; import com.hazelcast.test.HazelcastSerialClassRunner; import com.hazelcast.test.annotation.QuickTest; import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import java.io.IOException; import java.util.Collection; import java.util.Map; import java.util.Set; import static org.junit.Assert.*; /** * @author ali 5/10/13 */ @RunWith(HazelcastSerialClassRunner.class) @Category(QuickTest.class) @Ignore public class MultiMapClientRequestTest extends ClientTestSupport { static final String name = "test"; static final SerializationService ss = new DefaultSerializationServiceBuilder().build(); static final Data dataKey = ss.toData(name); protected Config createConfig() { return new Config(); } // @Test // public void testAddAll() throws IOException { // // List<Binary> list = new ArrayList<Binary>(); // list.add(ss.toData("item1")); // list.add(ss.toData("item2")); // list.add(ss.toData("item3")); // list.add(ss.toData("item4")); // // final SimpleClient client = getClient(); // client.send(new AddAllRequest(listProxyId, dataKey, getThreadId(), list)); // Object result = client.receive(); // assertTrue((Boolean) result); // int size = getInstance().getList(name).size(); // assertEquals(size, list.size()); // // } @Test public void testClear() throws IOException { MultiMap mm = getMultiMap(); mm.put("key1", "value1"); mm.put("key1", "value2"); mm.put("key2", "value3"); final SimpleClient client = getClient(); client.send(new ClearRequest(name)); assertNull(client.receive()); assertEquals(0, mm.size()); } // @Test // public void testCompareAndRemove() throws IOException { // MultiMap mm = getMultiMap(); // mm.put("key1", "value1"); // mm.put("key1", "value2"); // mm.put("key1", "value3"); // // List<Binary> list = new ArrayList<Binary>(); // list.add(ss.toData("value1")); // list.add(ss.toData("value2")); // // final SimpleClient client = getClient(); // client.send(new CompareAndRemoveRequest(name, ss.toData("key1"), list, true, getThreadId())); // Boolean result = (Boolean) client.receive(); // assertTrue(result); // assertEquals(2, mm.size()); // assertEquals(2, mm.valueCount("key1")); // // // client.send(new CompareAndRemoveRequest(name, ss.toData("key1"), list, false, getThreadId())); // result = (Boolean) client.receive(); // assertTrue(result); // assertEquals(0, mm.size()); // } // @Test // public void testContainsAll() throws IOException { // IList<Object> list = getInstance().getList(name); // list.add("value1"); // list.add("value2"); // list.add("value3"); // // Set<Binary> dataSet = new HashSet<Binary>(2); // dataSet.add(ss.toData("value2")); // dataSet.add(ss.toData("value3")); // // final SimpleClient client = getClient(); // client.send(new ContainsAllRequest(listProxyId, dataKey, dataSet)); // boolean result = (Boolean) client.receive(); // assertTrue(result); // // dataSet.add(ss.toData("value")); // client.send(new ContainsAllRequest(listProxyId, dataKey, dataSet)); // result = (Boolean) client.receive(); // assertFalse(result); // } @Test public void testContainsEntry() throws IOException { MultiMap mm = getMultiMap(); mm.put("key1", "value1"); mm.put("key2", "value2"); mm.put("key3", "value3"); //contains key value final SimpleClient client = getClient(); client.send(new KeyBasedContainsRequest(name, ss.toData("key1"), ss.toData("value1"))); boolean result = (Boolean) client.receive(); assertTrue(result); //not contains key value client.send(new KeyBasedContainsRequest(name, ss.toData("key1"), ss.toData("value2"))); result = (Boolean) client.receive(); assertFalse(result); //contains key client.send(new KeyBasedContainsRequest(name, ss.toData("key2"), null)); result = (Boolean) client.receive(); assertTrue(result); //not contains key client.send(new KeyBasedContainsRequest(name, ss.toData("key4"), null)); result = (Boolean) client.receive(); assertFalse(result); //contains value client.send(new ContainsRequest(name, ss.toData("value3"))); result = (Boolean) client.receive(); assertTrue(result); //not contains value client.send(new ContainsRequest(name, ss.toData("value0"))); result = (Boolean) client.receive(); assertFalse(result); } // @Test // public void testContains() throws IOException { // IList<Object> list = getInstance().getList(name); // list.add("value1"); // list.add("value2"); // list.add("value3"); // // final SimpleClient client = getClient(); // client.send(new ContainsRequest(listProxyId, dataKey, ss.toData("value2"))); // boolean result = (Boolean) client.receive(); // assertTrue(result); // // client.send(new ContainsRequest(listProxyId, dataKey, ss.toData("value"))); // result = (Boolean) client.receive(); // assertFalse(result); // } // @Test // public void testCount() throws IOException { // IList<Object> list = getInstance().getList(name); // list.add("value1"); // list.add("value2"); // list.add("value3"); // // final SimpleClient client = getClient(); // client.send(new CountRequest(listProxyId, dataKey)); // int result = (Integer) client.receive(); // assertEquals(result, 3); // assertEquals(result, list.size()); // // MultiMap<Object, Object> mm = getMultiMap(); // mm.put("key1", "value1"); // mm.put("key1", "value2"); // // mm.put("key2", "value2"); // // client.send(new CountRequest(name, ss.toData("key1"))); // result = (Integer) client.receive(); // assertEquals(result, 2); // assertEquals(result, mm.valueCount("key1")); // // client.send(new CountRequest(name, ss.toData("key2"))); // result = (Integer) client.receive(); // assertEquals(result, 1); // assertEquals(result, mm.valueCount("key2")); // } @Test public void testEntrySet() throws IOException { MultiMap<Object, Object> mm = getMultiMap(); mm.put("key1", "value1"); mm.put("key1", "value2"); mm.put("key2", "value2"); mm.put("key3", "value3"); mm.put("key4", "value4"); mm.put("key5", "value3"); final SimpleClient client = getClient(); client.send(new EntrySetRequest(name)); PortableEntrySetResponse result = (PortableEntrySetResponse) client.receive(); Set<Map.Entry> entrySet = result.getEntrySet(); Data value = (Data) entrySet.iterator().next().getValue(); String s = (String) ss.toObject(value); assertTrue(s.startsWith("value")); assertEquals(6, entrySet.size()); } @Test public void testGetAll() throws IOException { MultiMap<Object, Object> mm = getMultiMap(); mm.put("key1", "value1"); mm.put("key2", "value1"); mm.put("key2", "value2"); final SimpleClient client = getClient(); client.send(new GetAllRequest(name, ss.toData("key1"))); PortableCollection result = (PortableCollection) client.receive(); Collection<Data> coll = result.getCollection(); assertEquals(1, coll.size()); assertEquals("value1", ss.toObject(coll.iterator().next())); client.send(new GetAllRequest(name, ss.toData("key2"))); result = (PortableCollection) client.receive(); coll = result.getCollection(); assertEquals(2, coll.size()); } // @Test // public void testGet() throws IOException { // IList<Object> list = getInstance().getList(name); // list.add("value1"); // list.add("value2"); // list.add("value3"); // // final SimpleClient client = getClient(); // client.send(new GetRequest(listProxyId, dataKey, 1)); // Object result = client.receive(); // assertEquals(result, "value2"); // // client.send(new GetRequest(listProxyId, dataKey, 2)); // result = client.receive(); // assertEquals(result, "value3"); // } // @Test // public void testIndexOf() throws IOException { // IList<Object> list = getInstance().getList(name); // list.add("value1"); // list.add("value2"); // list.add("value3"); // list.add("value2"); // // final SimpleClient client = getClient(); // client.send(new IndexOfRequest(listProxyId, dataKey, ss.toData("value2"), false)); // int result = (Integer) client.receive(); // assertEquals(1, result); // // client.send(new IndexOfRequest(listProxyId, dataKey, ss.toData("value2"), true)); // result = (Integer) client.receive(); // assertEquals(3, result); // // client.send(new IndexOfRequest(listProxyId, dataKey, ss.toData("value4"), false)); // result = (Integer) client.receive(); // assertEquals(-1, result); // } @Test public void testKeySet() throws IOException { MultiMap<Object, Object> mm = getMultiMap(); mm.put("key1", "value1"); mm.put("key1", "value2"); mm.put("key1", "value3"); mm.put("key2", "value1"); mm.put("key2", "value2"); final SimpleClient client = getClient(); client.send(new KeySetRequest(name)); PortableCollection result = (PortableCollection) client.receive(); Collection<Data> keySet = result.getCollection(); assertEquals(2, keySet.size()); String s = (String) ss.toObject(keySet.iterator().next()); assertTrue(s.startsWith("key")); } @Test public void testPut() throws IOException { MultiMap<Object, Object> mm = getMultiMap(); final SimpleClient client = getClient(); client.send(new PutRequest(name, ss.toData("key1"), ss.toData("value1"), -1, getThreadId())); boolean result = (Boolean) client.receive(); assertTrue(result); assertEquals("value1", mm.get("key1").iterator().next()); client.send(new PutRequest(name, ss.toData("key1"), ss.toData("value1"), -1, getThreadId())); result = (Boolean) client.receive(); assertFalse(result); assertEquals(1, mm.size()); // IList<Object> list = getInstance().getList(name); // // client.send(new PutRequest(listProxyId, dataKey, ss.toData("value3"), -1, getThreadId())); // result = (Boolean) client.receive(); // assertTrue(result); // // client.send(new PutRequest(listProxyId, dataKey, ss.toData("value4"), -1, getThreadId())); // result = (Boolean) client.receive(); // assertTrue(result); // // client.send(new PutRequest(listProxyId, dataKey, ss.toData("value5"), 1, getThreadId())); // result = (Boolean) client.receive(); // assertTrue(result); // // assertEquals(3, list.size()); // assertEquals("value3", list.get(0)); // assertEquals("value5", list.get(1)); // assertEquals("value4", list.get(2)); } @Test public void testRemoveAll() throws IOException { MultiMap<Object, Object> mm = getMultiMap(); mm.put("key1", "value1"); mm.put("key2", "value1"); mm.put("key2", "value2"); final SimpleClient client = getClient(); client.send(new RemoveAllRequest(name, ss.toData("key1"), getThreadId())); PortableCollection result = (PortableCollection) client.receive(); Collection<Data> coll = result.getCollection(); assertEquals(1, coll.size()); assertEquals("value1", ss.toObject(coll.iterator().next())); client.send(new RemoveAllRequest(name, ss.toData("key2"), getThreadId())); result = (PortableCollection) client.receive(); coll = result.getCollection(); assertEquals(2, coll.size()); assertEquals(0, mm.size()); } // @Test // public void testRemoveIndex() throws IOException { // IList<Object> list = getInstance().getList(name); // // list.add("value1"); // list.add("value2"); // list.add("value3"); // // final SimpleClient client = getClient(); // client.send(new RemoveIndexRequest(listProxyId, dataKey, 0, getThreadId())); // Object result = client.receive(); // assertEquals(result, "value1"); // assertEquals(2, list.size()); // // client.send(new RemoveIndexRequest(listProxyId, dataKey, 1, getThreadId())); // result = client.receive(); // assertEquals(result, "value3"); // assertEquals(1, list.size()); // // assertEquals("value2", list.get(0)); // } // @Test // public void testRemove() throws IOException { // IList<Object> list = getInstance().getList(name); // // list.add("value1"); // list.add("value2"); // list.add("value3"); // // final SimpleClient client = getClient(); // client.send(new RemoveRequest(listProxyId, dataKey, ss.toData("value"), getThreadId())); // boolean result = (Boolean) client.receive(); // assertFalse(result); // assertEquals(3, list.size()); // // client.send(new RemoveRequest(listProxyId, dataKey, ss.toData("value2"), getThreadId())); // result = (Boolean) client.receive(); // assertTrue(result); // assertEquals(2, list.size()); // } // @Test // public void testSet() throws IOException { // IList<Object> list = getInstance().getList(name); // list.add("value1"); // list.add("value2"); // list.add("value3"); // // final SimpleClient client = getClient(); // client.send(new SetRequest(listProxyId, dataKey, ss.toData("value"), 1, getThreadId())); // Object result = client.receive(); // assertEquals(result, "value2"); // assertEquals(list.size(), 3); // assertEquals("value", list.get(1)); // } @Test public void testSize() throws IOException { MultiMap<Object, Object> mm = getMultiMap(); mm.put("key1", "value1"); mm.put("key2", "value1"); mm.put("key2", "value2"); mm.put("key3", "value2"); final SimpleClient client = getClient(); client.send(new SizeRequest(name)); int result = (Integer) client.receive(); assertEquals(result, 4); assertEquals(result, mm.size()); } @Test public void testValues() throws IOException { MultiMap<Object, Object> mm = getMultiMap(); mm.put("key1", "value1"); mm.put("key2", "value1"); mm.put("key2", "value2"); mm.put("key3", "value2"); final SimpleClient client = getClient(); client.send(new ValuesRequest(name)); PortableCollection result = (PortableCollection) client.receive(); Collection<Data> coll = result.getCollection(); assertEquals(4, coll.size()); for (Data data : coll) { Object obj = ss.toObject(data); assertTrue(((String) obj).startsWith("value")); } } @Test public void testListener() throws IOException { final SimpleClient client = getClient(); client.send(new AddEntryListenerRequest(name, null, true)); client.receive(); getMultiMap().put("key1", "value1"); PortableEntryEvent result = (PortableEntryEvent) client.receive(); assertEquals("key1", ss.toObject(result.getKey())); assertEquals("value1", ss.toObject(result.getValue())); } @Test public void testKeyListener() throws IOException { final SimpleClient client = getClient(); client.send(new AddEntryListenerRequest(name, ss.toData("key2"), true)); client.receive(); final MultiMap<Object, Object> multiMap = getMultiMap(); multiMap.put("key1", "value1"); multiMap.put("key2", "value8"); PortableEntryEvent result = (PortableEntryEvent) client.receive(); assertEquals("key2", ss.toObject(result.getKey())); assertEquals("value8", ss.toObject(result.getValue())); } private MultiMap<Object, Object> getMultiMap() { return getInstance().getMultiMap(name); } private long getThreadId() { return Thread.currentThread().getId(); } }
103616fbdf38173fe87344fdb30833ac70d92a22
52a0351165c9f480d8676b7fb15e5b878fa37f22
/src/main/java/indi/xp/coachview/mapper/MatchTeamMemberInfoMapper.java
21bf344d3d594eb175cd3c54683fba548f567741
[]
no_license
februay/coach_view
9523f6553174ae289f07c9797b705198588e191e
b1fa3f8290e0258162f1755a5d120c959d3fa8fb
refs/heads/master
2020-03-23T17:28:34.453237
2018-10-18T04:11:56
2018-10-18T04:11:56
141,861,676
0
1
null
null
null
null
UTF-8
Java
false
false
1,850
java
package indi.xp.coachview.mapper; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import indi.xp.coachview.model.MatchTeamMemberInfo; @Mapper public interface MatchTeamMemberInfoMapper { public MatchTeamMemberInfo getById(@Param("id") String id, @Param("authFilterMap") Map<String, Object[]> authFilterMap); public List<MatchTeamMemberInfo> findByIdList(@Param("idList") List<String> idList, @Param("authFilterMap") Map<String, Object[]> authFilterMap); public List<MatchTeamMemberInfo> findList(@Param("authFilterMap") Map<String, Object[]> authFilterMap); public void add(@Param("entity") MatchTeamMemberInfo matchTeamMemberInfo); public void update(@Param("entity") MatchTeamMemberInfo matchTeamMemberInfo, @Param("authFilterMap") Map<String, Object[]> authFilterMap); public void delete(@Param("id") String id, @Param("authFilterMap") Map<String, Object[]> authFilterMap); public void batchDelete(@Param("idList") List<String> idList, @Param("authFilterMap") Map<String, Object[]> authFilterMap); public MatchTeamMemberInfo getByWhere(@Param("paramMap") Map<String, Object[]> paramMap, @Param("authFilterMap") Map<String, Object[]> authFilterMap); public List<MatchTeamMemberInfo> findByWhere(@Param("paramMap") Map<String, Object[]> paramMap, @Param("authFilterMap") Map<String, Object[]> authFilterMap); public Integer queryCount(@Param("paramMap") Map<String, Object[]> paramMap, @Param("authFilterMap") Map<String, Object[]> authFilterMap); public void updateByWhere(@Param("updateMap") Map<String, Object> updateMap, @Param("paramMap") Map<String, Object[]> paramMap, @Param("authFilterMap") Map<String, Object[]> authFilterMap); }
f04a199137d033a647ea8e03662ba91c0102e63c
f1acfbd2af9630d362ad19dd98876596896a0782
/Examples/examples2/src/examples/designpattern/NutritionFactsTest.java
cc37d5ec83d7c8b7d305024daae28f24e086c51a
[]
no_license
japj91/Java-2909
682ddff086df3a11c0efbcdd08f69630da15cfa5
5a6c4a2c6aa16dc64025c4e42c7b5b9f721a9e4a
refs/heads/master
2021-04-26T09:03:20.215604
2017-10-14T17:21:08
2017-10-14T17:21:08
106,947,626
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
/** * */ package examples.designpattern; /** * @author scirka * */ public class NutritionFactsTest { /** * @param args */ public static void main(String[] args) { NutritionFacts cocaCola = new NutritionFacts.Builder(240, 8).calories(100).sodium(35).carbohydrate(27).build(); System.out.println("Coca-cola nutition facts: " + cocaCola); } }
8d7c6fcc7a6f6472fe7409fb9d53f4ea3735d7c3
a3ccd61096fe2a5a77cc8d11ec93f8fdea0b558f
/guineCore/src/main/java/com/guinea/communications/netty/webSocket/PlanTaskNettyInitialzer.java
1e54c1e1def5d9fb3642e1eb01696d440e87be0e
[]
no_license
skyjasper/guineFox
b94e5bc6a41dcefc1976a4b835796ad79fc8521b
355ed03d0e72861feb4cef783bd4fc7f7ea32b77
refs/heads/master
2021-01-10T04:13:08.159295
2018-03-21T15:29:40
2018-03-21T15:29:40
49,559,376
2
0
null
null
null
null
UTF-8
Java
false
false
2,440
java
package com.guinea.communications.netty.webSocket; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.socket.SocketChannel; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.HttpRequestDecoder; import io.netty.handler.codec.http.HttpResponseEncoder; import io.netty.handler.stream.ChunkedWriteHandler; /** * @title * @author: shiky * @describe: * @date: 2016/7/7 */ public class PlanTaskNettyInitialzer extends ChannelInitializer<SocketChannel> { @Override protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); // e.pipeline().addLast("frameDecoder", new // LengthFieldBasedFrameDecoder(64, 0, 8,0,8)); // e.pipeline().addLast("frameEncoder", new LengthFieldPrepender(8)); // e.pipeline().addLast("frameDecoder", new // DelimiterBasedFrameDecoder(1000, false, // new ByteBuf[]{Unpooled.wrappedBuffer(new byte[]{'#'}),})); // 用于解析http报文的handler pipeline.addLast("decoder", new HttpRequestDecoder()); // 用于将解析出来的数据封装成http对象,httprequest什么的 pipeline.addLast("aggregator", new HttpObjectAggregator(256)); // 用于将response编码成httpresponse报文发送 pipeline.addLast("encoder", new HttpResponseEncoder()); /*** * HttpServerCodec它会将HTTP客户端请求转成HttpRequest对象, * 将HttpResponse对象编码成HTTP响应发送给客户端 * (用了HttpRequestDecoder,HttpResponseEncoder就不用此方法) */ // e.pipeline().addLast("http-codec", new HttpServerCodec()); /*** * ChunkedWriteHandler 这个handler主要用于处理大数据流, * 比如一个1G大小的文件如果你直接传输肯定会撑暴jvm内存的,增加ChunkedWriteHandler * 这个handler我们就不用考虑这个问题了. */ pipeline.addLast("http-chunked", new ChunkedWriteHandler()); /*** * cp.addLast("writeTimeout", new WriteTimeoutHandler(new * HashedWheelTimer(),10)); */ // e.pipeline().addLast("writeTimeout", new WriteTimeoutHandler(10)); /*** * 自定义hander */ pipeline.addLast("handler", new PlanTaskNettyServerHandler()); } }
6193dfc73bbde60f2c39392dae9cb82c7c044c6d
847725e3c61906a89b20e1b4dc8d4c7877a20ce0
/samples/java/play-authenticate-usage/app/models/UserDbService.java
c91dd49dc0a3c691d4fb725da6a63038355c3d5f
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
chaschev/play-authenticate
4a608b915dbce5890e249f0bc6d4554151a7d857
7cf571fd0c7d32fa64104f0d971f472b9efdecbb
refs/heads/master
2021-01-16T21:25:02.259610
2013-11-27T15:33:42
2013-11-27T15:33:42
6,588,716
0
0
null
null
null
null
UTF-8
Java
false
false
1,863
java
package models; import com.feth.play.module.pa.providers.password.UsernamePasswordAuthUser; import com.feth.play.module.pa.user.AuthUser; import com.feth.play.module.pa.user.AuthUserIdentity; import java.util.Date; /** * @author Andrey Chaschev [email protected] */ public abstract class UserDbService { public abstract boolean existsByAuthUserIdentity(final AuthUserIdentity identity) ; public abstract User findByAuthUserIdentity(final AuthUserIdentity identity); public abstract User findByUsernamePasswordIdentity(final UsernamePasswordAuthUser identity); public abstract void merge(final AuthUser oldUser, final AuthUser newUser); public abstract void save(User user); public abstract void deepSave(User user); public abstract void save(TokenAction user); public abstract void save(LinkedAccount account); public abstract User findByEmail(final String email); public abstract LinkedAccount getAccountByProvider(final String providerKey); public abstract TokenAction findByToken(final String token, final TokenAction.Type type); public abstract void deleteByUser(final User u, final TokenAction.Type type); public void addLinkedAccount(final AuthUser oldUser, final AuthUser newUser) { final User u = findByAuthUserIdentity(oldUser); save(u); } public void setLastLoginDate(final AuthUser knownUser) { final User u = findByAuthUserIdentity(knownUser); u.lastLogin = new Date(); save(u); } public void verify(final User unverified){ unverified.emailValidated = true; save(unverified); deleteByUser(unverified, TokenAction.Type.EMAIL_VERIFICATION); } public abstract SecurityRole findByRoleName(String roleName); public abstract void save(SecurityRole role); public abstract int countRoles(); }
105dcb60666fb2e1c2d006db2c797efb1f1084b7
8e1f14940113ff28ecfa029640eba19aeb400fe4
/src/main/java/az/egov/repository/NotificationSentTypesRepository.java
80ac748399d6ebaa7bad7fec92a85bf82ac40c65
[]
no_license
SamirOsmanov/agro
68c95196fe9129a2f0278756c1413508f92d28cd
5a7e8aa46c93032bdc65d3dc3a9d812738d18a67
refs/heads/master
2020-04-02T16:28:23.699023
2018-10-10T13:10:49
2018-10-10T13:10:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
428
java
package az.egov.repository; import az.egov.entity.NotificationSentTypes; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; /** * Created by admin on 26.09.2018. */ @Repository @Transactional public interface NotificationSentTypesRepository extends JpaRepository<NotificationSentTypes,Integer> { }
c8c9bcc41a62528827f7b75402ef3d73d46d8bc8
24ebe2de93d6f9d7e3c188fc4654b57ee64dcd7e
/src/main/java/edu/dlnu/oa/peopleSend/controller/PeopleSendController.java
53cc355410f82ce068ab8e7c82f24bf0eccc8d58
[ "MIT" ]
permissive
DLNUOA/OA
27545f886ef3fa5bfcefa79012a2752fb195cc77
f6716408f978347d32fcffa10e5e2d9568f37bfa
refs/heads/master
2022-07-16T15:51:00.474458
2020-01-07T12:51:50
2020-01-07T12:51:50
228,975,799
3
0
MIT
2022-06-29T17:53:16
2019-12-19T04:37:03
JavaScript
UTF-8
Java
false
false
1,870
java
package edu.dlnu.oa.peopleSend.controller; import edu.dlnu.oa.peopleSend.pojo.ComSendPeople; import edu.dlnu.oa.peopleSend.service.PeopleSendService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; import static org.springframework.web.bind.annotation.RequestMethod.*; /** * 外派人才管理 */ @RestController @RequestMapping("api") public class PeopleSendController { @Autowired private PeopleSendService service; //查询所有外派人员信息 @RequestMapping(value = "/send/query", method = GET) public List<ComSendPeople> query() { return service.queryCsp(); } //添加外派人员信息 @RequestMapping(value = "/send/add", method = POST) public int add(@RequestBody ComSendPeople csp) { return service.addCsp(csp); } //根据ID查人员信息 @RequestMapping(value = "/send/queryById/{spId}", method = GET) public ComSendPeople queryById(@PathVariable int spId) { return service.queryCspId(spId); } //根据姓名模糊查询人员信息 @RequestMapping(value = "/send/queryByName", method = POST) public List<ComSendPeople> queryByName(@RequestBody Map<String,String> map) { return service.queryCspName(map.get("spName")); } //删除人员信息 @RequestMapping(value = "/send/delete/{spId}", method = DELETE) public int delete(@PathVariable int spId) { return service.deleteCsp(spId); } //更改人员信息 @RequestMapping(value = "/send/update", method = POST) public int update(@RequestBody Map<String,Object> csp) { return service.updateCsp(csp); } }
4af82fa9c35e90913fe1df1954c911112ca2eb40
e75be673baeeddee986ece49ef6e1c718a8e7a5d
/submissions/blizzard/Corpus/eclipse.jdt.ui/5643.java
bfb058a2a937f2cfb5f364ed3faac3b3996056bd
[ "MIT" ]
permissive
zhendong2050/fse18
edbea132be9122b57e272a20c20fae2bb949e63e
f0f016140489961c9e3c2e837577f698c2d4cf44
refs/heads/master
2020-12-21T11:31:53.800358
2018-07-23T10:10:57
2018-07-23T10:10:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
713
java
package p; import java.util.*; class Cell<T> { List<T> t; public void setT(AbstractList<T> t) { this.t = t; } public Collection<T> getT() { return t; } } class CellTest { public static void main(String[] args) { ArrayList booleanList = new ArrayList(); booleanList.add(Boolean.FALSE); Cell c1 = new Cell(); c1.t = booleanList; c1.setT(booleanList); Iterable t = c1.t; Iterator iter = (Iterator) c1.t.iterator(); Iterator iter2 = c1.t.iterator(); boolean bool = (Boolean) c1.t.iterator().next(); Cell c2 = new Cell(); c2.t = booleanList; } }
08d09a0b0d03ab5dabfe6d27645440c0d647b4eb
46786b383a16fff9c5d57b6b197b905e56a40dba
/xcloud/xcloud-vijava/src/main/java/com/vmware/vim25/AlarmEvent.java
6be98c705ee77169b443c6feeb32b1b6137a1d74
[]
no_license
yiguotang/x-cloud
feeb9c6288e01a45fca82648153238ed85d4069e
2b255249961efb99d48a0557f7d74ce3586918fe
refs/heads/master
2020-04-05T06:18:30.750373
2016-08-03T06:48:35
2016-08-03T06:48:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,990
java
/*================================================================================ Copyright (c) 2013 Steve Jin. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of VMware, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================================*/ package com.vmware.vim25; /** * @author Steve Jin (http://www.doublecloud.org) * @version 5.1 */ @SuppressWarnings("all") public class AlarmEvent extends Event { public AlarmEventArgument alarm; public AlarmEventArgument getAlarm() { return this.alarm; } public void setAlarm(AlarmEventArgument alarm) { this.alarm=alarm; } }
cb9f99b406a6c3cc675e1c8f557e6a4e79790843
f1d43a273696137ff3caea78ebcb70286e69cc9a
/src/main/java/com/ast/mall/bugee/config/WebMvcConfig.java
915fd981ce04e0f81a14beb8f3232a242899c1b5
[]
no_license
CherryAnnie/bugee
1cca55c3969177bed01cd0a476b916690767aa1a
09b515a3a265b08d245c5ab81af1d65e4cb85172
refs/heads/master
2021-04-26T22:58:11.317420
2018-03-05T10:40:01
2018-03-05T10:40:01
123,904,803
0
0
null
null
null
null
UTF-8
Java
false
false
66
java
package com.ast.mall.bugee.config; public class WebMvcConfig { }
8ab44de495faecf67df37d231edead58cffdf84a
fb1da37bbb61b861de230d55efed09b816c96dbc
/extranet/src/main/java/com/gruppo/isc/extranet/service/AvanzamentoServiceImp.java
a3d213c9f83e7cd85db57a8b43bb459bd51d0ed2
[]
no_license
Minfrey/Git_Extranet
c47a086de9141d7cb6add512357f89a7bf80f68d
52598423f7c1b74102094fdf9ad8e0f1bc891d1d
refs/heads/main
2023-03-20T04:14:33.201880
2021-03-09T09:41:39
2021-03-09T09:41:39
332,261,207
0
0
null
2021-03-08T17:20:43
2021-01-23T16:55:27
Java
UTF-8
Java
false
false
11,233
java
package com.gruppo.isc.extranet.service; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import com.gruppo.isc.extranet.model.Attivita; import com.gruppo.isc.extranet.model.Avanzamento; import com.gruppo.isc.extranet.model.Commessa; import com.gruppo.isc.extranet.model.TipoAvanzamento; import com.gruppo.isc.extranet.repository.AttivitaRepoImp; import com.gruppo.isc.extranet.repository.AvanzamentoRepoImp; import com.gruppo.isc.extranet.repository.CommessaRepoImp; @Service public class AvanzamentoServiceImp implements AvanzamentoService { @Autowired AvanzamentoRepoImp arr; @Autowired CommessaRepoImp cri; @Override @Transactional public String setAvanzamento(Avanzamento a) { Calendar alfa = new GregorianCalendar(); alfa.set(a.getAnno().getNumero(), (a.getMese().getId_mese()-1), 15); java.sql.Date javaSqlDate = new java.sql.Date(alfa.getTime().getTime()); a.setData(javaSqlDate); System.out.println(a.getData()); Integer percentualelocale = a.getPercentuale(); Double valore = a.getAttivita().getValore(); Double valoreava = (valore*percentualelocale)/100; a.setValore(valoreava); String messaggio=""; java.sql.Date inizio = a.getAttivita().getCommessa().getInizio(); System.out.println(inizio); java.sql.Date fine = a.getAttivita().getCommessa().getFine(); System.out.println(fine); if(inizio.before(a.getData()) && fine.after(a.getData())) { if(arr.controlloDuplicatiInserimento(a).size()==0) { if(a.getTipoAvanzamento().getId_tipo_avanzamento()==2 || a.getTipoAvanzamento().getId_tipo_avanzamento()==3) { List controllo = arr.controlloInserimento(a); if(controllo.size()>=1 && a.getTipoAvanzamento().getId_tipo_avanzamento()==2) { messaggio = ("\"Sono già stati inseriti i ricavi di questa attività\""); } else if(controllo.size()>=1 && a.getTipoAvanzamento().getId_tipo_avanzamento()==3) { messaggio = ("\"È già stato inserito un preventivo per i ricavi di questa attività\""); } else { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// arr.setAvanzamento(a); messaggio = ("\"Attivita Inserita\""); if(a.getTipoAvanzamento().getId_tipo_avanzamento()==2) { // prendo id della commessa e inserisco il valore dell'attivita nel fatturato essendo id 2 il computo dei ricavi // aggiungere fattura cri.fatturatoCommessa(a.getAttivita().getValore(), a.getAttivita().getCommessa().getId_commessa()); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } //se esite un avanzamento dello stesso tipo con lo stesso nome della stessa commessa allora errore else { ///////////////////////////////////////// boolean controlloprec = false; List<Avanzamento> percent = arr.controlloPercentuale(a); Avanzamento massimominimo = new Avanzamento(); Avanzamento minimomassimo = new Avanzamento(); for(int i=0;i<percent.size();i++) { if(a.getData().before(percent.get(i).getData())/* && a.getPercentuale()<percent.get(i).getPercentuale()*/) { if(minimomassimo.getData()==null) { minimomassimo = percent.get(i); } else if(minimomassimo.getData().after(percent.get(i).getData())/*&& minimomassimo.getPercentuale()>percent.get(i).getPercentuale()*/) { minimomassimo = percent.get(i); } } else if(a.getData().after(percent.get(i).getData())/* && a.getPercentuale()>percent.get(i).getPercentuale()*/) { if(massimominimo.getData()==null) { massimominimo = percent.get(i); } else if(massimominimo.getData().before(percent.get(i).getData())/*&& massimominimo.getPercentuale()<percent.get(i).getPercentuale()*/) { massimominimo = percent.get(i); } } } System.out.println("estremo inferiore "+massimominimo.getData()+" "+massimominimo.getPercentuale()); System.out.println("inserito "+a.getData()+" "+a.getPercentuale()); System.out.println("estremo superiore "+minimomassimo.getData()+" "+minimomassimo.getPercentuale()); if(massimominimo.getData()==null && minimomassimo.getData()==null) { System.out.println("liberoooooooooooooooooooo"); arr.setAvanzamento(a); messaggio = ("\"Attivita Inserita\""); } else if(massimominimo.getData()==null && a.getData().before(minimomassimo.getData()) && a.getPercentuale()<minimomassimo.getPercentuale() ) { System.out.println("estremo inferiore nulloooooooooooo"); arr.setAvanzamento(a); messaggio = ("\"Attivita Inserita\""); } else if(minimomassimo.getData()==null && a.getData().after(massimominimo.getData()) && a.getPercentuale()>massimominimo.getPercentuale()) { System.out.println("estremo superiore nulloooooooooooo"); arr.setAvanzamento(a); messaggio = ("\"Attivita Inserita\""); } /////////////////////////////// else if (massimominimo.getData()!=null && massimominimo.getData().before(a.getData()) && minimomassimo.getData()!=null && a.getData().before(minimomassimo.getData()) && massimominimo.getPercentuale()<a.getPercentuale() && a.getPercentuale()<minimomassimo.getPercentuale()) { System.out.println("nessuno e nulloooooooooo"); arr.setAvanzamento(a); messaggio = ("\"Attivita Inserita\""); } else { System.out.println(massimominimo.getData().before(a.getData())); // System.out.println(a.getData().before(minimomassimo.getData())); System.out.println(massimominimo.getPercentuale()<a.getPercentuale()); // System.out.println(a.getPercentuale()<minimomassimo.getPercentuale()); messaggio = ("\"Errore\""); } } } else { messaggio= ("\"Attivita Duplicata\""); } } else { messaggio="\"Data non corretta\""; } return messaggio; } @Override @Transactional public String modAvanzamento(Avanzamento a) { String messaggio=""; Avanzamento consolid = arr.getAvanzamentoByID(a.getId_avanzamento()); if(consolid.getConsolida()==null) { Calendar alfa = new GregorianCalendar(); alfa.set(a.getAnno().getNumero(), (a.getMese().getId_mese()-1), 15); java.sql.Date javaSqlDate = new java.sql.Date(alfa.getTime().getTime()); a.setData(javaSqlDate); //calcola valore da percentuale Integer percentualelocale = a.getPercentuale(); Double valore = a.getAttivita().getValore(); Double valoreava = (valore*percentualelocale)/100; a.setValore(valoreava); ///////////////////////////////////////// boolean controlloprec = false; List<Avanzamento> percent = arr.controlloPercentuale(a); Avanzamento massimominimo = new Avanzamento(); Avanzamento minimomassimo = new Avanzamento(); for(int i=0;i<percent.size();i++) { if(a.getMese().getId_mese()==percent.get(i).getMese().getId_mese() && a.getAnno().getId_anno()==percent.get(i).getAnno().getId_anno()) { continue; } if(a.getData().before(percent.get(i).getData())/* && a.getPercentuale()<percent.get(i).getPercentuale()*/) { if(minimomassimo.getData()==null) { minimomassimo = percent.get(i); } else if(minimomassimo.getData().after(percent.get(i).getData())/*&& minimomassimo.getPercentuale()>percent.get(i).getPercentuale()*/) { minimomassimo = percent.get(i); } } else if(a.getData().after(percent.get(i).getData())/* && a.getPercentuale()>percent.get(i).getPercentuale()*/) { if(massimominimo.getData()==null) { massimominimo = percent.get(i); } else if(massimominimo.getData().before(percent.get(i).getData())/*&& massimominimo.getPercentuale()<percent.get(i).getPercentuale()*/) { massimominimo = percent.get(i); } } } System.out.println("estremo inferiore "+massimominimo.getData()+" "+massimominimo.getPercentuale()); System.out.println("inserito "+a.getData()+" "+a.getPercentuale()); System.out.println("estremo superiore "+minimomassimo.getData()+" "+minimomassimo.getPercentuale()); if(massimominimo.getData()==null && minimomassimo.getData()==null) { System.out.println("liberoooooooooooooooooooo"); arr.modAvanzamento(a); messaggio = ("\"Attivita Inserita\""); } else if(massimominimo.getData()==null && a.getData().before(minimomassimo.getData()) && a.getPercentuale()<minimomassimo.getPercentuale() ) { System.out.println("estremo inferiore nulloooooooooooo"); arr.modAvanzamento(a); messaggio = ("\"Attivita Inserita\""); } else if(minimomassimo.getData()==null && a.getData().after(massimominimo.getData()) && a.getPercentuale()>massimominimo.getPercentuale()) { System.out.println("estremo superiore nulloooooooooooo"); arr.modAvanzamento(a); messaggio = ("\"Attivita Inserita\""); } /////////////////////////////// else if (massimominimo.getData().before(a.getData()) && a.getData().before(minimomassimo.getData()) && massimominimo.getPercentuale()<a.getPercentuale() && a.getPercentuale()<minimomassimo.getPercentuale()) { System.out.println("nessuno e nulloooooooooo"); arr.modAvanzamento(a); messaggio = ("\"Attivita Inserita\""); } else { System.out.println(massimominimo.getData().before(a.getData())); System.out.println(a.getData().before(minimomassimo.getData())); System.out.println(massimominimo.getPercentuale()<a.getPercentuale()); System.out.println(a.getPercentuale()<minimomassimo.getPercentuale()); messaggio = ("\"Errore\""); } } else { messaggio = ("\"Avanzamento consolidato non e possibile modificarlo\""); } return messaggio; } public List<Avanzamento> getListAvanzamento() { return arr.getAvanzamentoList(); } public List<Avanzamento> getAvanzamentoByAttivita2(int id) { List<Avanzamento> a = arr.getAvanzamentoByAttivita2(id); System.out.println(a.get(0).getAnno().getNumero()); return arr.getAvanzamentoByAttivita2(id); } public List<Avanzamento> getAvanzamentoByCommessaType(int id, int idt) { return arr.getAvanzamentoByCommessaType(id, idt); } @Transactional public String consolidaav(Avanzamento a) { String messaggio = ""; Avanzamento b = arr.consolidav(a); Integer numcom = a.getAttivita().getCommessa().getId_commessa(); if(a.getTipoAvanzamento().getId_tipo_avanzamento()==3) { cri.previsionefatturatoCommessa(a.getAttivita().getValore(), numcom); } if(b.getConsolida()!=null) { messaggio="\"Consolidato\""; } else { messaggio="\"Non Consolidato\""; } return messaggio; } }
5f121a499563e6eb1de82d26be57b437cb8fd473
235e4ededf737d2835d365a7a1eacdd5ea2acfdc
/XSACore/src/org/bibalex/sdxe/suggest/model/particle/SugtnSequenceNode.java
b2f03f8bcf4785dbdef24860a7c8dfe082b11934
[]
no_license
timeleft--/WAMCP
b29672dfbab7057abb0094568f6e92b6f2cf63fb
4d172ab80aed3acd21590f89c2067bcd53e3fc92
refs/heads/master
2021-01-16T21:57:21.287247
2013-07-24T11:27:47
2013-07-24T11:27:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,248
java
// Copyright 2013 Bibliotheca Alexandrina, Wellcome Trust Library // // 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.bibalex.sdxe.suggest.model.particle; /** * Class represents particle node of type SEQUENCE * */ @SuppressWarnings("serial") public class SugtnSequenceNode extends SugtnParticleNode { /** * Constructs a particle node of type SEQUENCE and sets user object to "Sequence" */ SugtnSequenceNode() { super(); this.setUserObject("Sequence"); } /** * Invite method of the visitor design pattern. * * @param visitor * Particle node visitor interface. * */ @Override public void invite(ISugtnParticleNodeVisitor visitor) { visitor.sequenceNode(this); } }
1cf3a9143f2302401e74c366a628ffacd0769781
093d1c914076656bf89936046f1aeae9ff9cb0f7
/pilot-hsqldb/src/main/java/com/nicecredit/pilot/hsqldb/DBRepository.java
a980927a2f73ffc7665d5520f1a8ea2914acede7
[]
no_license
OpenSourceConsulting/drools-pilot
26d5799311006d6c23b97fb5d694e8dab0c16ad1
8f9c68e6d10821c9686359b1dc64861abd540ca4
refs/heads/master
2021-03-24T09:36:21.381440
2018-05-15T01:33:58
2018-05-15T01:33:58
43,865,881
0
0
null
null
null
null
UTF-8
Java
false
false
1,875
java
package com.nicecredit.pilot.hsqldb; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * <pre> * * </pre> * @author BongJin Kwon */ public class DBRepository { private static final Logger LOGGER = LoggerFactory.getLogger(DBRepository.class); public static DBRepository INSTANCE; private EntityManagerFactory emFactory; private EntityManagerFactory emFactoryHsql; /** * <pre> * * </pre> */ private DBRepository() { emFactory = Persistence.createEntityManagerFactory( "org.hibernate.nice.jpa" ); emFactoryHsql = Persistence.createEntityManagerFactory( "org.hibernate.nice.hsql" ); } public static DBRepository getInstance() { if (INSTANCE == null) { synchronized (DBRepository.class) { if (INSTANCE == null) { INSTANCE = new DBRepository(); } } } return INSTANCE; } /** * <pre> * for hibernate * </pre> * @return */ public EntityManager createEntityManager() { return emFactory.createEntityManager(); } /** * <pre> * for hibernate (HSQL) * </pre> * @return */ public EntityManager createEntityManagerHsql() { return emFactoryHsql.createEntityManager(); } public static void close() { if (INSTANCE != null) { synchronized (DBRepository.class) { if (INSTANCE != null) { INSTANCE.doClose(); INSTANCE = null; } } } } private void doClose() { if (emFactory != null) { emFactory.close(); emFactory = null; } if (emFactoryHsql != null) { emFactoryHsql.close(); emFactoryHsql = null; } LOGGER.info("all EntityManagerFactory closed!!"); } } //end of DBRepository.java
6b5a85b2897ee46a078b8c5663ae1dc0ff6aeddd
0cac9980ec4e2f852d8cbb92654a54f17d1c3aab
/ribbon/src/test/java/ribbon/service/RibbonApplicationTests.java
87780972b63b1e3de3277994a4b8aa1ea3fec885
[]
no_license
lishuper/springclouddemo
45ea441c601ee72cfcba5252cbaa926c0b9f9264
2ddbe7d90243309e3c7dc771ca14c9f45edbfdb6
refs/heads/master
2020-05-17T18:41:05.267774
2019-05-08T09:10:16
2019-05-08T09:10:16
183,891,596
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
package ribbon.service; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class RibbonApplicationTests { @Test public void contextLoads() { } }
fdfe558091bbcfad6397e59714492b7570cc7070
ddd38972d2e73c464ee77024f6ba4d6e11aac97b
/platform/arcus-containers/scheduler-service/src/main/java/com/iris/service/scheduler/model/TimeOfDayScheduledCommand.java
02e043812a1bd54628790004d457e86e3a7de913
[ "Apache-2.0" ]
permissive
arcus-smart-home/arcusplatform
bc5a3bde6dc4268b9aaf9082c75482e6599dfb16
a2293efa1cd8e884e6bedbe9c51bf29832ba8652
refs/heads/master
2022-04-27T02:58:20.720270
2021-09-05T01:36:12
2021-09-05T01:36:12
168,190,985
104
50
Apache-2.0
2022-03-10T01:33:34
2019-01-29T16:49:10
Java
UTF-8
Java
false
false
6,087
java
/* * Copyright 2019 Arcus Project * * 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.iris.service.scheduler.model; import java.util.EnumSet; import java.util.Map; import java.util.Set; import org.apache.commons.lang3.StringUtils; import com.iris.common.rule.time.TimeOfDay; import com.iris.common.time.DayOfWeek; import com.iris.messages.errors.Errors; import com.iris.messages.type.TimeOfDayCommand; public class TimeOfDayScheduledCommand extends ScheduledCommand { public enum Mode { ABSOLUTE, SUNRISE, SUNSET; } public static TimeOfDayScheduledCommand fromMap(Map<String, Object> attributes) { TimeOfDayCommand raw = new TimeOfDayCommand(attributes); TimeOfDayScheduledCommand command = new TimeOfDayScheduledCommand(); command.setId(raw.getId()); command.setScheduleId(raw.getScheduleId()); if(!StringUtils.isEmpty(raw.getMessageType())) { command.setMessageType(raw.getMessageType()); } if(raw.getAttributes() != null) { command.setAttributes(raw.getAttributes()); } if(raw.getDays() != null) { command.setDays(toDays(raw.getDays())); } if(!StringUtils.isEmpty(raw.getMode())) { command.setMode(Mode.valueOf(raw.getMode())); } if(!StringUtils.isEmpty(raw.getTime())) { command.setTime(TimeOfDay.fromString(raw.getTime())); } if(raw.getOffsetMinutes() != null) { command.setOffsetMinutes(raw.getOffsetMinutes()); } return command; } private static Set<DayOfWeek> toDays(Set<String> days) { EnumSet<DayOfWeek> values = EnumSet.noneOf(DayOfWeek.class); if(days == null || days.isEmpty()) { return values; } for(String day: days) { values.add(DayOfWeek.fromAbbr(day)); } return values; } private Set<DayOfWeek> days; private Mode mode; private TimeOfDay time; private Integer offsetMinutes; public TimeOfDayScheduledCommand() { // TODO Auto-generated constructor stub } /** * @return the days */ public Set<DayOfWeek> getDays() { return days; } /** * @param days the days to set */ public void setDays(Set<DayOfWeek> days) { this.days = days; } /** * @return the mode */ public Mode getMode() { return mode; } /** * @param mode the mode to set */ public void setMode(Mode mode) { this.mode = mode; } public boolean isAbsolute() { return mode == Mode.ABSOLUTE; } /** * @return the time */ public TimeOfDay getTime() { return time; } /** * @param time the time to set */ public void setTime(TimeOfDay time) { this.time = time; } /** * @return the offsetMinutes */ public Integer getOffsetMinutes() { return offsetMinutes; } /** * @param offsetMinutes the offsetMinutes to set */ public void setOffsetMinutes(Integer offsetMinutes) { this.offsetMinutes = offsetMinutes; } public void validate() { Errors.assertRequiredParam(this.getScheduleId(), TimeOfDayCommand.ATTR_SCHEDULEID); if(this.getMode() == null || this.getMode() == Mode.ABSOLUTE) { Errors.assertRequiredParam(this.getTime(), TimeOfDayCommand.ATTR_TIME); Errors.assertValidRequest(this.getOffsetMinutes() == null || this.getOffsetMinutes() == 0, "May not specify non-zero offsetMinutes when mode is ABSOLUTE or unspecified."); } else { Errors.assertRequiredParam(this.getOffsetMinutes(), TimeOfDayCommand.ATTR_OFFSETMINUTES); Errors.assertValidRequest(this.getTime() == null, "May not specify time when mode is SUNRISE / SUNSET."); } Errors.assertRequiredParam(this.getDays(), TimeOfDayCommand.ATTR_DAYS); Errors.assertRequiredParam(this.getAttributes(), TimeOfDayCommand.ATTR_ATTRIBUTES); } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "TimeOfDayScheduledCommand [days=" + days + ", mode=" + mode + ", time=" + time + ", offsetMinutes=" + offsetMinutes + "]"; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((days == null) ? 0 : days.hashCode()); result = prime * result + ((mode == null) ? 0 : mode.hashCode()); result = prime * result + ((offsetMinutes == null) ? 0 : offsetMinutes.hashCode()); result = prime * result + ((time == null) ? 0 : time.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TimeOfDayScheduledCommand other = (TimeOfDayScheduledCommand) obj; if (days == null) { if (other.days != null) return false; } else if (!days.equals(other.days)) return false; if (mode != other.mode) return false; if (offsetMinutes == null) { if (other.offsetMinutes != null) return false; } else if (!offsetMinutes.equals(other.offsetMinutes)) return false; if (time == null) { if (other.time != null) return false; } else if (!time.equals(other.time)) return false; return true; } }
567ae6e6705060357c70d01675ac86ef51fdd54b
90e305db5a991a927db29f18d5de1344f880b08b
/src/test/java/com/testdatabuilder/ParqueaderoTestDatabuilder.java
02af1e69c37da22a9c5f484dc1eff5d3c7bcfe1d
[]
no_license
CarlosLopez900528/PracticaCeibaDos
ec591d1b489bbda701e847feba0dc6236d5631d6
d2b855333f721abb70fe493391bea4d5a2d8d237
refs/heads/master
2021-07-11T15:42:26.078569
2017-10-10T03:07:59
2017-10-10T03:07:59
105,787,247
0
0
null
2017-10-10T03:08:00
2017-10-04T15:49:33
Java
UTF-8
Java
false
false
1,327
java
package com.testdatabuilder; import java.util.Calendar; import com.entities.Parqueo; public class ParqueaderoTestDatabuilder { private static final int IDCLASEVEHICULO = 1; private static final String PLACAVEHICULO = "CJA083"; private static final int CILINDRAJE = 1800; private static final Calendar FECHA_PARQUEO = Calendar.getInstance();; private int idClaseVehiculo; private String placaVehiculo; private int cilindraje; private Calendar fechaParqueo; public ParqueaderoTestDatabuilder() { this.idClaseVehiculo = IDCLASEVEHICULO; this.placaVehiculo = PLACAVEHICULO; this.cilindraje = CILINDRAJE; this.fechaParqueo = FECHA_PARQUEO; } public ParqueaderoTestDatabuilder conidClaseVehiculo(int idClaseVehiculo) { this.idClaseVehiculo = idClaseVehiculo; return this; } public ParqueaderoTestDatabuilder conplacaVehiculo(String placaVehiculo) { this.placaVehiculo = placaVehiculo; return this; } public ParqueaderoTestDatabuilder concilindraje(int cilindraje) { this.cilindraje = cilindraje; return this; } public ParqueaderoTestDatabuilder confechaParqueo(Calendar fechaParqueo) { this.fechaParqueo = fechaParqueo; return this; } public Parqueo build() { return new Parqueo(this.idClaseVehiculo, this.placaVehiculo, this.cilindraje, this.fechaParqueo); } }
f2a5364ae6ed3ad572dd646e6b1211169daa8035
281a9c8dca9fa50a25c56af5c4834b01262fd597
/app/src/main/java/com/example/student_management/Student.java
ffb8db0db68f5012f7c3f6dd34d5245b3d70a195
[]
no_license
dungnguyenhuu/Student_Management
20905711bebefd7d196b392574e75b1a7cea3d7b
e173b3d9b344971aa89739e2248fa95cdc151519
refs/heads/master
2022-12-25T00:06:21.297068
2020-09-23T14:29:31
2020-09-23T14:29:31
272,986,096
0
0
null
null
null
null
UTF-8
Java
false
false
1,147
java
package com.example.student_management; import java.io.Serializable; public class Student implements Serializable { private int code; private String name; private String date; private String email; private String address; public Student(int code, String name, String date, String email, String address) { this.code = code; this.name = name; this.date = date; this.email = email; this.address = address; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
6afab49f9a602ae356401220f3e9f56651921f06
7c46a44f1930b7817fb6d26223a78785e1b4d779
/soap/src/java/com/zimbra/soap/admin/message/GetDomainInfoResponse.java
f543e478ecfc6be4c007b949cc086bd6d2b0fb3c
[]
no_license
Zimbra/zm-mailbox
20355a191c7174b1eb74461a6400b0329907fb02
8ef6538e789391813b65d3420097f43fbd2e2bf3
refs/heads/develop
2023-07-20T15:07:30.305312
2023-07-03T06:44:00
2023-07-06T10:09:53
85,609,847
67
128
null
2023-09-14T10:12:10
2017-03-20T18:07:01
Java
UTF-8
Java
false
false
1,659
java
/* * ***** BEGIN LICENSE BLOCK ***** * Zimbra Collaboration Suite Server * Copyright (C) 2010, 2012, 2013, 2014, 2016 Synacor, Inc. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software Foundation, * version 2 of the License. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with this program. * If not, see <https://www.gnu.org/licenses/>. * ***** END LICENSE BLOCK ***** */ package com.zimbra.soap.admin.message; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import com.zimbra.common.soap.AdminConstants; import com.zimbra.soap.admin.type.DomainInfo; @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement(name=AdminConstants.E_GET_DOMAIN_INFO_RESPONSE) @XmlType(propOrder = {}) public class GetDomainInfoResponse { /** * @zm-api-field-description Information about domain */ @XmlElement(name=AdminConstants.E_DOMAIN, required=false) private DomainInfo domain; public GetDomainInfoResponse() { } public void setDomain(DomainInfo domain) { this.domain = domain; } public DomainInfo getDomain() { return domain; } }
eff04ac7161234f65a1922f04fdf1a482c332a52
7e5f5708c9ea46094f38be0076dca2d6457567fa
/Rozszerzone Systemy Informatyczne - Java/REST/RestWeb_Client/build/generated-sources/jaxb/classes/Message.java
d96a94357c79f9ff28f9473e652c8018a7ac88ff
[]
no_license
isiemaszko/2k21---semesters-
fa6191cca5c1f27a7fd1422b48c15db36f076d6b
f3593cfcfb3f265b035dbea6724e3477bc118702
refs/heads/master
2023-07-12T06:50:27.693990
2021-08-18T17:41:58
2021-08-18T17:41:58
397,684,596
0
0
null
null
null
null
UTF-8
Java
false
false
2,607
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 // 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: 2021.05.23 at 08:40:14 PM CEST // package classes; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for message complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="message"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="author" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}long"/> * &lt;element name="message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "message", propOrder = { "author", "id", "message" }) public class Message { protected String author; protected long id; protected String message; /** * Gets the value of the author property. * * @return * possible object is * {@link String } * */ public String getAuthor() { return author; } /** * Sets the value of the author property. * * @param value * allowed object is * {@link String } * */ public void setAuthor(String value) { this.author = value; } /** * Gets the value of the id property. * */ public long getId() { return id; } /** * Sets the value of the id property. * */ public void setId(long value) { this.id = value; } /** * Gets the value of the message property. * * @return * possible object is * {@link String } * */ public String getMessage() { return message; } /** * Sets the value of the message property. * * @param value * allowed object is * {@link String } * */ public void setMessage(String value) { this.message = value; } }
881c24b147c38cdc5b2d0b6df689c1dbfdaeb6b5
64e88841921c6280608ca77fcc4b757bfa6768bd
/SpringBootCRUD/src/main/java/com/springbootproject/ProductRepository.java
d0db15292fd04e711ca6e59065a72e4e1856696c
[]
no_license
irya29/TesRespository
83c88dcf5a70b5f9f2c0c4125cf127f7efd8e3cd
7c9945722d1677504ee8232a9bdb364ecb18cb64
refs/heads/master
2020-08-27T00:58:48.000117
2019-10-24T03:02:31
2019-10-24T03:02:31
217,199,378
0
0
null
null
null
null
UTF-8
Java
false
false
178
java
package com.springbootproject; import org.springframework.data.jpa.repository.JpaRepository; public interface ProductRepository extends JpaRepository<Product, Long>{ }
[ "training@TRAINING7" ]
training@TRAINING7
468ff8044557d93a5f1fcdd22f2a6706b4a44deb
b71ac6338bb8b52564f48447936cc30972ff8bdb
/src/main/java/net/totaldarkness/ChestHistory/Main.java
d5314c8d337ead02cff354f3ece3a4b6515014fc
[ "Unlicense" ]
permissive
TotalDarkness-NRF/ChestHistory
528599e6863b3a547ff40eeee44fd1a7ab69f066
6c0f2217090f8eea4cd5e8685e34414100b1f413
refs/heads/main
2023-03-22T02:51:02.364363
2021-03-06T04:36:40
2021-03-06T04:36:40
339,275,687
0
0
null
null
null
null
UTF-8
Java
false
false
1,347
java
package net.totaldarkness.ChestHistory; import net.totaldarkness.ChestHistory.client.gui.ChestHistory; import net.totaldarkness.ChestHistory.client.services.ChestGuiService; import net.totaldarkness.ChestHistory.client.services.RenderEventService; import net.totaldarkness.ChestHistory.client.events.KeyboardEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @Mod(modid = "chesthistory", name = "Chest History", version = "0.0.1", acceptedMinecraftVersions = MinecraftForge.MC_VERSION, clientSideOnly = true) public class Main { @EventHandler public void preInit(FMLPreInitializationEvent event) {} @EventHandler public void init(FMLInitializationEvent event) { } @EventHandler public void postInit(FMLPostInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new KeyboardEvent()); MinecraftForge.EVENT_BUS.register(new RenderEventService()); MinecraftForge.EVENT_BUS.register(new ChestHistory()); MinecraftForge.EVENT_BUS.register(new ChestGuiService()); } }
fb71c860f9adb3e632e5815f45bd67092220b1ad
dfd3b94c341aa781f1c5be266080d03915226630
/src/com/luv2code/springdemo/SetterDemoApp.java
ec95177aa851d8e46a2520e9b3ca2e2c4d502392
[]
no_license
emadhanna/spring-demo-one
3015bed3e00d0a9249082a4c8c857f39f091724d
e255a2ee98c386a493ad8b6258ad9d222e00fe85
refs/heads/master
2020-09-11T13:51:37.055157
2020-05-13T06:21:00
2020-05-13T06:21:00
222,069,920
0
0
null
2019-11-16T10:41:41
2019-11-16T08:33:04
null
UTF-8
Java
false
false
741
java
package com.luv2code.springdemo; import org.springframework.context.support.ClassPathXmlApplicationContext; public class SetterDemoApp { public static void main(String[] args) { //Load the spring configuration file ClassPathXmlApplicationContext theContext = new ClassPathXmlApplicationContext("applicationContext.xml"); //Retrieve bean from spring container CricketCoach theCoach = theContext.getBean("myCricketCoach", CricketCoach.class); //Call methods on the bean System.out.println(theCoach.getDailyWorkout()); System.out.println(theCoach.getDailyFortune()); System.out.println(theCoach.getEmailAddress()); System.out.println(theCoach.getTeam()); //Close the context theContext.close(); } }
79ee5712eae0dd9089886ad8309e3dc893543310
8421eaa5b1f7678dac49b7056df4cf5dba31d0f0
/src/view/ResultListViewItem.java
c65af58cbf944796ae25e266a46a64f98cfc86ed
[]
no_license
stefanGT44/Concurrent-Word-Distribution-Tool
7f3ba6aba77d0902d6616e99d19d03f7951a1aeb
ded7c08c292faa5680837cb3b12c57815cb9497d
refs/heads/master
2022-12-20T19:40:24.043795
2020-09-15T23:09:53
2020-09-15T23:09:53
292,297,789
0
0
null
null
null
null
UTF-8
Java
false
false
315
java
package view; public class ResultListViewItem { private String name; public ResultListViewItem(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return this.name; } }
[ "stefan@stefan" ]
stefan@stefan
9b32289362fd9d26e214b3cc674cc2d2782d86c3
2ba865ef43a15e30d3bff27d8492cbc3572c26b4
/app/src/main/java/me/arulnadhan/androidultimate/TextSurface/activities/ShapeReveal.java
39a5f95afd94b563115efc123546da9b89bdbfa8
[]
no_license
Kimger/AndroidTemplate
c92c036a197d6fb5504ef29b2293a5ae83e0fe28
97828b43e906e8b37b7917da0218d63048c13386
refs/heads/master
2020-09-14T08:19:50.745234
2018-10-19T06:31:36
2018-10-19T06:31:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,470
java
package me.arulnadhan.androidultimate.TextSurface.activities; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.CheckBox; import android.widget.CompoundButton; import me.arulnadhan.androidultimate.R; import me.arulnadhan.textsurface.Debug; import me.arulnadhan.textsurface.Text; import me.arulnadhan.textsurface.TextBuilder; import me.arulnadhan.textsurface.TextSurface; import me.arulnadhan.textsurface.animations.Alpha; import me.arulnadhan.textsurface.animations.AnimationsSet; import me.arulnadhan.textsurface.animations.Circle; import me.arulnadhan.textsurface.animations.Delay; import me.arulnadhan.textsurface.animations.Rotate3D; import me.arulnadhan.textsurface.animations.SideCut; import me.arulnadhan.textsurface.animations.Slide; import me.arulnadhan.textsurface.animations.TransSurface; import me.arulnadhan.textsurface.contants.Axis; import me.arulnadhan.textsurface.contants.Direction; import me.arulnadhan.textsurface.contants.Pivot; import me.arulnadhan.textsurface.contants.Side; import me.arulnadhan.textsurface.contants.TYPE; public class ShapeReveal extends AppCompatActivity { private TextSurface textSurface; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_textsurface); textSurface = (TextSurface) findViewById(R.id.text_surface); textSurface.postDelayed(new Runnable() { @Override public void run() { show(); } }, 1000); findViewById(R.id.btn_refresh).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { show(); } }); CheckBox checkDebug = (CheckBox) findViewById(R.id.check_debug); checkDebug.setChecked(Debug.ENABLED); checkDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Debug.ENABLED = isChecked; textSurface.invalidate(); } }); } private void show() { textSurface.reset(); Text textA = TextBuilder.create("Hey Guys,").setPosition(me.arulnadhan.textsurface.contants.Align.SURFACE_CENTER).setSize(28).build(); Text textB = TextBuilder.create("How are you?").setPosition(me.arulnadhan.textsurface.contants.Align.BOTTOM_OF | me.arulnadhan.textsurface.contants.Align.CENTER_OF, textA).setSize(28).build(); Text textC = TextBuilder.create("Thanks for taking a look at ").setPosition(me.arulnadhan.textsurface.contants.Align.BOTTOM_OF | me.arulnadhan.textsurface.contants.Align.CENTER_OF, textB).setSize(24).build(); Text textD = TextBuilder.create("Android Ultimate").setPosition(me.arulnadhan.textsurface.contants.Align.BOTTOM_OF | me.arulnadhan.textsurface.contants.Align.CENTER_OF, textC).setSize(28).build(); final int flash = 1500; textSurface.play(TYPE.SEQUENTIAL, Rotate3D.showFromCenter(textA, 500, Direction.CLOCK, Axis.X), new AnimationsSet(TYPE.PARALLEL, me.arulnadhan.textsurface.animations.ShapeReveal.create(textA, flash, SideCut.hide(Side.LEFT), false), new AnimationsSet(TYPE.SEQUENTIAL, Delay.duration(flash / 4), me.arulnadhan.textsurface.animations.ShapeReveal.create(textA, flash, SideCut.show(Side.LEFT), false)) ), new AnimationsSet(TYPE.PARALLEL, Rotate3D.showFromSide(textB, 500, Pivot.TOP), new TransSurface(500, textB, Pivot.CENTER) ), Delay.duration(500), new AnimationsSet(TYPE.PARALLEL, Slide.showFrom(Side.TOP, textC, 500), new TransSurface(1000, textC, Pivot.CENTER) ), Delay.duration(500), new AnimationsSet(TYPE.PARALLEL, me.arulnadhan.textsurface.animations.ShapeReveal.create(textD, 500, Circle.show(Side.CENTER, Direction.OUT), false), new TransSurface(1500, textD, Pivot.CENTER) ), Delay.duration(500), new AnimationsSet(TYPE.PARALLEL, new AnimationsSet(TYPE.PARALLEL, Alpha.hide(textD, 700), me.arulnadhan.textsurface.animations.ShapeReveal.create(textD, 1000, SideCut.hide(Side.LEFT), true)), new AnimationsSet(TYPE.SEQUENTIAL, Delay.duration(500), new AnimationsSet(TYPE.PARALLEL, Alpha.hide(textC, 700), me.arulnadhan.textsurface.animations.ShapeReveal.create(textC, 1000, SideCut.hide(Side.LEFT), true))), new AnimationsSet(TYPE.SEQUENTIAL, Delay.duration(1000), new AnimationsSet(TYPE.PARALLEL, Alpha.hide(textB, 700), me.arulnadhan.textsurface.animations.ShapeReveal.create(textB, 1000, SideCut.hide(Side.LEFT), true))), new AnimationsSet(TYPE.SEQUENTIAL, Delay.duration(1500), new AnimationsSet(TYPE.PARALLEL, Alpha.hide(textA, 700), me.arulnadhan.textsurface.animations.ShapeReveal.create(textA, 1000, SideCut.hide(Side.LEFT), true))), new TransSurface(4000, textA, Pivot.CENTER) ) ); } }
cc2ab6377014af76973be27b971158b76ff17b24
483b37de9bb79da1b2188dfb06559edf5d5a067f
/Timed/src/main/java/frc/robot/RobotContainer.java
7ebb4cc0b09c29edd569213576bf87a67a9c58aa
[]
no_license
FRC7230/2020
3aa3b4823c19854985d89c622e8944cf32ab0dae
4b2ce2cec381acc8847e7d10504a1d5c773b585e
refs/heads/master
2020-12-09T11:04:11.776093
2020-03-07T22:12:52
2020-03-07T22:12:52
233,285,336
1
0
null
null
null
null
UTF-8
Java
false
false
5,874
java
package frc.robot; import java.util.List; import edu.wpi.first.wpilibj.GenericHID; import edu.wpi.first.wpilibj.XboxController; import edu.wpi.first.wpilibj.controller.PIDController; import edu.wpi.first.wpilibj.controller.RamseteController; import edu.wpi.first.wpilibj.controller.SimpleMotorFeedforward; import edu.wpi.first.wpilibj.trajectory.Trajectory; import edu.wpi.first.wpilibj.trajectory.Trajectory.State; import edu.wpi.first.wpilibj.trajectory.TrajectoryConfig; import edu.wpi.first.wpilibj.trajectory.constraint.DifferentialDriveVoltageConstraint; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.RamseteCommand; import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.button.JoystickButton; import frc.robot.Constants.AutoConstants; import frc.robot.Constants.DriveConstants; import frc.robot.Constants.OIConstants; import frc.robot.subsystems.DriveSubsystem; import static edu.wpi.first.wpilibj.XboxController.Button; import edu.wpi.first.wpilibj.trajectory.TrajectoryGenerator; import edu.wpi.first.wpilibj.geometry.Pose2d; import edu.wpi.first.wpilibj.geometry.Translation2d; import edu.wpi.first.wpilibj.geometry.Rotation2d; //import java.util.ArrayList; /** * This class is where the bulk of the robot should be declared. Since Command-based is a * "declarative" paradigm, very little robot logic should actually be handled in the {@link Robot} * periodic methods (other than the scheduler calls). Instead, the structure of the robot * (including subsystems, commands, and button mappings) should be declared here. */ public class RobotContainer { // The robot's subsystems public final DriveSubsystem m_robotDrive = new DriveSubsystem(); // The driver's controller XboxController m_driverController = new XboxController(OIConstants.kDriverControllerPort); State state = new State(); // ArrayList<State> states = new ArrayList<State>(); Trajectory trajectory; /** * The container for the robot. Contains subsystems, OI devices, and commands. */ public RobotContainer() { // Configure the button bindings configureButtonBindings(); // Configure default commands // Set the default drive command to split-stick arcade drive m_robotDrive.setDefaultCommand( // A split-stick arcade command, with forward/backward controlled by the left // hand, and turning controlled by the right. new RunCommand(() -> m_robotDrive .arcadeDrive(m_driverController.getY(GenericHID.Hand.kLeft), m_driverController.getX(GenericHID.Hand.kRight)), m_robotDrive)); } /** * Use this method to define your button->command mappings. Buttons can be created by * instantiating a {@link GenericHID} or one of its subclasses ({@link * edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then calling passing it to a * {@link JoystickButton}. */ private void configureButtonBindings() { // Drive at half speed when the right bumper is held new JoystickButton(m_driverController, Button.kBumperRight.value) .whenPressed(() -> m_robotDrive.setMaxOutput(0.5)) .whenReleased(() -> m_robotDrive.setMaxOutput(1)); } /** * Use this to pass the autonomous command to the main {@link Robot} class. * * @return the command to run in autonomous */ public void getAutonomousCommand() { // Create a voltage constraint to ensure we don't accelerate too fast var autoVoltageConstraint = new DifferentialDriveVoltageConstraint( new SimpleMotorFeedforward(DriveConstants.ksVolts, DriveConstants.kvVoltSecondsPerMeter, DriveConstants.kaVoltSecondsSquaredPerMeter), DriveConstants.kDriveKinematics, 10); // Create config for trajectory TrajectoryConfig config = new TrajectoryConfig(AutoConstants.kMaxSpeedMetersPerSecond, AutoConstants.kMaxAccelerationMetersPerSecondSquared) // Add kinematics to ensure max speed is actually obeyed .setKinematics(DriveConstants.kDriveKinematics) // Apply the voltage constraint .addConstraint(autoVoltageConstraint); // An example trajectory to follow. All units in meters. Trajectory exampleTrajectory = TrajectoryGenerator.generateTrajectory( // Start at the origin facing the +X direction new Pose2d(0, 0, new Rotation2d(0)), // Pass through these two interior waypoints, making an 's' curve path List.of( new Translation2d(10, 1), new Translation2d(20, -1) ), // End 3 meters straight ahead of where we started, facing forward new Pose2d(30, 0, new Rotation2d(0)), // Pass config config ); RamseteCommand ramseteCommand = new RamseteCommand( exampleTrajectory, m_robotDrive::getPose, new RamseteController(AutoConstants.kRamseteB, AutoConstants.kRamseteZeta), new SimpleMotorFeedforward(DriveConstants.ksVolts, DriveConstants.kvVoltSecondsPerMeter, DriveConstants.kaVoltSecondsSquaredPerMeter), DriveConstants.kDriveKinematics, m_robotDrive::getWheelSpeeds, new PIDController(DriveConstants.kPDriveVel, 0, 0), new PIDController(DriveConstants.kPDriveVel, 0, 0), // RamseteCommand passes volts to the callback m_robotDrive::tankDriveVolts, m_robotDrive ); // Run path following command, then stop at the end. ramseteCommand.schedule(); } }
671f0938207dcf58dde6aed68148dbf4059a0221
348de4c617d1db7c8d697e717e0a21bce50cb995
/haikudepotserver-webapp/src/test/java/org/haikuos/haikudepotserver/IntegrationTestSupportService.java
bb26a3af3150cf0d81a10dbf89d7a47cbf4f9a3a
[ "MIT" ]
permissive
diversys/haikudepotserver
c25409bfc9a48c13f533fe2467ca9281970482ea
8dbd4090dae16f1810d66c610bd5f850a1c2b2fb
refs/heads/master
2021-01-20T19:13:38.781356
2015-03-16T18:51:09
2015-03-16T18:51:09
32,403,687
0
0
null
2015-03-17T15:55:16
2015-03-17T15:55:16
null
UTF-8
Java
false
false
16,003
java
/* * Copyright 2014-2015, Andrew Lindesay * Distributed under the terms of the MIT License. */ package org.haikuos.haikudepotserver; import com.google.common.base.Strings; import org.apache.cayenne.ObjectContext; import org.apache.cayenne.configuration.server.ServerRuntime; import org.haikuos.haikudepotserver.dataobjects.*; import org.haikuos.haikudepotserver.pkg.PkgOrchestrationService; import org.haikuos.haikudepotserver.security.AuthenticationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.InputStream; import java.util.Collections; /** * <p>This class is designed to help out with creating some common test data that can be re-used between tests.</p> */ @Service public class IntegrationTestSupportService { protected static Logger LOGGER = LoggerFactory.getLogger(IntegrationTestSupportService.class); @Resource ServerRuntime serverRuntime; @Resource PkgOrchestrationService pkgOrchestrationService; @Resource PkgOrchestrationService pkgService; @Resource protected AuthenticationService authenticationService; private ObjectContext objectContext = null; public ObjectContext getObjectContext() { if(null==objectContext) { objectContext = serverRuntime.getContext(); } return objectContext; } private PkgScreenshot addPkgScreenshot(ObjectContext objectContext, Pkg pkg) { try (InputStream inputStream = IntegrationTestSupportService.class.getResourceAsStream("/sample-320x240.png")) { return pkgService.storePkgScreenshotImage(inputStream, objectContext, pkg); } catch(Exception e) { throw new IllegalStateException("an issue has arisen loading a sample screenshot into a test package",e); } } private void addPngPkgIcon(ObjectContext objectContext, Pkg pkg, int size) { try (InputStream inputStream = this.getClass().getResourceAsStream(String.format("/sample-%dx%d.png", size, size))) { pkgService.storePkgIconImage( inputStream, MediaType.getByCode(objectContext, com.google.common.net.MediaType.PNG.toString()).get(), size, objectContext, pkg); } catch(Exception e) { throw new IllegalStateException("an issue has arisen loading an icon",e); } } private void addHvifPkgIcon(ObjectContext objectContext, Pkg pkg) { try (InputStream inputStream = this.getClass().getResourceAsStream("/sample.hvif")) { pkgService.storePkgIconImage( inputStream, MediaType.getByCode(objectContext, MediaType.MEDIATYPE_HAIKUVECTORICONFILE).get(), null, objectContext, pkg); } catch(Exception e) { throw new IllegalStateException("an issue has arisen loading an icon",e); } } private void addPkgIcons(ObjectContext objectContext, Pkg pkg) { addPngPkgIcon(objectContext, pkg, 16); addPngPkgIcon(objectContext, pkg, 32); addHvifPkgIcon(objectContext, pkg); } public void addDummyLocalization(ObjectContext context, PkgVersion pkgVersion) { PkgVersionLocalization pkgVersionLocalization = context.newObject(PkgVersionLocalization.class); pkgVersionLocalization.setNaturalLanguage(NaturalLanguage.getByCode(context, NaturalLanguage.CODE_ENGLISH).get()); pkgVersionLocalization.setDescription("sample description"); pkgVersionLocalization.setSummary("sample summary"); pkgVersion.addToManyTarget(PkgVersion.PKG_VERSION_LOCALIZATIONS_PROPERTY, pkgVersionLocalization, true); } public StandardTestData createStandardTestData() { LOGGER.info("will create standard test data"); String platformTmpDirPath = System.getProperty("java.io.tmpdir"); if (Strings.isNullOrEmpty(platformTmpDirPath)) { throw new IllegalStateException("unable to get the java temporary directory"); } ObjectContext context = getObjectContext(); StandardTestData result = new StandardTestData(); Prominence prominence = Prominence.getByOrdering(context, Prominence.ORDERING_LAST).get(); Architecture x86 = Architecture.getByCode(context, "x86").get(); Architecture x86_gcc2 = Architecture.getByCode(context, "x86_gcc2").get(); Architecture any = Architecture.getByCode(context, "any").get(); result.repository = context.newObject(Repository.class); result.repository.setActive(Boolean.TRUE); result.repository.setCode("testrepository"); result.repository.setArchitecture(x86); result.repository.setUrl("file://" + platformTmpDirPath + "/repository"); result.pkg1 = context.newObject(Pkg.class); result.pkg1.setActive(true); result.pkg1.setName("pkg1"); result.pkg1.setDerivedRating(3.5f); result.pkg1.setDerivedRatingSampleSize(4); result.pkg1.setProminence(prominence); { PkgPkgCategory pkgPkgCategory = context.newObject(PkgPkgCategory.class); result.pkg1.addToManyTarget(Pkg.PKG_PKG_CATEGORIES_PROPERTY, pkgPkgCategory, true); pkgPkgCategory.setPkgCategory(PkgCategory.getByCode(context, "graphics").get()); } { PkgLocalization pkgLocalization = context.newObject(PkgLocalization.class); pkgLocalization.setNaturalLanguage(NaturalLanguage.getByCode(context, NaturalLanguage.CODE_ENGLISH).get()); pkgLocalization.setTitle("Package 1"); pkgLocalization.setPkg(result.pkg1); } { PkgLocalization pkgLocalization = context.newObject(PkgLocalization.class); pkgLocalization.setNaturalLanguage(NaturalLanguage.getByCode(context, NaturalLanguage.CODE_GERMAN).get()); pkgLocalization.setTitle("Packet 1"); pkgLocalization.setPkg(result.pkg1); } { PkgLocalization pkgLocalization = context.newObject(PkgLocalization.class); pkgLocalization.setNaturalLanguage(NaturalLanguage.getByCode(context, NaturalLanguage.CODE_SPANISH).get()); pkgLocalization.setTitle("Ping 1"); pkgLocalization.setPkg(result.pkg1); } addPkgScreenshot(context,result.pkg1); addPkgScreenshot(context,result.pkg1); addPkgScreenshot(context,result.pkg1); addPkgIcons(context, result.pkg1); result.pkg1Version1x86 = context.newObject(PkgVersion.class); result.pkg1Version1x86.setActive(Boolean.FALSE); result.pkg1Version1x86.setArchitecture(x86); result.pkg1Version1x86.setMajor("1"); result.pkg1Version1x86.setMicro("2"); result.pkg1Version1x86.setRevision(3); result.pkg1Version1x86.setIsLatest(false); result.pkg1Version1x86.setPkg(result.pkg1); result.pkg1Version1x86.setRepository(result.repository); addDummyLocalization(context, result.pkg1Version1x86); result.pkg1Version2x86 = context.newObject(PkgVersion.class); result.pkg1Version2x86.setActive(Boolean.TRUE); result.pkg1Version2x86.setArchitecture(x86); result.pkg1Version2x86.setMajor("1"); result.pkg1Version2x86.setMicro("2"); result.pkg1Version2x86.setRevision(4); result.pkg1Version2x86.setIsLatest(true); result.pkg1Version2x86.setPkg(result.pkg1); result.pkg1Version2x86.setRepository(result.repository); { PkgVersionLocalization pkgVersionLocalization = context.newObject(PkgVersionLocalization.class); pkgVersionLocalization.setNaturalLanguage(NaturalLanguage.getByCode(context, NaturalLanguage.CODE_ENGLISH).get()); pkgVersionLocalization.setDescription("pkg1Version2DescriptionEnglish_rockmelon"); pkgVersionLocalization.setSummary("pkg1Version2SummaryEnglish_persimon"); result.pkg1Version2x86.addToManyTarget(PkgVersion.PKG_VERSION_LOCALIZATIONS_PROPERTY, pkgVersionLocalization, true); } { PkgVersionLocalization pkgVersionLocalization = context.newObject(PkgVersionLocalization.class); pkgVersionLocalization.setNaturalLanguage(NaturalLanguage.getByCode(context, NaturalLanguage.CODE_SPANISH).get()); pkgVersionLocalization.setDescription("pkg1Version2DescriptionSpanish_mango"); pkgVersionLocalization.setSummary("pkg1Version2SummarySpanish_feijoa"); result.pkg1Version2x86.addToManyTarget(PkgVersion.PKG_VERSION_LOCALIZATIONS_PROPERTY, pkgVersionLocalization, true); } result.pkg1Version2x86_gcc2 = context.newObject(PkgVersion.class); result.pkg1Version2x86_gcc2.setActive(Boolean.TRUE); result.pkg1Version2x86_gcc2.setArchitecture(x86_gcc2); result.pkg1Version2x86_gcc2.setMajor("1"); result.pkg1Version2x86_gcc2.setMicro("2"); result.pkg1Version2x86_gcc2.setRevision(4); result.pkg1Version2x86_gcc2.setIsLatest(true); result.pkg1Version2x86_gcc2.setPkg(result.pkg1); result.pkg1Version2x86_gcc2.setRepository(result.repository); // this is the same as the x86 version so that comparisons with English will happen. { PkgVersionLocalization pkgVersionLocalization = context.newObject(PkgVersionLocalization.class); pkgVersionLocalization.setNaturalLanguage(NaturalLanguage.getByCode(context, NaturalLanguage.CODE_ENGLISH).get()); pkgVersionLocalization.setDescription("pkg1Version2DescriptionEnglish_guava"); pkgVersionLocalization.setSummary("pkg1Version2SummaryEnglish_apple"); result.pkg1Version2x86_gcc2.addToManyTarget(PkgVersion.PKG_VERSION_LOCALIZATIONS_PROPERTY, pkgVersionLocalization, true); } result.pkg2 = context.newObject(Pkg.class); result.pkg2.setActive(true); result.pkg2.setName("pkg2"); result.pkg2.setProminence(prominence); result.pkg2Version1 = context.newObject(PkgVersion.class); result.pkg2Version1.setActive(Boolean.TRUE); result.pkg2Version1.setArchitecture(x86); result.pkg2Version1.setMajor("1"); result.pkg2Version1.setMinor("1"); result.pkg2Version1.setMicro("2"); result.pkg2Version1.setRevision(3); result.pkg2Version1.setIsLatest(true); result.pkg2Version1.setPkg(result.pkg2); result.pkg2Version1.setRepository(result.repository); addDummyLocalization(context, result.pkg2Version1); result.pkg3 = context.newObject(Pkg.class); result.pkg3.setActive(true); result.pkg3.setName("pkg3"); result.pkg3.setProminence(prominence); result.pkg3Version1 = context.newObject(PkgVersion.class); result.pkg3Version1.setActive(Boolean.TRUE); result.pkg3Version1.setArchitecture(x86); result.pkg3Version1.setMajor("1"); result.pkg3Version1.setMinor("1"); result.pkg3Version1.setMicro("2"); result.pkg3Version1.setRevision(3); result.pkg3Version1.setIsLatest(true); result.pkg3Version1.setPkg(result.pkg3); result.pkg3Version1.setRepository(result.repository); addDummyLocalization(context, result.pkg3Version1); result.pkgAny = context.newObject(Pkg.class); result.pkgAny.setActive(true); result.pkgAny.setName("pkgany"); result.pkgAny.setProminence(prominence); result.pkgAnyVersion1 = context.newObject(PkgVersion.class); result.pkgAnyVersion1.setActive(Boolean.TRUE); result.pkgAnyVersion1.setArchitecture(any); result.pkgAnyVersion1.setMajor("123"); result.pkgAnyVersion1.setMicro("123"); result.pkgAnyVersion1.setRevision(3); result.pkgAnyVersion1.setIsLatest(true); result.pkgAnyVersion1.setPkg(result.pkgAny); result.pkgAnyVersion1.setRepository(result.repository); addDummyLocalization(context, result.pkgAnyVersion1); context.commitChanges(); LOGGER.info("did create standard test data"); return result; } public User createBasicUser(ObjectContext context, String nickname, String password) { User user = context.newObject(User.class); user.setNickname(nickname); user.setPasswordSalt(); // random user.setPasswordHash(authenticationService.hashPassword(user, password)); user.setNaturalLanguage(NaturalLanguage.getByCode(context, NaturalLanguage.CODE_ENGLISH).get()); context.commitChanges(); return user; } /** * <p>This will create a known user and a known set of user ratings that can be tested against. * This method expected that the standard test data has already been introduced into the * environment prior.</p> */ public void createUserRatings() { ObjectContext context = serverRuntime.getContext(); Pkg pkg = Pkg.getByName(context, "pkg3").get(); Architecture x86 = Architecture.getByCode(context, "x86").get(); PkgVersion pkgVersion = pkgOrchestrationService.getLatestPkgVersionForPkg(context, pkg, Collections.singletonList(x86)).get(); NaturalLanguage english = NaturalLanguage.getByCode(context, NaturalLanguage.CODE_ENGLISH).get(); { User user = createBasicUser(context, "urtest1", "password"); { UserRating userRating = context.newObject(UserRating.class); userRating.setRating((short) 5); userRating.setUser(user); userRating.setNaturalLanguage(english); userRating.setPkgVersion(pkgVersion); userRating.setComment("Southern hemisphere winter"); userRating.setCode("ABCDEF"); // known code that can be used for reference later } } { User user = createBasicUser(context, "urtest2", "password"); { UserRating userRating = context.newObject(UserRating.class); userRating.setRating((short) 3); userRating.setUser(user); userRating.setNaturalLanguage(english); userRating.setPkgVersion(pkgVersion); userRating.setComment("Winter banana apples"); userRating.setCode("GHIJKL"); // known code that can be used for reference later userRating.setUserRatingStability(UserRatingStability.getByCode(context, UserRatingStability.CODE_UNSTABLEBUTUSABLE).get()); } } { User user = createBasicUser(context, "urtest3", "password"); { UserRating userRating = context.newObject(UserRating.class); userRating.setRating((short) 1); userRating.setUser(user); userRating.setActive(false); userRating.setNaturalLanguage(english); userRating.setPkgVersion(pkgVersion); userRating.setComment("Kingston black apples"); userRating.setCode("MNOPQR"); // known code that can be used for reference later } } context.commitChanges(); } /** * <p>This class is a container that carries some basic test-case data.</p> */ public static class StandardTestData { public Repository repository; public Pkg pkg1; public PkgVersion pkg1Version1x86; public PkgVersion pkg1Version2x86; public PkgVersion pkg1Version2x86_gcc2; public Pkg pkg2; public PkgVersion pkg2Version1; public Pkg pkg3; public PkgVersion pkg3Version1; public Pkg pkgAny; public PkgVersion pkgAnyVersion1; } }
d8e474574bfb421d909cbb4e80742666a665b325
9604db615d0a1b2e20dd7b42933abce6e72564a5
/JavaAdvanced/16.FunctionalProgramming-Exercises/src/P08_SmallestElement.java
d33548f8a010a6f7c136cdf112096bbb7a968f8a
[]
no_license
mrindzhov/Software-University
131bb27ef897e9748030a9473f70af63d920b248
6ee1ca55003ee02663793ab7e42d4ee84282f403
refs/heads/master
2020-03-19T01:19:19.597378
2018-05-31T22:09:06
2018-05-31T22:09:06
135,537,253
0
0
null
null
null
null
UTF-8
Java
false
false
906
java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.function.Function; public class P08_SmallestElement { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); List<Integer> integers = new ArrayList<>(); String line = scanner.nextLine(); scanner = new Scanner(line); while (scanner.hasNextInt()) { integers.add(scanner.nextInt()); } Function<List<Integer>, Integer> smallestNum = elements -> { int min=Integer.MAX_VALUE; int index = 0; for (int i = 0; i < elements.size(); i++) { if(elements.get(i)<=min){ min=elements.get(i); index=i; } } return index; }; System.out.println(smallestNum.apply(integers)); } }
1a25519c849d58af95d50916236960ffaef5263f
1a99523879817afb53985477d26b1c8949698a30
/L6/Homework6/AppPlugin/src/menu/IExecutableAction.java
07b876ed46ce787cba9112102a61ef6d4357ecac
[]
no_license
betiix26/ObjectOrientedDesign
bffbbf08cefd6bed769dd6e626b3363b8c72d02e
42b7b571d5a665b3be27441d4b367e4d3acd4c72
refs/heads/main
2023-06-20T09:40:21.908489
2021-06-20T11:03:10
2021-06-20T11:03:10
362,103,963
0
0
null
null
null
null
UTF-8
Java
false
false
100
java
package menu; public interface IExecutableAction { void execute(Object[] parameters); }
8d0bde7d693c68750e62c88495c5b43e42937721
0dbff67032029495d1fce23dff122eeb4806fa2e
/src/kankan/wheel/widget/.svn/text-base/ArrayWheelAdapter.java.svn-base
fa01ddb42e4b744e29658c8fa639ee08ea3202de
[]
no_license
liuyijiang1994/znufe_app
2d1273231b3238589850e813fac35f8468f67ef8
46f76edc857d470065e094639e27c8f3b5750784
refs/heads/master
2020-12-25T15:17:39.997906
2019-06-19T08:01:12
2019-06-19T08:01:12
65,866,458
2
1
null
null
null
null
UTF-8
Java
false
false
1,516
/* * Copyright 2010 Yuri Kanivets * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package kankan.wheel.widget; /** * The simple Array wheel adapter * @param <T> the element type */ public class ArrayWheelAdapter<T> implements WheelAdapter { /** The default items length */ public static final int DEFAULT_LENGTH = -1; // items private T items[]; // length private int length; /** * Constructor * @param items the items * @param length the max items length */ public ArrayWheelAdapter(T items[], int length) { this.items = items; this.length = length; } /** * Contructor * @param items the items */ public ArrayWheelAdapter(T items[]) { this(items, DEFAULT_LENGTH); } @Override public String getItem(int index) { if (index >= 0 && index < items.length) { return items[index].toString(); } return null; } @Override public int getItemsCount() { return items.length; } @Override public int getMaximumLength() { return length; } }
[ "etwxyet2" ]
etwxyet2
ef758fe08d1132aa0bf07491a2338ff36f224e9e
7d44e79ec10f864a94e6233c08a4ad250c149873
/Clase04/src/ar/com/eduit/curso/java/entities/Direccion.java
c82a5dbe56a2621251e3a267d35b506ece891bf1
[]
no_license
EliseoDerghazarian/Java-8
26e055788e42d65ee996a3d6d8283d0bde4dc4c9
1d8d64e919008c68e3ee74892c4dd556b25b3452
refs/heads/master
2020-05-04T17:42:19.503280
2019-05-13T16:03:02
2019-05-13T16:03:02
179,322,882
0
0
null
null
null
null
UTF-8
Java
false
false
1,644
java
package ar.com.eduit.curso.java.entities; public class Direccion { private String calle; private int numero; private String piso; private String departamento; private String ciudad; public Direccion(String calle, int numero, String piso, String departamento, String ciudad) { this.calle = calle; this.numero = numero; this.piso = piso; this.departamento = departamento; this.ciudad = ciudad; } public Direccion() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public String toString() { return "Direccion{" + "calle=" + calle + ", numero=" + numero + ", piso=" + piso + ", departamento=" + departamento + ", ciudad=" + ciudad + '}'; } public String getCalle() { return calle; } public void setCalle(String calle) { this.calle = calle; } public int getNumero() { return numero; } public void setNumero(int numero) { this.numero = numero; } public String getPiso() { return piso; } public void setPiso(String piso) { this.piso = piso; } public String getDepartamento() { return departamento; } public void setDepartamento(String departamento) { this.departamento = departamento; } public String getCiudad() { return ciudad; } public void setCiudad(String ciudad) { this.ciudad = ciudad; } }
2e56220156b38595716cc1de3176f0066835c613
9387f41bac2c392bc2d6814e36408f795674817b
/Gajenje_Ovaca/src/main/java/app/services/OvcaService.java
3be41b4f71da71c37603bee773f85045495c4b82
[]
no_license
tadic/Ovcar
e9c6a146a20a4d6e49a95afa3915312da2d88c31
9ca7e2f562f28bd5a016d985dafd9fbd8f34cc99
refs/heads/master
2021-01-17T09:25:38.115959
2016-04-02T09:15:22
2016-04-02T09:15:22
21,502,797
0
0
null
null
null
null
UTF-8
Java
false
false
10,072
java
package app.services; import app.model.Ovca; import app.model.Parenje; import com.avaje.ebean.EbeanServer; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class OvcaService { private EbeanServer server; public OvcaService(EbeanServer server){ this.server = server; } public List<Ovca> getAllSheep() { List<Ovca> list = server.find(Ovca.class).findList(); for(Ovca o:list){ o.getOtac(); o.getMajka(); } return list; } public Ovca getOvca(int id) { Ovca o = server.find(Ovca.class, id); o.getOtac(); o.getMajka(); return o; } public Ovca getOvca(String oznaka) { return server.find(Ovca.class).where().like("oznaka", oznaka).findUnique(); } public void saveSheep(Ovca sheep) { sheep.getOtac(); linkToFather(sheep); sheep.getMajka();// povezi ovcu sa ocem i majkom iz baze linkToMother(sheep); if (sheep.getId()!=null){ // ako je ovca vec postojala u bazi, pronadji original i uskladi data Ovca o = server.find(Ovca.class, sheep.getId()); setSheep(o,sheep); // System.out.println("Trenutak pre snimanja novi otac :" + o.getOtac().getOznaka()); server.save(o); //server.save(o.getOtac()); //????????????? ne znam sto ovo mora!?!?!?!? // System.err.println("novi otac id:" + o.getOtac().getId()); return; } server.save(sheep); } private void linkToMother(Ovca sheep){ // System.out.println("Majka: " + sheep.getMajka()); if (sheep.getMajka().getOznaka()!= null){ //ako je oznaka uneta kroz formu Ovca majka = server.find(Ovca.class).where().like("oznaka", sheep.getMajka().getOznaka().toString()).findUnique(); if (majka==null){ sheep.getMajka().setPol('ž');// ako majka nije postojala u bazi Ovca defaultOtac = server.find(Ovca.class).where().like("oznaka", "nepoznat").findUnique(); Ovca defaultMajka = server.find(Ovca.class).where().like("oznaka", "nepoznata").findUnique(); sheep.getMajka().setMajka(defaultMajka); sheep.getMajka().setOtac(defaultOtac); server.save(sheep.getMajka()); // snimi majku kao 'nepoznatu' i uzmi njen id majka = server.find(Ovca.class).where().like("oznaka", sheep.getMajka().getOznaka().toString()).findUnique(); } sheep.setMajka(majka); proveriStaruMajku(sheep); } } private void linkToFather(Ovca sheep){ // System.out.println("novi Otac: " + sheep.getOtac().getOznaka()); if (sheep.getOtac().getOznaka()!= null){ //ako je oznaka vec uneta kroz formular Ovca otac = server.find(Ovca.class).where().like("oznaka", sheep.getOtac().getOznaka().toString()).findUnique(); if (otac==null){ // ako otac nije postojala u bazi sheep.getOtac().setPol('m'); Ovca defaultOtac = server.find(Ovca.class).where().like("oznaka", "nepoznat").findUnique(); Ovca defaultMajka = server.find(Ovca.class).where().like("oznaka", "nepoznata").findUnique(); sheep.getOtac().setMajka(defaultMajka); sheep.getOtac().setOtac(defaultOtac); server.save(sheep.getOtac()); // snimi oca kao 'nepoznatu' i uzmi njen id otac = server.find(Ovca.class).where().like("oznaka", sheep.getOtac().getOznaka().toString()).findUnique(); // System.out.println("Kreiran je novi otac oznake" + otac.getOznaka()); } sheep.setOtac(otac); //System.out.println("ponovo" + sheep.getOtac().getOznaka()); proveriStarogOca(sheep); } } private void proveriStarogOca(Ovca sheep){ if (sheep.getId()!=null){ // System.out.println("step 1"); Ovca staraOvca = server.find(Ovca.class, sheep.getId()); Ovca stariOtac = staraOvca.getOtac(); //System.out.println("Stari otac: " + stariOtac.getOznaka() + " id: " + stariOtac.getId()); //System.out.println("Novi otac: " + sheep.getOtac().getOznaka() + " id: " + sheep.getOtac().getId()); //System.out.println("Isti: " + stariOtac.equals(sheep.getOtac())); if (stariOtac==null || (stariOtac.equals(sheep.getOtac()))){ return; } ocistiOca(stariOtac); } } private void proveriStaruMajku(Ovca sheep){ if (sheep.getId()!=null){ Ovca staraOvca = server.find(Ovca.class, sheep.getId()); Ovca staraMajka = staraOvca.getMajka(); // System.out.println("step 2, status: " + staraMajka.getStatus()); if (staraMajka==null || (staraMajka.equals(sheep.getMajka()))){ return; } ocistiMajku(staraMajka); } } private void setSheep(Ovca ovca1, Ovca ovca2){ ovca1.setDatumRodjenja(ovca2.getDatumRodjenja()); ovca1.setNadimak(ovca2.getNadimak()); ovca1.setPracenje(ovca2.getPracenje()); ovca1.setLinija(ovca2.getLinija()); ovca1.setOpis(ovca2.getOpis()); ovca1.setOznaka(ovca2.getOznaka()); ovca1.setProcenatR(ovca2.getProcenatR()); ovca1.setPoreklo(ovca2.getPoreklo()); ovca1.setLeglo(ovca2.getLeglo()); ovca1.setPol(ovca2.getPol()); ovca1.setOtac(ovca2.getOtac()); ovca1.setMajka(ovca2.getMajka()); ovca1.setAktuelno(ovca2.getAktuelno()); ovca1.setTezinaNaRodjenju(ovca2.getTezinaNaRodjenju()); ovca1.setTezinaDvaMeseca(ovca2.getTezinaDvaMeseca()); ovca1.setTezinaCetiriMeseca(ovca2.getTezinaCetiriMeseca()); } public List<Ovca> getOvceZaJagnjenje() { List<Ovca> list = server.find(Ovca.class).where().like("status", "na farmi").like("pol", "ž").findList(); if (list!=null){ return list; } return new ArrayList<Ovca>(); } public List<Ovca> listaOvnova() { List<Ovca> list = server.find(Ovca.class).where().like("pol", "m").findList(); if (list!=null){ return list; } return new ArrayList<Ovca>(); } public List<Ovca> getSvaZivaGrla() { return server.find(Ovca.class).where().like("status", "na farmi").findList(); } public void undoStatus(Ovca ovca){ Ovca o = server.find(Ovca.class, ovca.getId()); if (o!=null){ if (o.getProdaja()!=null){ o.setStatus("prodato"); } else if (o.getUginuce()!=null){ o.setStatus("uginulo"); } else if (o.getRodjenje()==null && o.getNabavka()==null){ // ako nikad nije ni bio na farmi o.setStatus("zamisljena"); } else { o.setStatus("na farmi"); } server.save(o); } } public void setStatus(Ovca ovca, String status){ Ovca o = server.find(Ovca.class, ovca.getId()); if (o!=null){ o.setStatus(status); server.save(o); } } public void deleteSheep(Ovca o){ ocistiMajku(o.getMajka()); ocistiOca(o.getOtac()); server.delete(o); } private void ocistiMajku(Ovca o){ if (o.getStatus()!=null && o.getStatus().equals("zamisljena")){ List<Ovca> listaPotomaka = server.find(Ovca.class).where().like("majka_id", o.getId().toString()).findList(); if (listaPotomaka.size()==1){ // ako je stari otac zamisljen i bio je otac samo ovoj ovci - izbrisi ga server.delete(o); } } } private void ocistiOca(Ovca o){ if (o.getStatus()!=null && o.getStatus().equals("zamisljena")){ List<Ovca> listaPotomaka = server.find(Ovca.class).where().like("otac_id", o.getId().toString()).findList(); if (listaPotomaka.size()==1){ // ako je stari otac zamisljen i bio je otac samo ovoj ovci - izbrisi ga server.delete(o); } } } public void saveSheepStatus(Ovca sheep, String status){ Ovca o = server.find(Ovca.class, sheep.getId()); o.setStatus(status); server.save(o); } public void updateOvcaFromList(Ovca o) { Ovca stara = server.find(Ovca.class, o.getId()); stara.setAktuelno(o.getAktuelno()); stara.setOznaka(o.getOznaka()); stara.setNadimak(o.getNadimak()); System.out.println(o.getId()); server.save(stara); } public List<Ovca> getSveOvnove() { return server.find(Ovca.class).where().like("status", "na farmi").like("pol", "m").findList(); } public void resetAktuelno(Ovca ovca){ Ovca o = server.find(Ovca.class, ovca.getId()); o.setAktuelno(""); server.save(o); } public void saveAktuelno(Ovca ovca){ Ovca o = server.find(Ovca.class, ovca.getId()); o.setAktuelno(ovca.getAktuelno()); server.save(o); } public List<Parenje> getZadnjaParenja(Ovca ovan) { List<Parenje> lista = new ArrayList<Parenje>(); for (Ovca o: getAllSheep()){ if (o.getPol()=='ž' && o.getParenja()!=null && !o.getParenja().isEmpty()){ List<Parenje> parenja = o.getParenja(); Collections.sort(parenja); Parenje zadnjeParenje = parenja.get(parenja.size()-1); if (!zadnjeParenje.getTip().equals("Odvajanje") && zadnjeParenje.getOvan().equals(ovan)){ lista.add(zadnjeParenje); } } } return lista; } }
bd1e8ecb37750fceeb542a5999acfefde3fb4a93
7ea61ee7003c5d8e27b9f02d0fc004f0bbe44562
/lib/src/main/java/com/sd/lib/utils/FHandlerManager.java
61adc8d960badad5f67d7dc3e41073dcada042b4
[]
no_license
zj565061763/utils
c0bd1845a0255c268faa8f31733e98b71d2f0a13
3d0507184f9e4bd6f222224c73e077a9da98065c
refs/heads/master
2021-06-03T14:06:18.425693
2021-05-26T07:55:37
2021-05-26T07:55:37
114,324,750
1
2
null
null
null
null
UTF-8
Java
false
false
1,207
java
package com.sd.lib.utils; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; /** * Handler管理类 */ public class FHandlerManager { private static final HandlerThread HANDLER_THREAD = new HandlerThread("HandlerThread"); static { HANDLER_THREAD.start(); } private static final Handler MAIN_HANDLER = new Handler(Looper.getMainLooper()); private static final Handler BACKGROUND_HANDLER = new Handler(HANDLER_THREAD.getLooper()); private FHandlerManager() { } /** * 获得主线程Handler * * @return */ public final static Handler getMainHandler() { return MAIN_HANDLER; } /** * 获得后台线程Handler * * @return */ public final static Handler getBackgroundHandler() { return BACKGROUND_HANDLER; } /** * Ui线程执行 * * @param runnable */ public static void runOnUiThread(Runnable runnable) { if (runnable == null) return; if (Looper.myLooper() == Looper.getMainLooper()) runnable.run(); else MAIN_HANDLER.post(runnable); } }
d056230f919d98e7d50618990b75a8147d479bad
b65304eb64570b73df8878f371bd5fe740dc1a62
/app/src/main/java/com/angkorcab/fragments/ProfileFragment.java
323e8512bf4dbbcad6d5c91ff438b867fb46511e
[]
no_license
ersalye/mobite-taxi
8895bad4d466383724af8d60c6cafb559fd08541
e2e6c4b686c6567ac83dee5f6bd1ed137e7bcfcc
refs/heads/master
2021-06-11T23:33:07.206058
2017-02-13T11:03:38
2017-02-13T11:03:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,542
java
package com.angkorcab.fragments; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.JavascriptInterface; import android.webkit.WebView; import android.widget.ProgressBar; import com.angkorcab.taxi.MainActivity; import com.angkorcab.taxi.R; import com.angkorcab.constants.ProjectURls; import com.angkorcab.helper.MyWebViewClient; import com.angkorcab.login.LoginDetails; import com.angkorcab.utils.SharedPreferencesUtility; public class ProfileFragment extends BaseFragment { private Handler mHandler = new Handler(); WebView profile_web_view; ProgressBar profileProgressupdateProfile; Context context; private static final String TAG = "ProfileFragment"; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_profile, null); ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(getResources().getString(R.string.item_one)); context = getActivity(); try { Log.i(TAG,"working..."); Log.i(TAG, ProjectURls.getProfileUrl(SharedPreferencesUtility.loadUserEmail(context), SharedPreferencesUtility.loadUserType(context))); profileProgressupdateProfile = (ProgressBar) root.findViewById(R.id.progressBarupdateprofile); profile_web_view = (WebView) root.findViewById(R.id.profile_webview); MyWebViewClient.enableWebViewSettings(profile_web_view); profile_web_view.addJavascriptInterface(new DemoJavaScriptInterface(context), "uploadpic"); profileProgressupdateProfile.setVisibility(View.GONE); profile_web_view.setVisibility(View.VISIBLE); profile_web_view.setWebViewClient(new MyWebViewClient(context)); profile_web_view.loadUrl(ProjectURls.getProfileUrl(SharedPreferencesUtility.loadUserEmail(context), SharedPreferencesUtility.loadUserType(context))); } catch (Exception e) { e.printStackTrace(); } return root; } final class DemoJavaScriptInterface { DemoJavaScriptInterface(Context c) { } @JavascriptInterface public void clickOnUploadPic() { mHandler.post(new Runnable() { public void run() { replaceFragment(context, new UpdateProfilePictureFragment()); } }); } @JavascriptInterface public void clickOnDriver(String fullname, String contact, String cab_type, String cab_number) { LoginDetails.CabType = Integer.parseInt(cab_number); SharedPreferencesUtility.saveCabType(context, LoginDetails.CabType); mHandler.post(new Runnable() { public void run() { } }); } } @Override protected void backPressed() { try { context.startActivity(new Intent(context, MainActivity.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)); } catch (Exception e) { e.printStackTrace(); } } }
14612b9631c764746ce555882e5db85f31040f40
712fb350624fc67dc5af3c329f4520084480f79e
/src/main/java/com/github/andavid/ds/algorithm/divideandconquer/CountInversePairs.java
10e6b6ed2bcb4ca66fff58c53a390a590220f36c
[]
no_license
blank-1/ds-algo-java
114a115320fd29b9a8b0ef39de280dc0750b49a8
e5d011b2abb6305ddba52a6b021e47f4919151df
refs/heads/master
2022-12-29T05:00:48.790412
2020-06-09T15:23:24
2020-06-09T15:23:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,380
java
package com.github.andavid.ds.algorithm.divideandconquer; public class CountInversePairs { private int num = 0; /** * 输入一个数组,求出这个数组中的逆序对总数。 * 采用分治算法,利用二路归并排序实现。 */ public int count(int[] data) { if (data == null || data.length < 2) { return 0; } num = 0; mergeSort(data, 0, data.length - 1); return num; } public void mergeSort(int[] data, int low, int high) { if (low >= high) return; int mid = low + (high - low) / 2; mergeSort(data, low, mid); mergeSort(data, mid + 1, high); merge(data, low, mid, high); } public void merge(int[] data, int low, int mid, int high) { int[] temp = new int[high - low + 1]; int left = low; int right = mid + 1; int index = 0; while (left <= mid && right <= high) { if (data[left] > data[right]) { // 合并两个有序数组过程中,right 存在逆序对数量为 left 到 mid 的元素数量 num += mid - left + 1; temp[index++] = data[right++]; } else { temp[index++] = data[left++]; } } while (left <= mid) { temp[index++] = data[left++]; } while (right <= high) { temp[index++] = data[right++]; } for (int i = low; i <= high; i++) { data[i] = temp[i - low]; } } }
2522da23063371556f13c8ebbb4290f2d31a4b94
a8c5b7b04eace88b19b5a41a45f1fb030df393e3
/projects/core/src/test/java/com/opengamma/core/convention/ConventionTypeTest.java
7b5cc06bf06d7b15f98121da85cfa1ec73a1db49
[ "Apache-2.0" ]
permissive
McLeodMoores/starling
3f6cfe89cacfd4332bad4861f6c5d4648046519c
7ae0689e06704f78fd9497f8ddb57ee82974a9c8
refs/heads/master
2022-12-04T14:02:00.480211
2020-04-28T17:22:44
2020-04-28T17:22:44
46,577,620
4
4
Apache-2.0
2022-11-24T07:26:39
2015-11-20T17:48:10
Java
UTF-8
Java
false
false
1,343
java
/** * Copyright (C) 2018 - present McLeod Moores Software Limited. All rights reserved. */ package com.opengamma.core.convention; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotEquals; import org.testng.annotations.Test; import com.opengamma.util.test.TestGroup; /** * Tests for {@link ConventionType}. */ @Test(groups = TestGroup.UNIT) public class ConventionTypeTest { private static final String NAME = "NAME"; /** * Tests the object. */ @Test public void test() { final ConventionType type = ConventionType.of(NAME); assertEquals(type, type); assertNotEquals(null, type); assertNotEquals(NAME, type); assertEquals(type.getName(), NAME); assertEquals(type.toString(), NAME); ConventionType other = ConventionType.of(NAME); assertEquals(type, other); assertEquals(type.hashCode(), other.hashCode()); other = ConventionType.of(NAME.substring(1)); assertNotEquals(type, other); } /** * Tests the compareTo method. */ @Test public void testCompareTo() { final ConventionType type = ConventionType.of(NAME); assertEquals(type.compareTo(ConventionType.of(NAME)), 0); assertNotEquals(type.compareTo(ConventionType.of("a" + NAME)), 0); assertNotEquals(type.compareTo(ConventionType.of("z" + NAME)), 0); } }
21494cfe149130b2b25252db56c58f131ebb3056
55cb351fb9f1d542a87bcd809d9b58fdea6d68f6
/stacks/design_and_implementation/StackViaQueuesCostlyEnqueue.java
c930368e6f32c53892145e493e723f7a1bc3d0a7
[ "MIT" ]
permissive
GeekNandy/DataStructures
b1325bd0d2ac16b6bcf699b32f9430ccee4b7b13
84eeb9f3aaa02ec70e0a77890bceca5dabe7cfa5
refs/heads/master
2023-02-03T08:59:15.440668
2020-12-24T17:46:32
2020-12-24T17:46:32
294,992,813
0
0
MIT
2020-12-24T17:46:33
2020-09-12T17:28:10
Java
UTF-8
Java
false
false
938
java
package stacks.design_and_implementation; import java.util.LinkedList; import java.util.Queue; /** * @author Sharad * */ class StackCostlyPush { Queue<Integer> main = new LinkedList<>(); Queue<Integer> auxillary = new LinkedList<>(); void push(int elem) { while(!main.isEmpty()) { auxillary.add(main.poll()); } main.add(elem); while(!auxillary.isEmpty()) { main.add(auxillary.poll()); } } int pop() { return main.poll(); } void printStack() { while(!main.isEmpty()) { int t = main.poll(); auxillary.add(t); System.out.print(t+" "); } while(!auxillary.isEmpty()) { main.add(auxillary.poll()); } } } public class StackViaQueuesCostlyEnqueue { public static void main(String[] args) { StackCostlyPush stack = new StackCostlyPush(); stack.push(1); stack.push(2); stack.push(3); stack.push(4); stack.pop(); stack.pop(); stack.push(8); stack.printStack(); } }
e406075469850ecbcc4b914c5f5abc5aff7f42a3
88fad1e25f3707ff08c117c76917cffcc1af6513
/aspa/src/main/java/com/lori/aspa/api/AuthorizationApi.java
ca9d5af5ac1584e21bb7304749328ca24f480bc7
[]
no_license
brunolori/aspa
9f8e06230cb26a58aed745dda31b1bfb9263f4f6
5aff65f431fcb11e20c0e61722720b9e3d0701f2
refs/heads/master
2020-03-13T04:57:38.231617
2018-06-21T12:08:07
2018-06-21T12:08:07
130,972,975
0
0
null
null
null
null
UTF-8
Java
false
false
6,688
java
package com.lori.aspa.api; import java.io.IOException; import java.io.InputStream; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.InputStreamResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.lori.aspa.api.req.AuthorizationReq; import com.lori.aspa.dto.ApprovalHistoryDTO; import com.lori.aspa.dto.AuthorizationDTO; import com.lori.aspa.dto.UserDTO; import com.lori.aspa.exceptions.AppException; import com.lori.aspa.model.MyDashboardDTO; import com.lori.aspa.security.TokenUtil; import com.lori.aspa.services.AuthorizationService; import com.lori.aspa.services.PdfExporter; import com.lori.aspa.services.UserService; @RestController @RequestMapping("/api/authorization") public class AuthorizationApi { @Autowired AuthorizationService authorizationService; @Autowired UserService userService; @Autowired PdfExporter pdfExporter; @RequestMapping(value = "/findAuthorization/{id}", method = RequestMethod.GET, produces = "application/json") public ResponseEntity<?> findAuthorization(@PathVariable(name = "id") Integer authorizationId) { AuthorizationDTO auth = authorizationService.findAuthorizationById(authorizationId); if (auth == null) { return new ResponseEntity<String>(new String("Nuk u gjend autorizimi"), HttpStatus.NOT_FOUND); } return new ResponseEntity<>(auth, HttpStatus.OK); } @RequestMapping(value = "/searchAuthorization", method = RequestMethod.POST, produces = "application/json") public ResponseEntity<?> searchAuthorization(@RequestHeader(value = "Authorization") String token, @RequestBody AuthorizationReq req) { List<AuthorizationDTO> auths = authorizationService.searchAuthorization(req); return new ResponseEntity<>(auths, HttpStatus.OK); } @RequestMapping(value = "/myDashboard", method = RequestMethod.GET, produces = "application/json") public ResponseEntity<?> getMyDashboard(@RequestHeader(value = "Authorization") String token) { String uname = TokenUtil.getUsername(token); MyDashboardDTO dash = authorizationService.getMydashboard(uname); return new ResponseEntity<>(dash, HttpStatus.OK); } @RequestMapping(value = "/register", method = RequestMethod.POST, produces = { "application/json" }) public ResponseEntity<?> registerAuthorization(@RequestHeader(value = "Authorization") String token, @RequestBody AuthorizationDTO dto) { try { String uname = TokenUtil.getUsername(token); UserDTO u = userService.findUserByUsername(uname); dto.setUserId(u.getId()); AuthorizationDTO auth = authorizationService.registerAuthorization(dto); return new ResponseEntity<>(auth, HttpStatus.OK); } catch (AppException e) { return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST); } } @RequestMapping(value = "/modify", method = RequestMethod.POST, produces = { "application/json" }) public ResponseEntity<?> modifyAuthorization(@RequestHeader(value = "Authorization") String token, @RequestBody AuthorizationDTO dto) { try { String uname = TokenUtil.getUsername(token); AuthorizationDTO auth = authorizationService.modifyAuthorization(dto, uname); return new ResponseEntity<>(auth, HttpStatus.OK); } catch (AppException e) { return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST); } } @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = { "application/json" }) public ResponseEntity<?> delete(@RequestHeader(value = "Authorization") String token, @RequestBody AuthorizationDTO dto) { AuthorizationDTO auth = authorizationService.delete(dto); return new ResponseEntity<>(auth, HttpStatus.OK); } @RequestMapping(value = "/decide", method = RequestMethod.POST, produces = { "application/json" }) public ResponseEntity<?> decide(@RequestHeader(value = "Authorization") String token, @RequestBody ApprovalHistoryDTO dto) { try { String uname = TokenUtil.getUsername(token); authorizationService.decide(dto, uname); return new ResponseEntity<>(HttpStatus.OK); } catch (AppException e) { return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST); } } @RequestMapping(value = "/getAuthHistory/{auth_id}", method = RequestMethod.GET, produces = "application/json") public ResponseEntity<?> getVerifiedAuths(@RequestHeader(value = "Authorization") String token, @PathVariable(name = "auth_id") Integer authId) { List<ApprovalHistoryDTO> histories = authorizationService.getAuthHistory(authId); return new ResponseEntity<>(histories, HttpStatus.OK); } @RequestMapping(value = "/getAuthorizationsToVerify", method = RequestMethod.GET, produces = "application/json") public ResponseEntity<?> getAuthsToVerify(@RequestHeader(value = "Authorization") String token) { String uname = TokenUtil.getUsername(token); List<AuthorizationDTO> auths = authorizationService.getAuthsToVerify(uname); return new ResponseEntity<>(auths, HttpStatus.OK); } @RequestMapping(value = "/getVerifiedAuths", method = RequestMethod.GET, produces = "application/json") public ResponseEntity<?> getVerifiedAuths(@RequestHeader(value = "Authorization") String token) { String uname = TokenUtil.getUsername(token); List<AuthorizationDTO> auths = authorizationService.getVerifiedAuths(uname); return new ResponseEntity<>(auths, HttpStatus.OK); } @RequestMapping(value = "/pdfAuth/{auth_id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_PDF_VALUE) public ResponseEntity<InputStreamResource> pdfExporter(@PathVariable(name = "auth_id") Integer authorizationId) throws IOException { AuthorizationDTO authorization = authorizationService.findAuthorizationById(authorizationId); InputStream bis = pdfExporter.authorizationPdf(authorization); HttpHeaders headers = new HttpHeaders(); headers.add("Content-Disposition", "inline; filename=authorization.pdf"); return ResponseEntity.ok().headers(headers).contentType(MediaType.APPLICATION_PDF) .body(new InputStreamResource(bis)); } }
623f76a9bb2c7f2b05ca1ce027b3dfce2f529eb6
e5a11b5fd86bc6d4a4c18ec7ab4e20f2976d82d9
/Design principles Practice Check/DP Practice check 1/src/com/practicecheck/abstractfactory/IndiaCarFactory.java
ebcf49ad7c3e96f3b41232a05a81bf616f3b222e
[]
no_license
G-16-17/Gowthami_Bankuru_921629_16
24ef6a9e0a9560c330cf6864bb35c70691853451
338b173e9405cf816bcf63f2163c2511d8a8fb98
refs/heads/main
2023-08-24T06:38:34.883496
2021-09-29T09:05:46
2021-09-29T09:05:46
395,289,945
0
1
null
null
null
null
UTF-8
Java
false
false
323
java
package com.practicecheck.abstractfactory; public class IndiaCarFactory { public Car buildCar(CarType carType) { switch (carType) { case LUXURY: return new LuxuryCar(Location.INDIA); case MINI: return new MiniCar(Location.INDIA); case MICRO: return new MicroCar(Location.INDIA); } return null; } }
98222180f50d38796efc2bc8933aaf11308deb20
3302574b79253615a1bef227db6f47088739d408
/src/main/java/com/callioni/controllers/EOrderControllerBean.java
0d7ca1b354277f7d6c0fc3765386deea72aa3e23
[ "MIT" ]
permissive
petercallioni/DemoWebEJBSystem
ea3a13a28f1344cd0c420c3a8a955913be5e17a3
b966d9d0ca765c9cd5f6c191f9a56d44f8e2c650
refs/heads/master
2021-01-12T03:05:24.832657
2017-01-05T23:22:55
2017-01-05T23:22:55
78,155,082
0
0
null
null
null
null
UTF-8
Java
false
false
4,382
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.callioni.controllers; import com.callioni.entites.EOrder; import com.callioni.entites.Order_Line; import com.callioni.entjbeans.EOrderEJB; import java.util.Date; import java.util.List; import javax.inject.Named; import javax.enterprise.context.RequestScoped; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.inject.Inject; /** * * @author Peter */ @Named(value = "eorderControllerBean") @RequestScoped public class EOrderControllerBean { /** * Creates a new instance of CarControllerBean */ public EOrderControllerBean() { } @Inject private EOrderEJB eorderEJB; private EOrder eOrder = new EOrder(); private Order_Line order_Line = new Order_Line(); private List<Order_Line> lines; /** * Gets order lines associated with the managed bean * @return */ public List<Order_Line> getLines() { return lines; } /** * Sets list of lines * @param lines */ public void setLines(List<Order_Line> lines) { this.lines = lines; } /** * Calls eorderEJB to create an order with an order line * @param custId * @param date * @param carId * @param price * @param quantity */ public void createOrder(Long custId, Date date, Long carId, Double price, Integer quantity) { //status ID switch (eorderEJB.createEorder(custId, date, carId, price, quantity)) { case 0: { FacesContext context = FacesContext.getCurrentInstance(); context.addMessage(null, new FacesMessage("Order for customer " + custId + " for car " + carId + " successfully created")); break; } case 1: { FacesContext context = FacesContext.getCurrentInstance(); context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "The Customer ID is incorrect", "")); break; } case 2: { FacesContext context = FacesContext.getCurrentInstance(); context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "The Car ID incorrect", "")); break; } } } /** * Gets all Orders from database * @return */ public List<EOrder> findAllOrders() { return eorderEJB.getOrders(); } /** * Find a order by ID */ public void findOrderById() { eOrder = eorderEJB.findOrderById(eOrder.getId()); } /** * Gets all order lines in database * @return */ public List<Order_Line> findAllOrder_Lines() { return eorderEJB.getOrderLines(); } /** * Gets an list of order lines by parent eorder id * @param id * @return */ public List<Order_Line> findOrderLineById(Long id) { return eorderEJB.getOrderLinesById(id); } /** * get EorderEJB * @return */ public EOrderEJB getEOrderEJB() { return eorderEJB; } /** * sets the EorderEJB * @param eOrderEJB */ public void setEOrderEJB(EOrderEJB eOrderEJB) { this.eorderEJB = eOrderEJB; } /** * Adds an order line to an existing order * @param orderID * @param carID * @param price * @param quantity */ public void createOrderLine(Long orderID, Long carID, Double price, Integer quantity) { switch (eorderEJB.createOrderLine(orderID, carID, price, quantity)) { case 0: { FacesContext context = FacesContext.getCurrentInstance(); context.addMessage(null, new FacesMessage("Order line for order " + orderID + " for car " + carID + " successfully added")); break; } case 1: { FacesContext context = FacesContext.getCurrentInstance(); context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "The he Order ID is incorrect", "")); break; } case 2: { FacesContext context = FacesContext.getCurrentInstance(); context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "The Car ID is incorrect", "")); break; } } } /** * Deletes and order by ID * @param id */ public void deleteOrder(Long id) { eorderEJB.deleteOrder(id); } /* public void deleteOrderLine(Long id) { eorderEJB.deleteOrderLine(id); } */ }
29c0713158d436a9e1610bea12e6edc30ea81d73
e302e1f7c812c816bfde01bab06f13a2482e1274
/src/main/java/ejercicio3static/Nota2.java
c4354a85b70151d0f243c8fa78090e455e83de44
[]
no_license
SergiusxD/Presentar
8a1693a1521030b63da97b3c1a80d5ba9bb8da1e
36de52c522e4b65213b342d36d3e71f6328c7f85
refs/heads/master
2022-04-17T22:39:42.252080
2020-04-14T14:28:59
2020-04-14T14:28:59
255,631,102
0
0
null
null
null
null
UTF-8
Java
false
false
509
java
package ejercicio3static; public class Nota2 { public Nota2(){ } public String reconocimiento(int nota){ String msg="Regular Rendimiento"; if (ValidatorStatic.isValid(nota,1,100)){ if (nota >= 80 && nota < 90){ msg="Bueno "; } if (nota >= 90 && nota < 100){ msg="Muy Bueno "; } if (nota == 100){ msg="Excelente "; } } return msg + nota; } }
d655b2878b7e5f6332ee9aea457bd9bf61f034da
594c8f2ceaba206714692086b2426e13e0be929a
/src/main/java/com/example/chain/FaceFilter.java
8e5bab1dd50c4f3229468a2def5f99ccd835bf1f
[]
no_license
haohaodiniyao/design_pattern
fa16bf939b62a4d27960129bed4800518a4e7487
088071e76be29c2549905b65896dec73c0d6a54b
refs/heads/master
2020-08-31T07:46:55.706058
2017-07-06T06:59:45
2017-07-06T06:59:45
94,394,607
0
0
null
null
null
null
UTF-8
Java
false
false
445
java
package com.example.chain; /** * Created by yaokai on 2017/6/16. */ public class FaceFilter implements Filter{ public void doFilter(Request request, Response response, FilterChain filterChain) { request.setRequestStr(request.getRequestStr().replace(":):","^V^")+"####FaceFilter()"); filterChain.doFilter(request,response,filterChain); response.setResponseStr(response.getResponseStr()+"####FaceFilter()"); } }
11558a9198c13ebdb43810600d243083c3085ec1
c885ef92397be9d54b87741f01557f61d3f794f3
/results/Csv-8/org.apache.commons.csv.CSVFormat/BBC-F0-opt-60/tests/14/org/apache/commons/csv/CSVFormat_ESTest.java
fa65f290323f0684c929c316195308e412d46c47
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
76,527
java
/* * This file was automatically generated by EvoSuite * Wed Oct 20 21:44:56 GMT 2021 */ package org.apache.commons.csv; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import java.io.Reader; import java.io.StringReader; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.Quote; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class CSVFormat_ESTest extends CSVFormat_ESTest_scaffolding { @Test(timeout = 4000) public void test000() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withDelimiter('?'); CSVFormat cSVFormat2 = cSVFormat1.withCommentStart(';'); cSVFormat2.validate(); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat2.isNullHandling()); assertEquals(';', (char)cSVFormat2.getCommentStart()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat2.isEscaping()); assertTrue(cSVFormat1.isQuoting()); assertEquals('?', cSVFormat1.getDelimiter()); } @Test(timeout = 4000) public void test001() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; Character character0 = Character.valueOf('%'); CSVFormat cSVFormat1 = cSVFormat0.withEscape(character0); assertFalse(cSVFormat1.isCommentingEnabled()); cSVFormat1.validate(); assertFalse(cSVFormat1.isNullHandling()); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals(',', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals('\"', (char)cSVFormat1.getQuoteChar()); assertEquals('%', (char)cSVFormat1.getEscape()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test002() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; CSVFormat cSVFormat1 = cSVFormat0.RFC4180.withRecordSeparator('9'); boolean boolean0 = cSVFormat1.equals(cSVFormat0); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.isEscaping()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(boolean0); assertFalse(cSVFormat1.isCommentingEnabled()); assertEquals("9", cSVFormat1.getRecordSeparator()); assertFalse(cSVFormat1.isNullHandling()); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getSkipHeaderRecord()); } @Test(timeout = 4000) public void test003() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withNullString("z 7Y~Q7AwON=d!"); CSVFormat cSVFormat2 = cSVFormat1.withSkipHeaderRecord(false); assertFalse(cSVFormat2.getSkipHeaderRecord()); assertEquals("\r\n", cSVFormat2.getRecordSeparator()); assertTrue(cSVFormat2.equals((Object)cSVFormat1)); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.isCommentingEnabled()); assertFalse(cSVFormat2.isEscaping()); assertEquals("z 7Y~Q7AwON=d!", cSVFormat2.getNullString()); } @Test(timeout = 4000) public void test004() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('R'); CSVFormat cSVFormat2 = cSVFormat1.withSkipHeaderRecord(false); assertTrue(cSVFormat2.getIgnoreEmptyLines()); assertEquals('R', (char)cSVFormat2.getCommentStart()); assertFalse(cSVFormat2.isEscaping()); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat2.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat2.isNullHandling()); assertTrue(cSVFormat2.equals((Object)cSVFormat1)); assertEquals('\"', (char)cSVFormat2.getQuoteChar()); } @Test(timeout = 4000) public void test005() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withNullString(""); CSVFormat cSVFormat2 = cSVFormat1.withRecordSeparator(""); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat2.isEscaping()); assertEquals(',', cSVFormat1.getDelimiter()); assertEquals("\r\n", cSVFormat1.getRecordSeparator()); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat2.isCommentingEnabled()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals("", cSVFormat1.getNullString()); } @Test(timeout = 4000) public void test006() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('l'); CSVFormat cSVFormat2 = cSVFormat1.withRecordSeparator('l'); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat2.isEscaping()); assertFalse(cSVFormat2.equals((Object)cSVFormat1)); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertEquals('\"', (char)cSVFormat2.getQuoteChar()); assertFalse(cSVFormat2.isNullHandling()); assertEquals('l', (char)cSVFormat2.getCommentStart()); assertEquals("l", cSVFormat2.getRecordSeparator()); } @Test(timeout = 4000) public void test007() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); CSVFormat cSVFormat2 = cSVFormat1.withRecordSeparator('='); assertEquals("=", cSVFormat2.getRecordSeparator()); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat2.isEscaping()); assertFalse(cSVFormat2.equals((Object)cSVFormat1)); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat2.isCommentingEnabled()); assertTrue(cSVFormat1.getSkipHeaderRecord()); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.isNullHandling()); } @Test(timeout = 4000) public void test008() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('z'); CSVFormat cSVFormat1 = cSVFormat0.withNullString(":Td8q?O4uX_68{-r"); Quote quote0 = Quote.ALL; CSVFormat cSVFormat2 = cSVFormat1.withQuotePolicy(quote0); assertTrue(cSVFormat2.isNullHandling()); assertFalse(cSVFormat2.getSkipHeaderRecord()); assertEquals('z', cSVFormat2.getDelimiter()); assertFalse(cSVFormat2.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat2.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test009() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; Quote quote0 = Quote.ALL; CSVFormat cSVFormat1 = cSVFormat0.withQuotePolicy(quote0); assertFalse(cSVFormat1.isQuoting()); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals('\t', cSVFormat1.getDelimiter()); } @Test(timeout = 4000) public void test010() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; Character character0 = new Character('C'); CSVFormat cSVFormat1 = cSVFormat0.withCommentStart(character0); Quote quote0 = Quote.ALL; CSVFormat cSVFormat2 = cSVFormat1.withQuotePolicy(quote0); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.isEscaping()); assertEquals('C', (char)cSVFormat2.getCommentStart()); assertEquals('\"', (char)cSVFormat2.getQuoteChar()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat2.isNullHandling()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test011() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withQuoteChar((Character) null); assertTrue(cSVFormat1.equals((Object)cSVFormat0)); } @Test(timeout = 4000) public void test012() throws Throwable { Character character0 = Character.valueOf('z'); CSVFormat cSVFormat0 = CSVFormat.newFormat('z'); CSVFormat cSVFormat1 = cSVFormat0.withNullString(":Td8q?O4uX_68{-r"); CSVFormat cSVFormat2 = cSVFormat1.withQuoteChar(character0); assertEquals('z', cSVFormat2.getDelimiter()); assertFalse(cSVFormat2.getSkipHeaderRecord()); assertTrue(cSVFormat2.isNullHandling()); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.isCommentingEnabled()); assertFalse(cSVFormat2.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat2.isEscaping()); assertFalse(cSVFormat2.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test013() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; Character character0 = new Character('1'); CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('C'); CSVFormat cSVFormat2 = cSVFormat1.withQuoteChar(character0); assertEquals('\t', cSVFormat1.getDelimiter()); assertEquals('\\', (char)cSVFormat2.getEscape()); assertEquals('C', (char)cSVFormat2.getCommentStart()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals('1', (char)cSVFormat2.getQuoteChar()); assertFalse(cSVFormat2.isNullHandling()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test014() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; Character character0 = Character.valueOf('z'); CSVFormat cSVFormat1 = cSVFormat0.withQuoteChar(character0); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isCommentingEnabled()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertTrue(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isEscaping()); } @Test(timeout = 4000) public void test015() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('3'); CSVFormat cSVFormat1 = cSVFormat0.withNullString("@U1=rw8)y~w-_o"); CSVFormat cSVFormat2 = cSVFormat1.withQuoteChar('3'); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.isEscaping()); assertFalse(cSVFormat2.getIgnoreEmptyLines()); assertFalse(cSVFormat2.isCommentingEnabled()); assertFalse(cSVFormat2.getSkipHeaderRecord()); assertEquals('3', (char)cSVFormat2.getQuoteChar()); assertEquals('3', cSVFormat2.getDelimiter()); assertTrue(cSVFormat2.isNullHandling()); assertFalse(cSVFormat2.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test016() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withNullString((String) null); assertTrue(cSVFormat1.equals((Object)cSVFormat0)); } @Test(timeout = 4000) public void test017() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); CSVFormat cSVFormat2 = cSVFormat1.withNullString(""); assertEquals("", cSVFormat2.getNullString()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertEquals("\r\n", cSVFormat2.getRecordSeparator()); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat2.isEscaping()); assertFalse(cSVFormat2.isCommentingEnabled()); assertTrue(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertTrue(cSVFormat2.isQuoting()); } @Test(timeout = 4000) public void test018() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); CSVFormat cSVFormat2 = cSVFormat1.withIgnoreSurroundingSpaces(true); assertTrue(cSVFormat2.getIgnoreSurroundingSpaces()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.equals((Object)cSVFormat1)); assertTrue(cSVFormat2.isEscaping()); assertFalse(cSVFormat2.isNullHandling()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertTrue(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat2.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test019() throws Throwable { Character character0 = new Character('1'); CSVFormat cSVFormat0 = CSVFormat.newFormat('1'); CSVFormat cSVFormat1 = cSVFormat0.withEscape(character0); CSVFormat cSVFormat2 = cSVFormat1.withIgnoreEmptyLines(false); assertTrue(cSVFormat2.isEscaping()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat2.isQuoting()); assertTrue(cSVFormat2.equals((Object)cSVFormat1)); assertEquals('1', cSVFormat2.getDelimiter()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test020() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('3'); CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('3'); CSVFormat cSVFormat2 = cSVFormat1.withNullString("@U1=rw8)y~w-_o"); CSVFormat cSVFormat3 = cSVFormat2.withIgnoreEmptyLines(false); assertTrue(cSVFormat3.equals((Object)cSVFormat2)); assertFalse(cSVFormat3.isQuoting()); assertTrue(cSVFormat3.isCommentingEnabled()); assertTrue(cSVFormat3.isNullHandling()); assertEquals('3', (char)cSVFormat3.getCommentStart()); assertFalse(cSVFormat3.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat3.isEscaping()); assertEquals('3', cSVFormat3.getDelimiter()); assertFalse(cSVFormat3.getIgnoreEmptyLines()); assertFalse(cSVFormat3.getSkipHeaderRecord()); } @Test(timeout = 4000) public void test021() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); CSVFormat cSVFormat2 = cSVFormat1.withQuoteChar('Y'); Quote quote0 = Quote.NONE; CSVFormat cSVFormat3 = cSVFormat2.withQuotePolicy(quote0); CSVFormat cSVFormat4 = cSVFormat3.withIgnoreEmptyLines(false); assertTrue(cSVFormat4.equals((Object)cSVFormat3)); assertTrue(cSVFormat4.isQuoting()); assertTrue(cSVFormat4.getSkipHeaderRecord()); assertFalse(cSVFormat4.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat4.isNullHandling()); assertFalse(cSVFormat4.isCommentingEnabled()); assertFalse(cSVFormat4.isEscaping()); assertEquals('Y', (char)cSVFormat4.getQuoteChar()); assertFalse(cSVFormat4.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test022() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withNullString(""); String[] stringArray0 = new String[5]; CSVFormat cSVFormat2 = cSVFormat1.withHeader(stringArray0); assertEquals("\r\n", cSVFormat2.getRecordSeparator()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals(',', cSVFormat1.getDelimiter()); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.isCommentingEnabled()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat2.isEscaping()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals("", cSVFormat2.getNullString()); } @Test(timeout = 4000) public void test023() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('l'); CSVFormat cSVFormat2 = cSVFormat1.withHeader((String[]) null); assertTrue(cSVFormat2.equals((Object)cSVFormat1)); assertFalse(cSVFormat2.isEscaping()); assertEquals('l', (char)cSVFormat2.getCommentStart()); assertTrue(cSVFormat2.isQuoting()); assertEquals('\"', (char)cSVFormat2.getQuoteChar()); assertFalse(cSVFormat2.isNullHandling()); } @Test(timeout = 4000) public void test024() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); String[] stringArray0 = new String[6]; CSVFormat cSVFormat2 = cSVFormat1.withHeader(stringArray0); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat2.isCommentingEnabled()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertTrue(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat2.isEscaping()); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.isNullHandling()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test025() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withNullString(""); CSVFormat cSVFormat2 = cSVFormat1.withIgnoreEmptyLines(true); Character character0 = Character.valueOf('%'); CSVFormat cSVFormat3 = cSVFormat2.withEscape(character0); assertFalse(cSVFormat3.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat3.equals((Object)cSVFormat2)); assertTrue(cSVFormat2.isQuoting()); assertTrue(cSVFormat2.getIgnoreEmptyLines()); assertEquals("", cSVFormat3.getNullString()); assertEquals(',', cSVFormat3.getDelimiter()); assertEquals("\r\n", cSVFormat3.getRecordSeparator()); assertFalse(cSVFormat3.getSkipHeaderRecord()); assertFalse(cSVFormat3.isCommentingEnabled()); } @Test(timeout = 4000) public void test026() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); CSVFormat cSVFormat2 = cSVFormat1.withEscape((Character) null); assertTrue(cSVFormat2.getSkipHeaderRecord()); assertFalse(cSVFormat2.isEscaping()); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.getIgnoreEmptyLines()); assertFalse(cSVFormat2.isNullHandling()); assertFalse(cSVFormat2.isCommentingEnabled()); assertTrue(cSVFormat2.equals((Object)cSVFormat1)); assertFalse(cSVFormat2.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test027() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; Character character0 = new Character('b'); CSVFormat cSVFormat1 = cSVFormat0.withEscape(character0); assertFalse(cSVFormat1.isNullHandling()); assertTrue(cSVFormat1.isEscaping()); assertEquals('b', (char)cSVFormat1.getEscape()); assertTrue(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals('\"', (char)cSVFormat1.getQuoteChar()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertEquals('\t', cSVFormat1.getDelimiter()); } @Test(timeout = 4000) public void test028() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withNullString(""); CSVFormat cSVFormat2 = cSVFormat1.withIgnoreEmptyLines(true); CSVFormat cSVFormat3 = cSVFormat2.withEscape(':'); assertTrue(cSVFormat3.isEscaping()); assertTrue(cSVFormat2.getIgnoreEmptyLines()); assertFalse(cSVFormat3.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat3.isCommentingEnabled()); assertEquals("\r\n", cSVFormat3.getRecordSeparator()); assertTrue(cSVFormat2.isQuoting()); assertEquals("", cSVFormat3.getNullString()); assertEquals(',', cSVFormat3.getDelimiter()); assertEquals(':', (char)cSVFormat3.getEscape()); assertFalse(cSVFormat3.getSkipHeaderRecord()); } @Test(timeout = 4000) public void test029() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; CSVFormat cSVFormat1 = cSVFormat0.withEscape('y'); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertTrue(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals('y', (char)cSVFormat1.getEscape()); assertEquals('\"', (char)cSVFormat1.getQuoteChar()); assertEquals('\t', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.isNullHandling()); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isCommentingEnabled()); } @Test(timeout = 4000) public void test030() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withNullString("pr&r1}H"); CSVFormat cSVFormat2 = cSVFormat1.withDelimiter('/'); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals("pr&r1}H", cSVFormat2.getNullString()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat2.isCommentingEnabled()); assertEquals('/', cSVFormat2.getDelimiter()); assertEquals("\r\n", cSVFormat2.getRecordSeparator()); assertFalse(cSVFormat2.isEscaping()); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test031() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('{'); CSVFormat cSVFormat2 = cSVFormat1.withDelimiter('{'); assertFalse(cSVFormat2.isEscaping()); assertEquals('\"', (char)cSVFormat2.getQuoteChar()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertEquals('{', cSVFormat2.getDelimiter()); assertEquals('{', (char)cSVFormat2.getCommentStart()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat2.isNullHandling()); assertTrue(cSVFormat2.isQuoting()); } @Test(timeout = 4000) public void test032() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); CSVFormat cSVFormat2 = cSVFormat1.withDelimiter('^'); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertTrue(cSVFormat1.getSkipHeaderRecord()); assertEquals('^', cSVFormat2.getDelimiter()); assertFalse(cSVFormat2.isQuoting()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertTrue(cSVFormat2.isEscaping()); assertFalse(cSVFormat2.isNullHandling()); } @Test(timeout = 4000) public void test033() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; CSVFormat cSVFormat1 = cSVFormat0.withDelimiter('e'); assertEquals('e', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isEscaping()); assertTrue(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test034() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('z'); CSVFormat cSVFormat1 = cSVFormat0.withNullString(":Td8q?O4uX_68{-r"); CSVFormat cSVFormat2 = cSVFormat1.withCommentStart((Character) null); assertTrue(cSVFormat2.isNullHandling()); assertTrue(cSVFormat2.equals((Object)cSVFormat1)); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertEquals('z', cSVFormat2.getDelimiter()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat2.getSkipHeaderRecord()); } @Test(timeout = 4000) public void test035() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; Character character0 = new Character('l'); CSVFormat cSVFormat1 = cSVFormat0.MYSQL.withCommentStart(character0); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertEquals('\t', cSVFormat1.getDelimiter()); assertEquals('\\', (char)cSVFormat1.getEscape()); assertTrue(cSVFormat1.isCommentingEnabled()); } @Test(timeout = 4000) public void test036() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); Character character0 = new Character('?'); CSVFormat cSVFormat2 = cSVFormat1.withQuoteChar(character0); Quote quote0 = Quote.NON_NUMERIC; CSVFormat cSVFormat3 = cSVFormat2.withQuotePolicy(quote0); CSVFormat cSVFormat4 = cSVFormat3.withCommentStart(character0); assertFalse(cSVFormat3.getIgnoreEmptyLines()); assertFalse(cSVFormat3.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat3.isCommentingEnabled()); assertTrue(cSVFormat3.getSkipHeaderRecord()); assertFalse(cSVFormat4.isNullHandling()); assertFalse(cSVFormat4.isEscaping()); assertEquals(',', cSVFormat3.getDelimiter()); assertTrue(cSVFormat3.isQuoting()); } @Test(timeout = 4000) public void test037() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; CSVFormat cSVFormat1 = cSVFormat0.withNullString("`&f<`.3t$UR"); CSVFormat cSVFormat2 = cSVFormat1.withRecordSeparator('d'); CSVFormat cSVFormat3 = cSVFormat2.withCommentStart(')'); assertTrue(cSVFormat3.getIgnoreEmptyLines()); assertTrue(cSVFormat3.getIgnoreSurroundingSpaces()); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat3.isEscaping()); assertFalse(cSVFormat3.getSkipHeaderRecord()); assertEquals(')', (char)cSVFormat3.getCommentStart()); assertEquals("`&f<`.3t$UR", cSVFormat3.getNullString()); assertEquals("d", cSVFormat3.getRecordSeparator()); assertEquals('\t', cSVFormat3.getDelimiter()); } @Test(timeout = 4000) public void test038() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); CSVFormat cSVFormat2 = cSVFormat1.withCommentStart('0'); CSVFormat cSVFormat3 = cSVFormat2.withRecordSeparator((String) null); CSVFormat cSVFormat4 = cSVFormat3.withEscape('0'); assertEquals(',', cSVFormat3.getDelimiter()); assertEquals('0', (char)cSVFormat4.getEscape()); assertEquals('\"', (char)cSVFormat4.getQuoteChar()); assertTrue(cSVFormat3.getSkipHeaderRecord()); assertFalse(cSVFormat3.isEscaping()); assertFalse(cSVFormat3.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat3.equals((Object)cSVFormat2)); assertFalse(cSVFormat2.isNullHandling()); assertEquals('0', (char)cSVFormat4.getCommentStart()); assertFalse(cSVFormat3.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test039() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; String[] stringArray0 = new String[0]; CSVFormat cSVFormat1 = cSVFormat0.withHeader(stringArray0); StringReader stringReader0 = new StringReader("H1GW\"*[B)}!poj7C_"); cSVFormat1.parse(stringReader0); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.isNullHandling()); assertTrue(cSVFormat1.isEscaping()); } @Test(timeout = 4000) public void test040() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.MYSQL.withSkipHeaderRecord(true); boolean boolean0 = cSVFormat1.getSkipHeaderRecord(); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isQuoting()); assertTrue(boolean0); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); } @Test(timeout = 4000) public void test041() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withRecordSeparator((String) null); cSVFormat1.getRecordSeparator(); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isCommentingEnabled()); } @Test(timeout = 4000) public void test042() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; Quote quote0 = Quote.ALL; CSVFormat cSVFormat1 = cSVFormat0.withQuotePolicy(quote0); CSVFormat cSVFormat2 = cSVFormat1.withNullString(""); cSVFormat2.getQuotePolicy(); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat2.isCommentingEnabled()); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat2.isEscaping()); assertTrue(cSVFormat2.isQuoting()); assertEquals("\r\n", cSVFormat2.getRecordSeparator()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertEquals("", cSVFormat2.getNullString()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test043() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; Character character0 = cSVFormat0.getQuoteChar(); assertEquals('\"', (char)character0); } @Test(timeout = 4000) public void test044() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withQuoteChar('9'); Character character0 = cSVFormat1.getQuoteChar(); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertNotNull(character0); assertFalse(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.isCommentingEnabled()); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals('9', (char)character0); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test045() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withQuoteChar('O'); Character character0 = cSVFormat1.getQuoteChar(); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertEquals('O', (char)character0); assertEquals('\\', (char)cSVFormat1.getEscape()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertNotNull(character0); } @Test(timeout = 4000) public void test046() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withNullString("z(8J@6#hc!U$~Rg"); cSVFormat1.getNullString(); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test047() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withNullString(""); String string0 = cSVFormat1.getNullString(); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals("", string0); assertFalse(cSVFormat1.isEscaping()); assertTrue(cSVFormat1.isQuoting()); assertEquals(',', cSVFormat1.getDelimiter()); assertEquals("\r\n", cSVFormat1.getRecordSeparator()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test048() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; boolean boolean0 = cSVFormat0.getIgnoreSurroundingSpaces(); assertTrue(boolean0); } @Test(timeout = 4000) public void test049() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.TDF.withRecordSeparator((String) null); boolean boolean0 = cSVFormat1.getIgnoreEmptyLines(); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertTrue(boolean0); assertEquals('\t', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.getIgnoreSurroundingSpaces()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.isEscaping()); } @Test(timeout = 4000) public void test050() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; String[] stringArray0 = new String[7]; CSVFormat cSVFormat1 = cSVFormat0.withHeader(stringArray0); cSVFormat1.getHeader(); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.isQuoting()); assertEquals('\t', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test051() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; Character character0 = cSVFormat0.getEscape(); assertEquals('\\', (char)character0); } @Test(timeout = 4000) public void test052() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withEscape('0'); Character character0 = cSVFormat1.getEscape(); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.isCommentingEnabled()); assertEquals('\"', (char)cSVFormat1.getQuoteChar()); assertFalse(cSVFormat1.isNullHandling()); assertEquals(',', cSVFormat1.getDelimiter()); assertNotNull(character0); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals('0', (char)character0); } @Test(timeout = 4000) public void test053() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withEscape('B'); Character character0 = cSVFormat1.getEscape(); assertEquals('B', (char)character0); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.isQuoting()); assertNotNull(character0); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals('\t', cSVFormat1.getDelimiter()); } @Test(timeout = 4000) public void test054() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('6'); char char0 = cSVFormat0.getDelimiter(); assertFalse(cSVFormat0.getIgnoreEmptyLines()); assertEquals('6', char0); assertFalse(cSVFormat0.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat0.getSkipHeaderRecord()); } @Test(timeout = 4000) public void test055() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('N'); char char0 = cSVFormat0.getDelimiter(); assertEquals('N', char0); assertFalse(cSVFormat0.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat0.getSkipHeaderRecord()); assertFalse(cSVFormat0.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test056() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; Character character0 = Character.valueOf('|'); CSVFormat cSVFormat1 = cSVFormat0.TDF.withCommentStart(character0); Character character1 = cSVFormat1.getCommentStart(); assertFalse(cSVFormat1.isEscaping()); assertEquals('|', (char)character1); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals('\t', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertTrue(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals('\"', (char)cSVFormat1.getQuoteChar()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isNullHandling()); } @Test(timeout = 4000) public void test057() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('0'); Character character0 = cSVFormat1.getCommentStart(); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals('0', (char)character0); assertFalse(cSVFormat1.isEscaping()); assertEquals(',', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.isQuoting()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals('\"', (char)cSVFormat1.getQuoteChar()); } @Test(timeout = 4000) public void test058() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.MYSQL.withCommentStart('N'); Character character0 = cSVFormat1.getCommentStart(); assertFalse(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertNotNull(character0); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertEquals('\\', (char)cSVFormat1.getEscape()); assertFalse(cSVFormat1.isNullHandling()); assertEquals('N', (char)character0); assertTrue(cSVFormat1.isEscaping()); } @Test(timeout = 4000) public void test059() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; // Undeclared exception! try { cSVFormat0.withQuoteChar('\r'); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // The quoteChar cannot be a line break // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test060() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; // Undeclared exception! try { cSVFormat0.EXCEL.withEscape('\r'); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // The escape character cannot be a line break // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test061() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; // Undeclared exception! try { cSVFormat0.withCommentStart('\n'); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // The comment start character cannot be a line break // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test062() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; // Undeclared exception! try { cSVFormat0.parse((Reader) null); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // Parameter 'reader' must not be null! // verifyException("org.apache.commons.csv.Assertions", e); } } @Test(timeout = 4000) public void test063() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; boolean boolean0 = cSVFormat0.isQuoting(); assertTrue(boolean0); } @Test(timeout = 4000) public void test064() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.MYSQL.withSkipHeaderRecord(true); boolean boolean0 = cSVFormat1.isQuoting(); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertTrue(cSVFormat1.isEscaping()); assertFalse(boolean0); assertFalse(cSVFormat1.isNullHandling()); assertEquals('\t', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.getSkipHeaderRecord()); } @Test(timeout = 4000) public void test065() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; boolean boolean0 = cSVFormat0.isNullHandling(); assertFalse(boolean0); } @Test(timeout = 4000) public void test066() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; boolean boolean0 = cSVFormat0.isEscaping(); assertTrue(boolean0); } @Test(timeout = 4000) public void test067() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; boolean boolean0 = cSVFormat0.isEscaping(); assertFalse(boolean0); } @Test(timeout = 4000) public void test068() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('='); boolean boolean0 = cSVFormat0.isCommentingEnabled(); assertFalse(boolean0); assertFalse(cSVFormat0.getIgnoreEmptyLines()); assertFalse(cSVFormat0.getIgnoreSurroundingSpaces()); assertEquals('=', cSVFormat0.getDelimiter()); assertFalse(cSVFormat0.getSkipHeaderRecord()); } @Test(timeout = 4000) public void test069() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('7'); cSVFormat0.getHeader(); assertEquals('7', cSVFormat0.getDelimiter()); assertFalse(cSVFormat0.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat0.getIgnoreEmptyLines()); assertFalse(cSVFormat0.getSkipHeaderRecord()); } @Test(timeout = 4000) public void test070() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; boolean boolean0 = cSVFormat0.getIgnoreSurroundingSpaces(); assertFalse(boolean0); } @Test(timeout = 4000) public void test071() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; cSVFormat0.getQuotePolicy(); } @Test(timeout = 4000) public void test072() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; Character character0 = cSVFormat0.getQuoteChar(); assertNull(character0); } @Test(timeout = 4000) public void test073() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; String string0 = cSVFormat0.getNullString(); assertNull(string0); } @Test(timeout = 4000) public void test074() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; Character character0 = cSVFormat0.getCommentStart(); assertNull(character0); } @Test(timeout = 4000) public void test075() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; boolean boolean0 = cSVFormat0.getIgnoreEmptyLines(); assertFalse(boolean0); } @Test(timeout = 4000) public void test076() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; String string0 = cSVFormat0.getRecordSeparator(); assertEquals("\r\n", string0); } @Test(timeout = 4000) public void test077() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; Character character0 = cSVFormat0.getEscape(); assertNull(character0); } @Test(timeout = 4000) public void test078() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; char char0 = cSVFormat0.getDelimiter(); assertEquals(',', char0); } @Test(timeout = 4000) public void test079() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; Character character0 = Character.valueOf('\r'); // Undeclared exception! try { cSVFormat0.withQuoteChar(character0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // The quoteChar cannot be a line break // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test080() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; Character character0 = Character.valueOf('\r'); // Undeclared exception! try { cSVFormat0.MYSQL.withEscape(character0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // The escape character cannot be a line break // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test081() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('6'); String[] stringArray0 = new String[3]; CSVFormat cSVFormat1 = cSVFormat0.MYSQL.withHeader(stringArray0); // Undeclared exception! try { cSVFormat1.format(stringArray0); fail("Expecting exception: IllegalStateException"); } catch(IllegalStateException e) { // // The header contains duplicate names: [null, null, null] // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test082() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; String[] stringArray0 = new String[0]; CSVFormat cSVFormat1 = cSVFormat0.withHeader(stringArray0); assertFalse(cSVFormat1.isCommentingEnabled()); cSVFormat1.format(stringArray0); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.isQuoting()); assertEquals('\t', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test083() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; Quote quote0 = Quote.NONE; CSVFormat cSVFormat1 = cSVFormat0.withQuotePolicy(quote0); Object[] objectArray0 = new Object[2]; // Undeclared exception! try { cSVFormat1.format(objectArray0); fail("Expecting exception: IllegalStateException"); } catch(IllegalStateException e) { // // No quotes mode set but no escape character is set // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test084() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('7'); Character character0 = Character.valueOf('7'); CSVFormat cSVFormat2 = cSVFormat1.withEscape(character0); Object[] objectArray0 = new Object[5]; // Undeclared exception! try { cSVFormat2.format(objectArray0); fail("Expecting exception: IllegalStateException"); } catch(IllegalStateException e) { // // The comment start and the escape character cannot be the same ('7') // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test085() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('4'); CSVFormat cSVFormat2 = cSVFormat1.withQuoteChar('4'); try { cSVFormat2.validate(); fail("Expecting exception: IllegalStateException"); } catch(IllegalStateException e) { // // The comment start character and the quoteChar cannot be the same ('4') // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test086() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('$'); CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('$'); StringReader stringReader0 = new StringReader("Escape=<"); // Undeclared exception! try { cSVFormat1.parse(stringReader0); fail("Expecting exception: IllegalStateException"); } catch(IllegalStateException e) { // // The comment start character and the delimiter cannot be the same ('$') // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test087() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('{'); CSVFormat cSVFormat2 = cSVFormat1.withRecordSeparator((String) null); // Undeclared exception! try { cSVFormat2.format((Object[]) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.csv.CSVPrinter", e); } } @Test(timeout = 4000) public void test088() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withDelimiter('/'); CSVFormat cSVFormat2 = cSVFormat1.withEscape('/'); try { cSVFormat2.validate(); fail("Expecting exception: IllegalStateException"); } catch(IllegalStateException e) { // // The escape character and the delimiter cannot be the same ('/') // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test089() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; Character character0 = Character.valueOf('+'); CSVFormat cSVFormat1 = cSVFormat0.withQuoteChar(character0); CSVFormat cSVFormat2 = cSVFormat1.withDelimiter('+'); try { cSVFormat2.validate(); fail("Expecting exception: IllegalStateException"); } catch(IllegalStateException e) { // // The quoteChar character and the delimiter cannot be the same ('+') // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test090() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('1'); String string0 = cSVFormat0.toString(); assertEquals("Delimiter=<1> SkipHeaderRecord:false", string0); } @Test(timeout = 4000) public void test091() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withNullString(""); String string0 = cSVFormat1.toString(); assertEquals("Delimiter=<,> QuoteChar=<\"> NullString=<> RecordSeparator=<\r\n> SkipHeaderRecord:false", string0); } @Test(timeout = 4000) public void test092() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; Character character0 = new Character(':'); CSVFormat cSVFormat1 = cSVFormat0.withCommentStart(character0); String string0 = cSVFormat1.toString(); assertEquals("Delimiter=<,> QuoteChar=<\"> CommentStart=<:> RecordSeparator=<\r\n> SkipHeaderRecord:false", string0); } @Test(timeout = 4000) public void test093() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withNullString("YH]bI[.n6^1r1WP"); boolean boolean0 = cSVFormat1.isNullHandling(); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertEquals("\r\n", cSVFormat1.getRecordSeparator()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals(',', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.isQuoting()); assertEquals("YH]bI[.n6^1r1WP", cSVFormat1.getNullString()); assertFalse(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertTrue(boolean0); } @Test(timeout = 4000) public void test094() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; String[] stringArray0 = new String[0]; CSVFormat cSVFormat1 = cSVFormat0.MYSQL.withHeader(stringArray0); String string0 = cSVFormat1.toString(); assertEquals("Delimiter=<\t> Escape=<\\> RecordSeparator=<\n> SkipHeaderRecord:false Header:[]", string0); } @Test(timeout = 4000) public void test095() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('7'); CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('?'); boolean boolean0 = cSVFormat1.isCommentingEnabled(); assertTrue(boolean0); assertFalse(cSVFormat0.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat0.getIgnoreEmptyLines()); assertFalse(cSVFormat1.isEscaping()); assertFalse(cSVFormat0.getSkipHeaderRecord()); assertEquals('?', (char)cSVFormat1.getCommentStart()); assertFalse(cSVFormat1.isQuoting()); assertEquals('7', cSVFormat0.getDelimiter()); } @Test(timeout = 4000) public void test096() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; String string0 = cSVFormat0.toString(); assertEquals("Delimiter=<\t> QuoteChar=<\"> RecordSeparator=<\r\n> EmptyLines:ignored SurroundingSpaces:ignored SkipHeaderRecord:false", string0); } @Test(timeout = 4000) public void test097() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('C'); cSVFormat0.hashCode(); assertFalse(cSVFormat0.getSkipHeaderRecord()); assertEquals('C', cSVFormat0.getDelimiter()); assertFalse(cSVFormat0.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test098() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); cSVFormat1.hashCode(); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isEscaping()); assertTrue(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.isNullHandling()); } @Test(timeout = 4000) public void test099() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; cSVFormat0.hashCode(); } @Test(timeout = 4000) public void test100() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withNullString("`&f<`.3t$UR"); cSVFormat1.hashCode(); assertTrue(cSVFormat1.isEscaping()); assertEquals("\n", cSVFormat1.getRecordSeparator()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test101() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.RFC4180.withCommentStart('.'); cSVFormat1.hashCode(); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertTrue(cSVFormat1.isQuoting()); assertEquals('\"', (char)cSVFormat1.getQuoteChar()); assertTrue(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals('.', (char)cSVFormat1.getCommentStart()); } @Test(timeout = 4000) public void test102() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; Quote quote0 = Quote.ALL; CSVFormat cSVFormat1 = cSVFormat0.withQuotePolicy(quote0); cSVFormat1.hashCode(); assertTrue(cSVFormat1.isQuoting()); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test103() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; String[] stringArray0 = new String[0]; CSVFormat cSVFormat1 = cSVFormat0.withHeader(stringArray0); cSVFormat1.getHeader(); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.isCommentingEnabled()); assertTrue(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertEquals('\t', cSVFormat1.getDelimiter()); } @Test(timeout = 4000) public void test104() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withRecordSeparator((String) null); boolean boolean0 = cSVFormat1.equals(cSVFormat0); assertTrue(cSVFormat1.isQuoting()); assertFalse(boolean0); assertFalse(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test105() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withRecordSeparator((String) null); CSVFormat cSVFormat2 = cSVFormat1.withDelimiter('{'); CSVFormat cSVFormat3 = cSVFormat2.withIgnoreSurroundingSpaces(false); boolean boolean0 = cSVFormat3.equals(cSVFormat2); assertTrue(cSVFormat2.getIgnoreEmptyLines()); assertTrue(cSVFormat3.isQuoting()); assertFalse(cSVFormat3.isCommentingEnabled()); assertFalse(cSVFormat3.getSkipHeaderRecord()); assertEquals('{', cSVFormat3.getDelimiter()); assertFalse(cSVFormat2.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.equals((Object)cSVFormat3)); assertFalse(cSVFormat3.equals((Object)cSVFormat1)); assertTrue(boolean0); assertFalse(cSVFormat3.isEscaping()); } @Test(timeout = 4000) public void test106() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); boolean boolean0 = cSVFormat0.equals(cSVFormat1); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(boolean0); assertFalse(cSVFormat1.isCommentingEnabled()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test107() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = CSVFormat.DEFAULT; boolean boolean0 = cSVFormat1.equals(cSVFormat0); assertFalse(boolean0); } @Test(timeout = 4000) public void test108() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; CSVFormat cSVFormat1 = cSVFormat0.withNullString("`&f<`.3t$UR"); CSVFormat cSVFormat2 = cSVFormat1.withIgnoreSurroundingSpaces(false); boolean boolean0 = cSVFormat2.equals(cSVFormat1); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.getIgnoreSurroundingSpaces()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat2.isCommentingEnabled()); assertTrue(cSVFormat2.getIgnoreEmptyLines()); assertFalse(boolean0); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertEquals("`&f<`.3t$UR", cSVFormat2.getNullString()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat2.isEscaping()); } @Test(timeout = 4000) public void test109() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withNullString("`&f<`.3t$UR"); CSVFormat cSVFormat2 = CSVFormat.MYSQL; boolean boolean0 = cSVFormat2.equals(cSVFormat1); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.isQuoting()); assertEquals("`&f<`.3t$UR", cSVFormat1.getNullString()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(boolean0); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.isCommentingEnabled()); assertEquals("\n", cSVFormat1.getRecordSeparator()); } @Test(timeout = 4000) public void test110() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withNullString("z(8J@6#hc!U$~Rg"); boolean boolean0 = cSVFormat1.equals(cSVFormat0); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isQuoting()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(boolean0); assertFalse(cSVFormat1.isCommentingEnabled()); } @Test(timeout = 4000) public void test111() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withEscape('L'); boolean boolean0 = cSVFormat0.equals(cSVFormat1); assertFalse(cSVFormat1.isCommentingEnabled()); assertEquals('L', (char)cSVFormat1.getEscape()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(boolean0); assertTrue(cSVFormat1.isQuoting()); assertEquals(',', cSVFormat1.getDelimiter()); } @Test(timeout = 4000) public void test112() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('%'); boolean boolean0 = cSVFormat1.equals(cSVFormat0); assertFalse(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(boolean0); assertTrue(cSVFormat1.isQuoting()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.isNullHandling()); assertEquals(',', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals('\"', (char)cSVFormat1.getQuoteChar()); assertEquals('%', (char)cSVFormat1.getCommentStart()); } @Test(timeout = 4000) public void test113() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('e'); boolean boolean0 = cSVFormat0.equals(cSVFormat1); assertTrue(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertEquals('\"', (char)cSVFormat1.getQuoteChar()); assertEquals('e', (char)cSVFormat1.getCommentStart()); assertEquals('\t', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isEscaping()); assertFalse(boolean0); } @Test(timeout = 4000) public void test114() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; CSVFormat cSVFormat1 = cSVFormat0.withQuoteChar('?'); boolean boolean0 = cSVFormat1.equals(cSVFormat0); assertTrue(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat0.equals((Object)cSVFormat1)); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.isCommentingEnabled()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals('\t', cSVFormat1.getDelimiter()); assertEquals('?', (char)cSVFormat1.getQuoteChar()); assertFalse(boolean0); } @Test(timeout = 4000) public void test115() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withRecordSeparator(""); boolean boolean0 = cSVFormat0.equals(cSVFormat1); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.isCommentingEnabled()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(boolean0); } @Test(timeout = 4000) public void test116() throws Throwable { Character character0 = Character.valueOf('s'); CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withQuoteChar(character0); boolean boolean0 = cSVFormat0.equals(cSVFormat1); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals('s', (char)cSVFormat1.getQuoteChar()); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(boolean0); assertEquals('\\', (char)cSVFormat1.getEscape()); assertEquals('\t', cSVFormat1.getDelimiter()); } @Test(timeout = 4000) public void test117() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; Character character0 = Character.valueOf('s'); CSVFormat cSVFormat1 = cSVFormat0.withEscape(character0); boolean boolean0 = cSVFormat1.equals(cSVFormat0); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals('s', (char)cSVFormat1.getEscape()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.isNullHandling()); assertEquals(',', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(boolean0); assertEquals('\"', (char)cSVFormat1.getQuoteChar()); } @Test(timeout = 4000) public void test118() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; Character character0 = new Character('1'); CSVFormat cSVFormat1 = cSVFormat0.withDelimiter(':'); CSVFormat cSVFormat2 = cSVFormat0.withQuoteChar(character0); boolean boolean0 = cSVFormat2.equals(cSVFormat1); assertFalse(cSVFormat2.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat2.isEscaping()); assertFalse(cSVFormat2.getIgnoreEmptyLines()); assertFalse(cSVFormat1.equals((Object)cSVFormat0)); assertFalse(cSVFormat0.equals((Object)cSVFormat1)); assertEquals(':', cSVFormat1.getDelimiter()); assertTrue(cSVFormat2.isQuoting()); assertFalse(cSVFormat2.getSkipHeaderRecord()); assertFalse(cSVFormat2.isCommentingEnabled()); assertFalse(cSVFormat2.isNullHandling()); assertFalse(boolean0); } @Test(timeout = 4000) public void test119() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; Object object0 = new Object(); boolean boolean0 = cSVFormat0.equals(object0); assertFalse(boolean0); } @Test(timeout = 4000) public void test120() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; boolean boolean0 = cSVFormat0.equals((Object) null); assertFalse(boolean0); } @Test(timeout = 4000) public void test121() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; boolean boolean0 = cSVFormat0.equals(cSVFormat0); assertTrue(boolean0); } @Test(timeout = 4000) public void test122() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; Character character0 = new Character('\r'); // Undeclared exception! try { cSVFormat0.withCommentStart(character0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // The comment start character cannot be a line break // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test123() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; // Undeclared exception! try { cSVFormat0.withDelimiter('\r'); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // The delimiter cannot be a line break // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test124() throws Throwable { // Undeclared exception! try { CSVFormat.newFormat('\n'); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // The delimiter cannot be a line break // verifyException("org.apache.commons.csv.CSVFormat", e); } } @Test(timeout = 4000) public void test125() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; CSVFormat cSVFormat1 = cSVFormat0.withRecordSeparator(':'); assertFalse(cSVFormat1.isQuoting()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals(":", cSVFormat1.getRecordSeparator()); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); } @Test(timeout = 4000) public void test126() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; String[] stringArray0 = new String[0]; CSVFormat cSVFormat1 = cSVFormat0.withHeader(stringArray0); boolean boolean0 = cSVFormat1.equals(cSVFormat0); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertEquals('\t', cSVFormat1.getDelimiter()); assertFalse(boolean0); assertFalse(cSVFormat1.isQuoting()); assertTrue(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); } @Test(timeout = 4000) public void test127() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; CSVFormat cSVFormat1 = cSVFormat0.withIgnoreEmptyLines(true); assertTrue(cSVFormat1.equals((Object)cSVFormat0)); } @Test(timeout = 4000) public void test128() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; Object[] objectArray0 = new Object[5]; String string0 = cSVFormat0.format(objectArray0); assertEquals("\"\",,,,", string0); } @Test(timeout = 4000) public void test129() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withCommentStart('{'); CSVFormat cSVFormat2 = cSVFormat1.withIgnoreSurroundingSpaces(false); boolean boolean0 = cSVFormat2.equals(cSVFormat1); assertFalse(cSVFormat2.isEscaping()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertEquals('{', (char)cSVFormat2.getCommentStart()); assertTrue(boolean0); assertTrue(cSVFormat2.getIgnoreEmptyLines()); assertFalse(cSVFormat2.getSkipHeaderRecord()); assertFalse(cSVFormat2.equals((Object)cSVFormat0)); assertFalse(cSVFormat2.isNullHandling()); assertEquals('\"', (char)cSVFormat2.getQuoteChar()); } @Test(timeout = 4000) public void test130() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; Quote quote0 = Quote.NON_NUMERIC; CSVFormat cSVFormat1 = cSVFormat0.withQuotePolicy(quote0); boolean boolean0 = cSVFormat0.equals(cSVFormat1); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isEscaping()); assertFalse(boolean0); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isNullHandling()); assertEquals(',', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertFalse(cSVFormat1.getSkipHeaderRecord()); assertFalse(cSVFormat1.isCommentingEnabled()); } @Test(timeout = 4000) public void test131() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withRecordSeparator(""); String string0 = cSVFormat1.getRecordSeparator(); assertFalse(cSVFormat1.isNullHandling()); assertFalse(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isCommentingEnabled()); assertFalse(cSVFormat1.isEscaping()); assertNotNull(string0); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertEquals(',', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.getSkipHeaderRecord()); } @Test(timeout = 4000) public void test132() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.TDF; CSVFormat cSVFormat1 = cSVFormat0.withSkipHeaderRecord(true); assertTrue(cSVFormat1.getIgnoreSurroundingSpaces()); assertFalse(cSVFormat1.isNullHandling()); assertTrue(cSVFormat1.getIgnoreEmptyLines()); assertEquals('\t', cSVFormat1.getDelimiter()); assertTrue(cSVFormat1.getSkipHeaderRecord()); assertTrue(cSVFormat1.isQuoting()); assertFalse(cSVFormat1.isEscaping()); assertFalse(cSVFormat1.isCommentingEnabled()); } @Test(timeout = 4000) public void test133() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('7'); boolean boolean0 = cSVFormat0.getSkipHeaderRecord(); assertFalse(boolean0); assertFalse(cSVFormat0.getIgnoreEmptyLines()); assertFalse(cSVFormat0.getIgnoreSurroundingSpaces()); assertEquals('7', cSVFormat0.getDelimiter()); } @Test(timeout = 4000) public void test134() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; StringReader stringReader0 = new StringReader("H1GW\"*[B)}!poj7C_"); CSVParser cSVParser0 = cSVFormat0.parse(stringReader0); assertEquals(0L, cSVParser0.getRecordNumber()); } }
0db49d1faab4f50deed920678da9386ea7557e5f
02f14b4d2fee6364bec06fba7158aa19d20d3b51
/src/main/java/org/sourcelab/storm/spout/redis/client/Consumer.java
c9f412024b0ab1bdd0ccf21be997cce99d8b7c00
[ "MIT" ]
permissive
SourceLabOrg/RedisStreams-StormSpout
52696c5c5e86b8e78a6db9aa0be97a7a7f62b0c5
dc5e997c1de6d33409c90e37b8d37032810b6012
refs/heads/master
2022-12-13T03:46:41.749588
2020-07-24T01:19:41
2020-07-24T01:19:41
278,319,295
4
0
MIT
2020-07-24T01:08:45
2020-07-09T09:20:19
Java
UTF-8
Java
false
false
3,183
java
package org.sourcelab.storm.spout.redis.client; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sourcelab.storm.spout.redis.Message; import org.sourcelab.storm.spout.redis.RedisStreamSpoutConfig; import org.sourcelab.storm.spout.redis.funnel.ConsumerFunnel; import java.util.List; import java.util.Objects; /** * Background Processing Thread handling Consuming from a Redis Stream Client. */ public class Consumer implements Runnable { private static final Logger logger = LoggerFactory.getLogger(Consumer.class); /** * Configuration properties for the client. */ private final RedisStreamSpoutConfig config; /** * The underlying Redis Client. */ private final Client redisClient; /** * For thread safe communication between this client thread and the spout thread. */ private final ConsumerFunnel funnel; /** * Protected constructor for injecting a RedisClient instance, typically for tests. * @param config Spout configuration properties. * @param redisClient RedisClient instance. * @param funnel Funnel instance. */ public Consumer(final RedisStreamSpoutConfig config, final Client redisClient, final ConsumerFunnel funnel) { this.config = Objects.requireNonNull(config); this.redisClient = Objects.requireNonNull(redisClient); this.funnel = Objects.requireNonNull(funnel); } /** * Intended to be run by a background processing Thread. * This will continue running and not return until the Funnel has notified * this thread to stop. */ @Override public void run() { // Connect redisClient.connect(); // flip running flag. funnel.setIsRunning(true); logger.info("Starting to consume new messages from {}", config.getStreamKey()); while (!funnel.shouldStop()) { final List<Message> messages = redisClient.nextMessages(); // Loop over each message messages // Push into the funnel. // This operation can block if the queue is full. .forEach(funnel::addMessage); // process acks String msgId = funnel.nextAck(); while (msgId != null) { // Confirm that the message has been processed using XACK redisClient.commitMessage(msgId); // Grab next msg to ack. msgId = funnel.nextAck(); } // If configured with a delay if (config.getConsumerDelayMillis() > 0) { // Small delay. try { Thread.sleep(config.getConsumerDelayMillis()); } catch (final InterruptedException exception) { logger.info("Caught interrupt, stopping consumer", exception); break; } } } logger.info("Spout Requested Shutdown..."); // Close our connection and shutdown. redisClient.disconnect(); // Flip running flag to false to signal to spout. funnel.setIsRunning(false); } }
c5a9ade0e2e78fb2440cb255fe45e308a2daa843
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_619947c20452908a000946982f70ec8e2b948bf8/QueryLookupController/2_619947c20452908a000946982f70ec8e2b948bf8_QueryLookupController_s.java
7576f08addcdccde2acfea0585027d1e0984530e
[]
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
2,824
java
package com.mpower.controller; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.support.PagedListHolder; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; import com.mpower.domain.QueryLookup; import com.mpower.service.QueryLookupService; import com.mpower.service.SessionServiceImpl; public class QueryLookupController implements Controller { /** Logger for this class and subclasses */ protected final Log logger = LogFactory.getLog(getClass()); private QueryLookupService queryLookupService; public void setQueryLookupService(QueryLookupService queryLookupService) { this.queryLookupService = queryLookupService; } @SuppressWarnings("unchecked") @Override public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { Map<String, String> queryParams = new HashMap<String, String>(); Enumeration<String> enu = request.getParameterNames(); while (enu.hasMoreElements()) { String param = enu.nextElement(); String paramValue = StringUtils.trimToNull(request.getParameter(param)); if (paramValue != null && !param.equalsIgnoreCase("fieldDef") && !param.equalsIgnoreCase("view")) { queryParams.put(param, paramValue); } } // List<String> displayColumns = new ArrayList<String>(); // displayColumns.add("lastName"); // displayColumns.add("firstName"); String fieldDef = StringUtils.trimToNull(request.getParameter("fieldDef")); QueryLookup queryLookup = queryLookupService.readQueryLookup(SessionServiceImpl.lookupUserSiteName(), fieldDef); List<Object> objects = queryLookupService.executeQueryLookup(SessionServiceImpl.lookupUserSiteName(), fieldDef, queryParams); ModelAndView mav = new ModelAndView("queryLookup"); mav.addObject("objects", objects); PagedListHolder pagedListHolder = new PagedListHolder(objects); pagedListHolder.setMaxLinkedPages(3); pagedListHolder.setPageSize(50); String page = request.getParameter("page"); Integer pg = 0; if (!StringUtils.isBlank(page)) { pg = Integer.valueOf(page); } pagedListHolder.setPage(pg); mav.addObject("pagedListHolder", pagedListHolder); mav.addObject("queryLookup", queryLookup); // mav.addObject("displayColumns", displayColumns); // mav.addObject("parameterMap", request.getParameterMap()); return mav; } }
8441ebf14f1113ce37d438e8018b83cd2fa3579a
1a79d6c1be6ddf9cd09e3c777258fd53793dd9a5
/src/main/java/com/javaetmoi/core/batch/item/EsDocument.java
d34833825742bc7e8ad0db497813dbe58dde5791
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
achretien/musicbrainz-elasticsearch
1a49cd6356ddd4fd22051f5f86c50efbc2ce6e0e
f5f236b7c5ead1369d5087f8685a3a516d2d4c88
refs/heads/master
2021-01-18T13:40:25.074362
2014-06-29T19:58:07
2014-06-29T19:58:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,614
java
/** * Copyright 2013 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.javaetmoi.core.batch.item; import org.elasticsearch.common.xcontent.XContentBuilder; /** * JSON document which is stored in Elasticsearch. * * <p> * A document is stored in an <b>index</b> and has a <b>type</b> and an <b>id</b>.<br> * If no id is provided, Elasticsearch well auto-generated one.<br> * A document indexed in elasticsearch could be versioned. * </p> */ public class EsDocument { private String id; private String type; private Long version; private XContentBuilder contentBuilder; /** * EsDocument constructor. * * @param type * type of the Elasticsearch document * @param contentBuilder * Elasticsearch helper to generate JSON content. */ public EsDocument(String type, XContentBuilder contentBuilder) { this.type = type; this.contentBuilder = contentBuilder; } protected String getId() { return id; } /** * Set the ID of a document which identifies a document. * * @param id * ID of a document (may be <code>null</code>) */ public void setId(String id) { this.id = id; } protected XContentBuilder getContentBuilder() { return contentBuilder; } protected String getType() { return type; } /** * Sets the version, which will cause the index operation to only be performed if a matching * version exists and no changes happened on the doc since then. * * @param version * version of a document * @see http://www.elasticsearch.org/blog/versioning/ */ protected void setVersion(Long version) { this.version = version; } protected boolean isVersioned() { return version !=null; } public Long getVersion() { return version; } }
10fc1628cf3b6c437c1a4ed7dfcaf3e1eb165c1f
5ca2fb2edcbdab200a8650f1c785de56c040126d
/JSP_study/27_iBatis/src/controller/UserController.java
fe9fd5fb8ae50996fd67a2ed72648bc7de0905e4
[]
no_license
MainDuke/mainduke-portfolioList
f4acb6cef861fbf96c3d099df5d323793c778b00
0410f201d8819c4fe437322773593b5299d17b1f
refs/heads/master
2020-04-17T18:32:39.544859
2019-01-21T15:20:35
2019-01-21T15:20:35
166,830,888
0
0
null
null
null
null
UHC
Java
false
false
3,337
java
package controller; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.jws.WebParam.Mode; import model.User; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import user.service.UserDaoImplService; @Controller @RequestMapping("/user") public class UserController { private ApplicationContext ct = new ClassPathXmlApplicationContext("/config/applicationContext.xml"); private UserDaoImplService dao=(UserDaoImplService)ct.getBean("userService"); //빈 얻기 //http://컨텍스트:port/user/list.do @RequestMapping("/list.do") public ModelAndView listUser(){ //DAO 로 부터 모든 데이터 얻기 List<User> userList = this.dao.getList(); return new ModelAndView("list","userList",userList); //모델 생성 /* * Map<String, Object> model = new HashMap<String, Object>(); * model.put("userList",userList); * *반환값인 ModelAndView 인스턴스를 생성 *ModelAndView modelandView = new ModelAndView(); *modelandView.setViewName("list"); *modelandView.addAllObject(model); * return modelandView; * * */ }//---------------------- //입력 폼, GET방식 요청 처리 //insert @RequestMapping("/write.do") public String userWrite(){ return "write";// 뷰 } //insert @RequestMapping(value="/write.do", method=RequestMethod.POST) public String userWritePro(@ModelAttribute("User") User user){ this.dao.writeUser(user); return "redirect:list.do"; //redirect는 reponse.sendRedirect("list.jsp"); } //글 내용 보기 @RequestMapping(value="/content.do") public ModelAndView contentUser(String userId){ User user=this.dao.getUser(userId); return new ModelAndView("content", "user", user); } //글 수정 폼 @RequestMapping(value="/update.do", method=RequestMethod.GET) public ModelAndView updateUser(String userId){ User user=this.dao.getUser(userId); return new ModelAndView("update", "user", user); } //글 수정 @RequestMapping(value="/update.do", method=RequestMethod.POST) public String updatePro(User user){ this.dao.modifyUser(user); return "redirect:list.do"; //redirect 는 http://를 새로 연결한다. } //글 삭제 폼 @RequestMapping(value="/delete.do", method=RequestMethod.GET) public ModelAndView deleteUser(){ String id="아이디를 입력하시오."; String pwd="암호를 입력하시오"; Map<String, String> map = new HashMap<String, String>(); map.put("id",id); map.put("pwd",pwd); return new ModelAndView("delete", "map", map);//뷰 //redirect 는 http://를 새로 연결한다. } //글 삭제 @RequestMapping(value="/delete.do", method=RequestMethod.POST) public String deletePro(String userId){ this.dao.deleteUser(userId); return "redirect:list.do"; //redirect 는 http://를 새로 연결한다. } }//class end
c0d8e403dd1be78b55adab5c16c91e4ac3748885
b4307ca2f116a822b9ce8f70878364fbe784b98f
/pep/src/trees/GenericClient.java
bdd78ed147cd50e7d71723fdb3c8c68d236dc5f2
[]
no_license
anandkrrai/CompetitiveCoding
b5683d4d1e6f37ba9a4f2fd4a92f7f4668b740ce
63347ee9d571f862bc3ff938b5d96e7fb009764a
refs/heads/master
2023-01-03T06:42:34.054882
2020-10-30T21:25:40
2020-10-30T21:25:40
115,263,952
1
7
null
2020-10-30T21:25:41
2017-12-24T13:17:22
Java
UTF-8
Java
false
false
53
java
package trees; public class GenericClient { }
143ed249ca696a512f816024c2f07fae6ba50044
421f0a75a6b62c5af62f89595be61f406328113b
/generated_tests/model_seeding/36_schemaspy-net.sourceforge.schemaspy.view.HtmlRelationshipsPage-1.0-5/net/sourceforge/schemaspy/view/HtmlRelationshipsPage_ESTest.java
a769ea711ca69f495ad4675caf3e9e8823d2aa54
[]
no_license
tigerqiu712/evosuite-model-seeding-empirical-evaluation
c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6
11a920b8213d9855082d3946233731c843baf7bc
refs/heads/master
2020-12-23T21:04:12.152289
2019-10-30T08:02:29
2019-10-30T08:02:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
678
java
/* * This file was automatically generated by EvoSuite * Fri Oct 25 19:59:00 GMT 2019 */ package net.sourceforge.schemaspy.view; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class HtmlRelationshipsPage_ESTest extends HtmlRelationshipsPage_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
a906a0dbed4150e48db264f0793f5c539032d3ed
a5a7c6814a41bc3d74c59072eb739cad8a714b33
/src/main/src/org/omg/CORBA/UShortSeqHelper.java
8aa71aa1ec9fa3d84d36177f73fdfc8a66457b64
[ "Apache-2.0" ]
permissive
as543343879/myReadBook
3dcbbf739c184a84b32232373708c73db482f352
5f3af76e58357a0b2b78cc7e760c1676fe19414b
refs/heads/master
2023-09-01T16:09:21.287327
2023-08-23T06:44:46
2023-08-23T06:44:46
139,959,385
3
3
Apache-2.0
2023-06-14T22:31:32
2018-07-06T08:54:15
Java
UTF-8
Java
false
false
2,587
java
/* * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package org.omg.CORBA; /** * The Helper for <tt>UShortSeq</tt>. For more information on * Helper files, see <a href="doc-files/generatedfiles.html#helper"> * "Generated Files: Helper Files"</a>.<P> * org/omg/CORBA/UShortSeqHelper.java * Generated by the IDL-to-Java compiler (portable), version "3.0" * from streams.idl * 13 May 1999 22:41:36 o'clock GMT+00:00 * * The class definition has been modified to conform to the following * OMG specifications : * <ul> * <li> ORB core as defined by CORBA 2.3.1 * (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>) * </li> * * <li> IDL/Java Language Mapping as defined in * <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a> * </li> * </ul> */ public abstract class UShortSeqHelper { private static String _id = "IDL:omg.org/CORBA/UShortSeq:1.0"; public static void insert (org.omg.CORBA.Any a, short[] that) { org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); a.type (type ()); write (out, that); a.read_value (out.create_input_stream (), type ()); } public static short[] extract (org.omg.CORBA.Any a) { return read (a.create_input_stream ()); } private static org.omg.CORBA.TypeCode __typeCode = null; synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort); __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.UShortSeqHelper.id (), "UShortSeq", __typeCode); } return __typeCode; } public static String id () { return _id; } public static short[] read (org.omg.CORBA.portable.InputStream istream) { short value[] = null; int _len0 = istream.read_long (); value = new short[_len0]; istream.read_ushort_array (value, 0, _len0); return value; } public static void write (org.omg.CORBA.portable.OutputStream ostream, short[] value) { ostream.write_long (value.length); ostream.write_ushort_array (value, 0, value.length); } }