blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7aed80d7ef05714addab8277767ad54511299787 | 4a98f05b2f38345c0750c37407d0dd20615b3354 | /src/com/nhaarman/listviewanimations/appearance/simple/SwingLeftInAnimationAdapter.java | 250fde6009ec6206b4525d14b572a5bd684a3383 | [] | no_license | yuhuayi/QuickDevelopAndroid | e44b3157deee0f906a3553df8686c0089507ac77 | 09f4ec0a7d4aeafdc0d2fdd48af8ca4c11dab726 | refs/heads/master | 2021-01-19T06:50:40.474937 | 2015-08-12T09:54:52 | 2015-08-12T09:54:52 | 35,664,071 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,641 | java | /*
* Copyright 2014 Niek Haarman
*
* 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.nhaarman.listviewanimations.appearance.simple;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.nhaarman.listviewanimations.appearance.SingleAnimationAdapter;
import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.ObjectAnimator;
/**
* An implementation of the AnimationAdapter class which applies a
* swing-in-from-the-left-animation to views.
*/
@SuppressWarnings("UnusedDeclaration")
public class SwingLeftInAnimationAdapter extends SingleAnimationAdapter {
private static final String TRANSLATION_X = "translationX";
public SwingLeftInAnimationAdapter(@NonNull final BaseAdapter baseAdapter) {
super(baseAdapter);
}
@NonNull
@Override
protected Animator getAnimator(@NonNull final ViewGroup parent, @NonNull final View view) {
return ObjectAnimator.ofFloat(view, TRANSLATION_X, 0 - parent.getWidth(), 0);
}
}
| [
"cao_ruixiang@caoruixangdeMBP.lan"
] | cao_ruixiang@caoruixangdeMBP.lan |
03b1003c04eafb28ba5d24b9d6ef628216ae9d85 | 023201fc08ab395c5f46ed63a13d5d0c3c2c8482 | /src/main/java/_java/lang/ShortVertxBinder.java | 1c4f9ffdf08f5b2a9f116314b8a2fb831ad52629 | [
"Apache-2.0"
] | permissive | aries-scola/vertx-web-bind | 345a56612521af2a9235f073b553bce1baf57827 | 4899b9582c895a4176480305c55d3a5d3358b698 | refs/heads/master | 2021-01-15T14:12:06.345610 | 2016-02-26T14:49:34 | 2016-02-26T14:49:34 | 46,982,983 | 0 | 0 | null | 2016-01-11T14:08:49 | 2015-11-27T13:58:42 | Java | UTF-8 | Java | false | false | 12,508 | java | /**
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
* and distribution as defined by Sections 1 through 9 of this document.
*
* "Licensor" shall mean the copyright owner or entity authorized by
* the copyright owner that is granting the License.
*
* "Legal Entity" shall mean the union of the acting entity and all
* other entities that control, are controlled by, or are under common
* control with that entity. For the purposes of this definition,
* "control" means (i) the power, direct or indirect, to cause the
* direction or management of such entity, whether by contract or
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
* outstanding shares, or (iii) beneficial ownership of such entity.
*
* "You" (or "Your") shall mean an individual or Legal Entity
* exercising permissions granted by this License.
*
* "Source" form shall mean the preferred form for making modifications,
* including but not limited to software source code, documentation
* source, and configuration files.
*
* "Object" form shall mean any form resulting from mechanical
* transformation or translation of a Source form, including but
* not limited to compiled object code, generated documentation,
* and conversions to other media types.
*
* "Work" shall mean the work of authorship, whether in Source or
* Object form, made available under the License, as indicated by a
* copyright notice that is included in or attached to the work
* (an example is provided in the Appendix below).
*
* "Derivative Works" shall mean any work, whether in Source or Object
* form, that is based on (or derived from) the Work and for which the
* editorial revisions, annotations, elaborations, or other modifications
* represent, as a whole, an original work of authorship. For the purposes
* of this License, Derivative Works shall not include works that remain
* separable from, or merely link (or bind by name) to the interfaces of,
* the Work and Derivative Works thereof.
*
* "Contribution" shall mean any work of authorship, including
* the original version of the Work and any modifications or additions
* to that Work or Derivative Works thereof, that is intentionally
* submitted to Licensor for inclusion in the Work by the copyright owner
* or by an individual or Legal Entity authorized to submit on behalf of
* the copyright owner. For the purposes of this definition, "submitted"
* means any form of electronic, verbal, or written communication sent
* to the Licensor or its representatives, including but not limited to
* communication on electronic mailing lists, source code control systems,
* and issue tracking systems that are managed by, or on behalf of, the
* Licensor for the purpose of discussing and improving the Work, but
* excluding communication that is conspicuously marked or otherwise
* designated in writing by the copyright owner as "Not a Contribution."
*
* "Contributor" shall mean Licensor and any individual or Legal Entity
* on behalf of whom a Contribution has been received by Licensor and
* subsequently incorporated within the Work.
*
* 2. Grant of Copyright License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* copyright license to reproduce, prepare Derivative Works of,
* publicly display, publicly perform, sublicense, and distribute the
* Work and such Derivative Works in Source or Object form.
*
* 3. Grant of Patent License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* (except as stated in this section) patent license to make, have made,
* use, offer to sell, sell, import, and otherwise transfer the Work,
* where such license applies only to those patent claims licensable
* by such Contributor that are necessarily infringed by their
* Contribution(s) alone or by combination of their Contribution(s)
* with the Work to which such Contribution(s) was submitted. If You
* institute patent litigation against any entity (including a
* cross-claim or counterclaim in a lawsuit) alleging that the Work
* or a Contribution incorporated within the Work constitutes direct
* or contributory patent infringement, then any patent licenses
* granted to You under this License for that Work shall terminate
* as of the date such litigation is filed.
*
* 4. Redistribution. You may reproduce and distribute copies of the
* Work or Derivative Works thereof in any medium, with or without
* modifications, and in Source or Object form, provided that You
* meet the following conditions:
*
* (a) You must give any other recipients of the Work or
* Derivative Works a copy of this License; and
*
* (b) You must cause any modified files to carry prominent notices
* stating that You changed the files; and
*
* (c) You must retain, in the Source form of any Derivative Works
* that You distribute, all copyright, patent, trademark, and
* attribution notices from the Source form of the Work,
* excluding those notices that do not pertain to any part of
* the Derivative Works; and
*
* (d) If the Work includes a "NOTICE" text file as part of its
* distribution, then any Derivative Works that You distribute must
* include a readable copy of the attribution notices contained
* within such NOTICE file, excluding those notices that do not
* pertain to any part of the Derivative Works, in at least one
* of the following places: within a NOTICE text file distributed
* as part of the Derivative Works; within the Source form or
* documentation, if provided along with the Derivative Works; or,
* within a display generated by the Derivative Works, if and
* wherever such third-party notices normally appear. The contents
* of the NOTICE file are for informational purposes only and
* do not modify the License. You may add Your own attribution
* notices within Derivative Works that You distribute, alongside
* or as an addendum to the NOTICE text from the Work, provided
* that such additional attribution notices cannot be construed
* as modifying the License.
*
* You may add Your own copyright statement to Your modifications and
* may provide additional or different license terms and conditions
* for use, reproduction, or distribution of Your modifications, or
* for any such Derivative Works as a whole, provided Your use,
* reproduction, and distribution of the Work otherwise complies with
* the conditions stated in this License.
*
* 5. Submission of Contributions. Unless You explicitly state otherwise,
* any Contribution intentionally submitted for inclusion in the Work
* by You to the Licensor shall be under the terms and conditions of
* this License, without any additional terms or conditions.
* Notwithstanding the above, nothing herein shall supersede or modify
* the terms of any separate license agreement you may have executed
* with Licensor regarding such Contributions.
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor,
* except as required for reasonable and customary use in describing the
* origin of the Work and reproducing the content of the NOTICE file.
*
* 7. Disclaimer of Warranty. Unless required by applicable law or
* agreed to in writing, Licensor provides the Work (and each
* Contributor provides its Contributions) on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
* PARTICULAR PURPOSE. You are solely responsible for determining the
* appropriateness of using or redistributing the Work and assume any
* risks associated with Your exercise of permissions under this License.
*
* 8. Limitation of Liability. In no event and under no legal theory,
* whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law (such as deliberate and grossly
* negligent acts) or agreed to in writing, shall any Contributor be
* liable to You for damages, including any direct, indirect, special,
* incidental, or consequential damages of any character arising as a
* result of this License or out of the use or inability to use the
* Work (including but not limited to damages for loss of goodwill,
* work stoppage, computer failure or malfunction, or any and all
* other commercial damages or losses), even if such Contributor
* has been advised of the possibility of such damages.
*
* 9. Accepting Warranty or Additional Liability. While redistributing
* the Work or Derivative Works thereof, You may choose to offer,
* and charge a fee for, acceptance of support, warranty, indemnity,
* or other liability obligations and/or rights consistent with this
* License. However, in accepting such obligations, You may act only
* on Your own behalf and on Your sole responsibility, not on behalf
* of any other Contributor, and only if You agree to indemnify,
* defend, and hold each Contributor harmless for any liability
* incurred by, or claims asserted against, such Contributor by reason
* of your accepting any such warranty or additional liability.
*
* END OF TERMS AND CONDITIONS
*
* APPENDIX: How to apply the Apache License to your work.
*
* To apply the Apache License to your work, attach the following
* boilerplate notice, with the fields enclosed by brackets "{}"
* replaced with your own identifying information. (Don't include
* the brackets!) The text should be enclosed in the appropriate
* comment syntax for the file format. We also recommend that a
* file or class name and description of purpose be included on the
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
* Copyright {yyyy} {name of copyright owner}
*
* 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 _java.lang;
import com.thesoftwarefactory.vertx.web.bind.BindingInfo;
import com.thesoftwarefactory.vertx.web.bind.impl.BaseBinder;
import com.thesoftwarefactory.vertx.web.bind.impl.BinderHelper;
import io.vertx.ext.web.RoutingContext;
public class ShortVertxBinder extends BaseBinder<Short> {
@Override
public Short bindFromContext(BindingInfo bindingInfo, RoutingContext context) {
String tmp = BinderHelper.getValue(bindingInfo, context);
try {
return tmp!=null ? Short.parseShort(tmp) : null;
}
catch (Exception e) {
return null;
}
}
}
| [
"stephane.bastian@monpetitguide.com"
] | stephane.bastian@monpetitguide.com |
6f2e20858c55588c7e328d7932e2cf61368b58e2 | 3d690193ae8089b44c98ac8231961b20a39a95aa | /chaogao/gen/com/wyxz/chaogao/BuildConfig.java | 201b4a5584111e84bbd9e4faba75575b48c3872a | [] | no_license | zhangcf2012/bqgs | d56189e05b37061cfc13bffe23827fc8f6e9b00f | 5270b3f8151613e6be54527d7ba172c2d795953b | refs/heads/master | 2021-01-10T20:59:40.485751 | 2015-02-09T06:20:47 | 2015-02-09T06:20:47 | 30,516,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | /** Automatically generated file. DO NOT MODIFY */
package com.wyxz.chaogao;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"zhangchengfu@spriteapp.com"
] | zhangchengfu@spriteapp.com |
8e8e384b1e195c32a479d5924281f38923a5985c | f7df7f5520163c43594decc4ea84c8b36df56ccd | /src/main/java/com/zhiwei/handler/GlobalExceptionHandler.java | 2b6c060149fe4c3fb8137c8ac349c7b9c850570e | [] | no_license | zwjunhui/shiro | d66ae832928b12919334d05f275b6eb95231d6ae | a81d3fa195ca56c144944c789f310c3b1a4af954 | refs/heads/master | 2022-02-26T00:17:51.818052 | 2019-07-16T10:18:12 | 2019-07-16T10:18:12 | 197,156,556 | 1 | 0 | null | 2022-02-09T22:15:51 | 2019-07-16T08:49:48 | CSS | UTF-8 | Java | false | false | 998 | java | package com.zhiwei.handler;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
/**
* @Description: 全局的异常处理器.
* @Author: wyjun
* @UpdateDate: 2019/7/16 14:37
* @Version: 1.0
*/
@ControllerAdvice
//ExceptionHandler, 方法注解, 作用于 Controller 级别. ExceptionHandler 注解为一个 Controler 定义一个异常处理器.
//
//ControllerAdvice, 类注解, 作用于 整个 Spring 工程. ControllerAdvice 注解定义了一个全局的异常处理器.
@Order(value = Ordered.HIGHEST_PRECEDENCE)
//Spring将根据其订单值注入相同类型的自动连接bean。
public class GlobalExceptionHandler {
@ExceptionHandler(value = AuthorizationException.class)
public String handleAuthorizationException() {
return "403";
}
}
| [
"wyjunhui@126.com"
] | wyjunhui@126.com |
604566908f6e5dde2bb65149ae7b2a6306d84f98 | a408e03406dd008e383e8f1d726f32036b585711 | /utils/src/main/java/com/hbung/utils/ui/camera/CameraUtils.java | eae436947eb77c5215110a2ba9ade9b5bcd7b03f | [] | no_license | yylxy/liKunFrame | aacb1198aecee3b2d26dd4f2669fd9f417ea0dc2 | da199b183d91e157c9ba720ca697efc67e869878 | refs/heads/master | 2021-01-23T04:40:32.435110 | 2017-03-26T15:42:04 | 2017-03-26T15:42:04 | 86,243,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,893 | java | package com.hbung.utils.ui.camera;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.hardware.Camera;
import android.util.Log;
import android.view.Display;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;
import java.io.IOException;
import java.util.List;
/**
* 作者 : 李坤
* 创建时间:2016/9/5 14:06
* 邮箱 :496546144@qq.com
* <p>
* 功能介绍:
*/
public class CameraUtils implements SurfaceHolder.Callback {
//是否正在预览
private boolean isReady = false;
private int orientation = 0;//旋转角度
private SurfaceHolder surfaceHolder;
private Camera mCamera;
private Activity context;
private String flashMode = Camera.Parameters.FLASH_MODE_OFF;
public boolean cameraFront = false;//是否是前摄像头
private boolean flash = false;//是否开启闪光灯
CamerListener camerListener;
/**
* 作者 : 李坤
* 创建时间: 2016/9/5 14:30
* <p>
* 方法功能:打开或关闭闪光灯
*/
public void setFlashMode(String mode) {
try {
if (context.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_CAMERA_FLASH)
&& mCamera != null) {
// mCamera.stopPreview();
Camera.Parameters parameters = mCamera.getParameters();
parameters.setFlashMode(flashMode);
mCamera.setParameters(parameters);
// mCamera.startPreview();
flash = flashMode == Camera.Parameters.FLASH_MODE_TORCH;
if (camerListener != null) {
camerListener.onFlashImg(flash);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void setFlashMode() {
if (!flash) {
flashMode = Camera.Parameters.FLASH_MODE_TORCH;
} else {
flashMode = Camera.Parameters.FLASH_MODE_OFF;
}
setFlashMode(flashMode);
}
/**
* 切换摄像头
*/
public void switchCamera() {
int camerasNumber = Camera.getNumberOfCameras();
if (camerasNumber > 1) {
releaseCamera();
chooseCamera();
} else {
Toast toast = Toast.makeText(context, "抱歉,您的设备只有一个摄像头", Toast.LENGTH_LONG);
toast.show();
}
}
public void chooseCamera() {
cameraFront = !cameraFront;
if (!cameraFront) {
int cameraId = findBackFacingCamera();
if (cameraId >= 0) {
mCamera = Camera.open(cameraId);
refreshCamera();
if (camerListener != null) {
camerListener.setFlashImgVisibility(View.VISIBLE);
}
}
} else {
int cameraId = findFrontFacingCamera();
if (cameraId >= 0) {
mCamera = Camera.open(cameraId);
if (flash) {
flash = false;
setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
if (camerListener != null) {
camerListener.onFlashImg(flash);
camerListener.setFlashImgVisibility(View.GONE);
}
}
refreshCamera();
}
}
}
/**
* 初始化摄像头
*
* @throws IOException
* @author lip
* @date 2015-3-16
*/
public void initCamera() throws IOException {
if (mCamera != null) {
freeCameraResource();
}
try {
mCamera = Camera.open(findBackFacingCamera());
} catch (Exception e) {
e.printStackTrace();
freeCameraResource();
}
if (mCamera == null)
return;
refreshCamera();
}
public CameraUtils(Activity context) {
this.context = context;
}
public void setCamerListener(CamerListener camerListener) {
this.camerListener = camerListener;
}
public void setSurfaceHolder(SurfaceHolder surfaceHolder) {
this.surfaceHolder = surfaceHolder;
surfaceHolder.addCallback(this);
}
public Surface getSurface() {
return surfaceHolder.getSurface();
}
public Camera getmCamera() {
return mCamera;
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
try {
initCamera();
if (mCamera != null) {
mCamera.setPreviewDisplay(holder);
optimizeCameraDimens(mCamera);
mCamera.startPreview();
}
isReady = true;
} catch (IOException e) {
e.printStackTrace();
isReady = false;
}
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
isReady = false;
}
/**
* 释放摄像头资源
*
* @author liuyinjun
* @date 2015-2-5
*/
public void freeCameraResource() {
if (mCamera != null) {
mCamera.setPreviewCallback(null);
mCamera.stopPreview();
mCamera.lock();
mCamera.release();
mCamera = null;
}
}
private void releaseCamera() {
// stop and release camera
if (mCamera != null) {
mCamera.release();
mCamera = null;
}
}
public void refreshCamera() {
if (surfaceHolder.getSurface() == null) {
return;
}
try {
mCamera.stopPreview();
} catch (Exception e) {
}
if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
if (mCamera != null) {
mCamera.setDisplayOrientation(orientation = 90);
}
}
// start preview with new settings
try {
mCamera.setPreviewDisplay(surfaceHolder);
optimizeCameraDimens(mCamera);
mCamera.startPreview();
} catch (Exception e) {
}
}
private void optimizeCameraDimens(Camera mCamera) {
Rect rect = surfaceHolder.getSurfaceFrame();
int width = rect.width();
int height = rect.height();
if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
width = rect.height();
height = rect.width();
}
final List<Camera.Size> mSupportedPreviewSizes = mCamera.getParameters().getSupportedPreviewSizes();
Camera.Size mPreviewSize;
if (mSupportedPreviewSizes != null) {
mPreviewSize = getOptimalPreviewSize(mSupportedPreviewSizes, width, height);
Camera.Parameters parameters = mCamera.getParameters();
parameters.setPreviewSize(mPreviewSize.width, mPreviewSize.height);
parameters.setPictureSize(mPreviewSize.width, mPreviewSize.height);
parameters.setFlashMode(flashMode);
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);//1连续对焦
mCamera.setParameters(parameters);
mCamera.cancelAutoFocus();
}
}
/**
* 作者 : 李坤
* 创建时间: 2016/11/25 14:55
* <p>
* 方法功能:从摄像头的大小参数里面获取与指定的大小相似的大小
*/
private Camera.Size getOptimalPreviewSize(List<Camera.Size> sizes, int w, int h) {
final double ASPECT_TOLERANCE = 0.1;
float targetRatio = h / (w * 1.0f);
if (w > h)
targetRatio = (w * 1.0f) / h;
if (sizes == null)
return null;
Camera.Size optimalSize = null;
float minDiff = Float.MAX_VALUE;
int targetHeight = h;
for (Camera.Size size : sizes) {
float height = size.height * 1.0f;
float width = size.width * 1.0f;
float ratio = width / height;
if (height >= width)
ratio = height / width;
if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE)
continue;
if (Math.abs(height - targetHeight) < minDiff) {
optimalSize = size;
minDiff = Math.abs(size.height - targetHeight);
}
}
if (optimalSize == null) {
minDiff = Float.MAX_VALUE;
for (Camera.Size size : sizes) {
if (Math.abs(size.height - targetHeight) < minDiff) {
optimalSize = size;
minDiff = Math.abs(size.height - targetHeight);
}
}
}
return optimalSize;
}
public int getScreenHeight() {
WindowManager wm = (WindowManager)
context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
return display.getHeight();
}
public int getScreenWidth() {
WindowManager wm = (WindowManager)
context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
return display.getWidth();
}
private int findFrontFacingCamera() {
cameraId = -1;
// Search for the front facing camera
int numberOfCameras = Camera.getNumberOfCameras();
for (int i = 0; i < numberOfCameras; i++) {
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(i, info);
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
cameraId = i;
break;
}
}
return cameraId;
}
private int findBackFacingCamera() {
cameraId = -1;
// Search for the back facing camera
// get the number of cameras
int numberOfCameras = Camera.getNumberOfCameras();
// for every camera check
for (int i = 0; i < numberOfCameras; i++) {
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(i, info);
if (info.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
cameraId = i;
break;
}
}
return cameraId;
}
int cameraId = 0;
public int getRotation() {
int rotation = 0;
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(cameraId, info);
// if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {//前摄像头
// rotation = (info.orientation - 360) % 360;
// } else { // back-facing camera
// rotation = (info.orientation) % 360;
// }
rotation = (info.orientation) % 360;
// mMediaRecorder.setOrientationHint(rotation);
// if (cameraId == Camera.CameraInfo.CAMERA_FACING_FRONT) {//前摄像头
// if (rotation % 90 == 0) {
// rotation = 180;
// } else {
// rotation = 0;
// }
// } else {
// rotation = rotation - 90;
// }
rotation = rotation - 90;
Log.e("aaaa", rotation + "");
return rotation;
}
/**
* 作者 : 李坤
* 创建时间: 2016/11/28 10:34
* <p>
* 方法功能:是否准备好了
*/
public boolean isReady() {
return isReady;
}
public int getOrientation() {
return orientation;
}
}
| [
"lyxs916@163.com"
] | lyxs916@163.com |
da6b6144b884f9e811e28e1db4e86b0550b3ac3d | a3cb197516b453dbc83a14ed0800bfaf3f0675fd | /src/fr/triedge/sekai/common/model/TileEventType.java | 9a286d9edd9aa1cb1e6de6e5433633727bf3dbdd | [] | no_license | JikaiNoTsubasa/SekaiJME | d73f89704445e7f3753bbb5532c95fb90aaacce1 | 8b346b78b3d20b8d5347c86b58426e70b473d503 | refs/heads/master | 2020-07-03T11:19:08.151197 | 2019-09-26T15:10:28 | 2019-09-26T15:10:28 | 201,889,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | package fr.triedge.sekai.common.model;
import javax.xml.bind.annotation.XmlEnum;
@XmlEnum(String.class)
public enum TileEventType {
WARP,SIGN,BLOCKED
}
| [
"stephane.biehler.priv@gmail.com"
] | stephane.biehler.priv@gmail.com |
8e1507b6668eef8a4dff867bf62f6acd07f89111 | f585bd4254b912d6e0cae13653312e063d3e4696 | /app_network/src/main/java/com/sdxxtop/guardianapp/model/bean/InitBean.java | 1e79f1468e00f199f1240f53bdc239bf7f3f2913 | [] | no_license | ZhouSilverBullet/GuardianApp | 4844a647f72cc7bf9467e6f063d0e24ee4795f47 | ece98a058303beb25f88db11b46a08d40ff51f69 | refs/heads/master | 2020-04-29T06:57:52.841323 | 2020-03-19T07:28:40 | 2020-03-19T07:28:40 | 175,936,517 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,430 | java | package com.sdxxtop.guardianapp.model.bean;
public class InitBean {
// {
// "apk_url":"",//app更新地址
// "version_code":"20100",//更新后的版本号
// "version_name":"V2.1.0",//版本名称
// "content":"1.增加学生考勤功能 | 2.as科技的", //版本更新内容,用|代表换行,客户端需要自行处理
// "force_update":0,//是否为强制更新0:非强更 1:强更
// }
private String apk_url;
private String version_code;
private String version_name;
private String content;
private int force_update;
public String getApk_url() {
return apk_url;
}
public void setApk_url(String apk_url) {
this.apk_url = apk_url;
}
public String getVersion_code() {
return version_code;
}
public void setVersion_code(String version_code) {
this.version_code = version_code;
}
public String getVersion_name() {
return version_name;
}
public void setVersion_name(String version_name) {
this.version_name = version_name;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getForce_update() {
return force_update;
}
public void setForce_update(int force_update) {
this.force_update = force_update;
}
}
| [
"zhousaito@163.com"
] | zhousaito@163.com |
f802c8110d98c4b20dbd4898ba7d3e44fd7b7a29 | 278021139ae28e050976c943215e47b3e5cc49f8 | /codeforce/395div/aug17/paliindrom.java | 9832b5e309e99351bfa5b6536056d48a77db234d | [] | no_license | anshratn1997/Competitive-Programming-DS-Algo | f8673a2a7d3868da14725ce9739abc53e65a7429 | 975566bc0780615acd24e2b10d408163474864c6 | refs/heads/master | 2022-12-02T21:52:12.060298 | 2020-08-23T15:34:57 | 2020-08-23T15:34:57 | 109,971,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,029 | java | import java.io.*;
import java.util.*;
import java.math.*;
//public
class Main{
BufferedReader br;
public static void main(String[] args) {
new Main().main1();
}
void main1()
{
try{
br=new BufferedReader(new InputStreamReader(System.in));
int t=ii();
while(t-->0){
String a=si();
String b=si();
int[] aa=new int[27];
int[] bb=new int[27];
Arrays.fill(aa,0);
Arrays.fill(bb,0);
for (int i=0;i<a.length() ;i++ ) {
aa[a.charAt(i)-97]++;
}
for (int i=0;i<b.length() ;i++ ) {
bb[b.charAt(i)-97]++;
}
char ans='B';
for (int i=0;i<27 ;i++ ) {
if(aa[i]>=2 && bb[i]==0)
{ans='A';break;}
}
System.out.println(ans);
}
}
catch(Exception e){
e.printStackTrace();}
}
//input method
int[] iint() throws IOException{
String line[]=br.readLine().split(" ");
int[] a=new int[line.length];
for (int i=0;i<line.length ;i++ ) {
a[i]=Integer.parseInt(line[i]);
}
return a;
}
long[] ilong() throws IOException{
String line[]=br.readLine().split(" ");
long[] a=new long[line.length];
for (int i=0;i<line.length ;i++ ) {
a[i]=Long.parseLong(line[i]);
}
return a;
}
double[] idouble() throws IOException{
String line[]=br.readLine().split(" ");
double[] a=new double[line.length];
for (int i=0;i<line.length ;i++ ) {
a[i]=Long.parseLong(line[i]);
}
return a;
}
long li() throws IOException{
return Long.parseLong(br.readLine());
}
int ii() throws IOException{
return Integer.parseInt(br.readLine());
}
double di() throws IOException{
return Double.parseDouble(br.readLine());
}
char ci() throws IOException{
return (char)br.read();
}
String si() throws IOException{
return br.readLine();
}
} | [
"keshariratnesh9@gmail.com"
] | keshariratnesh9@gmail.com |
8f6d1abfc7b786d51eeb4aa29e3a7736c790895b | 1b22ed945a39bca567671feabfff983cc6d6a533 | /JPAShowTracker/src/entities/PartyUser.java | b6ae56a46907bef1edd4876adc692ac9fe464094 | [] | no_license | roberthelmick08/Bingr | e0554d6701b9e609c360504d291494e97ccaeac7 | 9a3351933dff82cf9be80d80d29e3bdc1fc2cf7a | refs/heads/master | 2021-01-19T13:36:14.883687 | 2017-03-26T18:40:54 | 2017-03-26T18:40:54 | 82,399,037 | 0 | 0 | null | 2017-02-18T16:14:04 | 2017-02-18T16:14:04 | null | UTF-8 | Java | false | false | 753 | java | package entities;
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="party_user")
public class PartyUser implements HasID{
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
@Column(name="user_id")
private int userId;
@Column(name="party_id")
private int partyId;
public int getId() {
return id;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getPartyId() {
return partyId;
}
public void setPartyId(int partyId) {
this.partyId = partyId;
}
}
| [
"roberthelmick@Roberts-MacBook-Pro.local"
] | roberthelmick@Roberts-MacBook-Pro.local |
024e43d3d53f13502db4a1ab6fc12f9d33ade2a2 | 39db83aa38f096c75925f237ae2be3fbc4a55f43 | /app/src/main/java/com/gartmedia/brody/loocasino/ambianceService.java | fc66fa4d3a8801c3e93fb86a57028272a961a17b | [] | no_license | BrodyGartner/LooCasino | 96f772d7ec50c75078beb42aa89e734d1fb62a64 | bf91a05d576a4992ec135111dbe9ee5e3409b5b7 | refs/heads/master | 2020-03-22T07:14:44.062002 | 2018-07-05T03:31:10 | 2018-07-05T03:31:10 | 139,688,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.gartmedia.brody.loocasino;
import android.app.Service;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;
public class ambianceService extends Service {
private MediaPlayer player;
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
player = MediaPlayer.create(this, R.raw.ambiance);
player.setLooping(true);
player.start();
return START_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
player.stop();
}
}
| [
"brody.gartner@outlook.com"
] | brody.gartner@outlook.com |
371644f5c118e63ab28c916a771bbbef73997c26 | 10bb4ca5c8de6ea6b27011462eb715d2e636a142 | /src/sendsms/Sendsms.java | 33513f4b4466ed8a743a0100dbe6e6cb603f1ca1 | [] | no_license | Basavaraj-chorgasti/Basavaraj-Project | 9ba30817bc34a8895b7e6973e46c307f7250d36e | 72ea28fd262bb95280f08dbefc5619c2a75ee5c6 | refs/heads/master | 2022-12-01T09:27:05.184456 | 2020-07-27T13:32:06 | 2020-07-27T13:32:06 | 282,882,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | package sendsms;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLEncoder;
import javax.net.ssl.HttpsURLConnection;
import constant.Constant;
public class Sendsms
{
public static void sendSms(String message,String number)
{
try
{
//important step...
message=URLEncoder.encode(message, "UTF-8");
String myUrl=Constant.URL+Constant.APIKEY+Constant.SEND_ID+Constant.SENDID+Constant.MESSAGE+message+Constant.LANGUAGE+Constant.LANGUAGE_+Constant.ROUTE_ID+Constant.ROUTE+Constant.NUMBER+number;
//sending get request using java..
URL url=new URL(myUrl);
HttpsURLConnection con=(HttpsURLConnection)url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty(Constant.AGENT, Constant.MOZILLA);
con.setRequestProperty(Constant.CONTROL, Constant.CACHE);
// console output
System.out.println("Wait..SMS IS SENDING............");
int code=con.getResponseCode();
System.out.println("Response code : "+code);
StringBuffer response=new StringBuffer();
BufferedReader br=new BufferedReader(new InputStreamReader(con.getInputStream()));
while(true)
{
String line=br.readLine();
if(line==null)
{
break;
}
response.append(line);
}
System.out.println(response);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
| [
"LENOVO@DESKTOP-7V12BAM"
] | LENOVO@DESKTOP-7V12BAM |
31c4f01c1483bd2b4f44fad35a57a7df37021663 | e0058d6c29e028e0574332570dad48c6ed84521c | /src/main/java/com/mfikria/itblocator/Client.java | 2a5fa8ae8f9d3986ac41868bdd2f3bd2d4b76fc9 | [] | no_license | mfikria/IF3111-2016-Tugas1-Android | c48e93504eb320acd680a4793318cf12dabe0bf6 | 131b1ca2a7e620c8ee3e6692a20bc62bf5c01e3f | refs/heads/master | 2021-01-19T11:52:21.015779 | 2016-03-28T02:26:24 | 2016-03-28T02:26:24 | 54,859,156 | 0 | 0 | null | 2016-03-28T02:18:57 | 2016-03-28T02:18:57 | null | UTF-8 | Java | false | false | 2,663 | java | package com.mfikria.itblocator;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import android.os.AsyncTask;
import android.widget.TextView;
public class Client extends AsyncTask<String, Void, String> implements AsyncResponse {
private static final String SERVER_ADDRESS = "167.205.34.132";
private static final int SERVER_PORT = 3111;
private static Socket socket;
String dstAddress;
int dstPort;
String response = "";
public AsyncResponse delegate = null;
@Override
public void processFinish(String output) {
}
Client() {
dstAddress = SERVER_ADDRESS;
dstPort = SERVER_PORT;
}
@Override
protected String doInBackground(String... args) {
String str = args[0];
String response = null;
try {
socket = new Socket(InetAddress.getByName(SERVER_ADDRESS), SERVER_PORT);
PrintWriter out;
out = new PrintWriter(new BufferedWriter(
new OutputStreamWriter(socket.getOutputStream())),
true);
out.println(str);
out.flush();
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
StringBuilder sb = new StringBuilder();
String strIn;
while ((strIn = in.readLine()) != null)
{
sb.append(strIn + "\n");
}
// close the reader, and return the results as a String
in.close();
response = sb.toString();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return response;
}
@Override
protected void onPostExecute(String result) {
// super.onPostExecute(result);
delegate.processFinish(result);
}
} | [
"mfikria@gmail.com"
] | mfikria@gmail.com |
84ac1dcea21b200902785ad7c7e2beb51f5b0c6d | 9bc4e4fd32dda778d61e15fd95609a5fb74faac3 | /boot-system/src/main/java/com/boot/system/mapper/SysDictTypeMapper.java | 4a98ef88f20a7897c3a042d853632289d5ccf69b | [
"MIT"
] | permissive | missaouib/boot | 210455e5cf87408b61852f36277e62b69fc4fff0 | 5340a820326ff06f6bd2a7bb1b905726c61aceb1 | refs/heads/master | 2023-03-02T23:42:05.000876 | 2021-01-13T07:03:45 | 2021-01-13T07:03:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,879 | java | package com.boot.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.boot.common.core.domain.entity.SysDictType;
/**
* 字典表 数据层
*
* @author ruoyi
*/
@Mapper
public interface SysDictTypeMapper
{
/**
* 根据条件分页查询字典类型
*
* @param dictType 字典类型信息
* @return 字典类型集合信息
*/
public List<SysDictType> selectDictTypeList(SysDictType dictType);
/**
* 根据所有字典类型
*
* @return 字典类型集合信息
*/
public List<SysDictType> selectDictTypeAll();
/**
* 根据字典类型ID查询信息
*
* @param dictId 字典类型ID
* @return 字典类型
*/
public SysDictType selectDictTypeById(Long dictId);
/**
* 根据字典类型查询信息
*
* @param dictType 字典类型
* @return 字典类型
*/
public SysDictType selectDictTypeByType(String dictType);
/**
* 通过字典ID删除字典信息
*
* @param dictId 字典ID
* @return 结果
*/
public int deleteDictTypeById(Long dictId);
/**
* 批量删除字典类型信息
*
* @param dictIds 需要删除的字典ID
* @return 结果
*/
public int deleteDictTypeByIds(Long[] dictIds);
/**
* 新增字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int insertDictType(SysDictType dictType);
/**
* 修改字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int updateDictType(SysDictType dictType);
/**
* 校验字典类型称是否唯一
*
* @param dictType 字典类型
* @return 结果
*/
public SysDictType checkDictTypeUnique(String dictType);
}
| [
"gfqjava@163.com"
] | gfqjava@163.com |
84ae8ece78888146343accf3c361f7453c3a2a27 | b859a270d06546ecdce3bc4b97f165275cb942d5 | /imageloader/src/main/java/com/erban/imageloader/ImageLoadTask.java | 169c0f9ad4d8e73ae5ed93437a26ef4a48487c29 | [] | no_license | 572722615/EasyPay | 0e0bd083f664aa3ad1b574204575c365ab78f874 | 90b555f2d149e666bef4bb37571e5cbad1f909f7 | refs/heads/master | 2021-01-19T05:03:57.227313 | 2016-08-01T07:35:09 | 2016-08-01T07:35:09 | 64,646,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,342 | java | package com.erban.imageloader;
import android.content.Context;
import android.net.ConnectivityManager;
import com.erban.common.http.HttpException;
import com.erban.common.http.HttpManager;
import com.erban.common.http.HttpMsg;
import com.erban.common.http.HttpMsg.AbstractHttpMsgListener;
import com.erban.common.http.HttpMsg.ResponseType;
import java.util.HashMap;
/**
* 网络加载任务的执行接口的实现类。专供ImageLoader使用;
* 实际上可以放进ImageLoader,作为其内部类;但是,可以在以后修改。
*/
public class ImageLoadTask implements IImageLoadTask {
private HttpManager mHttp;
public ImageLoadTask() {
if (null == mHttp) {
mHttp = HttpManager.getInstance();
}
}
/**
* 不知道写在这里是否合适,等做sdk 2.0的时候再rebuild吧。先把实现方法写在这里;
* 检测当前网络是否可用。包括wifi, 3G, 2G
*/
public static boolean isNetWorkAvailable(Context actCtx) {
if (actCtx != null) {
ConnectivityManager connManager = (ConnectivityManager) actCtx.getSystemService(
Context.CONNECTIVITY_SERVICE);
if (connManager.getActiveNetworkInfo() != null) {
return connManager.getActiveNetworkInfo().isAvailable();
}
}
return false;
}
public int getImage(final String url,
final KLoadListener<byte[]> listener) {
HttpMsg msg = new HttpMsg(url);
msg.setType(ResponseType.BINARY);
msg.setListener(new AbstractHttpMsgListener() {
public void beforeSend() {
if (listener != null) {
listener.startLoad();
}
}
@Override
public void onResponse(int responseCode,
HashMap<String, String> headers,
int responseLength,
byte[] respData) {
listener.onSucc(respData);
}
@Override
public void onError(HttpException exception) {
listener.onFail(exception);
}
@Override
public void onSocketTimeOut() {
//
}
public void afterSend() {
if (listener != null) {
listener.endLoad();
}
}
});
if (mHttp != null) {
return mHttp.send(msg);
} else {
return -1;
}
}
public void cancelTask(int taskId) {
if (mHttp != null) {
mHttp.cancel(taskId);
}
}
public void cancelQueuedTask(int taskId) { // 仅仅取消排队中的task,不取消已经开始下载的任务
if (mHttp != null) {
mHttp.cancelMsgInQuery(taskId);
}
}
@Override
public int initialize() {
// if (mHttp == null) {
// mHttp = new HttpManager();
// }
// mHttp.init();
return 0;
}
@Override
public int destroy() {
// if (mHttp != null) {
// mHttp.destroy();
// }
// mHttp = null;
return 0;
}
}
| [
"572722615@qq.com"
] | 572722615@qq.com |
38e7c1518697e6d0c42e01c2de6b8237f35993be | 635f8db9031bd05ceb5b03e1ef77524752ab2916 | /E3code/e3-sso/e3-sso-interface/src/main/java/cn/e3mall/sso/service/LoginService.java | 8b96c16f972635767607bb83bc65d99ae802b97b | [] | no_license | Vami1199/E3 | 5dcdb2763033d2cfd7d951077ef4bf2b3e8eca2e | 7a8e206865fb156e23a42e19b75cb462492a6979 | refs/heads/master | 2021-04-26T23:53:21.644791 | 2018-03-27T01:14:24 | 2018-03-27T01:14:24 | 123,875,402 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 246 | java | package cn.e3mall.sso.service;
import cn.e3mall.common.utils.E3Result;
public interface LoginService {
//参数:用户名和密码
//返回值:E3Result,其中包含token信息
E3Result userLogin(String username,String password);
}
| [
"15732627799@163.com"
] | 15732627799@163.com |
044ed983b60e4d91c5fa8826648a0fbc32d3541b | 354804ab06813d6fe0a448b1c237fca382d4ccd2 | /src/com/test/service/OrderRecordService.java | 87a4666e70d6ffabdafe479c8f3f68aa1bce12b1 | [] | no_license | Qzp990425/weddingDress | f84f925a495715c544aaf33748e527dab792ebe8 | bf0fbf33d1eb2d72177112faa390a23658873ac5 | refs/heads/master | 2022-12-28T05:16:18.871940 | 2020-10-15T14:20:07 | 2020-10-15T14:20:07 | 304,345,570 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | package com.test.service;
import com.github.pagehelper.PageInfo;
import com.test.entity.OrderRecord;
public interface OrderRecordService {
PageInfo<OrderRecord> getAllOrderByStatus(Integer status,Integer pageNum);
PageInfo<OrderRecord> getOrderByUid(Integer uid,Integer pageNum);
boolean insertOrder(OrderRecord orderRecord,Integer[] rid);
boolean insertOrder(OrderRecord orderRecord);
boolean preOrder(OrderRecord orderRecord);
boolean finishOrder(OrderRecord orderRecord);
}
| [
"309396064@qq.com"
] | 309396064@qq.com |
afc8a98b0e13a54fd449951f4ac6bd1bca69e1fc | d820ddb3deeb74b51a80f57603ac5760a61da75e | /src/main/java/org/zerock/domain/mountain/MnameVO.java | 35a7b3c4b184e51e3228dd7e7cf3abb9eb045783 | [] | no_license | dmswldi/mountain | ff5be07a9226c0aa317ae0a96681ae67b33a266d | 5a675d7a647e718fe247b37cc51dc64e0adc0cc7 | refs/heads/master | 2023-03-09T09:38:06.380008 | 2021-02-26T09:17:24 | 2021-02-26T09:17:24 | 335,507,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | package org.zerock.domain.mountain;
import lombok.Data;
@Data
public class MnameVO {
private Long no;
private String mname;
}
| [
"eeeunzz20@gmail.com"
] | eeeunzz20@gmail.com |
08d476186f369425b5543b9e2acce120c6ebc744 | 6500848c3661afda83a024f9792bc6e2e8e8a14e | /gp_JADX/com/google/android/finsky/zapp/C4861t.java | 57a77d9987c1bc7eb2b16ecb10d544619ade3bde | [] | no_license | enaawy/gproject | fd71d3adb3784d12c52daf4eecd4b2cb5c81a032 | 91cb88559c60ac741d4418658d0416f26722e789 | refs/heads/master | 2021-09-03T03:49:37.813805 | 2018-01-05T09:35:06 | 2018-01-05T09:35:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,146 | java | package com.google.android.finsky.zapp;
import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.util.Log;
import com.android.p2putils.ApkSignatureSchemeV2Verifier;
import com.android.p2putils.ApkSignatureSchemeV2Verifier.SignatureNotFoundException;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
public final class C4861t {
public static X509Certificate[][] m22743a(File file) {
try {
return ApkSignatureSchemeV2Verifier.m4194a(file.getAbsolutePath());
} catch (SignatureNotFoundException e) {
return null;
} catch (SecurityException e2) {
return null;
} catch (IOException e3) {
return null;
}
}
public static Signature[] m22741a(Context context) {
return C4861t.m22742a(context, context.getPackageName());
}
public static List m22745b(Context context) {
try {
String[] list = context.getAssets().list("split_certs");
if (list == null || list.length == 0) {
Log.i("DynamicModuleDownloader", "No split certificates could be read from the relevant assets folder.");
return null;
}
List arrayList = new ArrayList();
for (String str : list) {
String str2;
if (str2.endsWith(".pem")) {
String valueOf = String.valueOf("split_certs/");
str2 = String.valueOf(str2);
X509Certificate b = C4861t.m22744b(context, str2.length() != 0 ? valueOf.concat(str2) : new String(valueOf));
if (b != null) {
arrayList.add(b);
}
}
}
return arrayList;
} catch (IOException e) {
Log.i("DynamicModuleDownloader", "An IOException is encountered while accessing the split certificates folder.");
return null;
}
}
private static X509Certificate m22744b(Context context, String str) {
String str2;
String str3;
String valueOf;
try {
return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(context.getAssets().open(str));
} catch (FileNotFoundException e) {
str2 = "DynamicModuleDownloader";
str3 = "Certificate file could not be found. Check: ";
valueOf = String.valueOf(str);
Log.e(str2, valueOf.length() != 0 ? str3.concat(valueOf) : new String(str3));
} catch (CertificateException e2) {
str2 = "DynamicModuleDownloader";
str3 = "Certificate signature could not be extracted from file. Check: ";
valueOf = String.valueOf(str);
Log.e(str2, valueOf.length() != 0 ? str3.concat(valueOf) : new String(str3));
} catch (IOException e3) {
str2 = "DynamicModuleDownloader";
str3 = "Certificate signature could not be read from file. Check: ";
valueOf = String.valueOf(str);
Log.e(str2, valueOf.length() != 0 ? str3.concat(valueOf) : new String(str3));
}
return null;
}
static Signature[] m22742a(Context context, String str) {
try {
return context.getPackageManager().getPackageInfo(str, 64).signatures;
} catch (NameNotFoundException e) {
return null;
}
}
static X509Certificate m22740a(Signature signature) {
try {
return (X509Certificate) CertificateFactory.getInstance("X509").generateCertificate(new ByteArrayInputStream(signature.toByteArray()));
} catch (CertificateException e) {
Log.e("DynamicModuleDownloader", "Cannot decode certificate.");
return null;
}
}
}
| [
"genius.ron@gmail.com"
] | genius.ron@gmail.com |
841abaa3ef74107d8aabcb80704ae4179558eb96 | 34b8d32bb2be6303d3c119547bc8fe0a645762ee | /src/main/java/com/mffs/common/items/modules/projector/type/ModeSphere.java | 04cc3c991090243d9ddef3413bd725b1530fc54e | [] | no_license | PowerEclipse/mc_mffs | 907b149cc8c474bff642707433cde8933476c682 | 6e413b40e2570685bbaba615b3eeefc93e2b716f | refs/heads/master | 2021-01-12T14:18:09.416468 | 2016-09-22T02:13:20 | 2016-09-22T02:13:20 | 68,967,031 | 0 | 0 | null | 2016-09-22T22:24:49 | 2016-09-22T22:24:49 | null | UTF-8 | Java | false | false | 3,324 | java | package com.mffs.common.items.modules.projector.type;
import com.mffs.api.IFieldInteraction;
import com.mffs.api.IProjector;
import com.mffs.api.render.ModelCube;
import com.mffs.api.vector.Vector3D;
import com.mffs.common.items.ItemMode;
import com.mffs.common.items.modules.upgrades.ItemModuleScale;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import java.util.HashSet;
import java.util.Set;
/**
* @author Calclavia
*/
public class ModeSphere extends ItemMode {
@Override
public Set<Vector3D> getExteriorPoints(IFieldInteraction projector) {
Set<Vector3D> fieldBlocks = new HashSet();
int radius = projector.getModuleCount(ItemModuleScale.class);
int steps = (int) Math.ceil(3.141592653589793D / Math.atan(1.0D / radius / 2.0D));
for (int phi_n = 0; phi_n < 2 * steps; phi_n++) {
for (int theta_n = 0; theta_n < steps; theta_n++) {
double phi = 6.283185307179586D / steps * phi_n;
double theta = 3.141592653589793D / steps * theta_n;
Vector3D point = new Vector3D(Math.sin(theta) * Math.cos(phi), Math.cos(theta), Math.sin(theta) * Math.sin(phi)).scale(radius);
fieldBlocks.add(point);
}
}
return fieldBlocks;
}
@Override
public Set<Vector3D> getInteriorPoints(IFieldInteraction projector) {
Set<Vector3D> fieldBlocks = new HashSet();
Vector3D translation = projector.getTranslation();
int radius = projector.getModuleCount(ItemModuleScale.class);
for (int x = -radius; x <= radius; x++) {
for (int z = -radius; z <= radius; z++) {
for (int y = -radius; y <= radius; y++) {
Vector3D position = new Vector3D(x, y, z);
if (!isInField(projector, position.add(new Vector3D((TileEntity) projector)).add(translation))) {
continue;
}
fieldBlocks.add(position);
}
}
}
return fieldBlocks;
}
@Override
public boolean isInField(IFieldInteraction projector, Vector3D position) {
return new Vector3D((TileEntity) projector).add(projector.getTranslation()).distance(position) < projector.getModuleCount(ItemModuleScale.class);
}
@Override
public void render(IProjector paramIProjector, double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat, long paramLong) {
float scale = 0.15F;
GL11.glScalef(scale, scale, scale);
float radius = 1.5F;
int steps = (int) Math.ceil(3.141592653589793D / Math.atan(1.0D / radius / 2.0D));
for (int phi_n = 0; phi_n < 2 * steps; phi_n++) {
for (int theta_n = 0; theta_n < steps; theta_n++) {
double phi = 6.283185307179586D / steps * phi_n;
double theta = 3.141592653589793D / steps * theta_n;
Vector3D vector = new Vector3D(Math.sin(theta) * Math.cos(phi), Math.cos(theta), Math.sin(theta) * Math.sin(phi)).scale(radius);
GL11.glTranslated(vector.x, vector.y, vector.z);
ModelCube.INSTNACE.render();
GL11.glTranslated(-vector.x, -vector.y, -vector.z);
}
}
}
}
| [
"pwalne12@gmail.com"
] | pwalne12@gmail.com |
ecc9fa89fb55cef32d41b870c496e2b30cac1737 | f4fc8afce5731bf9c7fb1f81554edbc61d61723a | /myapi/src/main/java/com/myapi/config/JacksonCustomProvider.java | a1e80478a633d8511351936898b36745163d9d92 | [] | no_license | danielsantil/java-rest-api | 28df1d26626a48ff65b58b6db0476a915e77b9c3 | 9eda3ddcae5ede493d4f734d2946a450b8f6722d | refs/heads/master | 2021-03-27T09:46:10.423745 | 2017-10-24T03:34:36 | 2017-10-24T03:34:36 | 107,921,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,109 | java | package com.myapi.config;
import javax.ws.rs.ext.ContextResolver;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
public class JacksonCustomProvider implements ContextResolver<ObjectMapper> {
final ObjectMapper defaultObjectMapper;
public JacksonCustomProvider() {
defaultObjectMapper = createDefaultMapper();
}
@Override
public ObjectMapper getContext(Class<?> type) {
return defaultObjectMapper;
}
private static ObjectMapper createDefaultMapper() {
ObjectMapper mapper = new ObjectMapper();
// Ignores unknown properties, same as @JsonIgnoreProperties(ignoreUnknown=true)
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// Makes object mapper recognize standard JAXB annotations
AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(
mapper.getTypeFactory());
mapper.setAnnotationIntrospector(introspector);
return mapper;
}
}
| [
"daniel.shcf@gmail.com"
] | daniel.shcf@gmail.com |
c0aef69d3881e28811a20256ba4211863b65a249 | 08a7eec9b7061135dd340b260833efa41a97d5fa | /task4/Task1/BookShop/src/com/senla/training/FileWorker/FileWorker.java | ed07716bd5808fc1025485629663f2e3eff38ef5 | [] | no_license | DenisTulinsky/SenlaJavaTraining-Tulinsky-Denis- | 21d687183ff2976e2983e8071ca5417f7c9ce377 | 45f83450638beb2b6beb4b6a3608a139ab70d3fd | refs/heads/master | 2021-01-11T01:39:11.670297 | 2017-04-03T10:56:52 | 2017-04-03T10:56:52 | 69,535,584 | 0 | 0 | null | 2016-09-29T08:16:27 | 2016-09-29T05:57:40 | null | UTF-8 | Java | false | false | 3,070 | java | package com.senla.training.FileWorker;
import java.util.List;
import com.danco.training.TextFileWorker;
import com.senla.training.interfaces.IBook;
import com.senla.training.interfaces.IConverter;
import com.senla.training.interfaces.IFileWorker;
import com.senla.training.interfaces.IOrder;
import com.senla.training.interfaces.IPreorder;
import com.senla.training.interfaces.IStorage;
public class FileWorker implements IFileWorker {
private String books_txt = "d:/Books.txt";
private String preorders_txt = "d:/Preorders.txt";
private String orders_txt = "d:/Orders.txt";
private IConverter converter;
public FileWorker(IConverter converter) {
this.converter = converter;
}
@Override
public void writeToFile(IStorage storage) {
// wr books
List<IBook> allBooks = storage.getAllBooks();
TextFileWorker tfwbooks = new TextFileWorker(books_txt);
String[] strBooks = new String[allBooks.size()];
for (IBook book : allBooks) {
String bookString = converter.bookToString(book);
for (int j = 0; j < strBooks.length; j++) {
if (strBooks[j] == null) {
strBooks[j] = bookString;
break;
}
}
}
tfwbooks.writeToFile(strBooks);
// wr orders
List<IOrder> allOrders = storage.getAllOrders();
TextFileWorker tfworders = new TextFileWorker(orders_txt);
String[] strOrders = new String[allOrders.size()];
for (IOrder order : allOrders) {
String orderString = converter.orderToString(order);
for (int j = 0; j < strOrders.length; j++) {
if (strOrders[j] == null) {
strOrders[j] = orderString;
break;
}
}
}
tfworders.writeToFile(strOrders);
// wr preorders
List<IPreorder> allPreorders = storage.getAllPreorders();
TextFileWorker tfwpreorders = new TextFileWorker(preorders_txt);
String[] strPreorders = new String[allPreorders.size()];
for (IPreorder preord : allPreorders) {
String preorderString = converter.preorderToString(preord);
for (int j = 0; j < strPreorders.length; j++) {
if (strPreorders[j] == null) {
strPreorders[j] = preorderString;
break;
}
}
}
tfwpreorders.writeToFile(strPreorders);
}
// read book
@Override
public void readFromFile(IStorage storage) {
TextFileWorker tfw = new TextFileWorker(books_txt);
String[] booksString = tfw.readFromFile();
for (int j = 0; j < booksString.length; j++) {
if (booksString[j] != null) {
storage.addBook(converter.stringToBook(booksString[j]));
}
}
// read preod
TextFileWorker tfwPreord = new TextFileWorker(preorders_txt);
String[] preordersString = tfwPreord.readFromFile();
for (int j = 0; j < preordersString.length; j++) {
if (preordersString[j] != null) {
storage.addPreorder(converter.stringToPreorder(preordersString[j]));
}
}
// read order
TextFileWorker tfwOrder = new TextFileWorker(orders_txt);
String[] ordersString = tfwOrder.readFromFile();
for (int j = 0; j < ordersString.length; j++) {
if (ordersString[j] != null) {
storage.addOrder(converter.stringToOrder(ordersString[j]));
}
}
}
}
| [
"expatriatesky@gmail.com"
] | expatriatesky@gmail.com |
4f915fa64551e215c6e51599b40213d7591e0793 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-13316-2-10-NSGA_II-LineCoverage:ExceptionType:StackTraceSimilarity/com/xpn/xwiki/internal/skin/AbstractSkin_ESTest.java | dd87ccdef2d4e9665c1f05d8b85e22396cb58c2b | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,686 | java | /*
* This file was automatically generated by EvoSuite
* Sun Apr 05 22:41:35 UTC 2020
*/
package com.xpn.xwiki.internal.skin;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import ch.qos.logback.classic.Logger;
import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.internal.skin.EnvironmentSkin;
import com.xpn.xwiki.internal.skin.InternalSkinConfiguration;
import com.xpn.xwiki.internal.skin.InternalSkinManager;
import javax.inject.Provider;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.hibernate.loader.custom.sql.SQLCustomQuery;
import org.junit.runner.RunWith;
import org.xwiki.environment.Environment;
import org.xwiki.rendering.internal.syntax.DefaultSyntaxFactory;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class AbstractSkin_ESTest extends AbstractSkin_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
InternalSkinConfiguration internalSkinConfiguration0 = mock(InternalSkinConfiguration.class, new ViolatedAssumptionAnswer());
Logger logger0 = (Logger)SQLCustomQuery.log;
DefaultSyntaxFactory defaultSyntaxFactory0 = new DefaultSyntaxFactory();
EnvironmentSkin environmentSkin0 = new EnvironmentSkin((String) null, (InternalSkinManager) null, internalSkinConfiguration0, logger0, defaultSyntaxFactory0, (Environment) null, (Provider<XWikiContext>) null);
// Undeclared exception!
environmentSkin0.getOutputSyntax();
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
03eb1e0739a5916782c66c398846827b3c183e4a | 2aac6e7c4a1063ccf95e9a364ab9a70f26414892 | /algorithm/src/algorithm/TestArray.java | e3a23711661b1b282ac200d63cf02ea94b711991 | [] | no_license | 350679778/MyAlgorithmTest | 13569b597a8345c75c47cfce4f6ce857f9da6106 | bf4de59f8024eac6ea3b7e5060676d5651d54c4b | refs/heads/master | 2020-05-20T12:09:42.039940 | 2019-05-08T08:40:04 | 2019-05-08T08:40:04 | 185,565,825 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 862 | java | package algorithm;
public class TestArray {
public static void main(String[] args) {
//创建一个数组
int[] arr1 = new int[3];
//获取数组长度
int length1 = arr1.length;
System.out.println("arr1's length : " + length1);
//访问数组中的元素:数组名[下标] 注意:下标从0开始
int element1 = arr1[0];
System.out.println("element0 : " + element1);
//为数组中的元素赋值
arr1[0] = 99;
System.out.println("element0 : " + arr1[0]);
arr1[1] = 98;
arr1[2] = 97;
//遍历数组
for (int i = 0; i < length1; i++) {
System.out.println("arr1 element" + i + " : " + arr1[i]);
}
//创建数组的同时为数组中的元素赋值
int[] arr2 = new int[]{90,80,70,60,50};
//获取数组的长度
System.out.println("arr2 length : " + arr2.length);
}
}
| [
"350679778@qq.com"
] | 350679778@qq.com |
cfdc8bd8a15f3c3105ba2c83df907c6d7c0dfe3e | 878fff2d2ee1c73b993fba5faef18501a24067dc | /src/JavaDrills/SwitchExercises/SwitchExercise.java | e43687b22c31486d4f80825c9e46d999046e7300 | [] | no_license | angelluis396/JavaIn28Puzzles | 18510a543036dbaea51d87985c5ad0fb034c4d87 | b1c30fc44408b00d43e779f26c83e82d3e8215e5 | refs/heads/master | 2023-05-15T03:31:14.351823 | 2021-06-10T12:44:57 | 2021-06-10T12:44:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,690 | java | package JavaDrills.SwitchExercises;
import java.util.Scanner;
public class SwitchExercise {
public static void main(String[] args) {
//Scanner scanner = new Scanner(System.in);
System.out.println(determineNameOfDay(1));
System.out.println();
}
public static String determineNameOfDay(int dayNum) {
//switch on day number
String result = "";
switch (dayNum) {
case 0:
result = "Sunday";
break;
case 1:
result = "Monday";
break;
case 2:
result = "Tuesday";
break;
case 3:
result = "Wednesday";
break;
case 4:
result = "Thursday";
break;
case 5:
result = "Friday";
break;
case 6:
result = "Saturday";
break;
}
return result;
}
public static String determineNameOfMonth(int monthNum) {
String result = "";
switch (monthNum) {
case 0:
result = "January";
break;
case 1:
result = "February";
break;
case 2:
result = "March";
break;
case 3:
result = "April";
break;
case 4:
result = "May";
break;
case 5:
result = "June";
break;
case 6:
result = "July";
break;
case 7:
result = "August";
break;
case 8:
result = "September";
break;
case 9:
result = "October";
break;
case 10:
result = "November";
break;
case 11:
result = "December";
break;
}
return result;
}
public static boolean isWeekday(int dayNum) {
//Could take advantage of fall through and only return true on case 5 all others will default to false
switch (dayNum){
case 0:
return false;
case 1:
return true;
case 2:
return true;
case 3:
return true;
case 4:
return true;
case 5:
return true;
case 6:
return false;
}
return false;
}
}
| [
"ala31996@gmail.com"
] | ala31996@gmail.com |
f0e4687458bdd90f81a1ac3c639232e90f938354 | 26b3ff7402158f82a8a20324942dd1dd6f60a4d3 | /hmx-core/src/main/java/com/hmx/images/service/impl/HmxImagesServiceImpl.java | 93c75c351a42982a7f947fb831caea3a0944ae97 | [] | no_license | teamwh/hmx | ec0e7cd27c700a3249f8db7352a3c2b383950efe | 40f0e769002238ca039d235d18b2578421557a35 | refs/heads/master | 2020-04-27T08:24:12.304345 | 2019-04-22T02:33:30 | 2019-04-22T02:33:30 | 174,169,927 | 0 | 1 | null | 2019-04-15T02:58:52 | 2019-03-06T15:23:20 | Java | UTF-8 | Java | false | false | 5,795 | java | package com.hmx.images.service.impl;
import java.util.List;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import com.hmx.images.dao.HmxImagesMapper;
import com.hmx.images.entity.HmxImages;
import com.hmx.images.entity.HmxImagesExample;
import com.hmx.images.entity.HmxImagesExample.Criteria;
import com.hmx.images.service.HmxImagesService;
import com.hmx.images.dto.HmxImagesDto;
import com.hmx.utils.result.PageBean;
/**
* Service implementation class
*
*/
@Service
public class HmxImagesServiceImpl implements HmxImagesService{
@Autowired
private HmxImagesMapper hmxImagesMapper;
/**
* @Method: insert
* @Description: 添加
* @param hmxImages 要添加的对象
* @return
*/
@Override
public Boolean insert( HmxImages hmxImages ) {
return hmxImagesMapper.insertSelective( hmxImages ) > 0;
}
/**
* @Method: deleteByIdArray
* @Description: 批量删除
* @param ids 将要删除的对象主键字符串 例如:1,5,10,12
* @return true 删除成功 false 删除失败
*/
@Override
@Transactional
public Boolean deleteByIdArray(String ids) {
List<Integer> idArray = new ArrayList<Integer>();
String[] arrayStr = null ;
try{
if( ids == null || ids == "" ){
return false;
}
if( ids.length() > 0 ){
arrayStr = ids.split(",");
}
for(String strid: arrayStr){
Integer id = Integer.parseInt(strid);
idArray.add(id);
}
HmxImagesExample hmxImagesExample = new HmxImagesExample();
hmxImagesExample.or().andImageIdIn( idArray );
int ret = hmxImagesMapper.deleteByExample( hmxImagesExample );
return ret > 0;
}catch( Exception e ){
e.printStackTrace();
}
return false;
}
/**
* @Method: update
* @Description: 修改
* @param hmxImages 要修改的对象
* @return true 修改成功 false 修改失败
*/
@Override
public Boolean update(HmxImages hmxImages) {
return hmxImagesMapper.updateByPrimaryKeySelective( hmxImages ) > 0;
}
/**
* @Method: info
* @Description: 根据自增主键查询对象信息
* @param hmxImages 根据自增对象查询信息
* @return HmxImages 查询的对象
*/
public HmxImages info (Integer hmxImagesId) {
return hmxImagesMapper.selectByPrimaryKey( hmxImagesId );
}
/**
* @Method: getPage
* @Description: 分页查询
* @param page 分页参数
* @param hmxImagesDto 查询条件
* @return PageBean<HmxImages> 查询到的分页值
*/
public PageBean<HmxImages> getPage(PageBean<HmxImages> page,HmxImagesDto hmxImagesDto) {
HmxImagesExample hmxImagesExample = new HmxImagesExample();
hmxImagesExample.setOffset(page.getStartOfPage());
hmxImagesExample.setLimit(page.getPageSize());
Criteria where = hmxImagesExample.createCriteria();
if ( hmxImagesDto.getImageId() != null && hmxImagesDto.getImageId() != 0 ) {
where.andImageIdEqualTo( hmxImagesDto.getImageId() );
}
if ( StringUtils.isEmpty( hmxImagesDto.getImageUrl() ) ) {
where.andImageUrlEqualTo( hmxImagesDto.getImageUrl() );
}
if ( hmxImagesDto.getCreateTime() != null ) {
where.andCreateTimeEqualTo( hmxImagesDto.getCreateTime() );
}
if ( hmxImagesDto.getNewTime() != null ) {
where.andNewTimeEqualTo( hmxImagesDto.getNewTime() );
}
if ( hmxImagesDto.getState() != null && hmxImagesDto.getState() != 0 ) {
where.andStateEqualTo( hmxImagesDto.getState() );
}
if ( hmxImagesDto.getVersion() != null && hmxImagesDto.getVersion() != 0 ) {
where.andVersionEqualTo( hmxImagesDto.getVersion() );
}
if ( hmxImagesDto.getCreateid() != null && hmxImagesDto.getCreateid() != 0 ) {
where.andCreateidEqualTo( hmxImagesDto.getCreateid() );
}
Integer count = hmxImagesMapper.countByExample( hmxImagesExample );
boolean haveData = page.setTotalNum((int)(long)count);
if(!haveData){
return page;
}
List<HmxImages> data = hmxImagesMapper.selectByExample( hmxImagesExample );
page.setPage(data);
return page;
}
/**
* @Method: list
* @Description: 查询某个条件下的所有数据
* @param hmxImagesDto 查询参数
* @return List<HmxImages> 符合条件的list集合
*/
public List<HmxImages> list( HmxImagesDto hmxImagesDto ) {
HmxImagesExample hmxImagesExample = new HmxImagesExample();
Criteria where = hmxImagesExample.createCriteria();
if ( hmxImagesDto.getImageId() != null && hmxImagesDto.getImageId() != 0 ) {
where.andImageIdEqualTo( hmxImagesDto.getImageId() );
}
if ( !StringUtils.isEmpty( hmxImagesDto.getImageUrl() ) ) {
where.andImageUrlEqualTo( hmxImagesDto.getImageUrl() );
}
if ( hmxImagesDto.getCreateTime() != null ) {
where.andCreateTimeEqualTo( hmxImagesDto.getCreateTime() );
}
if ( hmxImagesDto.getNewTime() != null ) {
where.andNewTimeEqualTo( hmxImagesDto.getNewTime() );
}
if ( hmxImagesDto.getState() != null && hmxImagesDto.getState() != 0 ) {
where.andStateEqualTo( hmxImagesDto.getState() );
}
if ( hmxImagesDto.getVersion() != null && hmxImagesDto.getVersion() != 0 ) {
where.andVersionEqualTo( hmxImagesDto.getVersion() );
}
if ( hmxImagesDto.getCreateid() != null && hmxImagesDto.getCreateid() != 0 ) {
where.andCreateidEqualTo( hmxImagesDto.getCreateid() );
}
if( hmxImagesDto.getLimit() != null ){
hmxImagesExample.setLimit( hmxImagesDto.getLimit() );
}
if( !StringUtils.isEmpty( hmxImagesDto.getOrderByClause() ) ){
hmxImagesExample.setOrderByClause( hmxImagesDto.getOrderByClause() );
}
return hmxImagesMapper.selectByExample(hmxImagesExample);
}
}
| [
"1301934707.com"
] | 1301934707.com |
f26ecb3d9fd3eae6704124d008f998c3bb183b0c | 37372db7f5ad46651221010777a33848085c39dd | /src/main/java/liveu/tvbroadcast/Settings.java | c1499a6ff473fef6f0e0b558d68310f2d18b78ab | [
"Apache-2.0"
] | permissive | LiveU-TV/Tv-Broadcast | 7742934d34a2724a454116a33f7ca6808a1d09d9 | c7f682d90f6e8a9590bcabaaf98061cb3285ec04 | refs/heads/master | 2021-01-12T12:04:08.239342 | 2016-09-25T20:09:05 | 2016-09-25T20:09:05 | 69,114,183 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,443 | java | package liveu.tvbroadcast;
import java.io.PrintStream;
import redsoft.dsagent.*;
public class Settings {
public static boolean TEST_MODE = false; // Is Test-mode enabled
public static String DS; // DS target config, it's a string like "STD:UDP:FILE"
public static String DS_UDPSRV; // DS-UDP server (when UDP target is present)
public static String DS_FILEPATH; // DS-FILE path to be created (when FILE target is present)
/* Ds */
private static final Ds ds = new Ds("Settings");
/**
* set setting from system
*/
public static void init() {
TEST_MODE = Boolean.valueOf(System.getProperty("test.mode"));
DS = System.getProperty("ds");
DS_FILEPATH = System.getProperty("ds.file");
DS_UDPSRV = System.getProperty("ds.srv");
}
public static boolean isPdsActive (int pds_id)
{
if (DS==null)
return false;
switch (pds_id) {
case PDs.PDS_STD: return DS.indexOf("STD") >= 0;
case PDs.PDS_ERR: return DS.indexOf("ERR") >= 0;
case PDs.PDS_UDP: return DS.indexOf("UDP") >= 0;
case PDs.PDS_FILE: return DS.indexOf("FILE") >= 0;
}
return false;
}
/**
* print settings
*/
public static void print(PrintStream ps) {
ps.println("Using settings:");
ps.println(" test.mode=" + TEST_MODE);
ps.flush();
}
/**
* print setting 2 Ds
*/
public static void print2Ds() {
ds.print("TEST_MODE=%s", TEST_MODE);
}
}
| [
"Sergey@liveu.tv"
] | Sergey@liveu.tv |
c93a84ebed561a2b1dba9b7bfe6fda8228d08637 | 2263d7863aa195c404c88318d79919af0d028c84 | /app/src/androidTest/java/com/example/admin/scrollviewwidget/ExampleInstrumentedTest.java | 5f6be9318d25dd2898c5584f9abb63172eef2cc2 | [] | no_license | lieshoang/ScrollViewWidget | c36e13602eb22811ce48f957612f6c5bdc2c9f8e | c03d648342e4b9043579838fe55baba8bf0ba95c | refs/heads/master | 2020-03-28T15:45:52.167147 | 2018-09-13T10:45:26 | 2018-09-13T10:45:26 | 148,623,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package com.example.admin.scrollviewwidget;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.admin.scrollviewwidget", appContext.getPackageName());
}
}
| [
"lieshoang96@users.noreply.github.com"
] | lieshoang96@users.noreply.github.com |
e5e0fc70fbb8119b4b9b551a0c097ebf06f23e44 | feb93a02c6dd3e2ab3c272434544786eaf5a5d95 | /src/main/java/com/java/xdd/activiti/demo/service/CusUserTaskService.java | 10a327f33cd6ca8cedf5f820f4f986fea13435ed | [] | no_license | xdd-organ/xdd-activiti | 81ede8f62a140e01c1fab530ccf8e4e02995d5f4 | 7776f3d97c9e90a94d5398625d878e54bc7b4d1f | refs/heads/master | 2022-06-24T16:50:45.070013 | 2019-10-23T01:10:49 | 2019-10-23T01:10:49 | 215,440,229 | 0 | 0 | null | 2020-10-13T16:45:56 | 2019-10-16T02:35:34 | Java | UTF-8 | Java | false | false | 685 | java | package com.java.xdd.activiti.demo.service;
import com.java.xdd.activiti.demo.bean.CusUserTask;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author xdd
* @date 2019/10/18
*/
@Service
public class CusUserTaskService {
public List<CusUserTask> findByProcDefKey(String businessKey) {
List<CusUserTask> res = new ArrayList<>();
CusUserTask cusUserTask = new CusUserTask();
cusUserTask.setCandidate_ids("001");
cusUserTask.setGroup_id("01");
cusUserTask.setTaskDefKey("taskDefKey");
cusUserTask.setTaskType("1");
res.add(cusUserTask);
return res;
}
}
| [
"767403510@qq.com"
] | 767403510@qq.com |
0bc2319b3bbc2293568a087e984ab55e4e3c1b5c | e4ad56091d7e77c8690c19ad12b143306a672c4b | /app/src/main/java/com/kt/iot/mobile/service/RawdataGraphListService.java | a46625a80bf6f25ed09746072a23b9ce1bf4ca8e | [] | no_license | sinda72/premom-android-kt | 0345ee540b625bacd2b98cb2a159a7a14104ef57 | d95a9b4cc3508d0e600f5f7a31e0f15847220323 | refs/heads/master | 2022-12-10T02:05:29.836416 | 2020-09-08T14:14:02 | 2020-09-08T14:14:02 | 298,968,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,941 | java | package com.kt.iot.mobile.service;
import android.support.v4.app.Fragment;
import com.kt.gigaiot_sdk.TagStrmApi;
import com.kt.gigaiot_sdk.data.Device;
import com.kt.gigaiot_sdk.data.Log;
import com.kt.gigaiot_sdk.data.TagStrm;
import com.kt.gigaiot_sdk.data.TagStrmApiResponse;
import com.kt.gigaiot_sdk.network.ApiConstants;
import com.kt.iot.mobile.data.LogStream;
import com.kt.iot.mobile.utils.ApplicationPreference;
import java.util.ArrayList;
import java.util.List;
/**
* Created by NP1014425901 on 2015-03-12.
*/
public class RawdataGraphListService {
private static final String TAG = RawdataGraphListService.class.getSimpleName();
public interface UpdateListener {
public void onUpdate(List<LogStream> list);
}
private List<UpdateListener> listeners;
private Fragment fragment;
public RawdataGraphListService(Fragment fragment) {
this.fragment = fragment;
this.listeners = new ArrayList<UpdateListener>();
}
public void addListener(UpdateListener listener) {
if (listeners != null && listener != null) {
listeners.add(listener);
}
}
public void removeListener(UpdateListener listener) {
if (listeners != null && listener != null) {
listeners.remove(listener);
}
}
public void updateGraph(List<LogStream> list) {
if (listeners != null) {
for (UpdateListener listener : listeners) {
listener.onUpdate(list);
}
}
}
private LogPollingThread logPollingThread;
public void startPolling(Device device) {
if (logPollingThread != null) {
logPollingThread.stopThread();
}
logPollingThread = new LogPollingThread(device);
logPollingThread.startThread();
}
public void stopPolling() {
if (logPollingThread != null) {
logPollingThread.stopThread();
}
}
class LogPollingThread extends Thread {
private boolean isRunning = false;
private Device device;
LogPollingThread(Device device) {
this.device = device;
}
public void startThread() {
isRunning = true;
this.start();
}
public void stopThread() {
isRunning = false;
}
@Override
public void run() {
if (device != null ) {
if (device.getTagStrmList() != null && device.getTagStrmList().size() > 0) {
TagStrmApi tagStrmApi = new TagStrmApi(ApplicationPreference.getInstance().getPrefAccessToken());
//while(isRunning) {
List<LogStream> logStreams = new ArrayList<LogStream>();
try {
TagStrmApiResponse response = tagStrmApi.getTagStrmLog(device.getSpotDevId(), "100", "5");
if (response.getResponseCode().equals(ApiConstants.CODE_OK)) {
for (TagStrm tag : device.getTagStrmList()) {
if (tag.getTagStrmPrpsTypeCd().equals(TagStrmApi.TAGSTRM_DATA)) {
LogStream logStream = new LogStream();
logStream.setTag(tag);
if (response.getLogs() != null) {
ArrayList<Log> logs = new ArrayList<>();
for(Log tmp : response.getLogs()){
if(tmp.getAttributes().get(tag.getTagStrmId()) != null){
logs.add(tmp);
}
}
if(logs.size() > 0){ //혆재 태그스트림의 데이터가 있어야 logStreams에 추가한다.
/*for(Log tmp : logs) {
android.util.Log.w(TAG, "TAG ID = " + tag.getTagStrmId() + " | value = " + tmp.getAttributes().get(tag.getTagStrmId()));
}*/
logStream.setLogList(logs);
}
logStreams.add(logStream);
}
}
}
updateGraph(logStreams);
}
Thread.sleep(10000);
} catch (Exception e) {
e.printStackTrace();
}
//}
}
}
}
}
}
| [
"sinda72@gmail.com"
] | sinda72@gmail.com |
e3b24698ab436e3c864afaaa17b18a7cff87f631 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/neo4j/2015/8/LegacyLogEntryWriterTest.java | 3015c55bcf7b1aa8eeb1e15b02bb6a4532add81c | [] | 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 | 7,442 | java | /*
* Copyright (c) 2002-2015 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.storemigration.legacylogs;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.neo4j.kernel.impl.storemigration.legacylogs.LegacyLogFilenames.getLegacyLogFilename;
import static org.neo4j.kernel.impl.transaction.log.LogPosition.UNSPECIFIED;
import static org.neo4j.kernel.impl.transaction.log.entry.LogEntryStart.EMPTY_ADDITIONAL_ARRAY;
import static org.neo4j.kernel.impl.transaction.log.entry.LogHeaderReader.readLogHeader;
import static org.neo4j.kernel.impl.transaction.log.entry.LogVersions.CURRENT_LOG_VERSION;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import org.junit.Test;
import org.neo4j.function.Function;
import org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction;
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.kernel.impl.transaction.TransactionRepresentation;
import org.neo4j.kernel.impl.transaction.command.Command;
import org.neo4j.kernel.impl.transaction.log.IOCursor;
import org.neo4j.kernel.impl.transaction.log.LogVersionedStoreChannel;
import org.neo4j.kernel.impl.transaction.log.PhysicalTransactionRepresentation;
import org.neo4j.kernel.impl.transaction.log.WritableLogChannel;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntry;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryCommand;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryCommit;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryStart;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryWriter;
import org.neo4j.kernel.impl.transaction.log.entry.LogHeader;
import org.neo4j.kernel.impl.transaction.log.entry.OnePhaseCommit;
public class LegacyLogEntryWriterTest
{
private final FileSystemAbstraction fs = new EphemeralFileSystemAbstraction();
@Test
public void shouldWriteTheHeaderInTheFile() throws IOException
{
// given
final LegacyLogEntryWriter writer = new LegacyLogEntryWriter( fs );
final File output = new File( getLegacyLogFilename( 3 ) );
final LogHeader header = new LogHeader( CURRENT_LOG_VERSION, 1, 42l );
// when
try ( LogVersionedStoreChannel channel = writer.openWritableChannel( output ) )
{
writer.writeLogHeader( channel, header );
}
// then
assertEquals( header, readLogHeader( fs, output ) );
}
@Test
public void shouldWriteAllTheEntryInACommitToTheFile() throws IOException
{
// given
final LogVersionedStoreChannel channel = mock( LogVersionedStoreChannel.class );
final LogEntryWriter logEntryWriter = mock( LogEntryWriter.class );
final LegacyLogEntryWriter writer = new LegacyLogEntryWriter( fs, liftToFactory( logEntryWriter ) );
final LogEntryStart start = new LogEntryStart( 0, 1, 2l, 3l, EMPTY_ADDITIONAL_ARRAY, UNSPECIFIED );
final LogEntryCommand command = new LogEntryCommand( new Command.NodeCommand() );
final LogEntryCommit commit = new OnePhaseCommit( 42l, 43l );
// when
final IOCursor<LogEntry> cursor = mockCursor( start, command, commit );
writer.writeAllLogEntries( channel, cursor );
// then
verify( logEntryWriter, times( 1 ) ).writeStartEntry( 0, 1, 2l, 3l, EMPTY_ADDITIONAL_ARRAY );
final TransactionRepresentation expected =
new PhysicalTransactionRepresentation( Arrays.asList( command.getXaCommand() ) );
verify( logEntryWriter, times( 1 ) ).serialize( eq( expected ) );
verify( logEntryWriter, times( 1 ) ).writeCommitEntry( 42l, 43l );
}
@Test
public void shouldWriteAllTheEntryInSeveralCommitsToTheFile() throws IOException
{
// given
final LogVersionedStoreChannel channel = mock( LogVersionedStoreChannel.class );
final LogEntryWriter logEntryWriter = mock( LogEntryWriter.class );
final LegacyLogEntryWriter writer = new LegacyLogEntryWriter( fs, liftToFactory( logEntryWriter ) );
final LogEntryStart start1 = new LogEntryStart( 0, 1, 2l, 3l, EMPTY_ADDITIONAL_ARRAY, UNSPECIFIED );
final LogEntryCommand command1 = new LogEntryCommand( new Command.NodeCommand() );
final LogEntryCommit commit1 = new OnePhaseCommit( 42l, 43l );
final LogEntryStart start2 = new LogEntryStart( 9, 8, 7l, 6l, EMPTY_ADDITIONAL_ARRAY, UNSPECIFIED );
final LogEntryCommand command2 = new LogEntryCommand( new Command.RelationshipCommand() );
final LogEntryCommit commit2 = new OnePhaseCommit( 84l, 85l );
// when
IOCursor<LogEntry> cursor = mockCursor( start1, command1, commit1, start2, command2, commit2 );
writer.writeAllLogEntries( channel, cursor );
// then
verify( logEntryWriter, times( 1 ) ).writeStartEntry( 0, 1, 2l, 3l, EMPTY_ADDITIONAL_ARRAY );
final TransactionRepresentation expected1 =
new PhysicalTransactionRepresentation( Arrays.asList( command1.getXaCommand() ) );
verify( logEntryWriter, times( 1 ) ).serialize( eq( expected1 ) );
verify( logEntryWriter, times( 1 ) ).writeCommitEntry( 42l, 43l );
verify( logEntryWriter, times( 1 ) ).writeStartEntry( 9, 8, 7l, 6l, EMPTY_ADDITIONAL_ARRAY );
final TransactionRepresentation expected2 =
new PhysicalTransactionRepresentation( Arrays.asList( command2.getXaCommand() ) );
verify( logEntryWriter, times( 1 ) ).serialize( eq( expected2 ) );
verify( logEntryWriter, times( 1 ) ).writeCommitEntry( 84l, 85l );
}
private Function<WritableLogChannel, LogEntryWriter> liftToFactory( final LogEntryWriter logEntryWriter )
{
return new Function<WritableLogChannel, LogEntryWriter>()
{
@Override
public LogEntryWriter apply( WritableLogChannel ignored )
{
return logEntryWriter;
}
};
}
private IOCursor<LogEntry> mockCursor( final LogEntry... entries )
{
return new IOCursor<LogEntry>()
{
private int pos = 0;
@Override
public LogEntry get()
{
return entries[pos++];
}
@Override
public boolean next() throws IOException
{
return pos < entries.length;
}
@Override
public void close() throws IOException
{// nothing to do
}
};
}
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
03838f7cbbeaa64fbaaf034dca3fdf97c9803f1e | 78edb2421874af1a3fe5eb47e3b29616a75f749b | /RPGQuests/src/com/cracksn0w/rpgquests/QuestRegistry.java | be4016d428c2557e564f34c77ab0ebb60cc0ab96 | [] | no_license | Cracksn0w/RPGQuests | 0f0122c9b5fe9121d7f4a259d42f3897b0daae34 | d91a06dbdd4b33968669c4b1ac84e01b374667a2 | refs/heads/master | 2021-01-10T17:59:22.133222 | 2016-03-09T17:18:44 | 2016-03-09T17:18:44 | 46,428,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,356 | java | package com.cracksn0w.rpgquests;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import com.cracksn0w.rpgquests.companion.QuestCompanion;
import com.cracksn0w.rpgquests.companion.listener.PlayerListener;
import com.cracksn0w.rpgquests.quest.Quest;
import com.cracksn0w.rpgquests.quest.requirement.Requirement;
import com.cracksn0w.rpgquests.quest.requirement.RequirementType;
import com.cracksn0w.rpgquests.quest.reward.Reward;
import com.cracksn0w.rpgquests.quest.reward.RewardType;
import com.cracksn0w.rpgquests.quest.task.CollectTask;
import com.cracksn0w.rpgquests.quest.task.KillTask;
import com.cracksn0w.rpgquests.quest.task.Task;
import com.cracksn0w.rpgquests.quest.task.TaskType;
import com.cracksn0w.rpgquests.utils.IDGen;
public class QuestRegistry {
private IDGen id_gen;
private RPGQuests plugin;
private QuestRegistry instance;
private ArrayList<Quest> quests;
private ArrayList<QuestCompanion> quest_companions;
private PlayerListener player_listener;
public QuestRegistry(RPGQuests plugin) {
this.plugin = plugin;
this.instance = this;
this.id_gen = new IDGen(this);
this.quests = new ArrayList<>();
this.quest_companions = new ArrayList<>();
this.loadQuests();
this.registerPlayerListener();
}
public RPGQuests getPlugin() {
return plugin;
}
public Quest createQuest(String name, String npc_name) {
Quest quest = new Quest(this, name, id_gen.generateID(), npc_name);
quests.add(quest);
return quest;
}
public void removeQuest(Quest quest) {
for(QuestCompanion qc : this.getQCsForQuest(quest)) {
qc.onQuestRemoved();
}
quest.getQuestNPC().remove();
quests.remove(quest);
plugin.getLogger().info("Quest " + quest.getName() + " removed!");
}
public ArrayList<Quest> getQuests() {
return quests;
}
public ArrayList<QuestCompanion> getQuestCompanions() {
return quest_companions;
}
public void createQuestCompanion(Player player, Quest quest) {
quest_companions.add(new QuestCompanion(this, player, quest));
}
public void addQuestCompanion(QuestCompanion qc) {
quest_companions.add(qc);
}
public void removeQuestCompanion(QuestCompanion qc) {
quest_companions.remove(qc);
}
public ArrayList<QuestCompanion> getQCsForCurrentTask(Task task) {
ArrayList<QuestCompanion> result = new ArrayList<>();
for(QuestCompanion qc : quest_companions) {
if(qc.getCurrentTask() == task) {
result.add(qc);
}
}
return result;
}
private ArrayList<QuestCompanion> getQCsForQuest(Quest quest) {
ArrayList<QuestCompanion> result = new ArrayList<>();
for(QuestCompanion qc : quest_companions) {
if(qc.getQuest() == quest) {
result.add(qc);
}
}
return result;
}
public QuestCompanion getQCForQuest(UUID uuid, Quest quest) {
for(QuestCompanion qc : quest_companions) {
if(qc.getUUID().equals(uuid) && qc.getQuest() == quest) {
return qc;
}
}
return null;
}
public ArrayList<QuestCompanion> getQCsForUUID(UUID uuid) {
ArrayList<QuestCompanion> result = new ArrayList<>();
for(QuestCompanion qc : quest_companions) {
if(qc.getUUID().equals(uuid)) {
result.add(qc);
}
}
return result;
}
public Quest getById(int id) {
for(Quest quest : quests) {
if(quest.getId() == id) return quest;
}
return null;
}
private void registerPlayerListener() {
player_listener = new PlayerListener(this);
}
public PlayerListener getPlayerListener() {
return player_listener;
}
private void loadQuests() {
final QuestRegistry reg = this;
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
public void run() {
File folder = new File(plugin.getDataFolder() + "/quests");
if(folder.isDirectory() == false) return;
for(File file : folder.listFiles()) {
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
String name = config.getString("name");
int id = config.getInt("id");
boolean enabled = config.getBoolean("enabled");
ArrayList<Task> tasks = new ArrayList<>();
ArrayList<Reward> rewards = new ArrayList<>();
ArrayList<Requirement> requirements = new ArrayList<>();
ConfigurationSection tasks_section = config.getConfigurationSection("tasks");
for(String key : tasks_section.getKeys(false)) {
ConfigurationSection task_section = tasks_section.getConfigurationSection(key);
TaskType type = TaskType.valueOf(task_section.getString("type"));
switch(type) {
case COLLECT:
Material mat = Material.getMaterial(task_section.getString("material"));
int amount_ct = task_section.getInt("amount");
int mat_data = task_section.getInt("material-data");
tasks.add(new CollectTask(mat, amount_ct, mat_data));
break;
case KILL:
EntityType ent = EntityType.valueOf(task_section.getString("entity"));
int amount_kt = task_section.getInt("amount");
tasks.add(new KillTask(ent, amount_kt));
break;
default:
continue;
}
}
ConfigurationSection rewards_section = config.getConfigurationSection("rewards");
for(String key : rewards_section.getKeys(false)) {
ConfigurationSection reward_section = rewards_section.getConfigurationSection(key);
rewards.add(new Reward(RewardType.valueOf(reward_section.getString("type")), reward_section.get("reward")));
}
ConfigurationSection requirements_section = config.getConfigurationSection("requirements");
for(String key: requirements_section.getKeys(false)) {
ConfigurationSection requirement_section = requirements_section.getConfigurationSection(key);
RequirementType type = RequirementType.valueOf(requirement_section.getString("type"));
Object rqm = requirement_section.get("rqm");
switch(type) {
case ITEM:
rqm = Material.getMaterial((String) rqm);
break;
case LEVEL:
rqm = Integer.parseInt((String) rqm);
break;
default:
continue;
}
requirements.add(new Requirement(type, rqm));
}
ConfigurationSection npc_section = config.getConfigurationSection("npc");
int npc_id = npc_section.getInt("id");
Location npc_loc = (Location) npc_section.get("location");
List<String> npc_msg = npc_section.getStringList("message");
quests.add(new Quest(reg, name, id, npc_id, npc_loc, npc_msg, tasks, rewards, requirements, enabled));
}
}
}, 40);
}
//Serealisiert alle Quests
public void saveQuests() {
for(Quest quest : quests) {
File file = new File(plugin.getDataFolder() + "/quests/" + quest.getName() + ".yml");
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
config.set("name", quest.getName());
config.set("id", quest.getId());
config.set("enabled", quest.isEnabled());
ConfigurationSection tasks = config.createSection("tasks");
for(Task task : quest.getTasks()) {
ConfigurationSection ts = tasks.createSection("" + quest.getTasks().indexOf(task));
ts.set("type", task.getTaskType().toString());
switch(task.getTaskType()) {
case COLLECT:
CollectTask ct = (CollectTask) task;
ts.set("material", ct.getMaterial().toString());
ts.set("amount", ct.getAmount());
ts.set("material-data", ct.getMaterialData());
continue;
case KILL:
KillTask kt = (KillTask) task;
ts.set("entity", kt.getEntityType().toString());
ts.set("amount", kt.getAmount());
continue;
default:
continue;
}
}
ConfigurationSection rewards = config.createSection("rewards");
for(Reward reward : quest.getRewards()) {
ConfigurationSection rs = rewards.createSection("" + quest.getRewards().indexOf(reward));
rs.set("type", reward.getRewardType().toString());
rs.set("reward", reward.getActualReward());
}
ConfigurationSection requirements = config.createSection("requirements");
for(Requirement requirement : quest.getRequirements()) {
ConfigurationSection rqs = requirements.createSection("" + quest.getRequirements().indexOf(requirement));
rqs.set("type", requirement.getRequirementType().toString());
rqs.set("rqm", requirement.getRequirement().toString());
switch(requirement.getRequirementType()) {
case ITEM:
rqs.set("add", requirement.getAddition());
continue;
default:
continue;
}
}
ConfigurationSection npc = config.createSection("npc");
npc.set("id", quest.getQuestNPC().getid());
npc.set("location", quest.getQuestNPC().getLocation());
npc.set("message", quest.getQuestNPC().getMessage());
try {
config.save(file);
} catch (IOException e) {
plugin.getLogger().severe("Die Quest " + quest.getName() + " konnte nicht gespeichert werden!");
}
}
}
public void loadQuestCompanions(final UUID uuid) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
public void run() {
File folder = new File(plugin.getDataFolder() + "/companions");
if(folder.isDirectory() == false) return;
for(File file : folder.listFiles()) {
if(file.getName().contains(uuid.toString()) == false) continue;
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
UUID uuid_qc = UUID.fromString(config.getString("uuid"));
Quest quest = instance.getById(config.getInt("quest"));
if(quest == null) continue;
Task current_task = quest.getTasks().get(config.getInt("current-task"));
//skip loading if quest has no tasks anymore (maybe deleted by user)
if(current_task == null) {
if(quest.getTasks().size() == 0) continue;
current_task = quest.getTasks().get(0);
}
Object progress = config.get("progress");
QuestCompanion qc = new QuestCompanion(instance, uuid_qc, quest, current_task, progress);
qc.onPlayerConnect();
instance.addQuestCompanion(qc);
}
}
});
}
public void saveQuestCompanions(UUID uuid) {
for(QuestCompanion qc : this.getQCsForUUID(uuid)) {
File file = new File(plugin.getDataFolder() + "/companions/" + uuid + "_" + qc.getQuest().getId() + ".yml");
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
config.set("uuid", qc.getUUID().toString());
config.set("quest", qc.getQuest().getId());
config.set("current-task", qc.getQuest().getIndexOfTask(qc.getCurrentTask()));
config.set("progress", qc.getProgress());
qc.onDisable();
quest_companions.remove(qc);
try {
config.save(file);
} catch (IOException e) {
plugin.getLogger().info("Der QuestCompanion von " + qc.getUUID() + " konnte nicht gespeichert werden.");
}
}
}
} | [
"moriklein@web.de"
] | moriklein@web.de |
34a01ce423db615c7907766d452ff39cde6afddb | 095ed047948ba086d6883980ce79d120fb60c7e6 | /src/Servlet/Proposer/DraftServlet.java | 5563de54458b5c05350ad918ea625800db5717f6 | [] | no_license | lbq972149981/MeetingMag | e5573c3c6f5488f3191e7239d68c88187a5b3ce2 | 0096eb6f95d2d6c924b379b5c11c343708241ffc | refs/heads/master | 2020-03-23T11:58:44.071686 | 2018-07-19T05:45:01 | 2018-07-19T05:45:01 | 141,529,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,985 | java | package Servlet.Proposer;
import bean.Proposer;
import bean.RequestBean;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import dbdao.DbConnMethon;
import dbdao.DbConnection;
import dbdao.DbProcedure;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
public class DraftServlet extends HttpServlet{
private static final long serialVersionUID = -5442336831052199861L;
private DbConnection dbConn = null;
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
DbConnMethon dbmethod = new DbConnMethon(dbConn.createStatement());
Proposer pro = new Proposer();
RequestBean.<Proposer>getBean(req,pro);
String action = req.getParameter("action");
switch (action){
case "submit":
pro.setMeet_static("发布");break;
case "save":
pro.setMeet_static("未发布");break;
}
/* String sq = "{call insertPro('" + pro.getPro_name()+ "','" + pro.getMeet_name() + "','"+pro.getMeet_type()+"','"+pro.getMeet_time()+"','"+pro.getMeet_leader()+"','"+pro.getMeet_staff()+"','"+pro.getMeet_branch()+"','"+pro.getMeet_content()+"','"+pro.getMeet_theme()+"','"+pro.getMeet_static()+"')}";
DbProcedure procedure = new DbProcedure();
procedure.executeProceduce(sq);*/
String sq = "{call insertPro('" + pro.getPro_name()+ "','" + pro.getMeet_name() + "','"+pro.getMeet_type()+"','"+pro.getMeet_time()+"','"+pro.getMeet_leader()+"','"+pro.getMeet_staff()+"','"+pro.getMeet_branch()+"','"+pro.getMeet_content()+"','"+pro.getMeet_theme()+"','"+pro.getMeet_static()+"')}";
int tiao = dbmethod.insert(sq);
//int tiao = dbmethod.insert("insert into proposer_t(pro_name,meet_name,meet_type,meet_time,meet_leader,meet_staff,meet_branch,meet_content,meet_theme,meet_static) values('" + pro.getPro_name()+ "','" + pro.getMeet_name() + "','"+pro.getMeet_type()+"','"+pro.getMeet_time()+"','"+pro.getMeet_leader()+"','"+pro.getMeet_staff()+"','"+pro.getMeet_branch()+"','"+pro.getMeet_content()+"','"+pro.getMeet_theme()+"','"+pro.getMeet_static()+"')");
List<Proposer> list = null;
try {
list=(List<Proposer>)dbmethod.<Proposer>queryObjectList("{call selectPro()}", Proposer.class.getName());
} catch (Exception e) {
e.printStackTrace();
}
req.setAttribute("list",list);
req.getRequestDispatcher("defendMapply.jsp").forward(req,resp);
}
@Override
public void init() throws ServletException {
super.init();
dbConn = (DbConnection)this.getServletContext().getAttribute("conn");
}
}
| [
"972149981@qq.com"
] | 972149981@qq.com |
ca6ccc4613930d0ada12f4b49619f0d40c1f4c5e | 06202c1ef37da24a34907e19eeb5c750aeb1e71e | /app/src/main/java/com/taihe/eggshell/widget/CircleImageView.java | edacd390d8626ebcf19a7c0a98d7908d9b72ef78 | [] | no_license | TaiHeCodeControl/taihe_android | 29abe0ce814152b2fd9656a55faf33a64ba4e594 | 8c0fe813eaae5b04f7c40110e5fd30200fa5a7fd | refs/heads/master | 2021-01-17T10:34:20.990086 | 2016-02-24T02:52:03 | 2016-02-24T02:52:03 | 38,236,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,827 | java | package com.taihe.eggshell.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.util.AttributeSet;
import android.widget.ImageView;
import com.taihe.eggshell.R;
public class CircleImageView extends ImageView {
private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP;
private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888;
private static final int COLORDRAWABLE_DIMENSION = 2;
private static final int DEFAULT_BORDER_WIDTH = 0;
private static final int DEFAULT_BORDER_COLOR = Color.BLACK;
private final RectF mDrawableRect = new RectF();
private final RectF mBorderRect = new RectF();
private final Matrix mShaderMatrix = new Matrix();
private final Paint mBitmapPaint = new Paint();
private final Paint mBorderPaint = new Paint();
private int mBorderColor = DEFAULT_BORDER_COLOR;
private int mBorderWidth = DEFAULT_BORDER_WIDTH;
private Bitmap mBitmap;
private BitmapShader mBitmapShader;
private int mBitmapWidth;
private int mBitmapHeight;
private float mDrawableRadius;
private float mBorderRadius;
private ColorFilter mColorFilter;
private boolean mReady;
private boolean mSetupPending;
public CircleImageView(Context context) {
super(context);
init();
}
public CircleImageView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CircleImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0);
mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_border_width, DEFAULT_BORDER_WIDTH);
mBorderColor = a.getColor(R.styleable.CircleImageView_border_color, DEFAULT_BORDER_COLOR);
a.recycle();
init();
}
private void init() {
super.setScaleType(SCALE_TYPE);
mReady = true;
if (mSetupPending) {
setup();
mSetupPending = false;
}
}
@Override
public ScaleType getScaleType() {
return SCALE_TYPE;
}
@Override
public void setScaleType(ScaleType scaleType) {
if (scaleType != SCALE_TYPE) {
throw new IllegalArgumentException(String.format("ScaleType %s not supported.", scaleType));
}
}
@Override
public void setAdjustViewBounds(boolean adjustViewBounds) {
if (adjustViewBounds) {
throw new IllegalArgumentException("adjustViewBounds not supported.");
}
}
@Override
protected void onDraw(Canvas canvas) {
if (getDrawable() == null) {
return;
}
canvas.drawCircle(getWidth() / 2, getHeight() / 2, mDrawableRadius, mBitmapPaint);
if (mBorderWidth != 0) {
canvas.drawCircle(getWidth() / 2, getHeight() / 2, mBorderRadius, mBorderPaint);
}
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
setup();
}
public int getBorderColor() {
return mBorderColor;
}
public void setBorderColor(int borderColor) {
if (borderColor == mBorderColor) {
return;
}
mBorderColor = borderColor;
mBorderPaint.setColor(mBorderColor);
invalidate();
}
public int getBorderWidth() {
return mBorderWidth;
}
public void setBorderWidth(int borderWidth) {
if (borderWidth == mBorderWidth) {
return;
}
mBorderWidth = borderWidth;
setup();
}
@Override
public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
mBitmap = bm;
setup();
}
@Override
public void setImageDrawable(Drawable drawable) {
super.setImageDrawable(drawable);
mBitmap = getBitmapFromDrawable(drawable);
setup();
}
@Override
public void setImageResource(int resId) {
super.setImageResource(resId);
mBitmap = getBitmapFromDrawable(getDrawable());
setup();
}
@Override
public void setImageURI(Uri uri) {
super.setImageURI(uri);
mBitmap = getBitmapFromDrawable(getDrawable());
setup();
}
@Override
public void setColorFilter(ColorFilter cf) {
if (cf == mColorFilter) {
return;
}
mColorFilter = cf;
mBitmapPaint.setColorFilter(mColorFilter);
invalidate();
}
private Bitmap getBitmapFromDrawable(Drawable drawable) {
if (drawable == null) {
return null;
}
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
try {
Bitmap bitmap;
if (drawable instanceof ColorDrawable) {
bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG);
} else {
bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), BITMAP_CONFIG);
}
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
return bitmap;
} catch (OutOfMemoryError e) {
return null;
}
}
private void setup() {
if (!mReady) {
mSetupPending = true;
return;
}
if (mBitmap == null) {
return;
}
mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mBitmapPaint.setAntiAlias(true);
mBitmapPaint.setShader(mBitmapShader);
mBorderPaint.setStyle(Paint.Style.STROKE);
mBorderPaint.setAntiAlias(true);
mBorderPaint.setColor(mBorderColor);
mBorderPaint.setStrokeWidth(mBorderWidth);
mBitmapHeight = mBitmap.getHeight();
mBitmapWidth = mBitmap.getWidth();
mBorderRect.set(0, 0, getWidth(), getHeight());
mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2);
mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth);
mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2);
updateShaderMatrix();
invalidate();
}
private void updateShaderMatrix() {
float scale;
float dx = 0;
float dy = 0;
mShaderMatrix.set(null);
if (mBitmapWidth * mDrawableRect.height() > mDrawableRect.width() * mBitmapHeight) {
scale = mDrawableRect.height() / (float) mBitmapHeight;
dx = (mDrawableRect.width() - mBitmapWidth * scale) * 0.5f;
} else {
scale = mDrawableRect.width() / (float) mBitmapWidth;
dy = (mDrawableRect.height() - mBitmapHeight * scale) * 0.5f;
}
mShaderMatrix.setScale(scale, scale);
mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth, (int) (dy + 0.5f) + mBorderWidth);
mBitmapShader.setLocalMatrix(mShaderMatrix);
}
} | [
"488238623@qq.com"
] | 488238623@qq.com |
a9c880ae5d7cf1d8c1e3b51a3ad6c8050e978870 | 75a8892e4be8c81cbebc07153d53ccc379528287 | /capitulo13/devices/Scanner.java | 8279467662870cab063926a87734f779769eab01 | [] | no_license | lfbessegato/Estudos-Java | da2d50c5965eae6b804306fef0457885341f7ac1 | d358a777feb967147c125bf10cf302a1e9b96e43 | refs/heads/master | 2020-08-07T02:04:22.877913 | 2019-10-06T22:26:50 | 2019-10-06T22:26:50 | 213,252,991 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 82 | java | package course.capitulo13.devices;
public interface Scanner {
String scan();
}
| [
"lfrbessegato@gmail.com"
] | lfrbessegato@gmail.com |
439423ccc7b1872275ac2547df76facc09c7dfe4 | a5c1e2a08db1a6d6d43dda696750efebb8a7f0c8 | /Lab2/MedianThread.java | fdbfa44b9d3db0a4c66310edf1493d89682a7ac3 | [] | no_license | woshibiantai/50-005 | 2cc80573f1a765dcc5627c020a5c1aaf66c3b9fd | 65692afb55df34af46cac336b4221b0346dd78c3 | refs/heads/master | 2021-01-23T03:27:03.188209 | 2017-04-03T01:36:36 | 2017-04-03T01:36:36 | 86,076,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,063 | java | import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;
public class MedianThread {
ArrayList<Integer> readExternalFile(String filePath, int inputSize) throws FileNotFoundException {
Scanner inputScanner = new Scanner(new File(filePath));
ArrayList<Integer> arrayOutput = new ArrayList<>(inputSize);
int i = 0;
while (inputScanner.hasNext()) {
arrayOutput.add(i, inputScanner.nextInt());
i++;
}
return arrayOutput;
}
public ArrayList<MedianMultiThread> createThreads(int numOfThreads, ArrayList<ArrayList<Integer>> subArrays) {
ArrayList<MedianMultiThread> threadArrayList = new ArrayList<>(numOfThreads);
for (int i = 0; i < numOfThreads; i++) {
MedianMultiThread thread = new MedianMultiThread(subArrays.get(i));
threadArrayList.add(thread);
}
return threadArrayList;
}
private ArrayList<ArrayList<Integer>> partitioningArray(ArrayList<Integer> originalArray, int inputSize, int numOfThread) {
int subArraySize = inputSize/numOfThread;
ArrayList<ArrayList<Integer>> outputArray = new ArrayList<>(numOfThread);
int startingIndex = 0;
int endingIndex = subArraySize - 1;
for (int i = 0; i < numOfThread; i++) {
ArrayList<Integer> splitArray = new ArrayList<>(originalArray.subList(startingIndex,endingIndex));
outputArray.add(i,splitArray);
startingIndex += subArraySize;
endingIndex += subArraySize;
}
return outputArray;
}
public static void main(String[] args) throws InterruptedException, FileNotFoundException {
MedianThread medianThread = new MedianThread();
// TODO: read data from external file and store it in an array
// Note: you should pass the file as a first command line argument at runtime.
String filePath = args[0];
int inputSize = 524288;
ArrayList<Integer> originalArray = medianThread.readExternalFile(filePath,inputSize);
// define number of threads
int NumOfThread = Integer.parseInt(args[1]);;
// int NumOfThread = Integer.parseInt(args[2]);
// TODO: partition the array list into N subArrays, where N is the number of threads
ArrayList<ArrayList<Integer>> subArrays = medianThread.partitioningArray(originalArray,inputSize,NumOfThread);
// TODO: start recording time
long startTime = System.currentTimeMillis();
// TODO: create N threads and assign subArrays to the threads so that each thread sorts
// its repective subarray. For example,
ArrayList<MedianMultiThread> threadArrayList = medianThread.createThreads(NumOfThread,subArrays);
// TODO: start each thread to execute your sorting algorithm defined under the run() method, for example,
for (MedianMultiThread thread : threadArrayList) {
thread.start();
}
for (MedianMultiThread thread : threadArrayList) {
thread.join();
}
// TODO: use any merge algorithm to merge the sorted subarrays and store it to another array, e.g., sortedFullArray.
ArrayList<ArrayList<Integer>> sortedArrays = new ArrayList<>();
for (MedianMultiThread thread : threadArrayList) {
sortedArrays.add(thread.getInternal());
}
ArrayList<Integer> sortedFullArray = medianThread.mergeKSortedArray(sortedArrays);
//TODO: get median from sortedFullArray
//e.g, computeMedian(sortedFullArray);
double output = computeMedian(sortedFullArray);
// TODO: stop recording time and compute the elapsed time
long finalTime = System.currentTimeMillis();
long timeElapsed = finalTime - startTime;
// TODO: printout the final sorted array
// TODO: printout median
System.out.println("The Median value is ...");
System.out.println(output);
System.out.println("Running time is " + timeElapsed + " milliseconds\n");
}
public static ArrayList<Integer> mergeKSortedArray(ArrayList<ArrayList<Integer>> arr) {
//PriorityQueue is heap in Java
PriorityQueue<ArrayContainer> queue = new PriorityQueue<ArrayContainer>();
int total=0;
//add arrays to heap
for (int i = 0; i < arr.size(); i++) {
queue.add(new ArrayContainer(arr.get(i), 0));
total = total + arr.get(i).size();
}
int m=0;
// int result[] = new int[total];
ArrayList<Integer> result = new ArrayList<>(total);
//while heap is not empty
while(!queue.isEmpty()){
ArrayContainer ac = queue.poll();
result.add(m++,ac.arr.get(ac.index));
// result[m++]=ac.arr.get(ac.index);
if(ac.index < ac.arr.size()-1){
queue.add(new ArrayContainer(ac.arr, ac.index+1));
}
}
return result;
}
public static double computeMedian(ArrayList<Integer> inputArray) {
//TODO: implement your function that computes median of values of an array
int arraySize = inputArray.size();
int midpoint = arraySize / 2;
return inputArray.get(midpoint);
}
}
class ArrayContainer implements Comparable<ArrayContainer> {
ArrayList<Integer> arr;
int index;
public ArrayContainer(ArrayList<Integer> arr, int index) {
this.arr = arr;
this.index = index;
}
@Override
public int compareTo(ArrayContainer o) {
return this.arr.get(this.index) - o.arr.get(o.index);
}
}
// extend Thread
class MedianMultiThread extends Thread {
private ArrayList<Integer> list;
public ArrayList<Integer> getInternal() {
return list;
}
MedianMultiThread(ArrayList<Integer> array) {
list = array;
}
public void run() {
// called by object.start()
mergeSort(list);
}
public static void main(String[] args) {
ArrayList<Integer> input = new ArrayList<>(Arrays.asList(5,1,2,8,9,3,4,6,2,7,6,3,9,0));
MedianMultiThread medianMultiThread = new MedianMultiThread(input);
System.out.println("mergeSort: " + medianMultiThread.mergeSort(input));
}
// TODO: implement merge sort here, recursive algorithm
private ArrayList<Integer> mergeSort (ArrayList<Integer> list) {
ArrayList<Integer> firstHalf = new ArrayList<>();
ArrayList<Integer> secondHalf = new ArrayList<>();
int midpoint;
if (list.size() == 1) {
return list;
} else {
midpoint = list.size()/2;
for (int i = 0; i < midpoint; i++) {
firstHalf.add(list.get(i));
}
for (int i = midpoint; i < list.size(); i++) {
secondHalf.add(list.get(i));
}
firstHalf = mergeSort(firstHalf);
secondHalf = mergeSort(secondHalf);
merge(firstHalf,secondHalf,list);
}
return list;
}
private void merge(ArrayList<Integer> firstHalf, ArrayList<Integer> secondHalf, ArrayList<Integer> list) {
int firstIndex = 0;
int secondIndex = 0;
int listIndex = 0;
while (firstIndex < firstHalf.size() && secondIndex < secondHalf.size()) {
if (firstHalf.get(firstIndex) < secondHalf.get(secondIndex)) {
list.set(listIndex,firstHalf.get(firstIndex));
firstIndex++;
} else {
list.set(listIndex,secondHalf.get(secondIndex));
secondIndex++;
}
listIndex++;
}
while (firstIndex < firstHalf.size()) {
list.set(listIndex,firstHalf.get(firstIndex));
firstIndex++;
listIndex++;
}
while (secondIndex < secondHalf.size()) {
list.set(listIndex,secondHalf.get(secondIndex));
secondIndex++;
listIndex++;
}
}
}
| [
"ruthwongny@gmail.com"
] | ruthwongny@gmail.com |
87c06b3fd49197db20184d61f501f6e31892fcce | ac431e3bc46ce6630dede39ccd464cc76e9efabc | /src/lesson03/a_inheritance/Color.java | 16ac583695859bda96a4d1ded4b402d759a7b405 | [] | no_license | viktoriyatkachuk/viktoriyatkachuk | 94be6f5ae823d7f78d7e556c9b36e578ed6a8fc0 | 2433982468ca35f9967dfaf1aeeaad9071166fe1 | refs/heads/master | 2020-07-06T21:21:44.418872 | 2019-09-09T20:55:44 | 2019-09-09T20:55:44 | 203,141,201 | 0 | 0 | null | 2019-09-09T20:55:45 | 2019-08-19T09:27:23 | Java | UTF-8 | Java | false | false | 256 | java | package lesson03.a_inheritance;
public enum Color {
RED("red"),
GREEN("green"),
BLUE("blue");
private String color;
Color(String color) {
this.color = color;
}
public String getColor() {
return color;
}
} | [
"kievjobrule@gmail.com"
] | kievjobrule@gmail.com |
5f432c195e8a98c14c8d84ef1fc045c8f3aa61db | 160cb145fead9b03b7a124a5f6cda49f706e95f3 | /bookcart_monolith/src/main/java/aakash/monolith/bookcart_monolith/BookcartMonolithApplication.java | f1e0cf3ba0515993d86c38eb5d8dd29e237c422e | [
"Apache-2.0"
] | permissive | aakashmishra1991/bookcart | c36d8c1bf4de7667d5a82ec4a4ee128f87896982 | 67955b9b7cadf0a7d2ff874ec328ec8902a39910 | refs/heads/main | 2023-06-26T23:44:08.274392 | 2021-07-20T15:35:50 | 2021-07-20T15:35:50 | 374,737,583 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package aakash.monolith.bookcart_monolith;
import aakash.monolith.bookcart_monolith.dao.model.UserDetails;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BookcartMonolithApplication {
public static void main(String[] args) {
UserDetails userDetails = new UserDetails();
userDetails.getId();
SpringApplication.run(BookcartMonolithApplication.class, args);
}
}
| [
"aakashmishra1991@gmail.com"
] | aakashmishra1991@gmail.com |
e5a2b464393b88d898da4d89698d670bdd50c863 | d1968914261a8ebdf4e63fa19bbbd4dea3eb5507 | /src/main/java/tran/compbuildbackend/CompBuildBackendApplication.java | 3b88f3d7863063afec2bbcd7083f527f746690ce | [] | no_license | ttran9/heroku-comp-build | 60753128e9518b8a7a9cf3a37073fb47c1afc522 | 94b1650242727a0cf727f1b0c66c33e88f1e2918 | refs/heads/master | 2022-06-07T07:11:11.323426 | 2019-08-09T02:39:44 | 2019-08-09T02:39:44 | 200,948,314 | 0 | 0 | null | 2022-05-20T21:04:38 | 2019-08-07T01:21:13 | Java | UTF-8 | Java | false | false | 346 | java | package tran.compbuildbackend;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CompBuildBackendApplication {
public static void main(String[] args) {
SpringApplication.run(CompBuildBackendApplication.class, args);
}
}
| [
"wptran58@gmail.com"
] | wptran58@gmail.com |
3228013a035ba3cfae5f4b8298f2c47a98f81fce | a27c7f605172ab45ad18aa0e2d41500f63e55f45 | /hilos/src/main/java/ar/edu/um/programacion2_2018/prod_cons/ContenedorBerreta.java | 49d94176632ab85153011a9f96ec94a6b37d46eb | [] | no_license | fvillarreal/UMProgramacion2-2018-ejemplos | 332bf272b20402d3da2e1b9312bd0a6e1de5cec6 | 441e3857f3ffac0bf738bc92c8738334671da63b | refs/heads/master | 2020-03-12T23:54:08.667568 | 2018-09-13T13:40:47 | 2018-09-13T13:40:47 | 130,876,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 872 | java | package ar.edu.um.programacion2_2018.prod_cons;
public class ContenedorBerreta implements Container{
protected String elemento;
public ContenedorBerreta() {
this.elemento = "";
}
public String getElemento() {
String retornar = this.elemento;
this.elemento = "";
//System.out.println("elemento obtenido");
return retornar;
}
public void ponerElemento(String elemento) {
char[] caracteres = elemento.toCharArray();
for(int i = 0; i < caracteres.length; i++) {
this.elemento = this.elemento + String.valueOf(caracteres[i]);
try {
Thread.sleep(35);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
//this.elemento = elemento;
//System.out.println("elemento puesto");
}
}
| [
"fvillarreal@matterport.com"
] | fvillarreal@matterport.com |
dd55e02e9c4f55a9700db85052e56ca8ceb962be | bb98d18639f9e21947ab95a131563a03bbae2e7c | /src/main/java/com/example/demo/models/GenericResponse.java | f31707ed5cd9aca491a41a23f814e4e6db86b9b4 | [] | no_license | yash-chokhani/demo | 8fb13d097101a93b27e8021c38cb7fb06235cd43 | 7c8f91e387cb368a3d5f597b301c1c8fe7955dff | refs/heads/master | 2023-07-07T18:11:30.839541 | 2021-08-16T12:37:20 | 2021-08-16T12:37:20 | 396,787,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.example.demo.models;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class GenericResponse {
private boolean success;
private String errorResponse;
private Object data;
} | [
"yash.chokhani@oyorooms.com"
] | yash.chokhani@oyorooms.com |
d5d36263fdd9ac4196b4905f178c362a354202da | a8c028477177ae2e93e8c0f63222edfc7201326f | /src/main/java/com/vjava/transfer1/config/SecurityConfig.java | 2c1d940e5e12796cbaac2428942bb77d96bf2ae9 | [] | no_license | Valentin-java/S.Bootnew1 | 33fb81e33894378f938a50fd7a7092aee839d26c | 1562f1a5e8ad563df71e10fbccd6591c48eb4abc | refs/heads/master | 2023-09-04T06:38:33.609720 | 2021-10-19T12:59:40 | 2021-10-19T12:59:40 | 418,508,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,170 | java | package com.vjava.transfer1.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
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.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.filter.HiddenHttpMethodFilter;
import java.util.Arrays;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private final UserDetailsService userDetailsService;
private final LoginSuccessHandler loginSuccessHandler;
@Autowired
public SecurityConfig(@Qualifier("userDetailsServiceImpl") UserDetailsService userDetailsService, LoginSuccessHandler loginSuccessHandler) {
this.userDetailsService = userDetailsService;
this.loginSuccessHandler = loginSuccessHandler;
}
@Autowired
public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/").hasRole("ADMIN")
.antMatchers("/page").hasRole("USER")
.and()
.formLogin()
.successHandler(loginSuccessHandler)
.and()
.logout().logoutSuccessUrl("/");
}
public BCryptPasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
| [
"v_tin@mail.ru"
] | v_tin@mail.ru |
fbf2f5fa18fa5140cbe2b16cedef62b8926851ca | 5c264d5b9fdae5ace16e68254db252b35c2c15c9 | /src/test/java/one/digitalinnovation/beerstock/utils/JsonConvertionUtils.java | 23971afebec0a3e83a2a6d8bc9a7892ec4a99d81 | [] | no_license | vamaral2020/unit_tests_of_the_beer_management_api | 812ecac0807d13a12eeb827a5457c2a3161db5ae | d9264f627d130854d62b5aa6edf4a3ae46ed5369 | refs/heads/master | 2023-03-28T04:14:04.351025 | 2021-03-31T18:18:06 | 2021-03-31T18:18:06 | 352,752,754 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | package one.digitalinnovation.beerstock.utils;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
public class JsonConvertionUtils {
public static String asJsonString(Object bookDTO){
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.registerModule(new JavaTimeModule());
try {
return objectMapper.writeValueAsString(bookDTO);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
| [
"vagner2013.vrda@gmail.com"
] | vagner2013.vrda@gmail.com |
5219bef37d5283bc15230cfed13fb348933469bc | fd5f04385e954b73d12cf3f9b3336fe50ec3f6a8 | /src/cn/jiansuyan/game1/GameFrame5.java | a7ac729e2757f8d4d835eec1e05273b921c6b78e | [] | no_license | jiansuyan/GameFrame | 43e8447726fee19aeb1d1151de8b9e14dd7b1a16 | b23c9cf6cb88a972cf2c800661766b022a967c10 | refs/heads/master | 2020-12-04T08:09:17.868579 | 2016-08-27T07:53:58 | 2016-08-27T07:53:58 | 66,702,808 | 0 | 0 | null | null | null | null | ISO-8859-7 | Java | false | false | 1,177 | java | package cn.jiansuyan.game1;
import java.awt.Color;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/**
* The game frame class,
* test the frame moving with all kind of
*
* @author test
*
*/
public class GameFrame5 extends MyFrame { //GUI:AWT, swing
Image img = GameUtil.getImage("images/test.jpg");
private double x=100, y=100;
private boolean left;
private double degree = 3.14/3; //[0,2pi], »‘ΆΘ
@Override
public void paint(Graphics g) {
g.drawImage(img, (int)x, (int)y, null);
x += 30*Math.cos(degree);
y += 30*Math.sin(degree);
if(y> 500-30){
degree = -degree;
}
if(y < 30){
degree = -degree;
}
if(x < 0){
degree = Math.PI - degree;
}
if(x >500 -30){
degree = Math.PI - degree;
}
/* if(left){
x -= 3;
}else{
x += 3;
}
if(x > 500){
left = true;
}
if(x < 0){
left = false;
}
*/
}
public static void main(String[] args){
GameFrame5 gf = new GameFrame5();
gf.launchFrame();
}
}
| [
"test@SW-CNKC-SDR505L.apac.wdpr.disney.com"
] | test@SW-CNKC-SDR505L.apac.wdpr.disney.com |
9ef9e7d73d87056a2cbe6adc11b14a05d2ece8b9 | 3d2deb1e3209be164d29b2ce7cb4e212e6ea120d | /src/sample/SampleController.java | e6a584023d825fbe4b98454b2d5fc44e30c96b15 | [] | no_license | azheng8072/fxIntroduction | 9807ea557d4acd856f04b9eaac44fdd2edee70cb | c9214a041250951dc54c9aeb8f975b599cb839d0 | refs/heads/master | 2020-04-11T04:32:53.165125 | 2018-12-12T16:29:20 | 2018-12-12T16:29:20 | 161,515,819 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package sample;
import javafx.event.ActionEvent;
import javafx.scene.control.Label;
public class SampleController
{
public Label helloWorld;
public void sayHelloWorld(ActionEvent actionEvent)
{
helloWorld.setText("Hello World!");
}
}
| [
"BT_1N3_14@bktech.local"
] | BT_1N3_14@bktech.local |
8176e81d27298de3bfe0fe720be539cb9891e837 | 47e3740b9ec46637d820e981053a51745dc66b73 | /MicrobankCli/CliSimbiosis/src/org/simbiosis/cli/base/TestUtils.java | 0bc3da40590ab44c920d44117d30857f11c24465 | [] | no_license | simbiosis1/MicrobankApp | 4051a30d9147085df905b9105dc6669e9aa2b365 | 7d9ac104893985aa0e6c39b850a51b360852ff3c | refs/heads/master | 2020-06-04T22:39:58.886792 | 2015-07-21T00:50:01 | 2015-07-21T00:50:01 | 33,455,226 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package org.simbiosis.cli.base;
import org.joda.time.DateTime;
public class TestUtils {
private DateTools dateTools = new DateTools();
public static void main(String[] args) {
new TestUtils();
}
public TestUtils() {
DateTime date = dateTools.getValidDate(35, 2,2015);
System.out.println("Tanggal yang keluar = "+dateTools.getDateTimeFormatter().print(date));
}
}
| [
"iwanaf@gmail.com"
] | iwanaf@gmail.com |
82db532417e619da460c01406a2d80ead091334d | 38287b8e62016230551840c9d4c8fbd4e473f420 | /mallcore/src/main/java/com/hxqc/mall/core/views/dialog/SubmitDialog.java | f393191bfe5d3154c0f1108cdbc641e92374336e | [] | no_license | isliulin/Mall3 | f950f87376b9573ee196b762eb1833d8b5c145d8 | b27f73feb17e93cb6fd0d4991fd99c1037dd0427 | refs/heads/master | 2023-03-15T23:24:33.795603 | 2017-02-16T07:03:58 | 2017-02-16T07:03:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | package com.hxqc.mall.core.views.dialog;
import android.app.Dialog;
import android.content.Context;
import android.view.Window;
import android.widget.TextView;
import com.hxqc.mall.core.R;
/**
* 说明:提交内容对话框
*
* author: 吕飞
* since: 2015-03-25
* Copyright:恒信汽车电子商务有限公司
*/
public class SubmitDialog extends Dialog {
public TextView mTextView;
public SubmitDialog(Context context) {
super(context);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_submit);
setCancelable(false);
mTextView = (TextView) findViewById(R.id.text);
}
public SubmitDialog(Context context,String text) {
super(context);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_submit);
setCancelable(false);
mTextView = (TextView) findViewById(R.id.text);
mTextView.setText(text);
}
public void setText(String text) {
mTextView.setText(text);
}
}
| [
"1239251224@qq.com"
] | 1239251224@qq.com |
720d557bb5a1c7d84ab80514620cf5b1713ad1b0 | be240016a8f3d0b41e1f18e9f08136b2ee142f55 | /src/test/java/me/mikeintoch/MovieResourceTest.java | ee95d5ff3e332589f98e8121934ad3c13b872789 | [] | no_license | mikeintoch/apicurio-avro | d7c0f99830da090c4b780a34df83c80308d5aef8 | d21c4cb2c2fee2a5a87916c09e02548ebbc89f1f | refs/heads/main | 2023-01-23T10:39:52.497358 | 2020-11-12T18:34:21 | 2020-11-12T18:34:21 | 312,363,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package me.mikeintoch;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;
@QuarkusTest
public class MovieResourceTest {
@Test
public void testHelloEndpoint() {
given()
.when().get("/movies")
.then()
.statusCode(200)
.body(is("hello"));
}
} | [
"mdelgadi@redhat.com"
] | mdelgadi@redhat.com |
a666c9070d8cbb0518c12412595accc68fb66f03 | 6da21ffe86495aa928a7173824139ea7ae04dcc9 | /hunit/hunit-impl/src/main/java/ca/uhn/hunit/iface/AbstractJmsInterfaceImpl.java | 5db7977b0d2382259d6adc216c9408294f4095b6 | [] | no_license | ppazos/hapi-testpanel | 8ae94e1ce194940f51c8112db986bddf0786d9fc | 445d8e19be146c32a7d81298c8e77be0ad4fbbfb | refs/heads/master | 2021-01-20T01:35:44.112540 | 2017-04-25T05:19:27 | 2017-04-25T05:19:36 | 89,303,678 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,595 | java | /**
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
* specific language governing rights and limitations under the License.
*
* The Initial Developer of the Original Code is University Health Network. Copyright (C)
* 2001. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the terms of the
* GNU General Public License (the "GPL"), in which case the provisions of the GPL are
* applicable instead of those above. If you wish to allow use of your version of this
* file only under the terms of the GPL and not to allow others to use your version
* of this file under the MPL, indicate your decision by deleting the provisions above
* and replace them with the notice and other provisions required by the GPL License.
* If you do not delete the provisions above, a recipient may use your version of
* this file under either the MPL or the GPL.
*/
package ca.uhn.hunit.iface;
import java.beans.PropertyVetoException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.commons.lang.StringUtils;
import org.springframework.jms.JmsException;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import ca.uhn.hunit.event.InterfaceInteractionEnum;
import ca.uhn.hunit.ex.ConfigurationException;
import ca.uhn.hunit.ex.InterfaceWontSendException;
import ca.uhn.hunit.ex.InterfaceWontStartException;
import ca.uhn.hunit.ex.InterfaceWontStopException;
import ca.uhn.hunit.ex.TestFailureException;
import ca.uhn.hunit.l10n.Strings;
import ca.uhn.hunit.run.IExecutionContext;
import ca.uhn.hunit.test.TestBatteryImpl;
import ca.uhn.hunit.util.TypedValueListTableModel;
import ca.uhn.hunit.util.log.LogFactory;
import ca.uhn.hunit.xsd.AbstractJmsInterface;
import ca.uhn.hunit.xsd.Interface;
import ca.uhn.hunit.xsd.JavaArgument;
import ca.uhn.hunit.xsd.NamedJavaArgument;
public abstract class AbstractJmsInterfaceImpl<T extends Object> extends AbstractInterface<T> {
//~ Static fields/initializers -------------------------------------------------------------------------------------
public static final String CONNECTION_FACTORY_CLASS_PROPERTY =
AbstractJmsInterfaceImpl.class + "CONNECTION_FACTORY_CLASS_PROPERTY";
//~ Instance fields ------------------------------------------------------------------------------------------------
private Class<?> myConnectionFactoryClass;
private Constructor<?> myConstructor;
private DefaultMessageListenerContainer myMessageListenerContainer;
private JmsTemplate myJmsTemplate;
private String myPassword;
private String myQueueName;
private String myUsername;
private final TypedValueListTableModel myConstructorArgsTableModel = new TypedValueListTableModel(false);
private final TypedValueListTableModel myMessagePropertyTableModel = new TypedValueListTableModel(true);
private boolean myPubSubDomain;
private boolean myStarted;
private boolean myStopped;
private ConnectionFactory myConnectionFactory;
//~ Constructors ---------------------------------------------------------------------------------------------------
public AbstractJmsInterfaceImpl(TestBatteryImpl theBattery, String theId) {
super(theBattery, theId);
init();
}
public AbstractJmsInterfaceImpl(TestBatteryImpl theBattery, AbstractJmsInterface theConfig)
throws ConfigurationException {
super(theBattery, theConfig);
myQueueName = theConfig.getQueueName();
if (myQueueName == null) {
myQueueName = theConfig.getTopicName();
myPubSubDomain = true;
}
if (theConfig.getConnectionFactory() != null) {
try {
myConnectionFactoryClass = Class.forName(theConfig.getConnectionFactory());
} catch (ClassNotFoundException e) {
throw new ConfigurationException("Unknown connection factory: " + theConfig.getConnectionFactory());
}
}
myConstructorArgsTableModel.importValuesFromXml(theConfig.getConnectionFactoryConstructorArg());
try {
myConstructor = myConnectionFactoryClass.getConstructor(myConstructorArgsTableModel.getArgTypeArray());
} catch (SecurityException e) {
throw new ConfigurationException("Error creating connection factory: ", e);
} catch (NoSuchMethodException e) {
throw new ConfigurationException("Error creating connection factory: ", e);
}
myUsername = theConfig.getUserName();
myPassword = theConfig.getPassword();
myStarted = false;
myStopped = false;
myMessagePropertyTableModel.importValuesFromXml(theConfig.getMessageProperty());
init();
}
//~ Methods --------------------------------------------------------------------------------------------------------
/**
* {@inheritDoc }
*/
protected Interface exportConfig(AbstractJmsInterface retVal) {
super.exportConfig(retVal);
myConstructorArgsTableModel.exportValuesToXml(retVal.getConnectionFactoryConstructorArg());
myMessagePropertyTableModel.exportValuesToXml(retVal.getMessageProperty());
retVal.setConnectionFactory(myConnectionFactoryClass.getName());
retVal.setPassword(myPassword);
retVal.setQueueName(myPubSubDomain ? null : myQueueName);
retVal.setTopicName(myPubSubDomain ? myQueueName : null);
retVal.setUserName(myUsername);
return retVal;
}
public static void extractArgsFromXml(List<Class<?>> theArgTypeList, List<String> theNames, List<Object> theArgs,
List<JavaArgument> theArgDefinitions)
throws ConfigurationException {
for (JavaArgument next : theArgDefinitions) {
if ("java.lang.String".equals(next.getType())) {
theArgTypeList.add(String.class);
theArgs.add(next.getValue());
} else if ("java.lang.Integer".equals(next.getType())) {
theArgTypeList.add(Integer.class);
theArgs.add(Integer.parseInt(next.getValue()));
} else if ("int".equals(next.getType())) {
theArgTypeList.add(int.class);
theArgs.add(Integer.parseInt(next.getValue()));
} else {
throw new ConfigurationException("Unknown arg type: " + next.getType());
}
if (theNames != null) {
theNames.add(((NamedJavaArgument) next).getName());
}
}
}
public static void extractNamedArgsFromXml(List<Class<?>> theArgTypeList, List<String> theNames,
List<Object> theArgs, List<NamedJavaArgument> theArgDefinitions)
throws ConfigurationException {
List<JavaArgument> argDefs = new ArrayList<JavaArgument>();
for (NamedJavaArgument next : theArgDefinitions) {
argDefs.add(next);
}
extractArgsFromXml(theArgTypeList, theNames, theArgs, argDefs);
}
public Class<?> getConnectionFactoryClass() {
return myConnectionFactoryClass;
}
public TypedValueListTableModel getConstructorArgsTableModel() {
return myConstructorArgsTableModel;
}
public TypedValueListTableModel getMessagePropertyTableModel() {
return myMessagePropertyTableModel;
}
public String getPassword() {
return myPassword;
}
public String getQueueName() {
return myQueueName;
}
public String getUsername() {
return myUsername;
}
private void init() {
myUsername = StringUtils.defaultString(myUsername);
myPassword = StringUtils.defaultString(myPassword);
}
public boolean isPubSubDomain() {
return myPubSubDomain;
}
@Override
protected TestMessage<T> internalSendMessage(final TestMessage<T> theMessage) throws TestFailureException {
LogFactory.INSTANCE.get(this).info("Sending message (" + theMessage.getRawMessage().length() + " bytes)");
try {
MessageCreator mc =
new MessageCreator() {
@Override
public javax.jms.Message createMessage(Session theSession)
throws JMSException {
TextMessage textMessage = theSession.createTextMessage(theMessage.getRawMessage());
for (int i = 0; i < myMessagePropertyTableModel.getRowCount(); i++) {
if (java.lang.String.class.equals(myMessagePropertyTableModel.getArgType(i))) {
textMessage.setStringProperty(myMessagePropertyTableModel.getName(i),
(String) myMessagePropertyTableModel.getArg(i));
} else if (java.lang.Integer.class.equals(myMessagePropertyTableModel.getArgType(i))) {
textMessage.setIntProperty(myMessagePropertyTableModel.getName(i),
(Integer) myMessagePropertyTableModel.getArg(i));
} else if (int.class.equals(myMessagePropertyTableModel.getArgType(i))) {
textMessage.setIntProperty(myMessagePropertyTableModel.getName(i),
(Integer) myMessagePropertyTableModel.getArg(i));
}
}
return textMessage;
}
};
myJmsTemplate.send(myQueueName, mc);
LogFactory.INSTANCE.get(this).info("Sent message");
} catch (JmsException e) {
throw new InterfaceWontSendException(this,
e.getMessage(), e);
}
return null;
}
public void setConnectionFactoryClass(Class<?> theConnectionFactoryClass)
throws PropertyVetoException {
Class<?> oldValue = theConnectionFactoryClass;
if (! theConnectionFactoryClass.isAssignableFrom(ConnectionFactory.class)) {
throw new PropertyVetoException("Must extend " + ConnectionFactory.class, null);
}
fireVetoableChange(CONNECTION_FACTORY_CLASS_PROPERTY, oldValue, theConnectionFactoryClass);
this.myConnectionFactoryClass = theConnectionFactoryClass;
firePropertyChange(CONNECTION_FACTORY_CLASS_PROPERTY, oldValue, theConnectionFactoryClass);
}
public void setPassword(String myPassword) {
this.myPassword = myPassword;
}
public void setPubSubDomain(boolean myPubSubDomain) {
this.myPubSubDomain = myPubSubDomain;
}
public void setQueueName(String myQueueName) throws PropertyVetoException {
if (StringUtils.isBlank(myQueueName)) {
throw new PropertyVetoException(Strings.getInstance().getString("interface.queue.empty"), null);
}
this.myQueueName = myQueueName;
}
public void setUsername(String myUsername) {
this.myUsername = myUsername;
}
//~ Inner Classes --------------------------------------------------------------------------------------------------
private class MyMessageListener implements MessageListener {
public void onMessage(Message message) {
LogFactory.INSTANCE.get(AbstractJmsInterfaceImpl.this).info("Message arrived");
String messageText;
try {
TextMessage jmsTextMessage = (TextMessage) message;
messageText = jmsTextMessage.getText();
internalReceiveMessage(new TestMessage<T>(messageText, null));
} catch (JMSException e) {
LogFactory.INSTANCE.get(AbstractJmsInterfaceImpl.this).warn("Failure while extracting JMS message: " + e.getMessage(), e);
}
}
}
/**
* {@inheritDoc}
*/
@Override
protected void doStartReceiving() throws InterfaceWontStartException {
LogFactory.INSTANCE.get(this).info("Starting JMS listener");
myMessageListenerContainer = new DefaultMessageListenerContainer();
myMessageListenerContainer.setBeanName(getId());
myMessageListenerContainer.setAutoStartup(true);
myMessageListenerContainer.setAcceptMessagesWhileStopping(false);
myMessageListenerContainer.setClientId("hUnit-" + getId());
myMessageListenerContainer.setConcurrentConsumers(1);
myMessageListenerContainer.setConnectionFactory(myConnectionFactory);
myMessageListenerContainer.setPubSubDomain(myPubSubDomain);
myMessageListenerContainer.setDestinationName(myQueueName);
myMessageListenerContainer.setMessageListener(new MyMessageListener());
myMessageListenerContainer.afterPropertiesSet();
}
/**
* {@inheritDoc}
*/
@Override
protected void doStart() throws InterfaceWontStartException {
try {
myConnectionFactory = (ConnectionFactory) myConstructor.newInstance(myConstructorArgsTableModel.getArgArray());
} catch (IllegalArgumentException e1) {
throw new InterfaceWontStartException(this,
e1.getMessage());
} catch (InstantiationException e1) {
throw new InterfaceWontStartException(this,
e1.getMessage());
} catch (IllegalAccessException e1) {
throw new InterfaceWontStartException(this,
e1.getMessage());
} catch (InvocationTargetException e1) {
throw new InterfaceWontStartException(this,
e1.getMessage());
}
myConnectionFactory = new JmsConnectionFactory(myConnectionFactory, myUsername, myPassword);
myJmsTemplate = new JmsTemplate(myConnectionFactory);
myJmsTemplate.setReceiveTimeout(1000);
myJmsTemplate.setPubSubDomain(myPubSubDomain);
}
/**
* {@inheritDoc}
*/
@Override
protected void doStartSending() throws InterfaceWontStartException {
// nothing
}
/**
* {@inheritDoc}
*/
@Override
protected void doStop() throws InterfaceWontStopException {
// nothing
}
/**
* {@inheritDoc}
*/
@Override
protected void doStopReceiving() throws InterfaceWontStopException {
if (myMessageListenerContainer != null) {
myMessageListenerContainer.shutdown();
}
}
/**
* {@inheritDoc}
*/
@Override
protected void doStopSending() throws InterfaceWontStopException {
// nothing
}
}
| [
"pablo.pazos@cabolabs.com"
] | pablo.pazos@cabolabs.com |
aa234f8d87f716e95156a39a4e9640890c51323e | 7916fe1284a2aff1414191eaabb07c91946f0ca2 | /src/test/java/com/hsbc/mobile/test/HSBCTestOnSauce.java | d0541e2a2c21747f1c468993c8d5a3b7994afdbc | [] | no_license | pengma/automationmobilesaucelab | 691c6c54e81a67a62129a859f4933c49b83877c3 | b5149f6c8b1e20c64873be277bc2b78016f06d0d | refs/heads/master | 2020-04-24T03:52:52.817578 | 2019-03-13T07:53:49 | 2019-03-13T07:53:49 | 171,684,416 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package com.hsbc.mobile.test;
import com.hsbc.mobile.base.DesktopWebTestBase;
import org.testng.annotations.Test;
import static com.hsbc.mobile.data.TestConstants.HSBC_BASE_URL;
import static org.testng.Assert.assertEquals;
/**
* Created by Mark Ma
*/
public class HSBCTestOnSauce extends DesktopWebTestBase {
@Test
public void testCancelRegister(){
webWorkFlow.cancelRegister();
assertEquals(HSBC_BASE_URL, driver.get().getCurrentUrl());
}
@Test
public void testRegisterUser() {
webWorkFlow.userRegister();
}
}
| [
"531713818@qq.com"
] | 531713818@qq.com |
0168fadcad7a8cb7f499c0e06426655856113908 | b527b774aca7755bad28293c30396c63dda4bda9 | /src/main/java/com/creffer/controllers/admin/DashBoardController.java | d821405a0364df6b65f308157f81abd27a12da7e | [] | no_license | VashchenkoAlex/Creffer | bfb7363db778821de078403868fb3e97c0c13593 | 0e89a2dbf592296d6adf99878bd5a874a6253fe1 | refs/heads/master | 2020-03-20T20:20:04.935602 | 2018-08-29T16:05:34 | 2018-08-29T16:05:34 | 137,682,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,345 | java | package com.creffer.controllers.admin;
import com.creffer.security.TokenAuth;
import org.springframework.http.HttpRequest;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@Controller
@RequestMapping(value = "/adminDashboard")
public class DashBoardController {
@RequestMapping(method = RequestMethod.GET)
public ModelAndView dashGet(HttpServletRequest request){
HttpSession session = request.getSession();
session.getAttribute("SPRING_SECURITY_CONTEXT");
return new ModelAndView("/protected/admin/dashboard");
}
@RequestMapping(method = RequestMethod.POST,produces = "text/html")
public ModelAndView dashPost(){
/*HttpSession session = request.getSession(true);
session.setAttribute("SPRING_SECURITY_CONTEXT", SecurityContextHolder.getContext());
response.setStatus(HttpServletResponse.SC_OK);
return "redirect:/pages/protected/admin/dashboard.html";*/
return new ModelAndView("forward:/pages/protected/admin/dashboard");
}
}
| [
"washchenko.aleksandr@gmail.com"
] | washchenko.aleksandr@gmail.com |
6866d8d8496467332b13734008922930bed77ca8 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/15/15_10cc0e43fbf25cb64a4b301fd35fdad8b49013e8/EclipseTypeSpaceLoader/15_10cc0e43fbf25cb64a4b301fd35fdad8b49013e8_EclipseTypeSpaceLoader_s.java | 606636e15101e10a16d1423da0e2c298f52bd06a | [] | 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 | 29,511 | java | /*******************************************************************************
* Copyright (c) 2005, 2012 eBay Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*******************************************************************************/
package org.eclipse.vjet.eclipse.core.ts;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.mod.core.DLTKContentTypeManager;
import org.eclipse.dltk.mod.core.DLTKCore;
import org.eclipse.dltk.mod.core.IBuildpathEntry;
import org.eclipse.dltk.mod.core.IDLTKLanguageToolkit;
import org.eclipse.dltk.mod.core.IScriptProject;
import org.eclipse.dltk.mod.core.ModelException;
import org.eclipse.dltk.mod.internal.core.Model;
import org.eclipse.dltk.mod.internal.core.ModelManager;
import org.eclipse.dltk.mod.internal.core.ScriptProject;
import org.eclipse.vjet.dsf.ts.TypeSpace;
import org.eclipse.vjet.dsf.ts.event.group.RemoveGroupEvent;
import org.eclipse.vjet.eclipse.codeassist.CodeassistUtils;
import org.eclipse.vjet.eclipse.core.PiggyBackClassPathUtil;
import org.eclipse.vjet.eclipse.core.VjoLanguageToolkit;
import org.eclipse.vjet.eclipse.core.VjoNature;
import org.eclipse.vjet.eclipse.core.builder.TypeSpaceBuilder;
import org.eclipse.vjet.vjo.tool.typespace.GroupInfo;
import org.eclipse.vjet.vjo.tool.typespace.ITypeSpaceLoader;
import org.eclipse.vjet.vjo.tool.typespace.SourcePathInfo;
import org.eclipse.vjet.vjo.tool.typespace.SourceTypeName;
import org.eclipse.vjet.vjo.tool.typespace.TypeSpaceMgr;
/**
* This class load vjo resources to {@link TypeSpace} object. Read all project
* resource from all vjo projects. Process vjo resources changes. Calls
* corresponding type space jobs. When changes ".buildpath" file then calls
* {@link TypeSpaceReloadJob#schedule()} method.
*
*
*
* @see TypeSpaceLoadJob
* @see TypeSpaceRefreshJob
* @see TypeSpaceGroupLoadJob
*
*
*
*/
public class EclipseTypeSpaceLoader implements ITypeSpaceLoader {
private List<SourceTypeName> m_types = new ArrayList<SourceTypeName>();
private IDLTKLanguageToolkit m_toolkit = VjoLanguageToolkit.getDefault();
private ModelManager m_manager = ModelManager.getModelManager();
private TypeSpaceRefreshJob m_refreshJob = new TypeSpaceRefreshJob();
private TypeSpaceReloadJob m_reloadJob = new TypeSpaceReloadJob();
private List<SourceTypeName> m_changedTypes = new ArrayList<SourceTypeName>();
private TypeSpaceMgr m_tsmgr = TypeSpaceMgr.getInstance();
private boolean m_started = false;
private Map<String, List<String>> m_groupDependency;
/**
* Create instance of this class. Add listeners to the workspace for control
* resource changes.
*/
public EclipseTypeSpaceLoader() {
super();
// final IWorkspace workspace = ResourcesPlugin.getWorkspace();
// workspace.removeResourceChangeListener(this);
// workspace.addResourceChangeListener(this,
// IResourceChangeEvent.POST_CHANGE
// | IResourceChangeEvent.PRE_DELETE
// | IResourceChangeEvent.PRE_CLOSE);
}
public List<SourceTypeName> getTypes() {
m_types.clear();
createWorkspaceTypes();
createWorkspaceLibrariesTypes();
return m_types;
}
/**
* Create list of the types from the workspace libraries.
*/
private void createWorkspaceLibrariesTypes() {
try {
Model model = m_manager.getModel();
IScriptProject[] projects;
projects = model.getScriptProjects(VjoNature.NATURE_ID);
for (IScriptProject project : projects) {
loadLibrariesTypes(project);
}
} catch (Exception e) {
DLTKCore.error(e.toString(), e);
}
}
/**
* Create list of the types from the project libraries.
*
* @param project
* {@link IScriptProject} object
* @throws IOException
* @throws CoreException
*/
private void loadLibrariesTypes(IScriptProject project) throws IOException,
CoreException {
IBuildpathEntry[] entries = project.getResolvedBuildpath(true);
for (IBuildpathEntry entry : entries) {
if (entry.getEntryKind() == IBuildpathEntry.BPE_LIBRARY) {
IPath path = entry.getPath();
String strPath = path.toString().toLowerCase();
if (CodeassistUtils.isBinaryPath(strPath)) {
ZipFile jarFile = m_manager.getZipFile(path);
Enumeration<? extends ZipEntry> enumeration = jarFile
.entries();
while (enumeration.hasMoreElements()) {
ZipEntry elem = enumeration.nextElement();
if (!elem.isDirectory()) {
createType(path, jarFile, elem);
}
}
}
}
}
}
/**
* Create type from {@link IPath} object, {@link ZipFile} object and
* {@link ZipEntry} object.
*
* @param path
* {@link IPath} object
* @param jarFile
* {@link ZipFile} object
* @param elem
* {@link ZipEntry} object.
* @throws IOException
*/
private void createType(IPath path, ZipFile jarFile, ZipEntry elem)
throws IOException {
IPath path2 = new Path(path.segment(0));
path2 = path2.addTrailingSeparator();
path2 = path2.append(elem.getName());
Workspace ws = (Workspace) ResourcesPlugin.getWorkspace();
IFile file = (IFile) ws.newResource(path2, IResource.FILE);
if (isValidFile(file)) {
byte[] bs = getContent(jarFile, elem);
createSourceTypeName(file, bs);
}
}
/**
* Returns bytes content of the {@link ZipEntry} object.
*
* @param jarFile
* {@link ZipFile} object.
* @param elem
* {@link ZipEntry} object.
* @return bytes content of the {@link ZipEntry} object.
* @throws IOException
*/
private byte[] getContent(ZipFile jarFile, ZipEntry elem)
throws IOException {
InputStream stream = jarFile.getInputStream(elem);
byte[] bs = new byte[stream.available()];
stream.read(bs);
stream.close();
return bs;
}
/**
* Creates list of the {@link SourceTypeName} objects from the all workspace
* vjo types and put to inner m_types object.
*/
private void createWorkspaceTypes() {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject[] projects = workspace.getRoot().getProjects();
for (int i = 0; i < projects.length; i++) {
IProject project = projects[i];
createProjectTypes(project);
}
}
/**
* Create list of the {@link SourceTypeName} objects from specified project
* and put to inner m_types object.
*
* @param project
* {@link IProject} object.
*/
private void createProjectTypes(IProject project) {
if (project.isAccessible()) {
try {
IProjectNature nature = project.getNature(VjoNature.NATURE_ID);
if (nature != null) {
IResource[] resources = project.members();
createResourcesTypes(resources);
}
} catch (CoreException e) {
DLTKCore.error(e.toString(), e);
}
}
}
/**
* Create list of the {@link SourceTypeName} objects from specified array of
* the {@link IResource} object and put to inner m_types object.
*
* @param resources
* array of the {@link IResource} objects.
*
*/
private void createResourcesTypes(IResource[] resources) {
for (IResource resource : resources) {
// process children
if (resource instanceof IContainer) {
IContainer container = (IContainer) resource;
loadResources(container);
}
if (resource instanceof IFile) {
createType(resource);
}
}
}
private void createType(IResource resource) {
IFile file = (IFile) resource;
if (isValidFile(file)) {
SourceTypeName name = createSourceTypeName(file);
m_types.add(name);
}
}
private SourceTypeName createSourceTypeName(IFile file) {
byte[] content = SourceTypeName.EMPTY_CONTENT;
content = getFileContent(file);
return createSourceTypeName(file, content);
}
/**
* Refresh file from the disk to workspace.
*
* @param file
* {@link IFile} object.
*/
private void refresh(IFile file) {
try {
file.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
DLTKCore.error(e.toString(), e);
}
}
/**
* Creation {@link SourceTypeName} object from {@link IFile} object and
* bytes content.
*
* @param file
* {@link IFile} object
* @param bs
* bytes content of the file object.
* @return {@link SourceTypeName} object.
*/
private SourceTypeName createSourceTypeName(IFile file, byte[] bs) {
String group = file.getProject().getName();
String source = new String(bs);
String name = CodeassistUtils.getClassName(file);
// SourceTypeName typeName = new SourceTypeName(group,
// file.getRawLocation().toPortableString(), source);
SourceTypeName typeName = new SourceTypeName(group, name, source);
return typeName;
}
private byte[] getFileContent(IFile file) {
byte[] bs = SourceTypeName.EMPTY_CONTENT;
try {
bs = doGetFileContent(file);
} catch (IOException e) {
logError(e);
} catch (ResourceException e) {
refresh(file);
try {
bs = doGetFileContent(file);
} catch (Exception e1) {
logError(e1);
}
} catch (CoreException e) {
logError(e);
}
return bs;
}
private void logError(Exception e1) {
DLTKCore.error(e1.getMessage(), e1);
}
/**
* Read content of the {@link IFile} object to the bytes array.
*
* @param file
* {@link IFile}
* @return file content in bytes array.
* @throws CoreException
* @throws IOException
*/
private byte[] doGetFileContent(IFile file) throws CoreException,
IOException {
InputStream stream = file.getContents();
int available = stream.available();
byte[] bs = new byte[available];
stream.read(bs);
stream.close();
return bs;
}
/**
* Returns true if {@link IFile} object has valid file name and is in source
* folder.
*
* @param file
* {@link IFile} object.
* @return true if {@link IFile} object has valid file name and is in source
* folder.
*/
private boolean isValidFile(IFile file) {
return isValidName(file)
&& PiggyBackClassPathUtil.isInSourceFolder(file);
}
/**
* Returns true if location of the file has valid name and content type.
*
* @param file
* {@link IFile} object.
* @return true if location of the file has valid name and content type.
*/
private boolean isValidName(IFile file) {
boolean isValid = false;
try {
isValid = DLTKContentTypeManager.isValidFileNameForContentType(
m_toolkit, file.getLocation());
} catch (Exception e) {
DLTKCore.error(e.getMessage(), e);
}
return isValid;
}
private void loadResources(IContainer container) {
try {
createResourcesTypes(container.members());
} catch (CoreException e) {
DLTKCore.error(e.toString(), e);
}
}
public List<SourceTypeName> getTypes(String group) {
m_types.clear();
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject project = workspace.getRoot().getProject(group);
if (project != null) {
createProjectTypes(project);
}
return m_types;
}
/**
* Return map of the group depends.
*/
public Map<String, List<String>> getGroupDepends() {
if (m_groupDependency != null) {
return m_groupDependency;
}
try {
/*
* sleep 3 seconds before getting the model to make sure we use it
* after it's initialized, otherwise
* TypeSpaceMgrTest#testGroupDepends() would fail
*/
Thread.sleep(3000);
updateGroupDepends();
} catch (InterruptedException e) {
}
return m_groupDependency;
}
private void updateGroupDepends(IProject project) {
m_groupDependency = new HashMap<String, List<String>>();
// Model model = m_manager.getModel();
// IScriptProject[] projects;
//
// try {
// projects = model.getScriptProjects(VjoNature.NATURE_ID);
// for (IScriptProject project : projects) {
try {
createDepends(m_groupDependency, DLTKCore.create(project));
} catch (ModelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// }
// } catch (ModelException e) {
// DLTKCore.error(e.toString(), e);
// }
}
private void updateGroupDepends() {
m_groupDependency = new HashMap<String, List<String>>();
Model model = m_manager.getModel();
IScriptProject[] projects;
try {
projects = model.getScriptProjects(VjoNature.NATURE_ID);
for (IScriptProject project : projects) {
createDepends(m_groupDependency, project);
}
} catch (ModelException e) {
DLTKCore.error(e.toString(), e);
}
}
/**
* @param groups
* @param project
* @return
* @throws ModelException
* @see org.eclipse.vjet.eclipse.internal.launching.SdkBuildpathContainer#computeBuildpathEntries(String
* sdkName)
*/
private IBuildpathEntry[] createDepends(Map<String, List<String>> groups,
IScriptProject project) throws ModelException {
List<String> list = getDependsProjects(groups, project.getElementName());
IBuildpathEntry[] entries = TypeSpaceBuilder.getSerFileGroupDepends(
project, list);
groups.put(project.getElementName(), list);
return entries;
}
/**
* Returns list of the depends groups for specified group.
*
* @param groups
* map of the depends between groups.
* @param group
* specified group name
* @return list of the depends groups for specified group.
*/
private List<String> getDependsProjects(Map<String, List<String>> groups,
String group) {
List<String> list = groups.get(group);
if (list == null) {
list = new ArrayList<String>();
groups.put(group, list);
}
return list;
}
public List<SourceTypeName> getChangedTypes() {
return m_changedTypes;
}
// /**
// * Process workspace resources changes.
// *
// */
// public void resourceChanged(IResourceChangeEvent event) {
//
// int type = event.getType();
//
// IProject project = getProject(event);
// if (!isStarted() || !m_tsmgr.isAllowChanges() || project==null) {
// return;
// }
//
// // process close project event.
// if (type == IResourceChangeEvent.PRE_CLOSE
// || type == IResourceChangeEvent.PRE_DELETE) {
//
// updateGroupDepends(project);
// processCloseProject(event);
// // TODO after close build dependent projects
// }
//
// // process add/modify/delete resources events.
// if (type == IResourceChangeEvent.POST_CHANGE) {
//
// if (isBildPathChangedEvent(event.getDelta())) {
// updateGroupDepends(project);
//
//
//
// // m_reloadJob.schedule();
// } else {
// processChanges(event);
// }
// }
//
// }
private IProject getProject(IResourceChangeEvent event) {
if (event.getDelta() != null
&& event.getDelta().getAffectedChildren().length > 0
&& event.getDelta().getAffectedChildren()[0].getResource() != null) {
return event.getDelta().getAffectedChildren()[0].getResource().getProject();
}
if(event.getResource()!=null && event.getResource() instanceof IProject){
return event.getResource().getProject();
}
return null;
}
/**
* Process changes resources in workspace.
*
* @param event
* {@link IResourceChangeEvent} object.
*/
private void processChanges(IResourceChangeEvent event) {
IResourceDelta[] resourceDeltas = event.getDelta()
.getAffectedChildren();
List<GroupInfo> info = new ArrayList<GroupInfo>();
m_changedTypes.clear();
for (IResourceDelta resourceDelta : resourceDeltas) {
IProject project = resourceDelta.getResource().getProject();
if (!project.exists() || !project.isOpen()) {
continue;
}
// process delta if project exist and type space loading is
// finished else create add group event.
if (m_tsmgr.existGroup(project.getName()) && m_tsmgr.isLoaded()) {
processDelta(resourceDelta);
} else if (m_tsmgr.isLoaded()) {
// for (Object o :
// m_tsmgr.getController().getJstTypeSpaceMgr().getTypeSpace().getGroups().keySet().toArray())
// {
// String s = (String)o;
// if (!s.endsWith(".jar")) {
// System.out.println(o);
// }
// }
// updateGroupDepends();
processAddGroup(info, project);
}
}
// Calls group load job if group info list in not empty else call
// refresh job for changes resources.
if (!info.isEmpty()) {
TypeSpaceGroupLoadJob groupLoadJob = new TypeSpaceGroupLoadJob(info);
m_tsmgr.setLoaded(false);
groupLoadJob.schedule();
} else if (!m_changedTypes.isEmpty()) {
TypeSpaceTracer.loadRefreshEvent(getChangedTypes());
m_refreshJob.schedule();
}
}
private void processAddGroup(List<GroupInfo> info, IProject project) {
try {
IScriptProject scriptProject;
Model model = m_manager.getModel();
scriptProject = model.getScriptProject(project.getName());
if (scriptProject.exists()) {
populateGroupInfos(info, scriptProject, getGroupDepends());
}
} catch (ModelException e) {
DLTKCore.error(e.getMessage(), e);
}
}
public IProject getProjectName(IResourceDelta delta) {
return delta.getAffectedChildren()[0].getResource().getProject();
}
/**
* Send {@link RemoveGroupEvent} to the {@link TypeSpaceMgr} for specified
* {@link IResourceChangeEvent} object.
*
* @param event
* {@link IResourceChangeEvent} object.
*/
private void processCloseProject(IResourceChangeEvent event) {
IProject project = (IProject) event.getResource();
String name = project.getName();
RemoveGroupEvent removeGroupEvent = new RemoveGroupEvent(name, name);
m_tsmgr.processEvent(removeGroupEvent);
}
/**
* Returns true if was changed ".buildpath" file only.
*
* @param delta
* {@link IResourceDelta} object.
* @return true if was changed ".buildpath" file only.
*/
public static boolean isBildPathChangedEvent(IResourceDelta delta) {
boolean isBuildPathCnahgedEvent = false;
IResource resource = delta.getResource();
// if changed .buildpath file
if (resource.getName().equals(ScriptProject.BUILDPATH_FILENAME)) {
isBuildPathCnahgedEvent = delta.getKind() == IResourceDelta.CHANGED;
}
if(resource instanceof IProject && delta.getAffectedChildren().length==0){
return true;
}
// check that no changes of the other recourses
if (!isBuildPathCnahgedEvent) {
IResourceDelta[] deltas = delta.getAffectedChildren();
for (IResourceDelta resourceDelta : deltas) {
isBuildPathCnahgedEvent = isBildPathChangedEvent(resourceDelta);
if (isBuildPathCnahgedEvent) {
break;
}
}
}
return isBuildPathCnahgedEvent;
}
/**
* Process resource delta and add {@link SourceTypeName} to the inner
* m_changedTypes list only when resource changed not for add/remove/modify
* markers.
*
* @param delta
* {@link IResourceDelta} object.
*/
private void processDelta(IResourceDelta delta) {
IResource resource = delta.getResource();
// fix typespace not updated after refactor finished
if (resource instanceof IFile) {
switch (delta.getKind()) {
case IResourceDelta.CHANGED:
if ((delta.getFlags() & ~(IResourceDelta.SYNC | IResourceDelta.MARKERS)) != 0) {
loadFile(delta, resource);
}
break;
case IResourceDelta.ADDED:
loadFile(delta, resource);
break;
case IResourceDelta.REMOVED:
loadFile(delta, resource);
break;
default:
break;
}
} else if (PiggyBackClassPathUtil.isInSourceFolder(resource)
|| resource instanceof IProject) {
IResourceDelta[] deltas = delta.getAffectedChildren();
for (IResourceDelta resourceDelta : deltas) {
processDelta(resourceDelta);
}
}
}
/**
* Returns true if delta contains markers flag.
*
* @param delta
* {@link IResourceDelta} object.
* @return true if delta contains markers flag.
*/
// private boolean isResourceMarker(IResourceDelta delta) {
// return (delta.getFlags() & IResourceDelta.MARKERS) != 0;
// }
private void loadFile(IResourceDelta delta, IResource resource) {
IFile file = (IFile) resource;
SourceTypeName name = null;
if (isValidFile(file)) {
loadVjoFile(delta, file);
}
}
/**
* Create for {@link File} object corresponding {@link SourceTypeName}
* object and adding to the inner list of changed types.
*
* @param delta
* {@link IResourceDelta} object
* @param file
* {@link File} object.
*/
private void loadVjoFile(IResourceDelta delta, IFile file) {
SourceTypeName name;
if (file.exists()) {
name = createSourceTypeName(file);
} else {
name = createSourceTypeName(file, SourceTypeName.EMPTY_CONTENT);
}
String typeName = CodeassistUtils.getClassName(file);
switch (delta.getKind()) {
case IResourceDelta.ADDED:
if (!m_tsmgr.existType(file.getProject().getName(), typeName)) {
name.setAction(SourceTypeName.ADDED);
m_changedTypes.add(name);
if (file.exists()) {
m_tsmgr.getController().parseAndResolve(name.groupName(),
file.getLocation().toFile());
}
}
break;
case IResourceDelta.CHANGED:
if (m_tsmgr.existType(file.getProject().getName(), typeName)) {
name.setAction(SourceTypeName.CHANGED);
m_changedTypes.add(name);
}
break;
case IResourceDelta.REMOVED:
if (m_tsmgr.existType(file.getProject().getName(), typeName)) {
name.setAction(SourceTypeName.REMOVED);
m_changedTypes.add(name);
}
break;
default:
break;
}
// return !(delta.getKind() == IResourceDelta.ADDED &&
// m_tsmgr.existType(file.getProject().getName(), typeName));
}
/**
* Return true if not (type name exist in type space and delta kind equals
* {@link IResourceDelta#ADDED})
*
* @param delta
* {@link IResourceDelta} object.
* @param file
* {@link IFile} object
* @param typeName
* type name of the file
* @return true if not (type name exist in type space and delta kind equals
* {@link IResourceDelta#ADDED})
*/
private boolean canModify(IResourceDelta delta, IFile file, String typeName) {
return !(delta.getKind() == IResourceDelta.ADDED && m_tsmgr.existType(
file.getProject().getName(), typeName));
}
public int getRefreshJobState() {
return m_refreshJob.getState();
}
public int getReloadJobState() {
return m_reloadJob.getState();
}
public List<GroupInfo> getGroupInfo() {
return getScriptProjectEntries();
}
public List<GroupInfo> getGroupInfo(String group) {
List<GroupInfo> info = new ArrayList<GroupInfo>();
Map<String, List<String>> groupDependency = getGroupDepends();
IScriptProject p = m_manager.getModel().getScriptProject(group);
try {
populateGroupInfos(info, p, groupDependency);
} catch (ModelException e) {
DLTKCore.error(e.toString(), e);
}
return info;
}
/**
* Return list of the {@link GroupInfo} object created from the
* corresponding {@link IScriptProject} object.
*
* @return list of the {@link GroupInfo} object created from the
* corresponding {@link IScriptProject} object.
*/
private List<GroupInfo> getScriptProjectEntries() {
Model model = m_manager.getModel();
List<GroupInfo> info = new ArrayList<GroupInfo>();
IScriptProject[] projects;
java.io.File groupPath = null;
try {
projects = model.getScriptProjects(VjoNature.NATURE_ID);
populateGroupInfos(info, projects);
} catch (ModelException e) {
DLTKCore.error(e.toString(), e);
}
return info;
}
private void populateGroupInfos(List<GroupInfo> info,
IScriptProject[] projects) throws ModelException {
Map<String, List<String>> groupDependency = getGroupDepends();
for (IScriptProject project : projects) {
populateGroupInfos(info, project, groupDependency);
}
}
/**
* Populate info list from the {@link IScriptProject} project.
*
* @param info
* list of the {@link GroupInfo} objects.
* @param project
* {@link IScriptProject} object.
* @throws ModelException
*/
private void populateGroupInfos(final List<GroupInfo> info,
final IScriptProject project,
final Map<String, List<String>> groupDependency)
throws ModelException {
// initialize dltk build path
if (!PiggyBackClassPathUtil
.ifScriptProjectInitializedFromJavaProject(project)) {
PiggyBackClassPathUtil
.initializeScriptProjectFromJavProject(project);
}
// initialize dependant jars
List<String> classPaths = new ArrayList<String>();
List<URL> urls = PiggyBackClassPathUtil
.getProjectDependantJars_DLTK(project);
List<String> groupDepends = new ArrayList<String>();
TypeSpaceBuilder.getSerFileGroupDepends(project, groupDepends);
IBuildpathEntry bootstrapPath = TypeSpaceBuilder
.getBootstrapDir(project);
for (URL u : urls) {
java.io.File file = new java.io.File(u.getFile());
String fileName = file.getName();
// Skip the file which has been calculated into type space
if (m_tsmgr.existGroup(fileName)) {
continue;
}
// Check if the jar has been added into list
if (!classPaths.contains(fileName)) {
SourcePathInfo srcPathInfo = new SourcePathInfo();
srcPathInfo.addSourcePath(file.getPath());
info.add(new GroupInfo(file.getName(), file.getAbsolutePath(),
srcPathInfo, null, groupDependency.get(file.getName())));
classPaths.add(fileName);
System.out.println("ScriptProject<" + project.getElementName()
+ "> depends on :" + u);
}
}
// initialize src path
SourcePathInfo srcPathInfo = PiggyBackClassPathUtil
.getProjectSrcPath_DLTK(project);
List<String> srcPaths =srcPathInfo.getSourcePaths();
String name = project.getProject().getName();
java.io.File groupPath = project.getProject().getLocation().toFile();
List<String> bootstrapDirs = new ArrayList<String>();
if (bootstrapPath != null) {
String portableString = "";
portableString = getRelativeProjectPath(project, bootstrapPath);
bootstrapDirs.add(portableString);
}
info.add(new GroupInfo(name, groupPath.getAbsolutePath(), srcPathInfo,
classPaths, groupDependency.get(name), bootstrapDirs));
}
private String getRelativeProjectPath(IScriptProject project,
IBuildpathEntry bootstrap) {
String name = project.getElementName();
String bootstrapPath = bootstrap.getPath().toPortableString();
if (bootstrapPath.lastIndexOf(name) != -1) {
if (bootstrapPath.equals(name)) {
bootstrapPath = "";
} else {
bootstrapPath = bootstrapPath.substring(bootstrapPath
.indexOf(name) + name.length());
}
}
return bootstrapPath;
}
/**
* @return the isStarted
*/
public boolean isStarted() {
return m_started;
}
/**
* @param isStarted
* the isStarted to set
*/
public void setStarted(boolean isStarted) {
this.m_started = isStarted;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
d50d0e2714d10a26e2bccc4f8000f878e61912c9 | b845908bb05334637ae4596a97cb59563d6fd427 | /app/com/iaasimov/utils/StringUtils.java | b5d295f8a31903856b19db4e38583b902622676d | [] | no_license | saurav-joshi/react-native | 0d693f0557ab8da4b97b067d2eaeda3769401c90 | b9f7b2193dbf4bff257e9ade5276ba071d3f1d72 | refs/heads/master | 2021-08-12T03:52:31.573013 | 2017-11-14T11:42:17 | 2017-11-14T11:42:17 | 110,665,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,293 | java | package com.iaasimov.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.StringTokenizer;
/**
*
* @author HaNguyen modified by $Author: hanguyen $
* @version $Revision: 1.5 $
*/
public class StringUtils {
private static final int PASSWD_MIN_LEN = 6;
public static boolean isEmpty(String string) {
if (string == null) {
return true;
}
if ("".equals(string.trim())) {
return true;
}
return false;
}
/**
*
* @param dateStr
* @return
*/
public static Date stringToDate(String dateStr) {
return stringToDate(dateStr, StringConstants.DATE_FORMAT);
}
public static Date stringToDate(String dateStr, String format) {
SimpleDateFormat sdf = new SimpleDateFormat(format);
Date ret = null;
try {
ret = sdf.parse(dateStr);
} catch (Exception e) {
}
return ret;
}
public static String dateToString(Date date) {
return dateToString(date, StringConstants.DATE_FORMAT);
}
public static String dateToString(Date date, String format) {
if (date == null) {
return "";
}
SimpleDateFormat sdf = new SimpleDateFormat(format);
String ret="";
try {
ret =sdf.format(date);
} catch (Exception e) {
ret="";
}
return ret;
}
public static boolean isLong(String source) {
boolean ret = true;
try {
Long.parseLong(source);
} catch (Exception ex) {
ret= false;
}
return ret;
}
/**
*
* @param input
* @return
*/
public static boolean validateTimeString(String input) {
if (input.indexOf(":")<0) {
return false;
}
String min= input.substring(input.indexOf(":")+1);
String hour= input.substring(0,input.indexOf(":"));
if (!isLong(min) || !isLong(hour)) {
return false;
}
if (Long.valueOf(hour).longValue() >23) {
return false;
}
if (Long.valueOf(min).longValue() >59) {
return false;
}
return isLong(min) && isLong(hour);
}
/**
*
* @param input
* @return
*/
public static boolean isAllDegit(String input) {
if (input !=null) {
input=input.trim();
}
char[] charArray = input.toCharArray();
boolean valid= true;
if (charArray !=null && charArray .length>0) {
for (int i=0; i<charArray.length;i++) {
if (!Character.isDigit(charArray[i])) {
valid=false;
break;
}
}
}
return valid;
}
/**
* Get duration in minutes
*
* @param starttime
* @param endTime
* @param defaultVal
* @return
*/
public static int durationMinute(Date starttime, Date endTime, int defaultVal) {
if (endTime == null) {
return defaultVal;
}
long duration = endTime.getTime() - starttime.getTime();
duration = duration / 1000; //second
return (int)duration / 60;
}
/**
* Validate password
* @param password
*/
public static boolean validatePasswordContainName(String password, String name) {
password =password.toLowerCase();
String[] words = name.toLowerCase().split(" ");
if (words!=null) {
for (int i= 0;i <words.length; i++) {
if (words[i] !=null && words[i].length()>1 && password.indexOf(words[i])>=0) {
return false;
}
}
}
return true;
}
/**
* Validate password length
* @param password
*/
public static boolean validatePasswordLength(String password) {
password= password.trim();
if (password.length() < PASSWD_MIN_LEN) {
return false;
}
boolean hasDigit =false;
for (int i=0 ; i <password.length();i++) {
if (Character.isDigit(password.charAt(i))) {
hasDigit =true;
}
}
return hasDigit;
}
/**
*
* @param input
* @return
*/
public static String withoutHttp(String input) {
if (input == null) return "";
String ret = input.toLowerCase();
if (ret.startsWith("http://")) {
ret = ret.substring(7);
} else if (ret.startsWith("https://")) {
ret = ret.substring(8);
}
return ret;
}
/**
* Parse value from duplicate param name to array.
* @param params
* @return an array of param's value
*/
public static String[] parseParamsToArray(String params) {
if (StringUtils.isEmpty(params)) {
return null;
}
StringTokenizer token = new StringTokenizer(params, "&");
String[] ret = new String[token.countTokens()];
int i = 0;
while (token.hasMoreTokens()) {
String val = token.nextToken();
ret[i++] = val.substring(val.indexOf("=")+1, val.length());
}
return ret;
}
/**
*
* @param bytes
* @return
*/
public static String toHexString(byte[] bytes) {
StringBuilder sb = new StringBuilder(bytes.length * 2);
for (int i=0; i< bytes.length; i++) {
sb.append(String.format("%02x", bytes[i]));
}
return sb.toString().toUpperCase();
}
/**
* Get the application full context url
* @param request
* @param secured
* @return
*/
public static String getApplicationUrl(String serverName, String contextPath, boolean secured) {
String url = "";
if (secured) {
url="https://";
} else {
url="http://";
}
url += serverName;
if (!isEmpty(contextPath)) {
url += contextPath;
}
if (!url.endsWith("/")) {
url +="/";
}
url.replaceAll("//", "/");
return url;
}
public static String redirectURL(String host, String uri, boolean secured) {
String url = host + uri;
if (secured) {
url = "https://" + url;
} else {
url = "http://" + url;
}
return url;
}
}
| [
"sauravjoshi2000@yahoo.com"
] | sauravjoshi2000@yahoo.com |
1d8b70c585b26fec841c8a3c8307cadc91ae65d5 | 13f90772c6cc9e55768dc1dda630802c7e288f20 | /src/practice/Test5.java | a7a5632543b252822147c63c6ad337a99a423168 | [] | no_license | manojrajapratik/razaz | 385053b36dc137a00030a00f5f7c23271666dec3 | b89ecd21497191983f5ad2d21ecc7a6f8936e28a | refs/heads/master | 2023-06-06T12:06:13.043533 | 2021-06-30T13:26:52 | 2021-06-30T13:39:17 | 381,714,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 132 | java | package practice;
public interface Test5 {
int k=10;
void a();
public static void main(String[] args) {
}
}
| [
"Raja@Sony"
] | Raja@Sony |
e4805840281cb7cf01d157ce7a8fea0ee4e58ee6 | d4929eb690c796b9e24c54cd641d7b56c411efdd | /design-patterns/src/behavioral/interpreter/InterpreterPatternMain.java | cd7ddebcfcc1503faafa2d4b76bef266e17d9132 | [] | no_license | oalam/cours | 4efc03b8ef8cdc5aa61536bd1fbeb02ff7f24f39 | bd2779c3d1b5cabf91cb98eefeda1134cbfb3c76 | refs/heads/master | 2020-05-21T13:17:14.388476 | 2012-12-04T11:24:39 | 2012-12-04T11:24:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,558 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package behavioral.interpreter;
public class InterpreterPatternMain {
public static void main(String[] args) {
// Création des expressions non terminales
ExpressionNonTerminale lRacine =
new ExpressionNonTerminale("RACINE");
ExpressionNonTerminale lElement1 =
new ExpressionNonTerminale("ELEMENT1");
ExpressionNonTerminale lElement2 =
new ExpressionNonTerminale("ELEMENT2");
ExpressionNonTerminale lElement3 =
new ExpressionNonTerminale("ELEMENT3");
// Création des expressions terminales
ExpressionTerminal lTexte1 =
new ExpressionTerminal("TEXTE1");
ExpressionTerminal lTexte2 =
new ExpressionTerminal("TEXTE2");
// Construit l'arborescence
lRacine.ajouterExpression(lElement1);
lRacine.ajouterExpression(lElement2);
lElement2.ajouterExpression(lElement3);
lElement1.ajouterExpression(lTexte1);
lElement3.ajouterExpression(lTexte2);
// Appel la méthode de l'expression racine
lRacine.operation();
// Affichage :
// <RACINE>
// <ELEMENT1>
// TEXTE1
// </ELEMENT1>
// <ELEMENT2>
// <ELEMENT3>
// TEXTE2
// </ELEMENT3>
// </ELEMENT2>
// </RACINE>
}
}
| [
"bailet.thomas@gmail.com"
] | bailet.thomas@gmail.com |
4f5f8aa6f97d6d8826e81a01a189e43e6793a174 | c7f90f8b04c5d3855e7013884227ca9b8451a991 | /app/src/main/java/cz/alois_seckar/vseadventrura/eu/pedu/adv16s_fw/game_txt/IAuthor.java | 23ee73963f5b5afdf8110225d5181ee1310c72c2 | [] | no_license | kk1000/VSEAdventura | 0eb0397576f8348d38b7b32083ec681c91b562f5 | 6d53096ea8e86408d64925b91ae539d9c0157155 | refs/heads/master | 2020-03-18T11:06:56.217833 | 2016-04-26T19:18:06 | 2016-04-26T19:18:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,614 | java | /* The file is saved in UTF-8 codepage.
* Check: «Stereotype», Section mark-§, Copyright-©, Alpha-α, Beta-β, Smile-☺
*/
package cz.alois_seckar.vseadventrura.eu.pedu.adv16s_fw.game_txt;
/*******************************************************************************
* Instances of interface {@code IAuthorRUP} know to return on request
* the name and identification string of the author of its class.
*
* @author Rudolf PECINOVSKÝ
* @version 2016-Summer
*/
public interface IAuthor
{
//== STATIC CONSTANTS ==========================================================
//== STATIC METHODS ============================================================
//##############################################################################
//== ABSTRACT GETTERS AND SETTERS ==============================================
/***************************************************************************
* Returns the program author name in format <b>SURNAME First-name</b>,
* i.e. firstly the surname in capital letters followed by first name,
* with only the first capital letter, other letters will be small.
* If the program author has more first names, he can quote all of them.
*
* @return Program author name in format SURNAME First-name
*/
// @Override
public String getAuthorName()
;
/***************************************************************************
* Returns the program author identification string
* written in CAPITAL LETTERS.
* It is mostly the login into the school information system.
*
* @return Identification string (login) of the program author
*/
// @Override
public String getAuthorID()
;
//== OTHER ABSTRACT METHODS ====================================================
//== DEFAULT GETTERS AND SETTERS ===============================================
//== OTHER DEFAULT METHODS =====================================================
/***************************************************************************
* Returns the string composed from the author ID followed by
* m-dash and the author's name.
* It serves for elusion of the impossibility to define a default method
* overriding the {@code toString()} method.
*
* @return Author ID and name
*/
public default String getAuthorString()
{
return getAuthorID() + " — " + getAuthorName();
}
//##############################################################################
//== NESTED DATA TYPES =========================================================
}
| [
"ellrohir@seznam.cz"
] | ellrohir@seznam.cz |
d786def59cde3536a576ccbbb0d62952686e2ee9 | e51066fc6ca1e0291e38e219a1cff84a4d5b1304 | /src/main/java/ua/company/constants/SubscriptionStatus.java | 0fc60f1f360d6f41b06497cde470f03fa68e4832 | [] | no_license | alexandr-semenov/internet_provider_servlet | 04a245b59af3f1150238c92c7d4486399a22e7d3 | 82dec8dbf3430cca797b118a77b04340d0fb03c3 | refs/heads/master | 2023-03-10T21:37:11.599249 | 2021-02-28T20:30:53 | 2021-02-28T20:30:53 | 338,869,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | package ua.company.constants;
public class SubscriptionStatus {
public final static String ACTIVE = "ACTIVE";
public final static String NOT_ACTIVE = "NOT_ACTIVE";
}
| [
"inbox.semenov@gmail.com"
] | inbox.semenov@gmail.com |
5a3f996304dbf2818618d81611f7f6256b7d689c | cc0e4996362687fa22e338260e25fba6501cf416 | /src/main/java/com/ma/Aspect/HttpAcpect.java | e66dd5c9775636a4f28145136c053cd72b941c2b | [] | no_license | maquansheng/girl | 2a5db071ddd72630af096fc93796894f2f96a3c3 | a7c557872f775de801c34a0ca240d11b5a60fba6 | refs/heads/master | 2022-06-25T21:31:12.206654 | 2019-05-31T14:44:46 | 2019-05-31T14:44:46 | 189,603,390 | 0 | 0 | null | 2022-06-21T01:12:18 | 2019-05-31T14:01:46 | Java | UTF-8 | Java | false | false | 1,440 | java | package com.ma.Aspect;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/*
使用aop处理请求
*/
@Aspect
@Component
public class HttpAcpect {
private final static Logger logger = LoggerFactory.getLogger(HttpAcpect.class);
@Pointcut("execution(public * com.ma.controller.GirlController.*(..))")
public void log() {
}
@Before("log()")
public void doBefor() {
logger.info("1111111111===================================================================");
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
//url
logger.info("url={}", request.getRequestURI());
//method
logger.info("method={}", request.getMethod());
//ip
logger.info("ip={}", request.getRemoteAddr());
}
@After("log()")
public void doAfter() {
logger.info("2222222222222222");
}
@AfterReturning(returning = "object", pointcut = "log()")
public void afterRuning(Object object) {
logger.info("response={}", object.toString());
}
}
| [
"931701520@qq.com"
] | 931701520@qq.com |
99bd106e43852da5f26356f354a9d3bcc9fe8d71 | 401ed5f77536f5ce5fa1994177781bf56fa92f83 | /app/src/main/java/com/tomatoLCJC/main/utils/ImageUtils.java | dbb8c780c36ad678bbd647a59dd84dcb52eb9999 | [] | no_license | Mindyu/LCJCSystem | 0d75e78ec8a73deeb93e09caaf01b4ac6fe8d020 | d10cadb7de70207fb5c379c2a8705b4c8855f155 | refs/heads/master | 2021-08-23T14:17:07.645836 | 2017-12-05T06:36:57 | 2017-12-05T06:36:57 | 103,231,953 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,694 | java | package com.tomatoLCJC.main.utils;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
/**
* Created by ${dzm} on 2015/9/16 0016.
*/
public class ImageUtils {
/**
* @param url
* @return
*/
public Bitmap returnBitMapByUrl(String url) {
URL myFileUrl = null;
Bitmap bitmap = null;
try {
myFileUrl = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
HttpURLConnection conn = (HttpURLConnection) myFileUrl
.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(is);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
//Log.v(tag, bitmap.toString());
return bitmap;
}
/**
* @param path
* @return
*/
public Bitmap returnBmpByFilePath(String path) {
Bitmap bitmap = null;
File file = new File(path);
try {
if (file.exists()) {
FileInputStream is = new FileInputStream(file);
BitmapFactory.Options options = new BitmapFactory.Options();
bitmap = BitmapFactory.decodeFile(path, options);//decodeStream(is);
is.close();
}
} catch (Exception e) {
e.printStackTrace();
}
//Log.v(tag, bitmap.toString());
return bitmap;
}
/**
* @param path
* @param w
* @param h
*/
public Bitmap getZoomBmp4Path(String path, int w, int h) {
Bitmap bitmap = BitmapFactory.decodeFile(path);
if (bitmap != null) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Matrix matrix = new Matrix();
float scaleWidht = ((float) w / width);
float scaleHeight = ((float) h / height);
matrix.postScale(scaleWidht, scaleHeight);
Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
BitmapFactory.Options options = new BitmapFactory.Options();
return newbmp;
} else {
return null;
}
}
public Bitmap getZoomBmpByDecodePath(String path, int w, int h) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);
options.inSampleSize = calculateInSampleSize(options, w, h);
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(path, options);
}
/**
*
* @param path
* @return
*/
public static Bitmap returnBmpByPath(String path) {
Bitmap bitmap = null;
File file = new File(path);
try {
if(file.exists()) {
FileInputStream is = new FileInputStream(file);
bitmap = BitmapFactory.decodeStream(is);
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
//Log.v(tag, bitmap.toString());
return bitmap;
}
/**
* 质量压缩
* @param image
* @return
*/
public static Bitmap compressImage(Bitmap image) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, baos);//质量压缩方法,这里100表示不压缩,把压缩后的数据存放到baos中
int options = 100;
while ( baos.toByteArray().length / 1024>100) { //循环判断如果压缩后图片是否大于100kb,大于继续压缩
baos.reset();//重置baos即清空baos
image.compress(Bitmap.CompressFormat.JPEG, options, baos);//这里压缩options%,把压缩后的数据存放到baos中
options -= 10;//每次都减少10
}
ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());//把压缩后的数据baos存放到ByteArrayInputStream中
Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, null);//把ByteArrayInputStream数据生成图片
return bitmap;
}
/**
* 图片按比例大小压缩方法(根据路径获取图片并压缩)
* @param srcPath
* @return
*/
public static Bitmap getimage(String srcPath) {
BitmapFactory.Options newOpts = new BitmapFactory.Options();
//开始读入图片,此时把options.inJustDecodeBounds 设回true了
newOpts.inJustDecodeBounds = true;
Bitmap bitmap = BitmapFactory.decodeFile(srcPath,newOpts);//此时返回bm为空
newOpts.inJustDecodeBounds = false;
int w = newOpts.outWidth;
int h = newOpts.outHeight;
//现在主流手机比较多是800*480分辨率,所以高和宽我们设置为
float hh = 800f;//这里设置高度为800f
float ww = 480f;//这里设置宽度为480f
//缩放比。由于是固定比例缩放,只用高或者宽其中一个数据进行计算即可
int be = 1;//be=1表示不缩放
if (w > h && w > ww) {//如果宽度大的话根据宽度固定大小缩放
be = (int) (newOpts.outWidth / ww);
} else if (w < h && h > hh) {//如果高度高的话根据宽度固定大小缩放
be = (int) (newOpts.outHeight / hh);
}
if (be <= 0)
be = 1;
newOpts.inSampleSize = be;//设置缩放比例
//重新读入图片,注意此时已经把options.inJustDecodeBounds 设回false了
bitmap = BitmapFactory.decodeFile(srcPath, newOpts);
return compressImage(bitmap);//压缩好比例大小后再进行质量压缩
}
/**
* 图片按比例大小压缩方法(根据Bitmap图片压缩)
* @param image
* @return
*/
public static Bitmap comp(Bitmap image) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, baos);
if( baos.toByteArray().length / 1024>1024) {//判断如果图片大于1M,进行压缩避免在生成图片(BitmapFactory.decodeStream)时溢出
baos.reset();//重置baos即清空baos
image.compress(Bitmap.CompressFormat.JPEG, 50, baos);//这里压缩50%,把压缩后的数据存放到baos中
}
ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());
BitmapFactory.Options newOpts = new BitmapFactory.Options();
//开始读入图片,此时把options.inJustDecodeBounds 设回true了
newOpts.inJustDecodeBounds = true;
Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, newOpts);
newOpts.inJustDecodeBounds = false;
int w = newOpts.outWidth;
int h = newOpts.outHeight;
//现在主流手机比较多是800*480分辨率,所以高和宽我们设置为
float hh = 800f;//这里设置高度为800f
float ww = 480f;//这里设置宽度为480f
//缩放比。由于是固定比例缩放,只用高或者宽其中一个数据进行计算即可
int be = 1;//be=1表示不缩放
if (w > h && w > ww) {//如果宽度大的话根据宽度固定大小缩放
be = (int) (newOpts.outWidth / ww);
} else if (w < h && h > hh) {//如果高度高的话根据宽度固定大小缩放
be = (int) (newOpts.outHeight / hh);
}
if (be <= 0)
be = 1;
newOpts.inSampleSize = be;//设置缩放比例
//重新读入图片,注意此时已经把options.inJustDecodeBounds 设回false了
isBm = new ByteArrayInputStream(baos.toByteArray());
bitmap = BitmapFactory.decodeStream(isBm, null, newOpts);
return compressImage(bitmap);//压缩好比例大小后再进行质量压缩
}
public static Bitmap zoomBitmap(Bitmap bitmap, float scale){
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Log.e("ss","width="+width);
Log.e("ss","height="+height);
Matrix matrix = new Matrix();
//float scaleWidht = ((float)w / width);
//float scaleHeight = ((float)h / height);
matrix.postScale(scale, scale);
Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
return newbmp;
}
/**
* 计算缩略图压缩的比列,因为每张图片长宽不一样,压缩比列也不一样
*
* @param options
* @param reqWidth
* @param reqHeight
* @return
*/
public static int calculateInSampleSize(BitmapFactory.Options options,
int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
if (width > height) {
inSampleSize = Math.round((float) height / (float) reqHeight);
} else {
inSampleSize = Math.round((float) width / (float) reqWidth);
}
}
return inSampleSize;
}
/**
* @param bm
* @return
*/
public byte[] Bitmap2Bytes(Bitmap bm) {
if (bm == null) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG, 100, baos);
return baos.toByteArray();
}
public Bitmap getBitmapFromView(View view) {
view.destroyDrawingCache();
view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
view.setDrawingCacheEnabled(true);
Bitmap bitmap = view.getDrawingCache(true);
return bitmap;
}
//将Drawable转化为Bitmap
public Bitmap drawableToBitmap(Drawable drawable) {
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
Bitmap bitmap = Bitmap.createBitmap(width, height,
drawable.getOpacity() != PixelFormat.OPAQUE ? Config.ARGB_8888
: Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, width, height);
drawable.draw(canvas);
return bitmap;
}
//获得圆角图片的方法
public Bitmap getRoundedCornerBitmap(Bitmap bitmap, float roundPx) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap
.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}
//获得带阴影的图片方法
public Bitmap createReflectionImageWithOrigin(Bitmap bitmap) {
final int reflectionGap = 4;
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.preScale(1, -1);
Bitmap reflectionImage = Bitmap.createBitmap(bitmap,
0, height / 2, width, height / 2, matrix, false);
Bitmap bitmapWithReflection = Bitmap.createBitmap(width, (height + height / 2), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmapWithReflection);
canvas.drawBitmap(bitmap, 0, 0, null);
Paint deafalutPaint = new Paint();
canvas.drawRect(0, height, width, height + reflectionGap,
deafalutPaint);
canvas.drawBitmap(reflectionImage, 0, height + reflectionGap, null);
Paint paint = new Paint();
LinearGradient shader = new LinearGradient(0,
bitmap.getHeight(), 0, bitmapWithReflection.getHeight()
+ reflectionGap, 0x70ffffff, 0x00ffffff, TileMode.CLAMP);
paint.setShader(shader);
// Set the Transfer mode to be porter duff and destination in
paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
// Draw a rectangle using the paint with our linear gradient
canvas.drawRect(0, height, width, bitmapWithReflection.getHeight()
+ reflectionGap, paint);
return bitmapWithReflection;
}
}
| [
"704191988@qq.com"
] | 704191988@qq.com |
50a51bfb33054502b15a62446a1a996ba05dd0a1 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_9cacfe55a2acd3a9e35d01b025dc3a40c6fcb3d2/GameController/2_9cacfe55a2acd3a9e35d01b025dc3a40c6fcb3d2_GameController_s.java | b981aafcdadac26f302b8f1d6fdacbabafb1b772 | [] | 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 | 6,619 | java | package de.tu_darmstadt.gdi1.samegame.controller;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import static java.awt.event.KeyEvent.*;
import java.io.File;
import java.util.Locale;
import javax.swing.JButton;
import javax.swing.JMenuItem;
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import de.tu_darmstadt.gdi1.samegame.exceptions.ParameterOutOfRangeException;
import de.tu_darmstadt.gdi1.samegame.model.Level;
import de.tu_darmstadt.gdi1.samegame.view.SameGameViewer;
import de.tu_darmstadt.gdi1.samegame.controller.AbstractController;
import de.tu_darmstadt.gdi1.samegame.exceptions.InternalFailureException;
import de.tu_darmstadt.gdi1.samegame.view.gameframes.MainPanel;
public class GameController extends AbstractController{
private SameGameViewer viewer;
public GameController(Level level){
this.level = level;
}
public GameController(Level level, SameGameViewer viewer){
this.level = level;
this.viewer = viewer;
}
public void setLevel(Level level){
this.level = level;
}
@Override
public void menuClick(JMenuItem menuItem){
String menuName = menuItem.getName();
if (menuName.equals("GameMenu_RestartLvl") )
level.restartLevel();
if (menuName.equals("FileMenu_GenerateLevel")){
viewer.closeMainFrame();
viewer.setLevel(level);
level.generateLevel(10, 10, 5, 3);
}
if (menuName.equals("Skin_Default"))
viewer.setSkin("defaultskin", Color.white, Color.black, Color.LIGHT_GRAY);
if (menuName.equals("Skin_Tuskin"))
viewer.setSkin("tuskin", Color.black, Color.white, Color.black);
if (menuName.equals("Skin_Squareskin"))
viewer.setSkin("squareskin", Color.white, Color.black, Color.white);
if (menuName.equals("Skin_Ballskin"))
viewer.setSkin("ballskin", Color.black, Color.white, Color.black);
if (menuName.equals("Skin_Jewelskin"))
viewer.setSkin("jewelskin", Color.white, Color.black, Color.white);
if (menuName.equals("FileMenu_SaveLevel"))
viewer.showFileChooseDialog("SaveLevel");
if (menuName.equals("FileMenu_LoadLevel"))
viewer.showFileChooseDialog("LoadLevel");
if (menuName.equals("FileMenu_Exit"))
viewer.closeMainFrame();
if (menuName.equals("GameMenu_Undo"))
level.undo();
if (menuName.equals("GameMenu_Redo"))
level.redo();
if (menuName.equals("German"))
viewer.setLanguage(new Locale("de", "DE"));
if (menuName.equals("English"))
viewer.setLanguage(new Locale("en", "US"));
if (menuName.equals("Polish"))
viewer.setLanguage(new Locale("pl", "PL"));
if (menuName.equals("About"))
viewer.showAboutFrame();
if (menuName.equals("FileMenu_GenerateCustomLevel"))
//viewer.showCustomizeFrame();
if (menuName.equals("FileMenu_SaveGameState"))
viewer.showFileChooseDialog("SaveGameState");
if (menuName.equals("FileMenu_LoadGameState"))
viewer.showFileChooseDialog("LoadGameState");
}
@Override
public void fieldClick(ActionEvent e, JButton b){
JButton btn = b;
if (e.getSource() == btn) {
// determine x and y position
int posX = (int)btn.getLocation().getX();
int posY = (int)btn.getLocation().getY();
entityClicked(posX / btn.getWidth(),
posY / btn.getHeight());
}
}
@Override
public void fileChoosed(String source, File f){
try{
if(source.equals("LoadLevel")){
Level newLevel = new Level(viewer);
newLevel.restoreLevel(f);
viewer.setLevel(newLevel);
this.level = newLevel;
viewer.closeMainFrame();
viewer.showMainFrame();
viewer.notifyLevelLoaded();
}else if(source.equals("SaveLevel")){
// TODO
}else if(source.equals("LoadGameState")){
// TODO
}else if(source.equals("SaveGameState")){
// TODO
}
}catch(Exception e){
e.printStackTrace();
}
}
public void entityClicked(int positionX, int positionY){
MainPanel panel = viewer.getMainPanel();
panel.getParentWindow().requestFocus();
if(!viewer.duringAnimation() && level.removeable(positionY, positionX)){
try{
viewer.startAnimation(positionY, positionX, 500);
level.removeStone(positionY, positionX);
panel.redraw();
}catch(ParameterOutOfRangeException e){
viewer.showAlertFrame(e.getParameterName(), "Parameter out of Range");
}catch(InternalFailureException e){
viewer.showAlertFrame(e.getMessage(), "Internal Failure");
}
}
}
@Override
public void keyPressed(KeyEvent e){
int key = e.getKeyCode();
int markedRow = 0;
int markedCol = 0;
if(viewer!=null){
markedRow = viewer.getMarkedFieldRow();
markedCol = viewer.getMarkedFieldCol();
viewer.markField(markedRow, markedCol);
}
switch(key){
case VK_N:
level.restartLevel();
break;
case VK_BACK_SPACE:
if (viewer.duringAnimation() != true)
try{
level.undo();
}catch(CannotUndoException ignored){}
break;
case VK_ENTER:
if (viewer.duringAnimation() != true)
try{
level.redo();
}catch(CannotRedoException ignored){}
break;
case VK_SPACE:
if (viewer.duringAnimation() != true)
entityClicked(markedCol, markedRow);
break;
case VK_LEFT:
if (markedCol >0){
markedCol -=1;
viewer.markField(markedRow,markedCol);
try{
viewer.getMainPanel().redraw();
}catch(InternalFailureException ex){
viewer.showAlertFrame(ex.getMessage(), "Internal Failure");
}
}
break;
case VK_RIGHT:
if (markedCol < level.getFieldWidth()-1){
markedCol +=1;
viewer.markField(markedRow,markedCol);
try{
viewer.getMainPanel().redraw();
}catch(InternalFailureException ex){
viewer.showAlertFrame(ex.getMessage(), "Internal Failure");
}
}
break;
case VK_UP:
if (markedRow >0){
markedRow -=1;
viewer.markField(markedRow, markedCol);
try{
viewer.getMainPanel().redraw();
}catch(InternalFailureException ex){
viewer.showAlertFrame(ex.getMessage(), "Internal Failure");
}
}
break;
case VK_DOWN:
if (markedRow < level.getFieldHeight()-1){
markedRow +=1;
viewer.markField(markedRow, markedCol);
try{
viewer.getMainPanel().redraw();
}catch(InternalFailureException ex){
viewer.showAlertFrame(ex.getMessage(), "Internal Failure");
}
}
break;
case VK_T:
viewer.showHighscoreFrame();
break;
default:;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
bd9992f7189acf6411ea7aa8f981b74c159bbdd6 | 3cfb396b6d0bb45e6d96e34a0a2b21814d9223c3 | /workTime/src/workTime/main/service/TimeClockRecordService.java | e5601677f0564d12e537a067a21ad14cf303380b | [] | no_license | ChiRueiYuan/workTime | b17ae74399a53b924fbddf65e2b128aed961535f | 5e6b907cace71ae64495fa5bbaa84e2cefe95fea | refs/heads/master | 2023-03-13T07:05:43.542123 | 2021-03-09T02:34:23 | 2021-03-09T02:34:23 | 330,847,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package workTime.main.service;
import java.sql.Connection;
import java.util.ArrayList;
import workTime.main.model.TimeClockRecord;
public interface TimeClockRecordService<T> {
public ArrayList<TimeClockRecord> getAll(Connection conn);
public ArrayList<TimeClockRecord> getPaginationByQuery(Connection conn, int page, int size);
public TimeClockRecord getById(Connection conn, String id);
}
| [
"ruel-yuan.chi@varmeego.com"
] | ruel-yuan.chi@varmeego.com |
92286245fe036f5a253658394448c6f9d6e4b4f5 | 9082443fd8e17b4ea7737b0b20ee05b5acd87c7a | /23-01-2020-FN-AN-Unit Testing/EmployeeCRUD/src/main/java/com/springAU/config/exception/IllegalURLException.java | 9da2b50b3390d3e54f1c14d42f7c00e18adb4c18 | [] | no_license | gonsalvesrohit920/Spring-AU-2020 | 25c0de5c64754d3dc174d5f8e6494686c3a97d69 | 7f7ba6bd5d8b365402881f5aa975be9ad3960c5a | refs/heads/master | 2020-12-07T14:15:27.153460 | 2020-01-30T18:53:10 | 2020-01-30T18:53:10 | 232,735,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package com.springAU.config.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value=HttpStatus.NOT_FOUND, reason="Illegal URL") //404 Error
public class IllegalURLException extends RuntimeException {
/**
*
*/
private static final long serialVersionUID = -6759314514353045508L;
}
| [
"32949288+RohitGonsalves1999@users.noreply.github.com"
] | 32949288+RohitGonsalves1999@users.noreply.github.com |
4c88d540e31df8f8a839e66a35a4941489d14733 | 760431162a8eb98a8bf4c7ba657a7278a389bc4c | /roomdb/src/androidTest/java/com/ericshenn/address/roomdb/ExampleInstrumentedTest.java | 4f102f9112535b4278a01aca859f330f3859eddf | [] | no_license | EricQianTW/Android-Component_development | 17aba6c9f6aa53f9c286f54f930dc6dc568123cc | 22957418c6e263706341cecb63aea3e4a98ea5ba | refs/heads/master | 2020-03-30T19:22:27.886413 | 2018-10-04T08:18:26 | 2018-10-04T08:18:26 | 151,539,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 755 | java | package com.ericshenn.address.roomdb;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.xcecs.mtbs.roomdb.test", appContext.getPackageName());
}
}
| [
"pnt_twqian@163.com"
] | pnt_twqian@163.com |
a8873c750f2cc8512132e09dcd69a78cec1f3a80 | feedd412ca4cd62ab41e5a3880abe9384932d99b | /MedicalStore/src/src/SupplierWiseMedList.java | 78ff8926ad622e2ebc7b6276e6b035415a8ace25 | [] | no_license | vee-pool/MedicalStore | 38015080cbbb320c72fe1487343d78d2af7e2b63 | 6d742ae4169bedb666d4a418e95efcc91ef83198 | refs/heads/master | 2021-06-26T16:52:39.258645 | 2017-09-12T05:45:46 | 2017-09-12T05:45:46 | 103,225,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,764 | java | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.table.DefaultTableModel;
import java.sql.*;
import java.sql.ResultSet;
public class SupplierWiseMedList extends JFrame implements ActionListener
{
int medicalID;
JFrame jf;
JButton submit,clear;
JLabel l1, lsname, lsph, lsem, lsadd;
JTextField t1;
Font f, fs;
Connection con;
PreparedStatement ps;
JComboBox date;
Statement stmt;
ResultSet rs;
String purdate;
DefaultTableModel model = new DefaultTableModel();
JTable tabGrid = new JTable(model);
JScrollPane scrlPane = new JScrollPane(tabGrid);
DefaultTableModel supp = new DefaultTableModel();
JTable tabSupp = new JTable(supp);
JScrollPane suppPane = new JScrollPane(tabSupp);
public SupplierWiseMedList(int id)
{
medicalID = id;
jf=new JFrame();
f = new Font("Times New Roman",Font.BOLD,20);
fs = new Font("Times New Roman",Font.BOLD,12);
jf.setLayout(null);
l1 = new JLabel("Enter Supplier name:");
l1.setFont(f);
l1.setBounds(20,50,200,25);
jf.add(l1);
t1=new JTextField(10);
t1.setBounds(220,50,200,25);t1.setToolTipText("Enter supplier name");
jf.add(t1);
submit = new JButton("Submit",new ImageIcon("images//open.png"));
submit.setBounds(20,100,110,35); submit.setToolTipText("click to open supplier wise medicine report");
jf.add(submit);submit.addActionListener(this);
clear = new JButton("Clear",new ImageIcon("images//clear.png"));
clear.setBounds(150,100,110,35);clear.setToolTipText("click to clear textfield");
jf.add(clear);clear.addActionListener(this);
scrlPane.setBounds(0,150,900,600);
jf.add(scrlPane);
tabGrid.setFont(new Font ("Times New Roman",0,15));
model.addColumn("M_BNO");
model.addColumn("M_NAME");
model.addColumn("M_COMPANY");
model.addColumn("M_QUANTITY");
model.addColumn("M_EXPDATE");
model.addColumn("M_TYPE");
model.addColumn("M_PURPRICE");
model.addColumn("M_SALEPRICE");
model.addColumn("M_RACKNO");
model.addColumn("M_SID");
suppPane.setBounds(500,0,400,60);
jf.add(suppPane);
tabSupp.setFont(new Font ("Times New Roman",0,15));
supp.addColumn("Name");
supp.addColumn("Address");
supp.addColumn("Phone no");
supp.addColumn("Email");
date=new JComboBox();
date.setBounds(280,100,130,25);
date.setToolTipText("select purchase date");
jf.add(date);
date.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
purdate =(String)date.getSelectedItem();
}
});
try
{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/medical_store","root","");
System.out.println("Connected to database.");
ps=con.prepareStatement("select distinct mpurdate from medicine where medID = '" + medicalID + "'");
rs=ps.executeQuery();
while(rs.next())
{
String sname1=rs.getString(1);
date.addItem(sname1);
}
con.close();
}
catch(SQLException se)
{
System.out.println(se);
}
catch(Exception e)
{
System.out.println(e);
}
jf.setTitle("Supplier Wise Medicine Report");
jf.setSize(900,700);
jf.setLocation(20,20);
jf.setResizable(false);
jf.getContentPane().setBackground(Color.cyan);
jf.setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==submit)
{//list
display_supplier_info();
int r = 0;
try
{
if(((t1.getText()).equals("")))
{
JOptionPane.showMessageDialog(this,"Please supplier name !","Warning!!!",JOptionPane.WARNING_MESSAGE);
}
else
{
int foundrec = 0;
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/medical_store","root","");
System.out.println("Connected to database.");
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT mbno,mname,mcompany,mquantity,mexpdate,mtype,mpurprice, msaleprice,mrackno,sid from medicine where sname='"
+t1.getText()+"' and mpurdate='"+purdate+"' and medID = '"+medicalID+"'");
while(rs.next())
{
model.insertRow(r++,new Object[]{rs.getString(1),rs.getString(2),rs.getString(3),
rs.getString(4),rs.getString(5),
rs.getString(6),rs.getString(7),rs.getString(8),
rs.getString(9),rs.getString(10)});
foundrec = 1;
}
if (foundrec == 0)
{
JOptionPane.showMessageDialog(null,"Not any medicine","Dialog",JOptionPane.WARNING_MESSAGE);
}
}
con.close();
}
catch(SQLException se)
{
System.out.println(se);
JOptionPane.showMessageDialog(null,"SQL Error:"+se);
}
catch(Exception e)
{
System.out.println(e);
JOptionPane.showMessageDialog(null,"Error:"+e);
}
}
else if(ae.getSource()==clear)
{
t1.setText("");
}
}
private void display_supplier_info()
{
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/medical_store","root","");
System.out.println("Connected to database. display_supplier_info");
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT * from supplier where sname = '" + t1.getText()+"'");
if (rs.next())
{
supp.insertRow(0,new Object[]{rs.getString(2),rs.getString(3),
rs.getString(4),rs.getString(5)});
}
con.close();
}
catch(SQLException se)
{
System.out.println(se);
JOptionPane.showMessageDialog(null,"SQL Error:"+se);
}
catch(Exception e)
{
System.out.println(e);
JOptionPane.showMessageDialog(null,"Error:"+e);
}
}
/*public static void main(String args[])
{
new SupplierWiseMedList();
}*/
}
| [
"vipzshady@lb1pc20-dx2480-MT"
] | vipzshady@lb1pc20-dx2480-MT |
7e660d6560866026f10841c19f8a5617ebf064ee | d5f9de55add650b24de567ce024fc1bfe5f3bd83 | /app/src/main/java/eee/cu/ac/bd/smartcity/shortfeed.java | 400fb1c70554ba4e8e05482f1c63e9117f9f4d15 | [] | no_license | mahbubcubd/SmartCity | 4e49afd82ac83a446b1d3ef6dd0267167fde4c43 | f4cf92725acc281d78d86ad9b0857cf35a7c7342 | refs/heads/master | 2021-09-09T04:19:44.803441 | 2018-03-13T20:16:57 | 2018-03-13T20:16:57 | 106,335,909 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 936 | java | package eee.cu.ac.bd.smartcity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
/**
* Created by mahbub on 10/2/17.
*/
public class shortfeed {
private String Title;
private String Name;
private String Location;
private String id;
public shortfeed(){
}
public String getTitle() {
return Title;
}
public void setTitle(String title) {
Title = title;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getLocation() {
return Location;
}
public void setLocation(String location) {
Location = location;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
| [
"mahbubcu14@gmail.com"
] | mahbubcu14@gmail.com |
cd07d726ffb833252a4619c8033638cfa08e05e4 | 57c0354505689e4e8adbb7bd13f159043ea65d29 | /app/src/main/java/me/keegan/snap/SectionsPagerAdapter.java | 8963d7f93b26c36e5d61c2c2f45be3ce0bc32b08 | [] | no_license | cloneforyou/AndroidSnap | f6ea15eafb4420c1509917d5dc091fc69b3f4307 | 9a576f8037bc7007c38722a377a1260532818658 | refs/heads/master | 2020-03-25T17:43:11.510538 | 2017-10-06T15:52:01 | 2017-10-06T15:52:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,277 | java | package me.keegan.snap;
import java.util.Locale;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {
protected Context mContext;
public SectionsPagerAdapter(Context context, FragmentManager fm) {
super(fm);
mContext = context;
}
@Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a DummySectionFragment (defined as a static inner class
// below) with the page number as its lone argument.
switch(position) {
case 0:
return new InboxFragment();
case 1:
return new FriendsFragment();
}
return null;
}
@Override
public int getCount() {
return 2;
}
@Override
public CharSequence getPageTitle(int position) {
Locale l = Locale.getDefault();
switch (position) {
case 0:
return mContext.getString(R.string.title_section1).toUpperCase(l);
case 1:
return mContext.getString(R.string.title_section2).toUpperCase(l);
}
return null;
}
}
| [
"mhsjlw@users.noreply.github.com"
] | mhsjlw@users.noreply.github.com |
9ed00f948183927d2cadab776edf80f6893191dd | 906d9e6aa851699fb44eec6be391d6acfa6d71a4 | /app/src/main/java/com/haibuzou/datepicker/view/MyTextView.java | c418c3c179455a59ad58da4e6747457e90e6ef3c | [] | no_license | txfyteen/Calendar365 | f7aadf8498d17e313c4a85d88ac344ed5799ae06 | 093b5afe63b338bcb8dde669bca10aee2b5e3799 | refs/heads/master | 2021-01-16T17:52:17.583853 | 2016-05-23T01:05:09 | 2016-05-23T01:05:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,154 | java | package com.haibuzou.datepicker.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.TextView;
public class MyTextView extends TextView {
private Paint mPaint;
private int width;
private RectF rect;
public MyTextView(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public MyTextView(Context context) {
this(context,null);
}
public MyTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG|Paint.DITHER_FLAG);
mPaint.setColor(Color.GRAY);
mPaint.setStyle(Paint.Style.FILL);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawRoundRect(rect,30,30,mPaint);
super.onDraw(canvas);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
rect = new RectF(0,0,w,h);
}
}
| [
"haibuzouxi@163.com"
] | haibuzouxi@163.com |
107e24c08abbaf287bf7abc4857770a2965c9f4f | 38aaa732c0cded008c1de460f79fcde84018cae5 | /AzureCSPack/src/com/microsoft/tooling/msservices/model/vm/VirtualMachineImage.java | e373961cc98fbecd5fad745c914f337724b6b8d2 | [] | no_license | milismsft/AzureDockerPlugin | ccfec90aeef22d7d61a2f0ef4b0240b21e5a1f21 | 3b05b76c8924df39c0ce15fc7261e243629d5c17 | refs/heads/master | 2021-01-17T15:12:45.280923 | 2018-12-01T00:38:17 | 2018-12-01T00:38:17 | 71,814,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,151 | java | /**
* Copyright (c) Microsoft Corporation
* <p/>
* All rights reserved.
* <p/>
* MIT License
* <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* <p/>
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
* <p/>
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.microsoft.tooling.msservices.model.vm;
import com.microsoft.tooling.msservices.helpers.NotNull;
import com.microsoft.tooling.msservices.model.ServiceTreeItem;
import java.util.Calendar;
public class VirtualMachineImage implements ServiceTreeItem {
private boolean loading;
private String name;
private String type;
private String category;
private String publisherName;
private Calendar publishedDate;
private String label;
private String description;
private String operatingSystemType;
private String location;
private String eulaUri;
private String privacyUri;
private String pricingUri;
private String recommendedVMSize;
private boolean showInGui;
public VirtualMachineImage(@NotNull String name, @NotNull String type, @NotNull String category,
@NotNull String publisherName, @NotNull Calendar publishedDate, @NotNull String label,
@NotNull String description, @NotNull String operatingSystemType, @NotNull String location,
@NotNull String eulaUri, @NotNull String privacyUri, @NotNull String pricingUri,
@NotNull String recommendedVMSize, boolean showInGui) {
this.name = name;
this.type = type;
this.category = category;
this.publisherName = publisherName;
this.publishedDate = publishedDate;
this.label = label;
this.description = description;
this.operatingSystemType = operatingSystemType;
this.location = location;
this.eulaUri = eulaUri;
this.privacyUri = privacyUri;
this.pricingUri = pricingUri;
this.recommendedVMSize = recommendedVMSize;
this.showInGui = showInGui;
}
@Override
public boolean isLoading() {
return loading;
}
@Override
public void setLoading(boolean loading) {
this.loading = loading;
}
@NotNull
public String getName() {
return name;
}
@NotNull
public String getType() {
return type;
}
@NotNull
public String getCategory() {
return category;
}
@NotNull
public String getPublisherName() {
return publisherName;
}
@NotNull
public Calendar getPublishedDate() {
return publishedDate;
}
@NotNull
public String getLabel() {
return label;
}
@NotNull
public String getDescription() {
return description;
}
@NotNull
public String getOperatingSystemType() {
return operatingSystemType;
}
@NotNull
public String getLocation() {
return location;
}
@NotNull
public String getEulaUri() {
return eulaUri;
}
@NotNull
public String getPrivacyUri() {
return privacyUri;
}
@NotNull
public String getPricingUri() {
return pricingUri;
}
@NotNull
public String getRecommendedVMSize() {
return recommendedVMSize;
}
public boolean isShowInGui() {
return showInGui;
}
@Override
public String toString() {
return label + (loading ? " (loading...)" : "");
}
} | [
"adrianmi@microsoft.com"
] | adrianmi@microsoft.com |
1a88572b16ed380a129a95e1a0a0030bde405abd | ad861e0ba1acb3333acf0a60adbdf2f3a8a8b23c | /src/com/cn/javass/dp/strategy/example5/RMBCash.java | 8521469e459d74028ed0f0d8846b77fac6ec42fa | [] | no_license | qingziguanjun/datastructure | 2b0487ee2196a32628425ae398daa06700f786e0 | 74fab15e932599bac8e8a9d15ec848fe9fd88154 | refs/heads/master | 2021-07-05T16:08:32.839758 | 2021-05-06T06:52:11 | 2021-05-06T06:52:11 | 234,649,789 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 271 | java | package com.cn.javass.dp.strategy.example5;
/**
* 人民币现金支付
*/
public class RMBCash implements PaymentStrategy{
public void pay(PaymentContext ctx) {
System.out.println("现在给"+ctx.getUserName()+"人民币现金支付"+ctx.getMoney()+"元");
}
}
| [
"songyi@meituan.com"
] | songyi@meituan.com |
bbc7ed33a2b48e5ff754ffa7ccfa2a08c07935b6 | 59adf76a12669d5a9cf6f67fa255eeb86f148a16 | /houduan/11.业务功能实现/mango-admin/src/main/java/com/ll/mango/admin/service/impl/SysMenuServiceImpl.java | 51b8e3d0b0c8bf9ffc994570d94344513dece9a4 | [] | no_license | niuniu1996/springbootmango | 22b0bddda3dd4536f2172bda20817def12cad859 | f2d912bb7fc41a8d55c440d9bf9ca0247d1d5b3e | refs/heads/master | 2023-02-09T08:48:01.483311 | 2020-12-31T06:46:21 | 2020-12-31T06:46:21 | 299,795,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package com.ll.mango.admin.service.impl;
import com.ll.mango.admin.dao.SysDictMapper;
import com.ll.mango.admin.dao.SysMenuMapper;
import com.ll.mango.admin.po.SysMenu;
import com.ll.mango.admin.service.SysMenuService;
import com.ll.mango.core.page.PageRequest;
import com.ll.mango.core.page.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author liulan
* @version 1.0
* @date 2020/6/10 0010 下午 17:00
*/
@Service
public class SysMenuServiceImpl implements SysMenuService {
@Autowired
private SysMenuMapper sysMenuMapper;
@Override
public List<SysMenu> findByUserName(String userName) {
return sysMenuMapper.findByUserName(userName);
}
@Override
public int save(SysMenu record) {
return 0;
}
@Override
public int delete(SysMenu record) {
return 0;
}
@Override
public int delete(List<SysMenu> records) {
return 0;
}
@Override
public SysMenu findById(Long id) {
return null;
}
@Override
public PageResult findPage(PageRequest pageRequest) {
return null;
}
}
| [
"15797703301@163.com"
] | 15797703301@163.com |
1a165ee67067814cf9ee39a01681798a2ce87244 | 3491a70c471c272d6f7640bf04fec65cdfcb13d0 | /src/main/java/com/twobomb/entity/ThemeOffer.java | 9c5091a568f576b4599997d7a373403751df6d41 | [] | no_license | twobomb/diplom | 142be2fa40a4e325403077be7106aa528563c243 | f9fbc3b004de5305b32026d53ba8995663d635a7 | refs/heads/master | 2020-03-12T18:59:10.121101 | 2018-05-25T23:22:17 | 2018-05-25T23:22:17 | 130,774,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package com.twobomb.entity;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "themes_offer")
public class ThemeOffer extends AbstractEntity{
@Column(name="description")
String description;
@Column(name = "text")
@Type(type = "text")
String text;
@Column(name = "date")
Date date;
@JoinColumn(name = "id_person_student")
@OneToOne(cascade = CascadeType.ALL)
Person person;
}
| [
"stalkerfirst@mail.ru"
] | stalkerfirst@mail.ru |
a4ad9215be7e43ad6458ca5d21a913b10dc4a66f | ff3c616d55b1d36d078ce45c40687b7e574432f8 | /src/WeightNode.java | a7e0eb4e90084b82f68ff43eae8c6852382121f3 | [] | no_license | felix823sung/FoodDatabase | 0320eb65b0636b975ebcb2c86f2d369dbd508ee0 | f077aa83fed6dca23ff60ec43806a9b4b8d4cef1 | refs/heads/master | 2021-01-13T12:37:04.674665 | 2017-03-18T05:02:32 | 2017-03-18T05:02:32 | 78,372,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,557 | java | /**
* The custom WeightNode class, stores three Strings
* @author Felix
*
*/
public class WeightNode
{
// Initialize variables
private String amount;
private WeightNode next;
private String msre_Desc;
private String gm_Wgt;
/**
* The constructor for the WeightNode, requires three parameters
* @param amount the modifier for the description
* @param msre_Desc the description of the measurement
* @param gm_Wgt the weight of the measurement in grams
*/
public WeightNode(String amount, String msre_Desc, String gm_Wgt)
{
this.amount = amount;
this.msre_Desc = msre_Desc;
this.gm_Wgt = gm_Wgt;
}
/**
* A method that gets the next linked node
* @return the next linked node
*/
public WeightNode getNext()
{
return this.next;
}
/**
* A method to set the next linked node
* @param next the WeightNode to be set as the next linked WeightNode
*/
public void setNext(WeightNode next)
{
this.next = next;
}
/**
* A method to get the amount aspect of the weight information
* @return the modifier for the measurement
*/
public String getAmount()
{
return amount;
}
/**
* A method to get the description aspect of the weight information
* @return the description of the measurement
*/
public String getMsre_Desc()
{
return msre_Desc;
}
/**
* A method to get the weight aspect of the weight information
* @return the weight of the measurement in grams
*/
public String getGm_Wgt()
{
return gm_Wgt;
}
} | [
"Flex413@gmail.com"
] | Flex413@gmail.com |
1274ac3f87cc15e081ae72f3b85d92ae41f0550b | a753c693a9f85ab1bc70284d801f6403d403e21f | /app/src/main/java/com/moxi/agenttool/ui/viewpager/vm/ViewPagerViewModel.java | b56360a8ff27a4f84a312ab18c61168f77929288 | [
"Apache-2.0"
] | permissive | subenli115/AgentTool | ead6445fa26ee23bfc06fa45ef09c829954384d5 | 63ef76b0ce390331d7cdb863a6391920bc682fb9 | refs/heads/main | 2023-07-02T16:44:47.170475 | 2021-08-06T12:44:45 | 2021-08-06T12:44:45 | 392,252,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,230 | java | package com.moxi.agenttool.ui.viewpager.vm;
import android.app.Application;
import com.moxi.agenttool.BR;
import com.moxi.agenttool.R;
import androidx.annotation.NonNull;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableList;
import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.binding.command.BindingConsumer;
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent;
import me.goldze.mvvmhabit.utils.ToastUtils;
import me.tatarka.bindingcollectionadapter2.BindingViewPagerAdapter;
import me.tatarka.bindingcollectionadapter2.ItemBinding;
/**
* 所有例子仅做参考,千万不要把它当成一种标准,毕竟主打的不是例子,业务场景繁多,理解如何使用才最重要。
* Created by goldze on 2018/7/18.
*/
public class ViewPagerViewModel extends BaseViewModel {
public SingleLiveEvent<String> itemClickEvent = new SingleLiveEvent<>();
public ViewPagerViewModel(@NonNull Application application) {
super(application);
//模拟3个ViewPager页面
for (int i = 1; i <= 3; i++) {
ViewPagerItemViewModel itemViewModel = new ViewPagerItemViewModel(this, "第" + i + "个页面");
items.add(itemViewModel);
}
}
//给ViewPager添加ObservableList
public ObservableList<ViewPagerItemViewModel> items = new ObservableArrayList<>();
//给ViewPager添加ItemBinding
public ItemBinding<ViewPagerItemViewModel> itemBinding = ItemBinding.of(BR.viewModel, R.layout.item_viewpager);
//给ViewPager添加PageTitle
public final BindingViewPagerAdapter.PageTitles<ViewPagerItemViewModel> pageTitles = new BindingViewPagerAdapter.PageTitles<ViewPagerItemViewModel>() {
@Override
public CharSequence getPageTitle(int position, ViewPagerItemViewModel item) {
return "条目" + position;
}
};
//ViewPager切换监听
public BindingCommand<Integer> onPageSelectedCommand = new BindingCommand<>(new BindingConsumer<Integer>() {
@Override
public void call(Integer index) {
ToastUtils.showShort("ViewPager切换:" + index);
}
});
}
| [
"1178213948@qq.com"
] | 1178213948@qq.com |
ae9d766b7975edbb33287c262795abd970c24a9b | 4a92a5064300331c49649d6bd1a63c7e45a2b24d | /hatech-oauth-server/src/main/java/cn/com/hatechframework/server/dto/OAuthCodeDTO.java | fb9d08ddcc3368cf53394591e82a361a8c9c1360 | [] | no_license | tidehc/hatech-framework | 6b38c05b21e2240df0c96620cb2a05efbeda3975 | 80fd4995ea3ef32af5e5a38dc8b8e10a4fa7f6fb | refs/heads/master | 2022-04-08T12:48:48.380424 | 2020-03-11T12:54:08 | 2020-03-11T12:54:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,663 | java | package cn.com.hatechframework.server.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* Copyright (C), 2019, 北京同创永益科技发展有限公司
*
* @program hatech-framework
* @package cn.com.hatechframework.dto
* @className AuthCodeDTO
* @description authorization code 校验码实体类
* @author YeMeng
* @create 2019/12/23 17:12
* @version 1.0
* <Author> <Time> <Version> <Description>
* YeMeng 2019/12/23 17:12 1.0 authorization code 校验码实体类
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "cn.com.hatechframework.dto.OAuthCodeDTO", description = "校验码实体类(输入)")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OAuthCodeDTO extends UsernamePasswordPrincipalDTO {
@ApiModelProperty(value="客户端支持的responseType,只支持code验证码类型", dataType = "String", required = true, example = "code")
@NotBlank(message = "当前客户端支持的responseType不能为空")
@Length(message = "当前客户端支持的responseType长度应该在{min}~{max}之间", min = 1, max = 20)
private String responseType;
@ApiModelProperty(value="客户端clientId", dataType = "String", required = true, example = "swagger")
@NotBlank(message = "客户端clientId不能为空")
@Length(message = "当前客户端clientId长度应该在{min}~{max}之间", min = 1, max = 128)
private String clientId;
@ApiModelProperty(value="跳转链接redirectUri,跳转url需要与数据库存储的url一致", dataType = "String", required = true, example = "http://127.0.0.1:8070/doc.html")
@NotBlank(message = "跳转链接redirectUri不能为空")
@Length(message = "当前跳转链接redirectUri长度应该在{min}-{max}之内", min=1, max = 128)
private String redirectUri;
@ApiModelProperty(value="授权范围", dataType = "String", required = true, example = "server")
@NotBlank(message = "授权范围不能为空")
@Length(message = "当前授权范围长度应该在{min}~{max}之间", min = 1, max = 128)
private String scope;
@Builder
public OAuthCodeDTO(String responseType, String clientId, String redirectUri, String scope, String username, String password) {
super(username, password);
this.responseType = responseType;
this.clientId = clientId;
this.redirectUri = redirectUri;
this.scope = scope;
}
}
| [
"alittlexincan@sina.com"
] | alittlexincan@sina.com |
0e6b5b9ee4fa6277c7c986b5681fb4dbf4d632af | 1a97a6f603adbfbe335ebd54a25b3a9a62fcecf0 | /src/musicwriter/gui/partitionaffichage/AffichageNote.java | 9a5393bb33e915b82d72d72ba90b1a0d9c1faaf1 | [] | no_license | francoisschwarzentruber/openmusicwriter | bface8acca6241ea9464abb0c8fa5a9422d3b5be | f76d39db0283b29acec1ce0023466534cbe5664a | refs/heads/master | 2022-07-20T13:14:24.325633 | 2020-05-18T11:47:50 | 2020-05-18T11:47:50 | 264,154,770 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,021 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package musicwriter.gui.partitionaffichage;
import java.awt.Color;
import musicwriter.donnees.Hauteur.Alteration;
import musicwriter.donnees.*;
import musicwriter.gui.*;
/**
*
* @author proprietaire
*/
public class AffichageNote extends AffichageElementMusical implements Affichage {
static final private Image imgNoteLectureMIDIFleur = ImageLoader.getImage("note-fleur.png");
static final private Image imgNoteLectureMIDIPacMan = ImageLoader.getImage("note-pacman.png");
static final private Image imgNoteDureeVague = ImageLoader.getImage("note-dureevague.png");
static final private Color colorLectureMIDIPacmanLangue = new Color(0.0f, 0.5f, 0.0f);
private float noteCentreX;
private final Alteration alterationParDefaut;
AffichageNote(Systeme systeme, Note note, float notecentrex) {
super(systeme, note);
this.noteCentreX = notecentrex;
alterationParDefaut = systeme
.getPartitionDonnees()
.getAlterationParDefaut
(note.getDebutMoment(),
getSysteme().getDebutMoment(),
note.getPortee(),
note.getHauteur());
}
private Note getNote()
{
return (Note) getElementMusical();
}
private Moment getFinMoment()
{
return getNote().getFinMoment();
}
private Area getShape() {
float cercleRayon = (float) getNoteRayon();
float cercleCentreY = (float) getSysteme().getY(getNote().getPortee(), getNote().getCoordonneeVerticaleSurPortee());
return RegionFactory.createEllipse(noteCentreX - cercleRayon - 1,
cercleCentreY - cercleRayon,
2 * cercleRayon + 2,
2 * cercleRayon);
}
public double getNoteRayon()
{
if(getNote().isAppogiature())
return 2*getSysteme().getNoteRayon(getPortee())/3;
else
return getSysteme().getNoteRayon(getPortee());
}
private double getInterLigne()
{
return getSysteme().getInterLigne(getPortee());
}
public Portee getPortee()
{
return getNote().getPortee();
}
private void afficherLigneSupplementaire(Graphics g, double xcentrenote, double yLigneSupplementaire) {
/* affiche UNE ligne supplémentaire*/
g.drawLine((xcentrenote - getSysteme().ligneSupplementaireLongueurGet() / 2),
yLigneSupplementaire,
(xcentrenote + getSysteme().ligneSupplementaireLongueurGet() / 2),
yLigneSupplementaire);
}
/**
*
* @param g
* @param xcentrenote
* @param ytroisiemeligne
* @param coordonneVerticale
*
* Dessine les lignes supplémentaires si jamais la note est trop aigu ou trop grave
* ytroisiemeligne = le y de la 3e ligne centrale de la portée concernée
*/
private void afficherLignesSupplementaires(Graphics g,
double xcentrenote,
Portee portee,
int coordonneVerticale) {
g.setPenWidth(1.8f);
//si une note est trop aigue
for(int ligneSupplementaireCoordonneeVerticale = 6;
ligneSupplementaireCoordonneeVerticale <= coordonneVerticale;
ligneSupplementaireCoordonneeVerticale+=2)
{
afficherLigneSupplementaire(g,
xcentrenote,
getSysteme().getY(portee,
ligneSupplementaireCoordonneeVerticale));
}
//si une note est trop grave
//(ce qui est suit c'est ce qui a au dessus avec tous les signes opposés)
for(int ligneSupplementaireCoordonneeVerticale = -6;
ligneSupplementaireCoordonneeVerticale >= coordonneVerticale;
ligneSupplementaireCoordonneeVerticale-=2)
{
afficherLigneSupplementaire(g,
xcentrenote,
getSysteme().getY(portee,
ligneSupplementaireCoordonneeVerticale));
}
}
private void drawPetitPoint(Graphics g)
{
double y = getNoteCentreY();
if(isSurLigne())
y -= getInterLigne()*0.4;
dessinerDisque(g, noteCentreX + 2.2*getNoteRayon(),
y, 0.4*getNoteRayon());
}
private void drawDeuxiemePetitPoint(Graphics g)
{
double y = getNoteCentreY();
if(isSurLigne())
y -= getInterLigne()*0.4;
dessinerDisque(g, noteCentreX + 3.2*getNoteRayon(),
y, 0.4*getNoteRayon());
}
private void drawLectureMIDIPacManLangue(Graphics g, int x1, int y, int x2, double ranimation)
{
int n = (int) ((x2 - x1) / getInterLigne());
int epaisseur = (int) ((getInterLigne()/8) * (1.2+Math.cos(ranimation*5)));
for(int i = 0; i<n; i++)
{
int x = x1 + (int) (i*getInterLigne());
g.drawLine(x, y - epaisseur,
x + (getInterLigne()/2),
y + epaisseur);
g.drawLine(x + getInterLigne(), y - epaisseur,
x + (getInterLigne()/2),
y + epaisseur);
}
}
public void dessinerLectureMIDIFleur(Graphics g, Moment moment)
{
Rectangle r = getRectangle();
r.grow((int) (0.3*getInterLigne()), (int) (0.3*getInterLigne()));
if(getNote().getDuree().isStrictementInferieur(new Duree(new Rational(2, 1))))
{
float angle = (float) moment.getRational().getRealNumber()*2;
g.drawImage(imgNoteLectureMIDIFleur, r, angle);
}
else
{
g.drawImage(imgNoteLectureMIDIPacMan, r);
g.setPenWidth(2.0f);
g.setColor(colorLectureMIDIPacmanLangue);
drawLectureMIDIPacManLangue(g, (int) r.getCenterX(),
(int) r.getCenterY(),
(int) getSysteme().getXNotes(moment),
moment.getRealNumber());
}
}
private boolean isSurLigne()
{
return (getNote().getCoordonneeVerticaleSurPortee() % 2 == 0);
}
@Override
public void draw(Graphics g) {
afficherLignesSupplementaires(g,
noteCentreX,
getNote().getPortee(),
getNote().getCoordonneeVerticaleSurPortee());
//affiche les altérations #, b, etc.
if(!getNote().getHauteur().getAlteration().equals(alterationParDefaut))
getSysteme().dessinerAlterationGauche(g,
getNote().getHauteur().getAlteration(),
getNoteCentreX() - getNoteRayon(),
getPortee(),
getCoordonneeVerticaleSurPortee());
if(getNote().getDuree().getRational().isZero()
|| getNote().getDuree().isVague())
{
Rectangle r = getRectangle();
r.grow((int) (0.3*getInterLigne()), (int) (0.3*getInterLigne()));
if(getNote().getDuree().isStrictementInferieur(new Duree(new Rational(2, 1))))
{
g.drawImage(imgNoteDureeVague, r);
}
return;
}
switch(getNote().getNoteFigure())
{
case OVALE:
if(getNote().getDuree().getRational().isSuperieur(new Rational(2, 1)))
dessinerCercle(g, getNoteCentreX(), getNoteCentreY(), getNoteRayon());
else
dessinerDisque(g, getNoteCentreX(), getNoteCentreY(), getNoteRayon());
break;
case LOSANGE:
if(getNote().getDuree().getRational().isSuperieur(new Rational(2, 1)))
dessinerLosange(g, getNoteCentreX(), getNoteCentreY(), getNoteRayon());
else
dessinerLosangeRempli(g, getNoteCentreX(), getNoteCentreY(), getNoteRayon());
break;
case CROIX:
dessinerCroix(g, getNoteCentreX(), getNoteCentreY(), getNoteRayon());
break;
}
if(getNote().getDuree().isPremierPetitPoint())
{
drawPetitPoint(g);
}
if(getNote().getDuree().isDeuxiemePetitPoint())
{
drawDeuxiemePetitPoint(g);
}
if(getNote().isLieeALaSuivante())
drawLieeALaSuivante(g);
}
@Override
public Selection getSelection(Area area) {
Area a = getShape();
a.intersect(area);
if(!a.isEmpty())
{
return new Selection(getNote());
}
else
return null;
}
@Override
public Area getArea() {
return RegionFactory.createRegion(getRectangle());
}
@Override
public Rectangle getRectangle()
{
double cercleRayon = getNoteRayon();
return RegionFactory.createRectangle((int) (getNoteCentreX() - cercleRayon),
(int) (getNoteCentreY() - cercleRayon),
(int) (2 * cercleRayon)+1,
(int) (2 * cercleRayon)+1);
}
public double getNoteCentreY()
{
return getSysteme().getY(getNote().getPortee(), getCoordonneeVerticaleSurPortee());
}
private double getNoteCentreX()
{
return noteCentreX;
}
public double getX() {
return noteCentreX;
}
public double getXFin() {
return getX() + getNoteRayon();
}
private int getCoordonneeVerticaleSurPortee()
{
return getNote().getCoordonneeVerticaleSurPortee();
}
public void setX(double x) {
noteCentreX = (float) x;
}
private void drawLieeALaSuivante(Graphics g) {
ControlCurve p = new NatCubic();
double xdebut = (getNoteCentreX() + getNoteRayon() + getInterLigne() * 0.2 );
double xfin = getSysteme().getXNotes(getFinMoment()) - getNoteRayon() - getInterLigne() * 0.2;
double y = getNoteCentreY() + getNoteRayon();
p.addPoint( (int) xdebut, (int) y);
p.addPoint( (int) (xdebut + xfin) / 2, (int) (y + getInterLigne() * 0.5));
p.addPoint( (int) xfin, (int) (y));
p.paint(g);
}
private Polygon getLosangePolygon(double noteCentreX, double noteCentreY, double noteRayon)
{
Polygon p = RegionFactory.createPolygon();
p.addPoint((int) (noteCentreX),
(int) (noteCentreY - noteRayon));
p.addPoint((int) (noteCentreX + noteRayon),
(int) (noteCentreY));
p.addPoint((int) (noteCentreX),
(int) (noteCentreY + noteRayon));
p.addPoint((int) (noteCentreX - noteRayon),
(int) (noteCentreY));
return p;
}
private void dessinerLosange(Graphics g, double noteCentreX, double noteCentreY, double noteRayon) {
Polygon p = getLosangePolygon(noteCentreX, noteCentreY, noteRayon);
g.drawPolygon(p);
}
private void dessinerLosangeRempli(Graphics g, double noteCentreX, double noteCentreY, double noteRayon) {
Polygon p = getLosangePolygon(noteCentreX, noteCentreY, noteRayon);
g.drawPolygon(p);
g.fillPolygon(p);
}
private void dessinerCroix(Graphics g, double noteCentreX, double noteCentreY, double noteRayon) {
g.drawLine((int) (noteCentreX - noteRayon),
(int) (noteCentreY - noteRayon),
(int) (noteCentreX + noteRayon),
(int) (noteCentreY + noteRayon));
g.drawLine((int) (noteCentreX - noteRayon),
(int) (noteCentreY + noteRayon),
(int) (noteCentreX + noteRayon),
(int) (noteCentreY - noteRayon));
}
// @Override
// public Set<Poignee> getPoignees() {
// Set<Poignee> P = new HashSet<Poignee>();
// P.add(new PoigneeElementMusicalDureeFin(getSysteme(), getNote()));
// return P;
// }
public int getCoordonneeVerticale() {
return getNote().getCoordonneeVerticaleSurPortee();
}
}
| [
"francois.schwarzentruber@ens-rennes.fr"
] | francois.schwarzentruber@ens-rennes.fr |
3d8d46e11a4f2bb199d8754b8684bb9884b385ed | a03ddb4111faca852088ea25738bc8b3657e7b5c | /TestTransit/src/com/google/android/gms/games/internal/GamesClientImpl$RoomConnectedCallback.java | 35bcf971ff4e72571be4b20d0adbfb50768c3dad | [] | no_license | randhika/TestMM | 5f0de3aee77b45ca00f59cac227450e79abc801f | 4278b34cfe421bcfb8c4e218981069a7d7505628 | refs/heads/master | 2020-12-26T20:48:28.446555 | 2014-09-29T14:37:51 | 2014-09-29T14:37:51 | 24,874,176 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 945 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.google.android.gms.games.internal;
import com.google.android.gms.common.data.DataHolder;
import com.google.android.gms.games.multiplayer.realtime.Room;
import com.google.android.gms.games.multiplayer.realtime.RoomUpdateListener;
// Referenced classes of package com.google.android.gms.games.internal:
// GamesClientImpl
private final class init> extends init>
{
final GamesClientImpl NE;
public void a(RoomUpdateListener roomupdatelistener, Room room, int i)
{
roomupdatelistener.onRoomConnected(i, room);
}
Q(GamesClientImpl gamesclientimpl, RoomUpdateListener roomupdatelistener, DataHolder dataholder)
{
NE = gamesclientimpl;
super(gamesclientimpl, roomupdatelistener, dataholder);
}
}
| [
"metromancn@gmail.com"
] | metromancn@gmail.com |
0938305a7a0dfa5546ce8cbd02b53226ecae4494 | cebab5906e9ce39791f0c136bb61a21846e922d3 | /TeachDroid/datalink_old/com/keba/kemro/plc/network/sysrpc/RepSys/TRepSysMsgEntryResp.java | d97417148c510af13de6c14368345b3f400ec6ba | [] | no_license | hauserkristof/TeachDroid | 7927965fb66fbfe917430106d40fa2c005d32188 | 9edfcfd9aa8b75847db97a5798df7baa124c6e31 | refs/heads/master | 2021-05-27T16:17:41.448040 | 2014-03-05T07:54:56 | 2014-03-05T07:54:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package com.keba.kemro.plc.network.sysrpc.RepSys;
import java.io.IOException;
import com.keba.jrpc.rpc.RPCException;
import com.keba.jrpc.rpc.RPCInputStream;
import com.keba.jrpc.rpc.RPCOutputStream;
import com.keba.jrpc.rpc.XDR;
public class TRepSysMsgEntryResp implements XDR {
public TRepSysRespErr errorCode;
public TRepSysMsgEntry value;
public TRepSysMsgEntryResp () {
errorCode = new TRepSysRespErr();
value = new TRepSysMsgEntry();
}
public void write (RPCOutputStream out) throws RPCException, IOException {
errorCode.write(out);
value.write(out);
}
public void read (RPCInputStream in) throws RPCException, IOException {
errorCode.read(in);
value.read(in);
}
} | [
"ltz@keba.com"
] | ltz@keba.com |
86c6b0ee264052d4a62c8c66ceabe29b395a5ca9 | f0695098503a2e6dbfcb97fc64883da40f3ffff3 | /spring4-mvc-gradle-xml/src/main/java/org/sep/merchant/form/dao/RiskItemDao.java | c799e9c82ad6cfebc65abaf342e117b4756e5efe | [] | no_license | acailic/sep2015 | e775e1af7da448ad2ce33a642a5eebf399030c2b | e60683e8263e4b65b04b9d495840ff8e65103a72 | refs/heads/master | 2016-08-12T08:12:53.352558 | 2016-02-05T20:21:54 | 2016-02-05T20:21:54 | 46,935,008 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 184 | java | package org.sep.merchant.form.dao;
import org.sep.merchant.form.model.RiskItem;
import org.sep.merchant.jpa.GenericDao;
public interface RiskItemDao extends GenericDao<RiskItem>{
}
| [
"igoryov@gmail.com"
] | igoryov@gmail.com |
3809db2c2550f2b83e0ac9a747b113c69afc1006 | 89c89a06ab401ed4a751543971f8a90e48c9e6f3 | /waf-client/src/main/java/com/airlock/waf/client/config/rs/transfer/VirtualHostDto.java | 1c03959661afad5d32150608924457be6b5b5c6c | [
"MIT"
] | permissive | ergon/airlock-waf-kubernetes-openshift-integration | 9ab444f98bc3041053806be3cdd6d094d33905b9 | cb902d43c6fb81579cecd5219b40b5fc742834e0 | refs/heads/master | 2023-08-10T20:52:29.750942 | 2023-07-27T11:41:34 | 2023-07-27T11:41:34 | 169,729,551 | 17 | 6 | MIT | 2023-07-27T11:41:35 | 2019-02-08T12:08:44 | Java | UTF-8 | Java | false | false | 1,418 | java | package com.airlock.waf.client.config.rs.transfer;
import com.fasterxml.jackson.annotation.JsonTypeName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import static lombok.AccessLevel.PRIVATE;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor(access = PRIVATE)
@JsonTypeName(VirtualHostDto.VIRTUAL_HOST_TYPE)
public class VirtualHostDto {
public static final String VIRTUAL_HOST_TYPE = "virtual-host";
private String name;
private String hostName;
private VirtualHostNetworkInterfaceDto networkInterface;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor(access = PRIVATE)
public static class VirtualHostNetworkInterfaceDto {
private String externalLogicalInterfaceName;
private String ipV4Address;
private String ipV6Address;
private HttpDto http;
private HttpsDto https;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor(access = PRIVATE)
public static class HttpDto {
private Boolean enabled;
private Integer port;
private Boolean httpsRedirectEnforced;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor(access = PRIVATE)
public static class HttpsDto {
private Boolean enabled;
private Integer port;
private Boolean http2Allowed;
}
}
| [
"orlando.tomas@ergon.ch"
] | orlando.tomas@ergon.ch |
7c1437bad5ad2bb4b5200a93f4187ea6543a6c2f | 2088303ad9939663f5f8180f316b0319a54bc1a6 | /src/test/java/com/lottery/test/lottype/AnHuiK3Test.java | 4a017fc6d856f150fcfb5a63f88edfab287c89b2 | [] | no_license | lichaoliu/lottery | f8afc33ccc70dd5da19c620250d14814df766095 | 7796650e5b851c90fce7fd0a56f994f613078e10 | refs/heads/master | 2022-12-23T05:30:22.666503 | 2019-06-10T13:46:38 | 2019-06-10T13:46:38 | 141,867,129 | 7 | 1 | null | 2022-12-16T10:52:50 | 2018-07-22T04:59:44 | Java | UTF-8 | Java | false | false | 727 | java | package com.lottery.test.lottype;
import java.math.BigDecimal;
import java.util.List;
import org.junit.Test;
import com.lottery.lottype.AnHuiKuai3;
import com.lottery.lottype.SplitedLot;
public class AnHuiK3Test {
AnHuiKuai3 k3 = new AnHuiKuai3();
@Test
public void test() {
System.out.println(k3.validate("100811-3,5^", new BigDecimal(400), new BigDecimal(1), 200));
System.out.println(k3.validate("100812-1,4*2,5^", new BigDecimal(800), new BigDecimal(1), 200));
}
@Test
public void testSplit() {
List<SplitedLot> splits = k3.split("100811-3,5^", 100, 40000, 200);
for(SplitedLot s:splits) {
System.out.println(s.getLotterytype()+ " "+s.getBetcode()+" "+s.getLotMulti()+" "+s.getAmt());
}
}
}
| [
"1147149597@qq.com"
] | 1147149597@qq.com |
83d9904d9df4331987168ceaaa76580e7db7d625 | 304f95b5f61e447cbeb68c59f07ececf2932a6db | /2listapod2016.2/questao_01/node2/src/main/java/br/edu/ifpb/pod/ConexaoFabrica.java | 5ba593f578a067be9c5a7ad0797db882e8ccef01 | [] | no_license | AluisioPereira/POD2016.2A | c20c6854224105f80afcace52c565eff8aa1e605 | 408c05c12f26b4e5f69b716b0e72c0a728cb40f2 | refs/heads/master | 2021-01-21T08:50:40.807180 | 2017-05-24T06:14:25 | 2017-05-24T06:14:25 | 91,642,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,355 | java | package br.edu.ifpb.pod;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URISyntaxException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
/**
*
* @author ajp
*/
public class ConexaoFabrica {
/**
* Método retorna uma conexão com o banco de dados mysql
*
* @return
* @throws java.io.IOException
* @throws java.net.URISyntaxException
* @throws java.lang.ClassNotFoundException
* @throws java.sql.SQLException
*/
public Connection getConectionMysql() throws IOException, URISyntaxException, ClassNotFoundException, SQLException {
String url2;
String usuario2;
String senha2;
String nome2;
Properties properties = new Properties();
properties.load(new FileInputStream(getClass().getResource("/banco/acesso.properties").toURI().getPath()));
url2 = properties.getProperty("url2");
usuario2 = properties.getProperty("usuario2");
senha2 = properties.getProperty("senha2");
nome2 = properties.getProperty("nome2");
Class.forName(nome2);
try {
return DriverManager.getConnection(url2, usuario2, senha2);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
| [
"aluisio1102@gmail.com"
] | aluisio1102@gmail.com |
daec88d631ca0abef7f098c3a35b5e7f34bd5d16 | 4d056e8b7a49ae99544228d54bae524152ac0fc2 | /src/chess/Attack.java | 4b997d43c8af1b811007d9e95f4ebeea35259646 | [] | no_license | javier78/Chess | 5073cae29b4d2440c8c6f7e9509afe168426c8c0 | 000e1fb9e47b79ad53fab90ae35cb2c976d223a2 | refs/heads/master | 2021-03-13T00:03:33.461925 | 2015-01-04T05:55:22 | 2015-01-04T05:55:22 | 28,765,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | /**
* @author Javier Martinez
*/
package chess;
public class Attack
{
ChessPiece cp;
String dir;
public Attack(ChessPiece p,String dir)
{
cp=p;
this.dir=dir;
}
}
| [
"javier.martinez1024@gmail.com"
] | javier.martinez1024@gmail.com |
980036c429deb5b9d8aac89c1593a1a098c868e4 | 0b7d185feb54d2d421b3eae462859971745ee103 | /pace-base/src/main/java/com/pace/base/comm/PafRequest.java | 7faed596ffb0d928d22d0a9a3143d3c90e1eabaa | [] | no_license | alanfarkas/test-pace-server | b61462a2c48a989fd1015428e890d760feccd224 | 334a21210956409f8c8d1e48588a74c4c04fbd7c | refs/heads/master | 2021-01-01T05:43:14.449086 | 2013-06-27T17:15:48 | 2013-06-27T17:15:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,323 | java | /*
* File: @(#)PafRequest.java Package: com.pace.base.comm Project: Paf Base Libraries
* Created: Sep 6, 2005 By: JWatkins
* Version: x.xx
*
* Copyright (c) 2005-2006 Palladium Group, Inc. All rights reserved.
*
* This software is the confidential and proprietary information of Palladium Group, Inc.
* ("Confidential Information"). You shall not disclose such Confidential Information and
* should use it only in accordance with the terms of the license agreement you entered into
* with Palladium Group, Inc.
*
*
*
Date Author Version Changes
xx/xx/xx xxxxxxxx x.xx ..............
* 05/24/06 AFarkas x.xx Moved from com.pace.base.server.comm (PafServer)
*
*/
package com.pace.base.comm;
/**
* Base class for holding information common to all client requests
*
* @version x.xx
* @author JWatkins
*
*/
public class PafRequest {
private String clientId;
private String sessionToken;
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getSessionToken() {
return sessionToken;
}
public void setSessionToken(String sessionToken) {
this.sessionToken = sessionToken;
}
}
| [
"jwatkins@53513f66-9fe0-4f4b-a901-10d5c8ad6cc7"
] | jwatkins@53513f66-9fe0-4f4b-a901-10d5c8ad6cc7 |
2e9102046be16e96b5270a8d28abc67f8d2a52b3 | 7ac2df61e84ddbaaf0e57fbaccc3c4f24297c5b9 | /core/src/main/java/com/coldcore/coloradoftp/command/impl/ftp/RntoCommand.java | a33b40531280066368ebbec581cad01388a0b387 | [] | no_license | longkaili/coloradoftp | 037208923865e66fdf1fc44a41adced8c8ab147a | f21e9758a968d147ef896067dce2022756596ce0 | refs/heads/master | 2021-01-10T08:17:15.354332 | 2016-04-10T15:30:20 | 2016-04-10T15:30:20 | 55,906,903 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,674 | java | /**
* Command RNTO.
* See FTP spec for details on the command.
*/
package com.coldcore.coloradoftp.command.impl.ftp;
import com.coldcore.coloradoftp.command.Reply;
import com.coldcore.coloradoftp.command.impl.AbstractCommand;
import com.coldcore.coloradoftp.factory.ObjectFactory;
import com.coldcore.coloradoftp.factory.ObjectName;
import com.coldcore.coloradoftp.filesystem.FileSystem;
import com.coldcore.coloradoftp.session.Session;
import org.apache.log4j.Logger;
/**
"重命名为(RNTO)"指令,该指令指出了要被改名的文件的新的路径名.
与上面的"RNFR"指令共同完成文件的重命名
*/
public class RntoCommand extends AbstractCommand {
private static Logger log = Logger.getLogger(RntoCommand.class);
public Reply execute() {
Reply reply = getReply();
if (!testLogin()) return reply;
Session session = controlConnection.getSession();
session.removeAttribute("rnto.path");
String rnto = getParameter();
if (rnto.equals("")) {
reply.setCode("501");
reply.setText("Send path name.");
return reply;
}
String rnfr = (String) session.getAttribute("rnfr.path");
session.removeAttribute("rnfr.path");
if (rnfr == null) {
reply.setCode("503");
reply.setText("Send RNFR first.");
return reply;
}
//调用文件系统的renamePath()函数完成路径的重命名
FileSystem fileSystem = (FileSystem) ObjectFactory.getObject(ObjectName.FILESYSTEM);
fileSystem.renamePath(rnfr, rnto, session);
reply.setCode("250");
reply.setText("Path renamed.");
return reply;
}
}
| [
"longkaili@meituan.com"
] | longkaili@meituan.com |
008902528fea114124ac3784ad26609fcd6c143e | 331cefa101b79e5cee1e779b05fcc8f83bbd77d7 | /JavaUebung01/HalloWelt.java | 3680e42792fa1c077a6ac09e6d090b0fd523e2b0 | [] | no_license | chiefdestructor/Java | 90088f8930b8fb233f2e3f542e889e300796fb60 | d8a2fe7efd1aad052f2fead21d0c209fc17afe12 | refs/heads/master | 2020-04-05T23:19:04.442581 | 2013-01-30T17:33:46 | 2013-01-30T17:33:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 169 | java | public class HalloWelt{
public static void main (String args[]){
System.out.println("Hallo Welt!");
System.out.println("Hier spricht der Imperator!");
}
} | [
"d.benaissa@gmx.de"
] | d.benaissa@gmx.de |
c0c9b4c3fc63d5bc32b58840a0bbcf9840d17f88 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/elastic--elasticsearch/904cbf53409ae62bb67cd07c31ef88121cff9361/after/LimitQueryBuilder.java | 63e242875fe3daefcd2d02e4ed1a66def2eace10 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,812 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.index.query;
import org.apache.lucene.search.Query;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.XContentBuilder;
import java.io.IOException;
/**
* @deprecated Use {@link SearchRequestBuilder#setTerminateAfter(int)} instead.
*/
@Deprecated
public class LimitQueryBuilder extends AbstractQueryBuilder<LimitQueryBuilder> {
public static final String NAME = "limit";
private final int limit;
static final LimitQueryBuilder PROTOTYPE = new LimitQueryBuilder(-1);
public LimitQueryBuilder(int limit) {
this.limit = limit;
}
public int limit() {
return limit;
}
@Override
protected void doXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(NAME);
builder.field("value", limit);
printBoostAndQueryName(builder);
builder.endObject();
}
@Override
protected Query doToQuery(QueryShardContext context) throws IOException {
// this filter is deprecated and parses to a filter that matches everything
return Queries.newMatchAllQuery();
}
@Override
public QueryValidationException validate() {
// nothing to validate
return null;
}
@Override
protected boolean doEquals(LimitQueryBuilder other) {
return Integer.compare(other.limit, limit) == 0;
}
@Override
protected int doHashCode() {
return this.limit;
}
@Override
protected LimitQueryBuilder doReadFrom(StreamInput in) throws IOException {
return new LimitQueryBuilder(in.readInt());
}
@Override
protected void doWriteTo(StreamOutput out) throws IOException {
out.writeInt(limit);
}
@Override
public String getName() {
return NAME;
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
4548e433d3e54ccc30df40accfcb2ed9df3dcd63 | cb3d25957c5fb256a80db15ae7c8b34843f38914 | /src/main/java/com/faculte/mandatPersonnel/MandatPersonnelApplication.java | caabfc09d141accda588934265230909722c19fc | [] | no_license | lstsir2019/simple-faculte-mandat | 8fd0a2d33ad917c20e64a8cf8953018c8a553e3f | cffd20b3893bfcc104b15f39e2ab9e5900195306 | refs/heads/master | 2020-04-25T17:18:37.791689 | 2019-06-19T14:25:41 | 2019-06-19T14:25:41 | 172,943,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | package com.faculte.mandatPersonnel;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableFeignClients("com.faculte.mandatPersonnel.rest")
@EnableDiscoveryClient
public class MandatPersonnelApplication {
public static void main(String[] args) {
SpringApplication.run(MandatPersonnelApplication.class, args);
}
}
| [
"abdou@DESKTOP-T0N64LA"
] | abdou@DESKTOP-T0N64LA |
a93eecc1e4589820a178ff28ddd6fff0e8caf85d | c3606c4f01c68e8225e628b8ece5ccbe7f6e5a29 | /src/test/java/utils/BrowserFactory.java | c43e4b9cd5a7faa61ed50dfc479a9c302f5a71c9 | [] | no_license | Quincet/SeleniumHW | d0aa4cf0b1bc8c37a14633b7fe03bcddb0aca99c | 1971eb3b207f1c6974ee0c3c2ee2cf24287eb01a | refs/heads/master | 2020-04-30T12:20:26.084687 | 2019-04-07T19:28:48 | 2019-04-07T19:28:48 | 176,824,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,483 | java | package utils;
import com.google.common.io.Files;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.opera.OperaDriver;
import org.openqa.selenium.opera.OperaOptions;
import org.openqa.selenium.support.events.AbstractWebDriverEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
public class BrowserFactory {
public static class MyListener extends AbstractWebDriverEventListener {
Logger logger = LoggerFactory.getLogger(BrowserFactory.class);
@Override
public void beforeFindBy(By by, WebElement element, WebDriver driver) {
logger.info("Обращение к элементу " + by);
}
@Override
public void afterFindBy(By by, WebElement element, WebDriver driver) {
logger.info("Найден элемент " + by);
}
@Override
public void onException(Throwable throwable, WebDriver driver) {
File tmp = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
File file = new File("target", "sccreen-" + System.currentTimeMillis() + ".png");
try {
Files.copy(tmp, file);
} catch (IOException e) {
e.printStackTrace();
}
logger.error(file.getAbsolutePath());
}
}
public static WebDriver getBrowser(String browser){
switch (browser.toLowerCase()){
case "firefox":
System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE, "true");
FirefoxOptions ffOpt = new FirefoxOptions();
ffOpt.addPreference("dom.webnotifications.enabled", false);
return new FirefoxDriver();
case "chrome":
ChromeOptions chromeInvisibleOpt = new ChromeOptions();
chromeInvisibleOpt.addArguments("--disable-notifications");
return new ChromeDriver(chromeInvisibleOpt);
case "opera":
OperaOptions options = new OperaOptions();
options.addArguments("--disable-notifications");
return new OperaDriver(options);
default:
return getBrowser("chrome");
}
}
}
| [
"36072477+Quincet@users.noreply.github.com"
] | 36072477+Quincet@users.noreply.github.com |
3acf287004925e7d6fffe18ebcd2db961117caa2 | 44b0beff126742050167c25bb58605738c94d651 | /department-management-portlet-service/src/main/java/com/lftechnology/sbwbtraining/service/DepartmentService.java | 1d13b6463b9f2a27ae1f995c31704be2d33b1e45 | [] | no_license | Msanjib/SBWB_Assignment | 5e2907446f0c13bf5f028ad259a7dfe8b4854413 | 03fdbfc86a72edf5aaf18c5e3e9d8b7f7281ae98 | refs/heads/master | 2016-09-05T23:53:30.390048 | 2015-02-27T08:53:05 | 2015-02-27T08:53:05 | 31,411,117 | 0 | 0 | null | 2015-03-09T11:57:53 | 2015-02-27T08:55:51 | Java | UTF-8 | Java | false | false | 2,054 | java | package com.lftechnology.sbwbtraining.service;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.jsonwebservice.JSONWebService;
import com.liferay.portal.kernel.transaction.Isolation;
import com.liferay.portal.kernel.transaction.Transactional;
import com.liferay.portal.service.BaseService;
import com.liferay.portal.service.InvokableService;
/**
* The interface for the department remote service.
*
* <p>
* This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
* </p>
*
* @author Sanjib Maharjan
* @see DepartmentServiceUtil
* @see com.lftechnology.sbwbtraining.service.base.DepartmentServiceBaseImpl
* @see com.lftechnology.sbwbtraining.service.impl.DepartmentServiceImpl
* @generated
*/
@JSONWebService
@Transactional(isolation = Isolation.PORTAL, rollbackFor = {
PortalException.class, SystemException.class}
)
public interface DepartmentService extends BaseService, InvokableService {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this interface directly. Always use {@link DepartmentServiceUtil} to access the department remote service. Add custom service methods to {@link com.lftechnology.sbwbtraining.service.impl.DepartmentServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
*/
/**
* Returns the Spring bean ID for this bean.
*
* @return the Spring bean ID for this bean
*/
public java.lang.String getBeanIdentifier();
/**
* Sets the Spring bean ID for this bean.
*
* @param beanIdentifier the Spring bean ID for this bean
*/
public void setBeanIdentifier(java.lang.String beanIdentifier);
public java.lang.Object invokeMethod(java.lang.String name,
java.lang.String[] parameterTypes, java.lang.Object[] arguments)
throws java.lang.Throwable;
}
| [
"sanjibmaharjan@lftechnology.com"
] | sanjibmaharjan@lftechnology.com |
aa86d5652dbf6eac1ab973345a15959735c6f179 | d714a28521865130d0340364da9953feb236336e | /riptide-opentracing/src/main/java/org/zalando/riptide/opentracing/span/HttpResponseHeaderSpanDecorator.java | 9952a8e32b0b1c5d16459f9c3b63206d250c9dd4 | [
"MIT"
] | permissive | zalando/riptide | 52e81ef13c85a4af6422360f5c19ee82959024c2 | ce3e7fda2ded5b5f2867732461e70fc5056ed0ae | refs/heads/main | 2023-08-31T22:11:59.704472 | 2023-08-29T15:35:34 | 2023-08-29T15:35:34 | 33,559,545 | 281 | 79 | MIT | 2023-09-12T07:54:45 | 2015-04-07T18:03:31 | Java | UTF-8 | Java | false | false | 693 | java | package org.zalando.riptide.opentracing.span;
import io.opentracing.Span;
import lombok.AllArgsConstructor;
import org.apiguardian.api.API;
import org.springframework.http.client.ClientHttpResponse;
import org.zalando.riptide.RequestArguments;
import static org.apiguardian.api.API.Status.INTERNAL;
@API(status = INTERNAL)
@AllArgsConstructor
final class HttpResponseHeaderSpanDecorator implements SpanDecorator {
private final HttpSpanOperator operator;
@Override
public void onResponse(
final Span span,
final RequestArguments arguments,
final ClientHttpResponse response) {
operator.apply(span, response.getHeaders());
}
}
| [
"w.schoenborn@gmail.com"
] | w.schoenborn@gmail.com |
1dab254b112389f5c7d3335ff8b6b327c7b6b484 | e10dec611c5f3bfaf79ac4530d691a491fa86c16 | /src/com.faang/LinkedLists/LinkedListTemplate.java | c6b3147e2cd28f4d11b218857cbf18486341b386 | [] | no_license | coder-madhu/FAANG_Prepare | cfb31e9f2f9c0e503c53b96a28d6d3c2f2207939 | 396ccc073faa51e13b4107bab722a2be34a6bc68 | refs/heads/master | 2023-01-18T22:20:45.241043 | 2020-11-24T19:35:15 | 2020-11-24T19:35:15 | 289,644,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,266 | java | package com.faang.LinkedLists;
class SLLNode{
int data;
SLLNode next;
SLLNode(int val) {
data = val;
next = null;
}
}
public class LinkedListTemplate {
SLLNode findMiddle(SLLNode h){
if(h == null)
return h;
SLLNode fp =h, sp =h;
while(fp!= null && fp.next != null)
{
fp = fp.next.next;
if(fp == null)
return sp;
sp = sp.next;
}
return sp;
}
SLLNode merge(SLLNode h1, SLLNode h2){
if( h1 == null)
return h2;
if( h2 == null)
return h1;
h1.next =merge(h2,h1.next);
return h1;
}
SLLNode revers(SLLNode h)
{
SLLNode c = h, p = null, n;
while( c!= null)
{
n = c.next;
c.next = p;
p = c;
c = n;
}
return p;
}
void frontLastRearragne(SLLNode head) {
//if (head == null) return null;
SLLNode h1 = head;
// Find middle node
SLLNode mid = findMiddle(head);
// psilt the last into 2 parts
SLLNode h2 = mid.next;
mid.next = null;
h2 = revers(h2);
merge(h1, h2);
}
}
| [
"madhu.korepu1@t-mobile.com"
] | madhu.korepu1@t-mobile.com |
2a3288a066c2c71544c1b1b21c7366b4d7c75cdb | e16fa5a4bbda618fa26b9b89034f50f6607a037a | /Game_RPM/src/GameRPM/DefensivePlayer.java | a79c2b66b0d1d8cb29415deb5fa16ce701e92e52 | [] | no_license | dilnoraa/Game_RPM | 40ea0c7100b962fcfd2d514e865fec31a034a1d8 | a2efa48efd732568060c1f97a4d47f5746eee670 | refs/heads/master | 2022-07-24T10:27:59.803512 | 2020-05-13T21:02:55 | 2020-05-13T21:02:55 | 111,469,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package GameRPM;
public class DefensivePlayer extends Player{
public DefensivePlayer(String name) {
super(name);
// TODO Auto-generated constructor stub
}
public String strategic_play(String lastMoveOfRival) {
if(lastMoveOfRival.equals("Scissors"))
move= "Paper";
else if(lastMoveOfRival.equals("Paper"))
move="Rock";
else
move="Scissors";
return move;
}
}
| [
"dilnora.matniyazova@gmail.com"
] | dilnora.matniyazova@gmail.com |
9ec8e04d93f5b270d0a1d8751fe0a866b97d387c | 9877ff9f13b35be0316619a6bef7cf95d9421ca9 | /src/main/java/mvc3/config/MongoConfig.java | 3d3840e9bbc8e4cbc55a8a43df9cf3e31b3942f3 | [] | no_license | levelp/SpringMVC4 | 4f7403d83105320b7802e1df14c26a2f1d676527 | 222803177e099e728a693b6e0fcdbc2485310e69 | refs/heads/master | 2021-01-10T08:40:32.327805 | 2017-02-08T19:26:39 | 2017-02-08T20:10:28 | 54,267,567 | 1 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,646 | java | package mvc3.config;
import com.mongodb.Mongo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper;
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
import org.springframework.data.mongodb.core.convert.MongoTypeMapper;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import java.net.UnknownHostException;
@Configuration
@Lazy
class MongoConfig {
@Bean
public MongoDbFactory mongoDbFactory() throws UnknownHostException {
return new SimpleMongoDbFactory(new Mongo(), "mvc-demo");
}
@Bean
public MongoTemplate mongoTemplate() throws UnknownHostException {
MongoTemplate template = new MongoTemplate(mongoDbFactory(), mongoConverter());
return template;
}
@Bean
public MongoTypeMapper mongoTypeMapper() {
return new DefaultMongoTypeMapper(null);
}
@Bean
public MongoMappingContext mongoMappingContext() {
return new MongoMappingContext();
}
@Bean
public MappingMongoConverter mongoConverter() throws UnknownHostException {
MappingMongoConverter converter = new MappingMongoConverter(mongoDbFactory(), mongoMappingContext());
converter.setTypeMapper(mongoTypeMapper());
return converter;
}
}
| [
"super.denis@gmail.com"
] | super.denis@gmail.com |
6cfa154fb2e0368ade2672227f592aab7c58fd73 | 0fe4aeb0b763ec3f1c4f3d8d615e9d0e931326d7 | /Database/services/RoomsService.java | eebf585a72835225347ffdacaf8c55dabaf38aea | [] | no_license | dnicanix/SECURDE-SHS-Online-Library-System | 8362b202aaebf4be35ada2179c96105a5af67a6e | 518bdf7e80275696dafcdbf62a910a7721279390 | refs/heads/master | 2020-12-02T17:46:35.743196 | 2017-07-13T19:03:16 | 2017-07-13T19:03:16 | 96,424,230 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package securde.edu.services;
public class RoomsService {
//reserve room
//update room status
//get all rooms
}
| [
"denise_silva@dlsu.edu.ph"
] | denise_silva@dlsu.edu.ph |
6ebb2f09a2d65f1e5ebe979ea63e275cb5adfdf1 | bc42416ce883f3320c43f172c7b48aa35ce34cf8 | /data-common/src/com/souschef/json/encoder/Bean2JSONEncoderDelegate.java | 7970759b3210c3f427a82c19be01263266cf61f0 | [] | no_license | rafael-paypal-solano/sous-chef | fe1492df6cc00cb3941381500ea0f62c2d14f2af | 250bafe30dc4ef8a6b3a03ae253581a4745455b3 | refs/heads/master | 2021-07-23T05:04:58.856742 | 2017-11-02T22:43:15 | 2017-11-02T22:43:15 | 109,326,330 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,376 | java | package com.souschef.json.encoder;
import java.io.PrintWriter;
/**
*<p>This interface define the contract of classes tha implement custom bean encoding into JSON format.</p>
*<p>Copyright © 1998 - 2010 <a href="http://www.castlebreck.com">Castlebreck Inc.</a> All rights reserved. This software may only be copied, altered, transferred or used in accordance<br/>
*with the Castlebreck General Services Agreement which is available upon request from Castlebreck Inc. Visit www.castlebreck.com for<br/>
*contact information. This notice may not be removed and must be included with any copies of this work.</p>
*@author rsolano
*/
public interface Bean2JSONEncoderDelegate {
/**
*<p><code>BeanHieararchy2JSONEncoder.encode(Object bean, Writer writer)</code> delegates encoding process <code>Bean2JSONEncoderDelegate.encode(Object bean, Writer writer)</code> method for each object belonging to the class this instance is bound to.</p>
* @param bean An object that must be either null or an instance of same class returned by <code>this.getManagedClass()</code>
* @param writer .-
* @throws JSONEncodingException
*/
public void encode(Object bean, PrintWriter writer) throws JSONEncodingException;
/**
*
* @return The class whose instances can be translated into JSON.
*/
public Class<?> getManagedClass();
}
| [
"rsolano@castlebreck.com"
] | rsolano@castlebreck.com |
59629134075242e120c34ec81a02dbbf09fb59a2 | 8601453ed3cae0a36696b0163df270b12ff6b111 | /app/src/androidTest/java/com/yanes/database/ExampleInstrumentedTest.java | 2b1b8bce418abf015861a5098011efee42eaddfc | [] | no_license | cyanesgarcia/USADatabase | 6b534b1d486284cd3ecf41262e6119f073718faf | eafe0ad59220ae692b9cc109bbc5f8aa83c6c4ab | refs/heads/master | 2022-11-18T18:30:54.117830 | 2020-07-18T14:44:45 | 2020-07-18T14:44:45 | 280,674,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | package com.yanes.database;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.yanes.database", appContext.getPackageName());
}
}
| [
"lidiayanesgarcia@gmail.com"
] | lidiayanesgarcia@gmail.com |
0456bddebb359d41c4568a5008cad14b5ccf4988 | 7b73756ba240202ea92f8f0c5c51c8343c0efa5f | /classes2/KQQ/PushSwitchData.java | 2feb980b9141e90d9f5a7b0a0349b451b7f7d914 | [] | no_license | meeidol-luo/qooq | 588a4ca6d8ad579b28dec66ec8084399fb0991ef | e723920ac555e99d5325b1d4024552383713c28d | refs/heads/master | 2020-03-27T03:16:06.616300 | 2016-10-08T07:33:58 | 2016-10-08T07:33:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,210 | java | package KQQ;
import com.qq.taf.jce.JceInputStream;
import com.qq.taf.jce.JceOutputStream;
import com.qq.taf.jce.JceStruct;
import com.tencent.mobileqq.hotpatch.NotVerifyClass;
public final class PushSwitchData
extends JceStruct
{
public long appid;
public byte cPushSwitch;
public long uin;
public PushSwitchData()
{
boolean bool = NotVerifyClass.DO_VERIFY_CLASS;
}
public PushSwitchData(long paramLong1, long paramLong2, byte paramByte)
{
this.uin = paramLong1;
this.appid = paramLong2;
this.cPushSwitch = paramByte;
}
public void readFrom(JceInputStream paramJceInputStream)
{
this.uin = paramJceInputStream.read(this.uin, 0, true);
this.appid = paramJceInputStream.read(this.appid, 1, true);
this.cPushSwitch = paramJceInputStream.read(this.cPushSwitch, 2, true);
}
public void writeTo(JceOutputStream paramJceOutputStream)
{
paramJceOutputStream.write(this.uin, 0);
paramJceOutputStream.write(this.appid, 1);
paramJceOutputStream.write(this.cPushSwitch, 2);
}
}
/* Location: E:\apk\QQ_91\classes2-dex2jar.jar!\KQQ\PushSwitchData.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"1776098770@qq.com"
] | 1776098770@qq.com |
f055c448dfd8084f2870990f5fd668dfec1d30b5 | 12027f1b2126f76aa184203bccdca565e6539f8a | /API/src/test/java/com/qa/constants/Path.java | 5497537b9a9d7ca7deea5de4f4fcb379b602650c | [] | no_license | vamshiosuru/Udemy-API | be3f86b3041053c2e9d2c16ef8fc47e7fbc6cc52 | cf110f576babe82881d6f1c2d7c185383079c0ae | refs/heads/master | 2023-07-13T10:32:51.402258 | 2021-08-14T13:01:58 | 2021-08-14T13:01:58 | 396,006,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 97 | java | package com.qa.constants;
public class Path {
String BASE_URI="";
String BASE_path="";
}
| [
"1282vamshi@gmail.com"
] | 1282vamshi@gmail.com |
64ff1699b28b019e6685710f63d788d07105b46b | cb7ca5469115cab34b64a6b3c255660cf8bf6e09 | /org.eclipse.draw2d/src/org/eclipse/draw2d/ConnectionAnchorBase.java | cc4875ba727ee8fcbc1acd03e2f19531f98489a5 | [
"EPL-1.0",
"LicenseRef-scancode-free-unknown",
"MIT"
] | permissive | archimatetool/archi | 59b0a984b3d0471643835cd8f9ff5a648bd97de7 | eec0869ad2b6e9c192e127aa9bc00bdbc82b7cd0 | refs/heads/master | 2023-09-04T02:29:50.509293 | 2023-08-31T10:28:46 | 2023-08-31T10:28:46 | 1,547,663 | 799 | 274 | MIT | 2023-05-26T16:55:05 | 2011-03-30T19:18:13 | Java | UTF-8 | Java | false | false | 1,897 | java | /*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.draw2d;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Provides support for a ConnectionAnchor. A ConnectionAnchor is one of the end
* points of a {@link Connection}. It holds listeners and notifies them if the
* anchor is moved.
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public abstract class ConnectionAnchorBase implements ConnectionAnchor {
/**
* The list of listeners
*/
protected List listeners = new ArrayList(1);
/**
* @see org.eclipse.draw2d.ConnectionAnchor#addAnchorListener(AnchorListener)
*/
@Override
public void addAnchorListener(AnchorListener listener) {
listeners.add(listener);
}
/**
* @see org.eclipse.draw2d.ConnectionAnchor#removeAnchorListener(AnchorListener)
*/
@Override
public void removeAnchorListener(AnchorListener listener) {
listeners.remove(listener);
}
/**
* Notifies all the listeners in the list of a change in position of this
* anchor. This is called from one of the implementing anchors when its
* location is changed.
*
* @since 2.0
*/
protected void fireAnchorMoved() {
Iterator iter = listeners.iterator();
while (iter.hasNext())
((AnchorListener) iter.next()).anchorMoved(this);
}
}
| [
"p.beauvoir@dadabeatnik.com"
] | p.beauvoir@dadabeatnik.com |
e6cd94043a8197326c25615ed4889bed7a75de5a | cf3f8997897762ac108f5f9286d2f53b585f105a | /src/encryptdecrypt/AlgorithmList.java | e961defcfabb050b5069c4eff56fe7efb72fa3dd | [] | no_license | heydarm/encryptor-decryptor | 2eed8d87d862e50cbaa57415a4cfbfe64fe702aa | c5be2458c2dd0545be8a7bdbd94a68e9c4c92471 | refs/heads/master | 2022-11-23T03:02:12.239283 | 2020-07-25T09:13:12 | 2020-07-25T09:13:12 | 267,616,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 78 | java | package encryptdecrypt;
public enum AlgorithmList {
SHIFT,
UNICODE
}
| [
"geydar18@gmail.com"
] | geydar18@gmail.com |
651b003c31b79972921c512cbb0afa649b16478c | 3c0e519e400526379df16320ef53bd3b1f18af5d | /deployable-config-shared/src/main/java/com/jivesoftware/os/routing/bird/deployable/config/shared/DeployableConfig.java | a5f036b083457a66428d003a0292bf6131d5c6b9 | [
"Apache-2.0"
] | permissive | jivesoftware/routing-bird | 1aee04b569af434951602873f26aa987cf899c04 | c55049f30de272b3995e2e112696991e8e10c331 | refs/heads/master | 2020-05-21T23:44:33.383246 | 2018-02-05T23:07:13 | 2018-02-05T23:07:13 | 37,302,101 | 2 | 2 | null | 2017-05-07T16:02:09 | 2015-06-12T04:32:52 | Java | UTF-8 | Java | false | false | 1,716 | java | /*
* Copyright 2013 Jive Software, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.jivesoftware.os.routing.bird.deployable.config.shared;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
public class DeployableConfig {
public final String context;
public final String instanceKey;
public final String instanceVersion;
public final Map<String, String> properties;
@JsonCreator
public DeployableConfig(@JsonProperty("context") String context,
@JsonProperty("instanceKey") String instanceKey,
@JsonProperty("instanceVersion") String instanceVersion,
@JsonProperty("properties") Map<String, String> properties) {
this.context = context;
this.instanceKey = instanceKey;
this.instanceVersion = instanceVersion;
this.properties = properties;
}
@Override
public String toString() {
return "DeployableConfig{"
+ "context=" + context
+ ", instanceKey=" + instanceKey
+ ", instanceVersion=" + instanceVersion
+ ", properties=" + properties
+ '}';
}
}
| [
"jonathan.colt@jivesoftware.com"
] | jonathan.colt@jivesoftware.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.