blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f21780d422bede06a55d7b26c9bf9ba2a1de533e | b3f4831cd7d8aad8bc3cc54d3c9b2fbe3f426fba | /app/gen/com/mobiapplicious/whatstheword/BuildConfig.java | 14269d611f7719bfecc58b749a4776297ce05f29 | [] | no_license | taz13/WordGuess | 11f64f453f9a27357d5203bef72c5f6a64873ada | 312f008fa318e3f0481a4d34bc6a0d0eeaed4f7b | refs/heads/master | 2022-06-16T23:51:58.830650 | 2020-05-04T15:17:28 | 2020-05-04T15:17:28 | 261,219,162 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | /** Automatically generated file. DO NOT MODIFY */
package com.mobiapplicious.whatstheword;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"tahseen.rahman@bellmedia.ca"
] | tahseen.rahman@bellmedia.ca |
0757fff2bf7bc4b174ca3a71b6164d3e61ff5185 | 94a5e3077dbb52693aae9a7a515abc89ab05a6a3 | /src/image/view/ImageView.java | cf3bf2efc44c3eb33ff55fbb34d7d0b4c827364b | [] | no_license | nmhaddad/java-image-processing | c2f45c47535fa77977b5bfe11e16144ee1930257 | d8905f5f9be0233b11d3a0d34ee5b283281a4b7e | refs/heads/master | 2020-09-05T12:22:43.051524 | 2020-05-21T15:17:27 | 2020-05-21T15:17:27 | 220,102,860 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,939 | java | package image.view;
import java.util.function.Consumer;
/**
* This interface represents the methods that an ImageView can execute. ImageView is intended to be
* used in tandem with ImageModel and ImageController but can be implemented elsewhere as it is it's
* own module. This interface contains six methods: setImage, makeVisible, setCommandCallback,
* getCommand,
* showErrorMessage, and refresh. These methods setup the view, allow the view to process a command,
* get a user typed command, show an error message, and redraw the view.
*/
public interface ImageView {
/**
* This method makes objects visible in the view. It uses a built in JFrame method called
* setVisible to make things like panels visible on screen.
*/
void makeVisible();
/**
* This method provides the view with a callback option to process a command.
*
* @param callback object
*/
void setCommandCallback(Consumer<String> callback);
/**
* This method gets the command from the input variable for this JFrame.
*
* @return the string command to be executed.
*/
String getCommand();
/**
* This method creates a pop-out error message for handling exceptions thrown through the view.
* Each message is pulled from the controller/model.
*
* @param error the error that is thrown.
*/
void showErrorMessage(String error);
/**
* This method is used by the controller to set the image displayed in the view to the current
* image that is stored within the controllers model. It uses a method within ImageUtil called
* getBufferedImage() that passes this view an image that can be displayed.
*
* @param image an integer array of pixels.
*/
void setImage(int[][][] image);
/**
* This method is used to refresh the view, so that images and other objects can be reset and
* updated without having to save and load images multiple times.
*/
void refresh();
}
| [
"nhaddad2112@gmail.com"
] | nhaddad2112@gmail.com |
db609ef157f4f9f2a3113feb65b6f3a78a6eae05 | c2dedde590d0af1a20f1d9e85cdf90e1070cd218 | /Design_Patterns/Strategy_Pattern/QuackBehavior.java | 56542cf1bd893803ac731e67d325367c30c2533a | [] | no_license | Peace-Song/Playground | 5e85d4dff1c48895bbcd0921d77cfbf1d684e5b6 | b3b463e129bb4f8a0b5febdd3a9376edb387bf50 | refs/heads/master | 2023-01-24T13:28:32.468369 | 2021-09-26T10:19:45 | 2021-09-26T10:19:45 | 195,020,451 | 1 | 0 | null | 2023-01-07T10:25:59 | 2019-07-03T09:18:31 | Java | UTF-8 | Java | false | false | 365 | java | public interface QuackBehavior{
public void quack();
}
class Quack implements QuackBehavior{
public void quack(){
System.out.println("Quack!");
}
}
class MuteQuack implements QuackBehavior{
public void quack(){
System.out.println("...");
}
}
class Squeak implements QuackBehavior{
public void quack(){
System.out.println("Squeak!");
}
} | [
"ddaengjun@gmail.com"
] | ddaengjun@gmail.com |
e643fe87b6a1cafdf92822d33843e23b163b25ab | 05898f49058aa863a3bb2163a45f57f429e8ed9e | /src/main/java/com/baizhi/service/UserService.java | f10e9592aa41e92da56bc1272beba261db03b94c | [] | no_license | wazk2008/springboot11 | 09025d9cc358a522509ef09d3650ba5a02d80cae | a7c34b19a26efb9b869e5c66ef9db82826425848 | refs/heads/master | 2020-05-07T09:47:26.775471 | 2019-04-09T15:28:52 | 2019-04-09T15:28:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 150 | java | package com.baizhi.service;
import com.baizhi.entity.User;
import java.util.List;
public interface UserService {
List<User> selectAllUser();
}
| [
"test@qq.com"
] | test@qq.com |
13a89d57ec60126499f5360849eb65e3472d559d | e466d0398ba7f6f533b2b750e49597d954cb8196 | /SpringProjects/src/main/java/com/TDVictory/bean/Car.java | dc9dd89adc2a5e03ad07d9f990dd16e35f2282b6 | [] | no_license | TDVictory/Spring_SelfStudy | 3dabd0bac113167b45bccfa53fadac37e40a56a3 | f8b41576a76c54cba9d40fadd060266d2b4bb9fe | refs/heads/master | 2022-07-29T00:03:40.744622 | 2019-09-02T09:50:19 | 2019-09-02T09:50:19 | 188,754,810 | 0 | 0 | null | 2020-10-13T15:35:27 | 2019-05-27T02:03:37 | Java | UTF-8 | Java | false | false | 267 | java | package com.TDVictory.bean;
public class Car {
public Car() {
System.out.println("Car Constuct");
}
public void init(){
System.out.println("Car Init");
}
public void destroy(){
System.out.println("Car Destroy");
}
}
| [
"598779014@qq.com"
] | 598779014@qq.com |
4fb9d8c16a70105445e8f0146e9933611c2ff925 | 30fc69988568e95b39228d60687a942bef6b3ffa | /StudentRecord/src/com/hustunique/Views/MyCircle.java | 3cdf15900984d41ae890d7401aafd90ab5fb14e5 | [] | no_license | chensq03123/chensq | 58ab0eeb22babcca6203b10b63353c2921a22c9e | 9fa4735c3e3a7df03ab64f243b305a63d9a20800 | refs/heads/master | 2020-05-19T20:05:11.686561 | 2014-09-02T09:25:30 | 2014-09-02T09:25:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,108 | java | package com.hustunique.Views;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Paint.Cap;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
public class MyCircle extends View{
private static int DIAMETER = 180; //Diameter英文为直径,该常量表示小圆直径的dp值
private static int STROKE_WIDTH = 15; // 该常量表示圆环宽度2倍的dp值
private Paint mPaint;
private float mProgress=300;// 表示进度
private RectF mRect;
private int mDiameter=10; // Diameter英文为直径,在该View中要绘制圆环,圆环由两个圆形确定(大圆和小圆),这个整形值表示小圆直径。
private int mWidth=200;// 这个值表示圆环的宽度的2倍(大圆直径-小圆直径)
private final int defaultColor=Color.rgb(216,143,5);
private int mbgcolor=Color.rgb(237,194,115);//进度条背景颜色
private int processColor=Color.RED; //进度条进度颜色
public MyCircle(Context context){
super(context);
}
public MyCircle(Context context, AttributeSet attrs) {
super(context, attrs);
processColor =Color.WHITE;
init();
}
private void init() {
Resources res = getResources();
//getDisplayMetrics()返回当前展示的metrics.
DisplayMetrics metrics = res.getDisplayMetrics();
//TypedValue.applyDimension(int unit, float value, DisplayMetrics metrics)
//该方法中unit表示要转换成的单位,value表示数值,metrics表示当前的度量方式
//DIAMETER是常量0x1E,十进制为30,下面语句就表示tmp的值为30dp换算成的像素数值
float tmp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
DIAMETER, metrics);
//ceil函数表示向上取整
mDiameter = (int) Math.ceil(tmp);
tmp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
STROKE_WIDTH, metrics);
mWidth = (int) Math.ceil(tmp);
Paint p = new Paint();
//Paint.Style.STROKE表示空心,Paint.Style.FILL表示实心,Paint.Style.FILL_AND_STROKE表示空心与实心
p.setStyle(Paint.Style.STROKE);
p.setAntiAlias(true);
//setStrokeWidth()设置画笔宽度
// p.setStrokeWidth(0.5F*mWidth+0.5F*mDiameter);
p.setStrokeWidth(0.5F*mWidth);
p.setStrokeCap(Cap.ROUND);
p.setColor(defaultColor);
mPaint = p;
float rightTop = (float) (mWidth / 2.0);//这个值就是圆环宽度(大圆半径-小圆半径)
mRect = new RectF(rightTop, rightTop, mDiameter+rightTop, mDiameter+rightTop);
mProgress = 0;
}
@Override
protected void onDraw(Canvas canvas) {
// super.onDraw(canvas);
Paint paint = mPaint;
/* if (mProgress < 360) {
paint.setStrokeWidth(0.5f*(mWidth));
paint.setAlpha(0x7f);
paint.setColor(Color.WHITE);
canvas.drawArc(mRect, 128, 284, false, paint);
}*/
paint.setStrokeWidth(0.5F*mWidth);
//如果mProgress<360,则圆形进度条还未旋转完成,则用0x7f的透明度绘制一个完整的圆形作为进度条背景
//注意要先绘制背景条,再绘制进度条,因为后绘制的会覆盖在先绘制的上面
if (mProgress < 360) {
paint.setAlpha(127);
paint.setColor(mbgcolor);
canvas.drawArc(mRect, 140,260, false, paint);
}
{
float degree = (float) (260.0f * mProgress);
paint.setAlpha(0xff);
paint.setColor(processColor);
//drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint paint)
//该方法参数:
//oval表示绘制椭圆的矩形边界;
//startAngle表示起始角度;
//useCenter
//paint表示要使用的画笔;
canvas.drawArc(mRect, 140, degree, false, paint);
}
}
@Override
protected final void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//mDiameter表示小圆直径,mWidth表示圆环宽度的2倍,所以meas表示大圆直径
//所以View的hight,width都为meas
final int meas = mDiameter + mWidth;
setMeasuredDimension(meas, meas);
}
public void setProgress(int p) {
mProgress = p;
invalidate();
}
public void setParas(float progress,boolean isoveruse){
if(isoveruse){
this.mProgress=1;
}else
mProgress=progress;
this.postInvalidate();
}
public void postProgress(final int p) {
post(new Runnable(){
@Override
public void run() {
setProgress(180);
}
});
}
} | [
"intern.shuiqiangchen@hustunique.com"
] | intern.shuiqiangchen@hustunique.com |
910982e0d642b3d25b39f5830268d9217b5fa81a | ae8b8c1d72da34fb19b2a22b437931afdae3abc9 | /TopQuiz/app/src/test/java/com/collet/alexandre/topquiz/ExampleUnitTest.java | 99edb7fb9d4ffc18d95a820cc9c1d8e9186b78dc | [] | no_license | Noraj117/TopQuiz | fa26a29a4d34dcf3639712b9ab8feafddbbacc54 | 6186bd2c36a55b41dd8444e4ac41b36d8d79aea8 | refs/heads/master | 2020-04-22T11:39:36.135293 | 2019-02-12T16:21:18 | 2019-02-12T16:21:18 | 170,325,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.collet.alexandre.topquiz;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"alexandre.collet.fra@gmail.com"
] | alexandre.collet.fra@gmail.com |
a74e77bc7826d3d2ebfba2224da48b1f43d7812c | b5b4cf99ff324e371efd3a811137c87abf78e21f | /src/main/java/com/wanfin/fpd/modules/wind/adapter/vo/DbVo.java | 8a407b3bfb24db4f7a77f6aa0b396d776e521105 | [
"Apache-2.0"
] | permissive | shimaomao/fpd | 2692f950a36ad7137d14e902d4bc7dff7de53aa2 | aedd8f053de1ff9288dbafca9b4b26fe9cc2bc50 | refs/heads/master | 2021-06-30T02:00:27.652743 | 2017-09-13T03:49:41 | 2017-09-13T03:49:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,732 | java | package com.wanfin.fpd.modules.wind.adapter.vo;
import java.util.List;
import com.wanfin.fpd.modules.wind.adapter.IAdapterDb;
import com.wanfin.fpd.modules.wind.adapter.IeAdapterDB;
public class DbVo {
private String key;
private String name;
private Boolean status;
private List<DbGroupVo> groups;
public DbVo() {
super();
}
public DbVo(IAdapterDb db) {
super();
this.key = db.getDb().getKey();
this.name = db.getDb().getName();
}
public DbVo(IAdapterDb db, List<DbGroupVo> groups) {
super();
this.key = db.getDb().getKey();
this.name = db.getDb().getName();
this.groups = groups;
}
public DbVo(IeAdapterDB db) {
super();
this.key = db.getKey();
this.name = db.getName();
}
public DbVo(IeAdapterDB db, List<DbGroupVo> groups) {
super();
this.key = db.getKey();
this.name = db.getName();
this.groups = groups;
}
public DbVo(String key, String name) {
super();
this.key = key;
this.name = name;
}
public DbVo(String key, String name, List<DbGroupVo> groups) {
super();
this.key = key;
this.name = name;
this.groups = groups;
}
public DbVo(String key, String name, Boolean status, List<DbGroupVo> groups) {
super();
this.key = key;
this.name = name;
this.status = status;
this.groups = groups;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<DbGroupVo> getGroups() {
return groups;
}
public void setGroups(List<DbGroupVo> groups) {
this.groups = groups;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
}
| [
"lengzhijun@wanfin.com"
] | lengzhijun@wanfin.com |
57ef18b9f25810c8efea99b095ed481c1cf30581 | 01852da496c20a1f1ee26ff11e140905e6ae9b7a | /src/main/java/com/turan/springdemo/controller/CustomerController.java | 5d4253a3814d9fd2da5a58ed15f34dbe44f0893e | [] | no_license | lgorkemt/spring-web-customer-tracker | 005ca88c0b8c3b802c3b529177192367160c6798 | 8637c015aa3f838a4ee2a5845dee533078e5ff95 | refs/heads/master | 2020-04-17T20:19:07.370029 | 2019-03-08T10:25:56 | 2019-03-08T10:25:56 | 166,900,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,221 | java | package com.turan.springdemo.controller;
import java.util.List;
import com.turan.springdemo.entity.Customer;
import com.turan.springdemo.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping("/customer")
public class CustomerController {
// need to inject our customer service
@Autowired
private CustomerService customerService;
@GetMapping("/list")
public String listCustomers(Model theModel) {
// get customers from the service
List<Customer> theCustomers = customerService.getCustomers();
// add the customers to the model
theModel.addAttribute("customers", theCustomers);
return "list-customers";
}
@GetMapping("/showFormForAdd")
public String showFormForAdd(Model theModel) {
// create model attribute to bind form data
Customer theCustomer = new Customer();
theModel.addAttribute("customer", theCustomer);
return "customer-form";
}
@PostMapping("/saveCustomer")
public String saveCustomer(@ModelAttribute("customer") Customer theCustomer) {
// save the customer using our service
customerService.saveCustomer(theCustomer);
return "redirect:/customer/list";
}
@GetMapping("/showFormForUpdate")
public String showFormForUpdate(@RequestParam("customerId") int theId,
Model theModel) {
// get the customer from our service
Customer theCustomer = customerService.getCustomer(theId);
// set customer as a model attribute to pre-populate the form
theModel.addAttribute("customer", theCustomer);
// send over to our form
return "customer-form";
}
@GetMapping("/delete")
public String deleteCustomer(@RequestParam("customerId") int theId) {
// delete the customer
customerService.deleteCustomer(theId);
return "redirect:/customer/list";
}
}
| [
"gorkemt@hotmail.com"
] | gorkemt@hotmail.com |
be25017eeb4e457a8d64e9bb7d87be1b90376df1 | 2787dcef6cf240e109df91d2fa21e00c4b2a9faf | /app/src/main/java/com/example/csa/courseselectionapplication/helper/SessionManager.java | 00d790449048c50ee63744f465b37d2ae55916f2 | [] | no_license | pakcok/CourseSelectionApplication | 7af8d3bd4b3aba9a3296c57c982171d3597a15ff | e4253b0b07010a0acc0a967b22210faa0defc613 | refs/heads/master | 2021-01-01T19:32:01.631914 | 2017-08-03T16:31:13 | 2017-08-03T16:31:13 | 98,604,496 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,140 | java | package com.example.csa.courseselectionapplication.helper;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.util.Log;
public class SessionManager {
// LogCat tag
private static String TAG = SessionManager.class.getSimpleName();
// Shared Preferences
SharedPreferences pref;
Editor editor;
Context _context;
// Shared pref mode
int PRIVATE_MODE = 0;
// Shared preferences file name
private static final String PREF_NAME = "AndroidLogin";
private static final String KEY_IS_LOGGED_IN = "isLoggedIn";
public SessionManager(Context context) {
this._context = context;
pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
editor = pref.edit();
}
public void setLogin(boolean isLoggedIn) {
editor.putBoolean(KEY_IS_LOGGED_IN, isLoggedIn);
// commit changes
editor.commit();
Log.d(TAG, "User login session modified!");
}
public boolean isLoggedIn(){
return pref.getBoolean(KEY_IS_LOGGED_IN, false);
}
}
| [
"pakco.k@gmail.com"
] | pakco.k@gmail.com |
a3d137a56841e05224d2bcfcda08873b3ee46681 | 51fa3cc281eee60058563920c3c9059e8a142e66 | /Java/src/testcases/CWE191_Integer_Underflow/s05/CWE191_Integer_Underflow__int_connect_tcp_predec_81_bad.java | bdcdddc704510c2b37b6efc0d73af9f5895a66e4 | [] | no_license | CU-0xff/CWE-Juliet-TestSuite-Java | 0b4846d6b283d91214fed2ab96dd78e0b68c945c | f616822e8cb65e4e5a321529aa28b79451702d30 | refs/heads/master | 2020-09-14T10:41:33.545462 | 2019-11-21T07:34:54 | 2019-11-21T07:34:54 | 223,105,798 | 1 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,121 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE191_Integer_Underflow__int_connect_tcp_predec_81_bad.java
Label Definition File: CWE191_Integer_Underflow__int.label.xml
Template File: sources-sinks-81_bad.tmpl.java
*/
/*
* @description
* CWE: 191 Integer Underflow
* BadSource: connect_tcp Read data using an outbound tcp connection
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: decrement
* GoodSink: Ensure there will not be an underflow before decrementing data
* BadSink : Decrement data, which can cause an Underflow
* Flow Variant: 81 Data flow: data passed in a parameter to an abstract method
*
* */
package testcases.CWE191_Integer_Underflow.s05;
import testcasesupport.*;
import javax.servlet.http.*;
public class CWE191_Integer_Underflow__int_connect_tcp_predec_81_bad extends CWE191_Integer_Underflow__int_connect_tcp_predec_81_base
{
public void action(int data ) throws Throwable
{
/* POTENTIAL FLAW: if data == Integer.MIN_VALUE, this will overflow */
int result = (int)(--data);
IO.writeLine("result: " + result);
}
}
| [
"frank@fischer.com.mt"
] | frank@fischer.com.mt |
46bbb48155d8f1c52b34f8a09dd49bfba7ae12cc | b2c839764f0148622a92d16b444f48608ff87d92 | /assignments/logger/src/main/java/com/reachgoal/assignments/logger/Message.java | eb7ef0c5c78959cec249f8b006d3d66bb3dfdfc7 | [] | no_license | anantiit/reachgoal | 718507c2b68a3c8cf29a82c7bb9391306cd7e410 | c7f70aade379c9b557fb195a6138c7861e9e8b56 | refs/heads/master | 2023-07-09T08:24:09.749455 | 2023-07-04T17:29:42 | 2023-07-04T17:29:42 | 75,408,803 | 0 | 0 | null | 2023-06-22T13:18:27 | 2016-12-02T15:45:06 | Java | UTF-8 | Java | false | false | 228 | java | package com.reachgoal.assignments.logger;
public class Message {
String message;
LogLevel logLevel;
public Message(String message, LogLevel logLevel) {
super();
this.message = message;
this.logLevel = logLevel;
}
}
| [
"anant123.iit@gmail.com"
] | anant123.iit@gmail.com |
8a54e9024a3c063460882bee61295835234f0c41 | 8a883dab213c8c6aa92dcba5b64012afbc87148b | /HW10b-0036453293/src/test/java/hr/fer/zemris/java/gui/calc/Calculator/strategy/imp/MultiplyStrategyTest.java | d86fb65a2293184323242cd9010e4a3691b84df4 | [] | no_license | mborovac/javaProject | a34e23fefade7d596b2822ede04e593a85b73b1f | 178effbcc27ab9aa2e6ce4b1fbdcfa95a58e9a56 | refs/heads/master | 2021-01-10T07:32:39.270239 | 2015-12-10T18:07:01 | 2015-12-10T18:07:01 | 47,714,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | package hr.fer.zemris.java.gui.calc.Calculator.strategy.imp;
import static org.junit.Assert.*;
import org.junit.Test;
public class MultiplyStrategyTest {
@Test
public void MulTest1() {
MultiplyStrategy mul = new MultiplyStrategy();
assertEquals("expected = 6", 6, mul.calculateResult(2, 3, true), 1.e-5);
}
@Test
public void MulTest2() {
MultiplyStrategy mul = new MultiplyStrategy();
assertEquals("expected = 6", 6, mul.calculateResult(2, 3, true), 1.e-5);
}
}
| [
"marko.borovac@fer.hr"
] | marko.borovac@fer.hr |
d4022771362a553a5f8061278e071327800c062d | d5209436e4cde6cb91bc7680ea6e008c9138e19e | /ExampleInstrumentedTest.java | f89c00ca82b48a9b6d23e070d411c3e26f2bdffa | [] | no_license | otogeny/lab4 | cceddc6f3bb3be77e578ad75d7449f9504fecc12 | ea14ad2ad6c9b558b8776f79c808db056ebb0254 | refs/heads/master | 2021-09-01T19:26:31.829374 | 2017-12-28T12:28:41 | 2017-12-28T12:28:41 | 115,621,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | package com.kpp.vntu.lab4;
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.kpp.vntu.lab4", appContext.getPackageName());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
2fd1efcc5f5154c168ab6c9f01e197d44e4ee1ff | ce3dffa7bb4e431c711448e2bde1bf7de6e7f3ac | /app/src/main/java/com/codeme/NaijaShoppers/HomeFragment.java | 469c5cf816cbeac7014340c3cf4badcd228fe877 | [] | no_license | codemelinux/NaijaShoppers | 384c4b21a2c16e71a3d9666fbf73f4441724b99c | 01b57eddb399fce40eb74a5eb18199286875e724 | refs/heads/master | 2020-06-10T02:51:41.227824 | 2019-09-07T06:58:23 | 2019-09-07T06:58:23 | 193,560,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,971 | java | package com.codeme.NaijaShoppers;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Parcelable;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.Toast;
import java.io.File;
import java.io.IOException;
import static android.app.Activity.RESULT_OK;
import static android.support.constraint.Constraints.TAG;
public class HomeFragment extends Fragment {
public WebView webV;
private ProgressBar progressBar;
// variables for camera and choosing files methods
private static final int FILECHOOSER_RESULTCODE = 1;
private ValueCallback<Uri> mUploadMessage;
private Uri mCapturedImageURI = null;
// the same for Android 5.0 methods only
private ValueCallback<Uri[]> mFilePathCallback;
private String mCameraPhotoPath;
// error handling
// error handling
//private static final String TAG = HomeFragment.class.getSimpleName();
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//calls the activity home fragment
View mView = inflater.inflate(R.layout.home, container, false);
// Create WebView
webV = new WebView(getActivity());
// Reload the old WebView content
if (savedInstanceState != null) {
webV.restoreState(savedInstanceState);
}
// Create the WebView
else {
// *******webview *******
webV = (WebView) mView.findViewById(R.id.webview);
progressBar = (ProgressBar) mView.findViewById(R.id.progressBar);
webV.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
WebSettings webSettings = webV.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setGeolocationEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setDatabaseEnabled(true);
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
webSettings.setAllowFileAccess(true);
webSettings.setAppCacheEnabled(true);
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
webSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);
webV.setWebViewClient(new WebViewClient());
webV.loadUrl("https://www.naijashoppers.net/");
webV.restoreState(savedInstanceState);
webV.setWebViewClient(new MyAppWebViewClient());
webV.setWebChromeClient(new WebChromeClient() {
// page loading progress, gone when fully loaded
public void onProgressChanged(WebView view, int progress) {
if (progress < 100 && progressBar.getVisibility() == ProgressBar.GONE) {
progressBar.setVisibility(ProgressBar.VISIBLE);
}
progressBar.setProgress(progress);
if (progress == 100) {
progressBar.setVisibility(ProgressBar.GONE);
}
}
// for Lollipop, all in one
public boolean onShowFileChooser(
WebView webView, ValueCallback<Uri[]> filePathCallback,
WebChromeClient.FileChooserParams fileChooserParams) {
if (mFilePathCallback != null) {
mFilePathCallback.onReceiveValue(null);
}
mFilePathCallback = filePathCallback;
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
// create the file where the photo should go
File photoFile = null;
try {
photoFile = createImageFile();
takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
} catch (IOException ex) {
// Error occurred while creating the File
Log.e(String.valueOf(TAG), "Unable to create Image File", ex);
}
// continue only if the file was successfully created
if (photoFile != null) {
mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photoFile));
} else {
takePictureIntent = null;
}
}
Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
contentSelectionIntent.setType("image/*");
Intent[] intentArray;
if (takePictureIntent != null) {
intentArray = new Intent[]{takePictureIntent};
} else {
intentArray = new Intent[0];
}
Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
chooserIntent.putExtra(Intent.EXTRA_TITLE, getString(R.string.image_chooser));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
startActivityForResult(chooserIntent, FILECHOOSER_RESULTCODE);
return true;
}
// creating image files (Lollipop only)
private File createImageFile() throws IOException {
File imageStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "DirectoryNameHere");
if (!imageStorageDir.exists()) {
imageStorageDir.mkdirs();
}
// create an image file name
imageStorageDir = new File(imageStorageDir + File.separator + "IMG_" + String.valueOf(System.currentTimeMillis()) + ".jpg");
return imageStorageDir;
}
// openFileChooser for Android 3.0+
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;
try {
File imageStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "DirectoryNameHere");
if (!imageStorageDir.exists()) {
imageStorageDir.mkdirs();
}
File file = new File(imageStorageDir + File.separator + "IMG_" + String.valueOf(System.currentTimeMillis()) + ".jpg");
mCapturedImageURI = Uri.fromFile(file); // save to the private variable
final Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
// captureIntent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
Intent chooserIntent = Intent.createChooser(i, getString(R.string.image_chooser));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Parcelable[]{captureIntent});
startActivityForResult(chooserIntent, FILECHOOSER_RESULTCODE);
} catch (Exception e) {
Toast.makeText(getContext(), "Camera Exception:" + e, Toast.LENGTH_LONG).show();
}
}
// openFileChooser for Android < 3.0
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
openFileChooser(uploadMsg, "");
}
// openFileChooser for other Android versions
/* may not work on KitKat due to lack of implementation of openFileChooser() or onShowFileChooser()
https://code.google.com/p/android/issues/detail?id=62220
however newer versions of KitKat fixed it on some devices */
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
openFileChooser(uploadMsg, acceptType);
}
});
webV.canGoBack();
webV.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK
&& event.getAction() == MotionEvent.ACTION_UP
&& webV.canGoBack()) {
webV.goBack();
return true;
}
return false;
}
});
}
return mView;
}
// Save the state of the web view when the screen is rotated.
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
webV.saveState(outState);
}
// return here when file selected from camera or from SD Card
@Override
public void onActivityResult (int requestCode, int resultCode, Intent data) {
// code for all versions except of Lollipop
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
if(requestCode==FILECHOOSER_RESULTCODE) {
if (null == this.mUploadMessage) {
return;
}
Uri result=null;
try{
if (resultCode != RESULT_OK) {
result = null;
} else {
// retrieve from the private variable if the intent is null
result = data == null ? mCapturedImageURI : data.getData();
}
}
catch(Exception e) {
Toast.makeText(getContext(), "activity :"+e, Toast.LENGTH_LONG).show();
}
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
}
} // end of code for all versions except of Lollipop
// start of code for Lollipop only
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (requestCode != FILECHOOSER_RESULTCODE || mFilePathCallback == null) {
super.onActivityResult(requestCode, resultCode, data);
return;
}
Uri[] results = null;
// check that the response is a good one
if (resultCode == RESULT_OK) {
if (data == null || data.getData() == null) {
// if there is not data, then we may have taken a photo
if (mCameraPhotoPath != null) {
results = new Uri[]{Uri.parse(mCameraPhotoPath)};
}
} else {
String dataString = data.getDataString();
if (dataString != null) {
results = new Uri[]{Uri.parse(dataString)};
}
}
}
mFilePathCallback.onReceiveValue(results);
mFilePathCallback = null;
} // end of code for Lollipop only
}
private class MyAppWebViewClient extends WebViewClient {
}
}
| [
"codemelinux@gmail.com"
] | codemelinux@gmail.com |
3f0fddf045a31bb34300ac6417ad1725e2836f20 | c63a04fbe545fd232e1f45dd85c187caa70994c0 | /statistics/src/test/java/hu/rb/cloud/statistics/service/TrackStatsServiceTest.java | 345191500134a3f5a9d732aaf9ab23e5ac739070 | [] | no_license | cabrelkemfang/trkcloud | d9e7bb08be12695fde3b9c5bed23e060482e37a1 | 1801d35ecc9bc970be3741d846e84ac81be97c4c | refs/heads/master | 2022-01-05T09:08:46.223779 | 2019-02-24T18:36:58 | 2019-02-24T18:37:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,684 | java | package hu.rb.cloud.statistics.service;
import hu.rb.cloud.statistics.message.TrackStatsMessageSource;
import hu.rb.cloud.statistics.model.TrackStats;
import hu.rb.cloud.statistics.model.dto.Track;
import hu.rb.cloud.statistics.repository.TrackStatsRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.messaging.MessageChannel;
import java.text.DecimalFormat;
import java.text.ParseException;
import static hu.rb.cloud.statistics.helper.ModelGenerator.generateTrack;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.AdditionalAnswers.returnsFirstArg;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class)
public class TrackStatsServiceTest {
@InjectMocks
@Spy
private TrackStatsServiceImpl trackStatsService;
@Mock
private TrackStatsRepository trackStatsRepository;
@Mock
private TrackStatsMessageSource trackStatsMessageSource;
@Test(expected = IllegalArgumentException.class)
public void shouldFailCalcStatsWithNoTrack(){
trackStatsService.calcStats(null);
}
@Test(expected = IllegalArgumentException.class)
public void shouldFailCalcStatsWithNoTrackId(){
Track track = generateTrack();
track.setTrackId(null);
trackStatsService.calcStats(track);
}
@Test
public void shouldCreateNewTrackStats(){
ArgumentCaptor<TrackStats> captor = ArgumentCaptor.forClass(TrackStats.class);
when(trackStatsRepository.findByTrackId(any())).thenReturn(null);
when(trackStatsRepository.save(any())).then(returnsFirstArg());
when(trackStatsMessageSource.trackStatsChannel()).thenReturn(mock(MessageChannel.class));
doReturn(1D).when(trackStatsService).calcDistance(any());
doReturn(1D).when(trackStatsService).calcSpeed(any());
doReturn(1L).when(trackStatsService).calcDuration(any());
when(trackStatsRepository.save(any())).then(returnsFirstArg());
Track track = generateTrack();
trackStatsService.calcStats(track);
verify(trackStatsRepository).save(captor.capture());
assertEquals(captor.getValue().getTrackId(), track.getTrackId());
assertEquals(1d, captor.getValue().getDistance(), 0.0);
}
@Test
public void shouldNotCreateNewTrackStats(){
TrackStats refTrackStats = new TrackStats();
refTrackStats.setTrackId("trackId");
when(trackStatsRepository.findByTrackId(any())).thenReturn(refTrackStats);
when(trackStatsRepository.save(any())).then(returnsFirstArg());
when(trackStatsMessageSource.trackStatsChannel()).thenReturn(mock(MessageChannel.class));
doReturn(1D).when(trackStatsService).calcDistance(any());
doReturn(1D).when(trackStatsService).calcSpeed(any());
doReturn(1L).when(trackStatsService).calcDuration(any());
Track track = generateTrack();
trackStatsService.calcStats(track);
assertEquals(refTrackStats.getTrackId(), "trackId");
assertEquals(1d, refTrackStats.getDistance(), 0.0);
}
@Test
public void shouldCalcDistance() throws ParseException {
Track track = generateTrack();
Double distance = trackStatsService.calcDistance(track);
assertNotNull(distance);
assertTrue(distance>0);
}
}
| [
"balintrudas@gmail.com"
] | balintrudas@gmail.com |
2b80350f8acc67c413bef267e0a80a62e5b594dd | 3b72d12871b48a8bae6d65789a5edf8667b8706b | /zqq/dgg_zqq/src/main/java/net/dgg/zqq/services/BaseService.java | 9f8723fbc4eccbec957cf41007d6ce6368425b2a | [] | no_license | xeon-ye/dgg-pro | 53d344ab34c5ddf423485cc8ee5f7de6368d9571 | cc25cb60f1c1c89b4591bbdaec8db1eeba818377 | refs/heads/master | 2023-05-04T20:08:42.972557 | 2019-09-17T08:45:53 | 2019-09-17T08:45:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package net.dgg.zqq.services;
import java.util.List;
import java.util.Map;
/**
* Created by wu on 2017/7/31.
*/
public interface BaseService<T> {
/**
* 查询全部数据
*
* @return
*/
List<T> findAll(Map condition);
/**
* 根据ID查询单条记录
*
* @param id
* @return
*/
T findOne(String id);
/**
* 插入数据
*
* @param t
* @return
*/
int insert(T t);
/**
* 更新数据
*
* @param t
* @return
*/
int update(T t);
/**
* 根据ID删除数据
*
* @param id
* @return
*/
int delete(String id);
/**
* 查询第后面1001条
* @param map
* @return
*/
T findEndThousand(Map map);
/**
* 统计条数
* @param map
* @return
*/
int findCount(Map map);
/**
* 分页查询
* @param map
* @return
*/
List<T> searchPage(Map map);
}
| [
"chenxin4@dgg.net"
] | chenxin4@dgg.net |
7e8df2820cd1e8baede944aa67584f26ab7eb894 | 92ad9f8ab8126f73ceb6f6fddef8d237af01813a | /src/designpatterns/creational/builder/LunchOrderBean.java | dee627d5dc288ba88cc05e7878f1eff26a1803cd | [] | no_license | xChivalrouSx/DesignPatternsInJava | e603e4872e96e344e0198ebd188be2acbe733e0a | a096f273288e65597c7eee0e32730bf5a26c060c | refs/heads/master | 2021-01-15T01:54:54.465164 | 2020-03-11T20:59:27 | 2020-03-11T20:59:27 | 242,839,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 698 | java | package designpatterns.creational.builder;
public class LunchOrderBean {
private String bread;
private String condiments;
private String dressing;
private String meat;
public LunchOrderBean() {}
public String getBread() {
return bread;
}
public void setBread(String bread) {
this.bread = bread;
}
public String getCondiments() {
return condiments;
}
public void setCondiments(String condiments) {
this.condiments = condiments;
}
public String getDressing() {
return dressing;
}
public void setDressing(String dressing) {
this.dressing = dressing;
}
public String getMeat() {
return meat;
}
public void setMeat(String meat) {
this.meat = meat;
}
}
| [
"mertcakar.es@gmail.com"
] | mertcakar.es@gmail.com |
24f97a73e7c6be20c90c1a4c3d5f315f02e6229e | 68501c82355c4b6f97a2f08e59569a61b4a603a2 | /User-Management/src/main/java/com/vishnu/repository/UserRepository.java | 23ee4faf8c5a69912e4189a4c0d4134c0a81d3b3 | [] | no_license | Vishnuvardhan-coder/SpringBootHandsON | fb9253e8b06371fd3ffebf878afcf2de145e1a40 | 4151cd2db92abccbbd55d29c3e3035ac5ac13b55 | refs/heads/main | 2023-04-13T12:06:52.957529 | 2021-04-13T02:58:20 | 2021-04-13T02:58:20 | 304,115,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package com.vishnu.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.vishnu.entity.User;
public interface UserRepository extends JpaRepository<User, Integer> {
User findByEmailIdAndPassword(String email, String pwd);
User findByEmailId(String emailId);
}
| [
"princevishnu777@gmail.com"
] | princevishnu777@gmail.com |
9105d17435b3e000bd642cdded8dcc2fb1d63028 | 50cb496bcc0aa3f20be28fe4146ac6733c344709 | /Mockito/Mockito/evosuite-branch/1/src/Mockito-19f/org/mockito/internal/configuration/injection/filter/TypeBasedCandidateFilter_ESTest_scaffolding.java | d16ae30b6bedf7f990a8086bbec5b723cc22f650 | [] | no_license | evosuite-problematic-tests/test-data | a99b63928e8b5b8794f4c02dcc814b6840541823 | ca17583607f76e7853d1bb17a20669ce6d616d0c | refs/heads/master | 2020-04-16T18:58:13.376495 | 2019-01-15T13:30:09 | 2019-01-15T13:30:09 | 165,842,026 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,691 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Dec 24 17:51:52 GMT 2018
*/
package org.mockito.internal.configuration.injection.filter;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class TypeBasedCandidateFilter_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.mockito.internal.configuration.injection.filter.TypeBasedCandidateFilter";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("file.encoding", "UTF-8");
java.lang.System.setProperty("java.awt.headless", "true");
java.lang.System.setProperty("java.io.tmpdir", "/tmp");
java.lang.System.setProperty("user.country", "US");
java.lang.System.setProperty("user.dir", "/tmp/run_evosuite.pl_80660_1545673428");
java.lang.System.setProperty("user.home", "/root");
java.lang.System.setProperty("user.language", "en");
java.lang.System.setProperty("user.name", "root");
java.lang.System.setProperty("user.timezone", "America/Los_Angeles");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(TypeBasedCandidateFilter_ESTest_scaffolding.class.getClassLoader() ,
"org.mockito.internal.configuration.injection.filter.FinalMockCandidateFilter$2",
"org.mockito.internal.configuration.injection.filter.TypeBasedCandidateFilter",
"org.mockito.internal.configuration.injection.filter.OngoingInjecter",
"org.mockito.internal.configuration.injection.filter.FinalMockCandidateFilter",
"org.mockito.internal.configuration.injection.filter.MockCandidateFilter"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(TypeBasedCandidateFilter_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.mockito.internal.configuration.injection.filter.TypeBasedCandidateFilter",
"org.mockito.internal.configuration.injection.filter.FinalMockCandidateFilter",
"org.mockito.internal.configuration.injection.filter.FinalMockCandidateFilter$2",
"org.mockito.internal.configuration.injection.filter.NameBasedCandidateFilter",
"org.mockito.internal.configuration.plugins.PluginRegistry",
"org.mockito.internal.configuration.plugins.PluginLoader",
"org.mockito.internal.configuration.plugins.DefaultPluginSwitch",
"org.mockito.internal.configuration.plugins.PluginFinder",
"org.mockito.internal.util.collections.Iterables",
"org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker",
"org.mockito.internal.creation.bytebuddy.CachingMockBytecodeGenerator",
"org.mockito.internal.creation.bytebuddy.MockBytecodeGenerator",
"net.bytebuddy.ByteBuddy",
"net.bytebuddy.ClassFileVersion",
"net.bytebuddy.utility.ByteBuddyCommons",
"net.bytebuddy.NamingStrategy$Unbound$Default",
"net.bytebuddy.implementation.auxiliary.AuxiliaryType$NamingStrategy$SuffixingRandom",
"net.bytebuddy.utility.RandomString",
"net.bytebuddy.matcher.FilterableList$Empty",
"net.bytebuddy.description.type.TypeList$Empty",
"net.bytebuddy.matcher.ElementMatchers",
"net.bytebuddy.matcher.ElementMatcher$Junction$AbstractBase",
"net.bytebuddy.matcher.NameMatcher",
"net.bytebuddy.matcher.StringMatcher",
"net.bytebuddy.matcher.StringMatcher$Mode",
"net.bytebuddy.matcher.MethodParameterMatcher",
"net.bytebuddy.matcher.CollectionSizeMatcher",
"net.bytebuddy.matcher.ElementMatcher$Junction$Conjunction",
"net.bytebuddy.description.ModifierReviewable$AbstractModifierReviewable",
"net.bytebuddy.description.type.TypeDescription$AbstractTypeDescription",
"net.bytebuddy.description.type.TypeDescription$ForLoadedType",
"net.bytebuddy.matcher.EqualityMatcher",
"net.bytebuddy.matcher.MethodReturnTypeMatcher",
"net.bytebuddy.matcher.DeclaringTypeMatcher",
"net.bytebuddy.matcher.ModifierMatcher",
"net.bytebuddy.matcher.ModifierMatcher$Mode",
"net.bytebuddy.matcher.MethodSortMatcher",
"net.bytebuddy.matcher.MethodSortMatcher$Sort",
"net.bytebuddy.matcher.NegatingMatcher",
"net.bytebuddy.matcher.ElementMatcher$Junction$Disjunction",
"net.bytebuddy.dynamic.scaffold.BridgeMethodResolver$Simple$ConflictHandler$Default",
"net.bytebuddy.dynamic.scaffold.BridgeMethodResolver$Simple$Factory",
"net.bytebuddy.asm.ClassVisitorWrapper$Chain",
"net.bytebuddy.dynamic.scaffold.MethodRegistry$Default",
"net.bytebuddy.ByteBuddy$Definable$Undefined",
"net.bytebuddy.implementation.attribute.TypeAttributeAppender$NoOp",
"net.bytebuddy.dynamic.scaffold.MethodLookupEngine$Default$Factory",
"net.bytebuddy.implementation.attribute.FieldAttributeAppender$NoOp",
"net.bytebuddy.implementation.attribute.MethodAttributeAppender$NoOp",
"net.bytebuddy.implementation.attribute.MethodAttributeAppender$ForInstrumentedMethod",
"net.bytebuddy.implementation.attribute.TypeAttributeAppender$ForSuperType",
"org.mockito.internal.exceptions.stacktrace.DefaultStackTraceCleanerProvider",
"org.mockito.internal.configuration.plugins.Plugins",
"org.mockito.internal.util.MockUtil",
"org.mockito.internal.configuration.injection.filter.FinalMockCandidateFilter$1",
"org.mockito.exceptions.base.MockitoException",
"org.mockito.exceptions.misusing.NotAMockException",
"org.mockito.internal.exceptions.stacktrace.ConditionalStackTraceFilter",
"org.mockito.internal.configuration.GlobalConfiguration",
"org.mockito.configuration.DefaultMockitoConfiguration",
"org.mockito.internal.configuration.ClassPathLoader",
"org.mockito.internal.exceptions.stacktrace.DefaultStackTraceCleaner",
"org.mockito.internal.exceptions.stacktrace.StackTraceFilter"
);
}
}
| [
"sustc1526fan@hotmail.com"
] | sustc1526fan@hotmail.com |
573d48cc8b529bd268f6e038407f7c13f764f057 | d868442671dde59c59c472b0070d33b3101aca0e | /printer/src/main/java/Printer.java | f941cce1e82203fd350c0c0509841144b6f46418 | [] | no_license | CMilligan26/wk11_dy1_java | d65d7a2e62de0154582c28d0f3b2d41f60b708c4 | 608e548e0837257bea859b1e958398ff672d39f3 | refs/heads/master | 2020-04-15T11:04:15.970177 | 2019-01-08T09:25:26 | 2019-01-08T09:25:26 | 164,612,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 523 | java | public class Printer {
public int paper = 500;
public int toner = 100;
public int getPaper() {
return this.paper;
}
public void print(int i, int i1) {
int sheets = i * i1;
if (sheets < this.paper) {
this.paper -= sheets;
this.toner -= sheets;
}
}
public void refillPaper() {
this.paper = 500;
}
public int getToner() {
return this.toner;
}
public void refillToner() {
this.toner = 100;
}
}
| [
"milliganjchristopher@gmail.com"
] | milliganjchristopher@gmail.com |
9c1a3fad14ab1d97067c0b2fff8f8b6d3dbbb038 | d2b06efdb175089ed24306818c1ff7f91eed010e | /framework/msf-framework-data-mongodb/src/test/java/cn/com/connext/msf/data/mongo/entity/Address.java | 50d42c304be303bd854e5bb3d0eb013af7a59eea | [] | no_license | lianwei-product/msf-core | 860026edb22542f2d1d93ae33eaf273e5a68348c | ed0365ee562b4dd261a40f55854fb095a1c54f01 | refs/heads/master | 2023-03-23T15:44:04.704652 | 2021-03-02T07:19:57 | 2021-03-02T07:19:57 | 348,597,990 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,364 | java | package cn.com.connext.msf.data.mongo.entity;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection = "sys_address")
public class Address {
@Id
private String id;
private String province;
private String city;
private String area;
private String address;
private String mobile;
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"han.cheng@connext.com.cn"
] | han.cheng@connext.com.cn |
92989aad5ec12a392dcb9011d352d83be7a5bd97 | 0d403c7232b66e560274d3996f352039fe01b788 | /src/main/java/com/example/workmanagetwo/controller/AdminController.java | caab140bb81182959d5c23c61052e7c1dec384ba | [] | no_license | NeptuneGxy/workmanagetwo | 04e2b4e8b7e2cb84e813629280d23a9351c27beb | 3e317c3ebf6905a8f471655b45cf2bbdf96581f3 | refs/heads/master | 2020-06-04T21:57:40.970017 | 2019-06-16T15:25:00 | 2019-06-16T15:25:00 | 192,206,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 699 | java | package com.example.workmanagetwo.controller;
import com.example.workmanagetwo.service.AdminService;
import com.example.workmanagetwo.service.TeacherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/api/admin")
public class AdminController {
@Autowired
AdminService adminService;
@Autowired
TeacherService teacherService;
@PostMapping("/addAdmin/{id}")
public Map addAdmin(@PathVariable int id){
adminService.addAdmin(id);
return Map.of("teachers", teacherService.getTeacher());
}
}
| [
"admin@163.com"
] | admin@163.com |
f22f05a38ba381126610beb07ebfc4836f22f96b | 69537ca029c7bbf388fe42ee0f64c2d1aa093970 | /android/src/org/asetniop/Hand.java | 84234eb56a911a113557d76dc9cabe8ca8621b7a | [] | no_license | dangirsh/asetniop | 3ab2e9b32a7c76833aa101ec250d441ed9aba94a | 69c8a3dc2ca4104d122ad83c6b82a55795118085 | refs/heads/master | 2021-01-18T08:28:27.703885 | 2012-12-13T14:55:03 | 2012-12-13T14:55:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 862 | java | package org.asetniop;
import android.util.SparseIntArray;
class Hand {
private SparseIntArray fingers = new SparseIntArray();
public void set(int fingerId, int value) { // set the buttons pressed by this finger
fingers.put(fingerId, value);
}
public void release(int fingerId, ButtonPanel buttons) {
// b is the buttons pushed by this finger
int b = fingers.get(fingerId, 0);
// if there are no buttons to release, do nothing
if( b == 0 ) return;
// for each button in the system
for( int i = SoftKeyboard.A_KEY; i <= SoftKeyboard.NUMSHIFT_KEY; i = i << 1 ) {
// if this finger pushed this button
if( (b & i) == i ) {
// and it isn't currently stuck down
if( ! ((buttons.stuck & i) == i) ) {
// release it
buttons.setPressed(i, false);
}
}
}
// clear the finger from the set
fingers.delete(fingerId);
}
} | [
"jesse.dailey@gmail.com"
] | jesse.dailey@gmail.com |
ad5c2ebb498a5d4a574eb6f7e203888902ccffb2 | db1f5692e55d5fa66c15fe35e130cbae05c4c482 | /src/main/java/com/yh/junit/maptest/MapTest01.java | 4c41fca1a5f67ffd532564d468fae24012ee38d3 | [] | no_license | feelmykiss/yanghaotest | c00e26e1411bc3157d1a858c931fcd7ae42354a6 | 27b11aff5afb872d62181e1f062bac9856991fe6 | refs/heads/master | 2021-11-19T02:49:06.688899 | 2021-09-09T01:14:53 | 2021-09-09T01:14:53 | 199,622,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package com.yh.junit.maptest;
import com.google.common.collect.ImmutableMap;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
/**
* MapTest01 class
*
* @author yh
* @date 2020/12/23
*/
public class MapTest01 {
/**
* ImmutableMap中key和value均不能为null,放入null值会抛出NPE
*/
@Test
public void test() {
Map<String, String> dataMap = new HashMap<>();
dataMap.put("source1", "value1");
dataMap.put("source2", null);
ImmutableMap.copyOf(dataMap);
}
/**
* Map puttAll 有重复的 key 效果:
*/
@Test
public void test1() {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("source1", "value1");
dataMap.put("source2", "1111");
dataMap.put("source3", "1111");
dataMap.put("source4", "1111");
dataMap.put("source5", "1111");
Map<String, Object> dataMap1 = new HashMap<>();
dataMap1.put("source1", "1");
dataMap1.put("source2", "2");
dataMap1.put("source3", "3");
dataMap.putAll(dataMap1);
dataMap.forEach((key,value)->{
System.out.println(key);
System.out.println(value);
});
}
}
| [
"yanghao@hithinksoft.com"
] | yanghao@hithinksoft.com |
05ef4a62113e268e41fb67a23c91493c66d92638 | 3a9bbe454ce592c0a0c1bd5117dce1beeb08ad2a | /src/p10005.java | 243fcd2e00df8257e5fad8c7a10858c9c2f7e5f9 | [] | no_license | sungodavi/UVA | d420e720bef1b8e100d40fe4794b46a8203a7f12 | 457557605856099eacf12b73789005d3bd1cd2a8 | refs/heads/master | 2021-09-07T16:56:08.214286 | 2018-02-26T11:09:28 | 2018-02-26T11:09:28 | 112,102,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,750 | java | import java.util.*;
import java.io.*;
public class p10005
{
public static final double EPS = 1e-9;
public static void main(String[] args) throws IOException
{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
StringTokenizer st;
for(int size = Integer.parseInt(f.readLine()); size > 0; size = Integer.parseInt(f.readLine()))
{
Point[] a = new Point[size];
for(int i = 0; i < size; i++)
{
st = new StringTokenizer(f.readLine());
double x = Double.parseDouble(st.nextToken());
double y = Double.parseDouble(st.nextToken());
a[i] = new Point(x, y);
}
double r = Double.parseDouble(f.readLine());
if(check(a, r))
out.println("The polygon can be packed in the circle.");
else
out.println("There is no way of packing that polygon.");
}
out.close();
}
public static boolean check(Point[] a, double r)
{
for(int i = 0; i < a.length - 1; i++)
for(int j = 0; j < a.length; j++)
{
if(i != j)
{
Point center = center(a[i], a[j], r);
if(center != null && inside(a, center, r))
return true;
}
}
return false;
}
public static boolean inside(Point[] a, Point p, double r)
{
for(Point temp : a)
if(!inside(temp, p, r))
return false;
return true;
}
public static boolean inside(Point a, Point p, double r)
{
//return dist(a, p) <= r * r;
return dist(a, p) - r * r < EPS;
}
public static Point center(Point a, Point b, double r)
{
if(dist(a, b) > 4 * r * r)
return null;
Point m = mid(a, b);
Vector v = new Vector(m, a);
v.rotate();
double u = Math.sqrt((r * r - dist(a, m)) / v.normSq());
v.scale(u);
return m.translate(v);
}
static double dist(Point a, Point b)
{
double dx = a.x - b.x;
double dy = a.y - b.y;
return dx * dx + dy * dy;
}
static Point mid(Point a, Point b)
{
return new Point((a.x + b.x) / 2, (a.y + b.y) / 2);
}
static class Vector
{
double x, y;
public Vector(double x, double y)
{
this.x = x;
this.y = y;
}
public Vector(Point a, Point b)
{
x = b.x - a.x;
y = b.y - a.y;
}
public double normSq()
{
return x * x + y * y;
}
public void rotate()
{
double temp = y;
y = x;
x = -temp;
}
public void scale(double u)
{
x *= u;
y *= u;
}
public String toString()
{
return String.format("%.3f %.3f", x, y);
}
}
static class Point
{
double x, y;
public Point(double x, double y)
{
this.x = x;
this.y = y;
}
public Point translate(Vector v)
{
return new Point(x + v.x, y + v.y);
}
public String toString()
{
return String.format("%.3f %.3f", x, y);
}
}
} | [
"sungodavi@gmail.com"
] | sungodavi@gmail.com |
f37c87b0ab41ea0c92f2e9b9b41c7b3691281cb8 | f48d680b976f700cc49290cd4f564f94583dd045 | /J2EE_exercice/struts-EmploiDuTemps/src/action/ajoutEnseignAction.java | cd4ccf789ea602086207fedd2b43f1775a2912a7 | [] | no_license | suoqingqiu2011/JAVA-and-J2EE | a03fb520ad0faf635a6c117aff8683a85ecc7495 | 754da7d581e19ec9e663ccad87cae0bd9b49ea80 | refs/heads/master | 2023-04-27T14:41:36.439357 | 2022-02-12T15:16:11 | 2022-02-12T15:16:11 | 243,785,106 | 0 | 0 | null | 2023-04-14T17:50:23 | 2020-02-28T14:47:59 | HTML | UTF-8 | Java | false | false | 1,695 | java | package action;
import java.util.ArrayList;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import entity.Enseignant;
import entity.Etudiant;
import form.EnseignActionForm;
import form.EtuActionForm;
public class ajoutEnseignAction extends Action{
//HashMap<String,Produit> newmap=new HashMap<String,Produit>();
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
EnseignActionForm donneesEn=(EnseignActionForm) form;
System.out.println("suis ds la "+ donneesEn.getNomEnseign()+" "+donneesEn.getCodeEnseign());
HttpSession session=request.getSession();
Enseignant en=new Enseignant(donneesEn.getNomEnseign(),donneesEn.getCodeEnseign());
ArrayList<Enseignant> tachesEn=(ArrayList<Enseignant>)session.getAttribute("destachesEnseign");
if(tachesEn==null){
tachesEn=new ArrayList<Enseignant>();
}
try{
tachesEn.add(en);
}catch(Exception e){
e.printStackTrace();
}
session.setAttribute("tachesEnseign",tachesEn);
ArrayList<Enseignant> tachesEng=(ArrayList<Enseignant>)session.getAttribute("tachesEnseign");
if(tachesEng == null){
tachesEng = new ArrayList<Enseignant>();
}
for(Enseignant items: tachesEng){
System.out.println( items.getNomEnseign()+" " +items.getCodeEnseign());
}
return mapping.findForward("ajoutEnseign");
}
}
| [
"happybin1989@gmail.com"
] | happybin1989@gmail.com |
86d3fe35ad8f4c6959703957478bc409af6c3e49 | 216b5e3d43d3bb8cb0f374842840eada5a6bb990 | /gmall-sms/src/main/java/com/atguigu/gmall/sms/controller/HomeSubjectController.java | 73757855df4d041ce27fcee5c9d5aeb29b8c3966 | [
"Apache-2.0"
] | permissive | limingj/gmall-lmj | 859662744a7c4ce0d904daa4cd474c3d5cdfc2b2 | 396d0888d5a79fd5255ba837d65c1e23a0f82bb0 | refs/heads/master | 2022-12-22T14:10:09.894451 | 2020-03-23T03:34:45 | 2020-03-23T03:34:45 | 231,021,134 | 0 | 0 | Apache-2.0 | 2022-12-10T05:54:03 | 2019-12-31T03:45:00 | JavaScript | UTF-8 | Java | false | false | 2,599 | java | package com.atguigu.gmall.sms.controller;
import java.util.Arrays;
import com.atguigu.core.bean.PageVo;
import com.atguigu.core.bean.QueryCondition;
import com.atguigu.core.bean.Resp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.atguigu.gmall.sms.entity.HomeSubjectEntity;
import com.atguigu.gmall.sms.service.HomeSubjectService;
/**
* 首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】
*
* @author lixianfeng
* @email lxf@atguigu.com
* @date 2020-01-02 08:07:26
*/
@Api(tags = "首页专题表【jd首页下面很多专题,每个专题链接新的页面,展示专题商品信息】 管理")
@RestController
@RequestMapping("sms/homesubject")
public class HomeSubjectController {
@Autowired
private HomeSubjectService homeSubjectService;
/**
* 列表
*/
@ApiOperation("分页查询(排序)")
@GetMapping("/list")
@PreAuthorize("hasAuthority('sms:homesubject:list')")
public Resp<PageVo> list(QueryCondition queryCondition) {
PageVo page = homeSubjectService.queryPage(queryCondition);
return Resp.ok(page);
}
/**
* 信息
*/
@ApiOperation("详情查询")
@GetMapping("/info/{id}")
@PreAuthorize("hasAuthority('sms:homesubject:info')")
public Resp<HomeSubjectEntity> info(@PathVariable("id") Long id){
HomeSubjectEntity homeSubject = homeSubjectService.getById(id);
return Resp.ok(homeSubject);
}
/**
* 保存
*/
@ApiOperation("保存")
@PostMapping("/save")
@PreAuthorize("hasAuthority('sms:homesubject:save')")
public Resp<Object> save(@RequestBody HomeSubjectEntity homeSubject){
homeSubjectService.save(homeSubject);
return Resp.ok(null);
}
/**
* 修改
*/
@ApiOperation("修改")
@PostMapping("/update")
@PreAuthorize("hasAuthority('sms:homesubject:update')")
public Resp<Object> update(@RequestBody HomeSubjectEntity homeSubject){
homeSubjectService.updateById(homeSubject);
return Resp.ok(null);
}
/**
* 删除
*/
@ApiOperation("删除")
@PostMapping("/delete")
@PreAuthorize("hasAuthority('sms:homesubject:delete')")
public Resp<Object> delete(@RequestBody Long[] ids){
homeSubjectService.removeByIds(Arrays.asList(ids));
return Resp.ok(null);
}
}
| [
"1816025354@qq.com"
] | 1816025354@qq.com |
baa5af81b950aa5ca2a2650fc48504c377e27ae4 | 8ab2c1163dad932f03e028496b70bd813fefd86d | /src/main/java/hoanghung/com/demo/entity/Dog.java | 19bb05dc62020d554d940d6155768166b288b77b | [] | no_license | hoanghung0102/learn-pattern | 10ee2339c4f7d91d7e1bfeac140a5a06423b9173 | 0b9e3dc47f0e0e26dac1306fc3a49b8cf4959005 | refs/heads/master | 2020-03-30T23:28:49.031907 | 2019-04-03T04:11:49 | 2019-04-03T04:11:49 | 151,701,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package hoanghung.com.demo.entity;
import lombok.Data;
@Data
public class Dog extends Animal {
private int numOfLegs;
public Dog(int numOfLegs) {
this.numOfLegs = numOfLegs;
}
@Override
public void run() {
System.out.println("I am Dog. I run by 4 legs");
}
}
| [
"hung.hoang@axonactive.com"
] | hung.hoang@axonactive.com |
3fe402a8696d018f8e86f5d2064a5c3585c65aa7 | 071a9fa7cfee0d1bf784f6591cd8d07c6b2a2495 | /corpus/norm-class/eclipse.jdt.core/5233.java | 969cf02c4481343e1dbe683b5c7817523a8697b5 | [
"MIT"
] | permissive | masud-technope/ACER-Replication-Package-ASE2017 | 41a7603117f01382e7e16f2f6ae899e6ff3ad6bb | cb7318a729eb1403004d451a164c851af2d81f7a | refs/heads/master | 2021-06-21T02:19:43.602864 | 2021-02-13T20:44:09 | 2021-02-13T20:44:09 | 187,748,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 751 | java | copyright ibm corporation rights reserved program accompanying materials terms eclipse license accompanies distribution http eclipse org legal epl html contributors ibm corporation initial api implementation org eclipse jdt internal compiler util suffix constants suffixconstants nls string extension nls string extension nls string extension java java nls string extension java java nls string suffix string extension nls string suffix string extension nls string suffix string java extension java nls string suffix string java extension java suffix suffix string to char array tochararray suffix suffix string to char array tochararray suffix java suffix string java to char array tochararray suffix java suffix string java to char array tochararray | [
"masudcseku@gmail.com"
] | masudcseku@gmail.com |
f819532e59b2daf0ba8ba3cb56d0a4275a5e8282 | 2779d673ff4f37a190e87072697d9e2cfa6f595f | /src/document/PageObject.java | c1c9d1464ab0eb5873ae020b866d6838a6320043 | [] | no_license | jefrusse24/JournalNotes | 87804bb8dd32d2053a5347103f0b2c4369a42424 | f4eb57f8e79a132d18e7edb5d4db213905c7996c | refs/heads/master | 2020-06-04T12:54:31.068221 | 2014-12-19T01:23:40 | 2014-12-19T01:23:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,192 | java | package document;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
public abstract class PageObject implements Transferable {
public static final int TITLE_HEIGHT=8;
Rectangle m_boundingRect;
Color m_color = Color.BLACK;
boolean m_isHilighted;
int m_lineWidth = 1;
public Rectangle getBoundingRect() {
return m_boundingRect;
}
public Color getColor() {
return m_color;
}
public void setColor(Color color) {
m_color = color;
}
public boolean isHilighted() {
return m_isHilighted;
}
public void isHilighted(boolean isHilighted) {
m_isHilighted = isHilighted;
}
public boolean getObjectAtPoint(Point pt) {
return m_boundingRect.contains(pt);
}
/**
* Gets the width of the line for this object.
* @return int - Width of the line for this object.
*/
public int getLineWidth() {
return m_lineWidth;
}
/**
* Sets the width of the line for this object. The maximum
* line width is 15. It takes the passed in value, and looks
* at only the first byte to set the width of the line.
* @param width int - Width of the line
*/
public void setLineWidth(int width) {
m_lineWidth = (width & 0x0F); // Max of 15 width.
}
//
//
// Abstract Methods
// Specific methods for objects of this class
//
/**
* Return the upper left point of ths object.
* @return
*/
public abstract Point getPt();
public abstract void move(Point pt);
abstract void moveTo(Point point);
abstract void calculateBoundingRect();
public abstract void paint(Graphics g);
public abstract void paint(Graphics g, int yOffset);
abstract void delete();
@Override
public Object getTransferData(DataFlavor arg0) throws UnsupportedFlavorException, IOException {
return this;
}
@Override
public DataFlavor[] getTransferDataFlavors() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isDataFlavorSupported(DataFlavor arg0) {
// TODO Auto-generated method stub
return false;
}
}
| [
"jefrusse@yahoo.com"
] | jefrusse@yahoo.com |
7b2afc32e55d597f9d8b6bb8f57fcc3fc6b51c01 | 749ec1687d2ade19169eb9e60128855b19727597 | /WTN_practice/src/com/wipro/multithreading/runnable/ControlThreads.java | abe12c01db58664c97fbb54b90ea0a05fb0e8ca9 | [] | no_license | nikhil-teki/WTN_practice_repository | c09917cca5567e38b05ef30e2b166bb5432942c1 | a04a38330ba5864738ee4961cb6c088d0d9ecf06 | refs/heads/master | 2022-12-09T16:33:07.212465 | 2020-08-29T10:37:25 | 2020-08-29T10:37:25 | 272,974,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,401 | java | package com.wipro.multithreading.runnable;
public class ControlThreads implements Runnable{
String threadName="";
Thread t;
ControlThreads(String threadName)
{
this.threadName=threadName;
t=new Thread(this,threadName);
System.out.println("New thread : "+threadName);
t.start();
}
public void run()
{
try {
for(int i=0;i<5;i++)
System.out.println("Child Thread "+t.getName()+" "+i);
Thread.sleep(1000);
}
catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
ControlThreads ct1=new ControlThreads("Thread One");
ControlThreads ct2=new ControlThreads("Thread Two");
ControlThreads ct3=new ControlThreads("Thread Three");
System.out.println(ct1.t.getName()+"is alive : "+ct1.t.isAlive());
System.out.println(ct2.t.getName()+"is alive : "+ct2.t.isAlive());
System.out.println(ct3.t.getName()+"is alive : "+ct3.t.isAlive());
try
{
System.out.println("Waiting for Child threads to finish.....");
ct1.t.join();
ct2.t.join();
ct3.t.join();
}
catch(InterruptedException e)
{
e.printStackTrace();
}
System.out.println(ct1.t.getName()+"is alive : "+ct1.t.isAlive());
System.out.println(ct2.t.getName()+"is alive : "+ct2.t.isAlive());
System.out.println(ct3.t.getName()+"is alive : "+ct3.t.isAlive());
}
}
| [
"nikhil.teki2000@gmail.com"
] | nikhil.teki2000@gmail.com |
b7118c02b50655af6ba6625dc8518165ff0bc604 | 2e630142e6a4bbfa1d5f12fa5641b094075fa189 | /src/org/mel/menu/MenuLookDemo.java | 34b7d0ea76616a048a525b6c3bcfed2635b8edc5 | [] | no_license | privatemiao/Swing-Sample | bf74f8ef28ab4c493bc002fb41f5d9925136447e | 6ce298ce42a1e22866f6f25f7f5f36eeba2facfb | refs/heads/master | 2021-01-21T08:02:16.536796 | 2017-02-28T09:21:34 | 2017-02-28T09:21:34 | 83,331,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,789 | java | package org.mel.menu;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.KeyStroke;
public class MenuLookDemo {
JTextArea output;
JScrollPane scrollPane;
public JMenuBar createMenuBar() {
JMenuBar menuBar;
JMenu menu, submenu;
JMenuItem menuItem;
JRadioButtonMenuItem rbMenuItem;
JCheckBoxMenuItem cbMenuItem;
// Create the menu bar.
menuBar = new JMenuBar();
// Build the first menu.
menu = new JMenu("A Menu");
menu.setMnemonic(KeyEvent.VK_A);
menu.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
menuBar.add(menu);
// a group of JMenuItems
menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
// menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
menu.add(menuItem);
ImageIcon icon = createImageIcon("images/middle.gif");
menuItem = new JMenuItem("Both text and icon", icon);
menuItem.setMnemonic(KeyEvent.VK_B);
menu.add(menuItem);
menuItem = new JMenuItem(icon);
menuItem.setMnemonic(KeyEvent.VK_D);
menu.add(menuItem);
// a group of radio button menu items
menu.addSeparator();
ButtonGroup group = new ButtonGroup();
rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
rbMenuItem.setSelected(true);
rbMenuItem.setMnemonic(KeyEvent.VK_R);
group.add(rbMenuItem);
menu.add(rbMenuItem);
rbMenuItem = new JRadioButtonMenuItem("Another one");
rbMenuItem.setMnemonic(KeyEvent.VK_O);
group.add(rbMenuItem);
menu.add(rbMenuItem);
// a group of check box menu items
menu.addSeparator();
cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
cbMenuItem.setMnemonic(KeyEvent.VK_C);
menu.add(cbMenuItem);
cbMenuItem = new JCheckBoxMenuItem("Another one");
cbMenuItem.setMnemonic(KeyEvent.VK_H);
menu.add(cbMenuItem);
// a submenu
menu.addSeparator();
submenu = new JMenu("A submenu");
submenu.setMnemonic(KeyEvent.VK_S);
menuItem = new JMenuItem("An item in the submenu");
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK));
submenu.add(menuItem);
menuItem = new JMenuItem("Another item");
submenu.add(menuItem);
menu.add(submenu);
// Build second menu in the menu bar.
menu = new JMenu("Another Menu");
menu.setMnemonic(KeyEvent.VK_N);
menu.getAccessibleContext().setAccessibleDescription("This menu does nothing");
menuBar.add(menu);
return menuBar;
}
public Container createContentPane() {
// Create the content-pane-to-be.
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.setOpaque(true);
// Create a scrolled text area.
output = new JTextArea(5, 30);
output.setEditable(false);
scrollPane = new JScrollPane(output);
// Add the text area to the content pane.
contentPane.add(scrollPane, BorderLayout.CENTER);
return contentPane;
}
/** Returns an ImageIcon, or null if the path was invalid. */
protected static ImageIcon createImageIcon(String path) {
java.net.URL imgURL = MenuLookDemo.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
}
/**
* Create the GUI and show it. For thread safety, this method should be
* invoked from the event-dispatching thread.
*/
private static void createAndShowGUI() {
// Create and set up the window.
JFrame frame = new JFrame("MenuLookDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create and set up the content pane.
MenuLookDemo demo = new MenuLookDemo();
frame.setJMenuBar(demo.createMenuBar());
frame.setContentPane(demo.createContentPane());
// Display the window.
frame.setSize(450, 260);
frame.setVisible(true);
}
public static void main(String[] args) {
// Schedule a job for the event-dispatching thread:
// creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
| [
"privatemiao@gmail.com"
] | privatemiao@gmail.com |
040ca138f518275a7d440ef971d0c8255966bca2 | 62386891609d16e8e504b0c1435ed48bec429ac9 | /src/main/java/com/learning/effective_java/four/Super.java | e641c2b08d7dfd329ab81ad42e8c366d8a5413a5 | [] | no_license | strugglekian/effective_java | 1ca66340c4e36fb0cb43d511cc360420662de0f5 | 94a009d09fc729430d76564f8a70723164472b37 | refs/heads/master | 2020-06-01T19:12:58.504768 | 2019-10-30T12:14:20 | 2019-10-30T12:14:20 | 190,896,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.learning.effective_java.four;
/**
* @author kian
* @date 2019/6/12
*/
public class Super {
public Super() {
overrideMe();
System.out.println(2);
}
public void overrideMe() {
System.out.println(1);
}
public static void canNotOverride(){
System.out.println("can not be override.");
}
}
| [
"kian.kang@aliyun.com"
] | kian.kang@aliyun.com |
e05753edd46698b53fc82ea2e4d4ff4f5b2fe8fb | 3ff28e8b94c30cbbed016941cb0307b441de4e8f | /src/main/java/edu/umass/ciir/galagotools/spelling/WordListParser.java | fc072c04bcb1c1397c22d0898b17e9bc96c4e018 | [
"BSD-3-Clause"
] | permissive | jjfiv/GalagoTools | 726df7e89fe918e5f0c52ecdfe4995e7ff5145e4 | 85bb19eba4c7af6cd35966b5daf8c0e1b5098b2f | refs/heads/master | 2016-09-06T19:27:39.372245 | 2015-02-04T02:48:32 | 2015-02-04T02:48:32 | 21,000,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,259 | java | package edu.umass.ciir.galagotools.spelling;
import edu.umass.ciir.galagotools.utils.IO;
import org.lemurproject.galago.core.parse.Document;
import org.lemurproject.galago.core.parse.DocumentStreamParser;
import org.lemurproject.galago.core.types.DocumentSplit;
import org.lemurproject.galago.utility.Parameters;
import java.io.BufferedReader;
import java.io.IOException;
/**
* For parsing /usr/share/dict/words into trigrams
* @author jfoley
*/
public class WordListParser extends DocumentStreamParser {
private BufferedReader reader;
public WordListParser(DocumentSplit split, Parameters p) throws IOException {
super(split, p);
this.reader = getBufferedReader(split);
}
@Override
public Document nextDocument() throws IOException {
if(reader == null) return null;
while(true) {
String line = reader.readLine();
if (line == null) return null;
// each line becomes both name and text
Document doc = new Document();
doc.name = line.toLowerCase().trim();
if(doc.name.endsWith("s")) continue;
if(doc.name.length() < 3) continue;
doc.text = line;
return doc;
}
}
@Override
public void close() throws IOException {
IO.close(reader);
reader = null;
}
}
| [
"jfoley@cs.umass.edu"
] | jfoley@cs.umass.edu |
3dd4b9bb905936acaa99fb6e74c6f2440ad5d986 | 22bdeb7dd7a9824faeb4d0d1734531391ce62626 | /app/src/main/java/com/bayue/ciic/upload/controller/UploadService.java | 41cb4afb6a04980b50719dff014fc342477c5879 | [] | no_license | BayueCiic/Ciic | 00a9eb2e68c78cb371a46279687c89c82f1addff | f7dc7c699c9279d7d2e984bcb576967d5049fba5 | refs/heads/master | 2021-01-17T12:19:50.068174 | 2017-08-18T09:45:38 | 2017-08-18T09:45:43 | 95,396,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,819 | java | package com.bayue.ciic.upload.controller;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Binder;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bayue.ciic.DemoCache;
import com.bayue.ciic.MainActivity;
import com.bayue.ciic.R;
import com.bayue.ciic.server.DemoServerHttpClient;
import com.bayue.ciic.server.entity.AddVideoResponseEntity;
import com.bayue.ciic.server.entity.TranscodeResponseEntity;
import com.bayue.ciic.upload.constant.TranscodeType;
import com.bayue.ciic.upload.constant.UploadType;
import com.bayue.ciic.upload.model.UploadDbHelper;
import com.bayue.ciic.upload.model.UploadTotalDataAccessor;
import com.bayue.ciic.upload.model.VideoItem;
import com.netease.cloud.nos.android.core.CallRet;
import com.netease.cloud.nos.android.exception.InvalidParameterException;
import com.netease.vcloudnosupload.UploadBuilder;
import com.netease.vcloudnosupload.VcloudUpload;
import org.json.JSONException;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by zhukkun on 3/1/17.
*/
public class UploadService extends Service {
private final static String TAG = UploadService.class.getSimpleName();
public static final boolean show_nofitycation = false; //由于开启通知, 用户点击通知时,导航路径未明确,故暂时关闭通知.
public static final int POLLING_INTERVAL = 30000; //30s一次的轮询,查询转码状态 用户可根据自己需要调整时长间隔
public static final String UPLAOD_CALL_BACK = "vod/uploadcallback";
public static final String TRANSCODE_CALL_BACK = "vod/transcodecallback";
public static final int STATE_WAIT = 0;
public static final int STATE_UPLOADING = 1;
public static final int STATE_UPLOAD_COMPLETE = 2;
public static final int STATE_UPLOAD_FAIL = 3;
public static final int STATE_TRANSCODEING = 4;
public static final int STATE_TRANSCODE_FAIL = 5;
public static final int STATE_TRANSCODE_COMPLETE = 6;
public static final int TRANSCODE_THREAD_STATE_WAIT = 0;
public static final int TRANSCODE_THREAD_STATE_WORKING = 1;
private UploadController controller;
private VcloudUpload vcloudUpload;
//用于处理上传任务的线程
private HandlerThread uploadThread;
//用于轮询转码状态的线程
private HandlerThread transCodeQueryThread;
//上传任务发送器, 发送任务后会在上传任务线程处理
private Handler uploadHandler;
//轮询任务发送器, 发送任务后会在转码查询线程处理
private Handler transCodeQueryHandler;
private UploadBinder mBinder = new UploadBinder();
private int transcode_thread_state = TRANSCODE_THREAD_STATE_WAIT;
private VideoItem uploadingItem; //当前正在上传的item
private boolean needStopUpload; //是否需要停止上传
@Override
public void onCreate() {
super.onCreate();
Log.i(TAG, "upload service create");
}
@Override
public void onDestroy() {
super.onDestroy();
}
public class UploadBinder extends Binder {
public void attachController(UploadController controller) {
UploadService.this.controller = controller;
}
public void startUpload() {
//使用handler发送任务, 保证上传任务是在上传线程中串行执行,这样即使同时收到多个开启上传任务的请求,也会串行执行,并且由于只有Wait状态的任务才会进入uploadOne(),故可避免任务的重复上传
needStopUpload = false;
uploadHandler.post(new Runnable() {
@Override
public void run() {
// showNotification("正在上传中...", false);
UploadService.this.startUpload();
}
});
}
public void deleteUploadItem(VideoItem videoItem) {
if (vcloudUpload != null && uploadingItem != null && videoItem.getId().equals(uploadingItem.getId())) {
vcloudUpload.cancelTask();
}
}
public void stopUpload() {
if (vcloudUpload != null) {
transCodeQueryHandler.post(new Runnable() {
@Override
public void run() {
vcloudUpload.cancelTask();
//由于uploadThread中执行的uploadOne()sleep了200ms,所以即使任务关闭,此时的uploadItem也不为null.
if (uploadingItem != null) {
uploadingItem.setState(UploadService.STATE_WAIT);
controller.onReceiveUploadCallback(uploadingItem.getId(), uploadingItem.getUploadProgress(), STATE_WAIT);
UploadDbHelper.updateToDb(uploadingItem);
}
}
});
}
needStopUpload = true;
}
public void showUploadNotification() {
showNotification("正在上传中...", false);
}
/**
* 开启转码查询
*/
public void startTransQuery() {
List list = controller.getDataAccessor().getTranscodingVidList();
if (list != null && list.size() > 0 && transcode_thread_state == TRANSCODE_THREAD_STATE_WAIT) {
transcodeStatePolling();
}
}
public boolean isUploading() {
return uploadingItem != null;
}
}
@Override
public IBinder onBind(Intent intent) {
needStopUpload = false;
uploadThread = new HandlerThread("UploadService");
uploadThread.start();
uploadHandler = new Handler(uploadThread.getLooper());
transCodeQueryThread = new HandlerThread("transCodeQueryThread");
transCodeQueryThread.start();
transCodeQueryHandler = new Handler(transCodeQueryThread.getLooper());
return mBinder;
}
@Override
public boolean onUnbind(Intent intent) {
if (vcloudUpload != null) {
vcloudUpload.cancelTask();
}
needStopUpload = true;
uploadThread.quit();
transCodeQueryThread.quit();
transCodeQueryHandler.removeCallbacksAndMessages(null);
uploadHandler.removeCallbacksAndMessages(null);
return super.onUnbind(intent);
}
private void startUpload() {
if (controller == null) {
throw new NullPointerException("must attachController() before startUpload()");
}
List<VideoItem> waitUploadingItems = new ArrayList<>(UploadTotalDataAccessor.getInstance().getUploadList());
for (int i = 0; i < waitUploadingItems.size(); i++) {
VideoItem videoItem = waitUploadingItems.get(i);
//判空,防止待上传项被删除.
if (videoItem == null) continue;
if (videoItem.getState() == STATE_WAIT) {
controller.onUploadStateChanged(STATE_UPLOADING);
if (!needStopUpload) {
uploadOne(videoItem);
}
} else if (videoItem.getState() == STATE_UPLOAD_COMPLETE && !UploadTotalDataAccessor.getInstance().getWaitAddToServerItems().contains(videoItem)) {
//进到此分支为 已上传成功,但未成功添加至应用服务器的数据
addVideoToDemoServer(videoItem);
}
}
if (UploadTotalDataAccessor.getInstance().isFullySuccess()) {
controller.onUploadStateChanged(STATE_UPLOAD_COMPLETE);
// showNotification("上传已完成", true);
}
}
private boolean uploadOne(final VideoItem videoItem) {
final Object lock = new Object();
final File mFile = new File(videoItem.getFilePath());
try {
Log.d(TAG, "uploadOne() " + videoItem.getId());
Log.i(TAG, "upload type:" + videoItem.getType());
vcloudUpload = getUploadBuild(mFile.getName()).build();
VcloudUpload.UploadInfo uploadContext = new VcloudUpload.UploadInfo(videoItem.getUploadToken(), videoItem.getUploadBucket(), videoItem.getUploadObject());
if (checkHasSucUpload(videoItem)) {
return true;
}
uploadingItem = videoItem;
String nosUrl = vcloudUpload.uploadFile(mFile, videoItem.getUploadContext(), uploadContext, new VcloudUpload.UploadCallBack() {
@Override
public void onUploadInit(VcloudUpload.UploadInfo uploadInfo) {
videoItem.setUploadToken(uploadInfo.getUploadToken());
videoItem.setUploadBucket(uploadInfo.getUploadBucketName());
videoItem.setUploadObject(uploadInfo.getUploadObjectName());
}
@Override
public void onUploadContextCreate(Object o, String s, String s1) {
videoItem.setUploadContext(s1);
UploadDbHelper.updateToDb(videoItem);
}
@Override
public void onProcess(Object o, long current, long mtotal) {
int progress = (int) (current * 100 / (float) mtotal);
videoItem.setState(STATE_UPLOADING);
videoItem.setUploadProgress(progress);
controller.onReceiveUploadCallback(videoItem.getId(), progress, STATE_UPLOADING);
}
@Override
public void onSuccess(CallRet callRet) {
videoItem.setState(STATE_UPLOAD_COMPLETE);
UploadTotalDataAccessor.getInstance().uploadSuccess(videoItem);
JSONObject json = JSON.parseObject(callRet.getCallbackRetMsg());
if (json != null && json.getInteger("code") == 200) {
long vid = json.getJSONObject("ret").getLong("vid");
videoItem.setVid(vid);
UploadTotalDataAccessor.getInstance().getWaitAddToServerItems().add(videoItem);
UploadDbHelper.updateToDb(videoItem);
addVideoToDemoServer(videoItem);
}
synchronized (lock) {
lock.notify();
}
}
@Override
public void onFailure(CallRet callRet) {
videoItem.setState(STATE_UPLOAD_FAIL);
controller.onReceiveUploadCallback(videoItem.getId(), 0, STATE_UPLOAD_FAIL);
UploadDbHelper.updateToDb(videoItem);
synchronized (lock) {
lock.notify();
}
}
@Override
public void onCanceled(CallRet callRet) {
synchronized (lock) {
lock.notify();
}
}
});
synchronized (lock) {
lock.wait();
}
try {
//sleep 200毫秒 作用: 在断网重连时,让时间片给其他线程进行状态修改等处理
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
uploadingItem = null;
if (nosUrl != null) {
//不显示上传成功状态,直接由上传成功到转码中
//controller.onReceiveUploadCallback(videoItem.getId(), 100, STATE_UPLOAD_COMPLETE);
}
} catch (InvalidParameterException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
/**
* 检查该任务是否已成功上传, 防止在接近99.99%时,断网或进程被杀,客户端无法感知到已成功上传,故先查询
*
* 已上传到nos,未上传到demoserver
*
* @param videoItem
* @return true 已成功上传, false未成功上传
*/
private boolean checkHasSucUpload(final VideoItem videoItem) {
final Object lock = new Object();
if (videoItem.getUploadObject() != null) {
vcloudUpload.uploadQuery(Arrays.asList(new String[]{videoItem.getUploadObject()}), new VcloudUpload.QueryCallBack() {
@Override
public void onSuc(List<Integer> list) {
if (list != null && list.size() > 0) {
int vid = list.get(0);
if (vid != 0) {
videoItem.setState(STATE_UPLOAD_COMPLETE);
videoItem.setVid(vid);
UploadTotalDataAccessor.getInstance().getWaitAddToServerItems().add(videoItem);
UploadDbHelper.updateToDb(videoItem);
addVideoToDemoServer(videoItem);
}
}
synchronized (lock) {
lock.notify();
}
}
@Override
public void onFail(String s) {
synchronized (lock) {
lock.notify();
}
}
});
try {
synchronized (lock) {
lock.wait();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
return videoItem.getVid() != 0;
} else {
return false;
}
}
private UploadBuilder getUploadBuild(String name) {
UploadBuilder builder = new UploadBuilder(DemoCache.getContext(), getAppKey(), DemoCache.getAccount(), DemoCache.getVodtoken())
.setOriginFileName(getValidateFileName(name))
.setUserFileName(name)
.setCallbackUrl(DemoServerHttpClient.API_SERVER + TRANSCODE_CALL_BACK)
.setUploadCallbackUrl(DemoServerHttpClient.API_SERVER + UPLAOD_CALL_BACK);
return builder;
}
/**
* NOS对原始文件名做了限制,含非法字符将无法上传,故对其进行过滤
*
* @param name
* @return
*/
private String getValidateFileName(String name) {
int index_of_p = name.lastIndexOf('.');
return System.currentTimeMillis() + name.substring(index_of_p);
}
/**
* 在应用服务器 标记 视频上传成功,服务器成功后,自动开始转码.
*
* @param videoItem
*/
private void addVideoToDemoServer(final VideoItem videoItem) {
transCodeQueryHandler.post(new Runnable() {
@Override
public void run() {
if (videoItem.getType() == UploadType.SHORT_VIDEO) {
DemoServerHttpClient.getInstance().addVideo(videoItem.getVid(), videoItem.getDisplayName(), 1, new DemoServerHttpClient.DemoServerHttpCallback<AddVideoResponseEntity>() {
@Override
public void onSuccess(AddVideoResponseEntity addVideoResponseEntity) {
UploadDbHelper.removeItemFromDb(videoItem);
UploadTotalDataAccessor.getInstance().getWaitAddToServerItems().remove(videoItem);
UploadTotalDataAccessor.getInstance().uploadSuccess(videoItem);
controller.onAddVideoResult(200, videoItem.getId(), addVideoResponseEntity);
}
@Override
public void onFailed(int code, String errorMsg) {
controller.onAddVideoResult(code, videoItem.getId(), null);
}
});
} else {
DemoServerHttpClient.getInstance().addVideo(videoItem.getVid(), videoItem.getDisplayName(), 0, new DemoServerHttpClient.DemoServerHttpCallback<AddVideoResponseEntity>() {
@Override
public void onSuccess(AddVideoResponseEntity addVideoResponseEntity) {
if (addVideoResponseEntity.getTransjobstatus() == 0) {
controller.onReceiveUploadCallback(videoItem.getId(), 100, STATE_TRANSCODEING);
videoItem.setState(STATE_TRANSCODEING);
videoItem.setVid(addVideoResponseEntity.getVideoInfoEntity().getVid());
// 1、上传成功
// 2、添加到转码
UploadTotalDataAccessor.getInstance().uploadSuccess(videoItem);
controller.getDataAccessor().addTransCodingList(videoItem);
controller.startTranscodeQuery();
} else {
//服务端发起转码请求失败
controller.onReceiveUploadCallback(videoItem.getId(), 100, STATE_TRANSCODE_FAIL);
videoItem.setState(STATE_TRANSCODE_FAIL);
}
UploadTotalDataAccessor.getInstance().getWaitAddToServerItems().remove(videoItem);
UploadDbHelper.removeItemFromDb(videoItem);
UploadController.getInstance().getDataAccessor().localAddToCloud(videoItem);
controller.onAddVideoResult(200, videoItem.getId(), addVideoResponseEntity);
}
@Override
public void onFailed(int code, String errorMsg) {
controller.onAddVideoResult(code, videoItem.getId(), null);
}
});
}
}
});
}
/**
* 当转码等待队列中有任务时,开启60S一次的轮询
*/
public void transcodeStatePolling() {
if (controller.getDataAccessor().getTranscodingItems() != null
&& controller.getDataAccessor().getTranscodingItems().size() > 0) {
transcode_thread_state = TRANSCODE_THREAD_STATE_WORKING;
transCodeQueryHandler.postDelayed(new Runnable() {
@Override
public void run() {
startQueryTransCodeState();
}
}, POLLING_INTERVAL);
} else {
transcode_thread_state = TRANSCODE_THREAD_STATE_WAIT;
}
}
/**
* 查询转码状态轮询
*/
private void startQueryTransCodeState() {
transCodeQueryHandler.post(new Runnable() {
@Override
public void run() {
DemoServerHttpClient.getInstance().videoTransCodeStatus(
controller.getDataAccessor().getTranscodingVidList(), new DemoServerHttpClient.DemoServerHttpCallback<List<TranscodeResponseEntity>>() {
@Override
public void onSuccess(List<TranscodeResponseEntity> transcodeResponseEntities) {
Log.d(TAG, transcodeResponseEntities.toString());
for (int i = 0; i < transcodeResponseEntities.size(); i++) {
TranscodeResponseEntity entity = transcodeResponseEntities.get(i);
switch (entity.getTranscodestatus()) {
case TranscodeType.TRASNCODE_SUCCESS: //转码成功
{
VideoItem videoItem = controller.getDataAccessor().removeTranscodeItemByVid(entity.getVid());
if (videoItem != null) {
videoItem.setState(STATE_TRANSCODE_COMPLETE);
controller.onReceiveUploadCallback(videoItem.getId(), 100, STATE_TRANSCODE_COMPLETE);
}
}
break;
case TranscodeType.TRANSCODING: //转码中
break;
case TranscodeType.TRANSCODE_FAILED: //转码失败
{
VideoItem videoItem = controller.getDataAccessor().removeTranscodeItemByVid(entity.getVid());
if (videoItem != null) {
videoItem.setState(STATE_TRANSCODE_FAIL);
controller.onReceiveUploadCallback(videoItem.getId(), 100, STATE_TRANSCODE_FAIL);
}
break;
}
}
}
//必须放在返回回调, 更新状态后,确认仍在转码,才开启轮询
transcodeStatePolling();
}
@Override
public void onFailed(int code, String errorMsg) {
transcodeStatePolling();
}
}
);
}
});
}
private int mNotificationId = 100;
private void showNotification(String content, boolean autoCancel) {
if (!show_nofitycation) return;
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("上传视频")
.setContentText(content)
.setTicker(content)
.setAutoCancel(autoCancel);
Intent intent = new Intent(this, MainActivity.class);
// intent.putExtra(MainActivity.EXTRA_FROM_UPLOAD_NOTIFY, true);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(pendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(mNotificationId, mBuilder.build());
}
private String appKey;
private String getAppKey() {
if (appKey == null) {
appKey = readAppKey();
}
return appKey;
}
private String readAppKey() {
try {
ApplicationInfo appInfo = DemoCache.getContext().getPackageManager().getApplicationInfo(DemoCache.getContext().getPackageName(), PackageManager.GET_META_DATA);
if (appInfo != null) {
return appInfo.metaData.getString("com.netease.nim.appKey");
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
| [
"min98788@163"
] | min98788@163 |
3a2b78726c9146e1f54b3356c174e4412198b0e2 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/35/35_62ac8b3c4299d2beb11df56f63ba07e2acbb076e/BuildDetailsHibernateRepository/35_62ac8b3c4299d2beb11df56f63ba07e2acbb076e_BuildDetailsHibernateRepository_t.java | c4a0462e2720e620f90884a182922c24199f325c | [] | 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,417 | java | /**
*
*/
package org.jenkins.plugins.dbaudit.internal.data;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import org.jenkins.plugins.dbaudit.data.BuildDetailsRepository;
import org.jenkins.plugins.dbaudit.model.BuildDetails;
import org.springframework.orm.hibernate3.HibernateTemplate;
/**
* Hibernate-based implementation of the {@link BuildDetailsRepository} interface.
*
* @author Marco Scata
*
*/
public class BuildDetailsHibernateRepository implements BuildDetailsRepository {
private final HibernateTemplate hibernate = new HibernateTemplate();
public BuildDetailsHibernateRepository(final SessionFactory sessionFactory) {
this.hibernate.setSessionFactory(sessionFactory);
}
/**
* @see org.jenkins.plugins.dbaudit.data.BuildDetailsRepository#saveBuildDetails(org.jenkins.plugins.dbaudit.model.BuildDetails)
*/
@Override
public Object saveBuildDetails(final BuildDetails details) {
if (null == details) {
throw new IllegalArgumentException("Invalid build details: cannot be null.");
}
return hibernate.save(details);
}
/**
* @see org.jenkins.plugins.dbaudit.data.BuildDetailsRepository#getBuildDetailsById(String)
*/
@SuppressWarnings("unchecked")
@Override
public BuildDetails getBuildDetailsById(final String id) {
BuildDetails retval = null;
final DetachedCriteria criteria = DetachedCriteria.forClass(BuildDetails.class);
criteria.add(Restrictions.eq("id", id));
final List<BuildDetails> builds = hibernate.findByCriteria(criteria);
if ((builds != null) && !builds.isEmpty()) {
retval = builds.get(0);
}
return retval;
}
/**
* @see org.jenkins.plugins.dbaudit.data.BuildDetailsRepository#getBuildDetailsByName(java.lang.String)
*/
@SuppressWarnings("unchecked")
@Override
public List<BuildDetails> getBuildDetailsByName(final String name) {
final DetachedCriteria criteria = DetachedCriteria.forClass(BuildDetails.class);
criteria.add(Restrictions.ilike("name", name, MatchMode.EXACT));
return hibernate.findByCriteria(criteria);
}
/**
* @see org.jenkins.plugins.dbaudit.data.BuildDetailsRepository#getBuildDetailsByFullName(java.lang.String)
*/
@SuppressWarnings("unchecked")
@Override
public List<BuildDetails> getBuildDetailsByFullName(final String fullName) {
final DetachedCriteria criteria = DetachedCriteria.forClass(BuildDetails.class);
criteria.add(Restrictions.ilike("fullName", fullName, MatchMode.EXACT));
return hibernate.findByCriteria(criteria);
}
/**
* @see org.jenkins.plugins.dbaudit.data.BuildDetailsRepository#getBuildDetailsByDateRange(java.util.Date, java.util.Date)
*/
@SuppressWarnings("unchecked")
@Override
public List<BuildDetails> getBuildDetailsByDateRange(final Date start, final Date end) {
final DetachedCriteria criteria = DetachedCriteria.forClass(BuildDetails.class);
// we need this funny-looking complex criteria because the
// semantics of the 'between' criteria can vary across
// db providers and we want a predictable inclusive behaviour.
final Calendar inclusiveStartDate = Calendar.getInstance();
inclusiveStartDate.setTime(start);
inclusiveStartDate.set(Calendar.HOUR_OF_DAY, 0);
inclusiveStartDate.set(Calendar.MINUTE, 0);
inclusiveStartDate.set(Calendar.SECOND, 0);
inclusiveStartDate.set(Calendar.MILLISECOND, 0);
final Calendar inclusiveEndDate = Calendar.getInstance();
inclusiveEndDate.setTime(end);
inclusiveEndDate.set(Calendar.HOUR_OF_DAY, 23);
inclusiveEndDate.set(Calendar.MINUTE, 59);
inclusiveEndDate.set(Calendar.SECOND, 59);
inclusiveEndDate.set(Calendar.MILLISECOND, 999);
criteria.add(Restrictions.or(
Restrictions.and(
Restrictions.ge("startDate", inclusiveStartDate.getTime()),
Restrictions.le("startDate", inclusiveEndDate.getTime())),
Restrictions.and(
Restrictions.ge("endDate", inclusiveStartDate.getTime()),
Restrictions.le("endDate", inclusiveEndDate.getTime()))
));
return hibernate.findByCriteria(criteria);
}
/**
* @see org.jenkins.plugins.dbaudit.data.BuildDetailsRepository#getBuildDetailsByDuration(long)
*/
@SuppressWarnings("unchecked")
@Override
public List<BuildDetails> getBuildDetailsByDurationRange(final long min, final long max) {
final DetachedCriteria criteria = DetachedCriteria.forClass(BuildDetails.class);
// we need this funny-looking complex criteria because the
// semantics of the 'between' criteria can vary across
// db providers and we want a predictable inclusive behaviour.
criteria.add(
Restrictions.and(
Restrictions.ge("duration", min),
Restrictions.le("duration", max)
));
return hibernate.findByCriteria(criteria);
}
/**
* @see org.jenkins.plugins.dbaudit.data.BuildDetailsRepository#getBuildDetailsByUserId(java.lang.String)
*/
@SuppressWarnings("unchecked")
@Override
public List<BuildDetails> getBuildDetailsByUserId(final String userId) {
final DetachedCriteria criteria = DetachedCriteria.forClass(BuildDetails.class);
criteria.add(Restrictions.ilike("userId", userId, MatchMode.EXACT));
return hibernate.findByCriteria(criteria);
}
/**
* @see org.jenkins.plugins.dbaudit.data.BuildDetailsRepository#getBuildDetailsByUserName(java.lang.String)
*/
@SuppressWarnings("unchecked")
@Override
public List<BuildDetails> getBuildDetailsByUserName(final String userName) {
final DetachedCriteria criteria = DetachedCriteria.forClass(BuildDetails.class);
criteria.add(Restrictions.ilike("userName", userName, MatchMode.EXACT));
return hibernate.findByCriteria(criteria);
}
/**
* @see org.jenkins.plugins.dbaudit.data.BuildDetailsRepository#updateBuildDetails(org.jenkins.plugins.dbaudit.model.BuildDetails)
*/
@Override
public void updateBuildDetails(final BuildDetails details) {
if (null == details) {
throw new IllegalArgumentException("Invalid build details: cannot be null.");
}
hibernate.update(details);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
22bbd1504636fbd3b352472375434a4a30ce98fd | d7bc2cfbb59f23382b1fb394f4256931a11fdd9f | /src/main/java/frc/robot/commands/AutonomousDriveForward.java | ce09f55f5d9b2add4748ac8e94481c4b7e79fd90 | [] | no_license | TrinityTrihawks/2019 | f1744f2d6762edc3700649027931c80496273b19 | 57b51970072f98cb47c4b0e4478ae0e0cf482026 | refs/heads/master | 2020-04-15T19:26:31.284238 | 2019-08-11T18:15:02 | 2019-08-11T18:15:02 | 164,949,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,276 | java | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.commands;
import edu.wpi.first.wpilibj.command.Command;
import frc.robot.subsystems.Drivetrain;
/**
* An example command. You can replace me with your own command.
*/
public class AutonomousDriveForward extends Command {
private final Drivetrain drivetrain;
double targetDistance;
public AutonomousDriveForward(Drivetrain drivetrain, double targetDistance) {
this.drivetrain = drivetrain;
// Use requires() here to declare subsystem dependencies
requires(this.drivetrain);
this.targetDistance = targetDistance;
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
drivetrain.Drive(0.5, 0.5);
System.out.println("Drive forward command starting");
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
double leftEncoder = drivetrain.getLeftDistance();
double rightEncoder = drivetrain.getRightDistance();
System.out.println("Left Encoder: "+ leftEncoder);
System.out.println("Right encoder: "+ rightEncoder);
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
double leftDistance = drivetrain.getLeftDistance();
// double rightDistance = Robot.drivetrain.getRightDistance();
if(leftDistance >= targetDistance) {
return true;
} else {
return false;
}
}
// Called once after isFinished returns true
@Override
protected void end() {
drivetrain.Drive(0, 0);
System.out.println("Drive forward ended");
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
end();
}
}
| [
"cqnykamp@gmail.com"
] | cqnykamp@gmail.com |
58766f91f2ce7b3d497a049545df324e9670db7c | 2b9e1ecdbb579232353329d141730744f3191757 | /seckill/src/main/Java/org/seckill/dto/SeckillExecution.java | 120096c10bbf65a3e1c9067489cf864783cff554 | [] | no_license | Horace-Y/seckill | cd3b5b10e0c54849624b8212fb126a4ede131540 | 5a9a10938de6f97953919b06a570b0139174fbb8 | refs/heads/master | 2022-12-22T04:49:41.341186 | 2022-11-16T03:03:10 | 2022-11-16T03:03:10 | 206,449,786 | 1 | 0 | null | 2022-12-10T05:41:22 | 2019-09-05T01:38:43 | Java | UTF-8 | Java | false | false | 1,889 | java | package org.seckill.dto;
import org.seckill.entity.SuccessKilled;
import org.seckill.enums.SeckillStatEnum;
/**
* 封装秒杀执行后结果
*/
public class SeckillExecution {
private long seckillId;
//秒杀执行结果状态
private int state;
//状态标识
private String stateInfo;
//秒杀成功对象
private SuccessKilled successKilled;
@Override
public String toString() {
return "SeckillExecution{" +
"seckillId=" + seckillId +
", state=" + state +
", stateInfo='" + stateInfo + '\'' +
", successKilled=" + successKilled +
'}';
}
public SeckillExecution(long seckillId, SeckillStatEnum statEnum, SuccessKilled successKilled) {
this.seckillId = seckillId;
this.state = statEnum.getState();
this.stateInfo = statEnum.getStateInfo();
this.successKilled = successKilled;
}
public SeckillExecution(long seckillId, SeckillStatEnum statEnum) {
this.seckillId = seckillId;
this.state = statEnum.getState();
this.stateInfo = statEnum.getStateInfo();
}
public long getSeckillId() {
return seckillId;
}
public void setSeckillId(long seckillId) {
this.seckillId = seckillId;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public String getStateInfo() {
return stateInfo;
}
public void setStateInfo(String stateInfo) {
this.stateInfo = stateInfo;
}
public SuccessKilled getSuccessKilled() {
return successKilled;
}
public void setSuccessKilled(SuccessKilled successKilled) {
this.successKilled = successKilled;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
8443b18fb6b641e0b2d0491c8b1685959ad58d01 | 96a4ad24e2a9887b2982b23a77ac603115939a54 | /src/main/java/com/EcommerceApp/Entity/Cart.java | 5b6770e056267d7e0f91380cbe20a0b6a6f6004d | [] | no_license | tech2praveen/EcommerceAssignment | 206ff329551432ab0281ace780abb2185ff46043 | 21a177f97a4d5d0ceac0d6ba1c280a67cb308338 | refs/heads/master | 2020-03-18T06:04:21.865263 | 2018-05-22T07:07:47 | 2018-05-22T07:07:47 | 134,374,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,479 | java | package com.EcommerceApp.Entity;
public class Cart {
private int cartID;
//private int userID;
private int prodDetailsID;
private int quantity;
private int productID;
private int totalPrice;
private int catID;
public int getCatID() {
return catID;
}
public void setCatID(int catID) {
this.catID = catID;
}
public Cart(int catID,int productID,int prodDetailsID,int quantity) {
super();
this.catID=catID;
this.quantity = quantity;
this.productID = productID;
this.prodDetailsID = prodDetailsID;
}
public void setProdDetailsID(int prodDetailsID) {
this.prodDetailsID = prodDetailsID;
}
public int getCartID() {
return cartID;
}
public void setCartID(int cartID) {
this.cartID = cartID;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public int getProductID() {
return productID;
}
public void setProductID(int productID) {
this.productID = productID;
}
public int getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(int totalPrice) {
this.totalPrice = totalPrice;
}
public int getProdDetailsID() {
return prodDetailsID;
}
@Override
public String toString() {
return "Cart [cartID=" + cartID + ", prodDetailsID=" + prodDetailsID + ", quantity=" + quantity + ", productID="
+ productID + ", totalPrice=" + totalPrice + "]";
}
}
| [
"Praveen Kumar@DESKTOP-LHIOIOQ"
] | Praveen Kumar@DESKTOP-LHIOIOQ |
377c071970bd0460a754055b8d45898a93a1dc80 | 7bb47b5609f78adac66751cac756a4737a7bbeb4 | /src/main/java/trulden/com/vk/KanbanModel/model/ScenarioResults.java | 9d36724fc2c430463232767175a8788cf99ecc37 | [] | no_license | kirillsmirnov1/KanbanModel | 612f2e9505b7e91d4646dac4d5d892f88ab40bed | 05529a2e11f3f34f42a157c78e18e2a8c526d765 | refs/heads/master | 2023-04-27T15:25:23.693286 | 2019-04-03T08:54:29 | 2019-04-03T08:54:29 | 159,684,509 | 0 | 0 | null | 2023-04-14T17:47:05 | 2018-11-29T15:08:37 | Java | UTF-8 | Java | false | false | 2,085 | java | package trulden.com.vk.KanbanModel.model;
// Результаты выполнения сценария
public class ScenarioResults {
// Время тасок на доске
private double leadTime;
// Время тасок на рабочих стадиях
private double cycleTime;
// Количество завершенных задач
private double tasksFinished;
// Количество прогонов сценария
private final int numberOfRuns;
// Конструктор для однократного прогона
ScenarioResults(double leadTime, double cycleTime, int tasksFinished){
this.leadTime = leadTime;
this.cycleTime = cycleTime;
this.tasksFinished = tasksFinished;
numberOfRuns = 1;
}
// Конструктор для многократного прогона
public ScenarioResults(int numberOfRuns){
this.numberOfRuns = numberOfRuns;
leadTime = 0d;
cycleTime = 0d;
tasksFinished = 0d;
}
// Добавить результат одного прогона к общему усредненному результату
public void addResult(double leadTime, double cycleTime, int tasksFinished){
this.leadTime += findFraction(leadTime);
this.cycleTime += findFraction(cycleTime);
this.tasksFinished += findFraction(tasksFinished);
}
// Нахожу пропорцию числа для добавления к усредненному
private double findFraction(double number){
return number / (1d * numberOfRuns);
}
public double getLeadTime() {
return leadTime;
}
public double getCycleTime() {
return cycleTime;
}
public double getTasksFinished() {
return tasksFinished;
}
public int getNumberOfRuns() {
return numberOfRuns;
}
public void addResult(ScenarioResults result) {
addResult(result.getLeadTime(), result.getCycleTime(), (int)result.getTasksFinished());
}
}
| [
"thegaldren@gmail.com"
] | thegaldren@gmail.com |
978c165199ac6ff45f9d54d1fbd3b5bbc3ee0de5 | cef5f5dc0af9135f195576d3088cc544fd863125 | /src/telran_20190402/management/stateconstants/StateConstante.java | 25ac14d2b65631fc385fd80c8cd9f1934f517643 | [] | no_license | OVasilena/telran-java | ae3a38028e6d2932175269e469dcde96c3ec832e | a84c74f013425cb42c04edb7189b8ed4029cb72a | refs/heads/master | 2020-05-03T16:34:00.114002 | 2019-07-04T18:34:47 | 2019-07-04T18:34:47 | 178,725,514 | 0 | 1 | null | 2019-07-06T09:34:47 | 2019-03-31T18:21:24 | Java | UTF-8 | Java | false | false | 132 | java | package telran_20190402.management.stateconstants;
public class StateConstante {
public static final double MIN_WAGE = 9.20;
}
| [
"o.podlubnaja@hirschtec.eu"
] | o.podlubnaja@hirschtec.eu |
26b0ba8fa5fdd3fa39e06b35a925d1eda6080c76 | 95e7862b0b0a3dd88b703703433da2627c598427 | /src/main/java/com/example/springboot/ad/model/security/UserAuthentication.java | dfd12c63e6f6ac0567f2ba9a20703e7eebe0cbf0 | [
"MIT"
] | permissive | vijay358/spring-boot-test-ad | 13785bc41f82ecbae4050fd429bb93d7ed2e4be1 | 84be1ecb4c2381af153edd1f20cb38fb9088d687 | refs/heads/master | 2020-04-12T04:16:08.949843 | 2016-05-23T04:28:19 | 2016-05-23T04:28:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | package com.example.springboot.ad.model.security;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;
public class UserAuthentication implements Authentication {
private final UserDetails userDetails;
private boolean authenticated = true;
public UserAuthentication(UserDetails userDetails) {
this.userDetails = userDetails;
}
@Override
public String getName() {
return userDetails.getUsername();
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return userDetails.getAuthorities();
}
@Override
public Object getCredentials() {
return userDetails.getPassword();
}
@Override
public UserDetails getDetails() {
return userDetails;
}
@Override
public Object getPrincipal() {
return userDetails.getUsername();
}
@Override
public boolean isAuthenticated() {
return authenticated;
}
@Override
public void setAuthenticated(boolean authenticated) {
this.authenticated = authenticated;
}
}
| [
"prateek.nayak1708@gmail.com"
] | prateek.nayak1708@gmail.com |
20bf96b5416c90a98fdf2332ca2e5d87983b60c3 | d205d578bf5c7173dd6ad663f497d57f9b0fdd87 | /src/ru/shunt/guapschedule/schedulechanger/Changer.java | 5da2bc66499e0dcb40e4649eebea7924f1d9fa33 | [] | no_license | Shunt22/Guap-Schedule | d1074e645a9df29acf18cb79b923f016494ee07d | ca20869126e44a7dcb3ccfc8bf2ae04c25774ee3 | refs/heads/master | 2021-04-12T12:26:52.678089 | 2018-03-21T18:52:07 | 2018-03-21T18:52:07 | 126,224,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,327 | java | package ru.shunt.guapschedule.schedulechanger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.joda.time.DateTime;
import ru.shunt.guapschedule.day.ShowStudy;
import ru.shunt.guapschedule.main.MainFragment;
import ru.shunt.guapschedule.main.Preference;
import ru.shunt.guapschedule.mainobjects.Study;
import ru.shunt.guapschedule.mainobjects.Study.STUDYTYPE;
import ru.shunt.guapschedule.mainobjects.Study.STUDYWEEK;
import ru.shunt.guapschedule.regular.ScheduleParser.WEEK;
import ru.shunt.guapschedule.sdworker.SdWorker;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import com.shunt.guapschedule.R;
public class Changer extends Fragment {
private String groupName;
private Spinner daysSpinner;
private Spinner studyTypeSpinner;
private Spinner weekTypeSpinner;
private Spinner studyIdSpinner;
private EditText studyName;
private EditText room;
private WEEK week;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View viewHierarchy = inflater.inflate(R.layout.act_changer_main, container, false);
groupName = getGroupName();
if (groupName == null) {
Toast.makeText(getActivity().getApplicationContext(), "Выберите группу!", Toast.LENGTH_SHORT).show();
getFragmentManager().beginTransaction().replace(R.id.content_frame, new Preference()).commit();
} else {
daysSpinner = (Spinner) viewHierarchy.findViewById(R.id.changerDaySpinner);
studyTypeSpinner = (Spinner) viewHierarchy.findViewById(R.id.changerTypeSpinner);
studyName = (EditText) viewHierarchy.findViewById(R.id.changerStudyNameEdit);
room = (EditText) viewHierarchy.findViewById(R.id.changerStudyRoomEdit);
weekTypeSpinner = (Spinner) viewHierarchy.findViewById(R.id.changerWeekSpinner);
studyIdSpinner = (Spinner) viewHierarchy.findViewById(R.id.changerStudyIdSpinner);
Resources res = getResources();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), R.layout.others_row,
res.getStringArray(R.array.days));
adapter.setDropDownViewResource(R.layout.others_row);
daysSpinner.setAdapter(adapter);
ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(getActivity(), R.layout.others_row,
res.getStringArray(R.array.studyTypes));
adapter1.setDropDownViewResource(R.layout.others_row);
studyTypeSpinner.setAdapter(adapter1);
ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(getActivity(), R.layout.others_row,
res.getStringArray(R.array.weeks));
adapter2.setDropDownViewResource(R.layout.others_row);
weekTypeSpinner.setAdapter(adapter2);
ArrayAdapter<String> adapter3 = new ArrayAdapter<String>(getActivity(), R.layout.others_row,
new ArrayList<String>(Arrays.asList("1", "2", "3", "4", "5", "6", "7", "8")));
adapter3.setDropDownViewResource(R.layout.others_row);
studyIdSpinner.setAdapter(adapter3);
Button saveButton = (Button) viewHierarchy.findViewById(R.id.changerSaveButton);
saveButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getData();
}
});
}
return viewHierarchy;
}
private String getGroupName() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
return prefs.getString("mainGroup", null);
}
private boolean contains(List<? extends Study> list, Study study) {
int studyId = study.getNumber();
STUDYWEEK week = study.getWeekType();
for (Study studyFromList : list) {
if (studyFromList.getNumber() == studyId) {
if (week.equals(STUDYWEEK.BOTH)
&& (studyFromList.getWeekType().equals(STUDYWEEK.UP) || studyFromList.getWeekType().equals(
STUDYWEEK.DN))) {
return true;
} else if ((week.equals(STUDYWEEK.UP) || week.equals(STUDYWEEK.DN)
&& studyFromList.getWeekType().equals(STUDYWEEK.BOTH))) {
return true;
} else {
if (studyFromList.getWeekType().equals(week)) {
return true;
}
}
}
}
return false;
}
private void changeSchedule(Map<Integer, List<Study>> mapToChange, Study study) {
}
private void change(Study study) {
if (week == WEEK.BOTH) {
Map<Integer, List<Study>> studiesMapWeek = new SdWorker().readGroupFile(groupName, WEEK.EVEN);
List<Study> studiesListWeek = studiesMapWeek.get(daysSpinner.getSelectedItemPosition());
if (studiesListWeek == null) {
studiesListWeek = new ArrayList<Study>();
studiesMapWeek.put(daysSpinner.getSelectedItemPosition(), studiesListWeek);
}
if (!contains(studiesListWeek, study)) {
studiesListWeek.add(study);
} else {
error();
return;
}
Collections.sort(studiesListWeek);
new SdWorker().writeGroupFile(groupName, studiesMapWeek, WEEK.EVEN);
studiesMapWeek = new SdWorker().readGroupFile(groupName, WEEK.ODD);
studiesListWeek = studiesMapWeek.get(daysSpinner.getSelectedItemPosition());
if (studiesListWeek == null) {
studiesListWeek = new ArrayList<Study>();
studiesMapWeek.put(daysSpinner.getSelectedItemPosition(), studiesListWeek);
}
if (!contains(studiesListWeek, study)) {
studiesListWeek.add(study);
} else {
error();
return;
}
Collections.sort(studiesListWeek);
new SdWorker().writeGroupFile(groupName, studiesMapWeek, WEEK.ODD);
studiesMapWeek = new SdWorker().readGroupFile(groupName, WEEK.BOTH);
studiesListWeek = studiesMapWeek.get(daysSpinner.getSelectedItemPosition());
if (studiesListWeek == null) {
studiesListWeek = new ArrayList<Study>();
studiesMapWeek.put(daysSpinner.getSelectedItemPosition(), studiesListWeek);
}
if (!contains(studiesListWeek, study)) {
studiesListWeek.add(study);
} else {
error();
return;
}
Collections.sort(studiesListWeek);
new SdWorker().writeGroupFile(groupName, studiesMapWeek, WEEK.BOTH);
saveCompleted();
} else {
Map<Integer, List<Study>> studiesMapWeek = new SdWorker().readGroupFile(groupName, week);
List<Study> studiesListWeek = studiesMapWeek.get(daysSpinner.getSelectedItemPosition());
if (studiesListWeek == null) {
studiesListWeek = new ArrayList<Study>();
studiesMapWeek.put(daysSpinner.getSelectedItemPosition(), studiesListWeek);
}
if (!contains(studiesListWeek, study)) {
studiesListWeek.add(study);
} else {
error();
return;
}
Collections.sort(studiesListWeek);
new SdWorker().writeGroupFile(groupName, studiesMapWeek, week);
/*
* BOTH week file here
*/
Map<Integer, List<Study>> studiesMap = new SdWorker().readGroupFile(groupName, WEEK.BOTH);
List<Study> studiesList = studiesMap.get(daysSpinner.getSelectedItemPosition());
if (studiesList == null) {
studiesList = new ArrayList<Study>();
studiesMap.put(daysSpinner.getSelectedItemPosition(), studiesList);
}
if (!contains(studiesList, study)) {
studiesList.add(study);
} else {
error();
return;
}
Collections.sort(studiesList);
new SdWorker().writeGroupFile(groupName, studiesMap, WEEK.BOTH);
saveCompleted();
}
}
private void saveCompleted() {
FragmentManager fragmentManager = getFragmentManager();
Fragment fragment = new MainFragment();
fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
}
private void error() {
Toast.makeText(getActivity(), "Такая пара уже существует!", Toast.LENGTH_SHORT).show();
}
private void getData() {
DateTime timeStart = new DateTime();
DateTime timeFinish = new DateTime();
switch (studyIdSpinner.getSelectedItemPosition()) {
case 0:
timeStart = timeStart.hourOfDay().setCopy(9).minuteOfHour().setCopy(0);
timeFinish = timeFinish.hourOfDay().setCopy(10).minuteOfHour().setCopy(30);
break;
case 1:
timeStart = timeStart.hourOfDay().setCopy(10).minuteOfHour().setCopy(40);
timeFinish = timeFinish.hourOfDay().setCopy(12).minuteOfHour().setCopy(10);
break;
case 2:
timeStart = timeStart.hourOfDay().setCopy(12).minuteOfHour().setCopy(20);
timeFinish = timeFinish.hourOfDay().setCopy(13).minuteOfHour().setCopy(50);
break;
case 3:
timeStart = timeStart.hourOfDay().setCopy(14).minuteOfHour().setCopy(10);
timeFinish = timeFinish.hourOfDay().setCopy(15).minuteOfHour().setCopy(40);
break;
case 4:
timeStart = timeStart.hourOfDay().setCopy(15).minuteOfHour().setCopy(50);
timeFinish = timeFinish.hourOfDay().setCopy(17).minuteOfHour().setCopy(20);
break;
case 5:
timeStart = timeStart.hourOfDay().setCopy(17).minuteOfHour().setCopy(30);
timeFinish = timeFinish.hourOfDay().setCopy(19).minuteOfHour().setCopy(0);
break;
case 6:
timeStart = timeStart.hourOfDay().setCopy(19).minuteOfHour().setCopy(10);
timeFinish = timeFinish.hourOfDay().setCopy(20).minuteOfHour().setCopy(30);
break;
case 7:
timeStart = timeStart.hourOfDay().setCopy(20).minuteOfHour().setCopy(40);
timeFinish = timeFinish.hourOfDay().setCopy(22).minuteOfHour().setCopy(0);
break;
}
timeStart = timeStart.secondOfMinute().setCopy(0).millisOfSecond().setCopy(0);
timeFinish = timeFinish.secondOfMinute().setCopy(0).millisOfSecond().setCopy(0);
Study study = new Study(String.valueOf(studyIdSpinner.getSelectedItemPosition() + 1), timeStart, timeFinish);
study.setType(STUDYTYPE.forName((String) studyTypeSpinner.getSelectedItem()));
switch (weekTypeSpinner.getSelectedItemPosition()) {
case 0:
week = WEEK.ODD;
study.setWeekType(STUDYWEEK.UP);
break;
case 1:
week = WEEK.EVEN;
study.setWeekType(STUDYWEEK.DN);
break;
default:
week = WEEK.BOTH;
study.setWeekType(STUDYWEEK.BOTH);
break;
}
study.setName(studyName.getText().toString());
study.setRoom(room.getText().toString());
change(study);
}
}
| [
"shunt22@mail.ru"
] | shunt22@mail.ru |
69eef17a1f9f6358b657e1905a9e2b8f16a0b9a7 | b0774f084418cf3ec535a5b1fcd1df79bd61a0ae | /SgoliberControl1/app/src/test/java/com/example/sgolibercontrol1/ExampleUnitTest.java | 9e48026ed1d96841973b1ce52bc661b482a48863 | [] | no_license | R4f4Lc/HLCAndroid2Daw | 4bae7d784b5ae6904960a59f60833b921c7e3a1f | 1f7abbfd47841b5708d74a1da367c05e4b89b0dc | refs/heads/master | 2021-03-11T17:46:24.861143 | 2020-03-11T11:04:51 | 2020-03-11T11:04:51 | 246,548,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.example.sgolibercontrol1;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"rafalc329@gmail.com"
] | rafalc329@gmail.com |
ff465121276415a7998db8dab190d471c4289e09 | 6ef4869c6bc2ce2e77b422242e347819f6a5f665 | /devices/google/Pixel 2/29/QPP6.190730.005/src/framework/android/graphics/drawable/DrawableContainer.java | 582f26b14e79f05c8529b88a5a3e3b0b51d28fc1 | [] | no_license | hacking-android/frameworks | 40e40396bb2edacccabf8a920fa5722b021fb060 | 943f0b4d46f72532a419fb6171e40d1c93984c8e | refs/heads/master | 2020-07-03T19:32:28.876703 | 2019-08-13T03:31:06 | 2019-08-13T03:31:06 | 202,017,534 | 2 | 0 | null | 2019-08-13T03:33:19 | 2019-08-12T22:19:30 | Java | UTF-8 | Java | false | false | 39,966 | java | /*
* Decompiled with CFR 0.145.
*/
package android.graphics.drawable;
import android.annotation.UnsupportedAppUsage;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Insets;
import android.graphics.Outline;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.SystemClock;
import android.util.SparseArray;
public class DrawableContainer
extends Drawable
implements Drawable.Callback {
private static final boolean DEBUG = false;
private static final boolean DEFAULT_DITHER = true;
private static final String TAG = "DrawableContainer";
private int mAlpha = 255;
private Runnable mAnimationRunnable;
private BlockInvalidateCallback mBlockInvalidateCallback;
private int mCurIndex = -1;
private Drawable mCurrDrawable;
@UnsupportedAppUsage
private DrawableContainerState mDrawableContainerState;
private long mEnterAnimationEnd;
private long mExitAnimationEnd;
private boolean mHasAlpha;
private Rect mHotspotBounds;
@UnsupportedAppUsage
private Drawable mLastDrawable;
private int mLastIndex = -1;
private boolean mMutated;
private void initializeDrawableForDisplay(Drawable drawable2) {
block10 : {
if (this.mBlockInvalidateCallback == null) {
this.mBlockInvalidateCallback = new BlockInvalidateCallback();
}
drawable2.setCallback(this.mBlockInvalidateCallback.wrap(drawable2.getCallback()));
if (this.mDrawableContainerState.mEnterFadeDuration <= 0 && this.mHasAlpha) {
drawable2.setAlpha(this.mAlpha);
}
if (this.mDrawableContainerState.mHasColorFilter) {
drawable2.setColorFilter(this.mDrawableContainerState.mColorFilter);
} else {
if (this.mDrawableContainerState.mHasTintList) {
drawable2.setTintList(this.mDrawableContainerState.mTintList);
}
if (this.mDrawableContainerState.mHasTintMode) {
drawable2.setTintBlendMode(this.mDrawableContainerState.mBlendMode);
}
}
drawable2.setVisible(this.isVisible(), true);
drawable2.setDither(this.mDrawableContainerState.mDither);
drawable2.setState(this.getState());
drawable2.setLevel(this.getLevel());
drawable2.setBounds(this.getBounds());
drawable2.setLayoutDirection(this.getLayoutDirection());
drawable2.setAutoMirrored(this.mDrawableContainerState.mAutoMirrored);
Rect rect = this.mHotspotBounds;
if (rect == null) break block10;
drawable2.setHotspotBounds(rect.left, rect.top, rect.right, rect.bottom);
}
return;
finally {
drawable2.setCallback(this.mBlockInvalidateCallback.unwrap());
}
}
private boolean needsMirroring() {
boolean bl = this.isAutoMirrored();
boolean bl2 = true;
if (!bl || this.getLayoutDirection() != 1) {
bl2 = false;
}
return bl2;
}
void animate(boolean bl) {
int n;
long l;
this.mHasAlpha = true;
long l2 = SystemClock.uptimeMillis();
int n2 = 0;
Drawable drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
l = this.mEnterAnimationEnd;
n = n2;
if (l != 0L) {
if (l <= l2) {
drawable2.setAlpha(this.mAlpha);
this.mEnterAnimationEnd = 0L;
n = n2;
} else {
n = (int)((l - l2) * 255L) / this.mDrawableContainerState.mEnterFadeDuration;
this.mCurrDrawable.setAlpha((255 - n) * this.mAlpha / 255);
n = 1;
}
}
} else {
this.mEnterAnimationEnd = 0L;
n = n2;
}
if ((drawable2 = this.mLastDrawable) != null) {
l = this.mExitAnimationEnd;
n2 = n;
if (l != 0L) {
if (l <= l2) {
drawable2.setVisible(false, false);
this.mLastDrawable = null;
this.mLastIndex = -1;
this.mExitAnimationEnd = 0L;
n2 = n;
} else {
n = (int)((l - l2) * 255L) / this.mDrawableContainerState.mExitFadeDuration;
this.mLastDrawable.setAlpha(this.mAlpha * n / 255);
n2 = 1;
}
}
} else {
this.mExitAnimationEnd = 0L;
n2 = n;
}
if (bl && n2 != 0) {
this.scheduleSelf(this.mAnimationRunnable, 16L + l2);
}
}
@Override
public void applyTheme(Resources.Theme theme) {
this.mDrawableContainerState.applyTheme(theme);
}
@Override
public boolean canApplyTheme() {
return this.mDrawableContainerState.canApplyTheme();
}
@Override
public void clearMutated() {
super.clearMutated();
this.mDrawableContainerState.clearMutated();
this.mMutated = false;
}
DrawableContainerState cloneConstantState() {
return this.mDrawableContainerState;
}
@Override
public void draw(Canvas canvas) {
Drawable drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
drawable2.draw(canvas);
}
if ((drawable2 = this.mLastDrawable) != null) {
drawable2.draw(canvas);
}
}
@Override
public int getAlpha() {
return this.mAlpha;
}
@Override
public int getChangingConfigurations() {
return super.getChangingConfigurations() | this.mDrawableContainerState.getChangingConfigurations();
}
@Override
public Drawable.ConstantState getConstantState() {
if (this.mDrawableContainerState.canConstantState()) {
this.mDrawableContainerState.mChangingConfigurations = this.getChangingConfigurations();
return this.mDrawableContainerState;
}
return null;
}
@Override
public Drawable getCurrent() {
return this.mCurrDrawable;
}
public int getCurrentIndex() {
return this.mCurIndex;
}
@Override
public void getHotspotBounds(Rect rect) {
Rect rect2 = this.mHotspotBounds;
if (rect2 != null) {
rect.set(rect2);
} else {
super.getHotspotBounds(rect);
}
}
@Override
public int getIntrinsicHeight() {
if (this.mDrawableContainerState.isConstantSize()) {
return this.mDrawableContainerState.getConstantHeight();
}
Drawable drawable2 = this.mCurrDrawable;
int n = drawable2 != null ? drawable2.getIntrinsicHeight() : -1;
return n;
}
@Override
public int getIntrinsicWidth() {
if (this.mDrawableContainerState.isConstantSize()) {
return this.mDrawableContainerState.getConstantWidth();
}
Drawable drawable2 = this.mCurrDrawable;
int n = drawable2 != null ? drawable2.getIntrinsicWidth() : -1;
return n;
}
@Override
public int getMinimumHeight() {
if (this.mDrawableContainerState.isConstantSize()) {
return this.mDrawableContainerState.getConstantMinimumHeight();
}
Drawable drawable2 = this.mCurrDrawable;
int n = drawable2 != null ? drawable2.getMinimumHeight() : 0;
return n;
}
@Override
public int getMinimumWidth() {
if (this.mDrawableContainerState.isConstantSize()) {
return this.mDrawableContainerState.getConstantMinimumWidth();
}
Drawable drawable2 = this.mCurrDrawable;
int n = drawable2 != null ? drawable2.getMinimumWidth() : 0;
return n;
}
@Override
public int getOpacity() {
Drawable drawable2 = this.mCurrDrawable;
int n = drawable2 != null && drawable2.isVisible() ? this.mDrawableContainerState.getOpacity() : -2;
return n;
}
@Override
public Insets getOpticalInsets() {
Drawable drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
return drawable2.getOpticalInsets();
}
return Insets.NONE;
}
@Override
public void getOutline(Outline outline) {
Drawable drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
drawable2.getOutline(outline);
}
}
@Override
public boolean getPadding(Rect rect) {
boolean bl;
Object object = this.mDrawableContainerState.getConstantPadding();
if (object != null) {
rect.set((Rect)object);
bl = (((Rect)object).left | ((Rect)object).top | ((Rect)object).bottom | ((Rect)object).right) != 0;
} else {
object = this.mCurrDrawable;
bl = object != null ? ((Drawable)object).getPadding(rect) : super.getPadding(rect);
}
if (this.needsMirroring()) {
int n = rect.left;
rect.left = rect.right;
rect.right = n;
}
return bl;
}
@Override
public boolean hasFocusStateSpecified() {
Drawable drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
return drawable2.hasFocusStateSpecified();
}
drawable2 = this.mLastDrawable;
if (drawable2 != null) {
return drawable2.hasFocusStateSpecified();
}
return false;
}
@Override
public void invalidateDrawable(Drawable drawable2) {
DrawableContainerState drawableContainerState = this.mDrawableContainerState;
if (drawableContainerState != null) {
drawableContainerState.invalidateCache();
}
if (drawable2 == this.mCurrDrawable && this.getCallback() != null) {
this.getCallback().invalidateDrawable(this);
}
}
@Override
public boolean isAutoMirrored() {
return this.mDrawableContainerState.mAutoMirrored;
}
@Override
public boolean isStateful() {
return this.mDrawableContainerState.isStateful();
}
@Override
public void jumpToCurrentState() {
boolean bl = false;
Drawable drawable2 = this.mLastDrawable;
if (drawable2 != null) {
drawable2.jumpToCurrentState();
this.mLastDrawable = null;
this.mLastIndex = -1;
bl = true;
}
if ((drawable2 = this.mCurrDrawable) != null) {
drawable2.jumpToCurrentState();
if (this.mHasAlpha) {
this.mCurrDrawable.setAlpha(this.mAlpha);
}
}
if (this.mExitAnimationEnd != 0L) {
this.mExitAnimationEnd = 0L;
bl = true;
}
if (this.mEnterAnimationEnd != 0L) {
this.mEnterAnimationEnd = 0L;
bl = true;
}
if (bl) {
this.invalidateSelf();
}
}
@Override
public Drawable mutate() {
if (!this.mMutated && super.mutate() == this) {
DrawableContainerState drawableContainerState = this.cloneConstantState();
drawableContainerState.mutate();
this.setConstantState(drawableContainerState);
this.mMutated = true;
}
return this;
}
@Override
protected void onBoundsChange(Rect rect) {
Drawable drawable2 = this.mLastDrawable;
if (drawable2 != null) {
drawable2.setBounds(rect);
}
if ((drawable2 = this.mCurrDrawable) != null) {
drawable2.setBounds(rect);
}
}
@Override
public boolean onLayoutDirectionChanged(int n) {
return this.mDrawableContainerState.setLayoutDirection(n, this.getCurrentIndex());
}
@Override
protected boolean onLevelChange(int n) {
Drawable drawable2 = this.mLastDrawable;
if (drawable2 != null) {
return drawable2.setLevel(n);
}
drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
return drawable2.setLevel(n);
}
return false;
}
@Override
protected boolean onStateChange(int[] arrn) {
Drawable drawable2 = this.mLastDrawable;
if (drawable2 != null) {
return drawable2.setState(arrn);
}
drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
return drawable2.setState(arrn);
}
return false;
}
@Override
public void scheduleDrawable(Drawable drawable2, Runnable runnable, long l) {
if (drawable2 == this.mCurrDrawable && this.getCallback() != null) {
this.getCallback().scheduleDrawable(this, runnable, l);
}
}
public boolean selectDrawable(int n) {
Object object;
if (n == this.mCurIndex) {
return false;
}
long l = SystemClock.uptimeMillis();
if (this.mDrawableContainerState.mExitFadeDuration > 0) {
object = this.mLastDrawable;
if (object != null) {
((Drawable)object).setVisible(false, false);
}
if ((object = this.mCurrDrawable) != null) {
this.mLastDrawable = object;
this.mLastIndex = this.mCurIndex;
this.mExitAnimationEnd = (long)this.mDrawableContainerState.mExitFadeDuration + l;
} else {
this.mLastDrawable = null;
this.mLastIndex = -1;
this.mExitAnimationEnd = 0L;
}
} else {
object = this.mCurrDrawable;
if (object != null) {
((Drawable)object).setVisible(false, false);
}
}
if (n >= 0 && n < this.mDrawableContainerState.mNumChildren) {
object = this.mDrawableContainerState.getChild(n);
this.mCurrDrawable = object;
this.mCurIndex = n;
if (object != null) {
if (this.mDrawableContainerState.mEnterFadeDuration > 0) {
this.mEnterAnimationEnd = (long)this.mDrawableContainerState.mEnterFadeDuration + l;
}
this.initializeDrawableForDisplay((Drawable)object);
}
} else {
this.mCurrDrawable = null;
this.mCurIndex = -1;
}
if (this.mEnterAnimationEnd != 0L || this.mExitAnimationEnd != 0L) {
object = this.mAnimationRunnable;
if (object == null) {
this.mAnimationRunnable = new Runnable(){
@Override
public void run() {
DrawableContainer.this.animate(true);
DrawableContainer.this.invalidateSelf();
}
};
} else {
this.unscheduleSelf((Runnable)object);
}
this.animate(true);
}
this.invalidateSelf();
return true;
}
@Override
public void setAlpha(int n) {
if (!this.mHasAlpha || this.mAlpha != n) {
this.mHasAlpha = true;
this.mAlpha = n;
Drawable drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
if (this.mEnterAnimationEnd == 0L) {
drawable2.setAlpha(n);
} else {
this.animate(false);
}
}
}
}
@Override
public void setAutoMirrored(boolean bl) {
if (this.mDrawableContainerState.mAutoMirrored != bl) {
DrawableContainerState drawableContainerState = this.mDrawableContainerState;
drawableContainerState.mAutoMirrored = bl;
Drawable drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
drawable2.setAutoMirrored(drawableContainerState.mAutoMirrored);
}
}
}
@Override
public void setColorFilter(ColorFilter colorFilter) {
Object object = this.mDrawableContainerState;
((DrawableContainerState)object).mHasColorFilter = true;
if (((DrawableContainerState)object).mColorFilter != colorFilter) {
this.mDrawableContainerState.mColorFilter = colorFilter;
object = this.mCurrDrawable;
if (object != null) {
((Drawable)object).setColorFilter(colorFilter);
}
}
}
protected void setConstantState(DrawableContainerState object) {
this.mDrawableContainerState = object;
int n = this.mCurIndex;
if (n >= 0) {
this.mCurrDrawable = ((DrawableContainerState)object).getChild(n);
object = this.mCurrDrawable;
if (object != null) {
this.initializeDrawableForDisplay((Drawable)object);
}
}
this.mLastIndex = -1;
this.mLastDrawable = null;
}
public void setCurrentIndex(int n) {
this.selectDrawable(n);
}
@Override
public void setDither(boolean bl) {
if (this.mDrawableContainerState.mDither != bl) {
DrawableContainerState drawableContainerState = this.mDrawableContainerState;
drawableContainerState.mDither = bl;
Drawable drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
drawable2.setDither(drawableContainerState.mDither);
}
}
}
public void setEnterFadeDuration(int n) {
this.mDrawableContainerState.mEnterFadeDuration = n;
}
public void setExitFadeDuration(int n) {
this.mDrawableContainerState.mExitFadeDuration = n;
}
@Override
public void setHotspot(float f, float f2) {
Drawable drawable2 = this.mCurrDrawable;
if (drawable2 != null) {
drawable2.setHotspot(f, f2);
}
}
@Override
public void setHotspotBounds(int n, int n2, int n3, int n4) {
Object object = this.mHotspotBounds;
if (object == null) {
this.mHotspotBounds = new Rect(n, n2, n3, n4);
} else {
((Rect)object).set(n, n2, n3, n4);
}
object = this.mCurrDrawable;
if (object != null) {
((Drawable)object).setHotspotBounds(n, n2, n3, n4);
}
}
@Override
public void setTintBlendMode(BlendMode blendMode) {
Object object = this.mDrawableContainerState;
((DrawableContainerState)object).mHasTintMode = true;
if (((DrawableContainerState)object).mBlendMode != blendMode) {
this.mDrawableContainerState.mBlendMode = blendMode;
object = this.mCurrDrawable;
if (object != null) {
((Drawable)object).setTintBlendMode(blendMode);
}
}
}
@Override
public void setTintList(ColorStateList colorStateList) {
Object object = this.mDrawableContainerState;
((DrawableContainerState)object).mHasTintList = true;
if (((DrawableContainerState)object).mTintList != colorStateList) {
this.mDrawableContainerState.mTintList = colorStateList;
object = this.mCurrDrawable;
if (object != null) {
((Drawable)object).setTintList(colorStateList);
}
}
}
@Override
public boolean setVisible(boolean bl, boolean bl2) {
boolean bl3 = super.setVisible(bl, bl2);
Drawable drawable2 = this.mLastDrawable;
if (drawable2 != null) {
drawable2.setVisible(bl, bl2);
}
if ((drawable2 = this.mCurrDrawable) != null) {
drawable2.setVisible(bl, bl2);
}
return bl3;
}
@Override
public void unscheduleDrawable(Drawable drawable2, Runnable runnable) {
if (drawable2 == this.mCurrDrawable && this.getCallback() != null) {
this.getCallback().unscheduleDrawable(this, runnable);
}
}
protected final void updateDensity(Resources resources) {
this.mDrawableContainerState.updateDensity(resources);
}
private static class BlockInvalidateCallback
implements Drawable.Callback {
private Drawable.Callback mCallback;
private BlockInvalidateCallback() {
}
@Override
public void invalidateDrawable(Drawable drawable2) {
}
@Override
public void scheduleDrawable(Drawable drawable2, Runnable runnable, long l) {
Drawable.Callback callback = this.mCallback;
if (callback != null) {
callback.scheduleDrawable(drawable2, runnable, l);
}
}
@Override
public void unscheduleDrawable(Drawable drawable2, Runnable runnable) {
Drawable.Callback callback = this.mCallback;
if (callback != null) {
callback.unscheduleDrawable(drawable2, runnable);
}
}
public Drawable.Callback unwrap() {
Drawable.Callback callback = this.mCallback;
this.mCallback = null;
return callback;
}
public BlockInvalidateCallback wrap(Drawable.Callback callback) {
this.mCallback = callback;
return this;
}
}
public static abstract class DrawableContainerState
extends Drawable.ConstantState {
boolean mAutoMirrored;
BlendMode mBlendMode;
boolean mCanConstantState;
int mChangingConfigurations;
boolean mCheckedConstantSize;
boolean mCheckedConstantState;
boolean mCheckedOpacity;
boolean mCheckedPadding;
boolean mCheckedStateful;
int mChildrenChangingConfigurations;
ColorFilter mColorFilter;
int mConstantHeight;
int mConstantMinimumHeight;
int mConstantMinimumWidth;
@UnsupportedAppUsage
Rect mConstantPadding;
boolean mConstantSize = false;
int mConstantWidth;
int mDensity = 160;
boolean mDither = true;
SparseArray<Drawable.ConstantState> mDrawableFutures;
@UnsupportedAppUsage
Drawable[] mDrawables;
int mEnterFadeDuration = 0;
int mExitFadeDuration = 0;
@UnsupportedAppUsage
boolean mHasColorFilter;
boolean mHasTintList;
boolean mHasTintMode;
int mLayoutDirection;
boolean mMutated;
int mNumChildren;
int mOpacity;
final DrawableContainer mOwner;
Resources mSourceRes;
boolean mStateful;
ColorStateList mTintList;
boolean mVariablePadding = false;
@UnsupportedAppUsage(maxTargetSdk=28, trackingBug=115609023L)
protected DrawableContainerState(DrawableContainerState object, DrawableContainer object2, Resources resources) {
this.mOwner = object2;
object2 = resources != null ? resources : (object != null ? ((DrawableContainerState)object).mSourceRes : null);
this.mSourceRes = object2;
int n = object != null ? ((DrawableContainerState)object).mDensity : 0;
this.mDensity = Drawable.resolveDensity(resources, n);
if (object != null) {
this.mChangingConfigurations = ((DrawableContainerState)object).mChangingConfigurations;
this.mChildrenChangingConfigurations = ((DrawableContainerState)object).mChildrenChangingConfigurations;
this.mCheckedConstantState = true;
this.mCanConstantState = true;
this.mVariablePadding = ((DrawableContainerState)object).mVariablePadding;
this.mConstantSize = ((DrawableContainerState)object).mConstantSize;
this.mDither = ((DrawableContainerState)object).mDither;
this.mMutated = ((DrawableContainerState)object).mMutated;
this.mLayoutDirection = ((DrawableContainerState)object).mLayoutDirection;
this.mEnterFadeDuration = ((DrawableContainerState)object).mEnterFadeDuration;
this.mExitFadeDuration = ((DrawableContainerState)object).mExitFadeDuration;
this.mAutoMirrored = ((DrawableContainerState)object).mAutoMirrored;
this.mColorFilter = ((DrawableContainerState)object).mColorFilter;
this.mHasColorFilter = ((DrawableContainerState)object).mHasColorFilter;
this.mTintList = ((DrawableContainerState)object).mTintList;
this.mBlendMode = ((DrawableContainerState)object).mBlendMode;
this.mHasTintList = ((DrawableContainerState)object).mHasTintList;
this.mHasTintMode = ((DrawableContainerState)object).mHasTintMode;
if (((DrawableContainerState)object).mDensity == this.mDensity) {
if (((DrawableContainerState)object).mCheckedPadding) {
this.mConstantPadding = new Rect(((DrawableContainerState)object).mConstantPadding);
this.mCheckedPadding = true;
}
if (((DrawableContainerState)object).mCheckedConstantSize) {
this.mConstantWidth = ((DrawableContainerState)object).mConstantWidth;
this.mConstantHeight = ((DrawableContainerState)object).mConstantHeight;
this.mConstantMinimumWidth = ((DrawableContainerState)object).mConstantMinimumWidth;
this.mConstantMinimumHeight = ((DrawableContainerState)object).mConstantMinimumHeight;
this.mCheckedConstantSize = true;
}
}
if (((DrawableContainerState)object).mCheckedOpacity) {
this.mOpacity = ((DrawableContainerState)object).mOpacity;
this.mCheckedOpacity = true;
}
if (((DrawableContainerState)object).mCheckedStateful) {
this.mStateful = ((DrawableContainerState)object).mStateful;
this.mCheckedStateful = true;
}
object2 = ((DrawableContainerState)object).mDrawables;
this.mDrawables = new Drawable[((Drawable[])object2).length];
this.mNumChildren = ((DrawableContainerState)object).mNumChildren;
object = ((DrawableContainerState)object).mDrawableFutures;
this.mDrawableFutures = object != null ? ((SparseArray)object).clone() : new SparseArray(this.mNumChildren);
int n2 = this.mNumChildren;
for (n = 0; n < n2; ++n) {
if (object2[n] == null) continue;
object = object2[n].getConstantState();
if (object != null) {
this.mDrawableFutures.put(n, (Drawable.ConstantState)object);
continue;
}
this.mDrawables[n] = object2[n];
}
} else {
this.mDrawables = new Drawable[10];
this.mNumChildren = 0;
}
}
private void createAllFutures() {
SparseArray<Drawable.ConstantState> sparseArray = this.mDrawableFutures;
if (sparseArray != null) {
int n = sparseArray.size();
for (int i = 0; i < n; ++i) {
int n2 = this.mDrawableFutures.keyAt(i);
sparseArray = this.mDrawableFutures.valueAt(i);
this.mDrawables[n2] = this.prepareDrawable(((Drawable.ConstantState)((Object)sparseArray)).newDrawable(this.mSourceRes));
}
this.mDrawableFutures = null;
}
}
private void mutate() {
int n = this.mNumChildren;
Drawable[] arrdrawable = this.mDrawables;
for (int i = 0; i < n; ++i) {
if (arrdrawable[i] == null) continue;
arrdrawable[i].mutate();
}
this.mMutated = true;
}
private Drawable prepareDrawable(Drawable drawable2) {
drawable2.setLayoutDirection(this.mLayoutDirection);
drawable2 = drawable2.mutate();
drawable2.setCallback(this.mOwner);
return drawable2;
}
public final int addChild(Drawable drawable2) {
int n = this.mNumChildren;
if (n >= this.mDrawables.length) {
this.growArray(n, n + 10);
}
drawable2.mutate();
drawable2.setVisible(false, true);
drawable2.setCallback(this.mOwner);
this.mDrawables[n] = drawable2;
++this.mNumChildren;
this.mChildrenChangingConfigurations |= drawable2.getChangingConfigurations();
this.invalidateCache();
this.mConstantPadding = null;
this.mCheckedPadding = false;
this.mCheckedConstantSize = false;
this.mCheckedConstantState = false;
return n;
}
final void applyTheme(Resources.Theme theme) {
if (theme != null) {
this.createAllFutures();
int n = this.mNumChildren;
Drawable[] arrdrawable = this.mDrawables;
for (int i = 0; i < n; ++i) {
if (arrdrawable[i] == null || !arrdrawable[i].canApplyTheme()) continue;
arrdrawable[i].applyTheme(theme);
this.mChildrenChangingConfigurations |= arrdrawable[i].getChangingConfigurations();
}
this.updateDensity(theme.getResources());
}
}
@Override
public boolean canApplyTheme() {
int n = this.mNumChildren;
Drawable[] arrdrawable = this.mDrawables;
for (int i = 0; i < n; ++i) {
Object object = arrdrawable[i];
if (!(object != null ? ((Drawable)object).canApplyTheme() : (object = this.mDrawableFutures.get(i)) != null && ((Drawable.ConstantState)object).canApplyTheme())) continue;
return true;
}
return false;
}
public boolean canConstantState() {
synchronized (this) {
block7 : {
if (!this.mCheckedConstantState) break block7;
boolean bl = this.mCanConstantState;
return bl;
}
this.createAllFutures();
this.mCheckedConstantState = true;
int n = this.mNumChildren;
Drawable[] arrdrawable = this.mDrawables;
for (int i = 0; i < n; ++i) {
if (arrdrawable[i].getConstantState() != null) continue;
this.mCanConstantState = false;
return false;
}
this.mCanConstantState = true;
return true;
}
}
final void clearMutated() {
int n = this.mNumChildren;
Drawable[] arrdrawable = this.mDrawables;
for (int i = 0; i < n; ++i) {
if (arrdrawable[i] == null) continue;
arrdrawable[i].clearMutated();
}
this.mMutated = false;
}
protected void computeConstantSize() {
this.mCheckedConstantSize = true;
this.createAllFutures();
int n = this.mNumChildren;
Drawable[] arrdrawable = this.mDrawables;
this.mConstantHeight = -1;
this.mConstantWidth = -1;
this.mConstantMinimumHeight = 0;
this.mConstantMinimumWidth = 0;
for (int i = 0; i < n; ++i) {
Drawable drawable2 = arrdrawable[i];
int n2 = drawable2.getIntrinsicWidth();
if (n2 > this.mConstantWidth) {
this.mConstantWidth = n2;
}
if ((n2 = drawable2.getIntrinsicHeight()) > this.mConstantHeight) {
this.mConstantHeight = n2;
}
if ((n2 = drawable2.getMinimumWidth()) > this.mConstantMinimumWidth) {
this.mConstantMinimumWidth = n2;
}
if ((n2 = drawable2.getMinimumHeight()) <= this.mConstantMinimumHeight) continue;
this.mConstantMinimumHeight = n2;
}
}
final int getCapacity() {
return this.mDrawables.length;
}
@Override
public int getChangingConfigurations() {
return this.mChangingConfigurations | this.mChildrenChangingConfigurations;
}
public final Drawable getChild(int n) {
int n2;
SparseArray<Drawable.ConstantState> sparseArray = this.mDrawables[n];
if (sparseArray != null) {
return sparseArray;
}
sparseArray = this.mDrawableFutures;
if (sparseArray != null && (n2 = sparseArray.indexOfKey(n)) >= 0) {
this.mDrawables[n] = sparseArray = this.prepareDrawable(this.mDrawableFutures.valueAt(n2).newDrawable(this.mSourceRes));
this.mDrawableFutures.removeAt(n2);
if (this.mDrawableFutures.size() == 0) {
this.mDrawableFutures = null;
}
return sparseArray;
}
return null;
}
public final int getChildCount() {
return this.mNumChildren;
}
public final Drawable[] getChildren() {
this.createAllFutures();
return this.mDrawables;
}
public final int getConstantHeight() {
if (!this.mCheckedConstantSize) {
this.computeConstantSize();
}
return this.mConstantHeight;
}
public final int getConstantMinimumHeight() {
if (!this.mCheckedConstantSize) {
this.computeConstantSize();
}
return this.mConstantMinimumHeight;
}
public final int getConstantMinimumWidth() {
if (!this.mCheckedConstantSize) {
this.computeConstantSize();
}
return this.mConstantMinimumWidth;
}
public final Rect getConstantPadding() {
if (this.mVariablePadding) {
return null;
}
if (this.mConstantPadding == null && !this.mCheckedPadding) {
this.createAllFutures();
Rect rect = null;
Rect rect2 = new Rect();
int n = this.mNumChildren;
Drawable[] arrdrawable = this.mDrawables;
for (int i = 0; i < n; ++i) {
Rect rect3 = rect;
if (arrdrawable[i].getPadding(rect2)) {
Rect rect4 = rect;
if (rect == null) {
rect4 = new Rect(0, 0, 0, 0);
}
if (rect2.left > rect4.left) {
rect4.left = rect2.left;
}
if (rect2.top > rect4.top) {
rect4.top = rect2.top;
}
if (rect2.right > rect4.right) {
rect4.right = rect2.right;
}
rect3 = rect4;
if (rect2.bottom > rect4.bottom) {
rect4.bottom = rect2.bottom;
rect3 = rect4;
}
}
rect = rect3;
}
this.mCheckedPadding = true;
this.mConstantPadding = rect;
return rect;
}
return this.mConstantPadding;
}
public final int getConstantWidth() {
if (!this.mCheckedConstantSize) {
this.computeConstantSize();
}
return this.mConstantWidth;
}
public final int getEnterFadeDuration() {
return this.mEnterFadeDuration;
}
public final int getExitFadeDuration() {
return this.mExitFadeDuration;
}
public final int getOpacity() {
if (this.mCheckedOpacity) {
return this.mOpacity;
}
this.createAllFutures();
int n = this.mNumChildren;
Drawable[] arrdrawable = this.mDrawables;
int n2 = n > 0 ? arrdrawable[0].getOpacity() : -2;
for (int i = 1; i < n; ++i) {
n2 = Drawable.resolveOpacity(n2, arrdrawable[i].getOpacity());
}
this.mOpacity = n2;
this.mCheckedOpacity = true;
return n2;
}
public void growArray(int n, int n2) {
Drawable[] arrdrawable = new Drawable[n2];
System.arraycopy(this.mDrawables, 0, arrdrawable, 0, n);
this.mDrawables = arrdrawable;
}
void invalidateCache() {
this.mCheckedOpacity = false;
this.mCheckedStateful = false;
}
public final boolean isConstantSize() {
return this.mConstantSize;
}
public final boolean isStateful() {
boolean bl;
if (this.mCheckedStateful) {
return this.mStateful;
}
this.createAllFutures();
int n = this.mNumChildren;
Drawable[] arrdrawable = this.mDrawables;
boolean bl2 = false;
int n2 = 0;
do {
bl = bl2;
if (n2 >= n) break;
if (arrdrawable[n2].isStateful()) {
bl = true;
break;
}
++n2;
} while (true);
this.mStateful = bl;
this.mCheckedStateful = true;
return bl;
}
public final void setConstantSize(boolean bl) {
this.mConstantSize = bl;
}
public final void setEnterFadeDuration(int n) {
this.mEnterFadeDuration = n;
}
public final void setExitFadeDuration(int n) {
this.mExitFadeDuration = n;
}
final boolean setLayoutDirection(int n, int n2) {
boolean bl = false;
int n3 = this.mNumChildren;
Drawable[] arrdrawable = this.mDrawables;
for (int i = 0; i < n3; ++i) {
boolean bl2 = bl;
if (arrdrawable[i] != null) {
boolean bl3 = arrdrawable[i].setLayoutDirection(n);
bl2 = bl;
if (i == n2) {
bl2 = bl3;
}
}
bl = bl2;
}
this.mLayoutDirection = n;
return bl;
}
public final void setVariablePadding(boolean bl) {
this.mVariablePadding = bl;
}
final void updateDensity(Resources resources) {
if (resources != null) {
this.mSourceRes = resources;
int n = Drawable.resolveDensity(resources, this.mDensity);
int n2 = this.mDensity;
this.mDensity = n;
if (n2 != n) {
this.mCheckedConstantSize = false;
this.mCheckedPadding = false;
}
}
}
}
}
| [
"me@paulo.costa.nom.br"
] | me@paulo.costa.nom.br |
868f75dfd128204c973eba32a7ded68b996e322b | 4da10b4092ac11c782fb80cec4a27942616b9647 | /src/main/java/utilities/AIHackathon/ExtentTestManager_AIHackathon.java | 47a7d3cc8f95380fd49f5fb8daec2bab8cb3c79b | [] | no_license | yberky/applitoolshackathon | 4effd071bcf1c0cd0599ebaef1979bf6e4683803 | 6cc4fa83471f48b8f3a1a70a6bf02b8472dc71ed | refs/heads/master | 2022-07-12T20:35:54.096792 | 2019-11-29T10:45:21 | 2019-11-29T10:45:21 | 221,960,549 | 0 | 0 | null | 2022-06-29T17:46:44 | 2019-11-15T16:17:23 | HTML | UTF-8 | Java | false | false | 1,030 | java | package utilities.AIHackathon;
import java.util.HashMap;
import java.util.Map;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
public class ExtentTestManager_AIHackathon { // new
static Map<Integer, ExtentTest> extentTestMap = new HashMap<Integer, ExtentTest>();
private static ExtentReports extent = ExtentManager_AIHackathon.getReporter();
public static synchronized ExtentTest getTest() {
return (ExtentTest) extentTestMap.get((int) (long) (Thread.currentThread().getId()));
}
public static synchronized void endTest() {
extent.endTest((ExtentTest) extentTestMap.get((int) (long) (Thread.currentThread().getId())));
}
public static synchronized ExtentTest startTest(String testName) {
return startTest(testName, "");
}
public static synchronized ExtentTest startTest(String testName, String desc) {
ExtentTest test = extent.startTest(testName, desc);
extentTestMap.put((int) (long) (Thread.currentThread().getId()), test);
return test;
}
}
| [
"yberky85@hotmail.com"
] | yberky85@hotmail.com |
bef1ec67fd203cdebeea868cf4986eae73dd1cfb | 396bbb10810eb6dd0a125f2904e4d0e7a07c1ac3 | /src/main/java/com/emanuelhonorio/model/Foto.java | e8181a6d4834dbdf75fb894a39e531c8bcba84ea | [] | no_license | emanuelhonorio/classifika-web | 306640a6dabce493f182076817dcad78b464dfc7 | 1c1a7b0d5906645ad864d3e293b4c0a54b67561d | refs/heads/master | 2020-09-25T13:04:44.945385 | 2019-12-05T03:41:45 | 2019-12-05T03:41:45 | 226,008,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,006 | java | package com.emanuelhonorio.model;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
@Table(name = "foto")
public class Foto implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@JsonIgnore
@Lob
private byte[] arquivo;
@Transient
private String url;
@JsonIgnore
@ManyToOne
@JoinColumn(name = "id_anuncio")
private Anuncio anuncio;
public Foto() {
}
public Foto(byte[] arquivo, Anuncio anuncio) {
super();
this.arquivo = arquivo;
this.anuncio = anuncio;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public byte[] getArquivo() {
return arquivo;
}
public void setArquivo(byte[] arquivo) {
this.arquivo = arquivo;
}
public Anuncio getAnuncio() {
return anuncio;
}
public void setAnuncio(Anuncio anuncio) {
this.anuncio = anuncio;
}
public String getUrl() {
return "https://classifika-api.herokuapp.com" + "/anuncios/img/" + this.id;
// return "http://localhost:8080" + "/anuncios/img/" + this.id;
}
public void setUrl(String url) {
this.url = url;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Foto other = (Foto) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"emanuelh.dev@gmail.com"
] | emanuelh.dev@gmail.com |
d765144d91d8da4aa3cbd2355879453bd0bc430a | cd765f88977e971e7dabc8b79e045d765b18d433 | /ui_libaray/src/main/java/com/xingzhe/ui_libaray/dataview/DefaultLoadMoreView.java | 3db74876591dd5ba8182cd5761c66dea143cf6f7 | [] | no_license | xingzhe0315/jetpackdemo-java | 2d62867c36cd65e281c4a09de99049ae56f318a2 | 286d0fac8eb7d8a4269fde16bbc2943cd134cd57 | refs/heads/master | 2020-06-03T10:13:24.423832 | 2019-06-17T07:31:32 | 2019-06-17T07:31:32 | 191,532,724 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,185 | java | package com.xingzhe.ui_libaray.dataview;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.xingzhe.ui_libaray.R;
/**
* Created by wumm on 2019/5/6.
*/
public class DefaultLoadMoreView extends LinearLayout implements LoadMoreView {
private ProgressBar progress;
private TextView messageTv;
private String message_loading = "加载中...";
private String message_error = "网络错误,点击重试";
private String message_end = "没有更多了";
private DataRetryHandler retryHandler;
public DefaultLoadMoreView(Context context) {
this(context,null);
}
public DefaultLoadMoreView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs,0);
}
public DefaultLoadMoreView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
inflate(context, R.layout.view_loading_more_footer,this);
progress = findViewById(R.id.progress);
messageTv = findViewById(R.id.message_tv);
}
@Override
public void onLoading() {
setOnClickListener(null);
setClickable(false);
progress.setVisibility(VISIBLE);
messageTv.setText(message_loading);
}
@Override
public void onError() {
setClickable(true);
progress.setVisibility(GONE);
messageTv.setText(message_error);
if (retryHandler!=null){
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onLoading();
retryHandler.onHandleRetry();
}
});
}
}
@Override
public void onEnd() {
setOnClickListener(null);
setClickable(false);
progress.setVisibility(GONE);
messageTv.setText(message_end);
}
public void setRetryHandler(DataRetryHandler retryHandler) {
this.retryHandler = retryHandler;
}
}
| [
"wumm@boqii.com"
] | wumm@boqii.com |
31ff642f4c6eefdb71132759783b24a0aa88b99c | b07deb5968592a8f7bf524f05a28c9ac33144b93 | /TestRaspberry/src/test/rasp/Message.java | b60edd73c14f63d8dae030e93c46d3bf412aa396 | [] | no_license | FujiiNoritsugu/Test_Raspberry | df402ac396ca7c6277c8af09953d5f7190d214d3 | b9e74d6420b307a280e514fcd4d61d128868798c | refs/heads/master | 2021-01-10T18:53:30.211831 | 2014-02-03T21:18:30 | 2014-02-03T21:18:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 51 | java | package test.rasp;
public class Message {
}
| [
"Fujii@Fujii-PC"
] | Fujii@Fujii-PC |
05daf7ec2052d2d304d36eed3128fe700e76f86e | bd79e6517d9b1dad08fe19322791f6c56ec89278 | /weixin4j-wxa/src/main/java/com/foxinmy/weixin4j/wxa/api/TemplateMessageApi.java | 7b3eb1b6ec15fe62169921340cf4f2d6974533cd | [
"Apache-2.0"
] | permissive | cylgit/weixin4j | 5ab138dd5daee4eaf3744be254398e03c5e17150 | 5dea49df5b3011a35ec072303c4ab5549e1ffb13 | refs/heads/master | 2020-03-30T07:08:48.378472 | 2018-09-11T15:06:33 | 2018-09-11T15:06:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,032 | java | package com.foxinmy.weixin4j.wxa.api;
import java.util.Map;
import java.util.Properties;
import com.foxinmy.weixin4j.exception.WeixinException;
import com.foxinmy.weixin4j.token.TokenManager;
/**
* 发送模版消息。
*
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/api/notice.html#%E5%8F%91%E9%80%81%E6%A8%A1%E7%89%88%E6%B6%88%E6%81%AF">发送模版消息</a>
* @since 1.8
*/
public class TemplateMessageApi extends TokenManagerApi {
public TemplateMessageApi(TokenManager tokenManager) {
this(tokenManager, null);
}
public TemplateMessageApi(TokenManager tokenManager, Properties properties) {
super(tokenManager, properties);
}
/**
* 发送模板消息
*
* @param toUser 接收者(用户)的 openid。
* @param templateId 所需下发的模板消息的 id。
* @param page 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。
* @param formId 表单提交场景下,为 submit 事件带上的 formId;支付场景下,为本次支付的 prepay_id。
* @param data 模板内容,不填则下发空模板。
* @param emphasisKeyword 模板需要放大的关键词,不填则默认无放大。
* @throws WeixinException indicates getting access token failed, or sending template message failed.
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/api/notice.html#%E5%8F%91%E9%80%81%E6%A8%A1%E7%89%88%E6%B6%88%E6%81%AF">发送模版消息</a>
*/
public void sendTemplateMessage(
final String toUser,
final String templateId,
final String page,
final String formId,
final Map<String, String> data,
final String emphasisKeyword
) throws WeixinException {
final TemplateMessageParameter message = new TemplateMessageParameter(
toUser, templateId, page, formId, data, emphasisKeyword
);
final WxaApiResult r = this.post(
"wxopen_template_message_send",
message,
WxaApiResult.TYPE_REFERENCE
);
r.checkErrCode();
}
}
| [
"zhoushuqun@gmail.com"
] | zhoushuqun@gmail.com |
f1b34e4f3be73b960dd4167113d9e5ec034fe4f0 | ffae4f552611a9880dfb2fd7519ac8464b11c634 | /nostalciacOLD/target/generated-sources/annotations/nostalciac/entity/Sede_.java | 712be989b6ca4906641dc1b385a91a6909b9b936 | [] | no_license | mymmo74/nostalCIAC | ce5e3bfd23ba329ed220b7bf6ea7dd00be9fe4a1 | 89dd4ccbc4189ef2a9ccf5bd09bd775042769d19 | refs/heads/master | 2020-05-03T03:56:15.063830 | 2019-04-15T15:00:03 | 2019-04-15T15:00:03 | 178,000,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 763 | java | package nostalciac.entity;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2019-04-08T15:26:59")
@StaticMetamodel(Sede.class)
public class Sede_ {
public static volatile SingularAttribute<Sede, String> note;
public static volatile SingularAttribute<Sede, String> mail;
public static volatile SingularAttribute<Sede, String> indirizzo;
public static volatile SingularAttribute<Sede, String> nome;
public static volatile SingularAttribute<Sede, String> tel;
public static volatile SingularAttribute<Sede, Integer> id;
public static volatile SingularAttribute<Sede, String> citta;
} | [
"mimmo.garrone@gmail.com"
] | mimmo.garrone@gmail.com |
affe45c25232d90954181a3114c666c927549531 | 97627f2fdd57a8a20e58dcfd3039e8fb2faaee51 | /platformio/src/com/jetbrains/cidr/cpp/embedded/platformio/PlatformioCleanBeforeRunTaskProvider.java | 993c33a182cc2c8ba27a36286ddf524d7c726d75 | [
"Apache-2.0"
] | permissive | ls9527/intellij-plugins | 3ef28f13bf7d8c9f6472cbecf9a4480c816adb4b | d1e62a18c5f7d84a8aa0adaf3c564b60a565718c | refs/heads/master | 2023-02-13T12:54:04.972079 | 2020-12-18T09:42:26 | 2021-01-13T15:45:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,396 | java | package com.jetbrains.cidr.cpp.embedded.platformio;
import com.intellij.execution.BeforeRunTask;
import com.intellij.execution.BeforeRunTaskProvider;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.execution.process.ProcessAdapter;
import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Ref;
import com.intellij.tools.Tool;
import com.intellij.ui.GuiUtils;
import com.intellij.util.concurrency.Semaphore;
import com.jetbrains.cidr.cpp.embedded.platformio.ui.PlatformioCleanAction;
import com.jetbrains.cidr.execution.build.CidrBuild;
import icons.ClionEmbeddedPlatformioIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
public class PlatformioCleanBeforeRunTaskProvider extends BeforeRunTaskProvider<BeforeRunTask<?>> {
public static final Key<BeforeRunTask<?>> ID = Key.create("PlatformioPluginTarget");
private static final long executionId = ExecutionEnvironment.getNextUnusedExecutionId();
@Override
public @Nullable Icon getIcon() {
return ClionEmbeddedPlatformioIcons.Platformio;
}
@Override
public Key<BeforeRunTask<?>> getId() {
return ID;
}
@Override
public String getName() {
return ClionEmbeddedPlatformioBundle.message("platformio.prebuild.clean");
}
@Nullable
@Override
public BeforeRunTask<?> createTask(@NotNull RunConfiguration runConfiguration) {
return new BeforeRunTask<BeforeRunTask<?>>(ID) {
};
}
@Override
public boolean executeTask(@NotNull DataContext context,
@NotNull RunConfiguration configuration,
@NotNull ExecutionEnvironment env,
@NotNull BeforeRunTask<?> task) {
Tool tool = PlatformioCleanAction.createPlatformioTool(configuration.getProject());
Ref<Boolean> success = new Ref<>(false);
Semaphore actionFinished = new Semaphore();
if (tool != null) {
ProcessAdapter successListener = new ProcessAdapter() {
@Override
public void processTerminated(@NotNull ProcessEvent event) {
success.set(event.getExitCode() == 0);
actionFinished.up();
}
};
actionFinished.down();
ApplicationManager.getApplication().invokeLater(() ->
{
if (!tool.executeIfPossible(null, context, executionId, successListener)) {
actionFinished.up();
}
}
);
actionFinished.waitFor();
}
if (!success.get()) {
GuiUtils.invokeLaterIfNeeded(
() -> CidrBuild.showBuildNotification(configuration.getProject(), MessageType.ERROR,
ClionEmbeddedPlatformioBundle.message("platformio.clean.failed")),
ModalityState.NON_MODAL);
}
return success.get();
}
}
| [
"intellij-monorepo-bot-no-reply@jetbrains.com"
] | intellij-monorepo-bot-no-reply@jetbrains.com |
0cf628f286570168eca5ac1d360400a27249f949 | 8d323bf00e8bc71d821dd09e4549404f122f5827 | /mvc_active/src/main/java/Controller/RecyclerViewHolder.java | 617fff80d17c79749c7059c2f42768614d35930e | [
"Apache-2.0"
] | permissive | Yaphetwyf/architect | b61d4b7da85336f2c1796d27efad6cb2ce75e28d | ad6cb490dd7772aacf57a2a0855f9fd9d4dd4e89 | refs/heads/main | 2023-05-20T18:01:18.948550 | 2021-06-14T14:05:45 | 2021-06-14T14:05:45 | 369,384,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 828 | java | package Controller;
import android.support.annotation.CallSuper;
import android.support.annotation.LayoutRes;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
/**
* Created by Yunpeng Li on 2018/12/10.
*/
public class RecyclerViewHolder<T> extends RecyclerView.ViewHolder { // ViewHolder基类
private T mData; // ViewHolder需要的数据
public RecyclerViewHolder(ViewGroup parent, @LayoutRes int resource) {
// 构造方法,加载界面布局
super(LayoutInflater.from(parent.getContext()).inflate(resource, parent, false));
}
@CallSuper // 提示调用父类方法
public void onBindView(T data) {
mData = data; // 绑定数据
}
public T getData() {
return mData; // 获得数据
}
}
| [
"635272824@qq.com"
] | 635272824@qq.com |
204fc33b3a1d204818ae4fda0f9b6197642cd22a | d44e6e8838ebed7735b1e4bfe413841fc3601b44 | /CoreJava/src/OOPConcept/MathodOverloading.java | dc8e57fcfced814bcae1473d6affb6ace38b71c5 | [] | no_license | Muhammed-Nayeem/Java-Programming | 2d4ab01f568a26214a8cd5c08af6c913df371a27 | 8725dfb0e633db56914212b028f30e0910631caa | refs/heads/master | 2022-12-24T23:44:00.448702 | 2020-10-06T15:10:51 | 2020-10-06T15:10:51 | 301,765,966 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | //OOP Program 12: Mathod Overloading
package OOPConcept;
public class MathodOverloading {
void add(int a, int b){
System.out.println("Sum is : "+ (a+b));
}
void add(double a, double b){
System.out.println("Sum is : "+ (a+b));
}
void add(int a, int b, int c){
System.out.println("Sum is : "+ (a+b+c));
}
}
| [
"mohammednayeem808@gmail.com"
] | mohammednayeem808@gmail.com |
d8938e4c83b77f2cdf0cf88b352cdeb9734be4e9 | 46c20022f4ea7375faea80c14efb62e1b633e848 | /regFormToMail/src/main/java/com/cooler/model/User.java | ddfb0104e9dae6dadf4793d4b74ac91109e81463 | [] | no_license | eugenivanuke/training | cefb02c0f840603451b0d6bb59c0c4b84d6f8ea5 | a873f2bfe885a0306c96b1bb3e2e4a71bfd7042d | refs/heads/master | 2020-12-02T22:53:34.735829 | 2017-07-05T13:16:08 | 2017-07-05T13:16:08 | 72,785,830 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,122 | java | package com.cooler.model;
/*plain and simple domain class, gives a weird exception
"You should inject a bean of String type" in case of use classic DI
constructor like {this.name = name} and so on, used get\set methods instead.
The origin of this exception is still unknown for me :(
*/
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
public class User {
@NotNull
@Size(min = 2, max = 30, message = "{firstName.size}")
private String firstName;
@NotNull
@Size(min = 2, max = 30, message = "{lastName.size}")
private String lastName;
@NotNull
private String telNumber;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getTelNumber() {
return telNumber;
}
public void setTelNumber(String telNumber) {
this.telNumber = telNumber;
}
}
| [
"gorgeousrichie@gmail.com"
] | gorgeousrichie@gmail.com |
bbad343a71a7706af6dca56253fe8fd93363a44b | d1f3526537b86f429e1d938f76ddd310663e6547 | /src/Pattern.java | 1e555bf6f08c0bda1535db9265a92432af34308c | [] | no_license | bhandarisaurav/advanced-java-pacticals | 417ec3af23af756134fb169427a6def19a06a3ce | 6a470cbf641fd58092cb530abf05844a2f891a3e | refs/heads/master | 2021-10-12T00:49:08.957869 | 2019-01-31T06:00:54 | 2019-01-31T06:00:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | public class Pattern {
public static void main(String[] args) {
int tabs = 2;
for (int i = 1; i <= 5; i=i+2) {
for (int j = 1; j <= i; j++) {
for (int t = 1; t <=tabs; t++) {
System.out.print(" ");
}
System.out.print("*");
tabs--;
}
System.out.println();
}
tabs = 1;
for (int i = 3; i >= 1; i=i-2) {
for (int t = 1; t <=tabs; t++) {
System.out.print(" ");
}
for (int j = 1; j <= i; j++) {
System.out.print("*");
}
tabs++;
System.out.println();
}
}
}
| [
"saurav.bhandari@yahoo.com"
] | saurav.bhandari@yahoo.com |
88d8a3632cff1bb4fa520ce73f10576eae15dcc2 | f52c15f0dfca88f66bbbf7e77d59e480431a129c | /app/src/test/java/com/example/shefaliupadhyaya/crbs/ExampleUnitTest.java | a56e66af24a0f026a50b391f8604617c93b837a5 | [] | no_license | ketanparikh1211/CRBS | 0a871f1df012fb3e90797b2d452bfc2ba21bb5d5 | c3e7035bd2ea3c3ad1f6846b4e87bd597f127756 | refs/heads/master | 2021-01-01T20:40:00.932279 | 2017-08-17T11:53:06 | 2017-08-17T11:53:06 | 98,909,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package com.example.shefaliupadhyaya.crbs;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"ketanparikh1211@gmail.com"
] | ketanparikh1211@gmail.com |
22835a5a5e1929d9101ce847ea8159337c4b50f2 | adc72aba84a0ec272521f5642c13dd231bbf84d6 | /src/main/java/com/fsantos/camelmicroservicea/CamelMicroserviceAApplication.java | 06ab4f46e81eee577a75a5980448e7ce16710cb5 | [] | no_license | fsantosbr/camel-microservice-a | 444a743998e56974b4405bcdbcac576ae63cc9c8 | 4b59faf5f822e734e9376ef6e6e37aa7d18f3d27 | refs/heads/master | 2023-05-08T02:53:52.463224 | 2021-05-28T16:25:41 | 2021-05-28T16:25:41 | 371,162,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.fsantos.camelmicroservicea;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CamelMicroserviceAApplication {
public static void main(String[] args) {
SpringApplication.run(CamelMicroserviceAApplication.class, args);
}
}
| [
"fsantosinfo@gmail.com"
] | fsantosinfo@gmail.com |
5aa612300b392e9aba7c0f55ab44a194a24ac364 | 8731f2795a6d50dcc214a2c61e1e7ca766504968 | /src/main/java/org/kacperjagodzinski/finalproject/rase/RaseService.java | e34feaa4580ff5667fa626ea7ad38e4b17e38b03 | [] | no_license | KacperJagodzinski/Final-Project | f3d391c221e2a670e37088b04ab6cedd54539b36 | a01b0cb4853a2498731e931999e6a7b39505efb2 | refs/heads/master | 2020-09-06T05:09:50.942221 | 2020-05-24T15:02:37 | 2020-05-24T15:02:37 | 220,333,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | package org.kacperjagodzinski.finalproject.rase;
import org.hibernate.Hibernate;
import org.kacperjagodzinski.finalproject.dog.Dog;
import org.springframework.stereotype.Service;
import java.awt.print.Book;
import java.util.List;
@Service
public class RaseService {
private final RaseRepository raseRepository;
public RaseService(RaseRepository raseRepository) {
this.raseRepository = raseRepository;
}
public void create(Rase rase) {
raseRepository.save(rase);
}
public void update(Rase rase) {
raseRepository.save(rase);
}
public Rase findOne(Long id) {
return raseRepository.findById(id).orElse(null);
}
public void deleteOne(Long id) {
raseRepository.deleteById(id);
}
public List<Rase> findAll() {
List<Rase> rases = raseRepository.findAll();
return rases;
}
}
| [
"kacper.jagodzinski@onet.eu"
] | kacper.jagodzinski@onet.eu |
09587e9f9c20297960a3324599f259e06320f6ce | a5d217272863801ff4f53c12b3bfa82d42fea003 | /src/main/java/com/example/jwtdemo/dal/UserRepository.java | eb304ddb145ecceb30a1c3bc1ba0a614516eb83f | [] | no_license | artuncolak/Spring-Boot-JWT-Authentication | 7cb49b7af0917234663835ee90269f8cc89f2b59 | 60e4013b47b4ae023d0e8898faf8d4e8a52a86f4 | refs/heads/master | 2022-11-26T02:52:39.176468 | 2020-08-05T10:52:46 | 2020-08-05T10:52:46 | 285,260,366 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 256 | java | package com.example.jwtdemo.dal;
import com.example.jwtdemo.models.User;
import org.springframework.data.jpa.repository.JpaRepository;
public interface UserRepository extends JpaRepository<User, Integer> {
User findUserByUsername(String username);
}
| [
"artuncolak97@gmail.com"
] | artuncolak97@gmail.com |
615334d7ea4eaafea72e123722e82061197623d5 | cad9bbf9986d6d06bc208ba99b7f406e0c1ea7b8 | /src/main/java/cl/safe/controller/VisitaMedicaController.java | a1de49c84784523cf920590e423b159bbccca74b | [
"MIT"
] | permissive | claudioDcv/portafolio-jwt-oracle11g | 3eb6767e981b462936529c4eca3314a81f502460 | 0311abc15ef335175058faedcc24be2734d790a4 | refs/heads/master | 2020-04-02T12:42:13.002811 | 2018-12-17T01:44:36 | 2018-12-17T01:44:36 | 154,447,038 | 2 | 1 | MIT | 2018-11-12T05:13:22 | 2018-10-24T06:00:22 | Java | UTF-8 | Java | false | false | 11,299 | java | package cl.safe.controller;
import java.util.List;
import java.util.Random;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cl.safe.config.Const;
import cl.safe.config.Utils;
import cl.safe.dto.ConsultaMedicaRequestDto;
import cl.safe.dto.ExamenConsultaMedicaRequestDto;
import cl.safe.dto.InstalacionRequestDto;
import cl.safe.dto.PaginacionObjetoResponseDto;
import cl.safe.dto.PaginacionRequestDto;
import cl.safe.dto.ResponseDto;
import cl.safe.dto.VisitaMedicaRequestDto;
import cl.safe.entity.ConsultaMedicaEntity;
import cl.safe.entity.UserEntity;
import cl.safe.entity.VisitaMedicaEntity;
import cl.safe.service.UserServiceSP;
import cl.safe.service.VisitaMedicaService;
import io.jsonwebtoken.Claims;
@RestController
@RequestMapping("/api/visitas-medicas")
public class VisitaMedicaController {
@Autowired
VisitaMedicaService visitaMedicaService;
@Autowired
private UserServiceSP userServiceSP;
@PostMapping("/mis-visitas-medicas-medico")
public ResponseEntity<ResponseDto<List<VisitaMedicaEntity>>> misVisitasMedicasMedico(
@RequestAttribute("claims") final Claims claims,
@RequestBody @Valid final VisitaMedicaRequestDto visitaMedicaRequestDto) {
UserEntity u = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(u, Const.ADMIN_SAFE, Const.MEDICO, Const.SUPERVISOR)) {
ResponseDto<List<VisitaMedicaEntity>> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.findAllByEmpresaMedicoConfirmacionSP(visitaMedicaRequestDto.getEmpresaId(), u.getId(), visitaMedicaRequestDto.getConfirmacion()));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
@GetMapping("/mis-visitas-medicas-supervisor/{empresaId}")
public ResponseEntity<ResponseDto<List<VisitaMedicaEntity>>> misVisitasMedicasSupervisor(
@RequestAttribute("claims") final Claims claims,
@PathVariable(name="empresaId") Long empresaId) {
UserEntity u = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(u, Const.SUPERVISOR)) {
ResponseDto<List<VisitaMedicaEntity>> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.findAllByEmpresaSupervisorSP(empresaId, u.getId()));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
@GetMapping("/{empresaId}/{visitaMedicaId}")
public ResponseEntity<ResponseDto<VisitaMedicaEntity>> getVisitaMedicaById(
@RequestAttribute("claims") final Claims claims,
@PathVariable(name="empresaId") Long empresaId,
@PathVariable(name="visitaMedicaId") Long visitaMedicaId) {
UserEntity u = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(u, Const.MEDICO)) {
ResponseDto<VisitaMedicaEntity> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.getVisitaMedicaById(empresaId, visitaMedicaId));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
/*
* List<VisitaMedicaEntity> findAll();
* ExamenConsultaMedicaRequestDto
Long aceptarVisitaMedica(Long visitaMedicaId);
Long rechazarVisitaMedica(Long visitaMedicaId);
*/
@PostMapping("")
public ResponseEntity<ResponseDto<Long>> crearVisitaMedica(
@RequestAttribute("claims") final Claims claims,
@RequestBody @Valid final VisitaMedicaRequestDto visitaMedicaRequestDto) {
UserEntity user = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(user, Const.SUPERVISOR)) {
visitaMedicaRequestDto.setSupervisorId(user.getId());
ResponseDto<Long> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.crearVisitaMedica(visitaMedicaRequestDto));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
@GetMapping("/cerrar/{visitaMedicaId}")
public ResponseEntity<ResponseDto<Long>> cerrarVisitaMedica(
@RequestAttribute("claims") final Claims claims,
@PathVariable(name="visitaMedicaId") Long visitaMedicaId) {
UserEntity user = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(user, Const.MEDICO, Const.SUPERVISOR)) {
ResponseDto<Long> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.cerrarVisitaMedica(visitaMedicaId));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
@GetMapping("/aceptar/{visitaMedicaId}")
public ResponseEntity<ResponseDto<Long>> aceptarVisitaMedica(
@RequestAttribute("claims") final Claims claims,
@PathVariable(name="visitaMedicaId") Long visitaMedicaId) {
UserEntity user = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(user, Const.MEDICO)) {
ResponseDto<Long> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.aceptarVisitaMedica(visitaMedicaId));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
@GetMapping("/rechazar/{visitaMedicaId}")
public ResponseEntity<ResponseDto<Long>> rechazarVisitaMedica(
@RequestAttribute("claims") final Claims claims,
@PathVariable(name="visitaMedicaId") Long visitaMedicaId) {
UserEntity user = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(user, Const.MEDICO)) {
ResponseDto<Long> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.rechazarVisitaMedica(visitaMedicaId));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
@PostMapping("/consulta-medica")
public ResponseEntity<ResponseDto<Long>> crearConsultaMedica(
@RequestAttribute("claims") final Claims claims,
@RequestBody @Valid final ConsultaMedicaRequestDto consultaMedicaRequestDto) {
UserEntity user = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(user, Const.MEDICO)) {
ResponseDto<Long> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.crearConsultaMedica(consultaMedicaRequestDto));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
@GetMapping("/consulta-medica/cerrar/{consultaMedicaId}")
public ResponseEntity<ResponseDto<Long>> cerrarConsultaMedica(
@RequestAttribute("claims") final Claims claims,
@PathVariable(name="consultaMedicaId") Long consultaMedicaId) {
UserEntity user = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(user, Const.MEDICO)) {
ResponseDto<Long> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.cerrarConsultaMedica(consultaMedicaId));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
@PostMapping("/asignar-examen-consulta-medica")
public ResponseEntity<ResponseDto<Long>> asignarExamenConsultaMedica(
@RequestAttribute("claims") final Claims claims,
@RequestBody @Valid final ExamenConsultaMedicaRequestDto examenConsultaMedicaRequestDto) {
UserEntity user = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(user, Const.MEDICO)) {
ResponseDto<Long> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.asignarExamenConsultaMedica(
examenConsultaMedicaRequestDto.getConsultaMedicaId(),
examenConsultaMedicaRequestDto.getExamenId()
));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
// getAllConsultasMedicasByVisitaMedica
@GetMapping("/consulta-medica/por-visita-medica/{visitaMedicaId}")
public ResponseEntity<ResponseDto<List<ConsultaMedicaEntity>>> getAllConsultasMedicasByVisitaMedica(
@RequestAttribute("claims") final Claims claims,
@PathVariable(name="visitaMedicaId") Long visitaMedicaId) {
UserEntity user = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(user, Const.MEDICO)) {
ResponseDto<List<ConsultaMedicaEntity>> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.getAllConsultasMedicasByVisitaMedica(visitaMedicaId));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
// TODO implementar servicio real de validacion
@GetMapping("/validar-medico/{rut}")
public ResponseEntity<ResponseDto<Boolean>> validarMedico(
@RequestAttribute("claims") final Claims claims,
@PathVariable(name="rut") Long rut) {
UserEntity user = userServiceSP.findByEmail(claims.getSubject());
if (Utils.hasProfile(user,
Const.ADMIN_SAFE,
Const.MEDICO,
Const.SUPERVISOR,
Const.EXAMINADOR)) {
Random random = new Random();
ResponseDto<Boolean> rdto = new ResponseDto<>();
rdto.setObj(random.nextBoolean());
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
// ESTO ES PARA ADMIN DE EMPRESAS
@PostMapping("/admin-empresa")
public ResponseEntity<ResponseDto<PaginacionObjetoResponseDto<VisitaMedicaEntity>>> getAllInformeInstalacionADMINEMPRESA_PAG(
@RequestAttribute("claims") final Claims claims,
final @RequestBody PaginacionRequestDto instaParam) {
UserEntity user = userServiceSP.findByEmail(claims.getSubject());
if (user.getEmpresaFk() == null) {
return Utils.responseUnauthorized("No registra empresa asignada como Administrador");
}
if (Utils.hasProfile(user, Const.ADMIN_EMPRESA)) {
ResponseDto<PaginacionObjetoResponseDto<VisitaMedicaEntity>> rdto = new ResponseDto<>();
rdto.setObj(visitaMedicaService.getVisitaMedicaADMINEMPRESA_PAG(
user.getEmpresaFk(),
instaParam.getPageNumber(),
instaParam.getPageSize(),
instaParam.getFromDate(),
instaParam.getToDate()
));
rdto.setMessage("OK");
rdto.setStatus(HttpStatus.OK);
return new ResponseEntity<>(rdto, HttpStatus.OK);
}
return Utils.responseUnauthorized();
}
}
| [
"claudio.dcv@gmail.com"
] | claudio.dcv@gmail.com |
f325816c2f3835aa1272ba79577e8c27246d592a | ab4ec269a5c296d25893cb5b0f429230b76d6102 | /src/main/java/com/lee/system/util/DateUtil.java | e5c286f4fe890c7c4443199626112cb1d57c3282 | [] | no_license | pzhxyzf/baseproject | f4098ad0a21498c8ea6dd5197c18225275dbf23e | 5677d0d414bb675519b3ae2720303144549fddd0 | refs/heads/master | 2021-07-24T00:23:16.718808 | 2017-11-01T02:21:09 | 2017-11-01T02:26:11 | 108,796,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,468 | java | package com.lee.system.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
private final static SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
private final static SimpleDateFormat sdfDay = new SimpleDateFormat(
"yyyy-MM-dd");
private final static SimpleDateFormat sdfDays = new SimpleDateFormat(
"yyyyMMdd");
private final static SimpleDateFormat sdfTime = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
/**
* 获取YYYY格式
*
* @return
*/
public static String getYear() {
return sdfYear.format(new Date());
}
/**
* 获取YYYY-MM-DD格式
*
* @return
*/
public static String getDay() {
return sdfDay.format(new Date());
}
/**
* 获取YYYYMMDD格式
*
* @return
*/
public static String getDays(){
return sdfDays.format(new Date());
}
/**
* 获取YYYY-MM-DD HH:mm:ss格式
*
* @return
*/
public static String getTime() {
return sdfTime.format(new Date());
}
/**
* @Title: compareDate
* @Description: TODO(日期比较,如果s>=e 返回true 否则返回false)
* @param s
* @param e
* @return boolean
* @throws
* @author luguosui
*/
public static boolean compareDate(String s, String e) {
if(fomatDate(s)==null||fomatDate(e)==null){
return false;
}
return fomatDate(s).getTime() >=fomatDate(e).getTime();
}
/**
* 格式化日期
*
* @return
*/
public static Date fomatDate(String date) {
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
try {
return fmt.parse(date);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
/**
* 校验日期是否合法
*
* @return
*/
public static boolean isValidDate(String s) {
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
try {
fmt.parse(s);
return true;
} catch (Exception e) {
// 如果throw java.text.ParseException或者NullPointerException,就说明格式不对
return false;
}
}
public static int getDiffYear(String startTime,String endTime) {
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
try {
int years=(int) (((fmt.parse(endTime).getTime()-fmt.parse(startTime).getTime())/ (1000 * 60 * 60 * 24))/365);
return years;
} catch (Exception e) {
// 如果throw java.text.ParseException或者NullPointerException,就说明格式不对
return 0;
}
}
/**
* <li>功能描述:时间相减得到天数
* @param beginDateStr
* @param endDateStr
* @return
* long
* @author Administrator
*/
public static long getDaySub(String beginDateStr,String endDateStr){
long day=0;
java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd");
java.util.Date beginDate = null;
java.util.Date endDate = null;
try {
beginDate = format.parse(beginDateStr);
endDate= format.parse(endDateStr);
} catch (ParseException e) {
e.printStackTrace();
}
day=(endDate.getTime()-beginDate.getTime())/(24*60*60*1000);
//System.out.println("相隔的天数="+day);
return day;
}
/**
* 得到n天之后的日期
* @param days
* @return
*/
public static String getAfterDayDate(String days) {
int daysInt = Integer.parseInt(days);
Calendar canlendar = Calendar.getInstance(); // java.util包
canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动
Date date = canlendar.getTime();
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateStr = sdfd.format(date);
return dateStr;
}
/**
* 得到n天之后是周几
* @param days
* @return
*/
public static String getAfterDayWeek(String days) {
int daysInt = Integer.parseInt(days);
Calendar canlendar = Calendar.getInstance(); // java.util包
canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动
Date date = canlendar.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("E");
String dateStr = sdf.format(date);
return dateStr;
}
public static void main(String[] args) {
System.out.println(getDays());
System.out.println(getAfterDayWeek("3"));
}
}
| [
"490532848@qq.com"
] | 490532848@qq.com |
eaec0f950190ae1708e12443a3b0a1340a2e1342 | 4f87a5b5c16c2a0aee9d8ccc3960d575026f0051 | /java/src/main/java/dominio/estados/EstadoContexto.java | 3097a254e223e1a642e4eb99e906ee46de805fee | [] | no_license | sistemadual-ahk/dds2-patron-state | 4ab268c66c09ed55a12a866a574307de9853f6b0 | 71cb90ba2d721025fc70601995da600a711b3eaa | refs/heads/master | 2022-07-26T10:38:32.059780 | 2020-05-21T21:36:30 | 2020-05-21T21:36:30 | 256,352,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | package dominio.estados;
import dominio.Contexto;
public interface EstadoContexto {
public void actuar(Contexto contexto);
}
| [
"ezequieloscarescobar2@gmail.com"
] | ezequieloscarescobar2@gmail.com |
a42010bd6328b6a5564c4c31eabc345013add12e | 7f05ccc06656d991bf7a53d9689f030e6797ef46 | /BE/CL9/AS2/mpj/test/mpi/ccl_ObjSer/test.java | 79ee938798954f955072da549d3bc3b642c59ecf | [
"MIT"
] | permissive | manas10001/BEIT | effc72536765b8af5163a55a141809feef5cce47 | 0be09ac02804d0dba5f43a41d63662a7c6cd5045 | refs/heads/master | 2023-05-31T12:20:23.688109 | 2021-06-22T14:34:46 | 2021-06-22T14:34:46 | 214,174,766 | 8 | 6 | null | 2020-10-01T17:13:15 | 2019-10-10T12:17:28 | Jupyter Notebook | UTF-8 | Java | false | false | 187 | java | package mpi.ccl_ObjSer;
import java.io.*;
public class test implements Serializable {
public test() {
}
public int a = 112;
public String b = "test1";
public int c = 999;
}
| [
"manaspatil1999np@gmail.com"
] | manaspatil1999np@gmail.com |
afa54ab4f43f1244bab8069b29ef70103b570dce | 55621002a5b0b8e074f9025175db66567b2b9637 | /snackpub-service/snackpub-system/src/main/java/com/snackpub/system/service/impl/RoleServiceImpl.java | 46e30c64e6abe71da796a61781d9841d96273de3 | [] | no_license | snackpub/my-architecture | eb810cb67e49482fed0522a1f3f5d520f95695ad | b82355a8b042a3ae15ad6e253066e3d5f7f79a4a | refs/heads/master | 2023-06-23T02:18:55.132036 | 2021-07-10T04:53:46 | 2021-07-10T04:53:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,892 | java | /**
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.snackpub.system.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.snackpub.core.secure.utils.SecureUtil;
import com.snackpub.core.tools.constant.RoleConstant;
import com.snackpub.core.tools.node.ForestNodeMerger;
import com.snackpub.core.tools.utils.CollectionUtil;
import com.snackpub.core.tools.utils.Func;
import com.snackpub.system.entity.Role;
import com.snackpub.system.entity.RoleMenu;
import com.snackpub.system.mapper.RoleMapper;
import com.snackpub.system.service.IRoleMenuService;
import com.snackpub.system.service.IRoleService;
import com.snackpub.system.vo.RoleVO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.List;
/**
* 服务实现类
*
* @author Chill
*/
@Service
@Validated
@AllArgsConstructor
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {
IRoleMenuService roleMenuService;
@Override
public IPage<RoleVO> selectRolePage(IPage<RoleVO> page, RoleVO role) {
return page.setRecords(baseMapper.selectRolePage(page, role));
}
@Override
public List<RoleVO> tree(String tenantId) {
String userRole = SecureUtil.getUserRole();
String excludeRole = null;
if (!CollectionUtil.contains(Func.toStrArray(userRole), RoleConstant.ADMIN)) {
excludeRole = RoleConstant.ADMIN;
}
return ForestNodeMerger.merge(baseMapper.tree(tenantId, excludeRole));
}
@Override
public boolean grant(@NotEmpty List<Integer> roleIds, @NotEmpty List<Integer> menuIds) {
// 删除角色配置的菜单集合
roleMenuService.remove(Wrappers.<RoleMenu>update().lambda().in(RoleMenu::getRoleId, roleIds));
// 组装配置
List<RoleMenu> roleMenus = new ArrayList<>();
roleIds.forEach(roleId -> menuIds.forEach(menuId -> {
RoleMenu roleMenu = new RoleMenu();
roleMenu.setRoleId(roleId);
roleMenu.setMenuId(menuId);
roleMenus.add(roleMenu);
}));
// 新增配置
return roleMenuService.saveBatch(roleMenus);
}
}
| [
"835124577@qq.com"
] | 835124577@qq.com |
2d21b475d1ca8c4219497011dec13f8eadd21490 | a61fd9d6ec9dc5b32acab6656205a89e892256b8 | /ddd-d-platform/src/main/java/com/cfets/ts/s/platform/parser/PomFileParser.java | dbb94b9f7276924b8911daa8b02a1d5baf12bf55 | [] | no_license | TaoTeChing/cfets-ddd | 7943b9449eac91f47ea16709ffc804f0dad13d70 | c77f778ca16a1caf793f684d57bdc43c8c3fd5e1 | refs/heads/master | 2020-03-26T14:52:18.569600 | 2018-02-08T05:38:21 | 2018-02-08T05:38:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,490 | java | /**
* 辅助交易系统ts-s-platform
*/
package com.cfets.ts.s.platform.parser;
import java.io.File;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import com.cfets.ts.s.platform.bean.ComponentPO;
import com.cfets.ts.s.platform.bean.RelationPO;
import com.cfets.ts.s.platform.exception.PomFileException;
import com.cfets.ddd.d.platform.repository.domain.Component;
import com.cfets.ddd.d.platform.repository.domain.ComponentGroup;
import com.cfets.ddd.d.platform.repository.domain.Relation;
import com.cfets.ddd.d.platform.repository.domain.Scope;
import com.cfets.ts.s.platform.service.ComponentService;
import com.cfets.ts.s.platform.service.impl.ComponentServiceImpl;
/**
* <b>Copyright 2016 中国外汇交易中心 All Rights Reserved</b>
*
* @description:
* @author pluto
* @create on 2017年2月27日
*
* @history
*
*/
public class PomFileParser extends DefaultHandler {
private static final Logger logger = Logger.getLogger(PomFileParser.class);
private ComponentService componentService = new ComponentServiceImpl();
/**
* 所读取的文件
*/
private String fileName;
/**
* 父工程
*/
private Component parentComponent;
/**
* POM文件工程
*/
private Component mainComponent;
/**
* 子工程
*/
private Component childComponent;
/**
* 当前依赖关系
*/
private Scope scope;
/**
* 依赖的子工程
*/
private List<Component> children;
/**
* 依赖关系
*/
private List<Relation> relations;
/**
* 进入依赖集合标签之前
*/
private boolean isMainTag = true;
/**
* 进入父依赖集合标签
*/
private boolean isParentTag = false;
/**
* 进入子依赖集合标签
*/
private boolean isChildTag = false;
/**
* 当前元素名称
*/
private String currentElement;
private ComponentGroup group;
public ComponentGroup readPom(String path, ComponentGroup group) {
return this.readPom(new File(path), group);
}
public ComponentGroup readPom(File file, ComponentGroup group) {
this.fileName = file.getPath();
this.group = group;
try {
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
saxParser.parse(file, this);
} catch (ParserConfigurationException | SAXException | IOException e) {
e.printStackTrace(); // TODO 优化异常处理使在多线程读取比较时不中断,待查证修改
}
return this.group;
}
private boolean isPom(String qName, Attributes attributes) {
if ("project".equals(qName)
&& "http://maven.apache.org/POM/4.0.0".equals(attributes
.getValue("xmlns"))) {
return true;
} else {
return false;
}
}
@Override
public void startDocument() throws SAXException {
try {
logger.info("开始解析XML文件:" + fileName);
mainComponent = new Component();// 创建主工程
children = new ArrayList<Component>();// 创建子工程集合
relations = new ArrayList<Relation>();// 创建依赖关系集合
} catch (Exception e) {
e.printStackTrace();
logger.error(e);
}
}
@Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
try {
currentElement = qName;
if (isMainTag) {
// 是否是pom文件
if ("project".equals(currentElement)) {
if (isPom(currentElement, attributes)) {
logger.info("当前XML文件是POM文件");
} else {
throw new PomFileException("当前文件非pom文件");
}
}
if ("parent".equals(currentElement)) {
isMainTag = false;
isParentTag = true;
}
if ("dependencies".equals(currentElement)) {
isMainTag = false;
isChildTag = true;
}
return;
}
if (isChildTag) {
// 针对每个依赖建立新对象
if ("dependency".equals(currentElement)) {
childComponent = new Component();
scope = Scope.COMPILE;
}
}
if (isParentTag && parentComponent == null) {
// 创建父对象
parentComponent = new Component();
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e);
}
}
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
try {
String content = new String(ch, start, length).trim();
if (StringUtils.isBlank(content)) {
// logger.debug("当前标签[" + currentElement + "]内容为空");
return;
}
if (isMainTag) {
if ("groupId".equals(currentElement)) {
mainComponent.setGroupId(content);
}
if ("artifactId".equals(currentElement)) {
mainComponent.setArtifactId(content);
}
if ("version".equals(currentElement)) {
mainComponent.setVersion(content);
}
if ("description".equals(currentElement)) {
mainComponent.setDescription(content);
}
}
if (isParentTag) {
if ("groupId".equals(currentElement)) {
parentComponent.setGroupId(content);
mainComponent.setGroupId(content);// 子继承父的groupId
}
if ("artifactId".equals(currentElement)) {
parentComponent.setArtifactId(content);
}
if ("version".equals(currentElement)) {
parentComponent.setVersion(content);
mainComponent.setVersion(content);// 子继承父的版本号
}
}
if (isChildTag) {
if ("groupId".equals(currentElement)) {
childComponent.setGroupId(content);
}
if ("artifactId".equals(currentElement)) {
childComponent.setArtifactId(content);
}
if ("version".equals(currentElement)) {
childComponent.setVersion(content);
}
if ("scope".equals(currentElement)) {
scope = Scope.obtain(content);
}
}
} catch (Exception e) {
e.printStackTrace();
logger.error(e);
}
}
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
try {
currentElement = qName;
if (isParentTag) {
if ("parent".equals(currentElement)) {
isMainTag = true;
isParentTag = false;
// 添加依赖关系
relations.add(Relation.obtain(mainComponent,
parentComponent, Scope.EXTEND));
}
}
if (isChildTag) {
if ("dependencies".equals(currentElement)) {
isMainTag = true;
isChildTag = false;
}
if ("dependency".equals(qName)) {
children.add(childComponent);
// 添加依赖关系
relations.add(Relation.obtain(mainComponent,
childComponent, scope));
}
}
currentElement = null;// 回收对象
// scope = null;// 回收对象
} catch (Exception e) {
e.printStackTrace();
logger.error(e);
}
}
@Override
public void endDocument() throws SAXException {
try {
logger.info(fileName + "文档读取完毕");
echo();
parentComponent = null;
mainComponent = null;
childComponent = null;
} catch (Exception e) {
e.printStackTrace();
logger.error(e);
}
}
private void echo() {
// 父工程
logger.info("父构件" + parentComponent.toString());
logger.info("主构件" + mainComponent.toString());
for (Component child : children) {
logger.info("子构件" + child.toString());
}
for (Relation relation : relations) {
logger.info("依赖关系" + relation.toString());
}
// group.registerComponent(mainComponent);
// group.addAllRelation(relations);
// 这里保存入库:
ComponentPO parentComepontPO = new ComponentPO();
if (parentComponent != null
&& parentComponent.getArtifactId().startsWith("ts")) {
parentComepontPO.setGroupId(parentComponent.getGroupId());
parentComepontPO.setArtifactId(parentComponent.getArtifactId());
parentComepontPO.setVersion(parentComponent.getVersion());
parentComepontPO.setCreateTime(new Timestamp(System
.currentTimeMillis()));
componentService.save(parentComepontPO);
} else {
logger.info("不是ts的父构件---"+parentComponent.getArtifactId());
logger.info("不是ts的父构件---"+parentComponent.getArtifactId().startsWith("ts"));
}
ComponentPO mainComponentPO = new ComponentPO();
mainComponentPO.setGroupId(mainComponent.getGroupId());
if (StringUtils.isEmpty(mainComponent.getGroupId())) {
mainComponentPO.setGroupId(parentComponent.getGroupId());
}
mainComponentPO.setArtifactId(mainComponent.getArtifactId());
mainComponentPO.setVersion(mainComponent.getVersion());
mainComponentPO
.setCreateTime(new Timestamp(System.currentTimeMillis()));
if (mainComponentPO.getArtifactId().startsWith("ts")) {
componentService.save(mainComponentPO);
}
else {
logger.info("不是ts的主构件---");
}
for (Component child : children) {
ComponentPO childComponent = new ComponentPO();
childComponent.setGroupId(child.getGroupId());
childComponent.setArtifactId(child.getArtifactId());
childComponent.setVersion(child.getVersion());
childComponent.setCreateTime(new Timestamp(System
.currentTimeMillis()));
if (childComponent.getArtifactId().startsWith("ts")) {
componentService.save(childComponent);
}
else {
logger.info("不是ts的构件---"+childComponent.getArtifactId());
}
}
// 保存依赖关系
for (Relation relation : relations) {
RelationPO po = new RelationPO();
Component one = relation.getOne();
Component another = relation.getAnother();
Long mainId = componentService.getId(one.getGroupId(),
one.getArtifactId(), one.getVersion());
Long anotherId = componentService.getId(another.getGroupId(),
another.getArtifactId(), another.getVersion());
logger.info("mainId---"+mainId);
logger.info("anotherId---"+anotherId);
if (mainId == null) {
break;
}
if (anotherId == null) {
continue;
}
po.setMainId(mainId);
po.setDepencyId(anotherId);
po.setScope(relation.getScope().getName());
po.setDegree(1);
componentService.save(po);
}
}
} | [
"creater1989@gmail.com"
] | creater1989@gmail.com |
44c1243fc6f9e1f6d5f001f5351302fd6ff716a8 | e0170beeef745b8216d36d994cef1b7eb0deac9b | /app/src/main/java/com/example/ruben/trestokkfestivalen/MainActivity.java | 3ae45a819059a50986bc6f0d5c66a3a1b7f22924 | [] | no_license | rubenmoenn/TrestokkFestivalen2 | a9c6babebd99fb04887106b3d53d4fe2481d7ef7 | 4b9a0e9807fc09d4541253ec586fb7c86fd57ef6 | refs/heads/master | 2020-03-23T21:50:34.169215 | 2018-07-24T09:30:36 | 2018-07-24T09:30:36 | 142,136,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,233 | java | package com.example.ruben.trestokkfestivalen;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button mFestivalButton = (Button) findViewById(R.id.festival_button);
Button mInfoButton = (Button) findViewById(R.id.info_button);
Button mBillettButton = (Button) findViewById(R.id.billett_button);
// festival_button is pressed
mFestivalButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("Trestokk", "Festival Kart button Clicked");
switchToMaps();
}
});
// info_button is pressed
mInfoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("Trestokk", "Info button clicked");
switchToInfo();
}
});
// billett_button is pressed
mBillettButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("Trestokk", "Billett button is clicked");
Uri uri = Uri.parse("https://trestokkfestivalen.no/shop/");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
}
// Switches from MainActivity to MapsActivity via festival_button
public void switchToMaps() {
Intent intent = new Intent(this, com.example.ruben.trestokkfestivalen.MapsActivity.class);
startActivity(intent);
}
// Switches from MainActivity to InfoActivity via info_button
public void switchToInfo() {
Intent intent = new Intent(this, com.example.ruben.trestokkfestivalen.InfoActivity.class);
startActivity(intent);
}
}
| [
"wifiduck01@gmail.com"
] | wifiduck01@gmail.com |
e5107e5f53c06be1497605239015d4a0d2d6f99e | 89476306a5f41ff45e3335cdd90f897caf9ddb62 | /app/src/main/java/empolyesecurity/testtaskmvp/ui/login/LoginPresenter.java | 51a3f41b2ed8c8b52b25405865178d93b222bf1d | [] | no_license | senkeshkhan/TestTaskMvp | cfab146900ed7cb69f9e0a63bbbed9863ac2444c | a522791a0e8b7413dde8b12b7f8a8e3767777ca4 | refs/heads/master | 2020-03-22T23:24:28.528095 | 2018-07-13T06:49:08 | 2018-07-13T06:49:08 | 140,808,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,902 | java | /*
* Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED
* 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
*
* https://mindorks.com/license/apache-v2
*
* 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 empolyesecurity.testtaskmvp.ui.login;
import javax.inject.Inject;
import empolyesecurity.testtaskmvp.R;
import empolyesecurity.testtaskmvp.data.DataManager;
import empolyesecurity.testtaskmvp.data.network.model.LoginRequest;
import empolyesecurity.testtaskmvp.data.network.model.LoginResponse;
import empolyesecurity.testtaskmvp.ui.base.BasePresenter;
import empolyesecurity.testtaskmvp.utils.CommonUtils;
import empolyesecurity.testtaskmvp.utils.rx.SchedulerProvider;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Consumer;
/**
* Created by janisharali on 27/01/17.
*/
public class LoginPresenter<V extends LoginMvpView> extends BasePresenter<V>
implements LoginMvpPresenter<V> {
private static final String TAG = "LoginPresenter";
@Inject
public LoginPresenter(DataManager dataManager,
SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable) {
super(dataManager, schedulerProvider, compositeDisposable);
}
@Override
public void onServerLoginClick(String email, String password) {
//validate email and password
if (email == null || email.isEmpty()) {
getMvpView().onError(R.string.empty_email);
return;
}
if (!CommonUtils.isEmailValid(email)) {
getMvpView().onError(R.string.invalid_email);
return;
}
if (password == null || password.isEmpty()) {
getMvpView().onError(R.string.empty_password);
return;
}
getMvpView().showLoading();
/* getCompositeDisposable().add(getDataManager()
.doServerLoginApiCall(new LoginRequest.ServerLoginRequest(email, password))
.subscribeOn(getSchedulerProvider().io())
.observeOn(getSchedulerProvider().ui())
.subscribe(new Consumer<LoginResponse>() {
@Override
public void accept(LoginResponse response) throws Exception {
getDataManager().updateUserInfo(
response.getAccessToken(),
response.getUserId(),
DataManager.LoggedInMode.LOGGED_IN_MODE_SERVER,
response.getUserName(),
response.getUserEmail(),
response.getGoogleProfilePicUrl());
if (!isViewAttached()) {
return;
}
getMvpView().hideLoading();
getMvpView().openMainActivity();
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (!isViewAttached()) {
return;
}
getMvpView().hideLoading();
// handle the login error here
*//* if (throwable instanceof ANError) {
ANError anError = (ANError) throwable;
handleApiError(anError);
}*//*
}
}));*/
}
@Override
public void onGoogleLoginClick() {
// instruct LoginActivity to initiate google login
getMvpView().showLoading();
/*
getCompositeDisposable().add(getDataManager()
.doGoogleLoginApiCall(new LoginRequest.GoogleLoginRequest("test1", "test1"))
.subscribeOn(getSchedulerProvider().io())
.observeOn(getSchedulerProvider().ui())
.subscribe(new Consumer<LoginResponse>() {
@Override
public void accept(LoginResponse response) throws Exception {
getDataManager().updateUserInfo(
response.getAccessToken(),
response.getUserId(),
DataManager.LoggedInMode.LOGGED_IN_MODE_GOOGLE,
response.getUserName(),
response.getUserEmail(),
response.getGoogleProfilePicUrl());
System.out.println("yyyyyyyyyyyyyyyy"+response.getUserName());
if (!isViewAttached()) {
return;
}
getMvpView().hideLoading();
getMvpView().openMainActivity();
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (!isViewAttached()) {
return;
}
getMvpView().hideLoading();
// handle the login error here
*//* if (throwable instanceof ANError) {
ANError anError = (ANError) throwable;
handleApiError(anError);
}*//*
}
}));*/
}
@Override
public void onFacebookLoginClick() {
// instruct LoginActivity to initiate facebook login
getMvpView().showLoading();
/* getCompositeDisposable().add(getDataManager()
.doFacebookLoginApiCall(new LoginRequest.FacebookLoginRequest("test3", "test4"))
.subscribeOn(getSchedulerProvider().io())
.observeOn(getSchedulerProvider().ui())
.subscribe(new Consumer<LoginResponse>() {
@Override
public void accept(LoginResponse response) throws Exception {
getDataManager().updateUserInfo(
response.getAccessToken(),
response.getUserId(),
DataManager.LoggedInMode.LOGGED_IN_MODE_FB,
response.getUserName(),
response.getUserEmail(),
response.getGoogleProfilePicUrl());
if (!isViewAttached()) {
return;
}
getMvpView().hideLoading();
getMvpView().openMainActivity();
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (!isViewAttached()) {
return;
}
getMvpView().hideLoading();
// handle the login error here
*//* if (throwable instanceof ANError) {
ANError anError = (ANError) throwable;
handleApiError(anError);
}*//*
}
}));*/
}
}
| [
"senkeshkhan.s@gmail.com"
] | senkeshkhan.s@gmail.com |
d27c8c2f3c9db5f294f311706a7db0f961c655ed | 6324ba3857e09e1ff891dc547f05bb7c9ed6f449 | /apps/speedcloud/services/core-parent/business/src/main/java/net/aicoder/speedcloud/business/pipeline/exec/builder/StageBuilder.java | 1c2d43f9894c9c358a73b25ca05fbe9abb902404 | [] | no_license | ai-coders/devp | 68a0431007ebd5796dbf48a321ee08ff2dd87708 | 9dfe34374048cea2e613fa01fd9f584c5090361d | refs/heads/master | 2023-01-09T12:16:06.197363 | 2018-11-24T09:16:25 | 2018-11-24T09:16:25 | 134,250,514 | 0 | 2 | null | 2022-12-26T05:54:12 | 2018-05-21T09:53:00 | Java | UTF-8 | Java | false | false | 3,325 | java | package net.aicoder.speedcloud.business.pipeline.exec.builder;
import net.aicoder.speedcloud.business.pipeline.constant.ExecFlowType;
import net.aicoder.speedcloud.business.pipeline.constant.ExecNodeType;
import net.aicoder.speedcloud.business.pipeline.domain.PipelineStage;
import net.aicoder.speedcloud.business.pipeline.domain.PipelineStageNode;
import net.aicoder.speedcloud.business.pipeline.exec.domain.PipelineExecNode;
import net.aicoder.speedcloud.business.pipeline.exec.service.PipelineExecNodeService;
import net.aicoder.speedcloud.business.pipeline.exec.service.PipelineExecNodeStatus;
import net.aicoder.speedcloud.business.pipeline.service.PipelineStageNodeService;
import net.aicoder.speedcloud.business.pipeline.service.PipelineStageService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.List;
@Component
public class StageBuilder implements ExecNodeBuilder {
@Autowired
private PipelineExecInstanceBuilder pipelineExecInstanceBuilder;
@Autowired
private PipelineStageService pipelineStageService;
@Autowired
private PipelineStageNodeService pipelineStageNodeService;
@Autowired()@Qualifier("pipelineExecNodeService")
private PipelineExecNodeService execNodeService;
@Override
public PipelineExecNode createExecNode(PipelineExecNode parentNode, Long stageId, boolean createSubNode) {
PipelineStage pipelineStage = pipelineStageService.find(stageId);
//创建执行节点
PipelineExecNode stageExecNode = new PipelineExecNode();
stageExecNode.setNodeType(ExecNodeType.STAGE);
stageExecNode.setAutoStart(!StringUtils.equalsIgnoreCase(ExecFlowType.MANUAL, pipelineStage.getFlowType()));
stageExecNode.setName(pipelineStage.getName());
stageExecNode.setParentId(parentNode.getId());
stageExecNode.setExec(parentNode.getExec());
stageExecNode.setRelationObjId(pipelineStage.getId());
// stageExecNode.setExecIndex(execIndex);
stageExecNode.setExecIndex(pipelineStage.getExecOrder());
stageExecNode.setExecMode(pipelineStage.getExecMode());
stageExecNode.setTid(parentNode.getTid());
stageExecNode.setStatus(PipelineExecNodeStatus.WAIT);
execNodeService.add(stageExecNode);
if(createSubNode) {
handleSubNode(stageId, createSubNode, stageExecNode);
}
return stageExecNode;
}
private void handleSubNode(Long stageId, boolean createSubNode, PipelineExecNode stageExecNode) {
//开始处理stage关联的节点
List<PipelineStageNode> stageNodeList = pipelineStageNodeService.findByStage(stageId);
for(int i = 0; i < CollectionUtils.size(stageNodeList); i++){
PipelineStageNode stageNode = stageNodeList.get(i);
pipelineExecInstanceBuilder.build(stageExecNode, stageNode.getObjType(), stageNode.getId(), createSubNode);
}
}
@PostConstruct
public void register(){
pipelineExecInstanceBuilder.register(ExecNodeType.STAGE, this);
}
}
| [
"13962217@qq.com"
] | 13962217@qq.com |
8abb9d6d32550e2379d21f99b7a2fab977766f32 | 1d17da0194897dc9e8e3dc18c9b3178a5836ecaf | /src/main/java/com/ykh/dao/suport/QueryUtil.java | 9993d04081fe769b916fc4e6c37716521716bb99 | [] | no_license | AntShakeTree/yhk_cms | a28fd492f4340d3ddd3472789b100d525a806193 | 89994edc47ed5d16aedba0f29c33a28e1685cd6d | refs/heads/master | 2016-09-10T08:08:58.134331 | 2015-09-23T06:46:13 | 2015-09-23T06:46:13 | 41,133,363 | 0 | 1 | null | 2015-09-04T13:28:30 | 2015-08-21T03:51:10 | Java | UTF-8 | Java | false | false | 7,792 | java | package com.ykh.dao.suport;
import com.maxc.rest.common.ConfigUtil;
import com.ykh.common.ParseJSON;
import com.ykh.dao.GenericsUtils;
import com.ykh.dao.PageRequest;
import com.ykh.dao.Request;
import com.ykh.dao.annotation.DaoHelper;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.data.domain.Sort;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* @author ant_shake_tree
*/
public class QueryUtil {
private String hql;
private List<Object> values;
QueryUtil(String hql, List<Object> values) {
super();
this.hql = hql;
this.values = values;
}
public String getHql() {
return hql;
}
public List<Object> getValues() {
return values;
}
/**
* @param <T>
* @param @param req 设定文件
* @return void 返回类型
* @throws SecurityException
* @throws NoSuchFieldException
* @throws
* @Title: getHqlByDomain
* @Description: 获得hql
*/
public static <T> QueryUtil getHqlByDomain(Request<T> req) {
BeanWrapper bean = new BeanWrapperImpl(req);
PropertyDescriptor[] pros = bean.getPropertyDescriptors();
StringBuffer hql = new StringBuffer();
hql.append(" from ");
String fromname = GenericsUtils.getMethodParameterGenericsInterfaceType(req)
.getSimpleName();
hql.append(fromname);
hql.append(" where ");
List<Object> strs = new ArrayList<Object>();
for (PropertyDescriptor propertyDescriptor : pros) {
try {
Method methodGetX = propertyDescriptor.getReadMethod(); // Read对应get()方法
Method methodSet = propertyDescriptor.getWriteMethod();
String properyName = propertyDescriptor.getName();
if (methodGetX != null && methodSet != null) {
Object reValue = methodGetX.invoke(req);
if (reValue == null || (reValue + "").equals("")) {
continue;
}
DaoHelper daoHelper = methodGetX
.getAnnotation(DaoHelper.class);
//
boolean iscontinu = false;
if (daoHelper != null) {
DaoHelper.IgnoreValue ignoreValue = daoHelper.ignore();
switch (ignoreValue) {
case ZERO:
if (reValue instanceof Integer) {
if ((int) reValue == 0) {
iscontinu = true;
}
} else if (reValue instanceof Long) {
if ((long) reValue == 0) {
continue;
}
} else if (reValue instanceof Double) {
if ((double) reValue == 0) {
continue;
}
} else if (reValue instanceof String) {
if (Integer.parseInt(reValue + "") == 0) {
continue;
}
}
break;
case NULLCOLLECTION:
Collection<?> c = (Collection<?>) reValue;
if (c != null && c.size() <= 0) {
iscontinu = true;
}
break;
case NONE:
iscontinu = true;
break;
default:
break;
}
}
if (isContainsPageProperty(properyName)) {
continue;
}
if (iscontinu) {
continue;
}
if (daoHelper != null) {
DaoHelper.SearchMethod searchMethod = daoHelper.searchMethod();
if (searchMethod != null) {
switch (searchMethod) {
case like: {
strs.add("%" + reValue + "%");
hql.append(" " + propertyDescriptor.getName())
.append(" like ? ").append("and ");
break;
}
default:
break;
}
} else {
strs.add(reValue);
hql.append(" " + propertyDescriptor.getName())
.append(" = ? ").append("and ");
}
} else {
strs.add(reValue);
hql.append(" " + propertyDescriptor.getName())
.append(" = ? ").append("and ");
}
}
} catch (IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
hql.append(" 1=1 ");
if (req instanceof PageRequest) {
Map<String, Sort.Direction> od = ((PageRequest) req).getOrders();
if (od != null) {
StringBuilder sb = new StringBuilder(" order by ");
for (String key : od.keySet()) {
sb.append(key).append(" ").append(od.get(key)).append(",");
}
hql.append(sb.substring(0, sb.length() - 1));
}
}
return new QueryUtil(hql.toString(), strs);
}
public static boolean isContainsPageProperty(String properyName) {
String[] sts = ConfigUtil.getByKey("page.property").split(",");
for (String string : sts) {
if (properyName.equalsIgnoreCase(string)) {
return true;
}
}
return false;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((hql == null) ? 0 : hql.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
QueryUtil other = (QueryUtil) obj;
if (hql == null) {
if (other.hql != null)
return false;
} else if (!hql.equals(other.hql))
return false;
String vs = checkVs();
if (vs == null) {
if (other.checkVs() != null)
return false;
} else if (!vs.equals(other.checkVs()))
return false;
return true;
}
private String checkVs() {
return ParseJSON.toJson(this.values);
}
@Override
public String toString() {
return "QueryUtil [hql=" + hql + ", values=" + values + "]";
}
}
| [
"ant_shake_tree@163.com"
] | ant_shake_tree@163.com |
2033b3ddfbe1289de087f37008c7de31ca1a296b | 13cbb329807224bd736ff0ac38fd731eb6739389 | /jdk/internal/util/xml/XMLStreamException.java | c513c40ead4e9086ffbf6307fd2a8a2e15615cbb | [] | no_license | ZhipingLi/rt-source | 5e2537ed5f25d9ba9a0f8009ff8eeca33930564c | 1a70a036a07b2c6b8a2aac6f71964192c89aae3c | refs/heads/master | 2023-07-14T15:00:33.100256 | 2021-09-01T04:49:04 | 2021-09-01T04:49:04 | 401,933,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 822 | java | package jdk.internal.util.xml;
public class XMLStreamException extends Exception {
private static final long serialVersionUID = 1L;
protected Throwable nested;
public XMLStreamException() {}
public XMLStreamException(String paramString) { super(paramString); }
public XMLStreamException(Throwable paramThrowable) {
super(paramThrowable);
this.nested = paramThrowable;
}
public XMLStreamException(String paramString, Throwable paramThrowable) {
super(paramString, paramThrowable);
this.nested = paramThrowable;
}
public Throwable getNestedException() { return this.nested; }
}
/* Location: D:\software\jd-gui\jd-gui-windows-1.6.3\rt.jar!\jdk\interna\\util\xml\XMLStreamException.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.0.7
*/ | [
"michael__lee@yeah.net"
] | michael__lee@yeah.net |
d3441e4002b8c0b6ac06b4d7a491716f8119b18f | f627b4684be1c1c3f0eaffa7a8a3427a39efc1e0 | /cloud-consumer-feign-order80/src/main/java/com/demo/springcloud/orderFeignOrder80.java | 27a41648b90b3130d27b51193e1bc05f3d0c2af7 | [] | no_license | wanghuadong-v/springcloud | a0922b2d992a492ae5fbca0043b048265c167f8b | 245956e4911c3ace4583469162b981d568f7f3fa | refs/heads/master | 2023-02-01T08:57:33.530469 | 2020-12-15T13:08:25 | 2020-12-15T13:08:25 | 308,487,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.demo.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @Author: wanghuadong
* @Date: 2020/11/12 22:10
* @Version: 1.0
*/
@SpringBootApplication
@EnableFeignClients
public class orderFeignOrder80 {
public static void main(String[] args) {
SpringApplication.run(orderFeignOrder80.class,args);
}
}
| [
"1453240241@qq.com"
] | 1453240241@qq.com |
a72741e52ba64819e18a4e34e4a7057c26c4c4b6 | cb3b9a6bd423174df9afa2a6dba76d0ee0a1fd6a | /src/entity/databaseEntity/PreTaskUser.java | 87e0824484ea7b50d3ad1d8a2dd71453f3b5017f | [] | no_license | callmewindow/AppPlatService | b4f8ed45575e02bd6faf2e559ef3b3fb61146928 | b97994b492a33cf92ec1548fb89bede101b59fe3 | refs/heads/main | 2023-01-22T16:50:33.893521 | 2020-11-18T13:36:36 | 2020-11-18T13:36:36 | 313,943,321 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,804 | java | package entity.databaseEntity;
/**
* Created by winter on 2014/6/28.
*/
public class PreTaskUser {
private String preTaskUserId;
private String userMailbox;
private Integer isPassed;
private Task taskByTaskId;
public String getPreTaskUserId() {
return preTaskUserId;
}
public void setPreTaskUserId(String preTaskUserId) {
this.preTaskUserId = preTaskUserId;
}
public String getUserMailbox() {
return userMailbox;
}
public void setUserMailbox(String userMailbox) {
this.userMailbox = userMailbox;
}
public Integer getIsPassed() {
return isPassed;
}
public void setIsPassed(Integer isPassed) {
this.isPassed = isPassed;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PreTaskUser that = (PreTaskUser) o;
if (isPassed != null ? !isPassed.equals(that.isPassed) : that.isPassed != null) return false;
if (preTaskUserId != null ? !preTaskUserId.equals(that.preTaskUserId) : that.preTaskUserId != null)
return false;
if (userMailbox != null ? !userMailbox.equals(that.userMailbox) : that.userMailbox != null) return false;
return true;
}
@Override
public int hashCode() {
int result = preTaskUserId != null ? preTaskUserId.hashCode() : 0;
result = 31 * result + (userMailbox != null ? userMailbox.hashCode() : 0);
result = 31 * result + (isPassed != null ? isPassed.hashCode() : 0);
return result;
}
public Task getTaskByTaskId() {
return taskByTaskId;
}
public void setTaskByTaskId(Task taskByTaskId) {
this.taskByTaskId = taskByTaskId;
}
}
| [
"847590417@qq.com"
] | 847590417@qq.com |
0689a9bd17edf742187a8cac3c9170125d95b355 | 48e51188d48154becc385d167f040c77b42677f5 | /tags/JSR-231-AFTER-RENAME/src/classes/com/sun/opengl/impl/x11/X11GLDrawableFactory.java | 997828864fed6474a5096de79bd8998c43133dc4 | [] | no_license | drosenthal/CompGraphics | d147d839ba1fe7ebf694d8439778099ffaa80d81 | 868b2b473a1fd7318e8ab1741f2cbda41537059b | refs/heads/master | 2018-12-28T08:27:17.796266 | 2013-05-07T03:11:27 | 2013-05-07T03:11:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,515 | java | /*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
* MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
* ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
* DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
*
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package com.sun.opengl.impl.x11;
import java.awt.Component;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.security.*;
import java.util.ArrayList;
import java.util.List;
import javax.media.opengl.*;
import com.sun.opengl.impl.*;
public class X11GLDrawableFactory extends GLDrawableFactoryImpl {
private static final boolean DEBUG = Debug.debug("X11GLDrawableFactory");
// There is currently a bug on Linux/AMD64 distributions in glXGetProcAddressARB
private static boolean isLinuxAMD64;
static {
NativeLibLoader.load();
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
String os = System.getProperty("os.name").toLowerCase();
String arch = System.getProperty("os.arch").toLowerCase();
if (os.startsWith("linux") && arch.equals("amd64")) {
isLinuxAMD64 = true;
}
return null;
}
});
}
public X11GLDrawableFactory() {
// Must initialize GLX support eagerly in case a pbuffer is the
// first thing instantiated
resetProcAddressTable(GLX.getGLXProcAddressTable());
}
private static final int MAX_ATTRIBS = 128;
public GraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
GLCapabilitiesChooser chooser,
GraphicsDevice device) {
int screen = X11SunJDKReflection.graphicsDeviceGetScreen(device);
// Until we have a rock-solid visual selection algorithm written
// in pure Java, we're going to provide the underlying window
// system's selection to the chooser as a hint
int[] attribs = glCapabilities2AttribList(capabilities, isMultisampleAvailable());
XVisualInfo[] infos = null;
GLCapabilities[] caps = null;
int recommendedIndex = -1;
lockAWT();
try {
long display = getDisplayConnection();
XVisualInfo recommendedVis = GLX.glXChooseVisual(display, screen, attribs, 0);
int[] count = new int[1];
XVisualInfo template = new XVisualInfo();
template.screen(screen);
infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count, 0);
if (infos == null) {
throw new GLException("Error while enumerating available XVisualInfos");
}
caps = new GLCapabilities[infos.length];
for (int i = 0; i < infos.length; i++) {
caps[i] = xvi2GLCapabilities(display, infos[i]);
// Attempt to find the visual chosen by glXChooseVisual
if (recommendedVis != null && recommendedVis.visualid() == infos[i].visualid()) {
recommendedIndex = i;
}
}
} finally {
unlockAWT();
}
int chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex);
if (chosen < 0 || chosen >= caps.length) {
throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")");
}
XVisualInfo vis = infos[chosen];
if (vis == null) {
throw new GLException("GLCapabilitiesChooser chose an invalid visual");
}
// FIXME: need to look at glue code and see type of this field
long visualID = vis.visualid();
// FIXME: the storage for the infos array, as well as that for the
// recommended visual, is leaked; should free them here with XFree()
// Now figure out which GraphicsConfiguration corresponds to this
// visual by matching the visual ID
GraphicsConfiguration[] configs = device.getConfigurations();
for (int i = 0; i < configs.length; i++) {
GraphicsConfiguration config = configs[i];
if (config != null) {
if (X11SunJDKReflection.graphicsConfigurationGetVisualID(config) == visualID) {
return config;
}
}
}
// Either we weren't able to reflectively introspect on the
// X11GraphicsConfig or something went wrong in the steps above;
// we're going to return null without signaling an error condition
// in this case (although we should distinguish between the two
// and possibly report more of an error in the latter case)
return null;
}
public GLDrawable getGLDrawable(Object target,
GLCapabilities capabilities,
GLCapabilitiesChooser chooser) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
if (!(target instanceof Component)) {
throw new IllegalArgumentException("GLDrawables not supported for objects of type " +
target.getClass().getName() + " (only Components are supported in this implementation)");
}
return new X11OnscreenGLDrawable((Component) target);
}
public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities,
GLCapabilitiesChooser chooser) {
return new X11OffscreenGLDrawable(capabilities, chooser);
}
private boolean pbufferSupportInitialized = false;
private boolean canCreateGLPbuffer = false;
public boolean canCreateGLPbuffer(GLCapabilities capabilities,
int initialWidth,
int initialHeight) {
if (!pbufferSupportInitialized) {
Runnable r = new Runnable() {
public void run() {
long display = getDisplayConnection();
lockAWT();
try {
int[] major = new int[1];
int[] minor = new int[1];
if (!GLX.glXQueryVersion(display, major, 0, minor, 0)) {
throw new GLException("glXQueryVersion failed");
}
if (DEBUG) {
System.err.println("!!! GLX version: major " + major[0] +
", minor " + minor[0]);
}
int screen = 0; // FIXME: provide way to specify this?
// Work around bugs in ATI's Linux drivers where they report they
// only implement GLX version 1.2 but actually do support pbuffers
if (major[0] == 1 && minor[0] == 2) {
String str = GLX.glXQueryServerString(display, screen, GLX.GLX_VENDOR);
if (str != null && str.indexOf("ATI") >= 0) {
canCreateGLPbuffer = true;
}
} else {
canCreateGLPbuffer = ((major[0] > 1) || (minor[0] > 2));
}
pbufferSupportInitialized = true;
} finally {
unlockAWT();
}
}
};
maybeDoSingleThreadedWorkaround(r);
}
return canCreateGLPbuffer;
}
public GLPbuffer createGLPbuffer(final GLCapabilities capabilities,
final int initialWidth,
final int initialHeight,
final GLContext shareWith) {
if (!canCreateGLPbuffer(capabilities, initialWidth, initialHeight)) {
throw new GLException("Pbuffer support not available with current graphics card");
}
final List returnList = new ArrayList();
Runnable r = new Runnable() {
public void run() {
X11PbufferGLDrawable pbufferDrawable = new X11PbufferGLDrawable(capabilities,
initialWidth,
initialHeight);
GLPbufferImpl pbuffer = new GLPbufferImpl(pbufferDrawable, shareWith);
returnList.add(pbuffer);
}
};
maybeDoSingleThreadedWorkaround(r);
return (GLPbuffer) returnList.get(0);
}
public GLContext createExternalGLContext() {
return new X11ExternalGLContext();
}
public boolean canCreateExternalGLDrawable() {
return canCreateGLPbuffer(null, 0, 0);
}
public GLDrawable createExternalGLDrawable() {
return new X11ExternalGLDrawable();
}
public long dynamicLookupFunction(String glFuncName) {
long res = 0;
if (!isLinuxAMD64) {
res = GLX.glXGetProcAddressARB(glFuncName);
}
if (res == 0) {
// GLU routines aren't known to the OpenGL function lookup
res = GLX.dlsym(glFuncName);
}
return res;
}
public static GLCapabilities xvi2GLCapabilities(long display, XVisualInfo info) {
int[] tmp = new int[1];
int val = glXGetConfig(display, info, GLX.GLX_USE_GL, tmp, 0);
if (val == 0) {
// Visual does not support OpenGL
return null;
}
val = glXGetConfig(display, info, GLX.GLX_RGBA, tmp, 0);
if (val == 0) {
// Visual does not support RGBA
return null;
}
GLCapabilities res = new GLCapabilities();
res.setDoubleBuffered(glXGetConfig(display, info, GLX.GLX_DOUBLEBUFFER, tmp, 0) != 0);
res.setStereo (glXGetConfig(display, info, GLX.GLX_STEREO, tmp, 0) != 0);
// Note: use of hardware acceleration is determined by
// glXCreateContext, not by the XVisualInfo. Optimistically claim
// that all GLCapabilities have the capability to be hardware
// accelerated.
res.setHardwareAccelerated(true);
res.setDepthBits (glXGetConfig(display, info, GLX.GLX_DEPTH_SIZE, tmp, 0));
res.setStencilBits (glXGetConfig(display, info, GLX.GLX_STENCIL_SIZE, tmp, 0));
res.setRedBits (glXGetConfig(display, info, GLX.GLX_RED_SIZE, tmp, 0));
res.setGreenBits (glXGetConfig(display, info, GLX.GLX_GREEN_SIZE, tmp, 0));
res.setBlueBits (glXGetConfig(display, info, GLX.GLX_BLUE_SIZE, tmp, 0));
res.setAlphaBits (glXGetConfig(display, info, GLX.GLX_ALPHA_SIZE, tmp, 0));
res.setAccumRedBits (glXGetConfig(display, info, GLX.GLX_ACCUM_RED_SIZE, tmp, 0));
res.setAccumGreenBits(glXGetConfig(display, info, GLX.GLX_ACCUM_GREEN_SIZE, tmp, 0));
res.setAccumBlueBits (glXGetConfig(display, info, GLX.GLX_ACCUM_BLUE_SIZE, tmp, 0));
res.setAccumAlphaBits(glXGetConfig(display, info, GLX.GLX_ACCUM_ALPHA_SIZE, tmp, 0));
if (isMultisampleAvailable()) {
res.setSampleBuffers(glXGetConfig(display, info, GLX.GLX_SAMPLE_BUFFERS_ARB, tmp, 0) != 0);
res.setNumSamples (glXGetConfig(display, info, GLX.GLX_SAMPLES_ARB, tmp, 0));
}
return res;
}
public static int[] glCapabilities2AttribList(GLCapabilities caps,
boolean isMultisampleAvailable) {
int colorDepth = (caps.getRedBits() +
caps.getGreenBits() +
caps.getBlueBits());
if (colorDepth < 15) {
throw new GLException("Bit depths < 15 (i.e., non-true-color) not supported");
}
int[] res = new int[MAX_ATTRIBS];
int idx = 0;
res[idx++] = GLX.GLX_RGBA;
if (caps.getDoubleBuffered()) {
res[idx++] = GLX.GLX_DOUBLEBUFFER;
}
if (caps.getStereo()) {
res[idx++] = GLX.GLX_STEREO;
}
res[idx++] = GLX.GLX_RED_SIZE;
res[idx++] = caps.getRedBits();
res[idx++] = GLX.GLX_GREEN_SIZE;
res[idx++] = caps.getGreenBits();
res[idx++] = GLX.GLX_BLUE_SIZE;
res[idx++] = caps.getBlueBits();
res[idx++] = GLX.GLX_ALPHA_SIZE;
res[idx++] = caps.getAlphaBits();
res[idx++] = GLX.GLX_DEPTH_SIZE;
res[idx++] = caps.getDepthBits();
res[idx++] = GLX.GLX_STENCIL_SIZE;
res[idx++] = caps.getStencilBits();
res[idx++] = GLX.GLX_ACCUM_RED_SIZE;
res[idx++] = caps.getAccumRedBits();
res[idx++] = GLX.GLX_ACCUM_GREEN_SIZE;
res[idx++] = caps.getAccumGreenBits();
res[idx++] = GLX.GLX_ACCUM_BLUE_SIZE;
res[idx++] = caps.getAccumBlueBits();
if (isMultisampleAvailable && caps.getSampleBuffers()) {
res[idx++] = GLXExt.GLX_SAMPLE_BUFFERS_ARB;
res[idx++] = GL.GL_TRUE;
res[idx++] = GLXExt.GLX_SAMPLES_ARB;
res[idx++] = caps.getNumSamples();
}
res[idx++] = 0;
return res;
}
// JAWT access
private static JAWT jawt;
public static JAWT getJAWT() {
if (jawt == null) {
JAWT j = new JAWT();
j.version(JAWTFactory.JAWT_VERSION_1_4);
if (!JAWTFactory.JAWT_GetAWT(j)) {
throw new RuntimeException("Unable to initialize JAWT");
}
jawt = j;
}
return jawt;
}
public static void lockAWT() {
getJAWT().Lock();
}
public static void unlockAWT() {
getJAWT().Unlock();
}
// Display connection for use by visual selection algorithm and by all offscreen surfaces
private static long staticDisplay;
public static long getDisplayConnection() {
if (staticDisplay == 0) {
lockAWT();
try {
staticDisplay = GLX.XOpenDisplay(null);
} finally {
unlockAWT();
}
if (staticDisplay == 0) {
throw new GLException("Unable to open default display, needed for visual selection and offscreen surface handling");
}
}
return staticDisplay;
}
private static boolean checkedMultisample;
private static boolean multisampleAvailable;
public static boolean isMultisampleAvailable() {
if (!checkedMultisample) {
long display = getDisplayConnection();
String exts = GLX.glXGetClientString(display, GLX.GLX_EXTENSIONS);
if (exts != null) {
multisampleAvailable = (exts.indexOf("GLX_ARB_multisample") >= 0);
}
checkedMultisample = true;
}
return multisampleAvailable;
}
private static String glXGetConfigErrorCode(int err) {
switch (err) {
case GLX.GLX_NO_EXTENSION: return "GLX_NO_EXTENSION";
case GLX.GLX_BAD_SCREEN: return "GLX_BAD_SCREEN";
case GLX.GLX_BAD_ATTRIBUTE: return "GLX_BAD_ATTRIBUTE";
case GLX.GLX_BAD_VISUAL: return "GLX_BAD_VISUAL";
default: return "Unknown error code " + err;
}
}
public static int glXGetConfig(long display, XVisualInfo info, int attrib, int[] tmp, int tmp_offset) {
if (display == 0) {
throw new GLException("No display connection");
}
int res = GLX.glXGetConfig(display, info, attrib, tmp, tmp_offset);
if (res != 0) {
throw new GLException("glXGetConfig failed: error code " + glXGetConfigErrorCode(res));
}
return tmp[tmp_offset];
}
private void maybeDoSingleThreadedWorkaround(Runnable action) {
if (SingleThreadedWorkaround.doWorkaround() &&
!SingleThreadedWorkaround.isOpenGLThread()) {
SingleThreadedWorkaround.invokeOnOpenGLThread(action);
} else {
action.run();
}
}
}
| [
"davros23@hotmail.com"
] | davros23@hotmail.com |
3a32107169639069f9822abd50a6943be3863cb1 | 801ea23bf1e788dee7047584c5c26d99a4d0b2e3 | /com/planet_ink/coffee_mud/Abilities/Skills/Skill_Haggle.java | ef1ff898cd68a092d59ff5dd2a4d841e584b1d79 | [
"Apache-2.0"
] | permissive | Tearstar/CoffeeMud | 61136965ccda651ff50d416b6c6af7e9a89f5784 | bb1687575f7166fb8418684c45f431411497cef9 | refs/heads/master | 2021-01-17T20:23:57.161495 | 2014-10-18T08:03:37 | 2014-10-18T08:03:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,024 | java | package com.planet_ink.coffee_mud.Abilities.Skills;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2003-2014 Bo Zimmerman
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.
*/
@SuppressWarnings({"unchecked","rawtypes"})
public class Skill_Haggle extends StdSkill
{
@Override public String ID() { return "Skill_Haggle"; }
private final static String localizedName = CMLib.lang().L("Haggle");
@Override public String name() { return localizedName; }
@Override protected int canAffectCode(){return CAN_MOBS;}
@Override protected int canTargetCode(){return CAN_MOBS;}
@Override public int abstractQuality(){return Ability.QUALITY_INDIFFERENT;}
private static final String[] triggerStrings =I(new String[] {"HAGGLE"});
@Override public String[] triggerStrings(){return triggerStrings;}
@Override public int classificationCode(){return Ability.ACODE_SKILL|Ability.DOMAIN_INFLUENTIAL;}
@Override
public void affectCharStats(MOB affectedMOB, CharStats affectableStats)
{
super.affectCharStats(affectedMOB,affectableStats);
affectableStats.setStat(CharStats.STAT_CHARISMA,affectableStats.getStat(CharStats.STAT_CHARISMA)+10+getXLEVELLevel(invoker()));
}
@Override
public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel)
{
String cmd="";
if(commands.size()>0)
cmd=((String)commands.firstElement()).toUpperCase();
if((commands.size()<2)||((!cmd.equals("BUY")&&(!cmd.equals("SELL")))))
{
mob.tell(L("You must specify BUY, SELL, an item, and possibly a ShopKeeper (unless it is implied)."));
return false;
}
final Environmental shopkeeper=CMLib.english().parseShopkeeper(mob,commands,CMStrings.capitalizeAndLower(cmd)+" what to whom?");
if(shopkeeper==null) return false;
if(commands.size()==0)
{
mob.tell(L("@x1 what?",CMStrings.capitalizeAndLower(cmd)));
return false;
}
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final CMMsg msg=CMClass.getMsg(mob,shopkeeper,this,CMMsg.MSG_SPEAK,auto?"":L("<S-NAME> haggle(s) with <T-NAMESELF>."));
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
invoker=mob;
mob.addEffect(this);
mob.recoverCharStats();
commands.insertElementAt(CMStrings.capitalizeAndLower(cmd),0);
mob.doCommand(commands,Command.METAFLAG_FORCED);
commands.addElement(shopkeeper.name());
mob.delEffect(this);
mob.recoverCharStats();
}
}
else
beneficialWordsFizzle(mob,shopkeeper,L("<S-NAME> haggle(s) with <T-NAMESELF>, but <S-IS-ARE> unconvincing."));
// return whether it worked
return success;
}
}
| [
"bo@zimmers.net"
] | bo@zimmers.net |
44ec3b0d9567d71184588fd64377a398fc840df8 | 44c4977230cdafdaf2e2094c3054f4296f74adc9 | /app/src/androidTest/java/danielfarias/com/testefragments/ExampleInstrumentedTest.java | 7e86af5d71df2b0a19ab8e8841ff5b54c0b3b815 | [] | no_license | danielfarias09/TesteFragments | 60a97f13e635fdd8b29d70cb9e0d69274ee9654d | e0d6f0e563779c0fac07f906df47d4ccfb46a2b3 | refs/heads/master | 2021-01-19T21:41:48.971531 | 2017-04-19T02:34:07 | 2017-04-19T02:34:07 | 88,690,990 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package danielfarias.com.testefragments;
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.*;
/**
* Instrumentation 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("danielfarias.com.testefragments", appContext.getPackageName());
}
}
| [
"danielfarias09@hotmail.com"
] | danielfarias09@hotmail.com |
d471781b1818efa12e4877d0d6c10b604de3671c | 7fa9c6b0fa1d0726ae1cda0199716c811a1ea01b | /Crawler/data/MonoRuntimeProvider.java | cabfd7269f586aeb045a87c2fa8b85ef483816d6 | [] | no_license | NayrozD/DD2476-Project | b0ca75799793d8ced8d4d3ba3c43c79bb84a72c0 | 94dfb3c0a470527b069e2e0fd9ee375787ee5532 | refs/heads/master | 2023-03-18T04:04:59.111664 | 2021-03-10T15:03:07 | 2021-03-10T15:03:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,073 | java | 2
https://raw.githubusercontent.com/AtomizedSoul/TulpApp/master/TulpApp.Android/obj/Release/90/android/src/mono/MonoRuntimeProvider.java
package mono;
//NOTE: we can't use import, see Generator.GetMonoInitSource
public class MonoRuntimeProvider
extends android.content.ContentProvider
{
public MonoRuntimeProvider ()
{
}
@Override
public boolean onCreate ()
{
return true;
}
@Override
public void attachInfo (android.content.Context context, android.content.pm.ProviderInfo info)
{
// Mono Runtime Initialization {{{
android.content.pm.ApplicationInfo applicationInfo = context.getApplicationInfo ();
String[] apks = null;
if (android.os.Build.VERSION.SDK_INT >= 21) {
String[] splitApks = applicationInfo.splitPublicSourceDirs;
if (splitApks != null && splitApks.length > 0) {
apks = new String[splitApks.length + 1];
apks [0] = applicationInfo.sourceDir;
System.arraycopy (splitApks, 0, apks, 1, splitApks.length);
}
}
if (apks == null) {
apks = new String[] { applicationInfo.sourceDir };
}
mono.MonoPackageManager.LoadApplication (context, applicationInfo, apks);
// }}}
super.attachInfo (context, info);
}
@Override
public android.database.Cursor query (android.net.Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
{
throw new RuntimeException ("This operation is not supported.");
}
@Override
public String getType (android.net.Uri uri)
{
throw new RuntimeException ("This operation is not supported.");
}
@Override
public android.net.Uri insert (android.net.Uri uri, android.content.ContentValues initialValues)
{
throw new RuntimeException ("This operation is not supported.");
}
@Override
public int delete (android.net.Uri uri, String where, String[] whereArgs)
{
throw new RuntimeException ("This operation is not supported.");
}
@Override
public int update (android.net.Uri uri, android.content.ContentValues values, String where, String[] whereArgs)
{
throw new RuntimeException ("This operation is not supported.");
}
}
| [
"veronika.cucorova@gmail.com"
] | veronika.cucorova@gmail.com |
422a392aaa94401a2ea1012905b10527ce0d983d | bc24c4fa6bffc7ba452f8de45e2d1229224f39b3 | /src/main/java/com/zup/microservice/metrics/DatabaseConnectionIndicator.java | bfb2282c3e1e85f1b43a9d9858a308d7aba6509b | [
"Apache-2.0"
] | permissive | ricamartins/orange-talents-03-template-proposta | e9d3e22b0b0a75767481779de88c59a5967a2ecd | 18d956352415443466c965a03490b8cea4e8fb7a | refs/heads/main | 2023-04-12T00:01:35.318971 | 2021-05-03T17:53:32 | 2021-05-03T17:53:32 | 356,304,436 | 0 | 0 | Apache-2.0 | 2021-04-09T14:47:20 | 2021-04-09T14:47:19 | null | UTF-8 | Java | false | false | 918 | java | package com.zup.microservice.metrics;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthContributor;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;
@Component
public class DatabaseConnectionIndicator implements HealthIndicator, HealthContributor {
private DataSource ds;
public DatabaseConnectionIndicator(DataSource ds) {
this.ds = ds;
}
@Override
public Health health() {
try {
Connection connection = ds.getConnection();
Statement statement = connection.createStatement();
statement.execute("select 1 from tb_proposals");
return Health.up().build();
} catch (SQLException e) {
return Health.outOfService().withException(e).build();
}
}
}
| [
"martinsc.ricardo@gmail.com"
] | martinsc.ricardo@gmail.com |
2c40db1cf84ae4070e2bb730e8148f32f02b33ca | 643d701fc59bf663dd8ec809576521147d54c313 | /src/main/java/gwt/jelement/core/MappingFunction.java | f357a947785bc8495a94cebfb8333caa4088dcfe | [
"MIT"
] | permissive | gwt-jelement/gwt-jelement | 8e8cca46b778ed1146a2efd8be996a358f974b44 | f28303d85f16cefa1fc067ccb6f0b610cdf942f4 | refs/heads/master | 2021-01-01T17:03:07.607472 | 2018-01-16T15:46:44 | 2018-01-16T15:46:44 | 97,984,978 | 6 | 5 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | /*
* Copyright 2017 Abed Tony BenBrahim <tony.benrahim@10xdev.com>
* and Gwt-JElement project contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package gwt.jelement.core;
import jsinterop.annotations.JsFunction;
@JsFunction
public interface MappingFunction<T,U>{
U map(T element, double index, Array array);
}
| [
"tony.benbrahim@gmail.com"
] | tony.benbrahim@gmail.com |
5b875f24f4c5f9a05cf81988f49cc4e08cbe65e0 | 91fafac28ff56104c2d1730b1ab8c850ad51cc5d | /src/com/xe/tool/mark/Type.java | 3ea1f9e48f5850580ed964391f6df1690fb17726 | [] | no_license | gyi/xetool | e91a274468454bdd13955f8528078ae1a6fc7ed1 | 1e65fd1233656c8790e16685eba75ccece0f97a0 | refs/heads/master | 2021-01-01T20:35:30.306830 | 2015-01-30T09:33:02 | 2015-01-30T09:33:02 | 30,065,477 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.xe.tool.mark;
/**
*
* @Create time : 2014-11-26
* @author : zhaowei
* @Description : TODO 数据类型
*/
public enum Type {
/**
* 基础数据类型
*/
basic,
/**
* 复合类型
*/
complex,
/**
* 数组
*/
arr,
/**
* map类型
*/
map,
/**
* list类型
*/
list
}
| [
"syflvcode@yeah.net"
] | syflvcode@yeah.net |
c8a974673432fd775739194052ba616b8d2b7fb0 | baacc34980366c56d862514d96a8e3ed5e916c2d | /JITSshipping/test/jesseboyd/jitsShipping/io/WriteDeliveryToXMLTest.java | 7539a0f492f3dc3e653e88e6c5c059454642bba6 | [] | no_license | jessewriter/jitsShippingKisok | 72607c7c148e6481ed69fd500dd3b763c5fa0b8a | a689af11ce69a6ec6638d3482f819290751b7c5d | refs/heads/master | 2021-03-30T16:24:10.924115 | 2017-08-26T21:07:02 | 2017-08-26T21:07:02 | 100,803,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,110 | java | package jesseboyd.jitsShipping.io;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import jesseboyd.jitsShipping.DemoParcelsForTesting;
import jesseboyd.jitsShipping.address.UnitedStatesAddress;
import jesseboyd.jitsShipping.delivery.DeliveryStatus;
import jesseboyd.jitsShipping.delivery.ValidUSADelivery;
import jesseboyd.jitsShipping.delivery.ValidUSADeliveryDAOSerializable;
import jesseboyd.jitsShipping.parcels.Parcel;
public class WriteDeliveryToXMLTest {
@SuppressWarnings("unused")
private WriteDeliveryToXML wdtx;
private ValidUSADelivery vud;
private ValidUSADeliveryDAOSerializable vudds;
@Before
public void setUp() throws Exception {
List<Parcel> parcels = DemoParcelsForTesting.getParcels();
List<UnitedStatesAddress> demoStatesAddresses = DemoParcelsForTesting.getUsaAddresses();
vud = new ValidUSADelivery(parcels.get(0), 100, 5, 7.5, demoStatesAddresses.get(0),
demoStatesAddresses.get(1), DeliveryStatus.accepted);
vudds = new ValidUSADeliveryDAOSerializable(vud);
}
@Test
public void test() {
wdtx = new WriteDeliveryToXML(vudds);
}
}
| [
"16365134+jessewriter@users.noreply.github.com"
] | 16365134+jessewriter@users.noreply.github.com |
c1a64341f0a44bc85fcc12090f4388d1311c5e45 | 36995a4a2672b51f9662a21979e69e57eeca0dca | /src/main/java/org/xbib/graphics/chart/io/vector/intermediate/commands/SetColorCommand.java | d5d3fc12308ffa3ba2c90dc11f3f5456e77f2fff | [] | no_license | jprante/chart | 211e4dd0ac674919de88e7d170e5e1444617e144 | 71403bc3ab669c9ed0d403e6a8e6c29c884a3f99 | refs/heads/master | 2023-08-14T17:46:18.688343 | 2020-10-07T22:43:54 | 2020-10-07T22:43:54 | 146,636,273 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | package org.xbib.graphics.chart.io.vector.intermediate.commands;
import java.awt.Color;
public class SetColorCommand extends StateCommand<Color> {
public SetColorCommand(Color color) {
super(color);
}
}
| [
"joergprante@gmail.com"
] | joergprante@gmail.com |
0363a3111d46766c04114c669dc52656890f4521 | 01a9d833d3bb02a2fecd6519f511984ab792560c | /src/agenziaviaggi/Filiale.java | 79296838ff24ff7e3b0be18d110f5c427c7204e2 | [] | no_license | lxmiccio/Ese104-AgenziaViaggi | 2a0eeb37583359fa6afd46b8dc5db535efe2eeb9 | d61e73ebd601fed509e4a4a1c8fe0b232960aeff | refs/heads/master | 2021-01-18T11:05:42.854165 | 2015-04-17T20:47:02 | 2015-04-17T20:47:02 | 33,986,755 | 0 | 0 | null | 2015-04-15T10:06:32 | 2015-04-15T10:06:31 | null | UTF-8 | Java | false | false | 286 | java | package agenziaviaggi;
public class Filiale
{
private int numero;
public Filiale(int numero)
{
this.numero = numero;
}
public int getNumero()
{
return numero;
}
@Override public String toString()
{
return "Filiale [numero=" + numero + "]";
}
} | [
"andrei523070@gmail.com"
] | andrei523070@gmail.com |
5651fda10af48fac7cc601d3e091a2daece1ad35 | 6b728db76f198aa5221f74c7b301394fc86611d3 | /06_InheritanceAndPolymorphism/Clients/src/clients/PrivatPerson.java | 135f96c859cde5234522a0dc9a9f981f3b6af114 | [] | no_license | NikitaPerevozchikov/Skillbox | ce6dcf7d1345afaba72aca69f98782486f832501 | 0b7076947ccea750b2c8a999140113186380b675 | refs/heads/master | 2023-07-10T00:14:50.803758 | 2021-08-14T19:09:57 | 2021-08-14T19:09:57 | 396,100,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 552 | java | package clients;
public class PrivatPerson extends Client {
public PrivatPerson(double sum) {
this.sum = sum;
}
@Override
public double getSum() {
return sum;
}
@Override
public void addMoney(double sum) {
this.sum += sum;
}
@Override
public void takeMoney(double sum) {
if (sum > this.sum) {
System.out.println("Недостаточно средств для выполнения оперции");
return;
}
this.sum -= sum;
}
}
| [
"9045480568@mail.ru"
] | 9045480568@mail.ru |
b80b11c0f9752811d742a91e7309b469a42f0dec | a6eb177429a855ad7cb4e3afaa1f85ea8a202f95 | /src/main/java/com/iweb/dao/entity/UserInfoAttach.java | c027533a356382e14b0326f4ccd4401dd852fa42 | [] | no_license | xpengV/iWebApp | 560f10484bfd583a51218c81ab9c67d1882aeeaa | 0813db4d93d4d75d36d8783eaca03daf140ef6b9 | refs/heads/master | 2020-04-23T20:17:44.528571 | 2019-02-19T08:27:28 | 2019-02-19T08:27:28 | 171,197,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,535 | java | package com.iweb.dao.entity;
/**
* -------------------------------------------------
*
* @ClassName UserInfoAttach
* @Auther xiaopeng
* @Date 2019/2/19 14:25
* @Version 1.0
* @Description TODO
* -------------------------------------------------
*/
public class UserInfoAttach {
private String uuid;
private String registerData;
private String password;
private int pwdErrorTimes;
private String image;
public UserInfoAttach(){}
public UserInfoAttach(String uuid, String registerData, String password, int pwdErrorTimes, String image) {
this.uuid = uuid;
this.registerData = registerData;
this.password = password;
this.pwdErrorTimes = pwdErrorTimes;
this.image = image;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getRegisterData() {
return registerData;
}
public void setRegisterData(String registerData) {
this.registerData = registerData;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getPwdErrorTimes() {
return pwdErrorTimes;
}
public void setPwdErrorTimes(int pwdErrorTimes) {
this.pwdErrorTimes = pwdErrorTimes;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
}
| [
"a_xiao_peng@163.com"
] | a_xiao_peng@163.com |
a422f09b0a6bb96db7ed6f79abd1a66305831ba3 | 7d22f3c0b274775963a7fb0bf33afae160ab1df9 | /app/src/main/java/com/xu/headlinehelper/ui/activity/newtask/NewTaskActivity.java | b4ae284c862b80c816ca37748417c6d0a245eb08 | [] | no_license | xushanning/HeadlineHelper | 00b092b7f5eb1c489ae6fbb7a290e718f440c818 | 7ad62b11a7ceac93919422c17e729c98f108a6b7 | refs/heads/master | 2021-07-10T19:40:27.779421 | 2018-09-26T10:09:24 | 2018-09-26T10:09:24 | 131,945,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,973 | java | package com.xu.headlinehelper.ui.activity.newtask;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.jakewharton.rxbinding2.widget.RxTextView;
import com.xu.headlinehelper.R;
import com.xu.headlinehelper.di.component.ActivityComponent;
import com.xu.headlinehelper.ui.activity.basedownload.BaseDownloadMvpActivity;
import com.xu.headlinehelper.util.ToastUtil;
import butterknife.BindView;
import butterknife.OnClick;
import io.reactivex.functions.Consumer;
/**
* @author 言吾許
* 新建下载任务的activity
*/
public class NewTaskActivity extends BaseDownloadMvpActivity<INewTaskPresenter> implements INewTaskView {
@BindView(R.id.et_input)
EditText etInput;
@BindView(R.id.tv_download)
TextView tvDownload;
@Override
public int setLayout() {
return R.layout.activity_new_task;
}
@Override
public void inject(ActivityComponent activityComponent) {
activityComponent.inject(this);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
mPresenter.getClipboardData(this);
RxTextView.textChanges(etInput)
.subscribe(charSequence -> {
GradientDrawable drawable = new GradientDrawable();
drawable.setCornerRadius(5);
if (charSequence.length() == 0) {
tvDownload.setClickable(false);
drawable.setStroke(1, ContextCompat.getColor(NewTaskActivity.this, R.color.button_unpressed_bg));
drawable.setColor(ContextCompat.getColor(NewTaskActivity.this, R.color.button_unpressed_bg));
} else {
drawable.setStroke(1, ContextCompat.getColor(NewTaskActivity.this, R.color.colorPrimary));
drawable.setColor(ContextCompat.getColor(NewTaskActivity.this, R.color.colorPrimary));
tvDownload.setClickable(true);
}
tvDownload.setBackground(drawable);
});
}
@Override
public void loadClipboardData(String data) {
etInput.setText(data);
}
@Override
public void analysisUrlFailed(String msg) {
ToastUtil.toastShort(this, msg);
}
@Override
public void downloading() {
super.downloading();
finish();
}
@OnClick({R.id.tv_download, R.id.img_back})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_download:
mPresenter.getVideoUrl(etInput.getText().toString());
break;
case R.id.img_back:
finish();
break;
default:
break;
}
}
}
| [
"shanningxu@163.com"
] | shanningxu@163.com |
b440398740dae8083df6026f215d3b463243becc | ab1b417315a7bc4f7c8874c519d84ea931e90f4c | /Jtasks/src/com/krealll/tasks/TaskManager.java | 157b109d69b94144f9576b48c37f44edad939d2f | [] | no_license | Krealll/JRep | f249b722499a7a89f3bc7c97d660ef0595863954 | f0e64276183a54cb5307e28f4e5f63f62aafa976 | refs/heads/master | 2022-11-21T14:20:32.071421 | 2020-06-01T15:23:56 | 2020-06-01T15:23:56 | 248,188,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,373 | java | package com.krealll.tasks;
public class TaskManager {
public static void main(String[] args) {
try {
System.out.println("Stop value is 0");
System.out.println("Task1");
Task1 task1 = new Task1();
task1.run();
System.out.println("Task2");
Task2 task2 = new Task2();
task2.run();
System.out.println("Task3");
Task3 task3 = new Task3();
task3.run();
System.out.println("Task4");
Task4 task4 = new Task4();
task4.run();
System.out.println("Task5");
Task5 task5 = new Task5();
task5.run();
System.out.println("Task6");
Task6 task6 = new Task6();
task6.run();
System.out.println("Task7");
Task7 task7 = new Task7();
task7.run();
System.out.println("Task8");
Task8 task8 = new Task8();
task8.run();
System.out.println("Task9");
Task9 task9 = new Task9();
task9.run();
System.out.println("Task10");
Task10 task10 = new Task10();
task10.run();
}
catch (RuntimeException e){
System.out.println(e.getMessage());
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
4ab0d37c0ef97fa612c92cdf21772171ba88b1fa | f3b97350efdfe2c2faf62fb7bcc862ffd383f350 | /app/src/test/java/com/mcrealtime/wallpaperapp/ExampleUnitTest.java | e46c752e5be1886d8a4f75a7a2c415446e9045cf | [] | no_license | chintan-sonaviya/wallpaper_facebook | bce8af0cc4f12209c07c07fd96483c519503ad82 | 263c0cc9960d3f0d8948ea07480c799a2d5dc8ac | refs/heads/master | 2023-07-13T20:35:14.815165 | 2021-09-01T17:35:06 | 2021-09-01T17:35:06 | 402,147,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package com.mcrealtime.wallpaperapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"chintu.07kohali@gmail.com"
] | chintu.07kohali@gmail.com |
7b68bf4b87bc8aa2e97510ea72b7e5fecb857650 | a68755a41fce71f2ebb463915bef34efdb05c271 | /app/src/main/java/com/rivetlogic/mobilepeopledirectory/data/Database.java | 917e31082b341416326448c5d4332448105320b6 | [] | no_license | rivetlogic/liferay-mobile-directory-android | b75e208aa6d5630e23343f21173610e52da06787 | 6df042a572386340fbbb0f8118a3ad229ed8319f | refs/heads/master | 2021-01-01T17:00:51.456069 | 2015-05-21T03:36:31 | 2015-05-21T03:36:31 | 28,934,958 | 0 | 1 | null | 2015-05-18T16:05:28 | 2015-01-07T21:26:37 | Java | UTF-8 | Java | false | false | 5,578 | java | package com.rivetlogic.mobilepeopledirectory.data;
import android.content.ContentValues;
import android.content.Context;
import net.sqlcipher.Cursor;
import net.sqlcipher.SQLException;
import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;
import java.util.Vector;
public class Database {
private static final String DATABASE_NAME = "com.rivetlogic.mobilepeoplefinder.database.db";
private static final int DATABASE_VERSION = 1;
private static DatabaseHelper mDbHelper = null;
protected static SQLiteDatabase mDatabase;
protected String tableName;
private static final String VERSION_TABLE_NAME = "versions";
public static final String KEY_ID = "_id";
private static final String KEY_TABLE_NAME = "table_name";
private static final String KEY_TABLE_VERSION = "table_version";
private static TableRow[] versionTableDef = {
new TableRow(1, KEY_ID, TableRow.DbType.INTEGER_PRIMARY_KEY, TableRow.Nullable.FALSE),
new TableRow(1, KEY_TABLE_NAME, TableRow.DbType.TEXT, TableRow.Nullable.FALSE),
new TableRow(1, KEY_TABLE_VERSION, TableRow.DbType.INT, TableRow.Nullable.FALSE)
};
private static class DatabaseHelper extends SQLiteOpenHelper {
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
createTable(db, VERSION_TABLE_NAME, -1, versionTableDef, false);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(String.format("DROP TABLE IF EXISTS %s", VERSION_TABLE_NAME));
createTable(db, VERSION_TABLE_NAME, -1, versionTableDef, false);
}
}
protected synchronized Database open(Context context, String masterPassword, String tableName, int tableVersion, TableRow[] tableDef) throws SQLException {
SQLiteDatabase.loadLibs(context);
if (mDbHelper == null) {
mDbHelper = new DatabaseHelper(context);
mDatabase = mDbHelper.getWritableDatabase(masterPassword);
}
this.tableName = tableName;
int version = getTableVersion(mDatabase, tableName);
if (version == -1) {
createTable(mDatabase, tableName, tableVersion, tableDef, false);
}
else if (version != tableVersion) {
upgradeTable(mDatabase, tableName, tableVersion, version, tableDef);
}
return this;
}
protected static void createTable(SQLiteDatabase db, String tableName, int newTableVersion, TableRow[] tableDef, boolean noTran) {
StringBuffer sql = new StringBuffer(String.format("create table if not exists %s (", tableName));
for (int i = 0, s = tableDef.length; i < s; i++) {
if (!tableDef[i].isDelete())
sql.append(tableDef[i].toString());
}
sql.setLength(sql.length() - 1);
sql.append(");");
if (!noTran) {
db.beginTransaction();
}
try {
db.execSQL(sql.toString());
if (newTableVersion > 0) {
setTableVersion(db, tableName, newTableVersion);
}
if (!noTran) {
db.setTransactionSuccessful();
}
}
catch (Exception e) {
}
if (!noTran)
db.endTransaction();
}
protected static void upgradeTable(SQLiteDatabase db, String tableName, int newTableVersion, int oldTableVersion, TableRow[] tableDef) {
String tempTableName = String.format("%s_temp", tableName);
StringBuffer columns = new StringBuffer();
for (int i = 0, s = tableDef.length; i < s; i++) {
if (!tableDef[i].isDelete() && tableDef[i].getTableVersion() <= oldTableVersion) {
columns.append(tableDef[i].getName()).append(',');
}
}
columns.setLength(columns.length() - 1);
Vector<String> sql = new Vector<String>();
sql.add(String.format("INSERT INTO %s(%s) SELECT %s FROM %s",
tempTableName, columns.toString(), columns.toString(), tableName));
sql.add(String.format("DROP TABLE %s", tableName));
sql.add(String.format("ALTER TABLE %s RENAME TO %s", tempTableName, tableName));
db.beginTransaction();
try {
createTable(db, tempTableName, -1, tableDef, true);
for (int i = 0, s = sql.size(); i < s; i++) {
db.execSQL(sql.elementAt(i));
}
setTableVersion(db, tableName, newTableVersion);
db.setTransactionSuccessful();
}
catch (Exception e) {
}
db.endTransaction();
}
protected static int setTableVersion(SQLiteDatabase db, String tableName, int newVersion) {
ContentValues values = new ContentValues();
values.put(KEY_TABLE_VERSION, newVersion);
int result = db.update(VERSION_TABLE_NAME, values, String.format("%s=?", KEY_TABLE_NAME), new String[] {tableName});
if (result == 0) {
values.clear();
values.put(KEY_TABLE_NAME, tableName);
values.put(KEY_TABLE_VERSION, newVersion);
db.insert(VERSION_TABLE_NAME, null, values);
result = 1;
}
return result;
}
protected static int getTableVersion(SQLiteDatabase db, String tableName) {
int version = -1;
Cursor cursor = null;
try {
cursor = db.query(VERSION_TABLE_NAME, new String[] {KEY_TABLE_VERSION}, String.format("%s=?", KEY_TABLE_NAME), new String[] {tableName}, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
try {
version = cursor.getInt(0);
}
finally {
cursor.close();
}
}
}
catch (Exception e) {
}
return version;
}
public int getCount() {
String sql = String.format("SELECT COUNT(*) FROM %s", tableName);
Cursor cursor = mDatabase.rawQuery(sql, null);
int count = 0;
if(null != cursor) {
if(cursor.getCount() > 0) {
cursor.moveToFirst();
count = cursor.getInt(0);
}
cursor.close();
}
return count;
}
} | [
"thomas.lorenz@rivetlogic.com"
] | thomas.lorenz@rivetlogic.com |
f6bf6ec6667afa78b0890fbd7703a0b9029b7065 | f88580b96c2549172d2071a0b6fe6442f1527362 | /src/java/br/edu/ifsul/converter/ConverterUsuario.java | fcb203b8383b29572577920b16a4aff0a901a607 | [] | no_license | vitor-mft/TA-2018-1-6N1-Web | bd189a59c1be3d993c8d4e2fcf52efd7c6cc0d93 | 28bdc100dc7e895020563c2097650076d30fe579 | refs/heads/master | 2020-03-18T14:40:10.870702 | 2018-06-06T22:35:15 | 2018-06-06T22:35:15 | 134,860,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,349 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.edu.ifsul.converter;
import br.edu.ifsul.modelo.Usuario;
import java.io.Serializable;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author V_M_FT
*/
@FacesConverter (value = "converterUsuario")
public class ConverterUsuario implements Serializable, Converter{
@PersistenceContext(unitName = "TA-2018-1-6N1-WebPU")
private EntityManager em;
@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
if ( string == null || string.equals("Selecione um Registro")){
return null;
}
return em.find(Usuario.class,Integer.parseInt(string));
}
//aqui so vai precisar retornar o ID
@Override
public String getAsString(FacesContext fc, UIComponent uic, Object o) {
if(o == null){
return null;
}
Usuario obj = (Usuario) o;
return obj.getId().toString();
}
}
| [
"V_M_FT@DESKTOP-3TKRK7T"
] | V_M_FT@DESKTOP-3TKRK7T |
3354625fd61bcf832144605e47a2efb8b3e2bdbd | c3500c212bf46e08b6faba075c5e02ce40e9a749 | /taurus-restlet/src/main/java/com/dp/bigdata/taurus/restlet/utils/PoolManager.java | 7d5b7b322eaf94d025fca1b91a5246204bb736f4 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | lalaguozhe/Taurus | 6e17f058400d0f589b4c68969d57d5675adc64ef | 3dc704a75d18adc6089ed64e67480bd8968c7264 | refs/heads/master | 2022-05-02T17:48:45.981246 | 2022-03-08T05:51:36 | 2022-03-08T05:51:36 | 6,836,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,154 | java | package com.dp.bigdata.taurus.restlet.utils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import com.dp.bigdata.taurus.generated.mapper.PoolMapper;
import com.dp.bigdata.taurus.generated.module.Pool;
import com.dp.bigdata.taurus.generated.module.PoolExample;
/**
*
* PoolManager
* @author damon.zhu
*
*/
public class PoolManager {
@Autowired
private PoolMapper poolMapper;
private Map<Integer, String> idMap;
private Map<String, Integer> nameMap;
public void init(){
idMap = new HashMap<Integer, String>();
nameMap = new HashMap<String, Integer>();
PoolExample example = new PoolExample();
example.or();
List<Pool> pools = poolMapper.selectByExample(example);
for(Pool pool : pools){
idMap.put(pool.getId(), pool.getName());
nameMap.put(pool.getName(), pool.getId());
}
}
public int getID(String name){
return nameMap.get(name);
}
public String getName(int id){
return idMap.get(id);
}
}
| [
"ainilife@gmail.com"
] | ainilife@gmail.com |
f286c2a08b746cd35f126570257e68a18410fe8c | 5eaf82827850b87e12db6c8b7a804e8a8748af9b | /java_project/src/main/java/com/cl/interview/service/impl/BookChapterServiceImpl.java | fea882ee911b4f6bcf4b33e7f8cddb3689ae8981 | [] | no_license | learnjavaforly/interview | bd987230de611506ad4115e0c10d0629c582f28c | d8f8fb6bf112c0119aa1c27668ebd1f9c8f7aeb3 | refs/heads/master | 2022-04-24T10:31:14.275058 | 2020-04-26T14:34:06 | 2020-04-26T14:34:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,275 | java | package com.cl.interview.service.impl;
import com.cl.interview.common.HttpResp;
import com.cl.interview.common.IoTErrorCode;
import com.cl.interview.common.Page;
import com.cl.interview.config.BaseConfig;
import com.cl.interview.dao.BaseDao;
import com.cl.interview.dao.BookChapterDao;
import com.cl.interview.dao.BookDao;
import com.cl.interview.dto.BookChapterDto;
import com.cl.interview.entity.BookChapterEntity;
import com.cl.interview.po.BookChapterPo;
import com.cl.interview.service.BookChapterService;
import com.cl.interview.util.DaoUtil;
import com.cl.interview.util.SerializableFile;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.persistence.Transient;
import javax.transaction.Transactional;
import java.io.File;
import java.io.IOException;
import java.util.*;
@Slf4j
@Transactional
@Service("bookService")
public class BookChapterServiceImpl implements BookChapterService {
private static List<BookChapterPo> posCache;
@Autowired
BookChapterDao dao;
@Autowired
BaseConfig config;
@Resource
private BaseDao baseDao;
@Override
public List<BookChapterPo> findAll() {
return DaoUtil.convertDataList(dao.findAll());
}
@Override
public BookChapterPo save(BookChapterPo obj) {
// if (obj.getId() == null || obj.getId() == 0)
// obj.setId(IdGenerator.nextId());
if (obj.getParent() == null) {
obj.setParent(new BookChapterPo(0));
} else if (obj.getParent().getId() == null) {
obj.getParent().setId(0);
}
if (obj.getLevel() == null) {
if (obj.getParent().getLevel() == null) {
obj.setLevel(1);
} else {
BookChapterPo parent = getOne(obj.getParent().getId());
obj.setLevel(parent.getLevel() + 1);
}
}
obj.setCreateTime(Calendar.getInstance().getTime());
BookChapterEntity entity = obj.toObject();
return dao.save(entity).toObject();
}
@Override
public void delete(Integer id) {
dao.deleteById(id);
this.refreshCache();
}
@Override
public BookChapterPo getOne(Integer id) {
return dao.getOne(id).toObject();
}
@Override
public void delete(Iterable<BookChapterPo> entities) {
if (entities != null) {
for (BookChapterPo po : entities) {
dao.delete(po.toObject());
}
}
this.refreshCache();
}
@Override
public HttpResp create(BookChapterDto dto) {
HttpResp resp = new HttpResp();
save(dto.toObject());
this.refreshCache();
return resp;
}
@Override
public HttpResp update(BookChapterDto dto) {
// TODO Auto-generated method stub
HttpResp resp = new HttpResp();
BookChapterPo po = getOne(dto.getId());
if (po == null) {
resp.setCode(IoTErrorCode.ITEM_NOT_FOUND.getErrorCode());
resp.setMessage("编辑习题信息失败,习题信息不存在");
return resp;
}
save(dto.toObject());
this.refreshCache();
return resp;
}
@Override
public String doSerializable() {
String fileName = this.getClass().getSimpleName();
String filePath = config.getWebFilePath();
List<BookChapterPo> list = this.findAll();
try {
SerializableFile.doSerializable(list, filePath + File.separator + fileName + ".out");
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
public void saveByFile(MultipartFile mf) {
if (mf != null) {
List<BookChapterPo> list = null;
try {
list = (List<BookChapterPo>) SerializableFile.upSerializable(mf.getBytes());
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
if (list != null) {
for (int i = 0, len = list.size(); i < len; i++) {
BookChapterPo po = list.get(i);
boolean add = true;
if (po.getId() != null) {
BookChapterPo old = getOne(po.getId());
if (old != null) {
add = false;
}
}
if (add && po.getName() != null) {
save(po);
}
}
this.refreshCache();
}
}
}
private void refreshCache() {
posCache = null;
}
@Override
public List<Map> treeData() {
if (posCache == null) {
posCache = DaoUtil.convertDataList(this.dao.findByParentId(null));
}
return toMap(posCache);
}
public List<Map> toMap(List<BookChapterPo> pos) {
if (pos == null)
return null;
List<Map> list = new ArrayList<>();
for (int i = 0, size = pos.size(); i < size; i++) {
BookChapterPo po = pos.get(i);
Map<String, Object> map = new HashMap<>();
map.put("value", po.getId());
map.put("label", po.getName());
if (po.getChildren() != null && po.getChildren().size() > 0) {
map.put("children", toMap(po.getChildren()));
}
list.add(map);
}
return list;
}
@Override
public Page getDataByPage(int pageNo, int pageSize, BookChapterPo obj, List<String> orderBysList, String search) {
StringBuffer hql = new StringBuffer(" from BookChapterEntity entity ");
Map<String, Object> params = new HashMap<String, Object>();
String orderBy = "";
if (orderBysList != null && orderBysList.size() > 0) {
for (String i : orderBysList) {
orderBy = i;
}
}
if (obj != null) {
hql.append(getWhereSql(obj));
params = getWhereParam(obj);
}
if (search != null && search.length() > 0) {
hql.append("and entity.name like :search");
params.put("search", "%" + search + "%");
}
String queryHql = hql.toString();
if (orderBy.length() > 0) {
queryHql += " order by " + orderBy + " desc ";
}
Page resultPage = baseDao.pagedQuery(queryHql, pageNo, pageSize, params);
List<BookChapterEntity> list = (List<BookChapterEntity>) resultPage.getResult();
resultPage.setResult(DaoUtil.convertDataList(list));
return resultPage;
}
@Transient
public Map<String, Object> getWhereParam(BookChapterPo t) {
Map<String, Object> params = new HashMap<String, Object>();
return params;
}
@Transient
public String getWhereSql(BookChapterPo t) {
StringBuffer sb = new StringBuffer("where 1 = 1 and entity.parent is null");
return sb.toString();
}
}
| [
"895645094@qq.com"
] | 895645094@qq.com |
bf0ab068e9a427a85881c22ae73ad6770cc9b217 | 551d8fcaab0885486a2e50a3ed7dd0d0c0499049 | /basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdDirElemConstructor.java | 6f35c47bd50638e1f7b4e8de09cb5d8ddf1c8c6a | [
"BSD-3-Clause"
] | permissive | litlfred/basex | 4456768cd3592c2fc6627d11eb41c6bbd09fbd3a | 4cb2dbcc03dc1c7a21989e8826b02dec555951db | refs/heads/master | 2021-01-18T12:40:41.077881 | 2013-11-23T22:33:45 | 2013-11-23T22:33:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,840 | java | package org.basex.test.qt3ts.prod;
import org.basex.tests.bxapi.XQuery;
import org.basex.test.qt3ts.QT3TestSet;
/**
* Tests for the DirElemConstructor (Direct Element Constructor) production.
*
* @author BaseX Team 2005-12, BSD License
* @author Leo Woerteler
*/
@SuppressWarnings("all")
public class ProdDirElemConstructor extends QT3TestSet {
/**
* Element constructor with open curly brace .
*/
@org.junit.Test
public void constrElemCurlybr1() {
final XQuery query = new XQuery(
"<elem>{{</elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<elem>{</elem>", false)
);
}
/**
* Element constructor with closing curly brace .
*/
@org.junit.Test
public void constrElemCurlybr2() {
final XQuery query = new XQuery(
"<elem>}}</elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<elem>}</elem>", false)
);
}
/**
* Character reference for open curly brace .
*/
@org.junit.Test
public void constrElemCurlybr3() {
final XQuery query = new XQuery(
"<elem>{</elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<elem>{</elem>", false)
);
}
/**
* Character reference for closing curly brace .
*/
@org.junit.Test
public void constrElemCurlybr4() {
final XQuery query = new XQuery(
"<elem>}</elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<elem>}</elem>", false)
);
}
/**
* Single open curly brace .
*/
@org.junit.Test
public void constrElemCurlybr5() {
final XQuery query = new XQuery(
"<elem>{</elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Single closing curly brace .
*/
@org.junit.Test
public void constrElemCurlybr6() {
final XQuery query = new XQuery(
"<elem>}</elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Empty element constructor .
*/
@org.junit.Test
public void constrElemEmpty1() {
final XQuery query = new XQuery(
"<elem/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<elem/>", false)
);
}
/**
* Empty element constructor with closing tag .
*/
@org.junit.Test
public void constrElemEmpty2() {
final XQuery query = new XQuery(
"<elem></elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<elem/>", false)
);
}
/**
* Number of child nodes for empty element .
*/
@org.junit.Test
public void constrElemEmpty3() {
final XQuery query = new XQuery(
"fn:count((<elem/>)/node())",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertEq("0")
);
}
/**
* Number of child nodes for empty element .
*/
@org.junit.Test
public void constrElemEmpty4() {
final XQuery query = new XQuery(
"fn:count((<elem></elem>)/node())",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
(
assertEq("0")
||
error("XPST0005")
)
);
}
/**
* Whitespace in element constructor .
*/
@org.junit.Test
public void constrElemEmpty5() {
final XQuery query = new XQuery(
"<elem />",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<elem/>", false)
);
}
/**
* Begin tag matches end tag .
*/
@org.junit.Test
public void constrElemMatchtag1() {
final XQuery query = new XQuery(
"<elem></elemother>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XQST0118")
);
}
/**
* Begin tag matches end tag with namespace prefix .
*/
@org.junit.Test
public void constrElemMatchtag2() {
final XQuery query = new XQuery(
"<foo:elem xmlns:foo=\"http://www.w3.org/XQueryTest/Construct\" xmlns:bar=\"http://www.w3.org/XQueryTest/Construct\"></bar:elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XQST0118")
);
}
/**
* Ensure processing-instructions aren't included when extracting the string-value from elements. .
*/
@org.junit.Test
public void k2DirectConElem1() {
final XQuery query = new XQuery(
"string(<pi>{<?pi x?>}</pi>) eq \"\"",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertBoolean(true)
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem10() {
final XQuery query = new XQuery(
"<prefix:foo",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
(
error("XPST0003")
||
error("XPST0081")
)
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem11() {
final XQuery query = new XQuery(
"<prefix: foo/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem12() {
final XQuery query = new XQuery(
"<foo attr=\"{'a string'}><<<\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem13() {
final XQuery query = new XQuery(
"</>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem14() {
final XQuery query = new XQuery(
"<e> content}</e>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem15() {
final XQuery query = new XQuery(
"<f><c></f></c>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XQST0118")
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem16() {
final XQuery query = new XQuery(
"<a><b><c/><d/><a/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem17() {
final XQuery query = new XQuery(
"<a><b><c/><b/><d/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem18() {
final XQuery query = new XQuery(
"<elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem19() {
final XQuery query = new XQuery(
"<elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Ensure comments aren't included when extracting the string-value from elements. .
*/
@org.junit.Test
public void k2DirectConElem2() {
final XQuery query = new XQuery(
"string(<a attr=\"content\"><!-- NOTINC -->1<b>2<c><!-- NOTINC -->34</c><!-- NOTINC --><d/>56</b>7</a>) eq \"1234567\"",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertBoolean(true)
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem20() {
final XQuery query = new XQuery(
"<elem><",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem21() {
final XQuery query = new XQuery(
"<elem><[",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem22() {
final XQuery query = new XQuery(
"<elem><![",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem23() {
final XQuery query = new XQuery(
"<elem><!-",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntactically invalid direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem24() {
final XQuery query = new XQuery(
"<elem>&</elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Enclosed expressions aren't allowed inside element constructors. .
*/
@org.junit.Test
public void k2DirectConElem25() {
final XQuery query = new XQuery(
"<elem {\"attribute-name\"} = \"attribute value\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Enclosed expressions aren't allowed inside element constructors.(#2). .
*/
@org.junit.Test
public void k2DirectConElem26() {
final XQuery query = new XQuery(
"<elem attributename = {\"attribute value\"} />",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Enclosed expressions aren't allowed inside element constructors.(#3). .
*/
@org.junit.Test
public void k2DirectConElem27() {
final XQuery query = new XQuery(
"<elem attributename = {\"attribute value\"}></elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* A simple direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem28() {
final XQuery query = new XQuery(
"<a></a>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<a/>", false)
);
}
/**
* Serialize a sequence of direct element constructors. .
*/
@org.junit.Test
public void k2DirectConElem29() {
final XQuery query = new XQuery(
"<e>a</e>, <e>b</e>, <e>c</e>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<e>a</e><e>b</e><e>c</e>", false)
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem3() {
final XQuery query = new XQuery(
"<",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Serialize a couple of element constructors. .
*/
@org.junit.Test
public void k2DirectConElem30() {
final XQuery query = new XQuery(
"<elem>some text<node/>some text</elem>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<elem>some text<node/>some text</elem>", false)
);
}
/**
* A couple of simple elements. .
*/
@org.junit.Test
public void k2DirectConElem31() {
final XQuery query = new XQuery(
"<foo > <doo/> </foo>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<foo><doo/></foo>", false)
);
}
/**
* A couple of simple elements(#2). .
*/
@org.junit.Test
public void k2DirectConElem32() {
final XQuery query = new XQuery(
"<foo><doo/></foo>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<foo><doo/></foo>", false)
);
}
/**
* A couple of simple elements(#3). .
*/
@org.junit.Test
public void k2DirectConElem33() {
final XQuery query = new XQuery(
"<foo><doo/> </foo>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<foo><doo/></foo>", false)
);
}
/**
* An element with a computed attribute and element. .
*/
@org.junit.Test
public void k2DirectConElem34() {
final XQuery query = new XQuery(
"<foo > {attribute name {\"content\"}} <doo/> </foo>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<foo name=\"content\"><doo/></foo>", false)
);
}
/**
* Bind the 'xml' namespace URI to an invalid prefix. .
*/
@org.junit.Test
public void k2DirectConElem35() {
final XQuery query = new XQuery(
"<e xmlns:aPrefixOtherThanXml=\"http://www.w3.org/XML/1998/namespace\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XQST0070")
);
}
/**
* Bind the 'xml' namespace URI to an invalid prefix(#2). .
*/
@org.junit.Test
public void k2DirectConElem36() {
final XQuery query = new XQuery(
"<e xmlns=\"http://www.w3.org/XML/1998/namespace\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XQST0070")
);
}
/**
* Bind the 'xml' namespace URI to an invalid prefix(#3). .
*/
@org.junit.Test
public void k2DirectConElem37() {
final XQuery query = new XQuery(
"<e xmlns:XML=\"http://www.w3.org/XML/1998/namespace\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XQST0070")
);
}
/**
* Bind the 'xml' namespace URI to a valid prefix. The output doesn't expect the declaration because the c14n specification ignores declarations of the xml prefix if it binds to the XML namespace(see section 2.3). In either case, serializing this declaration is redundant. See the public report #4217 in W3C's Bugzilla database. .
*/
@org.junit.Test
public void k2DirectConElem38() {
final XQuery query = new XQuery(
"<e xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<e/>", false)
);
}
/**
* Bind the 'xmlns' namespace URI to an invalid prefix(#3). .
*/
@org.junit.Test
public void k2DirectConElem39() {
final XQuery query = new XQuery(
"<e xmlns:xmlns=\"http://www.w3.org/XML/1998/namespace\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XQST0070")
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem4() {
final XQuery query = new XQuery(
"< foo/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Bind the 'xmlns' namespace URI to an invalid prefix(#3). .
*/
@org.junit.Test
public void k2DirectConElem40() {
final XQuery query = new XQuery(
"<e xmlns:xmlns=\"http://www.w3.org/2000/xmlns/\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XQST0070")
);
}
/**
* Bind the 'xmlns' namespace URI to an invalid prefix(#3). .
*/
@org.junit.Test
public void k2DirectConElem41() {
final XQuery query = new XQuery(
"<e xmlns:xmlns=\"http://www.example.com/\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XQST0070")
);
}
/**
* Use a content sequence that is a strange combination of a computed document constructor and a path. .
*/
@org.junit.Test
public void k2DirectConElem42() {
final XQuery query = new XQuery(
"<e> { document{()}/(/) } </e>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<e/>", false)
);
}
/**
* Use a content sequence that is a computed document constructor. .
*/
@org.junit.Test
public void k2DirectConElem43() {
final XQuery query = new XQuery(
"<e> { document{()} } </e>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<e/>", false)
);
}
/**
* Extract the string value of a single element node. .
*/
@org.junit.Test
public void k2DirectConElem44() {
final XQuery query = new XQuery(
"string(<e>text</e>)",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertStringValue(false, "text")
);
}
/**
* Extract the typed value of a single element node. .
*/
@org.junit.Test
public void k2DirectConElem45() {
final XQuery query = new XQuery(
"data(<e>text</e>)",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertStringValue(false, "text")
);
}
/**
* Use an element constructor that use a namespace declare in a prolog declaration. .
*/
@org.junit.Test
public void k2DirectConElem46() {
final XQuery query = new XQuery(
"declare namespace p = \"http://www.example.com/\"; <p:e/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<p:e xmlns:p=\"http://www.example.com/\"/>", false)
);
}
/**
* Use content that needs to be escaped, inside namespace declaration attributes. .
*/
@org.junit.Test
public void k2DirectConElem47() {
final XQuery query = new XQuery(
"let $in := <r> <e xmlns=\"http://example.com/<>"'\"\"\"/> <e xmlns='http://example.com/<>"''''/> <p:e xmlns:p=\"http://example.com/<>"'\"\"\"/> <p:e xmlns:p='http://example.com/<>"''''/> </r> return <r>{for $n in $in/*/namespace-uri(.) return <e ns=\"{$n}\"/>}</r>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
(
assertSerialization("<r><e ns=\"http://example.com/<>"'"\"/><e ns=\"http://example.com/<>"''\"/><e ns=\"http://example.com/<>"'"\"/><e ns=\"http://example.com/<>"''\"/></r>", false)
||
error("XQST0046")
||
error("XQST0022")
)
);
}
/**
* In XQuery, as opposed to XML, the sequence ]]< is allowed in element content. .
*/
@org.junit.Test
public void k2DirectConElem48() {
final XQuery query = new XQuery(
"<e>]]></e>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertStringValue(false, "]]>")
);
}
/**
* In XQuery, as opposed to XML, the sequence ]]< is allowed in attribute content. .
*/
@org.junit.Test
public void k2DirectConElem49() {
final XQuery query = new XQuery(
"<e attr=\"]]>\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<e attr=\"]]>\"/>", false)
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem5() {
final XQuery query = new XQuery(
"<foo/ >",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Character < cannot appear in attributes. .
*/
@org.junit.Test
public void k2DirectConElem50() {
final XQuery query = new XQuery(
"<e attr=\"<\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Ensure that whitespace normalization of xml:id is performed. .
*/
@org.junit.Test
public void k2DirectConElem51() {
final XQuery query = new XQuery(
"<e xml:id=\" fo\"/>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<e xml:id=\"fo\"/>", false)
);
}
/**
* Output sharp S. .
*/
@org.junit.Test
public void k2DirectConElem52() {
final XQuery query = new XQuery(
"<a>ß</a>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
assertSerialization("<a>ß</a>", false)
);
}
/**
* There is no 'namespace' constructor in XQuery 1.0. .
*/
@org.junit.Test
public void k2DirectConElem53() {
xquery10();
final XQuery query = new XQuery(
"namespace {\"p\"} {\"abc\"}",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* There is a 'namespace' constructor in XQuery 3.0. .
*/
@org.junit.Test
public void k2DirectConElem53a() {
final XQuery query = new XQuery(
"namespace {\"p\"} {\"abc\"}",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
(
assertType("namespace-node()")
&&
assertStringValue(false, "abc")
)
);
}
/**
* There is no 'namespace-node' constructor in XQuery. .
*/
@org.junit.Test
public void k2DirectConElem54() {
final XQuery query = new XQuery(
"namespace-node {\"p\"} {\"abc\"}",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem6() {
final XQuery query = new XQuery(
"< foo></foo>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem7() {
final XQuery query = new XQuery(
"<foo>< /foo>",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem8() {
final XQuery query = new XQuery(
"<foo /",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
/**
* Syntax error in direct element constructor. .
*/
@org.junit.Test
public void k2DirectConElem9() {
final XQuery query = new XQuery(
"<foo",
ctx);
try {
result = new QT3Result(query.value());
} catch(final Throwable trw) {
result = new QT3Result(trw);
} finally {
query.close();
}
test(
error("XPST0003")
);
}
}
| [
"leo@woerteler.de"
] | leo@woerteler.de |
5d8f5f95ceba2f978724ab2dab46f90b0d933b67 | f060f7a7976678cc8b9a1264e6f78e601ecad852 | /ssm/spring-springmvc-mybatis/src/test/java/me/xueyao/ssm/solr/TestSolr.java | 8e061355543375487a8c3ed04de50f6d14c692a7 | [] | no_license | flowstone/Base-Java | 1a734ea23ae22b4ffd7b05d37c0e020592164535 | 80e8700e696dede08456f4eb7e3c8203dd5dae69 | refs/heads/master | 2020-12-03T04:02:53.070350 | 2017-12-22T12:02:50 | 2017-12-22T12:02:50 | 95,805,211 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 101 | java | package me.xueyao.ssm.solr;
/**
* @author XueYao
* @date 2017-12-13
*/
public class TestSolr {
}
| [
"xueyao.me@gmail.com"
] | xueyao.me@gmail.com |
890839371b5b854ffb6f9a4c7c43f2ae7fa80563 | c67b6c4c4c529e1aeabd32e13b12ac36644a06cf | /app/src/main/java/com/apitechnosoft/ipad/ASTClassPpt.java | 7e396025ea488e5f4889e78aa55351d5f5c565a1 | [] | no_license | neerajk0702/ipad | 467b34d20b21f43b846075675be15fdc53872cbf | b123ce297c1b5ac85bc57d3e7b57d368866198eb | refs/heads/master | 2020-03-25T02:47:41.031807 | 2019-04-17T09:37:53 | 2019-04-17T09:37:53 | 143,307,720 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.apitechnosoft.ipad;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author AST Inc.
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface ASTClassPpt {
}
| [
"neerajk0702@gmail.com"
] | neerajk0702@gmail.com |
421d67887545270886f0021d3ce770eb045840db | 7f1f98a327ab7eec4e2f3bad69624506862aa23d | /app/src/androidTest/java/com/cook/pro/ExampleInstrumentedTest.java | 129873e227f2a094aeaac42618d011aecc3f1047 | [] | no_license | quicklauncher/GetNotifyProject2020 | e2283b27a1d96efd9bc23de911e8088abc7aa1d8 | 4875a567ba5752387009d7538a29d4b2c08320a0 | refs/heads/master | 2022-06-07T19:49:20.603282 | 2020-05-05T17:30:45 | 2020-05-05T17:30:45 | 261,539,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | package com.cook.pro;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.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.myapplication", appContext.getPackageName());
}
}
| [
"quicklaunchers1@gmail.com"
] | quicklaunchers1@gmail.com |
a62c7790b133b50082a651b761bb5f8b0394137d | 5d58a1744a999d7c58c1dfe88b35d70d8cc5c972 | /java/introduction/LoopII.java | 145dcd1bf4a3df4376969a174ddb811e68640910 | [] | no_license | weihanchen/hacker-rank | b46b7d4bbe073e0fed840a0eebdb833ef8cbb294 | 7c70af31591b8bcc6981d4a291e7ad28e498ad90 | refs/heads/master | 2021-01-22T05:50:23.951670 | 2017-09-29T09:18:26 | 2017-09-29T09:18:26 | 81,711,969 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | import java.util.*;
import java.io.*;
class LoopII{
public static void main(String []argh){
Scanner in = new Scanner(System.in);
int t=in.nextInt();
for(int i=0;i<t;i++){
int a = in.nextInt();
int b = in.nextInt();
int n = in.nextInt();
int sum = 0;
for (int j = 0;j < n;j++) {
if (j == 0) sum += a;
sum += (power(2, j) * b);
System.out.print(sum);
System.out.print(" ");
}
System.out.println();
}
in.close();
}
private static int power(int x, int pow) {
if (pow <= 0) return 1;
return x * power(x, pow - 1);
}
}
| [
"willhanchen@gmail.com"
] | willhanchen@gmail.com |
4663516be340dd0ee0f92bd30abd29ac5be97979 | cc99e406815353c641b2f35827006f8e48766d9e | /app/src/main/java/com/zdk/pojun/heartrec/custom/SpaceItemDecoration.java | e973f44a7600343725579b5f184f3ca54290ba2c | [] | no_license | DubheBroken/Heartrec | 6b6151daa81ec4247c618e19ae1b6bcb0d3f0bd2 | db0ff1187b519f2e3dd46419af3ea1e7e4547005 | refs/heads/master | 2020-03-23T07:13:18.167933 | 2018-10-05T15:31:44 | 2018-10-05T15:31:44 | 141,256,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,633 | java | package com.zdk.pojun.heartrec.custom;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class SpaceItemDecoration extends RecyclerView.ItemDecoration {
int mSpace;
/**
* Retrieve any offsets for the given item. Each field of <code>outRect</code> specifies
* the number of pixels that the item view should be inset by, similar to padding or margin.
* The default implementation sets the bounds of outRect to 0 and returns.
* <p>
* <p>
* If this ItemDecoration does not affect the positioning of item views, it should set
* all four fields of <code>outRect</code> (left, top, right, bottom) to zero
* before returning.
* <p>
* <p>
* If you need to access Adapter for additional data, you can call
* {@link RecyclerView#getChildAdapterPosition(View)} to get the adapter position of the
* View.
*
* @param outRect Rect to receive the output.
* @param view The child view to decorate
* @param parent RecyclerView this ItemDecoration is decorating
* @param state The current state of RecyclerView.
*/
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
outRect.left = mSpace;
outRect.right = mSpace;
outRect.bottom = mSpace;
if (parent.getChildAdapterPosition(view) == 0) {
outRect.top = mSpace;
}
}
public SpaceItemDecoration(int space) {
this.mSpace = space;
}
}
| [
"z1574507001@gmail.com"
] | z1574507001@gmail.com |
c33cf8469e20213c09410dd5bf0ece7949c10f58 | a5e768386e2f92bd052649d22585baa62021cfa8 | /Esercitazione 3/ReceiverPaint/gen/com/example/receiverpaint/BuildConfig.java | 70849477266b0714077f12b89594e2b19899826c | [] | no_license | paolo279/Esercitazioni | 0626047895a4f12a7349b5712f6a34daad0ecaf4 | eb802395fdd8204842231dd3cb3d4a2d049e2a17 | refs/heads/master | 2016-09-06T05:06:24.981110 | 2013-01-24T22:24:08 | 2013-01-24T22:24:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 167 | java | /** Automatically generated file. DO NOT MODIFY */
package com.example.receiverpaint;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"paoloc279@gmail.com"
] | paoloc279@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.