blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
29e2dad337aefcce512d04fb7371155219a63e42
| 38,809,324,489,817 |
59fef4a4ee7297c331f8ce3a2f1b634f010724d3
|
/src/main/java/com/sam/yh/controller/OrderRegisterController.java
|
87c4e92273301b35bd8c16223620183205e13994
|
[] |
no_license
|
chenjiajun1991/boyuan
|
https://github.com/chenjiajun1991/boyuan
|
f5384df594eadf7ccb123cd3ec110606b342e375
|
90661bea69ddeae1d039edcfa785741d61fc0da9
|
refs/heads/master
| 2020-06-12T15:58:57.174000 | 2017-05-27T02:39:53 | 2017-05-27T02:39:53 | 75,797,213 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sam.yh.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.sam.yh.crud.exception.BtyLockException;
import com.sam.yh.crud.exception.CrudException;
import com.sam.yh.dao.BatteryMapper;
import com.sam.yh.model.Battery;
import com.sam.yh.model.OrderRegister;
import com.sam.yh.req.bean.FetchOrderRegisterReq;
import com.sam.yh.req.bean.SendOrderRegisterReq;
import com.sam.yh.resp.bean.FetchOrderRegisterResp;
import com.sam.yh.resp.bean.ResponseUtils;
import com.sam.yh.resp.bean.SamResponse;
import com.sam.yh.service.BatteryService;
@RestController
@RequestMapping("/bty")
public class OrderRegisterController {
private static final Logger logger = LoggerFactory.getLogger(OrderRegisterController.class);
@Autowired
BatteryService batteryService;
@Resource
private BatteryMapper batteryMapper;
@RequestMapping(value = "/send/order", method = RequestMethod.POST)
public SamResponse sendOrder(HttpServletRequest httpServletRequest, @RequestParam("jsonReq") String jsonReq) {
logger.info("Request send order registe json String:" + jsonReq);
SendOrderRegisterReq req = JSON.parseObject(jsonReq, SendOrderRegisterReq.class);
try {
batteryService.sendOrderRegister(req.getImei(), req.getMsg());
return ResponseUtils.getNormalResp(StringUtils.EMPTY);
} catch (CrudException e) {
logger.error("send Order Register exception, " + req.getImei(), e);
return ResponseUtils.getServiceErrorResp(e.getMessage());
} catch (Exception e) {
logger.error("send Order Register exception, " + req.getImei(), e);
return ResponseUtils.getSysErrorResp();
}
}
@RequestMapping(value = "/fetch/register", method = RequestMethod.POST)
public SamResponse fetchRegister(HttpServletRequest httpServletRequest, @RequestParam("jsonReq") String jsonReq) {
logger.info("Request fetch register registe json String:" + jsonReq);
FetchOrderRegisterReq req = JSON.parseObject(jsonReq, FetchOrderRegisterReq.class);
try {
OrderRegister orderRegister = batteryService.fetchOrderRegister(req.getImei());
FetchOrderRegisterResp resp = new FetchOrderRegisterResp();
Battery battery = batteryMapper.selectByPrimaryKey(orderRegister.getBatteryId());
resp.setImei(battery.getImei());
resp.setStatus(orderRegister.getStatus());
if(orderRegister.getReceiveMsg() != null){
resp.setMsg(orderRegister.getReceiveMsg());
}else{
resp.setMsg("");
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(orderRegister.getReceiveDate() != null){
Date date = orderRegister.getReceiveDate();
String dateString = formatter.format(date);
resp.setReceiveDate(dateString);
}else{
Date date = new Date();
String dateString = formatter.format(date);
resp.setReceiveDate(dateString);
}
return ResponseUtils.getNormalResp(resp);
} catch (CrudException e) {
logger.error("send Order Register exception, " + req.getImei(), e);
if (e instanceof BtyLockException) {
return ResponseUtils.getServiceErrorResp(e.getMessage());
} else {
return ResponseUtils.getSysErrorResp();
}
} catch (Exception e) {
logger.error("send Order Register exception, " + req.getImei(), e);
return ResponseUtils.getSysErrorResp();
}
}
}
|
UTF-8
|
Java
| 4,427 |
java
|
OrderRegisterController.java
|
Java
|
[] | null |
[] |
package com.sam.yh.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.sam.yh.crud.exception.BtyLockException;
import com.sam.yh.crud.exception.CrudException;
import com.sam.yh.dao.BatteryMapper;
import com.sam.yh.model.Battery;
import com.sam.yh.model.OrderRegister;
import com.sam.yh.req.bean.FetchOrderRegisterReq;
import com.sam.yh.req.bean.SendOrderRegisterReq;
import com.sam.yh.resp.bean.FetchOrderRegisterResp;
import com.sam.yh.resp.bean.ResponseUtils;
import com.sam.yh.resp.bean.SamResponse;
import com.sam.yh.service.BatteryService;
@RestController
@RequestMapping("/bty")
public class OrderRegisterController {
private static final Logger logger = LoggerFactory.getLogger(OrderRegisterController.class);
@Autowired
BatteryService batteryService;
@Resource
private BatteryMapper batteryMapper;
@RequestMapping(value = "/send/order", method = RequestMethod.POST)
public SamResponse sendOrder(HttpServletRequest httpServletRequest, @RequestParam("jsonReq") String jsonReq) {
logger.info("Request send order registe json String:" + jsonReq);
SendOrderRegisterReq req = JSON.parseObject(jsonReq, SendOrderRegisterReq.class);
try {
batteryService.sendOrderRegister(req.getImei(), req.getMsg());
return ResponseUtils.getNormalResp(StringUtils.EMPTY);
} catch (CrudException e) {
logger.error("send Order Register exception, " + req.getImei(), e);
return ResponseUtils.getServiceErrorResp(e.getMessage());
} catch (Exception e) {
logger.error("send Order Register exception, " + req.getImei(), e);
return ResponseUtils.getSysErrorResp();
}
}
@RequestMapping(value = "/fetch/register", method = RequestMethod.POST)
public SamResponse fetchRegister(HttpServletRequest httpServletRequest, @RequestParam("jsonReq") String jsonReq) {
logger.info("Request fetch register registe json String:" + jsonReq);
FetchOrderRegisterReq req = JSON.parseObject(jsonReq, FetchOrderRegisterReq.class);
try {
OrderRegister orderRegister = batteryService.fetchOrderRegister(req.getImei());
FetchOrderRegisterResp resp = new FetchOrderRegisterResp();
Battery battery = batteryMapper.selectByPrimaryKey(orderRegister.getBatteryId());
resp.setImei(battery.getImei());
resp.setStatus(orderRegister.getStatus());
if(orderRegister.getReceiveMsg() != null){
resp.setMsg(orderRegister.getReceiveMsg());
}else{
resp.setMsg("");
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(orderRegister.getReceiveDate() != null){
Date date = orderRegister.getReceiveDate();
String dateString = formatter.format(date);
resp.setReceiveDate(dateString);
}else{
Date date = new Date();
String dateString = formatter.format(date);
resp.setReceiveDate(dateString);
}
return ResponseUtils.getNormalResp(resp);
} catch (CrudException e) {
logger.error("send Order Register exception, " + req.getImei(), e);
if (e instanceof BtyLockException) {
return ResponseUtils.getServiceErrorResp(e.getMessage());
} else {
return ResponseUtils.getSysErrorResp();
}
} catch (Exception e) {
logger.error("send Order Register exception, " + req.getImei(), e);
return ResponseUtils.getSysErrorResp();
}
}
}
| 4,427 | 0.661848 | 0.66117 | 113 | 38.176991 | 29.466413 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.469027 | false | false |
7
|
ceab5a36b95cc82b97c766698b686b3ccf7e1fc4
| 14,121,852,537,299 |
866cc70a0f6ffc4446c9d378d2e01aee58919198
|
/src/main/java/mayday/graphviewer/core/bag/renderer/CompartmentBagRenderer.java
|
320c546d659383ccf434b8e4e296e2dac1a5acea
|
[] |
no_license
|
Integrative-Transcriptomics/Mayday-pathway
|
https://github.com/Integrative-Transcriptomics/Mayday-pathway
|
eb4a6ca4ee057f4a0280e487428f77dee5d5f9de
|
a64b6df0eb5c942daa8ed11a1b29f32d30eefe18
|
refs/heads/master
| 2023-01-12T00:46:38.341000 | 2016-08-01T09:07:07 | 2016-08-01T09:07:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mayday.graphviewer.core.bag.renderer;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
import mayday.graphviewer.core.bag.BagComponent;
import mayday.graphviewer.core.bag.ComponentBag;
public class CompartmentBagRenderer implements BagRenderer
{
@Override
public boolean hideComponents()
{
return false;
}
@Override
public void paint(Graphics2D g, BagComponent comp, ComponentBag bag, boolean isSelected)
{
Font f=g.getFont();
Rectangle bounds=comp.drawableRect();
g.setColor(Color.white);
g.fillRect(0, 0, bounds.width, bounds.height);
g.setColor(Color.black);
g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 18));
g.drawString(bag.getName(), 10, 25);
// draw thick border
if(isSelected)
g.setColor(Color.red);
g.setStroke(new BasicStroke(4.0f));
g.drawRoundRect(5, 5, bounds.width-10, bounds.height-10, 20, 20);
g.setFont(f);
}
@Override
public Shape getBoundingShape(BagComponent comp, ComponentBag bag)
{
Rectangle rect= bag.getBoundingRect();
rect.x-=10;
rect.y-=35;
rect.width+=20;
rect.height+=45;
return rect;
}
@Override
public boolean hideTitleBar()
{
return true;
}
}
|
UTF-8
|
Java
| 1,266 |
java
|
CompartmentBagRenderer.java
|
Java
|
[] | null |
[] |
package mayday.graphviewer.core.bag.renderer;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
import mayday.graphviewer.core.bag.BagComponent;
import mayday.graphviewer.core.bag.ComponentBag;
public class CompartmentBagRenderer implements BagRenderer
{
@Override
public boolean hideComponents()
{
return false;
}
@Override
public void paint(Graphics2D g, BagComponent comp, ComponentBag bag, boolean isSelected)
{
Font f=g.getFont();
Rectangle bounds=comp.drawableRect();
g.setColor(Color.white);
g.fillRect(0, 0, bounds.width, bounds.height);
g.setColor(Color.black);
g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 18));
g.drawString(bag.getName(), 10, 25);
// draw thick border
if(isSelected)
g.setColor(Color.red);
g.setStroke(new BasicStroke(4.0f));
g.drawRoundRect(5, 5, bounds.width-10, bounds.height-10, 20, 20);
g.setFont(f);
}
@Override
public Shape getBoundingShape(BagComponent comp, ComponentBag bag)
{
Rectangle rect= bag.getBoundingRect();
rect.x-=10;
rect.y-=35;
rect.width+=20;
rect.height+=45;
return rect;
}
@Override
public boolean hideTitleBar()
{
return true;
}
}
| 1,266 | 0.726698 | 0.703002 | 56 | 21.607143 | 20.45088 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.964286 | false | false |
7
|
4870c4f3d8fccb694c72291b3fb02eaadddb6181
| 39,479,339,389,222 |
909c61324aba6e84e945e8911d0d147c8740d346
|
/linlist19.java
|
6bab0baa49458de2bfb07fa390888b54ada01561
|
[] |
no_license
|
RevathiAsokan/Java-Collections-LinkedList
|
https://github.com/RevathiAsokan/Java-Collections-LinkedList
|
f82563f6e54fdd2618e97f69e4d369001c8c84b6
|
dce971bdd8975904efb1af8ed14d351b29e25d58
|
refs/heads/master
| 2021-01-07T23:37:59.786000 | 2020-07-06T09:01:50 | 2020-07-06T09:01:50 | 241,833,758 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// To remove and return the first element of a linked list
import java.util.LinkedList;
class linlist19
{
public static void main(String args[])
{
LinkedList<String> games = new LinkedList<String>();
games.add("Cricket");
games.add("Hockey");
System.out.println("Before pop: "+games);
System.out.println("Removed element: "+games.pop());
System.out.println("After pop: "+games);
}
}
|
UTF-8
|
Java
| 418 |
java
|
linlist19.java
|
Java
|
[] | null |
[] |
// To remove and return the first element of a linked list
import java.util.LinkedList;
class linlist19
{
public static void main(String args[])
{
LinkedList<String> games = new LinkedList<String>();
games.add("Cricket");
games.add("Hockey");
System.out.println("Before pop: "+games);
System.out.println("Removed element: "+games.pop());
System.out.println("After pop: "+games);
}
}
| 418 | 0.667464 | 0.662679 | 17 | 22.705883 | 21.145893 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.411765 | false | false |
7
|
858121805de4675b5179dbafb2e60e3ce2cc6150
| 38,938,173,541,285 |
41fde57ab72f8a74ccf2f5d89a1012cf11df3a65
|
/src/com/stackroute/demo/RandomNum.java
|
3e60bddcde8c9f17420c10bf7e9fb5b750433f20
|
[] |
no_license
|
utkarsh311/Java-pe-1-
|
https://github.com/utkarsh311/Java-pe-1-
|
f3d367c4b040a719e4cf8af24f3e2201e096a7c4
|
127635b1ec5eef386c7c9457c619e234646a71b1
|
refs/heads/master
| 2020-03-24T21:06:35.214000 | 2018-08-01T13:25:31 | 2018-08-01T13:25:31 | 143,013,916 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.stackroute.demo;
import java.util.*;
public class RandomNum {
public static void main(String args[])
{
Scanner in=new Scanner (System.in);
Random rand = new Random();
int num=rand.nextInt(100);
while(true)
{
System.out.println("Enter your guess");
int guess=in.nextInt();
if(num==guess)
{
System.out.println("BINGO");
break;
}
else if(num>guess)
{
System.out.println("guess is smaller than num");
}
else
{
System.out.println("guess is larger than num");
}
}
}
}
|
UTF-8
|
Java
| 513 |
java
|
RandomNum.java
|
Java
|
[] | null |
[] |
package com.stackroute.demo;
import java.util.*;
public class RandomNum {
public static void main(String args[])
{
Scanner in=new Scanner (System.in);
Random rand = new Random();
int num=rand.nextInt(100);
while(true)
{
System.out.println("Enter your guess");
int guess=in.nextInt();
if(num==guess)
{
System.out.println("BINGO");
break;
}
else if(num>guess)
{
System.out.println("guess is smaller than num");
}
else
{
System.out.println("guess is larger than num");
}
}
}
}
| 513 | 0.65692 | 0.651072 | 28 | 17.321428 | 15.611474 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.785714 | false | false |
7
|
fe16d40b3cc2f9f27f455366d53edda78c8f1e60
| 35,459,250,040,997 |
5ef8b4820e33068cf173e364f2fcac05b238218f
|
/src/test1_9/Test5StackQueue.java
|
bc57ae8707edbd3bfd7364158bc494386a2691b1
|
[] |
no_license
|
icemoonlol/PTOffer
|
https://github.com/icemoonlol/PTOffer
|
803a9b868223f594854f8313ee51bdfbeca219dd
|
01b4303ee36af44d776a4a2e3347286bc8c3a6b9
|
refs/heads/master
| 2021-05-23T23:29:13.842000 | 2016-07-28T09:50:31 | 2016-07-28T09:50:31 | 64,295,156 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package test1_9;
import java.util.Stack;
public class Test5StackQueue {
Stack<Integer> stack1 = new Stack<Integer>();
Stack<Integer> stack2 = new Stack<Integer>();
public void push(int node) {
stack1.push(node);
}
public int pop() {
if(!stack2.isEmpty()) return stack2.pop();
else{
while(!stack1.isEmpty()){
int popup = stack1.pop();
stack2.push(popup);
}
return stack2.pop();
}
}
public static void main(String[] args) {
Test5StackQueue queue = new Test5StackQueue();
queue.push(1);
queue.push(2);
queue.push(3);
System.out.println(queue.pop());
System.out.println(queue.pop());
queue.push(4);
System.out.println(queue.pop());
queue.push(5);
System.out.println(queue.pop());
System.out.println(queue.pop());
}
}
|
UTF-8
|
Java
| 856 |
java
|
Test5StackQueue.java
|
Java
|
[] | null |
[] |
package test1_9;
import java.util.Stack;
public class Test5StackQueue {
Stack<Integer> stack1 = new Stack<Integer>();
Stack<Integer> stack2 = new Stack<Integer>();
public void push(int node) {
stack1.push(node);
}
public int pop() {
if(!stack2.isEmpty()) return stack2.pop();
else{
while(!stack1.isEmpty()){
int popup = stack1.pop();
stack2.push(popup);
}
return stack2.pop();
}
}
public static void main(String[] args) {
Test5StackQueue queue = new Test5StackQueue();
queue.push(1);
queue.push(2);
queue.push(3);
System.out.println(queue.pop());
System.out.println(queue.pop());
queue.push(4);
System.out.println(queue.pop());
queue.push(5);
System.out.println(queue.pop());
System.out.println(queue.pop());
}
}
| 856 | 0.593458 | 0.571262 | 37 | 22.135136 | 15.203418 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.27027 | false | false |
7
|
b60e7422bd0b98735e8bef7781a2fe829edba964
| 34,316,788,714,728 |
730fe0b9e58536ac3ca9f75e040f3aff50216a30
|
/src/HelloWorld.java
|
8d11ef779eafaf2c41391f7a9aaa1d7d11795582
|
[] |
no_license
|
agtrevino/codeup-java-exercises
|
https://github.com/agtrevino/codeup-java-exercises
|
a59685b7fc1648171cbdaff41a40e94dbf9919be
|
50558f32a3151b8892ea211ff8e5c6178a81f4bd
|
refs/heads/master
| 2020-03-23T20:30:22.652000 | 2018-08-07T13:59:44 | 2018-08-07T13:59:44 | 142,045,334 | 0 | 0 | null | false | 2018-08-07T13:59:45 | 2018-07-23T17:13:54 | 2018-08-03T19:45:03 | 2018-08-07T13:59:45 | 18 | 0 | 0 | 0 |
Java
| false | null |
// Change your code to assign the value 123L (Note the 'L' at the end) to myNumber.
//
// Change your code to assign the value 123 to myNumber.
//
// Why does assigning the value 3.14 to a variable declared as a long not compile, but assigning an integer value does?
// Change your code to declare myNumber as a float. Assign the value 3.14 to it. What happens? What are two ways we could fix this?
//
// Copy and paste the following code blocks one at a time and execute them
//
//
// int x = 5;
// System.out.println(x++);
// System.out.println(x);
//
// int x = 5;
// System.out.println(++x);
// System.out.println(x);
// What is the difference between the above code blocks? Explain why the code outputs what it does.
//
// Try to create a variable named class. What happens?
//
// Rewrite the following expressions using the relevant shorthand assignment operators:
//
//
// int x = 4;
// x = x + 5;
//
// int x = 3;
// int y = 4;
// y = y * x;
//
// int x = 10;
// int y = 2;
// x = x / y;
// y = y - x;
public class HelloWorld {
public static void main(String[] args) {
// byte rating = 5;
// short aztecTheatre = 3435;
// int ATTCenter = 3455435;
// long Alamodome =21434356545555L;
// float price = 23.44f;
// double grade = 88.95;
//
// //reference types
// Long anotherVenue = 123123123123123L;
// String name = "Aaron";
//
// System.out.println("Price = " + price);
// System.out.println("Grade = " + grade);
//
// char initialFN = 'f';
// char gender = 'c';
// boolean doYouHaveQuestions = true;
//
// System.out.println("Name = " + name);
//
// String cohort = "Voyageurs";
//
// final int PAGES = 364;
//
// rating++;
// System.out.println("Rating = " + rating);
//
// System.out.println("Pages = " + PAGES + 1);
//
// //explicit
//
// double pi = 3.1416;
// int almostPi = (int) pi;
//
// double populationThatLikesVanilla = 123.23;
// byte chartVanilla = (byte) populationThatLikesVanilla;
//
// System.out.println(pi);
// System.out.println(almostPi);
//exercise
int favoriteNumber = 66;
System.out.println(favoriteNumber);
String myString = "Aaron T.";
System.out.println(myString);
float myNumber = 3.14f;
System.out.println(myNumber);
int x = 5;
System.out.println(x++);
System.out.println(x);
// int x = 5;
// System.out.println(++x);
// System.out.println(x);
// Rewrite the following expressions using the relevant shorthand assignment operators:
//
//
// int x = 4;
// x = x + 5;
//
// int x = 3;
// int y = 4;
// y = y * x;
//
// int x = 10;
// int y = 2;
// x = x / y;
// y = y - x;
}
}
|
UTF-8
|
Java
| 3,053 |
java
|
HelloWorld.java
|
Java
|
[
{
"context": "enue = 123123123123123L;\n// String name = \"Aaron\";\n//\n// System.out.println(\"Price = \" + pr",
"end": 1559,
"score": 0.9976838827133179,
"start": 1554,
"tag": "NAME",
"value": "Aaron"
},
{
"context": "ntln(favoriteNumber);\n\n String myString = \"Aaron T.\";\n System.out.println(myString);\n\n fl",
"end": 2459,
"score": 0.9986261129379272,
"start": 2452,
"tag": "NAME",
"value": "Aaron T"
}
] | null |
[] |
// Change your code to assign the value 123L (Note the 'L' at the end) to myNumber.
//
// Change your code to assign the value 123 to myNumber.
//
// Why does assigning the value 3.14 to a variable declared as a long not compile, but assigning an integer value does?
// Change your code to declare myNumber as a float. Assign the value 3.14 to it. What happens? What are two ways we could fix this?
//
// Copy and paste the following code blocks one at a time and execute them
//
//
// int x = 5;
// System.out.println(x++);
// System.out.println(x);
//
// int x = 5;
// System.out.println(++x);
// System.out.println(x);
// What is the difference between the above code blocks? Explain why the code outputs what it does.
//
// Try to create a variable named class. What happens?
//
// Rewrite the following expressions using the relevant shorthand assignment operators:
//
//
// int x = 4;
// x = x + 5;
//
// int x = 3;
// int y = 4;
// y = y * x;
//
// int x = 10;
// int y = 2;
// x = x / y;
// y = y - x;
public class HelloWorld {
public static void main(String[] args) {
// byte rating = 5;
// short aztecTheatre = 3435;
// int ATTCenter = 3455435;
// long Alamodome =21434356545555L;
// float price = 23.44f;
// double grade = 88.95;
//
// //reference types
// Long anotherVenue = 123123123123123L;
// String name = "Aaron";
//
// System.out.println("Price = " + price);
// System.out.println("Grade = " + grade);
//
// char initialFN = 'f';
// char gender = 'c';
// boolean doYouHaveQuestions = true;
//
// System.out.println("Name = " + name);
//
// String cohort = "Voyageurs";
//
// final int PAGES = 364;
//
// rating++;
// System.out.println("Rating = " + rating);
//
// System.out.println("Pages = " + PAGES + 1);
//
// //explicit
//
// double pi = 3.1416;
// int almostPi = (int) pi;
//
// double populationThatLikesVanilla = 123.23;
// byte chartVanilla = (byte) populationThatLikesVanilla;
//
// System.out.println(pi);
// System.out.println(almostPi);
//exercise
int favoriteNumber = 66;
System.out.println(favoriteNumber);
String myString = "<NAME>.";
System.out.println(myString);
float myNumber = 3.14f;
System.out.println(myNumber);
int x = 5;
System.out.println(x++);
System.out.println(x);
// int x = 5;
// System.out.println(++x);
// System.out.println(x);
// Rewrite the following expressions using the relevant shorthand assignment operators:
//
//
// int x = 4;
// x = x + 5;
//
// int x = 3;
// int y = 4;
// y = y * x;
//
// int x = 10;
// int y = 2;
// x = x / y;
// y = y - x;
}
}
| 3,052 | 0.525712 | 0.493613 | 116 | 25.327587 | 26.525776 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534483 | false | false |
7
|
c75a9405ca75fd0478efcb7967b8a71558dea26a
| 18,803,366,873,579 |
bd3cd9d2a62966356e22007c92b38f73fb47b57e
|
/src/leetcode/Leetcode93.java
|
c6376c0cf300a17d11e9f66134a4d94a10b097df
|
[] |
no_license
|
adrainYin/leetcode
|
https://github.com/adrainYin/leetcode
|
0a00b474aff7d8b946e0e68f6e5bb1d315731531
|
ff404d01e0b09d7998f4b1559410c83c1f7f9770
|
refs/heads/master
| 2020-04-10T12:03:57.812000 | 2019-09-30T07:50:40 | 2019-09-30T07:50:40 | 161,010,441 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package leetcode;
import java.util.ArrayList;
import java.util.List;
public class Leetcode93 {
public static List<String> restoreIpAddresses(String s) {
List<String> result = new ArrayList<>();
if (s == null || s.length() < 4) {
return result;
}
int length = s.length();
dfs(result, 0, length, 1, new StringBuffer(), s);
return result;
}
private static void dfs(List<String> result, int index, int length, int currNum, StringBuffer sb, String s) {
if (currNum > 4) {
result.add(sb.toString().substring(0, sb.toString().length() - 1));
return;
}
if (currNum == 4 && length - index <= 3 && length - index >= 1) {
//如果开头为0而且存在两个以上数字,那么是不合法的,直接返回
if (s.charAt(index) - '0' == 0 && length - index > 1) {
return;
}
int ip = Integer.valueOf(s.substring(index));
//合法的ip
if (ip <= 255) {
sb.append(ip + ".");
//此时一定是会返回的
dfs(result, s.length(), length, currNum + 1, sb, s);
}
}
//继续添加
if (currNum < 4) {
//如果当前的为0那么只能自己作为一个字段
if (index > length - 1) {
return;
}
if (s.charAt(index) - '0' == 0) {
StringBuffer temp = new StringBuffer(sb);
temp.append(0).append(".");
dfs(result, index + 1, length, currNum + 1, temp, s);
return ;
}
for (int i = 1; i < 4; i++) {
//已经超出字符串的范围
if (index + i > length) {
break;
}
int ip = Integer.valueOf(s.substring(index, index + i));
if (ip <= 255) {
StringBuffer stringBuffer = new StringBuffer(sb);
stringBuffer.append(ip + ".");
dfs(result, index + i, length, currNum + 1, stringBuffer, s);
}
}
}
}
public static void main(String[] args) {
List<String> result = restoreIpAddresses("010010");
System.out.println(result.toString());
}
}
|
UTF-8
|
Java
| 2,381 |
java
|
Leetcode93.java
|
Java
|
[] | null |
[] |
package leetcode;
import java.util.ArrayList;
import java.util.List;
public class Leetcode93 {
public static List<String> restoreIpAddresses(String s) {
List<String> result = new ArrayList<>();
if (s == null || s.length() < 4) {
return result;
}
int length = s.length();
dfs(result, 0, length, 1, new StringBuffer(), s);
return result;
}
private static void dfs(List<String> result, int index, int length, int currNum, StringBuffer sb, String s) {
if (currNum > 4) {
result.add(sb.toString().substring(0, sb.toString().length() - 1));
return;
}
if (currNum == 4 && length - index <= 3 && length - index >= 1) {
//如果开头为0而且存在两个以上数字,那么是不合法的,直接返回
if (s.charAt(index) - '0' == 0 && length - index > 1) {
return;
}
int ip = Integer.valueOf(s.substring(index));
//合法的ip
if (ip <= 255) {
sb.append(ip + ".");
//此时一定是会返回的
dfs(result, s.length(), length, currNum + 1, sb, s);
}
}
//继续添加
if (currNum < 4) {
//如果当前的为0那么只能自己作为一个字段
if (index > length - 1) {
return;
}
if (s.charAt(index) - '0' == 0) {
StringBuffer temp = new StringBuffer(sb);
temp.append(0).append(".");
dfs(result, index + 1, length, currNum + 1, temp, s);
return ;
}
for (int i = 1; i < 4; i++) {
//已经超出字符串的范围
if (index + i > length) {
break;
}
int ip = Integer.valueOf(s.substring(index, index + i));
if (ip <= 255) {
StringBuffer stringBuffer = new StringBuffer(sb);
stringBuffer.append(ip + ".");
dfs(result, index + i, length, currNum + 1, stringBuffer, s);
}
}
}
}
public static void main(String[] args) {
List<String> result = restoreIpAddresses("010010");
System.out.println(result.toString());
}
}
| 2,381 | 0.459544 | 0.44211 | 69 | 31.42029 | 24.389 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.826087 | false | false |
7
|
9b43bb70c3d740f2b89d5dafa9def126546bfd64
| 32,083,405,728,156 |
dddcfd0dc79f9d740633e5005e9598e82fbe50bd
|
/module/module-dms/src/main/java/com/coracle/dms/service/impl/tz/TgCustomOrderProductServiceImpl.java
|
9bd09a8f5f5de89f064ef415ee424e7b10d5664d
|
[] |
no_license
|
channelCloud/MXM_WORK
|
https://github.com/channelCloud/MXM_WORK
|
ec7b8c788b28f9018e9f6ab570e815ab4267dc69
|
443061adfdf021e9b4332de3e51f3e57ba822509
|
refs/heads/master
| 2020-04-10T15:22:00.286000 | 2020-04-08T08:46:24 | 2020-04-08T08:46:24 | 161,107,078 | 0 | 1 | null | false | 2020-11-03T01:12:34 | 2018-12-10T02:49:34 | 2020-11-03T01:12:10 | 2020-11-03T01:12:33 | 3,716 | 0 | 1 | 12 |
Java
| false | false |
package com.coracle.dms.service.impl.tz;
import com.coracle.dms.dao.mybatis.tz.TgCustomOrderProductMapper;
import com.coracle.dms.po.tz.TgCustomOrderProduct;
import com.coracle.dms.service.tz.TgCustomOrderProductService;
import com.coracle.yk.xdatabase.base.mybatis.intf.IMybatisDao;
import com.coracle.yk.xservice.base.BaseServiceImpl;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TgCustomOrderProductServiceImpl extends BaseServiceImpl<TgCustomOrderProduct> implements TgCustomOrderProductService {
private static final Logger logger = Logger.getLogger(TgCustomOrderProductServiceImpl.class);
@Autowired
private TgCustomOrderProductMapper tgCustomOrderProductMapper;
@Override
public IMybatisDao<TgCustomOrderProduct> getBaseDao() {
return tgCustomOrderProductMapper;
}
@Override
public List<TgCustomOrderProduct> selectVoByOrderProduct(Long id) {
return null;
}
}
|
UTF-8
|
Java
| 1,066 |
java
|
TgCustomOrderProductServiceImpl.java
|
Java
|
[] | null |
[] |
package com.coracle.dms.service.impl.tz;
import com.coracle.dms.dao.mybatis.tz.TgCustomOrderProductMapper;
import com.coracle.dms.po.tz.TgCustomOrderProduct;
import com.coracle.dms.service.tz.TgCustomOrderProductService;
import com.coracle.yk.xdatabase.base.mybatis.intf.IMybatisDao;
import com.coracle.yk.xservice.base.BaseServiceImpl;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TgCustomOrderProductServiceImpl extends BaseServiceImpl<TgCustomOrderProduct> implements TgCustomOrderProductService {
private static final Logger logger = Logger.getLogger(TgCustomOrderProductServiceImpl.class);
@Autowired
private TgCustomOrderProductMapper tgCustomOrderProductMapper;
@Override
public IMybatisDao<TgCustomOrderProduct> getBaseDao() {
return tgCustomOrderProductMapper;
}
@Override
public List<TgCustomOrderProduct> selectVoByOrderProduct(Long id) {
return null;
}
}
| 1,066 | 0.812383 | 0.811445 | 30 | 34.566666 | 32.932945 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false |
7
|
8d5c212a4b2fa9592b9540a144225cedd35319b0
| 22,144,851,415,099 |
2ce40be95f79b04bed862bb2756753bf7a9d0e2f
|
/doctorbaselibrary/src/main/java/cn/demomaster/huan/doctorbaselibrary/model/UserModel.java
|
a7b2d396fbc264f49c47927d2093b0b75ce44a2c
|
[] |
no_license
|
squirrelhuan/DoctorBaseLib
|
https://github.com/squirrelhuan/DoctorBaseLib
|
529cc249e7e48818dae3a753fb252fc52399a398
|
5756b217d4a916c43aad335b4ab1055e0a2f94eb
|
refs/heads/master
| 2020-05-30T19:09:43.343000 | 2019-06-03T01:46:20 | 2019-06-03T01:46:20 | 189,916,487 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.demomaster.huan.doctorbaselibrary.model;
public class UserModel {
/**
* data : {"sessionId":"1251","token":"IdRj6cdaHNZiRZGCW+8bALe0PasmotCy45Sw+/s6QFMEDtlEpr1kjq3+0QFZPd2XqraPm0TA1DPLuNfcgc0qZ4obBirq0lOv356ufcaSMGIiJcWaO94Rm51LYxgnlONCZTpES5aCoKec0dk8W5fOiqtC/W7RVEhas8Sns2J2rr4S7MU9NXW2Jvx4mtJ+cA4ASICxjLHQ/Gaup4CkzsrRiw==","uuid":"SXngi5SkEFoC2UzUbbaz7Tg0We1xehsxRYDJ+MIyb6wuND3qQdZuDyCD87JLupTgyHHc7ItFZZPQZ6J4y6cJLwv1GzVkl0w0NIxwwflAb4dhLBr6wRvoU8lo9WW2mLNnf8Pjm1bnTFK9XGkQFadyimtl7BXc1GvgE5wPrO+RMKQ=","userName":"郑小白"}
* message : 验证成功
* retCode : 0
*/
private String data;
private String message;
private int retCode;
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getRetCode() {
return retCode;
}
public void setRetCode(int retCode) {
this.retCode = retCode;
}
}
|
UTF-8
|
Java
| 1,113 |
java
|
UserModel.java
|
Java
|
[
{
"context": "UserModel {\n\n\n /**\n * data : {\"sessionId\":\"1251\",\"token\":\"IdRj6cdaHNZiRZGCW+8bALe0PasmotCy45Sw+/s",
"end": 120,
"score": 0.873586893081665,
"start": 116,
"tag": "KEY",
"value": "1251"
},
{
"context": " /**\n * data : {\"sessionId\":\"1251\",\"token\":\"IdRj6cdaHNZiRZGCW+8bALe0PasmotCy45Sw+/s6QFMEDtlEpr1kjq3+0QFZPd2XqraPm0TA1DPLuNfcgc0qZ4obBirq0lOv356ufcaSMGIiJcWaO94Rm51LYxgnlONCZTpES5aCoKec0dk8W5fOiqtC/W7RVEhas8Sns2J2rr4S7MU9NXW2Jvx4mtJ+cA4ASICxjLHQ/Gaup4CkzsrRiw==\",\"uuid\":\"SXngi5SkEFoC2UzUbbaz7Tg0We1xehsxRYDJ+MIyb",
"end": 348,
"score": 0.9995558857917786,
"start": 131,
"tag": "KEY",
"value": "IdRj6cdaHNZiRZGCW+8bALe0PasmotCy45Sw+/s6QFMEDtlEpr1kjq3+0QFZPd2XqraPm0TA1DPLuNfcgc0qZ4obBirq0lOv356ufcaSMGIiJcWaO94Rm51LYxgnlONCZTpES5aCoKec0dk8W5fOiqtC/W7RVEhas8Sns2J2rr4S7MU9NXW2Jvx4mtJ+cA4ASICxjLHQ/Gaup4CkzsrRiw==\""
},
{
"context": "r4S7MU9NXW2Jvx4mtJ+cA4ASICxjLHQ/Gaup4CkzsrRiw==\",\"uuid\":\"SXngi5SkEFoC2UzUbbaz7Tg0We1xehsxRYDJ+MIyb6wuND3",
"end": 354,
"score": 0.4664542078971863,
"start": 350,
"tag": "KEY",
"value": "uuid"
},
{
"context": "NXW2Jvx4mtJ+cA4ASICxjLHQ/Gaup4CkzsrRiw==\",\"uuid\":\"SXngi5SkEFoC2UzUbbaz7Tg0We1xehsxRYDJ+MIyb6wuND3qQdZuDyCD87JLupTgyHHc7ItFZZPQZ6J4y6cJLwv1GzVkl0w0NIxwwflAb4dhLBr6wRvoU8lo9WW2mLNnf8Pjm1bnTFK9XGkQFadyimtl7BXc1GvgE5wPrO+RMKQ=\",\"userName\":\"郑小白\"}\n * message : 验证成功\n * re",
"end": 530,
"score": 0.9973135590553284,
"start": 357,
"tag": "KEY",
"value": "SXngi5SkEFoC2UzUbbaz7Tg0We1xehsxRYDJ+MIyb6wuND3qQdZuDyCD87JLupTgyHHc7ItFZZPQZ6J4y6cJLwv1GzVkl0w0NIxwwflAb4dhLBr6wRvoU8lo9WW2mLNnf8Pjm1bnTFK9XGkQFadyimtl7BXc1GvgE5wPrO+RMKQ=\""
},
{
"context": "TFK9XGkQFadyimtl7BXc1GvgE5wPrO+RMKQ=\",\"userName\":\"郑小白\"}\n * message : 验证成功\n * retCode : 0\n *",
"end": 546,
"score": 0.9996172189712524,
"start": 543,
"tag": "USERNAME",
"value": "郑小白"
}
] | null |
[] |
package cn.demomaster.huan.doctorbaselibrary.model;
public class UserModel {
/**
* data : {"sessionId":"1251","token":"<KEY>,"uuid":"<KEY>,"userName":"郑小白"}
* message : 验证成功
* retCode : 0
*/
private String data;
private String message;
private int retCode;
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getRetCode() {
return retCode;
}
public void setRetCode(int retCode) {
this.retCode = retCode;
}
}
| 733 | 0.714286 | 0.651501 | 39 | 27.179487 | 71.724854 | 460 | false | false | 0 | 0 | 0 | 0 | 216 | 0.353048 | 0.333333 | false | false |
7
|
b276518f8ef510bbf50ec898f49b99c516ffb56c
| 22,144,851,415,800 |
f0e2dc567f5e1832a4abcd799c2eb95001fde3f1
|
/sdk-example/src/test/java/com/manywho/services/example/tests/DatabaseLoadTest.java
|
950422aecf54867b0b28f88a06679c9eacc8e091
|
[
"MIT"
] |
permissive
|
manywho/sdk-java
|
https://github.com/manywho/sdk-java
|
c801ab27ae40e9394abda4aae6ff4af02b4e6799
|
ef4503ccbaa7eaebc9d88aa8bfc0386c8c5f658c
|
refs/heads/develop
| 2023-08-06T09:00:32.495000 | 2021-01-28T11:27:44 | 2021-01-28T11:27:44 | 22,968,123 | 0 | 12 | null | false | 2021-07-07T02:30:39 | 2014-08-14T20:47:25 | 2021-01-28T11:27:49 | 2021-07-07T02:30:37 | 4,539 | 0 | 7 | 37 |
Java
| false | false |
package com.manywho.services.example.tests;
import com.manywho.sdk.api.run.EngineValue;
import com.manywho.sdk.api.run.elements.type.ListFilter;
import com.manywho.sdk.api.run.elements.type.MObject;
import com.manywho.sdk.api.run.elements.type.ObjectDataRequest;
import com.manywho.sdk.api.run.elements.type.ObjectDataType;
import com.manywho.services.example.TestConstants;
import io.restassured.http.ContentType;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
public class DatabaseLoadTest {
@Test
public void testFindAll() {
List<EngineValue> configurationValues = new ArrayList<>();
configurationValues.add(new EngineValue("Username", com.manywho.sdk.api.ContentType.String, "username-test"));
configurationValues.add(new EngineValue("Password", com.manywho.sdk.api.ContentType.String, "password-test"));
ObjectDataType objectDataType = new ObjectDataType();
objectDataType.setDeveloperName("Person");
ListFilter listFilter = new ListFilter();
listFilter.setLimit(2);
List<MObject> objects = new ArrayList<>();
objects.add(new MObject("person1"));
ObjectDataRequest objectDataRequest = new ObjectDataRequest();
objectDataRequest.setObjectDataType(objectDataType);
objectDataRequest.setListFilter(listFilter);
objectDataRequest.setConfigurationValues(configurationValues);
objectDataRequest.setObjectData(objects);
given()
.contentType(ContentType.JSON)
.header("Authorization", TestConstants.TOKEN)
.body(objectDataRequest)
.when()
.post("/data")
.then()
.assertThat()
.statusCode(200)
.body(notNullValue())
.body("objectData", hasSize(2))
.body("objectData[0].developerName", equalTo("Person"))
.body("objectData[0].externalId", not(isEmptyOrNullString()))
.body("objectData[0].properties", hasSize(9))
.body("objectData[0].properties[0].contentType", equalTo("ContentNumber"))
.body("objectData[0].properties[0].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[0].developerName", equalTo("Age"))
.body("objectData[0].properties[1].contentType", equalTo("ContentContent"))
.body("objectData[0].properties[1].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[1].developerName", equalTo("Biography"))
.body("objectData[0].properties[2].contentType", equalTo("ContentDateTime"))
.body("objectData[0].properties[2].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[2].developerName", equalTo("Created At"))
.body("objectData[0].properties[3].contentType", equalTo("ContentList"))
.body("objectData[0].properties[3].contentValue", nullValue())
.body("objectData[0].properties[3].developerName", equalTo("Groups"))
.body("objectData[0].properties[3].objectData", hasSize(2))
.body("objectData[0].properties[3].objectData[0].developerName", equalTo("Group"))
.body("objectData[0].properties[3].objectData[0].externalId", equalTo("1"))
.body("objectData[0].properties[3].objectData[0].properties", hasSize(1))
.body("objectData[0].properties[3].objectData[0].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[3].objectData[0].properties[0].contentValue", equalTo("Developers"))
.body("objectData[0].properties[3].objectData[0].properties[0].developerName", equalTo("Name"))
.body("objectData[0].properties[3].objectData[1].developerName", equalTo("Group"))
.body("objectData[0].properties[3].objectData[1].externalId", equalTo("2"))
.body("objectData[0].properties[3].objectData[1].properties", hasSize(1))
.body("objectData[0].properties[3].objectData[1].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[3].objectData[1].properties[0].contentValue", equalTo("TechOps"))
.body("objectData[0].properties[3].objectData[1].properties[0].developerName", equalTo("Name"))
.body("objectData[0].properties[4].contentType", equalTo("ContentBoolean"))
.body("objectData[0].properties[4].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[4].developerName", equalTo("Is Active?"))
.body("objectData[0].properties[5].contentType", equalTo("ContentObject"))
.body("objectData[0].properties[5].contentValue", nullValue())
.body("objectData[0].properties[5].developerName", equalTo("Manager"))
.body("objectData[0].properties[5].objectData", hasSize(1))
.body("objectData[0].properties[5].objectData[0].developerName", equalTo("Person"))
.body("objectData[0].properties[5].objectData[0].externalId", not(isEmptyOrNullString()))
.body("objectData[0].properties[5].objectData[0].properties", hasSize(9))
.body("objectData[0].properties[5].objectData[0].properties[3].objectData", hasSize(2))
.body("objectData[0].properties[6].contentType", equalTo("ContentString"))
.body("objectData[0].properties[6].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[6].developerName", equalTo("Name"))
.body("objectData[0].properties[7].contentType", equalTo("ContentPassword"))
.body("objectData[0].properties[7].contentValue", nullValue())
.body("objectData[0].properties[7].developerName", equalTo("Password"))
.body("objectData[0].properties[8].contentType", equalTo("ContentEncrypted"))
.body("objectData[0].properties[8].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[8].developerName", equalTo("Social Security Number"));
}
@Test
public void testFind() {
List<EngineValue> configurationValues = new ArrayList<>();
configurationValues.add(new EngineValue("Username", com.manywho.sdk.api.ContentType.String, "username-test"));
configurationValues.add(new EngineValue("Password", com.manywho.sdk.api.ContentType.String, "password-test"));
ObjectDataType objectDataType = new ObjectDataType();
objectDataType.setDeveloperName("Person");
ListFilter listFilter = new ListFilter();
listFilter.setId(UUID.randomUUID().toString());
ObjectDataRequest objectDataRequest = new ObjectDataRequest();
objectDataRequest.setObjectDataType(objectDataType);
objectDataRequest.setListFilter(listFilter);
objectDataRequest.setConfigurationValues(configurationValues);
given()
.contentType(ContentType.JSON)
.header("Authorization", TestConstants.TOKEN)
.body(objectDataRequest)
.when()
.post("/data")
.then()
.assertThat()
.statusCode(200)
.body(notNullValue())
.body("objectData", hasSize(1))
.body("objectData[0].developerName", equalTo("Person"))
.body("objectData[0].externalId", not(isEmptyOrNullString()))
.body("objectData[0].properties", hasSize(9))
.body("objectData[0].properties[0].contentType", equalTo("ContentNumber"))
.body("objectData[0].properties[0].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[0].developerName", equalTo("Age"))
.body("objectData[0].properties[1].contentType", equalTo("ContentContent"))
.body("objectData[0].properties[1].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[1].developerName", equalTo("Biography"))
.body("objectData[0].properties[2].contentType", equalTo("ContentDateTime"))
.body("objectData[0].properties[2].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[2].developerName", equalTo("Created At"))
.body("objectData[0].properties[3].contentType", equalTo("ContentList"))
.body("objectData[0].properties[3].contentValue", nullValue())
.body("objectData[0].properties[3].developerName", equalTo("Groups"))
.body("objectData[0].properties[3].objectData", hasSize(2))
.body("objectData[0].properties[3].objectData[0].developerName", equalTo("Group"))
.body("objectData[0].properties[3].objectData[0].externalId", equalTo("1"))
.body("objectData[0].properties[3].objectData[0].properties", hasSize(1))
.body("objectData[0].properties[3].objectData[0].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[3].objectData[0].properties[0].contentValue", equalTo("Developers"))
.body("objectData[0].properties[3].objectData[0].properties[0].developerName", equalTo("Name"))
.body("objectData[0].properties[3].objectData[1].developerName", equalTo("Group"))
.body("objectData[0].properties[3].objectData[1].externalId", equalTo("2"))
.body("objectData[0].properties[3].objectData[1].properties", hasSize(1))
.body("objectData[0].properties[3].objectData[1].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[3].objectData[1].properties[0].contentValue", equalTo("TechOps"))
.body("objectData[0].properties[3].objectData[1].properties[0].developerName", equalTo("Name"))
.body("objectData[0].properties[4].contentType", equalTo("ContentBoolean"))
.body("objectData[0].properties[4].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[4].developerName", equalTo("Is Active?"))
.body("objectData[0].properties[5].contentType", equalTo("ContentObject"))
.body("objectData[0].properties[5].contentValue", nullValue())
.body("objectData[0].properties[5].developerName", equalTo("Manager"))
.body("objectData[0].properties[5].objectData", hasSize(1))
.body("objectData[0].properties[5].objectData[0].developerName", equalTo("Person"))
.body("objectData[0].properties[5].objectData[0].externalId", not(isEmptyOrNullString()))
.body("objectData[0].properties[5].objectData[0].properties", hasSize(9))
.body("objectData[0].properties[5].objectData[0].properties[3].objectData", hasSize(2))
.body("objectData[0].properties[6].contentType", equalTo("ContentString"))
.body("objectData[0].properties[6].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[6].developerName", equalTo("Name"))
.body("objectData[0].properties[7].contentType", equalTo("ContentPassword"))
.body("objectData[0].properties[7].contentValue", nullValue())
.body("objectData[0].properties[7].developerName", equalTo("Password"))
.body("objectData[0].properties[8].contentType", equalTo("ContentEncrypted"))
.body("objectData[0].properties[8].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[8].developerName", equalTo("Social Security Number"));
}
@Test
public void testFindAllRaw() {
List<EngineValue> configurationValues = new ArrayList<>();
configurationValues.add(new EngineValue("Username", com.manywho.sdk.api.ContentType.String, "username-test"));
configurationValues.add(new EngineValue("Password", com.manywho.sdk.api.ContentType.String, "password-test"));
ObjectDataType objectDataType = new ObjectDataType();
objectDataType.setDeveloperName("custom-type-one");
ListFilter listFilter = new ListFilter();
listFilter.setLimit(2);
ObjectDataRequest objectDataRequest = new ObjectDataRequest();
objectDataRequest.setObjectDataType(objectDataType);
objectDataRequest.setListFilter(listFilter);
objectDataRequest.setConfigurationValues(configurationValues);
given()
.contentType(ContentType.JSON)
.header("Authorization", TestConstants.TOKEN)
.body(objectDataRequest)
.when()
.post("/data")
.then()
.assertThat()
.statusCode(200)
.body(notNullValue())
.body("objectData", hasSize(2))
.body("objectData[0].developerName", equalTo("custom-type-one"))
.body("objectData[0].externalId", equalTo("0"))
.body("objectData[0].properties", hasSize(2))
.body("objectData[0].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[0].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[0].developerName", equalTo("Property One"))
.body("objectData[0].properties[1].contentType", equalTo("ContentString"))
.body("objectData[0].properties[1].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[1].developerName", equalTo("Property Two"))
.body("objectData[1].developerName", equalTo("custom-type-one"))
.body("objectData[1].externalId", equalTo("1"))
.body("objectData[1].properties", hasSize(2))
.body("objectData[1].properties[0].contentType", equalTo("ContentString"))
.body("objectData[1].properties[0].contentValue", not(isEmptyOrNullString()))
.body("objectData[1].properties[0].developerName", equalTo("Property One"))
.body("objectData[1].properties[1].contentType", equalTo("ContentString"))
.body("objectData[1].properties[1].contentValue", not(isEmptyOrNullString()))
.body("objectData[1].properties[1].developerName", equalTo("Property Two"));
}
@Test
public void testFindRaw() {
List<EngineValue> configurationValues = new ArrayList<>();
configurationValues.add(new EngineValue("Username", com.manywho.sdk.api.ContentType.String, "username-test"));
configurationValues.add(new EngineValue("Password", com.manywho.sdk.api.ContentType.String, "password-test"));
ObjectDataType objectDataType = new ObjectDataType();
objectDataType.setDeveloperName("custom-type-one");
ListFilter listFilter = new ListFilter();
listFilter.setId(UUID.randomUUID().toString());
ObjectDataRequest objectDataRequest = new ObjectDataRequest();
objectDataRequest.setObjectDataType(objectDataType);
objectDataRequest.setListFilter(listFilter);
objectDataRequest.setConfigurationValues(configurationValues);
given()
.contentType(ContentType.JSON)
.header("Authorization", TestConstants.TOKEN)
.body(objectDataRequest)
.when()
.post("/data")
.then()
.assertThat()
.statusCode(200)
.body(notNullValue())
.body("hasMoreResults", equalTo(false))
.body("objectData", hasSize(1))
.body("objectData[0].developerName", equalTo("custom-type-one"))
.body("objectData[0].externalId", equalTo(listFilter.getId()))
.body("objectData[0].properties", hasSize(2))
.body("objectData[0].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[0].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[0].developerName", equalTo("Property One"))
.body("objectData[0].properties[1].contentType", equalTo("ContentString"))
.body("objectData[0].properties[1].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[1].developerName", equalTo("Property Two"));
}
}
|
UTF-8
|
Java
| 16,925 |
java
|
DatabaseLoadTest.java
|
Java
|
[
{
"context": "rname\", com.manywho.sdk.api.ContentType.String, \"username-test\"));\n configurationValues.add(new EngineVal",
"end": 859,
"score": 0.7198834419250488,
"start": 846,
"tag": "USERNAME",
"value": "username-test"
},
{
"context": "rname\", com.manywho.sdk.api.ContentType.String, \"username-test\"));\n configurationValues.add(new EngineVal",
"end": 6657,
"score": 0.9978693127632141,
"start": 6644,
"tag": "USERNAME",
"value": "username-test"
},
{
"context": "sword\", com.manywho.sdk.api.ContentType.String, \"password-test\"));\n\n ObjectDataType objectDataType =",
"end": 6772,
"score": 0.5129008889198303,
"start": 6764,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "com.manywho.sdk.api.ContentType.String, \"password-test\"));\n\n ObjectDataType objectDataType = new ",
"end": 6777,
"score": 0.6902100443840027,
"start": 6773,
"tag": "PASSWORD",
"value": "test"
},
{
"context": "rname\", com.manywho.sdk.api.ContentType.String, \"username-test\"));\n configurationValues.add(new EngineVal",
"end": 12339,
"score": 0.969515323638916,
"start": 12326,
"tag": "USERNAME",
"value": "username-test"
},
{
"context": "rname\", com.manywho.sdk.api.ContentType.String, \"username-test\"));\n configurationValues.add(new EngineVal",
"end": 15077,
"score": 0.9608075022697449,
"start": 15064,
"tag": "USERNAME",
"value": "username-test"
},
{
"context": "nfigurationValues.add(new EngineValue(\"Password\", com.manywho.sdk.api.ContentType.String, \"password-test\"));\n\n O",
"end": 15162,
"score": 0.9877086877822876,
"start": 15143,
"tag": "PASSWORD",
"value": "com.manywho.sdk.api"
}
] | null |
[] |
package com.manywho.services.example.tests;
import com.manywho.sdk.api.run.EngineValue;
import com.manywho.sdk.api.run.elements.type.ListFilter;
import com.manywho.sdk.api.run.elements.type.MObject;
import com.manywho.sdk.api.run.elements.type.ObjectDataRequest;
import com.manywho.sdk.api.run.elements.type.ObjectDataType;
import com.manywho.services.example.TestConstants;
import io.restassured.http.ContentType;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
public class DatabaseLoadTest {
@Test
public void testFindAll() {
List<EngineValue> configurationValues = new ArrayList<>();
configurationValues.add(new EngineValue("Username", com.manywho.sdk.api.ContentType.String, "username-test"));
configurationValues.add(new EngineValue("Password", com.manywho.sdk.api.ContentType.String, "password-test"));
ObjectDataType objectDataType = new ObjectDataType();
objectDataType.setDeveloperName("Person");
ListFilter listFilter = new ListFilter();
listFilter.setLimit(2);
List<MObject> objects = new ArrayList<>();
objects.add(new MObject("person1"));
ObjectDataRequest objectDataRequest = new ObjectDataRequest();
objectDataRequest.setObjectDataType(objectDataType);
objectDataRequest.setListFilter(listFilter);
objectDataRequest.setConfigurationValues(configurationValues);
objectDataRequest.setObjectData(objects);
given()
.contentType(ContentType.JSON)
.header("Authorization", TestConstants.TOKEN)
.body(objectDataRequest)
.when()
.post("/data")
.then()
.assertThat()
.statusCode(200)
.body(notNullValue())
.body("objectData", hasSize(2))
.body("objectData[0].developerName", equalTo("Person"))
.body("objectData[0].externalId", not(isEmptyOrNullString()))
.body("objectData[0].properties", hasSize(9))
.body("objectData[0].properties[0].contentType", equalTo("ContentNumber"))
.body("objectData[0].properties[0].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[0].developerName", equalTo("Age"))
.body("objectData[0].properties[1].contentType", equalTo("ContentContent"))
.body("objectData[0].properties[1].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[1].developerName", equalTo("Biography"))
.body("objectData[0].properties[2].contentType", equalTo("ContentDateTime"))
.body("objectData[0].properties[2].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[2].developerName", equalTo("Created At"))
.body("objectData[0].properties[3].contentType", equalTo("ContentList"))
.body("objectData[0].properties[3].contentValue", nullValue())
.body("objectData[0].properties[3].developerName", equalTo("Groups"))
.body("objectData[0].properties[3].objectData", hasSize(2))
.body("objectData[0].properties[3].objectData[0].developerName", equalTo("Group"))
.body("objectData[0].properties[3].objectData[0].externalId", equalTo("1"))
.body("objectData[0].properties[3].objectData[0].properties", hasSize(1))
.body("objectData[0].properties[3].objectData[0].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[3].objectData[0].properties[0].contentValue", equalTo("Developers"))
.body("objectData[0].properties[3].objectData[0].properties[0].developerName", equalTo("Name"))
.body("objectData[0].properties[3].objectData[1].developerName", equalTo("Group"))
.body("objectData[0].properties[3].objectData[1].externalId", equalTo("2"))
.body("objectData[0].properties[3].objectData[1].properties", hasSize(1))
.body("objectData[0].properties[3].objectData[1].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[3].objectData[1].properties[0].contentValue", equalTo("TechOps"))
.body("objectData[0].properties[3].objectData[1].properties[0].developerName", equalTo("Name"))
.body("objectData[0].properties[4].contentType", equalTo("ContentBoolean"))
.body("objectData[0].properties[4].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[4].developerName", equalTo("Is Active?"))
.body("objectData[0].properties[5].contentType", equalTo("ContentObject"))
.body("objectData[0].properties[5].contentValue", nullValue())
.body("objectData[0].properties[5].developerName", equalTo("Manager"))
.body("objectData[0].properties[5].objectData", hasSize(1))
.body("objectData[0].properties[5].objectData[0].developerName", equalTo("Person"))
.body("objectData[0].properties[5].objectData[0].externalId", not(isEmptyOrNullString()))
.body("objectData[0].properties[5].objectData[0].properties", hasSize(9))
.body("objectData[0].properties[5].objectData[0].properties[3].objectData", hasSize(2))
.body("objectData[0].properties[6].contentType", equalTo("ContentString"))
.body("objectData[0].properties[6].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[6].developerName", equalTo("Name"))
.body("objectData[0].properties[7].contentType", equalTo("ContentPassword"))
.body("objectData[0].properties[7].contentValue", nullValue())
.body("objectData[0].properties[7].developerName", equalTo("Password"))
.body("objectData[0].properties[8].contentType", equalTo("ContentEncrypted"))
.body("objectData[0].properties[8].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[8].developerName", equalTo("Social Security Number"));
}
@Test
public void testFind() {
List<EngineValue> configurationValues = new ArrayList<>();
configurationValues.add(new EngineValue("Username", com.manywho.sdk.api.ContentType.String, "username-test"));
configurationValues.add(new EngineValue("Password", com.manywho.sdk.api.ContentType.String, "<PASSWORD>-<PASSWORD>"));
ObjectDataType objectDataType = new ObjectDataType();
objectDataType.setDeveloperName("Person");
ListFilter listFilter = new ListFilter();
listFilter.setId(UUID.randomUUID().toString());
ObjectDataRequest objectDataRequest = new ObjectDataRequest();
objectDataRequest.setObjectDataType(objectDataType);
objectDataRequest.setListFilter(listFilter);
objectDataRequest.setConfigurationValues(configurationValues);
given()
.contentType(ContentType.JSON)
.header("Authorization", TestConstants.TOKEN)
.body(objectDataRequest)
.when()
.post("/data")
.then()
.assertThat()
.statusCode(200)
.body(notNullValue())
.body("objectData", hasSize(1))
.body("objectData[0].developerName", equalTo("Person"))
.body("objectData[0].externalId", not(isEmptyOrNullString()))
.body("objectData[0].properties", hasSize(9))
.body("objectData[0].properties[0].contentType", equalTo("ContentNumber"))
.body("objectData[0].properties[0].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[0].developerName", equalTo("Age"))
.body("objectData[0].properties[1].contentType", equalTo("ContentContent"))
.body("objectData[0].properties[1].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[1].developerName", equalTo("Biography"))
.body("objectData[0].properties[2].contentType", equalTo("ContentDateTime"))
.body("objectData[0].properties[2].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[2].developerName", equalTo("Created At"))
.body("objectData[0].properties[3].contentType", equalTo("ContentList"))
.body("objectData[0].properties[3].contentValue", nullValue())
.body("objectData[0].properties[3].developerName", equalTo("Groups"))
.body("objectData[0].properties[3].objectData", hasSize(2))
.body("objectData[0].properties[3].objectData[0].developerName", equalTo("Group"))
.body("objectData[0].properties[3].objectData[0].externalId", equalTo("1"))
.body("objectData[0].properties[3].objectData[0].properties", hasSize(1))
.body("objectData[0].properties[3].objectData[0].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[3].objectData[0].properties[0].contentValue", equalTo("Developers"))
.body("objectData[0].properties[3].objectData[0].properties[0].developerName", equalTo("Name"))
.body("objectData[0].properties[3].objectData[1].developerName", equalTo("Group"))
.body("objectData[0].properties[3].objectData[1].externalId", equalTo("2"))
.body("objectData[0].properties[3].objectData[1].properties", hasSize(1))
.body("objectData[0].properties[3].objectData[1].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[3].objectData[1].properties[0].contentValue", equalTo("TechOps"))
.body("objectData[0].properties[3].objectData[1].properties[0].developerName", equalTo("Name"))
.body("objectData[0].properties[4].contentType", equalTo("ContentBoolean"))
.body("objectData[0].properties[4].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[4].developerName", equalTo("Is Active?"))
.body("objectData[0].properties[5].contentType", equalTo("ContentObject"))
.body("objectData[0].properties[5].contentValue", nullValue())
.body("objectData[0].properties[5].developerName", equalTo("Manager"))
.body("objectData[0].properties[5].objectData", hasSize(1))
.body("objectData[0].properties[5].objectData[0].developerName", equalTo("Person"))
.body("objectData[0].properties[5].objectData[0].externalId", not(isEmptyOrNullString()))
.body("objectData[0].properties[5].objectData[0].properties", hasSize(9))
.body("objectData[0].properties[5].objectData[0].properties[3].objectData", hasSize(2))
.body("objectData[0].properties[6].contentType", equalTo("ContentString"))
.body("objectData[0].properties[6].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[6].developerName", equalTo("Name"))
.body("objectData[0].properties[7].contentType", equalTo("ContentPassword"))
.body("objectData[0].properties[7].contentValue", nullValue())
.body("objectData[0].properties[7].developerName", equalTo("Password"))
.body("objectData[0].properties[8].contentType", equalTo("ContentEncrypted"))
.body("objectData[0].properties[8].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[8].developerName", equalTo("Social Security Number"));
}
@Test
public void testFindAllRaw() {
List<EngineValue> configurationValues = new ArrayList<>();
configurationValues.add(new EngineValue("Username", com.manywho.sdk.api.ContentType.String, "username-test"));
configurationValues.add(new EngineValue("Password", com.manywho.sdk.api.ContentType.String, "password-test"));
ObjectDataType objectDataType = new ObjectDataType();
objectDataType.setDeveloperName("custom-type-one");
ListFilter listFilter = new ListFilter();
listFilter.setLimit(2);
ObjectDataRequest objectDataRequest = new ObjectDataRequest();
objectDataRequest.setObjectDataType(objectDataType);
objectDataRequest.setListFilter(listFilter);
objectDataRequest.setConfigurationValues(configurationValues);
given()
.contentType(ContentType.JSON)
.header("Authorization", TestConstants.TOKEN)
.body(objectDataRequest)
.when()
.post("/data")
.then()
.assertThat()
.statusCode(200)
.body(notNullValue())
.body("objectData", hasSize(2))
.body("objectData[0].developerName", equalTo("custom-type-one"))
.body("objectData[0].externalId", equalTo("0"))
.body("objectData[0].properties", hasSize(2))
.body("objectData[0].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[0].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[0].developerName", equalTo("Property One"))
.body("objectData[0].properties[1].contentType", equalTo("ContentString"))
.body("objectData[0].properties[1].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[1].developerName", equalTo("Property Two"))
.body("objectData[1].developerName", equalTo("custom-type-one"))
.body("objectData[1].externalId", equalTo("1"))
.body("objectData[1].properties", hasSize(2))
.body("objectData[1].properties[0].contentType", equalTo("ContentString"))
.body("objectData[1].properties[0].contentValue", not(isEmptyOrNullString()))
.body("objectData[1].properties[0].developerName", equalTo("Property One"))
.body("objectData[1].properties[1].contentType", equalTo("ContentString"))
.body("objectData[1].properties[1].contentValue", not(isEmptyOrNullString()))
.body("objectData[1].properties[1].developerName", equalTo("Property Two"));
}
@Test
public void testFindRaw() {
List<EngineValue> configurationValues = new ArrayList<>();
configurationValues.add(new EngineValue("Username", com.manywho.sdk.api.ContentType.String, "username-test"));
configurationValues.add(new EngineValue("Password", <PASSWORD>.ContentType.String, "password-test"));
ObjectDataType objectDataType = new ObjectDataType();
objectDataType.setDeveloperName("custom-type-one");
ListFilter listFilter = new ListFilter();
listFilter.setId(UUID.randomUUID().toString());
ObjectDataRequest objectDataRequest = new ObjectDataRequest();
objectDataRequest.setObjectDataType(objectDataType);
objectDataRequest.setListFilter(listFilter);
objectDataRequest.setConfigurationValues(configurationValues);
given()
.contentType(ContentType.JSON)
.header("Authorization", TestConstants.TOKEN)
.body(objectDataRequest)
.when()
.post("/data")
.then()
.assertThat()
.statusCode(200)
.body(notNullValue())
.body("hasMoreResults", equalTo(false))
.body("objectData", hasSize(1))
.body("objectData[0].developerName", equalTo("custom-type-one"))
.body("objectData[0].externalId", equalTo(listFilter.getId()))
.body("objectData[0].properties", hasSize(2))
.body("objectData[0].properties[0].contentType", equalTo("ContentString"))
.body("objectData[0].properties[0].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[0].developerName", equalTo("Property One"))
.body("objectData[0].properties[1].contentType", equalTo("ContentString"))
.body("objectData[0].properties[1].contentValue", not(isEmptyOrNullString()))
.body("objectData[0].properties[1].developerName", equalTo("Property Two"));
}
}
| 16,924 | 0.62777 | 0.608922 | 275 | 60.545456 | 35.589588 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.774545 | false | false |
7
|
4953dcc7dab3d397197e388984053679a5046ac7
| 26,388,279,105,923 |
ffcdd8c1fb7ba99dac838913a7b90c84ed704881
|
/app/src/main/java/com/valdizz/penaltycheck/model/NetworkServiceListener.java
|
2032386430decbea8f4fd1a5dbeda3e6c60b8e74
|
[] |
no_license
|
valdizz/penaltycheck
|
https://github.com/valdizz/penaltycheck
|
145d03ab3c73962ce56221a93da5ce4924ccd68e
|
c53598e2f80fac126f00676027cd5d108c4cd392
|
refs/heads/master
| 2021-07-08T07:24:30.862000 | 2019-01-09T20:05:54 | 2019-01-09T20:05:54 | 106,465,767 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.valdizz.penaltycheck.model;
import com.valdizz.penaltycheck.model.entity.Auto;
import java.util.Date;
import java.util.List;
public interface NetworkServiceListener {
void onSuccessRequest(long count);
void onErrorRequest(String error);
}
|
UTF-8
|
Java
| 263 |
java
|
NetworkServiceListener.java
|
Java
|
[] | null |
[] |
package com.valdizz.penaltycheck.model;
import com.valdizz.penaltycheck.model.entity.Auto;
import java.util.Date;
import java.util.List;
public interface NetworkServiceListener {
void onSuccessRequest(long count);
void onErrorRequest(String error);
}
| 263 | 0.790875 | 0.790875 | 12 | 20.916666 | 18.94931 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
7
|
86768b5b0b71ffa74875ce128887bdf961af001f
| 28,887,950,097,304 |
23f0861602d177ea895b32a1009bb878ec3b7e2c
|
/src/main/java/com/HR/iiitb/service/impl/DepartmentServiceImpl.java
|
a84ddc5fe6f0c468cbd9cb934a04bf80eec2d85e
|
[] |
no_license
|
mayurjain02/Academic_ERP
|
https://github.com/mayurjain02/Academic_ERP
|
e6b727050bc56f922bcec33d15550dd2967bd66b
|
d301aafc62fd3fc50e90827d009cfef4b09ca367
|
refs/heads/main
| 2023-01-21T22:50:25.367000 | 2020-11-22T15:27:54 | 2020-11-22T15:27:54 | 315,066,555 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.HR.iiitb.service.impl;
import java.util.List;
import com.HR.iiitb.bean.Department;
import com.HR.iiitb.service.DepartmentService;
public class DepartmentServiceImpl implements DepartmentService {
@Override
public void createDepartment(Department department) {
departmentDAO.createDeaprtment(department);
}
@Override
public List<String> getDepartmentName() {
return departmentDAO.getDepartmentName();
}
@Override
public Integer getDeptId(String departmentName) {
return departmentDAO.getDeptId(departmentName);
}
@Override
public void deleteDepartment(Integer deprtID) {
departmentDAO.deleteDepart(deprtID);
}
@Override
public void updateDepartment(Department department) {
departmentDAO.updateDepartment(department);
}
@Override
public Department getDepartment(String deptName) {
return departmentDAO.getDept(deptName);
}
}
|
UTF-8
|
Java
| 888 |
java
|
DepartmentServiceImpl.java
|
Java
|
[] | null |
[] |
package com.HR.iiitb.service.impl;
import java.util.List;
import com.HR.iiitb.bean.Department;
import com.HR.iiitb.service.DepartmentService;
public class DepartmentServiceImpl implements DepartmentService {
@Override
public void createDepartment(Department department) {
departmentDAO.createDeaprtment(department);
}
@Override
public List<String> getDepartmentName() {
return departmentDAO.getDepartmentName();
}
@Override
public Integer getDeptId(String departmentName) {
return departmentDAO.getDeptId(departmentName);
}
@Override
public void deleteDepartment(Integer deprtID) {
departmentDAO.deleteDepart(deprtID);
}
@Override
public void updateDepartment(Department department) {
departmentDAO.updateDepartment(department);
}
@Override
public Department getDepartment(String deptName) {
return departmentDAO.getDept(deptName);
}
}
| 888 | 0.782658 | 0.782658 | 44 | 19.181818 | 21.402287 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.090909 | false | false |
7
|
1613b09ff1a8206175a035acbb53e3e10f5b18b3
| 18,975,165,570,951 |
3f88ea3dd3cf89982d92e12e88871846669725f7
|
/app/src/main/java/com/example/launcherapplication/FavouriteAppAdapter.java
|
ad79fd09f73e5dab744c8605354df0a1b2241f07
|
[] |
no_license
|
akseltahir/launcherApplication
|
https://github.com/akseltahir/launcherApplication
|
1c36204a9706f6fdb3ee5a7503302bf9c6139bfb
|
122f09166e046a0a58cc13647dbc314848d94529
|
refs/heads/main
| 2023-07-03T01:37:05.202000 | 2021-07-15T20:25:24 | 2021-07-15T20:25:24 | 381,751,838 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.launcherapplication;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class FavouriteAppAdapter extends RecyclerView.Adapter<FavouriteAppAdapter.ViewHolder> {
private final List<AppObject> faveAppsList;
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnCreateContextMenuListener {
public TextView faveAppNameTV;
public ImageView faveAppIconIV;
public TextView faveAppUsageTimeTV;
public LinearLayout faveAppItemTV;
public ViewHolder(View itemView) {
super(itemView);
faveAppNameTV = (TextView) itemView.findViewById(R.id.faveAppNameTV);
faveAppIconIV = (ImageView) itemView.findViewById(R.id.faveAppIconIV);
faveAppUsageTimeTV = (TextView) itemView.findViewById(R.id.faveAppUsageTimeTV);
faveAppItemTV = (LinearLayout) itemView.findViewById(R.id.faveAppItemTV);
itemView.setOnClickListener(this);
itemView.setOnCreateContextMenuListener(this);
}
@Override
public void onClick(View v) {
int pos = getAdapterPosition();
Context context = v.getContext();
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(faveAppsList.get(pos).getPackageName());
context.startActivity(launchIntent);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
menu.add(this.getAdapterPosition(), 1, 0, "Remove from Favourites");
menu.add(this.getAdapterPosition(), 2, 1, "App info");
}
}
//adds the code we've written to the target view
@NonNull
@Override
public FavouriteAppAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.favourites_app_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder viewHolder, int i) {
String appLabel = faveAppsList.get(i).getName();
String appPackage = faveAppsList.get(i).getPackageName();
Drawable appIcon = faveAppsList.get(i).getImage();
String appCategory = faveAppsList.get(i).getAppInfo();
TextView textView = (TextView) viewHolder.faveAppNameTV;
textView.setText(appLabel);
ImageView imageView = viewHolder.faveAppIconIV;
imageView.setImageDrawable(appIcon);
TextView appUsageTime = (TextView) viewHolder.faveAppUsageTimeTV;
appUsageTime.setText(appCategory);
}
/*
Various helper functions
*/
//get the item count for the recyclerview
@Override
public int getItemCount() {
return faveAppsList.size();
}
//remove single app from the recyclerview
public void removeAppFromList(int position) {
faveAppsList.remove(position);
notifyDataSetChanged();
}
//return packagename of the selected app
public String getAppPackageName(int position) {
return faveAppsList.get(position).getPackageName();
}
//add into recyclerview
public void addApp(AppObject app) {
faveAppsList.add(app);
}
//simple constructor
public FavouriteAppAdapter(Context c) {
faveAppsList = new ArrayList<>();
}
//delete all items from the recyclerview
public void clear() {
int size = faveAppsList.size();
faveAppsList.clear();
notifyItemRangeRemoved(0, size);
}
}
|
UTF-8
|
Java
| 4,057 |
java
|
FavouriteAppAdapter.java
|
Java
|
[] | null |
[] |
package com.example.launcherapplication;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class FavouriteAppAdapter extends RecyclerView.Adapter<FavouriteAppAdapter.ViewHolder> {
private final List<AppObject> faveAppsList;
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnCreateContextMenuListener {
public TextView faveAppNameTV;
public ImageView faveAppIconIV;
public TextView faveAppUsageTimeTV;
public LinearLayout faveAppItemTV;
public ViewHolder(View itemView) {
super(itemView);
faveAppNameTV = (TextView) itemView.findViewById(R.id.faveAppNameTV);
faveAppIconIV = (ImageView) itemView.findViewById(R.id.faveAppIconIV);
faveAppUsageTimeTV = (TextView) itemView.findViewById(R.id.faveAppUsageTimeTV);
faveAppItemTV = (LinearLayout) itemView.findViewById(R.id.faveAppItemTV);
itemView.setOnClickListener(this);
itemView.setOnCreateContextMenuListener(this);
}
@Override
public void onClick(View v) {
int pos = getAdapterPosition();
Context context = v.getContext();
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(faveAppsList.get(pos).getPackageName());
context.startActivity(launchIntent);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
menu.add(this.getAdapterPosition(), 1, 0, "Remove from Favourites");
menu.add(this.getAdapterPosition(), 2, 1, "App info");
}
}
//adds the code we've written to the target view
@NonNull
@Override
public FavouriteAppAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.favourites_app_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder viewHolder, int i) {
String appLabel = faveAppsList.get(i).getName();
String appPackage = faveAppsList.get(i).getPackageName();
Drawable appIcon = faveAppsList.get(i).getImage();
String appCategory = faveAppsList.get(i).getAppInfo();
TextView textView = (TextView) viewHolder.faveAppNameTV;
textView.setText(appLabel);
ImageView imageView = viewHolder.faveAppIconIV;
imageView.setImageDrawable(appIcon);
TextView appUsageTime = (TextView) viewHolder.faveAppUsageTimeTV;
appUsageTime.setText(appCategory);
}
/*
Various helper functions
*/
//get the item count for the recyclerview
@Override
public int getItemCount() {
return faveAppsList.size();
}
//remove single app from the recyclerview
public void removeAppFromList(int position) {
faveAppsList.remove(position);
notifyDataSetChanged();
}
//return packagename of the selected app
public String getAppPackageName(int position) {
return faveAppsList.get(position).getPackageName();
}
//add into recyclerview
public void addApp(AppObject app) {
faveAppsList.add(app);
}
//simple constructor
public FavouriteAppAdapter(Context c) {
faveAppsList = new ArrayList<>();
}
//delete all items from the recyclerview
public void clear() {
int size = faveAppsList.size();
faveAppsList.clear();
notifyItemRangeRemoved(0, size);
}
}
| 4,057 | 0.694848 | 0.693616 | 122 | 32.262295 | 28.64732 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.557377 | false | false |
7
|
9790e4f11328eddca59e04b957b0e2dd3251712d
| 10,333,691,317,189 |
76a8a810d592acac2c9c8a1043c71f5a65e25179
|
/04HibernateManyToMany/src/org/kushal/hibernate/App.java
|
1fe2251cf2085d67fd5192f0acf69ec9ce1e77da
|
[] |
no_license
|
KushalK2507/Hibernate
|
https://github.com/KushalK2507/Hibernate
|
bdb7feb5b671025b941eaa3435087e7d6f284064
|
43123bc193e25e4e5c6f371ddbb47ff021cab285
|
refs/heads/master
| 2021-11-13T04:46:34.856000 | 2021-10-17T12:47:06 | 2021-10-17T12:47:06 | 196,855,351 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.kushal.hibernate;
import java.util.Scanner;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.kushal.hibernate.entity.Persons;
import org.kushal.hibernate.entity.Vehicle;
public class App {
public static void main(String args[]) {
SessionFactory sessionFactory = new Configuration().configure("hibernate.cfg.xml")
.addAnnotatedClass(Persons.class).addAnnotatedClass(Vehicle.class).buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
Persons person1 = new Persons();
person1.setName("Kushal");
Persons person2 = new Persons();
person2.setName("Komal");
Vehicle vehicle = new Vehicle();
vehicle.setVehicleName("Jeep");
Vehicle vehicle2 = new Vehicle();
vehicle2.setVehicleName("Car");
person1.getVehicle().add(vehicle);
person1.getVehicle().add(vehicle2);
person2.getVehicle().add(vehicle);
person2.getVehicle().add(vehicle2);
vehicle.getPerson().add(person1);
vehicle.getPerson().add(person2);
vehicle2.getPerson().add(person1);
vehicle2.getPerson().add(person2);
session.beginTransaction();
session.save(person1);
session.save(vehicle);
session.save(vehicle2);
session.getTransaction().commit();
session.close();
System.out.println("Programs Ends");
System.exit(0);
}
}
|
UTF-8
|
Java
| 1,405 |
java
|
App.java
|
Java
|
[
{
"context": "sons person1 = new Persons();\r\n\t\tperson1.setName(\"Kushal\");\r\n\r\n\t\tPersons person2 = new Persons();\r\n\t\tperso",
"end": 634,
"score": 0.9998321533203125,
"start": 628,
"tag": "NAME",
"value": "Kushal"
},
{
"context": "sons person2 = new Persons();\r\n\t\tperson2.setName(\"Komal\");\r\n\r\n\t\tVehicle vehicle = new Vehicle();\r\n\t\tvehic",
"end": 701,
"score": 0.9998268485069275,
"start": 696,
"tag": "NAME",
"value": "Komal"
}
] | null |
[] |
package org.kushal.hibernate;
import java.util.Scanner;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.kushal.hibernate.entity.Persons;
import org.kushal.hibernate.entity.Vehicle;
public class App {
public static void main(String args[]) {
SessionFactory sessionFactory = new Configuration().configure("hibernate.cfg.xml")
.addAnnotatedClass(Persons.class).addAnnotatedClass(Vehicle.class).buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
Persons person1 = new Persons();
person1.setName("Kushal");
Persons person2 = new Persons();
person2.setName("Komal");
Vehicle vehicle = new Vehicle();
vehicle.setVehicleName("Jeep");
Vehicle vehicle2 = new Vehicle();
vehicle2.setVehicleName("Car");
person1.getVehicle().add(vehicle);
person1.getVehicle().add(vehicle2);
person2.getVehicle().add(vehicle);
person2.getVehicle().add(vehicle2);
vehicle.getPerson().add(person1);
vehicle.getPerson().add(person2);
vehicle2.getPerson().add(person1);
vehicle2.getPerson().add(person2);
session.beginTransaction();
session.save(person1);
session.save(vehicle);
session.save(vehicle2);
session.getTransaction().commit();
session.close();
System.out.println("Programs Ends");
System.exit(0);
}
}
| 1,405 | 0.713879 | 0.698932 | 55 | 23.545454 | 20.801065 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.654545 | false | false |
7
|
5e5d5d51a9323151ac9efd3de32ab0140fee951c
| 2,473,901,201,622 |
f19ccba838ecccbb716d905198a86ca253281001
|
/Check.java
|
8e9aec88833e24299c1aeed3b7069b6c14bb4ff6
|
[] |
no_license
|
DenisKuivalainen/Tic-Tac-Toe
|
https://github.com/DenisKuivalainen/Tic-Tac-Toe
|
8f53577ecf6307e51daba684dfcb29f49cd48c62
|
fc9b70eef9ce0b155cea2b01e77ce1f2213539b2
|
refs/heads/master
| 2022-12-04T01:42:16.366000 | 2020-05-16T13:36:04 | 2020-05-16T13:36:04 | 262,627,602 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kuivalainen;
import java.util.LinkedList;
public class Check {
String[] xo;
int[][] rows;
public Check (String[] xo) {
this.xo = xo;
this.rows = new WinningCombo().winningCombos();
}
// Проверяет значения поля на победу
// Checks field values for winning combinations
public boolean checkWin() {
for(int j = 0; j < 8; j++) {
if(xo[rows[j][0]] == xo[rows[j][1]] &&
xo[rows[j][0]] == xo[rows[j][1]] &&
xo[rows[j][0]] == xo[rows[j][2]] &&
(xo[rows[j][0]] == "O" ||
xo[rows[j][0]] == "X")
) {
return true;
}
}
return false;
}
// Creates list of empty cells
public LinkedList<Integer> checkFill() {
LinkedList<Integer> empty = new LinkedList<>();
for (int i = 0; i < xo.length; i++) {
if(xo[i] != "X" && xo[i] != "O") {
empty.add(i);
}
}
return empty;
}
// Checks if draw
public boolean draw() {
for(int i = 0; i < 9; i++) {
if((xo[i] != "X") && (xo[i] != "O")) {
return false;
}
}
return true;
}
}
|
UTF-8
|
Java
| 1,309 |
java
|
Check.java
|
Java
|
[] | null |
[] |
package com.kuivalainen;
import java.util.LinkedList;
public class Check {
String[] xo;
int[][] rows;
public Check (String[] xo) {
this.xo = xo;
this.rows = new WinningCombo().winningCombos();
}
// Проверяет значения поля на победу
// Checks field values for winning combinations
public boolean checkWin() {
for(int j = 0; j < 8; j++) {
if(xo[rows[j][0]] == xo[rows[j][1]] &&
xo[rows[j][0]] == xo[rows[j][1]] &&
xo[rows[j][0]] == xo[rows[j][2]] &&
(xo[rows[j][0]] == "O" ||
xo[rows[j][0]] == "X")
) {
return true;
}
}
return false;
}
// Creates list of empty cells
public LinkedList<Integer> checkFill() {
LinkedList<Integer> empty = new LinkedList<>();
for (int i = 0; i < xo.length; i++) {
if(xo[i] != "X" && xo[i] != "O") {
empty.add(i);
}
}
return empty;
}
// Checks if draw
public boolean draw() {
for(int i = 0; i < 9; i++) {
if((xo[i] != "X") && (xo[i] != "O")) {
return false;
}
}
return true;
}
}
| 1,309 | 0.419531 | 0.409375 | 53 | 23.150944 | 18.054838 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.396226 | false | false |
7
|
807c46ceb8fc90fefb6b2b860b34a740755c825c
| 24,567,212,986,975 |
d6f122599c867f2fbb4291a4f3ac20adf7205e0c
|
/app/src/main/java/com/example/progettoium/ListaCorsi.java
|
07b89a340e1cee343232ad19ffef38be40943ded
|
[] |
no_license
|
alessandronasso/BookLessons-Android
|
https://github.com/alessandronasso/BookLessons-Android
|
fde64385c6938ed6cea3f590e2fa7686eac974de
|
41d4e77d39d310f387429f1cc37b301af8962211
|
refs/heads/master
| 2021-02-08T18:16:31.786000 | 2020-03-01T16:25:24 | 2020-03-01T16:25:24 | 244,182,596 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.progettoium;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class ListaCorsi extends AppCompatActivity {
String[] listviewTitle = new String[7];
int[] listviewImage = new int[]{
R.drawable.so, R.drawable.analisi, R.drawable.tweb, R.drawable.sic,
R.drawable.ro, R.drawable.db, R.drawable.algoritmi};
String[] listviewShortDescription = new String[]{
"L’insegnamento fornisce una conoscenza di base dell'architettura interna e del funzionamento dei moderni sistemi operativi.",
"L'insegnamento ha lo scopo di presentare le nozioni di base su funzioni, grafici e loro trasformazioni.",
"Obiettivi: Imparare diversi linguaggi e tecnologie per lo sviluppo Web client-side, quali HTML5, CSS, JavaScript, JQuery.",
"Il corso si propone di fornire agli studenti gli strumenti crittografici e tecnici utilizzati per garantire la sicurezza di reti e calcolatori.",
"Il corso si propone di fornire agli studenti nozioni generali di calcolo matriciale, algebra e geometria.",
"L'insegnamento è un'introduzione alle basi di dati e ai sistemi di gestione delle medesime (SGBD).",
"L’insegnamento ha lo scopo di introdurre i concetti e le tecniche fondamentali per l’analisi e la progettazione di algoritmi.", };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listaimg);
caricamentoLista();
List<HashMap<String, String>> aList = new ArrayList<HashMap<String, String>>();
for (int i = 0; i < 7; i++) {
HashMap<String, String> hm = new HashMap<String, String>();
hm.put("listview_title", listviewTitle[i]);
hm.put("listview_discription", listviewShortDescription[i]);
hm.put("listview_image", Integer.toString(listviewImage[i]));
aList.add(hm);
}
String[] from = {"listview_image", "listview_title", "listview_discription"};
int[] to = {R.id.listview_image, R.id.listview_item_title, R.id.listview_item_short_description};
SimpleAdapter simpleAdapter = new SimpleAdapter(getBaseContext(), aList, R.layout.activity_lista_corsi, from, to);
ListView androidListView = (ListView) findViewById(R.id.list_view);
androidListView.setAdapter(simpleAdapter);
androidListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adattatore, final View componente, int pos, long id){
HashMap<String, String> item = (HashMap<String, String>) adattatore.getItemAtPosition(pos);
String value = item.get("listview_title");
Intent intent = new Intent(getApplicationContext(), ListaLiberi.class);
intent.putExtra("corso", value);
startActivity(intent);
}
});
}
public void caricamentoLista () {
GestioneDB db = new GestioneDB(this);
db.open();
Cursor c = db.getCorsi();
int i=0;
if (c.moveToFirst()) {
do {
if (!(c.getString(1).equals("ECONOMIA")))
listviewTitle[i++] = c.getString(1);
} while (c.moveToNext());
}
db.close();
}
@Override
public void onBackPressed() {
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
}
}
|
UTF-8
|
Java
| 3,966 |
java
|
ListaCorsi.java
|
Java
|
[] | null |
[] |
package com.example.progettoium;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class ListaCorsi extends AppCompatActivity {
String[] listviewTitle = new String[7];
int[] listviewImage = new int[]{
R.drawable.so, R.drawable.analisi, R.drawable.tweb, R.drawable.sic,
R.drawable.ro, R.drawable.db, R.drawable.algoritmi};
String[] listviewShortDescription = new String[]{
"L’insegnamento fornisce una conoscenza di base dell'architettura interna e del funzionamento dei moderni sistemi operativi.",
"L'insegnamento ha lo scopo di presentare le nozioni di base su funzioni, grafici e loro trasformazioni.",
"Obiettivi: Imparare diversi linguaggi e tecnologie per lo sviluppo Web client-side, quali HTML5, CSS, JavaScript, JQuery.",
"Il corso si propone di fornire agli studenti gli strumenti crittografici e tecnici utilizzati per garantire la sicurezza di reti e calcolatori.",
"Il corso si propone di fornire agli studenti nozioni generali di calcolo matriciale, algebra e geometria.",
"L'insegnamento è un'introduzione alle basi di dati e ai sistemi di gestione delle medesime (SGBD).",
"L’insegnamento ha lo scopo di introdurre i concetti e le tecniche fondamentali per l’analisi e la progettazione di algoritmi.", };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listaimg);
caricamentoLista();
List<HashMap<String, String>> aList = new ArrayList<HashMap<String, String>>();
for (int i = 0; i < 7; i++) {
HashMap<String, String> hm = new HashMap<String, String>();
hm.put("listview_title", listviewTitle[i]);
hm.put("listview_discription", listviewShortDescription[i]);
hm.put("listview_image", Integer.toString(listviewImage[i]));
aList.add(hm);
}
String[] from = {"listview_image", "listview_title", "listview_discription"};
int[] to = {R.id.listview_image, R.id.listview_item_title, R.id.listview_item_short_description};
SimpleAdapter simpleAdapter = new SimpleAdapter(getBaseContext(), aList, R.layout.activity_lista_corsi, from, to);
ListView androidListView = (ListView) findViewById(R.id.list_view);
androidListView.setAdapter(simpleAdapter);
androidListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adattatore, final View componente, int pos, long id){
HashMap<String, String> item = (HashMap<String, String>) adattatore.getItemAtPosition(pos);
String value = item.get("listview_title");
Intent intent = new Intent(getApplicationContext(), ListaLiberi.class);
intent.putExtra("corso", value);
startActivity(intent);
}
});
}
public void caricamentoLista () {
GestioneDB db = new GestioneDB(this);
db.open();
Cursor c = db.getCorsi();
int i=0;
if (c.moveToFirst()) {
do {
if (!(c.getString(1).equals("ECONOMIA")))
listviewTitle[i++] = c.getString(1);
} while (c.moveToNext());
}
db.close();
}
@Override
public void onBackPressed() {
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
}
}
| 3,966 | 0.664814 | 0.662794 | 87 | 44.517242 | 38.88588 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.034483 | false | false |
7
|
ecf01af520b4b284afaba966df2f67a0c71b0e64
| 24,567,212,989,018 |
bb98e89f362fefa2fe8c7ce242f707450cb4d41c
|
/testapp/app/src/main/java/com/example/testapp/CustomeCalandar/LuaChonTrongLich.java
|
3e1e2d47afcf71bf7a65b8dd42fe02d433511370
|
[] |
no_license
|
cuongvom97/android-app
|
https://github.com/cuongvom97/android-app
|
473062c2db8b06ecf2759298ad72cc4b0e78d3d0
|
59eeae4d3d1952d875adfb99b0c0b39d8ea76c24
|
refs/heads/master
| 2022-12-30T05:08:14.618000 | 2020-10-16T17:15:08 | 2020-10-16T17:15:08 | 177,274,643 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.testapp.CustomeCalandar;
import java.util.ArrayList;
public class LuaChonTrongLich {
public String ngaybd="";
public static ArrayList<LuaChonTrongLich> luaChonTrongLichArrayList;
public LuaChonTrongLich(String ngaybd) {
this.ngaybd = ngaybd;
}
}
|
UTF-8
|
Java
| 293 |
java
|
LuaChonTrongLich.java
|
Java
|
[] | null |
[] |
package com.example.testapp.CustomeCalandar;
import java.util.ArrayList;
public class LuaChonTrongLich {
public String ngaybd="";
public static ArrayList<LuaChonTrongLich> luaChonTrongLichArrayList;
public LuaChonTrongLich(String ngaybd) {
this.ngaybd = ngaybd;
}
}
| 293 | 0.74744 | 0.74744 | 12 | 23.416666 | 22.016882 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
7
|
acd0b89d16b708f45b3aeb7e72af3c6f718249a9
| 6,614,249,673,043 |
7f73664733e5787833705f8aa0034bb6995514e1
|
/src/com/study/designpatterns/behavioral/template/exercise/CustomApp.java
|
f18c5f94761d2d42c9c16a2fbb53a540db1559a1
|
[] |
no_license
|
MayurOzaSoft/HelloWorld
|
https://github.com/MayurOzaSoft/HelloWorld
|
1003b8861d07a3726efc31393aaf23f688785156
|
1cf95a1138d9edbfd42913c5da45c8ff29894c64
|
refs/heads/master
| 2022-11-12T23:15:48.839000 | 2020-06-29T21:01:54 | 2020-06-29T21:01:54 | 275,924,382 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.study.designpatterns.behavioral.template.exercise;
public class CustomApp extends Window {
@Override
protected void after() {
System.out.println("After Close");
}
@Override
protected void before() {
System.out.println("Before Close");
}
}
|
UTF-8
|
Java
| 293 |
java
|
CustomApp.java
|
Java
|
[] | null |
[] |
package com.study.designpatterns.behavioral.template.exercise;
public class CustomApp extends Window {
@Override
protected void after() {
System.out.println("After Close");
}
@Override
protected void before() {
System.out.println("Before Close");
}
}
| 293 | 0.662116 | 0.662116 | 13 | 21.538462 | 19.535433 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.230769 | false | false |
7
|
4ab5a75c712eed0892c91d63cd613e4ff64395c3
| 32,727,650,843,105 |
ef2c59f8fb631a4f305ddfe7cc326b8956753efd
|
/src/main/java/com/iba/service/IbaService.java
|
e05569dcd3c13fa89179b09dfb84adbb1c5c9a80
|
[] |
no_license
|
hithaieshl/iba
|
https://github.com/hithaieshl/iba
|
36495f8847af6ab0d5ab7412a1e66c90949765b0
|
738f16ef0ef802b1c5c596fa7faf7e33ec6c2c12
|
refs/heads/dev
| 2020-02-26T16:58:27.361000 | 2016-04-18T10:31:45 | 2016-04-18T10:31:45 | 56,034,691 | 0 | 0 | null | true | 2016-04-12T05:46:30 | 2016-04-12T05:46:29 | 2016-04-12T05:35:11 | 2016-04-12T05:35:10 | 241 | 0 | 0 | 0 | null | null | null |
package com.iba.service;
import com.iba.domain.BankDetails;
import com.iba.domain.PersonalDetails;
import com.iba.forms.BankDetailsForm;
import com.iba.forms.PersonalDetailsForm;
public interface IbaService {
PersonalDetails savePersonalDetails(PersonalDetailsForm personalDetailsform);
BankDetails saveBankDetails(BankDetailsForm bankDetailsForm);
}
|
UTF-8
|
Java
| 363 |
java
|
IbaService.java
|
Java
|
[] | null |
[] |
package com.iba.service;
import com.iba.domain.BankDetails;
import com.iba.domain.PersonalDetails;
import com.iba.forms.BankDetailsForm;
import com.iba.forms.PersonalDetailsForm;
public interface IbaService {
PersonalDetails savePersonalDetails(PersonalDetailsForm personalDetailsform);
BankDetails saveBankDetails(BankDetailsForm bankDetailsForm);
}
| 363 | 0.834711 | 0.834711 | 14 | 24.928572 | 24.358818 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
7
|
2abc02b48b9be5bffe03362eeadb341693fa9b49
| 24,249,385,415,522 |
b2934237dc53a7cd97b48f147f782bb815e4b893
|
/math-client/src/main/java/com/beumuth/math/client/internal/environment/EnvironmentConfiguration.java
|
1469ffa969e3388bb02b0540c370e173559b3977
|
[] |
no_license
|
Beumuth/math
|
https://github.com/Beumuth/math
|
7ef0c50aef5e8cad823f13cce16d969afec0f5db
|
10f2a4dd85b43f7116ba3d2f1580d59946307851
|
refs/heads/master
| 2022-12-20T21:56:22.038000 | 2020-02-26T04:07:05 | 2020-02-26T04:07:05 | 170,879,506 | 0 | 0 | null | false | 2022-12-10T05:30:46 | 2019-02-15T14:42:25 | 2020-02-26T04:07:48 | 2022-12-10T05:30:45 | 325 | 0 | 0 | 5 |
Java
| false | false |
package com.beumuth.math.client.internal.environment;
import com.beumuth.math.client.internal.database.DatabaseConfiguration;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import java.util.Objects;
@AllArgsConstructor
@NoArgsConstructor
public class EnvironmentConfiguration {
public String name;
public String baseUrl;
public DatabaseConfiguration databaseConfiguration;
/**
* Copy constructor
*/
public EnvironmentConfiguration(EnvironmentConfiguration other) {
this.name = other.name;
this.baseUrl = other.baseUrl;
this.databaseConfiguration = new DatabaseConfiguration(other.databaseConfiguration);
}
public static EnvironmentConfiguration copy(EnvironmentConfiguration other) {
return new EnvironmentConfiguration(other);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EnvironmentConfiguration that = (EnvironmentConfiguration) o;
return name.equalsIgnoreCase(that.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
}
|
UTF-8
|
Java
| 1,196 |
java
|
EnvironmentConfiguration.java
|
Java
|
[] | null |
[] |
package com.beumuth.math.client.internal.environment;
import com.beumuth.math.client.internal.database.DatabaseConfiguration;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import java.util.Objects;
@AllArgsConstructor
@NoArgsConstructor
public class EnvironmentConfiguration {
public String name;
public String baseUrl;
public DatabaseConfiguration databaseConfiguration;
/**
* Copy constructor
*/
public EnvironmentConfiguration(EnvironmentConfiguration other) {
this.name = other.name;
this.baseUrl = other.baseUrl;
this.databaseConfiguration = new DatabaseConfiguration(other.databaseConfiguration);
}
public static EnvironmentConfiguration copy(EnvironmentConfiguration other) {
return new EnvironmentConfiguration(other);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EnvironmentConfiguration that = (EnvironmentConfiguration) o;
return name.equalsIgnoreCase(that.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
}
| 1,196 | 0.716555 | 0.716555 | 41 | 28.170732 | 25.26436 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.463415 | false | false |
7
|
ac0fd4141e3b0f8dc1e75eda07d510596869be7c
| 5,901,285,068,082 |
0345c1266b0a3c49e67a948b24a9d948096a64db
|
/java_surendra_sr/January/jan3_package_have_to_study/jan3_package_have to study/p3/src/sis/mumbai/Other2.java
|
ca8e9bca2146e20bae5b38d3a7fd85527ed131c6
|
[] |
no_license
|
yogitaupadhyay/gfg
|
https://github.com/yogitaupadhyay/gfg
|
c9d5883cc7f9e834355a22cc89e18e8e2eebfc0b
|
e8536c094cf5b09cf83395457d51003b94fda89c
|
refs/heads/master
| 2023-03-01T19:47:56.798000 | 2021-02-05T11:21:57 | 2021-02-05T11:21:57 | 198,049,852 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package sis.mumbai;
public class Other2{
public void show(){
sis.raipur.Parent p1 = new sis.raipur.Parent();
//CTE System.out.println("p1.a " +p1.a);
System.out.println("p1.b " +p1.b);
//CTE System.out.println("p1.c " +p1.c);
//CTE System.out.println("p1.d " +p1.d);
}
}//End of class
|
UTF-8
|
Java
| 311 |
java
|
Other2.java
|
Java
|
[] | null |
[] |
package sis.mumbai;
public class Other2{
public void show(){
sis.raipur.Parent p1 = new sis.raipur.Parent();
//CTE System.out.println("p1.a " +p1.a);
System.out.println("p1.b " +p1.b);
//CTE System.out.println("p1.c " +p1.c);
//CTE System.out.println("p1.d " +p1.d);
}
}//End of class
| 311 | 0.607717 | 0.575563 | 13 | 22.846153 | 17.999342 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
7
|
770f4956ae2113f95ebf62b77c10379c8f861d0c
| 5,239,860,169,603 |
dbe54b56da62ff585e35612d8b38fa351f3e94d1
|
/src/main/java/com/mingyue/controller/mzycpkcsq/MzycpkcsqController.java
|
829feb349d63a6fde515afe8a211272a13536e63
|
[] |
no_license
|
hwdpaley/mingyue
|
https://github.com/hwdpaley/mingyue
|
2ebb5ab4665c0e7089e739633ce713de21d22287
|
130dab1d3f7b3de24d4c32450d8127b12bf25c06
|
refs/heads/master
| 2021-01-01T19:37:39.865000 | 2017-07-28T09:12:49 | 2017-07-28T09:12:49 | 98,630,650 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mingyue.controller.mzycpkcsq;
import java.math.BigDecimal;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mingyue.entity.mzy_product.MzyProductEntity;
import com.mingyue.entity.mzycpkcsq.Mzysqxd;
import org.apache.log4j.Logger;
import org.hibernate.criterion.Property;
import org.jeecgframework.core.util.DateUtils;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.vo.datatable.SortDirection;
import org.jeecgframework.web.system.controller.core.IconImageUtil;
import org.jeecgframework.web.system.manager.ClientManager;
import org.jeecgframework.web.system.pojo.base.TSRoleUser;
import org.jeecgframework.web.system.pojo.base.TSUserOrg;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;
import com.mingyue.entity.mzycpkcsq.MzycpkcsqEntity;
import com.mingyue.service.mzycpkcsq.MzycpkcsqServiceI;
/**
* @author Tony
* @version V1.0
* @Title: Controller
* @Description: 产品库存申请表
* @date 2015-09-24 03:09:24
*/
@Scope("prototype")
@Controller
@RequestMapping("/mzycpkcsqController")
public class MzycpkcsqController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(MzycpkcsqController.class);
@Autowired
private MzycpkcsqServiceI mzycpkcsqService;
@Autowired
private MutiLangServiceI mutiLangService;
/**
* 产品库存申请表列表 页面跳转
*
* @return
*/
@RequestMapping(params = "mzycpkcsq")
public ModelAndView mzycpkcsq(HttpServletRequest request) {
request.setAttribute("departIsNotOne", getDepart());
return new ModelAndView("com/mingyue/mzycpkcsq/mzycpkcsqList");
}
private int getDepart() {
int a = 1;
String orgId = ClientManager.getInstance().getClient().getUser().getCurrentDepart().getId();
List<TSDepart> tsDepartList = systemService.findByProperty(TSDepart.class, "TSPDepart.id", orgId);
if (tsDepartList.size() > 1) {
a = tsDepartList.size();
} else {
List<TSRoleUser> tsRoleUserList = systemService.findByProperty(TSRoleUser.class, "TSUser.id", ClientManager.getInstance().getClient().getUser().getId());
for (TSRoleUser tsRoleUser : tsRoleUserList) {
if (tsRoleUser.getTSRole().getRoleName().endsWith("店长")) {
a = 2;
break;
}
}
}
return a;
}
@RequestMapping(params = "sqxd")
public ModelAndView sqxd(HttpServletRequest request) {
ModelAndView mv = new ModelAndView("com/mingyue/mzycpkcsq/mzysqcpxd");
String sqkcId = oConvertUtils.getString(request.getParameter("sqkcId"));
mv.addObject("sqkcId", sqkcId);
return mv;
}
@RequestMapping(params = "mzyProductSelect")
public ModelAndView mzyProductSelect(HttpServletRequest request) {
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
request.setAttribute("sqxdId", sqxdId);
return new ModelAndView("com/mingyue/mzy_product/mzyProductListSelect");
}
/**
* easyui AJAX请求数据
*
* @param request
* @param response
* @param dataGrid
* @param
*/
@RequestMapping(params = "datagrid")
public void datagrid(MzycpkcsqEntity mzycpkcsq, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(MzycpkcsqEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, mzycpkcsq, request.getParameterMap());
String orgId = ClientManager.getInstance().getClient().getUser().getCurrentDepart().getId();
List<TSDepart> tsDepartList = systemService.findByProperty(TSDepart.class, "TSPDepart.id", orgId);
List<String> orgIdList = new ArrayList<String>();
if (tsDepartList.size() > 1) {
String orgIds = request.getParameter("orgIds");
orgIdList = extractIdListByComma(orgIds);
if (!CollectionUtils.isEmpty(orgIdList)) {
} else {
StringBuilder sb = new StringBuilder();
for (TSDepart tsDepart : tsDepartList) {
sb.append(tsDepart.getId());
sb.append(",");
}
String ssb = sb.toString();
orgId += "," + ssb.substring(0, ssb.length() - 1);
orgIdList = extractIdListByComma(orgId);
// cq.in("TSPDepart.id", orgIdList.toArray());
}
cq.in("tsDepart.id", orgIdList.toArray());
} else {
// String orgIds = request.getParameter("orgIds");
orgIdList = extractIdListByComma(orgId);
cq.eq("tsDepart.id", orgId);
}
cq.notEq("isDelete", "Y");
cq.addOrder("createDate", SortDirection.desc);
cq.add();
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, mzycpkcsq, request.getParameterMap());
this.mzycpkcsqService.getDataGridReturn(cq, true);
for (Object o : dataGrid.getResults()) {
if (o instanceof MzycpkcsqEntity) {
MzycpkcsqEntity mzycpkcsqEntity = (MzycpkcsqEntity) o;
List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", mzycpkcsqEntity.getId());
if (mzysqxdList.size() == 0) {
systemService.delete(mzycpkcsqEntity);
dataGrid.getResults().remove(o);
}
}
}
TagUtil.datagrid(response, dataGrid);
}
@RequestMapping(params = "sqcpxddatagrid")
public void sqcpxddatagrid(Mzysqxd mzysqxd, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(Mzysqxd.class, dataGrid);
//查询条件组装器
String sqkcId = oConvertUtils.getString(request.getParameter("sqkcId"));
cq.eq("mzycpkcsqEntity.id", sqkcId);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, mzysqxd, request.getParameterMap());
this.mzycpkcsqService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
* 删除产品库存申请表
*
* @return
*/
@RequestMapping(params = "del")
@ResponseBody
public AjaxJson del(MzycpkcsqEntity mzycpkcsq, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
mzycpkcsq = systemService.getEntity(MzycpkcsqEntity.class, mzycpkcsq.getId());
List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", mzycpkcsq.getId());
systemService.deleteAllEntitie(mzysqxdList);
message = "产品库存申请表删除成功";
mzycpkcsq.setIsDelete("Y");
systemService.saveOrUpdate(mzycpkcsq);
// mzycpkcsqService.delete(mzycpkcsq);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
j.setMsg(message);
return j;
}
/**
* 添加产品库存申请表
*
* @param
* @return
*/
@RequestMapping(params = "save")
@ResponseBody
public AjaxJson save(MzycpkcsqEntity mzycpkcsq, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
String orgId = ClientManager.getInstance().getClient().getUser().getCurrentDepart().getId();
List<TSDepart> tsDepartList = systemService.findByProperty(TSDepart.class, "TSPDepart.id", orgId);
if (tsDepartList.size() > 1) {
mzycpkcsq.setTsUserSh(ClientManager.getInstance().getClient().getUser());
} else {
if (mzycpkcsq.getTsUser() == null) {
mzycpkcsq.setTsUser(ClientManager.getInstance().getClient().getUser());
}
}
if (StringUtil.isNotEmpty(mzycpkcsq.getId())) {
message = "产品库存申请表更新成功";
MzycpkcsqEntity t = mzycpkcsqService.get(MzycpkcsqEntity.class, mzycpkcsq.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(mzycpkcsq, t);
mzycpkcsqService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "产品库存申请表更新失败";
}
} else {
TSDepart tsDepart = ClientManager.getInstance().getClient().getUser().getCurrentDepart();
mzycpkcsq.setTsDepart(tsDepart);
mzycpkcsq.setTsUser(ClientManager.getInstance().getClient().getUser());
message = "产品库存申请表添加成功";
mzycpkcsqService.save(mzycpkcsq);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}
j.setMsg(message);
return j;
}
@RequestMapping(params = "sqxdsave")
@ResponseBody
public AjaxJson sqxdsave(Mzysqxd mzysqxd, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
String sqkcId = oConvertUtils.getString(request.getParameter("sqkcId"));
MzycpkcsqEntity mzycpkcsqEntity = systemService.get(MzycpkcsqEntity.class, sqkcId);
mzysqxd.setMzycpkcsqEntity(mzycpkcsqEntity);
mzysqxd.setNote(mzysqxd.getNote().trim());
if (StringUtil.isNotEmpty(mzysqxd.getId())) {
message = "产品库存详单表更新成功";
Mzysqxd t = mzycpkcsqService.get(Mzysqxd.class, mzysqxd.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(mzysqxd, t);
mzycpkcsqService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "产品库存申请表更新失败";
}
} else {
message = "产品库存详单表添加成功";
mzycpkcsqService.save(mzysqxd);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}
j.setMsg(message);
return j;
}
private String getSqIdnum() {
TSDepart tsDepart = systemService.getEntity(TSDepart.class, ClientManager.getInstance().getClient().getUser().getCurrentDepart().getId());
String r = tsDepart.getDepartCode() + mutiLangService.getsqbhIdNum();
return r;
}
/**
* 产品库存申请表列表页面跳转
*
* @return
*/
@RequestMapping(params = "addorupdate")
public ModelAndView addorupdate(MzycpkcsqEntity mzycpkcsq, HttpServletRequest req) {
if (StringUtil.isNotEmpty(mzycpkcsq.getId())) {
mzycpkcsq = mzycpkcsqService.getEntity(MzycpkcsqEntity.class, mzycpkcsq.getId());
// mzycpkcsq.setSqbh(getSqIdnum());
} else {
mzycpkcsq.setSqbh(getSqIdnum());
mzycpkcsq.setTsUser(ClientManager.getInstance().getClient().getUser());
mzycpkcsq.setTsDepart(ClientManager.getInstance().getClient().getUser().getCurrentDepart());
mzycpkcsq.setSqdate(new Date());
mzycpkcsq.setStatus("0");
systemService.save(mzycpkcsq);
}
req.setAttribute("mzycpkcsqPage", mzycpkcsq);
return new ModelAndView("com/mingyue/mzycpkcsq/cpkcsqBySqbh");
}
@RequestMapping(params = "sqcpxdAddorupdate")
public ModelAndView sqcpxdAddorupdate(Mzysqxd mzysqxd, HttpServletRequest req) {
String sqkcId = oConvertUtils.getString(req.getParameter("sqkcId"));
req.setAttribute("sqkcId", sqkcId);
if (StringUtil.isNotEmpty(mzysqxd.getId())) {
mzysqxd = mzycpkcsqService.getEntity(Mzysqxd.class, mzysqxd.getId());
req.setAttribute("mzysqxdPage", mzysqxd);
}
return new ModelAndView("com/mingyue/mzycpkcsq/mzysqxd_addedit");
}
@RequestMapping(params = "mzyProductSelected")
@ResponseBody
public AjaxJson mzyProductSelected(HttpServletRequest request) {
AjaxJson j = new AjaxJson();
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
MzycpkcsqEntity mzycpkcsqEntity = systemService.getEntity(MzycpkcsqEntity.class, sqxdId);
String ids = request.getParameter("ids");
List<String> idsList = new ArrayList<String>();
idsList = extractIdListByComma(ids);
if (!CollectionUtils.isEmpty(idsList)) {
for (String pid : idsList) {
Mzysqxd mzysqxd = new Mzysqxd();
MzyProductEntity mzyProductEntity = systemService.getEntity(MzyProductEntity.class, pid);
mzysqxd.setMzyProductEntity(mzyProductEntity);
mzysqxd.setNums("1");
mzysqxd.setMzycpkcsqEntity(mzycpkcsqEntity);
systemService.save(mzysqxd);
}
}
message = "产品列表添加成功";
j.setMsg(message);
return j;
}
@RequestMapping(params = "getSqxdList")
@ResponseBody
public List<Object> getSqxdList(HttpServletRequest request) {
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
// Mzy_xsprintEntity mzy_xsprint = systemService.getEntity(Mzy_xsprintEntity.class, xsprintId);
List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", sqxdId);
List<Object> map = new ArrayList<Object>();
for (Mzysqxd mzysqxd : mzysqxdList) {
Map<String, String> ap = new HashMap<String, String>();
ap.put("id", mzysqxd.getMzyProductEntity().getId());
ap.put("productName", mzysqxd.getMzyProductEntity().getName());
if (mzysqxd.getMzyProductEntity().getPrice() != null) {
ap.put("price", mzysqxd.getMzyProductEntity().getPrice().toString());
} else {
ap.put("price", "0.0");
}
ap.put("nums", mzysqxd.getNums());
map.add(ap);
}
return map;
}
@RequestMapping(params = "check_sqxd")
@ResponseBody
public AjaxJson check_sqxd(MzycpkcsqEntity mzycpkcsqEntity, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
j.setMsg("删除成功");
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
mzycpkcsqEntity = systemService.getEntity(MzycpkcsqEntity.class, sqxdId);
List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", sqxdId);
for (Mzysqxd mzysqxd : mzysqxdList) {
mzysqxd.setIsDelete("Y");
systemService.saveOrUpdate(mzysqxd);
}
// systemService.deleteAllEntitie(mzysqxdList);
// systemService.delete(mzycpkcsqEntity);
return j;
}
@RequestMapping(params = "saveProListBySqxd")
@ResponseBody
public AjaxJson saveProListBySqxd(MzycpkcsqEntity mzycpkcsqEntity, HttpServletRequest request) {
// String customId = oConvertUtils.getString(request.getParameter("customId"));
// MzyCustomEntity mzyCustomEntity=systemService.getEntity(MzyCustomEntity.class,customId);
// Mzy_xsprintEntity t = systemService.get(Mzy_xsprintEntity.class, mzy_xsprint.getId());
// try {
// MyBeanUtils.copyBeanNotNull2Bean(mzy_xsprint, t);
//// systemService.saveOrUpdate(t);
//// systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
// } catch (Exception e) {
// e.printStackTrace();
// message = "销售开单更新失败";
// }
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
mzycpkcsqEntity = systemService.getEntity(MzycpkcsqEntity.class, sqxdId);
// List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", mzycpkcsqEntity.getId());
// if (mzysqxdList.size() == 0) {
// systemService.delete(mzycpkcsqEntity);
// mutiLangService.setsqbhIdNum();
// }
AjaxJson j = new AjaxJson();
j.setMsg("库存申请保存成功");
return j;
}
@RequestMapping(params = "saveSelect")
@ResponseBody
public AjaxJson saveSelect(MzycpkcsqEntity mzycpkcsqEntity, HttpServletRequest request) {
String ids = oConvertUtils.getString(request.getParameter("ids"));
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
String sqdate = oConvertUtils.getString(request.getParameter("sqdate"));
String note = oConvertUtils.getString(request.getParameter("note"));
String pfdate = oConvertUtils.getString(request.getParameter("pfdate"));
String daodadate = oConvertUtils.getString(request.getParameter("daodadate"));
String fhdate = oConvertUtils.getString(request.getParameter("fhdate"));
mzycpkcsqEntity = systemService.getEntity(MzycpkcsqEntity.class, sqxdId);
List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", mzycpkcsqEntity.getId());
systemService.deleteAllEntitie(mzysqxdList);
List<String> idsList = new ArrayList<String>();
idsList = extractIdListByComma(ids);
AjaxJson j = new AjaxJson();
if (!CollectionUtils.isEmpty(idsList)) {
for (int i = 0; i < idsList.size(); i++) {
String pid = idsList.get(i);
if (pid.length() > 30) {
MzyProductEntity mzyProductEntity = systemService.getEntity(MzyProductEntity.class, pid);
if (mzyProductEntity != null) {
Mzysqxd mzysqxd = new Mzysqxd();
mzysqxd.setMzyProductEntity(mzyProductEntity);
String nums = idsList.get(i + 2);
mzysqxd.setNums(nums);
// String price = idsList.get(i + 1);
// double pr = Double.valueOf(price);
// mzy_xiaoshouEntity.setPrice(BigDecimal.valueOf(pr));
mzysqxd.setMzycpkcsqEntity(mzycpkcsqEntity);
systemService.save(mzysqxd);
}
}
}
mzycpkcsqEntity.setNote(note);
mzycpkcsqEntity.setSqdate(DateUtils.str2Date(sqdate, DateUtils.datetimeFormat));
mzycpkcsqEntity.setPfdate(DateUtils.str2Date(pfdate, DateUtils.datetimeFormat));
mzycpkcsqEntity.setDaodadate(DateUtils.str2Date(daodadate, DateUtils.datetimeFormat));
mzycpkcsqEntity.setFhdate(DateUtils.str2Date(fhdate, DateUtils.datetimeFormat));
// MzyCustomEntity mzyCustomEntity = mzy_xsprint.getMzyCustomEntity();
// TSUserOrg tsUserOrg = systemService.findUniqueByProperty(TSUserOrg.class, "tsUser.id", mzyCustomEntity.getId());
// String dname = tsUserOrg.getTsDepart().getDepartname();
// if (!dname.endsWith(ClientManager.getInstance().getClient().getUser().getCurrentDepart().getDepartname())) {
// tsUserOrg.setTsDepart(ClientManager.getInstance().getClient().getUser().getCurrentDepart());
// systemService.updateEntitie(tsUserOrg);
// // mzy_xsprint.setTsDepart(ClientManager.getInstance().getClient().getUser().getCurrentDepart());
// }
// mzy_xsprint.setRealTotal(BigDecimal.valueOf(Double.valueOf(realTotal)));
// mzy_xsprint.setIsOK("Y");
systemService.saveOrUpdate(mzycpkcsqEntity);
j.setMsg("保存成功");
} else {
mzycpkcsqEntity.setIsDelete("Y");
systemService.saveOrUpdate(mzycpkcsqEntity);
// systemService.delete(mzycpkcsqEntity);
j.setSuccess(false);
j.setMsg("删除成功");
}
return j;
}
// @RequestMapping(params = "selectProductDatagrid")
// public void selectDatagrid(MzyProductEntity mzyProductEntity,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
// CriteriaQuery cq = new CriteriaQuery(MzyProductEntity.class, dataGrid);
// //查询条件组装器
// String orgId = ClientManager.getInstance().getClient().getUser().getCurrentDepart().getId();
// List<TSDepart> tsDepartList = systemService.findByProperty(TSDepart.class, "TSPDepart.id", orgId);
// List<String> orgIdList=new ArrayList<String>();
// if (tsDepartList.size() > 1) {
// String orgIds = request.getParameter("orgIds");
// orgIdList = extractIdListByComma(orgIds);
// if (!CollectionUtils.isEmpty(orgIdList)) {
//
// }else{
// StringBuilder sb = new StringBuilder();
// for (TSDepart tsDepart : tsDepartList) {
// sb.append(tsDepart.getId());
// sb.append(",");
// }
// String ssb=sb.toString();
// orgId+=","+ssb.substring(0,ssb.length()-1);
// orgIdList = extractIdListByComma(orgId);
//// cq.in("TSPDepart.id", orgIdList.toArray());
// }
// cq.in("TSPDepart.id", orgIdList.toArray());
// }else{
//// String orgIds = request.getParameter("orgIds");
// orgIdList = extractIdListByComma(orgId);
// cq.eq("TSPDepart.id", orgId);
// }
// String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
// MzycpkcsqEntity mzycpkcsqEntity=systemService.getEntity(MzycpkcsqEntity.class, sqxdId);
// List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", mzycpkcsqEntity.getId());
// List<String> productIds = new ArrayList<String>();
// for (Mzysqxd mzysqxd : mzysqxdList) {
// productIds.add(mzysqxd.getMzyProductEntity().getId());
// }
//// productIds.add(mzy_xsprint.getId());
// // 获取 当前组织机构的用户信息
// if (!CollectionUtils.isEmpty(productIds)) {
// CriteriaQuery subCq = new CriteriaQuery(MzyKuCunEntity.class);
// subCq.setProjection(Property.forName("id"));
// subCq.in("mzyProductEntity.id", productIds.toArray());
// subCq.add();
//
// cq.add(Property.forName("id").notIn(subCq.getDetachedCriteria()));
// }
// // 获取 当前组织机构的用户信息
//// CriteriaQuery subCq = new CriteriaQuery(Mzy_xiaoshouEntity.class);
//// subCq.setProjection(Property.forName("mzyProductEntity.id"));
//// subCq.eq("mzy_xsprintEntity.id", mzy_xsprint.getId());
//// subCq.add();
//
// cq.add();
//
// org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, mzyKuCun, request.getParameterMap());
// this.systemService.getDataGridReturn(cq, true);
// for (Object o : dataGrid.getResults()) {
// if (o instanceof MzyKuCunEntity) {
// MzyKuCunEntity mzyKuCunEntity = (MzyKuCunEntity) o;
// Date dd=new Date();
// List<MzycuxiaoEntity> mzycuxiaoEntityList=systemService.findHql("from MzycuxiaoEntity cx " +
// "where cx.mzyProductEntity.id= ? and sdate< ? and edate > ? ",mzyKuCunEntity.getMzyProductEntity().getId(),dd,dd);
// if(mzycuxiaoEntityList.size()>0){
// mzyKuCunEntity.setIsCx("促销产品");
// }else{
// mzyKuCunEntity.setIsCx("");
// }
// mzyKuCunEntity.setName(mzyKuCunEntity.getMzyProductEntity().getName());
// systemService.saveOrUpdate(mzyKuCunEntity);
// }
// }
// IconImageUtil.convertKcDataGrid(dataGrid, request, systemService);
// this.mzyKuCunService.getDataGridReturn(cq, true);
// TagUtil.datagrid(response, dataGrid);
// }
}
|
UTF-8
|
Java
| 25,224 |
java
|
MzycpkcsqController.java
|
Java
|
[
{
"context": "rvice.mzycpkcsq.MzycpkcsqServiceI;\n\n/**\n * @author Tony\n * @version V1.0\n * @Title: Controller\n * @Descri",
"end": 1912,
"score": 0.9960626363754272,
"start": 1908,
"tag": "NAME",
"value": "Tony"
}
] | null |
[] |
package com.mingyue.controller.mzycpkcsq;
import java.math.BigDecimal;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mingyue.entity.mzy_product.MzyProductEntity;
import com.mingyue.entity.mzycpkcsq.Mzysqxd;
import org.apache.log4j.Logger;
import org.hibernate.criterion.Property;
import org.jeecgframework.core.util.DateUtils;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.vo.datatable.SortDirection;
import org.jeecgframework.web.system.controller.core.IconImageUtil;
import org.jeecgframework.web.system.manager.ClientManager;
import org.jeecgframework.web.system.pojo.base.TSRoleUser;
import org.jeecgframework.web.system.pojo.base.TSUserOrg;
import org.jeecgframework.web.system.service.MutiLangServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils;
import com.mingyue.entity.mzycpkcsq.MzycpkcsqEntity;
import com.mingyue.service.mzycpkcsq.MzycpkcsqServiceI;
/**
* @author Tony
* @version V1.0
* @Title: Controller
* @Description: 产品库存申请表
* @date 2015-09-24 03:09:24
*/
@Scope("prototype")
@Controller
@RequestMapping("/mzycpkcsqController")
public class MzycpkcsqController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(MzycpkcsqController.class);
@Autowired
private MzycpkcsqServiceI mzycpkcsqService;
@Autowired
private MutiLangServiceI mutiLangService;
/**
* 产品库存申请表列表 页面跳转
*
* @return
*/
@RequestMapping(params = "mzycpkcsq")
public ModelAndView mzycpkcsq(HttpServletRequest request) {
request.setAttribute("departIsNotOne", getDepart());
return new ModelAndView("com/mingyue/mzycpkcsq/mzycpkcsqList");
}
private int getDepart() {
int a = 1;
String orgId = ClientManager.getInstance().getClient().getUser().getCurrentDepart().getId();
List<TSDepart> tsDepartList = systemService.findByProperty(TSDepart.class, "TSPDepart.id", orgId);
if (tsDepartList.size() > 1) {
a = tsDepartList.size();
} else {
List<TSRoleUser> tsRoleUserList = systemService.findByProperty(TSRoleUser.class, "TSUser.id", ClientManager.getInstance().getClient().getUser().getId());
for (TSRoleUser tsRoleUser : tsRoleUserList) {
if (tsRoleUser.getTSRole().getRoleName().endsWith("店长")) {
a = 2;
break;
}
}
}
return a;
}
@RequestMapping(params = "sqxd")
public ModelAndView sqxd(HttpServletRequest request) {
ModelAndView mv = new ModelAndView("com/mingyue/mzycpkcsq/mzysqcpxd");
String sqkcId = oConvertUtils.getString(request.getParameter("sqkcId"));
mv.addObject("sqkcId", sqkcId);
return mv;
}
@RequestMapping(params = "mzyProductSelect")
public ModelAndView mzyProductSelect(HttpServletRequest request) {
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
request.setAttribute("sqxdId", sqxdId);
return new ModelAndView("com/mingyue/mzy_product/mzyProductListSelect");
}
/**
* easyui AJAX请求数据
*
* @param request
* @param response
* @param dataGrid
* @param
*/
@RequestMapping(params = "datagrid")
public void datagrid(MzycpkcsqEntity mzycpkcsq, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(MzycpkcsqEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, mzycpkcsq, request.getParameterMap());
String orgId = ClientManager.getInstance().getClient().getUser().getCurrentDepart().getId();
List<TSDepart> tsDepartList = systemService.findByProperty(TSDepart.class, "TSPDepart.id", orgId);
List<String> orgIdList = new ArrayList<String>();
if (tsDepartList.size() > 1) {
String orgIds = request.getParameter("orgIds");
orgIdList = extractIdListByComma(orgIds);
if (!CollectionUtils.isEmpty(orgIdList)) {
} else {
StringBuilder sb = new StringBuilder();
for (TSDepart tsDepart : tsDepartList) {
sb.append(tsDepart.getId());
sb.append(",");
}
String ssb = sb.toString();
orgId += "," + ssb.substring(0, ssb.length() - 1);
orgIdList = extractIdListByComma(orgId);
// cq.in("TSPDepart.id", orgIdList.toArray());
}
cq.in("tsDepart.id", orgIdList.toArray());
} else {
// String orgIds = request.getParameter("orgIds");
orgIdList = extractIdListByComma(orgId);
cq.eq("tsDepart.id", orgId);
}
cq.notEq("isDelete", "Y");
cq.addOrder("createDate", SortDirection.desc);
cq.add();
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, mzycpkcsq, request.getParameterMap());
this.mzycpkcsqService.getDataGridReturn(cq, true);
for (Object o : dataGrid.getResults()) {
if (o instanceof MzycpkcsqEntity) {
MzycpkcsqEntity mzycpkcsqEntity = (MzycpkcsqEntity) o;
List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", mzycpkcsqEntity.getId());
if (mzysqxdList.size() == 0) {
systemService.delete(mzycpkcsqEntity);
dataGrid.getResults().remove(o);
}
}
}
TagUtil.datagrid(response, dataGrid);
}
@RequestMapping(params = "sqcpxddatagrid")
public void sqcpxddatagrid(Mzysqxd mzysqxd, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(Mzysqxd.class, dataGrid);
//查询条件组装器
String sqkcId = oConvertUtils.getString(request.getParameter("sqkcId"));
cq.eq("mzycpkcsqEntity.id", sqkcId);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, mzysqxd, request.getParameterMap());
this.mzycpkcsqService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
* 删除产品库存申请表
*
* @return
*/
@RequestMapping(params = "del")
@ResponseBody
public AjaxJson del(MzycpkcsqEntity mzycpkcsq, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
mzycpkcsq = systemService.getEntity(MzycpkcsqEntity.class, mzycpkcsq.getId());
List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", mzycpkcsq.getId());
systemService.deleteAllEntitie(mzysqxdList);
message = "产品库存申请表删除成功";
mzycpkcsq.setIsDelete("Y");
systemService.saveOrUpdate(mzycpkcsq);
// mzycpkcsqService.delete(mzycpkcsq);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
j.setMsg(message);
return j;
}
/**
* 添加产品库存申请表
*
* @param
* @return
*/
@RequestMapping(params = "save")
@ResponseBody
public AjaxJson save(MzycpkcsqEntity mzycpkcsq, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
String orgId = ClientManager.getInstance().getClient().getUser().getCurrentDepart().getId();
List<TSDepart> tsDepartList = systemService.findByProperty(TSDepart.class, "TSPDepart.id", orgId);
if (tsDepartList.size() > 1) {
mzycpkcsq.setTsUserSh(ClientManager.getInstance().getClient().getUser());
} else {
if (mzycpkcsq.getTsUser() == null) {
mzycpkcsq.setTsUser(ClientManager.getInstance().getClient().getUser());
}
}
if (StringUtil.isNotEmpty(mzycpkcsq.getId())) {
message = "产品库存申请表更新成功";
MzycpkcsqEntity t = mzycpkcsqService.get(MzycpkcsqEntity.class, mzycpkcsq.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(mzycpkcsq, t);
mzycpkcsqService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "产品库存申请表更新失败";
}
} else {
TSDepart tsDepart = ClientManager.getInstance().getClient().getUser().getCurrentDepart();
mzycpkcsq.setTsDepart(tsDepart);
mzycpkcsq.setTsUser(ClientManager.getInstance().getClient().getUser());
message = "产品库存申请表添加成功";
mzycpkcsqService.save(mzycpkcsq);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}
j.setMsg(message);
return j;
}
@RequestMapping(params = "sqxdsave")
@ResponseBody
public AjaxJson sqxdsave(Mzysqxd mzysqxd, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
String sqkcId = oConvertUtils.getString(request.getParameter("sqkcId"));
MzycpkcsqEntity mzycpkcsqEntity = systemService.get(MzycpkcsqEntity.class, sqkcId);
mzysqxd.setMzycpkcsqEntity(mzycpkcsqEntity);
mzysqxd.setNote(mzysqxd.getNote().trim());
if (StringUtil.isNotEmpty(mzysqxd.getId())) {
message = "产品库存详单表更新成功";
Mzysqxd t = mzycpkcsqService.get(Mzysqxd.class, mzysqxd.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(mzysqxd, t);
mzycpkcsqService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "产品库存申请表更新失败";
}
} else {
message = "产品库存详单表添加成功";
mzycpkcsqService.save(mzysqxd);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}
j.setMsg(message);
return j;
}
private String getSqIdnum() {
TSDepart tsDepart = systemService.getEntity(TSDepart.class, ClientManager.getInstance().getClient().getUser().getCurrentDepart().getId());
String r = tsDepart.getDepartCode() + mutiLangService.getsqbhIdNum();
return r;
}
/**
* 产品库存申请表列表页面跳转
*
* @return
*/
@RequestMapping(params = "addorupdate")
public ModelAndView addorupdate(MzycpkcsqEntity mzycpkcsq, HttpServletRequest req) {
if (StringUtil.isNotEmpty(mzycpkcsq.getId())) {
mzycpkcsq = mzycpkcsqService.getEntity(MzycpkcsqEntity.class, mzycpkcsq.getId());
// mzycpkcsq.setSqbh(getSqIdnum());
} else {
mzycpkcsq.setSqbh(getSqIdnum());
mzycpkcsq.setTsUser(ClientManager.getInstance().getClient().getUser());
mzycpkcsq.setTsDepart(ClientManager.getInstance().getClient().getUser().getCurrentDepart());
mzycpkcsq.setSqdate(new Date());
mzycpkcsq.setStatus("0");
systemService.save(mzycpkcsq);
}
req.setAttribute("mzycpkcsqPage", mzycpkcsq);
return new ModelAndView("com/mingyue/mzycpkcsq/cpkcsqBySqbh");
}
@RequestMapping(params = "sqcpxdAddorupdate")
public ModelAndView sqcpxdAddorupdate(Mzysqxd mzysqxd, HttpServletRequest req) {
String sqkcId = oConvertUtils.getString(req.getParameter("sqkcId"));
req.setAttribute("sqkcId", sqkcId);
if (StringUtil.isNotEmpty(mzysqxd.getId())) {
mzysqxd = mzycpkcsqService.getEntity(Mzysqxd.class, mzysqxd.getId());
req.setAttribute("mzysqxdPage", mzysqxd);
}
return new ModelAndView("com/mingyue/mzycpkcsq/mzysqxd_addedit");
}
@RequestMapping(params = "mzyProductSelected")
@ResponseBody
public AjaxJson mzyProductSelected(HttpServletRequest request) {
AjaxJson j = new AjaxJson();
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
MzycpkcsqEntity mzycpkcsqEntity = systemService.getEntity(MzycpkcsqEntity.class, sqxdId);
String ids = request.getParameter("ids");
List<String> idsList = new ArrayList<String>();
idsList = extractIdListByComma(ids);
if (!CollectionUtils.isEmpty(idsList)) {
for (String pid : idsList) {
Mzysqxd mzysqxd = new Mzysqxd();
MzyProductEntity mzyProductEntity = systemService.getEntity(MzyProductEntity.class, pid);
mzysqxd.setMzyProductEntity(mzyProductEntity);
mzysqxd.setNums("1");
mzysqxd.setMzycpkcsqEntity(mzycpkcsqEntity);
systemService.save(mzysqxd);
}
}
message = "产品列表添加成功";
j.setMsg(message);
return j;
}
@RequestMapping(params = "getSqxdList")
@ResponseBody
public List<Object> getSqxdList(HttpServletRequest request) {
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
// Mzy_xsprintEntity mzy_xsprint = systemService.getEntity(Mzy_xsprintEntity.class, xsprintId);
List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", sqxdId);
List<Object> map = new ArrayList<Object>();
for (Mzysqxd mzysqxd : mzysqxdList) {
Map<String, String> ap = new HashMap<String, String>();
ap.put("id", mzysqxd.getMzyProductEntity().getId());
ap.put("productName", mzysqxd.getMzyProductEntity().getName());
if (mzysqxd.getMzyProductEntity().getPrice() != null) {
ap.put("price", mzysqxd.getMzyProductEntity().getPrice().toString());
} else {
ap.put("price", "0.0");
}
ap.put("nums", mzysqxd.getNums());
map.add(ap);
}
return map;
}
@RequestMapping(params = "check_sqxd")
@ResponseBody
public AjaxJson check_sqxd(MzycpkcsqEntity mzycpkcsqEntity, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
j.setMsg("删除成功");
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
mzycpkcsqEntity = systemService.getEntity(MzycpkcsqEntity.class, sqxdId);
List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", sqxdId);
for (Mzysqxd mzysqxd : mzysqxdList) {
mzysqxd.setIsDelete("Y");
systemService.saveOrUpdate(mzysqxd);
}
// systemService.deleteAllEntitie(mzysqxdList);
// systemService.delete(mzycpkcsqEntity);
return j;
}
@RequestMapping(params = "saveProListBySqxd")
@ResponseBody
public AjaxJson saveProListBySqxd(MzycpkcsqEntity mzycpkcsqEntity, HttpServletRequest request) {
// String customId = oConvertUtils.getString(request.getParameter("customId"));
// MzyCustomEntity mzyCustomEntity=systemService.getEntity(MzyCustomEntity.class,customId);
// Mzy_xsprintEntity t = systemService.get(Mzy_xsprintEntity.class, mzy_xsprint.getId());
// try {
// MyBeanUtils.copyBeanNotNull2Bean(mzy_xsprint, t);
//// systemService.saveOrUpdate(t);
//// systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
// } catch (Exception e) {
// e.printStackTrace();
// message = "销售开单更新失败";
// }
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
mzycpkcsqEntity = systemService.getEntity(MzycpkcsqEntity.class, sqxdId);
// List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", mzycpkcsqEntity.getId());
// if (mzysqxdList.size() == 0) {
// systemService.delete(mzycpkcsqEntity);
// mutiLangService.setsqbhIdNum();
// }
AjaxJson j = new AjaxJson();
j.setMsg("库存申请保存成功");
return j;
}
@RequestMapping(params = "saveSelect")
@ResponseBody
public AjaxJson saveSelect(MzycpkcsqEntity mzycpkcsqEntity, HttpServletRequest request) {
String ids = oConvertUtils.getString(request.getParameter("ids"));
String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
String sqdate = oConvertUtils.getString(request.getParameter("sqdate"));
String note = oConvertUtils.getString(request.getParameter("note"));
String pfdate = oConvertUtils.getString(request.getParameter("pfdate"));
String daodadate = oConvertUtils.getString(request.getParameter("daodadate"));
String fhdate = oConvertUtils.getString(request.getParameter("fhdate"));
mzycpkcsqEntity = systemService.getEntity(MzycpkcsqEntity.class, sqxdId);
List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", mzycpkcsqEntity.getId());
systemService.deleteAllEntitie(mzysqxdList);
List<String> idsList = new ArrayList<String>();
idsList = extractIdListByComma(ids);
AjaxJson j = new AjaxJson();
if (!CollectionUtils.isEmpty(idsList)) {
for (int i = 0; i < idsList.size(); i++) {
String pid = idsList.get(i);
if (pid.length() > 30) {
MzyProductEntity mzyProductEntity = systemService.getEntity(MzyProductEntity.class, pid);
if (mzyProductEntity != null) {
Mzysqxd mzysqxd = new Mzysqxd();
mzysqxd.setMzyProductEntity(mzyProductEntity);
String nums = idsList.get(i + 2);
mzysqxd.setNums(nums);
// String price = idsList.get(i + 1);
// double pr = Double.valueOf(price);
// mzy_xiaoshouEntity.setPrice(BigDecimal.valueOf(pr));
mzysqxd.setMzycpkcsqEntity(mzycpkcsqEntity);
systemService.save(mzysqxd);
}
}
}
mzycpkcsqEntity.setNote(note);
mzycpkcsqEntity.setSqdate(DateUtils.str2Date(sqdate, DateUtils.datetimeFormat));
mzycpkcsqEntity.setPfdate(DateUtils.str2Date(pfdate, DateUtils.datetimeFormat));
mzycpkcsqEntity.setDaodadate(DateUtils.str2Date(daodadate, DateUtils.datetimeFormat));
mzycpkcsqEntity.setFhdate(DateUtils.str2Date(fhdate, DateUtils.datetimeFormat));
// MzyCustomEntity mzyCustomEntity = mzy_xsprint.getMzyCustomEntity();
// TSUserOrg tsUserOrg = systemService.findUniqueByProperty(TSUserOrg.class, "tsUser.id", mzyCustomEntity.getId());
// String dname = tsUserOrg.getTsDepart().getDepartname();
// if (!dname.endsWith(ClientManager.getInstance().getClient().getUser().getCurrentDepart().getDepartname())) {
// tsUserOrg.setTsDepart(ClientManager.getInstance().getClient().getUser().getCurrentDepart());
// systemService.updateEntitie(tsUserOrg);
// // mzy_xsprint.setTsDepart(ClientManager.getInstance().getClient().getUser().getCurrentDepart());
// }
// mzy_xsprint.setRealTotal(BigDecimal.valueOf(Double.valueOf(realTotal)));
// mzy_xsprint.setIsOK("Y");
systemService.saveOrUpdate(mzycpkcsqEntity);
j.setMsg("保存成功");
} else {
mzycpkcsqEntity.setIsDelete("Y");
systemService.saveOrUpdate(mzycpkcsqEntity);
// systemService.delete(mzycpkcsqEntity);
j.setSuccess(false);
j.setMsg("删除成功");
}
return j;
}
// @RequestMapping(params = "selectProductDatagrid")
// public void selectDatagrid(MzyProductEntity mzyProductEntity,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
// CriteriaQuery cq = new CriteriaQuery(MzyProductEntity.class, dataGrid);
// //查询条件组装器
// String orgId = ClientManager.getInstance().getClient().getUser().getCurrentDepart().getId();
// List<TSDepart> tsDepartList = systemService.findByProperty(TSDepart.class, "TSPDepart.id", orgId);
// List<String> orgIdList=new ArrayList<String>();
// if (tsDepartList.size() > 1) {
// String orgIds = request.getParameter("orgIds");
// orgIdList = extractIdListByComma(orgIds);
// if (!CollectionUtils.isEmpty(orgIdList)) {
//
// }else{
// StringBuilder sb = new StringBuilder();
// for (TSDepart tsDepart : tsDepartList) {
// sb.append(tsDepart.getId());
// sb.append(",");
// }
// String ssb=sb.toString();
// orgId+=","+ssb.substring(0,ssb.length()-1);
// orgIdList = extractIdListByComma(orgId);
//// cq.in("TSPDepart.id", orgIdList.toArray());
// }
// cq.in("TSPDepart.id", orgIdList.toArray());
// }else{
//// String orgIds = request.getParameter("orgIds");
// orgIdList = extractIdListByComma(orgId);
// cq.eq("TSPDepart.id", orgId);
// }
// String sqxdId = oConvertUtils.getString(request.getParameter("sqxdId"));
// MzycpkcsqEntity mzycpkcsqEntity=systemService.getEntity(MzycpkcsqEntity.class, sqxdId);
// List<Mzysqxd> mzysqxdList = systemService.findByProperty(Mzysqxd.class, "mzycpkcsqEntity.id", mzycpkcsqEntity.getId());
// List<String> productIds = new ArrayList<String>();
// for (Mzysqxd mzysqxd : mzysqxdList) {
// productIds.add(mzysqxd.getMzyProductEntity().getId());
// }
//// productIds.add(mzy_xsprint.getId());
// // 获取 当前组织机构的用户信息
// if (!CollectionUtils.isEmpty(productIds)) {
// CriteriaQuery subCq = new CriteriaQuery(MzyKuCunEntity.class);
// subCq.setProjection(Property.forName("id"));
// subCq.in("mzyProductEntity.id", productIds.toArray());
// subCq.add();
//
// cq.add(Property.forName("id").notIn(subCq.getDetachedCriteria()));
// }
// // 获取 当前组织机构的用户信息
//// CriteriaQuery subCq = new CriteriaQuery(Mzy_xiaoshouEntity.class);
//// subCq.setProjection(Property.forName("mzyProductEntity.id"));
//// subCq.eq("mzy_xsprintEntity.id", mzy_xsprint.getId());
//// subCq.add();
//
// cq.add();
//
// org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, mzyKuCun, request.getParameterMap());
// this.systemService.getDataGridReturn(cq, true);
// for (Object o : dataGrid.getResults()) {
// if (o instanceof MzyKuCunEntity) {
// MzyKuCunEntity mzyKuCunEntity = (MzyKuCunEntity) o;
// Date dd=new Date();
// List<MzycuxiaoEntity> mzycuxiaoEntityList=systemService.findHql("from MzycuxiaoEntity cx " +
// "where cx.mzyProductEntity.id= ? and sdate< ? and edate > ? ",mzyKuCunEntity.getMzyProductEntity().getId(),dd,dd);
// if(mzycuxiaoEntityList.size()>0){
// mzyKuCunEntity.setIsCx("促销产品");
// }else{
// mzyKuCunEntity.setIsCx("");
// }
// mzyKuCunEntity.setName(mzyKuCunEntity.getMzyProductEntity().getName());
// systemService.saveOrUpdate(mzyKuCunEntity);
// }
// }
// IconImageUtil.convertKcDataGrid(dataGrid, request, systemService);
// this.mzyKuCunService.getDataGridReturn(cq, true);
// TagUtil.datagrid(response, dataGrid);
// }
}
| 25,224 | 0.641312 | 0.639456 | 543 | 44.639042 | 32.600468 | 165 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.797422 | false | false |
7
|
f7f3b3b613613ab71b1915832806900636dba81f
| 32,615,981,679,764 |
06a321c128ee333e8c140ddb7071ce30eab21daa
|
/src/main/java/austeretony/better_merchants/client/gui/merchant/BuyGUISection.java
|
c1b9f86f0346106994f6aeddd429c50a6b82d3bb
|
[] |
no_license
|
AustereTony-MCMods/Better-Merchants
|
https://github.com/AustereTony-MCMods/Better-Merchants
|
162b34867c44df3b94c65548774f4e662cb508a3
|
0f7fcded670d9ba9ebae57a4b3e22d4710464c72
|
refs/heads/master
| 2020-07-07T02:14:40.313000 | 2019-08-19T18:07:03 | 2019-08-19T18:07:03 | 203,213,085 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package austeretony.better_merchants.client.gui.merchant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import austeretony.alternateui.screen.browsing.GUIScroller;
import austeretony.alternateui.screen.button.GUIButton;
import austeretony.alternateui.screen.button.GUISlider;
import austeretony.alternateui.screen.core.AbstractGUISection;
import austeretony.alternateui.screen.core.GUIBaseElement;
import austeretony.alternateui.screen.panel.GUIButtonPanel;
import austeretony.alternateui.screen.text.GUITextField;
import austeretony.alternateui.screen.text.GUITextLabel;
import austeretony.alternateui.util.EnumGUIOrientation;
import austeretony.better_merchants.client.ClientReference;
import austeretony.better_merchants.client.MerchantsManagerClient;
import austeretony.better_merchants.client.gui.IndexedGUIButton;
import austeretony.better_merchants.client.gui.MerchantsGUITextures;
import austeretony.better_merchants.client.gui.settings.GUISettings;
import austeretony.better_merchants.common.main.CurrencyHandler;
import austeretony.better_merchants.common.main.MerchantOffer;
import austeretony.better_merchants.common.main.MerchantProfile;
import austeretony.better_merchants.common.main.SoundEffects;
import austeretony.better_merchants.common.util.InventoryHelper;
import austeretony.better_merchants.common.util.MathUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class BuyGUISection extends AbstractGUISection {
private final MerchantMenuGUIScreen screen;
private GUIButton sellingSectionButton, searchButton;
private GUITextField searchField;
private GUITextLabel inventoryStateTextLabel;
private GUIButtonPanel buyOffersPanel;
private GUICurrencyBalance currencyBalance;
private OfferGUIButton currentOfferButton;
private boolean overloaded;
private int balance, occupiedSlots;
public BuyGUISection(MerchantMenuGUIScreen screen) {
super(screen);
this.screen = screen;
}
@Override
public void init() {
this.addElement(new MerchantBackgroundGUIFiller(0, 0, this.getWidth(), this.getHeight()));
this.addElement(new GUITextLabel(2, 4).setDisplayText(this.screen.merchantProfile.getName(), false, GUISettings.instance().getTitleScale()));
String sectionName = ClientReference.localize("better_merchants.gui.merchant.buy");
this.addElement(new GUITextLabel(this.getWidth() - 32 - this.textWidth(sectionName, GUISettings.instance().getTitleScale()), 4).setDisplayText(sectionName, false, GUISettings.instance().getTitleScale()));
this.addElement(new GUIButton(this.getWidth() - 28, 0, 12, 12).setTexture(MerchantsGUITextures.BUY_ICONS, 12, 12).toggle());
this.addElement(this.sellingSectionButton = new GUIButton(this.getWidth() - 14, 0, 12, 12).setSound(SoundEffects.BUTTON_CLICK.soundEvent).setTexture(MerchantsGUITextures.SELL_ICONS, 12, 12));
this.addElement(this.searchButton = new GUIButton(3, 15, 7, 7).setSound(SoundEffects.BUTTON_CLICK.soundEvent).setTexture(MerchantsGUITextures.SEARCH_ICONS, 7, 7));
this.buyOffersPanel = new GUIButtonPanel(EnumGUIOrientation.VERTICAL, 0, 24, this.getWidth() - 3, 16).setButtonsOffset(1).setTextScale(GUISettings.instance().getTextScale());
this.addElement(this.buyOffersPanel);
this.addElement(this.searchField = new GUITextField(0, 14, 70, 9, 20)
.enableDynamicBackground(GUISettings.instance().getEnabledTextFieldColor(), GUISettings.instance().getDisabledTextFieldColor(), GUISettings.instance().getHoveredTextFieldColor())
.setDisplayText("...", false, GUISettings.instance().getSubTextScale()).setLineOffset(3).cancelDraggedElementLogic().disableFull());
this.buyOffersPanel.initSearchField(this.searchField);
GUIScroller scroller = new GUIScroller(MathUtils.clamp(this.screen.merchantProfile.getOffersAmount(), 9, 100), 9);
this.buyOffersPanel.initScroller(scroller);
GUISlider slider = new GUISlider(this.getWidth() - 2, 24, 2, 152);
slider.setDynamicBackgroundColor(GUISettings.instance().getEnabledSliderColor(), GUISettings.instance().getDisabledSliderColor(), GUISettings.instance().getHoveredSliderColor());
scroller.initSlider(slider);
this.addElement(this.inventoryStateTextLabel = new GUITextLabel(2, 179).setTextScale(GUISettings.instance().getSubTextScale()));
this.addElement(this.currencyBalance = new GUICurrencyBalance(this.getWidth() - 13, 181));
if (!this.screen.merchantProfile.isUsingCurrency())
this.currencyBalance.setItemStack(this.screen.merchantProfile.getCurrencyStack().getItemStack());
this.updateInventoryState();
this.updateBalance();
}
public void updateInventoryState() {
this.setInventoryState(InventoryHelper.getOccupiedSlotsAmount(this.mc.player));
}
public void setInventoryState(int value) {
this.inventoryStateTextLabel.setDisplayText(String.valueOf(value) + "/" + String.valueOf(this.mc.player.inventory.mainInventory.size()));
this.occupiedSlots = value;
this.overloaded = value == this.mc.player.inventory.mainInventory.size();
this.inventoryStateTextLabel.setEnabledTextColor(this.overloaded ? 0xFFCC0000 : 0xFFD1D1D1);
}
public void updateBalance() {
int balance = 0;
if (this.screen.merchantProfile.isUsingCurrency())
balance = CurrencyHandler.getCurrency(this.mc.player);
else
balance = InventoryHelper.getEqualStackAmount(this.mc.player, this.screen.merchantProfile.getCurrencyStack());
this.setBalance(balance);
}
public void setBalance(int value) {
this.currencyBalance.setBalance(value);
this.currencyBalance.setEnabledTextColor(value == 0 ? 0xFFCC0000 : 0xFFD1D1D1);
this.balance = value;
}
public void loadOffers() {
List<MerchantOffer> offers = new ArrayList<MerchantOffer>(this.screen.merchantProfile.getOffers());
Collections.sort(offers, (o1, o2)->(int) ((o1.offerId - o2.offerId) / 5_000L));
OfferGUIButton button;
ItemStack
currencyItemStack = null,
offeredStack;
if (!this.screen.merchantProfile.isUsingCurrency())
currencyItemStack = this.screen.merchantProfile.getCurrencyStack().getItemStack();
int
stock,
buyOfferCounter = 0,
sellingOfferCounter = 0;
for (MerchantOffer offer : offers) {
stock = InventoryHelper.getEqualStackAmount(this.mc.player, offer.getOfferedStack());
offeredStack = offer.getOfferedStack().getItemStack();
if (!offer.isSellingOnly()) {
button = new OfferGUIButton(offer.offerId, stock, offeredStack, offer.getAmount(), offer.getBuyCost(), currencyItemStack);
button.enableDynamicBackground(GUISettings.instance().getEnabledElementColor(), GUISettings.instance().getEnabledElementColor(), GUISettings.instance().getHoveredElementColor());
button.setTextDynamicColor(GUISettings.instance().getEnabledTextColor(), GUISettings.instance().getDisabledTextColor(), GUISettings.instance().getHoveredTextColor());
button.setEnabled(!this.overloaded && this.balance >= offer.getBuyCost());
button.requireDoubleClick();
this.buyOffersPanel.addButton(button);
buyOfferCounter++;
}
if (offer.isSellingEnabled()) {
button = new OfferGUIButton(offer.offerId, stock, offeredStack, offer.getAmount(), offer.getSellingCost(), currencyItemStack);
button.enableDynamicBackground(GUISettings.instance().getEnabledElementColor(), GUISettings.instance().getEnabledElementColor(), GUISettings.instance().getHoveredElementColor());
button.setTextDynamicColor(GUISettings.instance().getEnabledTextColor(), GUISettings.instance().getDisabledTextColor(), GUISettings.instance().getHoveredTextColor());
button.setEnabled((this.screen.merchantProfile.isUsingCurrency() || !this.overloaded) && stock >= offer.getAmount());
button.requireDoubleClick();
this.screen.getSellingSection().getSellingOffersPanel().addButton(button);
sellingOfferCounter++;
}
}
this.buyOffersPanel.getScroller().updateRowsAmount(MathUtils.clamp(buyOfferCounter, 9, 100));
this.screen.getSellingSection().getSellingOffersPanel().getScroller().updateRowsAmount(MathUtils.clamp(sellingOfferCounter, 9, 100));
}
@Override
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (this.searchField.isEnabled() && !this.searchField.isHovered()) {
this.searchButton.enableFull();
this.searchField.disableFull();
}
return super.mouseClicked(mouseX, mouseY, mouseButton);
}
@Override
public void handleElementClick(AbstractGUISection section, GUIBaseElement element, int mouseButton) {
if (mouseButton == 0) {
if (element == this.sellingSectionButton)
this.screen.getSellingSection().open();
else if (element == this.searchButton) {
this.searchField.enableFull();
this.searchButton.disableFull();
} else if (element instanceof OfferGUIButton) {
this.currentOfferButton = (OfferGUIButton) element;
MerchantsManagerClient.instance().performBuySynced(this.screen.merchantProfile.getId(), this.currentOfferButton.index);
}
}
}
public void bought() {
this.mc.player.playSound(SoundEffects.SELL.soundEvent, 0.5F, 1.0F);
if (this.currentOfferButton != null) {
MerchantOffer offer = this.screen.merchantProfile.getOffer(this.currentOfferButton.index);
this.simulateBuy(ClientReference.getClientPlayer(), this.screen.merchantProfile, offer);
this.updateInventoryState();
this.currentOfferButton.setPlayerStock(this.currentOfferButton.getPlayerStock() + offer.getAmount());
this.setBalance(this.balance - offer.getBuyCost());
this.screen.getSellingSection().setInventoryState(this.occupiedSlots);
this.screen.getSellingSection().setBalance(this.balance);
this.screen.getSellingSection().updateOffer(offer.offerId, this.currentOfferButton.getPlayerStock());
}
for (GUIButton button : this.buyOffersPanel.buttonsBuffer)
button.setEnabled(!this.overloaded && this.balance >= this.screen.merchantProfile.getOffer(((IndexedGUIButton<Long>) button).index).getBuyCost());
}
public void updateOffer(long offerId, int amount) {
OfferGUIButton offerButton;
for (GUIButton button : this.buyOffersPanel.buttonsBuffer) {
offerButton = (OfferGUIButton) button;
button.setEnabled(!this.overloaded && this.balance >= this.screen.merchantProfile.getOffer(offerButton.index).getBuyCost());
if (offerButton.index == offerId)
offerButton.setPlayerStock(amount);
}
}
private void simulateBuy(EntityPlayer player, MerchantProfile profile, MerchantOffer offer) {
if (!profile.isUsingCurrency())
InventoryHelper.removeEqualStack(player, profile.getCurrencyStack(), offer.getBuyCost());
InventoryHelper.addItemStack(player, offer.getOfferedStack().getItemStack(), offer.getAmount());
}
}
|
UTF-8
|
Java
| 11,688 |
java
|
BuyGUISection.java
|
Java
|
[] | null |
[] |
package austeretony.better_merchants.client.gui.merchant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import austeretony.alternateui.screen.browsing.GUIScroller;
import austeretony.alternateui.screen.button.GUIButton;
import austeretony.alternateui.screen.button.GUISlider;
import austeretony.alternateui.screen.core.AbstractGUISection;
import austeretony.alternateui.screen.core.GUIBaseElement;
import austeretony.alternateui.screen.panel.GUIButtonPanel;
import austeretony.alternateui.screen.text.GUITextField;
import austeretony.alternateui.screen.text.GUITextLabel;
import austeretony.alternateui.util.EnumGUIOrientation;
import austeretony.better_merchants.client.ClientReference;
import austeretony.better_merchants.client.MerchantsManagerClient;
import austeretony.better_merchants.client.gui.IndexedGUIButton;
import austeretony.better_merchants.client.gui.MerchantsGUITextures;
import austeretony.better_merchants.client.gui.settings.GUISettings;
import austeretony.better_merchants.common.main.CurrencyHandler;
import austeretony.better_merchants.common.main.MerchantOffer;
import austeretony.better_merchants.common.main.MerchantProfile;
import austeretony.better_merchants.common.main.SoundEffects;
import austeretony.better_merchants.common.util.InventoryHelper;
import austeretony.better_merchants.common.util.MathUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class BuyGUISection extends AbstractGUISection {
private final MerchantMenuGUIScreen screen;
private GUIButton sellingSectionButton, searchButton;
private GUITextField searchField;
private GUITextLabel inventoryStateTextLabel;
private GUIButtonPanel buyOffersPanel;
private GUICurrencyBalance currencyBalance;
private OfferGUIButton currentOfferButton;
private boolean overloaded;
private int balance, occupiedSlots;
public BuyGUISection(MerchantMenuGUIScreen screen) {
super(screen);
this.screen = screen;
}
@Override
public void init() {
this.addElement(new MerchantBackgroundGUIFiller(0, 0, this.getWidth(), this.getHeight()));
this.addElement(new GUITextLabel(2, 4).setDisplayText(this.screen.merchantProfile.getName(), false, GUISettings.instance().getTitleScale()));
String sectionName = ClientReference.localize("better_merchants.gui.merchant.buy");
this.addElement(new GUITextLabel(this.getWidth() - 32 - this.textWidth(sectionName, GUISettings.instance().getTitleScale()), 4).setDisplayText(sectionName, false, GUISettings.instance().getTitleScale()));
this.addElement(new GUIButton(this.getWidth() - 28, 0, 12, 12).setTexture(MerchantsGUITextures.BUY_ICONS, 12, 12).toggle());
this.addElement(this.sellingSectionButton = new GUIButton(this.getWidth() - 14, 0, 12, 12).setSound(SoundEffects.BUTTON_CLICK.soundEvent).setTexture(MerchantsGUITextures.SELL_ICONS, 12, 12));
this.addElement(this.searchButton = new GUIButton(3, 15, 7, 7).setSound(SoundEffects.BUTTON_CLICK.soundEvent).setTexture(MerchantsGUITextures.SEARCH_ICONS, 7, 7));
this.buyOffersPanel = new GUIButtonPanel(EnumGUIOrientation.VERTICAL, 0, 24, this.getWidth() - 3, 16).setButtonsOffset(1).setTextScale(GUISettings.instance().getTextScale());
this.addElement(this.buyOffersPanel);
this.addElement(this.searchField = new GUITextField(0, 14, 70, 9, 20)
.enableDynamicBackground(GUISettings.instance().getEnabledTextFieldColor(), GUISettings.instance().getDisabledTextFieldColor(), GUISettings.instance().getHoveredTextFieldColor())
.setDisplayText("...", false, GUISettings.instance().getSubTextScale()).setLineOffset(3).cancelDraggedElementLogic().disableFull());
this.buyOffersPanel.initSearchField(this.searchField);
GUIScroller scroller = new GUIScroller(MathUtils.clamp(this.screen.merchantProfile.getOffersAmount(), 9, 100), 9);
this.buyOffersPanel.initScroller(scroller);
GUISlider slider = new GUISlider(this.getWidth() - 2, 24, 2, 152);
slider.setDynamicBackgroundColor(GUISettings.instance().getEnabledSliderColor(), GUISettings.instance().getDisabledSliderColor(), GUISettings.instance().getHoveredSliderColor());
scroller.initSlider(slider);
this.addElement(this.inventoryStateTextLabel = new GUITextLabel(2, 179).setTextScale(GUISettings.instance().getSubTextScale()));
this.addElement(this.currencyBalance = new GUICurrencyBalance(this.getWidth() - 13, 181));
if (!this.screen.merchantProfile.isUsingCurrency())
this.currencyBalance.setItemStack(this.screen.merchantProfile.getCurrencyStack().getItemStack());
this.updateInventoryState();
this.updateBalance();
}
public void updateInventoryState() {
this.setInventoryState(InventoryHelper.getOccupiedSlotsAmount(this.mc.player));
}
public void setInventoryState(int value) {
this.inventoryStateTextLabel.setDisplayText(String.valueOf(value) + "/" + String.valueOf(this.mc.player.inventory.mainInventory.size()));
this.occupiedSlots = value;
this.overloaded = value == this.mc.player.inventory.mainInventory.size();
this.inventoryStateTextLabel.setEnabledTextColor(this.overloaded ? 0xFFCC0000 : 0xFFD1D1D1);
}
public void updateBalance() {
int balance = 0;
if (this.screen.merchantProfile.isUsingCurrency())
balance = CurrencyHandler.getCurrency(this.mc.player);
else
balance = InventoryHelper.getEqualStackAmount(this.mc.player, this.screen.merchantProfile.getCurrencyStack());
this.setBalance(balance);
}
public void setBalance(int value) {
this.currencyBalance.setBalance(value);
this.currencyBalance.setEnabledTextColor(value == 0 ? 0xFFCC0000 : 0xFFD1D1D1);
this.balance = value;
}
public void loadOffers() {
List<MerchantOffer> offers = new ArrayList<MerchantOffer>(this.screen.merchantProfile.getOffers());
Collections.sort(offers, (o1, o2)->(int) ((o1.offerId - o2.offerId) / 5_000L));
OfferGUIButton button;
ItemStack
currencyItemStack = null,
offeredStack;
if (!this.screen.merchantProfile.isUsingCurrency())
currencyItemStack = this.screen.merchantProfile.getCurrencyStack().getItemStack();
int
stock,
buyOfferCounter = 0,
sellingOfferCounter = 0;
for (MerchantOffer offer : offers) {
stock = InventoryHelper.getEqualStackAmount(this.mc.player, offer.getOfferedStack());
offeredStack = offer.getOfferedStack().getItemStack();
if (!offer.isSellingOnly()) {
button = new OfferGUIButton(offer.offerId, stock, offeredStack, offer.getAmount(), offer.getBuyCost(), currencyItemStack);
button.enableDynamicBackground(GUISettings.instance().getEnabledElementColor(), GUISettings.instance().getEnabledElementColor(), GUISettings.instance().getHoveredElementColor());
button.setTextDynamicColor(GUISettings.instance().getEnabledTextColor(), GUISettings.instance().getDisabledTextColor(), GUISettings.instance().getHoveredTextColor());
button.setEnabled(!this.overloaded && this.balance >= offer.getBuyCost());
button.requireDoubleClick();
this.buyOffersPanel.addButton(button);
buyOfferCounter++;
}
if (offer.isSellingEnabled()) {
button = new OfferGUIButton(offer.offerId, stock, offeredStack, offer.getAmount(), offer.getSellingCost(), currencyItemStack);
button.enableDynamicBackground(GUISettings.instance().getEnabledElementColor(), GUISettings.instance().getEnabledElementColor(), GUISettings.instance().getHoveredElementColor());
button.setTextDynamicColor(GUISettings.instance().getEnabledTextColor(), GUISettings.instance().getDisabledTextColor(), GUISettings.instance().getHoveredTextColor());
button.setEnabled((this.screen.merchantProfile.isUsingCurrency() || !this.overloaded) && stock >= offer.getAmount());
button.requireDoubleClick();
this.screen.getSellingSection().getSellingOffersPanel().addButton(button);
sellingOfferCounter++;
}
}
this.buyOffersPanel.getScroller().updateRowsAmount(MathUtils.clamp(buyOfferCounter, 9, 100));
this.screen.getSellingSection().getSellingOffersPanel().getScroller().updateRowsAmount(MathUtils.clamp(sellingOfferCounter, 9, 100));
}
@Override
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
if (this.searchField.isEnabled() && !this.searchField.isHovered()) {
this.searchButton.enableFull();
this.searchField.disableFull();
}
return super.mouseClicked(mouseX, mouseY, mouseButton);
}
@Override
public void handleElementClick(AbstractGUISection section, GUIBaseElement element, int mouseButton) {
if (mouseButton == 0) {
if (element == this.sellingSectionButton)
this.screen.getSellingSection().open();
else if (element == this.searchButton) {
this.searchField.enableFull();
this.searchButton.disableFull();
} else if (element instanceof OfferGUIButton) {
this.currentOfferButton = (OfferGUIButton) element;
MerchantsManagerClient.instance().performBuySynced(this.screen.merchantProfile.getId(), this.currentOfferButton.index);
}
}
}
public void bought() {
this.mc.player.playSound(SoundEffects.SELL.soundEvent, 0.5F, 1.0F);
if (this.currentOfferButton != null) {
MerchantOffer offer = this.screen.merchantProfile.getOffer(this.currentOfferButton.index);
this.simulateBuy(ClientReference.getClientPlayer(), this.screen.merchantProfile, offer);
this.updateInventoryState();
this.currentOfferButton.setPlayerStock(this.currentOfferButton.getPlayerStock() + offer.getAmount());
this.setBalance(this.balance - offer.getBuyCost());
this.screen.getSellingSection().setInventoryState(this.occupiedSlots);
this.screen.getSellingSection().setBalance(this.balance);
this.screen.getSellingSection().updateOffer(offer.offerId, this.currentOfferButton.getPlayerStock());
}
for (GUIButton button : this.buyOffersPanel.buttonsBuffer)
button.setEnabled(!this.overloaded && this.balance >= this.screen.merchantProfile.getOffer(((IndexedGUIButton<Long>) button).index).getBuyCost());
}
public void updateOffer(long offerId, int amount) {
OfferGUIButton offerButton;
for (GUIButton button : this.buyOffersPanel.buttonsBuffer) {
offerButton = (OfferGUIButton) button;
button.setEnabled(!this.overloaded && this.balance >= this.screen.merchantProfile.getOffer(offerButton.index).getBuyCost());
if (offerButton.index == offerId)
offerButton.setPlayerStock(amount);
}
}
private void simulateBuy(EntityPlayer player, MerchantProfile profile, MerchantOffer offer) {
if (!profile.isUsingCurrency())
InventoryHelper.removeEqualStack(player, profile.getCurrencyStack(), offer.getBuyCost());
InventoryHelper.addItemStack(player, offer.getOfferedStack().getItemStack(), offer.getAmount());
}
}
| 11,688 | 0.716034 | 0.706109 | 220 | 52.127274 | 49.451374 | 212 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.986364 | false | false |
7
|
5d0226ab392f9011fe9abb0a4041fbb9642566fe
| 12,386,685,742,273 |
b93a9d014b5032598f9ca6349e2d356a98ace0a6
|
/src/Com/MyTraining/Abstract/Main.java
|
f7dd0fc5274cd350c1df4e4d740cf048332dfcda
|
[] |
no_license
|
Lunaticc/Java-Polymorphism-Training
|
https://github.com/Lunaticc/Java-Polymorphism-Training
|
dd555b8f6c9119522c27dc52e61da1e3e0f98918
|
5d3d9c73d7e224939b5d1183201d287078b521b4
|
refs/heads/master
| 2022-12-14T22:21:38.718000 | 2020-08-29T02:27:31 | 2020-08-29T02:27:31 | 290,486,569 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Com.MyTraining.Abstract;
public class Main {
public static void main(String[] args) {
GermanShepherd dog = new GermanShepherd("Black coating with baige spots.");
System.out.println(dog.getLegs());
System.out.println(dog);
GermanShepherd dogo = new GermanShepherd("Black and blue");
dogo.setDescription("A jumpy and happy german shepherd");
System.out.println(dogo.getHead());
System.out.println(dogo);
Leven leven = Leven.MEDIUM;
System.out.println(leven);
}
}
enum Leven{
LOW,
MEDIUM,
HIGH
}
|
UTF-8
|
Java
| 603 |
java
|
Main.java
|
Java
|
[] | null |
[] |
package Com.MyTraining.Abstract;
public class Main {
public static void main(String[] args) {
GermanShepherd dog = new GermanShepherd("Black coating with baige spots.");
System.out.println(dog.getLegs());
System.out.println(dog);
GermanShepherd dogo = new GermanShepherd("Black and blue");
dogo.setDescription("A jumpy and happy german shepherd");
System.out.println(dogo.getHead());
System.out.println(dogo);
Leven leven = Leven.MEDIUM;
System.out.println(leven);
}
}
enum Leven{
LOW,
MEDIUM,
HIGH
}
| 603 | 0.633499 | 0.633499 | 29 | 19.793104 | 23.53776 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.413793 | false | false |
7
|
309ff35bb91aac455979cb2e3b910f0cddc8410a
| 12,386,685,741,465 |
a93484a74635534e4e875762a111f4dd2a0f4809
|
/Tabelas2Views/src/controllers/Controller2.java
|
ac1c98c11993c999970e932d93583667f3ee7b91
|
[] |
no_license
|
dcota/TIS3ano-JavaFX
|
https://github.com/dcota/TIS3ano-JavaFX
|
de078924a92af5191431f72daf282dcb9eb87123
|
b3e217019c1aa411f9bd1071a44c609c23643ba4
|
refs/heads/master
| 2023-03-05T12:30:06.169000 | 2021-02-22T21:37:09 | 2021-02-22T21:37:09 | 330,947,243 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package controllers;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;
public class Controller2 {
@FXML private Button btnFechar;
@FXML private Button btnSubmeter;
@FXML private TextArea taTextoView2;
@FXML private Label mostrarTexto;
private String texto;
@FXML
public void submeterTexto(ActionEvent event){
texto = this.taTextoView2.getText();
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setHeaderText(null);
alert.setTitle("INFO");
alert.setContentText("Texto submetido com sucesso!");
alert.showAndWait();
Stage stage = (Stage) this.btnSubmeter.getScene().getWindow();
stage.close();
}
@FXML
public void fecharView2(ActionEvent event){
Stage stage = (Stage) this.btnFechar.getScene().getWindow();
stage.close();
}
public String getTexto(){
return this.texto;
}
public void preencheLabel(String txt){
this.mostrarTexto.setText(txt);
}
}
|
UTF-8
|
Java
| 1,201 |
java
|
Controller2.java
|
Java
|
[] | null |
[] |
package controllers;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;
public class Controller2 {
@FXML private Button btnFechar;
@FXML private Button btnSubmeter;
@FXML private TextArea taTextoView2;
@FXML private Label mostrarTexto;
private String texto;
@FXML
public void submeterTexto(ActionEvent event){
texto = this.taTextoView2.getText();
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setHeaderText(null);
alert.setTitle("INFO");
alert.setContentText("Texto submetido com sucesso!");
alert.showAndWait();
Stage stage = (Stage) this.btnSubmeter.getScene().getWindow();
stage.close();
}
@FXML
public void fecharView2(ActionEvent event){
Stage stage = (Stage) this.btnFechar.getScene().getWindow();
stage.close();
}
public String getTexto(){
return this.texto;
}
public void preencheLabel(String txt){
this.mostrarTexto.setText(txt);
}
}
| 1,201 | 0.681932 | 0.678601 | 47 | 24.553192 | 19.870655 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.531915 | false | false |
7
|
099fa0c19985f63e09f2e81b5732620b889d5a04
| 25,598,005,085,227 |
468a8bc0ea940fea7acf7ff289894801ef555148
|
/src/main/java/org/trustedanalytics/scheduler/WorkflowSchedulerConfigurationProvider.java
|
b69a08952fb55dd62ad66fadf7c461d557b6e8b9
|
[] |
no_license
|
Kendralabs/workflow-scheduler
|
https://github.com/Kendralabs/workflow-scheduler
|
3e4d33015784dc8d52d0967af5daa3f89bc656d4
|
27ce27a7d2a2dd2dfd2fe38174122195040df9a5
|
refs/heads/master
| 2023-01-20T05:48:52.341000 | 2016-05-16T12:19:00 | 2016-05-16T12:19:00 | 235,635,473 | 0 | 1 | null | true | 2023-01-17T06:11:27 | 2020-01-22T18:15:03 | 2020-01-22T18:15:05 | 2023-01-17T06:11:25 | 91 | 0 | 1 | 4 | null | false | false |
/**
* Copyright (c) 2016 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.trustedanalytics.scheduler;
import org.trustedanalytics.scheduler.config.Database;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.TimeZone;
import java.util.UUID;
import java.util.stream.Collectors;
import org.trustedanalytics.scheduler.security.TokenProvider;
import rx.Observable;
@Service
public class WorkflowSchedulerConfigurationProvider {
private static final String MAIN_TIMEZONES = ".*(GMT|UTC|US|Europe/Warsaw).*";
private final List<Database> databases;
private final List<String> zones;
private final TokenProvider tokenProvider;
@Autowired
public WorkflowSchedulerConfigurationProvider(Observable<Database> databases, TokenProvider tokenProvider) {
this.databases = databases.toList().toBlocking().single();
this.zones = Arrays.stream(TimeZone.getAvailableIDs())
.filter(timezone -> timezone.matches(MAIN_TIMEZONES))
.collect(Collectors.toList());
this.tokenProvider = tokenProvider;
}
public WorkflowSchedulerConfigurationEntity getConfiguration(UUID orgId) {
return WorkflowSchedulerConfigurationEntity.builder()
.databases(databases)
.timezones(zones)
.organizationDirectory(
String.format("hdfs://nameservice1/org/%s/user/%s/", orgId, tokenProvider.getUserId()))
.build();
}
}
|
UTF-8
|
Java
| 2,114 |
java
|
WorkflowSchedulerConfigurationProvider.java
|
Java
|
[] | null |
[] |
/**
* Copyright (c) 2016 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.trustedanalytics.scheduler;
import org.trustedanalytics.scheduler.config.Database;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.TimeZone;
import java.util.UUID;
import java.util.stream.Collectors;
import org.trustedanalytics.scheduler.security.TokenProvider;
import rx.Observable;
@Service
public class WorkflowSchedulerConfigurationProvider {
private static final String MAIN_TIMEZONES = ".*(GMT|UTC|US|Europe/Warsaw).*";
private final List<Database> databases;
private final List<String> zones;
private final TokenProvider tokenProvider;
@Autowired
public WorkflowSchedulerConfigurationProvider(Observable<Database> databases, TokenProvider tokenProvider) {
this.databases = databases.toList().toBlocking().single();
this.zones = Arrays.stream(TimeZone.getAvailableIDs())
.filter(timezone -> timezone.matches(MAIN_TIMEZONES))
.collect(Collectors.toList());
this.tokenProvider = tokenProvider;
}
public WorkflowSchedulerConfigurationEntity getConfiguration(UUID orgId) {
return WorkflowSchedulerConfigurationEntity.builder()
.databases(databases)
.timezones(zones)
.organizationDirectory(
String.format("hdfs://nameservice1/org/%s/user/%s/", orgId, tokenProvider.getUserId()))
.build();
}
}
| 2,114 | 0.730369 | 0.726112 | 60 | 34.233334 | 29.424686 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
7
|
edc6c9a9cee2208c40c6a48a56a3366ee7231d11
| 22,256,520,554,291 |
aac4750d472d9fd6fc2f27d394711b4f8936e591
|
/src/main/java/com/ydy/ienum/EnumBanner.java
|
a55bbc3e0681727fdc9ad4214c5eccaa10e84f00
|
[] |
no_license
|
maxkiddie/model
|
https://github.com/maxkiddie/model
|
4142718a7a510addd6964992411756206fefb723
|
22aef24aebbfb9ee58baa74c846a516ca8b63663
|
refs/heads/master
| 2022-06-26T13:03:02.140000 | 2019-09-16T08:54:59 | 2019-09-16T08:54:59 | 208,697,209 | 0 | 0 | null | false | 2022-06-17T02:31:05 | 2019-09-16T02:56:54 | 2019-09-16T08:55:19 | 2022-06-17T02:31:05 | 68 | 0 | 0 | 3 |
Java
| false | false |
/**
*
*/
package com.ydy.ienum;
import com.ydy.ienum.base.IErrorEnum;
/**
* @author xuzhaojie
*
* 2018年11月12日 上午9:41:48
*/
public enum EnumBanner implements IErrorEnum {
DATA_NOT_FOUND(3000,"can not found banner");
private Integer code;
private String msg;
private EnumBanner(int code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public int getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
|
UTF-8
|
Java
| 486 |
java
|
EnumBanner.java
|
Java
|
[
{
"context": "ort com.ydy.ienum.base.IErrorEnum;\n\n/**\n * @author xuzhaojie\n *\n * 2018年11月12日 上午9:41:48\n */\npublic en",
"end": 99,
"score": 0.9993398785591125,
"start": 90,
"tag": "USERNAME",
"value": "xuzhaojie"
}
] | null |
[] |
/**
*
*/
package com.ydy.ienum;
import com.ydy.ienum.base.IErrorEnum;
/**
* @author xuzhaojie
*
* 2018年11月12日 上午9:41:48
*/
public enum EnumBanner implements IErrorEnum {
DATA_NOT_FOUND(3000,"can not found banner");
private Integer code;
private String msg;
private EnumBanner(int code, String msg) {
this.code = code;
this.msg = msg;
}
@Override
public int getCode() {
return code;
}
@Override
public String getMsg() {
return msg;
}
}
| 486 | 0.657563 | 0.621849 | 34 | 13 | 14.179522 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.882353 | false | false |
7
|
e92f0d06b570659d4bf0ff5c76d0376b37c0834f
| 29,669,634,100,792 |
fbe0946f72577153ad8e5f33207b9ba9253fa5eb
|
/src/model/formulas/Negation.java
|
fc9c3e86744fca41e3571c4962669eba6e8f6067
|
[
"MIT"
] |
permissive
|
nonilole/Conan
|
https://github.com/nonilole/Conan
|
516e65745543908ff662a0f467b9c273ba71ef5e
|
d3c079d37755a16cdbf629ae9ba90a1d2b2d63aa
|
refs/heads/master
| 2021-06-01T13:08:15.909000 | 2021-04-27T22:05:41 | 2021-04-27T22:05:41 | 82,529,552 | 19 | 2 |
MIT
| false | 2021-04-27T22:05:41 | 2017-02-20T07:31:58 | 2020-10-23T15:44:25 | 2021-04-27T22:05:41 | 4,271 | 15 | 2 | 0 |
Java
| false | false |
package model.formulas;
public class Negation extends Formula{
public final Formula formula;
public Negation(Formula formula){
this.formula = formula;
super.precedence = 3;
}
@Override
public Formula replace(String newId,String oldId){
return new Negation(formula.replace(newId, oldId));
}
@Override
public Formula replace(Term newTerm, Term oldTerm) {
return new Negation(formula.replace(newTerm, oldTerm));
}
@Override
public boolean equals(Object o){
if(o instanceof Negation){
Negation other = (Negation) o;
return this.formula.equals(other.formula);
}
return false;
}
@Override
public String toString(){
return formula.getPrecedence() < 3 ? "¬("+formula+")" : "¬"+formula+"";
}
@Override
public String parenthesize() {
return "(¬"+formula.parenthesize()+")";
}
@Override
public boolean containsFreeObjectId(String id) {
return formula.containsFreeObjectId(id);
}
}
|
UTF-8
|
Java
| 1,036 |
java
|
Negation.java
|
Java
|
[] | null |
[] |
package model.formulas;
public class Negation extends Formula{
public final Formula formula;
public Negation(Formula formula){
this.formula = formula;
super.precedence = 3;
}
@Override
public Formula replace(String newId,String oldId){
return new Negation(formula.replace(newId, oldId));
}
@Override
public Formula replace(Term newTerm, Term oldTerm) {
return new Negation(formula.replace(newTerm, oldTerm));
}
@Override
public boolean equals(Object o){
if(o instanceof Negation){
Negation other = (Negation) o;
return this.formula.equals(other.formula);
}
return false;
}
@Override
public String toString(){
return formula.getPrecedence() < 3 ? "¬("+formula+")" : "¬"+formula+"";
}
@Override
public String parenthesize() {
return "(¬"+formula.parenthesize()+")";
}
@Override
public boolean containsFreeObjectId(String id) {
return formula.containsFreeObjectId(id);
}
}
| 1,036 | 0.637948 | 0.636012 | 45 | 21.933332 | 20.245604 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.733333 | false | false |
7
|
cf0b0a51a38673961abcc7657429d032b127739d
| 29,669,634,100,323 |
f1fd92ae6d20a167ce8b8cae87d8f6bb1f70db6f
|
/src/main/java/crmdna/inventory/PackagedInventorySales.java
|
fa9a263b90dbf847248d355717adafe7a69f8286
|
[] |
no_license
|
ishacrm/ishacrmserver
|
https://github.com/ishacrm/ishacrmserver
|
4d26fc973f826b41e3a596d5382cacdc19eef573
|
56536a6c3fe859c7c1b0e79c028a237aeecdbf04
|
refs/heads/master
| 2016-06-16T05:06:09.461000 | 2016-06-15T17:09:46 | 2016-06-15T17:09:46 | 42,118,067 | 5 | 3 | null | false | 2016-07-11T04:13:30 | 2015-09-08T14:37:36 | 2016-01-12T17:43:40 | 2016-07-11T04:13:30 | 1,485 | 5 | 2 | 54 |
Java
| null | null |
package crmdna.inventory;
import com.googlecode.objectify.cmd.Query;
import crmdna.client.Client;
import crmdna.common.api.APIException;
import crmdna.common.api.APIResponse;
import java.util.ArrayList;
import java.util.List;
import static crmdna.common.AssertUtils.ensureNotNull;
import static crmdna.common.OfyService.ofy;
public class PackagedInventorySales {
public static PackagedInventorySalesEntity safeGet(String client, long salesId) {
Client.ensureValid(client);
PackagedInventorySalesEntity entity =
ofy(client).load().type(PackagedInventorySalesEntity.class).id(salesId).now();
if (null == entity)
throw new APIException().status(APIResponse.Status.ERROR_RESOURCE_NOT_FOUND).message(
"Sales id [" + salesId + "] does not exist");
return entity;
}
public static List<PackagedInventorySalesProp> query(String client,
PackagedInventorySalesQueryCondition qc) {
ensureNotNull(qc);
Query<PackagedInventorySalesEntity> query =
ofy(client).load().type(PackagedInventorySalesEntity.class);
if (qc.startMS != null) {
query = query.filter("salesMS >=", qc.startMS);
}
if (qc.endMS != null) {
query = query.filter("salesMS <=", qc.endMS);
}
List<PackagedInventorySalesEntity> entities = query.list();
List<PackagedInventorySalesProp> props = new ArrayList<>();
for (PackagedInventorySalesEntity entity : entities) {
props.add(entity.toProp());
}
return props;
}
}
|
UTF-8
|
Java
| 1,674 |
java
|
PackagedInventorySales.java
|
Java
|
[] | null |
[] |
package crmdna.inventory;
import com.googlecode.objectify.cmd.Query;
import crmdna.client.Client;
import crmdna.common.api.APIException;
import crmdna.common.api.APIResponse;
import java.util.ArrayList;
import java.util.List;
import static crmdna.common.AssertUtils.ensureNotNull;
import static crmdna.common.OfyService.ofy;
public class PackagedInventorySales {
public static PackagedInventorySalesEntity safeGet(String client, long salesId) {
Client.ensureValid(client);
PackagedInventorySalesEntity entity =
ofy(client).load().type(PackagedInventorySalesEntity.class).id(salesId).now();
if (null == entity)
throw new APIException().status(APIResponse.Status.ERROR_RESOURCE_NOT_FOUND).message(
"Sales id [" + salesId + "] does not exist");
return entity;
}
public static List<PackagedInventorySalesProp> query(String client,
PackagedInventorySalesQueryCondition qc) {
ensureNotNull(qc);
Query<PackagedInventorySalesEntity> query =
ofy(client).load().type(PackagedInventorySalesEntity.class);
if (qc.startMS != null) {
query = query.filter("salesMS >=", qc.startMS);
}
if (qc.endMS != null) {
query = query.filter("salesMS <=", qc.endMS);
}
List<PackagedInventorySalesEntity> entities = query.list();
List<PackagedInventorySalesProp> props = new ArrayList<>();
for (PackagedInventorySalesEntity entity : entities) {
props.add(entity.toProp());
}
return props;
}
}
| 1,674 | 0.643967 | 0.643967 | 54 | 30 | 29.390097 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.462963 | false | false |
7
|
6eedd237da65a83ddfae1cb0e4684ca7ec50ccf2
| 15,977,278,394,607 |
64e0664dc1f916cd740213549fe9121c2a3a81e6
|
/payment-service/src/main/java/com/mydigipay/paymentService/debtCardTransfer/service/TransferService.java
|
078f0daba5454c3b97c0467dda347b83a2266dee
|
[] |
no_license
|
kamal-shariats-wcar/PaymentSolution
|
https://github.com/kamal-shariats-wcar/PaymentSolution
|
82c9c09562af789c23668c7f86f38c2a26930e33
|
f1ed1bb94743e2b04b53a2b1cb02e31180aca525
|
refs/heads/master
| 2023-04-24T17:06:11.717000 | 2021-02-05T11:41:33 | 2021-02-05T11:41:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mydigipay.paymentService.debtCardTransfer.service;
import com.mydigipay.paymentService.debtCardTransfer.repository.vm.RecordCountVM;
import com.mydigipay.paymentService.debtCardTransfer.web.dto.CardTransferDTO;
import org.springframework.http.ResponseEntity;
import reactor.core.publisher.Mono;
import java.util.Date;
public interface TransferService {
Mono<ResponseEntity<Boolean>> transfer(CardTransferDTO dto);
RecordCountVM getReport(Date from, Date to, Integer debtCardId);
}
|
UTF-8
|
Java
| 506 |
java
|
TransferService.java
|
Java
|
[] | null |
[] |
package com.mydigipay.paymentService.debtCardTransfer.service;
import com.mydigipay.paymentService.debtCardTransfer.repository.vm.RecordCountVM;
import com.mydigipay.paymentService.debtCardTransfer.web.dto.CardTransferDTO;
import org.springframework.http.ResponseEntity;
import reactor.core.publisher.Mono;
import java.util.Date;
public interface TransferService {
Mono<ResponseEntity<Boolean>> transfer(CardTransferDTO dto);
RecordCountVM getReport(Date from, Date to, Integer debtCardId);
}
| 506 | 0.833992 | 0.833992 | 15 | 32.733334 | 30.61256 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
7
|
05ecc3e053db01e0eb1a6609bc0616d4f44f749b
| 27,633,819,601,287 |
1c9712e66f941fe56ce868ef1f504e1cfe0e003f
|
/ListaPOOB1/src/br/com/metrocamp/exercicio/Filme.java
|
d5d6858e9177103474cc139e098d3f233b36d812
|
[] |
no_license
|
rodrigoords/Cursos
|
https://github.com/rodrigoords/Cursos
|
532a133b70ffdd7d4a014331c1d6b3ba84995f93
|
4da6bf9ab114847f0859b7eddd41bfd495a28d5a
|
refs/heads/master
| 2022-12-26T03:13:31.485000 | 2019-08-24T19:58:44 | 2019-08-24T19:58:44 | 73,127,180 | 0 | 0 | null | false | 2022-12-10T02:35:13 | 2016-11-07T22:35:32 | 2019-08-24T19:59:04 | 2022-12-10T02:35:09 | 1,007 | 0 | 0 | 2 |
HTML
| false | false |
package br.com.metrocamp.exercicio;
public class Filme {
private Integer codigo;
private String titulo;
private String genero;
private Integer ano;
private Integer duracao;
private String direcao;
public Integer getCodigo() {
return codigo;
}
public void setCodigo(Integer codigo) {
this.codigo = codigo;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public String getGenero() {
return genero;
}
public void setGenero(String genero) {
this.genero = genero;
}
public Integer getAno() {
return ano;
}
public void setAno(Integer ano) {
this.ano = ano;
}
public Integer getDuracao() {
return duracao;
}
public void setDuracao(Integer duracao) {
this.duracao = duracao;
}
public String getDirecao() {
return direcao;
}
public void setDirecao(String direcao) {
this.direcao = direcao;
}
@Override
public String toString() {
String dados;
dados = "Código............: "+ getCodigo();
dados += "\nTítulo Original: " + getTitulo();
dados += "\nGênero.........: "+getGenero();
dados += "\nAno de Produção: "+getAno();
dados += "\nDuração (min)..: " + getDuracao();
dados += "\nDireção........: "+getDirecao();
return dados;
}
}
|
UTF-8
|
Java
| 1,277 |
java
|
Filme.java
|
Java
|
[] | null |
[] |
package br.com.metrocamp.exercicio;
public class Filme {
private Integer codigo;
private String titulo;
private String genero;
private Integer ano;
private Integer duracao;
private String direcao;
public Integer getCodigo() {
return codigo;
}
public void setCodigo(Integer codigo) {
this.codigo = codigo;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public String getGenero() {
return genero;
}
public void setGenero(String genero) {
this.genero = genero;
}
public Integer getAno() {
return ano;
}
public void setAno(Integer ano) {
this.ano = ano;
}
public Integer getDuracao() {
return duracao;
}
public void setDuracao(Integer duracao) {
this.duracao = duracao;
}
public String getDirecao() {
return direcao;
}
public void setDirecao(String direcao) {
this.direcao = direcao;
}
@Override
public String toString() {
String dados;
dados = "Código............: "+ getCodigo();
dados += "\nTítulo Original: " + getTitulo();
dados += "\nGênero.........: "+getGenero();
dados += "\nAno de Produção: "+getAno();
dados += "\nDuração (min)..: " + getDuracao();
dados += "\nDireção........: "+getDirecao();
return dados;
}
}
| 1,277 | 0.659306 | 0.659306 | 62 | 19.451612 | 15.042603 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.725806 | false | false |
7
|
b31049e9fd1297fbe4d452531531d16a2ed6098f
| 13,022,340,881,454 |
0270d1b523c96eaed721797ebd01c418e657cac2
|
/src/main/java/com/jmr/testsuite/fas/action/cl/CLDMNDSB_Test.java
|
91a80f93c136775cd9197edfa8d84c59c6dcfe03
|
[] |
no_license
|
Rahul3465/fas_flexcube
|
https://github.com/Rahul3465/fas_flexcube
|
c5c654dd55d722dbba4bb593d73cd50d744c589e
|
8d2bda1eeffc88d59098e9d2b86a97351cc1054d
|
refs/heads/master
| 2022-12-25T20:22:24.213000 | 2020-01-20T16:20:54 | 2020-01-20T16:20:54 | 235,143,269 | 0 | 1 | null | false | 2022-12-14T20:41:58 | 2020-01-20T16:14:54 | 2020-01-20T16:20:57 | 2022-12-14T20:41:56 | 36,030 | 0 | 1 | 8 |
Java
| false | false |
package com.jmr.testsuite.fas.action.cl;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import com.jmr.testsuite.fas.FlexcubeCommon;
import com.jmr.testsuite.fas.SpringConfiguration;
import com.jmr.testsuite.fas.page.cl.CLDMNDSB_Page;
import io.github.millij.poi.ss.reader.XlsxReader;
@ContextConfiguration(classes = SpringConfiguration.class)
public class CLDMNDSB_Test extends AbstractTestNGSpringContextTests{
@Autowired
private FlexcubeCommon fcubs;
@Autowired
private XlsxReader xlsReader;
private String errorMsg = "";
private final String screenId = "CLDMNDSB";
private final String screenName="Manual Disbursement Details";
private List<CLDMNDSB_Page> dataList;
private List<CLDMNDSB_Page> resultList;
private String testCaseId;
@PostConstruct
public void initSetup() throws Exception {
fcubs.setScreenDetails(screenId, screenName);
fcubs.launchApp();
// dataList1 = xlsReader.read(CFDFLTRI.class, new File(AppConfig.testFileLocation), 13);
dataList = fcubs.loadDataFromExcel(CLDMNDSB_Page.class, screenId);
resultList = new ArrayList<>();
}
@Test()
public void executeTestCase() throws Exception {
for (CLDMNDSB_Page data : dataList) {
try {
this.testCaseId = data.getTestCaseId();
System.out.println("Executing Test Case ====>" + this.testCaseId);
fcubs.setTestCaseId(testCaseId);
if (data.getRunMode().equalsIgnoreCase("Yes") || data.getRunMode().equalsIgnoreCase("Y")) {
fcubs.launchScreen(screenId);
if (data.getNewdata().equalsIgnoreCase("Yes")) {
fcubs.clickNew();
fcubs.populateTextById("BLK_DSBR_MASTER__ACTNO", data.getAccountnumber());
fcubs.clickButtonById("BLK_DSBR_MASTER__BTN_DEFAULT");
fcubs.populateTextById("BLK_DSBR_MASTER__VALDTI", data.getValuedate());
fcubs.populateTextById("BLK_DSBR_MASTER__EXECUTIONDATEI", data.getExecutiondate());
fcubs.populateTextById("BLK_DSBR_MASTER__REMARKS", data.getRemark());
fcubs.selectDropdownByText("BLK_DSBR_DETAIL__STTLMODE", data.getSettlementmode());
fcubs.populateTextById("BLK_DSBR_DETAIL__STTLCCY", data.getSettlementcurrency());
fcubs.populateTextById("BLK_DSBR_DETAIL__STTLAMTI", data.getSettlementamount());
fcubs.clickSave();
fcubs.closeOverridePopUp();
}
//============================================Authorise Record=================================================
if (data.getAuthorize().equalsIgnoreCase("Yes")) {
fcubs.clickEnterQuery();
fcubs.populateTextById("BLK_DSBR_MASTER__ACTNO", data.getAccountnumber());
fcubs.clickExecuteQuery();
fcubs.clickButtonByXpath("//a[contains(text(),'Authorize')]");
fcubs.switchtosubscreensframe();
fcubs.clickBtnAuthorisebtn();
fcubs.closeInfoPopUp();
fcubs.closeScreen();
}
try {
errorMsg = fcubs.getAllErrorMsgAndClose(data.getTestCaseId());
System.out.println("Error Message " + errorMsg);
data.setTestCaseResult(errorMsg);
if (fcubs.validInput(errorMsg)) {
resultList.add(data);
continue;
}
} catch (Exception ex) {
ex.printStackTrace();
}
//fcubs.closeOverridePopUp();
data.setTestCaseResult("SUCCESS");
resultList.add(data);
// on successful save action confirm and close window for next test case
fcubs.closeInfoPopUp();
fcubs.closeScreen();
data.setTestCaseResult("SUCCESS");
}
} catch (Exception ex) {
errorMsg = fcubs.checkUIFormatError();
if (fcubs.validInput(errorMsg)) {
data.setTestCaseResult(errorMsg);
} else if (fcubs.validInput(ex.getMessage())) {
data.setTestCaseResult(ex.getMessage());
}
ex.printStackTrace();
resultList.add(data);
// to update the status as failed
// fcubs.updateTestCaseExecutionAsFailed();
}
}
}
@AfterClass
public void destroy() throws Exception {
System.out.println("before destroying opened session");
fcubs.destroy();
}
@AfterMethod
public void tearDown(ITestResult result) {
System.out.println("inside after method");
if (!result.isSuccess()) {
fcubs.takeScreenShot("UNHANDLED_EXCEPTION_" + testCaseId);
}
System.out.println("Test Case Id\tResult");
for (CLDMNDSB_Page data : resultList) {
System.out.println(data.getTestCaseId() + "\t" + data.getTestCaseResult().replace("\n", ";"));
}
}
}
|
UTF-8
|
Java
| 4,857 |
java
|
CLDMNDSB_Test.java
|
Java
|
[] | null |
[] |
package com.jmr.testsuite.fas.action.cl;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import com.jmr.testsuite.fas.FlexcubeCommon;
import com.jmr.testsuite.fas.SpringConfiguration;
import com.jmr.testsuite.fas.page.cl.CLDMNDSB_Page;
import io.github.millij.poi.ss.reader.XlsxReader;
@ContextConfiguration(classes = SpringConfiguration.class)
public class CLDMNDSB_Test extends AbstractTestNGSpringContextTests{
@Autowired
private FlexcubeCommon fcubs;
@Autowired
private XlsxReader xlsReader;
private String errorMsg = "";
private final String screenId = "CLDMNDSB";
private final String screenName="Manual Disbursement Details";
private List<CLDMNDSB_Page> dataList;
private List<CLDMNDSB_Page> resultList;
private String testCaseId;
@PostConstruct
public void initSetup() throws Exception {
fcubs.setScreenDetails(screenId, screenName);
fcubs.launchApp();
// dataList1 = xlsReader.read(CFDFLTRI.class, new File(AppConfig.testFileLocation), 13);
dataList = fcubs.loadDataFromExcel(CLDMNDSB_Page.class, screenId);
resultList = new ArrayList<>();
}
@Test()
public void executeTestCase() throws Exception {
for (CLDMNDSB_Page data : dataList) {
try {
this.testCaseId = data.getTestCaseId();
System.out.println("Executing Test Case ====>" + this.testCaseId);
fcubs.setTestCaseId(testCaseId);
if (data.getRunMode().equalsIgnoreCase("Yes") || data.getRunMode().equalsIgnoreCase("Y")) {
fcubs.launchScreen(screenId);
if (data.getNewdata().equalsIgnoreCase("Yes")) {
fcubs.clickNew();
fcubs.populateTextById("BLK_DSBR_MASTER__ACTNO", data.getAccountnumber());
fcubs.clickButtonById("BLK_DSBR_MASTER__BTN_DEFAULT");
fcubs.populateTextById("BLK_DSBR_MASTER__VALDTI", data.getValuedate());
fcubs.populateTextById("BLK_DSBR_MASTER__EXECUTIONDATEI", data.getExecutiondate());
fcubs.populateTextById("BLK_DSBR_MASTER__REMARKS", data.getRemark());
fcubs.selectDropdownByText("BLK_DSBR_DETAIL__STTLMODE", data.getSettlementmode());
fcubs.populateTextById("BLK_DSBR_DETAIL__STTLCCY", data.getSettlementcurrency());
fcubs.populateTextById("BLK_DSBR_DETAIL__STTLAMTI", data.getSettlementamount());
fcubs.clickSave();
fcubs.closeOverridePopUp();
}
//============================================Authorise Record=================================================
if (data.getAuthorize().equalsIgnoreCase("Yes")) {
fcubs.clickEnterQuery();
fcubs.populateTextById("BLK_DSBR_MASTER__ACTNO", data.getAccountnumber());
fcubs.clickExecuteQuery();
fcubs.clickButtonByXpath("//a[contains(text(),'Authorize')]");
fcubs.switchtosubscreensframe();
fcubs.clickBtnAuthorisebtn();
fcubs.closeInfoPopUp();
fcubs.closeScreen();
}
try {
errorMsg = fcubs.getAllErrorMsgAndClose(data.getTestCaseId());
System.out.println("Error Message " + errorMsg);
data.setTestCaseResult(errorMsg);
if (fcubs.validInput(errorMsg)) {
resultList.add(data);
continue;
}
} catch (Exception ex) {
ex.printStackTrace();
}
//fcubs.closeOverridePopUp();
data.setTestCaseResult("SUCCESS");
resultList.add(data);
// on successful save action confirm and close window for next test case
fcubs.closeInfoPopUp();
fcubs.closeScreen();
data.setTestCaseResult("SUCCESS");
}
} catch (Exception ex) {
errorMsg = fcubs.checkUIFormatError();
if (fcubs.validInput(errorMsg)) {
data.setTestCaseResult(errorMsg);
} else if (fcubs.validInput(ex.getMessage())) {
data.setTestCaseResult(ex.getMessage());
}
ex.printStackTrace();
resultList.add(data);
// to update the status as failed
// fcubs.updateTestCaseExecutionAsFailed();
}
}
}
@AfterClass
public void destroy() throws Exception {
System.out.println("before destroying opened session");
fcubs.destroy();
}
@AfterMethod
public void tearDown(ITestResult result) {
System.out.println("inside after method");
if (!result.isSuccess()) {
fcubs.takeScreenShot("UNHANDLED_EXCEPTION_" + testCaseId);
}
System.out.println("Test Case Id\tResult");
for (CLDMNDSB_Page data : resultList) {
System.out.println(data.getTestCaseId() + "\t" + data.getTestCaseResult().replace("\n", ";"));
}
}
}
| 4,857 | 0.68952 | 0.688903 | 163 | 28.797546 | 26.621675 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.355828 | false | false |
7
|
9e703a9bae1d092f6177e34c5696c3630b30287d
| 17,575,006,185,857 |
be8387cb68e4cfd9c6f85a10c5e583c9601d90ab
|
/Exercise3/minhthuc/Ex2.java
|
9dcef051622dd0e469f9f6b5ba7dc5352847407c
|
[] |
no_license
|
hackademicsedu/h17jb3
|
https://github.com/hackademicsedu/h17jb3
|
12905eac2b27d827f5aab6627d5238d015500201
|
e484e86d77454e83a2b5f6ae6fa2f05ada85c9fc
|
refs/heads/master
| 2018-04-01T01:47:30.656000 | 2017-08-08T14:08:05 | 2017-08-08T14:08:05 | 88,257,022 | 1 | 0 | null | false | 2017-04-19T12:09:45 | 2017-04-14T10:05:49 | 2017-04-19T05:55:33 | 2017-04-19T12:09:45 | 40 | 1 | 0 | 0 |
Java
| null | null |
package Excercise_3;
import java.util.Scanner;
/**
* Created by minht on 4/24/2017.
*/
public class Ex2
{
public static void main(String[] args) {
findName("thuc");
// String[] hoVaTen = "truong minh thuc".split(" ");
// System.out.println(hoVaTen.length);
// System.out.println(hoVaTen[hoVaTen.length-1]);
// System.out.println("thuc".equals(hoVaTen[hoVaTen.length-1]));
}
private static String[] NameInitial(int number){
String[] name = new String[number];
Scanner scanner = new Scanner(System.in);
for (int i=0;i<number;i++){
name[i] = scanner.nextLine();
}
return name;
}
private static boolean CheckName(String sample,String name){
String[] hoVaTen = sample.trim().split(" ");
if (name.equals(hoVaTen[hoVaTen.length-1])){
return true;
}else return false;
}
private static void findName(String name){
String[] sample = NameInitial(3);
StringBuilder stringBuilder = new StringBuilder();
for (String a:sample) {
if (CheckName(a,name)){
stringBuilder.append(a+"\n");
}
}
if (stringBuilder.length()!=0){
System.out.println(stringBuilder.toString());
}else System.out.println("ban da nhap sai ten");
}
}
|
UTF-8
|
Java
| 1,363 |
java
|
Ex2.java
|
Java
|
[
{
"context": "e_3;\n\nimport java.util.Scanner;\n\n/**\n * Created by minht on 4/24/2017.\n */\npublic class Ex2\n{\n public s",
"end": 72,
"score": 0.9995680451393127,
"start": 67,
"tag": "USERNAME",
"value": "minht"
}
] | null |
[] |
package Excercise_3;
import java.util.Scanner;
/**
* Created by minht on 4/24/2017.
*/
public class Ex2
{
public static void main(String[] args) {
findName("thuc");
// String[] hoVaTen = "truong minh thuc".split(" ");
// System.out.println(hoVaTen.length);
// System.out.println(hoVaTen[hoVaTen.length-1]);
// System.out.println("thuc".equals(hoVaTen[hoVaTen.length-1]));
}
private static String[] NameInitial(int number){
String[] name = new String[number];
Scanner scanner = new Scanner(System.in);
for (int i=0;i<number;i++){
name[i] = scanner.nextLine();
}
return name;
}
private static boolean CheckName(String sample,String name){
String[] hoVaTen = sample.trim().split(" ");
if (name.equals(hoVaTen[hoVaTen.length-1])){
return true;
}else return false;
}
private static void findName(String name){
String[] sample = NameInitial(3);
StringBuilder stringBuilder = new StringBuilder();
for (String a:sample) {
if (CheckName(a,name)){
stringBuilder.append(a+"\n");
}
}
if (stringBuilder.length()!=0){
System.out.println(stringBuilder.toString());
}else System.out.println("ban da nhap sai ten");
}
}
| 1,363 | 0.57887 | 0.567865 | 43 | 30.697674 | 20.960135 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534884 | false | false |
7
|
4b54f7f7c0a35cac36c9e7d2ca43b7edb1d4be06
| 3,813,930,992,280 |
5397f01da5c89742c9c3ffabbfcde3c1b11bf0f6
|
/src/main/java/hu/inf/unideb/fridges/smartfridge/repository/ConversionsRepository.java
|
26cfbfb1a331a506ee1a21e83e03fc2af25bf0b1
|
[
"MIT"
] |
permissive
|
Csszabi98/Smartfridge
|
https://github.com/Csszabi98/Smartfridge
|
7541ba1f94a00722bb19c439dd83b0b81f6d013a
|
35f6c742de01d09fe2f29416bf288a57a6ebab84
|
refs/heads/master
| 2020-03-30T00:48:12.534000 | 2018-12-17T20:00:55 | 2018-12-17T20:00:55 | 150,544,851 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package hu.inf.unideb.fridges.smartfridge.repository;
import hu.inf.unideb.fridges.smartfridge.model.Conversions;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ConversionsRepository extends JpaRepository<Conversions, Long> {
Conversions findByWhatToConvert(String whatToConvert);
Conversions findByInDkg(double inDkg);
}
|
UTF-8
|
Java
| 426 |
java
|
ConversionsRepository.java
|
Java
|
[] | null |
[] |
package hu.inf.unideb.fridges.smartfridge.repository;
import hu.inf.unideb.fridges.smartfridge.model.Conversions;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ConversionsRepository extends JpaRepository<Conversions, Long> {
Conversions findByWhatToConvert(String whatToConvert);
Conversions findByInDkg(double inDkg);
}
| 426 | 0.840376 | 0.840376 | 11 | 37.727272 | 27.905981 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false |
7
|
2634dae0adee333756d7cd9e227a1fc6637bc271
| 17,626,545,848,657 |
8c6fb446fa580677a7933a3f729f3469394f23a0
|
/spring-api-reactor/src/main/java/com/udemy/springboot/api/rest/reactor/app/model/database/BrandDao.java
|
d0ac80a21f16c1557ea37f9d6d63c90fd28f0bca
|
[] |
no_license
|
JohnDuq/reactiveTraining
|
https://github.com/JohnDuq/reactiveTraining
|
eec855a320defba63749732944dccae09d774207
|
7ba7ac81c4f45bc3e97044303fed7bddda8cc4e8
|
refs/heads/master
| 2023-02-10T03:39:31.181000 | 2021-01-07T15:58:28 | 2021-01-07T15:58:28 | 326,244,428 | 0 | 0 | null | false | 2021-01-07T13:04:27 | 2021-01-02T18:19:16 | 2021-01-06T20:17:08 | 2021-01-07T13:04:26 | 144 | 0 | 0 | 0 |
Java
| false | false |
package com.udemy.springboot.api.rest.reactor.app.model.database;
import com.udemy.springboot.api.rest.reactor.app.model.documents.Brand;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import reactor.core.publisher.Mono;
public interface BrandDao extends ReactiveMongoRepository<Brand, String> {
public Mono<Brand> findByName(String name);
}
|
UTF-8
|
Java
| 381 |
java
|
BrandDao.java
|
Java
|
[] | null |
[] |
package com.udemy.springboot.api.rest.reactor.app.model.database;
import com.udemy.springboot.api.rest.reactor.app.model.documents.Brand;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import reactor.core.publisher.Mono;
public interface BrandDao extends ReactiveMongoRepository<Brand, String> {
public Mono<Brand> findByName(String name);
}
| 381 | 0.818898 | 0.818898 | 13 | 28.307692 | 32.087345 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false |
7
|
85e79cf882c5c2e7adc4f15135ae82dd1b724dd4
| 31,396,210,952,392 |
5f5b134f19a2186a21eb45cd80303b6d126e2abb
|
/src/jspbean/struts/Datepicker.java
|
7494c5abc03f3affa51249ee5d70e40db0d558ba
|
[] |
no_license
|
gromanc/jspbean
|
https://github.com/gromanc/jspbean
|
ace0a698adcd9c4b16055e91b13f31911a7ea9ca
|
1df3d33bd4bebe05c4ea7a65885153ddd3ff5015
|
refs/heads/master
| 2020-03-14T07:39:52.547000 | 2018-04-29T16:08:38 | 2018-04-29T16:08:38 | 131,508,990 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package jspbean.struts;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.Date;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import com.opensymphony.xwork2.ActionSupport;
public class Datepicker extends ActionSupport {
private static final long serialVersionUID = 7641453994518254115L;
private Date dateValue;
private Date nameValue;
private Date minValue;
private Date maxValue;
private Date date0;
public Date getDateValue()
{
return dateValue;
}
public Date getNameValue()
{
return nameValue;
}
public Date getMinValue()
{
return minValue;
}
public Date getMaxValue()
{
return maxValue;
}
public Date getDate0() {
return date0;
}
public void setDate0(Date date0) {
this.date0 = date0;
}
@Action(value = "datepicker", results = {
@Result(location = "/datepicker.jsp", name = "success")
}, interceptorRefs = {@InterceptorRef("token"), @InterceptorRef("defaultStack")})
public String execute() throws Exception
{
Calendar c = Calendar.getInstance();
c.roll(Calendar.WEEK_OF_YEAR, -1);
dateValue = c.getTime();
c.roll(Calendar.MONTH, -1);
nameValue = c.getTime();
c.setTime(new Date());
c.roll(Calendar.MONTH, -1);
minValue = c.getTime();
c.roll(Calendar.MONTH, 2);
maxValue = c.getTime();
return SUCCESS;
}
@Action(value="savepicker", results = {
@Result(name="input", location = "/detepicker.jsp"),
@Result(name="success", type="redirectAction", location = "datepicker")
},interceptorRefs = @InterceptorRef(value="appDefaultStack", params = {"validation.validateAnnotatedMethodOnly", "true"}))
public String save() throws SQLException {
return SUCCESS;
}
}
|
UTF-8
|
Java
| 2,011 |
java
|
Datepicker.java
|
Java
|
[] | null |
[] |
package jspbean.struts;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.Date;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import com.opensymphony.xwork2.ActionSupport;
public class Datepicker extends ActionSupport {
private static final long serialVersionUID = 7641453994518254115L;
private Date dateValue;
private Date nameValue;
private Date minValue;
private Date maxValue;
private Date date0;
public Date getDateValue()
{
return dateValue;
}
public Date getNameValue()
{
return nameValue;
}
public Date getMinValue()
{
return minValue;
}
public Date getMaxValue()
{
return maxValue;
}
public Date getDate0() {
return date0;
}
public void setDate0(Date date0) {
this.date0 = date0;
}
@Action(value = "datepicker", results = {
@Result(location = "/datepicker.jsp", name = "success")
}, interceptorRefs = {@InterceptorRef("token"), @InterceptorRef("defaultStack")})
public String execute() throws Exception
{
Calendar c = Calendar.getInstance();
c.roll(Calendar.WEEK_OF_YEAR, -1);
dateValue = c.getTime();
c.roll(Calendar.MONTH, -1);
nameValue = c.getTime();
c.setTime(new Date());
c.roll(Calendar.MONTH, -1);
minValue = c.getTime();
c.roll(Calendar.MONTH, 2);
maxValue = c.getTime();
return SUCCESS;
}
@Action(value="savepicker", results = {
@Result(name="input", location = "/detepicker.jsp"),
@Result(name="success", type="redirectAction", location = "datepicker")
},interceptorRefs = @InterceptorRef(value="appDefaultStack", params = {"validation.validateAnnotatedMethodOnly", "true"}))
public String save() throws SQLException {
return SUCCESS;
}
}
| 2,011 | 0.677275 | 0.659871 | 87 | 22.114943 | 23.762922 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.563218 | false | false |
7
|
48ba7db12e7de79c6303746c1fe27c560b86e88e
| 31,361,851,196,802 |
5da1723afb3bc462c4818ddb5db61883e5caca63
|
/src/com/texnedo/DiameterOfTree.java
|
d94186d1c2ce122ffd04acd3121db7c46bbc45e0
|
[] |
no_license
|
texnedo/algo-tasks
|
https://github.com/texnedo/algo-tasks
|
2e417036ce7114244d3deeb3f60a46dba4ceb228
|
8fb90a6589ce1a8ad0cda09dbaf7c1ac143d356f
|
refs/heads/master
| 2022-12-11T07:47:07.214000 | 2022-12-04T23:19:19 | 2022-12-04T23:19:19 | 189,897,415 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.texnedo;
import com.texnedo.utils.TreeNode;
public class DiameterOfTree {
public static void main(String[] args) {
DiameterOfTree tree = new DiameterOfTree();
Integer[] data = {1,2,3,4,5};
System.out.println(tree.diameterOfBinaryTree(TreeNode.parse(data)));
Integer[] data1 = {4,2,null,1,3};
System.out.println(tree.diameterOfBinaryTree(TreeNode.parse(data1)));
}
public int diameterOfBinaryTree(TreeNode root) {
if (root == null) {
return 0;
}
if (root.right == null && root.left == null) {
return 0;
}
int maxDiameterCurrent = getMaxDepth(root.left) + getMaxDepth(root.right);
int leftDiameter = diameterOfBinaryTree(root.left);
int rightDiameter = diameterOfBinaryTree(root.right);
return Math.max(maxDiameterCurrent, Math.max(leftDiameter, rightDiameter));
}
private int getMaxDepth(TreeNode root) {
if (root == null) {
return 0;
}
int left = getMaxDepth(root.left);
int right = getMaxDepth(root.right);
return Math.max(left, right) + 1;
}
}
|
UTF-8
|
Java
| 1,166 |
java
|
DiameterOfTree.java
|
Java
|
[] | null |
[] |
package com.texnedo;
import com.texnedo.utils.TreeNode;
public class DiameterOfTree {
public static void main(String[] args) {
DiameterOfTree tree = new DiameterOfTree();
Integer[] data = {1,2,3,4,5};
System.out.println(tree.diameterOfBinaryTree(TreeNode.parse(data)));
Integer[] data1 = {4,2,null,1,3};
System.out.println(tree.diameterOfBinaryTree(TreeNode.parse(data1)));
}
public int diameterOfBinaryTree(TreeNode root) {
if (root == null) {
return 0;
}
if (root.right == null && root.left == null) {
return 0;
}
int maxDiameterCurrent = getMaxDepth(root.left) + getMaxDepth(root.right);
int leftDiameter = diameterOfBinaryTree(root.left);
int rightDiameter = diameterOfBinaryTree(root.right);
return Math.max(maxDiameterCurrent, Math.max(leftDiameter, rightDiameter));
}
private int getMaxDepth(TreeNode root) {
if (root == null) {
return 0;
}
int left = getMaxDepth(root.left);
int right = getMaxDepth(root.right);
return Math.max(left, right) + 1;
}
}
| 1,166 | 0.614923 | 0.602058 | 35 | 32.314285 | 25.067648 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false |
7
|
7063adb4a8b62aaa36c667c66893247bfe1acdd7
| 6,536,940,243,012 |
32ff598e4a68705d3c2cf9c4dd5525ea4b0497d7
|
/FatigoHDFS/src/es/cipf/hadoop/fatigo/hdfs/driver/FatigoHDFS.java
|
460868c9fa9af0eb0e514b4a200eac1aa6178ff1
|
[] |
no_license
|
alldaudinot/cipf
|
https://github.com/alldaudinot/cipf
|
10776bd0c8a184b2d0a5aa28e6f054209ae54cb9
|
78094caa76895780604e1128a0721d2466e4e589
|
refs/heads/master
| 2015-08-21T04:56:46.724000 | 2015-03-06T00:05:31 | 2015-03-06T00:05:31 | 31,743,323 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package es.cipf.hadoop.fatigo.hdfs.driver;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.hadoop.mapred.FileSplit;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.TextOutputFormat;
import org.apache.hadoop.mapred.JobClient;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.Reducer;
public class FatigoHDFS {
private static int fcount1 = 0;
private static int fcount2 = 0;
private static final Text fone = new Text("one");
private static final Text ftwo = new Text("two");
private static final Text f1 = new Text("1");
private static List<String> fcontext = new ArrayList<>();
public static int getCount1() {
return fcount1;
}
public static int getCount2() {
return fcount2;
}
public List<String> getContext() {
return fcontext;
}
public static void updateCount1() {
fcount1 += 1;
}
public static void updateCount2() {
fcount2 += 1;
}
public static void addContext(String acontext) {
fcontext.add(acontext);
}
// mapperIn
public static class FatigoMapperGenes extends MapReduceBase
implements Mapper<Object, Text, Text, Text> {
private Text fgene = new Text();
private Text fanno = new Text();
@Override
public void map(Object key, Text value,
OutputCollector<Text, Text> output,
Reporter reporter) throws IOException {
// files
FileSplit fs = (FileSplit) reporter.getInputSplit();
String fn = fs.getPath().toString();
// reading
if (fn.contains("genes1")) {
String[] alines = value.toString().split("\n");
for (String aline : alines) {
String[] acontent = aline.split("\t"); // gene + annot
if ((acontent != null) && (acontent.length == 1)) {
this.fgene.set(acontent[0].trim());
output.collect(this.fgene, fone);
updateCount1();
}
}
} else if (fn.contains("genes2")) {
String[] alines = value.toString().split("\n");
for (String aline : alines) {
String[] acontent = aline.split("\t"); // gene + annot
if ((acontent != null) && (acontent.length == 1)) {
this.fgene.set(acontent[0].trim());
output.collect(this.fgene, ftwo);
updateCount2();
}
}
} else {
String[] alines = value.toString().split("\n");
for (String aline : alines) {
String[] acontent = aline.split("\t"); // gene + annot
if ((acontent != null) && (acontent.length > 1)) {
this.fgene.set(acontent[0].trim());
this.fanno.set(acontent[1].trim());
output.collect(this.fgene, this.fanno);
}
}
}
}
}
// reducerIn
public static class FatigoReducerGenes extends MapReduceBase
implements Reducer<Text, Text, Text, Text> {
private Text fkey = new Text();
@Override
public void reduce(Text gene, Iterator<Text> annots,
OutputCollector<Text, Text> output,
Reporter reporter) throws IOException {
List<String> aannots = new ArrayList<String>();
while (annots.hasNext()) {
aannots.add(annots.next().toString().trim());
}
String aannot1 = fone.toString().trim();
String aannot2 = ftwo.toString().trim();
if (aannots.contains(aannot1)) {
for (int i = 0; i < aannots.size(); i++) {
if (!aannots.get(i).equals(aannot1)) {
this.fkey.set("1 " + aannots.get(i));
output.collect(this.fkey, f1);
}
}
} else if (aannots.contains(aannot2)) {
for (int i = 0; i < aannots.size(); i++) {
if (!aannots.get(i).equals(aannot2)) {
this.fkey.set("2 " + aannots.get(i));
output.collect(this.fkey, f1);
}
}
}
}
}
// mapperOut
public static class FatigoMapperAnnots extends MapReduceBase
implements Mapper<Object, Text, Text, Text> {
private Text fkey = new Text();
@Override
public void map(Object key, Text value,
OutputCollector<Text, Text> output,
Reporter reporter) throws IOException {
String[] alines = value.toString().split("\n");
for (String aline : alines) {
String[] acontent1 = aline.split("\t"); // annot
this.fkey.set(acontent1[0].trim() + "\t" + acontent1[1].trim());
output.collect(this.fkey, f1);
}
}
}
// reducerOut
public static class FatigoReducerAnnots extends MapReduceBase
implements Reducer<Text, Text, Text, Text> {
@Override
public void reduce(Text annot, Iterator<Text> values,
OutputCollector<Text, Text> output,
Reporter reporter) throws IOException {
int sum = 0;
while (values.hasNext()) {
values.next();
sum += 1;
}
if (annot.toString().charAt(0) == '1') {
double div = (double) sum / (double) getCount1();
output.collect(annot, new Text(String.valueOf(div)));
addContext(annot.toString() + "\t" + String.valueOf(div));
} else if (annot.toString().charAt(0) == '2') {
double div = (double) sum / (double) getCount2();
output.collect(annot, new Text(String.valueOf(div)));
addContext(annot.toString() + "\t" + String.valueOf(div));
}
}
}
public static void main(String[] args) throws IOException,
InterruptedException, ClassNotFoundException {
// First Job
JobConf jc1 = new JobConf(FatigoHDFS.class);
jc1.setJobName("Genes-Annots");
jc1.setOutputKeyClass(Text.class);
jc1.setOutputValueClass(Text.class);
jc1.setMapperClass(FatigoMapperGenes.class);
jc1.setReducerClass(FatigoReducerGenes.class);
jc1.setInputFormat(TextInputFormat.class);
jc1.setOutputFormat(TextOutputFormat.class);
Path ingenes1 = new Path(args[0]);
Path ingenes2 = new Path(args[1]);
Path inannots = new Path(args[2]);
Path outresult1 = new Path(args[3]);
FileInputFormat.setInputPaths(jc1, ingenes1, ingenes2, inannots);
FileOutputFormat.setOutputPath(jc1, outresult1);
FileSystem hdfs1 = FileSystem.get(jc1);
if (hdfs1.exists(outresult1)) {
hdfs1.delete(outresult1, true);
}
// First Job Execution
JobClient.runJob(jc1);
// Second Job
JobConf jc2 = new JobConf(FatigoHDFS.class);
jc2.setJobName("Annots-Count");
jc2.setOutputKeyClass(Text.class);
jc2.setOutputValueClass(Text.class);
jc2.setMapperClass(FatigoMapperAnnots.class);
jc2.setReducerClass(FatigoReducerAnnots.class);
jc2.setInputFormat(TextInputFormat.class);
jc2.setOutputFormat(TextOutputFormat.class);
String inputfn = args[3];
if (inputfn.endsWith("/")) {
inputfn.concat("part-00000");
} else {
inputfn.concat("/part-00000");
}
Path inresult1 = new Path(inputfn);
FileInputFormat.setInputPaths(jc2, inresult1);
Path outresult2 = new Path(args[4]);
FileOutputFormat.setOutputPath(jc2, outresult2);
FileSystem hdfs2 = FileSystem.get(jc2);
if (hdfs2.exists(outresult2)) {
hdfs2.delete(outresult2, true);
}
// Second Job Execution
JobClient.runJob(jc2);
}
}
|
UTF-8
|
Java
| 7,189 |
java
|
FatigoHDFS.java
|
Java
|
[] | null |
[] |
package es.cipf.hadoop.fatigo.hdfs.driver;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.hadoop.mapred.FileSplit;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.TextOutputFormat;
import org.apache.hadoop.mapred.JobClient;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.Reducer;
public class FatigoHDFS {
private static int fcount1 = 0;
private static int fcount2 = 0;
private static final Text fone = new Text("one");
private static final Text ftwo = new Text("two");
private static final Text f1 = new Text("1");
private static List<String> fcontext = new ArrayList<>();
public static int getCount1() {
return fcount1;
}
public static int getCount2() {
return fcount2;
}
public List<String> getContext() {
return fcontext;
}
public static void updateCount1() {
fcount1 += 1;
}
public static void updateCount2() {
fcount2 += 1;
}
public static void addContext(String acontext) {
fcontext.add(acontext);
}
// mapperIn
public static class FatigoMapperGenes extends MapReduceBase
implements Mapper<Object, Text, Text, Text> {
private Text fgene = new Text();
private Text fanno = new Text();
@Override
public void map(Object key, Text value,
OutputCollector<Text, Text> output,
Reporter reporter) throws IOException {
// files
FileSplit fs = (FileSplit) reporter.getInputSplit();
String fn = fs.getPath().toString();
// reading
if (fn.contains("genes1")) {
String[] alines = value.toString().split("\n");
for (String aline : alines) {
String[] acontent = aline.split("\t"); // gene + annot
if ((acontent != null) && (acontent.length == 1)) {
this.fgene.set(acontent[0].trim());
output.collect(this.fgene, fone);
updateCount1();
}
}
} else if (fn.contains("genes2")) {
String[] alines = value.toString().split("\n");
for (String aline : alines) {
String[] acontent = aline.split("\t"); // gene + annot
if ((acontent != null) && (acontent.length == 1)) {
this.fgene.set(acontent[0].trim());
output.collect(this.fgene, ftwo);
updateCount2();
}
}
} else {
String[] alines = value.toString().split("\n");
for (String aline : alines) {
String[] acontent = aline.split("\t"); // gene + annot
if ((acontent != null) && (acontent.length > 1)) {
this.fgene.set(acontent[0].trim());
this.fanno.set(acontent[1].trim());
output.collect(this.fgene, this.fanno);
}
}
}
}
}
// reducerIn
public static class FatigoReducerGenes extends MapReduceBase
implements Reducer<Text, Text, Text, Text> {
private Text fkey = new Text();
@Override
public void reduce(Text gene, Iterator<Text> annots,
OutputCollector<Text, Text> output,
Reporter reporter) throws IOException {
List<String> aannots = new ArrayList<String>();
while (annots.hasNext()) {
aannots.add(annots.next().toString().trim());
}
String aannot1 = fone.toString().trim();
String aannot2 = ftwo.toString().trim();
if (aannots.contains(aannot1)) {
for (int i = 0; i < aannots.size(); i++) {
if (!aannots.get(i).equals(aannot1)) {
this.fkey.set("1 " + aannots.get(i));
output.collect(this.fkey, f1);
}
}
} else if (aannots.contains(aannot2)) {
for (int i = 0; i < aannots.size(); i++) {
if (!aannots.get(i).equals(aannot2)) {
this.fkey.set("2 " + aannots.get(i));
output.collect(this.fkey, f1);
}
}
}
}
}
// mapperOut
public static class FatigoMapperAnnots extends MapReduceBase
implements Mapper<Object, Text, Text, Text> {
private Text fkey = new Text();
@Override
public void map(Object key, Text value,
OutputCollector<Text, Text> output,
Reporter reporter) throws IOException {
String[] alines = value.toString().split("\n");
for (String aline : alines) {
String[] acontent1 = aline.split("\t"); // annot
this.fkey.set(acontent1[0].trim() + "\t" + acontent1[1].trim());
output.collect(this.fkey, f1);
}
}
}
// reducerOut
public static class FatigoReducerAnnots extends MapReduceBase
implements Reducer<Text, Text, Text, Text> {
@Override
public void reduce(Text annot, Iterator<Text> values,
OutputCollector<Text, Text> output,
Reporter reporter) throws IOException {
int sum = 0;
while (values.hasNext()) {
values.next();
sum += 1;
}
if (annot.toString().charAt(0) == '1') {
double div = (double) sum / (double) getCount1();
output.collect(annot, new Text(String.valueOf(div)));
addContext(annot.toString() + "\t" + String.valueOf(div));
} else if (annot.toString().charAt(0) == '2') {
double div = (double) sum / (double) getCount2();
output.collect(annot, new Text(String.valueOf(div)));
addContext(annot.toString() + "\t" + String.valueOf(div));
}
}
}
public static void main(String[] args) throws IOException,
InterruptedException, ClassNotFoundException {
// First Job
JobConf jc1 = new JobConf(FatigoHDFS.class);
jc1.setJobName("Genes-Annots");
jc1.setOutputKeyClass(Text.class);
jc1.setOutputValueClass(Text.class);
jc1.setMapperClass(FatigoMapperGenes.class);
jc1.setReducerClass(FatigoReducerGenes.class);
jc1.setInputFormat(TextInputFormat.class);
jc1.setOutputFormat(TextOutputFormat.class);
Path ingenes1 = new Path(args[0]);
Path ingenes2 = new Path(args[1]);
Path inannots = new Path(args[2]);
Path outresult1 = new Path(args[3]);
FileInputFormat.setInputPaths(jc1, ingenes1, ingenes2, inannots);
FileOutputFormat.setOutputPath(jc1, outresult1);
FileSystem hdfs1 = FileSystem.get(jc1);
if (hdfs1.exists(outresult1)) {
hdfs1.delete(outresult1, true);
}
// First Job Execution
JobClient.runJob(jc1);
// Second Job
JobConf jc2 = new JobConf(FatigoHDFS.class);
jc2.setJobName("Annots-Count");
jc2.setOutputKeyClass(Text.class);
jc2.setOutputValueClass(Text.class);
jc2.setMapperClass(FatigoMapperAnnots.class);
jc2.setReducerClass(FatigoReducerAnnots.class);
jc2.setInputFormat(TextInputFormat.class);
jc2.setOutputFormat(TextOutputFormat.class);
String inputfn = args[3];
if (inputfn.endsWith("/")) {
inputfn.concat("part-00000");
} else {
inputfn.concat("/part-00000");
}
Path inresult1 = new Path(inputfn);
FileInputFormat.setInputPaths(jc2, inresult1);
Path outresult2 = new Path(args[4]);
FileOutputFormat.setOutputPath(jc2, outresult2);
FileSystem hdfs2 = FileSystem.get(jc2);
if (hdfs2.exists(outresult2)) {
hdfs2.delete(outresult2, true);
}
// Second Job Execution
JobClient.runJob(jc2);
}
}
| 7,189 | 0.674642 | 0.658923 | 258 | 26.864342 | 20.442608 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.767442 | false | false |
7
|
f16dea1ed6201c0e1c6bbf89e77dac3b5ab55558
| 6,536,940,245,417 |
12ee3b337c847d84863492dd022b1d72fa042927
|
/src/niit/edu/cn/java10/SavingsAccount.java
|
87174ca20acde51c0078ffe80d9ac4038150680e
|
[] |
no_license
|
ZhangGHGitHub/JAVA_Object_Oriented_Programming_Course
|
https://github.com/ZhangGHGitHub/JAVA_Object_Oriented_Programming_Course
|
1471c2f3fc9521c0a3dcfbadb347584d8ebeb660
|
ed5df4bf8eff5d8e218defb79748dda75facaf2d
|
refs/heads/master
| 2023-01-27T18:04:13.200000 | 2020-12-08T12:30:31 | 2020-12-08T12:30:31 | 319,613,626 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package niit.edu.cn.java10;
import java.util.Date;
/**
* @author: 张国豪
* @date: 2020/10/27 22:42
* FileName: SavingsAccount
* @version: 1.0
* Description: 存储账户
*/
public class SavingsAccount extends AccountBank{
public SavingsAccount(int id , double balance)
{
super(id,balance);
}
@Override
public String toString() {
return "储蓄账户:{"+super.toString()+"}";
}
public static void main(String[] args) {
SavingsAccount acc = new SavingsAccount(1122, 20000);
acc.setAnnuallnterstRate(4.5);
Date D=new Date(2020-1900, 10-1, 7);
acc.setDateCreated(D);
acc.deposit(1000000);
System.out.println(acc.toString());
}
}
|
UTF-8
|
Java
| 736 |
java
|
SavingsAccount.java
|
Java
|
[
{
"context": ".java10;\n\nimport java.util.Date;\n\n/**\n * @author: 张国豪\n * @date: 2020/10/27 22:42\n * FileName: SavingsAc",
"end": 72,
"score": 0.999859631061554,
"start": 69,
"tag": "NAME",
"value": "张国豪"
}
] | null |
[] |
package niit.edu.cn.java10;
import java.util.Date;
/**
* @author: 张国豪
* @date: 2020/10/27 22:42
* FileName: SavingsAccount
* @version: 1.0
* Description: 存储账户
*/
public class SavingsAccount extends AccountBank{
public SavingsAccount(int id , double balance)
{
super(id,balance);
}
@Override
public String toString() {
return "储蓄账户:{"+super.toString()+"}";
}
public static void main(String[] args) {
SavingsAccount acc = new SavingsAccount(1122, 20000);
acc.setAnnuallnterstRate(4.5);
Date D=new Date(2020-1900, 10-1, 7);
acc.setDateCreated(D);
acc.deposit(1000000);
System.out.println(acc.toString());
}
}
| 736 | 0.619382 | 0.554775 | 31 | 21.967741 | 17.833429 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.483871 | false | false |
7
|
e7ad862a826ba0265f98623a4f839f5a9391b0ee
| 31,585,189,540,858 |
5eb7e1e2637d3b5844857958dbe5084ca33d7156
|
/app/src/main/java/com/codeian/employeeattendance/EmployeeDetailFragment.java
|
c69e8588654c5d6c501203429ba96eeaea7ba9e9
|
[] |
no_license
|
developercons/EmployeeAttendance-1
|
https://github.com/developercons/EmployeeAttendance-1
|
93ebdda349277f51447d7923c67cf96a582ee64a
|
b5f8ea72a6b20379b5b72fad44661885947dbe9b
|
refs/heads/master
| 2020-03-29T01:16:29.168000 | 2018-08-09T13:29:26 | 2018-08-09T13:29:26 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.codeian.employeeattendance;
import android.app.Activity;
import android.support.design.widget.CollapsingToolbarLayout;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.error.VolleyError;
import com.android.volley.request.StringRequest;
import com.codeian.employeeattendance.Helpers.Settings;
import com.codeian.employeeattendance.Model.EmployeeList;
import com.codeian.employeeattendance.Network.NetworkManager;
import com.codeian.employeeattendance.dummy.DummyContent;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Array;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/**
* A fragment representing a single Employee detail screen.
* This fragment is either contained in a {@link EmployeeListActivity}
* in two-pane mode (on tablets) or a {@link EmployeeDetailActivity}
* on handsets.
*/
public class EmployeeDetailFragment extends Fragment {
/**
* The fragment argument representing the item ID that this fragment
* represents.
*/
public static final String ARG_ITEM_ID = "item_id";
public static final String ARG_USER_NAME ="user_name";
public static final String ARG_USER_EMAIL = "user_email";
String getArgUserName,getArgUserEmail;
/**
* The dummy content this fragment is presenting.
*/
private DummyContent.DummyItem mItem;
private List<EmployeeList> mValues;
// private String apiBase = Settings.INSTANCE.getApiUrl();
private String apiBase = "http://bvigrimscloud.com/employee-attendance/public/api";
String fpData,nfcData,uID;
/**
* Mandatory empty constructor for the fragment manager to instantiate the
* fragment (e.g. upon screen orientation changes).
*/
public EmployeeDetailFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments().containsKey(ARG_ITEM_ID)) {
// Load the dummy content specified by the fragment
// arguments. In a real-world scenario, use a Loader
// to load content from a content provider.
uID = getArguments().getString(ARG_ITEM_ID);
getArgUserName = getArguments().getString(ARG_USER_NAME);
getArgUserEmail = getArguments().getString(ARG_USER_EMAIL);
String getPosition = getArguments().getString(ARG_ITEM_ID);
int position = Integer.parseInt(getPosition);
//mValues = new ArrayList<>();
//EmployeeList singleEmployee;
Log.e("ID", Integer.toString(position));
setHistoryDate();
getUserData();
// singleEmployee = mValues.get(position);
//
// Activity activity = this.getActivity();
// CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout);
// if (appBarLayout != null) {
// appBarLayout.setTitle(singleEmployee.getName());
// }
}
}
public void setHistoryDate(){
//WeekDay
Calendar sCalendar = Calendar.getInstance();
String weekDay = sCalendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault());
//Today Date
Date c = Calendar.getInstance().getTime();
// System.out.println("Current time => " + c);
SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy", Locale.getDefault());
String todayDate = df.format(c);
}
public void getUserData(){
// Initialize a new StringRequest
String mUrlString = apiBase+"/user/"+uID;
StringRequest stringRequest = new StringRequest(
Request.Method.GET,
mUrlString,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
//TODO Parse JSON AND SHOW DATA TO USER CARD.
// Do something with response string
try {
JSONObject respond = new JSONObject(response);
String isSuccess = respond.getString("success");
if(isSuccess.equals("true")){
JSONObject jObject = respond.getJSONObject("userInfo");
JSONObject jObjectUser = jObject.getJSONObject("user");
JSONArray userHistoryArray = jObject.getJSONArray("user_history");
JSONObject userHistory = userHistoryArray.getJSONObject(0);
//Log.e("USER HISTORY",Integer.toString(userHistory.length()));
if(userHistory.length() > 0 ){
String userActivityHistory = userHistory.toString();
Log.e("USER HISTORY",userActivityHistory);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
Log.e("UserDATA",response);
//mTextView.setText(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Do something when get error
//Snackbar.make(mCLayout,"Error...",Snackbar.LENGTH_LONG).show();
}
}
);
stringRequest.setShouldCache(false);
// Add StringRequest to the RequestQueue
NetworkManager.getInstance(getContext()).addToRequestQueue(stringRequest);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.employee_detail, container, false);
((TextView) rootView.findViewById(R.id.userName)).setText(getArgUserName);
((TextView) rootView.findViewById(R.id.userEmail)).setText(getArgUserEmail);
return rootView;
}
}
|
UTF-8
|
Java
| 6,711 |
java
|
EmployeeDetailFragment.java
|
Java
|
[
{
"context": "\";\n public static final String ARG_USER_NAME =\"user_name\";\n public static final String ARG_USER_EMAIL =",
"end": 1576,
"score": 0.9966945648193359,
"start": 1567,
"tag": "USERNAME",
"value": "user_name"
}
] | null |
[] |
package com.codeian.employeeattendance;
import android.app.Activity;
import android.support.design.widget.CollapsingToolbarLayout;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.error.VolleyError;
import com.android.volley.request.StringRequest;
import com.codeian.employeeattendance.Helpers.Settings;
import com.codeian.employeeattendance.Model.EmployeeList;
import com.codeian.employeeattendance.Network.NetworkManager;
import com.codeian.employeeattendance.dummy.DummyContent;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Array;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/**
* A fragment representing a single Employee detail screen.
* This fragment is either contained in a {@link EmployeeListActivity}
* in two-pane mode (on tablets) or a {@link EmployeeDetailActivity}
* on handsets.
*/
public class EmployeeDetailFragment extends Fragment {
/**
* The fragment argument representing the item ID that this fragment
* represents.
*/
public static final String ARG_ITEM_ID = "item_id";
public static final String ARG_USER_NAME ="user_name";
public static final String ARG_USER_EMAIL = "user_email";
String getArgUserName,getArgUserEmail;
/**
* The dummy content this fragment is presenting.
*/
private DummyContent.DummyItem mItem;
private List<EmployeeList> mValues;
// private String apiBase = Settings.INSTANCE.getApiUrl();
private String apiBase = "http://bvigrimscloud.com/employee-attendance/public/api";
String fpData,nfcData,uID;
/**
* Mandatory empty constructor for the fragment manager to instantiate the
* fragment (e.g. upon screen orientation changes).
*/
public EmployeeDetailFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments().containsKey(ARG_ITEM_ID)) {
// Load the dummy content specified by the fragment
// arguments. In a real-world scenario, use a Loader
// to load content from a content provider.
uID = getArguments().getString(ARG_ITEM_ID);
getArgUserName = getArguments().getString(ARG_USER_NAME);
getArgUserEmail = getArguments().getString(ARG_USER_EMAIL);
String getPosition = getArguments().getString(ARG_ITEM_ID);
int position = Integer.parseInt(getPosition);
//mValues = new ArrayList<>();
//EmployeeList singleEmployee;
Log.e("ID", Integer.toString(position));
setHistoryDate();
getUserData();
// singleEmployee = mValues.get(position);
//
// Activity activity = this.getActivity();
// CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout);
// if (appBarLayout != null) {
// appBarLayout.setTitle(singleEmployee.getName());
// }
}
}
public void setHistoryDate(){
//WeekDay
Calendar sCalendar = Calendar.getInstance();
String weekDay = sCalendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault());
//Today Date
Date c = Calendar.getInstance().getTime();
// System.out.println("Current time => " + c);
SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy", Locale.getDefault());
String todayDate = df.format(c);
}
public void getUserData(){
// Initialize a new StringRequest
String mUrlString = apiBase+"/user/"+uID;
StringRequest stringRequest = new StringRequest(
Request.Method.GET,
mUrlString,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
//TODO Parse JSON AND SHOW DATA TO USER CARD.
// Do something with response string
try {
JSONObject respond = new JSONObject(response);
String isSuccess = respond.getString("success");
if(isSuccess.equals("true")){
JSONObject jObject = respond.getJSONObject("userInfo");
JSONObject jObjectUser = jObject.getJSONObject("user");
JSONArray userHistoryArray = jObject.getJSONArray("user_history");
JSONObject userHistory = userHistoryArray.getJSONObject(0);
//Log.e("USER HISTORY",Integer.toString(userHistory.length()));
if(userHistory.length() > 0 ){
String userActivityHistory = userHistory.toString();
Log.e("USER HISTORY",userActivityHistory);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
Log.e("UserDATA",response);
//mTextView.setText(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Do something when get error
//Snackbar.make(mCLayout,"Error...",Snackbar.LENGTH_LONG).show();
}
}
);
stringRequest.setShouldCache(false);
// Add StringRequest to the RequestQueue
NetworkManager.getInstance(getContext()).addToRequestQueue(stringRequest);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.employee_detail, container, false);
((TextView) rootView.findViewById(R.id.userName)).setText(getArgUserName);
((TextView) rootView.findViewById(R.id.userEmail)).setText(getArgUserEmail);
return rootView;
}
}
| 6,711 | 0.614662 | 0.614066 | 175 | 37.348572 | 28.336321 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
7
|
2292ce3a9c6b0aa5feb808007883d7cd79e279f1
| 23,295,902,640,352 |
d750ab7e884c6fae89054ad12118bbb2073798ca
|
/src/open/OpenClient.java
|
6b9a9ea607e2c7c72eb89f4767a58086b5f4a3ad
|
[] |
no_license
|
gmendonca/distributed-hash-table
|
https://github.com/gmendonca/distributed-hash-table
|
1d46efa673bdf748bed8c1ed5c34d983a0397fea
|
a72371fa68f0c414dbf81f07e255fb43fea746ad
|
refs/heads/master
| 2021-01-10T10:53:51.729000 | 2015-12-01T03:50:41 | 2015-12-01T03:50:41 | 43,100,518 | 6 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package open;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;
import java.util.UUID;
import util.DistributedHashtable;
public class OpenClient extends Thread {
private int num;
public static ArrayList<Socket> socketList;
public OpenClient(int num, ArrayList<Socket> socketList) {
this.num = num;
OpenClient.socketList = socketList;
}
// put
public static Boolean put(String key, String value, int pId)
throws Exception {
if (key.length() > 24)
return false;
if (value.length() > 1000)
return false;
Socket socket = socketList.get(pId);
boolean ack;
synchronized(socket){
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
// put option
dOut.writeByte(0);
dOut.flush();
// key, value
dOut.writeUTF(key);
dOut.flush();
dOut.writeUTF(value);
dOut.flush();
DataInputStream dIn = new DataInputStream(socket.getInputStream());
ack = dIn.readBoolean();
}
return ack;
}
// get
public static String get(String key, int pId) throws IOException {
if (key.length() > 24)
return null;
Socket socket = socketList.get(pId);
String value;
synchronized(socket){
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
// get option
dOut.writeByte(1);
dOut.flush();
// key
dOut.writeUTF(key);
dOut.flush();
DataInputStream dIn = new DataInputStream(socket.getInputStream());
value = dIn.readUTF();
}
return value;
}
// delete
public static Boolean delete(String key, int pId) throws Exception {
if (key.length() > 24)
return false;
Socket socket = socketList.get(pId);
boolean ack;
synchronized(socket){
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
// put option
dOut.writeByte(2);
dOut.flush();
// key
dOut.writeUTF(key);
dOut.flush();
DataInputStream dIn = new DataInputStream(socket.getInputStream());
ack = dIn.readBoolean();
}
return ack;
}
public void run() {
long start, stop, time;
int pId;
String key;
//String value;
//boolean result;
start = time = System.currentTimeMillis();
for (int i = OpenBench.operations * (num + 1); i < OpenBench.operations
* (num + 2); i++) {
key = Integer.toString(i);
pId = DistributedHashtable.hash(key, OpenBench.numPeers);
try {
put(key, UUID.randomUUID().toString(), pId);
//result = put(key, UUID.randomUUID().toString(), pId);
//System.out.println("put " + i + " " + result);
} catch (Exception e) {
System.out
.println("Couldn't put the key-value pair in the system.");
}
}
stop = System.currentTimeMillis();
System.out.println("Client " + num + ": Running time to "
+ OpenBench.operations + " put operations: " + (stop - start)
+ "ms.");
start = System.currentTimeMillis();
for (int i = OpenBench.operations * (num + 1); i < OpenBench.operations
* (num + 2); i++) {
key = Integer.toString(i);
pId = DistributedHashtable.hash(key, OpenBench.numPeers);
try {
get(key, pId);
//value = get(key, pId);
//System.out.println(value);
} catch (Exception e) {
System.out
.println("Couldn't get the value pair from the system.");
}
}
stop = System.currentTimeMillis();
System.out.println("Client " + num + ": Running time to "
+ OpenBench.operations + " get operations: " + (stop - start)
+ "ms.");
start = System.currentTimeMillis();
for (int i = OpenBench.operations * (num + 1); i < OpenBench.operations
* (num + 2); i++) {
key = Integer.toString(i);
pId = DistributedHashtable.hash(key, OpenBench.numPeers);
try {
delete(key, pId);
//result = delete(key, pId);
//System.out.println("deleted " + i + " " + result);
} catch (Exception e) {
//e.printStackTrace();
System.out
.println("Couldn't delete the key-value pair in the system.");
}
}
stop = System.currentTimeMillis();
System.out.println("Client " + num + ": Running time to "
+ OpenBench.operations + " del operations: " + (stop - start)
+ "ms.");
System.out.println("Client " + num + ": Overall time: "
+ (System.currentTimeMillis() - time) + "ms.");
}
}
|
UTF-8
|
Java
| 4,303 |
java
|
OpenClient.java
|
Java
|
[
{
"context": "nBench.operations\n\t\t\t\t* (num + 2); i++) {\n\t\t\tkey = Integer.toString(i);\n\t\t\tpId = DistributedHashtable.hash(key, OpenBen",
"end": 2362,
"score": 0.9950753450393677,
"start": 2344,
"tag": "KEY",
"value": "Integer.toString(i"
},
{
"context": "nBench.operations\n\t\t\t\t* (num + 2); i++) {\n\t\t\tkey = Integer.toString(i);\n\t\t\tpId = DistributedHashtable.hash(key, OpenBen",
"end": 3059,
"score": 0.9924328923225403,
"start": 3041,
"tag": "KEY",
"value": "Integer.toString(i"
},
{
"context": "nBench.operations\n\t\t\t\t* (num + 2); i++) {\n\t\t\tkey = Integer.toString(i);\n\t\t\tpId = DistributedHashtable.hash(key, OpenBe",
"end": 3672,
"score": 0.9585784673690796,
"start": 3655,
"tag": "KEY",
"value": "Integer.toString("
}
] | null |
[] |
package open;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;
import java.util.UUID;
import util.DistributedHashtable;
public class OpenClient extends Thread {
private int num;
public static ArrayList<Socket> socketList;
public OpenClient(int num, ArrayList<Socket> socketList) {
this.num = num;
OpenClient.socketList = socketList;
}
// put
public static Boolean put(String key, String value, int pId)
throws Exception {
if (key.length() > 24)
return false;
if (value.length() > 1000)
return false;
Socket socket = socketList.get(pId);
boolean ack;
synchronized(socket){
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
// put option
dOut.writeByte(0);
dOut.flush();
// key, value
dOut.writeUTF(key);
dOut.flush();
dOut.writeUTF(value);
dOut.flush();
DataInputStream dIn = new DataInputStream(socket.getInputStream());
ack = dIn.readBoolean();
}
return ack;
}
// get
public static String get(String key, int pId) throws IOException {
if (key.length() > 24)
return null;
Socket socket = socketList.get(pId);
String value;
synchronized(socket){
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
// get option
dOut.writeByte(1);
dOut.flush();
// key
dOut.writeUTF(key);
dOut.flush();
DataInputStream dIn = new DataInputStream(socket.getInputStream());
value = dIn.readUTF();
}
return value;
}
// delete
public static Boolean delete(String key, int pId) throws Exception {
if (key.length() > 24)
return false;
Socket socket = socketList.get(pId);
boolean ack;
synchronized(socket){
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
// put option
dOut.writeByte(2);
dOut.flush();
// key
dOut.writeUTF(key);
dOut.flush();
DataInputStream dIn = new DataInputStream(socket.getInputStream());
ack = dIn.readBoolean();
}
return ack;
}
public void run() {
long start, stop, time;
int pId;
String key;
//String value;
//boolean result;
start = time = System.currentTimeMillis();
for (int i = OpenBench.operations * (num + 1); i < OpenBench.operations
* (num + 2); i++) {
key = Integer.toString(i);
pId = DistributedHashtable.hash(key, OpenBench.numPeers);
try {
put(key, UUID.randomUUID().toString(), pId);
//result = put(key, UUID.randomUUID().toString(), pId);
//System.out.println("put " + i + " " + result);
} catch (Exception e) {
System.out
.println("Couldn't put the key-value pair in the system.");
}
}
stop = System.currentTimeMillis();
System.out.println("Client " + num + ": Running time to "
+ OpenBench.operations + " put operations: " + (stop - start)
+ "ms.");
start = System.currentTimeMillis();
for (int i = OpenBench.operations * (num + 1); i < OpenBench.operations
* (num + 2); i++) {
key = Integer.toString(i);
pId = DistributedHashtable.hash(key, OpenBench.numPeers);
try {
get(key, pId);
//value = get(key, pId);
//System.out.println(value);
} catch (Exception e) {
System.out
.println("Couldn't get the value pair from the system.");
}
}
stop = System.currentTimeMillis();
System.out.println("Client " + num + ": Running time to "
+ OpenBench.operations + " get operations: " + (stop - start)
+ "ms.");
start = System.currentTimeMillis();
for (int i = OpenBench.operations * (num + 1); i < OpenBench.operations
* (num + 2); i++) {
key = Integer.toString(i);
pId = DistributedHashtable.hash(key, OpenBench.numPeers);
try {
delete(key, pId);
//result = delete(key, pId);
//System.out.println("deleted " + i + " " + result);
} catch (Exception e) {
//e.printStackTrace();
System.out
.println("Couldn't delete the key-value pair in the system.");
}
}
stop = System.currentTimeMillis();
System.out.println("Client " + num + ": Running time to "
+ OpenBench.operations + " del operations: " + (stop - start)
+ "ms.");
System.out.println("Client " + num + ": Overall time: "
+ (System.currentTimeMillis() - time) + "ms.");
}
}
| 4,303 | 0.643737 | 0.639321 | 184 | 22.38587 | 21.963606 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.570652 | false | false |
7
|
82262f1556b0ee707faa7d5c74bc28b882075d57
| 27,814,208,232,046 |
0242dc617980b5bb0ab1bd4d569d433ea43b03a5
|
/MeiRMW-master/app/src/main/java/com/heshicai/meirmw/activity/LoginSuccessActivity.java
|
4e820b5a3acaf4bf7b8fec1e950897f6b3fc8036
|
[] |
no_license
|
heshicaihao/MeiRMW
|
https://github.com/heshicaihao/MeiRMW
|
cf25297d13e59d7bc761c18aa0a4727029acd38a
|
ccedea0b92140a04c9fcf5d538ea82c3ace81365
|
refs/heads/master
| 2021-05-14T04:37:56.768000 | 2020-03-26T17:11:50 | 2020-03-26T17:11:50 | 116,646,940 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.heshicai.meirmw.activity;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.heshicai.meirmw.R;
public class LoginSuccessActivity extends Activity implements OnClickListener {
private TextView name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_success);
View btn1 = findViewById(R.id.btn1);
View btn2 = findViewById(R.id.btn2);
View btn3 = findViewById(R.id.btn3);
View btn4 = findViewById(R.id.btn4);
name = (TextView) findViewById(R.id.name);
View rebtn = findViewById(R.id.frg_homepage_header_left_btn);
useruID();
rebtn.setOnClickListener(this);
btn1.setOnClickListener(this);
btn2.setOnClickListener(this);
btn3.setOnClickListener(this);
btn4.setOnClickListener(this);
}
public void useruID() {
SharedPreferences sp = getSharedPreferences("weiboToken",
Context.MODE_PRIVATE);
String uid = sp.getString("uid", null);
name.setText(uid);
}
@Override
public void onClick(View v) {
int id = v.getId();
switch (id) {
case R.id.frg_homepage_header_left_btn:
finish();
break;
default:
break;
}
}
}
|
UTF-8
|
Java
| 1,355 |
java
|
LoginSuccessActivity.java
|
Java
|
[] | null |
[] |
package com.heshicai.meirmw.activity;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.heshicai.meirmw.R;
public class LoginSuccessActivity extends Activity implements OnClickListener {
private TextView name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_success);
View btn1 = findViewById(R.id.btn1);
View btn2 = findViewById(R.id.btn2);
View btn3 = findViewById(R.id.btn3);
View btn4 = findViewById(R.id.btn4);
name = (TextView) findViewById(R.id.name);
View rebtn = findViewById(R.id.frg_homepage_header_left_btn);
useruID();
rebtn.setOnClickListener(this);
btn1.setOnClickListener(this);
btn2.setOnClickListener(this);
btn3.setOnClickListener(this);
btn4.setOnClickListener(this);
}
public void useruID() {
SharedPreferences sp = getSharedPreferences("weiboToken",
Context.MODE_PRIVATE);
String uid = sp.getString("uid", null);
name.setText(uid);
}
@Override
public void onClick(View v) {
int id = v.getId();
switch (id) {
case R.id.frg_homepage_header_left_btn:
finish();
break;
default:
break;
}
}
}
| 1,355 | 0.744649 | 0.735793 | 55 | 23.636364 | 18.649263 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.8 | false | false |
7
|
12f831f1d7190e0ee5c088f727b74977264f53e5
| 5,446,018,551,457 |
46ffd142f3a0cfd636a205ff8013409a8762bc02
|
/src/main/java/com/legendshop/mobile/config/audit/package-info.java
|
31701d6d290345e11724411c99e5f4c4094ab447
|
[] |
no_license
|
laozhuang727/shop
|
https://github.com/laozhuang727/shop
|
b0904574daad91b7fa11e0d22487b994cacdac61
|
168e5066db50c32dc9708832d9b9a3a4228dbf33
|
refs/heads/master
| 2021-01-12T13:01:28.422000 | 2016-10-06T01:45:52 | 2016-10-06T01:45:52 | 70,114,156 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Audit specific code.
*/
package com.legendshop.mobile.config.audit;
|
UTF-8
|
Java
| 76 |
java
|
package-info.java
|
Java
|
[] | null |
[] |
/**
* Audit specific code.
*/
package com.legendshop.mobile.config.audit;
| 76 | 0.710526 | 0.710526 | 4 | 18 | 16.583124 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
7
|
7edde4220f836c31de015886b5dac0d14692c7f4
| 22,643,067,610,320 |
6fae25e428efe5df0989fde18b17d8c67a0a756f
|
/app/src/main/java/shree/firebaseandroid/adapter/CompletedTaskAdapter.java
|
8662335d9027ce1c5f75624fdfc41d2943d4ba56
|
[
"MIT"
] |
permissive
|
shrinivasbhosale/Wotrorg
|
https://github.com/shrinivasbhosale/Wotrorg
|
8a21d83fd88f6d2f3ca223f66faf1b9e633e0bef
|
7478c5218c4dfe8e5c4bc9ac438dbf9fd6b7e226
|
refs/heads/master
| 2020-03-24T03:01:37.627000 | 2018-07-26T06:51:23 | 2018-07-26T06:51:34 | 142,401,277 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package shree.firebaseandroid.adapter;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import shree.firebaseandroid.R;
import shree.firebaseandroid.fragments.AssignedFragment;
import shree.firebaseandroid.fragments.CompletedFragment;
import shree.firebaseandroid.fragments.FragmentProjects;
/**
* Created by Shrinivas on 13-06-2018.
*/
public class CompletedTaskAdapter extends BaseAdapter implements Filterable{
private List<CompletedFragment.AllTasks> taskList = null;
private ArrayList<CompletedFragment.AllTasks> allTasks;
Context mContext;
LayoutInflater inflater;
ValueFilter valueFilter;
public CompletedTaskAdapter(Activity context, ArrayList<CompletedFragment.AllTasks> allTask) {
super();
this.mContext = context;
this.allTasks = new ArrayList<CompletedFragment.AllTasks>();
allTasks.addAll(allTask);
this.taskList = allTasks;
inflater = LayoutInflater.from(mContext);
}
public class ViewHolder {
TextView taskname;
TextView taskshortdesc;
TextView taskcreatetime;
}
@Override
public int getCount() {
return taskList.size();
}
@Override
public Object getItem(int position) {
return taskList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public Filter getFilter() {
if (valueFilter == null) {
valueFilter = new CompletedTaskAdapter.ValueFilter();
}
return valueFilter;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
final CompletedTaskAdapter.ViewHolder holder;
if (view == null) {
holder = new CompletedTaskAdapter.ViewHolder();
view = inflater.inflate(R.layout.tasklist, null);
holder.taskname = (TextView) view.findViewById(R.id.taskname);
holder.taskshortdesc = (TextView) view.findViewById(R.id.taskdesc);
holder.taskcreatetime=(TextView) view.findViewById(R.id.taskdate);
view.setTag(holder);
} else {
holder = (CompletedTaskAdapter.ViewHolder) view.getTag();
}
holder.taskname.setText(taskList.get(i).getSubActivityname());
holder.taskshortdesc.setText(taskList.get(i).getDescription());
holder.taskcreatetime.setText(taskList.get(i).getStartdate());
return view;
}
private class ValueFilter extends Filter {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
ArrayList<CompletedFragment.AllTasks> filterList = new ArrayList<CompletedFragment.AllTasks>();
if (constraint != null && constraint.length() > 0) {
for (int i = 0; i < allTasks.size(); i++) {
if ( (allTasks.get(i).getSubActivityname().toUpperCase() )
.contains(constraint.toString().toUpperCase())) {
CompletedFragment.AllTasks country = new CompletedFragment.AllTasks(allTasks.get(i)
.getSubActivityname(),allTasks.get(i)
.getDescription() ,allTasks.get(i).getStatus(), allTasks.get(i)
.getStartdate());
filterList.add(country);
}
}
results.count = filterList.size();
results.values = filterList;
} else {
results.count = filterList.size();
results.values = filterList;
}
return results;
}
@Override
protected void publishResults(CharSequence constraint,
FilterResults results) {
taskList = (ArrayList<CompletedFragment.AllTasks>) results.values;
notifyDataSetChanged();
}
}
}
|
UTF-8
|
Java
| 4,296 |
java
|
CompletedTaskAdapter.java
|
Java
|
[
{
"context": "oid.fragments.FragmentProjects;\n\n/**\n * Created by Shrinivas on 13-06-2018.\n */\n\npublic class CompletedTaskAda",
"end": 610,
"score": 0.9992582201957703,
"start": 601,
"tag": "NAME",
"value": "Shrinivas"
}
] | null |
[] |
package shree.firebaseandroid.adapter;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import shree.firebaseandroid.R;
import shree.firebaseandroid.fragments.AssignedFragment;
import shree.firebaseandroid.fragments.CompletedFragment;
import shree.firebaseandroid.fragments.FragmentProjects;
/**
* Created by Shrinivas on 13-06-2018.
*/
public class CompletedTaskAdapter extends BaseAdapter implements Filterable{
private List<CompletedFragment.AllTasks> taskList = null;
private ArrayList<CompletedFragment.AllTasks> allTasks;
Context mContext;
LayoutInflater inflater;
ValueFilter valueFilter;
public CompletedTaskAdapter(Activity context, ArrayList<CompletedFragment.AllTasks> allTask) {
super();
this.mContext = context;
this.allTasks = new ArrayList<CompletedFragment.AllTasks>();
allTasks.addAll(allTask);
this.taskList = allTasks;
inflater = LayoutInflater.from(mContext);
}
public class ViewHolder {
TextView taskname;
TextView taskshortdesc;
TextView taskcreatetime;
}
@Override
public int getCount() {
return taskList.size();
}
@Override
public Object getItem(int position) {
return taskList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public Filter getFilter() {
if (valueFilter == null) {
valueFilter = new CompletedTaskAdapter.ValueFilter();
}
return valueFilter;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
final CompletedTaskAdapter.ViewHolder holder;
if (view == null) {
holder = new CompletedTaskAdapter.ViewHolder();
view = inflater.inflate(R.layout.tasklist, null);
holder.taskname = (TextView) view.findViewById(R.id.taskname);
holder.taskshortdesc = (TextView) view.findViewById(R.id.taskdesc);
holder.taskcreatetime=(TextView) view.findViewById(R.id.taskdate);
view.setTag(holder);
} else {
holder = (CompletedTaskAdapter.ViewHolder) view.getTag();
}
holder.taskname.setText(taskList.get(i).getSubActivityname());
holder.taskshortdesc.setText(taskList.get(i).getDescription());
holder.taskcreatetime.setText(taskList.get(i).getStartdate());
return view;
}
private class ValueFilter extends Filter {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
ArrayList<CompletedFragment.AllTasks> filterList = new ArrayList<CompletedFragment.AllTasks>();
if (constraint != null && constraint.length() > 0) {
for (int i = 0; i < allTasks.size(); i++) {
if ( (allTasks.get(i).getSubActivityname().toUpperCase() )
.contains(constraint.toString().toUpperCase())) {
CompletedFragment.AllTasks country = new CompletedFragment.AllTasks(allTasks.get(i)
.getSubActivityname(),allTasks.get(i)
.getDescription() ,allTasks.get(i).getStatus(), allTasks.get(i)
.getStartdate());
filterList.add(country);
}
}
results.count = filterList.size();
results.values = filterList;
} else {
results.count = filterList.size();
results.values = filterList;
}
return results;
}
@Override
protected void publishResults(CharSequence constraint,
FilterResults results) {
taskList = (ArrayList<CompletedFragment.AllTasks>) results.values;
notifyDataSetChanged();
}
}
}
| 4,296 | 0.628492 | 0.626164 | 137 | 30.357664 | 27.477858 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.49635 | false | false |
7
|
e97f8764a151256425dd0a63b46de079fe6ddc41
| 22,643,067,612,361 |
f429ab0ddf8ffe8f75f60f959cf50c5c84583a68
|
/src/main/java/automata/wta/WTA.java
|
a016857bfb90d179ed5fb0cf4ce542a5b27acd4b
|
[
"MIT"
] |
permissive
|
qinheping/WTAlib
|
https://github.com/qinheping/WTAlib
|
d043c5769e18516c9bd81c562f5705b8a904b550
|
2996b68f36172f275694c484398b5634e1c0163d
|
refs/heads/master
| 2023-07-06T23:04:04.418000 | 2020-01-28T22:45:23 | 2020-01-28T22:45:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package automata.wta;
import automata.Automaton;
import automata.Move;
import java.util.*;
public class WTA<S,R> extends Automaton<S> {
// ------------------------------------------------------
// Automata properties
// ------------------------------------------------------
private Integer initialState;
private Collection<Integer> states;
protected Map<Integer, Collection<Move<S>>> movesFrom;
private Integer maxStateId;
private Integer transitionCount;
/**
* @return the maximum state id
*/
public Integer getMaxStateId() {
return maxStateId;
}
/**
* @return number of states in the automaton
*/
public Integer stateCount() {
return states.size();
}
/**
* @return number of transitions in the automaton
*/
public Integer getTransitionCount() {
return transitionCount;
}
// ------------------------------------------------------
// Constructors
// ------------------------------------------------------
// Initializes all the fields of the automaton
public WTA() {
super();
states = new HashSet<Integer>();
movesFrom = new HashMap<Integer, Collection<Move<S>>>();
transitionCount = 0;
maxStateId = 0;
}
// Adds a transition to the WFA
public void addTransition(WTAMove<S, R> transition){
transitionCount++;
if (transition.from > maxStateId)
maxStateId = transition.from;
for(Integer to: transition.to){
if (to > maxStateId)
maxStateId = to;
states.add(to);
}
states.add(transition.from);
if (movesFrom.get(transition.from) != null)
movesFrom.get(transition.from).add(transition);
else{
Collection<Move<S>> transitions = new LinkedList<Move<S>>();
transitions.add(transition);
movesFrom.put(transition.from, transitions);
}
}
// ------------------------------------------------------
// Boolean automata operations
// ------------------------------------------------------
public Collection<Move<S>> getLeafTransitions(){
Collection<Move<S>> leafTransitions = new LinkedList<Move<S>>();
for(Collection<Move<S>> bucket: movesFrom.values()){
for(Move<S> transition: bucket){
if(transition.to.size() == 0)
leafTransitions.add(transition);
}
}
return leafTransitions;
}
public Collection<Move<S>> getMovesFrom(Integer state) {
Collection<Move<S>> transitions = new LinkedList<Move<S>>();
if(movesFrom.get(state) != null)
transitions.addAll(movesFrom.get(state));
else
movesFrom.put(state,transitions);
return transitions;
}
public Collection<Move<S>> getMovesTo(List<Integer> states) {
Collection<Move<S>> transitions = new LinkedList<Move<S>>();
for(Collection<Move<S>> bucket: movesFrom.values()){
for(Move<S> transition: bucket){
if(states.equals(transition.to))
transitions.add(transition);
}
}
return transitions;
}
public Collection<Integer> getStates() {
return states;
}
public Integer getInitialState() {
return initialState;
}
public void setInitialState(Integer init) { this.initialState = init;}
public String toString(){
return states.toString() + movesFrom.toString();
}
}
|
UTF-8
|
Java
| 3,597 |
java
|
WTA.java
|
Java
|
[] | null |
[] |
package automata.wta;
import automata.Automaton;
import automata.Move;
import java.util.*;
public class WTA<S,R> extends Automaton<S> {
// ------------------------------------------------------
// Automata properties
// ------------------------------------------------------
private Integer initialState;
private Collection<Integer> states;
protected Map<Integer, Collection<Move<S>>> movesFrom;
private Integer maxStateId;
private Integer transitionCount;
/**
* @return the maximum state id
*/
public Integer getMaxStateId() {
return maxStateId;
}
/**
* @return number of states in the automaton
*/
public Integer stateCount() {
return states.size();
}
/**
* @return number of transitions in the automaton
*/
public Integer getTransitionCount() {
return transitionCount;
}
// ------------------------------------------------------
// Constructors
// ------------------------------------------------------
// Initializes all the fields of the automaton
public WTA() {
super();
states = new HashSet<Integer>();
movesFrom = new HashMap<Integer, Collection<Move<S>>>();
transitionCount = 0;
maxStateId = 0;
}
// Adds a transition to the WFA
public void addTransition(WTAMove<S, R> transition){
transitionCount++;
if (transition.from > maxStateId)
maxStateId = transition.from;
for(Integer to: transition.to){
if (to > maxStateId)
maxStateId = to;
states.add(to);
}
states.add(transition.from);
if (movesFrom.get(transition.from) != null)
movesFrom.get(transition.from).add(transition);
else{
Collection<Move<S>> transitions = new LinkedList<Move<S>>();
transitions.add(transition);
movesFrom.put(transition.from, transitions);
}
}
// ------------------------------------------------------
// Boolean automata operations
// ------------------------------------------------------
public Collection<Move<S>> getLeafTransitions(){
Collection<Move<S>> leafTransitions = new LinkedList<Move<S>>();
for(Collection<Move<S>> bucket: movesFrom.values()){
for(Move<S> transition: bucket){
if(transition.to.size() == 0)
leafTransitions.add(transition);
}
}
return leafTransitions;
}
public Collection<Move<S>> getMovesFrom(Integer state) {
Collection<Move<S>> transitions = new LinkedList<Move<S>>();
if(movesFrom.get(state) != null)
transitions.addAll(movesFrom.get(state));
else
movesFrom.put(state,transitions);
return transitions;
}
public Collection<Move<S>> getMovesTo(List<Integer> states) {
Collection<Move<S>> transitions = new LinkedList<Move<S>>();
for(Collection<Move<S>> bucket: movesFrom.values()){
for(Move<S> transition: bucket){
if(states.equals(transition.to))
transitions.add(transition);
}
}
return transitions;
}
public Collection<Integer> getStates() {
return states;
}
public Integer getInitialState() {
return initialState;
}
public void setInitialState(Integer init) { this.initialState = init;}
public String toString(){
return states.toString() + movesFrom.toString();
}
}
| 3,597 | 0.532666 | 0.531832 | 129 | 26.88372 | 22.573782 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.356589 | false | false |
7
|
43856417f03c364c31877229e71eb4054c8e7bfc
| 2,190,433,365,056 |
181d00fa8d69969827f32ea47fd10f141b5aad6d
|
/src/com/srihari/design_patterns/a_behavioural/e_template_method_pattern/a_problem_1/BankingApplication.java
|
2f27f9414402b7e0fffb3b2d46772c58b3072b45
|
[] |
no_license
|
Srihari-Singuru/design-patterns
|
https://github.com/Srihari-Singuru/design-patterns
|
15b7c37f00c05b44c1d7975ad60f330a01958a57
|
430bad5bcfa797b2332aa8689448928249a124e9
|
refs/heads/master
| 2020-06-19T12:29:29.004000 | 2020-05-28T18:04:10 | 2020-05-28T18:04:10 | 266,847,987 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.srihari.design_patterns.a_behavioural.e_template_method_pattern.a_problem_1;
/**
* A baning application wants us to record the audit trail for all the actions user performed
*/
public class BankingApplication {
public static void main(String[] args) {
// Transfer money
// Generate report
// ...
}
}
|
UTF-8
|
Java
| 347 |
java
|
BankingApplication.java
|
Java
|
[] | null |
[] |
package com.srihari.design_patterns.a_behavioural.e_template_method_pattern.a_problem_1;
/**
* A baning application wants us to record the audit trail for all the actions user performed
*/
public class BankingApplication {
public static void main(String[] args) {
// Transfer money
// Generate report
// ...
}
}
| 347 | 0.677233 | 0.674352 | 12 | 27.916666 | 31.100531 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | false | false |
7
|
f446c1a8f4393460a403a7ee9063e5b0cb5f2b1b
| 2,190,433,368,252 |
1251afe681971a2b9c692fc441c4d76832d60788
|
/charity-app/src/main/java/com/softserveinc/charity/model/offer/OfferInLineProjection.java
|
9d8e4b3d5888722384d48c83d86c980a7f625450
|
[] |
no_license
|
ArtStepanyuk/side-project
|
https://github.com/ArtStepanyuk/side-project
|
93e2ec479f0c17259298069fa4b4b84eebe76129
|
b8a7784e202e6eb6c8eb35d2a0483a5d35c06cd7
|
refs/heads/master
| 2021-01-01T05:35:09.550000 | 2015-12-01T10:03:17 | 2015-12-01T10:03:17 | 40,610,863 | 0 | 4 | null | false | 2015-11-12T13:11:14 | 2015-08-12T16:13:29 | 2015-08-12T16:14:38 | 2015-11-12T13:07:10 | 3,886 | 0 | 1 | 1 |
HTML
| null | null |
package com.softserveinc.charity.model.offer;
import com.softserveinc.charity.model.*;
import org.springframework.data.rest.core.config.Projection;
import java.util.Date;
import java.util.Set;
@Projection(name = "inLine", types = {Offer.class})
public interface OfferInLineProjection {
Integer getId();
City getCity();
User getUserCreated();
String getAddress();
String getConvenientTime();
Date getCreated();
String getDescription();
String getFormattedActualTo();
String getName();
Boolean getPickup();
Date getUpdated();
Category getCategory();
Set<OfferResponse> getOfferResponses();
boolean getOpen();
Set<Image> getImages();
}
|
UTF-8
|
Java
| 710 |
java
|
OfferInLineProjection.java
|
Java
|
[] | null |
[] |
package com.softserveinc.charity.model.offer;
import com.softserveinc.charity.model.*;
import org.springframework.data.rest.core.config.Projection;
import java.util.Date;
import java.util.Set;
@Projection(name = "inLine", types = {Offer.class})
public interface OfferInLineProjection {
Integer getId();
City getCity();
User getUserCreated();
String getAddress();
String getConvenientTime();
Date getCreated();
String getDescription();
String getFormattedActualTo();
String getName();
Boolean getPickup();
Date getUpdated();
Category getCategory();
Set<OfferResponse> getOfferResponses();
boolean getOpen();
Set<Image> getImages();
}
| 710 | 0.698592 | 0.698592 | 40 | 16.75 | 17.189751 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.525 | false | false |
7
|
027d7a4ca46cf67ccc7d9b5bd6f70d5ecf3e2da9
| 15,668,040,708,683 |
741db2a8a3a00d15b18ceaca774626a4d06e5201
|
/src/main/java/org/seeknresolve/domain/dto/BugDTO.java
|
e128949ed5432ec75d2e12702c739815d0e685c6
|
[
"MIT"
] |
permissive
|
seeknresolve/seeknresolve
|
https://github.com/seeknresolve/seeknresolve
|
8a968b8d636a76c5687630f5b39b65b077326f18
|
d953cb53b0c7214dcd2f2bc13a5e5c46e53858f6
|
refs/heads/master
| 2020-04-01T18:40:46.757000 | 2014-09-30T16:54:45 | 2014-09-30T16:54:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.seeknresolve.domain.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.joda.ser.DateTimeSerializer;
import org.hibernate.validator.constraints.NotEmpty;
import org.joda.time.DateTime;
import org.seeknresolve.domain.entity.Bug;
import javax.validation.constraints.NotNull;
@JsonIgnoreProperties(ignoreUnknown = true)
public class BugDTO {
private String tag;
@NotEmpty
private String name;
private String description;
@JsonSerialize(using = DateTimeSerializer.class)
private DateTime dateCreated;
@JsonSerialize(using = DateTimeSerializer.class)
private DateTime dateModified;
@NotNull
private Long reporterId;
private String reporterLogin;
private String reporterName;
private Long assigneeId;
private String assigneeLogin;
private String assigneeName;
@NotNull
private Long projectId;
private String projectName;
private Bug.State state;
@NotNull
private Bug.Priority priority;
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public DateTime getDateCreated() {
return dateCreated;
}
public void setDateCreated(DateTime dateCreated) {
this.dateCreated = dateCreated;
}
public DateTime getDateModified() {
return dateModified;
}
public void setDateModified(DateTime dateModified) {
this.dateModified = dateModified;
}
public Long getReporterId() {
return reporterId;
}
public void setReporterId(Long reporterId) {
this.reporterId = reporterId;
}
public String getReporterLogin() {
return reporterLogin;
}
public void setReporterLogin(String reporterLogin) {
this.reporterLogin = reporterLogin;
}
public String getReporterName() {
return reporterName;
}
public void setReporterName(String reporterName) {
this.reporterName = reporterName;
}
public Long getAssigneeId() {
return assigneeId;
}
public void setAssigneeId(Long assigneeId) {
this.assigneeId = assigneeId;
}
public String getAssigneeLogin() {
return assigneeLogin;
}
public void setAssigneeLogin(String assigneeLogin) {
this.assigneeLogin = assigneeLogin;
}
public String getAssigneeName() {
return assigneeName;
}
public void setAssigneeName(String assigneeName) {
this.assigneeName = assigneeName;
}
public Long getProjectId() {
return projectId;
}
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public Bug.State getState() {
return state;
}
public void setState(Bug.State state) {
this.state = state;
}
public Bug.Priority getPriority() {
return priority;
}
public void setPriority(Bug.Priority priority) {
this.priority = priority;
}
@Override
public String toString() {
return "BugDTO{" +
"tag='" + tag + '\'' +
", name='" + name + '\'' +
", description='" + description + '\'' +
", dateCreated=" + dateCreated +
", dateModified=" + dateModified +
", reporterId=" + reporterId +
", reporterName='" + reporterName + '\'' +
", assigneeId=" + assigneeId +
", assigneeName='" + assigneeName + '\'' +
", projectId=" + projectId +
", projectName='" + projectName + '\'' +
", state=" + state +
", priority=" + priority +
'}';
}
}
|
UTF-8
|
Java
| 4,299 |
java
|
BugDTO.java
|
Java
|
[
{
"context": " reporterId +\n \", reporterName='\" + reporterName + '\\'' +\n \", assigneeId=\" + as",
"end": 3968,
"score": 0.7038145661354065,
"start": 3960,
"tag": "NAME",
"value": "reporter"
},
{
"context": " assigneeId +\n \", assigneeName='\" + assigneeName + '\\'' +\n \", projectId=\" + project",
"end": 4078,
"score": 0.6648938059806824,
"start": 4066,
"tag": "NAME",
"value": "assigneeName"
}
] | null |
[] |
package org.seeknresolve.domain.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.joda.ser.DateTimeSerializer;
import org.hibernate.validator.constraints.NotEmpty;
import org.joda.time.DateTime;
import org.seeknresolve.domain.entity.Bug;
import javax.validation.constraints.NotNull;
@JsonIgnoreProperties(ignoreUnknown = true)
public class BugDTO {
private String tag;
@NotEmpty
private String name;
private String description;
@JsonSerialize(using = DateTimeSerializer.class)
private DateTime dateCreated;
@JsonSerialize(using = DateTimeSerializer.class)
private DateTime dateModified;
@NotNull
private Long reporterId;
private String reporterLogin;
private String reporterName;
private Long assigneeId;
private String assigneeLogin;
private String assigneeName;
@NotNull
private Long projectId;
private String projectName;
private Bug.State state;
@NotNull
private Bug.Priority priority;
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public DateTime getDateCreated() {
return dateCreated;
}
public void setDateCreated(DateTime dateCreated) {
this.dateCreated = dateCreated;
}
public DateTime getDateModified() {
return dateModified;
}
public void setDateModified(DateTime dateModified) {
this.dateModified = dateModified;
}
public Long getReporterId() {
return reporterId;
}
public void setReporterId(Long reporterId) {
this.reporterId = reporterId;
}
public String getReporterLogin() {
return reporterLogin;
}
public void setReporterLogin(String reporterLogin) {
this.reporterLogin = reporterLogin;
}
public String getReporterName() {
return reporterName;
}
public void setReporterName(String reporterName) {
this.reporterName = reporterName;
}
public Long getAssigneeId() {
return assigneeId;
}
public void setAssigneeId(Long assigneeId) {
this.assigneeId = assigneeId;
}
public String getAssigneeLogin() {
return assigneeLogin;
}
public void setAssigneeLogin(String assigneeLogin) {
this.assigneeLogin = assigneeLogin;
}
public String getAssigneeName() {
return assigneeName;
}
public void setAssigneeName(String assigneeName) {
this.assigneeName = assigneeName;
}
public Long getProjectId() {
return projectId;
}
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public Bug.State getState() {
return state;
}
public void setState(Bug.State state) {
this.state = state;
}
public Bug.Priority getPriority() {
return priority;
}
public void setPriority(Bug.Priority priority) {
this.priority = priority;
}
@Override
public String toString() {
return "BugDTO{" +
"tag='" + tag + '\'' +
", name='" + name + '\'' +
", description='" + description + '\'' +
", dateCreated=" + dateCreated +
", dateModified=" + dateModified +
", reporterId=" + reporterId +
", reporterName='" + reporterName + '\'' +
", assigneeId=" + assigneeId +
", assigneeName='" + assigneeName + '\'' +
", projectId=" + projectId +
", projectName='" + projectName + '\'' +
", state=" + state +
", priority=" + priority +
'}';
}
}
| 4,299 | 0.619912 | 0.619912 | 174 | 23.706896 | 19.248236 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37931 | false | false |
7
|
effd6d8cdff7b0e41208e5da402b418749f1f0d8
| 25,177,098,354,419 |
ef47018407569139da3ca8dd3bcf2473606bca0b
|
/maybank.mobile.amos/src/com/mobile/appraisal/Fragment_VHC_Pembanding.java
|
d3fedfecda6f945df619ce839007346ba5d2ad31
|
[] |
no_license
|
YogaAnggaraDaswara/AMOS
|
https://github.com/YogaAnggaraDaswara/AMOS
|
bea88b90df262ee751d4c922188823f8189d95b0
|
e70102cb7b1915122fe82fcecd919cd10d3f63c6
|
refs/heads/master
| 2020-12-24T19:12:44.125000 | 2016-04-20T07:42:50 | 2016-04-20T07:42:50 | 56,661,730 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mobile.appraisal;
import java.util.ArrayList;
import com.mobile.app.configuration.AppConstants;
import com.mobile.bo.app.dataprovider.Appr_Vhc_Pembanding;
import com.mobile.bo.app.dataprovider.LOVDataProvider;
import com.mobile.bo.app.datatype.Datatype_Appr_Vhc_Pembanding_Int;
import com.mobile.bo.app.datatype.LovData;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Bundle;
import android.app.AlertDialog;
import android.app.Fragment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import bii.mobile.amos.R;
public class Fragment_VHC_Pembanding extends Fragment {
Button button;
View view=null;
Button Btnsave;
private Context ctx = null;
private Appr_Vhc_Pembanding Appr_Vhc_Pembanding_DataProvider=new Appr_Vhc_Pembanding();
private Datatype_Appr_Vhc_Pembanding_Int Appr_Vhc_Pembanding_int = new Datatype_Appr_Vhc_Pembanding_Int();
private String col_id="";
private String ap_regno="";
private ArrayList<Datatype_Appr_Vhc_Pembanding_Int> listdataall = null;;
private Fragment_VHC_Pembanding_Dialog fragment_vhc_Pembanding_Dialog=null;
private Button btn_new;
private TableLayout pembanding_tableLayout;
private LOVDataProvider lovDataProvider;
public Fragment_VHC_Pembanding() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_rtb_pembanding, null);
ctx = this.getActivity();
Appr_Vhc_Pembanding_DataProvider=new Appr_Vhc_Pembanding();
Appr_Vhc_Pembanding_int = new Datatype_Appr_Vhc_Pembanding_Int();
fragment_vhc_Pembanding_Dialog=new Fragment_VHC_Pembanding_Dialog(ctx);
pembanding_tableLayout = (TableLayout) view.findViewById(R.id.pembanding_tableLayout);
Bundle b = getArguments();
col_id=b.getString("COL_ID");
ap_regno=b.getString("AP_REGNO");
if(b.getString("STATUS").equals("INQUERY")){
fragment_vhc_Pembanding_Dialog.getBtn_save().setEnabled(false);
btn_new.setEnabled(false);
}
viewPembanding() ;
fragment_vhc_Pembanding_Dialog.getBtn_save().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try{
if(fragment_vhc_Pembanding_Dialog.CekMandatory().equals(false)){
showAlert(R.string.msg_notification_mandatory);
}
else{
int intCount=1;
if(!fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_seq().getText().toString().equals(""))
{
intCount=Integer.parseInt(fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_seq().getText().toString());
}
else{
intCount=Appr_Vhc_Pembanding_DataProvider.getAllAppr_Vhc_Pembanding_by_MaxSeq(col_id);
}
Appr_Vhc_Pembanding_int.setCOL_ID(col_id);
Appr_Vhc_Pembanding_int.setAP_REGNO(ap_regno);
Appr_Vhc_Pembanding_int.setSEQ(""+ intCount);
Appr_Vhc_Pembanding_int.setID(col_id + intCount);
Appr_Vhc_Pembanding_int.setVHC_BRAND_CODE(fragment_vhc_Pembanding_Dialog.getval_vhc_txt_merk().getText().toString());
Appr_Vhc_Pembanding_int.setVHC_CODE(fragment_vhc_Pembanding_Dialog.getval_vhc_txt_model().getText().toString());
Appr_Vhc_Pembanding_int.setCOLOR_CODE(fragment_vhc_Pembanding_Dialog.getval_vhc_txt_warna().getText().toString());
Appr_Vhc_Pembanding_int.setYEAR_CREATED(fragment_vhc_Pembanding_Dialog.getval_vhc_txt_tahun().getText().toString());
Appr_Vhc_Pembanding_int.setTRANSMISION(fragment_vhc_Pembanding_Dialog.getval_vhc_spn_transmisi());
Appr_Vhc_Pembanding_int.setCONDITION(fragment_vhc_Pembanding_Dialog.getval_vhc_spn_kondisi());
Appr_Vhc_Pembanding_int.setOFFER_PRICE(fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_harga_penawaran().getText().toString());
Appr_Vhc_Pembanding_int.setAFTER_ADJUSTMENT_PRICE(fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_adjusment().getText().toString());
Appr_Vhc_Pembanding_int.setNARA_SUMBER(fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_nara_sumber().getText().toString());
Appr_Vhc_Pembanding_int.setPHONE_NO(fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_no_telp().getText().toString());
Appr_Vhc_Pembanding_int.setOFFER_TYPE(fragment_vhc_Pembanding_Dialog.getVal_vhc_spn_penawaran());
Appr_Vhc_Pembanding_DataProvider.updateData(Appr_Vhc_Pembanding_int);
viewPembanding();
fragment_vhc_Pembanding_Dialog.dismiss();
showAlert(R.string.msg_notification_update_success);
}
}
catch(Exception ex){
showAlert(R.string.msg_notification_update_error);
}
}
});
btn_new = (Button) view.findViewById(R.id.btn_new);
btn_new.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_merk("");
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_model("");
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_warna("");
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_tahun("");
fragment_vhc_Pembanding_Dialog.setval_vhc_spn_transmisi("");
fragment_vhc_Pembanding_Dialog.setval_vhc_spn_kondisi("");
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_harga_penawaran("");
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_adjusment("");
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_nara_sumber("");
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_no_telp("");
fragment_vhc_Pembanding_Dialog.setVal_vhc_spn_penawaran("");
fragment_vhc_Pembanding_Dialog.show();
}
});
return view;
}
public void showAlert(int messageId) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ctx);
alertDialog.setTitle(R.string.MESSAGE);
alertDialog.setMessage(messageId);
alertDialog.setPositiveButton(R.string.str_ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
alertDialog.show();
}
private void initControl(){
}
private void loadData(String col_id){
}
private void viewPembanding_test(){
}
private void viewPembanding() {
listdataall=Appr_Vhc_Pembanding_DataProvider.getAllAppr_Vhc_Pembanding(col_id);
if (listdataall != null) {
pembanding_tableLayout.removeAllViews();
TableRow rowHeaderTable = new TableRow(ctx);
rowHeaderTable.setBackgroundColor(getResources().getColor(R.color.color_bacground2));
rowHeaderTable.setPadding(0, 0, 0, 2);
TableRow.LayoutParams rowParamsDetail = new TableRow.LayoutParams();
rowParamsDetail.gravity = Gravity.LEFT;
TextView header = new TextView(ctx);
header.setGravity(Gravity.LEFT);
header.setTextColor(getResources().getColor(android.R.color.black));
header.setPadding(0, 3, 0, 3);
header.setTextSize(12);
header.setWidth(400);
header.setText("Action");
rowHeaderTable.addView(header, rowParamsDetail);
TextView header10 = new TextView(ctx);
header10.setGravity(Gravity.LEFT);
header10.setTextColor(getResources().getColor(android.R.color.black));
header10.setPadding(0, 3, 0, 3);
header10.setTextSize(12);
header10.setWidth(200);
header10.setText("Merk");
rowHeaderTable.addView(header10, rowParamsDetail);
TextView header9 = new TextView(ctx);
header9.setGravity(Gravity.LEFT);
header9.setTextColor(getResources().getColor(android.R.color.black));
header9.setPadding(0, 2, 0,2);
header9.setTextSize(12);
header9.setWidth(200);
header9.setText("Jenis/Model");
rowHeaderTable.addView(header9, rowParamsDetail);
TextView header1 = new TextView(ctx);
header1.setGravity(Gravity.LEFT);
header1.setTextColor(getResources().getColor(android.R.color.black));
header1.setPadding(0, 3, 0, 3);
header1.setTextSize(12);
header1.setWidth(170);
header1.setText("Warna");
rowHeaderTable.addView(header1, rowParamsDetail);
TextView header2 = new TextView(ctx);
header2.setGravity(Gravity.LEFT);
header2.setTextColor(getResources().getColor(android.R.color.black));
header2.setPadding(0, 3, 0, 3);
header2.setTextSize(12);
header2.setWidth(170);
header2.setText("Tahun Pembuatan");
rowHeaderTable.addView(header2, rowParamsDetail);
TextView header11 = new TextView(ctx);
header11.setTextColor(getResources().getColor(android.R.color.black));
header11.setPadding(0, 3, 0, 3);
header11.setTextSize(12);
header11.setWidth(170);
header11.setText("Transmisi");
rowHeaderTable.addView(header11, rowParamsDetail);
TextView header3 = new TextView(ctx);
header3.setGravity(Gravity.LEFT);
header3.setTextColor(getResources().getColor(android.R.color.black));
header3.setPadding(0, 3, 0, 3);
header3.setTextSize(12);
header3.setWidth(200);
header3.setText("Kondisi");
rowHeaderTable.addView(header3, rowParamsDetail);
TextView header4 = new TextView(ctx);
header4.setGravity(Gravity.LEFT);
header4.setTextColor(getResources().getColor(android.R.color.black));
header4.setPadding(0, 3, 0, 3);
header4.setTextSize(12);
header4.setWidth(200);
header4.setText("Penawaran / Transaksi");
rowHeaderTable.addView(header4, rowParamsDetail);
TextView header5 = new TextView(ctx);
header5.setGravity(Gravity.LEFT);
header5.setTextColor(getResources().getColor(android.R.color.black));
header5.setPadding(0, 3, 0, 3);
header5.setTextSize(12);
header5.setWidth(200);
header5.setText("Harga Penawaran / Transaksi (Rp.)");
rowHeaderTable.addView(header5, rowParamsDetail);
TextView header6 = new TextView(ctx);
header6.setGravity(Gravity.LEFT);
header6.setTextColor(getResources().getColor(android.R.color.black));
header6.setPadding(0, 3, 0, 3);
header6.setTextSize(12);
header6.setWidth(200);
header6.setText("Adjusment Internal Appr (Rp.)");
rowHeaderTable.addView(header6, rowParamsDetail);
TextView header7 = new TextView(ctx);
header7.setGravity(Gravity.LEFT);
header7.setTextColor(getResources().getColor(android.R.color.black));
header7.setPadding(0, 3, 0, 3);
header7.setTextSize(12);
header7.setWidth(150);
header7.setText("Nara Sumber");
rowHeaderTable.addView(header7, rowParamsDetail);
TextView header8 = new TextView(ctx);
header8.setGravity(Gravity.LEFT);
header8.setTextColor(getResources().getColor(android.R.color.black));
header8.setPadding(0, 3, 0, 3);
header8.setTextSize(12);
header8.setWidth(150);
header8.setText("No. Telp");
rowHeaderTable.addView(header8, rowParamsDetail);
pembanding_tableLayout.addView(rowHeaderTable);
String lov_descoffer_type="",lov_desctransmisi="",lov_desckondisi="";
lovDataProvider = new LOVDataProvider();
for (int i = 0; i < listdataall.size(); i++) {
final Datatype_Appr_Vhc_Pembanding_Int contentdata = listdataall.get(i);
final TableRow rowContentTable = new TableRow(ctx);
if ((i + 1) % 2 == 0) {
rowContentTable.setBackgroundColor(getResources().getColor(R.color.color_bacground1));
} else {
rowContentTable.setBackgroundColor(Color.WHITE);
}
LovData lovoffer_type = lovDataProvider.getLOVDetail(contentdata.getOFFER_TYPE().toString(), AppConstants.SPINNER_PENAWARAN);
LovData lovtransmisi = lovDataProvider.getLOVDetail(contentdata.getTRANSMISION().toString(), AppConstants.SPINNER_TRANSMISI);
LovData lovkondisi = lovDataProvider.getLOVDetail(contentdata.getCONDITION().toString(), AppConstants.SPINNER_KONDISI);
try{
lov_descoffer_type=lovoffer_type.getDESCRIPTION().toString();
}
catch(Exception ex){
lov_descoffer_type="";
}
try{
lov_desctransmisi=lovtransmisi.getDESCRIPTION().toString();
}
catch(Exception ex){
lov_desctransmisi="";
}
try{
lov_desckondisi=lovkondisi.getDESCRIPTION().toString();
}
catch(Exception ex){
lov_desckondisi="";
}
TextView content_col_id = new TextView(ctx);
content_col_id.setText(contentdata.getCOL_ID().toString() + contentdata.getSEQ().toString());
content_col_id.setVisibility(View.GONE);
rowContentTable.addView(content_col_id);
Button content_detail = new Button(ctx);
content_detail.setGravity(Gravity.CENTER);
content_detail.setText(R.string.form_action_detail);
//content_detail.setWidth(30);
rowContentTable.addView(content_detail, 5, 50);
content_detail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView content_col_id = (TextView) rowContentTable.getChildAt(0);
Appr_Vhc_Pembanding_int=Appr_Vhc_Pembanding_DataProvider.getAllAppr_Vhc_Pembanding_by_seq(content_col_id.getText().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_merk(Appr_Vhc_Pembanding_int.getVHC_BRAND_CODE().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_model(Appr_Vhc_Pembanding_int.getVHC_CODE().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_warna(Appr_Vhc_Pembanding_int.getCOLOR_CODE().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_tahun(Appr_Vhc_Pembanding_int.getYEAR_CREATED().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_spn_transmisi(Appr_Vhc_Pembanding_int.getTRANSMISION().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_spn_kondisi(Appr_Vhc_Pembanding_int.getCONDITION().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_harga_penawaran(Appr_Vhc_Pembanding_int.getOFFER_PRICE().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_adjusment(Appr_Vhc_Pembanding_int.getAFTER_ADJUSTMENT_PRICE().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_nara_sumber(Appr_Vhc_Pembanding_int.getNARA_SUMBER().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_no_telp(Appr_Vhc_Pembanding_int.getPHONE_NO().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_spn_penawaran(Appr_Vhc_Pembanding_int.getOFFER_TYPE().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_seq(Appr_Vhc_Pembanding_int.getSEQ().toString());
fragment_vhc_Pembanding_Dialog.show();
}
});
Button content_delete = new Button(ctx);
content_delete.setGravity(Gravity.CENTER);
content_delete.setText(R.string.form_action_delete);
//content_delete.setWidth(30);
rowContentTable.addView(content_delete, 5, 50);
content_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView content_col_id = (TextView) rowContentTable.getChildAt(0);
try {
Appr_Vhc_Pembanding_DataProvider.deleteTransaksiById(content_col_id.toString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
TextView content_ap_regno = new TextView(ctx);
content_ap_regno.setGravity(Gravity.LEFT);
content_ap_regno.setTextColor(getResources().getColor(android.R.color.black));
content_ap_regno.setPadding(0, 3, 0, 3);
content_ap_regno.setTextSize(12);
content_ap_regno.setWidth(200);
content_ap_regno.setText(contentdata.getVHC_BRAND_CODE().toString());
rowContentTable.addView(content_ap_regno, rowParamsDetail);
TextView content_jaminan = new TextView(ctx);
content_jaminan.setGravity(Gravity.LEFT);
content_jaminan.setTextColor(getResources().getColor(android.R.color.black));
content_jaminan.setPadding(0, 3, 0, 3);
content_jaminan.setTextSize(12);
content_jaminan.setWidth(200);
content_jaminan.setText(contentdata.getVHC_CODE().toString());
rowContentTable.addView(content_jaminan, rowParamsDetail);
TextView content_nama = new TextView(ctx);
content_nama.setGravity(Gravity.LEFT);
content_nama.setTextColor(getResources().getColor(android.R.color.black));
content_nama.setPadding(0, 3, 0, 3);
content_nama.setTextSize(12);
content_nama.setWidth(170);
content_nama.setText(contentdata.getCOLOR_CODE().toString());
rowContentTable.addView(content_nama, rowParamsDetail);
TextView content_tipe = new TextView(ctx);
content_tipe.setGravity(Gravity.LEFT);
content_tipe.setTextColor(getResources().getColor(android.R.color.black));
content_tipe.setPadding(0, 3, 0, 3);
content_tipe.setTextSize(12);
content_tipe.setWidth(170);
content_tipe.setText(contentdata.getYEAR_CREATED().toString());
rowContentTable.addView(content_tipe,rowParamsDetail);
TextView content_transmisi = new TextView(ctx);
content_transmisi.setGravity(Gravity.LEFT);
content_transmisi.setTextColor(getResources().getColor(android.R.color.black));
content_transmisi.setPadding(0, 3, 0, 3);
content_transmisi.setTextSize(12);
content_transmisi.setWidth(170);
content_transmisi.setText(lov_desctransmisi);
rowContentTable.addView(content_transmisi,rowParamsDetail);
TextView content_npwp = new TextView(ctx);
content_npwp.setGravity(Gravity.LEFT);
content_npwp.setTextColor(getResources().getColor(android.R.color.black));
content_npwp.setPadding(0, 3, 0, 3);
content_npwp.setTextSize(12);
content_npwp.setWidth(200);
content_npwp.setText(lov_desckondisi);
rowContentTable.addView(content_npwp,rowParamsDetail);
TextView content_status = new TextView(ctx);
content_status.setGravity(Gravity.LEFT);
content_status.setTextColor(getResources().getColor(android.R.color.black));
content_status.setPadding(0, 3, 0, 3);
content_status.setTextSize(12);
content_status.setWidth(200);
content_status.setText(lov_descoffer_type);
rowContentTable.addView(content_status,rowParamsDetail);
TextView content_aging = new TextView(ctx);
content_aging.setGravity(Gravity.LEFT);
content_aging.setTextColor(getResources().getColor(android.R.color.black));
content_aging.setPadding(0, 3, 0, 3);
content_aging.setTextSize(12);
content_aging.setWidth(200);
content_aging.setText(contentdata.getOFFER_PRICE().toString());
rowContentTable.addView(content_aging,rowParamsDetail);
TextView content_adjustment = new TextView(ctx);
content_adjustment.setGravity(Gravity.LEFT);
content_adjustment.setTextColor(getResources().getColor(android.R.color.black));
content_adjustment.setPadding(0, 3, 0, 3);
content_adjustment.setTextSize(12);
content_adjustment.setWidth(200);
content_adjustment.setText(contentdata.getAFTER_ADJUSTMENT_PRICE().toString());
rowContentTable.addView(content_adjustment,rowParamsDetail);
TextView content_narasumber = new TextView(ctx);
content_narasumber.setGravity(Gravity.LEFT);
content_narasumber.setTextColor(getResources().getColor(android.R.color.black));
content_narasumber.setPadding(0, 3, 0, 3);
content_narasumber.setTextSize(12);
content_narasumber.setWidth(150);
content_narasumber.setText(contentdata.getNARA_SUMBER().toString());
rowContentTable.addView(content_narasumber,rowParamsDetail);
TextView content_phone = new TextView(ctx);
content_phone.setGravity(Gravity.LEFT);
content_phone.setTextColor(getResources().getColor(android.R.color.black));
content_phone.setPadding(0, 3, 0, 3);
content_phone.setTextSize(12);
content_phone.setWidth(150);
content_phone.setText(contentdata.getPHONE_NO().toString());
rowContentTable.addView(content_phone,rowParamsDetail);
pembanding_tableLayout.addView(rowContentTable);
}
}
}
}
|
UTF-8
|
Java
| 22,709 |
java
|
Fragment_VHC_Pembanding.java
|
Java
|
[
{
"context": "header10.setWidth(200);\n header10.setText(\"Merk\");\n\n rowHeaderTable.addView(header10, rowP",
"end": 8425,
"score": 0.923431932926178,
"start": 8421,
"tag": "NAME",
"value": "Merk"
}
] | null |
[] |
package com.mobile.appraisal;
import java.util.ArrayList;
import com.mobile.app.configuration.AppConstants;
import com.mobile.bo.app.dataprovider.Appr_Vhc_Pembanding;
import com.mobile.bo.app.dataprovider.LOVDataProvider;
import com.mobile.bo.app.datatype.Datatype_Appr_Vhc_Pembanding_Int;
import com.mobile.bo.app.datatype.LovData;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Bundle;
import android.app.AlertDialog;
import android.app.Fragment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import bii.mobile.amos.R;
public class Fragment_VHC_Pembanding extends Fragment {
Button button;
View view=null;
Button Btnsave;
private Context ctx = null;
private Appr_Vhc_Pembanding Appr_Vhc_Pembanding_DataProvider=new Appr_Vhc_Pembanding();
private Datatype_Appr_Vhc_Pembanding_Int Appr_Vhc_Pembanding_int = new Datatype_Appr_Vhc_Pembanding_Int();
private String col_id="";
private String ap_regno="";
private ArrayList<Datatype_Appr_Vhc_Pembanding_Int> listdataall = null;;
private Fragment_VHC_Pembanding_Dialog fragment_vhc_Pembanding_Dialog=null;
private Button btn_new;
private TableLayout pembanding_tableLayout;
private LOVDataProvider lovDataProvider;
public Fragment_VHC_Pembanding() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_rtb_pembanding, null);
ctx = this.getActivity();
Appr_Vhc_Pembanding_DataProvider=new Appr_Vhc_Pembanding();
Appr_Vhc_Pembanding_int = new Datatype_Appr_Vhc_Pembanding_Int();
fragment_vhc_Pembanding_Dialog=new Fragment_VHC_Pembanding_Dialog(ctx);
pembanding_tableLayout = (TableLayout) view.findViewById(R.id.pembanding_tableLayout);
Bundle b = getArguments();
col_id=b.getString("COL_ID");
ap_regno=b.getString("AP_REGNO");
if(b.getString("STATUS").equals("INQUERY")){
fragment_vhc_Pembanding_Dialog.getBtn_save().setEnabled(false);
btn_new.setEnabled(false);
}
viewPembanding() ;
fragment_vhc_Pembanding_Dialog.getBtn_save().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try{
if(fragment_vhc_Pembanding_Dialog.CekMandatory().equals(false)){
showAlert(R.string.msg_notification_mandatory);
}
else{
int intCount=1;
if(!fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_seq().getText().toString().equals(""))
{
intCount=Integer.parseInt(fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_seq().getText().toString());
}
else{
intCount=Appr_Vhc_Pembanding_DataProvider.getAllAppr_Vhc_Pembanding_by_MaxSeq(col_id);
}
Appr_Vhc_Pembanding_int.setCOL_ID(col_id);
Appr_Vhc_Pembanding_int.setAP_REGNO(ap_regno);
Appr_Vhc_Pembanding_int.setSEQ(""+ intCount);
Appr_Vhc_Pembanding_int.setID(col_id + intCount);
Appr_Vhc_Pembanding_int.setVHC_BRAND_CODE(fragment_vhc_Pembanding_Dialog.getval_vhc_txt_merk().getText().toString());
Appr_Vhc_Pembanding_int.setVHC_CODE(fragment_vhc_Pembanding_Dialog.getval_vhc_txt_model().getText().toString());
Appr_Vhc_Pembanding_int.setCOLOR_CODE(fragment_vhc_Pembanding_Dialog.getval_vhc_txt_warna().getText().toString());
Appr_Vhc_Pembanding_int.setYEAR_CREATED(fragment_vhc_Pembanding_Dialog.getval_vhc_txt_tahun().getText().toString());
Appr_Vhc_Pembanding_int.setTRANSMISION(fragment_vhc_Pembanding_Dialog.getval_vhc_spn_transmisi());
Appr_Vhc_Pembanding_int.setCONDITION(fragment_vhc_Pembanding_Dialog.getval_vhc_spn_kondisi());
Appr_Vhc_Pembanding_int.setOFFER_PRICE(fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_harga_penawaran().getText().toString());
Appr_Vhc_Pembanding_int.setAFTER_ADJUSTMENT_PRICE(fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_adjusment().getText().toString());
Appr_Vhc_Pembanding_int.setNARA_SUMBER(fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_nara_sumber().getText().toString());
Appr_Vhc_Pembanding_int.setPHONE_NO(fragment_vhc_Pembanding_Dialog.getVal_vhc_txt_no_telp().getText().toString());
Appr_Vhc_Pembanding_int.setOFFER_TYPE(fragment_vhc_Pembanding_Dialog.getVal_vhc_spn_penawaran());
Appr_Vhc_Pembanding_DataProvider.updateData(Appr_Vhc_Pembanding_int);
viewPembanding();
fragment_vhc_Pembanding_Dialog.dismiss();
showAlert(R.string.msg_notification_update_success);
}
}
catch(Exception ex){
showAlert(R.string.msg_notification_update_error);
}
}
});
btn_new = (Button) view.findViewById(R.id.btn_new);
btn_new.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_merk("");
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_model("");
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_warna("");
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_tahun("");
fragment_vhc_Pembanding_Dialog.setval_vhc_spn_transmisi("");
fragment_vhc_Pembanding_Dialog.setval_vhc_spn_kondisi("");
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_harga_penawaran("");
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_adjusment("");
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_nara_sumber("");
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_no_telp("");
fragment_vhc_Pembanding_Dialog.setVal_vhc_spn_penawaran("");
fragment_vhc_Pembanding_Dialog.show();
}
});
return view;
}
public void showAlert(int messageId) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ctx);
alertDialog.setTitle(R.string.MESSAGE);
alertDialog.setMessage(messageId);
alertDialog.setPositiveButton(R.string.str_ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
alertDialog.show();
}
private void initControl(){
}
private void loadData(String col_id){
}
private void viewPembanding_test(){
}
private void viewPembanding() {
listdataall=Appr_Vhc_Pembanding_DataProvider.getAllAppr_Vhc_Pembanding(col_id);
if (listdataall != null) {
pembanding_tableLayout.removeAllViews();
TableRow rowHeaderTable = new TableRow(ctx);
rowHeaderTable.setBackgroundColor(getResources().getColor(R.color.color_bacground2));
rowHeaderTable.setPadding(0, 0, 0, 2);
TableRow.LayoutParams rowParamsDetail = new TableRow.LayoutParams();
rowParamsDetail.gravity = Gravity.LEFT;
TextView header = new TextView(ctx);
header.setGravity(Gravity.LEFT);
header.setTextColor(getResources().getColor(android.R.color.black));
header.setPadding(0, 3, 0, 3);
header.setTextSize(12);
header.setWidth(400);
header.setText("Action");
rowHeaderTable.addView(header, rowParamsDetail);
TextView header10 = new TextView(ctx);
header10.setGravity(Gravity.LEFT);
header10.setTextColor(getResources().getColor(android.R.color.black));
header10.setPadding(0, 3, 0, 3);
header10.setTextSize(12);
header10.setWidth(200);
header10.setText("Merk");
rowHeaderTable.addView(header10, rowParamsDetail);
TextView header9 = new TextView(ctx);
header9.setGravity(Gravity.LEFT);
header9.setTextColor(getResources().getColor(android.R.color.black));
header9.setPadding(0, 2, 0,2);
header9.setTextSize(12);
header9.setWidth(200);
header9.setText("Jenis/Model");
rowHeaderTable.addView(header9, rowParamsDetail);
TextView header1 = new TextView(ctx);
header1.setGravity(Gravity.LEFT);
header1.setTextColor(getResources().getColor(android.R.color.black));
header1.setPadding(0, 3, 0, 3);
header1.setTextSize(12);
header1.setWidth(170);
header1.setText("Warna");
rowHeaderTable.addView(header1, rowParamsDetail);
TextView header2 = new TextView(ctx);
header2.setGravity(Gravity.LEFT);
header2.setTextColor(getResources().getColor(android.R.color.black));
header2.setPadding(0, 3, 0, 3);
header2.setTextSize(12);
header2.setWidth(170);
header2.setText("Tahun Pembuatan");
rowHeaderTable.addView(header2, rowParamsDetail);
TextView header11 = new TextView(ctx);
header11.setTextColor(getResources().getColor(android.R.color.black));
header11.setPadding(0, 3, 0, 3);
header11.setTextSize(12);
header11.setWidth(170);
header11.setText("Transmisi");
rowHeaderTable.addView(header11, rowParamsDetail);
TextView header3 = new TextView(ctx);
header3.setGravity(Gravity.LEFT);
header3.setTextColor(getResources().getColor(android.R.color.black));
header3.setPadding(0, 3, 0, 3);
header3.setTextSize(12);
header3.setWidth(200);
header3.setText("Kondisi");
rowHeaderTable.addView(header3, rowParamsDetail);
TextView header4 = new TextView(ctx);
header4.setGravity(Gravity.LEFT);
header4.setTextColor(getResources().getColor(android.R.color.black));
header4.setPadding(0, 3, 0, 3);
header4.setTextSize(12);
header4.setWidth(200);
header4.setText("Penawaran / Transaksi");
rowHeaderTable.addView(header4, rowParamsDetail);
TextView header5 = new TextView(ctx);
header5.setGravity(Gravity.LEFT);
header5.setTextColor(getResources().getColor(android.R.color.black));
header5.setPadding(0, 3, 0, 3);
header5.setTextSize(12);
header5.setWidth(200);
header5.setText("Harga Penawaran / Transaksi (Rp.)");
rowHeaderTable.addView(header5, rowParamsDetail);
TextView header6 = new TextView(ctx);
header6.setGravity(Gravity.LEFT);
header6.setTextColor(getResources().getColor(android.R.color.black));
header6.setPadding(0, 3, 0, 3);
header6.setTextSize(12);
header6.setWidth(200);
header6.setText("Adjusment Internal Appr (Rp.)");
rowHeaderTable.addView(header6, rowParamsDetail);
TextView header7 = new TextView(ctx);
header7.setGravity(Gravity.LEFT);
header7.setTextColor(getResources().getColor(android.R.color.black));
header7.setPadding(0, 3, 0, 3);
header7.setTextSize(12);
header7.setWidth(150);
header7.setText("Nara Sumber");
rowHeaderTable.addView(header7, rowParamsDetail);
TextView header8 = new TextView(ctx);
header8.setGravity(Gravity.LEFT);
header8.setTextColor(getResources().getColor(android.R.color.black));
header8.setPadding(0, 3, 0, 3);
header8.setTextSize(12);
header8.setWidth(150);
header8.setText("No. Telp");
rowHeaderTable.addView(header8, rowParamsDetail);
pembanding_tableLayout.addView(rowHeaderTable);
String lov_descoffer_type="",lov_desctransmisi="",lov_desckondisi="";
lovDataProvider = new LOVDataProvider();
for (int i = 0; i < listdataall.size(); i++) {
final Datatype_Appr_Vhc_Pembanding_Int contentdata = listdataall.get(i);
final TableRow rowContentTable = new TableRow(ctx);
if ((i + 1) % 2 == 0) {
rowContentTable.setBackgroundColor(getResources().getColor(R.color.color_bacground1));
} else {
rowContentTable.setBackgroundColor(Color.WHITE);
}
LovData lovoffer_type = lovDataProvider.getLOVDetail(contentdata.getOFFER_TYPE().toString(), AppConstants.SPINNER_PENAWARAN);
LovData lovtransmisi = lovDataProvider.getLOVDetail(contentdata.getTRANSMISION().toString(), AppConstants.SPINNER_TRANSMISI);
LovData lovkondisi = lovDataProvider.getLOVDetail(contentdata.getCONDITION().toString(), AppConstants.SPINNER_KONDISI);
try{
lov_descoffer_type=lovoffer_type.getDESCRIPTION().toString();
}
catch(Exception ex){
lov_descoffer_type="";
}
try{
lov_desctransmisi=lovtransmisi.getDESCRIPTION().toString();
}
catch(Exception ex){
lov_desctransmisi="";
}
try{
lov_desckondisi=lovkondisi.getDESCRIPTION().toString();
}
catch(Exception ex){
lov_desckondisi="";
}
TextView content_col_id = new TextView(ctx);
content_col_id.setText(contentdata.getCOL_ID().toString() + contentdata.getSEQ().toString());
content_col_id.setVisibility(View.GONE);
rowContentTable.addView(content_col_id);
Button content_detail = new Button(ctx);
content_detail.setGravity(Gravity.CENTER);
content_detail.setText(R.string.form_action_detail);
//content_detail.setWidth(30);
rowContentTable.addView(content_detail, 5, 50);
content_detail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView content_col_id = (TextView) rowContentTable.getChildAt(0);
Appr_Vhc_Pembanding_int=Appr_Vhc_Pembanding_DataProvider.getAllAppr_Vhc_Pembanding_by_seq(content_col_id.getText().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_merk(Appr_Vhc_Pembanding_int.getVHC_BRAND_CODE().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_model(Appr_Vhc_Pembanding_int.getVHC_CODE().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_warna(Appr_Vhc_Pembanding_int.getCOLOR_CODE().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_txt_tahun(Appr_Vhc_Pembanding_int.getYEAR_CREATED().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_spn_transmisi(Appr_Vhc_Pembanding_int.getTRANSMISION().toString());
fragment_vhc_Pembanding_Dialog.setval_vhc_spn_kondisi(Appr_Vhc_Pembanding_int.getCONDITION().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_harga_penawaran(Appr_Vhc_Pembanding_int.getOFFER_PRICE().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_adjusment(Appr_Vhc_Pembanding_int.getAFTER_ADJUSTMENT_PRICE().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_nara_sumber(Appr_Vhc_Pembanding_int.getNARA_SUMBER().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_no_telp(Appr_Vhc_Pembanding_int.getPHONE_NO().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_spn_penawaran(Appr_Vhc_Pembanding_int.getOFFER_TYPE().toString());
fragment_vhc_Pembanding_Dialog.setVal_vhc_txt_seq(Appr_Vhc_Pembanding_int.getSEQ().toString());
fragment_vhc_Pembanding_Dialog.show();
}
});
Button content_delete = new Button(ctx);
content_delete.setGravity(Gravity.CENTER);
content_delete.setText(R.string.form_action_delete);
//content_delete.setWidth(30);
rowContentTable.addView(content_delete, 5, 50);
content_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView content_col_id = (TextView) rowContentTable.getChildAt(0);
try {
Appr_Vhc_Pembanding_DataProvider.deleteTransaksiById(content_col_id.toString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
TextView content_ap_regno = new TextView(ctx);
content_ap_regno.setGravity(Gravity.LEFT);
content_ap_regno.setTextColor(getResources().getColor(android.R.color.black));
content_ap_regno.setPadding(0, 3, 0, 3);
content_ap_regno.setTextSize(12);
content_ap_regno.setWidth(200);
content_ap_regno.setText(contentdata.getVHC_BRAND_CODE().toString());
rowContentTable.addView(content_ap_regno, rowParamsDetail);
TextView content_jaminan = new TextView(ctx);
content_jaminan.setGravity(Gravity.LEFT);
content_jaminan.setTextColor(getResources().getColor(android.R.color.black));
content_jaminan.setPadding(0, 3, 0, 3);
content_jaminan.setTextSize(12);
content_jaminan.setWidth(200);
content_jaminan.setText(contentdata.getVHC_CODE().toString());
rowContentTable.addView(content_jaminan, rowParamsDetail);
TextView content_nama = new TextView(ctx);
content_nama.setGravity(Gravity.LEFT);
content_nama.setTextColor(getResources().getColor(android.R.color.black));
content_nama.setPadding(0, 3, 0, 3);
content_nama.setTextSize(12);
content_nama.setWidth(170);
content_nama.setText(contentdata.getCOLOR_CODE().toString());
rowContentTable.addView(content_nama, rowParamsDetail);
TextView content_tipe = new TextView(ctx);
content_tipe.setGravity(Gravity.LEFT);
content_tipe.setTextColor(getResources().getColor(android.R.color.black));
content_tipe.setPadding(0, 3, 0, 3);
content_tipe.setTextSize(12);
content_tipe.setWidth(170);
content_tipe.setText(contentdata.getYEAR_CREATED().toString());
rowContentTable.addView(content_tipe,rowParamsDetail);
TextView content_transmisi = new TextView(ctx);
content_transmisi.setGravity(Gravity.LEFT);
content_transmisi.setTextColor(getResources().getColor(android.R.color.black));
content_transmisi.setPadding(0, 3, 0, 3);
content_transmisi.setTextSize(12);
content_transmisi.setWidth(170);
content_transmisi.setText(lov_desctransmisi);
rowContentTable.addView(content_transmisi,rowParamsDetail);
TextView content_npwp = new TextView(ctx);
content_npwp.setGravity(Gravity.LEFT);
content_npwp.setTextColor(getResources().getColor(android.R.color.black));
content_npwp.setPadding(0, 3, 0, 3);
content_npwp.setTextSize(12);
content_npwp.setWidth(200);
content_npwp.setText(lov_desckondisi);
rowContentTable.addView(content_npwp,rowParamsDetail);
TextView content_status = new TextView(ctx);
content_status.setGravity(Gravity.LEFT);
content_status.setTextColor(getResources().getColor(android.R.color.black));
content_status.setPadding(0, 3, 0, 3);
content_status.setTextSize(12);
content_status.setWidth(200);
content_status.setText(lov_descoffer_type);
rowContentTable.addView(content_status,rowParamsDetail);
TextView content_aging = new TextView(ctx);
content_aging.setGravity(Gravity.LEFT);
content_aging.setTextColor(getResources().getColor(android.R.color.black));
content_aging.setPadding(0, 3, 0, 3);
content_aging.setTextSize(12);
content_aging.setWidth(200);
content_aging.setText(contentdata.getOFFER_PRICE().toString());
rowContentTable.addView(content_aging,rowParamsDetail);
TextView content_adjustment = new TextView(ctx);
content_adjustment.setGravity(Gravity.LEFT);
content_adjustment.setTextColor(getResources().getColor(android.R.color.black));
content_adjustment.setPadding(0, 3, 0, 3);
content_adjustment.setTextSize(12);
content_adjustment.setWidth(200);
content_adjustment.setText(contentdata.getAFTER_ADJUSTMENT_PRICE().toString());
rowContentTable.addView(content_adjustment,rowParamsDetail);
TextView content_narasumber = new TextView(ctx);
content_narasumber.setGravity(Gravity.LEFT);
content_narasumber.setTextColor(getResources().getColor(android.R.color.black));
content_narasumber.setPadding(0, 3, 0, 3);
content_narasumber.setTextSize(12);
content_narasumber.setWidth(150);
content_narasumber.setText(contentdata.getNARA_SUMBER().toString());
rowContentTable.addView(content_narasumber,rowParamsDetail);
TextView content_phone = new TextView(ctx);
content_phone.setGravity(Gravity.LEFT);
content_phone.setTextColor(getResources().getColor(android.R.color.black));
content_phone.setPadding(0, 3, 0, 3);
content_phone.setTextSize(12);
content_phone.setWidth(150);
content_phone.setText(contentdata.getPHONE_NO().toString());
rowContentTable.addView(content_phone,rowParamsDetail);
pembanding_tableLayout.addView(rowContentTable);
}
}
}
}
| 22,709 | 0.632833 | 0.618213 | 487 | 45.63039 | 31.997866 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.37577 | false | false |
7
|
7ffb9ec4f320540078f136af3c16d94d30914394
| 31,722,628,468,298 |
51bcd5f81f8ed19edd137866183fbdfb2abfa3c8
|
/src/main/java/com/era/easyretail/validators/ImpuesxpartidapedsValidator.java
|
82f800bf0f01560017ced9c7e7ac52d493ac2691
|
[] |
no_license
|
davidtadeovargas/era_easyretail
|
https://github.com/davidtadeovargas/era_easyretail
|
60edeb7c30468e596662e127c396a3d93948426b
|
2e19a1859c115bfa6574b2133e6a62ec9ed92d3e
|
refs/heads/master
| 2023-01-27T23:34:31.676000 | 2020-11-24T04:42:46 | 2020-11-24T04:42:46 | 245,110,215 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.era.easyretail.validators;
import com.era.easyretail.validators.exceptions.ImpuesxpartidapedsValidatorsExceptions;
import com.era.models.Impuesxpartidaped;
import com.era.repositories.RepositoryFactory;
public class ImpuesxpartidapedsValidator extends IValidate{
private String codigoImpuesto;
public void setCodigoImpuesto(String property){
this.codigoImpuesto = property;
}
private String idPartida;
public void setIdPartida(String property){
this.idPartida = property;
}
private String idParts;
public void setIdParts(String property){
this.idParts = property;
}
private String ret_tras;
public void setRet_tras(String property){
this.ret_tras = property;
}
private String retencion;
public void setRetencion(String property){
this.retencion = property;
}
private String tasa;
public void setTasa(String property){
this.tasa = property;
}
private String total;
public void setTotal(String property){
this.total = property;
}
@Override
public void validateInsert() throws Exception {
if(codigoImpuesto==null || codigoImpuesto.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getCodigoImpuestoException();
}
if(idPartida==null || idPartida.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getIdPartidaException();
}
if(idParts==null || idParts.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getIdPartsException();
}
if(ret_tras==null || ret_tras.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getRet_trasException();
}
if(retencion==null || retencion.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getRetencionException();
}
if(tasa==null || tasa.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getTasaException();
}
if(total==null || total.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getTotalException();
}
if(IInsertValidation!=null){
final boolean response = IInsertValidation.validate();
if(!response){
throw new ImpuesxpartidapedsValidatorsExceptions().getCustomVaidationNotPassedException();
}
}
}
@Override
public void validateUpdate() throws Exception {
this.validateInsert();
if(IUpdateValidation!=null){
final boolean response = IUpdateValidation.validate();
if(!response){
throw new ImpuesxpartidapedsValidatorsExceptions().getCustomVaidationNotPassedException();
}
}
}
}
|
UTF-8
|
Java
| 2,786 |
java
|
ImpuesxpartidapedsValidator.java
|
Java
|
[] | null |
[] |
package com.era.easyretail.validators;
import com.era.easyretail.validators.exceptions.ImpuesxpartidapedsValidatorsExceptions;
import com.era.models.Impuesxpartidaped;
import com.era.repositories.RepositoryFactory;
public class ImpuesxpartidapedsValidator extends IValidate{
private String codigoImpuesto;
public void setCodigoImpuesto(String property){
this.codigoImpuesto = property;
}
private String idPartida;
public void setIdPartida(String property){
this.idPartida = property;
}
private String idParts;
public void setIdParts(String property){
this.idParts = property;
}
private String ret_tras;
public void setRet_tras(String property){
this.ret_tras = property;
}
private String retencion;
public void setRetencion(String property){
this.retencion = property;
}
private String tasa;
public void setTasa(String property){
this.tasa = property;
}
private String total;
public void setTotal(String property){
this.total = property;
}
@Override
public void validateInsert() throws Exception {
if(codigoImpuesto==null || codigoImpuesto.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getCodigoImpuestoException();
}
if(idPartida==null || idPartida.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getIdPartidaException();
}
if(idParts==null || idParts.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getIdPartsException();
}
if(ret_tras==null || ret_tras.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getRet_trasException();
}
if(retencion==null || retencion.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getRetencionException();
}
if(tasa==null || tasa.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getTasaException();
}
if(total==null || total.isEmpty()){
throw new ImpuesxpartidapedsValidatorsExceptions().getTotalException();
}
if(IInsertValidation!=null){
final boolean response = IInsertValidation.validate();
if(!response){
throw new ImpuesxpartidapedsValidatorsExceptions().getCustomVaidationNotPassedException();
}
}
}
@Override
public void validateUpdate() throws Exception {
this.validateInsert();
if(IUpdateValidation!=null){
final boolean response = IUpdateValidation.validate();
if(!response){
throw new ImpuesxpartidapedsValidatorsExceptions().getCustomVaidationNotPassedException();
}
}
}
}
| 2,786 | 0.669777 | 0.669777 | 98 | 27.438776 | 28.195768 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.44898 | false | false |
14
|
71b5f404a3c0e93bd4677e95d48e556cc8299fb6
| 5,248,450,098,052 |
004f6fc45bb8310b74c1fc14bbbb91a653fcecaf
|
/src/main/java/mods/hinasch/unsaga/ability/AbilityPotentialTable.java
|
f13e344b45886b57fa12c3922ebf1e4df161c4dc
|
[] |
no_license
|
damofujiki/unsagamod-1.12-new
|
https://github.com/damofujiki/unsagamod-1.12-new
|
7ebf8bcdaadd33511050315256db62ffeb04a2d4
|
f72a2003bc3d28a5bfd3ab9ed310104842da69ce
|
refs/heads/master
| 2020-06-03T19:02:42.231000 | 2019-06-13T05:29:02 | 2019-06-13T05:29:02 | 191,693,815 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mods.hinasch.unsaga.ability;
import java.util.List;
import java.util.Optional;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Table;
import mods.hinasch.unsaga.util.ToolCategory;
public class AbilityPotentialTable<T>{
Table<ToolCategory,T,List<IAbility>> map = HashBasedTable.create();
public List<IAbility> get(ToolCategory cate,T tag){
return Optional.ofNullable(map.get(cate, tag)).orElse(this.getEmptyList());
}
public List<IAbility> getEmptyList(){
return ImmutableList.of();
}
}
|
UTF-8
|
Java
| 593 |
java
|
AbilityPotentialTable.java
|
Java
|
[] | null |
[] |
package mods.hinasch.unsaga.ability;
import java.util.List;
import java.util.Optional;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Table;
import mods.hinasch.unsaga.util.ToolCategory;
public class AbilityPotentialTable<T>{
Table<ToolCategory,T,List<IAbility>> map = HashBasedTable.create();
public List<IAbility> get(ToolCategory cate,T tag){
return Optional.ofNullable(map.get(cate, tag)).orElse(this.getEmptyList());
}
public List<IAbility> getEmptyList(){
return ImmutableList.of();
}
}
| 593 | 0.780776 | 0.780776 | 24 | 23.708334 | 24.120321 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.958333 | false | false |
14
|
121f4f02a8f19c0863b5977e43b6b2d33a285490
| 12,592,844,155,190 |
0d504bd21857d6d1b8292c8efa2678ea461ff7bf
|
/src/skiplistPackage/LockFreeSkipList.java
|
ba41b57cf50bede05e492ec97f6260ebeb4afc51
|
[] |
no_license
|
Phleisch/pdc-lab3
|
https://github.com/Phleisch/pdc-lab3
|
a81ba89a6629a625021a1cae49faa33217e81c25
|
f2a23854041a072f77aac32f42007548cd262c7a
|
refs/heads/main
| 2022-12-25T00:26:53.509000 | 2020-10-07T11:13:01 | 2020-10-07T11:13:01 | 300,842,754 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package skiplistPackage;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicMarkableReference;
import java.util.concurrent.locks.ReentrantLock;
import testPackage.Log;
// Most of the implementation directly from the code of H&S 14.4
public final class LockFreeSkipList {
static final int MAX_LEVEL = 32;
final Node head;
final Node tail;
final ReentrantLock linearizationLock;
private boolean useLinearizationLock;
public LockFreeSkipList(boolean useLinearizationLock) {
head = new Node(Integer.MIN_VALUE);
tail = new Node(Integer.MAX_VALUE);
linearizationLock = new ReentrantLock();
this.useLinearizationLock = useLinearizationLock;
for (int i = 0; i < head.next.length; i++) {
head.next[i] = new AtomicMarkableReference<LockFreeSkipList.Node>(tail, false);
}
this.useLinearizationLock = useLinearizationLock;
}
public static final class Node {
final Integer value;
final int key;
final AtomicMarkableReference<Node>[] next;
private int topLevel;
@SuppressWarnings("unchecked")
public Node(int key) {
value = null;
this.key = key;
next = (AtomicMarkableReference<Node>[]) new AtomicMarkableReference[MAX_LEVEL + 1];
for (int i = 0; i < next.length; i++) {
next[i] = new AtomicMarkableReference<Node>(null, false);
}
topLevel = MAX_LEVEL;
}
@SuppressWarnings("unchecked")
public Node(Integer x, int height) {
value = x;
key = x.hashCode();
next = (AtomicMarkableReference<Node>[]) new AtomicMarkableReference[height + 1];
for (int i = 0; i < next.length; i++) {
next[i] = new AtomicMarkableReference<Node>(null, false);
}
topLevel = height;
}
}
public Log add(Integer x) {
int topLevel = randomLevel();
int bottomLevel = 0;
Node[] preds = (Node[]) new Node[MAX_LEVEL + 1];
Node[] succs = (Node[]) new Node[MAX_LEVEL + 1];
while (true) {
StampedBool stampedBool = find(x, preds, succs); // Linearization point failed.
boolean found = stampedBool.success;
long linTime = stampedBool.timestamp;
if (found) {
return new Log(x, "add", false, linTime);
} else {
Node newNode = new Node(x, topLevel);
for (int level = bottomLevel; level <= topLevel; level++) {
Node succ = succs[level];
newNode.next[level].set(succ, false);
}
Node pred = preds[bottomLevel];
Node succ = succs[bottomLevel];
if (useLinearizationLock)
linearizationLock.lock();
if(!pred.next[bottomLevel].compareAndSet(succ, newNode, false, false)) { // Linearization point success.
if (useLinearizationLock)
linearizationLock.unlock();
continue;
}
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
for(int level = bottomLevel+1; level <= topLevel; level++) {
while(true) {
pred = preds[level];
succ = succs[level];
if(pred.next[level].compareAndSet(succ, newNode, false, false))
break;
find(x, preds, succs);
}
}
return new Log(x, "add", true, linTime);
}
}
}
public Log remove(Integer x) {
int bottomLevel = 0;
Node[] preds = (Node[]) new Node[MAX_LEVEL + 1];
Node[] succs = (Node[]) new Node[MAX_LEVEL + 1];
Node succ;
while(true) {
StampedBool stampedBool = find(x, preds, succs); // Linearization point failed.
boolean found = stampedBool.success;
long linTime = stampedBool.timestamp;
if(!found) {
return new Log(x, "remove", false, linTime);
} else {
Node nodeToRemove = succs[bottomLevel];
for(int level = nodeToRemove.topLevel; level >= bottomLevel+1; level--) {
boolean[] marked = {false};
succ = nodeToRemove.next[level].get(marked);
while(!marked[0]) {
nodeToRemove.next[level].compareAndSet(succ, succ, false, true);
succ = nodeToRemove.next[level].get(marked);
}
}
boolean[] marked = {false};
succ = nodeToRemove.next[bottomLevel].get(marked);
while(true) {
if (useLinearizationLock)
linearizationLock.lock();
boolean iMarkedIt = nodeToRemove.next[bottomLevel].compareAndSet(succ, succ, false, true); // Linearization point success.
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
succ = succs[bottomLevel].next[bottomLevel].get(marked);
if(iMarkedIt) {
find(x, preds, succs);
return new Log(x, "remove", true, linTime);
}
else if(marked[0]) {
return new Log(x, "remove", false, 0); // Linearization point outside function, omit log.
}
}
}
}
}
StampedBool find(Integer x, Node[] preds, Node[] succs) {
long linTime = 0;
int bottomLevel = 0;
int key = x.hashCode();
boolean[] marked = {false};
boolean snip;
Node pred = null, curr = null, succ = null;
retry:
while (true) {
pred = head;
for(int level = MAX_LEVEL; level >= bottomLevel; level--) {
if (useLinearizationLock)
linearizationLock.lock();
curr = pred.next[level].getReference(); // Linearization point if last.
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
while (true) {
succ = curr.next[level].get(marked);
while(marked[0]) {
snip = pred.next[level].compareAndSet(curr, succ, false, false);
if(!snip) continue retry;
if (useLinearizationLock)
linearizationLock.lock();
curr = pred.next[level].getReference(); // Linearization point if last.
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
succ = curr.next[level].get(marked);
}
if(curr.key < key){
pred = curr; curr = succ;
} else {
break;
}
}
preds[level] = pred;
succs[level] = curr;
}
return new StampedBool(curr.key == key, linTime);
}
}
public Log contains(Integer x) {
long linTime = 0;
int bottomLevel = 0;
int v = x.hashCode();
boolean[] marked = {false};
Node pred = head, curr = null, succ = null;
for(int level = MAX_LEVEL; level >= bottomLevel; level--) {
if (useLinearizationLock)
linearizationLock.lock();
curr = pred.next[level].getReference(); // Linearization point if last.
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
while(true) {
succ = curr.next[level].get(marked);
while(marked[0]) {
if (useLinearizationLock)
linearizationLock.lock();
curr = curr.next[level].getReference(); // Linearization point if last.
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
succ = curr.next[level].get(marked);
}
if(curr.key < v){
pred = curr;
curr = succ;
} else {
break;
}
}
}
return new Log(x, "contains", (curr.key == v), linTime);
}
public LinkedList<Integer> toList() {
LinkedList<Integer> list = new LinkedList<Integer>();
Node currNode = head.next[0].getReference();
while(currNode != null && currNode.key != Integer.MAX_VALUE) {
list.add(currNode.key);
currNode = currNode.next[0].getReference();
}
return list;
}
// Code from https://stackoverflow.com/questions/12067045/random-level-function-in-skip-list
private static int randomLevel() {
int lvl = (int)(Math.log(1.-Math.random())/Math.log(0.5));
return Math.min(lvl, MAX_LEVEL);
}
private class StampedBool{
public boolean success;
public long timestamp;
public StampedBool(boolean success, long timestamp) {
this.success = success;
this.timestamp = timestamp;
}
}
}
|
UTF-8
|
Java
| 7,629 |
java
|
LockFreeSkipList.java
|
Java
|
[
{
"context": "de(Integer x, int height) {\n\t\t\tvalue = x;\n\t\t\tkey = x.hashCode();\n\t\t\tnext = (AtomicMarkableReference<Node>[]) new A",
"end": 1437,
"score": 0.9952755570411682,
"start": 1424,
"tag": "KEY",
"value": "x.hashCode();"
},
{
"context": "linTime = 0;\n\t\t\n\t\tint bottomLevel = 0;\n\t\tint key = x.hashCode();\n\t\tboolean[] marked = {false};\n\t\tboolean snip;\n",
"end": 4696,
"score": 0.9879531860351562,
"start": 4686,
"tag": "KEY",
"value": "x.hashCode"
}
] | null |
[] |
package skiplistPackage;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicMarkableReference;
import java.util.concurrent.locks.ReentrantLock;
import testPackage.Log;
// Most of the implementation directly from the code of H&S 14.4
public final class LockFreeSkipList {
static final int MAX_LEVEL = 32;
final Node head;
final Node tail;
final ReentrantLock linearizationLock;
private boolean useLinearizationLock;
public LockFreeSkipList(boolean useLinearizationLock) {
head = new Node(Integer.MIN_VALUE);
tail = new Node(Integer.MAX_VALUE);
linearizationLock = new ReentrantLock();
this.useLinearizationLock = useLinearizationLock;
for (int i = 0; i < head.next.length; i++) {
head.next[i] = new AtomicMarkableReference<LockFreeSkipList.Node>(tail, false);
}
this.useLinearizationLock = useLinearizationLock;
}
public static final class Node {
final Integer value;
final int key;
final AtomicMarkableReference<Node>[] next;
private int topLevel;
@SuppressWarnings("unchecked")
public Node(int key) {
value = null;
this.key = key;
next = (AtomicMarkableReference<Node>[]) new AtomicMarkableReference[MAX_LEVEL + 1];
for (int i = 0; i < next.length; i++) {
next[i] = new AtomicMarkableReference<Node>(null, false);
}
topLevel = MAX_LEVEL;
}
@SuppressWarnings("unchecked")
public Node(Integer x, int height) {
value = x;
key = x.hashCode();
next = (AtomicMarkableReference<Node>[]) new AtomicMarkableReference[height + 1];
for (int i = 0; i < next.length; i++) {
next[i] = new AtomicMarkableReference<Node>(null, false);
}
topLevel = height;
}
}
public Log add(Integer x) {
int topLevel = randomLevel();
int bottomLevel = 0;
Node[] preds = (Node[]) new Node[MAX_LEVEL + 1];
Node[] succs = (Node[]) new Node[MAX_LEVEL + 1];
while (true) {
StampedBool stampedBool = find(x, preds, succs); // Linearization point failed.
boolean found = stampedBool.success;
long linTime = stampedBool.timestamp;
if (found) {
return new Log(x, "add", false, linTime);
} else {
Node newNode = new Node(x, topLevel);
for (int level = bottomLevel; level <= topLevel; level++) {
Node succ = succs[level];
newNode.next[level].set(succ, false);
}
Node pred = preds[bottomLevel];
Node succ = succs[bottomLevel];
if (useLinearizationLock)
linearizationLock.lock();
if(!pred.next[bottomLevel].compareAndSet(succ, newNode, false, false)) { // Linearization point success.
if (useLinearizationLock)
linearizationLock.unlock();
continue;
}
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
for(int level = bottomLevel+1; level <= topLevel; level++) {
while(true) {
pred = preds[level];
succ = succs[level];
if(pred.next[level].compareAndSet(succ, newNode, false, false))
break;
find(x, preds, succs);
}
}
return new Log(x, "add", true, linTime);
}
}
}
public Log remove(Integer x) {
int bottomLevel = 0;
Node[] preds = (Node[]) new Node[MAX_LEVEL + 1];
Node[] succs = (Node[]) new Node[MAX_LEVEL + 1];
Node succ;
while(true) {
StampedBool stampedBool = find(x, preds, succs); // Linearization point failed.
boolean found = stampedBool.success;
long linTime = stampedBool.timestamp;
if(!found) {
return new Log(x, "remove", false, linTime);
} else {
Node nodeToRemove = succs[bottomLevel];
for(int level = nodeToRemove.topLevel; level >= bottomLevel+1; level--) {
boolean[] marked = {false};
succ = nodeToRemove.next[level].get(marked);
while(!marked[0]) {
nodeToRemove.next[level].compareAndSet(succ, succ, false, true);
succ = nodeToRemove.next[level].get(marked);
}
}
boolean[] marked = {false};
succ = nodeToRemove.next[bottomLevel].get(marked);
while(true) {
if (useLinearizationLock)
linearizationLock.lock();
boolean iMarkedIt = nodeToRemove.next[bottomLevel].compareAndSet(succ, succ, false, true); // Linearization point success.
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
succ = succs[bottomLevel].next[bottomLevel].get(marked);
if(iMarkedIt) {
find(x, preds, succs);
return new Log(x, "remove", true, linTime);
}
else if(marked[0]) {
return new Log(x, "remove", false, 0); // Linearization point outside function, omit log.
}
}
}
}
}
StampedBool find(Integer x, Node[] preds, Node[] succs) {
long linTime = 0;
int bottomLevel = 0;
int key = x.hashCode();
boolean[] marked = {false};
boolean snip;
Node pred = null, curr = null, succ = null;
retry:
while (true) {
pred = head;
for(int level = MAX_LEVEL; level >= bottomLevel; level--) {
if (useLinearizationLock)
linearizationLock.lock();
curr = pred.next[level].getReference(); // Linearization point if last.
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
while (true) {
succ = curr.next[level].get(marked);
while(marked[0]) {
snip = pred.next[level].compareAndSet(curr, succ, false, false);
if(!snip) continue retry;
if (useLinearizationLock)
linearizationLock.lock();
curr = pred.next[level].getReference(); // Linearization point if last.
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
succ = curr.next[level].get(marked);
}
if(curr.key < key){
pred = curr; curr = succ;
} else {
break;
}
}
preds[level] = pred;
succs[level] = curr;
}
return new StampedBool(curr.key == key, linTime);
}
}
public Log contains(Integer x) {
long linTime = 0;
int bottomLevel = 0;
int v = x.hashCode();
boolean[] marked = {false};
Node pred = head, curr = null, succ = null;
for(int level = MAX_LEVEL; level >= bottomLevel; level--) {
if (useLinearizationLock)
linearizationLock.lock();
curr = pred.next[level].getReference(); // Linearization point if last.
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
while(true) {
succ = curr.next[level].get(marked);
while(marked[0]) {
if (useLinearizationLock)
linearizationLock.lock();
curr = curr.next[level].getReference(); // Linearization point if last.
linTime = System.nanoTime();
if (useLinearizationLock)
linearizationLock.unlock();
succ = curr.next[level].get(marked);
}
if(curr.key < v){
pred = curr;
curr = succ;
} else {
break;
}
}
}
return new Log(x, "contains", (curr.key == v), linTime);
}
public LinkedList<Integer> toList() {
LinkedList<Integer> list = new LinkedList<Integer>();
Node currNode = head.next[0].getReference();
while(currNode != null && currNode.key != Integer.MAX_VALUE) {
list.add(currNode.key);
currNode = currNode.next[0].getReference();
}
return list;
}
// Code from https://stackoverflow.com/questions/12067045/random-level-function-in-skip-list
private static int randomLevel() {
int lvl = (int)(Math.log(1.-Math.random())/Math.log(0.5));
return Math.min(lvl, MAX_LEVEL);
}
private class StampedBool{
public boolean success;
public long timestamp;
public StampedBool(boolean success, long timestamp) {
this.success = success;
this.timestamp = timestamp;
}
}
}
| 7,629 | 0.645432 | 0.640189 | 260 | 28.342308 | 23.026617 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.980769 | false | false |
14
|
32aae22e876fdf2e864fdae9e822f4ec0a11470b
| 31,516,470,079,187 |
33a94ed4d65973c97a3bc19e47e79e41f6647c41
|
/lottery-interface/src/org/x/info/PageAction.java
|
f81d71f859a7e264060fb9ead6b9a971231d91fa
|
[] |
no_license
|
xiangtone/lottery
|
https://github.com/xiangtone/lottery
|
eb6fd0febf4dbaeb97d56d80af0ec4e663d92320
|
72d4aa8514239be6d03b086ec6e725e51bd1532f
|
refs/heads/master
| 2021-03-22T03:29:46.576000 | 2017-02-20T09:06:08 | 2017-02-20T09:06:08 | 62,270,747 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.x.info;
import java.util.Map;
public class PageAction {
private String url;
private Map<String, String> entity;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Map<String, String> getEntity() {
return entity;
}
public void setEntity(Map<String, String> entity) {
this.entity = entity;
}
}
|
UTF-8
|
Java
| 376 |
java
|
PageAction.java
|
Java
|
[] | null |
[] |
package org.x.info;
import java.util.Map;
public class PageAction {
private String url;
private Map<String, String> entity;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Map<String, String> getEntity() {
return entity;
}
public void setEntity(Map<String, String> entity) {
this.entity = entity;
}
}
| 376 | 0.683511 | 0.683511 | 26 | 13.461538 | 14.897678 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.115385 | false | false |
14
|
ab76344f4454ae954c3caebebd5f22028d2c1075
| 1,494,648,626,753 |
b9a1de4e584de757fc3128a61d7032c3486c21f8
|
/src/main/java/cn/dombro/simpleioc/helper/ClassHelper.java
|
8a96785a408c79f762a080c85d119676e496a1c8
|
[] |
no_license
|
DomBro96/simpleioc
|
https://github.com/DomBro96/simpleioc
|
d3608b416646216d68f896d3bee7204463fdadaa
|
3eb7bcb700507ab872f64a68b368d50ddbb61bfb
|
refs/heads/master
| 2021-05-07T01:44:46.535000 | 2017-11-22T08:48:02 | 2017-11-22T08:48:02 | 110,328,257 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.dombro.simpleioc.helper;
import cn.dombro.simpleioc.annotation.Common;
import cn.dombro.simpleioc.annotation.Controller;
import cn.dombro.simpleioc.annotation.Service;
import cn.dombro.simpleioc.util.ClassUtil;
import cn.dombro.simpleioc.util.PropsUtil;
import java.util.HashSet;
import java.util.Set;
/**
* 类对象操作助手类
*/
public class ClassHelper {
private static Set<Class<?>> CLASS_SET ;
static {
String basePackage = PropsUtil.getString(PropsUtil.loadProps("ioc.properties"),"base_package");
CLASS_SET = ClassUtil.getClassSet(basePackage);
}
/**
* 获取包名下所有的类
* @return
*/
public static Set<Class<?>> getClassSet(){
return CLASS_SET;
}
/**
* 获取包名下所有 Common
*/
public static Set<Class<?>> getCommonClassSet(){
Set<Class<?>> classSet = new HashSet<>();
for (Class<?> cls : CLASS_SET){
if (cls.isAnnotationPresent(Common.class))
classSet.add(cls);
}
return classSet;
}
/**
* 获取包名下所有 Service
*/
public static Set<Class<?>> getServiceClassSet(){
Set<Class<?>> classSet = new HashSet<>();
for (Class<?> cls : CLASS_SET){
if (cls.isAnnotationPresent(Service.class))
classSet.add(cls);
}
return classSet;
}
/**
* 获取包名下所有 Controller
*/
public static Set<Class<?>> getControllerClassSet(){
Set<Class<?>> classSet = new HashSet<>();
for (Class<?> cls : CLASS_SET){
if (cls.isAnnotationPresent(Controller.class))
classSet.add(cls);
}
return classSet;
}
/**
* 获取包名下所有 Bean
*/
public static Set<Class<?>> getBeanClassSet(){
Set<Class<?>> beanClassSet = new HashSet<>();
beanClassSet.addAll(getCommonClassSet());
beanClassSet.addAll(getServiceClassSet());
beanClassSet.addAll(getControllerClassSet());
return beanClassSet;
}
}
|
UTF-8
|
Java
| 2,101 |
java
|
ClassHelper.java
|
Java
|
[] | null |
[] |
package cn.dombro.simpleioc.helper;
import cn.dombro.simpleioc.annotation.Common;
import cn.dombro.simpleioc.annotation.Controller;
import cn.dombro.simpleioc.annotation.Service;
import cn.dombro.simpleioc.util.ClassUtil;
import cn.dombro.simpleioc.util.PropsUtil;
import java.util.HashSet;
import java.util.Set;
/**
* 类对象操作助手类
*/
public class ClassHelper {
private static Set<Class<?>> CLASS_SET ;
static {
String basePackage = PropsUtil.getString(PropsUtil.loadProps("ioc.properties"),"base_package");
CLASS_SET = ClassUtil.getClassSet(basePackage);
}
/**
* 获取包名下所有的类
* @return
*/
public static Set<Class<?>> getClassSet(){
return CLASS_SET;
}
/**
* 获取包名下所有 Common
*/
public static Set<Class<?>> getCommonClassSet(){
Set<Class<?>> classSet = new HashSet<>();
for (Class<?> cls : CLASS_SET){
if (cls.isAnnotationPresent(Common.class))
classSet.add(cls);
}
return classSet;
}
/**
* 获取包名下所有 Service
*/
public static Set<Class<?>> getServiceClassSet(){
Set<Class<?>> classSet = new HashSet<>();
for (Class<?> cls : CLASS_SET){
if (cls.isAnnotationPresent(Service.class))
classSet.add(cls);
}
return classSet;
}
/**
* 获取包名下所有 Controller
*/
public static Set<Class<?>> getControllerClassSet(){
Set<Class<?>> classSet = new HashSet<>();
for (Class<?> cls : CLASS_SET){
if (cls.isAnnotationPresent(Controller.class))
classSet.add(cls);
}
return classSet;
}
/**
* 获取包名下所有 Bean
*/
public static Set<Class<?>> getBeanClassSet(){
Set<Class<?>> beanClassSet = new HashSet<>();
beanClassSet.addAll(getCommonClassSet());
beanClassSet.addAll(getServiceClassSet());
beanClassSet.addAll(getControllerClassSet());
return beanClassSet;
}
}
| 2,101 | 0.594729 | 0.594729 | 84 | 22.940475 | 21.654951 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.321429 | false | false |
14
|
fe89a7c9b28fcea194df4faafd42ca37518cef9b
| 32,418,413,207,551 |
c1ea7e316a4fa44bb475ebda2f3a914029ecb646
|
/src/main/java/com/manhlee/flight_booking_online/repository/OperationsRepository.java
|
30d876c37fe1da89ab791c84de93332d15347dc0
|
[] |
no_license
|
Negu-teppi/ProjectFinal
|
https://github.com/Negu-teppi/ProjectFinal
|
14db39be9819a1c1c82e4ddb3e2e3ea75441d061
|
5cc5d60569426261c1a7dc5a202b1a59c426e5db
|
refs/heads/main
| 2023-08-30T19:42:12.795000 | 2021-11-13T21:50:01 | 2021-11-13T21:50:01 | 427,619,864 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.manhlee.flight_booking_online.repository;
import com.manhlee.flight_booking_online.entities.OperationEntity;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface OperationsRepository extends CrudRepository<OperationEntity, Integer> {
}
|
UTF-8
|
Java
| 335 |
java
|
OperationsRepository.java
|
Java
|
[] | null |
[] |
package com.manhlee.flight_booking_online.repository;
import com.manhlee.flight_booking_online.entities.OperationEntity;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface OperationsRepository extends CrudRepository<OperationEntity, Integer> {
}
| 335 | 0.859702 | 0.859702 | 9 | 36.222221 | 31.600906 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false |
14
|
5f7a9ef81352acc857385fb9ff274cd1525eb861
| 28,570,122,500,629 |
a99deaad0608b33ed57b6ed82cbfd51a91a8fc55
|
/src/java/Classes/DB_Connect_Admin.java
|
9b109bb77b015c69d153acbda87c46949e90b7ec
|
[] |
no_license
|
adamhw/StockAppSadProject
|
https://github.com/adamhw/StockAppSadProject
|
d3a5960ec213dc7222a22d40033aab6c95b266bf
|
5b552edf4dd1b58c117891fcfcf24567bf862c33
|
refs/heads/master
| 2016-06-08T14:28:01.079000 | 2016-05-21T14:39:09 | 2016-05-21T14:39:09 | 59,364,359 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* 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 Classes;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*
* @author Adam
*/
public class DB_Connect_Admin {
private static final String DBURL = "jdbc:mysql://localhost/stockAppDb";
private static final String DBUserName = "root";
private static final String DBPassword = "";
public static Staff checkUser(String username, String password) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
Staff staff = new Staff();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "Select * FROM staff WHERE username LIKE '" + username
+ "' AND password LIKE '" + password + "'";
rs = optionalStatement.executeQuery(optionalQuery);
if(!rs.next()){
return null;
}
else{
staff.setId(rs.getInt("id"));
staff.setFirstName(rs.getString("firstName"));
staff.setLastName(rs.getString("lastName"));
staff.setUsername(rs.getString("username"));
staff.setPassword(rs.getString("password"));
staff.setPosition(rs.getString("position"));
return staff;
}
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static ArrayList<RawStock> getRawStock() throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<RawStock> rawStockList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit FROM rawStock ORDER BY name";
rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
do{
rawStockList.add(new RawStock(rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit")));
}
while(rs.next());
return rawStockList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static int addRawStock(String name, double stock, double minimum, String unit) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "INSERT INTO rawStock VALUES(DEFAULT, '" + name + "', '"
+ stock + "', '" + minimum + "', '" + unit + "')";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int addStaff(String firstName, String lastName, String username, String password, String position) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "INSERT INTO staff VALUES(DEFAULT, '" + firstName + "', '"
+ lastName + "', '" + username + "', '" + password + "', '" + position + "')";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static ArrayList<ProcessedStock> getProcessedStock() throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<ProcessedStock> processedStockList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit, rawId FROM processedStock ORDER BY name";
rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
do{
processedStockList.add(new ProcessedStock(rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit"),
rs.getInt("rawId")));
}
while(rs.next());
return processedStockList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static int addProcessedStock(String name, double stock, double minimum, String unit, int rawId) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "INSERT INTO processedStock VALUES(DEFAULT, '" + name
+ "', '" + stock + "', '" + minimum + "', '" + unit + "', '" + rawId + "')";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int addBeverageStock(String name, double stock, double minimum, String unit) throws ClassNotFoundException {
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "INSERT INTO beverageStock VALUES(DEFAULT, '" + name + "', '"
+ stock + "', '" + minimum + "', '" + unit + "')";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static RawStock chooseRawStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit FROM rawStock WHERE id = '"+ id + "'";
ResultSet rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
RawStock rawStock = new RawStock (rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit"));
return rawStock;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static int editRawStock(int id, String name, double stock, double minimum, String unit) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "UPDATE rawStock SET name='" + name + "', stock='" + stock
+ "', minimum='" + minimum + "', unit='" + unit + "' WHERE id ='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int removeRawStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "DELETE FROM rawStock WHERE id='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static ProcessedStock chooseProcessedStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit, rawId FROM processedStock WHERE id = '"+ id + "'";
ResultSet rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
ProcessedStock processedStock = new ProcessedStock (rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit"), rs.getInt("rawId"));
return processedStock;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static int editProcessedStock(int id, String name, double stock, double minimum, String unit, int rawId) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "UPDATE processedStock SET name='" + name + "', stock='" + stock
+ "', minimum='" + minimum + "', unit='" + unit + "', rawId='" + rawId + "' WHERE id = '" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int removeProcessedStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "DELETE FROM processedStock WHERE id='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int removeBeverageStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "DELETE FROM beverageStock WHERE id='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int removeUser(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "DELETE FROM staff WHERE id='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int removeRecipe(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "DELETE FROM ingredient WHERE recipeId='" + id + "'";
if(optionalStatement.executeUpdate(optionalQuery) == 0){
return 0;
}
optionalQuery = "DELETE FROM recipe WHERE id='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static ArrayList<BeverageStock> getBeverageStock() throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<BeverageStock> beverageStockList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit FROM beverageStock ORDER BY name";
rs = optionalStatement.executeQuery(optionalQuery);
if(rs == null){
return null;
}
rs.next();
do{
beverageStockList.add(new BeverageStock(rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit")));
}
while(rs.next());
return beverageStockList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static BeverageStock chooseBeverageStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit FROM beverageStock WHERE id = '"+ id + "'";
ResultSet rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
BeverageStock beverageStock = new BeverageStock (rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit"));
return beverageStock;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static int editBeverageStock(int id, String name, double stock, double minimum, String unit) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "UPDATE beverageStock SET name='" + name + "', stock='" + stock
+ "', minimum='" + minimum + "', unit='" + unit + "' WHERE id ='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static ArrayList<Recipe> getRecipe() throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<Recipe> recipeList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, category FROM recipe ORDER BY name";
rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
do{
recipeList.add(new Recipe(rs.getInt("id"), rs.getString("name"), rs.getString("category")));
}
while(rs.next());
return recipeList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static ArrayList<Ingredient> getIngredientList(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<Ingredient> ingredientList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT recipeId, stockId, stockTypeId, amount FROM ingredient WHERE recipeId='" + id + "'";
rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
do{
ingredientList.add(new Ingredient(rs.getInt("recipeId"), rs.getInt("stockId"),
rs.getInt("stockTypeId"), rs.getDouble("amount")));
}
while(rs.next());
return ingredientList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static ArrayList<Staff> getStaff() throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<Staff> staffList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, firstName, lastName, username, password, position FROM staff ORDER BY lastName";
rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
do{
staffList.add(new Staff(rs.getInt("id"), rs.getString("firstName"), rs.getString("lastName"),
rs.getString("username"), rs.getString("password"), rs.getString("position")));
}
while(rs.next());
return staffList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
}
|
UTF-8
|
Java
| 22,023 |
java
|
DB_Connect_Admin.java
|
Java
|
[
{
"context": "import javax.swing.JOptionPane;\n\n/**\n *\n * @author Adam\n */\npublic class DB_Connect_Admin {\n private s",
"end": 399,
"score": 0.9953816533088684,
"start": 395,
"tag": "NAME",
"value": "Adam"
},
{
"context": "nalQuery = \"INSERT INTO staff VALUES(DEFAULT, '\" + firstName + \"', '\"\n + lastName + \"', '\" ",
"end": 4550,
"score": 0.552649974822998,
"start": 4541,
"tag": "NAME",
"value": "firstName"
}
] | null |
[] |
/*
* 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 Classes;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*
* @author Adam
*/
public class DB_Connect_Admin {
private static final String DBURL = "jdbc:mysql://localhost/stockAppDb";
private static final String DBUserName = "root";
private static final String DBPassword = "";
public static Staff checkUser(String username, String password) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
Staff staff = new Staff();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "Select * FROM staff WHERE username LIKE '" + username
+ "' AND password LIKE '" + password + "'";
rs = optionalStatement.executeQuery(optionalQuery);
if(!rs.next()){
return null;
}
else{
staff.setId(rs.getInt("id"));
staff.setFirstName(rs.getString("firstName"));
staff.setLastName(rs.getString("lastName"));
staff.setUsername(rs.getString("username"));
staff.setPassword(rs.getString("password"));
staff.setPosition(rs.getString("position"));
return staff;
}
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static ArrayList<RawStock> getRawStock() throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<RawStock> rawStockList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit FROM rawStock ORDER BY name";
rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
do{
rawStockList.add(new RawStock(rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit")));
}
while(rs.next());
return rawStockList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static int addRawStock(String name, double stock, double minimum, String unit) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "INSERT INTO rawStock VALUES(DEFAULT, '" + name + "', '"
+ stock + "', '" + minimum + "', '" + unit + "')";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int addStaff(String firstName, String lastName, String username, String password, String position) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "INSERT INTO staff VALUES(DEFAULT, '" + firstName + "', '"
+ lastName + "', '" + username + "', '" + password + "', '" + position + "')";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static ArrayList<ProcessedStock> getProcessedStock() throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<ProcessedStock> processedStockList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit, rawId FROM processedStock ORDER BY name";
rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
do{
processedStockList.add(new ProcessedStock(rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit"),
rs.getInt("rawId")));
}
while(rs.next());
return processedStockList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static int addProcessedStock(String name, double stock, double minimum, String unit, int rawId) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "INSERT INTO processedStock VALUES(DEFAULT, '" + name
+ "', '" + stock + "', '" + minimum + "', '" + unit + "', '" + rawId + "')";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int addBeverageStock(String name, double stock, double minimum, String unit) throws ClassNotFoundException {
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "INSERT INTO beverageStock VALUES(DEFAULT, '" + name + "', '"
+ stock + "', '" + minimum + "', '" + unit + "')";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static RawStock chooseRawStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit FROM rawStock WHERE id = '"+ id + "'";
ResultSet rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
RawStock rawStock = new RawStock (rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit"));
return rawStock;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static int editRawStock(int id, String name, double stock, double minimum, String unit) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "UPDATE rawStock SET name='" + name + "', stock='" + stock
+ "', minimum='" + minimum + "', unit='" + unit + "' WHERE id ='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int removeRawStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "DELETE FROM rawStock WHERE id='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static ProcessedStock chooseProcessedStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit, rawId FROM processedStock WHERE id = '"+ id + "'";
ResultSet rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
ProcessedStock processedStock = new ProcessedStock (rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit"), rs.getInt("rawId"));
return processedStock;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static int editProcessedStock(int id, String name, double stock, double minimum, String unit, int rawId) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "UPDATE processedStock SET name='" + name + "', stock='" + stock
+ "', minimum='" + minimum + "', unit='" + unit + "', rawId='" + rawId + "' WHERE id = '" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int removeProcessedStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "DELETE FROM processedStock WHERE id='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int removeBeverageStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "DELETE FROM beverageStock WHERE id='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int removeUser(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "DELETE FROM staff WHERE id='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static int removeRecipe(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "DELETE FROM ingredient WHERE recipeId='" + id + "'";
if(optionalStatement.executeUpdate(optionalQuery) == 0){
return 0;
}
optionalQuery = "DELETE FROM recipe WHERE id='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static ArrayList<BeverageStock> getBeverageStock() throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<BeverageStock> beverageStockList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit FROM beverageStock ORDER BY name";
rs = optionalStatement.executeQuery(optionalQuery);
if(rs == null){
return null;
}
rs.next();
do{
beverageStockList.add(new BeverageStock(rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit")));
}
while(rs.next());
return beverageStockList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static BeverageStock chooseBeverageStock(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, stock, minimum, unit FROM beverageStock WHERE id = '"+ id + "'";
ResultSet rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
BeverageStock beverageStock = new BeverageStock (rs.getInt("id"), rs.getString("name"),
rs.getDouble("stock"), rs.getDouble("minimum"), rs.getString("unit"));
return beverageStock;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static int editBeverageStock(int id, String name, double stock, double minimum, String unit) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "UPDATE beverageStock SET name='" + name + "', stock='" + stock
+ "', minimum='" + minimum + "', unit='" + unit + "' WHERE id ='" + id + "'";
return optionalStatement.executeUpdate(optionalQuery);
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return 0;
}
}
public static ArrayList<Recipe> getRecipe() throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<Recipe> recipeList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, name, category FROM recipe ORDER BY name";
rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
do{
recipeList.add(new Recipe(rs.getInt("id"), rs.getString("name"), rs.getString("category")));
}
while(rs.next());
return recipeList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static ArrayList<Ingredient> getIngredientList(int id) throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<Ingredient> ingredientList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT recipeId, stockId, stockTypeId, amount FROM ingredient WHERE recipeId='" + id + "'";
rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
do{
ingredientList.add(new Ingredient(rs.getInt("recipeId"), rs.getInt("stockId"),
rs.getInt("stockTypeId"), rs.getDouble("amount")));
}
while(rs.next());
return ingredientList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
public static ArrayList<Staff> getStaff() throws ClassNotFoundException{
String optionalQuery;
Connection optionalConnection;
Statement optionalStatement;
ResultSet rs;
ArrayList<Staff> staffList = new ArrayList<>();
Class.forName("com.mysql.jdbc.Driver");
try{
optionalConnection = DriverManager.getConnection(DBURL, DBUserName, DBPassword);
optionalStatement = optionalConnection.createStatement();
optionalQuery = "SELECT id, firstName, lastName, username, password, position FROM staff ORDER BY lastName";
rs = optionalStatement.executeQuery(optionalQuery);
rs.next();
do{
staffList.add(new Staff(rs.getInt("id"), rs.getString("firstName"), rs.getString("lastName"),
rs.getString("username"), rs.getString("password"), rs.getString("position")));
}
while(rs.next());
return staffList;
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
return null;
}
}
}
| 22,023 | 0.590564 | 0.589929 | 552 | 38.89674 | 31.477249 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.878623 | false | false |
14
|
85e9b726bd033ebbeb5b09ddab22c7c01a98cb60
| 11,725,260,719,084 |
4821c3cf229ff07a7a1633ec1e42b6c714245e51
|
/src/com/banksoft/XinChengShop/ui/DispatchOrderManagerActivity.java
|
80fc161c40696c6535eef2fbf013668cb8ec0e86
|
[] |
no_license
|
HarryRobin2011/XinchengShop
|
https://github.com/HarryRobin2011/XinchengShop
|
8040cb79269df7cac0a112724fb5ce89e7835fff
|
be38a32a9fbbb61bc30b70b4f754e4ed7a5f6ee5
|
refs/heads/master
| 2020-04-12T02:32:27.753000 | 2017-02-06T23:15:45 | 2017-02-06T23:15:45 | 62,385,673 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.banksoft.XinChengShop.ui;
import android.content.Intent;
import android.os.AsyncTask;
import android.view.View;
import android.widget.*;
import com.banksoft.XinChengShop.R;
import com.banksoft.XinChengShop.config.IntentFlag;
import com.banksoft.XinChengShop.dao.DispatchDao;
import com.banksoft.XinChengShop.model.DispatchMemberData;
import com.banksoft.XinChengShop.ui.base.XCBaseActivity;
/**
* Created by Robin on 2016/4/23.
*/
public class DispatchOrderManagerActivity extends XCBaseActivity implements View.OnClickListener{
private LinearLayout myDispatchOrder, newDispatchOrder,toolLayout;
private Button applyDispatch;
private TextView title;
private ImageView back;
private ProgressBar mProgressBar;
private DispatchDao dispatchDao;
private int APPLY_DISPATCHER = 0;// 申请派单员
@Override
protected void initContentView() {
setContentView(R.layout.dispatch_order_manager_layout);
}
@Override
protected void initView() {
myDispatchOrder = (LinearLayout) findViewById(R.id.my_dispatch_order);
newDispatchOrder = (LinearLayout) findViewById(R.id.new_dispatch_order);
title = (TextView) findViewById(R.id.titleText);
back = (ImageView) findViewById(R.id.title_back_button);
applyDispatch = (Button) findViewById(R.id.apply_dispatch);
mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
toolLayout = (LinearLayout) findViewById(R.id.tool_layout);
}
@Override
protected void initData() {
title.setText(R.string.dispatch_manager_title);
back.setVisibility(View.VISIBLE);
back.setOnClickListener(this);
applyDispatch.setOnClickListener(this);
myDispatchOrder.setOnClickListener(this);
newDispatchOrder.setOnClickListener(this);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == APPLY_DISPATCHER){
}
}
@Override
protected void initOperate() {
if(dispatchDao == null){
dispatchDao = new DispatchDao(mContext);
}
new MyThread().execute(dispatchDao);
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.my_dispatch_order:// 我的派送订单
Intent intent = new Intent(mContext,ExpressBillListActivity.class);
intent.putExtra(IntentFlag.TYPE,ExpressBillListActivity.OperaType.MY_DISPATH_ORDER);
startActivity(intent);
break;
case R.id.new_dispatch_order://新的派送订单
Intent newIntent = new Intent(mContext,ExpressBillListActivity.class);
newIntent.putExtra(IntentFlag.TYPE,ExpressBillListActivity.OperaType.NEW_DISPATCH_ORDER);
startActivity(newIntent);
break;
case R.id.title_back_button://
finish();
break;
case R.id.apply_dispatch:// 申请派单员
Intent dispatchIntent = new Intent(mContext,ApplyDispatcherActivity.class);
startActivity(dispatchIntent);
break;
}
}
private class MyThread extends AsyncTask<DispatchDao,String,DispatchMemberData>{
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressBar.setVisibility(View.VISIBLE);
}
@Override
protected DispatchMemberData doInBackground(DispatchDao... params) {
return params[0].getDispatchMemberData(member.getMember().getId(),false);
}
@Override
protected void onPostExecute(DispatchMemberData dispatchMemberData) {
super.onPostExecute(dispatchMemberData);
mProgressBar.setVisibility(View.GONE);
if(dispatchMemberData.isSuccess() || dispatchMemberData.getCode() == 2){// 是派单员
toolLayout.setVisibility(View.VISIBLE);
applyDispatch.setVisibility(View.GONE);
}else{
toolLayout.setVisibility(View.GONE);
applyDispatch.setVisibility(View.VISIBLE);
}
}
}
}
|
UTF-8
|
Java
| 4,305 |
java
|
DispatchOrderManagerActivity.java
|
Java
|
[
{
"context": "engShop.ui.base.XCBaseActivity;\n\n/**\n * Created by Robin on 2016/4/23.\n */\npublic class DispatchOrderManag",
"end": 428,
"score": 0.9930971264839172,
"start": 423,
"tag": "USERNAME",
"value": "Robin"
}
] | null |
[] |
package com.banksoft.XinChengShop.ui;
import android.content.Intent;
import android.os.AsyncTask;
import android.view.View;
import android.widget.*;
import com.banksoft.XinChengShop.R;
import com.banksoft.XinChengShop.config.IntentFlag;
import com.banksoft.XinChengShop.dao.DispatchDao;
import com.banksoft.XinChengShop.model.DispatchMemberData;
import com.banksoft.XinChengShop.ui.base.XCBaseActivity;
/**
* Created by Robin on 2016/4/23.
*/
public class DispatchOrderManagerActivity extends XCBaseActivity implements View.OnClickListener{
private LinearLayout myDispatchOrder, newDispatchOrder,toolLayout;
private Button applyDispatch;
private TextView title;
private ImageView back;
private ProgressBar mProgressBar;
private DispatchDao dispatchDao;
private int APPLY_DISPATCHER = 0;// 申请派单员
@Override
protected void initContentView() {
setContentView(R.layout.dispatch_order_manager_layout);
}
@Override
protected void initView() {
myDispatchOrder = (LinearLayout) findViewById(R.id.my_dispatch_order);
newDispatchOrder = (LinearLayout) findViewById(R.id.new_dispatch_order);
title = (TextView) findViewById(R.id.titleText);
back = (ImageView) findViewById(R.id.title_back_button);
applyDispatch = (Button) findViewById(R.id.apply_dispatch);
mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
toolLayout = (LinearLayout) findViewById(R.id.tool_layout);
}
@Override
protected void initData() {
title.setText(R.string.dispatch_manager_title);
back.setVisibility(View.VISIBLE);
back.setOnClickListener(this);
applyDispatch.setOnClickListener(this);
myDispatchOrder.setOnClickListener(this);
newDispatchOrder.setOnClickListener(this);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == APPLY_DISPATCHER){
}
}
@Override
protected void initOperate() {
if(dispatchDao == null){
dispatchDao = new DispatchDao(mContext);
}
new MyThread().execute(dispatchDao);
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.my_dispatch_order:// 我的派送订单
Intent intent = new Intent(mContext,ExpressBillListActivity.class);
intent.putExtra(IntentFlag.TYPE,ExpressBillListActivity.OperaType.MY_DISPATH_ORDER);
startActivity(intent);
break;
case R.id.new_dispatch_order://新的派送订单
Intent newIntent = new Intent(mContext,ExpressBillListActivity.class);
newIntent.putExtra(IntentFlag.TYPE,ExpressBillListActivity.OperaType.NEW_DISPATCH_ORDER);
startActivity(newIntent);
break;
case R.id.title_back_button://
finish();
break;
case R.id.apply_dispatch:// 申请派单员
Intent dispatchIntent = new Intent(mContext,ApplyDispatcherActivity.class);
startActivity(dispatchIntent);
break;
}
}
private class MyThread extends AsyncTask<DispatchDao,String,DispatchMemberData>{
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressBar.setVisibility(View.VISIBLE);
}
@Override
protected DispatchMemberData doInBackground(DispatchDao... params) {
return params[0].getDispatchMemberData(member.getMember().getId(),false);
}
@Override
protected void onPostExecute(DispatchMemberData dispatchMemberData) {
super.onPostExecute(dispatchMemberData);
mProgressBar.setVisibility(View.GONE);
if(dispatchMemberData.isSuccess() || dispatchMemberData.getCode() == 2){// 是派单员
toolLayout.setVisibility(View.VISIBLE);
applyDispatch.setVisibility(View.GONE);
}else{
toolLayout.setVisibility(View.GONE);
applyDispatch.setVisibility(View.VISIBLE);
}
}
}
}
| 4,305 | 0.65977 | 0.657418 | 116 | 35.663792 | 27.453705 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62069 | false | false |
14
|
79fd711713aff5795333dc77a9c882aedcf87c82
| 22,943,715,322,005 |
2ca1020957a88aff4aaa172a4a2ae687886fadb5
|
/unit9/lesson2/U9L2Q2.java
|
ae99b2f83a53ebdad00eb7cf88e873c62b23c225
|
[
"MIT"
] |
permissive
|
greg4333/apcsa2020
|
https://github.com/greg4333/apcsa2020
|
6946df5d1fc791e3452ff729790ddf91ae46e827
|
7fccfb1eaae52a2b7b15a3e27dad1186dde09d95
|
refs/heads/master
| 2023-04-08T15:35:52.618000 | 2021-04-15T06:56:28 | 2021-04-15T06:56:28 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class DoubleCone extends Cone{
private String flavor="";
public DoubleCone(String f, boolean w)
{
super(f,w);
flavor=f;
}
public DoubleCone(String f1, String f2, boolean w){
super(f1,w);
flavor=f2;
}
public void setFlavor(String f1, String f2)
{
super.setFlavor(f1);
flavor=f2;
}
public void setFlavor(String f1)
{
super.setFlavor(f1);
flavor=f1;
}
public String toString()
{
return "double "+super.toString()+" and "+flavor;
}
}
|
UTF-8
|
Java
| 532 |
java
|
U9L2Q2.java
|
Java
|
[] | null |
[] |
public class DoubleCone extends Cone{
private String flavor="";
public DoubleCone(String f, boolean w)
{
super(f,w);
flavor=f;
}
public DoubleCone(String f1, String f2, boolean w){
super(f1,w);
flavor=f2;
}
public void setFlavor(String f1, String f2)
{
super.setFlavor(f1);
flavor=f2;
}
public void setFlavor(String f1)
{
super.setFlavor(f1);
flavor=f1;
}
public String toString()
{
return "double "+super.toString()+" and "+flavor;
}
}
| 532 | 0.593985 | 0.573308 | 36 | 13.777778 | 15.755265 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false |
14
|
580c1cd80d52aee26cd6a83760e5fe2a54c7835e
| 25,520,695,675,010 |
51adf2d99568aef990f86887a09057e619a57ce0
|
/readbook_datagenerator/src/main/java/com/wenhua/readbook/datagenerator/service/impl/ReadbookCommentArticleServiceImpl.java
|
ba5a6ce214e026f6d680ac0573f1f64617ec1346
|
[
"MIT"
] |
permissive
|
qinyuqiong/readbook
|
https://github.com/qinyuqiong/readbook
|
c2d87a9040bed4a19a29ff1c12943df420ba9a3d
|
a0897264c69159c43b25efa55f776aa6e99eef61
|
refs/heads/dev
| 2021-07-15T17:41:48.625000 | 2021-05-21T13:11:23 | 2021-05-21T13:11:23 | 246,989,980 | 3 | 3 | null | false | 2020-10-10T06:24:08 | 2020-03-13T04:45:22 | 2020-10-06T06:38:10 | 2020-10-10T05:59:30 | 97,580 | 3 | 2 | 0 |
Java
| false | false |
package com.wenhua.readbook.datagenerator.service.impl;
import com.wenhua.readbook.datagenerator.entity.ReadbookCommentArticle;
import com.wenhua.readbook.datagenerator.mapper.ReadbookCommentArticleMapper;
import com.wenhua.readbook.datagenerator.service.ReadbookCommentArticleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author testjava
* @since 2020-09-29
*/
@Service
public class ReadbookCommentArticleServiceImpl extends ServiceImpl<ReadbookCommentArticleMapper, ReadbookCommentArticle> implements ReadbookCommentArticleService {
}
|
UTF-8
|
Java
| 666 |
java
|
ReadbookCommentArticleServiceImpl.java
|
Java
|
[
{
"context": "rvice;\n\n/**\n * <p>\n * 服务实现类\n * </p>\n *\n * @author testjava\n * @since 2020-09-29\n */\n@Service\npublic class Re",
"end": 454,
"score": 0.9994692802429199,
"start": 446,
"tag": "USERNAME",
"value": "testjava"
}
] | null |
[] |
package com.wenhua.readbook.datagenerator.service.impl;
import com.wenhua.readbook.datagenerator.entity.ReadbookCommentArticle;
import com.wenhua.readbook.datagenerator.mapper.ReadbookCommentArticleMapper;
import com.wenhua.readbook.datagenerator.service.ReadbookCommentArticleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author testjava
* @since 2020-09-29
*/
@Service
public class ReadbookCommentArticleServiceImpl extends ServiceImpl<ReadbookCommentArticleMapper, ReadbookCommentArticle> implements ReadbookCommentArticleService {
}
| 666 | 0.832317 | 0.820122 | 20 | 31.799999 | 41.351662 | 163 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | false | false |
14
|
9f66e65ba04201c3b1dfbed5c06ae43faabef470
| 12,300,786,358,930 |
80faeaa44ca19bfe14a0c4784dd851ba42c0304f
|
/GCC178 - Práticas de Programação Orientada a Objetos/Listas/01 - Lista sobre Conceitos Básicos/Ex3/CarrinhoTeste.java
|
774dc84e47b96ae2b91fde5b84b1757818b1929f
|
[] |
no_license
|
mateuscarvalhog/UFLA-2019-2
|
https://github.com/mateuscarvalhog/UFLA-2019-2
|
8e58db380a83bc410b55bb00c5573806d7b3c687
|
009c9794e0792c6666a254dd91e8777f72d568a9
|
refs/heads/main
| 2023-02-17T20:13:31.620000 | 2021-01-20T17:09:15 | 2021-01-20T17:09:15 | 331,121,457 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Scanner;
import java.lang.String;
public class CarrinhoTeste {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
String cliente = entrada.next();
int dia = entrada.nextInt();
int mes = entrada.nextInt();
int ano = entrada.nextInt();
Carrinho car = new Carrinho(cliente, dia, mes, ano);
for(int i = 0; i < 5; i++) {
car.inserirItem(entrada.next());
}
car.exibir();
cliente = entrada.next();
dia = entrada.nextInt();
mes = entrada.nextInt();
ano = entrada.nextInt();
int qtd = entrada.nextInt();
Carrinho car2 = new Carrinho(cliente, dia, mes, ano, qtd);
for(int i = 0; i < qtd; i++) {
car2.inserirItem(entrada.next());
}
car2.exibir();
}
}
|
UTF-8
|
Java
| 895 |
java
|
CarrinhoTeste.java
|
Java
|
[] | null |
[] |
import java.util.Scanner;
import java.lang.String;
public class CarrinhoTeste {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
String cliente = entrada.next();
int dia = entrada.nextInt();
int mes = entrada.nextInt();
int ano = entrada.nextInt();
Carrinho car = new Carrinho(cliente, dia, mes, ano);
for(int i = 0; i < 5; i++) {
car.inserirItem(entrada.next());
}
car.exibir();
cliente = entrada.next();
dia = entrada.nextInt();
mes = entrada.nextInt();
ano = entrada.nextInt();
int qtd = entrada.nextInt();
Carrinho car2 = new Carrinho(cliente, dia, mes, ano, qtd);
for(int i = 0; i < qtd; i++) {
car2.inserirItem(entrada.next());
}
car2.exibir();
}
}
| 895 | 0.529609 | 0.522905 | 28 | 29.964285 | 16.79388 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.035714 | false | false |
14
|
3bb219ccab0fe4d9b5d77b6a055916c9a511ceec
| 18,287,970,768,679 |
14b697aff3a3fa915ee48d8f3bef3b201abcdcd6
|
/instance-scheduler/src/test/java/mm_scheduler/instanceScheduler/algorithm/heuristic/OneHeuristicSchedulerTest.java
|
4667a6eb27d4b332680ff8d8ab8153190881175b
|
[] |
no_license
|
hanbaoan123/JobShopScheduler
|
https://github.com/hanbaoan123/JobShopScheduler
|
3ece19307bd222a6889165cb96a8ac888857bb56
|
21c8502b6a77538da85c66e763f1f31901f16ef6
|
refs/heads/master
| 2023-08-28T16:23:36.638000 | 2022-06-01T03:27:11 | 2022-06-01T03:27:11 | 231,040,309 | 18 | 14 | null | false | 2023-08-04T19:31:37 | 2019-12-31T06:39:42 | 2023-04-13T09:56:56 | 2023-08-04T19:31:37 | 5,293 | 18 | 13 | 10 |
Java
| false | false |
/**
* hba
*/
package mm_scheduler.instanceScheduler.algorithm.heuristic;
import java.util.List;
import mm_scheduler.instanceScheduler.instance.domain.basicdata.Instance;
import mm_scheduler.instanceScheduler.rules.*;
import mm_scheduler.instanceScheduler.util.FileHandle;
import mm_scheduler.instanceScheduler.util.InstanceUtil;
/**
* @author: hba
* @description: 简单规则调度器测试
* @date: 2019年12月18日
*
*/
public class OneHeuristicSchedulerTest {
/**
* @author: hba
* @description:
* @param args
* @throws Exception
* @date: 2019年12月18日
*
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
FileHandle fileHandle = new FileHandle();
List<Instance> instances = fileHandle.readSingleMachineInstance("0_40x1sample");
// 一次执行运行一个启发式规则
HeuristicScheduler heuristicScheduler = new HeuristicScheduler(new OperationEDD());
for (Instance instance : instances) {
instance.setWirteDynamic(true);
heuristicScheduler.schedule(instance, 0);
InstanceUtil.outputInstanceSolution(instance, heuristicScheduler.getOperationRule().getRuleName());
}
}
}
|
UTF-8
|
Java
| 1,178 |
java
|
OneHeuristicSchedulerTest.java
|
Java
|
[
{
"context": "tanceScheduler.util.InstanceUtil;\n\n/**\n * @author: hba\n * @description: 简单规则调度器测试\n * @date: 2019年12月18日\n",
"end": 353,
"score": 0.9996508359909058,
"start": 350,
"tag": "USERNAME",
"value": "hba"
},
{
"context": "ass OneHeuristicSchedulerTest {\n\n\t/**\n\t * @author: hba\n\t * @description:\n\t * @param args\n\t * @throws Exc",
"end": 473,
"score": 0.9996790885925293,
"start": 470,
"tag": "USERNAME",
"value": "hba"
}
] | null |
[] |
/**
* hba
*/
package mm_scheduler.instanceScheduler.algorithm.heuristic;
import java.util.List;
import mm_scheduler.instanceScheduler.instance.domain.basicdata.Instance;
import mm_scheduler.instanceScheduler.rules.*;
import mm_scheduler.instanceScheduler.util.FileHandle;
import mm_scheduler.instanceScheduler.util.InstanceUtil;
/**
* @author: hba
* @description: 简单规则调度器测试
* @date: 2019年12月18日
*
*/
public class OneHeuristicSchedulerTest {
/**
* @author: hba
* @description:
* @param args
* @throws Exception
* @date: 2019年12月18日
*
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
FileHandle fileHandle = new FileHandle();
List<Instance> instances = fileHandle.readSingleMachineInstance("0_40x1sample");
// 一次执行运行一个启发式规则
HeuristicScheduler heuristicScheduler = new HeuristicScheduler(new OperationEDD());
for (Instance instance : instances) {
instance.setWirteDynamic(true);
heuristicScheduler.schedule(instance, 0);
InstanceUtil.outputInstanceSolution(instance, heuristicScheduler.getOperationRule().getRuleName());
}
}
}
| 1,178 | 0.756684 | 0.737968 | 41 | 26.365854 | 26.836229 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.146341 | false | false |
14
|
42fd2af2971c236c660e46175f6d239cdd7d1ee4
| 11,510,512,422,263 |
bc82f225a7a1b0fe91c6e90b6c221faab5134d86
|
/Tugas4/KPLBO_SENIN16_173040003/P8_KPLBO_SENIN16_173040003/src/frames/Kalkulator.java
|
f7fa247d71e7977cb97366a0fe1c8e6dd3a694dc
|
[] |
no_license
|
indrawansyah/TUGAS-KPLBO
|
https://github.com/indrawansyah/TUGAS-KPLBO
|
7bcadccf8e8bbb8cfcfe0de683d311acddcbec37
|
e97cfb7e88c2b2ca06f28d785c25b26d3b0b87f2
|
refs/heads/master
| 2020-08-01T02:47:41.194000 | 2019-09-25T12:08:23 | 2019-09-25T12:08:23 | 210,833,629 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package frames;
import javax.swing.JFrame;
import panels.KalkulatorPanel;
public class Kalkulator extends JFrame {
public Kalkulator() {
KalkulatorPanel kp = new KalkulatorPanel();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setTitle("Kalkulator");
setLocationRelativeTo(null);
setSize(500, 200);
add(kp);
}
}
|
UTF-8
|
Java
| 353 |
java
|
Kalkulator.java
|
Java
|
[] | null |
[] |
package frames;
import javax.swing.JFrame;
import panels.KalkulatorPanel;
public class Kalkulator extends JFrame {
public Kalkulator() {
KalkulatorPanel kp = new KalkulatorPanel();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setTitle("Kalkulator");
setLocationRelativeTo(null);
setSize(500, 200);
add(kp);
}
}
| 353 | 0.745043 | 0.728045 | 19 | 17.578947 | 15.945024 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.421053 | false | false |
14
|
08e21694fbb7938c75181ce045199f32edba0dc1
| 27,109,833,604,089 |
f165d37143b599fc47cff50aa1c27cb557a25d3b
|
/spring-jms-2-basic-queue/src/main/java/com/example/demo/activemq/receiver/Listener.java
|
c7fc66ab164834a88f2afa196b31da64335046b8
|
[] |
no_license
|
softcontext/spring-message
|
https://github.com/softcontext/spring-message
|
cc7203ed6437d55bb7e8981ed72b135841a49317
|
0303533497dbc4ee95214d81125f87007c0219aa
|
refs/heads/master
| 2021-09-06T17:42:58.353000 | 2018-02-09T07:07:20 | 2018-02-09T07:07:20 | 120,870,252 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.demo.activemq.receiver;
import java.util.Map;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.TextMessage;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;
import com.google.gson.Gson;
/*
* tcp://localhost:61616
* http://localhost:8161/admin/
*/
@Component
public class Listener {
/*
* Received message ActiveMQTextMessage
* {
* commandId = 9,
* responseRequired = false,
* messageId = ID:DESKTOP-827TD4G-48873-1517820938502-4:1:1:1:1,
* originalDestination = null,
* originalTransactionId = null,
* producerId = ID:DESKTOP-827TD4G-48873-1517820938502-4:1:1:1,
* destination = queue://inbound.queue,
* transactionId = null,
* expiration = 0,
* timestamp = 1517888365481,
* arrival = 0,
* brokerInTime = 1517888365481,
* brokerOutTime = 1517888365484,
* correlationId = ,
* replyTo = null,
* persistent = false,
* type = , priority = 0, groupID = null, groupSequence = 0,
* targetConsumerId = null, compressed = false, userID = null,
* content = org.apache.activemq.util.ByteSequence@3410348c,
* marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0,
* properties = null, readOnlyProperties = true, readOnlyBody = true,
* droppable = false, jmsXGroupFirstForConsumer = false,
* text = {"name":"john"}
* }
*/
@JmsListener(destination = "inbound.queue")
@SendTo("outbound.queue")
public String receiveMessage(final Message jsonMessage) throws JMSException {
System.out.println("Received message " + jsonMessage);
String messageData = null;
String response = null;
if (jsonMessage instanceof TextMessage) {
TextMessage textMessage = (TextMessage) jsonMessage;
messageData = textMessage.getText();
Map<?, ?> map = new Gson().fromJson(messageData, Map.class);
response = "Hello " + map.get("name");
}
return response;
}
// @JmsListener(destination = "inbound.topic")
// @SendTo("outbound.topic")
// public String receiveMessageFromTopic(final Message jsonMessage) throws JMSException {
// System.out.println("Received message " + jsonMessage);
//
// String messageData = null;
// String response = null;
//
// if (jsonMessage instanceof TextMessage) {
// TextMessage textMessage = (TextMessage) jsonMessage;
// messageData = textMessage.getText();
// Map<?, ?> map = new Gson().fromJson(messageData, Map.class);
// response = "Hello " + map.get("name");
// }
// return response;
// }
}
|
UTF-8
|
Java
| 2,657 |
java
|
Listener.java
|
Java
|
[
{
"context": "pFirstForConsumer = false, \n\t * \t\ttext = {\"name\":\"john\"}\n\t * }\n\t */\n\t@JmsListener(destination = \"inbound",
"end": 1520,
"score": 0.993513286113739,
"start": 1516,
"tag": "NAME",
"value": "john"
}
] | null |
[] |
package com.example.demo.activemq.receiver;
import java.util.Map;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.TextMessage;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;
import com.google.gson.Gson;
/*
* tcp://localhost:61616
* http://localhost:8161/admin/
*/
@Component
public class Listener {
/*
* Received message ActiveMQTextMessage
* {
* commandId = 9,
* responseRequired = false,
* messageId = ID:DESKTOP-827TD4G-48873-1517820938502-4:1:1:1:1,
* originalDestination = null,
* originalTransactionId = null,
* producerId = ID:DESKTOP-827TD4G-48873-1517820938502-4:1:1:1,
* destination = queue://inbound.queue,
* transactionId = null,
* expiration = 0,
* timestamp = 1517888365481,
* arrival = 0,
* brokerInTime = 1517888365481,
* brokerOutTime = 1517888365484,
* correlationId = ,
* replyTo = null,
* persistent = false,
* type = , priority = 0, groupID = null, groupSequence = 0,
* targetConsumerId = null, compressed = false, userID = null,
* content = org.apache.activemq.util.ByteSequence@3410348c,
* marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0,
* properties = null, readOnlyProperties = true, readOnlyBody = true,
* droppable = false, jmsXGroupFirstForConsumer = false,
* text = {"name":"john"}
* }
*/
@JmsListener(destination = "inbound.queue")
@SendTo("outbound.queue")
public String receiveMessage(final Message jsonMessage) throws JMSException {
System.out.println("Received message " + jsonMessage);
String messageData = null;
String response = null;
if (jsonMessage instanceof TextMessage) {
TextMessage textMessage = (TextMessage) jsonMessage;
messageData = textMessage.getText();
Map<?, ?> map = new Gson().fromJson(messageData, Map.class);
response = "Hello " + map.get("name");
}
return response;
}
// @JmsListener(destination = "inbound.topic")
// @SendTo("outbound.topic")
// public String receiveMessageFromTopic(final Message jsonMessage) throws JMSException {
// System.out.println("Received message " + jsonMessage);
//
// String messageData = null;
// String response = null;
//
// if (jsonMessage instanceof TextMessage) {
// TextMessage textMessage = (TextMessage) jsonMessage;
// messageData = textMessage.getText();
// Map<?, ?> map = new Gson().fromJson(messageData, Map.class);
// response = "Hello " + map.get("name");
// }
// return response;
// }
}
| 2,657 | 0.688747 | 0.645465 | 83 | 31.012049 | 23.551786 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.373494 | false | false |
14
|
27dbfb31d02250de3c08944f74098549154299ca
| 3,444,563,778,981 |
9dd4074b606a873cbad86b7878e898374604300e
|
/src/main/java/com/baidu/nuomi/crm/firmoperate/service/surpport/CrossAuthType.java
|
447b315ab8aadbb0e9949a1c4a209ee9bbe5b00b
|
[] |
no_license
|
maso53/crmWeb
|
https://github.com/maso53/crmWeb
|
1a7c2e32859ace7005aee4f160c986fdf9944251
|
04885453c2a555f4a3ee6ab6e3042820b0588521
|
refs/heads/master
| 2015-08-24T14:45:13.326000 | 2015-05-24T08:55:49 | 2015-05-24T08:55:49 | 35,794,560 | 1 | 4 | null | false | 2015-05-22T02:58:16 | 2015-05-18T03:24:00 | 2015-05-18T03:24:00 | 2015-05-22T02:58:16 | 0 | 0 | 0 | 0 | null | null | null |
package com.baidu.nuomi.crm.firmoperate.service.surpport;
import com.baidu.nuomi.crm.firmoperate.enumeration.OperateTypeEnum;
import com.baidu.nuomi.crm.sso.authority.enumeration.RoleEnum;
/**
* 该类用于根据角色类型RoleEnum和操作类型OperateTypeEnum,获取该操作是否可以跨圈子、跨站、跨站类型。
* 主要使用getCrossAuthType方法。
*
* @author:zhengtian
* @date:2014年10月9日
* @time:下午5:17:50
*
*/
public class CrossAuthType {
/**
* 是否可以跨圈子
*
* @return
*/
private boolean isCrossTerritory = false;
/**
* 是否可以跨站
*
* @return
*/
private boolean isCrossStation = false;
/**
* 是否可以跨站类型
*
* @return
*/
private boolean isCrossStationType = false;
/**
* 无参构造函数
*/
public CrossAuthType() {
}
/**
* 构造函数
*
* @param isCrossTerritory
* @param isCrossStation
* @param isCrossStationType
*/
public CrossAuthType(Boolean isCrossTerritory, Boolean isCrossStation, Boolean isCrossStationType) {
this.isCrossTerritory = isCrossTerritory;
this.isCrossStation = isCrossStation;
this.isCrossStationType = isCrossStationType;
}
/**
* 根据角色类型RoleEnum和操作类型OperateTypeEnum,获取该操作是否可以跨圈子、跨站、跨站类型
*
* @param roleEnum
* @param operateType
* @return
*/
public static CrossAuthType getCrossAuthType(RoleEnum roleEnum, OperateTypeEnum operateType) {
if (RoleEnum.SUPER_SELLER.getKey().equals(roleEnum.getKey())
&& ( OperateTypeEnum.CLAIM.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.DROP.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.EDIT.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.HANDER_OVER_AND_MOVE.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.MARK_AGENT.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.PRI_VISIT.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.PUB_VISIT.getValue().intValue() == operateType.getValue().intValue())) {
return new CrossAuthType(true, true, true);
}else {
return new CrossAuthType();
}
}
public boolean isCrossTerritory() {
return isCrossTerritory;
}
public void setCrossTerritory(boolean isCrossTerritory) {
this.isCrossTerritory = isCrossTerritory;
}
public boolean isCrossStation() {
return isCrossStation;
}
public void setCrossStation(boolean isCrossStation) {
this.isCrossStation = isCrossStation;
}
public boolean isCrossStationType() {
return isCrossStationType;
}
public void setCrossStationType(boolean isCrossStationType) {
this.isCrossStationType = isCrossStationType;
}
}
|
UTF-8
|
Java
| 2,938 |
java
|
CrossAuthType.java
|
Java
|
[
{
"context": "站类型。\r\n * 主要使用getCrossAuthType方法。\r\n * \r\n * @author:zhengtian\r\n * @date:2014年10月9日\r\n * @time:下午5:17:50\r\n * \r\n *",
"end": 319,
"score": 0.9994549751281738,
"start": 310,
"tag": "USERNAME",
"value": "zhengtian"
}
] | null |
[] |
package com.baidu.nuomi.crm.firmoperate.service.surpport;
import com.baidu.nuomi.crm.firmoperate.enumeration.OperateTypeEnum;
import com.baidu.nuomi.crm.sso.authority.enumeration.RoleEnum;
/**
* 该类用于根据角色类型RoleEnum和操作类型OperateTypeEnum,获取该操作是否可以跨圈子、跨站、跨站类型。
* 主要使用getCrossAuthType方法。
*
* @author:zhengtian
* @date:2014年10月9日
* @time:下午5:17:50
*
*/
public class CrossAuthType {
/**
* 是否可以跨圈子
*
* @return
*/
private boolean isCrossTerritory = false;
/**
* 是否可以跨站
*
* @return
*/
private boolean isCrossStation = false;
/**
* 是否可以跨站类型
*
* @return
*/
private boolean isCrossStationType = false;
/**
* 无参构造函数
*/
public CrossAuthType() {
}
/**
* 构造函数
*
* @param isCrossTerritory
* @param isCrossStation
* @param isCrossStationType
*/
public CrossAuthType(Boolean isCrossTerritory, Boolean isCrossStation, Boolean isCrossStationType) {
this.isCrossTerritory = isCrossTerritory;
this.isCrossStation = isCrossStation;
this.isCrossStationType = isCrossStationType;
}
/**
* 根据角色类型RoleEnum和操作类型OperateTypeEnum,获取该操作是否可以跨圈子、跨站、跨站类型
*
* @param roleEnum
* @param operateType
* @return
*/
public static CrossAuthType getCrossAuthType(RoleEnum roleEnum, OperateTypeEnum operateType) {
if (RoleEnum.SUPER_SELLER.getKey().equals(roleEnum.getKey())
&& ( OperateTypeEnum.CLAIM.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.DROP.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.EDIT.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.HANDER_OVER_AND_MOVE.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.MARK_AGENT.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.PRI_VISIT.getValue().intValue() == operateType.getValue().intValue()
|| OperateTypeEnum.PUB_VISIT.getValue().intValue() == operateType.getValue().intValue())) {
return new CrossAuthType(true, true, true);
}else {
return new CrossAuthType();
}
}
public boolean isCrossTerritory() {
return isCrossTerritory;
}
public void setCrossTerritory(boolean isCrossTerritory) {
this.isCrossTerritory = isCrossTerritory;
}
public boolean isCrossStation() {
return isCrossStation;
}
public void setCrossStation(boolean isCrossStation) {
this.isCrossStation = isCrossStation;
}
public boolean isCrossStationType() {
return isCrossStationType;
}
public void setCrossStationType(boolean isCrossStationType) {
this.isCrossStationType = isCrossStationType;
}
}
| 2,938 | 0.694178 | 0.689757 | 102 | 24.607843 | 29.025734 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.539216 | false | false |
14
|
5bfc2e701ef0e0d05a2739e842569baa3343c0fa
| 30,545,807,421,755 |
3fa43ba6c3c5e77ecc6a295931ab8a523665a28e
|
/src/main/java/br/com/exemplo/rabbitmq/repository/ClienteRepository.java
|
712d668b1038b4fb6595243a395d1f4be3e260ed
|
[] |
no_license
|
ramonrpb/rabbitmq-amqp
|
https://github.com/ramonrpb/rabbitmq-amqp
|
ab55505911aeab676faa7546ee50c38bfbe47a4f
|
2cfee80e5b2f61f9c62bd768ae253d89ad2a5abe
|
refs/heads/master
| 2020-07-05T05:34:38.350000 | 2019-08-15T12:33:17 | 2019-08-15T12:33:17 | 202,539,132 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.exemplo.rabbitmq.repository;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Repository;
import br.com.exemplo.rabbitmq.entity.Cliente;
@Repository
public interface ClienteRepository extends JpaRepositoryImplementation<Cliente, Long>{
public Cliente findByClient(String client);
}
|
UTF-8
|
Java
| 376 |
java
|
ClienteRepository.java
|
Java
|
[] | null |
[] |
package br.com.exemplo.rabbitmq.repository;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Repository;
import br.com.exemplo.rabbitmq.entity.Cliente;
@Repository
public interface ClienteRepository extends JpaRepositoryImplementation<Cliente, Long>{
public Cliente findByClient(String client);
}
| 376 | 0.848404 | 0.848404 | 13 | 27.923077 | 31.099003 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false |
14
|
a9c5bb046c7513423da64d878b5d4857e7933acf
| 7,198,365,224,682 |
aaac30301a5b18e8b930d9932a5e11d514924c7e
|
/demos/demo/src/main/java/me/maiz/training/net/Client.java
|
28c6563e9dc8189a982fe430acae75bf35eac861
|
[] |
no_license
|
stickgoal/trainning
|
https://github.com/stickgoal/trainning
|
9206e30fc0b17c817c5826a6e212ad25a3b9d8a6
|
58348f8a3d21e91cad54d0084078129e788ea1f4
|
refs/heads/master
| 2023-03-14T12:29:11.508000 | 2022-12-01T09:17:50 | 2022-12-01T09:17:50 | 91,793,279 | 1 | 0 | null | false | 2023-02-22T06:55:38 | 2017-05-19T10:06:01 | 2023-01-17T13:25:05 | 2023-02-22T06:55:36 | 51,761 | 2 | 0 | 83 |
JavaScript
| false | false |
package me.maiz.training.net;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
/**
* Created by Lucas on 2017-11-13.
*/
public class Client {
public static void main(String[] args) throws IOException {
Socket client = new Socket("127.0.0.1",4000);
System.out.println("client运行中...");
BufferedReader sin = new BufferedReader(new InputStreamReader(System.in));
BufferedReader resp = new BufferedReader(new InputStreamReader(client.getInputStream()));
PrintWriter pw = new PrintWriter(client.getOutputStream());
String line = sin.readLine();
while(!line.equals("exit")&&line.length()>0) {
pw.println(line);
pw.flush();
System.out.println("服务器回应 : "+resp.readLine());
line = sin.readLine();
}
}
}
|
UTF-8
|
Java
| 968 |
java
|
Client.java
|
Java
|
[
{
"context": "er;\r\nimport java.net.Socket;\r\n\r\n/**\r\n * Created by Lucas on 2017-11-13.\r\n */\r\npublic class Client {\r\n\r\n ",
"end": 209,
"score": 0.9875531196594238,
"start": 204,
"tag": "NAME",
"value": "Lucas"
},
{
"context": "OException {\r\n Socket client = new Socket(\"127.0.0.1\",4000);\r\n System.out.println(\"client运行中...",
"end": 366,
"score": 0.9997453689575195,
"start": 357,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
}
] | null |
[] |
package me.maiz.training.net;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
/**
* Created by Lucas on 2017-11-13.
*/
public class Client {
public static void main(String[] args) throws IOException {
Socket client = new Socket("127.0.0.1",4000);
System.out.println("client运行中...");
BufferedReader sin = new BufferedReader(new InputStreamReader(System.in));
BufferedReader resp = new BufferedReader(new InputStreamReader(client.getInputStream()));
PrintWriter pw = new PrintWriter(client.getOutputStream());
String line = sin.readLine();
while(!line.equals("exit")&&line.length()>0) {
pw.println(line);
pw.flush();
System.out.println("服务器回应 : "+resp.readLine());
line = sin.readLine();
}
}
}
| 968 | 0.623158 | 0.603158 | 32 | 27.6875 | 25.949997 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.53125 | false | false |
14
|
12e5bc733683dc7782602830d365a8c591bc8804
| 14,199,161,909,382 |
ca030864a3a1c24be6b9d1802c2353da4ca0d441
|
/classes4.dex_source_from_JADX/com/facebook/video/subtitles/controller/SubtitleMediaTimeProvider.java
|
5707d30104cd43016e75ee6e57be92698d0d4abd
|
[] |
no_license
|
pxson001/facebook-app
|
https://github.com/pxson001/facebook-app
|
87aa51e29195eeaae69adeb30219547f83a5b7b1
|
640630f078980f9818049625ebc42569c67c69f7
|
refs/heads/master
| 2020-04-07T20:36:45.758000 | 2018-03-07T09:04:57 | 2018-03-07T09:04:57 | 124,208,458 | 4 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.facebook.video.subtitles.controller;
/* compiled from: post_vad */
public interface SubtitleMediaTimeProvider {
int mo384a();
}
|
UTF-8
|
Java
| 145 |
java
|
SubtitleMediaTimeProvider.java
|
Java
|
[] | null |
[] |
package com.facebook.video.subtitles.controller;
/* compiled from: post_vad */
public interface SubtitleMediaTimeProvider {
int mo384a();
}
| 145 | 0.758621 | 0.737931 | 6 | 23.166666 | 18.933363 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
14
|
3cd9295ce55ddecc242a466613cd4dd150270f47
| 7,687,991,498,687 |
1dfd52a7a6c7000b87286a59b73bbdb03aaeef01
|
/app/src/main/java/edu/seu/labportal/action/AdminChangePasswordSaveAction.java
|
b729788ca6f32997d4fd6828e5a105da1b2abb6b
|
[
"Apache-2.0"
] |
permissive
|
zhouziyang/portal
|
https://github.com/zhouziyang/portal
|
f304a012c46dea811c29c59e63ea8f6c3e0c5001
|
9e16d9f0f089aabbdbb5febe434a7e73370cd09d
|
refs/heads/master
| 2018-01-07T15:33:41.984000 | 2014-10-11T13:28:42 | 2014-10-11T13:28:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.seu.labportal.action;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import org.apache.commons.codec.digest.DigestUtils;
import edu.seu.labportal.Utils;
import edu.seu.labportal.model.UserInfo;
public class AdminChangePasswordSaveAction extends Action {
private String mOldPass;
private String mNewPass;
private String mUserName;
@Override
public void perform() throws ServletException, IOException {
mUserName = ((UserInfo) mRequest.getSession().getAttribute("userInfo"))
.getUserName();
mOldPass = mRequest.getParameter("oldPass");
mNewPass = mRequest.getParameter("newPass");
if (isOldPassValid() && setNewPass()) {
reportAdminDone();
} else {
reportAdminError();
}
}
private boolean isOldPassValid() {
boolean ret = false;
try {
String query = "SELECT COUNT(*) FROM `tb_user` WHERE name=? AND password=?";
Connection conn = Utils.getConnection();
PreparedStatement psmt = conn.prepareStatement(query);
psmt.setString(1, mUserName);
psmt.setString(2, DigestUtils.sha1Hex(mOldPass));
ResultSet rs = psmt.executeQuery();
if (rs != null && rs.first() && rs.getInt(1) > 0) {
ret = true;
}
psmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
return ret;
}
private boolean setNewPass() {
boolean ret = false;
try {
String query = "UPDATE `tb_user` SET password=? WHERE name=?";
Connection conn = Utils.getConnection();
PreparedStatement psmt = conn.prepareStatement(query);
psmt.setString(1, DigestUtils.sha1Hex(mNewPass));
psmt.setString(2, mUserName);
if (psmt.executeUpdate() > 0) {
ret = true;
}
psmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
return ret;
}
}
|
UTF-8
|
Java
| 1,872 |
java
|
AdminChangePasswordSaveAction.java
|
Java
|
[] | null |
[] |
package edu.seu.labportal.action;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import org.apache.commons.codec.digest.DigestUtils;
import edu.seu.labportal.Utils;
import edu.seu.labportal.model.UserInfo;
public class AdminChangePasswordSaveAction extends Action {
private String mOldPass;
private String mNewPass;
private String mUserName;
@Override
public void perform() throws ServletException, IOException {
mUserName = ((UserInfo) mRequest.getSession().getAttribute("userInfo"))
.getUserName();
mOldPass = mRequest.getParameter("oldPass");
mNewPass = mRequest.getParameter("newPass");
if (isOldPassValid() && setNewPass()) {
reportAdminDone();
} else {
reportAdminError();
}
}
private boolean isOldPassValid() {
boolean ret = false;
try {
String query = "SELECT COUNT(*) FROM `tb_user` WHERE name=? AND password=?";
Connection conn = Utils.getConnection();
PreparedStatement psmt = conn.prepareStatement(query);
psmt.setString(1, mUserName);
psmt.setString(2, DigestUtils.sha1Hex(mOldPass));
ResultSet rs = psmt.executeQuery();
if (rs != null && rs.first() && rs.getInt(1) > 0) {
ret = true;
}
psmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
return ret;
}
private boolean setNewPass() {
boolean ret = false;
try {
String query = "UPDATE `tb_user` SET password=? WHERE name=?";
Connection conn = Utils.getConnection();
PreparedStatement psmt = conn.prepareStatement(query);
psmt.setString(1, DigestUtils.sha1Hex(mNewPass));
psmt.setString(2, mUserName);
if (psmt.executeUpdate() > 0) {
ret = true;
}
psmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
return ret;
}
}
| 1,872 | 0.702991 | 0.698184 | 76 | 23.631578 | 20.559185 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.118421 | false | false |
14
|
29a702d5c5458e6b03371f7f1aaa945da54668d5
| 20,933,670,634,295 |
8b6b025408deed1d067ff8bd4ef3c536f9c79543
|
/saml/src/main/java/gov/nist/toolkit/saml/bean/SamlSignatureType.java
|
5952ae6d8704d44e06da504426e81d5d3844f405
|
[] |
no_license
|
usnistgov/iheos-toolkit2
|
https://github.com/usnistgov/iheos-toolkit2
|
96847a78a05ff4e86fb9ed78ab67db9851170f9d
|
61b612a7378e1df32f8685ac13f1a14b1bf69002
|
refs/heads/master
| 2023-08-17T07:16:34.206000 | 2023-06-21T17:02:37 | 2023-06-21T17:02:37 | 61,730,404 | 48 | 29 | null | false | 2023-07-13T23:54:57 | 2016-06-22T15:32:13 | 2023-07-12T03:02:57 | 2023-07-13T23:54:53 | 197,987 | 41 | 26 | 261 |
Java
| false | false |
package gov.nist.toolkit.saml.bean;
public class SamlSignatureType {
protected SamlSignatureKeyInfoType keyInfo;
protected byte[] signatureValue;
/**
* Gets the value of the keyInfo property.
*
* @return
* possible model is
* {@link SamlSignatureKeyInfoType }
*
*/
public SamlSignatureKeyInfoType getKeyInfo() {
return keyInfo;
}
/**
* Sets the value of the keyInfo property.
*
* @param value
* allowed model is
* {@link SamlSignatureKeyInfoType }
*
*/
public void setKeyInfo(SamlSignatureKeyInfoType value) {
this.keyInfo = value;
}
/**
* Gets the value of the signatureValue property.
*
* @return
* possible model is
* byte[]
*/
public byte[] getSignatureValue() {
return signatureValue;
}
/**
* Sets the value of the signatureValue property.
*
* @param value
* allowed model is
* byte[]
*/
public void setSignatureValue(byte[] value) {
this.signatureValue = ((byte[]) value);
}
}
|
UTF-8
|
Java
| 1,208 |
java
|
SamlSignatureType.java
|
Java
|
[] | null |
[] |
package gov.nist.toolkit.saml.bean;
public class SamlSignatureType {
protected SamlSignatureKeyInfoType keyInfo;
protected byte[] signatureValue;
/**
* Gets the value of the keyInfo property.
*
* @return
* possible model is
* {@link SamlSignatureKeyInfoType }
*
*/
public SamlSignatureKeyInfoType getKeyInfo() {
return keyInfo;
}
/**
* Sets the value of the keyInfo property.
*
* @param value
* allowed model is
* {@link SamlSignatureKeyInfoType }
*
*/
public void setKeyInfo(SamlSignatureKeyInfoType value) {
this.keyInfo = value;
}
/**
* Gets the value of the signatureValue property.
*
* @return
* possible model is
* byte[]
*/
public byte[] getSignatureValue() {
return signatureValue;
}
/**
* Sets the value of the signatureValue property.
*
* @param value
* allowed model is
* byte[]
*/
public void setSignatureValue(byte[] value) {
this.signatureValue = ((byte[]) value);
}
}
| 1,208 | 0.536424 | 0.536424 | 54 | 20.370371 | 17.856731 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.12963 | false | false |
14
|
91963158ff4e2c3d462cbba25c436b405af9867f
| 4,518,305,630,865 |
e3780c806fdb6798abf4ad5c3a7cb49e3d05f67a
|
/src/main/java/com/hankcs/hanlp/classification/classifiers/IClassifier.java
|
1fd4b8dc9108b9c5da737f29df09374903d700d3
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
AnyListen/HanLP
|
https://github.com/AnyListen/HanLP
|
7e3cf2774f0980d24ecab0568ad59774232a56d6
|
58e5f6cda0b894cad156b06ac75bd397c9e26de3
|
refs/heads/master
| 2021-01-22T04:23:14.514000 | 2018-12-11T01:27:36 | 2018-12-11T01:27:36 | 125,140,795 | 1 | 1 |
Apache-2.0
| true | 2018-04-16T16:49:47 | 2018-03-14T02:04:04 | 2018-04-16T16:48:16 | 2018-04-16T16:48:10 | 50,151 | 1 | 1 | 1 |
Java
| false | null |
/*
* <summary></summary>
* <author>He Han</author>
* <email>me@hankcs.com</email>
* <create-date>2016/1/29 17:59</create-date>
*
* <copyright file="ITextClassifier.java" company="码农场">
* Copyright (c) 2008-2016, 码农场. All Right Reserved, http://www.hankcs.com/
* This source is subject to Hankcs. Please contact Hankcs to get more information.
* </copyright>
*/
package com.hankcs.hanlp.classification.classifiers;
import com.hankcs.hanlp.classification.corpus.Document;
import com.hankcs.hanlp.classification.corpus.IDataSet;
import com.hankcs.hanlp.classification.models.AbstractModel;
import java.io.IOException;
import java.util.Map;
/**
* 文本分类器接口
*
* @author hankcs
*/
public interface IClassifier
{
/**
* 是否归一化分值为概率
*
* @param enable
* @return
*/
IClassifier enableProbability(boolean enable);
/**
* 预测分类
*
* @param text 文本
* @return 所有分类对应的分值(或概率, 需要enableProbability)
* @throws IllegalArgumentException 参数错误
* @throws IllegalStateException 未训练模型
*/
Map<String, Double> predict(String text) throws IllegalArgumentException, IllegalStateException;
/**
* 预测分类
* @param document
* @return
*/
Map<String, Double> predict(Document document) throws IllegalArgumentException, IllegalStateException;
/**
* 预测分类
* @param document
* @return
* @throws IllegalArgumentException
* @throws IllegalStateException
*/
double[] categorize(Document document) throws IllegalArgumentException, IllegalStateException;
/**
* 预测最可能的分类
* @param document
* @return
* @throws IllegalArgumentException
* @throws IllegalStateException
*/
int label(Document document) throws IllegalArgumentException, IllegalStateException;
/**
* 预测最可能的分类
* @param text 文本
* @return 最可能的分类
* @throws IllegalArgumentException
* @throws IllegalStateException
*/
String classify(String text) throws IllegalArgumentException, IllegalStateException;
/**
* 预测最可能的分类
* @param document 一个结构化的文档(注意!这是一个底层数据结构,请谨慎操作)
* @return 最可能的分类
* @throws IllegalArgumentException
* @throws IllegalStateException
*/
String classify(Document document) throws IllegalArgumentException, IllegalStateException;
/**
* 训练模型
*
* @param trainingDataSet 训练数据集,用Map储存.键是分类名,值是一个数组,数组中每个元素都是一篇文档的内容.
*/
void train(Map<String, String[]> trainingDataSet) throws IllegalArgumentException;
/**
* 训练模型
*
* @param folderPath 分类语料的根目录.目录必须满足如下结构:<br>
* 根目录<br>
* ├── 分类A<br>
* │ └── 1.txt<br>
* │ └── 2.txt<br>
* │ └── 3.txt<br>
* ├── 分类B<br>
* │ └── 1.txt<br>
* │ └── ...<br>
* └── ...<br>
* 文件不一定需要用数字命名,也不需要以txt作为后缀名,但一定需要是文本文件.
* @param charsetName 文件编码
* @throws IOException 任何可能的IO异常
*/
void train(String folderPath, String charsetName) throws IOException;
/**
* 用UTF-8编码的语料训练模型
*
* @param folderPath 用UTF-8编码的分类语料的根目录.目录必须满足如下结构:<br>
* 根目录<br>
* ├── 分类A<br>
* │ └── 1.txt<br>
* │ └── 2.txt<br>
* │ └── 3.txt<br>
* ├── 分类B<br>
* │ └── 1.txt<br>
* │ └── ...<br>
* └── ...<br>
* 文件不一定需要用数字命名,也不需要以txt作为后缀名,但一定需要是文本文件.
* @throws IOException 任何可能的IO异常
*/
void train(String folderPath) throws IOException;
/**
* 训练模型
* @param dataSet 训练数据集
* @throws IllegalArgumentException 当数据集为空时,将抛出此异常
*/
void train(IDataSet dataSet) throws IllegalArgumentException;
/**
* 获取训练后的模型,可用于序列化保存或预测.
* @return 模型,null表示未训练
*/
AbstractModel getModel();
}
|
UTF-8
|
Java
| 4,933 |
java
|
IClassifier.java
|
Java
|
[
{
"context": "/*\n * <summary></summary>\n * <author>He Han</author>\n * <email>me@hankcs.com</email>\n * <crea",
"end": 43,
"score": 0.999824583530426,
"start": 37,
"tag": "NAME",
"value": "He Han"
},
{
"context": "y></summary>\n * <author>He Han</author>\n * <email>me@hankcs.com</email>\n * <create-date>2016/1/29 17:59</create-d",
"end": 76,
"score": 0.9999309778213501,
"start": 63,
"tag": "EMAIL",
"value": "me@hankcs.com"
},
{
"context": "mport java.util.Map;\n\n/**\n * 文本分类器接口\n *\n * @author hankcs\n */\npublic interface IClassifier\n{\n /**\n *",
"end": 685,
"score": 0.9996583461761475,
"start": 679,
"tag": "USERNAME",
"value": "hankcs"
}
] | null |
[] |
/*
* <summary></summary>
* <author><NAME></author>
* <email><EMAIL></email>
* <create-date>2016/1/29 17:59</create-date>
*
* <copyright file="ITextClassifier.java" company="码农场">
* Copyright (c) 2008-2016, 码农场. All Right Reserved, http://www.hankcs.com/
* This source is subject to Hankcs. Please contact Hankcs to get more information.
* </copyright>
*/
package com.hankcs.hanlp.classification.classifiers;
import com.hankcs.hanlp.classification.corpus.Document;
import com.hankcs.hanlp.classification.corpus.IDataSet;
import com.hankcs.hanlp.classification.models.AbstractModel;
import java.io.IOException;
import java.util.Map;
/**
* 文本分类器接口
*
* @author hankcs
*/
public interface IClassifier
{
/**
* 是否归一化分值为概率
*
* @param enable
* @return
*/
IClassifier enableProbability(boolean enable);
/**
* 预测分类
*
* @param text 文本
* @return 所有分类对应的分值(或概率, 需要enableProbability)
* @throws IllegalArgumentException 参数错误
* @throws IllegalStateException 未训练模型
*/
Map<String, Double> predict(String text) throws IllegalArgumentException, IllegalStateException;
/**
* 预测分类
* @param document
* @return
*/
Map<String, Double> predict(Document document) throws IllegalArgumentException, IllegalStateException;
/**
* 预测分类
* @param document
* @return
* @throws IllegalArgumentException
* @throws IllegalStateException
*/
double[] categorize(Document document) throws IllegalArgumentException, IllegalStateException;
/**
* 预测最可能的分类
* @param document
* @return
* @throws IllegalArgumentException
* @throws IllegalStateException
*/
int label(Document document) throws IllegalArgumentException, IllegalStateException;
/**
* 预测最可能的分类
* @param text 文本
* @return 最可能的分类
* @throws IllegalArgumentException
* @throws IllegalStateException
*/
String classify(String text) throws IllegalArgumentException, IllegalStateException;
/**
* 预测最可能的分类
* @param document 一个结构化的文档(注意!这是一个底层数据结构,请谨慎操作)
* @return 最可能的分类
* @throws IllegalArgumentException
* @throws IllegalStateException
*/
String classify(Document document) throws IllegalArgumentException, IllegalStateException;
/**
* 训练模型
*
* @param trainingDataSet 训练数据集,用Map储存.键是分类名,值是一个数组,数组中每个元素都是一篇文档的内容.
*/
void train(Map<String, String[]> trainingDataSet) throws IllegalArgumentException;
/**
* 训练模型
*
* @param folderPath 分类语料的根目录.目录必须满足如下结构:<br>
* 根目录<br>
* ├── 分类A<br>
* │ └── 1.txt<br>
* │ └── 2.txt<br>
* │ └── 3.txt<br>
* ├── 分类B<br>
* │ └── 1.txt<br>
* │ └── ...<br>
* └── ...<br>
* 文件不一定需要用数字命名,也不需要以txt作为后缀名,但一定需要是文本文件.
* @param charsetName 文件编码
* @throws IOException 任何可能的IO异常
*/
void train(String folderPath, String charsetName) throws IOException;
/**
* 用UTF-8编码的语料训练模型
*
* @param folderPath 用UTF-8编码的分类语料的根目录.目录必须满足如下结构:<br>
* 根目录<br>
* ├── 分类A<br>
* │ └── 1.txt<br>
* │ └── 2.txt<br>
* │ └── 3.txt<br>
* ├── 分类B<br>
* │ └── 1.txt<br>
* │ └── ...<br>
* └── ...<br>
* 文件不一定需要用数字命名,也不需要以txt作为后缀名,但一定需要是文本文件.
* @throws IOException 任何可能的IO异常
*/
void train(String folderPath) throws IOException;
/**
* 训练模型
* @param dataSet 训练数据集
* @throws IllegalArgumentException 当数据集为空时,将抛出此异常
*/
void train(IDataSet dataSet) throws IllegalArgumentException;
/**
* 获取训练后的模型,可用于序列化保存或预测.
* @return 模型,null表示未训练
*/
AbstractModel getModel();
}
| 4,927 | 0.567733 | 0.560654 | 145 | 27.255173 | 24.965017 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.289655 | false | false |
14
|
5f10bb87f035a793df6734b33baf2b165f047265
| 16,234,976,418,452 |
21abbb2f538e655306459310884334f11db16d48
|
/src/main/java/com/libing/io/bxd1/BufferedWriterDemo.java
|
96b0b8372a564f43073d118e914f6bb426d15ff7
|
[] |
no_license
|
leefireboy/learn_io
|
https://github.com/leefireboy/learn_io
|
2927db2364edfacfc07b57b9df5374d86554d27d
|
99867bcde98b0f296151101d0cf8fa57c01fa381
|
refs/heads/master
| 2021-01-09T09:34:51.353000 | 2016-08-17T02:46:34 | 2016-08-17T02:46:34 | 65,870,466 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (c) 2016 Sohu TV. All rights reserved.
*/
package com.libing.io.bxd1;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
/**
* <P>
* Description:
* </p>
* @author "libing"
* @version 1.0
* @Date 2016年2月25日下午4:56:21
*/
public class BufferedWriterDemo {
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
public static void main(String[] args) throws IOException {
FileWriter fw = new FileWriter("demo.txt");
BufferedWriter bw = new BufferedWriter(fw);
bw.write("abcdef" + LINE_SEPARATOR + "ghijklmn");
bw.flush();
bw.close();
}
}
|
UTF-8
|
Java
| 686 |
java
|
BufferedWriterDemo.java
|
Java
|
[
{
"context": ";\n\n/**\n * <P>\n * Description:\n * </p>\n * @author \"libing\"\n * @version 1.0\n * @Date 2016年2月25日下午4:56:21\n */",
"end": 228,
"score": 0.9996607303619385,
"start": 222,
"tag": "USERNAME",
"value": "libing"
}
] | null |
[] |
/*
* Copyright (c) 2016 Sohu TV. All rights reserved.
*/
package com.libing.io.bxd1;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
/**
* <P>
* Description:
* </p>
* @author "libing"
* @version 1.0
* @Date 2016年2月25日下午4:56:21
*/
public class BufferedWriterDemo {
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
public static void main(String[] args) throws IOException {
FileWriter fw = new FileWriter("demo.txt");
BufferedWriter bw = new BufferedWriter(fw);
bw.write("abcdef" + LINE_SEPARATOR + "ghijklmn");
bw.flush();
bw.close();
}
}
| 686 | 0.655325 | 0.627219 | 30 | 21.566668 | 22.394468 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
14
|
c523171cf84f7c7cd3b26645d8a849092a3220f1
| 16,234,976,420,269 |
86034183ee323704a11e0127235f4d49efcd7e75
|
/app/src/main/java/com/smartworks/pokerwithfriends/MainActivity.java
|
6d71aed0af5f954c0fb037e28e34a5c7be7d10eb
|
[] |
no_license
|
sw8lde/PokerwithFriends
|
https://github.com/sw8lde/PokerwithFriends
|
4b6bcab4420ccb2fe4e3de56f2908f8623b7d874
|
2e0360fdf21316acfcf9ea9d505b3a5aea699c40
|
refs/heads/master
| 2017-05-09T16:48:56.573000 | 2017-02-25T18:05:15 | 2017-02-25T18:05:15 | 82,474,028 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.smartworks.pokerwithfriends;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.games.Games;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.OptionalPendingResult;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.games.multiplayer.realtime.RoomConfig;
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatchConfig;
import java.util.ArrayList;
public class MainActivity extends FragmentActivity implements GoogleApiClient.OnConnectionFailedListener, View.OnClickListener {
private static final String TAG = "SignInActivity";
private static final int RC_SIGN_IN = 9001;
private static final int RC_SELECT_PLAYERS = 10000;
private GoogleApiClient mGoogleApiClient;
private TextView mStatusTextView;
private ProgressDialog mProgressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Views
mStatusTextView = (TextView) findViewById(R.id.status);
// Button listeners
findViewById(R.id.sign_in_button).setOnClickListener(this);
findViewById(R.id.sign_out_button).setOnClickListener(this);
findViewById(R.id.disconnect_button).setOnClickListener(this);
findViewById(R.id.new_game).setOnClickListener(this);
findViewById(R.id.my_games).setOnClickListener(this);
// Configure sign-in to request the user's ID, email address, and basic
// profile. ID and basic profile are included in DEFAULT_SIGN_IN.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
// Build a GoogleApiClient with access to the Google Sign-In API and the
// options specified by gso.
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
// Set the dimensions of the sign-in button.
SignInButton signInButton = (SignInButton) findViewById(R.id.sign_in_button);
signInButton.setSize(SignInButton.SIZE_STANDARD);
}
@Override
public void onStart() {
super.onStart();
OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
if (opr.isDone()) {
// If the user's cached credentials are valid, the OptionalPendingResult will be "done"
// and the GoogleSignInResult will be available instantly.
Log.d(TAG, "Got cached sign-in");
GoogleSignInResult result = opr.get();
handleSignInResult(result);
} else {
// If the user has not previously signed in on this device or the sign-in has expired,
// this asynchronous branch will attempt to sign in the user silently. Cross-device
// single sign-on will occur in this branch.
showProgressDialog();
opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
@Override
public void onResult(GoogleSignInResult googleSignInResult) {
hideProgressDialog();
handleSignInResult(googleSignInResult);
}
});
}
}
// [START onActivityResult]
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleSignInResult(result);
} else if (requestCode == RC_SELECT_PLAYERS) {
if (resultCode != Activity.RESULT_OK) {
// user canceled
return;
}
// Get the invitee list.
final ArrayList<String> invitees =
data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS);
// Get auto-match criteria.
Bundle autoMatchCriteria = null;
int minAutoMatchPlayers = data.getIntExtra(
Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, 0);
int maxAutoMatchPlayers = data.getIntExtra(
Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, 0);
if (minAutoMatchPlayers > 0) {
autoMatchCriteria = RoomConfig.createAutoMatchCriteria(
minAutoMatchPlayers, maxAutoMatchPlayers, 0);
} else {
autoMatchCriteria = null;
}
TurnBasedMatchConfig tbmc = TurnBasedMatchConfig.builder()
.addInvitedPlayers(invitees)
.setAutoMatchCriteria(autoMatchCriteria)
.build();
// Create and start the match.
Games.TurnBasedMultiplayer
.createMatch(mGoogleApiClient, tbmc)
.setResultCallback(new MatchInitiatedCallback());
}
}
// [END onActivityResult]
// [START handleSignInResult]
private void handleSignInResult(GoogleSignInResult result) {
Log.d(TAG, "handleSignInResult:" + result.isSuccess());
if (result.isSuccess()) {
// Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();
mStatusTextView.setText(getString(R.string.signed_in, acct.getDisplayName()));
// TODO: acct.getId();
updateUI(true);
} else {
// Signed out, show unauthenticated UI.
updateUI(false);
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.sign_in_button:
signIn();
break;
case R.id.sign_out_button:
signOut();
break;
case R.id.disconnect_button:
revokeAccess();
break;
case R.id.new_game:
newGame();
break;
case R.id.my_games:
myGames();
break;
}
}
private void signIn() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
}
private void signOut() {
Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
// [START_EXCLUDE]
updateUI(false);
// [END_EXCLUDE]
}
});
}
// [START revokeAccess]
private void revokeAccess() {
Auth.GoogleSignInApi.revokeAccess(mGoogleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
// [START_EXCLUDE]
updateUI(false);
// [END_EXCLUDE]
}
});
}
// [END revokeAccess]
private void newGame() {
Intent intent =
Games.TurnBasedMultiplayer.getSelectOpponentsIntent(mGoogleApiClient, 1, 9, true);
startActivityForResult(intent, RC_SELECT_PLAYERS);
}
private void myGames() {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
// An unresolvable error has occurred and Google APIs (including Sign-In) will not
// be available.
Log.d(TAG, "onConnectionFailed:" + connectionResult);
}
private void showProgressDialog() {
if (mProgressDialog == null) {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setMessage(getString(R.string.loading));
mProgressDialog.setIndeterminate(true);
}
mProgressDialog.show();
}
private void hideProgressDialog() {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.hide();
}
}
private void updateUI(boolean signedIn) {
if (signedIn) {
findViewById(R.id.sign_in_button).setVisibility(View.GONE);
findViewById(R.id.sign_out_button).setVisibility(View.VISIBLE);
findViewById(R.id.disconnect_button).setVisibility(View.VISIBLE);
} else {
mStatusTextView.setText(R.string.signed_out);
findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
findViewById(R.id.sign_out_button).setVisibility(View.GONE);
findViewById(R.id.disconnect_button).setVisibility(View.GONE);
}
}
public class TableObserver extends ContentObserver {
public TableObserver(Handler handler) {
super(handler);
}
/*
* Define a method that's called when data in the
* observed content provider changes.
* This method signature is provided for compatibility with
* older platforms.
*/
@Override
public void onChange(boolean selfChange) {
/*
* Invoke the method signature available as of
* Android platform version 4.1, with a null URI.
*/
onChange(selfChange, null);
}
/*
* Define a method that's called when data in the
* observed content provider changes.
*/
@Override
public void onChange(boolean selfChange, Uri changeUri) {
/*
* Ask the framework to run your sync adapter.
* To maintain backward compatibility, assume that
* changeUri is null.
*/
// TODO: ContentResolver.requestSync(mAccount, AuthenticatorConfig.AUTHORITY, null);
}
}
/**
* Create a new dummy account for the sync adapter
*
* @param context The application context
*/
public static Account CreateSyncAccount(Context context) {
// Create the account type and default account
// TODO: Account newAccount = new Account(AuthenticatorConfig.ACCOUNT, AuthenticatorConfig.ACCOUNT_TYPE);
// Get an instance of the Android account manager
AccountManager accountManager =
(AccountManager) context.getSystemService(
ACCOUNT_SERVICE);
/*
* Add the account and account type, no password or user data
* If successful, return the Account object, otherwise report an error.
if(accountManager.addAccountExplicitly(newAccount, null, null)) {
/*
* If you don't set android:syncable="true" in
* in your <provider> element in the manifest,
* then call context.setIsSyncable(account, AUTHORITY, 1)
* here.
return newAccount;
} else {
/*
* The account exists or some other error occurred. Log this, report it,
* or handle it internally.
return null;
}
*/
return null;
}
/**
* Respond to a button click by calling requestSync(). This is an
* asynchronous operation.
*
* This method is attached to the refresh button in the layout
* XML file
*
* @param v The View associated with the method call,
* in this case a Button
*/
public void onRefreshButtonClick(View v) {
// Pass the settings flags by inserting them in a bundle
Bundle settingsBundle = new Bundle();
settingsBundle.putBoolean(
ContentResolver.SYNC_EXTRAS_MANUAL, true);
settingsBundle.putBoolean(
ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
/*
* Request the sync for the default account, authority, and
* manual sync settings
*/
// TODO: ContentResolver.requestSync(mAccount, AuthenticatorConfig.AUTHORITY, settingsBundle);
}
}
|
UTF-8
|
Java
| 13,507 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.smartworks.pokerwithfriends;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.games.Games;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.SignInButton;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.OptionalPendingResult;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.games.multiplayer.realtime.RoomConfig;
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatchConfig;
import java.util.ArrayList;
public class MainActivity extends FragmentActivity implements GoogleApiClient.OnConnectionFailedListener, View.OnClickListener {
private static final String TAG = "SignInActivity";
private static final int RC_SIGN_IN = 9001;
private static final int RC_SELECT_PLAYERS = 10000;
private GoogleApiClient mGoogleApiClient;
private TextView mStatusTextView;
private ProgressDialog mProgressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Views
mStatusTextView = (TextView) findViewById(R.id.status);
// Button listeners
findViewById(R.id.sign_in_button).setOnClickListener(this);
findViewById(R.id.sign_out_button).setOnClickListener(this);
findViewById(R.id.disconnect_button).setOnClickListener(this);
findViewById(R.id.new_game).setOnClickListener(this);
findViewById(R.id.my_games).setOnClickListener(this);
// Configure sign-in to request the user's ID, email address, and basic
// profile. ID and basic profile are included in DEFAULT_SIGN_IN.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
// Build a GoogleApiClient with access to the Google Sign-In API and the
// options specified by gso.
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
// Set the dimensions of the sign-in button.
SignInButton signInButton = (SignInButton) findViewById(R.id.sign_in_button);
signInButton.setSize(SignInButton.SIZE_STANDARD);
}
@Override
public void onStart() {
super.onStart();
OptionalPendingResult<GoogleSignInResult> opr = Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
if (opr.isDone()) {
// If the user's cached credentials are valid, the OptionalPendingResult will be "done"
// and the GoogleSignInResult will be available instantly.
Log.d(TAG, "Got cached sign-in");
GoogleSignInResult result = opr.get();
handleSignInResult(result);
} else {
// If the user has not previously signed in on this device or the sign-in has expired,
// this asynchronous branch will attempt to sign in the user silently. Cross-device
// single sign-on will occur in this branch.
showProgressDialog();
opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
@Override
public void onResult(GoogleSignInResult googleSignInResult) {
hideProgressDialog();
handleSignInResult(googleSignInResult);
}
});
}
}
// [START onActivityResult]
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleSignInResult(result);
} else if (requestCode == RC_SELECT_PLAYERS) {
if (resultCode != Activity.RESULT_OK) {
// user canceled
return;
}
// Get the invitee list.
final ArrayList<String> invitees =
data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS);
// Get auto-match criteria.
Bundle autoMatchCriteria = null;
int minAutoMatchPlayers = data.getIntExtra(
Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, 0);
int maxAutoMatchPlayers = data.getIntExtra(
Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, 0);
if (minAutoMatchPlayers > 0) {
autoMatchCriteria = RoomConfig.createAutoMatchCriteria(
minAutoMatchPlayers, maxAutoMatchPlayers, 0);
} else {
autoMatchCriteria = null;
}
TurnBasedMatchConfig tbmc = TurnBasedMatchConfig.builder()
.addInvitedPlayers(invitees)
.setAutoMatchCriteria(autoMatchCriteria)
.build();
// Create and start the match.
Games.TurnBasedMultiplayer
.createMatch(mGoogleApiClient, tbmc)
.setResultCallback(new MatchInitiatedCallback());
}
}
// [END onActivityResult]
// [START handleSignInResult]
private void handleSignInResult(GoogleSignInResult result) {
Log.d(TAG, "handleSignInResult:" + result.isSuccess());
if (result.isSuccess()) {
// Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();
mStatusTextView.setText(getString(R.string.signed_in, acct.getDisplayName()));
// TODO: acct.getId();
updateUI(true);
} else {
// Signed out, show unauthenticated UI.
updateUI(false);
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.sign_in_button:
signIn();
break;
case R.id.sign_out_button:
signOut();
break;
case R.id.disconnect_button:
revokeAccess();
break;
case R.id.new_game:
newGame();
break;
case R.id.my_games:
myGames();
break;
}
}
private void signIn() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
}
private void signOut() {
Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
// [START_EXCLUDE]
updateUI(false);
// [END_EXCLUDE]
}
});
}
// [START revokeAccess]
private void revokeAccess() {
Auth.GoogleSignInApi.revokeAccess(mGoogleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
// [START_EXCLUDE]
updateUI(false);
// [END_EXCLUDE]
}
});
}
// [END revokeAccess]
private void newGame() {
Intent intent =
Games.TurnBasedMultiplayer.getSelectOpponentsIntent(mGoogleApiClient, 1, 9, true);
startActivityForResult(intent, RC_SELECT_PLAYERS);
}
private void myGames() {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
// An unresolvable error has occurred and Google APIs (including Sign-In) will not
// be available.
Log.d(TAG, "onConnectionFailed:" + connectionResult);
}
private void showProgressDialog() {
if (mProgressDialog == null) {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setMessage(getString(R.string.loading));
mProgressDialog.setIndeterminate(true);
}
mProgressDialog.show();
}
private void hideProgressDialog() {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.hide();
}
}
private void updateUI(boolean signedIn) {
if (signedIn) {
findViewById(R.id.sign_in_button).setVisibility(View.GONE);
findViewById(R.id.sign_out_button).setVisibility(View.VISIBLE);
findViewById(R.id.disconnect_button).setVisibility(View.VISIBLE);
} else {
mStatusTextView.setText(R.string.signed_out);
findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE);
findViewById(R.id.sign_out_button).setVisibility(View.GONE);
findViewById(R.id.disconnect_button).setVisibility(View.GONE);
}
}
public class TableObserver extends ContentObserver {
public TableObserver(Handler handler) {
super(handler);
}
/*
* Define a method that's called when data in the
* observed content provider changes.
* This method signature is provided for compatibility with
* older platforms.
*/
@Override
public void onChange(boolean selfChange) {
/*
* Invoke the method signature available as of
* Android platform version 4.1, with a null URI.
*/
onChange(selfChange, null);
}
/*
* Define a method that's called when data in the
* observed content provider changes.
*/
@Override
public void onChange(boolean selfChange, Uri changeUri) {
/*
* Ask the framework to run your sync adapter.
* To maintain backward compatibility, assume that
* changeUri is null.
*/
// TODO: ContentResolver.requestSync(mAccount, AuthenticatorConfig.AUTHORITY, null);
}
}
/**
* Create a new dummy account for the sync adapter
*
* @param context The application context
*/
public static Account CreateSyncAccount(Context context) {
// Create the account type and default account
// TODO: Account newAccount = new Account(AuthenticatorConfig.ACCOUNT, AuthenticatorConfig.ACCOUNT_TYPE);
// Get an instance of the Android account manager
AccountManager accountManager =
(AccountManager) context.getSystemService(
ACCOUNT_SERVICE);
/*
* Add the account and account type, no password or user data
* If successful, return the Account object, otherwise report an error.
if(accountManager.addAccountExplicitly(newAccount, null, null)) {
/*
* If you don't set android:syncable="true" in
* in your <provider> element in the manifest,
* then call context.setIsSyncable(account, AUTHORITY, 1)
* here.
return newAccount;
} else {
/*
* The account exists or some other error occurred. Log this, report it,
* or handle it internally.
return null;
}
*/
return null;
}
/**
* Respond to a button click by calling requestSync(). This is an
* asynchronous operation.
*
* This method is attached to the refresh button in the layout
* XML file
*
* @param v The View associated with the method call,
* in this case a Button
*/
public void onRefreshButtonClick(View v) {
// Pass the settings flags by inserting them in a bundle
Bundle settingsBundle = new Bundle();
settingsBundle.putBoolean(
ContentResolver.SYNC_EXTRAS_MANUAL, true);
settingsBundle.putBoolean(
ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
/*
* Request the sync for the default account, authority, and
* manual sync settings
*/
// TODO: ContentResolver.requestSync(mAccount, AuthenticatorConfig.AUTHORITY, settingsBundle);
}
}
| 13,507 | 0.617235 | 0.615829 | 357 | 36.834732 | 27.082779 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.481793 | false | false |
14
|
0fd7b89e79ee95f8b794eccc6e4976a175df122c
| 35,888,746,727,803 |
4a38305ff7bca7a009f3b7d278a1ff72c4155807
|
/Visuals/Principal.java
|
edc67565dd3438b4d8a5cbe5465cf3dd361a8189
|
[] |
no_license
|
aalva500-prog/Energy-Consumption-App-With-Database
|
https://github.com/aalva500-prog/Energy-Consumption-App-With-Database
|
b20122bea8b427c9bdb30c4184e29b823b0b153a
|
c359bac27e62234ff0006ff03b606b435ad2c6bc
|
refs/heads/main
| 2023-02-13T15:47:44.719000 | 2021-01-03T03:35:32 | 2021-01-03T03:35:32 | 326,315,405 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Visuals;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import Utils.CurrentUser;
import Utils.Idioma;
import Utils.Reportes;
public class Principal extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JMenuBar mainMenuBar = null;
private JMenu FileMenu = null;
private JMenu ReportsjMenu = null;
private JMenuItem biggerConnsumersjMenuItem = null;
private JMenuItem jMenuItem = null;
private JMenuItem jMenuItem1 = null;
private Conectar owner = null;
private JMenuItem jMenuItemAutenticar = null;
private JMenu GestionjMenu1 = null;
private JMenuItem UsuariosjMenuItem = null;
private JMenuItem VecindariojMenuItem = null;
private JLabel jLabel;
private JMenuItem CasasjMenuItem2 = null;
private JMenuItem ContadorporCasajMenuItem2 = null;
private JMenuItem jLecturasPorValor = null;
/**
* This is the default constructor
*/
public Principal(Conectar parent) {
super();
this.owner = parent;
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(408, 362);
this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/Img/HH00236_.png")));
this.setEnabled(true);
this.setJMenuBar(getMainMenuBar());
this.setContentPane(getJContentPane());
this.setTitle("Principal");
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent e) {
getOwner().dispose();
}
public void windowOpened(java.awt.event.WindowEvent e) {
if(CurrentUser.getCurrentUser().getSessionUser().getRol().equals("Administrador")){
getGestionjMenu1().setVisible(true);
}
if(CurrentUser.getCurrentUser().getSessionUser().getRol().equals("Invitado")){
getGestionjMenu1().setVisible(false);
}
}
});
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((screenSize.width - getWidth()) / 2,((screenSize.height - getHeight()) / 2));
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jLabel = new JLabel();
jLabel.setIcon(new ImageIcon(getClass().getResource("/Img/gl-20-02.jpg")));
jLabel.setName("jLabel");
jLabel.setText("");
jContentPane.setLayout(new CardLayout());
jContentPane.add(jLabel, jLabel.getName());
}
return jContentPane;
}
/**
* This method initializes mainMenuBar
*
* @return javax.swing.JMenuBar
*/
private JMenuBar getMainMenuBar() {
if (mainMenuBar == null) {
mainMenuBar = new JMenuBar();
mainMenuBar.add(getFileMenu());
mainMenuBar.add(getGestionjMenu1());
mainMenuBar.add(getReportsjMenu());
}
return mainMenuBar;
}
/**
* This method initializes FileMenu
*
* @return javax.swing.JMenu
*/
private JMenu getFileMenu() {
if (FileMenu == null) {
FileMenu = new JMenu();
FileMenu.setText("Archivo");
FileMenu.add(getJMenuItemAutenticar());
FileMenu.add(getJMenuItem1());
}
return FileMenu;
}
/**
* This method initializes ReportsjMenu
*
* @return javax.swing.JMenu
*/
public JMenu getReportsjMenu() {
if (ReportsjMenu == null) {
ReportsjMenu = new JMenu();
ReportsjMenu.setText(" Reportes");
ReportsjMenu.add(getJMenuItem());
ReportsjMenu.add(getContadorporCasajMenuItem2());
ReportsjMenu.add(getLecturasPorValor());
ReportsjMenu.add(getBiggerConnsumersjMenuItem());
}
return ReportsjMenu;
}
/**
* This method initializes biggerConnsumersjMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getBiggerConnsumersjMenuItem() {
if (biggerConnsumersjMenuItem == null) {
biggerConnsumersjMenuItem = new JMenuItem();
biggerConnsumersjMenuItem.setText("Mayores Consumidores");
biggerConnsumersjMenuItem.setIcon(new ImageIcon(getClass().getResource("/Img/lens_in.png")));
biggerConnsumersjMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Reportes.getR().MayoresConsumidores();
}
});
}
return biggerConnsumersjMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem() {
if (jMenuItem == null) {
jMenuItem = new JMenuItem();
jMenuItem.setText("Casas con el consumo alterado");
jMenuItem.setIcon(new ImageIcon(getClass().getResource("/Img/lens_in.png")));
jMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Reportes.getR().ReporteCasasAlteradas();
}
});
}
return jMenuItem;
}
/**
* This method initializes jMenuItem1
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem1() {
if (jMenuItem1 == null) {
jMenuItem1 = new JMenuItem();
jMenuItem1.setText("Salir");
jMenuItem1.setIcon(new ImageIcon(getClass().getResource("/Img/ico_alpha_Delete_16x16.png")));
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
dispose();
}
});
}
return jMenuItem1;
}
public void idioma(){
if(Idioma.getInstance().getIdioma().equalsIgnoreCase("ingles")){
FileMenu.setText("File");
ReportsjMenu.setText("Reports");
jMenuItem.setText("Hauses whit Altered Consuption");
jMenuItem1.setText("Exit");
VecindariojMenuItem.setText("Collectors");
biggerConnsumersjMenuItem.setText("Bigger Consumers");
CasasjMenuItem2.setText("Homes");
jMenuItemAutenticar.setText("Change User");
UsuariosjMenuItem.setText("Users");
GestionjMenu1.setText("Management");
jLecturasPorValor.setText("Home's Readings");
ContadorporCasajMenuItem2.setText("Readings for Collectors");
this.setTitle("Main");
}
else{
jLecturasPorValor.setText("Lecturas de un hogar");
FileMenu.setText("Archivo");
jMenuItem.setText("Casas con el consumo alterado");
ReportsjMenu.setText("Reportes");
CasasjMenuItem2.setText("Casas");
jMenuItem1.setText("Salir");
VecindariojMenuItem.setText("Cobradores");
biggerConnsumersjMenuItem.setText("Mayores Consumidores");
jMenuItemAutenticar.setText("Cambiar Usuario");
UsuariosjMenuItem.setText("Usuarios");
GestionjMenu1.setText("Gestión");
ContadorporCasajMenuItem2.setText("Contador y sus Lecturas");
this.setTitle("Principal");
}
}
public Principal returnThis(){
return this;
}
public Conectar getOwner() {
return owner;
}
/**
* This method initializes jMenuItemAutenticar
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItemAutenticar() {
if (jMenuItemAutenticar == null) {
jMenuItemAutenticar = new JMenuItem();
jMenuItemAutenticar.setText("Cambiar Usuario");
jMenuItemAutenticar.setIcon(new ImageIcon(getClass().getResource("/Img/edit_user.png")));
jMenuItemAutenticar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
setVisible(false);
Conectar r = new Conectar();
r.setVisible(true);
}
});
}
return jMenuItemAutenticar;
}
/**
* This method initializes GestionjMenu1
*
* @return javax.swing.JMenu
*/
private JMenu getGestionjMenu1() {
if (GestionjMenu1 == null) {
GestionjMenu1 = new JMenu();
GestionjMenu1.setText("Gestion");
GestionjMenu1.add(getUsuariosjMenuItem());
GestionjMenu1.add(getCasasjMenuItem2());
GestionjMenu1.add(getVecindariojMenuItem());
}
return GestionjMenu1;
}
/**
* This method initializes UsuariosjMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getUsuariosjMenuItem() {
if (UsuariosjMenuItem == null) {
UsuariosjMenuItem = new JMenuItem();
UsuariosjMenuItem.setText("Usuarios");
UsuariosjMenuItem.setIcon(new ImageIcon(getClass().getResource("/Img/add_user.png")));
UsuariosjMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Usuarios f = new Usuarios();
f.setVisible(true);
}
});
}
return UsuariosjMenuItem;
}
/**
* This method initializes VecindariojMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getVecindariojMenuItem() {
if (VecindariojMenuItem == null) {
VecindariojMenuItem = new JMenuItem();
VecindariojMenuItem.setText("Cobradores");
VecindariojMenuItem.setIcon(new ImageIcon(getClass().getResource("/Img/AOL Instant Messenger-fall.png")));
VecindariojMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
new CobradorVisual(Principal.this,true).setVisible(true);
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return VecindariojMenuItem;
}
/**
* This method initializes CasasjMenuItem2
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getCasasjMenuItem2() {
if (CasasjMenuItem2 == null) {
CasasjMenuItem2 = new JMenuItem();
CasasjMenuItem2.setText("Casas");
CasasjMenuItem2.setIcon(new ImageIcon(getClass().getResource("/Img/ico_alpha_HomePage_32x32.png")));
CasasjMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
new CasasVisual(Principal.this).setVisible(true);
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return CasasjMenuItem2;
}
/**
* This method initializes ContadorporCasajMenuItem2
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getContadorporCasajMenuItem2() {
if (ContadorporCasajMenuItem2 == null) {
ContadorporCasajMenuItem2 = new JMenuItem();
ContadorporCasajMenuItem2.setText("Contador y sus Lecturas");
ContadorporCasajMenuItem2.setIcon(new ImageIcon(getClass().getResource("/Img/lens_in.png")));
ContadorporCasajMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Reportes.getR().Contador();
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return ContadorporCasajMenuItem2;
}
private JMenuItem getLecturasPorValor() {
if (jLecturasPorValor == null) {
jLecturasPorValor = new JMenuItem();
jLecturasPorValor.setText("Lecturas de un hogar");
jLecturasPorValor.setIcon(new ImageIcon(getClass().getResource("/Img/lens_in.png")));
jLecturasPorValor.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
ReporteLecturaValor a = new ReporteLecturaValor();
a.setVisible(true);
}
});
}
return jLecturasPorValor;
}
} // @jve:decl-index=0:visual-constraint="10,10"
|
WINDOWS-1250
|
Java
| 11,323 |
java
|
Principal.java
|
Java
|
[] | null |
[] |
package Visuals;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import Utils.CurrentUser;
import Utils.Idioma;
import Utils.Reportes;
public class Principal extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JMenuBar mainMenuBar = null;
private JMenu FileMenu = null;
private JMenu ReportsjMenu = null;
private JMenuItem biggerConnsumersjMenuItem = null;
private JMenuItem jMenuItem = null;
private JMenuItem jMenuItem1 = null;
private Conectar owner = null;
private JMenuItem jMenuItemAutenticar = null;
private JMenu GestionjMenu1 = null;
private JMenuItem UsuariosjMenuItem = null;
private JMenuItem VecindariojMenuItem = null;
private JLabel jLabel;
private JMenuItem CasasjMenuItem2 = null;
private JMenuItem ContadorporCasajMenuItem2 = null;
private JMenuItem jLecturasPorValor = null;
/**
* This is the default constructor
*/
public Principal(Conectar parent) {
super();
this.owner = parent;
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(408, 362);
this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/Img/HH00236_.png")));
this.setEnabled(true);
this.setJMenuBar(getMainMenuBar());
this.setContentPane(getJContentPane());
this.setTitle("Principal");
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent e) {
getOwner().dispose();
}
public void windowOpened(java.awt.event.WindowEvent e) {
if(CurrentUser.getCurrentUser().getSessionUser().getRol().equals("Administrador")){
getGestionjMenu1().setVisible(true);
}
if(CurrentUser.getCurrentUser().getSessionUser().getRol().equals("Invitado")){
getGestionjMenu1().setVisible(false);
}
}
});
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((screenSize.width - getWidth()) / 2,((screenSize.height - getHeight()) / 2));
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jLabel = new JLabel();
jLabel.setIcon(new ImageIcon(getClass().getResource("/Img/gl-20-02.jpg")));
jLabel.setName("jLabel");
jLabel.setText("");
jContentPane.setLayout(new CardLayout());
jContentPane.add(jLabel, jLabel.getName());
}
return jContentPane;
}
/**
* This method initializes mainMenuBar
*
* @return javax.swing.JMenuBar
*/
private JMenuBar getMainMenuBar() {
if (mainMenuBar == null) {
mainMenuBar = new JMenuBar();
mainMenuBar.add(getFileMenu());
mainMenuBar.add(getGestionjMenu1());
mainMenuBar.add(getReportsjMenu());
}
return mainMenuBar;
}
/**
* This method initializes FileMenu
*
* @return javax.swing.JMenu
*/
private JMenu getFileMenu() {
if (FileMenu == null) {
FileMenu = new JMenu();
FileMenu.setText("Archivo");
FileMenu.add(getJMenuItemAutenticar());
FileMenu.add(getJMenuItem1());
}
return FileMenu;
}
/**
* This method initializes ReportsjMenu
*
* @return javax.swing.JMenu
*/
public JMenu getReportsjMenu() {
if (ReportsjMenu == null) {
ReportsjMenu = new JMenu();
ReportsjMenu.setText(" Reportes");
ReportsjMenu.add(getJMenuItem());
ReportsjMenu.add(getContadorporCasajMenuItem2());
ReportsjMenu.add(getLecturasPorValor());
ReportsjMenu.add(getBiggerConnsumersjMenuItem());
}
return ReportsjMenu;
}
/**
* This method initializes biggerConnsumersjMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getBiggerConnsumersjMenuItem() {
if (biggerConnsumersjMenuItem == null) {
biggerConnsumersjMenuItem = new JMenuItem();
biggerConnsumersjMenuItem.setText("Mayores Consumidores");
biggerConnsumersjMenuItem.setIcon(new ImageIcon(getClass().getResource("/Img/lens_in.png")));
biggerConnsumersjMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Reportes.getR().MayoresConsumidores();
}
});
}
return biggerConnsumersjMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem() {
if (jMenuItem == null) {
jMenuItem = new JMenuItem();
jMenuItem.setText("Casas con el consumo alterado");
jMenuItem.setIcon(new ImageIcon(getClass().getResource("/Img/lens_in.png")));
jMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Reportes.getR().ReporteCasasAlteradas();
}
});
}
return jMenuItem;
}
/**
* This method initializes jMenuItem1
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem1() {
if (jMenuItem1 == null) {
jMenuItem1 = new JMenuItem();
jMenuItem1.setText("Salir");
jMenuItem1.setIcon(new ImageIcon(getClass().getResource("/Img/ico_alpha_Delete_16x16.png")));
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
dispose();
}
});
}
return jMenuItem1;
}
public void idioma(){
if(Idioma.getInstance().getIdioma().equalsIgnoreCase("ingles")){
FileMenu.setText("File");
ReportsjMenu.setText("Reports");
jMenuItem.setText("Hauses whit Altered Consuption");
jMenuItem1.setText("Exit");
VecindariojMenuItem.setText("Collectors");
biggerConnsumersjMenuItem.setText("Bigger Consumers");
CasasjMenuItem2.setText("Homes");
jMenuItemAutenticar.setText("Change User");
UsuariosjMenuItem.setText("Users");
GestionjMenu1.setText("Management");
jLecturasPorValor.setText("Home's Readings");
ContadorporCasajMenuItem2.setText("Readings for Collectors");
this.setTitle("Main");
}
else{
jLecturasPorValor.setText("Lecturas de un hogar");
FileMenu.setText("Archivo");
jMenuItem.setText("Casas con el consumo alterado");
ReportsjMenu.setText("Reportes");
CasasjMenuItem2.setText("Casas");
jMenuItem1.setText("Salir");
VecindariojMenuItem.setText("Cobradores");
biggerConnsumersjMenuItem.setText("Mayores Consumidores");
jMenuItemAutenticar.setText("Cambiar Usuario");
UsuariosjMenuItem.setText("Usuarios");
GestionjMenu1.setText("Gestión");
ContadorporCasajMenuItem2.setText("Contador y sus Lecturas");
this.setTitle("Principal");
}
}
public Principal returnThis(){
return this;
}
public Conectar getOwner() {
return owner;
}
/**
* This method initializes jMenuItemAutenticar
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItemAutenticar() {
if (jMenuItemAutenticar == null) {
jMenuItemAutenticar = new JMenuItem();
jMenuItemAutenticar.setText("Cambiar Usuario");
jMenuItemAutenticar.setIcon(new ImageIcon(getClass().getResource("/Img/edit_user.png")));
jMenuItemAutenticar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
setVisible(false);
Conectar r = new Conectar();
r.setVisible(true);
}
});
}
return jMenuItemAutenticar;
}
/**
* This method initializes GestionjMenu1
*
* @return javax.swing.JMenu
*/
private JMenu getGestionjMenu1() {
if (GestionjMenu1 == null) {
GestionjMenu1 = new JMenu();
GestionjMenu1.setText("Gestion");
GestionjMenu1.add(getUsuariosjMenuItem());
GestionjMenu1.add(getCasasjMenuItem2());
GestionjMenu1.add(getVecindariojMenuItem());
}
return GestionjMenu1;
}
/**
* This method initializes UsuariosjMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getUsuariosjMenuItem() {
if (UsuariosjMenuItem == null) {
UsuariosjMenuItem = new JMenuItem();
UsuariosjMenuItem.setText("Usuarios");
UsuariosjMenuItem.setIcon(new ImageIcon(getClass().getResource("/Img/add_user.png")));
UsuariosjMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Usuarios f = new Usuarios();
f.setVisible(true);
}
});
}
return UsuariosjMenuItem;
}
/**
* This method initializes VecindariojMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getVecindariojMenuItem() {
if (VecindariojMenuItem == null) {
VecindariojMenuItem = new JMenuItem();
VecindariojMenuItem.setText("Cobradores");
VecindariojMenuItem.setIcon(new ImageIcon(getClass().getResource("/Img/AOL Instant Messenger-fall.png")));
VecindariojMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
new CobradorVisual(Principal.this,true).setVisible(true);
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return VecindariojMenuItem;
}
/**
* This method initializes CasasjMenuItem2
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getCasasjMenuItem2() {
if (CasasjMenuItem2 == null) {
CasasjMenuItem2 = new JMenuItem();
CasasjMenuItem2.setText("Casas");
CasasjMenuItem2.setIcon(new ImageIcon(getClass().getResource("/Img/ico_alpha_HomePage_32x32.png")));
CasasjMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
new CasasVisual(Principal.this).setVisible(true);
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return CasasjMenuItem2;
}
/**
* This method initializes ContadorporCasajMenuItem2
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getContadorporCasajMenuItem2() {
if (ContadorporCasajMenuItem2 == null) {
ContadorporCasajMenuItem2 = new JMenuItem();
ContadorporCasajMenuItem2.setText("Contador y sus Lecturas");
ContadorporCasajMenuItem2.setIcon(new ImageIcon(getClass().getResource("/Img/lens_in.png")));
ContadorporCasajMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Reportes.getR().Contador();
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return ContadorporCasajMenuItem2;
}
private JMenuItem getLecturasPorValor() {
if (jLecturasPorValor == null) {
jLecturasPorValor = new JMenuItem();
jLecturasPorValor.setText("Lecturas de un hogar");
jLecturasPorValor.setIcon(new ImageIcon(getClass().getResource("/Img/lens_in.png")));
jLecturasPorValor.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
ReporteLecturaValor a = new ReporteLecturaValor();
a.setVisible(true);
}
});
}
return jLecturasPorValor;
}
} // @jve:decl-index=0:visual-constraint="10,10"
| 11,323 | 0.715598 | 0.708355 | 394 | 27.73604 | 24.918474 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.446701 | false | false |
14
|
d4a44139d7f28a333c6f316c7fcf3399f1c4c155
| 34,162,169,877,184 |
a491f013fed5ca80f6c9312859625faed984e2d3
|
/External/OpenEye-Java-2019.Oct.2-Linux-x64/examples/openeye/examples/oespicoli/BindingSite1.java
|
a5a250f2c3e84a7f503379b497ed93242241904e
|
[] |
no_license
|
Abtaha/Periodic-Table-Guessing-Game
|
https://github.com/Abtaha/Periodic-Table-Guessing-Game
|
3830eb2c6a7ba2f0cd58f7a0d47613a66d33a23c
|
d219299d08a6fa9582edb350e8d35a522add2274
|
refs/heads/master
| 2020-12-08T23:54:13.745000 | 2020-01-10T21:17:45 | 2020-01-10T21:17:45 | 233,128,558 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
(C) 2017 OpenEye Scientific Software Inc. All rights reserved.
TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of OpenEye products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. OpenEye claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable OpenEye offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall OpenEye be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
package openeye.examples.oespicoli;
import openeye.oechem.*;
import openeye.oespicoli.*;
public class BindingSite1 {
private static final float _maxDistanceSquared = 8.0f * 8.0f;
private static float getDistance (OEFloatArray acoords, OEFloatArray vcoords) {
float d2 = (vcoords.getItem(0)-acoords.getItem(0)) * (vcoords.getItem(0)-acoords.getItem(0));
d2 += (vcoords.getItem(1)-acoords.getItem(1)) * (vcoords.getItem(1)-acoords.getItem(1));
d2 += (vcoords.getItem(2)-acoords.getItem(2)) * (vcoords.getItem(2)-acoords.getItem(2));
return d2;
}
public static void main(String[] args)
{
if (args.length != 3) {
oechem.OEThrow.Usage("BindingSite1 <protein> <ligand> <surface>");
}
String proteinFile = args[0];
String ligandFile = args[1];
String surfaceFile = args[2];
oemolistream pfs = new oemolistream(proteinFile);
OEGraphMol prot = new OEGraphMol();
oechem.OEReadMolecule(pfs, prot);
pfs.close();
oechem.OEAssignBondiVdWRadii(prot);
oemolistream lfs = new oemolistream(ligandFile);
OEGraphMol lig = new OEGraphMol();
oechem.OEReadMolecule(lfs, lig);
lfs.close();
OESurface surf = new OESurface();
oespicoli.OEMakeMolecularSurface(surf, prot);
// define clique id
int cliqueId = 1;
OEFloatArray vert = new OEFloatArray(3);
OEFloatArray xyz = new OEFloatArray(3);
// Iterate through all the protein surface vertices
for (int i = 0; i < surf.GetNumVertices(); i++) {
surf.GetVertex(i, vert);
// Check the distance to each atom
for(OEAtomBase atom: lig.GetAtoms()) {
lig.GetCoords(atom, xyz);
float dist2 = getDistance(xyz, vert);
if (dist2 < _maxDistanceSquared)
surf.SetVertexCliqueElement(i, cliqueId);
}
}
// Crop to the binding site and output
oespicoli.OESurfaceCropToClique(surf, cliqueId);
oespicoli.OEWriteSurface(surfaceFile, surf);
}
}
|
UTF-8
|
Java
| 3,087 |
java
|
BindingSite1.java
|
Java
|
[] | null |
[] |
/*
(C) 2017 OpenEye Scientific Software Inc. All rights reserved.
TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of OpenEye products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. OpenEye claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable OpenEye offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall OpenEye be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
package openeye.examples.oespicoli;
import openeye.oechem.*;
import openeye.oespicoli.*;
public class BindingSite1 {
private static final float _maxDistanceSquared = 8.0f * 8.0f;
private static float getDistance (OEFloatArray acoords, OEFloatArray vcoords) {
float d2 = (vcoords.getItem(0)-acoords.getItem(0)) * (vcoords.getItem(0)-acoords.getItem(0));
d2 += (vcoords.getItem(1)-acoords.getItem(1)) * (vcoords.getItem(1)-acoords.getItem(1));
d2 += (vcoords.getItem(2)-acoords.getItem(2)) * (vcoords.getItem(2)-acoords.getItem(2));
return d2;
}
public static void main(String[] args)
{
if (args.length != 3) {
oechem.OEThrow.Usage("BindingSite1 <protein> <ligand> <surface>");
}
String proteinFile = args[0];
String ligandFile = args[1];
String surfaceFile = args[2];
oemolistream pfs = new oemolistream(proteinFile);
OEGraphMol prot = new OEGraphMol();
oechem.OEReadMolecule(pfs, prot);
pfs.close();
oechem.OEAssignBondiVdWRadii(prot);
oemolistream lfs = new oemolistream(ligandFile);
OEGraphMol lig = new OEGraphMol();
oechem.OEReadMolecule(lfs, lig);
lfs.close();
OESurface surf = new OESurface();
oespicoli.OEMakeMolecularSurface(surf, prot);
// define clique id
int cliqueId = 1;
OEFloatArray vert = new OEFloatArray(3);
OEFloatArray xyz = new OEFloatArray(3);
// Iterate through all the protein surface vertices
for (int i = 0; i < surf.GetNumVertices(); i++) {
surf.GetVertex(i, vert);
// Check the distance to each atom
for(OEAtomBase atom: lig.GetAtoms()) {
lig.GetCoords(atom, xyz);
float dist2 = getDistance(xyz, vert);
if (dist2 < _maxDistanceSquared)
surf.SetVertexCliqueElement(i, cliqueId);
}
}
// Crop to the binding site and output
oespicoli.OESurfaceCropToClique(surf, cliqueId);
oespicoli.OEWriteSurface(surfaceFile, surf);
}
}
| 3,087 | 0.665047 | 0.653385 | 80 | 37.587502 | 27.246878 | 101 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6625 | false | false |
14
|
a47e427eb5834285899c39c167533c8103691b44
| 33,809,982,560,363 |
8c06be2e1932c781f0b351c90fd767172f9a4d48
|
/baselib/src/main/java/com/apache/fastandroid/artemis/exception/InitException.java
|
a46301eafc71c3bc1c5e0d23776ed9108fd7cc39
|
[] |
no_license
|
bill-bil/FastAndroid
|
https://github.com/bill-bil/FastAndroid
|
f2ebd1c91bb662c290f087b184e101721859c153
|
3f89ad2f6f6dec0321bc4c52215c91e931931460
|
refs/heads/master
| 2023-04-02T16:47:02.528000 | 2021-04-17T03:35:45 | 2021-04-17T03:35:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.apache.fastandroid.artemis.exception;
/**
* 初始化相关异常
* Created by Jerry on 2019/2/6.
*/
public class InitException extends RuntimeException {
}
|
UTF-8
|
Java
| 173 |
java
|
InitException.java
|
Java
|
[
{
"context": "d.artemis.exception;\n\n/**\n * 初始化相关异常\n * Created by Jerry on 2019/2/6.\n */\npublic class InitException exten",
"end": 85,
"score": 0.9910811185836792,
"start": 80,
"tag": "NAME",
"value": "Jerry"
}
] | null |
[] |
package com.apache.fastandroid.artemis.exception;
/**
* 初始化相关异常
* Created by Jerry on 2019/2/6.
*/
public class InitException extends RuntimeException {
}
| 173 | 0.748428 | 0.710692 | 8 | 18.875 | 20.925089 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | false | false |
14
|
41a3522a8e6ab52743789942fc358c7907959aa6
| 2,585,570,369,823 |
df61ce21b4eba05ac1c517eeaa24634f35271cac
|
/app/src/main/java/com/example/igti/quiz/MainActivity.java
|
a88c341fa5911f318ade15ea98823896e4855081
|
[] |
no_license
|
muller207/QuizIGTI
|
https://github.com/muller207/QuizIGTI
|
afc117bd1b39f799a35f33c6a99fb142338502b1
|
05d9906d606733e80ceb98a4d3510d908016777a
|
refs/heads/master
| 2022-12-25T14:54:56.920000 | 2020-10-07T23:17:58 | 2020-10-07T23:17:58 | 301,490,239 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.igti.quiz;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.motion.widget.MotionLayout;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import org.apache.commons.io.IOUtils;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
int currentIndex = 0;
int rightAnswers = 0;
ArrayList<Question> questions;
TextView txTitle;
TextView txQuestion;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
questions = new ArrayList<>();
try {
InputStream inputStream = getAssets().open("questions.txt");
String qs = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
Type qType = new TypeToken<ArrayList<Question>>() {}.getType();
Gson gson = new GsonBuilder().create();
questions = gson.fromJson(qs, qType);
} catch (IOException e){
e.printStackTrace();
}
final MotionLayout motionLayout = (MotionLayout) findViewById(R.id.motion_base);
txTitle = (TextView) findViewById(R.id.txTitle);
txQuestion = (TextView) findViewById(R.id.txQuestion);
nextQuestion();
Button btTrue = (Button) findViewById(R.id.btTrue);
Button btFalse = (Button) findViewById(R.id.btFalse);
btTrue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
motionLayout.transitionToState(R.id.verdadeiro);
checkAnswer(true);
}
});
btFalse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
motionLayout.transitionToState(R.id.falso);
checkAnswer(false);
}
});
}
protected void nextQuestion(){
if(currentIndex==questions.size()) {
Intent i = new Intent(MainActivity.this, ResultsActivity.class);
i.putExtra("percent",(double) rightAnswers/questions.size());
startActivity(i);
}else{
txTitle.setText("Pergunta " + String.valueOf(questions.get(currentIndex).getId()));
txQuestion.setText(questions.get(currentIndex).getContent());
}
}
protected void checkAnswer(boolean answer){
if(answer == questions.get(currentIndex).getAnswer()) {
Toast.makeText(getBaseContext(), "Acertou!", Toast.LENGTH_SHORT).show();
rightAnswers++;
}else{
Toast.makeText(getBaseContext(), "Errou!", Toast.LENGTH_SHORT).show();
}
currentIndex++;
nextQuestion();
}
}
|
UTF-8
|
Java
| 3,157 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.example.igti.quiz;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.motion.widget.MotionLayout;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import org.apache.commons.io.IOUtils;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
int currentIndex = 0;
int rightAnswers = 0;
ArrayList<Question> questions;
TextView txTitle;
TextView txQuestion;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
questions = new ArrayList<>();
try {
InputStream inputStream = getAssets().open("questions.txt");
String qs = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
Type qType = new TypeToken<ArrayList<Question>>() {}.getType();
Gson gson = new GsonBuilder().create();
questions = gson.fromJson(qs, qType);
} catch (IOException e){
e.printStackTrace();
}
final MotionLayout motionLayout = (MotionLayout) findViewById(R.id.motion_base);
txTitle = (TextView) findViewById(R.id.txTitle);
txQuestion = (TextView) findViewById(R.id.txQuestion);
nextQuestion();
Button btTrue = (Button) findViewById(R.id.btTrue);
Button btFalse = (Button) findViewById(R.id.btFalse);
btTrue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
motionLayout.transitionToState(R.id.verdadeiro);
checkAnswer(true);
}
});
btFalse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
motionLayout.transitionToState(R.id.falso);
checkAnswer(false);
}
});
}
protected void nextQuestion(){
if(currentIndex==questions.size()) {
Intent i = new Intent(MainActivity.this, ResultsActivity.class);
i.putExtra("percent",(double) rightAnswers/questions.size());
startActivity(i);
}else{
txTitle.setText("Pergunta " + String.valueOf(questions.get(currentIndex).getId()));
txQuestion.setText(questions.get(currentIndex).getContent());
}
}
protected void checkAnswer(boolean answer){
if(answer == questions.get(currentIndex).getAnswer()) {
Toast.makeText(getBaseContext(), "Acertou!", Toast.LENGTH_SHORT).show();
rightAnswers++;
}else{
Toast.makeText(getBaseContext(), "Errou!", Toast.LENGTH_SHORT).show();
}
currentIndex++;
nextQuestion();
}
}
| 3,157 | 0.64555 | 0.644599 | 95 | 32.231579 | 24.862337 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.652632 | false | false |
14
|
1cf512687981906563f604843f0d2b7dcf84c51d
| 9,517,647,590,502 |
3ee68f6b0eff5fb296323f5704d3f0bb5aaab20e
|
/app/src/main/java/com/sian0412/privatelocation/LocationData.java
|
5ef0ce8cb6fc45807aef738819f9c75cbe8ea1f6
|
[] |
no_license
|
Sian0412/PrivateLocation
|
https://github.com/Sian0412/PrivateLocation
|
4d69d617134a79cba25519b3a477a028848ce320
|
752743221b25e17fa2eab352105a3a17e148ebeb
|
refs/heads/master
| 2023-07-31T09:12:40.045000 | 2021-09-15T09:21:46 | 2021-09-15T09:21:46 | 406,418,370 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sian0412.privatelocation;
import android.os.Parcel;
import android.os.Parcelable;
public class LocationData implements Parcelable {
public String name;
public String address;
public String phone;
public String remarkColumn;
public static final Creator<LocationData> CREATOR = new Creator<LocationData>() {
@Override
public LocationData createFromParcel(Parcel in) {
LocationData mLocationData = new LocationData();
mLocationData.name = in.readString();
mLocationData.address = in.readString();
mLocationData.phone = in.readString();
mLocationData.remarkColumn = in.readString();
return mLocationData;
}
@Override
public LocationData[] newArray(int size) {
return new LocationData[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name);
dest.writeString(address);
dest.writeString(phone);
dest.writeString(remarkColumn);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getRemarkColumn() {
return remarkColumn;
}
public void setRemarkColumn(String remarkColumn) {
this.remarkColumn = remarkColumn;
}
}
|
UTF-8
|
Java
| 1,750 |
java
|
LocationData.java
|
Java
|
[] | null |
[] |
package com.sian0412.privatelocation;
import android.os.Parcel;
import android.os.Parcelable;
public class LocationData implements Parcelable {
public String name;
public String address;
public String phone;
public String remarkColumn;
public static final Creator<LocationData> CREATOR = new Creator<LocationData>() {
@Override
public LocationData createFromParcel(Parcel in) {
LocationData mLocationData = new LocationData();
mLocationData.name = in.readString();
mLocationData.address = in.readString();
mLocationData.phone = in.readString();
mLocationData.remarkColumn = in.readString();
return mLocationData;
}
@Override
public LocationData[] newArray(int size) {
return new LocationData[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name);
dest.writeString(address);
dest.writeString(phone);
dest.writeString(remarkColumn);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getRemarkColumn() {
return remarkColumn;
}
public void setRemarkColumn(String remarkColumn) {
this.remarkColumn = remarkColumn;
}
}
| 1,750 | 0.621143 | 0.618286 | 73 | 22.972603 | 19.751867 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.39726 | false | false |
14
|
08788b59135aefae17ced94a6314339b9550de0c
| 27,049,704,096,499 |
b32e86028322da293b3840a8db87429cc7669167
|
/src/mdj2/bigspace/engine/GameCore.java
|
4b1d84884c3d223423b068bac1aef79394caed78
|
[] |
no_license
|
JJOL/BigSpace
|
https://github.com/JJOL/BigSpace
|
7a8c8ee4ee62f44ee41ed7026da52a5eb3efb6bf
|
8ba73731ce75f86cb4ae51fded0c9f2accde667b
|
refs/heads/master
| 2020-04-02T20:20:43.060000 | 2018-11-20T23:35:52 | 2018-11-20T23:35:52 | 154,765,784 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mdj2.bigspace.engine;
import java.util.List;
public abstract class GameCore {
protected GameContext ctx;
public GameCore() {
}
public abstract EngineConfig getEngineConfig();
public abstract List<GameScene> getGameScenes();
public void setContext(GameContext ctx) {
this.ctx = ctx;
}
}
|
UTF-8
|
Java
| 319 |
java
|
GameCore.java
|
Java
|
[] | null |
[] |
package mdj2.bigspace.engine;
import java.util.List;
public abstract class GameCore {
protected GameContext ctx;
public GameCore() {
}
public abstract EngineConfig getEngineConfig();
public abstract List<GameScene> getGameScenes();
public void setContext(GameContext ctx) {
this.ctx = ctx;
}
}
| 319 | 0.727273 | 0.724138 | 21 | 14.190476 | 16.938599 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.047619 | false | false |
14
|
a1abb91c0395d082662ce39b109944ba747fab75
| 35,905,926,636,765 |
bf75227f08897f2864b156c9f1229b4373861833
|
/src/main/java/com/dna/rna/domain/serverPort/CustomServerPortRepository.java
|
cbc4fbeadbb3930c6872bd5fc28158c0f36fdaad
|
[] |
no_license
|
4whomtbts/Alpha
|
https://github.com/4whomtbts/Alpha
|
5e0d40e452848595f7f2211eb9658354f3a4224c
|
30f572f159aadb939882ed9342f589f7cdb1e7cf
|
refs/heads/master
| 2023-04-14T16:15:54.519000 | 2021-04-27T15:27:52 | 2021-04-27T15:27:52 | 361,786,089 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dna.rna.domain.serverPort;
import com.dna.rna.domain.instance.Instance;
import com.dna.rna.domain.instanceGpu.InstanceGpu;
import com.dna.rna.domain.server.Server;
import java.util.List;
public interface CustomServerPortRepository {
public List<ServerPort> fetchFreeExternalPortOfServer(Server server);
public List<ServerPort> fetchFreeInternalPortOfServer(Server server);
public void removeServerPortByInstance(Instance instance);
}
|
UTF-8
|
Java
| 465 |
java
|
CustomServerPortRepository.java
|
Java
|
[] | null |
[] |
package com.dna.rna.domain.serverPort;
import com.dna.rna.domain.instance.Instance;
import com.dna.rna.domain.instanceGpu.InstanceGpu;
import com.dna.rna.domain.server.Server;
import java.util.List;
public interface CustomServerPortRepository {
public List<ServerPort> fetchFreeExternalPortOfServer(Server server);
public List<ServerPort> fetchFreeInternalPortOfServer(Server server);
public void removeServerPortByInstance(Instance instance);
}
| 465 | 0.812903 | 0.812903 | 17 | 26.352942 | 27.317181 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false |
14
|
c00c5c2b603a638279a5c7ce026dd5f07b2f16ab
| 38,792,144,669,944 |
027a256805fc7e34cdfcec7afd8f351e6cbe1bd6
|
/Bankanwendung/src/g18/it1a/view/KundeAnlegenPanel.java
|
73252bc9cf138570fb506947035196f720f3791b
|
[] |
no_license
|
ivkovicmarjan/bank
|
https://github.com/ivkovicmarjan/bank
|
82315f6f5f061cbfe7bbbb3b43669edbd45df527
|
d332ee0a556157c4c224127ac4ac17bd201a9180
|
refs/heads/master
| 2021-01-22T16:05:33.101000 | 2013-08-01T06:46:32 | 2013-08-01T06:46:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package g18.it1a.view;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class KundeAnlegenPanel extends JPanel {
private JLabel kundenNummerLabel;
private JTextField kundenNummerField;
private JTextField kundenNameField;
private JButton anlegenButton;
private static final long serialVersionUID = 2326402193059787237L;
public KundeAnlegenPanel() {
setLayout(null);
kundenNummerLabel = new JLabel("Kundennummer:");
kundenNummerLabel.setBounds(10, 11, 124, 23);
anlegenButton = new JButton("Anlegen");
anlegenButton.setBounds(116, 76, 84, 23);
add(kundenNummerLabel);
add(anlegenButton);
JLabel lblKundenname = new JLabel("Kundenname:");
lblKundenname.setBounds(10, 48, 89, 14);
add(lblKundenname);
kundenNummerField = new JTextFieldWithLimit(5);
kundenNummerField.setBounds(111, 12, 89, 20);
add(kundenNummerField);
kundenNameField = new JTextField();
kundenNameField.setBounds(111, 45, 89, 20);
add(kundenNameField);
kundenNameField.setColumns(10);
}
public JTextField getKundenNummerField() {
return kundenNummerField;
}
public JTextField getKundenNameField() {
return kundenNameField;
}
public JButton getAnlegenButton() {
return anlegenButton;
}
}
|
UTF-8
|
Java
| 1,341 |
java
|
KundeAnlegenPanel.java
|
Java
|
[] | null |
[] |
package g18.it1a.view;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class KundeAnlegenPanel extends JPanel {
private JLabel kundenNummerLabel;
private JTextField kundenNummerField;
private JTextField kundenNameField;
private JButton anlegenButton;
private static final long serialVersionUID = 2326402193059787237L;
public KundeAnlegenPanel() {
setLayout(null);
kundenNummerLabel = new JLabel("Kundennummer:");
kundenNummerLabel.setBounds(10, 11, 124, 23);
anlegenButton = new JButton("Anlegen");
anlegenButton.setBounds(116, 76, 84, 23);
add(kundenNummerLabel);
add(anlegenButton);
JLabel lblKundenname = new JLabel("Kundenname:");
lblKundenname.setBounds(10, 48, 89, 14);
add(lblKundenname);
kundenNummerField = new JTextFieldWithLimit(5);
kundenNummerField.setBounds(111, 12, 89, 20);
add(kundenNummerField);
kundenNameField = new JTextField();
kundenNameField.setBounds(111, 45, 89, 20);
add(kundenNameField);
kundenNameField.setColumns(10);
}
public JTextField getKundenNummerField() {
return kundenNummerField;
}
public JTextField getKundenNameField() {
return kundenNameField;
}
public JButton getAnlegenButton() {
return anlegenButton;
}
}
| 1,341 | 0.735272 | 0.683818 | 53 | 23.301888 | 18.678596 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.849057 | false | false |
14
|
4982fe45f023dc48d67637eca83276b0c4f2b703
| 36,971,078,513,967 |
010c576e1b973e4d7cc34a01b3446488498b89d3
|
/family/src/main/java/edu/pdx/cs410J/family/RemoteMarriageImpl.java
|
8f028186f57242f32d36b649123d2de85f553847
|
[
"Apache-2.0"
] |
permissive
|
DavidWhitlock/PortlandStateJava
|
https://github.com/DavidWhitlock/PortlandStateJava
|
1460097b63b488be2dc25f86d4b6428f9c4fd411
|
3a50f18b1ebbd35856dd7598bfacbdb5c1c5ac89
|
refs/heads/main
| 2023-06-28T03:59:10.729000 | 2023-06-10T18:10:34 | 2023-06-10T18:10:34 | 9,431,642 | 17 | 12 |
Apache-2.0
| false | 2023-06-10T18:10:35 | 2013-04-14T16:31:58 | 2023-02-04T06:12:05 | 2023-06-10T18:10:34 | 43,340 | 18 | 5 | 22 |
Java
| false | false |
package edu.pdx.cs410J.family;
import java.rmi.*;
import java.util.Date;
/**
* This is class implements the <code>RemoteMarriage</code> interface.
* Basically, it delegates all of its behavior to an underlying {@link
* edu.pdx.cs410J.family.Marriage} that lives only on the server.
*/
@SuppressWarnings("serial")
class RemoteMarriageImpl extends java.rmi.server.UnicastRemoteObject
implements RemoteMarriage {
/** The underlying Marriage that is being modeled. */
private transient Marriage marriage;
////////////////////// Constructors //////////////////////
/**
* Creates a new <code>RemoteMarriageImpl</code> that delegates most
* of its behavior to a given <code>Marriage</code>
*/
RemoteMarriageImpl(Marriage marriage) throws RemoteException {
this.marriage = marriage;
}
//////////////////// Instance Methods ////////////////////
public int getHusbandId() throws RemoteException {
return this.marriage.getHusband().getId();
}
public int getWifeId() throws RemoteException {
return this.marriage.getWife().getId();
}
public Date getDate() throws RemoteException {
return this.marriage.getDate();
}
public void setDate(Date date) throws RemoteException {
this.marriage.setDate(date);
}
public String getLocation() throws RemoteException {
return this.marriage.getLocation();
}
public void setLocation(String location) throws RemoteException {
this.marriage.setLocation(location);
}
public String getDescription() throws RemoteException {
return this.marriage.toString();
}
}
|
UTF-8
|
Java
| 1,586 |
java
|
RemoteMarriageImpl.java
|
Java
|
[] | null |
[] |
package edu.pdx.cs410J.family;
import java.rmi.*;
import java.util.Date;
/**
* This is class implements the <code>RemoteMarriage</code> interface.
* Basically, it delegates all of its behavior to an underlying {@link
* edu.pdx.cs410J.family.Marriage} that lives only on the server.
*/
@SuppressWarnings("serial")
class RemoteMarriageImpl extends java.rmi.server.UnicastRemoteObject
implements RemoteMarriage {
/** The underlying Marriage that is being modeled. */
private transient Marriage marriage;
////////////////////// Constructors //////////////////////
/**
* Creates a new <code>RemoteMarriageImpl</code> that delegates most
* of its behavior to a given <code>Marriage</code>
*/
RemoteMarriageImpl(Marriage marriage) throws RemoteException {
this.marriage = marriage;
}
//////////////////// Instance Methods ////////////////////
public int getHusbandId() throws RemoteException {
return this.marriage.getHusband().getId();
}
public int getWifeId() throws RemoteException {
return this.marriage.getWife().getId();
}
public Date getDate() throws RemoteException {
return this.marriage.getDate();
}
public void setDate(Date date) throws RemoteException {
this.marriage.setDate(date);
}
public String getLocation() throws RemoteException {
return this.marriage.getLocation();
}
public void setLocation(String location) throws RemoteException {
this.marriage.setLocation(location);
}
public String getDescription() throws RemoteException {
return this.marriage.toString();
}
}
| 1,586 | 0.691047 | 0.687264 | 58 | 26.344828 | 25.783951 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.224138 | false | false |
14
|
a18bf5800293a121764edae8d357b38d57311ca9
| 22,419,729,288,203 |
b4cd197eecd6ebc79efb17e91e2936851a3ec96c
|
/src/main/java/edu/gslis/queries/expansion/TemporalRelevanceModel.java
|
92ad4bcc760bb3dcf49872ba10d416f30533b728
|
[] |
no_license
|
craig-willis/temporal
|
https://github.com/craig-willis/temporal
|
168f6c373c5e40c0d18b26974ed233fafabaffde
|
45a73c4d8eb17dbddc1effdc380c40e8550bf4aa
|
refs/heads/master
| 2020-05-19T15:35:43.350000 | 2017-10-07T22:51:11 | 2017-10-07T22:51:11 | 23,710,436 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.gslis.queries.expansion;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import edu.gslis.scorers.temporal.KDEScorer;
import edu.gslis.searchhits.SearchHit;
import edu.gslis.temporal.util.RKernelDensity;
import edu.gslis.textrepresentation.FeatureVector;
import edu.gslis.utils.KeyValuePair;
import edu.gslis.utils.KeyValuePairs;
/**
* Inspired by Peetz. What if we incorporate the KDE data directly into the relevance model estimation,
* instead of via the scores?
*/
public class TemporalRelevanceModel extends Feedback {
private double[] docWeights = null;
@Override
public void build() {
try {
Set<String> vocab = new HashSet<String>();
List<FeatureVector> fbDocVectors = new LinkedList<FeatureVector>();
if(relDocs == null) {
relDocs = index.runQuery(originalQuery, fbDocCount);
}
double[] x = KDEScorer.getTimes(relDocs);
double[] w = KDEScorer.getUniformWeights(relDocs);
RKernelDensity dist = new RKernelDensity(x, w);
double[] rsvs = new double[relDocs.size()];
double[] times = new double[relDocs.size()];
int k=0;
Iterator<SearchHit> hitIterator = relDocs.iterator();
while(hitIterator.hasNext()) {
SearchHit hit = hitIterator.next();
times[k] = KDEScorer.getTime(hit);
rsvs[k++] = Math.exp(hit.getScore());
}
hitIterator = relDocs.iterator();
while(hitIterator.hasNext()) {
SearchHit hit = hitIterator.next();
FeatureVector docVector = index.getDocVector(hit.getDocID(), stopper);
vocab.addAll(docVector.getFeatures());
fbDocVectors.add(docVector);
}
features = new KeyValuePairs();
Iterator<String> it = vocab.iterator();
while(it.hasNext()) {
String term = it.next();
double fbWeight = 0.0;
Iterator<FeatureVector> docIT = fbDocVectors.iterator();
k=0;
while(docIT.hasNext()) {
FeatureVector docVector = docIT.next();
double docProb = docVector.getFeatureWeight(term) / docVector.getLength();
double docWeight = 1.0;
if(docWeights != null)
docWeight = docWeights[k];
docProb *= rsvs[k++];
docProb *= docWeight;
fbWeight += docProb;
}
fbWeight /= (double)fbDocVectors.size();
KeyValuePair tuple = new KeyValuePair(term, fbWeight);
features.add(tuple);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void setDocWeights(double[] docWeights) {
this.docWeights = docWeights;
}
}
|
UTF-8
|
Java
| 2,574 |
java
|
TemporalRelevanceModel.java
|
Java
|
[
{
"context": "u.gslis.utils.KeyValuePairs;\n\n\n\n/**\n * Inspired by Peetz. What if we incorporate the KDE data directly in",
"end": 450,
"score": 0.6538612246513367,
"start": 445,
"tag": "USERNAME",
"value": "Peetz"
}
] | null |
[] |
package edu.gslis.queries.expansion;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import edu.gslis.scorers.temporal.KDEScorer;
import edu.gslis.searchhits.SearchHit;
import edu.gslis.temporal.util.RKernelDensity;
import edu.gslis.textrepresentation.FeatureVector;
import edu.gslis.utils.KeyValuePair;
import edu.gslis.utils.KeyValuePairs;
/**
* Inspired by Peetz. What if we incorporate the KDE data directly into the relevance model estimation,
* instead of via the scores?
*/
public class TemporalRelevanceModel extends Feedback {
private double[] docWeights = null;
@Override
public void build() {
try {
Set<String> vocab = new HashSet<String>();
List<FeatureVector> fbDocVectors = new LinkedList<FeatureVector>();
if(relDocs == null) {
relDocs = index.runQuery(originalQuery, fbDocCount);
}
double[] x = KDEScorer.getTimes(relDocs);
double[] w = KDEScorer.getUniformWeights(relDocs);
RKernelDensity dist = new RKernelDensity(x, w);
double[] rsvs = new double[relDocs.size()];
double[] times = new double[relDocs.size()];
int k=0;
Iterator<SearchHit> hitIterator = relDocs.iterator();
while(hitIterator.hasNext()) {
SearchHit hit = hitIterator.next();
times[k] = KDEScorer.getTime(hit);
rsvs[k++] = Math.exp(hit.getScore());
}
hitIterator = relDocs.iterator();
while(hitIterator.hasNext()) {
SearchHit hit = hitIterator.next();
FeatureVector docVector = index.getDocVector(hit.getDocID(), stopper);
vocab.addAll(docVector.getFeatures());
fbDocVectors.add(docVector);
}
features = new KeyValuePairs();
Iterator<String> it = vocab.iterator();
while(it.hasNext()) {
String term = it.next();
double fbWeight = 0.0;
Iterator<FeatureVector> docIT = fbDocVectors.iterator();
k=0;
while(docIT.hasNext()) {
FeatureVector docVector = docIT.next();
double docProb = docVector.getFeatureWeight(term) / docVector.getLength();
double docWeight = 1.0;
if(docWeights != null)
docWeight = docWeights[k];
docProb *= rsvs[k++];
docProb *= docWeight;
fbWeight += docProb;
}
fbWeight /= (double)fbDocVectors.size();
KeyValuePair tuple = new KeyValuePair(term, fbWeight);
features.add(tuple);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void setDocWeights(double[] docWeights) {
this.docWeights = docWeights;
}
}
| 2,574 | 0.674437 | 0.672106 | 96 | 25.8125 | 22.101711 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.833333 | false | false |
14
|
ce375ff3d7c7b06abb30723f83157851e622b715
| 34,368,328,356,919 |
649d19c0ad988439f4e886968163286f48d35715
|
/src/com/klausschoeffmann/Strings3.java
|
2d3def5d2cc2c9864f5e389fd97a5eed4030c787
|
[] |
no_license
|
klschoef/ESOPVO
|
https://github.com/klschoef/ESOPVO
|
707d1252300d456d37842c41dde442f4bf055ee7
|
10213720f93fb61841fa86cbab06aa63bdfc070a
|
refs/heads/master
| 2020-08-11T00:42:55.757000 | 2020-01-22T22:50:53 | 2020-01-22T22:50:53 | 214,455,199 | 2 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.klausschoeffmann;
public class Strings3 {
public static void main(String[] args) {
inefficientStringConcat();
efficientStringConcat();
}
static void inefficientStringConcat() {
long timeStart = System.currentTimeMillis();
String str = "";
for (int i=0; i < 10000; i++) {
str = str + i + " ";
}
//System.out.println(str);
long timeEnd = System.currentTimeMillis();
System.out.println("Time measurement: " + (timeEnd-timeStart) + "ms");
}
static void efficientStringConcat() {
long timeStart = System.currentTimeMillis();
StringBuilder sb = new StringBuilder();
for (int i=0; i < 10000; i++) {
sb.append(i);
sb.append(" ");
}
//System.out.println(sb.toString());
long timeEnd = System.currentTimeMillis();
System.out.println("Time measurement: " + (timeEnd-timeStart) + "ms");
}
}
|
UTF-8
|
Java
| 982 |
java
|
Strings3.java
|
Java
|
[] | null |
[] |
package com.klausschoeffmann;
public class Strings3 {
public static void main(String[] args) {
inefficientStringConcat();
efficientStringConcat();
}
static void inefficientStringConcat() {
long timeStart = System.currentTimeMillis();
String str = "";
for (int i=0; i < 10000; i++) {
str = str + i + " ";
}
//System.out.println(str);
long timeEnd = System.currentTimeMillis();
System.out.println("Time measurement: " + (timeEnd-timeStart) + "ms");
}
static void efficientStringConcat() {
long timeStart = System.currentTimeMillis();
StringBuilder sb = new StringBuilder();
for (int i=0; i < 10000; i++) {
sb.append(i);
sb.append(" ");
}
//System.out.println(sb.toString());
long timeEnd = System.currentTimeMillis();
System.out.println("Time measurement: " + (timeEnd-timeStart) + "ms");
}
}
| 982 | 0.570265 | 0.557027 | 31 | 30.67742 | 21.215313 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.645161 | false | false |
14
|
2fda27f8d26862fe4b5f5865d5cd2b6e368e095f
| 38,371,237,845,249 |
0215bcb1fd206ff3f8a278b8edf8c9a941bffebb
|
/src/day50_maps/Soru1_Bankamatik.java
|
cff6b2a1a6da9f0f0b344c16a0c07649a1867c5d
|
[] |
no_license
|
mhmmtyksl/java2021SummerTr
|
https://github.com/mhmmtyksl/java2021SummerTr
|
53fae4caa9fb99091998b662be8cbfd4a1451081
|
691101025e8d198628914cfa9a639749daab1251
|
refs/heads/master
| 2023-08-17T20:09:05.381000 | 2021-09-16T07:55:32 | 2021-09-16T07:55:32 | 403,857,808 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package day50_maps;
public class Soru1_Bankamatik {
public static void main(String[] args) {
/*
1) Kullanicidan kimlik numarasini(4 haneli), tam ismini, adresini, telefonunu, alin
2) Kimlik numarasini key olarak, diger bilgileri value olarak bir map'e depolayin
saveInfo() method olusturun:
3)Kullanicidan bircok kimlik numarasi(4 haneli), isim, adres ve telefon alin.
4)Kimlik numarasini key olarak, diger bilgileri value olarak bir map'e depolayin.
5)Ayni kimlik numarasi ile bilgi girilmesine engel olun.
getInfo() method olusturun:
1)Kimlik numarasini girerek kullanicinin bilgilerine ulasin.
2)Olmayan kimlik numarasi girilirse kullaniciya hata mesaji verin.
removeInfo() method olusturun:
1)Kimlik numarasini girerek data silin.
2)Girilen kimlik numarasi yoksa kullaniciya hata mesaji verin.
3)Collection bos ise kullaniciya hata mesaji verin.
selectOption() method olusturun:
1)Yukaridaki 3 methodu programi sonlandirana kadar secme hakki verin
*/
}
}
|
UTF-8
|
Java
| 1,088 |
java
|
Soru1_Bankamatik.java
|
Java
|
[] | null |
[] |
package day50_maps;
public class Soru1_Bankamatik {
public static void main(String[] args) {
/*
1) Kullanicidan kimlik numarasini(4 haneli), tam ismini, adresini, telefonunu, alin
2) Kimlik numarasini key olarak, diger bilgileri value olarak bir map'e depolayin
saveInfo() method olusturun:
3)Kullanicidan bircok kimlik numarasi(4 haneli), isim, adres ve telefon alin.
4)Kimlik numarasini key olarak, diger bilgileri value olarak bir map'e depolayin.
5)Ayni kimlik numarasi ile bilgi girilmesine engel olun.
getInfo() method olusturun:
1)Kimlik numarasini girerek kullanicinin bilgilerine ulasin.
2)Olmayan kimlik numarasi girilirse kullaniciya hata mesaji verin.
removeInfo() method olusturun:
1)Kimlik numarasini girerek data silin.
2)Girilen kimlik numarasi yoksa kullaniciya hata mesaji verin.
3)Collection bos ise kullaniciya hata mesaji verin.
selectOption() method olusturun:
1)Yukaridaki 3 methodu programi sonlandirana kadar secme hakki verin
*/
}
}
| 1,088 | 0.714154 | 0.698529 | 25 | 42.52 | 31.822155 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52 | false | false |
14
|
94dfa838e720e702ec8606d8d203b2fb7ba7d43d
| 23,983,097,401,826 |
eb8ec53304081d3c4874bdd556d3cd5f1dfbf6b9
|
/src/Produto.java
|
ca7b884e0ca3dac1fdddc188c5003f753ae09e48
|
[] |
no_license
|
arthurrio/POO
|
https://github.com/arthurrio/POO
|
e35bca4d63a7ffd7eb0d57ad271577b1f6c1f9be
|
6cbcc8b5516b2dd550c81cc36ce9bb94f9173e46
|
refs/heads/master
| 2020-03-28T16:15:39.804000 | 2018-09-13T17:24:35 | 2018-09-13T17:24:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Produto {
private String nome;
private int cod;
private float preco;
public Produto(String nome, int cod, float preco) {
this.nome = nome;
this.cod = cod;
this.preco = preco;
}
public boolean equals(Produto a) {
if(a==null) return false;
if(this.nome==a.nome && this.cod==a.cod) {
System.out.println("Produto jŠ cadastrado!");
return true;
}else {
return false;
}
}
public String toString() {
return "\nProduto\nNome: " + nome + ", Codigo: " + cod + ", Preco: " + preco;
}
public int getCod() {
return cod;
}
public void setPreco(float preco) {
this.preco = preco;
}
public float getPreco() {
return preco;
}
}
|
MacCentralEurope
|
Java
| 726 |
java
|
Produto.java
|
Java
|
[] | null |
[] |
public class Produto {
private String nome;
private int cod;
private float preco;
public Produto(String nome, int cod, float preco) {
this.nome = nome;
this.cod = cod;
this.preco = preco;
}
public boolean equals(Produto a) {
if(a==null) return false;
if(this.nome==a.nome && this.cod==a.cod) {
System.out.println("Produto jŠ cadastrado!");
return true;
}else {
return false;
}
}
public String toString() {
return "\nProduto\nNome: " + nome + ", Codigo: " + cod + ", Preco: " + preco;
}
public int getCod() {
return cod;
}
public void setPreco(float preco) {
this.preco = preco;
}
public float getPreco() {
return preco;
}
}
| 726 | 0.591724 | 0.591724 | 40 | 16.075001 | 17.441885 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.7 | false | false |
14
|
677a23239daf348af684045c4500bda55f79bf8d
| 32,770,600,498,015 |
b5514b666bd36aa9fafc1a152cfe3c4fa3722c60
|
/src/Lesson04/chat/ChatServer.java
|
af93cad79878b26683b80ed82524de03cb65049e
|
[] |
no_license
|
EvgenySaenko/Java2
|
https://github.com/EvgenySaenko/Java2
|
6018f12cdbb318792fb480fbd48bd0dac9596003
|
06516ee8c3566942d3e53c35a93a0cb2c638f75a
|
refs/heads/master
| 2020-12-20T19:12:10.942000 | 2020-02-10T14:13:44 | 2020-02-10T14:13:44 | 234,045,353 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Lesson04.chat;
import Lesson04.chat.network.ServerSocetThread;
public class ChatServer {
public ServerSocetThread server;
public void start(int port) {
if (server != null && server.isAlive())
System.out.println("Server already started");
else
server = new ServerSocetThread("Server", port);
}
public void stop() {
if (server == null || !server.isAlive()) {
System.out.println("Server is not running");
} else {
server.interrupt();
}
}
}
|
UTF-8
|
Java
| 557 |
java
|
ChatServer.java
|
Java
|
[] | null |
[] |
package Lesson04.chat;
import Lesson04.chat.network.ServerSocetThread;
public class ChatServer {
public ServerSocetThread server;
public void start(int port) {
if (server != null && server.isAlive())
System.out.println("Server already started");
else
server = new ServerSocetThread("Server", port);
}
public void stop() {
if (server == null || !server.isAlive()) {
System.out.println("Server is not running");
} else {
server.interrupt();
}
}
}
| 557 | 0.585278 | 0.578097 | 23 | 23.26087 | 20.749474 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.434783 | false | false |
14
|
f97787fd7cf0c7878407d1de954406d15c81533d
| 12,661,563,644,583 |
3af3cfec4d5220b6825d6c947bef58c6ddd2fa63
|
/NewsActivity.java
|
b580a7ab63e000edb52ded7829b1f60dc5554c7a
|
[] |
no_license
|
nppujitha/Newsapp
|
https://github.com/nppujitha/Newsapp
|
81d6f90f5073206ec8ac333c98a13fb1d26b8e62
|
ccfa031921f88dedf8ca65686095ab09ff39ab64
|
refs/heads/master
| 2021-01-24T13:28:46.577000 | 2018-04-27T00:09:19 | 2018-04-27T00:09:19 | 123,175,325 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.akipuja.Inclass7;
/*
Naga Poorna Pujitha,
Akshay Karai
Group34
*/
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
public class NewsActivity extends AppCompatActivity implements GetNewsTask.INewsArticle {
ArrayList<NewsArticle> newsArticles=new ArrayList<>();
ListView newsListView;
NewsAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(com.example.akipuja.Inclass7.R.layout.activity_news);
newsListView = (ListView)findViewById(com.example.akipuja.Inclass7.R.id.newsListView);
if(getIntent()!= null && getIntent().getExtras()!=null){
if(getIntent().getExtras().containsKey("category")){
String sCategory=getIntent().getExtras().getString("category");
setTitle(sCategory);
if(isConnected()) {
new GetNewsTask(NewsActivity.this, NewsActivity.this).execute("https://newsapi.org/v2/top-headlines?country=us&apiKey=bbee98d8505449b6ae2f0f5e4bdb22b3&category=" + sCategory);
}else{
Toast.makeText(this, "No Internet", Toast.LENGTH_SHORT).show();
}
}
}
newsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent(getBaseContext(),DetailActivity.class);
NewsArticle na = new NewsArticle();
Log.d("demo1", "onItemClick: "+newsArticles.get(i).getTitle());
na.title = newsArticles.get(i).getTitle();
na.publishedAt = newsArticles.get(i).getPublishedAt();
na.description = newsArticles.get(i).getDescription();
na.urlToImage = newsArticles.get(i).getUrlToImage();
intent.putExtra("detailedNews",na);
startActivity(intent);
}
});
}
private boolean isConnected() {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
if (networkInfo == null || !networkInfo.isConnected() ||
(networkInfo.getType() != ConnectivityManager.TYPE_WIFI
&& networkInfo.getType() != ConnectivityManager.TYPE_MOBILE)) {
return false;
}
return true;
}
@Override
public void handleNewsArticle(ArrayList<NewsArticle> s) {
if(s!=null&&!s.isEmpty()) {
newsArticles = s;
adapter = new NewsAdapter(this, com.example.akipuja.Inclass7.R.layout.news_listview, newsArticles);
newsListView.setAdapter(adapter);
}else{
Toast.makeText(this, "No News", Toast.LENGTH_SHORT).show();
}
}
}
|
UTF-8
|
Java
| 3,436 |
java
|
NewsActivity.java
|
Java
|
[
{
"context": "package com.example.akipuja.Inclass7;\r\n/*\r\n Naga Poorna Pujitha,\r\n Akshay Karai\r\n Group34\r\n*/\r\n",
"end": 64,
"score": 0.9998096823692322,
"start": 45,
"tag": "NAME",
"value": "Naga Poorna Pujitha"
},
{
"context": "a.Inclass7;\r\n/*\r\n Naga Poorna Pujitha,\r\n Akshay Karai\r\n Group34\r\n*/\r\n\r\nimport android.content.",
"end": 89,
"score": 0.9998589754104614,
"start": 77,
"tag": "NAME",
"value": "Akshay Karai"
},
{
"context": "://newsapi.org/v2/top-headlines?country=us&apiKey=bbee98d8505449b6ae2f0f5e4bdb22b3&category=\" + sCategory);\r\n }else{\r",
"end": 1478,
"score": 0.9995636940002441,
"start": 1446,
"tag": "KEY",
"value": "bbee98d8505449b6ae2f0f5e4bdb22b3"
}
] | null |
[] |
package com.example.akipuja.Inclass7;
/*
<NAME>,
<NAME>
Group34
*/
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
public class NewsActivity extends AppCompatActivity implements GetNewsTask.INewsArticle {
ArrayList<NewsArticle> newsArticles=new ArrayList<>();
ListView newsListView;
NewsAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(com.example.akipuja.Inclass7.R.layout.activity_news);
newsListView = (ListView)findViewById(com.example.akipuja.Inclass7.R.id.newsListView);
if(getIntent()!= null && getIntent().getExtras()!=null){
if(getIntent().getExtras().containsKey("category")){
String sCategory=getIntent().getExtras().getString("category");
setTitle(sCategory);
if(isConnected()) {
new GetNewsTask(NewsActivity.this, NewsActivity.this).execute("https://newsapi.org/v2/top-headlines?country=us&apiKey=bbee98d8505449b6ae2f0f5e4bdb22b3&category=" + sCategory);
}else{
Toast.makeText(this, "No Internet", Toast.LENGTH_SHORT).show();
}
}
}
newsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent(getBaseContext(),DetailActivity.class);
NewsArticle na = new NewsArticle();
Log.d("demo1", "onItemClick: "+newsArticles.get(i).getTitle());
na.title = newsArticles.get(i).getTitle();
na.publishedAt = newsArticles.get(i).getPublishedAt();
na.description = newsArticles.get(i).getDescription();
na.urlToImage = newsArticles.get(i).getUrlToImage();
intent.putExtra("detailedNews",na);
startActivity(intent);
}
});
}
private boolean isConnected() {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
if (networkInfo == null || !networkInfo.isConnected() ||
(networkInfo.getType() != ConnectivityManager.TYPE_WIFI
&& networkInfo.getType() != ConnectivityManager.TYPE_MOBILE)) {
return false;
}
return true;
}
@Override
public void handleNewsArticle(ArrayList<NewsArticle> s) {
if(s!=null&&!s.isEmpty()) {
newsArticles = s;
adapter = new NewsAdapter(this, com.example.akipuja.Inclass7.R.layout.news_listview, newsArticles);
newsListView.setAdapter(adapter);
}else{
Toast.makeText(this, "No News", Toast.LENGTH_SHORT).show();
}
}
}
| 3,417 | 0.62922 | 0.621653 | 84 | 38.904762 | 34.660469 | 195 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.702381 | false | false |
14
|
22786d387b6c94f81a85e6195e31e5088b8e7249
| 4,380,866,665,676 |
1f84fd4de56e2133bc44606b2aae6f9e90a344dd
|
/src/main/java/com/webdrone/assembla/dto/SpaceTicketCountDto.java
|
d3886cebbee54abaa5177c8bde109ca93ef608ad
|
[] |
no_license
|
luismance/AssemblaReaderWebApp
|
https://github.com/luismance/AssemblaReaderWebApp
|
c502927dd47331fc76af92952d0fe7f9c8c370c8
|
531827bf0b404d6bd1ca3f96d5842f0bd5d1b2f8
|
refs/heads/master
| 2021-09-29T02:22:20.315000 | 2018-11-22T19:05:18 | 2018-11-22T19:05:18 | 109,387,640 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.webdrone.assembla.dto;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "spaceTicketCount")
public class SpaceTicketCountDto {
private long ticketCount;
private String syncStatus;
@XmlElement(name = "count")
public long getTicketCount() {
return ticketCount;
}
public void setTicketCount(long ticketCount) {
this.ticketCount = ticketCount;
}
@XmlElement(name = "sync_status")
public String getSyncStatus() {
return syncStatus;
}
public void setSyncStatus(String syncStatus) {
this.syncStatus = syncStatus;
}
}
|
UTF-8
|
Java
| 619 |
java
|
SpaceTicketCountDto.java
|
Java
|
[] | null |
[] |
package com.webdrone.assembla.dto;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "spaceTicketCount")
public class SpaceTicketCountDto {
private long ticketCount;
private String syncStatus;
@XmlElement(name = "count")
public long getTicketCount() {
return ticketCount;
}
public void setTicketCount(long ticketCount) {
this.ticketCount = ticketCount;
}
@XmlElement(name = "sync_status")
public String getSyncStatus() {
return syncStatus;
}
public void setSyncStatus(String syncStatus) {
this.syncStatus = syncStatus;
}
}
| 619 | 0.760905 | 0.760905 | 31 | 18.967741 | 17.797216 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.935484 | false | false |
14
|
a6f488c551ff72c1ced123e532196580b535b7aa
| 32,341,103,793,079 |
8f32b05055117f13462db6299b623b71d1e3325b
|
/src/test/java/stepDefinations/VerifyMidYearApprisalStepDefinations.java
|
f9bef53173bbb50a9095ba831f21d74628a1366d
|
[] |
no_license
|
rjnits/RisePortalBDDFramework
|
https://github.com/rjnits/RisePortalBDDFramework
|
b433a24cd29e1f1a050b5a607c7e5bd642050559
|
47b40ba0f6d2e5a63bbf35d944d357273925fe11
|
refs/heads/master
| 2021-07-14T01:18:41.962000 | 2019-09-10T14:16:14 | 2019-09-10T14:16:14 | 207,578,306 | 0 | 0 | null | false | 2020-10-13T15:57:04 | 2019-09-10T14:14:19 | 2019-09-10T14:16:58 | 2020-10-13T15:57:02 | 4,523 | 0 | 0 | 1 |
HTML
| false | false |
package stepDefinations;
import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
public class VerifyMidYearApprisalStepDefinations {
public static WebDriver driver;
@Given("^user on Home page$")
public void user_on_Home_page() throws InterruptedException {
System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir")+"\\Drivers\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(50, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
try {
Runtime.getRuntime().exec("C:\\Users\\raju.das\\Desktop\\Window\\WindowAuthScript.exe");
}
catch(Exception e) {
System.out.println(e.getMessage());
}
driver.get("https://rise.trianz.com");
Thread.sleep(5000);
}
@Then("^mouse hover to Apprisal and Click on My Apprisal$")
public void mouse_hover_to_Apprisal_and_Click_on_My_Apprisal() throws Throwable {
WebElement apprisal =driver.findElement(By.xpath("//span[text()='APPRAISAL']"));
Actions action =new Actions(driver);
action.moveToElement(apprisal).perform();
driver.findElement(By.xpath("//a[text()='My Appraisal']")).click();
}
@Then("^click on latest self assement$")
public void click_on_latest_self_assement() throws InterruptedException {
driver.findElement(By.xpath("//label[contains(text(),' Mid-year Assessment 2019-20' )]//parent::span[@class='display']//parent::td//following-sibling::td//a[text()='Self-Assessment']")).click();
Thread.sleep(5000);
}
@Then("^move to the bottom of the page$")
public void move_to_the_bottom_of_the_page() {
JavascriptExecutor js = (JavascriptExecutor)driver; //Create instance of Java Script executor
WebElement text1 = driver.findElement(By.xpath("//*[contains(text(),'Activity by')]"));
js.executeScript("arguments[0].scrollIntoView(true);",text1);
}
@Then("^verify the status of goal setting$")
public void verify_the_status_of_goal_setting(){
String actual= driver.findElement(By.xpath("//*[contains(text(),'Activity by')]")).getText();
Assert.assertEquals(actual.substring(actual.length()-"Goal Setting Approved".length()),"Goal Setting Approved");
// driver.close();
}
@After("@second")
public void tearDown() {
driver.close();
}
}
|
UTF-8
|
Java
| 2,818 |
java
|
VerifyMidYearApprisalStepDefinations.java
|
Java
|
[
{
"context": "\t\ttry {\n\t\tRuntime.getRuntime().exec(\"C:\\\\Users\\\\raju.das\\\\Desktop\\\\Window\\\\WindowAuthScript.exe\");\n\t\t}\n\t\tc",
"end": 1107,
"score": 0.6288569569587708,
"start": 1101,
"tag": "NAME",
"value": "ju.das"
},
{
"context": "etting Approved\");\n//\t\tdriver.close();\n\t}\n\n\t@After(\"@second\")\n public void tearDown() {\n \tdriver.close(",
"end": 2755,
"score": 0.9820234179496765,
"start": 2748,
"tag": "USERNAME",
"value": "@second"
}
] | null |
[] |
package stepDefinations;
import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
public class VerifyMidYearApprisalStepDefinations {
public static WebDriver driver;
@Given("^user on Home page$")
public void user_on_Home_page() throws InterruptedException {
System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir")+"\\Drivers\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(50, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
try {
Runtime.getRuntime().exec("C:\\Users\\raju.das\\Desktop\\Window\\WindowAuthScript.exe");
}
catch(Exception e) {
System.out.println(e.getMessage());
}
driver.get("https://rise.trianz.com");
Thread.sleep(5000);
}
@Then("^mouse hover to Apprisal and Click on My Apprisal$")
public void mouse_hover_to_Apprisal_and_Click_on_My_Apprisal() throws Throwable {
WebElement apprisal =driver.findElement(By.xpath("//span[text()='APPRAISAL']"));
Actions action =new Actions(driver);
action.moveToElement(apprisal).perform();
driver.findElement(By.xpath("//a[text()='My Appraisal']")).click();
}
@Then("^click on latest self assement$")
public void click_on_latest_self_assement() throws InterruptedException {
driver.findElement(By.xpath("//label[contains(text(),' Mid-year Assessment 2019-20' )]//parent::span[@class='display']//parent::td//following-sibling::td//a[text()='Self-Assessment']")).click();
Thread.sleep(5000);
}
@Then("^move to the bottom of the page$")
public void move_to_the_bottom_of_the_page() {
JavascriptExecutor js = (JavascriptExecutor)driver; //Create instance of Java Script executor
WebElement text1 = driver.findElement(By.xpath("//*[contains(text(),'Activity by')]"));
js.executeScript("arguments[0].scrollIntoView(true);",text1);
}
@Then("^verify the status of goal setting$")
public void verify_the_status_of_goal_setting(){
String actual= driver.findElement(By.xpath("//*[contains(text(),'Activity by')]")).getText();
Assert.assertEquals(actual.substring(actual.length()-"Goal Setting Approved".length()),"Goal Setting Approved");
// driver.close();
}
@After("@second")
public void tearDown() {
driver.close();
}
}
| 2,818 | 0.716466 | 0.709013 | 82 | 33.365852 | 34.798203 | 196 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.646341 | false | false |
14
|
c5b9d3b543a58e0f86cbb4beead43376664fe437
| 8,899,172,242,855 |
43dc726b2f769bf2d04e446504b4d2b4715e53ae
|
/bos-web/src/main/java/com/itheima/bos/web/action/FunctionAction.java
|
e9c8362699c0882998f598620df8521efeaf6112
|
[] |
no_license
|
xienian/bos-parent
|
https://github.com/xienian/bos-parent
|
54a5bafc75183329ac27b0b6519adca967441bd2
|
c5dc5cb63259ded837481b0692f323a28b6cd932
|
refs/heads/master
| 2022-12-22T10:35:28.642000 | 2022-04-23T11:26:55 | 2022-04-23T11:26:59 | 177,051,960 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.itheima.bos.web.action;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.itheima.bos.domain.Function;
import com.itheima.bos.domain.User;
import com.itheima.bos.service.IFunctionService;
import com.itheima.bos.utils.BOSUtils;
import com.itheima.bos.web.action.base.BaseAction;
@Controller
@Scope("prototype")
public class FunctionAction extends BaseAction<Function> {
@Autowired
IFunctionService service;
/**
* 功能:
* 1.查询所有权限数据;
* 2.一般用来添加权限时查询;
* @return
*/
public String listajax() {
List<Function> list = service.findAll();
this.java2Json(list, new String[] {"roles","parentFunction"});
return NONE;
}
public String add() {
service.save(model);
return LIST;
}
public String pageQuery(){
String page = model.getPage();
pageBean.setCurrentPage(Integer.parseInt(page));
service.pageQuery(pageBean);
this.java2Json(pageBean, new String[]{"parentFunction","roles","children"});
return NONE;
}
/**
* 功能:
* 1.根据用户对象查询权限;
* @return
*/
public String findMenu() {
/**
* 1.获取当前用户对象;
* 2.获取权限数据;
* 3.返回json格式数据;
*/
List<Function> list= service.findMenu();
this.java2Json(list, new String[] {"roles","children"});//https://blog.csdn.net/wangyang163wy/article/details/50088177.为了过滤掉不需要转为json的成员变量
return NONE;
}
}
|
UTF-8
|
Java
| 1,603 |
java
|
FunctionAction.java
|
Java
|
[
{
"context": "g[] {\"roles\",\"children\"});//https://blog.csdn.net/wangyang163wy/article/details/50088177.为了过滤掉不需要转为json的成员变量\n\t\t\n\t",
"end": 1379,
"score": 0.9997048377990723,
"start": 1366,
"tag": "USERNAME",
"value": "wangyang163wy"
}
] | null |
[] |
package com.itheima.bos.web.action;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.itheima.bos.domain.Function;
import com.itheima.bos.domain.User;
import com.itheima.bos.service.IFunctionService;
import com.itheima.bos.utils.BOSUtils;
import com.itheima.bos.web.action.base.BaseAction;
@Controller
@Scope("prototype")
public class FunctionAction extends BaseAction<Function> {
@Autowired
IFunctionService service;
/**
* 功能:
* 1.查询所有权限数据;
* 2.一般用来添加权限时查询;
* @return
*/
public String listajax() {
List<Function> list = service.findAll();
this.java2Json(list, new String[] {"roles","parentFunction"});
return NONE;
}
public String add() {
service.save(model);
return LIST;
}
public String pageQuery(){
String page = model.getPage();
pageBean.setCurrentPage(Integer.parseInt(page));
service.pageQuery(pageBean);
this.java2Json(pageBean, new String[]{"parentFunction","roles","children"});
return NONE;
}
/**
* 功能:
* 1.根据用户对象查询权限;
* @return
*/
public String findMenu() {
/**
* 1.获取当前用户对象;
* 2.获取权限数据;
* 3.返回json格式数据;
*/
List<Function> list= service.findMenu();
this.java2Json(list, new String[] {"roles","children"});//https://blog.csdn.net/wangyang163wy/article/details/50088177.为了过滤掉不需要转为json的成员变量
return NONE;
}
}
| 1,603 | 0.718125 | 0.704342 | 61 | 22.786884 | 24.423929 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.557377 | false | false |
14
|
5b45dbedbe71f66a2875e6b0a9ed4a6cab9233c4
| 16,406,775,110,509 |
ab9b90b92009ce680f3d59c4a17bf183cc47f743
|
/src/test/java/com/pfernand/pfonboard/pfonboard/adapter/secondary/rest/UserCheckRestTest.java
|
7b05887ca832d618f10c445b7449d94421f2d04f
|
[] |
no_license
|
PauloFer1/pf-onboard
|
https://github.com/PauloFer1/pf-onboard
|
d4947de26fbe647635bb539fe646877a05de72eb
|
a00de35cc4efb56ee6b5443c6af010dce4b91246
|
refs/heads/master
| 2020-04-09T21:08:18.110000 | 2019-02-10T23:05:49 | 2019-02-10T23:05:49 | 160,592,961 | 0 | 0 | null | false | 2018-12-15T22:48:58 | 2018-12-05T23:47:48 | 2018-12-12T22:02:09 | 2018-12-15T22:48:35 | 51 | 0 | 0 | 1 |
Java
| false | null |
package com.pfernand.pfonboard.pfonboard.adapter.secondary.rest;
import com.pfernand.pfonboard.pfonboard.core.model.User;
import com.pfernand.pfonboard.pfonboard.security.AppToken;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
@RunWith(MockitoJUnitRunner.class)
public class UserCheckRestTest {
private static final String EMAIL = "paulo@mail.com";
private static final String SERVICE_URI = "service.com/user/";
private static final String TOKEN = "token";
@Mock
private RestTemplate restTemplate;
@Mock
private AppToken appToken;
private UserCheckRest userCheckRest;
@Before
public void SetUp() {
userCheckRest = new UserCheckRest(restTemplate, SERVICE_URI, appToken);
}
@Test
public void isEmailRegisteredThrowsRestException() {
// Given
// When
Mockito.when(restTemplate.exchange(SERVICE_URI + EMAIL, HttpMethod.GET, generateRequest(), User.class))
.thenThrow(new HttpClientErrorException(HttpStatus.UNAUTHORIZED));
Mockito.when(appToken.generateAppToken()).thenReturn(TOKEN);
// Then
assertThatExceptionOfType(HttpClientErrorException.class)
.isThrownBy(() -> userCheckRest.isEmailRegistered(EMAIL))
.withMessageContaining("401 UNAUTHORIZED");
}
@Test
public void isEmailRegisteredReturnsfalse() {
// Given
// When
Mockito.when(restTemplate.exchange(SERVICE_URI + EMAIL, HttpMethod.GET, generateRequest(), User.class))
.thenThrow(new HttpClientErrorException(HttpStatus.NOT_FOUND));
Mockito.when(appToken.generateAppToken()).thenReturn(TOKEN);
boolean result = userCheckRest.isEmailRegistered(EMAIL);
// Then
assertFalse(result);
}
@Test
public void isEmailRegisteredReturnstrue() {
// Given
// When
Mockito.when(restTemplate.exchange(SERVICE_URI + EMAIL, HttpMethod.GET, generateRequest(), User.class))
.thenReturn(ResponseEntity.ok(User.builder().build()));
Mockito.when(appToken.generateAppToken()).thenReturn(TOKEN);
boolean result = userCheckRest.isEmailRegistered(EMAIL);
// Then
assertTrue(result);
}
private HttpEntity<User> generateRequest() {
final HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
httpHeaders.set(HttpHeaders.AUTHORIZATION, "Bearer " + TOKEN);
return new HttpEntity<>(httpHeaders);
}
}
|
UTF-8
|
Java
| 3,229 |
java
|
UserCheckRestTest.java
|
Java
|
[
{
"context": "tTest {\n\n private static final String EMAIL = \"paulo@mail.com\";\n private static final String SERVICE_URI = \"",
"end": 1031,
"score": 0.9999145269393921,
"start": 1017,
"tag": "EMAIL",
"value": "paulo@mail.com"
},
{
"context": "/user/\";\n private static final String TOKEN = \"token\";\n\n @Mock\n private RestTemplate restTemplat",
"end": 1147,
"score": 0.7346103191375732,
"start": 1142,
"tag": "KEY",
"value": "token"
}
] | null |
[] |
package com.pfernand.pfonboard.pfonboard.adapter.secondary.rest;
import com.pfernand.pfonboard.pfonboard.core.model.User;
import com.pfernand.pfonboard.pfonboard.security.AppToken;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
@RunWith(MockitoJUnitRunner.class)
public class UserCheckRestTest {
private static final String EMAIL = "<EMAIL>";
private static final String SERVICE_URI = "service.com/user/";
private static final String TOKEN = "token";
@Mock
private RestTemplate restTemplate;
@Mock
private AppToken appToken;
private UserCheckRest userCheckRest;
@Before
public void SetUp() {
userCheckRest = new UserCheckRest(restTemplate, SERVICE_URI, appToken);
}
@Test
public void isEmailRegisteredThrowsRestException() {
// Given
// When
Mockito.when(restTemplate.exchange(SERVICE_URI + EMAIL, HttpMethod.GET, generateRequest(), User.class))
.thenThrow(new HttpClientErrorException(HttpStatus.UNAUTHORIZED));
Mockito.when(appToken.generateAppToken()).thenReturn(TOKEN);
// Then
assertThatExceptionOfType(HttpClientErrorException.class)
.isThrownBy(() -> userCheckRest.isEmailRegistered(EMAIL))
.withMessageContaining("401 UNAUTHORIZED");
}
@Test
public void isEmailRegisteredReturnsfalse() {
// Given
// When
Mockito.when(restTemplate.exchange(SERVICE_URI + EMAIL, HttpMethod.GET, generateRequest(), User.class))
.thenThrow(new HttpClientErrorException(HttpStatus.NOT_FOUND));
Mockito.when(appToken.generateAppToken()).thenReturn(TOKEN);
boolean result = userCheckRest.isEmailRegistered(EMAIL);
// Then
assertFalse(result);
}
@Test
public void isEmailRegisteredReturnstrue() {
// Given
// When
Mockito.when(restTemplate.exchange(SERVICE_URI + EMAIL, HttpMethod.GET, generateRequest(), User.class))
.thenReturn(ResponseEntity.ok(User.builder().build()));
Mockito.when(appToken.generateAppToken()).thenReturn(TOKEN);
boolean result = userCheckRest.isEmailRegistered(EMAIL);
// Then
assertTrue(result);
}
private HttpEntity<User> generateRequest() {
final HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
httpHeaders.set(HttpHeaders.AUTHORIZATION, "Bearer " + TOKEN);
return new HttpEntity<>(httpHeaders);
}
}
| 3,222 | 0.720037 | 0.719108 | 91 | 34.494507 | 28.921787 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.593407 | false | false |
14
|
750896dfe69f8f5bfa34be574d534a1b26253505
| 26,328,149,579,235 |
3916b10b9fb1ca283e21328a386818eb078186f9
|
/app/src/main/java/com/testkart/exam/edu/register/RegisterResponse.java
|
fa6c363efee7a40668d468e3d0b664f4eecc751c
|
[] |
no_license
|
zuzuauthor/Testkart
|
https://github.com/zuzuauthor/Testkart
|
51dbbdca3cff8c431fad6a6b8a9a25c021a5636f
|
6c8deb51cea8163c1932d22a9356d7b471af5d60
|
refs/heads/master
| 2020-03-21T10:45:20.349000 | 2018-07-11T07:51:34 | 2018-07-11T07:51:34 | 138,469,360 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.testkart.exam.edu.register;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by testkart on 15/5/17.
*/
public class RegisterResponse {
@SerializedName("status")
@Expose
private Boolean status;
@SerializedName("message")
@Expose
private String message;
@SerializedName("feedback")
@Expose
private String feedback;
@SerializedName("result")
@Expose
private String result;
@SerializedName("examResultId")
@Expose
private String examResultId;
@SerializedName("student_id")
@Expose
private String student_id;
public String getStudent_id() {
return student_id;
}
public void setStudent_id(String student_id) {
this.student_id = student_id;
}
public String getFeedback() {
return feedback;
}
public void setFeedback(String feedback) {
this.feedback = feedback;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getExamResultId() {
return examResultId;
}
public void setExamResultId(String examResultId) {
this.examResultId = examResultId;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
String res = "POResponse: "+status+"\n"+message+"\n"+feedback+"\n"+result+"\n"+examResultId+"\n"+student_id;
return res;
}
}
|
UTF-8
|
Java
| 1,786 |
java
|
RegisterResponse.java
|
Java
|
[
{
"context": "son.annotations.SerializedName;\n\n/**\n * Created by testkart on 15/5/17.\n */\n\npublic class RegisterResponse {\n",
"end": 162,
"score": 0.9996750950813293,
"start": 154,
"tag": "USERNAME",
"value": "testkart"
}
] | null |
[] |
package com.testkart.exam.edu.register;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by testkart on 15/5/17.
*/
public class RegisterResponse {
@SerializedName("status")
@Expose
private Boolean status;
@SerializedName("message")
@Expose
private String message;
@SerializedName("feedback")
@Expose
private String feedback;
@SerializedName("result")
@Expose
private String result;
@SerializedName("examResultId")
@Expose
private String examResultId;
@SerializedName("student_id")
@Expose
private String student_id;
public String getStudent_id() {
return student_id;
}
public void setStudent_id(String student_id) {
this.student_id = student_id;
}
public String getFeedback() {
return feedback;
}
public void setFeedback(String feedback) {
this.feedback = feedback;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getExamResultId() {
return examResultId;
}
public void setExamResultId(String examResultId) {
this.examResultId = examResultId;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
String res = "POResponse: "+status+"\n"+message+"\n"+feedback+"\n"+result+"\n"+examResultId+"\n"+student_id;
return res;
}
}
| 1,786 | 0.628219 | 0.62542 | 93 | 18.204302 | 19.071207 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.247312 | false | false |
14
|
8d2556b81b725c56032df25c0985ac88d9d40bfe
| 26,328,149,579,627 |
b5ae3f188db83c09ddf32996a25635e736554060
|
/src/com/tutorialspoint/HiWorld.java
|
322bc223236ea03a9fd0c13d58077d04eb85781e
|
[] |
no_license
|
WanduoHeng/MyFirstSpring
|
https://github.com/WanduoHeng/MyFirstSpring
|
bd33f96b1da57addc8026f2134c16b889523ada2
|
c7ba02c0b4a003f75d9d0dd2cc0d549e45257de8
|
refs/heads/master
| 2020-03-27T21:53:03.591000 | 2018-09-03T16:12:47 | 2018-09-03T16:12:47 | 147,183,528 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tutorialspoint;
public class HiWorld {
private String message;
public void setMessage(String message){
this.message = message;
}
public void getMessage(){
System.out.println("HiWorld Your message :" + message);
}
public void init(){
System.out.println("Init HiWorld...");
}
public void destroy(){
System.out.println("Destroy HiWorld...");
}
}
|
UTF-8
|
Java
| 425 |
java
|
HiWorld.java
|
Java
|
[] | null |
[] |
package com.tutorialspoint;
public class HiWorld {
private String message;
public void setMessage(String message){
this.message = message;
}
public void getMessage(){
System.out.println("HiWorld Your message :" + message);
}
public void init(){
System.out.println("Init HiWorld...");
}
public void destroy(){
System.out.println("Destroy HiWorld...");
}
}
| 425 | 0.616471 | 0.616471 | 17 | 24 | 18.240227 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false |
14
|
3b0c132c09145598ad3bbcf4c5d7c67b6b1e9d51
| 3,736,621,589,168 |
2cc97ea8be78b2202e5636e57941a75469679cde
|
/src/main/java/com/esdemo/modules/bean/AgentShareRuleTask.java
|
40be44ba79cd5c648768d09a7f378e8e2eedbf17
|
[] |
no_license
|
houmenghui/es-demo
|
https://github.com/houmenghui/es-demo
|
9fff9a92cfdb332b0ea74c5143dfce0adc17f2c2
|
6e2b1d4842d1da9267320d36a700311460aaac36
|
refs/heads/master
| 2022-11-14T04:07:55.132000 | 2020-07-14T03:57:51 | 2020-07-14T03:57:51 | 279,468,101 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.esdemo.modules.bean;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author tgh
* @description
* @date 2019/6/13
*/
@Data
public class AgentShareRuleTask {
private Integer id;
private Long shareId;
// @JSONField(format = "yyyy-MM-dd")
private Date efficientDate;
private Integer effectiveStatus;
private Integer profitType;
private BigDecimal perFixIncome;
private BigDecimal perFixInrate;
private BigDecimal safeLine;
private BigDecimal capping;
private BigDecimal shareProfitPercent;
private String ladder;
private String entityId;
private String agentNo;
private BigDecimal shareProfitPercentHistory;//修改前分润比例
private BigDecimal costHistory;//修改前代理商成本
private String costRateType;
private BigDecimal perFixCost;
private BigDecimal costRate;
private BigDecimal costCapping;
private BigDecimal costSafeline;
private BigDecimal ladder1Rate;
private BigDecimal ladder1Max;
private BigDecimal ladder2Rate;
private BigDecimal ladder2Max;
private BigDecimal ladder3Rate;
private BigDecimal ladder3Max;
private BigDecimal ladder4Rate;
private BigDecimal ladder4Max;
private String income;
private String cost;
private String ladderRate;
private Integer checkStatus;
private String serviceType;
private String serviceId;
private String cardType;
private String holidaysMark;
public void setLadder(String ladder) {
this.ladder = ladder == null ? null : ladder.trim();
}
public void setCostRateType(String costRateType) {
this.costRateType = costRateType == null ? null : costRateType.trim();
}
}
|
UTF-8
|
Java
| 1,784 |
java
|
AgentShareRuleTask.java
|
Java
|
[
{
"context": "BigDecimal;\nimport java.util.Date;\n\n/**\n * @author tgh\n * @description\n * @date 2019/6/13\n */\n@Data\npubl",
"end": 126,
"score": 0.9994968175888062,
"start": 123,
"tag": "USERNAME",
"value": "tgh"
}
] | null |
[] |
package com.esdemo.modules.bean;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author tgh
* @description
* @date 2019/6/13
*/
@Data
public class AgentShareRuleTask {
private Integer id;
private Long shareId;
// @JSONField(format = "yyyy-MM-dd")
private Date efficientDate;
private Integer effectiveStatus;
private Integer profitType;
private BigDecimal perFixIncome;
private BigDecimal perFixInrate;
private BigDecimal safeLine;
private BigDecimal capping;
private BigDecimal shareProfitPercent;
private String ladder;
private String entityId;
private String agentNo;
private BigDecimal shareProfitPercentHistory;//修改前分润比例
private BigDecimal costHistory;//修改前代理商成本
private String costRateType;
private BigDecimal perFixCost;
private BigDecimal costRate;
private BigDecimal costCapping;
private BigDecimal costSafeline;
private BigDecimal ladder1Rate;
private BigDecimal ladder1Max;
private BigDecimal ladder2Rate;
private BigDecimal ladder2Max;
private BigDecimal ladder3Rate;
private BigDecimal ladder3Max;
private BigDecimal ladder4Rate;
private BigDecimal ladder4Max;
private String income;
private String cost;
private String ladderRate;
private Integer checkStatus;
private String serviceType;
private String serviceId;
private String cardType;
private String holidaysMark;
public void setLadder(String ladder) {
this.ladder = ladder == null ? null : ladder.trim();
}
public void setCostRateType(String costRateType) {
this.costRateType = costRateType == null ? null : costRateType.trim();
}
}
| 1,784 | 0.718358 | 0.709806 | 90 | 18.48889 | 18.364969 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false |
14
|
d9bc8a23cf9ba132f1e6d0727f6d26b7b7b89670
| 11,072,425,691,018 |
762b2786928d086bbae6951f5ffad59547692d90
|
/src/algorithm/leetCode/alibaba/MyBlockingQueue.java
|
d078cb1779609d326d5f53f3002b1635c331cd8d
|
[] |
no_license
|
freestylewill/algorithm-structure
|
https://github.com/freestylewill/algorithm-structure
|
200eac33d2d35d01eeaa07e1a55a1fda48d5d825
|
6de69aa6a951afdd6a1c6f4599dbaa700d56bedd
|
refs/heads/master
| 2022-06-13T04:53:55.694000 | 2020-05-08T15:36:39 | 2020-05-08T15:36:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package algorithm.leetCode.alibaba;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class MyBlockingQueue {
AtomicInteger atomicInteger = new AtomicInteger(0);
Queue<Integer> queue;
int capacity;
Lock lock = new ReentrantLock();
Condition consumer = lock.newCondition();
Condition producer = lock.newCondition();
public MyBlockingQueue(int capacity) {
this.capacity = capacity;
queue = new ArrayDeque<>(capacity);
}
public void enqueue(int element) throws InterruptedException {
try {
lock.lock();
while (queue.size() == capacity) {
producer.await();
}
queue.add(element);
atomicInteger.incrementAndGet();
consumer.signal();
} finally {
lock.unlock();
}
}
public int dequeue() throws InterruptedException {
try {
lock.lock();
while (queue.isEmpty()) {
consumer.await();
}
atomicInteger.decrementAndGet();
int result = queue.poll();
producer.signal();
return result;
} finally {
lock.unlock();
}
}
public boolean isEmpty() {
lock.lock();
try {
return capacity == 0;
} finally {
lock.unlock();
}
}
public int size() {
return atomicInteger.get();
}
public static void main(String[] args) {
AtomicInteger result = new AtomicInteger();
MyBlockingQueue myBlockingQueue = new MyBlockingQueue(100);
new Thread(() -> {
for (int i = 0; i <= 100; i++) {
try {
myBlockingQueue.enqueue(i);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
new Thread(() -> {
while (!myBlockingQueue.isEmpty()) {
try {
System.out.println(result.addAndGet(myBlockingQueue.dequeue()));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
}
|
UTF-8
|
Java
| 2,444 |
java
|
MyBlockingQueue.java
|
Java
|
[] | null |
[] |
package algorithm.leetCode.alibaba;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class MyBlockingQueue {
AtomicInteger atomicInteger = new AtomicInteger(0);
Queue<Integer> queue;
int capacity;
Lock lock = new ReentrantLock();
Condition consumer = lock.newCondition();
Condition producer = lock.newCondition();
public MyBlockingQueue(int capacity) {
this.capacity = capacity;
queue = new ArrayDeque<>(capacity);
}
public void enqueue(int element) throws InterruptedException {
try {
lock.lock();
while (queue.size() == capacity) {
producer.await();
}
queue.add(element);
atomicInteger.incrementAndGet();
consumer.signal();
} finally {
lock.unlock();
}
}
public int dequeue() throws InterruptedException {
try {
lock.lock();
while (queue.isEmpty()) {
consumer.await();
}
atomicInteger.decrementAndGet();
int result = queue.poll();
producer.signal();
return result;
} finally {
lock.unlock();
}
}
public boolean isEmpty() {
lock.lock();
try {
return capacity == 0;
} finally {
lock.unlock();
}
}
public int size() {
return atomicInteger.get();
}
public static void main(String[] args) {
AtomicInteger result = new AtomicInteger();
MyBlockingQueue myBlockingQueue = new MyBlockingQueue(100);
new Thread(() -> {
for (int i = 0; i <= 100; i++) {
try {
myBlockingQueue.enqueue(i);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
new Thread(() -> {
while (!myBlockingQueue.isEmpty()) {
try {
System.out.println(result.addAndGet(myBlockingQueue.dequeue()));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
}
| 2,444 | 0.527005 | 0.523322 | 91 | 25.857143 | 18.361792 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false |
14
|
b98640f6726f74ba2a93ec15423adad6cf571b30
| 15,728,170,307,756 |
d04403e843c3f4e922262d6b76c02b5b265cf738
|
/KinanCity-captcha-server/src/main/java/com/kinancity/captcha/server/CaptchaController.java
|
9cd3d7b793073ca61abf0d9d140a15e49c9101d3
|
[
"Apache-2.0"
] |
permissive
|
drallieiv/KinanCity
|
https://github.com/drallieiv/KinanCity
|
eb0e942d4a0e590b94bc78d9b1d448c57f5359f3
|
0e7631cb8f6963ef5e1602d4356c1af12b053299
|
refs/heads/develop
| 2023-08-17T01:51:20.408000 | 2023-08-09T00:21:24 | 2023-08-09T00:21:24 | 85,866,226 | 125 | 92 |
Apache-2.0
| false | 2023-08-17T21:57:03 | 2017-03-22T19:09:31 | 2023-08-17T19:21:59 | 2023-08-17T21:57:01 | 784 | 108 | 66 | 27 |
Java
| false | false |
package com.kinancity.captcha.server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.kinancity.captcha.server.errors.SolvingException;
import com.kinancity.core.captcha.antiCaptcha.dto.AbstractTaskDto;
import com.kinancity.core.captcha.antiCaptcha.dto.BalanceRequest;
import com.kinancity.core.captcha.antiCaptcha.dto.BalanceResponse;
import com.kinancity.core.captcha.antiCaptcha.dto.CatpchaSolutionDto;
import com.kinancity.core.captcha.antiCaptcha.dto.CreateTaskRequest;
import com.kinancity.core.captcha.antiCaptcha.dto.CreateTaskResponse;
import com.kinancity.core.captcha.antiCaptcha.dto.PtcCaptchaTask;
import com.kinancity.core.captcha.antiCaptcha.dto.TaskResultRequest;
import com.kinancity.core.captcha.antiCaptcha.dto.TaskResultResponse;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
public class CaptchaController {
private SolvingService solvingService;
@Autowired
public CaptchaController(SolvingService solvingService) {
this.solvingService = solvingService;
}
@RequestMapping(path = "/captcha/balance", method = RequestMethod.POST)
public BalanceResponse getBalance(@RequestBody BalanceRequest request) {
log.debug("get Balance Called");
BalanceResponse response = new BalanceResponse();
Double balance = 999D;
response.setBalance(balance);
return response;
}
@RequestMapping(path = "/captcha/submit", method = RequestMethod.POST)
public CreateTaskResponse addRequest(@RequestBody CreateTaskRequest request) {
log.debug("add Request Called");
AbstractTaskDto task = request.getTask();
if (task instanceof PtcCaptchaTask) {
PtcCaptchaTask captchaTask = PtcCaptchaTask.class.cast(task);
Integer taskId = solvingService.addPtcCaptchaTask(captchaTask);
CreateTaskResponse response = new CreateTaskResponse();
response.setTaskId(taskId);
return response;
} else {
CreateTaskResponse response = new CreateTaskResponse();
response.setErrorCode("999");
response.setErrorDescription("Unknown task type");
return response;
}
}
@RequestMapping(path = "/captcha/retrieive", method = RequestMethod.POST)
public TaskResultResponse getResult(@RequestBody TaskResultRequest request) {
log.debug("get Result Called");
TaskResultResponse response = new TaskResultResponse();
try {
String captcha = solvingService.getCaptchaFor(Integer.parseInt(request.getTaskId()));
if (captcha != null) {
response.setStatus(TaskResultResponse.READY);
CatpchaSolutionDto solution = new CatpchaSolutionDto();
solution.setGRecaptchaResponse(captcha);
response.setSolution(solution);
} else {
response.setStatus(TaskResultResponse.PROCESSING);
}
} catch (SolvingException e) {
response.setStatus(TaskResultResponse.READY);
response.setErrorId(1);
response.setErrorDescription(e.getMessage());
response.setErrorCode("FAILED");
}
return response;
}
}
|
UTF-8
|
Java
| 3,150 |
java
|
CaptchaController.java
|
Java
|
[] | null |
[] |
package com.kinancity.captcha.server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.kinancity.captcha.server.errors.SolvingException;
import com.kinancity.core.captcha.antiCaptcha.dto.AbstractTaskDto;
import com.kinancity.core.captcha.antiCaptcha.dto.BalanceRequest;
import com.kinancity.core.captcha.antiCaptcha.dto.BalanceResponse;
import com.kinancity.core.captcha.antiCaptcha.dto.CatpchaSolutionDto;
import com.kinancity.core.captcha.antiCaptcha.dto.CreateTaskRequest;
import com.kinancity.core.captcha.antiCaptcha.dto.CreateTaskResponse;
import com.kinancity.core.captcha.antiCaptcha.dto.PtcCaptchaTask;
import com.kinancity.core.captcha.antiCaptcha.dto.TaskResultRequest;
import com.kinancity.core.captcha.antiCaptcha.dto.TaskResultResponse;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
public class CaptchaController {
private SolvingService solvingService;
@Autowired
public CaptchaController(SolvingService solvingService) {
this.solvingService = solvingService;
}
@RequestMapping(path = "/captcha/balance", method = RequestMethod.POST)
public BalanceResponse getBalance(@RequestBody BalanceRequest request) {
log.debug("get Balance Called");
BalanceResponse response = new BalanceResponse();
Double balance = 999D;
response.setBalance(balance);
return response;
}
@RequestMapping(path = "/captcha/submit", method = RequestMethod.POST)
public CreateTaskResponse addRequest(@RequestBody CreateTaskRequest request) {
log.debug("add Request Called");
AbstractTaskDto task = request.getTask();
if (task instanceof PtcCaptchaTask) {
PtcCaptchaTask captchaTask = PtcCaptchaTask.class.cast(task);
Integer taskId = solvingService.addPtcCaptchaTask(captchaTask);
CreateTaskResponse response = new CreateTaskResponse();
response.setTaskId(taskId);
return response;
} else {
CreateTaskResponse response = new CreateTaskResponse();
response.setErrorCode("999");
response.setErrorDescription("Unknown task type");
return response;
}
}
@RequestMapping(path = "/captcha/retrieive", method = RequestMethod.POST)
public TaskResultResponse getResult(@RequestBody TaskResultRequest request) {
log.debug("get Result Called");
TaskResultResponse response = new TaskResultResponse();
try {
String captcha = solvingService.getCaptchaFor(Integer.parseInt(request.getTaskId()));
if (captcha != null) {
response.setStatus(TaskResultResponse.READY);
CatpchaSolutionDto solution = new CatpchaSolutionDto();
solution.setGRecaptchaResponse(captcha);
response.setSolution(solution);
} else {
response.setStatus(TaskResultResponse.PROCESSING);
}
} catch (SolvingException e) {
response.setStatus(TaskResultResponse.READY);
response.setErrorId(1);
response.setErrorDescription(e.getMessage());
response.setErrorCode("FAILED");
}
return response;
}
}
| 3,150 | 0.793968 | 0.790794 | 91 | 33.615383 | 27.224249 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.857143 | false | false |
14
|
db04225918a5eae1455257389d6126686fcc97c9
| 20,701,742,376,317 |
eac782d369c11b7ba0eddcc38c38f2a5b1dd2095
|
/Labo_yaka/src/be/steformations/xb/labo/yaka/beans/Produit.java
|
7e073a0ad0f8c04512436060b29016cceefd31b8
|
[] |
no_license
|
XavierGDM/LaboYaka
|
https://github.com/XavierGDM/LaboYaka
|
e32827e24c5e62a8ffb0d0be273754ade4333725
|
77d10eea1bb7370a64aa63817d0420a2c6b5ed29
|
refs/heads/master
| 2021-07-09T23:30:15.138000 | 2017-10-10T14:56:44 | 2017-10-10T14:56:44 | 104,896,543 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package be.steformations.xb.labo.yaka.beans;
public class Produit {
private int id;
private String nom;
private String vignette;
private String image;
private String desc_courte;
private String desc_longue;
private int prod_stat;
private SousCategorie sousCategorie;
private java.util.List<Produit> sousProduit;
private java.util.List<Caracteristique> caracteristiques;
public java.util.List<Caracteristique> getCaracteristiques() {
return caracteristiques;
}
public void setCaracteristiques(java.util.List<Caracteristique> caracteristiques) {
this.caracteristiques = caracteristiques;
}
public int getId() {
return id;
}
public java.util.List<Produit> getSousProduit() {
return sousProduit;
}
public void setSousProduit(java.util.List<Produit> sousProduit) {
this.sousProduit = sousProduit;
}
public void setId(int id) {
this.id = id;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getVignette() {
return vignette;
}
public void setVignette(String vignette) {
this.vignette = vignette;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getDesc_courte() {
return desc_courte;
}
public void setDesc_courte(String desc_courte) {
this.desc_courte = desc_courte;
}
public String getDesc_longue() {
return desc_longue;
}
public void setDesc_longue(String desc_longue) {
this.desc_longue = desc_longue;
}
public int getProd_stat() {
return prod_stat;
}
public void setProd_stat(int prod_stat) {
this.prod_stat = prod_stat;
}
public SousCategorie getSousCategorie() {
return sousCategorie;
}
public void setSousCategorie(SousCategorie sousCategorie) {
this.sousCategorie = sousCategorie;
}
// public java.util.List<Caracteristique> getCaracteristiques() {
// return caracteristiques;
// }
// public void setCaracteristiques(java.util.List<Caracteristique> caracteristiques) {
// this.caracteristiques = caracteristiques;
// }
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((caracteristiques == null) ? 0 : caracteristiques.hashCode());
// result = prime * result + ((desc_courte == null) ? 0 : desc_courte.hashCode());
// result = prime * result + ((desc_longue == null) ? 0 : desc_longue.hashCode());
// result = prime * result + id;
// result = prime * result + ((image == null) ? 0 : image.hashCode());
// result = prime * result + ((nom == null) ? 0 : nom.hashCode());
// result = prime * result + prod_stat;
// result = prime * result + ((sousCategorie == null) ? 0 : sousCategorie.hashCode());
// result = prime * result + ((vignette == null) ? 0 : vignette.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;
// Produit other = (Produit) obj;
// if (caracteristiques == null) {
// if (other.caracteristiques != null)
// return false;
// } else if (!caracteristiques.equals(other.caracteristiques))
// return false;
// if (desc_courte == null) {
// if (other.desc_courte != null)
// return false;
// } else if (!desc_courte.equals(other.desc_courte))
// return false;
// if (desc_longue == null) {
// if (other.desc_longue != null)
// return false;
// } else if (!desc_longue.equals(other.desc_longue))
// return false;
// if (id != other.id)
// return false;
// if (image == null) {
// if (other.image != null)
// return false;
// } else if (!image.equals(other.image))
// return false;
// if (nom == null) {
// if (other.nom != null)
// return false;
// } else if (!nom.equals(other.nom))
// return false;
// if (prod_stat != other.prod_stat)
// return false;
// if (sousCategorie == null) {
// if (other.sousCategorie != null)
// return false;
// } else if (!sousCategorie.equals(other.sousCategorie))
// return false;
// if (vignette == null) {
// if (other.vignette != null)
// return false;
// } else if (!vignette.equals(other.vignette))
// return false;
// return true;
// }
}
|
UTF-8
|
Java
| 4,382 |
java
|
Produit.java
|
Java
|
[] | null |
[] |
package be.steformations.xb.labo.yaka.beans;
public class Produit {
private int id;
private String nom;
private String vignette;
private String image;
private String desc_courte;
private String desc_longue;
private int prod_stat;
private SousCategorie sousCategorie;
private java.util.List<Produit> sousProduit;
private java.util.List<Caracteristique> caracteristiques;
public java.util.List<Caracteristique> getCaracteristiques() {
return caracteristiques;
}
public void setCaracteristiques(java.util.List<Caracteristique> caracteristiques) {
this.caracteristiques = caracteristiques;
}
public int getId() {
return id;
}
public java.util.List<Produit> getSousProduit() {
return sousProduit;
}
public void setSousProduit(java.util.List<Produit> sousProduit) {
this.sousProduit = sousProduit;
}
public void setId(int id) {
this.id = id;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getVignette() {
return vignette;
}
public void setVignette(String vignette) {
this.vignette = vignette;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getDesc_courte() {
return desc_courte;
}
public void setDesc_courte(String desc_courte) {
this.desc_courte = desc_courte;
}
public String getDesc_longue() {
return desc_longue;
}
public void setDesc_longue(String desc_longue) {
this.desc_longue = desc_longue;
}
public int getProd_stat() {
return prod_stat;
}
public void setProd_stat(int prod_stat) {
this.prod_stat = prod_stat;
}
public SousCategorie getSousCategorie() {
return sousCategorie;
}
public void setSousCategorie(SousCategorie sousCategorie) {
this.sousCategorie = sousCategorie;
}
// public java.util.List<Caracteristique> getCaracteristiques() {
// return caracteristiques;
// }
// public void setCaracteristiques(java.util.List<Caracteristique> caracteristiques) {
// this.caracteristiques = caracteristiques;
// }
// @Override
// public int hashCode() {
// final int prime = 31;
// int result = 1;
// result = prime * result + ((caracteristiques == null) ? 0 : caracteristiques.hashCode());
// result = prime * result + ((desc_courte == null) ? 0 : desc_courte.hashCode());
// result = prime * result + ((desc_longue == null) ? 0 : desc_longue.hashCode());
// result = prime * result + id;
// result = prime * result + ((image == null) ? 0 : image.hashCode());
// result = prime * result + ((nom == null) ? 0 : nom.hashCode());
// result = prime * result + prod_stat;
// result = prime * result + ((sousCategorie == null) ? 0 : sousCategorie.hashCode());
// result = prime * result + ((vignette == null) ? 0 : vignette.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;
// Produit other = (Produit) obj;
// if (caracteristiques == null) {
// if (other.caracteristiques != null)
// return false;
// } else if (!caracteristiques.equals(other.caracteristiques))
// return false;
// if (desc_courte == null) {
// if (other.desc_courte != null)
// return false;
// } else if (!desc_courte.equals(other.desc_courte))
// return false;
// if (desc_longue == null) {
// if (other.desc_longue != null)
// return false;
// } else if (!desc_longue.equals(other.desc_longue))
// return false;
// if (id != other.id)
// return false;
// if (image == null) {
// if (other.image != null)
// return false;
// } else if (!image.equals(other.image))
// return false;
// if (nom == null) {
// if (other.nom != null)
// return false;
// } else if (!nom.equals(other.nom))
// return false;
// if (prod_stat != other.prod_stat)
// return false;
// if (sousCategorie == null) {
// if (other.sousCategorie != null)
// return false;
// } else if (!sousCategorie.equals(other.sousCategorie))
// return false;
// if (vignette == null) {
// if (other.vignette != null)
// return false;
// } else if (!vignette.equals(other.vignette))
// return false;
// return true;
// }
}
| 4,382 | 0.640575 | 0.638293 | 149 | 27.409395 | 20.946404 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.174497 | false | false |
14
|
5827a0f254c7e172c8f6175207c32541e1593298
| 16,277,926,055,296 |
da98adabc4a478760d1d6d77dc7dcb51de2c37c4
|
/src/main/java/io/advance/pi4led/io/advance/pi4led/controller/LedController.java
|
ceff1698ac5cdfb8b75385b96539029c2194a41e
|
[] |
no_license
|
cagecat/pi4led
|
https://github.com/cagecat/pi4led
|
50f981b8120770a91d82b5acd19488764fc27e34
|
74343d1aa456c626c37aa072feb018e0cbe369ae
|
refs/heads/master
| 2020-09-23T01:11:41.756000 | 2020-09-01T10:09:07 | 2020-09-01T10:09:07 | 66,213,566 | 0 | 0 | null | false | 2020-09-01T10:09:08 | 2016-08-21T18:14:57 | 2020-09-01T10:06:47 | 2020-09-01T10:09:08 | 20 | 0 | 0 | 0 |
Java
| false | false |
package io.advance.pi4led.io.advance.pi4led.controller;
import com.pi4j.io.gpio.*;
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent;
import com.pi4j.io.gpio.event.GpioPinListenerDigital;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.advance.pi4led.service.MqttEventPublisher;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by jgriesel on 2016/08/2
*/
@RestController
public class LedController {
final String topic = "bwclogic/power/set/";
private static GpioPinDigitalInput event;
private static GpioPinDigitalOutput pinRed;
private static GpioPinDigitalOutput pinGreen;
private static GpioPinDigitalOutput pinBlue;
//Thread gpioThread;
@RequestMapping("/")
public String greeting() {
return "Hello World!";
}
@RequestMapping("/event")
public String EventListener() {
if (event == null){
GpioController gpio = GpioFactory.getInstance();
event = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);
event.setShutdownOptions(true);
event.addListener(new GpioPinListenerDigital() {
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent gpioPinDigitalStateChangeEvent) {
Date date = new Date();
//System.out.println(dateFormat.format(date) + " GPIO PIN STATE CHANGE: " + event.getPin() + " = " + event.getState());
String payloadString = dateFormat.format(date) + event.getPin() + event.getState();
byte[] payload = payloadString.getBytes();
try {
MqttEventPublisher.publish(topic, payload);
} catch (MqttException e) {
e.printStackTrace();
}
}
});
while(true) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
return "OK";
}
@RequestMapping("/red")
public String Red() {
if (pinRed == null) {
GpioController gpio = GpioFactory.getInstance();
pinRed = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01, "MyRedLED", PinState.LOW);
}
//pinRed.toggle();
pinRed.blink(500, 15000);
return "OK";
}
@RequestMapping("/green")
public String Green() {
if (pinGreen == null) {
GpioController gpio = GpioFactory.getInstance();
pinGreen = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_02, "MyGreenLED", PinState.LOW);
}
pinGreen.toggle();
return "OK";
}
@RequestMapping("/blue")
public String Blue() {
if (pinBlue == null) {
GpioController gpio = GpioFactory.getInstance();
pinBlue = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_03, "MyBlueLED", PinState.LOW);
}
pinBlue.toggle();
return "OK";
}
}
|
UTF-8
|
Java
| 3,403 |
java
|
LedController.java
|
Java
|
[
{
"context": "eFormat;\nimport java.util.Date;\n\n/**\n * Created by jgriesel on 2016/08/2\n */\n\n@RestController\npublic class Le",
"end": 547,
"score": 0.9997450709342957,
"start": 539,
"tag": "USERNAME",
"value": "jgriesel"
}
] | null |
[] |
package io.advance.pi4led.io.advance.pi4led.controller;
import com.pi4j.io.gpio.*;
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent;
import com.pi4j.io.gpio.event.GpioPinListenerDigital;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.advance.pi4led.service.MqttEventPublisher;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by jgriesel on 2016/08/2
*/
@RestController
public class LedController {
final String topic = "bwclogic/power/set/";
private static GpioPinDigitalInput event;
private static GpioPinDigitalOutput pinRed;
private static GpioPinDigitalOutput pinGreen;
private static GpioPinDigitalOutput pinBlue;
//Thread gpioThread;
@RequestMapping("/")
public String greeting() {
return "Hello World!";
}
@RequestMapping("/event")
public String EventListener() {
if (event == null){
GpioController gpio = GpioFactory.getInstance();
event = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);
event.setShutdownOptions(true);
event.addListener(new GpioPinListenerDigital() {
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent gpioPinDigitalStateChangeEvent) {
Date date = new Date();
//System.out.println(dateFormat.format(date) + " GPIO PIN STATE CHANGE: " + event.getPin() + " = " + event.getState());
String payloadString = dateFormat.format(date) + event.getPin() + event.getState();
byte[] payload = payloadString.getBytes();
try {
MqttEventPublisher.publish(topic, payload);
} catch (MqttException e) {
e.printStackTrace();
}
}
});
while(true) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
return "OK";
}
@RequestMapping("/red")
public String Red() {
if (pinRed == null) {
GpioController gpio = GpioFactory.getInstance();
pinRed = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01, "MyRedLED", PinState.LOW);
}
//pinRed.toggle();
pinRed.blink(500, 15000);
return "OK";
}
@RequestMapping("/green")
public String Green() {
if (pinGreen == null) {
GpioController gpio = GpioFactory.getInstance();
pinGreen = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_02, "MyGreenLED", PinState.LOW);
}
pinGreen.toggle();
return "OK";
}
@RequestMapping("/blue")
public String Blue() {
if (pinBlue == null) {
GpioController gpio = GpioFactory.getInstance();
pinBlue = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_03, "MyBlueLED", PinState.LOW);
}
pinBlue.toggle();
return "OK";
}
}
| 3,403 | 0.602997 | 0.5933 | 112 | 29.375 | 29.283138 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.482143 | false | false |
14
|
e4fcafdbd1f27c9b4a8a259db1826a4535f36568
| 5,995,774,349,397 |
7b141f9b95bb898504a5050bc506b0b8ddcbd8a3
|
/src/Main.java
|
313e8a168255a8cea724fd1af976d455d799202f
|
[] |
no_license
|
OrHayat/Java_Parsing_Combinator
|
https://github.com/OrHayat/Java_Parsing_Combinator
|
8f46b3f2ada0da1a4bdcfa66310b5f205f4dfef1
|
65899e5bf7eb6c7182dbd5a974a1477b0927c57b
|
refs/heads/master
| 2022-01-13T22:22:48.454000 | 2019-07-22T18:29:27 | 2019-07-22T18:29:27 | 198,280,474 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
public class Main {
// Driver program to test above functions
public static void main(String[] args)
{
Parser c=PC.nt_char('a');
Parser b=PC.nt_char('b');
Parser ab=PC.nt_caten(c,b);
List<Character> lst=new LinkedList<>();
lst.add('a');
lst.add('a');
lst.add('a');
lst.add('a');
lst.add('a');
lst.add('a');
lst.add('a');
// ab.parse(lst);
var q =PC.nt_caten_list(new LinkedList<>());
Pair res= PC.nt_display(PC.nt_pack((x)->x,q),"test parser").parse(lst);
/*
Parser cb=PC.nt_caten(c,b);
c=PC.range_ci('A','B');
ArrayList arr = new ArrayList();
arr.add(c);
arr.add(c);
arr.add(c);
Parser t=PC.nt_caten_list(arr);
t.parse(lst);
List<Character> lst2=new LinkedList<>();
*/
//System.out.print(res.y.toString());
}
}
|
UTF-8
|
Java
| 1,011 |
java
|
Main.java
|
Java
|
[] | null |
[] |
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
public class Main {
// Driver program to test above functions
public static void main(String[] args)
{
Parser c=PC.nt_char('a');
Parser b=PC.nt_char('b');
Parser ab=PC.nt_caten(c,b);
List<Character> lst=new LinkedList<>();
lst.add('a');
lst.add('a');
lst.add('a');
lst.add('a');
lst.add('a');
lst.add('a');
lst.add('a');
// ab.parse(lst);
var q =PC.nt_caten_list(new LinkedList<>());
Pair res= PC.nt_display(PC.nt_pack((x)->x,q),"test parser").parse(lst);
/*
Parser cb=PC.nt_caten(c,b);
c=PC.range_ci('A','B');
ArrayList arr = new ArrayList();
arr.add(c);
arr.add(c);
arr.add(c);
Parser t=PC.nt_caten_list(arr);
t.parse(lst);
List<Character> lst2=new LinkedList<>();
*/
//System.out.print(res.y.toString());
}
}
| 1,011 | 0.51731 | 0.51632 | 39 | 24.897436 | 17.099699 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.820513 | false | false |
14
|
4a9fb345d209dca13f4f414261e1069a06d84d36
| 10,247,792,002,552 |
6814b136224524824087a913c2e96e8258d21315
|
/tests/MoneyEx/MoneyStaticInitializationBlockTest.java
|
1334fb4e89b39d49191a90eaac7caa8ad243949c
|
[] |
no_license
|
dzienm/PTEZadania
|
https://github.com/dzienm/PTEZadania
|
26428fafc3001953ab8156a5b0770154a710b096
|
291400c3a51aac8c0ac5ccf4ee5d3f5525571375
|
refs/heads/master
| 2021-01-11T15:53:53.607000 | 2017-01-27T23:16:15 | 2017-01-27T23:16:15 | 79,951,391 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package MoneyEx;
import org.junit.Test;
import java.math.BigDecimal;
import static org.junit.Assert.assertTrue;
/**
* Created by mdziendzikowski on 2017-01-27.
*/
public class MoneyStaticInitializationBlockTest {
@Test
public void testStaticBlockofClassInitialization_whenInitializingClass_ExchangeRatesSetDefault() {
Money m;
for (Currencies curr : Currencies.values()) {
m = new Money(new BigDecimal(1), curr);
assertTrue(new BigDecimal(1).equals(m.getExchangeRate()));
}
}
}
|
UTF-8
|
Java
| 548 |
java
|
MoneyStaticInitializationBlockTest.java
|
Java
|
[
{
"context": "ic org.junit.Assert.assertTrue;\n\n/**\n * Created by mdziendzikowski on 2017-01-27.\n */\npublic class MoneyStaticInitia",
"end": 149,
"score": 0.9990771412849426,
"start": 134,
"tag": "USERNAME",
"value": "mdziendzikowski"
}
] | null |
[] |
package MoneyEx;
import org.junit.Test;
import java.math.BigDecimal;
import static org.junit.Assert.assertTrue;
/**
* Created by mdziendzikowski on 2017-01-27.
*/
public class MoneyStaticInitializationBlockTest {
@Test
public void testStaticBlockofClassInitialization_whenInitializingClass_ExchangeRatesSetDefault() {
Money m;
for (Currencies curr : Currencies.values()) {
m = new Money(new BigDecimal(1), curr);
assertTrue(new BigDecimal(1).equals(m.getExchangeRate()));
}
}
}
| 548 | 0.687956 | 0.669708 | 25 | 20.92 | 26.728142 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.32 | false | false |
14
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.