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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
59da80608d518115a54eb61b45566a93ea4c96a4
| 3,015,067,101,900 |
5ec516592d32ec54232983c14815e6be149ae601
|
/spring/src/cn/day3/springjdbc/_02daoSupport/DaoImpl1.java
|
20524051d684b1cf5527bb82091137a6a35cc306
|
[] |
no_license
|
ZhaoShuyin/JavaWeb
|
https://github.com/ZhaoShuyin/JavaWeb
|
aabf606e876d75b6919efa96116157318345bbb5
|
cb3c92577d296f905d440004735adc20117d7aea
|
refs/heads/master
| 2022-06-30T03:27:37.734000 | 2021-11-08T08:55:36 | 2021-11-08T08:55:36 | 230,417,290 | 0 | 0 | null | false | 2022-06-21T04:21:12 | 2019-12-27T09:49:45 | 2021-11-08T08:57:19 | 2022-06-21T04:21:11 | 139,564 | 0 | 0 | 1 |
Java
| false | false |
package cn.day3.springjdbc._02daoSupport;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* <!-- Impl1 成员变量jdbcTemplate 使用jdbcT -->
* <bean id="Impl1" class="cn.day3.springjdbc._02daoSupport.DaoImpl1">
* <property name="jdbcTemplate" ref="jdbcT"></property>
* </bean>
*/
public class DaoImpl1 {
//
private JdbcTemplate jdbcTemplate;
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
System.out.println("setJdbcTemplate");
}
public void insert() {
System.out.println("insert >> " + jdbcTemplate);
jdbcTemplate.execute("insert into accounts (name,amount) values ('hhh',1000)");
}
}
|
UTF-8
|
Java
| 705 |
java
|
DaoImpl1.java
|
Java
|
[] | null |
[] |
package cn.day3.springjdbc._02daoSupport;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* <!-- Impl1 成员变量jdbcTemplate 使用jdbcT -->
* <bean id="Impl1" class="cn.day3.springjdbc._02daoSupport.DaoImpl1">
* <property name="jdbcTemplate" ref="jdbcT"></property>
* </bean>
*/
public class DaoImpl1 {
//
private JdbcTemplate jdbcTemplate;
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
System.out.println("setJdbcTemplate");
}
public void insert() {
System.out.println("insert >> " + jdbcTemplate);
jdbcTemplate.execute("insert into accounts (name,amount) values ('hhh',1000)");
}
}
| 705 | 0.679654 | 0.659452 | 24 | 27.875 | 26.051731 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
0
|
5860a7427f10c8802a58a93faee1e547b77a57b2
| 19,335,942,815,481 |
fc413697e8c2163ffd6d251caa9b8a0cc5d2ed1c
|
/OpenCashRegister/src/tests/StandardTest.java
|
66f68c7e8831682c5bd97dd7b6034b0fa00901e1
|
[] |
no_license
|
Futureflo/CashRegister
|
https://github.com/Futureflo/CashRegister
|
32d9127bbdca71a90bf4cb8b0f7922e9ac0c0d03
|
5e88229d03296f88aadf4c2e98f767d193e7b6c7
|
refs/heads/master
| 2020-01-23T22:06:49.316000 | 2017-04-29T08:41:31 | 2017-04-29T08:41:31 | 74,610,029 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package tests;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
@RunWith(JavaFXJunit4ClassRunner.class)
@ContextConfiguration(locations = { "/testConfiguration.xml" })
public class StandardTest {
@Before
public void setUp() throws Exception {
}
@Test
public void test() {
}
}
|
UTF-8
|
Java
| 403 |
java
|
StandardTest.java
|
Java
|
[] | null |
[] |
package tests;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
@RunWith(JavaFXJunit4ClassRunner.class)
@ContextConfiguration(locations = { "/testConfiguration.xml" })
public class StandardTest {
@Before
public void setUp() throws Exception {
}
@Test
public void test() {
}
}
| 403 | 0.727047 | 0.724566 | 21 | 17.190475 | 19.621706 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52381 | false | false |
0
|
5c01a6c258676bf5b537564f8aa5e351bca24031
| 26,362,509,311,584 |
114ac4f1eed2b2e9e14c74dddb9657addc6a202b
|
/src/review/controller/InterviewController.java
|
a715f26bb6d13c3302e19a0c341417825c2fd42f
|
[] |
no_license
|
teamjobs/MainProject
|
https://github.com/teamjobs/MainProject
|
cfcd28be55573f834b71b487abe39d52daf56058
|
b36644cb3fc99f27cd7036a1bdea75ceaef03b85
|
refs/heads/master
| 2021-01-21T11:49:06.033000 | 2016-12-31T07:43:45 | 2016-12-31T07:43:45 | 73,680,145 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package review.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import review.model.InterviewData;
import review.service.InterviewService;
@Controller
public class InterviewController {
// @Autowired
// InterviewService is;
//
// @RequestMapping("/review/interview")
// public String InterView(){
//
// return "/review/InterviewView.jsp";
// }
//
// @RequestMapping("/review/interviewchart")
// public ModelAndView InterViewCon(@RequestParam String company){
//
//
// System.out.println("컨트롤러"+company);
//
// HashMap interLvmap = is.InterviewLevel(company);
// List aplist = is.InterAppraisal(company);
//
// List passlist = is.InterPass(company);
//
// System.out.println("레벨"+interLvmap);
// System.out.println("전체"+aplist);
// System.out.println("컨트 pass"+passlist);
//
// ModelAndView mav = new ModelAndView("/review/InterviewView.jsp");
// mav.addObject("interLvmap",interLvmap);
// mav.addObject("aplist",aplist);
// mav.addObject("passlist",passlist);
//
// return mav;
// }
}
|
UHC
|
Java
| 1,462 |
java
|
InterviewController.java
|
Java
|
[] | null |
[] |
package review.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import review.model.InterviewData;
import review.service.InterviewService;
@Controller
public class InterviewController {
// @Autowired
// InterviewService is;
//
// @RequestMapping("/review/interview")
// public String InterView(){
//
// return "/review/InterviewView.jsp";
// }
//
// @RequestMapping("/review/interviewchart")
// public ModelAndView InterViewCon(@RequestParam String company){
//
//
// System.out.println("컨트롤러"+company);
//
// HashMap interLvmap = is.InterviewLevel(company);
// List aplist = is.InterAppraisal(company);
//
// List passlist = is.InterPass(company);
//
// System.out.println("레벨"+interLvmap);
// System.out.println("전체"+aplist);
// System.out.println("컨트 pass"+passlist);
//
// ModelAndView mav = new ModelAndView("/review/InterviewView.jsp");
// mav.addObject("interLvmap",interLvmap);
// mav.addObject("aplist",aplist);
// mav.addObject("passlist",passlist);
//
// return mav;
// }
}
| 1,462 | 0.712899 | 0.712899 | 52 | 25.73077 | 21.281191 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.519231 | false | false |
0
|
09283ffdd50a7b0d0f2d1170b5b8277d7d226f79
| 25,245,817,803,725 |
417b7c42bbb0febeb9a32a95fb8da7516ba52900
|
/app/src/main/java/com/eloypastor/weatherfinder/root/ApplicationComponent.java
|
d77a00473ac9c079017f2d3734053c99f20ca262
|
[] |
no_license
|
eloytomasnuin/WeatherFinder
|
https://github.com/eloytomasnuin/WeatherFinder
|
9047460dbc97fcc4857ef1bb9823444e5abd9d4e
|
ce203544a8f59bcadbea226bc3996485980c2b2f
|
refs/heads/master
| 2020-02-07T20:41:52.059000 | 2017-08-07T14:21:53 | 2017-08-07T14:21:53 | 99,325,936 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.eloypastor.weatherfinder.root;
import com.eloypastor.weatherfinder.MainActivity;
import com.eloypastor.weatherfinder.apimodel.ApiModule;
import javax.inject.Singleton;
import dagger.Component;
@Singleton
@Component(modules = {ApplicationModule.class, ApiModule.class})
public interface ApplicationComponent {
void inject(MainActivity target);
}
|
UTF-8
|
Java
| 368 |
java
|
ApplicationComponent.java
|
Java
|
[] | null |
[] |
package com.eloypastor.weatherfinder.root;
import com.eloypastor.weatherfinder.MainActivity;
import com.eloypastor.weatherfinder.apimodel.ApiModule;
import javax.inject.Singleton;
import dagger.Component;
@Singleton
@Component(modules = {ApplicationModule.class, ApiModule.class})
public interface ApplicationComponent {
void inject(MainActivity target);
}
| 368 | 0.817935 | 0.817935 | 17 | 20.647058 | 22.368416 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false |
0
|
de19fa75968ab951e65861fa587c40487a0a6ae0
| 4,629,974,809,357 |
71f8651021bd940e3c3c26dd506fb1df7c8384e2
|
/computer-database-persistence/src/main/java/com/excilys/computerdatabase/persistence/custom/ComputerDaoCustom.java
|
5350d9e58fd5a41bd6d80c9a4f0c5b9105b8199b
|
[] |
no_license
|
paulomatias/computer-database
|
https://github.com/paulomatias/computer-database
|
16d983b6a79f1860c4e4921c0885174a28252ea5
|
185a11539a012512ad8bbd5e2f8599f009887bd4
|
refs/heads/master
| 2020-04-07T12:22:11.331000 | 2014-01-21T09:30:36 | 2014-01-24T15:10:22 | 25,578,758 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.excilys.computerdatabase.persistence.custom;
import java.util.List;
/**
* Project: computer-database
* Package: com.excilys.computerdatabase.persistence.custom
* Computer: lortola
* Date: 21/01/14
* Description: N/A
*/
public interface ComputerDaoCustom {
public void deleteList(List<Long> ids);
}
|
UTF-8
|
Java
| 322 |
java
|
ComputerDaoCustom.java
|
Java
|
[] | null |
[] |
package com.excilys.computerdatabase.persistence.custom;
import java.util.List;
/**
* Project: computer-database
* Package: com.excilys.computerdatabase.persistence.custom
* Computer: lortola
* Date: 21/01/14
* Description: N/A
*/
public interface ComputerDaoCustom {
public void deleteList(List<Long> ids);
}
| 322 | 0.751553 | 0.732919 | 14 | 22 | 19.603207 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.214286 | false | false |
0
|
1fe9a89cf04116c68a1b4dde169554a88948a8fb
| 10,007,273,838,882 |
dfa1bb1bd7ef84f9e225d51761c4fc2470b51112
|
/BinaryTree/BFSLevelOrderTraversal.java
|
f82e234ffbe9f65d6c4f967557cc14b713b83a66
|
[] |
no_license
|
gowriaddepalli/Leetcode_solutions
|
https://github.com/gowriaddepalli/Leetcode_solutions
|
f31d9716a3690dcdbc0e7e4eaf9773b8bd8f7453
|
1f33cbeb52f9ec6332d05bbd3da69935ba553cf8
|
refs/heads/master
| 2023-04-05T11:34:42.736000 | 2021-04-16T07:33:02 | 2021-04-16T07:33:02 | 158,172,755 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public List<List<Integer>> levelOrder(TreeNode root) {
List<List<Integer>> al = new ArrayList<List<Integer>>();
ArrayList<Integer> ad = new ArrayList<Integer>();
Queue<TreeNode> qu = new LinkedList<TreeNode>();
if(root !=null)
{
qu.add(root);
}
while(!qu.isEmpty())
{
int size = qu.size();
//System.out.println(size);
// Iterate for the number of children per level and then add to the list.
for(int i=0; i<size;i++)
{
TreeNode t = qu.peek();
ad.add(t.val);
List<TreeNode> qchild = getChildren(t);
if(qchild !=null)
{
for(TreeNode u: qchild)
{
if(u != null)
{
qu.add(u);
}
}
}
qu.poll();
}
//System.out.println(ad.size());
al.add(ad);
ad = new ArrayList<Integer>();
}
return al;
}
public List<TreeNode> getChildren(TreeNode root) {
List<TreeNode> alchild1 = new ArrayList<TreeNode>();
if(root.left == null && root.right == null){
return null;
}
if(root.left != null)
{
alchild1.add(root.left);
}
if(root.right != null)
{
alchild1.add(root.right);
}
return alchild1;
}
}
|
UTF-8
|
Java
| 1,810 |
java
|
BFSLevelOrderTraversal.java
|
Java
|
[] | null |
[] |
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
class Solution {
public List<List<Integer>> levelOrder(TreeNode root) {
List<List<Integer>> al = new ArrayList<List<Integer>>();
ArrayList<Integer> ad = new ArrayList<Integer>();
Queue<TreeNode> qu = new LinkedList<TreeNode>();
if(root !=null)
{
qu.add(root);
}
while(!qu.isEmpty())
{
int size = qu.size();
//System.out.println(size);
// Iterate for the number of children per level and then add to the list.
for(int i=0; i<size;i++)
{
TreeNode t = qu.peek();
ad.add(t.val);
List<TreeNode> qchild = getChildren(t);
if(qchild !=null)
{
for(TreeNode u: qchild)
{
if(u != null)
{
qu.add(u);
}
}
}
qu.poll();
}
//System.out.println(ad.size());
al.add(ad);
ad = new ArrayList<Integer>();
}
return al;
}
public List<TreeNode> getChildren(TreeNode root) {
List<TreeNode> alchild1 = new ArrayList<TreeNode>();
if(root.left == null && root.right == null){
return null;
}
if(root.left != null)
{
alchild1.add(root.left);
}
if(root.right != null)
{
alchild1.add(root.right);
}
return alchild1;
}
}
| 1,810 | 0.41989 | 0.417127 | 75 | 23.133333 | 17.701475 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.346667 | false | false |
0
|
a4d7f0c612c64a95540211f37e896b4bfb9b7caa
| 23,725,399,386,835 |
5f2343da929bf1c10eec85c8b0ce72d7fc4c5aa7
|
/src/reusing/Test.java
|
adfd3cd182e52885631db81d000d1847c2c46873
|
[] |
no_license
|
1282778942/TIJ-4
|
https://github.com/1282778942/TIJ-4
|
b5114c797deff74b65f3f3f137fdf134f50c2cb5
|
c682fcaf793277342e2c9770e8eb33770991c063
|
refs/heads/master
| 2020-07-06T21:24:02.234000 | 2019-08-19T09:32:41 | 2019-08-19T09:32:41 | 203,142,097 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package reusing;
class A{
A(){
System.out.println("构造器A");
}
}
class B{
B(){
System.out.println("构造器B");
}
}
class C extends A{
B b = new B();
}
public class Test {
public static void main(String[] args) {
C c = new C();
System.out.println("创建C类对象");
}
}
|
GB18030
|
Java
| 295 |
java
|
Test.java
|
Java
|
[] | null |
[] |
package reusing;
class A{
A(){
System.out.println("构造器A");
}
}
class B{
B(){
System.out.println("构造器B");
}
}
class C extends A{
B b = new B();
}
public class Test {
public static void main(String[] args) {
C c = new C();
System.out.println("创建C类对象");
}
}
| 295 | 0.589744 | 0.589744 | 22 | 11.409091 | 11.888341 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.954545 | false | false |
0
|
9bddcb6c6fc85004878b5c54c88c1340acbbcb9b
| 4,561,255,335,958 |
5082c992fdbcc119c567a6e7ae93e570d3ae7b9b
|
/src/main/java/ro/mfl/dao/impl/PageDao.java
|
67c170a7c71955924c987257d0f7652075c16248
|
[] |
no_license
|
mateifl/mjblog
|
https://github.com/mateifl/mjblog
|
2c7678b27f5e90ad6578153f9d1992fef377025b
|
b1c56d47431ac257d66aca398492619862d6adae
|
refs/heads/master
| 2016-08-06T21:28:15.715000 | 2015-01-20T15:46:32 | 2015-01-20T15:46:32 | 29,528,777 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ro.mfl.dao.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import ro.mfl.beans.Page;
import ro.mfl.beans.PageLoadCriteria;
import ro.mfl.beans.PageTemplate;
import ro.mfl.beans.Tag;
import ro.mfl.dao.IPageDAO;
import ro.mfl.dao.IUserDAO;
public class PageDao extends AbstractDao<Page> implements IPageDAO {
@Autowired
private IUserDAO userDao;
public Page load(Long _id) {
Page bean = getTemplate().load(Page.class, _id);
return bean;
}
public List<Page> list() {
@SuppressWarnings("unchecked")
List<Page> pages = getTemplate().find("from Page order by ordering");
return pages;
}
public List<PageTemplate> listTemplates()
{
List<PageTemplate> templates = getTemplate().loadAll(PageTemplate.class);
return templates;
}
public Map<String, PageLoadCriteria> loadCriteria()
{
List<PageLoadCriteria> loadCriterias = getTemplate().loadAll(PageLoadCriteria.class);
if(logger.isDebugEnabled()) logger.debug("Criteria loaded: " + loadCriterias.size());
Map<String, PageLoadCriteria> criteriaMap = new HashMap<String, PageLoadCriteria>();
for( PageLoadCriteria p : loadCriterias )
criteriaMap.put(p.getCriteria(), p);
return criteriaMap;
}
public List<Tag> listByValue(String autocompleteTerm, Boolean withWildCards) {
if(logger.isDebugEnabled()) logger.debug("Loading tags ... ");
if( withWildCards )
autocompleteTerm = autocompleteTerm + "%";
String hql = " from Tag where value = ? ";
@SuppressWarnings("unchecked")
List<Tag> tags = getTemplate().find( hql, autocompleteTerm );
return tags;
}
@Transactional
public void createPageLoadCriteria() {
PageLoadCriteria pageCriteria = new PageLoadCriteria();
pageCriteria.setCriteria(PageLoadCriteria.ALL);
pageCriteria.setDescription("All Posts");
getTemplate().saveOrUpdate(pageCriteria);
pageCriteria = new PageLoadCriteria();
pageCriteria.setCriteria(PageLoadCriteria.BY_USER);
pageCriteria.setDescription("Posts by user");
getTemplate().saveOrUpdate(pageCriteria);
pageCriteria = new PageLoadCriteria();
pageCriteria.setCriteria(PageLoadCriteria.BY_TAG);
pageCriteria.setDescription("Posts by tag");
getTemplate().saveOrUpdate(pageCriteria);
pageCriteria = new PageLoadCriteria();
pageCriteria.setCriteria(PageLoadCriteria.BY_CATEGORY);
pageCriteria.setDescription("Posts by category");
getTemplate().saveOrUpdate(pageCriteria);
}
private static final Logger logger = LoggerFactory.getLogger(PageDao.class);
}
|
UTF-8
|
Java
| 2,689 |
java
|
PageDao.java
|
Java
|
[] | null |
[] |
package ro.mfl.dao.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import ro.mfl.beans.Page;
import ro.mfl.beans.PageLoadCriteria;
import ro.mfl.beans.PageTemplate;
import ro.mfl.beans.Tag;
import ro.mfl.dao.IPageDAO;
import ro.mfl.dao.IUserDAO;
public class PageDao extends AbstractDao<Page> implements IPageDAO {
@Autowired
private IUserDAO userDao;
public Page load(Long _id) {
Page bean = getTemplate().load(Page.class, _id);
return bean;
}
public List<Page> list() {
@SuppressWarnings("unchecked")
List<Page> pages = getTemplate().find("from Page order by ordering");
return pages;
}
public List<PageTemplate> listTemplates()
{
List<PageTemplate> templates = getTemplate().loadAll(PageTemplate.class);
return templates;
}
public Map<String, PageLoadCriteria> loadCriteria()
{
List<PageLoadCriteria> loadCriterias = getTemplate().loadAll(PageLoadCriteria.class);
if(logger.isDebugEnabled()) logger.debug("Criteria loaded: " + loadCriterias.size());
Map<String, PageLoadCriteria> criteriaMap = new HashMap<String, PageLoadCriteria>();
for( PageLoadCriteria p : loadCriterias )
criteriaMap.put(p.getCriteria(), p);
return criteriaMap;
}
public List<Tag> listByValue(String autocompleteTerm, Boolean withWildCards) {
if(logger.isDebugEnabled()) logger.debug("Loading tags ... ");
if( withWildCards )
autocompleteTerm = autocompleteTerm + "%";
String hql = " from Tag where value = ? ";
@SuppressWarnings("unchecked")
List<Tag> tags = getTemplate().find( hql, autocompleteTerm );
return tags;
}
@Transactional
public void createPageLoadCriteria() {
PageLoadCriteria pageCriteria = new PageLoadCriteria();
pageCriteria.setCriteria(PageLoadCriteria.ALL);
pageCriteria.setDescription("All Posts");
getTemplate().saveOrUpdate(pageCriteria);
pageCriteria = new PageLoadCriteria();
pageCriteria.setCriteria(PageLoadCriteria.BY_USER);
pageCriteria.setDescription("Posts by user");
getTemplate().saveOrUpdate(pageCriteria);
pageCriteria = new PageLoadCriteria();
pageCriteria.setCriteria(PageLoadCriteria.BY_TAG);
pageCriteria.setDescription("Posts by tag");
getTemplate().saveOrUpdate(pageCriteria);
pageCriteria = new PageLoadCriteria();
pageCriteria.setCriteria(PageLoadCriteria.BY_CATEGORY);
pageCriteria.setDescription("Posts by category");
getTemplate().saveOrUpdate(pageCriteria);
}
private static final Logger logger = LoggerFactory.getLogger(PageDao.class);
}
| 2,689 | 0.762365 | 0.761621 | 87 | 29.908047 | 25.074892 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.747126 | false | false |
0
|
d9f42b37301eb084fc0f74bedc11c105a714650c
| 9,191,230,072,953 |
5dc4425b9d8889ec23d6091c99e25d09907fd95f
|
/ITFEService/src/com/cfcc/itfe/service/dataquery/taxfreesearch/TaxFreeSearchService.java
|
fd652fa538239ff52c9c0a250a00331405fb1faf
|
[] |
no_license
|
caoyanguo/ITFE
|
https://github.com/caoyanguo/ITFE
|
64632fb70fd0808fe89bc7a6d244aeed69fe75a2
|
61f7b12abf0abdd707484ed01b1a9f9e5afb0d12
|
refs/heads/master
| 2021-01-07T21:08:51.634000 | 2020-02-20T08:30:24 | 2020-02-20T08:30:24 | 241,816,007 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cfcc.itfe.service.dataquery.taxfreesearch;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.cfcc.itfe.config.ITFECommonConstant;
import com.cfcc.itfe.exception.ITFEBizException;
import com.cfcc.itfe.facade.DatabaseFacade;
import com.cfcc.itfe.util.CommonUtil;
import com.cfcc.jaf.persistence.dao.exception.JAFDatabaseException;
/**
* @author db2admin
* @time 13-02-21 11:27:13
* codecomment:
*/
public class TaxFreeSearchService extends AbstractTaxFreeSearchService {
private static Log log = LogFactory.getLog(TaxFreeSearchService.class);
public void updateFail(List dtoInfos) throws ITFEBizException {
if(ITFECommonConstant.IFNEWINTERFACE.equals("1")){
throw new ITFEBizException("新版TIPS接口自动更新此状态,不可以手动更新!");
}
try {
DatabaseFacade.getDb().update(CommonUtil.listTArray(dtoInfos));
} catch (JAFDatabaseException e1) {
log.error(e1);
throw new ITFEBizException("批量更新数据失败", e1);
}
}
public void updateSuccess(List dtoInfos) throws ITFEBizException {
if(ITFECommonConstant.IFNEWINTERFACE.equals("1")){
throw new ITFEBizException("新版TIPS接口自动更新此状态,不可以手动更新!");
}
try {
DatabaseFacade.getDb().update(CommonUtil.listTArray(dtoInfos));
} catch (JAFDatabaseException e1) {
log.error(e1);
throw new ITFEBizException("批量更新数据失败", e1);
}
}
}
|
GB18030
|
Java
| 1,512 |
java
|
TaxFreeSearchService.java
|
Java
|
[
{
"context": "dao.exception.JAFDatabaseException;\n/**\n * @author db2admin\n * @time 13-02-21 11:27:13\n * codecomment: \n */",
"end": 436,
"score": 0.999578058719635,
"start": 428,
"tag": "USERNAME",
"value": "db2admin"
}
] | null |
[] |
package com.cfcc.itfe.service.dataquery.taxfreesearch;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.cfcc.itfe.config.ITFECommonConstant;
import com.cfcc.itfe.exception.ITFEBizException;
import com.cfcc.itfe.facade.DatabaseFacade;
import com.cfcc.itfe.util.CommonUtil;
import com.cfcc.jaf.persistence.dao.exception.JAFDatabaseException;
/**
* @author db2admin
* @time 13-02-21 11:27:13
* codecomment:
*/
public class TaxFreeSearchService extends AbstractTaxFreeSearchService {
private static Log log = LogFactory.getLog(TaxFreeSearchService.class);
public void updateFail(List dtoInfos) throws ITFEBizException {
if(ITFECommonConstant.IFNEWINTERFACE.equals("1")){
throw new ITFEBizException("新版TIPS接口自动更新此状态,不可以手动更新!");
}
try {
DatabaseFacade.getDb().update(CommonUtil.listTArray(dtoInfos));
} catch (JAFDatabaseException e1) {
log.error(e1);
throw new ITFEBizException("批量更新数据失败", e1);
}
}
public void updateSuccess(List dtoInfos) throws ITFEBizException {
if(ITFECommonConstant.IFNEWINTERFACE.equals("1")){
throw new ITFEBizException("新版TIPS接口自动更新此状态,不可以手动更新!");
}
try {
DatabaseFacade.getDb().update(CommonUtil.listTArray(dtoInfos));
} catch (JAFDatabaseException e1) {
log.error(e1);
throw new ITFEBizException("批量更新数据失败", e1);
}
}
}
| 1,512 | 0.751429 | 0.736429 | 50 | 27.02 | 25.421637 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.44 | false | false |
0
|
fce4321721f9f7347c406c831e1c12fcd766b2a5
| 23,819,888,677,340 |
82f19e74b5cabe1c80f8c76beba94096e8d2d104
|
/src/main/java/org/me/ws/PatientResource.java
|
c5c0f098f402e34c3c10bdf3f4bdd864964cb0b2
|
[] |
no_license
|
valtercwb/PI4WebService
|
https://github.com/valtercwb/PI4WebService
|
35daa7b9fa15b045a75f32ecf7aa983ce69d0b31
|
9027dfb45c5c952131d5bd0f68995ef079b6307b
|
refs/heads/master
| 2021-08-16T15:37:09.037000 | 2017-11-20T03:22:58 | 2017-11-20T03:22:58 | 104,212,041 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.me.ws;
import java.io.File;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.activation.MimetypesFileTypeMap;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.me.pi4.model.Patient;
import org.me.pi4.modeldao.PatientDAO;
/**
* @author valter.franco
*/
@Path("patient")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class PatientResource{
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Patient> GetAllPatients() throws SQLException {
ArrayList<Patient> list = PatientDAO.GetAllPatients();
return list;
}
@GET
@Path("/{patientId}")
public Patient GetPatient(@PathParam("patientId") int patientId) throws SQLException {
Patient p = PatientDAO.GetPatient(patientId);
return p;
}
@GET
@Path("/images/{image}")
public Response getImage(@PathParam("image") String image) {
File f = new File(image);
if (!f.exists()) {
throw new WebApplicationException(404);
}
String mt = new MimetypesFileTypeMap().getContentType(f);
return Response.ok(f, mt).build();
}
}
|
UTF-8
|
Java
| 1,466 |
java
|
PatientResource.java
|
Java
|
[
{
"context": "org.me.pi4.modeldao.PatientDAO;\r\n\r\n/**\r\n * @author valter.franco\r\n */\r\n\r\n@Path(\"patient\")\r\n@Produces(MediaType.APP",
"end": 538,
"score": 0.999131977558136,
"start": 525,
"tag": "NAME",
"value": "valter.franco"
}
] | null |
[] |
package org.me.ws;
import java.io.File;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.activation.MimetypesFileTypeMap;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.me.pi4.model.Patient;
import org.me.pi4.modeldao.PatientDAO;
/**
* @author valter.franco
*/
@Path("patient")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class PatientResource{
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Patient> GetAllPatients() throws SQLException {
ArrayList<Patient> list = PatientDAO.GetAllPatients();
return list;
}
@GET
@Path("/{patientId}")
public Patient GetPatient(@PathParam("patientId") int patientId) throws SQLException {
Patient p = PatientDAO.GetPatient(patientId);
return p;
}
@GET
@Path("/images/{image}")
public Response getImage(@PathParam("image") String image) {
File f = new File(image);
if (!f.exists()) {
throw new WebApplicationException(404);
}
String mt = new MimetypesFileTypeMap().getContentType(f);
return Response.ok(f, mt).build();
}
}
| 1,466 | 0.667121 | 0.663711 | 56 | 24.178572 | 19.681488 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.446429 | false | false |
0
|
574788ce0f41091e45543baacee0fb464fce9bfa
| 11,287,174,056,523 |
e15a90d678dcb0263ca9fd923cc876b7f34de59c
|
/basicKnowledge/src/main/java/com/gavin/socket/chat/ServerThread.java
|
d7d77921dd84e0e257699792733f12cd1ebd2f23
|
[] |
no_license
|
Gavin213917/javaBasicLearning
|
https://github.com/Gavin213917/javaBasicLearning
|
b9aef7360384a7f46a3da368db4ba6aa7cbef370
|
9bec5d6b46c892d865f1a9e2a4bf7141c5ac3677
|
refs/heads/master
| 2023-03-18T12:45:13.239000 | 2021-03-11T06:07:02 | 2021-03-11T06:07:02 | 315,174,596 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gavin.socket.chat;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;
public class ServerThread implements Runnable {
//定义当前线程所处理的Socket
Socket s=null;
//获取输入流
BufferedReader br = null;
public ServerThread(Socket socket) throws IOException {
this.s = socket;
//初始化输入流
br = new BufferedReader(new InputStreamReader(s.getInputStream()));
}
@Override
public void run() {
String content = null;
try {
while((content=readFormSocket())!=null){
//遍历socketlist中的每一个socket发送的请求信息
for (Socket socket : MyServer.scoketList) {
PrintStream pStream = new PrintStream(socket.getOutputStream());
pStream.println("客户端推送来的数据是:"+content);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
private String readFormSocket(){
try {
return br.readLine();
} catch (Exception e) {
MyServer.scoketList.remove(s);
return null;
}
}
}
|
UTF-8
|
Java
| 1,092 |
java
|
ServerThread.java
|
Java
|
[] | null |
[] |
package com.gavin.socket.chat;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;
public class ServerThread implements Runnable {
//定义当前线程所处理的Socket
Socket s=null;
//获取输入流
BufferedReader br = null;
public ServerThread(Socket socket) throws IOException {
this.s = socket;
//初始化输入流
br = new BufferedReader(new InputStreamReader(s.getInputStream()));
}
@Override
public void run() {
String content = null;
try {
while((content=readFormSocket())!=null){
//遍历socketlist中的每一个socket发送的请求信息
for (Socket socket : MyServer.scoketList) {
PrintStream pStream = new PrintStream(socket.getOutputStream());
pStream.println("客户端推送来的数据是:"+content);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
private String readFormSocket(){
try {
return br.readLine();
} catch (Exception e) {
MyServer.scoketList.remove(s);
return null;
}
}
}
| 1,092 | 0.703 | 0.703 | 48 | 19.833334 | 18.266926 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.9375 | false | false |
0
|
227fa516e6b3e10e826aeb03590dff872732094d
| 29,935,922,062,020 |
f704813188d21e9a7b441b2abe920e940c5c52b6
|
/NestedLoops/NestedWhileLoop.java
|
badabdf9048edd27cbdcd73a33dd80a7ec1cf11f
|
[
"MIT"
] |
permissive
|
DeirdreHegarty/Java_Fun
|
https://github.com/DeirdreHegarty/Java_Fun
|
0d0f58756ebc4afe1363b64d883d623da0c2b8fd
|
ee22c4754048a3953e041c5b069c77877f7396c7
|
refs/heads/master
| 2021-01-19T05:06:53.647000 | 2017-09-08T12:15:18 | 2017-09-08T12:15:18 | 63,588,616 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class NestedWhileLoop{
public static void main (String [] args){
int x = 0;
int y = 1;
while(y <= 5){
x = y;
while(x > 0){
System.out.print("#");
x--;
}
y++;
System.out.println();
}
}
}
|
UTF-8
|
Java
| 225 |
java
|
NestedWhileLoop.java
|
Java
|
[] | null |
[] |
public class NestedWhileLoop{
public static void main (String [] args){
int x = 0;
int y = 1;
while(y <= 5){
x = y;
while(x > 0){
System.out.print("#");
x--;
}
y++;
System.out.println();
}
}
}
| 225 | 0.506667 | 0.488889 | 15 | 14.066667 | 11.292869 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.666667 | false | false |
0
|
2e24a5d55af7de60f63e9947750cded85718098d
| 4,784,593,625,488 |
258de8e8d556901959831bbdc3878af2d8933997
|
/utopia-service/utopia-ai/utopia-ai-impl/src/main/java/com/voxlearning/utopia/service/ai/impl/service/listener/ChipsGraduationCertificateHandleQueueListener.java
|
dde5eb9569129055229d9482524079b9e1f5e376
|
[] |
no_license
|
Explorer1092/vox
|
https://github.com/Explorer1092/vox
|
d40168b44ccd523748647742ec376fdc2b22160f
|
701160b0417e5a3f1b942269b0e7e2fd768f4b8e
|
refs/heads/master
| 2020-05-14T20:13:02.531000 | 2019-04-17T06:54:06 | 2019-04-17T06:54:06 | 181,923,482 | 0 | 4 | null | true | 2019-04-17T15:53:25 | 2019-04-17T15:53:25 | 2019-04-17T07:16:30 | 2019-04-17T07:15:25 | 290,613 | 0 | 0 | 0 | null | false | false |
package com.voxlearning.utopia.service.ai.impl.service.listener;
import com.voxlearning.alps.calendar.DateUtils;
import com.voxlearning.alps.core.util.CollectionUtils;
import com.voxlearning.alps.core.util.MapUtils;
import com.voxlearning.alps.core.util.StringUtils;
import com.voxlearning.alps.lang.convert.SafeConverter;
import com.voxlearning.alps.lang.mapper.json.JsonUtils;
import com.voxlearning.alps.logger.LoggerFactory;
import com.voxlearning.alps.spi.queue.*;
import com.voxlearning.utopia.service.ai.entity.AIUserUnitResultHistory;
import com.voxlearning.utopia.service.ai.entity.ChipsEnglishPageContentConfig;
import com.voxlearning.utopia.service.ai.impl.persistence.AIUserUnitResultHistoryDao;
import com.voxlearning.utopia.service.ai.impl.service.AiChipsEnglishConfigServiceImpl;
import com.voxlearning.utopia.service.ai.impl.support.WechatConfig;
import com.voxlearning.utopia.service.ai.internal.ChipsUserService;
import com.voxlearning.utopia.service.ai.util.OrderProductUtil;
import com.voxlearning.utopia.service.order.api.entity.OrderProduct;
import com.voxlearning.utopia.service.order.api.entity.OrderProductItem;
import com.voxlearning.utopia.service.order.consumer.UserOrderLoaderClient;
import com.voxlearning.utopia.service.user.api.entities.User;
import com.voxlearning.utopia.service.user.api.entities.UserProfile;
import com.voxlearning.utopia.service.user.consumer.UserLoaderClient;
import com.voxlearning.utopia.service.wechat.api.constants.WechatTemplateMessageType;
import com.voxlearning.utopia.service.wechat.api.data.WechatTemplateData;
import com.voxlearning.utopia.service.wechat.client.WechatServiceClient;
import org.slf4j.Logger;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.*;
import java.util.stream.Collectors;
import static com.voxlearning.alps.calendar.DateUtils.FORMAT_SQL_DATE;
/**
* 毕业证
*/
@Named
@QueueConsumer(
destinations = {
@QueueDestination(system = QueueSystem.KFK, config = "primary", queue = "utopia.chips.course.end.certificate.queue"),
@QueueDestination(system = QueueSystem.KFK, config = "main-backup", queue = "utopia.chips.course.end.certificate.queue")
},
maxPermits = 4
)
public class ChipsGraduationCertificateHandleQueueListener implements MessageListener {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Inject
private WechatServiceClient wechatServiceClient;
@Inject
private UserOrderLoaderClient userOrderLoaderClient;
@Inject
private AIUserUnitResultHistoryDao aiUserUnitResultHistoryDao;
@Inject
private UserLoaderClient userLoaderClient;
@Inject
private AiChipsEnglishConfigServiceImpl aiChipsEnglishConfigService;
@Inject
private ChipsUserService chipsUserService;
private static final String SEND_RULE_PREFIX = "chips_send_rule_graduation_certificate";
@Override
public void onMessage(Message message) {
if (message == null) {
logger.error("course begin notify handle share queue no message");
return;
}
Object body = message.decodeBody();
if (body != null && body instanceof String) {
String json = (String) body;
Map<String, Object> param = JsonUtils.fromJson(json);
if (param == null) {
logger.error("AIUserShareVideoHandleQueueListener error. message:{}", body);
return;
}
long userId = SafeConverter.toLong(param.get("U"));
String productId = SafeConverter.toString(param.get("P"));
if (Long.compare(userId, 0L) < 0 || StringUtils.isBlank(productId)) {
return;
}
Set<String> productIds = chipsUserService.loadUserBoughtProduct(userId);
if (CollectionUtils.isEmpty(productIds) || !productIds.contains(productId)) {
return;
}
OrderProductItem item = userOrderLoaderClient.loadProductItemsByProductId(productId).stream().findFirst().orElse(null);
if (item == null || StringUtils.isBlank(item.getAppItemId())) {
logger.warn("product item is null. message:{}", json);
return;
}
ChipsEnglishPageContentConfig obj = aiChipsEnglishConfigService.loadChipsConfigByName(SEND_RULE_PREFIX);
int val = SafeConverter.toInt(Optional.ofNullable(obj).map(ChipsEnglishPageContentConfig::getValue).orElse(""));
List<AIUserUnitResultHistory> aiUserBookResultList = aiUserUnitResultHistoryDao.loadByUserId(userId).stream().filter(e -> item.getAppItemId().equals(e.getBookId())).collect(Collectors.toList());
if (aiUserBookResultList.size() < val) {
return;
}
OrderProduct orderProduct = userOrderLoaderClient.loadOrderProductById(productId);
if (orderProduct == null) {
logger.warn("product is null. message:{}", json);
}
if (!OrderProductUtil.isShortProduct(orderProduct)) {
return;
}
Date endDate = Optional.ofNullable(orderProduct)
.map(e -> e.getAttributes())
.filter(e -> StringUtils.isNotBlank(e))
.map(e -> JsonUtils.fromJson(e))
.filter(e -> MapUtils.isNotEmpty(e))
.map(e -> SafeConverter.toDate(e.get("endDate")))
.orElse(new Date());
Map<String, WechatTemplateData> templateDataMap = new HashMap<>();
templateDataMap.put("first", new WechatTemplateData("恭喜宝贝毕业啦!\n\r", "#FF6551"));
templateDataMap.put("keyword1", new WechatTemplateData(orderProduct.getName(), null));
templateDataMap.put("keyword2", new WechatTemplateData(DateUtils.dateToString(endDate, FORMAT_SQL_DATE), null));
templateDataMap.put("remark", new WechatTemplateData("\n\r→点击领取毕业证书,晒晒孩子的学习成果~", "#FF6551"));
Map<String, Object> map = new HashMap<>();
String userName = Optional.ofNullable(userLoaderClient.loadUser(userId))
.filter(e -> e.getProfile() != null)
.map(User::getProfile)
.map(UserProfile::getNickName)
.filter(e -> StringUtils.isNotBlank(e))
.orElse("");
map.put("url", WechatConfig.getBaseSiteUrl() + "/chips/center/getcertificate.vpage?user=" + userName);
try {
wechatServiceClient.getWechatService().processWechatTemplateMessageNotice(userId, WechatTemplateMessageType.CHIPS_COURSE_GRADUATION_CERTIFICATE.name(), templateDataMap, map);
} catch (Exception e) {
logger.warn("send WechatTemplateMessage error. user:{}, dataMap:{} ", userId, templateDataMap, e);
}
}
}
}
|
UTF-8
|
Java
| 6,970 |
java
|
ChipsGraduationCertificateHandleQueueListener.java
|
Java
|
[] | null |
[] |
package com.voxlearning.utopia.service.ai.impl.service.listener;
import com.voxlearning.alps.calendar.DateUtils;
import com.voxlearning.alps.core.util.CollectionUtils;
import com.voxlearning.alps.core.util.MapUtils;
import com.voxlearning.alps.core.util.StringUtils;
import com.voxlearning.alps.lang.convert.SafeConverter;
import com.voxlearning.alps.lang.mapper.json.JsonUtils;
import com.voxlearning.alps.logger.LoggerFactory;
import com.voxlearning.alps.spi.queue.*;
import com.voxlearning.utopia.service.ai.entity.AIUserUnitResultHistory;
import com.voxlearning.utopia.service.ai.entity.ChipsEnglishPageContentConfig;
import com.voxlearning.utopia.service.ai.impl.persistence.AIUserUnitResultHistoryDao;
import com.voxlearning.utopia.service.ai.impl.service.AiChipsEnglishConfigServiceImpl;
import com.voxlearning.utopia.service.ai.impl.support.WechatConfig;
import com.voxlearning.utopia.service.ai.internal.ChipsUserService;
import com.voxlearning.utopia.service.ai.util.OrderProductUtil;
import com.voxlearning.utopia.service.order.api.entity.OrderProduct;
import com.voxlearning.utopia.service.order.api.entity.OrderProductItem;
import com.voxlearning.utopia.service.order.consumer.UserOrderLoaderClient;
import com.voxlearning.utopia.service.user.api.entities.User;
import com.voxlearning.utopia.service.user.api.entities.UserProfile;
import com.voxlearning.utopia.service.user.consumer.UserLoaderClient;
import com.voxlearning.utopia.service.wechat.api.constants.WechatTemplateMessageType;
import com.voxlearning.utopia.service.wechat.api.data.WechatTemplateData;
import com.voxlearning.utopia.service.wechat.client.WechatServiceClient;
import org.slf4j.Logger;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.*;
import java.util.stream.Collectors;
import static com.voxlearning.alps.calendar.DateUtils.FORMAT_SQL_DATE;
/**
* 毕业证
*/
@Named
@QueueConsumer(
destinations = {
@QueueDestination(system = QueueSystem.KFK, config = "primary", queue = "utopia.chips.course.end.certificate.queue"),
@QueueDestination(system = QueueSystem.KFK, config = "main-backup", queue = "utopia.chips.course.end.certificate.queue")
},
maxPermits = 4
)
public class ChipsGraduationCertificateHandleQueueListener implements MessageListener {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Inject
private WechatServiceClient wechatServiceClient;
@Inject
private UserOrderLoaderClient userOrderLoaderClient;
@Inject
private AIUserUnitResultHistoryDao aiUserUnitResultHistoryDao;
@Inject
private UserLoaderClient userLoaderClient;
@Inject
private AiChipsEnglishConfigServiceImpl aiChipsEnglishConfigService;
@Inject
private ChipsUserService chipsUserService;
private static final String SEND_RULE_PREFIX = "chips_send_rule_graduation_certificate";
@Override
public void onMessage(Message message) {
if (message == null) {
logger.error("course begin notify handle share queue no message");
return;
}
Object body = message.decodeBody();
if (body != null && body instanceof String) {
String json = (String) body;
Map<String, Object> param = JsonUtils.fromJson(json);
if (param == null) {
logger.error("AIUserShareVideoHandleQueueListener error. message:{}", body);
return;
}
long userId = SafeConverter.toLong(param.get("U"));
String productId = SafeConverter.toString(param.get("P"));
if (Long.compare(userId, 0L) < 0 || StringUtils.isBlank(productId)) {
return;
}
Set<String> productIds = chipsUserService.loadUserBoughtProduct(userId);
if (CollectionUtils.isEmpty(productIds) || !productIds.contains(productId)) {
return;
}
OrderProductItem item = userOrderLoaderClient.loadProductItemsByProductId(productId).stream().findFirst().orElse(null);
if (item == null || StringUtils.isBlank(item.getAppItemId())) {
logger.warn("product item is null. message:{}", json);
return;
}
ChipsEnglishPageContentConfig obj = aiChipsEnglishConfigService.loadChipsConfigByName(SEND_RULE_PREFIX);
int val = SafeConverter.toInt(Optional.ofNullable(obj).map(ChipsEnglishPageContentConfig::getValue).orElse(""));
List<AIUserUnitResultHistory> aiUserBookResultList = aiUserUnitResultHistoryDao.loadByUserId(userId).stream().filter(e -> item.getAppItemId().equals(e.getBookId())).collect(Collectors.toList());
if (aiUserBookResultList.size() < val) {
return;
}
OrderProduct orderProduct = userOrderLoaderClient.loadOrderProductById(productId);
if (orderProduct == null) {
logger.warn("product is null. message:{}", json);
}
if (!OrderProductUtil.isShortProduct(orderProduct)) {
return;
}
Date endDate = Optional.ofNullable(orderProduct)
.map(e -> e.getAttributes())
.filter(e -> StringUtils.isNotBlank(e))
.map(e -> JsonUtils.fromJson(e))
.filter(e -> MapUtils.isNotEmpty(e))
.map(e -> SafeConverter.toDate(e.get("endDate")))
.orElse(new Date());
Map<String, WechatTemplateData> templateDataMap = new HashMap<>();
templateDataMap.put("first", new WechatTemplateData("恭喜宝贝毕业啦!\n\r", "#FF6551"));
templateDataMap.put("keyword1", new WechatTemplateData(orderProduct.getName(), null));
templateDataMap.put("keyword2", new WechatTemplateData(DateUtils.dateToString(endDate, FORMAT_SQL_DATE), null));
templateDataMap.put("remark", new WechatTemplateData("\n\r→点击领取毕业证书,晒晒孩子的学习成果~", "#FF6551"));
Map<String, Object> map = new HashMap<>();
String userName = Optional.ofNullable(userLoaderClient.loadUser(userId))
.filter(e -> e.getProfile() != null)
.map(User::getProfile)
.map(UserProfile::getNickName)
.filter(e -> StringUtils.isNotBlank(e))
.orElse("");
map.put("url", WechatConfig.getBaseSiteUrl() + "/chips/center/getcertificate.vpage?user=" + userName);
try {
wechatServiceClient.getWechatService().processWechatTemplateMessageNotice(userId, WechatTemplateMessageType.CHIPS_COURSE_GRADUATION_CERTIFICATE.name(), templateDataMap, map);
} catch (Exception e) {
logger.warn("send WechatTemplateMessage error. user:{}, dataMap:{} ", userId, templateDataMap, e);
}
}
}
}
| 6,970 | 0.6822 | 0.680174 | 147 | 46.006802 | 39.393272 | 206 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.734694 | false | false |
0
|
1e99f15a24e13e6d24ef8cad9c4cc27ea3163bae
| 18,348,100,327,769 |
301e560e4dfd3970ce74957e94e95eb6018a6314
|
/clockio-service/src/main/java/com/future/clockio/service/core/CommandExecutorService.java
|
33f0ba2e51019e077f9198c6564ff7f5673b1785
|
[] |
no_license
|
natashaval/Clockio-Backend
|
https://github.com/natashaval/Clockio-Backend
|
a53f9d7b758b91b3d46aa5368069c5f0a5328775
|
f38f3d5b44d49f3a59cb6fc1a5c5d5fe5e34f347
|
refs/heads/master
| 2023-02-07T15:36:19.041000 | 2020-02-10T07:38:19 | 2020-02-10T07:38:19 | 208,813,928 | 0 | 0 | null | false | 2023-01-31T12:07:37 | 2019-09-16T14:00:05 | 2020-02-24T17:04:33 | 2023-01-31T12:07:36 | 293 | 0 | 0 | 1 |
Java
| false | false |
package com.future.clockio.service.core;
import com.future.clockio.command.Command;
public interface CommandExecutorService {
<REQUEST, RESPONSE> RESPONSE executeCommand(Class<? extends Command<REQUEST,RESPONSE>> commandClass, REQUEST request);
}
|
UTF-8
|
Java
| 251 |
java
|
CommandExecutorService.java
|
Java
|
[] | null |
[] |
package com.future.clockio.service.core;
import com.future.clockio.command.Command;
public interface CommandExecutorService {
<REQUEST, RESPONSE> RESPONSE executeCommand(Class<? extends Command<REQUEST,RESPONSE>> commandClass, REQUEST request);
}
| 251 | 0.812749 | 0.812749 | 7 | 34.857143 | 39.534538 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.857143 | false | false |
0
|
77012ed06063076ae22b3a52ef7bdab50d160229
| 5,600,637,424,474 |
09895c859f0866f192dad34c62f0501c55f6517a
|
/app/src/main/java/com/example/Covid19Tracker/Models/StateModel.java
|
b13b1b1dfd3f6fb1f7c1fd020056c0d61a8a49dd
|
[] |
no_license
|
guru2804/MCLab
|
https://github.com/guru2804/MCLab
|
5fb34feeb0d382c16e5945416d22b474b82b61e2
|
3d25197b3586949fff115103a472560cedad64eb
|
refs/heads/main
| 2023-07-05T22:08:15.899000 | 2021-05-20T04:23:50 | 2021-05-20T04:23:50 | 369,077,501 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.Covid19Tracker.Models;
public class StateModel {
private String state;
private String confirmed;
private String active;
private String deceased;
private String recovered;
public StateModel(String state, String confirmed, String active, String deceased,
String recovered) {
this.state = state;
this.confirmed = confirmed;
this.active = active;
this.deceased = deceased;
this.recovered = recovered;
}
public String getState() {
return state;
}
public String getConfirmed() {
return confirmed;
}
public String getActive() {
return active;
}
public String getDeceased() {
return deceased;
}
public String getRecovered() {
return recovered;
}
}
|
UTF-8
|
Java
| 956 |
java
|
StateModel.java
|
Java
|
[] | null |
[] |
package com.example.Covid19Tracker.Models;
public class StateModel {
private String state;
private String confirmed;
private String active;
private String deceased;
private String recovered;
public StateModel(String state, String confirmed, String active, String deceased,
String recovered) {
this.state = state;
this.confirmed = confirmed;
this.active = active;
this.deceased = deceased;
this.recovered = recovered;
}
public String getState() {
return state;
}
public String getConfirmed() {
return confirmed;
}
public String getActive() {
return active;
}
public String getDeceased() {
return deceased;
}
public String getRecovered() {
return recovered;
}
}
| 956 | 0.539749 | 0.537657 | 39 | 23.461538 | 18.388746 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512821 | false | false |
0
|
f7c56e3996a39c2e8232f4bee7b044ee8cf6d81c
| 2,456,721,354,012 |
baae0148c139870c69911fc0766f3b32c90e668e
|
/app/src/main/java/ca/mohawkcollege/fayad/MainActivity.java
|
30cd1ee64843acb1e085174e8b5a4ce81ba2d839
|
[] |
no_license
|
hadifayad9/book-finder
|
https://github.com/hadifayad9/book-finder
|
3ed950e8719fc27f4a76a1b600198f4f8582e866
|
166572ba750d3e79d7cbaa1d92a9f9aa90dd10c9
|
refs/heads/master
| 2023-04-14T02:40:27.901000 | 2021-04-20T18:29:01 | 2021-04-20T18:29:01 | 359,913,576 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ca.mohawkcollege.fayad;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.TextView;
import com.google.android.material.navigation.NavigationView;
/*
I, Hadi Fayad, 000397306 certify that this material is my original work.
No other person's work has been used without due
acknowledgement.
https://youtu.be/nAP7qwP-ycc
*/
/**
* MainActivity one is used to use the user input and determine weather the user wants a book title or author search
* also uses the navbar
*/
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
public static final String TAG = "==MainActivity==";
private DrawerLayout myDrawer;
NavigationView myNavView;
public Button bookButton;
public Switch authorSwitch;
public EditText bookTitle;
@Override
/**
* Oncreate for the main method that calls the different methods like the navbarView() and the bookTitleCheck();
* The oncreate also calls the buttons and sets the click listener
*/
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
navBarView();
bookButton = findViewById(R.id.bookSearchButton);
authorSwitch = findViewById(R.id.authorSwitch);
bookButton.setOnClickListener(this::BookButtonClick);
bookTitleInputCheck();
Log.d(TAG,"onCreate");
bookTitle.setText("");
}
/**
* Displays the navbar using the navigation view and the actionbar. It also sets the toggles for checking
* when the navbar is open
*/
public void navBarView(){
Log.d(TAG,"navBarView");
myDrawer = (DrawerLayout)
findViewById(R.id.drawer_layout);
ActionBar myActionBar = getSupportActionBar();
myActionBar.setDisplayHomeAsUpEnabled(true);
ActionBarDrawerToggle myactionbartoggle = new
ActionBarDrawerToggle(this, myDrawer,
(R.string.open), (R.string.close));
myDrawer.addDrawerListener(myactionbartoggle);
myactionbartoggle.syncState();
myNavView = (NavigationView)
findViewById(R.id.nav_view);
myNavView.setNavigationItemSelectedListener(this);
}
/**
* Search button for the application that sends information to another activity that uses the startDownload method
* this method also checks if the user wants to use the author mode or the title mode
* @param view
*/
public void BookButtonClick(View view){
Log.d(TAG,"BookButtonClick");
Intent switchActivity = new Intent(MainActivity.this, MainActivity2.class);
bookTitle = (EditText) findViewById(R.id.bookFinderText);
if (authorSwitch.isChecked()) { // If the switch is checked then use the author search
String authorSearch = bookTitle.getText().toString();
switchActivity.putExtra("authorSearch", authorSearch); // Go to next activity
} else {
String bookTitleText = bookTitle.getText().toString();
switchActivity.putExtra("bookSearch", bookTitleText);
}
startActivity(switchActivity);
}
/**
* Navbar method that checks if the drawer is open or not when the hamburger menu is opened
* @param item
* @return item
*/
public boolean onOptionsItemSelected(MenuItem item) {
Log.d(TAG,"onOptionsItemSelected");
// Find out the current state of the drawer (open or closed)
boolean isOpen = myDrawer.isDrawerOpen(GravityCompat.START);
// Handle item selection
switch (item.getItemId()) {
case android.R.id.home:
// Home button - open or close the drawer
if (isOpen == true) {
myDrawer.closeDrawer(GravityCompat.START);
} else {
myDrawer.openDrawer(GravityCompat.START);
}
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* NavBar on item selected that when a item is clicked on the navbar it execute code
* the code takes the user to the intended activity they clicked on
* @param item
* @return item
*/
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Log.d(TAG,"onNavigationItemSelected");
myNavView.setCheckedItem(item);
myDrawer.closeDrawers();
switch (item.getItemId()) {
case R.id.searchNavBar:
Intent switchActivitySearch = new Intent(MainActivity.this,MainActivity.class);
startActivity(switchActivitySearch);
break;
case R.id.aboutNavBar:
Intent switchActivityAbout = new Intent(MainActivity.this,MainActivity3.class);
startActivity(switchActivityAbout);
break;
case R.id.bookFavNav:
Intent switchActivityFav = new Intent(MainActivity.this,MainActivity4.class);
startActivity(switchActivityFav);
}
return false;
}
/**
* The purpose of this method is to check for the book title text
* if the text field is empty then the button and switch is disabled
* if the there is text then the button and switch are enabled
*/
public void bookTitleInputCheck(){
bookTitle = (EditText) findViewById(R.id.bookFinderText);
TextView textChecker = findViewById(R.id.textChecker);
bookTitle.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
/**
* onTextChange execute the code if the string is empty then disable it
* @param s
* @param start
* @param before
* @param count
*/
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
String inputVal = bookTitle.getText().toString().trim();
if(inputVal.isEmpty()){
textChecker.setText(getResources().getString(R.string.textChecker));
bookButton.setEnabled(false);
authorSwitch.setEnabled(false);
}else{
textChecker.setText("");
bookButton.setEnabled(true);
authorSwitch.setEnabled(true);
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
}
|
UTF-8
|
Java
| 7,232 |
java
|
MainActivity.java
|
Java
|
[
{
"context": "android.material.navigation.NavigationView;\n\n/*\nI, Hadi Fayad, 000397306 certify that this material is my origi",
"end": 709,
"score": 0.999815821647644,
"start": 699,
"tag": "NAME",
"value": "Hadi Fayad"
}
] | null |
[] |
package ca.mohawkcollege.fayad;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Switch;
import android.widget.TextView;
import com.google.android.material.navigation.NavigationView;
/*
I, <NAME>, 000397306 certify that this material is my original work.
No other person's work has been used without due
acknowledgement.
https://youtu.be/nAP7qwP-ycc
*/
/**
* MainActivity one is used to use the user input and determine weather the user wants a book title or author search
* also uses the navbar
*/
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
public static final String TAG = "==MainActivity==";
private DrawerLayout myDrawer;
NavigationView myNavView;
public Button bookButton;
public Switch authorSwitch;
public EditText bookTitle;
@Override
/**
* Oncreate for the main method that calls the different methods like the navbarView() and the bookTitleCheck();
* The oncreate also calls the buttons and sets the click listener
*/
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
navBarView();
bookButton = findViewById(R.id.bookSearchButton);
authorSwitch = findViewById(R.id.authorSwitch);
bookButton.setOnClickListener(this::BookButtonClick);
bookTitleInputCheck();
Log.d(TAG,"onCreate");
bookTitle.setText("");
}
/**
* Displays the navbar using the navigation view and the actionbar. It also sets the toggles for checking
* when the navbar is open
*/
public void navBarView(){
Log.d(TAG,"navBarView");
myDrawer = (DrawerLayout)
findViewById(R.id.drawer_layout);
ActionBar myActionBar = getSupportActionBar();
myActionBar.setDisplayHomeAsUpEnabled(true);
ActionBarDrawerToggle myactionbartoggle = new
ActionBarDrawerToggle(this, myDrawer,
(R.string.open), (R.string.close));
myDrawer.addDrawerListener(myactionbartoggle);
myactionbartoggle.syncState();
myNavView = (NavigationView)
findViewById(R.id.nav_view);
myNavView.setNavigationItemSelectedListener(this);
}
/**
* Search button for the application that sends information to another activity that uses the startDownload method
* this method also checks if the user wants to use the author mode or the title mode
* @param view
*/
public void BookButtonClick(View view){
Log.d(TAG,"BookButtonClick");
Intent switchActivity = new Intent(MainActivity.this, MainActivity2.class);
bookTitle = (EditText) findViewById(R.id.bookFinderText);
if (authorSwitch.isChecked()) { // If the switch is checked then use the author search
String authorSearch = bookTitle.getText().toString();
switchActivity.putExtra("authorSearch", authorSearch); // Go to next activity
} else {
String bookTitleText = bookTitle.getText().toString();
switchActivity.putExtra("bookSearch", bookTitleText);
}
startActivity(switchActivity);
}
/**
* Navbar method that checks if the drawer is open or not when the hamburger menu is opened
* @param item
* @return item
*/
public boolean onOptionsItemSelected(MenuItem item) {
Log.d(TAG,"onOptionsItemSelected");
// Find out the current state of the drawer (open or closed)
boolean isOpen = myDrawer.isDrawerOpen(GravityCompat.START);
// Handle item selection
switch (item.getItemId()) {
case android.R.id.home:
// Home button - open or close the drawer
if (isOpen == true) {
myDrawer.closeDrawer(GravityCompat.START);
} else {
myDrawer.openDrawer(GravityCompat.START);
}
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* NavBar on item selected that when a item is clicked on the navbar it execute code
* the code takes the user to the intended activity they clicked on
* @param item
* @return item
*/
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Log.d(TAG,"onNavigationItemSelected");
myNavView.setCheckedItem(item);
myDrawer.closeDrawers();
switch (item.getItemId()) {
case R.id.searchNavBar:
Intent switchActivitySearch = new Intent(MainActivity.this,MainActivity.class);
startActivity(switchActivitySearch);
break;
case R.id.aboutNavBar:
Intent switchActivityAbout = new Intent(MainActivity.this,MainActivity3.class);
startActivity(switchActivityAbout);
break;
case R.id.bookFavNav:
Intent switchActivityFav = new Intent(MainActivity.this,MainActivity4.class);
startActivity(switchActivityFav);
}
return false;
}
/**
* The purpose of this method is to check for the book title text
* if the text field is empty then the button and switch is disabled
* if the there is text then the button and switch are enabled
*/
public void bookTitleInputCheck(){
bookTitle = (EditText) findViewById(R.id.bookFinderText);
TextView textChecker = findViewById(R.id.textChecker);
bookTitle.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
/**
* onTextChange execute the code if the string is empty then disable it
* @param s
* @param start
* @param before
* @param count
*/
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
String inputVal = bookTitle.getText().toString().trim();
if(inputVal.isEmpty()){
textChecker.setText(getResources().getString(R.string.textChecker));
bookButton.setEnabled(false);
authorSwitch.setEnabled(false);
}else{
textChecker.setText("");
bookButton.setEnabled(true);
authorSwitch.setEnabled(true);
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
}
| 7,228 | 0.645603 | 0.643805 | 181 | 38.961327 | 27.544512 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.563536 | false | false |
0
|
dddd80dae250b5acbd19aa8293313576d7ba0e1d
| 18,416,819,780,693 |
51f581d10d4f1c60a6af39aad7e70e7b43429a89
|
/experimento2/REF_Code-eimp/src/org/maze/eimp/rendezvous/XMLMessage.java
|
a8b0a773139ffcb922a552af5b01c34391013006
|
[] |
no_license
|
moudaaoulmi/experimento-dsc
|
https://github.com/moudaaoulmi/experimento-dsc
|
d3f629dce7822e36ad51af0026f39afd7d991d9e
|
74a8c363dfe9d988ef68147c0872fd89bd5b5f0a
|
refs/heads/master
| 2021-01-13T02:02:21.376000 | 2010-09-30T20:33:26 | 2010-09-30T20:33:26 | 37,370,490 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.maze.eimp.rendezvous;
import org.maze.eimp.im.MimeMessage;
/**
* @author Ringo De Smet
*/
public class XMLMessage {
private String body;
private String to;
private String type;
public XMLMessage() {
}
public XMLMessage(MimeMessage eimpMessage) {
this.setBody(eimpMessage.getMessageString());
}
public void setBody(String bodyText) {
this.body = bodyText;
}
public String getBody() {
return this.body;
}
public void setTo(String to) {
this.to = to;
}
public void setType(String type) {
this.type = type;
}
public String toString() {
return "Message[to=" + to + ",type=" + type + ",body=" + body + "]";
}
public XMLMessage createReply() {
XMLMessage reply = new XMLMessage();
reply.setBody(this.body);
reply.to = "localhost";
reply.type = this.type;
return reply;
}
public String toXML() {
return "<message to='"+ to + "' type='" + type + "'><body>" + body + "</body></message>";
}
}
|
UTF-8
|
Java
| 1,005 |
java
|
XMLMessage.java
|
Java
|
[
{
"context": "t org.maze.eimp.im.MimeMessage;\r\n\r\n/**\r\n * @author Ringo De Smet\r\n */\r\npublic class XMLMessage {\r\n\r\n\tprivate String ",
"end": 106,
"score": 0.9276127815246582,
"start": 93,
"tag": "NAME",
"value": "Ringo De Smet"
}
] | null |
[] |
package org.maze.eimp.rendezvous;
import org.maze.eimp.im.MimeMessage;
/**
* @author <NAME>
*/
public class XMLMessage {
private String body;
private String to;
private String type;
public XMLMessage() {
}
public XMLMessage(MimeMessage eimpMessage) {
this.setBody(eimpMessage.getMessageString());
}
public void setBody(String bodyText) {
this.body = bodyText;
}
public String getBody() {
return this.body;
}
public void setTo(String to) {
this.to = to;
}
public void setType(String type) {
this.type = type;
}
public String toString() {
return "Message[to=" + to + ",type=" + type + ",body=" + body + "]";
}
public XMLMessage createReply() {
XMLMessage reply = new XMLMessage();
reply.setBody(this.body);
reply.to = "localhost";
reply.type = this.type;
return reply;
}
public String toXML() {
return "<message to='"+ to + "' type='" + type + "'><body>" + body + "</body></message>";
}
}
| 998 | 0.616915 | 0.616915 | 52 | 17.326923 | 19.185051 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.230769 | false | false |
0
|
a96de5c739984c2ce18131d4ad7866d7235e0f8a
| 32,865,089,803,652 |
8ee283a10e50ab7bd75abbb1649346c6de13c807
|
/src/impl/xdtimpl.java
|
177ef233e342490851e0e0c8268fd190e229282c
|
[] |
no_license
|
adivxkk/res-order
|
https://github.com/adivxkk/res-order
|
46c8193b9e8247f10c2b4572c28a24fb90b3fdb1
|
c3b3fa3ee9523eb8b66a6b8bbb91f774742370a0
|
refs/heads/master
| 2020-06-18T23:10:43.175000 | 2019-07-12T01:34:29 | 2019-07-12T01:36:14 | 196,487,675 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import dbc.DBUtils;
import vo.Xiadantotal;
public class xdtimpl {
private Connection connection;
public xdtimpl(Connection connection) {
this.connection = connection;
}
public static float Selectxdt(Xiadantotal xiadantotal) {
Connection connection = null;
PreparedStatement preparedStatement = null;
float rs = 0;
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement("{call dbo.本次消费总金额(?,?)}");
preparedStatement.setInt(1, xiadantotal.getId());
preparedStatement.setInt(2, xiadantotal.getCus_id());
ResultSet rSet = preparedStatement.executeQuery();
if (rSet.next()) {
rs = rSet.getFloat("totalmoney");
}
} catch (Exception e) {
e.printStackTrace();
}
DBUtils.close(connection);
DBUtils.close(preparedStatement);
return rs;
}
}
|
UTF-8
|
Java
| 998 |
java
|
xdtimpl.java
|
Java
|
[] | null |
[] |
package impl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import dbc.DBUtils;
import vo.Xiadantotal;
public class xdtimpl {
private Connection connection;
public xdtimpl(Connection connection) {
this.connection = connection;
}
public static float Selectxdt(Xiadantotal xiadantotal) {
Connection connection = null;
PreparedStatement preparedStatement = null;
float rs = 0;
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement("{call dbo.本次消费总金额(?,?)}");
preparedStatement.setInt(1, xiadantotal.getId());
preparedStatement.setInt(2, xiadantotal.getCus_id());
ResultSet rSet = preparedStatement.executeQuery();
if (rSet.next()) {
rs = rSet.getFloat("totalmoney");
}
} catch (Exception e) {
e.printStackTrace();
}
DBUtils.close(connection);
DBUtils.close(preparedStatement);
return rs;
}
}
| 998 | 0.691057 | 0.688008 | 39 | 24.23077 | 20.418018 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.615385 | false | false |
0
|
241250aa37f3e498c7c712e34ca9da6ad6d4cb41
| 6,588,479,880,224 |
43ff7f278cfd91f841d1a845f00005c18e8e0e3d
|
/src/main/java/com/example/video/VideoFetchFrameUtils.java
|
09918e1f034049aceec6d9c1f41a8bdec469bf29
|
[] |
no_license
|
helloidealgod/jdk_proxy
|
https://github.com/helloidealgod/jdk_proxy
|
8b32421a946b146235e2d3b9c09a7cd98785aaf4
|
185555b5f53b9884a0ded81032aff939d1435e98
|
refs/heads/master
| 2023-06-24T09:54:16.751000 | 2023-06-22T17:27:06 | 2023-06-22T17:27:06 | 183,838,620 | 0 | 0 | null | false | 2023-01-18T11:14:09 | 2019-04-28T01:27:53 | 2023-01-10T12:01:25 | 2023-01-18T11:14:09 | 531 | 1 | 0 | 2 |
Java
| false | false |
//package com.example.video;
//
//import org.bytedeco.javacv.FFmpegFrameGrabber;
//import org.bytedeco.javacv.Frame;
//import org.bytedeco.javacv.FrameGrabber;
//import org.bytedeco.javacv.Java2DFrameConverter;
//
//import javax.imageio.ImageIO;
//import java.awt.image.BufferedImage;
//import java.io.File;
//import java.io.IOException;
//compile('org.bytedeco:javacv:1.4.3')
// compile('org.bytedeco.javacpp-presets:ffmpeg-platform:4.0.2-1.4.3')
///**
// * @Description:
// * @Auther: xiankun.jiang
// * @Date: 2019/5/17 08:47
// */
//public class VideoFetchFrameUtils {
// /**
// * @description: 获取视频文件第5帧图片
// * @param: videoFilePath 视频文件路径
// * @param: videoFilePath 图片要保存的路径
// * @return: void
// * @auther: xiankun.jiang
// * @date: 2019/5/17 9:04
// */
// public static void fetchFrame(String videoFilePath, String frameSavePath) {
// try {
// int flag = 0;
// FFmpegFrameGrabber fFmpegFrameGrabber = new FFmpegFrameGrabber(videoFilePath);
// fFmpegFrameGrabber.start();
// //获取视频总帧数
// int ftp = fFmpegFrameGrabber.getLengthInFrames();
// while (flag <= ftp) {
// Frame frame = fFmpegFrameGrabber.grabImage();
// //对视频的第五帧进行处理
// if (frame != null && flag == 5) {
// //文件储存对象
// File outPut = new File(frameSavePath);
// ImageIO.write(FrameToBufferedImage(frame), "jpg", outPut);
// break;
// }
// flag++;
// }
// } catch (FrameGrabber.Exception e) {
// e.printStackTrace();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// public static BufferedImage FrameToBufferedImage(Frame frame) {
// //创建BufferedImage对象
// Java2DFrameConverter converter = new Java2DFrameConverter();
// BufferedImage bufferedImage = converter.getBufferedImage(frame);
// return bufferedImage;
// }
//
// public static void main(String[] args) {
// fetchFrame("e:/1.ts", "e:/123.jpg");
// }
//}
|
UTF-8
|
Java
| 2,270 |
java
|
VideoFetchFrameUtils.java
|
Java
|
[
{
"context": "0.2-1.4.3')\n///**\n// * @Description:\n// * @Auther: xiankun.jiang\n// * @Date: 2019/5/17 08:47\n// */\n//public class ",
"end": 507,
"score": 0.99761563539505,
"start": 494,
"tag": "USERNAME",
"value": "xiankun.jiang"
},
{
"context": " 图片要保存的路径\n// * @return: void\n// * @auther: xiankun.jiang\n// * @date: 2019/5/17 9:04\n// */\n// pu",
"end": 757,
"score": 0.9954583048820496,
"start": 744,
"tag": "USERNAME",
"value": "xiankun.jiang"
}
] | null |
[] |
//package com.example.video;
//
//import org.bytedeco.javacv.FFmpegFrameGrabber;
//import org.bytedeco.javacv.Frame;
//import org.bytedeco.javacv.FrameGrabber;
//import org.bytedeco.javacv.Java2DFrameConverter;
//
//import javax.imageio.ImageIO;
//import java.awt.image.BufferedImage;
//import java.io.File;
//import java.io.IOException;
//compile('org.bytedeco:javacv:1.4.3')
// compile('org.bytedeco.javacpp-presets:ffmpeg-platform:4.0.2-1.4.3')
///**
// * @Description:
// * @Auther: xiankun.jiang
// * @Date: 2019/5/17 08:47
// */
//public class VideoFetchFrameUtils {
// /**
// * @description: 获取视频文件第5帧图片
// * @param: videoFilePath 视频文件路径
// * @param: videoFilePath 图片要保存的路径
// * @return: void
// * @auther: xiankun.jiang
// * @date: 2019/5/17 9:04
// */
// public static void fetchFrame(String videoFilePath, String frameSavePath) {
// try {
// int flag = 0;
// FFmpegFrameGrabber fFmpegFrameGrabber = new FFmpegFrameGrabber(videoFilePath);
// fFmpegFrameGrabber.start();
// //获取视频总帧数
// int ftp = fFmpegFrameGrabber.getLengthInFrames();
// while (flag <= ftp) {
// Frame frame = fFmpegFrameGrabber.grabImage();
// //对视频的第五帧进行处理
// if (frame != null && flag == 5) {
// //文件储存对象
// File outPut = new File(frameSavePath);
// ImageIO.write(FrameToBufferedImage(frame), "jpg", outPut);
// break;
// }
// flag++;
// }
// } catch (FrameGrabber.Exception e) {
// e.printStackTrace();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// public static BufferedImage FrameToBufferedImage(Frame frame) {
// //创建BufferedImage对象
// Java2DFrameConverter converter = new Java2DFrameConverter();
// BufferedImage bufferedImage = converter.getBufferedImage(frame);
// return bufferedImage;
// }
//
// public static void main(String[] args) {
// fetchFrame("e:/1.ts", "e:/123.jpg");
// }
//}
| 2,270 | 0.572946 | 0.554478 | 63 | 33.396824 | 21.855616 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false |
0
|
3b8bee176a0efd3905909eb1383521821cfc4d0a
| 25,211,458,091,242 |
00ab7e25ea8b4bdb243d0f7359dec7e46d84a389
|
/PruebaIngeneo/PruebaIngeneo-war/src/java/co/com/empresa/transporte/mb/InformacionPedidoMB.java
|
32f762f6446c4d816ba4d6254f17abe49fcd008e
|
[] |
no_license
|
PilarMassL/TestIngeneo
|
https://github.com/PilarMassL/TestIngeneo
|
06ac1ffccfc4b40495b04809f87d59742b9b7b02
|
3c0bf881378cd4473125fae47cc010d54a3f203b
|
refs/heads/master
| 2021-05-02T06:06:54.112000 | 2018-02-09T03:56:19 | 2018-02-09T03:56:19 | 120,853,171 | 1 | 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 co.com.empresa.transporte.mb;
import co.com.empresa.transporte.ejb.ClienteBeanLocal;
import co.com.empresa.transporte.ejb.DestinoBeanLocal;
import co.com.empresa.transporte.ejb.PedidoBeanLocal;
import co.com.empresa.transporte.ejb.VehiculoBeanLocal;
import co.com.empresa.transporte.modelo.Cliente;
import co.com.empresa.transporte.modelo.Destino;
import co.com.empresa.transporte.modelo.Pedido;
import co.com.empresa.transporte.modelo.Vehiculo;
import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.faces.bean.ManagedBean;
/**
*
* @author pilar.mass
*/
@ManagedBean
@Stateless
public class InformacionPedidoMB {
@EJB
PedidoBeanLocal pedidoBeanLocal;
@EJB
DestinoBeanLocal destinoBeanLocal;
@EJB
VehiculoBeanLocal vehiculoBeanLocal;
@EJB
ClienteBeanLocal clienteBeanLocal;
//
private double precio;
private double peso;
private String nombreCliente;
private String cedula;
private Date fecha;
/**
* Creates a new instance of InformacionPedidoMB
*/
private Destino destino;
private List<Destino> listaDestino;
private List<Pedido> listaPedido;
private List<Pedido> listaPedidoFiltrado;
@PostConstruct
public void init(){
listarDestino();
}
public InformacionPedidoMB() {
//listarDestino();
}
public void listarDestino(){
listaDestino =destinoBeanLocal.consultarDestino();
}
public void guardar(){
Pedido obj = new Pedido();
Vehiculo vehiculo= vehiculoBeanLocal.vehiculoDisponible(""+peso);
Cliente cliente = new Cliente();
cliente.setClieNombre(nombreCliente);
cliente.setClieCedula(Integer.parseInt(cedula));
cliente= clienteBeanLocal.insertarCliente(cliente);
obj.setPediPeso(peso);
obj.setPediPrecio(precio);
obj.setPediFecha(fecha);
obj.setPedivehiculoid(vehiculo);
obj.setPediCliente(cliente);
pedidoBeanLocal.insertarAcceso(obj);
}
public List<Destino> getListaDestino() {
return listaDestino;
}
public void setListaDestino(List<Destino> listaDestino) {
this.listaDestino = listaDestino;
}
public Destino getDestino() {
return destino;
}
public void setDestino(Destino destino) {
this.destino = destino;
}
public Double getPeso() {
return peso;
}
public void setPeso(Double peso) {
this.peso = peso;
}
public String getNombreCliente() {
return nombreCliente;
}
public void setNombreCliente(String nombreCliente) {
this.nombreCliente = nombreCliente;
}
public String getCedula() {
return cedula;
}
public void setCedula(String cedula) {
this.cedula = cedula;
}
public double getPrecio() {
return precio;
}
public void setPrecio(double precio) {
this.precio = precio;
}
public void setPeso(double peso) {
this.peso = peso;
}
public Date getFecha() {
return fecha;
}
public void setFecha(Date fecha) {
this.fecha = fecha;
}
public List<Pedido> getListaPedido() {
return listaPedido;
}
public void setListaPedido(List<Pedido> listaPedido) {
this.listaPedido = listaPedido;
}
public List<Pedido> getListaPedidoFiltrado() {
return listaPedidoFiltrado;
}
public void setListaPedidoFiltrado(List<Pedido> listaPedidoFiltrado) {
this.listaPedidoFiltrado = listaPedidoFiltrado;
}
}
|
UTF-8
|
Java
| 4,051 |
java
|
InformacionPedidoMB.java
|
Java
|
[
{
"context": "x.faces.bean.ManagedBean;\r\n\r\n\r\n/**\r\n *\r\n * @author pilar.mass\r\n */\r\n@ManagedBean\r\n@Stateless\r\npublic class Info",
"end": 867,
"score": 0.9339986443519592,
"start": 857,
"tag": "USERNAME",
"value": "pilar.mass"
},
{
"context": "te = new Cliente();\r\n cliente.setClieNombre(nombreCliente);\r\n cliente.setClieCedula(Integer.parseInt(",
"end": 2041,
"score": 0.9185940027236938,
"start": 2028,
"tag": "NAME",
"value": "nombreCliente"
}
] | 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 co.com.empresa.transporte.mb;
import co.com.empresa.transporte.ejb.ClienteBeanLocal;
import co.com.empresa.transporte.ejb.DestinoBeanLocal;
import co.com.empresa.transporte.ejb.PedidoBeanLocal;
import co.com.empresa.transporte.ejb.VehiculoBeanLocal;
import co.com.empresa.transporte.modelo.Cliente;
import co.com.empresa.transporte.modelo.Destino;
import co.com.empresa.transporte.modelo.Pedido;
import co.com.empresa.transporte.modelo.Vehiculo;
import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.faces.bean.ManagedBean;
/**
*
* @author pilar.mass
*/
@ManagedBean
@Stateless
public class InformacionPedidoMB {
@EJB
PedidoBeanLocal pedidoBeanLocal;
@EJB
DestinoBeanLocal destinoBeanLocal;
@EJB
VehiculoBeanLocal vehiculoBeanLocal;
@EJB
ClienteBeanLocal clienteBeanLocal;
//
private double precio;
private double peso;
private String nombreCliente;
private String cedula;
private Date fecha;
/**
* Creates a new instance of InformacionPedidoMB
*/
private Destino destino;
private List<Destino> listaDestino;
private List<Pedido> listaPedido;
private List<Pedido> listaPedidoFiltrado;
@PostConstruct
public void init(){
listarDestino();
}
public InformacionPedidoMB() {
//listarDestino();
}
public void listarDestino(){
listaDestino =destinoBeanLocal.consultarDestino();
}
public void guardar(){
Pedido obj = new Pedido();
Vehiculo vehiculo= vehiculoBeanLocal.vehiculoDisponible(""+peso);
Cliente cliente = new Cliente();
cliente.setClieNombre(nombreCliente);
cliente.setClieCedula(Integer.parseInt(cedula));
cliente= clienteBeanLocal.insertarCliente(cliente);
obj.setPediPeso(peso);
obj.setPediPrecio(precio);
obj.setPediFecha(fecha);
obj.setPedivehiculoid(vehiculo);
obj.setPediCliente(cliente);
pedidoBeanLocal.insertarAcceso(obj);
}
public List<Destino> getListaDestino() {
return listaDestino;
}
public void setListaDestino(List<Destino> listaDestino) {
this.listaDestino = listaDestino;
}
public Destino getDestino() {
return destino;
}
public void setDestino(Destino destino) {
this.destino = destino;
}
public Double getPeso() {
return peso;
}
public void setPeso(Double peso) {
this.peso = peso;
}
public String getNombreCliente() {
return nombreCliente;
}
public void setNombreCliente(String nombreCliente) {
this.nombreCliente = nombreCliente;
}
public String getCedula() {
return cedula;
}
public void setCedula(String cedula) {
this.cedula = cedula;
}
public double getPrecio() {
return precio;
}
public void setPrecio(double precio) {
this.precio = precio;
}
public void setPeso(double peso) {
this.peso = peso;
}
public Date getFecha() {
return fecha;
}
public void setFecha(Date fecha) {
this.fecha = fecha;
}
public List<Pedido> getListaPedido() {
return listaPedido;
}
public void setListaPedido(List<Pedido> listaPedido) {
this.listaPedido = listaPedido;
}
public List<Pedido> getListaPedidoFiltrado() {
return listaPedidoFiltrado;
}
public void setListaPedidoFiltrado(List<Pedido> listaPedidoFiltrado) {
this.listaPedidoFiltrado = listaPedidoFiltrado;
}
}
| 4,051 | 0.641076 | 0.641076 | 164 | 22.70122 | 19.634211 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.396341 | false | false |
0
|
9c9498d33d9ee4c34471027efb5951ffb7af8b31
| 5,325,759,492,260 |
aaee118b7481bf32b4e3607bf1837762532fc944
|
/netifi-httpgateway/src/test/java/com/netifi/httpgateway/bridge/endpoint/egress/pool/RandomSelectionWeightedEgressEndpointFactoryPoolTest.java
|
e201b7a2cdbddc4ce0d8d35ccee7b3477f8ca658
|
[
"Apache-2.0"
] |
permissive
|
rockysoft/netifi-httpgateway
|
https://github.com/rockysoft/netifi-httpgateway
|
13e3389ee5b6caa8018539dd97f18a2b77dd6267
|
813d4f21a10c36b8e0a6b749e17e60f3152b6872
|
refs/heads/master
| 2021-03-18T01:33:13.887000 | 2019-07-22T22:16:15 | 2019-07-22T22:16:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.netifi.httpgateway.bridge.endpoint.egress.pool;
import com.netifi.httpgateway.bridge.endpoint.egress.EgressEndpointFactory;
import com.netifi.httpgateway.bridge.endpoint.egress.EgressEndpointFactorySupplier;
import com.netifi.httpgateway.bridge.endpoint.egress.lb.WeightedEgressEndpointFactory;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import java.util.Optional;
import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.internal.util.collections.Sets;
import reactor.core.publisher.Flux;
public class RandomSelectionWeightedEgressEndpointFactoryPoolTest {
@Test
public void testShouldBeEmptyWhenNoItemsInPool() {
EgressEndpointFactorySupplier mock = Mockito.mock(EgressEndpointFactorySupplier.class);
Mockito.when(mock.get()).thenReturn(Flux.never());
RandomSelectionWeightedEgressEndpointFactoryPool pool =
new RandomSelectionWeightedEgressEndpointFactoryPool(mock, "", new SimpleMeterRegistry());
Optional<WeightedEgressEndpointFactory> lease = pool.lease();
Assert.assertFalse(lease.isPresent());
}
@Test
public void testShouldBeLeaseAnItem() {
EgressEndpointFactorySupplier egressEndpointFactorySupplier =
Mockito.mock(EgressEndpointFactorySupplier.class);
Set<EgressEndpointFactory> setOfFactories =
Sets.newSet(Mockito.mock(WeightedEgressEndpointFactory.class));
Mockito.when(egressEndpointFactorySupplier.get()).thenReturn(Flux.just(setOfFactories));
RandomSelectionWeightedEgressEndpointFactoryPool pool =
new RandomSelectionWeightedEgressEndpointFactoryPool(
egressEndpointFactorySupplier, "", new SimpleMeterRegistry());
Assert.assertEquals(1, pool.size());
Optional<WeightedEgressEndpointFactory> lease = pool.lease();
Assert.assertTrue(lease.isPresent());
Assert.assertEquals(0, pool.size());
Optional<WeightedEgressEndpointFactory> lease1 = pool.lease();
Assert.assertFalse(lease1.isPresent());
}
}
|
UTF-8
|
Java
| 2,033 |
java
|
RandomSelectionWeightedEgressEndpointFactoryPoolTest.java
|
Java
|
[] | null |
[] |
package com.netifi.httpgateway.bridge.endpoint.egress.pool;
import com.netifi.httpgateway.bridge.endpoint.egress.EgressEndpointFactory;
import com.netifi.httpgateway.bridge.endpoint.egress.EgressEndpointFactorySupplier;
import com.netifi.httpgateway.bridge.endpoint.egress.lb.WeightedEgressEndpointFactory;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import java.util.Optional;
import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.internal.util.collections.Sets;
import reactor.core.publisher.Flux;
public class RandomSelectionWeightedEgressEndpointFactoryPoolTest {
@Test
public void testShouldBeEmptyWhenNoItemsInPool() {
EgressEndpointFactorySupplier mock = Mockito.mock(EgressEndpointFactorySupplier.class);
Mockito.when(mock.get()).thenReturn(Flux.never());
RandomSelectionWeightedEgressEndpointFactoryPool pool =
new RandomSelectionWeightedEgressEndpointFactoryPool(mock, "", new SimpleMeterRegistry());
Optional<WeightedEgressEndpointFactory> lease = pool.lease();
Assert.assertFalse(lease.isPresent());
}
@Test
public void testShouldBeLeaseAnItem() {
EgressEndpointFactorySupplier egressEndpointFactorySupplier =
Mockito.mock(EgressEndpointFactorySupplier.class);
Set<EgressEndpointFactory> setOfFactories =
Sets.newSet(Mockito.mock(WeightedEgressEndpointFactory.class));
Mockito.when(egressEndpointFactorySupplier.get()).thenReturn(Flux.just(setOfFactories));
RandomSelectionWeightedEgressEndpointFactoryPool pool =
new RandomSelectionWeightedEgressEndpointFactoryPool(
egressEndpointFactorySupplier, "", new SimpleMeterRegistry());
Assert.assertEquals(1, pool.size());
Optional<WeightedEgressEndpointFactory> lease = pool.lease();
Assert.assertTrue(lease.isPresent());
Assert.assertEquals(0, pool.size());
Optional<WeightedEgressEndpointFactory> lease1 = pool.lease();
Assert.assertFalse(lease1.isPresent());
}
}
| 2,033 | 0.795868 | 0.793901 | 49 | 40.489796 | 30.081606 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.673469 | false | false |
0
|
9ea13426bcca83c32a6dd96086cf3e507ec7483e
| 25,640,954,791,104 |
f0d89fb683791bb897eb694bcf50092c3599d4b9
|
/EstructuraDatos2Proyecto/src/estructuradatos2proyecto/Main.java
|
875c55bb6998bd44fd593887e2f08360e5323ecd
|
[] |
no_license
|
Jahazielmr/ProyectoEDD2
|
https://github.com/Jahazielmr/ProyectoEDD2
|
423475d18294a5a8e8b8c10f51fd92e44d82546e
|
603017b4666d00c9dfde1f4447c1bda6c0aede7e
|
refs/heads/master
| 2021-08-11T22:31:03.006000 | 2017-11-14T06:08:39 | 2017-11-14T06:08:39 | 109,902,500 | 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 estructuradatos2proyecto;
import java.awt.Component;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import jdk.jfr.events.FileWriteEvent;
/**
*
* @author Jahaziel
*/
public class Main extends javax.swing.JFrame {
/**
* Creates new form Main
*/
public Main() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jMenuBar2 = new javax.swing.JMenuBar();
jMenu4 = new javax.swing.JMenu();
jMenu5 = new javax.swing.JMenu();
jPanel2 = new javax.swing.JPanel();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel3 = new javax.swing.JPanel();
jTabbedPane3 = new javax.swing.JTabbedPane();
jPanel11 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
tf_nombreCampo = new javax.swing.JTextField();
jButton3 = new javax.swing.JButton();
jPanel12 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
Tabla_campos = new javax.swing.JTable();
jPanel13 = new javax.swing.JPanel();
cb_modificarCampo = new javax.swing.JComboBox<>();
jLabel6 = new javax.swing.JLabel();
jButton5 = new javax.swing.JButton();
tf_ModificarCampo = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jPanel14 = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
cb_EliminarCampos = new javax.swing.JComboBox<>();
jButton4 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jTabbedPane2 = new javax.swing.JTabbedPane();
jPanel6 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
tf_nombreRegistro = new javax.swing.JTextField();
jButton6 = new javax.swing.JButton();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
tf_numeroRegistros = new javax.swing.JTextField();
jButton7 = new javax.swing.JButton();
jPanel10 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
TA_listarRegistros = new javax.swing.JTextArea();
jPanel9 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
cb_eliminarRegistro = new javax.swing.JComboBox<>();
jButton8 = new javax.swing.JButton();
jPanel7 = new javax.swing.JPanel();
jPanel8 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
LLenarRegistros = new javax.swing.JDialog();
cb_registrosLLenar = new javax.swing.JComboBox<>();
jLabel1 = new javax.swing.JLabel();
cb_camposLLenar = new javax.swing.JComboBox<>();
jLabel2 = new javax.swing.JLabel();
tf_llenarCampo = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
ta_listaCampos = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
TabPrincipal = new javax.swing.JTabbedPane();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem5 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem4 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem6 = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenu4.setText("File");
jMenuBar2.add(jMenu4);
jMenu5.setText("Edit");
jMenuBar2.add(jMenu5);
jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel5.setText("Nombre del Campo: ");
jButton3.setText("Guardar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
jPanel11.setLayout(jPanel11Layout);
jPanel11Layout.setHorizontalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(tf_nombreCampo, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton3)
.addContainerGap(473, Short.MAX_VALUE))
);
jPanel11Layout.setVerticalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(tf_nombreCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3))
.addContainerGap(393, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Crear Campos", jPanel11);
Tabla_campos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null},
{null},
{null},
{null}
},
new String [] {
"Campos"
}
));
jScrollPane2.setViewportView(Tabla_campos);
javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
jPanel12.setLayout(jPanel12Layout);
jPanel12Layout.setHorizontalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 581, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(203, Short.MAX_VALUE))
);
jPanel12Layout.setVerticalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(302, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Listar Campos", jPanel12);
jLabel6.setText("Seleccione campo a modificar: ");
jButton5.setText("Modificar");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jLabel8.setText("Ingrese Nuevo Nombre");
javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
jPanel13.setLayout(jPanel13Layout);
jPanel13Layout.setHorizontalGroup(
jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addGap(25, 25, 25)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(jLabel8))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton5)
.addComponent(cb_modificarCampo, 0, 167, Short.MAX_VALUE)
.addComponent(tf_ModificarCampo, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap(438, Short.MAX_VALUE))
);
jPanel13Layout.setVerticalGroup(
jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cb_modificarCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addGap(26, 26, 26)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tf_ModificarCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8))
.addGap(18, 18, 18)
.addComponent(jButton5)
.addContainerGap(292, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Modificar Campos", jPanel13);
jLabel7.setText("Seleccione Campo a eliminar: ");
jButton4.setText("Eliminar");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
jPanel14.setLayout(jPanel14Layout);
jPanel14Layout.setHorizontalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel14Layout.createSequentialGroup()
.addGap(25, 25, 25)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton4)
.addComponent(cb_EliminarCampos, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(461, Short.MAX_VALUE))
);
jPanel14Layout.setVerticalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel14Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(cb_EliminarCampos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jButton4)
.addContainerGap(344, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Eliminar Campos", jPanel14);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane3)
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane3)
.addContainerGap())
);
jTabbedPane1.addTab("Campos", jPanel3);
jLabel4.setText("Tipo del Registro: ");
jButton6.setText("Guardar");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jLabel10.setText("Ingrese Numero de Registros que desea crear: ");
jButton7.setText("Crear Registros");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton6)
.addComponent(tf_nombreRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel10)
.addGap(18, 18, 18)
.addComponent(tf_numeroRegistros, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(279, 279, 279))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(tf_nombreRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton6)
.addGap(5, 5, 5)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(tf_numeroRegistros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton7))
.addGap(323, 323, 323)
.addComponent(jLabel9)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane2.addTab("Introducir Registros", jPanel6);
TA_listarRegistros.setColumns(20);
TA_listarRegistros.setRows(5);
jScrollPane3.setViewportView(TA_listarRegistros);
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 766, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(18, Short.MAX_VALUE))
);
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addGap(27, 27, 27)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 381, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(19, Short.MAX_VALUE))
);
jTabbedPane2.addTab("Listar Registros", jPanel10);
jLabel11.setText("Eliminar Registro: ");
jButton8.setText("Eliminar");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton8)
.addComponent(cb_eliminarRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, 337, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(351, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(cb_eliminarRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addComponent(jButton8)
.addContainerGap(325, Short.MAX_VALUE))
);
jTabbedPane2.addTab("Borrar Registros", jPanel9);
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jTabbedPane2.addTab("Modificar Registros", jPanel7);
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jTabbedPane2.addTab("Buscar Registro", jPanel8);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane2)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane2)
.addContainerGap())
);
jTabbedPane1.addTab("Registros", jPanel1);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 819, Short.MAX_VALUE)
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 477, Short.MAX_VALUE)
);
jTabbedPane1.addTab("Indices", jPanel4);
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 819, Short.MAX_VALUE)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 477, Short.MAX_VALUE)
);
jTabbedPane1.addTab("Estandarizacion", jPanel5);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1)
.addContainerGap())
);
cb_registrosLLenar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cb_registrosLLenarActionPerformed(evt);
}
});
jLabel1.setText("Seleccione Registro: ");
jLabel2.setText("Seleccione campo del registro: ");
jLabel3.setText("LLene su campo: ");
jButton2.setText("Guardar");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
ta_listaCampos.setColumns(20);
ta_listaCampos.setRows(5);
jScrollPane1.setViewportView(ta_listaCampos);
jButton1.setText("Listar Campos");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout LLenarRegistrosLayout = new javax.swing.GroupLayout(LLenarRegistros.getContentPane());
LLenarRegistros.getContentPane().setLayout(LLenarRegistrosLayout);
LLenarRegistrosLayout.setHorizontalGroup(
LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(LLenarRegistrosLayout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel3))
.addGap(26, 26, 26)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
.addComponent(tf_llenarCampo)
.addComponent(cb_camposLLenar, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cb_registrosLLenar, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(62, 62, 62)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 423, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(34, Short.MAX_VALUE))
);
LLenarRegistrosLayout.setVerticalGroup(
LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(LLenarRegistrosLayout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(LLenarRegistrosLayout.createSequentialGroup()
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cb_registrosLLenar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addGap(37, 37, 37)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cb_camposLLenar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(39, 39, 39)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tf_llenarCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(38, 38, 38)
.addComponent(jButton2)
.addGap(39, 39, 39)
.addComponent(jButton1))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 472, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(35, Short.MAX_VALUE))
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jMenu1.setText("Archivo");
jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem1.setText("Nuevo Archivo");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem1);
jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem5.setText("Cargar Archivo");
jMenuItem5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jMenuItem5MouseClicked(evt);
}
});
jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem5ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem5);
jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem2.setText("Salvar Archivo");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem2);
jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem3.setText("Cerrar Archivo");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem3);
jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem4.setText("Salir");
jMenu1.add(jMenuItem4);
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
jMenu2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu2ActionPerformed(evt);
}
});
jMenuItem6.setText("LLenar Registros");
jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem6ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem6);
jMenuBar1.add(jMenu2);
jMenu3.setText("About...");
jMenuBar1.add(jMenu3);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(TabPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 848, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(TabPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 491, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
FileWriter file = null;
PrintWriter pw;
String n="";
try {
file = new FileWriter(jPanel2.getName()+".txt");
pw = new PrintWriter(file);
for (int i = 0; i < archivo.getRegistros().size(); i++) {
n+= archivo.getRegistro(i).getNombre()+"|";
for (int j = 0; j < archivo.getRegistros().get(i).getCampos().size(); j++) {
n+=archivo.getRegistros().get(i).getCampo(j).getNombre()+"-";
}
}
pw.println(n);
} catch (IOException ex) {
}finally {
try {
if (null != file)
file.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
}//GEN-LAST:event_jMenuItem2ActionPerformed
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
archivo = new Archivo();
JPanel p = new JPanel();
TabPrincipal.removeAll();
}//GEN-LAST:event_jMenuItem3ActionPerformed
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
JPanel p = new JPanel();
String nombre;
p= jPanel2;
nombre = JOptionPane.showInputDialog(null, "Ingrese Nombre: ");
p.setName(nombre);
Component add = TabPrincipal.add(p);
}//GEN-LAST:event_jMenuItem1ActionPerformed
private void jMenuItem5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem5MouseClicked
}//GEN-LAST:event_jMenuItem5MouseClicked
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
// TODO add your handling code here:
String texto = JOptionPane.showInputDialog(null, "Ingrese nombre del archivo: ");
try{
BufferedReader bf = new BufferedReader(new FileReader(texto));
String temp="";
String bfRead;
while((bfRead = bf.readLine()) != null){
temp = temp + bfRead;
}
bf.close();
String acum = "";
Registro raiz=new Registro();
int acum1=-1;
for (int i = 0; i < temp.length(); i++) {
switch (temp.charAt(i)) {
case '|':
raiz=new Registro(acum);
archivo.getRegistros().add(raiz);
acum="";
acum1++;
break;
case '-':
archivo.getRegistros().get(acum1).getCampos().add(new Campo(acum));
acum="";
break;
default:
acum+=temp.charAt(i);
break;
}
}
}catch(Exception e){
//System.out.println("No se encontro el archivo");
}
for (int i = 0; i < archivo.getRegistros().size(); i++) {
System.out.println(archivo.getRegistros().get(i).getNombre());
for (int j = 0; j < archivo.getRegistros().get(i).getCampos().size(); j++) {
System.out.println(archivo.getRegistros().get(i).getCampos().get(j).getNombre());
}
}
}//GEN-LAST:event_jMenuItem5ActionPerformed
private void cb_registrosLLenarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cb_registrosLLenarActionPerformed
DefaultComboBoxModel cb = new DefaultComboBoxModel();
int n = cb_registrosLLenar.getSelectedIndex();
for (Campo C : archivo.getRegistros().get(n).getCampos()) {
cb.addElement(C);
}
cb_camposLLenar.setModel(cb);
}//GEN-LAST:event_cb_registrosLLenarActionPerformed
private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed
}//GEN-LAST:event_jMenu2ActionPerformed
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
LLenarRegistros.setModal(true);
LLenarRegistros.pack();
LLenarRegistros.setLocationRelativeTo(this);
LLenarRegistros.setVisible(true);
DefaultComboBoxModel cb = new DefaultComboBoxModel();
for (Registro t : archivo.getRegistros()) {
cb.addElement(t);
}
cb_registrosLLenar.setModel(cb);
}//GEN-LAST:event_jMenuItem6ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
String contenido;
int n1, n2;
contenido = tf_llenarCampo.getText();
n1 = cb_registrosLLenar.getSelectedIndex();
n2 = cb_camposLLenar.getSelectedIndex();
archivo.getRegistro(n1).getCampo(n2).setContenido(contenido);
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String n="";
for (int i = 0; i < archivo.getRegistros().size(); i++) {
n+= "Nombre Registro : "+archivo.getRegistros().get(i).getNombre()+"\n";
n+= "Campos de Registro:"+"\n";
for (int j = 0; j < archivo.getRegistros().get(i).getCampos().size(); j++) {
n+= archivo.getRegistros().get(i).getCampos().get(j).getNombre()+": "+archivo.getRegistros().get(i).getCampos().get(j).getContenido();
}
n+= "\n";
}
ta_listaCampos.setText(n);
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
String Nombre;
Campo m = new Campo();
Nombre = tf_nombreCampo.getText();
m.setNombre(Nombre);
campos.add(m);
tf_nombreCampo.setText("");
Tabla_campos.setModel(new javax.swing.table.DefaultTableModel(
new Object[][]{},
new String[]{
"Nombre"
}
));
DefaultTableModel modelo = (DefaultTableModel) Tabla_campos.getModel();
for (int i = 0; i < campos.size(); i++) {
Object[] row = {
campos.get(i).getNombre(),
};
modelo.addRow(row);
}
Tabla_campos.setModel(modelo);
DefaultComboBoxModel cb = new DefaultComboBoxModel();
for (Campo t : campos) {
cb.addElement(t);
}
cb_modificarCampo.setModel(cb);
cb_EliminarCampos.setModel(cb);
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
String campo;
campo = tf_ModificarCampo.getText();
campos.get(cb_modificarCampo.getSelectedIndex()).setNombre(campo);
tf_ModificarCampo.setText("");
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
campos.remove(cb_EliminarCampos.getSelectedIndex());
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
String nombre;
nombre = tf_nombreRegistro.getText();
archivo.setNombre(nombre);
tf_nombreRegistro.setText("");
tf_nombreRegistro.disable();
}//GEN-LAST:event_jButton6ActionPerformed
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
int num;
num = Integer.parseInt(tf_numeroRegistros.getText());
String aux;
String aux2 = "";
for (int i = 0; i < num; i++) {
Registro r = new Registro();
r.setCampos(campos);
for (int j = 0; j < r.getCampos().size(); j++) {
aux = JOptionPane.showInputDialog("Ingrese "+r.getCampos().get(j).getNombre()+": ");
r.getCampos().get(j).setContenido(aux);
aux2+=i+"-)"+r.getCampos().get(j).getNombre()+": "+aux+"\n";
}
registrosAux.add(r);
}
/*for (int i = 0; i < registrosAux.size(); i++) {
for (int j = 0; j < registrosAux.get(i).getCampos().size(); j++) {
TA_listarRegistros.setText(j+"-)"+registrosAux.get(i).getCampos().get(j).getNombre()+": "+registrosAux.get(i).getCampos().get(j).getContenido()+"\n");
}
}
*/
TA_listarRegistros.setText(aux2);
DefaultComboBoxModel cb = new DefaultComboBoxModel();
for (Registro t : registrosAux) {
cb.addElement(t);
}
cb_eliminarRegistro.setModel(cb);
}//GEN-LAST:event_jButton7ActionPerformed
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
registrosAux.remove(cb_eliminarRegistro.getSelectedIndex());
}//GEN-LAST:event_jButton8ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Main().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JDialog LLenarRegistros;
private javax.swing.JTextArea TA_listarRegistros;
private javax.swing.JTabbedPane TabPrincipal;
private javax.swing.JTable Tabla_campos;
private javax.swing.JComboBox<String> cb_EliminarCampos;
private javax.swing.JComboBox<String> cb_camposLLenar;
private javax.swing.JComboBox<String> cb_eliminarRegistro;
private javax.swing.JComboBox<String> cb_modificarCampo;
private javax.swing.JComboBox<Object> cb_registrosLLenar;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuBar jMenuBar2;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JMenuItem jMenuItem5;
private javax.swing.JMenuItem jMenuItem6;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTabbedPane jTabbedPane2;
private javax.swing.JTabbedPane jTabbedPane3;
private javax.swing.JTextArea ta_listaCampos;
private javax.swing.JTextField tf_ModificarCampo;
private javax.swing.JTextField tf_llenarCampo;
private javax.swing.JTextField tf_nombreCampo;
private javax.swing.JTextField tf_nombreRegistro;
private javax.swing.JTextField tf_numeroRegistros;
// End of variables declaration//GEN-END:variables
Archivo archivo= new Archivo();
DefaultMutableTreeNode nodo_registro = new DefaultMutableTreeNode("Registros");
DefaultMutableTreeNode nodo_campo = new DefaultMutableTreeNode("campo");
ArrayList <Campo> campos = new ArrayList();
ArrayList<Registro> registrosAux = new ArrayList();
}
|
UTF-8
|
Java
| 48,177 |
java
|
Main.java
|
Java
|
[
{
"context": " jdk.jfr.events.FileWriteEvent;\n\n/**\n *\n * @author Jahaziel\n */\npublic class Main extends javax.swing.JFrame ",
"end": 801,
"score": 0.9997866749763489,
"start": 793,
"tag": "NAME",
"value": "Jahaziel"
}
] | 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 estructuradatos2proyecto;
import java.awt.Component;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import jdk.jfr.events.FileWriteEvent;
/**
*
* @author Jahaziel
*/
public class Main extends javax.swing.JFrame {
/**
* Creates new form Main
*/
public Main() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jMenuBar2 = new javax.swing.JMenuBar();
jMenu4 = new javax.swing.JMenu();
jMenu5 = new javax.swing.JMenu();
jPanel2 = new javax.swing.JPanel();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel3 = new javax.swing.JPanel();
jTabbedPane3 = new javax.swing.JTabbedPane();
jPanel11 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
tf_nombreCampo = new javax.swing.JTextField();
jButton3 = new javax.swing.JButton();
jPanel12 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
Tabla_campos = new javax.swing.JTable();
jPanel13 = new javax.swing.JPanel();
cb_modificarCampo = new javax.swing.JComboBox<>();
jLabel6 = new javax.swing.JLabel();
jButton5 = new javax.swing.JButton();
tf_ModificarCampo = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jPanel14 = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
cb_EliminarCampos = new javax.swing.JComboBox<>();
jButton4 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jTabbedPane2 = new javax.swing.JTabbedPane();
jPanel6 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
tf_nombreRegistro = new javax.swing.JTextField();
jButton6 = new javax.swing.JButton();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
tf_numeroRegistros = new javax.swing.JTextField();
jButton7 = new javax.swing.JButton();
jPanel10 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
TA_listarRegistros = new javax.swing.JTextArea();
jPanel9 = new javax.swing.JPanel();
jLabel11 = new javax.swing.JLabel();
cb_eliminarRegistro = new javax.swing.JComboBox<>();
jButton8 = new javax.swing.JButton();
jPanel7 = new javax.swing.JPanel();
jPanel8 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
LLenarRegistros = new javax.swing.JDialog();
cb_registrosLLenar = new javax.swing.JComboBox<>();
jLabel1 = new javax.swing.JLabel();
cb_camposLLenar = new javax.swing.JComboBox<>();
jLabel2 = new javax.swing.JLabel();
tf_llenarCampo = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
ta_listaCampos = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
TabPrincipal = new javax.swing.JTabbedPane();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem5 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem4 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem6 = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenu4.setText("File");
jMenuBar2.add(jMenu4);
jMenu5.setText("Edit");
jMenuBar2.add(jMenu5);
jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel5.setText("Nombre del Campo: ");
jButton3.setText("Guardar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
jPanel11.setLayout(jPanel11Layout);
jPanel11Layout.setHorizontalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(tf_nombreCampo, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton3)
.addContainerGap(473, Short.MAX_VALUE))
);
jPanel11Layout.setVerticalGroup(
jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel11Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(tf_nombreCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3))
.addContainerGap(393, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Crear Campos", jPanel11);
Tabla_campos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null},
{null},
{null},
{null}
},
new String [] {
"Campos"
}
));
jScrollPane2.setViewportView(Tabla_campos);
javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
jPanel12.setLayout(jPanel12Layout);
jPanel12Layout.setHorizontalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 581, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(203, Short.MAX_VALUE))
);
jPanel12Layout.setVerticalGroup(
jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel12Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(302, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Listar Campos", jPanel12);
jLabel6.setText("Seleccione campo a modificar: ");
jButton5.setText("Modificar");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jLabel8.setText("Ingrese Nuevo Nombre");
javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
jPanel13.setLayout(jPanel13Layout);
jPanel13Layout.setHorizontalGroup(
jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addGap(25, 25, 25)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(jLabel8))
.addGap(18, 18, 18)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton5)
.addComponent(cb_modificarCampo, 0, 167, Short.MAX_VALUE)
.addComponent(tf_ModificarCampo, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap(438, Short.MAX_VALUE))
);
jPanel13Layout.setVerticalGroup(
jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel13Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cb_modificarCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addGap(26, 26, 26)
.addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tf_ModificarCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8))
.addGap(18, 18, 18)
.addComponent(jButton5)
.addContainerGap(292, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Modificar Campos", jPanel13);
jLabel7.setText("Seleccione Campo a eliminar: ");
jButton4.setText("Eliminar");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
jPanel14.setLayout(jPanel14Layout);
jPanel14Layout.setHorizontalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel14Layout.createSequentialGroup()
.addGap(25, 25, 25)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton4)
.addComponent(cb_EliminarCampos, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(461, Short.MAX_VALUE))
);
jPanel14Layout.setVerticalGroup(
jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel14Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(cb_EliminarCampos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jButton4)
.addContainerGap(344, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Eliminar Campos", jPanel14);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane3)
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane3)
.addContainerGap())
);
jTabbedPane1.addTab("Campos", jPanel3);
jLabel4.setText("Tipo del Registro: ");
jButton6.setText("Guardar");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jLabel10.setText("Ingrese Numero de Registros que desea crear: ");
jButton7.setText("Crear Registros");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton6)
.addComponent(tf_nombreRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel10)
.addGap(18, 18, 18)
.addComponent(tf_numeroRegistros, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(279, 279, 279))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(tf_nombreRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton6)
.addGap(5, 5, 5)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(tf_numeroRegistros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton7))
.addGap(323, 323, 323)
.addComponent(jLabel9)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane2.addTab("Introducir Registros", jPanel6);
TA_listarRegistros.setColumns(20);
TA_listarRegistros.setRows(5);
jScrollPane3.setViewportView(TA_listarRegistros);
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 766, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(18, Short.MAX_VALUE))
);
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addGap(27, 27, 27)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 381, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(19, Short.MAX_VALUE))
);
jTabbedPane2.addTab("Listar Registros", jPanel10);
jLabel11.setText("Eliminar Registro: ");
jButton8.setText("Eliminar");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton8)
.addComponent(cb_eliminarRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, 337, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(351, Short.MAX_VALUE))
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel9Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(cb_eliminarRegistro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addComponent(jButton8)
.addContainerGap(325, Short.MAX_VALUE))
);
jTabbedPane2.addTab("Borrar Registros", jPanel9);
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jTabbedPane2.addTab("Modificar Registros", jPanel7);
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jTabbedPane2.addTab("Buscar Registro", jPanel8);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane2)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane2)
.addContainerGap())
);
jTabbedPane1.addTab("Registros", jPanel1);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 819, Short.MAX_VALUE)
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 477, Short.MAX_VALUE)
);
jTabbedPane1.addTab("Indices", jPanel4);
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 819, Short.MAX_VALUE)
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 477, Short.MAX_VALUE)
);
jTabbedPane1.addTab("Estandarizacion", jPanel5);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1)
.addContainerGap())
);
cb_registrosLLenar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cb_registrosLLenarActionPerformed(evt);
}
});
jLabel1.setText("Seleccione Registro: ");
jLabel2.setText("Seleccione campo del registro: ");
jLabel3.setText("LLene su campo: ");
jButton2.setText("Guardar");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
ta_listaCampos.setColumns(20);
ta_listaCampos.setRows(5);
jScrollPane1.setViewportView(ta_listaCampos);
jButton1.setText("Listar Campos");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout LLenarRegistrosLayout = new javax.swing.GroupLayout(LLenarRegistros.getContentPane());
LLenarRegistros.getContentPane().setLayout(LLenarRegistrosLayout);
LLenarRegistrosLayout.setHorizontalGroup(
LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(LLenarRegistrosLayout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel3))
.addGap(26, 26, 26)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
.addComponent(tf_llenarCampo)
.addComponent(cb_camposLLenar, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cb_registrosLLenar, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(62, 62, 62)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 423, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(34, Short.MAX_VALUE))
);
LLenarRegistrosLayout.setVerticalGroup(
LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(LLenarRegistrosLayout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(LLenarRegistrosLayout.createSequentialGroup()
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cb_registrosLLenar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addGap(37, 37, 37)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cb_camposLLenar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGap(39, 39, 39)
.addGroup(LLenarRegistrosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tf_llenarCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(38, 38, 38)
.addComponent(jButton2)
.addGap(39, 39, 39)
.addComponent(jButton1))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 472, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(35, Short.MAX_VALUE))
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jMenu1.setText("Archivo");
jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem1.setText("Nuevo Archivo");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem1);
jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem5.setText("Cargar Archivo");
jMenuItem5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jMenuItem5MouseClicked(evt);
}
});
jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem5ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem5);
jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem2.setText("Salvar Archivo");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem2);
jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem3.setText("Cerrar Archivo");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem3);
jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
jMenuItem4.setText("Salir");
jMenu1.add(jMenuItem4);
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
jMenu2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu2ActionPerformed(evt);
}
});
jMenuItem6.setText("LLenar Registros");
jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem6ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem6);
jMenuBar1.add(jMenu2);
jMenu3.setText("About...");
jMenuBar1.add(jMenu3);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(TabPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 848, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(TabPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 491, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
FileWriter file = null;
PrintWriter pw;
String n="";
try {
file = new FileWriter(jPanel2.getName()+".txt");
pw = new PrintWriter(file);
for (int i = 0; i < archivo.getRegistros().size(); i++) {
n+= archivo.getRegistro(i).getNombre()+"|";
for (int j = 0; j < archivo.getRegistros().get(i).getCampos().size(); j++) {
n+=archivo.getRegistros().get(i).getCampo(j).getNombre()+"-";
}
}
pw.println(n);
} catch (IOException ex) {
}finally {
try {
if (null != file)
file.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
}//GEN-LAST:event_jMenuItem2ActionPerformed
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
archivo = new Archivo();
JPanel p = new JPanel();
TabPrincipal.removeAll();
}//GEN-LAST:event_jMenuItem3ActionPerformed
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
JPanel p = new JPanel();
String nombre;
p= jPanel2;
nombre = JOptionPane.showInputDialog(null, "Ingrese Nombre: ");
p.setName(nombre);
Component add = TabPrincipal.add(p);
}//GEN-LAST:event_jMenuItem1ActionPerformed
private void jMenuItem5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem5MouseClicked
}//GEN-LAST:event_jMenuItem5MouseClicked
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
// TODO add your handling code here:
String texto = JOptionPane.showInputDialog(null, "Ingrese nombre del archivo: ");
try{
BufferedReader bf = new BufferedReader(new FileReader(texto));
String temp="";
String bfRead;
while((bfRead = bf.readLine()) != null){
temp = temp + bfRead;
}
bf.close();
String acum = "";
Registro raiz=new Registro();
int acum1=-1;
for (int i = 0; i < temp.length(); i++) {
switch (temp.charAt(i)) {
case '|':
raiz=new Registro(acum);
archivo.getRegistros().add(raiz);
acum="";
acum1++;
break;
case '-':
archivo.getRegistros().get(acum1).getCampos().add(new Campo(acum));
acum="";
break;
default:
acum+=temp.charAt(i);
break;
}
}
}catch(Exception e){
//System.out.println("No se encontro el archivo");
}
for (int i = 0; i < archivo.getRegistros().size(); i++) {
System.out.println(archivo.getRegistros().get(i).getNombre());
for (int j = 0; j < archivo.getRegistros().get(i).getCampos().size(); j++) {
System.out.println(archivo.getRegistros().get(i).getCampos().get(j).getNombre());
}
}
}//GEN-LAST:event_jMenuItem5ActionPerformed
private void cb_registrosLLenarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cb_registrosLLenarActionPerformed
DefaultComboBoxModel cb = new DefaultComboBoxModel();
int n = cb_registrosLLenar.getSelectedIndex();
for (Campo C : archivo.getRegistros().get(n).getCampos()) {
cb.addElement(C);
}
cb_camposLLenar.setModel(cb);
}//GEN-LAST:event_cb_registrosLLenarActionPerformed
private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed
}//GEN-LAST:event_jMenu2ActionPerformed
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
LLenarRegistros.setModal(true);
LLenarRegistros.pack();
LLenarRegistros.setLocationRelativeTo(this);
LLenarRegistros.setVisible(true);
DefaultComboBoxModel cb = new DefaultComboBoxModel();
for (Registro t : archivo.getRegistros()) {
cb.addElement(t);
}
cb_registrosLLenar.setModel(cb);
}//GEN-LAST:event_jMenuItem6ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
String contenido;
int n1, n2;
contenido = tf_llenarCampo.getText();
n1 = cb_registrosLLenar.getSelectedIndex();
n2 = cb_camposLLenar.getSelectedIndex();
archivo.getRegistro(n1).getCampo(n2).setContenido(contenido);
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String n="";
for (int i = 0; i < archivo.getRegistros().size(); i++) {
n+= "Nombre Registro : "+archivo.getRegistros().get(i).getNombre()+"\n";
n+= "Campos de Registro:"+"\n";
for (int j = 0; j < archivo.getRegistros().get(i).getCampos().size(); j++) {
n+= archivo.getRegistros().get(i).getCampos().get(j).getNombre()+": "+archivo.getRegistros().get(i).getCampos().get(j).getContenido();
}
n+= "\n";
}
ta_listaCampos.setText(n);
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
String Nombre;
Campo m = new Campo();
Nombre = tf_nombreCampo.getText();
m.setNombre(Nombre);
campos.add(m);
tf_nombreCampo.setText("");
Tabla_campos.setModel(new javax.swing.table.DefaultTableModel(
new Object[][]{},
new String[]{
"Nombre"
}
));
DefaultTableModel modelo = (DefaultTableModel) Tabla_campos.getModel();
for (int i = 0; i < campos.size(); i++) {
Object[] row = {
campos.get(i).getNombre(),
};
modelo.addRow(row);
}
Tabla_campos.setModel(modelo);
DefaultComboBoxModel cb = new DefaultComboBoxModel();
for (Campo t : campos) {
cb.addElement(t);
}
cb_modificarCampo.setModel(cb);
cb_EliminarCampos.setModel(cb);
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
String campo;
campo = tf_ModificarCampo.getText();
campos.get(cb_modificarCampo.getSelectedIndex()).setNombre(campo);
tf_ModificarCampo.setText("");
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
campos.remove(cb_EliminarCampos.getSelectedIndex());
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
String nombre;
nombre = tf_nombreRegistro.getText();
archivo.setNombre(nombre);
tf_nombreRegistro.setText("");
tf_nombreRegistro.disable();
}//GEN-LAST:event_jButton6ActionPerformed
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
int num;
num = Integer.parseInt(tf_numeroRegistros.getText());
String aux;
String aux2 = "";
for (int i = 0; i < num; i++) {
Registro r = new Registro();
r.setCampos(campos);
for (int j = 0; j < r.getCampos().size(); j++) {
aux = JOptionPane.showInputDialog("Ingrese "+r.getCampos().get(j).getNombre()+": ");
r.getCampos().get(j).setContenido(aux);
aux2+=i+"-)"+r.getCampos().get(j).getNombre()+": "+aux+"\n";
}
registrosAux.add(r);
}
/*for (int i = 0; i < registrosAux.size(); i++) {
for (int j = 0; j < registrosAux.get(i).getCampos().size(); j++) {
TA_listarRegistros.setText(j+"-)"+registrosAux.get(i).getCampos().get(j).getNombre()+": "+registrosAux.get(i).getCampos().get(j).getContenido()+"\n");
}
}
*/
TA_listarRegistros.setText(aux2);
DefaultComboBoxModel cb = new DefaultComboBoxModel();
for (Registro t : registrosAux) {
cb.addElement(t);
}
cb_eliminarRegistro.setModel(cb);
}//GEN-LAST:event_jButton7ActionPerformed
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
registrosAux.remove(cb_eliminarRegistro.getSelectedIndex());
}//GEN-LAST:event_jButton8ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Main().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JDialog LLenarRegistros;
private javax.swing.JTextArea TA_listarRegistros;
private javax.swing.JTabbedPane TabPrincipal;
private javax.swing.JTable Tabla_campos;
private javax.swing.JComboBox<String> cb_EliminarCampos;
private javax.swing.JComboBox<String> cb_camposLLenar;
private javax.swing.JComboBox<String> cb_eliminarRegistro;
private javax.swing.JComboBox<String> cb_modificarCampo;
private javax.swing.JComboBox<Object> cb_registrosLLenar;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuBar jMenuBar2;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JMenuItem jMenuItem5;
private javax.swing.JMenuItem jMenuItem6;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTabbedPane jTabbedPane2;
private javax.swing.JTabbedPane jTabbedPane3;
private javax.swing.JTextArea ta_listaCampos;
private javax.swing.JTextField tf_ModificarCampo;
private javax.swing.JTextField tf_llenarCampo;
private javax.swing.JTextField tf_nombreCampo;
private javax.swing.JTextField tf_nombreRegistro;
private javax.swing.JTextField tf_numeroRegistros;
// End of variables declaration//GEN-END:variables
Archivo archivo= new Archivo();
DefaultMutableTreeNode nodo_registro = new DefaultMutableTreeNode("Registros");
DefaultMutableTreeNode nodo_campo = new DefaultMutableTreeNode("campo");
ArrayList <Campo> campos = new ArrayList();
ArrayList<Registro> registrosAux = new ArrayList();
}
| 48,177 | 0.628661 | 0.610976 | 1,115 | 42.208073 | 34.27713 | 179 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.624215 | false | false |
0
|
ac829ff0ae0773ba116041fed81db4e53d7814c8
| 30,829,275,272,388 |
5a3d2e24875b23f82350f398041e2a0c2981d444
|
/src/crackingleetcode/EvaluateReversePolishNotation_150.java
|
bba5ee4454f1739a5d3285dd16b515c5858ca659
|
[
"MIT"
] |
permissive
|
HaomingChen/LeetCodeNotes
|
https://github.com/HaomingChen/LeetCodeNotes
|
009b2eabd057ff99f5c214b899e9495bea2a25c5
|
498da18a92a4fc5a2d5b6059f634142e6801fb08
|
refs/heads/master
| 2021-08-26T05:41:56.691000 | 2021-08-25T18:28:38 | 2021-08-25T18:28:38 | 124,029,045 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package crackingleetcode;
import java.util.Stack;
/**
* Evaluate the value of an arithmetic expression in Reverse Polish Notation.
* Valid operators are +, -, *, /. Each operand may be an integer or another expression.
*
* @author Haoming Chen
* Created on 2019/12/28
*/
public class EvaluateReversePolishNotation_150 {
public static void main(String[] args) {
// String[] arr = new String[]{"10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"};
String[] arr = new String[]{"22"};
System.out.println(evalRPN(arr));
}
public static int evalRPN(String[] tokens) {
if (tokens == null || tokens.length == 0) {
return 0;
}
Stack<String> stk = new Stack<>();
for (int i = 0; i < tokens.length; i++) {
int res;
if (tokens[i].equals("+")) {
res = Integer.parseInt(stk.pop()) + Integer.parseInt(stk.pop());
} else if (tokens[i].equals("-")) {
res = -Integer.parseInt(stk.pop()) + Integer.parseInt(stk.pop());
} else if (tokens[i].equals("*")) {
res = Integer.parseInt(stk.pop()) * Integer.parseInt(stk.pop());
} else if (tokens[i].equals("/")) {
int divisor = Integer.parseInt(stk.pop());
res = Integer.parseInt(stk.pop()) / divisor;
} else {
res = Integer.parseInt(tokens[i]);
}
stk.push(Integer.toString(res));
}
return Integer.parseInt(stk.pop());
}
}
|
UTF-8
|
Java
| 1,564 |
java
|
EvaluateReversePolishNotation_150.java
|
Java
|
[
{
"context": "be an integer or another expression.\n *\n * @author Haoming Chen\n * Created on 2019/12/28\n */\npublic class Evaluat",
"end": 249,
"score": 0.9998305439949036,
"start": 237,
"tag": "NAME",
"value": "Haoming Chen"
}
] | null |
[] |
package crackingleetcode;
import java.util.Stack;
/**
* Evaluate the value of an arithmetic expression in Reverse Polish Notation.
* Valid operators are +, -, *, /. Each operand may be an integer or another expression.
*
* @author <NAME>
* Created on 2019/12/28
*/
public class EvaluateReversePolishNotation_150 {
public static void main(String[] args) {
// String[] arr = new String[]{"10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"};
String[] arr = new String[]{"22"};
System.out.println(evalRPN(arr));
}
public static int evalRPN(String[] tokens) {
if (tokens == null || tokens.length == 0) {
return 0;
}
Stack<String> stk = new Stack<>();
for (int i = 0; i < tokens.length; i++) {
int res;
if (tokens[i].equals("+")) {
res = Integer.parseInt(stk.pop()) + Integer.parseInt(stk.pop());
} else if (tokens[i].equals("-")) {
res = -Integer.parseInt(stk.pop()) + Integer.parseInt(stk.pop());
} else if (tokens[i].equals("*")) {
res = Integer.parseInt(stk.pop()) * Integer.parseInt(stk.pop());
} else if (tokens[i].equals("/")) {
int divisor = Integer.parseInt(stk.pop());
res = Integer.parseInt(stk.pop()) / divisor;
} else {
res = Integer.parseInt(tokens[i]);
}
stk.push(Integer.toString(res));
}
return Integer.parseInt(stk.pop());
}
}
| 1,558 | 0.519821 | 0.503197 | 44 | 34.545456 | 27.842459 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.795455 | false | false |
0
|
c874a0508f01bf34597c884e84c95fc07ecceb3a
| 21,466,246,560,599 |
635162ba17786e6f366f712cb8c31ffb42633554
|
/project/eichong5.0.0/src/com/bm/wanma/dialog/CustomTipInsertGunDialog.java
|
56f9257284410f855b4ee66305da32a2bc9b4dad
|
[] |
no_license
|
macrogoal/wwh.stock
|
https://github.com/macrogoal/wwh.stock
|
19aeed117f57acc1f22f3ed0caf34e481f00eb9c
|
8847a4bc6707dd881ea28133b621cf81431d845b
|
refs/heads/master
| 2020-04-17T05:51:47.771000 | 2018-04-04T06:21:15 | 2018-04-04T06:21:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bm.wanma.dialog;
import com.bm.wanma.R;
import android.app.Dialog;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.BitmapDrawable;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
/**
* @Function: eichong4.0版本通用提示对话框
* @author cm
*/
public class CustomTipInsertGunDialog extends Dialog implements android.view.View.OnClickListener{
private static int default_width = 280; //默认宽度
private static int default_height = 160;//默认高度
public CustomTipInsertGunDialog(Context context,int layout, int style) {
this(context,default_width,default_height,layout,style);
}
public CustomTipInsertGunDialog(Context context,int layout) {
this(context,default_width,default_height,layout,R.style.customCommonDialog);
}
public CustomTipInsertGunDialog(Context context) {
this(context,default_width,default_height,R.layout.dialog_custom_insert_gun,R.style.customCommonDialog);
}
public CustomTipInsertGunDialog(Context context, int width, int height, int layout, int style) {
super(context, style);
//set content
setContentView(layout);
//set window params
Window window = getWindow();
//window.setBackgroundDrawable(new BitmapDrawable());
window.setBackgroundDrawableResource(android.R.color.transparent);
WindowManager.LayoutParams params = window.getAttributes();
//set width,height by density and gravity
DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager wmManager=(WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
wmManager.getDefaultDisplay().getMetrics(displayMetrics);
width = displayMetrics.widthPixels;
height = displayMetrics.heightPixels;
params.width = (int)(width * 0.8);
params.height = (int) (height*0.25);
params.gravity = Gravity.CENTER;
window.setAttributes(params);
findViewById(R.id.custom_positiveButton).setOnClickListener(this);
}
@Override
public void onClick(View v) {
dismiss();
}
}
|
UTF-8
|
Java
| 2,320 |
java
|
CustomTipInsertGunDialog.java
|
Java
|
[
{
"context": ";\n/**\n * @Function: eichong4.0版本通用提示对话框\n * @author cm\n */\npublic class CustomTipInsertGunDialog extends",
"end": 438,
"score": 0.9756047129631042,
"start": 436,
"tag": "USERNAME",
"value": "cm"
}
] | null |
[] |
package com.bm.wanma.dialog;
import com.bm.wanma.R;
import android.app.Dialog;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.BitmapDrawable;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
/**
* @Function: eichong4.0版本通用提示对话框
* @author cm
*/
public class CustomTipInsertGunDialog extends Dialog implements android.view.View.OnClickListener{
private static int default_width = 280; //默认宽度
private static int default_height = 160;//默认高度
public CustomTipInsertGunDialog(Context context,int layout, int style) {
this(context,default_width,default_height,layout,style);
}
public CustomTipInsertGunDialog(Context context,int layout) {
this(context,default_width,default_height,layout,R.style.customCommonDialog);
}
public CustomTipInsertGunDialog(Context context) {
this(context,default_width,default_height,R.layout.dialog_custom_insert_gun,R.style.customCommonDialog);
}
public CustomTipInsertGunDialog(Context context, int width, int height, int layout, int style) {
super(context, style);
//set content
setContentView(layout);
//set window params
Window window = getWindow();
//window.setBackgroundDrawable(new BitmapDrawable());
window.setBackgroundDrawableResource(android.R.color.transparent);
WindowManager.LayoutParams params = window.getAttributes();
//set width,height by density and gravity
DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager wmManager=(WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
wmManager.getDefaultDisplay().getMetrics(displayMetrics);
width = displayMetrics.widthPixels;
height = displayMetrics.heightPixels;
params.width = (int)(width * 0.8);
params.height = (int) (height*0.25);
params.gravity = Gravity.CENTER;
window.setAttributes(params);
findViewById(R.id.custom_positiveButton).setOnClickListener(this);
}
@Override
public void onClick(View v) {
dismiss();
}
}
| 2,320 | 0.71916 | 0.713473 | 62 | 35.887096 | 28.691971 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.032258 | false | false |
0
|
dcec38011ac716ab7bec89029b4917126d09b9e5
| 2,327,872,302,619 |
73e2e0e5f31f237b12c9f1ffa01399a9a9d7422a
|
/contractFalsifier/src/presentacion/Help.java
|
8e725a08f938174d3938f5dd2dcea28a745bc2ef
|
[] |
no_license
|
sof1508/tfg
|
https://github.com/sof1508/tfg
|
7fcbba7b5de13a06a081f825fc8e3d234c8bb08b
|
9a1b0a7f028e8b358f19d80f9199489f2a4a4bc3
|
refs/heads/master
| 2023-06-05T02:22:22.465000 | 2020-09-07T15:30:17 | 2020-09-07T15:30:17 | 281,786,603 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package presentacion;
import java.util.concurrent.Callable;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
@Command(
name = "ayuda",
description = "si necesita alguna ayuda para ejecutar esta herraienta"
)
public class Help implements Callable<String> {
public static void main(String[] args) throws Exception {
int exitCode = new CommandLine(new Help()).execute(args);
System.exit(exitCode);
}
@Option(names = {"-h", "--help"}, description = "Ayuda")
@Override
public String call() throws Exception {
// LLAMAR LOGICA
return "hola ayuda";
}
}
|
UTF-8
|
Java
| 636 |
java
|
Help.java
|
Java
|
[] | null |
[] |
package presentacion;
import java.util.concurrent.Callable;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
@Command(
name = "ayuda",
description = "si necesita alguna ayuda para ejecutar esta herraienta"
)
public class Help implements Callable<String> {
public static void main(String[] args) throws Exception {
int exitCode = new CommandLine(new Help()).execute(args);
System.exit(exitCode);
}
@Option(names = {"-h", "--help"}, description = "Ayuda")
@Override
public String call() throws Exception {
// LLAMAR LOGICA
return "hola ayuda";
}
}
| 636 | 0.712264 | 0.712264 | 31 | 19.516129 | 21.445913 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.032258 | false | false |
0
|
f972abd340dd409029d3de0161203577d12f6aef
| 24,790,551,261,461 |
ea930c7fd26ac2f575f484a072fc9f089d329bab
|
/app/src/main/java/bnz8/uw/tacoma/edu/caloriemeter/MainActivity.java
|
2c8dc58dd37d68ac6afc3de427ace03a0b91ef8b
|
[] |
no_license
|
meigsj/TCSS450_Project
|
https://github.com/meigsj/TCSS450_Project
|
e116de0adf8c969c92c710aac350bf1649a9e37b
|
1310dfdb810d9bf5c20da1f5d4576a88ccbfc0d8
|
refs/heads/master
| 2021-01-19T09:48:40.738000 | 2017-02-16T04:41:31 | 2017-02-16T04:41:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package bnz8.uw.tacoma.edu.caloriemeter;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import static android.R.attr.password;
public class MainActivity extends AppCompatActivity implements SignInFragment.LoginInteractionListener {
private Intent mIntent;
private static final String REG_URL = "http://cssgate.insttech.washington.edu/~bnz8/adduser.php?";
private static final String LOGIN_URL = "http://cssgate.insttech.washington.edu/~bnz8/login.php?";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container, new SignInFragment())
.commit();
}
@Override
public void login(String userId, String pwd) {
ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected() && credentialCheck(userId,pwd)) {
mIntent = new Intent(this, HomeActivity.class);
RegisteryTask task = new RegisteryTask();
task.execute(buildString(userId, pwd, LOGIN_URL));
} else {
Toast.makeText(this, "No network connection available. Cannot provide services",
Toast.LENGTH_LONG).show();
}
// Intent i = new Intent(this, HomeActivity.class);
// startActivity(i);
// finish();
}
public void register(String e, String pw){
ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected() && credentialCheck(e,pw)) {
mIntent = new Intent(this, HomeActivity.class);
RegisteryTask task = new RegisteryTask();
task.execute(buildString(e, pw, REG_URL));
} else {
Toast.makeText(this, "No network connection available. Cannot provide services",
Toast.LENGTH_LONG).show();
}
}
public void switchToSignUpFragment() {
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
new RegisterFragment()).addToBackStack(null).commit();
}
private boolean credentialCheck(String email, String password) {
boolean result = true;
if (TextUtils.isEmpty(email)) {
Toast.makeText(this, "Please enter your email.", Toast.LENGTH_LONG).show();
result = false;
} else if (!email.contains("@")) {
Toast.makeText(this, "Please enter a valid email.", Toast.LENGTH_LONG).show();
result = false;
} else if (email.length() > 40) {
Toast.makeText(this, "Please enter a valid email (less than fourty characters).",
Toast.LENGTH_LONG).show();
result = false;
} else if (TextUtils.isEmpty(password)) {
Toast.makeText(this, "Please enter your password.", Toast.LENGTH_LONG).show();
result = false;
} else if (password.length() > 20) {
Toast.makeText(this, "Please enter a valid password (less than twenty characters).",
Toast.LENGTH_LONG).show();
result = false;
} else if (password.length() < 6) {
Toast.makeText(this, "Please enter a valid password (more than six characters).",
Toast.LENGTH_LONG).show();
result = false;
}
return result;
}
private String buildString(String email, String password, String url) {
StringBuilder stringBuilder = new StringBuilder(url);
try {
stringBuilder.append("email=");
stringBuilder.append(URLEncoder.encode(email, "UTF-8"));
stringBuilder.append("&pwd=");
stringBuilder.append(URLEncoder.encode(password, "UTF-8"));
} catch (UnsupportedEncodingException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
return stringBuilder.toString();
}
private class RegisteryTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
String response = "";
HttpURLConnection urlConnection = null;
for (String url : urls) {
try {
URL urlObject = new URL(url);
urlConnection = (HttpURLConnection) urlObject.openConnection();
InputStream content = urlConnection.getInputStream();
BufferedReader buffer = new BufferedReader(new InputStreamReader(content));
String s = "";
while ((s = buffer.readLine()) != null) {
response += s;
}
} catch (Exception e) {
response = "Unable to log in, Reason: " + e.getMessage();
} finally {
if (urlConnection != null)
urlConnection.disconnect();
}
}
return response;
}
@Override
protected void onPostExecute(String result) {
// Something wrong with the network or the URL.
try {
JSONObject jsonObject = new JSONObject(result);
String status = (String) jsonObject.get("result");
if (status.equals("success")) {
Toast.makeText(getApplicationContext(), jsonObject.get("message").toString()
, Toast.LENGTH_LONG).show();
startActivity(mIntent);
MainActivity.this.finish();
} else {
Toast.makeText(getApplicationContext(), "Failed! " + jsonObject.get("error")
, Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
Toast.makeText(getApplicationContext(), "Something wrong with the data" +
e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}
}
|
UTF-8
|
Java
| 6,906 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package bnz8.uw.tacoma.edu.caloriemeter;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import static android.R.attr.password;
public class MainActivity extends AppCompatActivity implements SignInFragment.LoginInteractionListener {
private Intent mIntent;
private static final String REG_URL = "http://cssgate.insttech.washington.edu/~bnz8/adduser.php?";
private static final String LOGIN_URL = "http://cssgate.insttech.washington.edu/~bnz8/login.php?";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container, new SignInFragment())
.commit();
}
@Override
public void login(String userId, String pwd) {
ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected() && credentialCheck(userId,pwd)) {
mIntent = new Intent(this, HomeActivity.class);
RegisteryTask task = new RegisteryTask();
task.execute(buildString(userId, pwd, LOGIN_URL));
} else {
Toast.makeText(this, "No network connection available. Cannot provide services",
Toast.LENGTH_LONG).show();
}
// Intent i = new Intent(this, HomeActivity.class);
// startActivity(i);
// finish();
}
public void register(String e, String pw){
ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected() && credentialCheck(e,pw)) {
mIntent = new Intent(this, HomeActivity.class);
RegisteryTask task = new RegisteryTask();
task.execute(buildString(e, pw, REG_URL));
} else {
Toast.makeText(this, "No network connection available. Cannot provide services",
Toast.LENGTH_LONG).show();
}
}
public void switchToSignUpFragment() {
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
new RegisterFragment()).addToBackStack(null).commit();
}
private boolean credentialCheck(String email, String password) {
boolean result = true;
if (TextUtils.isEmpty(email)) {
Toast.makeText(this, "Please enter your email.", Toast.LENGTH_LONG).show();
result = false;
} else if (!email.contains("@")) {
Toast.makeText(this, "Please enter a valid email.", Toast.LENGTH_LONG).show();
result = false;
} else if (email.length() > 40) {
Toast.makeText(this, "Please enter a valid email (less than fourty characters).",
Toast.LENGTH_LONG).show();
result = false;
} else if (TextUtils.isEmpty(password)) {
Toast.makeText(this, "Please enter your password.", Toast.LENGTH_LONG).show();
result = false;
} else if (password.length() > 20) {
Toast.makeText(this, "Please enter a valid password (less than twenty characters).",
Toast.LENGTH_LONG).show();
result = false;
} else if (password.length() < 6) {
Toast.makeText(this, "Please enter a valid password (more than six characters).",
Toast.LENGTH_LONG).show();
result = false;
}
return result;
}
private String buildString(String email, String password, String url) {
StringBuilder stringBuilder = new StringBuilder(url);
try {
stringBuilder.append("email=");
stringBuilder.append(URLEncoder.encode(email, "UTF-8"));
stringBuilder.append("&pwd=");
stringBuilder.append(URLEncoder.encode(password, "UTF-8"));
} catch (UnsupportedEncodingException e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
return stringBuilder.toString();
}
private class RegisteryTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
String response = "";
HttpURLConnection urlConnection = null;
for (String url : urls) {
try {
URL urlObject = new URL(url);
urlConnection = (HttpURLConnection) urlObject.openConnection();
InputStream content = urlConnection.getInputStream();
BufferedReader buffer = new BufferedReader(new InputStreamReader(content));
String s = "";
while ((s = buffer.readLine()) != null) {
response += s;
}
} catch (Exception e) {
response = "Unable to log in, Reason: " + e.getMessage();
} finally {
if (urlConnection != null)
urlConnection.disconnect();
}
}
return response;
}
@Override
protected void onPostExecute(String result) {
// Something wrong with the network or the URL.
try {
JSONObject jsonObject = new JSONObject(result);
String status = (String) jsonObject.get("result");
if (status.equals("success")) {
Toast.makeText(getApplicationContext(), jsonObject.get("message").toString()
, Toast.LENGTH_LONG).show();
startActivity(mIntent);
MainActivity.this.finish();
} else {
Toast.makeText(getApplicationContext(), "Failed! " + jsonObject.get("error")
, Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
Toast.makeText(getApplicationContext(), "Something wrong with the data" +
e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}
}
| 6,906 | 0.599768 | 0.598176 | 179 | 37.581005 | 29.897924 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.703911 | false | false |
0
|
0ea47a9e26245310e30a0b3d7063853a54e07702
| 23,398,981,900,256 |
78c305853742830a15168c0e5b1d41d7a87416aa
|
/BIGRWeb/source/com/ardais/bigr/iltds/op/ShippingPrintManifests.java
|
308a140a2fe0bdfd78b7d99476f1a3121705e0f3
|
[] |
no_license
|
bellmit/BIGR
|
https://github.com/bellmit/BIGR
|
84d7fabf25f35388420bf847bdb59afb945a2e8c
|
7c538f9e14a4394f2e7a126bf396881a108302ae
|
refs/heads/master
| 2022-01-27T17:57:08.303000 | 2013-10-03T17:55:22 | 2013-10-03T17:55:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ardais.bigr.iltds.op;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ardais.bigr.iltds.beans.ListGenerator;
import com.ardais.bigr.iltds.beans.ListGeneratorHome;
import com.ardais.bigr.security.SecurityInfo;
import com.ardais.bigr.util.EjbHomes;
import com.ardais.bigr.util.WebUtils;
public class ShippingPrintManifests extends com.ardais.bigr.iltds.op.StandardOperation {
public ShippingPrintManifests(
HttpServletRequest req,
HttpServletResponse res,
ServletContext ctx) {
super(req, res, ctx);
}
public void invoke() throws Exception {
SecurityInfo securityInfo = WebUtils.getSecurityInfo(request);
String userID = securityInfo.getUsername();
ListGeneratorHome home = (ListGeneratorHome) EjbHomes.getHome(ListGeneratorHome.class);
ListGenerator shipment = home.create();
request.setAttribute("waybillList", shipment.findPrintableManifests(userID));
servletCtx.getRequestDispatcher(
"/hiddenJsps/iltds/shipping/shippingPrintManifests.jsp").forward(
request,
response);
}
}
|
UTF-8
|
Java
| 1,155 |
java
|
ShippingPrintManifests.java
|
Java
|
[] | null |
[] |
package com.ardais.bigr.iltds.op;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ardais.bigr.iltds.beans.ListGenerator;
import com.ardais.bigr.iltds.beans.ListGeneratorHome;
import com.ardais.bigr.security.SecurityInfo;
import com.ardais.bigr.util.EjbHomes;
import com.ardais.bigr.util.WebUtils;
public class ShippingPrintManifests extends com.ardais.bigr.iltds.op.StandardOperation {
public ShippingPrintManifests(
HttpServletRequest req,
HttpServletResponse res,
ServletContext ctx) {
super(req, res, ctx);
}
public void invoke() throws Exception {
SecurityInfo securityInfo = WebUtils.getSecurityInfo(request);
String userID = securityInfo.getUsername();
ListGeneratorHome home = (ListGeneratorHome) EjbHomes.getHome(ListGeneratorHome.class);
ListGenerator shipment = home.create();
request.setAttribute("waybillList", shipment.findPrintableManifests(userID));
servletCtx.getRequestDispatcher(
"/hiddenJsps/iltds/shipping/shippingPrintManifests.jsp").forward(
request,
response);
}
}
| 1,155 | 0.779221 | 0.779221 | 36 | 31.083334 | 26.348492 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.611111 | false | false |
0
|
de45ee2a5a7a5a1f74dd5cff8c7f76e3ac3e6d3e
| 14,946,486,226,698 |
73b3fec4f51c27eca9cb50f8cf9ebbfa5303044b
|
/app/src/main/java/com/lister/recyclerviewdemo/decoration/CityAdapter.java
|
9ef8bffe34305102ce05011f3a5104074a9b3866
|
[] |
no_license
|
ttianer/RecyclerViewDemo
|
https://github.com/ttianer/RecyclerViewDemo
|
375116cf7f071b6535782dd7c52c540ebfaa24ff
|
aa776b12c472b1b4e0705ca4a30a901f4dcf4535
|
refs/heads/master
| 2022-04-09T20:17:04.705000 | 2020-03-28T06:46:25 | 2020-03-28T06:46:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lister.recyclerviewdemo.decoration;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.lister.recyclerviewdemo.R;
import java.util.List;
public class CityAdapter extends RecyclerView.Adapter<CityAdapter.CityViewHolder> {
private Context mContext;
private List<CityInfo> mCityList;
public CityAdapter(Context context, @NonNull List<CityInfo> cityList) {
this.mContext = context;
this.mCityList = cityList;
}
@NonNull
@Override
public CityViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.item_city, parent, false);
return new CityViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull CityViewHolder holder, int position) {
holder.bindData(mCityList.get(position));
}
@Override
public int getItemCount() {
return mCityList.size();
}
public int getPositionForSection(char section) {
for (int i = 0; i < getItemCount(); i++) {
String group = mCityList.get(i).getGroup();
char firstChar = group.charAt(0);
if (firstChar == section) {
return i;
}
}
return -1;
}
static class CityViewHolder extends RecyclerView.ViewHolder {
TextView mTextViewCityName;
CityViewHolder(@NonNull View itemView) {
super(itemView);
mTextViewCityName = itemView.findViewById(R.id.item_city_text);
}
void bindData(CityInfo cityInfo) {
mTextViewCityName.setText(cityInfo.getCityName());
}
}
}
|
UTF-8
|
Java
| 1,874 |
java
|
CityAdapter.java
|
Java
|
[] | null |
[] |
package com.lister.recyclerviewdemo.decoration;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.lister.recyclerviewdemo.R;
import java.util.List;
public class CityAdapter extends RecyclerView.Adapter<CityAdapter.CityViewHolder> {
private Context mContext;
private List<CityInfo> mCityList;
public CityAdapter(Context context, @NonNull List<CityInfo> cityList) {
this.mContext = context;
this.mCityList = cityList;
}
@NonNull
@Override
public CityViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.item_city, parent, false);
return new CityViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull CityViewHolder holder, int position) {
holder.bindData(mCityList.get(position));
}
@Override
public int getItemCount() {
return mCityList.size();
}
public int getPositionForSection(char section) {
for (int i = 0; i < getItemCount(); i++) {
String group = mCityList.get(i).getGroup();
char firstChar = group.charAt(0);
if (firstChar == section) {
return i;
}
}
return -1;
}
static class CityViewHolder extends RecyclerView.ViewHolder {
TextView mTextViewCityName;
CityViewHolder(@NonNull View itemView) {
super(itemView);
mTextViewCityName = itemView.findViewById(R.id.item_city_text);
}
void bindData(CityInfo cityInfo) {
mTextViewCityName.setText(cityInfo.getCityName());
}
}
}
| 1,874 | 0.669157 | 0.667556 | 68 | 26.544117 | 25.340292 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.485294 | false | false |
0
|
d4fc64e4714bcb0973b4c8f29f513a71f6bedf69
| 2,808,908,651,332 |
17b1eca3f055ff85d17ca64d274f6a995262cc4e
|
/Dogends PL/src/me/woulfiee/server/chat/ranks/chat/Admin.java
|
e22fa355985b62c09987b34b759127306a5eb099
|
[] |
no_license
|
Doge4/Dogends-PL
|
https://github.com/Doge4/Dogends-PL
|
1ee4f472aa80ba4f7409d73d1d05351cde6edede
|
2a4f9d3e7e5bf9ec79f7251f156873b6eafff057
|
refs/heads/master
| 2020-05-21T20:00:02.186000 | 2017-02-21T14:44:18 | 2017-02-21T14:44:18 | 65,130,326 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*******************************************************************************
* Copyright (c) 31.8.2016 by Woulfiee
******************************************************************************/
package me.woulfiee.server.chat.ranks.chat;
import me.woulfiee.server.chat.ranks.Ranks;
import me.woulfiee.server.chat.ranks.utils.Utils;
import me.woulfiee.server.loginregister.Login;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
/**
*
* @author Woulfiee
*
*/
public class Admin implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerChat(AsyncPlayerChatEvent e) {
if (Ranks.isAdmin(e.getPlayer())) {
if (Login.isLoggedIn(e.getPlayer())) {
for (Player player : Bukkit.getOnlinePlayers()) {
Utils.playOutChat("§c§lADMIN",
"Przedostatnia ranga na serwerze, jaka istnieje. \nNie mozesz jej otrzymac w zaden sposob.",
player, e.getPlayer(), e.getMessage());
e.setCancelled(true);
}
System.out.println("ADMIN " + e.getPlayer().getName() + " >> " + e.getMessage());
}
}
}
}
|
UTF-8
|
Java
| 1,367 |
java
|
Admin.java
|
Java
|
[
{
"context": "*******************************\r\n * Copyright (c) 31.8.2016 by Woulfiee\r\n *******************************",
"end": 103,
"score": 0.5827352404594421,
"start": 99,
"tag": "IP_ADDRESS",
"value": "31.8"
},
{
"context": "*******************\r\n * Copyright (c) 31.8.2016 by Woulfiee\r\n ***********************************************",
"end": 120,
"score": 0.9991459846496582,
"start": 112,
"tag": "NAME",
"value": "Woulfiee"
},
{
"context": "ayer.AsyncPlayerChatEvent;\r\n\r\n/**\r\n * \r\n * @author Woulfiee\r\n *\r\n */\r\npublic class Admin implements Listener ",
"end": 657,
"score": 0.9942945241928101,
"start": 649,
"tag": "NAME",
"value": "Woulfiee"
}
] | null |
[] |
/*******************************************************************************
* Copyright (c) 31.8.2016 by Woulfiee
******************************************************************************/
package me.woulfiee.server.chat.ranks.chat;
import me.woulfiee.server.chat.ranks.Ranks;
import me.woulfiee.server.chat.ranks.utils.Utils;
import me.woulfiee.server.loginregister.Login;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
/**
*
* @author Woulfiee
*
*/
public class Admin implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerChat(AsyncPlayerChatEvent e) {
if (Ranks.isAdmin(e.getPlayer())) {
if (Login.isLoggedIn(e.getPlayer())) {
for (Player player : Bukkit.getOnlinePlayers()) {
Utils.playOutChat("§c§lADMIN",
"Przedostatnia ranga na serwerze, jaka istnieje. \nNie mozesz jej otrzymac w zaden sposob.",
player, e.getPlayer(), e.getMessage());
e.setCancelled(true);
}
System.out.println("ADMIN " + e.getPlayer().getName() + " >> " + e.getMessage());
}
}
}
}
| 1,367 | 0.567033 | 0.561905 | 40 | 32.125 | 28.595617 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.975 | false | false |
0
|
d093091407a5437ec91f2b02b8a8d965fb5a820b
| 9,938,554,373,165 |
358c65864a418ed901c395dd7a618c74d31a0017
|
/BDRProjet-master/application/transportPublic/src/gza/transportPublic/idomain/IBus.java
|
cf4dc9aa0b8ecd97960ae3ff202f35c61e7b4445
|
[] |
no_license
|
GZaretti/bdr
|
https://github.com/GZaretti/bdr
|
9dba196e2ca83be607699b366bddd055ecc57d47
|
828d5a533937eaae1c36107f77076e0325a18fe6
|
refs/heads/master
| 2022-12-23T09:39:03.734000 | 2020-10-04T16:01:07 | 2020-10-04T16:01:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package gza.transportPublic.idomain;
/**
* @author ZEED
*/
public interface IBus extends IEntite<IBus> {
ICategorie getCategorie();
void setCategorie(ICategorie categorie);
IModel getModel();
void setModel(IModel model);
String getNoMatricule();
void setNoMatricule(String noMatricule);
int getNbPassagerMax();
void setNbPassagerMax(int nbPassager);
boolean getHandicap();
void setHandicap(boolean handicap);
}
|
UTF-8
|
Java
| 464 |
java
|
IBus.java
|
Java
|
[
{
"context": "ckage gza.transportPublic.idomain;\n\n/**\n * @author ZEED\n */\npublic interface IBus extends IEntite<IBus> {",
"end": 57,
"score": 0.9979373812675476,
"start": 53,
"tag": "USERNAME",
"value": "ZEED"
}
] | null |
[] |
package gza.transportPublic.idomain;
/**
* @author ZEED
*/
public interface IBus extends IEntite<IBus> {
ICategorie getCategorie();
void setCategorie(ICategorie categorie);
IModel getModel();
void setModel(IModel model);
String getNoMatricule();
void setNoMatricule(String noMatricule);
int getNbPassagerMax();
void setNbPassagerMax(int nbPassager);
boolean getHandicap();
void setHandicap(boolean handicap);
}
| 464 | 0.706897 | 0.706897 | 27 | 16.185184 | 17.475988 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.407407 | false | false |
0
|
87fc7ead528871236af74092513566e7ca3cfe6a
| 33,947,421,514,664 |
d0e17c6a6b52bef1c1fb0dbe55d49dd71b09de7f
|
/pa.iscde.templates/src/pa/iscde/templates/coding/DefaultReturns.java
|
0c72cae18a9b4f9702109203566a85abe7d0fbd1
|
[] |
no_license
|
andre-santos-pt/pa2015
|
https://github.com/andre-santos-pt/pa2015
|
c7c1b67ae8747789fc655e259764b32a5b6823e5
|
61822d5ceeba70e905f2bb6e57e4986745448d4a
|
refs/heads/master
| 2021-01-10T14:30:20.400000 | 2015-12-23T00:08:05 | 2015-12-23T00:08:05 | 45,386,500 | 2 | 1 | null | false | 2015-12-06T22:05:52 | 2015-11-02T10:03:23 | 2015-11-20T15:18:02 | 2015-12-06T22:05:52 | 3,309 | 1 | 2 | 0 |
Java
| null | null |
package pa.iscde.templates.coding;
import pa.iscde.templates.model.MethodDeclaration;
/**
* @author Ricardo Imperial & Filipe Pinho
*
*/
public class DefaultReturns extends TemplateReturns {
private String myMessage = "//Not implemented yet...";
/**
* @return Devolve uma string com a mensagem default Not implemented yet.
*/
@Override
public String returnVoid() {
return myMessage;
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return 0.
*/
@Override
public String returnByte() {
return myMessage+"\n"+"return 0;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return 0.
*/
@Override
public String returnShort() {
return myMessage+"\n"+"return 0;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return 0.
*/
@Override
public String returnInt() {
return myMessage+"\n"+"return 0;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return 0L.
*/
@Override
public String returnLong() {
return myMessage+"\n"+"return 0L;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return 0.0f.
*/
@Override
public String returnFloat() {
return myMessage+"\n"+"return 0.0f;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return de um caracter vazio.
*/
@Override
public String returnChar() {
return myMessage+"\n"+"return '\u0000';";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return false.
*/
@Override
public String returnBoolean() {
return myMessage+"\n"+"return false;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return "".
*/
@Override
public String returnString() {
return myMessage+"\n"+"return \"\";";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return null.
*/
@Override
public String returnDefault(MethodDeclaration declaration) {
return myMessage+"\n"+"return null;";
}
}
|
UTF-8
|
Java
| 2,316 |
java
|
DefaultReturns.java
|
Java
|
[
{
"context": "templates.model.MethodDeclaration;\n\n/**\n * @author Ricardo Imperial & Filipe Pinho\n *\n */\n\n\npublic class DefaultRetur",
"end": 119,
"score": 0.9998749494552612,
"start": 103,
"tag": "NAME",
"value": "Ricardo Imperial"
},
{
"context": "hodDeclaration;\n\n/**\n * @author Ricardo Imperial & Filipe Pinho\n *\n */\n\n\npublic class DefaultReturns extends Temp",
"end": 134,
"score": 0.999864399433136,
"start": 122,
"tag": "NAME",
"value": "Filipe Pinho"
}
] | null |
[] |
package pa.iscde.templates.coding;
import pa.iscde.templates.model.MethodDeclaration;
/**
* @author <NAME> & <NAME>
*
*/
public class DefaultReturns extends TemplateReturns {
private String myMessage = "//Not implemented yet...";
/**
* @return Devolve uma string com a mensagem default Not implemented yet.
*/
@Override
public String returnVoid() {
return myMessage;
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return 0.
*/
@Override
public String returnByte() {
return myMessage+"\n"+"return 0;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return 0.
*/
@Override
public String returnShort() {
return myMessage+"\n"+"return 0;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return 0.
*/
@Override
public String returnInt() {
return myMessage+"\n"+"return 0;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return 0L.
*/
@Override
public String returnLong() {
return myMessage+"\n"+"return 0L;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return 0.0f.
*/
@Override
public String returnFloat() {
return myMessage+"\n"+"return 0.0f;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return de um caracter vazio.
*/
@Override
public String returnChar() {
return myMessage+"\n"+"return '\u0000';";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return false.
*/
@Override
public String returnBoolean() {
return myMessage+"\n"+"return false;";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return "".
*/
@Override
public String returnString() {
return myMessage+"\n"+"return \"\";";
}
/**
* @return Devolve uma string com a mensagem default Not implemented yet seguida de um exemplo de return null.
*/
@Override
public String returnDefault(MethodDeclaration declaration) {
return myMessage+"\n"+"return null;";
}
}
| 2,300 | 0.695596 | 0.688687 | 93 | 23.903225 | 33.520035 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.11828 | false | false |
0
|
e80d97ddb8e43755720b643943a75cd9287c567c
| 35,072,702,945,330 |
f210a222e33d736a8bfd21002afbfcea43a2fce4
|
/typesummary/app/src/main/java/typesummary/ILogWriter.java
|
5ec7e308b961df06ac6e10238125d74dad52e664
|
[
"MIT"
] |
permissive
|
isabella232/msgraph-sdk-java
|
https://github.com/isabella232/msgraph-sdk-java
|
8677f63cb6ff78a2f404c2d2dcb48611634d9c38
|
24dbfdc9c07b17bf1d4ce8d567104f744db10c05
|
refs/heads/dev
| 2023-03-08T05:44:36.269000 | 2020-12-01T20:50:03 | 2020-12-01T20:50:03 | 318,156,425 | 0 | 0 |
MIT
| true | 2021-02-23T20:45:18 | 2020-12-03T10:29:23 | 2020-12-03T10:29:24 | 2021-02-23T20:45:15 | 40,049 | 0 | 0 | 1 | null | false | false |
package typesummary;
public interface ILogWriter {
void write(final String content);
void write(final String content, final int indent);
}
|
UTF-8
|
Java
| 142 |
java
|
ILogWriter.java
|
Java
|
[] | null |
[] |
package typesummary;
public interface ILogWriter {
void write(final String content);
void write(final String content, final int indent);
}
| 142 | 0.78169 | 0.78169 | 6 | 22.666666 | 18.345451 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
0
|
9a1c3317a63fc282a718f20365e929769489e517
| 23,295,902,680,305 |
7d7400d4abef5c9a6b3ea81f88ce4bac89d680ad
|
/src/com/atguigu/crm/util/DataProcessUtils.java
|
9be418bdb228c17efd750127c693d479d61bc79a
|
[] |
no_license
|
drowningfish1986/crmFish
|
https://github.com/drowningfish1986/crmFish
|
d90a03231bedb244f073a0a815dfbf2b1598808e
|
6bb666629837c3f81d4fecda1123301c52fa1d0d
|
refs/heads/master
| 2016-08-22T11:27:36.703000 | 2016-08-20T05:33:22 | 2016-08-20T05:33:22 | 64,675,170 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.atguigu.crm.util;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.shiro.crypto.hash.SimpleHash;
import com.atguigu.crm.entity.User;
import com.atguigu.crm.mapper.BaseMapper;
import com.atguigu.crm.model.Page;
import com.atguigu.crm.model.PropertyFilter;
public class DataProcessUtils {
/**
*
* @param password:登录、创建新用户、更新用户信息时传入的明文密码
* @param salt:盐值,用于加密算法
* @return:经过加密算法后保存于数据库的字符串
*/
public static User getSafeUser(User user){
String salt = UUID.randomUUID().toString();//获取随机盐值
String password = user.getPassword();//获取明文密码
//设置密码加密方式和次数
String algorithmName = "MD5";
int hashIterations = 1024;
SimpleHash hash = new SimpleHash(algorithmName, password, salt, hashIterations);
String newPwd = hash.toString();//获取加密后的密码字符串
//对对象设置盐值和加密后的密码,便于保存到数据库
user.setSalt(salt);
user.setPassword(newPwd);
return user;
}
/**
*
* @param requestParams:从页面传来,经过webUtils处理后的参数map
* @return
*/
public static Map<String, Object> getMybatisMap(
Map<String, Object> requestParams) {
List<PropertyFilter> filters = PropertyFilter
.parseRequestParamsToPropertyFilters(requestParams);
Map<String, Object> params = new HashMap<>();
for (PropertyFilter filter : filters) {
params.put(filter.getPropertyName(), filter.getPropertyVal());
}
return params;
}
/**
* 通用的带条件分页方法
* @param mapper:分页对象的mapper,需要继承接口BaseMapper
* @param pageNoStr:传入的页码
* @param requestParams:
* @return
*/
public static <T> Page<T> getConditionPage(BaseMapper<T> mapper, String pageNoStr,
Map<String, Object> requestParams){
Map<String, Object> params = getMybatisMap(requestParams);
//根据需要的信息状态和当前用户查询符合条件的总记录数
int totalRecordNo = (int)mapper.getTotalRecord(params);
//根据页码和总记录数创建page对象,修正页码
Page<T> page = new Page<>(pageNoStr, totalRecordNo);
int pageNo = page.getPageNo();//获取修正后的页码
//计算开始记录和结束记录
int startNum = (pageNo - 1) * Page.PAGE_SIZE + 1;
int endNum = startNum + Page.PAGE_SIZE;
params.put("startNum", startNum);
params.put("endNum", endNum);
//根据开始和结束脚标查询分页记录
List<T> list = mapper.getConditionList(params);
page.setList(list);
return page;
}
}
|
UTF-8
|
Java
| 2,788 |
java
|
DataProcessUtils.java
|
Java
|
[
{
"context": "domUUID().toString();//获取随机盐值\r\n\t\tString password = user.getPassword();//获取明文密码\r\n\t\t\r\n\t\t//设置密码加密方式和次数\r\n\t\tString algorit",
"end": 638,
"score": 0.7518091201782227,
"start": 622,
"tag": "PASSWORD",
"value": "user.getPassword"
}
] | null |
[] |
package com.atguigu.crm.util;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.shiro.crypto.hash.SimpleHash;
import com.atguigu.crm.entity.User;
import com.atguigu.crm.mapper.BaseMapper;
import com.atguigu.crm.model.Page;
import com.atguigu.crm.model.PropertyFilter;
public class DataProcessUtils {
/**
*
* @param password:登录、创建新用户、更新用户信息时传入的明文密码
* @param salt:盐值,用于加密算法
* @return:经过加密算法后保存于数据库的字符串
*/
public static User getSafeUser(User user){
String salt = UUID.randomUUID().toString();//获取随机盐值
String password = <PASSWORD>();//获取明文密码
//设置密码加密方式和次数
String algorithmName = "MD5";
int hashIterations = 1024;
SimpleHash hash = new SimpleHash(algorithmName, password, salt, hashIterations);
String newPwd = hash.toString();//获取加密后的密码字符串
//对对象设置盐值和加密后的密码,便于保存到数据库
user.setSalt(salt);
user.setPassword(newPwd);
return user;
}
/**
*
* @param requestParams:从页面传来,经过webUtils处理后的参数map
* @return
*/
public static Map<String, Object> getMybatisMap(
Map<String, Object> requestParams) {
List<PropertyFilter> filters = PropertyFilter
.parseRequestParamsToPropertyFilters(requestParams);
Map<String, Object> params = new HashMap<>();
for (PropertyFilter filter : filters) {
params.put(filter.getPropertyName(), filter.getPropertyVal());
}
return params;
}
/**
* 通用的带条件分页方法
* @param mapper:分页对象的mapper,需要继承接口BaseMapper
* @param pageNoStr:传入的页码
* @param requestParams:
* @return
*/
public static <T> Page<T> getConditionPage(BaseMapper<T> mapper, String pageNoStr,
Map<String, Object> requestParams){
Map<String, Object> params = getMybatisMap(requestParams);
//根据需要的信息状态和当前用户查询符合条件的总记录数
int totalRecordNo = (int)mapper.getTotalRecord(params);
//根据页码和总记录数创建page对象,修正页码
Page<T> page = new Page<>(pageNoStr, totalRecordNo);
int pageNo = page.getPageNo();//获取修正后的页码
//计算开始记录和结束记录
int startNum = (pageNo - 1) * Page.PAGE_SIZE + 1;
int endNum = startNum + Page.PAGE_SIZE;
params.put("startNum", startNum);
params.put("endNum", endNum);
//根据开始和结束脚标查询分页记录
List<T> list = mapper.getConditionList(params);
page.setList(list);
return page;
}
}
| 2,782 | 0.692605 | 0.689596 | 88 | 24.431818 | 20.873426 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.863636 | false | false |
0
|
7af90490bba22e2fa160526e3f16e2dbe31d13b2
| 27,049,704,093,878 |
5e61f45cc071c07a74c86659182ef4f6a89751f1
|
/src/main/java/org/test_task/app/implementers/BasicDecomposer.java
|
2908e6ec9a4156bdc806824040dcbbb5167bc7e5
|
[] |
no_license
|
DarBeer/test-task
|
https://github.com/DarBeer/test-task
|
78ace0f6b72f6d75dddbec1757dadd42ef55a28a
|
65882bb663332d10a2b2da4782c0322a4a1e7d37
|
refs/heads/master
| 2022-06-17T14:26:12.457000 | 2020-03-14T20:49:19 | 2020-03-14T20:49:19 | 247,243,692 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.test_task.app.implementers;
import org.test_task.app.builders.NamedOrderBuilder;
import org.test_task.app.builders.TripleBuilder;
import org.test_task.app.models.Triple;
import java.util.ArrayList;
import java.util.List;
public class BasicDecomposer {
public static List<Triple> Decompose (String input) {
List<Triple> triples = new ArrayList<>();
int position = 0;
switch ((input.length()) % 3) {
case 0: {
for (int i = input.length() - 1; i > -1; i -= 3) {
String tripleLine = input.substring(i - 2, i + 1);
triples.add(new TripleBuilder(ForTripleDecomposer.Decompouse(tripleLine), new NamedOrderBuilder(position).build()).build());
position++;
}
} break;
case 1: {
for (int i = input.length() - 1; i > 2; i -= 3) {
String tripleLine = input.substring(i - 2, i + 1);
triples.add(new TripleBuilder(ForTripleDecomposer.Decompouse(tripleLine), new NamedOrderBuilder(position).build()).build());
position++;
}
String tripleLine = "00" + input.substring(0, 1);
triples.add(new TripleBuilder(ForTripleDecomposer.Decompouse(tripleLine), new NamedOrderBuilder(position).build()).build());
} break;
case 2: {
for (int i = input.length() - 1; i > 2; i -= 3) {
String tripleLine = input.substring(i - 2, i + 1);
triples.add(new TripleBuilder(ForTripleDecomposer.Decompouse(tripleLine), new NamedOrderBuilder(position).build()).build());
position++;
}
String tripleLine = "0" + input.substring(0, 2);
triples.add(new TripleBuilder(ForTripleDecomposer.Decompouse(tripleLine), new NamedOrderBuilder(position).build()).build());
} break;
}
return triples;
}
}
|
UTF-8
|
Java
| 2,022 |
java
|
BasicDecomposer.java
|
Java
|
[] | null |
[] |
package org.test_task.app.implementers;
import org.test_task.app.builders.NamedOrderBuilder;
import org.test_task.app.builders.TripleBuilder;
import org.test_task.app.models.Triple;
import java.util.ArrayList;
import java.util.List;
public class BasicDecomposer {
public static List<Triple> Decompose (String input) {
List<Triple> triples = new ArrayList<>();
int position = 0;
switch ((input.length()) % 3) {
case 0: {
for (int i = input.length() - 1; i > -1; i -= 3) {
String tripleLine = input.substring(i - 2, i + 1);
triples.add(new TripleBuilder(ForTripleDecomposer.Decompouse(tripleLine), new NamedOrderBuilder(position).build()).build());
position++;
}
} break;
case 1: {
for (int i = input.length() - 1; i > 2; i -= 3) {
String tripleLine = input.substring(i - 2, i + 1);
triples.add(new TripleBuilder(ForTripleDecomposer.Decompouse(tripleLine), new NamedOrderBuilder(position).build()).build());
position++;
}
String tripleLine = "00" + input.substring(0, 1);
triples.add(new TripleBuilder(ForTripleDecomposer.Decompouse(tripleLine), new NamedOrderBuilder(position).build()).build());
} break;
case 2: {
for (int i = input.length() - 1; i > 2; i -= 3) {
String tripleLine = input.substring(i - 2, i + 1);
triples.add(new TripleBuilder(ForTripleDecomposer.Decompouse(tripleLine), new NamedOrderBuilder(position).build()).build());
position++;
}
String tripleLine = "0" + input.substring(0, 2);
triples.add(new TripleBuilder(ForTripleDecomposer.Decompouse(tripleLine), new NamedOrderBuilder(position).build()).build());
} break;
}
return triples;
}
}
| 2,022 | 0.563304 | 0.549951 | 43 | 46.023254 | 40.641075 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.953488 | false | false |
0
|
fab597667c170bd4ac375aad5fbbe6612ca602dd
| 5,583,457,493,870 |
fa28e55fd32a1c2d23a0a14328096d4b1d947d02
|
/Other_models/src/voice_activity_detection/src_java/extract_spectral_features.java
|
76f7d5e07e23803f38428e3442e11f3cbff2cb83
|
[] |
no_license
|
baongoc83/Voice-Identification
|
https://github.com/baongoc83/Voice-Identification
|
0a2ff27d5727a5d5ae7af30b67f86732f2dd28f2
|
493afb2dd1b71ab6760db2226ab4a568b0a8c0b4
|
refs/heads/master
| 2023-06-27T14:29:34.785000 | 2021-07-28T12:26:55 | 2021-07-28T12:26:55 | 388,754,873 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/***
* @author - Sivaramakrishnan
*/
import java.lang.reflect.Array;
import java.util.ArrayList;
public class extract_spectral_features {
/***
* Constructor which finds the normalised fft for each frame in a window
* @param frame_list Arraylist containing all the frames in a window
* @param FFT_SIZE FFT size used for calculating the FFT
*/
public extract_spectral_features(ArrayList<double[]> frame_list,int FFT_SIZE,int SAMPLING_RATE){
fft_normalised = new ArrayList<>();
phase_angle = new ArrayList<>();
for(double[] frame: frame_list){
fft_normalization fft_norm = new fft_normalization(FFT_SIZE);
fft_norm.fft_normalize(frame);
fft_normalised.add(fft_norm.getFFTNormalised());
phase_angle.add(fft_norm.getPhase_angle());
}
fft_frequency fq = new fft_frequency(FFT_SIZE,SAMPLING_RATE);
fft_freq = fq.getFFTFrequency();
//Once fft normalization, phase calculation and fft frequency bins are done we can extract all the spectral features
extractSpectralFlux();
extractSpectralRolloff();
extractSpectralCentroid();
extractBandwidth();
extractNWPD();
extractRSE();
}
/***
* Finds the Spectral flux using the normalised FFT values
*/
public void extractSpectralFlux(){
spectral_flux = new ArrayList<>();
for(double[] frame:fft_normalised){
double sum = 0;
for(int i = 1;i < frame.length;i++){
sum += Math.pow(frame[i-1] - frame[i],2);
}
spectral_flux.add(sum);
}
}
/***
* Finds the Spectral Rolloff using normalised FFT values and FFT freqeuncy bins
*/
public void extractSpectralRolloff(){
spectral_rolloff = new ArrayList<>();
for(double[] frame:fft_normalised){
double[] temp = new double[frame.length];
temp[0] = frame[0];
double sum = frame[0],roll_of_percentage;
int lower_spectral_index = 0;
for(int j = 1;j < frame.length;j++){
sum += frame[j];
temp[j] = temp[j-1] + frame[j];
}
roll_of_percentage = sum * SPECTRAL_ROLLOFF_PERCENTAGE;
for(int i = frame.length-1;i >= 0;i--){
if(temp[i] < roll_of_percentage) {
lower_spectral_index = i;
break;
}
}
spectral_rolloff.add(fft_freq[lower_spectral_index]);
}
}
/***
* Finds the Spectral Centroid for each frame in framelist
*/
public void extractSpectralCentroid(){
spectral_centroid = new ArrayList<>();
double num;
double den;
for(int frame = 0;frame < fft_normalised.size();frame++){
num = 0.0;
den = 1E-15;
for(int i = 0;i<fft_normalised.get(frame).length;i++){
num += fft_freq[i] * (Math.pow(fft_normalised.get(frame)[i],2));
den += (Math.pow(fft_normalised.get(frame)[i],2));
}
spectral_centroid.add(num/den);
}
}
/***
* Finds the bandwidth for each frame in framelist
*/
public void extractBandwidth(){
bandwidth = new ArrayList<>();
double num;
double den;
for(int frame = 0;frame < fft_normalised.size();frame++){
num = 0.0;
den = 1E-15;
for(int i = 0;i<fft_normalised.get(frame).length;i++){
num += Math.pow(fft_freq[i] - spectral_centroid.get(frame),2) * Math.pow(fft_normalised.get(frame)[i],2);
den += (Math.pow(fft_normalised.get(frame)[i],2));
}
bandwidth.add(num/den);
}
}
/***
* Find the Normalised Weighted Phase Deviation
*/
public void extractNWPD(){
nwpd = new ArrayList<>();
double nwpd_;
for(int frame = 0;frame < phase_angle.size(); frame++){
double[] first_derivative = util.find_derivative(phase_angle.get(frame));
double[] second_derivative = util.find_derivative(first_derivative); //size of this array is 2 less than the phase angle array because we find the second derivative
nwpd_ = 0.0;
for(int i = 0;i<second_derivative.length;i++){
nwpd_ += fft_normalised.get(frame)[i] * second_derivative[i];
}
nwpd.add(nwpd_);
}
}
/***
* Finds the Relative Spectral Entropy of framelist
*/
public void extractRSE(){
rse = new ArrayList<>();
double rse_;
int fft_normalised_len = fft_normalised.get(0).length;
double[] m_prev = util.zeros1D(fft_normalised_len);
double[] m_curr = new double[fft_normalised_len];
for(int i = 0;i < fft_normalised_len;i++){
m_curr[i] = (m_prev[i] * RSE_M_T_PREV) + (fft_normalised.get(0)[i] * RSE_P_T);
}
for(int frame = 1;frame < fft_normalised.size();frame++){
fft_normalised_len = fft_normalised.get(frame).length;
//m_prev = m_curr;
for(int k = 0;k < m_prev.length;k++){
m_prev[k] = m_curr[k];
}
for(int i = 0;i < fft_normalised_len;i++){
m_curr[i] = (m_prev[i] * RSE_M_T_PREV) + (fft_normalised.get(frame)[i] * RSE_P_T);
}
rse_ = 0.0;
for(int j = 0;j < fft_normalised_len; j++){
rse_ += fft_normalised.get(frame)[j] * (Math.log(fft_normalised.get(frame)[j]) - Math.log(m_prev[j]));
}
rse.add(-rse_);
}
}
/***
* returns the private ArrayList for spectral flux
* @return
*/
public ArrayList<Double> getSpectral_flux(){ return spectral_flux;}
ArrayList<double[]> fft_normalised;
ArrayList<double[]> phase_angle;
double[] fft_freq;
ArrayList<Double> spectral_flux;
ArrayList<Double> spectral_rolloff;
ArrayList<Double> spectral_centroid;
ArrayList<Double> bandwidth;
ArrayList<Double> nwpd;
ArrayList<Double> rse;
private static final double SPECTRAL_ROLLOFF_PERCENTAGE = 0.93;
private static final double RSE_M_T_PREV = 0.9;
private static final double RSE_P_T = 0.1;
}
|
UTF-8
|
Java
| 6,352 |
java
|
extract_spectral_features.java
|
Java
|
[
{
"context": "/***\n * @author - Sivaramakrishnan\n */\n\nimport java.lang.reflect.Array;\nimport java.",
"end": 34,
"score": 0.9998839497566223,
"start": 18,
"tag": "NAME",
"value": "Sivaramakrishnan"
}
] | null |
[] |
/***
* @author - Sivaramakrishnan
*/
import java.lang.reflect.Array;
import java.util.ArrayList;
public class extract_spectral_features {
/***
* Constructor which finds the normalised fft for each frame in a window
* @param frame_list Arraylist containing all the frames in a window
* @param FFT_SIZE FFT size used for calculating the FFT
*/
public extract_spectral_features(ArrayList<double[]> frame_list,int FFT_SIZE,int SAMPLING_RATE){
fft_normalised = new ArrayList<>();
phase_angle = new ArrayList<>();
for(double[] frame: frame_list){
fft_normalization fft_norm = new fft_normalization(FFT_SIZE);
fft_norm.fft_normalize(frame);
fft_normalised.add(fft_norm.getFFTNormalised());
phase_angle.add(fft_norm.getPhase_angle());
}
fft_frequency fq = new fft_frequency(FFT_SIZE,SAMPLING_RATE);
fft_freq = fq.getFFTFrequency();
//Once fft normalization, phase calculation and fft frequency bins are done we can extract all the spectral features
extractSpectralFlux();
extractSpectralRolloff();
extractSpectralCentroid();
extractBandwidth();
extractNWPD();
extractRSE();
}
/***
* Finds the Spectral flux using the normalised FFT values
*/
public void extractSpectralFlux(){
spectral_flux = new ArrayList<>();
for(double[] frame:fft_normalised){
double sum = 0;
for(int i = 1;i < frame.length;i++){
sum += Math.pow(frame[i-1] - frame[i],2);
}
spectral_flux.add(sum);
}
}
/***
* Finds the Spectral Rolloff using normalised FFT values and FFT freqeuncy bins
*/
public void extractSpectralRolloff(){
spectral_rolloff = new ArrayList<>();
for(double[] frame:fft_normalised){
double[] temp = new double[frame.length];
temp[0] = frame[0];
double sum = frame[0],roll_of_percentage;
int lower_spectral_index = 0;
for(int j = 1;j < frame.length;j++){
sum += frame[j];
temp[j] = temp[j-1] + frame[j];
}
roll_of_percentage = sum * SPECTRAL_ROLLOFF_PERCENTAGE;
for(int i = frame.length-1;i >= 0;i--){
if(temp[i] < roll_of_percentage) {
lower_spectral_index = i;
break;
}
}
spectral_rolloff.add(fft_freq[lower_spectral_index]);
}
}
/***
* Finds the Spectral Centroid for each frame in framelist
*/
public void extractSpectralCentroid(){
spectral_centroid = new ArrayList<>();
double num;
double den;
for(int frame = 0;frame < fft_normalised.size();frame++){
num = 0.0;
den = 1E-15;
for(int i = 0;i<fft_normalised.get(frame).length;i++){
num += fft_freq[i] * (Math.pow(fft_normalised.get(frame)[i],2));
den += (Math.pow(fft_normalised.get(frame)[i],2));
}
spectral_centroid.add(num/den);
}
}
/***
* Finds the bandwidth for each frame in framelist
*/
public void extractBandwidth(){
bandwidth = new ArrayList<>();
double num;
double den;
for(int frame = 0;frame < fft_normalised.size();frame++){
num = 0.0;
den = 1E-15;
for(int i = 0;i<fft_normalised.get(frame).length;i++){
num += Math.pow(fft_freq[i] - spectral_centroid.get(frame),2) * Math.pow(fft_normalised.get(frame)[i],2);
den += (Math.pow(fft_normalised.get(frame)[i],2));
}
bandwidth.add(num/den);
}
}
/***
* Find the Normalised Weighted Phase Deviation
*/
public void extractNWPD(){
nwpd = new ArrayList<>();
double nwpd_;
for(int frame = 0;frame < phase_angle.size(); frame++){
double[] first_derivative = util.find_derivative(phase_angle.get(frame));
double[] second_derivative = util.find_derivative(first_derivative); //size of this array is 2 less than the phase angle array because we find the second derivative
nwpd_ = 0.0;
for(int i = 0;i<second_derivative.length;i++){
nwpd_ += fft_normalised.get(frame)[i] * second_derivative[i];
}
nwpd.add(nwpd_);
}
}
/***
* Finds the Relative Spectral Entropy of framelist
*/
public void extractRSE(){
rse = new ArrayList<>();
double rse_;
int fft_normalised_len = fft_normalised.get(0).length;
double[] m_prev = util.zeros1D(fft_normalised_len);
double[] m_curr = new double[fft_normalised_len];
for(int i = 0;i < fft_normalised_len;i++){
m_curr[i] = (m_prev[i] * RSE_M_T_PREV) + (fft_normalised.get(0)[i] * RSE_P_T);
}
for(int frame = 1;frame < fft_normalised.size();frame++){
fft_normalised_len = fft_normalised.get(frame).length;
//m_prev = m_curr;
for(int k = 0;k < m_prev.length;k++){
m_prev[k] = m_curr[k];
}
for(int i = 0;i < fft_normalised_len;i++){
m_curr[i] = (m_prev[i] * RSE_M_T_PREV) + (fft_normalised.get(frame)[i] * RSE_P_T);
}
rse_ = 0.0;
for(int j = 0;j < fft_normalised_len; j++){
rse_ += fft_normalised.get(frame)[j] * (Math.log(fft_normalised.get(frame)[j]) - Math.log(m_prev[j]));
}
rse.add(-rse_);
}
}
/***
* returns the private ArrayList for spectral flux
* @return
*/
public ArrayList<Double> getSpectral_flux(){ return spectral_flux;}
ArrayList<double[]> fft_normalised;
ArrayList<double[]> phase_angle;
double[] fft_freq;
ArrayList<Double> spectral_flux;
ArrayList<Double> spectral_rolloff;
ArrayList<Double> spectral_centroid;
ArrayList<Double> bandwidth;
ArrayList<Double> nwpd;
ArrayList<Double> rse;
private static final double SPECTRAL_ROLLOFF_PERCENTAGE = 0.93;
private static final double RSE_M_T_PREV = 0.9;
private static final double RSE_P_T = 0.1;
}
| 6,352 | 0.553369 | 0.545025 | 180 | 34.288887 | 28.674126 | 176 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.661111 | false | false |
3
|
40257a396861204b1e83365b76ca6b9f30cff173
| 23,837,068,498,665 |
fb6257f0af4e1ed0b9c5d2603da7ebdec322157d
|
/api/src/main/java/com/happylifeplat/wechat/service/IOauth2Service.java
|
ce7d28e9fbe328dde3653c8d273bbf2b06d59271
|
[
"MIT"
] |
permissive
|
ivysboy/wuyuan_wechat_service
|
https://github.com/ivysboy/wuyuan_wechat_service
|
9c1a1f7a690b847042f2f10aec76a003cb82861f
|
185576a4291455cf8b3813a1517da92b7ece101f
|
refs/heads/master
| 2021-06-24T05:36:02.025000 | 2017-09-09T19:03:56 | 2017-09-09T19:03:56 | 102,977,766 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.happylifeplat.wechat.service;
import com.happylifeplat.wechat.model.WxBindStoreDto;
import com.happylifeplat.wechat.model.result.WechatPublicUserDto;
import com.happylifeplat.wechat.util.ResponseModel;
public interface IOauth2Service {
/**
* 获取授权url
*
* @param appId, redirectUrl
* @return
*/
ResponseModel authorize(String appId, String redirectUrl);
/**
* 验证微信号是否绑定(微信验证回调)
*
* @param code, state
* @return
*/
ResponseModel valid(String code, String state);
/**
* 绑定旺管家账号
*
* @param wechatPublicUserDto
* @return
*/
ResponseModel bind(WechatPublicUserDto wechatPublicUserDto);
/**
* 绑定供应商id
* @param wechatPublicUserDto
* @return
*/
ResponseModel bindProvider(WechatPublicUserDto wechatPublicUserDto);
/**
* 绑定店铺id
* @param bindStoreDto
* @return
*/
ResponseModel bindStore(WxBindStoreDto bindStoreDto);
}
|
UTF-8
|
Java
| 961 |
java
|
IOauth2Service.java
|
Java
|
[] | null |
[] |
package com.happylifeplat.wechat.service;
import com.happylifeplat.wechat.model.WxBindStoreDto;
import com.happylifeplat.wechat.model.result.WechatPublicUserDto;
import com.happylifeplat.wechat.util.ResponseModel;
public interface IOauth2Service {
/**
* 获取授权url
*
* @param appId, redirectUrl
* @return
*/
ResponseModel authorize(String appId, String redirectUrl);
/**
* 验证微信号是否绑定(微信验证回调)
*
* @param code, state
* @return
*/
ResponseModel valid(String code, String state);
/**
* 绑定旺管家账号
*
* @param wechatPublicUserDto
* @return
*/
ResponseModel bind(WechatPublicUserDto wechatPublicUserDto);
/**
* 绑定供应商id
* @param wechatPublicUserDto
* @return
*/
ResponseModel bindProvider(WechatPublicUserDto wechatPublicUserDto);
/**
* 绑定店铺id
* @param bindStoreDto
* @return
*/
ResponseModel bindStore(WxBindStoreDto bindStoreDto);
}
| 961 | 0.723788 | 0.722661 | 47 | 17.872341 | 20.601194 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.978723 | false | false |
3
|
9d6fe8ab9d8915d55993e800dd82dfe0a5025ce1
| 24,558,623,006,164 |
116b74f7b3a6e070e586c44c9a436df4f8197477
|
/src/com/chzu/app/util/URLUtil.java
|
3e18771d2b3b6ffab5c83fc9e2e8d73d26eb1151
|
[] |
no_license
|
vector4wang/CHZUAPP
|
https://github.com/vector4wang/CHZUAPP
|
ece8010c6ad0cca7d22afbe04614ac852454f6c4
|
e2a93f9e8e0466036d5f3a2218fbde0addd061ab
|
refs/heads/master
| 2021-05-29T11:06:26.091000 | 2015-06-17T10:31:38 | 2015-06-17T10:31:38 | 37,588,283 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.chzu.app.util;
public class URLUtil {
/**
* 蔚园要问
* 院部动态
* 通知公告
* 教科研信息
*/
public static final String NEWS_LIST_WYYW = "http://www.chzu.edu.cn/s/1/t/1152/p/2/list.htm";
public static final String NEWS_LIST_YBDT = "http://www.chzu.edu.cn/s/1/t/1152/p/3/list.htm";
public static final String NEWS_LIST_TZGG = "http://www.chzu.edu.cn/s/1/t/1152/p/4/list.htm";
public static final String NEWS_LIST_JKYXX = "http://www.chzu.edu.cn/s/1/t/1152/p/5/list.htm";
public static String gengrateURL(int newsType){
String urlStr = "";
switch (newsType)
{
case URLDetail.NEWS_LIST_WYYW:
urlStr = NEWS_LIST_WYYW;
break;
case URLDetail.NEWS_LIST_YBDT:
urlStr = NEWS_LIST_YBDT;
break;
case URLDetail.NEWS_LIST_TZGG:
urlStr = NEWS_LIST_TZGG;
break;
case URLDetail.NEWS_LIST_JKYXX:
urlStr = NEWS_LIST_JKYXX;
break;
default:
urlStr = NEWS_LIST_WYYW;
break;
}
return urlStr;
}
/** 教务管理系统 */
//池州学院http://211.86.193.14 default210.45.160.115
public static final String JWGL_URL = "http://210.45.160.115";
/** 教务系统登录地址 ,中间的参数为一段24位的的字符串和/() */
public static final String JWGL_LOGIN_URL = JWGL_URL + "%s/default2.aspx";
/** 教务系统验证码地址 ,中间的参数为一段24位的的字符串和/() */
public static final String JWGL_CHECKCODE_URL = JWGL_URL + "%s/CheckCode.aspx";
//public static final String JWGL_CHECKCODE_URL = JWGL_URL + "/CheckCode.aspx";
/** 教务系统登录后的主页,第一个参数:一段24位的字符串和/() ,第二个参数:学号 */
public static final String JWGL_MAIN_URL = JWGL_URL + "%s/xs_main.aspx?xh=%s";
/** 教务系统用户的头像 ,第一个参数:一段24位的的字符串和/() ,第二个参数:学号 */
public static final String JWGL_HEAD_ICON_URL = JWGL_URL + "%s/readimagexs.aspx?xh=%s";
/** 查找用户信息,第一个参数为一段24位的的字符串和/(),第二个参数:学号 ,第三个参数:姓名 */
public static final String JWGL_USER_INFO_URL = JWGL_URL + "%s/xsgrxx.aspx?xh=%s&xm=%s&gnmkdm=N121501";
/** 查找课程表,第一个参数为一段24位的的字符串和/(),第二个参数:学号 ,第三个参数:姓名 */
/**http://210.45.160.115/(iqsqej45zddpfxjx4z5xwiv4)/xskbcx.aspx?xh=2011211311&xm=%CD%F5%D0%CB%B3%AC&gnmkdm=N121603*/
public static final String JWGL_USER_SCHEDULE_URL = JWGL_URL + "%s/xskbcx.aspx?xh=%s&xm=%s&gnmkdm=N121603";
/** 查找用户成绩 ,第一个参数:24位安全码,第二个参数:学号,第三个参数姓名 */
public static final String JWGL_USER_SCORE_URL = JWGL_URL + "%s/xscjcx.aspx?xh=%s&xm=%s&gnmkdm=N121605";
/**查找空教室,第一个参数24位安全码,第二个参数学号,第三个参数姓名*/
public static final String JWGL_EMPTY_CLASSROOM = JWGL_URL + "%s/xxjsjy.aspx?xh=%s&xm=%s&gnmkdm=N121611";
}
|
UTF-8
|
Java
| 2,934 |
java
|
URLUtil.java
|
Java
|
[
{
"context": ".chzu.app.util;\n\n\npublic class URLUtil {\n\t/**\n\t * 蔚园要问\n\t * 院部动态\n\t * 通知公告\n\t * 教科研信息\n\t */\n\tpublic static ",
"end": 64,
"score": 0.94354647397995,
"start": 61,
"tag": "NAME",
"value": "蔚园要"
},
{
"context": "\treturn urlStr;\n\t}\n\t\n\t/** 教务管理系统 */\n\t//池州学院http://211.86.193.14 default210.45.160.115\n\tpublic static final String",
"end": 980,
"score": 0.9997302293777466,
"start": 967,
"tag": "IP_ADDRESS",
"value": "211.86.193.14"
},
{
"context": "\t/** 教务管理系统 */\n\t//池州学院http://211.86.193.14 default210.45.160.115\n\tpublic static final String JWGL_URL = \"http://21",
"end": 1002,
"score": 0.9995990991592407,
"start": 988,
"tag": "IP_ADDRESS",
"value": "210.45.160.115"
},
{
"context": "15\n\tpublic static final String JWGL_URL = \"http://210.45.160.115\";\n\t\n\t/** 教务系统登录地址 ,中间的参数为一段24位的的字符串和/() */\n\tpubli",
"end": 1064,
"score": 0.9997368454933167,
"start": 1050,
"tag": "IP_ADDRESS",
"value": "210.45.160.115"
},
{
"context": "数为一段24位的的字符串和/(),第二个参数:学号 ,第三个参数:姓名 */\n\t/**http://210.45.160.115/(iqsqej45zddpfxjx4z5xwiv4)/xskbcx.aspx?xh=2011211",
"end": 1903,
"score": 0.9771112203598022,
"start": 1889,
"tag": "IP_ADDRESS",
"value": "210.45.160.115"
}
] | null |
[] |
package com.chzu.app.util;
public class URLUtil {
/**
* 蔚园要问
* 院部动态
* 通知公告
* 教科研信息
*/
public static final String NEWS_LIST_WYYW = "http://www.chzu.edu.cn/s/1/t/1152/p/2/list.htm";
public static final String NEWS_LIST_YBDT = "http://www.chzu.edu.cn/s/1/t/1152/p/3/list.htm";
public static final String NEWS_LIST_TZGG = "http://www.chzu.edu.cn/s/1/t/1152/p/4/list.htm";
public static final String NEWS_LIST_JKYXX = "http://www.chzu.edu.cn/s/1/t/1152/p/5/list.htm";
public static String gengrateURL(int newsType){
String urlStr = "";
switch (newsType)
{
case URLDetail.NEWS_LIST_WYYW:
urlStr = NEWS_LIST_WYYW;
break;
case URLDetail.NEWS_LIST_YBDT:
urlStr = NEWS_LIST_YBDT;
break;
case URLDetail.NEWS_LIST_TZGG:
urlStr = NEWS_LIST_TZGG;
break;
case URLDetail.NEWS_LIST_JKYXX:
urlStr = NEWS_LIST_JKYXX;
break;
default:
urlStr = NEWS_LIST_WYYW;
break;
}
return urlStr;
}
/** 教务管理系统 */
//池州学院http://172.16.17.32 default172.16.31.10
public static final String JWGL_URL = "http://172.16.31.10";
/** 教务系统登录地址 ,中间的参数为一段24位的的字符串和/() */
public static final String JWGL_LOGIN_URL = JWGL_URL + "%s/default2.aspx";
/** 教务系统验证码地址 ,中间的参数为一段24位的的字符串和/() */
public static final String JWGL_CHECKCODE_URL = JWGL_URL + "%s/CheckCode.aspx";
//public static final String JWGL_CHECKCODE_URL = JWGL_URL + "/CheckCode.aspx";
/** 教务系统登录后的主页,第一个参数:一段24位的字符串和/() ,第二个参数:学号 */
public static final String JWGL_MAIN_URL = JWGL_URL + "%s/xs_main.aspx?xh=%s";
/** 教务系统用户的头像 ,第一个参数:一段24位的的字符串和/() ,第二个参数:学号 */
public static final String JWGL_HEAD_ICON_URL = JWGL_URL + "%s/readimagexs.aspx?xh=%s";
/** 查找用户信息,第一个参数为一段24位的的字符串和/(),第二个参数:学号 ,第三个参数:姓名 */
public static final String JWGL_USER_INFO_URL = JWGL_URL + "%s/xsgrxx.aspx?xh=%s&xm=%s&gnmkdm=N121501";
/** 查找课程表,第一个参数为一段24位的的字符串和/(),第二个参数:学号 ,第三个参数:姓名 */
/**http://172.16.31.10/(iqsqej45zddpfxjx4z5xwiv4)/xskbcx.aspx?xh=2011211311&xm=%CD%F5%D0%CB%B3%AC&gnmkdm=N121603*/
public static final String JWGL_USER_SCHEDULE_URL = JWGL_URL + "%s/xskbcx.aspx?xh=%s&xm=%s&gnmkdm=N121603";
/** 查找用户成绩 ,第一个参数:24位安全码,第二个参数:学号,第三个参数姓名 */
public static final String JWGL_USER_SCORE_URL = JWGL_URL + "%s/xscjcx.aspx?xh=%s&xm=%s&gnmkdm=N121605";
/**查找空教室,第一个参数24位安全码,第二个参数学号,第三个参数姓名*/
public static final String JWGL_EMPTY_CLASSROOM = JWGL_URL + "%s/xxjsjy.aspx?xh=%s&xm=%s&gnmkdm=N121611";
}
| 2,927 | 0.685477 | 0.630705 | 68 | 34.441177 | 34.819866 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false |
3
|
23b9d51469d9472acdf623bf86d55f22bd58c45f
| 24,962,349,929,793 |
934194773cb541dbdb1105dfff06e00c93a0ca5c
|
/Maze_Game_JOHN/src/ie/gmit/sw/ai/runner/GameView.java
|
4ff73e56f1ecfbbdac4aa757fbef7ac60c87f0e9
|
[] |
no_license
|
G00330443/Heuristically-Informed-Fuzzy-Maze
|
https://github.com/G00330443/Heuristically-Informed-Fuzzy-Maze
|
fb2896e2f6e22667582ef1bfe5a716922c53a2da
|
11cd1048f624ec7fdac99d6e854e4861aa4f3deb
|
refs/heads/master
| 2021-01-10T17:31:00.801000 | 2016-04-05T23:10:15 | 2016-04-05T23:10:15 | 55,522,293 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ie.gmit.sw.ai.runner;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.Random;
import javax.imageio.*;
import javax.swing.*;
import ie.gmit.sw.ai.Maze.Maze_Generate;
import ie.gmit.sw.ai.characters.Boom;
import ie.gmit.sw.ai.characters.Enemy;
import ie.gmit.sw.ai.characters.Hero;
import ie.gmit.sw.ai.characters.characters;
import ie.gmit.sw.ai.traverse.enemy_walk;
import ie.gmit.sw.ai.traverse.traverse_DFS;
public class GameView extends JPanel implements ActionListener{
private static final long serialVersionUID = 1L;
public static final int DEFAULT_VIEW_SIZE = 800;
private static final int IMAGE_COUNT = 30;
private int cellspan = 5;
private int cellpadding = 2;
public static int[][] maze;
public BufferedImage[] images;
private Maze_Generate mg=new Maze_Generate();
//set action state
private int enemy_state = 5;
private int hero_state = 7;
private int hero_attack = 12;
public Timer timer;
private int currentRow;
private int currentCol;
// Boolean zoomOut
private boolean zoomOut = false;
private int imageIndex = -1;
private characters[][] character;
private boolean shortpath=false;
private static int nu=1;
public GameView(){
}
public GameView(int[][] mazeData) throws Exception{
init();
this.maze = mazeData;
character=new runner().getCharacter();
setBackground(Color.LIGHT_GRAY);
setDoubleBuffered(true);
timer = new Timer(300, this);
timer.start();
/*GameView view=new GameView();
enemy_walk thread1= view.new enemy_walk();*/
}
public void setCurrentRow(int row) {
if (row < cellpadding){
currentRow = cellpadding;
}else if (row > (maze.length - 1) - cellpadding){
currentRow = (maze.length - 1) - cellpadding;
}else{
currentRow = row;
}
}
public void setCurrentCol(int col) {
if (col < cellpadding){
currentCol = cellpadding;
}else if (col > (maze[currentRow].length - 1) - cellpadding){
currentCol = (maze[currentRow].length - 1) - cellpadding;
}else{
currentCol = col;
}
}
public int getCurrentRow() {
return currentRow;
}
public int getCurrentCol() {
return currentCol;
}
//Setting enemy_walk walk Direction
static int u= 0;
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
cellspan = zoomOut ? maze.length : 5;
final int size = DEFAULT_VIEW_SIZE/cellspan;
g2.drawRect(0, 0, GameView.DEFAULT_VIEW_SIZE, GameView.DEFAULT_VIEW_SIZE);
g2.drawImage(images[enemy_state], currentRow*size, currentCol*size, null);
//show hero state
g2.setColor(Color.white);
g2.setFont(new Font("TimesRoman",1,30));
g2.drawString("Blood :" + runner.hero.getBlood(), 30, DEFAULT_VIEW_SIZE+30);
g2.drawString("Wepon :" + runner.wepon.usetimes, 230, DEFAULT_VIEW_SIZE+30);
g2.drawString("Wall break tool :" + runner.wallbreak.getNumber(), 430, DEFAULT_VIEW_SIZE+30);
g2.drawString("Bomb :" + new Boom().getNumber(), 30, DEFAULT_VIEW_SIZE+80);
int[][] mmm =runner.mmm;
//Paint Cell of Game
for(int row = 0; row < cellspan; row++) {
for (int col = 0; col < cellspan; col++){
int x1 = col * size;
int y1 = row * size;
int index = 0;
if (zoomOut){
mg.getShortPath();
mmm=mg.node_set;
index = maze[row][col];
if(shortpath){
for(int i=0;i<mmm.length;i++){
for(int j=0;j<mmm[i].length;j++){
int x2 = j * size;
int y2 = i * size;
if(mmm[i][j]==1){
g2.setColor(Color.red);
g2.setFont(new Font("TimesRoman",1,15));
g2.drawString(">",x2+15, y2+15);
}
if(maze[i][j]==4){
g2.setColor(Color.yellow);
g2.fillRect(x2, y2,15, 15);
}
if(maze[i][j]==19){
g2.setColor(Color.red);
g2.fillRect(x2, y2,15, 15);
}
}
}
}
if (row == currentRow && col == currentCol){
g2.setColor(Color.BLACK);
g2.fillRect(x1, y1, size, size);
continue;
}
}else{
index = maze[currentRow - cellpadding + row][currentCol - cellpadding + col];
// System.out.println(ch);
}
if (index == 0){
imageIndex = -1;;
}else if (index==999){// visited road
imageIndex=999;;
}/*else if (index==998){// break wall
imageIndex=998;;
}*/else if (index == 1){ // wall
imageIndex = 0;
}else if (index ==666){ // paint hero
imageIndex = hero_state;;
}else if (index == 3){ //bomb
imageIndex = 3;;
}else if (index == 2){
imageIndex = 1;;
}else if (index == 4){
//new Enemy(row,col).paint(g2);;
imageIndex=enemy_state;;
}else if (index == 10){
imageIndex = 10;;
}else if (index == 11){
imageIndex = 11;;
}else if (index == 12){
imageIndex = hero_attack;;
}else if (index == 19){
imageIndex = 19;;
}else{
imageIndex = -1;
}
g2.setColor(Color.LIGHT_GRAY);
g2.fillRect(x1, y1, size, size);
if (imageIndex >= 0&& imageIndex!=999 && imageIndex!=998&& imageIndex!=5){
g2.drawImage(images[imageIndex], x1, y1, null);
}else if(imageIndex==999){
g2.setColor(Color.white);
g2.fillRect(x1, y1, size, size);
}/*else if(imageIndex==998){
g2.setColor(Color.white);
g2.fillRect(x1, y1, size, size);
mg.node_set[currentRow - cellpadding + row][currentCol - cellpadding + col]=1;
}*/else if(imageIndex==5){
new enemy_walk().start();
if(nu%2!=0){
g2.drawImage(images[imageIndex], x1, y1, null);
nu++;
}else{
// Create a new enemy_walk();
// check enemy next step is valid or not is valid go next step
// throught action preformed to sleep 200ms
new enemy_walk();
u= enemy_walk.check(currentRow - cellpadding + row,currentCol - cellpadding + col);
System.out.println(u+"***");
if(u==4){
g2.drawImage(images[imageIndex], x1+size, y1, null);
enemy_collision((currentRow - cellpadding + row),(currentCol - cellpadding + col));
//
}else if(u==3){
g2.drawImage(images[imageIndex], x1-size, y1, null);
enemy_collision((currentRow - cellpadding + row),(currentCol - cellpadding + col));
}else if(u==2){
g2.drawImage(images[imageIndex], x1, y1+size, null);
enemy_collision((currentRow - cellpadding + row),(currentCol - cellpadding + col));
}else if(u==1){
g2.drawImage(images[imageIndex], x1, y1-size, null);
enemy_collision((currentRow - cellpadding + row),(currentCol - cellpadding + col));
}
nu++;
// g2.drawImage(images[imageIndex], x1-size, y1, null);
}
}else{
}
}
}
if(Hero.blood<=0){
paintDead(g2);
}
if(new Collision_check().victory_check){
paintVictory(g2);
}
}
public void enemy_collision(int x1,int y1){
if(maze[x1][y1]==666){
maze[x1][y1]=7;
// System.out.println("x1"+x1+"x2"+y1);
try {
runner.ccc=true;
System.out.println("666");
Thread.sleep(200);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void toggleZoom(){
zoomOut = !zoomOut;
System.out.println(zoomOut);
}
int times=0;
public void resetAttack(){
if(times==2){
times=0;
runner.ccc=false;
}
}
public void actionPerformed(ActionEvent e) {
resetAttack();
if (enemy_state < 0 || enemy_state == 5){
enemy_state = 6;
try {
Thread.currentThread();
Thread.sleep(200);
} catch (InterruptedException c) {
// TODO Auto-generated catch block
c.printStackTrace();
}
}else{
enemy_state = 5;
}
try {
Thread.currentThread();
Thread.sleep(200);
} catch (InterruptedException c) {
// TODO Auto-generated catch block
c.printStackTrace();
}
if (hero_state < 0 || hero_state == 7){
hero_state = 8;
}else if(hero_state < 0 || hero_state == 8){
hero_state = 9;
}else{
hero_state = 7;
}
// System.out.println(ccc+"``````");
if(runner.ccc){
System.out.println(runner.ccc);
if( hero_attack==12){
hero_attack = 13;
}else if(hero_attack == 13){
hero_attack = 14;
}else if(hero_attack == 14){
times++;
System.out.println(times);
hero_attack = 15;
}else if(hero_attack == 15){
hero_attack = 16;
}else if(hero_attack == 16){
hero_attack = 17;
}else if( hero_attack == 17){
hero_attack = 18;
}else{
hero_attack = 12;
}
if(times>=2){
hero_attack=7;
}
}
// / times=0;
// runner.ccc=false;
this.repaint();
}
/*public void he(){
int iii=0;
if( hero_attack==12){
iii++;
hero_attack = 13;
}else if(hero_attack == 13){
times++;
System.out.println(times+"`````"+iii);
hero_attack = 14;
}else if(hero_attack == 14){
// times++;
hero_attack = 15;
}else if(hero_attack == 15){
hero_attack = 16;
}else if(hero_attack == 16){
hero_attack = 17;
}else if( hero_attack == 17){
hero_attack = 18;
}else{
hero_attack = 12;
}
}*/
private void init() throws Exception{
images = new BufferedImage[IMAGE_COUNT];
images[0] = ImageIO.read(new java.io.File("resources/mon.png"));
images[1] = ImageIO.read(new java.io.File("resources/sword.png"));
images[2] = ImageIO.read(new java.io.File("resources/help.png"));
images[3] = ImageIO.read(new java.io.File("resources/bomb.png"));
images[4] = ImageIO.read(new java.io.File("resources/h_bomb.png"));
images[5] = ImageIO.read(new java.io.File("resources/spider_down.png"));
images[6] = ImageIO.read(new java.io.File("resources/spider_up.png"));
images[7] = ImageIO.read(new java.io.File("resources/hero1.gif"));
images[8] = ImageIO.read(new java.io.File("resources/hero2.gif"));
images[9] = ImageIO.read(new java.io.File("resources/hero3.gif"));
images[10] = ImageIO.read(new java.io.File("resources/trees.png"));
images[11] = ImageIO.read(new java.io.File("resources/door.png"));
images[12] = ImageIO.read(new java.io.File("resources/attack1.jpg"));
images[13] = ImageIO.read(new java.io.File("resources/attack2.jpg"));
images[14] = ImageIO.read(new java.io.File("resources/attack3.jpg"));
images[15] = ImageIO.read(new java.io.File("resources/attack4.jpg"));
images[16] = ImageIO.read(new java.io.File("resources/attack5.jpg"));
images[17] = ImageIO.read(new java.io.File("resources/attack6.jpg"));
images[18] = ImageIO.read(new java.io.File("resources/attack7.jpg"));
images[19] = ImageIO.read(new java.io.File("resources/health.png"));
// images[20] = ImageIO.read(new java.io.File("resources/health.png"));
}
public boolean isShortpath() {
return shortpath;
}
public void setShortpath() {
shortpath = !shortpath;
}
public void paintDead(Graphics g) {
g.setColor(Color.red);
g.drawString("You are dead. GAME OVER", 200, 400);
timer.stop();
}
public void paintVictory(Graphics g) {
g.setColor(Color.green);
g.drawString("Congrulation , you Win", 200, 400);
timer.stop();
}
}
|
UTF-8
|
Java
| 11,197 |
java
|
GameView.java
|
Java
|
[] | null |
[] |
package ie.gmit.sw.ai.runner;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.Random;
import javax.imageio.*;
import javax.swing.*;
import ie.gmit.sw.ai.Maze.Maze_Generate;
import ie.gmit.sw.ai.characters.Boom;
import ie.gmit.sw.ai.characters.Enemy;
import ie.gmit.sw.ai.characters.Hero;
import ie.gmit.sw.ai.characters.characters;
import ie.gmit.sw.ai.traverse.enemy_walk;
import ie.gmit.sw.ai.traverse.traverse_DFS;
public class GameView extends JPanel implements ActionListener{
private static final long serialVersionUID = 1L;
public static final int DEFAULT_VIEW_SIZE = 800;
private static final int IMAGE_COUNT = 30;
private int cellspan = 5;
private int cellpadding = 2;
public static int[][] maze;
public BufferedImage[] images;
private Maze_Generate mg=new Maze_Generate();
//set action state
private int enemy_state = 5;
private int hero_state = 7;
private int hero_attack = 12;
public Timer timer;
private int currentRow;
private int currentCol;
// Boolean zoomOut
private boolean zoomOut = false;
private int imageIndex = -1;
private characters[][] character;
private boolean shortpath=false;
private static int nu=1;
public GameView(){
}
public GameView(int[][] mazeData) throws Exception{
init();
this.maze = mazeData;
character=new runner().getCharacter();
setBackground(Color.LIGHT_GRAY);
setDoubleBuffered(true);
timer = new Timer(300, this);
timer.start();
/*GameView view=new GameView();
enemy_walk thread1= view.new enemy_walk();*/
}
public void setCurrentRow(int row) {
if (row < cellpadding){
currentRow = cellpadding;
}else if (row > (maze.length - 1) - cellpadding){
currentRow = (maze.length - 1) - cellpadding;
}else{
currentRow = row;
}
}
public void setCurrentCol(int col) {
if (col < cellpadding){
currentCol = cellpadding;
}else if (col > (maze[currentRow].length - 1) - cellpadding){
currentCol = (maze[currentRow].length - 1) - cellpadding;
}else{
currentCol = col;
}
}
public int getCurrentRow() {
return currentRow;
}
public int getCurrentCol() {
return currentCol;
}
//Setting enemy_walk walk Direction
static int u= 0;
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
cellspan = zoomOut ? maze.length : 5;
final int size = DEFAULT_VIEW_SIZE/cellspan;
g2.drawRect(0, 0, GameView.DEFAULT_VIEW_SIZE, GameView.DEFAULT_VIEW_SIZE);
g2.drawImage(images[enemy_state], currentRow*size, currentCol*size, null);
//show hero state
g2.setColor(Color.white);
g2.setFont(new Font("TimesRoman",1,30));
g2.drawString("Blood :" + runner.hero.getBlood(), 30, DEFAULT_VIEW_SIZE+30);
g2.drawString("Wepon :" + runner.wepon.usetimes, 230, DEFAULT_VIEW_SIZE+30);
g2.drawString("Wall break tool :" + runner.wallbreak.getNumber(), 430, DEFAULT_VIEW_SIZE+30);
g2.drawString("Bomb :" + new Boom().getNumber(), 30, DEFAULT_VIEW_SIZE+80);
int[][] mmm =runner.mmm;
//Paint Cell of Game
for(int row = 0; row < cellspan; row++) {
for (int col = 0; col < cellspan; col++){
int x1 = col * size;
int y1 = row * size;
int index = 0;
if (zoomOut){
mg.getShortPath();
mmm=mg.node_set;
index = maze[row][col];
if(shortpath){
for(int i=0;i<mmm.length;i++){
for(int j=0;j<mmm[i].length;j++){
int x2 = j * size;
int y2 = i * size;
if(mmm[i][j]==1){
g2.setColor(Color.red);
g2.setFont(new Font("TimesRoman",1,15));
g2.drawString(">",x2+15, y2+15);
}
if(maze[i][j]==4){
g2.setColor(Color.yellow);
g2.fillRect(x2, y2,15, 15);
}
if(maze[i][j]==19){
g2.setColor(Color.red);
g2.fillRect(x2, y2,15, 15);
}
}
}
}
if (row == currentRow && col == currentCol){
g2.setColor(Color.BLACK);
g2.fillRect(x1, y1, size, size);
continue;
}
}else{
index = maze[currentRow - cellpadding + row][currentCol - cellpadding + col];
// System.out.println(ch);
}
if (index == 0){
imageIndex = -1;;
}else if (index==999){// visited road
imageIndex=999;;
}/*else if (index==998){// break wall
imageIndex=998;;
}*/else if (index == 1){ // wall
imageIndex = 0;
}else if (index ==666){ // paint hero
imageIndex = hero_state;;
}else if (index == 3){ //bomb
imageIndex = 3;;
}else if (index == 2){
imageIndex = 1;;
}else if (index == 4){
//new Enemy(row,col).paint(g2);;
imageIndex=enemy_state;;
}else if (index == 10){
imageIndex = 10;;
}else if (index == 11){
imageIndex = 11;;
}else if (index == 12){
imageIndex = hero_attack;;
}else if (index == 19){
imageIndex = 19;;
}else{
imageIndex = -1;
}
g2.setColor(Color.LIGHT_GRAY);
g2.fillRect(x1, y1, size, size);
if (imageIndex >= 0&& imageIndex!=999 && imageIndex!=998&& imageIndex!=5){
g2.drawImage(images[imageIndex], x1, y1, null);
}else if(imageIndex==999){
g2.setColor(Color.white);
g2.fillRect(x1, y1, size, size);
}/*else if(imageIndex==998){
g2.setColor(Color.white);
g2.fillRect(x1, y1, size, size);
mg.node_set[currentRow - cellpadding + row][currentCol - cellpadding + col]=1;
}*/else if(imageIndex==5){
new enemy_walk().start();
if(nu%2!=0){
g2.drawImage(images[imageIndex], x1, y1, null);
nu++;
}else{
// Create a new enemy_walk();
// check enemy next step is valid or not is valid go next step
// throught action preformed to sleep 200ms
new enemy_walk();
u= enemy_walk.check(currentRow - cellpadding + row,currentCol - cellpadding + col);
System.out.println(u+"***");
if(u==4){
g2.drawImage(images[imageIndex], x1+size, y1, null);
enemy_collision((currentRow - cellpadding + row),(currentCol - cellpadding + col));
//
}else if(u==3){
g2.drawImage(images[imageIndex], x1-size, y1, null);
enemy_collision((currentRow - cellpadding + row),(currentCol - cellpadding + col));
}else if(u==2){
g2.drawImage(images[imageIndex], x1, y1+size, null);
enemy_collision((currentRow - cellpadding + row),(currentCol - cellpadding + col));
}else if(u==1){
g2.drawImage(images[imageIndex], x1, y1-size, null);
enemy_collision((currentRow - cellpadding + row),(currentCol - cellpadding + col));
}
nu++;
// g2.drawImage(images[imageIndex], x1-size, y1, null);
}
}else{
}
}
}
if(Hero.blood<=0){
paintDead(g2);
}
if(new Collision_check().victory_check){
paintVictory(g2);
}
}
public void enemy_collision(int x1,int y1){
if(maze[x1][y1]==666){
maze[x1][y1]=7;
// System.out.println("x1"+x1+"x2"+y1);
try {
runner.ccc=true;
System.out.println("666");
Thread.sleep(200);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void toggleZoom(){
zoomOut = !zoomOut;
System.out.println(zoomOut);
}
int times=0;
public void resetAttack(){
if(times==2){
times=0;
runner.ccc=false;
}
}
public void actionPerformed(ActionEvent e) {
resetAttack();
if (enemy_state < 0 || enemy_state == 5){
enemy_state = 6;
try {
Thread.currentThread();
Thread.sleep(200);
} catch (InterruptedException c) {
// TODO Auto-generated catch block
c.printStackTrace();
}
}else{
enemy_state = 5;
}
try {
Thread.currentThread();
Thread.sleep(200);
} catch (InterruptedException c) {
// TODO Auto-generated catch block
c.printStackTrace();
}
if (hero_state < 0 || hero_state == 7){
hero_state = 8;
}else if(hero_state < 0 || hero_state == 8){
hero_state = 9;
}else{
hero_state = 7;
}
// System.out.println(ccc+"``````");
if(runner.ccc){
System.out.println(runner.ccc);
if( hero_attack==12){
hero_attack = 13;
}else if(hero_attack == 13){
hero_attack = 14;
}else if(hero_attack == 14){
times++;
System.out.println(times);
hero_attack = 15;
}else if(hero_attack == 15){
hero_attack = 16;
}else if(hero_attack == 16){
hero_attack = 17;
}else if( hero_attack == 17){
hero_attack = 18;
}else{
hero_attack = 12;
}
if(times>=2){
hero_attack=7;
}
}
// / times=0;
// runner.ccc=false;
this.repaint();
}
/*public void he(){
int iii=0;
if( hero_attack==12){
iii++;
hero_attack = 13;
}else if(hero_attack == 13){
times++;
System.out.println(times+"`````"+iii);
hero_attack = 14;
}else if(hero_attack == 14){
// times++;
hero_attack = 15;
}else if(hero_attack == 15){
hero_attack = 16;
}else if(hero_attack == 16){
hero_attack = 17;
}else if( hero_attack == 17){
hero_attack = 18;
}else{
hero_attack = 12;
}
}*/
private void init() throws Exception{
images = new BufferedImage[IMAGE_COUNT];
images[0] = ImageIO.read(new java.io.File("resources/mon.png"));
images[1] = ImageIO.read(new java.io.File("resources/sword.png"));
images[2] = ImageIO.read(new java.io.File("resources/help.png"));
images[3] = ImageIO.read(new java.io.File("resources/bomb.png"));
images[4] = ImageIO.read(new java.io.File("resources/h_bomb.png"));
images[5] = ImageIO.read(new java.io.File("resources/spider_down.png"));
images[6] = ImageIO.read(new java.io.File("resources/spider_up.png"));
images[7] = ImageIO.read(new java.io.File("resources/hero1.gif"));
images[8] = ImageIO.read(new java.io.File("resources/hero2.gif"));
images[9] = ImageIO.read(new java.io.File("resources/hero3.gif"));
images[10] = ImageIO.read(new java.io.File("resources/trees.png"));
images[11] = ImageIO.read(new java.io.File("resources/door.png"));
images[12] = ImageIO.read(new java.io.File("resources/attack1.jpg"));
images[13] = ImageIO.read(new java.io.File("resources/attack2.jpg"));
images[14] = ImageIO.read(new java.io.File("resources/attack3.jpg"));
images[15] = ImageIO.read(new java.io.File("resources/attack4.jpg"));
images[16] = ImageIO.read(new java.io.File("resources/attack5.jpg"));
images[17] = ImageIO.read(new java.io.File("resources/attack6.jpg"));
images[18] = ImageIO.read(new java.io.File("resources/attack7.jpg"));
images[19] = ImageIO.read(new java.io.File("resources/health.png"));
// images[20] = ImageIO.read(new java.io.File("resources/health.png"));
}
public boolean isShortpath() {
return shortpath;
}
public void setShortpath() {
shortpath = !shortpath;
}
public void paintDead(Graphics g) {
g.setColor(Color.red);
g.drawString("You are dead. GAME OVER", 200, 400);
timer.stop();
}
public void paintVictory(Graphics g) {
g.setColor(Color.green);
g.drawString("Congrulation , you Win", 200, 400);
timer.stop();
}
}
| 11,197 | 0.609985 | 0.578369 | 452 | 23.774336 | 21.631824 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.449115 | false | false |
3
|
8c55457562357461740f39a4d4d6021ea90f6c9a
| 26,061,861,559,393 |
f19874d67e4ad92c01a6fda4904399a319b531ac
|
/src/main/java/com/example/EmployeeInformation/demo/web/controller/EmployeeController.java
|
18c822df8b3690f1dc2917332817a17cd2756dff
|
[] |
no_license
|
b23karali/EmployeeUploadService
|
https://github.com/b23karali/EmployeeUploadService
|
91aaf5a76c245449e3e975961699294402ea725e
|
0f5b59dffe669cb46715f1a4c00c0598fe47c417
|
refs/heads/master
| 2023-03-22T04:27:44.748000 | 2021-03-14T19:58:46 | 2021-03-14T19:58:46 | 347,734,980 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.EmployeeInformation.demo.web.controller;
import com.example.EmployeeInformation.demo.data.entity.Employee;
import com.example.EmployeeInformation.demo.data.repository.EmployeeRepository;
import com.example.EmployeeInformation.demo.web.service.EmployeeService;
import com.example.EmployeeInformation.demo.web.service.EmployeeServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.*;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
@RestController
@RequestMapping(value = "/api")
public class EmployeeController {
@Autowired
JobLauncher jobLauncher;
@Autowired
JobExplorer jobExplorer;
@Autowired
Job job;
@Autowired
EmployeeRepository employeeRepository;
@Autowired
EmployeeService employeeService;
Logger logger = LoggerFactory.getLogger(EmployeeController.class);
@PostMapping(value = "/employee", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity loadEmployeeData(@RequestParam("action") String[] filters,
@RequestParam("file") MultipartFile file) throws Exception {
if(filters.length > 0 && filters[0].equalsIgnoreCase("upload")){
Long jobExectionId = employeeService.uploadEmployeeDataFromFile(file);
return new ResponseEntity(jobExectionId, HttpStatus.ACCEPTED);
}else
throw new Exception("Action not identified");
}
@GetMapping(value = "/getAll", produces = MediaType.APPLICATION_JSON_VALUE)
public List<Employee> getAllEmployee(){
Iterable<Employee> iterable = employeeRepository.findAll();
return StreamSupport.stream(iterable.spliterator(), false)
.collect(Collectors.toList());
}
@GetMapping(value = "/getJobStatus", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getJobStatus(@RequestParam("jobId") String jobId){
JobExecution jobExecution = jobExplorer.getJobExecution(Long.parseLong(jobId));
return new ResponseEntity(jobExecution.getStatus(), HttpStatus.OK);
}
@PostMapping(value = "/employees", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity addEmployee(@RequestBody Employee employee) throws Exception {
employeeService.saveEmployee(employee);
return new ResponseEntity(HttpStatus.CREATED);
}
@PutMapping(value = "/employees", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity updateEmployee(@RequestBody Employee employee) throws Exception {
if (employeeService.updateEmployee(employee))
return new ResponseEntity(employee, HttpStatus.OK);
else
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@GetMapping(value = "/employees/{employeeId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getEmployee(@PathVariable(value = "employeeId") String employeeId) throws Exception {
Optional<Employee> employee = employeeService.getEmployeeDetails(Long.parseLong(employeeId));
if(employee.isPresent())
return new ResponseEntity(employee.get(), HttpStatus.OK);
else
return new ResponseEntity(null, HttpStatus.NO_CONTENT);
}
@DeleteMapping(value = "/employees/{employeeId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity deleteEmployee(@PathVariable(value = "employeeId") String employeeId) throws Exception {
try{
employeeService.deleteEmployeeDetails(Long.parseLong(employeeId));
return new ResponseEntity(null, HttpStatus.OK);
} catch (EmptyResultDataAccessException ex){
return new ResponseEntity(null, HttpStatus.NO_CONTENT);
}
}
}
|
UTF-8
|
Java
| 4,338 |
java
|
EmployeeController.java
|
Java
|
[] | null |
[] |
package com.example.EmployeeInformation.demo.web.controller;
import com.example.EmployeeInformation.demo.data.entity.Employee;
import com.example.EmployeeInformation.demo.data.repository.EmployeeRepository;
import com.example.EmployeeInformation.demo.web.service.EmployeeService;
import com.example.EmployeeInformation.demo.web.service.EmployeeServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.*;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
@RestController
@RequestMapping(value = "/api")
public class EmployeeController {
@Autowired
JobLauncher jobLauncher;
@Autowired
JobExplorer jobExplorer;
@Autowired
Job job;
@Autowired
EmployeeRepository employeeRepository;
@Autowired
EmployeeService employeeService;
Logger logger = LoggerFactory.getLogger(EmployeeController.class);
@PostMapping(value = "/employee", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity loadEmployeeData(@RequestParam("action") String[] filters,
@RequestParam("file") MultipartFile file) throws Exception {
if(filters.length > 0 && filters[0].equalsIgnoreCase("upload")){
Long jobExectionId = employeeService.uploadEmployeeDataFromFile(file);
return new ResponseEntity(jobExectionId, HttpStatus.ACCEPTED);
}else
throw new Exception("Action not identified");
}
@GetMapping(value = "/getAll", produces = MediaType.APPLICATION_JSON_VALUE)
public List<Employee> getAllEmployee(){
Iterable<Employee> iterable = employeeRepository.findAll();
return StreamSupport.stream(iterable.spliterator(), false)
.collect(Collectors.toList());
}
@GetMapping(value = "/getJobStatus", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getJobStatus(@RequestParam("jobId") String jobId){
JobExecution jobExecution = jobExplorer.getJobExecution(Long.parseLong(jobId));
return new ResponseEntity(jobExecution.getStatus(), HttpStatus.OK);
}
@PostMapping(value = "/employees", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity addEmployee(@RequestBody Employee employee) throws Exception {
employeeService.saveEmployee(employee);
return new ResponseEntity(HttpStatus.CREATED);
}
@PutMapping(value = "/employees", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity updateEmployee(@RequestBody Employee employee) throws Exception {
if (employeeService.updateEmployee(employee))
return new ResponseEntity(employee, HttpStatus.OK);
else
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@GetMapping(value = "/employees/{employeeId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity getEmployee(@PathVariable(value = "employeeId") String employeeId) throws Exception {
Optional<Employee> employee = employeeService.getEmployeeDetails(Long.parseLong(employeeId));
if(employee.isPresent())
return new ResponseEntity(employee.get(), HttpStatus.OK);
else
return new ResponseEntity(null, HttpStatus.NO_CONTENT);
}
@DeleteMapping(value = "/employees/{employeeId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity deleteEmployee(@PathVariable(value = "employeeId") String employeeId) throws Exception {
try{
employeeService.deleteEmployeeDetails(Long.parseLong(employeeId));
return new ResponseEntity(null, HttpStatus.OK);
} catch (EmptyResultDataAccessException ex){
return new ResponseEntity(null, HttpStatus.NO_CONTENT);
}
}
}
| 4,338 | 0.741355 | 0.740433 | 105 | 40.314285 | 33.102528 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
3
|
0a39c3b096b7010df2e93580c9f89dcc290933d0
| 26,061,861,556,968 |
a264c518289cd5324d7dd657a1632a230f37f4e1
|
/familyFinancial/src/com/hi5/ff/entity/CategoryExpenditure.java
|
29d0753f278cbb3cbed040dc9d9d1dd1615243d9
|
[] |
no_license
|
samxzq1983/hi5
|
https://github.com/samxzq1983/hi5
|
1463247d598c50a0090317091d1492d9c3c4299a
|
e011e87f63b3f40219d5a3478eda038a290d25a9
|
refs/heads/master
| 2020-12-31T07:55:54.328000 | 2015-10-31T03:28:56 | 2015-10-31T03:28:56 | 43,903,374 | 0 | 1 | null | false | 2015-10-09T05:37:36 | 2015-10-08T16:48:04 | 2015-10-09T04:06:06 | 2015-10-09T05:37:36 | 0 | 0 | 1 | 0 |
Java
| null | null |
package com.hi5.ff.entity;
public class CategoryExpenditure {
private int categoryID;
private double expenditure;
public int getCategoryID() {
return categoryID;
}
public void setCategoryID(int categoryID) {
this.categoryID = categoryID;
}
public double getExpenditure() {
return expenditure;
}
public void setExpenditure(double expenditure) {
this.expenditure = expenditure;
}
}
|
UTF-8
|
Java
| 435 |
java
|
CategoryExpenditure.java
|
Java
|
[] | null |
[] |
package com.hi5.ff.entity;
public class CategoryExpenditure {
private int categoryID;
private double expenditure;
public int getCategoryID() {
return categoryID;
}
public void setCategoryID(int categoryID) {
this.categoryID = categoryID;
}
public double getExpenditure() {
return expenditure;
}
public void setExpenditure(double expenditure) {
this.expenditure = expenditure;
}
}
| 435 | 0.696552 | 0.694253 | 24 | 16.125 | 15.985182 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.291667 | false | false |
3
|
325ddf399fdf92b54a5de62f1da6b5b2a5a6dd11
| 26,061,861,557,701 |
1c92599ba34ee34288d12a1a4c6032d47aa1ccce
|
/src/test/java/iut/tdd/TestConvert.java
|
756b697ebf3592571e57de5775618504c210c5af
|
[] |
no_license
|
jv1/tdd1
|
https://github.com/jv1/tdd1
|
74212cf5fbc1e1a3c3e55f87025123750dd98d56
|
66526c97ade8635bb4da03b24e02c9f13dada42e
|
refs/heads/master
| 2016-09-11T09:21:02.421000 | 2015-04-17T13:20:44 | 2015-04-17T13:20:44 | 34,114,211 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package iut.tdd;
import junit.framework.Assert;
import org.junit.Test;
public class TestConvert {
@Test
public void test_num2text_zero () {
// Given
String input = "0";
String expected = "zéro";
Convert myConvert = new Convert();
// When
String actual = myConvert.num2text(input);
// Then
Assert.assertEquals(expected, actual);
}
@Test
public void test_text2num_zero(){
// Given
String input = "zéro";
String expected = "0";
Convert myConvert = new Convert();
// When
String actual = myConvert.text2num(input);
// Then
Assert.assertEquals(expected, actual);
}
}
|
UTF-8
|
Java
| 655 |
java
|
TestConvert.java
|
Java
|
[
{
"context": "iven\r\n\t\tString input = \"0\";\r\n\t\tString expected = \"zéro\";\r\n\t\tConvert myConvert = new Convert();\r\n\t\t// Whe",
"end": 214,
"score": 0.9842219948768616,
"start": 210,
"tag": "NAME",
"value": "zéro"
},
{
"context": "text2num_zero(){\r\n\t\t// Given\r\n\t\t\t\tString input = \"zéro\";\r\n\t\t\t\tString expected = \"0\";\r\n\t\t\t\tConvert myConv",
"end": 453,
"score": 0.9929057955741882,
"start": 449,
"tag": "NAME",
"value": "zéro"
}
] | null |
[] |
package iut.tdd;
import junit.framework.Assert;
import org.junit.Test;
public class TestConvert {
@Test
public void test_num2text_zero () {
// Given
String input = "0";
String expected = "zéro";
Convert myConvert = new Convert();
// When
String actual = myConvert.num2text(input);
// Then
Assert.assertEquals(expected, actual);
}
@Test
public void test_text2num_zero(){
// Given
String input = "zéro";
String expected = "0";
Convert myConvert = new Convert();
// When
String actual = myConvert.text2num(input);
// Then
Assert.assertEquals(expected, actual);
}
}
| 655 | 0.62634 | 0.617152 | 32 | 18.40625 | 15.095238 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.15625 | false | false |
3
|
8f0fcfe78bc3b204f03d463fc6e367451121f25c
| 30,966,714,211,547 |
a68a61298c35d21fa0e33ccf04bb17d68c770fb5
|
/src/com/nimych/springdemo/ChessCoach.java
|
e10d1d90b6af7a3caa2b74f9a2273739b15b5022
|
[] |
no_license
|
Hilder64/Spring-Hibernate
|
https://github.com/Hilder64/Spring-Hibernate
|
6385f9bcb5f70a346310ea7638210a24ba0a8c6f
|
7663135efc7f625ae02c01d803e3eec25964c8c2
|
refs/heads/master
| 2020-08-06T13:00:12.477000 | 2020-01-04T12:42:15 | 2020-01-04T12:42:15 | 212,984,694 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.nimych.springdemo;
public class ChessCoach implements Coach {
@Override
public String getDailyWorkout() {
return "Play chess every day for a few games";
}
}
|
UTF-8
|
Java
| 190 |
java
|
ChessCoach.java
|
Java
|
[] | null |
[] |
package com.nimych.springdemo;
public class ChessCoach implements Coach {
@Override
public String getDailyWorkout() {
return "Play chess every day for a few games";
}
}
| 190 | 0.694737 | 0.694737 | 8 | 22.75 | 19.376209 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
3
|
7eb2e67726b5fba571f3785b0599a2ea9fb8a108
| 14,525,579,406,919 |
e573294c6eb8e6554d923311fe76f4b6367ff65f
|
/app/src/main/java/com/github/riyaz/hnbrowser/views/main/FeedItemAdapter.java
|
44cdf4dd106163b38da058dd5cc0ce9b64dd9450
|
[
"MIT"
] |
permissive
|
riyaz-ali/capstone-project
|
https://github.com/riyaz-ali/capstone-project
|
a49c714253a73eefd261e1f76283a50328f4b217
|
dca6f7d46b8a6dd0d91ad56ffcee2b6785b87af6
|
refs/heads/master
| 2020-04-02T22:04:28.214000 | 2018-12-03T10:36:46 | 2018-12-03T10:36:46 | 154,820,861 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.github.riyaz.hnbrowser.views.main;
import android.content.Context;
import android.graphics.Paint;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.github.riyaz.hnbrowser.R;
import com.github.riyaz.hnbrowser.models.FeedItem;
import com.pascalwelsch.arrayadapter.ArrayAdapter;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* {@code RecyclerView.Adapter} implementation for displaying {@link com.github.riyaz.hnbrowser.models.FeedItem}
*/
public class FeedItemAdapter extends ArrayAdapter<FeedItem, FeedItemAdapter.ViewHolder> {
// VH impl
class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
@BindView(R.id.feed_title)
TextView title;
@BindView(R.id.feed_domain)
TextView domain;
@BindView(R.id.feed_points)
TextView points;
@BindView(R.id.feed_posted_by)
TextView postedBy;
ViewHolder(@NonNull View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
itemView.setOnClickListener(this);
domain.setPaintFlags(domain.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
void bind(@NonNull FeedItem model){
title.setText(model.getTitle());
domain.setText(model.getDomain());
points.setText(model.getPoints() + "");
postedBy.setText(Html.
fromHtml(context.getString(R.string.main_posted_by, model.getUser(), model.getTimeAgo())));
}
@Override
public void onClick(View v) {
listener.onClick(getItem(getAdapterPosition()));
}
}
// listener interface for parent to implement
public interface OnClickListener {
// called when a feed item is clicked from the list
void onClick(@NonNull FeedItem feed);
}
// Context
private Context context;
// click listener implementation
private OnClickListener listener;
public FeedItemAdapter(@NonNull Context context, @NonNull OnClickListener listener, @NonNull List<FeedItem> feeds){
super(feeds);
this.context = context;
this.listener = listener;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
return new ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.adapter_feed_item, viewGroup, false));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
viewHolder.bind(getItem(i));
}
@Nullable
@Override
public Object getItemId(@NonNull FeedItem item) {
return item.getId();
}
}
|
UTF-8
|
Java
| 2,964 |
java
|
FeedItemAdapter.java
|
Java
|
[
{
"context": "package com.github.riyaz.hnbrowser.views.main;\n\n\nimport android.content.Co",
"end": 24,
"score": 0.8618817329406738,
"start": 19,
"tag": "USERNAME",
"value": "riyaz"
},
{
"context": "mport android.widget.TextView;\n\nimport com.github.riyaz.hnbrowser.R;\nimport com.github.riyaz.hnbrowser.mo",
"end": 421,
"score": 0.9860587120056152,
"start": 416,
"tag": "USERNAME",
"value": "riyaz"
},
{
"context": "t com.github.riyaz.hnbrowser.R;\nimport com.github.riyaz.hnbrowser.models.FeedItem;\nimport com.pascalwelsc",
"end": 458,
"score": 0.9121695160865784,
"start": 453,
"tag": "USERNAME",
"value": "riyaz"
},
{
"context": "ub.riyaz.hnbrowser.models.FeedItem;\nimport com.pascalwelsch.arrayadapter.ArrayAdapter;\n\nimport java.util.List",
"end": 509,
"score": 0.7052042484283447,
"start": 500,
"tag": "USERNAME",
"value": "calwelsch"
},
{
"context": "mplementation for displaying {@link com.github.riyaz.hnbrowser.models.FeedItem}\n */\npublic class FeedI",
"end": 713,
"score": 0.5071500539779663,
"start": 711,
"tag": "USERNAME",
"value": "az"
}
] | null |
[] |
package com.github.riyaz.hnbrowser.views.main;
import android.content.Context;
import android.graphics.Paint;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.github.riyaz.hnbrowser.R;
import com.github.riyaz.hnbrowser.models.FeedItem;
import com.pascalwelsch.arrayadapter.ArrayAdapter;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* {@code RecyclerView.Adapter} implementation for displaying {@link com.github.riyaz.hnbrowser.models.FeedItem}
*/
public class FeedItemAdapter extends ArrayAdapter<FeedItem, FeedItemAdapter.ViewHolder> {
// VH impl
class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
@BindView(R.id.feed_title)
TextView title;
@BindView(R.id.feed_domain)
TextView domain;
@BindView(R.id.feed_points)
TextView points;
@BindView(R.id.feed_posted_by)
TextView postedBy;
ViewHolder(@NonNull View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
itemView.setOnClickListener(this);
domain.setPaintFlags(domain.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
}
void bind(@NonNull FeedItem model){
title.setText(model.getTitle());
domain.setText(model.getDomain());
points.setText(model.getPoints() + "");
postedBy.setText(Html.
fromHtml(context.getString(R.string.main_posted_by, model.getUser(), model.getTimeAgo())));
}
@Override
public void onClick(View v) {
listener.onClick(getItem(getAdapterPosition()));
}
}
// listener interface for parent to implement
public interface OnClickListener {
// called when a feed item is clicked from the list
void onClick(@NonNull FeedItem feed);
}
// Context
private Context context;
// click listener implementation
private OnClickListener listener;
public FeedItemAdapter(@NonNull Context context, @NonNull OnClickListener listener, @NonNull List<FeedItem> feeds){
super(feeds);
this.context = context;
this.listener = listener;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
return new ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.adapter_feed_item, viewGroup, false));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
viewHolder.bind(getItem(i));
}
@Nullable
@Override
public Object getItemId(@NonNull FeedItem item) {
return item.getId();
}
}
| 2,964 | 0.687247 | 0.68691 | 96 | 29.875 | 28.440819 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.520833 | false | false |
3
|
987c12ff16da3a8250906e4bbc691444cc1cb1cd
| 12,060,268,169,892 |
cdaadc741a0eab17cac2fe4ac006e8c46bf2046c
|
/PDV_antigo/src/test/java/classesAuxiliares/PrepararPDV.java
|
71d7dc2f9aecab164ae3f48c55478907d7e8b947
|
[] |
no_license
|
canalvpsa/bdd
|
https://github.com/canalvpsa/bdd
|
6ae067ca6adf5b1bfd53e5f5c1e540a523b2ff55
|
d4899f3a5c491ebfa839a6cdd5b0d0d6c36a1c74
|
refs/heads/master
| 2021-07-17T03:16:32.334000 | 2021-06-21T12:16:11 | 2021-06-21T12:16:11 | 123,920,733 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package classesAuxiliares;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.net.URL;
import java.sql.SQLException;
import org.sikuli.script.App;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Key;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
import org.sikuli.script.Settings;
import DAO.impl.Maquina;
import DAO.impl.TipoImpressora;
import sincronismoUpdateManager.AcoesPDV;
public class PrepararPDV {
private static PrepararPDV instancia = new PrepararPDV();
private AcoesPDV statusPDV = AcoesPDV.getInstance();
private ValidacoesECF ECF = ValidacoesECF.getInstance();
private AbrirFecharRotinas cadastro = AbrirFecharRotinas.getInstance();
private TipoImpressora BDtipoImpressora = new TipoImpressora();
private Maquina BDmaquina = new Maquina();
private Screen s = new Screen();
private Pattern m_loginPDV = new Pattern(getImage("imgGeral/loginPDV.png")).similar(0.90f);
private Pattern m_emAtendimento = new Pattern(getImage("imgOrcamentoPedido/emAtendimento.png")).similar(0.98f);
private Pattern m_PDVabrindo = new Pattern(getImage("imgGeral/PDVabrindo.png")).similar(0.98f);
private Pattern m_loginSenha = new Pattern(getImage("imgGeral/loginSenha.png")).similar(0.85f);
private Pattern m_loginUsuario = new Pattern(getImage("imgGeral/loginUsuario.png")).similar(0.85f);
private Pattern m_loginUsuarioVazio = new Pattern(getImage("imgGeral/loginUsuarioVazio.png")).similar(0.55f);
private Pattern m_abrirCaixa = new Pattern(getImage("imgGeral/abrirCaixa.png")).similar(0.90f);
String imageString, docFiscalParametro, docFiscal;
boolean PDVaberto;
private String getImage(String path) {
URL url = getClass().getClassLoader().getResource(path);
imageString = url.toString();
return imageString;
}
public static PrepararPDV getInstance(){
if (instancia ==null){
instancia = new PrepararPDV();
}
return instancia;
}
public void verificaSituacaoPDV(String docFiscal) throws InterruptedException, FindFailed, IOException, ClassNotFoundException, SQLException{
Settings.ActionLogs = false;
if(BDtipoImpressora.getTipoImpressora(docFiscal) == false){
BDtipoImpressora.atualizarTipoImpressora(docFiscal);
BDmaquina.atualizarAtualizaecf();
statusPDV.fecharPDV();
File diretorio = new File("C:/VPSA/PDV/config");
FileFilter ff = new FileFilter() {
public boolean accept(File arquivo){
return arquivo.getName().endsWith(".txt");
}
};
File[] arquivos = diretorio.listFiles(ff);
if(arquivos != null){
for(File arquivo : arquivos){
arquivo.delete();
}
}
}
if(s.exists(m_abrirCaixa) == null){
//Verifica se tem PDV em andamento
if (statusPDV.processoPDVandamento() != null) {
PDVaberto = true;
//Se nao conseguir focar no PDV, deve finalizar o processo dele
if (App.focus("PDV 4.0") == null) {
statusPDV.fecharPDV();
PDVaberto = false;
}
}
if (PDVaberto == false) {
iniciarPDV();
}
// SE ESTIVER NA TELA DE VENDA, CANCELA O PEDIDO
if (s.exists(m_emAtendimento) != null) {
cadastro.sairPedido();
}
}
}
public void iniciarPDV() throws InterruptedException, FindFailed, IOException, ClassNotFoundException, SQLException{
Settings.ActionLogs = false;
s.wait(5.0);
//Inicia PDV
statusPDV.abrePDV();
while (s.exists(m_PDVabrindo) != null) {
}
//Se trabalhar com ECF, deve validar mensagens da impressora
if(BDtipoImpressora.getTipoImpressora("SWEDA") == true)
ECF.validaECFaberturaPDV();
s.wait(m_loginPDV, 300);
login();
}
public void login() throws FindFailed, ClassNotFoundException, SQLException{
if (App.focus("PDV 4.0") != null) {
// LOGAR SE O TERMINAL ESTIVER FECHADO
if (s.exists(m_loginSenha) != null) {
s.exists(m_loginSenha);
if (App.focus("PDV 4.0") != null) {
if (s.exists(m_loginUsuario) != null) {
s.type(Key.TAB);
} else {
s.click(m_loginUsuarioVazio);
s.type("cxsp");
}
s.type(Key.ENTER);
s.type("varejonline");
s.type(Key.ENTER);
// VALIDA SE ESTA NA TELA PRINCIPAL DO PDV
s.wait(m_abrirCaixa, 10.0);
// VERIFICA SE TEM REDCAO Z PENDENTE
s.wait(2.0);
if(BDtipoImpressora.getTipoImpressora("SWEDA") == true)
ECF.verificaReducaoZPendente();
}
}
}
}
}
|
UTF-8
|
Java
| 4,365 |
java
|
PrepararPDV.java
|
Java
|
[] | null |
[] |
package classesAuxiliares;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.net.URL;
import java.sql.SQLException;
import org.sikuli.script.App;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Key;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;
import org.sikuli.script.Settings;
import DAO.impl.Maquina;
import DAO.impl.TipoImpressora;
import sincronismoUpdateManager.AcoesPDV;
public class PrepararPDV {
private static PrepararPDV instancia = new PrepararPDV();
private AcoesPDV statusPDV = AcoesPDV.getInstance();
private ValidacoesECF ECF = ValidacoesECF.getInstance();
private AbrirFecharRotinas cadastro = AbrirFecharRotinas.getInstance();
private TipoImpressora BDtipoImpressora = new TipoImpressora();
private Maquina BDmaquina = new Maquina();
private Screen s = new Screen();
private Pattern m_loginPDV = new Pattern(getImage("imgGeral/loginPDV.png")).similar(0.90f);
private Pattern m_emAtendimento = new Pattern(getImage("imgOrcamentoPedido/emAtendimento.png")).similar(0.98f);
private Pattern m_PDVabrindo = new Pattern(getImage("imgGeral/PDVabrindo.png")).similar(0.98f);
private Pattern m_loginSenha = new Pattern(getImage("imgGeral/loginSenha.png")).similar(0.85f);
private Pattern m_loginUsuario = new Pattern(getImage("imgGeral/loginUsuario.png")).similar(0.85f);
private Pattern m_loginUsuarioVazio = new Pattern(getImage("imgGeral/loginUsuarioVazio.png")).similar(0.55f);
private Pattern m_abrirCaixa = new Pattern(getImage("imgGeral/abrirCaixa.png")).similar(0.90f);
String imageString, docFiscalParametro, docFiscal;
boolean PDVaberto;
private String getImage(String path) {
URL url = getClass().getClassLoader().getResource(path);
imageString = url.toString();
return imageString;
}
public static PrepararPDV getInstance(){
if (instancia ==null){
instancia = new PrepararPDV();
}
return instancia;
}
public void verificaSituacaoPDV(String docFiscal) throws InterruptedException, FindFailed, IOException, ClassNotFoundException, SQLException{
Settings.ActionLogs = false;
if(BDtipoImpressora.getTipoImpressora(docFiscal) == false){
BDtipoImpressora.atualizarTipoImpressora(docFiscal);
BDmaquina.atualizarAtualizaecf();
statusPDV.fecharPDV();
File diretorio = new File("C:/VPSA/PDV/config");
FileFilter ff = new FileFilter() {
public boolean accept(File arquivo){
return arquivo.getName().endsWith(".txt");
}
};
File[] arquivos = diretorio.listFiles(ff);
if(arquivos != null){
for(File arquivo : arquivos){
arquivo.delete();
}
}
}
if(s.exists(m_abrirCaixa) == null){
//Verifica se tem PDV em andamento
if (statusPDV.processoPDVandamento() != null) {
PDVaberto = true;
//Se nao conseguir focar no PDV, deve finalizar o processo dele
if (App.focus("PDV 4.0") == null) {
statusPDV.fecharPDV();
PDVaberto = false;
}
}
if (PDVaberto == false) {
iniciarPDV();
}
// SE ESTIVER NA TELA DE VENDA, CANCELA O PEDIDO
if (s.exists(m_emAtendimento) != null) {
cadastro.sairPedido();
}
}
}
public void iniciarPDV() throws InterruptedException, FindFailed, IOException, ClassNotFoundException, SQLException{
Settings.ActionLogs = false;
s.wait(5.0);
//Inicia PDV
statusPDV.abrePDV();
while (s.exists(m_PDVabrindo) != null) {
}
//Se trabalhar com ECF, deve validar mensagens da impressora
if(BDtipoImpressora.getTipoImpressora("SWEDA") == true)
ECF.validaECFaberturaPDV();
s.wait(m_loginPDV, 300);
login();
}
public void login() throws FindFailed, ClassNotFoundException, SQLException{
if (App.focus("PDV 4.0") != null) {
// LOGAR SE O TERMINAL ESTIVER FECHADO
if (s.exists(m_loginSenha) != null) {
s.exists(m_loginSenha);
if (App.focus("PDV 4.0") != null) {
if (s.exists(m_loginUsuario) != null) {
s.type(Key.TAB);
} else {
s.click(m_loginUsuarioVazio);
s.type("cxsp");
}
s.type(Key.ENTER);
s.type("varejonline");
s.type(Key.ENTER);
// VALIDA SE ESTA NA TELA PRINCIPAL DO PDV
s.wait(m_abrirCaixa, 10.0);
// VERIFICA SE TEM REDCAO Z PENDENTE
s.wait(2.0);
if(BDtipoImpressora.getTipoImpressora("SWEDA") == true)
ECF.verificaReducaoZPendente();
}
}
}
}
}
| 4,365 | 0.707675 | 0.699198 | 152 | 27.717106 | 28.014427 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.467105 | false | false |
3
|
276522357d5d0796566df3d434d3c3cf1da0e8f5
| 25,288,767,449,191 |
ec1e0dd8f9820abd52ba60e5d1b96acf474ab615
|
/src/main/java/com/whxx/core/utils/sign/SignConfig.java
|
e9e1e2006542fe178d6e80a8303ba5cf3093d20e
|
[] |
no_license
|
13thlancer/hotelManager
|
https://github.com/13thlancer/hotelManager
|
f8b2b4e8dda82392102bd1dc06e65c61c857dd44
|
8827006a7d91e7ea8ae87204bc5fb66fa066ce98
|
refs/heads/master
| 2020-03-21T08:04:50.141000 | 2018-06-22T15:29:34 | 2018-06-22T15:29:34 | 138,318,746 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.whxx.core.utils.sign;
public class SignConfig {
// 商户密钥
public static final String KEY_ALGORITHM = "RSA";
public static final String CIPHER_ALGORITHM = "RSA/ECB/PKCS1Padding";
public static final String PUBLIC_KEY = "publicKey";
public static final String PRIVATE_KEY = "privateKey";
public static final int KEY_SIZE = 2048;
public static final String SIGNATURE_ALGORITHM = "SHA256withRSA";
public static final String ENCODE_ALGORITHM = "SHA-256";
public static String CHARSET = "UTF-8";
}
|
UTF-8
|
Java
| 521 |
java
|
SignConfig.java
|
Java
|
[] | null |
[] |
package com.whxx.core.utils.sign;
public class SignConfig {
// 商户密钥
public static final String KEY_ALGORITHM = "RSA";
public static final String CIPHER_ALGORITHM = "RSA/ECB/PKCS1Padding";
public static final String PUBLIC_KEY = "publicKey";
public static final String PRIVATE_KEY = "privateKey";
public static final int KEY_SIZE = 2048;
public static final String SIGNATURE_ALGORITHM = "SHA256withRSA";
public static final String ENCODE_ALGORITHM = "SHA-256";
public static String CHARSET = "UTF-8";
}
| 521 | 0.756335 | 0.732943 | 14 | 35.642857 | 24.073124 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false |
3
|
c252513074858025f797d227bc9d2a72bc0df3c7
| 31,035,433,693,919 |
50e571d055f61970574591565464d60a148a130f
|
/src/main/java/com/hughes/lou/lintcode/easy/MatrixZigzagTraversal185.java
|
8c2169302a51fb1b94e6fbc7f660af558b707cad
|
[] |
no_license
|
HughesLou/lintcode
|
https://github.com/HughesLou/lintcode
|
8a6290654e579bd9beb82aaec2852147c18f8147
|
97ba9b6bf0d3796387f741f18f885cc442e72796
|
refs/heads/master
| 2022-06-02T05:51:22.318000 | 2022-05-24T11:41:35 | 2022-05-24T11:41:35 | 114,759,434 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (C) 2018 Hughes Lou, Inc. All Rights Reserved.
*/
package com.hughes.lou.lintcode.easy;
import com.hughes.lou.lintcode.level.Easy;
/**
* 给你一个包含 m x n 个元素的矩阵 (m 行, n 列), 求该矩阵的之字型遍历。
* <p>
* Created by Hughes on 2018/1/19 22:04.
*/
public class MatrixZigzagTraversal185 implements Easy {
/*
* @param matrix: An array of integers
* @return: An array of integers
*/
public int[] printZMatrix(int[][] matrix) {
int x, y, dx, dy, count, m, n;
x = y = 0;
count = 1;
dx = -1;
dy = 1;
m = matrix.length;
n = matrix[0].length;
int[] result = new int[m * n];
result[0] = matrix[0][0];
while (count < m * n) {
if (x + dx >= 0 && y + dy >= 0 && x + dx < m && y + dy < n) {
x += dx;
y += dy;
} else if (dx == -1 && dy == 1) {
if (y + 1 < n) {
++y;
} else {
++x;
}
dx = 1;
dy = -1;
} else {
if (x + 1 < m) {
++x;
} else {
++y;
}
dx = -1;
dy = 1;
}
result[count] = matrix[x][y];
++count;
}
return result;
}
}
|
UTF-8
|
Java
| 1,434 |
java
|
MatrixZigzagTraversal185.java
|
Java
|
[
{
"context": "/*\n * Copyright (C) 2018 Hughes Lou, Inc. All Rights Reserved.\n */\n\npackage com.hughe",
"end": 35,
"score": 0.9998470544815063,
"start": 25,
"tag": "NAME",
"value": "Hughes Lou"
},
{
"context": "元素的矩阵 (m 行, n 列), 求该矩阵的之字型遍历。\n * <p>\n * Created by Hughes on 2018/1/19 22:04.\n */\npublic class MatrixZigzag",
"end": 229,
"score": 0.9986994862556458,
"start": 223,
"tag": "USERNAME",
"value": "Hughes"
}
] | null |
[] |
/*
* Copyright (C) 2018 <NAME>, Inc. All Rights Reserved.
*/
package com.hughes.lou.lintcode.easy;
import com.hughes.lou.lintcode.level.Easy;
/**
* 给你一个包含 m x n 个元素的矩阵 (m 行, n 列), 求该矩阵的之字型遍历。
* <p>
* Created by Hughes on 2018/1/19 22:04.
*/
public class MatrixZigzagTraversal185 implements Easy {
/*
* @param matrix: An array of integers
* @return: An array of integers
*/
public int[] printZMatrix(int[][] matrix) {
int x, y, dx, dy, count, m, n;
x = y = 0;
count = 1;
dx = -1;
dy = 1;
m = matrix.length;
n = matrix[0].length;
int[] result = new int[m * n];
result[0] = matrix[0][0];
while (count < m * n) {
if (x + dx >= 0 && y + dy >= 0 && x + dx < m && y + dy < n) {
x += dx;
y += dy;
} else if (dx == -1 && dy == 1) {
if (y + 1 < n) {
++y;
} else {
++x;
}
dx = 1;
dy = -1;
} else {
if (x + 1 < m) {
++x;
} else {
++y;
}
dx = -1;
dy = 1;
}
result[count] = matrix[x][y];
++count;
}
return result;
}
}
| 1,430 | 0.367775 | 0.341763 | 55 | 24.163637 | 16.116354 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
3
|
4be710660e408503daa9ec0e3f13f3f0e81a0d94
| 8,031,588,859,005 |
0312f7d3481212b9112b15bcc42cd996bae22440
|
/src/main/java/com/oracle/customer/order/service/CustomerOrderService.java
|
327c0a540fde0a484f6383e4665251dbba7ee3bb
|
[] |
no_license
|
Hotel006/Team006_Hotel
|
https://github.com/Hotel006/Team006_Hotel
|
d388969cce91227fc5bd1683a9635e38a680d578
|
d7a388fa0ec95332e8158ac90cf654e4f8cb215c
|
refs/heads/master
| 2020-09-28T11:12:47.566000 | 2019-12-23T06:29:12 | 2019-12-23T06:29:12 | 226,766,856 | 0 | 0 | null | false | 2019-12-12T08:28:21 | 2019-12-09T02:22:30 | 2019-12-12T08:28:00 | 2019-12-12T08:27:58 | 2,918 | 0 | 0 | 0 |
JavaScript
| false | false |
package com.oracle.customer.order.service;
import java.sql.SQLException;
import java.util.List;
import com.oracle.customer.order.dao.CustomerOrderDao;
import com.oracle.entity.Hotel_order;
public class CustomerOrderService {
CustomerOrderDao cod = new CustomerOrderDao();
public List<Hotel_order> queryByIntro(int uid) throws SQLException {
List<Hotel_order> list = cod.queryByIntro(uid);
System.out.println(list.size());
return list;
}
}
|
UTF-8
|
Java
| 458 |
java
|
CustomerOrderService.java
|
Java
|
[] | null |
[] |
package com.oracle.customer.order.service;
import java.sql.SQLException;
import java.util.List;
import com.oracle.customer.order.dao.CustomerOrderDao;
import com.oracle.entity.Hotel_order;
public class CustomerOrderService {
CustomerOrderDao cod = new CustomerOrderDao();
public List<Hotel_order> queryByIntro(int uid) throws SQLException {
List<Hotel_order> list = cod.queryByIntro(uid);
System.out.println(list.size());
return list;
}
}
| 458 | 0.768559 | 0.768559 | 21 | 20.809525 | 22.076963 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.952381 | false | false |
3
|
86f559be389428c0350a2a26c9b43809212efef7
| 9,844,065,059,105 |
0ad0bd906823833f7a3679870bbb888f5d7a46be
|
/Lab5D.java
|
84bb4b9bfbbc152e58d12c8a34b75bb620990ac7
|
[] |
no_license
|
JoshuaGraves28/First-GUI-Project
|
https://github.com/JoshuaGraves28/First-GUI-Project
|
1a3126ea1f43d2a51efcaa215ca6b5ffcef8f6f3
|
023926f02972342b8aa9cc609377adb16ca6b580
|
refs/heads/master
| 2021-09-25T21:51:31.964000 | 2018-10-25T18:38:12 | 2018-10-25T18:38:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package lab5a;
import java.awt.*;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.*;
public class Lab5D extends JPanel {
private final int MAX_LAYER = 10;
private ArrayList<Shape> shapes;
/* CONSTRUCTOR */
public Lab5D() {
super();
this.setBackground(Color.decode("#00BFFF")); // Deep Sky Blue
shapes = new ArrayList<>();
for(int i = 0; i<30;++i ){
int num = (int) (Math.random()*3+1);
int x = (int) (Math.random()*500+1);
int y = (int) (Math.random()*500+1);
int z = (int) (Math.random()*2);
int radius = (int) (Math.random()*100+1);
int width =(int) (Math.random()*100+10);
int length =(int) (Math.random()*100+10);
int base =(int) (Math.random()*100+10);
int height = (int) (Math.random()*100+10);
if(num ==1){
shapes.add(new Circle(x,y,z,radius));
}
if(num==2){
shapes.add(new Rectangle(x,y,z,length,width ));
}
if(num==3){
shapes.add(new Triangle(x,y,z,base, height));
}
}}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
/* Iterate through Layers 1 through 10 */
for (int i = 0; i < MAX_LAYER; ++i) {
/* Iterate through Shape collection */
for (Shape s : shapes) {
/* Get X and Y coordinates */
int x = s.getX();
int y = s.getY();
/* Check Layer */
if (s.getZ() == i) {
/* RECTANGLE */
if (s instanceof Rectangle) {
g.setColor(Color.decode("#B22222")); // Firebrick Red
int width = (int)((Rectangle)s).getWidth();
int len = (int)((Rectangle)s).getLength();
g.fillRect(x-(width/2), y-(len/2), len, width);
}
/* CIRCLE */
else if (s instanceof Circle) {
g.setColor(Color.YELLOW); // Yellow
int radius = (int)((Circle)s).getRadius();
g.fillOval(x-radius/2, y-radius/2, radius, radius);
}
/* TRIANGLE */
else if (s instanceof Triangle) {
g.setColor(Color.decode("#228B22")); // Forest Green
int height = (int)((Triangle)s).getHeight();
int base= (int)((Triangle)s).getBase();
int []xPoint = {x-(base/2),x,x+(base/2)};
int []yPoint = {y+(height/2),y-(height/2),y+(height/2)};
int nPoints = 3;
g.fillPolygon(xPoint, yPoint, nPoints);
}
/* Tag shape with area */
g.setColor(Color.ORANGE);
g.drawString(Integer.toString((int)s.area()), x, y);
} // end layer if
} // end shapes loop
} // end layer loop
} // end paintComponent()
}
|
UTF-8
|
Java
| 3,775 |
java
|
Lab5D.java
|
Java
|
[] | null |
[] |
package lab5a;
import java.awt.*;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.*;
public class Lab5D extends JPanel {
private final int MAX_LAYER = 10;
private ArrayList<Shape> shapes;
/* CONSTRUCTOR */
public Lab5D() {
super();
this.setBackground(Color.decode("#00BFFF")); // Deep Sky Blue
shapes = new ArrayList<>();
for(int i = 0; i<30;++i ){
int num = (int) (Math.random()*3+1);
int x = (int) (Math.random()*500+1);
int y = (int) (Math.random()*500+1);
int z = (int) (Math.random()*2);
int radius = (int) (Math.random()*100+1);
int width =(int) (Math.random()*100+10);
int length =(int) (Math.random()*100+10);
int base =(int) (Math.random()*100+10);
int height = (int) (Math.random()*100+10);
if(num ==1){
shapes.add(new Circle(x,y,z,radius));
}
if(num==2){
shapes.add(new Rectangle(x,y,z,length,width ));
}
if(num==3){
shapes.add(new Triangle(x,y,z,base, height));
}
}}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
/* Iterate through Layers 1 through 10 */
for (int i = 0; i < MAX_LAYER; ++i) {
/* Iterate through Shape collection */
for (Shape s : shapes) {
/* Get X and Y coordinates */
int x = s.getX();
int y = s.getY();
/* Check Layer */
if (s.getZ() == i) {
/* RECTANGLE */
if (s instanceof Rectangle) {
g.setColor(Color.decode("#B22222")); // Firebrick Red
int width = (int)((Rectangle)s).getWidth();
int len = (int)((Rectangle)s).getLength();
g.fillRect(x-(width/2), y-(len/2), len, width);
}
/* CIRCLE */
else if (s instanceof Circle) {
g.setColor(Color.YELLOW); // Yellow
int radius = (int)((Circle)s).getRadius();
g.fillOval(x-radius/2, y-radius/2, radius, radius);
}
/* TRIANGLE */
else if (s instanceof Triangle) {
g.setColor(Color.decode("#228B22")); // Forest Green
int height = (int)((Triangle)s).getHeight();
int base= (int)((Triangle)s).getBase();
int []xPoint = {x-(base/2),x,x+(base/2)};
int []yPoint = {y+(height/2),y-(height/2),y+(height/2)};
int nPoints = 3;
g.fillPolygon(xPoint, yPoint, nPoints);
}
/* Tag shape with area */
g.setColor(Color.ORANGE);
g.drawString(Integer.toString((int)s.area()), x, y);
} // end layer if
} // end shapes loop
} // end layer loop
} // end paintComponent()
}
| 3,775 | 0.377483 | 0.358411 | 128 | 27.460938 | 22.851048 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.546875 | false | false |
3
|
38f2b243b11d0980ed79296deed5d32cc19f673b
| 13,322,988,567,517 |
12c4008073f919692c53e64f7457b2e581ae90cc
|
/CollectionDisplay/src/project1/DisplayCollectionTest.java
|
0a95b085b0d4aff1ad545689764f458b83927760
|
[] |
no_license
|
Pholoxo/Java_Projects
|
https://github.com/Pholoxo/Java_Projects
|
d67d66f2523103f36e6847edad929dbb51aed7cc
|
51488a0b745e6c987015d5dfe749589cf72c0560
|
refs/heads/master
| 2020-05-17T16:55:17.973000 | 2019-04-28T00:38:40 | 2019-04-28T00:38:40 | 183,833,049 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package project1;
import bag.BagInterface;
import student.TestCase;
/**
* Test class for DisplayCollection
*
* @author Jairo Diaz-Ortiz
* @version September 14, 2017
*
*/
public class DisplayCollectionTest extends TestCase {
/**
* This sets up the test cases for DisplayColleciton
*/
public void setUp() {
// this is empty intentionally
}
// ~ Methods ...............................................................
/**
* This tests the BagContents() method
*/
public void testBagContents() {
DisplayCollection display = new DisplayCollection();
BagInterface<String> bag = display.getItemBag();
int bagSize = bag.getCurrentSize();
for (int i = 0; i < bagSize; i++) {
String str = bag.remove();
assertTrue(str.equals(DisplayCollection.STRINGS[0]) || str.equals(
DisplayCollection.STRINGS[1]) || str.equals(
DisplayCollection.STRINGS[2]) || str.equals(
DisplayCollection.STRINGS[3]));
}
}
// .........................................................................
/**
* This tests the BagSize() method
*/
public void testBagSize() {
for (int i = 0; i < 20; i++) {
DisplayCollection display = new DisplayCollection();
BagInterface<String> bag = display.getItemBag();
bag.getCurrentSize();
assertTrue(bag.getCurrentSize() <= 15 || bag.getCurrentSize() >= 5);
assertFalse(bag.getCurrentSize() > 16 || bag.getCurrentSize() < 5);
}
}
}
|
UTF-8
|
Java
| 1,640 |
java
|
DisplayCollectionTest.java
|
Java
|
[
{
"context": " * Test class for DisplayCollection\n * \n * @author Jairo Diaz-Ortiz\n * @version September 14, 2017\n *\n */\npublic clas",
"end": 141,
"score": 0.9998779296875,
"start": 125,
"tag": "NAME",
"value": "Jairo Diaz-Ortiz"
}
] | null |
[] |
package project1;
import bag.BagInterface;
import student.TestCase;
/**
* Test class for DisplayCollection
*
* @author <NAME>
* @version September 14, 2017
*
*/
public class DisplayCollectionTest extends TestCase {
/**
* This sets up the test cases for DisplayColleciton
*/
public void setUp() {
// this is empty intentionally
}
// ~ Methods ...............................................................
/**
* This tests the BagContents() method
*/
public void testBagContents() {
DisplayCollection display = new DisplayCollection();
BagInterface<String> bag = display.getItemBag();
int bagSize = bag.getCurrentSize();
for (int i = 0; i < bagSize; i++) {
String str = bag.remove();
assertTrue(str.equals(DisplayCollection.STRINGS[0]) || str.equals(
DisplayCollection.STRINGS[1]) || str.equals(
DisplayCollection.STRINGS[2]) || str.equals(
DisplayCollection.STRINGS[3]));
}
}
// .........................................................................
/**
* This tests the BagSize() method
*/
public void testBagSize() {
for (int i = 0; i < 20; i++) {
DisplayCollection display = new DisplayCollection();
BagInterface<String> bag = display.getItemBag();
bag.getCurrentSize();
assertTrue(bag.getCurrentSize() <= 15 || bag.getCurrentSize() >= 5);
assertFalse(bag.getCurrentSize() > 16 || bag.getCurrentSize() < 5);
}
}
}
| 1,630 | 0.52378 | 0.510976 | 62 | 25.451612 | 26.173538 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.451613 | false | false |
3
|
2635b6af4d561ed4ca611154a012f1062497d689
| 11,733,850,667,389 |
214f6e72c768c2030670f1537a857c831bdf128a
|
/313.Super Ugly Number/Solution.java
|
592737aedb6d2780933094a08e9a1c43807467dd
|
[] |
no_license
|
zjsyhjh/leetcode
|
https://github.com/zjsyhjh/leetcode
|
79d4ad1b8b9e0da743813a8bb9dd1a28aea4133b
|
384cd5e7a782bdd371bdedebf012c0e721ce28b0
|
refs/heads/master
| 2020-04-10T03:29:59.047000 | 2017-04-03T08:44:33 | 2017-04-03T08:44:33 | 68,012,869 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Solution {
private int[] ugly;
private int[] ptr;
public int nthSuperUglyNumber(int n, int[] primes) {
ugly = new int[n + 1];
ugly[1] = 1;
ptr = new int[primes.length];
for (int i = 0; i < ptr.length; i++){
ptr[i] = 1;
}
int index = 1;
while (index <= n) {
int minVal = Integer.MAX_VALUE;
for (int i = 0; i < primes.length; i++) {
minVal = Math.min(minVal, primes[i] * ugly[ptr[i]]);
}
ugly[++index] = minVal;
for (int i = 0; i < primes.length; i++) {
while (primes[i] * ugly[ptr[i]] <= minVal) ptr[i]++;
}
}
return ugly[n];
}
}
|
UTF-8
|
Java
| 707 |
java
|
Solution.java
|
Java
|
[] | null |
[] |
public class Solution {
private int[] ugly;
private int[] ptr;
public int nthSuperUglyNumber(int n, int[] primes) {
ugly = new int[n + 1];
ugly[1] = 1;
ptr = new int[primes.length];
for (int i = 0; i < ptr.length; i++){
ptr[i] = 1;
}
int index = 1;
while (index <= n) {
int minVal = Integer.MAX_VALUE;
for (int i = 0; i < primes.length; i++) {
minVal = Math.min(minVal, primes[i] * ugly[ptr[i]]);
}
ugly[++index] = minVal;
for (int i = 0; i < primes.length; i++) {
while (primes[i] * ugly[ptr[i]] <= minVal) ptr[i]++;
}
}
return ugly[n];
}
}
| 707 | 0.462518 | 0.451202 | 25 | 27.32 | 18.283808 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.36 | false | false |
3
|
e8c2bf7acfae67c627e36a5eef864594666972dc
| 10,179,072,509,800 |
62edebc5d76d6bae3e0becfd672f1db6c7509471
|
/src/Day39_wrapperClass/WrapperClasses.java
|
c56502b954ad9585b4ce82cff9b207cfc94a7170
|
[] |
no_license
|
Dzhakhongir1/Class01
|
https://github.com/Dzhakhongir1/Class01
|
28a6e3dad0f735c3b3794c11d03a1a43d739aef5
|
dc4e7ba53f063cf1d20080eb6e33d2b7a59d1762
|
refs/heads/master
| 2023-07-12T12:10:15.448000 | 2021-08-15T01:33:00 | 2021-08-15T01:33:00 | 371,149,958 | 0 | 0 | null | false | 2021-07-13T23:13:23 | 2021-05-26T19:38:35 | 2021-07-11T14:58:41 | 2021-07-13T23:13:22 | 384 | 0 | 0 | 0 |
Java
| false | false |
package Day39_wrapperClass;
import sun.text.normalizer.UCharacter;
public class WrapperClasses {
public static void main(String[] args) {
int num =100;
Integer n=new Integer(500);
System.out.println("is n 500>?="+n.equals(500));
System.out.println(n+300);
Integer n2=1000;
String numStr=n2+"";
String numSt=n2.toString();
System.out.println(numSt);
Byte b1= new Byte((byte)5);
Byte b2 =10;
Short sh1=new Short((short)40);
Short sh2=50;
Integer i1 =new Integer(100);
Integer i2=200;
Long l1 =new Long(300l);
Long l2= 3455l;
Float fl1= new Float(5.2);
Float fl2=45.3f;
Double d1 = new Double (345.3);
Double d2 = 234.5;
Character ch1= new Character('Q');
Character ch2='V';
Boolean bl1=new Boolean(true);
Boolean bl2= false;
}
}
|
UTF-8
|
Java
| 937 |
java
|
WrapperClasses.java
|
Java
|
[] | null |
[] |
package Day39_wrapperClass;
import sun.text.normalizer.UCharacter;
public class WrapperClasses {
public static void main(String[] args) {
int num =100;
Integer n=new Integer(500);
System.out.println("is n 500>?="+n.equals(500));
System.out.println(n+300);
Integer n2=1000;
String numStr=n2+"";
String numSt=n2.toString();
System.out.println(numSt);
Byte b1= new Byte((byte)5);
Byte b2 =10;
Short sh1=new Short((short)40);
Short sh2=50;
Integer i1 =new Integer(100);
Integer i2=200;
Long l1 =new Long(300l);
Long l2= 3455l;
Float fl1= new Float(5.2);
Float fl2=45.3f;
Double d1 = new Double (345.3);
Double d2 = 234.5;
Character ch1= new Character('Q');
Character ch2='V';
Boolean bl1=new Boolean(true);
Boolean bl2= false;
}
}
| 937 | 0.559232 | 0.481323 | 40 | 22.424999 | 15.921507 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.65 | false | false |
3
|
63ddf9a594a24fc39c27ef8ecebcdd11191622f9
| 18,081,812,332,171 |
81d8474c876cd14f6b2ff81e70a269f76e7b363c
|
/app/src/main/java/com/example/user/testteamextention/MainActivity.java
|
69a42e28e37cfb7cd0eb5b45545b18c73c372833
|
[] |
no_license
|
LaviniaDragunoi/TestTeamExtention
|
https://github.com/LaviniaDragunoi/TestTeamExtention
|
f0ee3e610aabfdd922fc56d5272df391951d8d61
|
ef8197a32a872b6ea8e0669d53052e74763523f9
|
refs/heads/master
| 2020-04-09T08:50:58.129000 | 2018-12-03T19:41:38 | 2018-12-03T19:41:38 | 160,210,635 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.user.testteamextention;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.example.user.testteamextention.adapter.ItemAdapter;
import com.example.user.testteamextention.data.ApiClient;
import com.example.user.testteamextention.data.ApiInterface;
import com.example.user.testteamextention.model.ItemObject;
import com.example.user.testteamextention.model.ItemResponse;
import java.util.List;
import butterknife.BindView;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity extends AppCompatActivity {
private static final String TAG = MainActivity.class.getName();
private Context context;
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button getBttn = findViewById(R.id.get_button);
getBttn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadList(v);
}
});
}
private void loadList(View view){
ApiInterface apiInterface = ApiClient.getClient().create(ApiInterface.class);
final Call<ItemResponse> call = apiInterface.getItemsList();
call.enqueue(new Callback<ItemResponse>() {
@Override
public void onResponse(@NonNull Call<ItemResponse> call, @NonNull Response<ItemResponse> response) {
List<ItemObject> items = response.body().getResults();
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(context);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(new ItemAdapter(context, items));
}
@Override
public void onFailure(Call<ItemResponse> call, Throwable t) {
Log.e(TAG, t.toString());
}
});
}
}
|
UTF-8
|
Java
| 2,416 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.example.user.testteamextention;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.example.user.testteamextention.adapter.ItemAdapter;
import com.example.user.testteamextention.data.ApiClient;
import com.example.user.testteamextention.data.ApiInterface;
import com.example.user.testteamextention.model.ItemObject;
import com.example.user.testteamextention.model.ItemResponse;
import java.util.List;
import butterknife.BindView;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity extends AppCompatActivity {
private static final String TAG = MainActivity.class.getName();
private Context context;
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button getBttn = findViewById(R.id.get_button);
getBttn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loadList(v);
}
});
}
private void loadList(View view){
ApiInterface apiInterface = ApiClient.getClient().create(ApiInterface.class);
final Call<ItemResponse> call = apiInterface.getItemsList();
call.enqueue(new Callback<ItemResponse>() {
@Override
public void onResponse(@NonNull Call<ItemResponse> call, @NonNull Response<ItemResponse> response) {
List<ItemObject> items = response.body().getResults();
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(context);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(new ItemAdapter(context, items));
}
@Override
public void onFailure(Call<ItemResponse> call, Throwable t) {
Log.e(TAG, t.toString());
}
});
}
}
| 2,416 | 0.685017 | 0.682533 | 74 | 31.621622 | 27.465311 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.554054 | false | false |
3
|
cbab25ea6a770c75d7253d8c1c846c4c24351f28
| 27,479,200,792,658 |
521beb466b07b79d69547b68d377348c890aca24
|
/src/main/java/com/java/bms/driver/mapper/DriverMapper.java
|
140d02929685e954f4f96a042591b4e7a5f81b99
|
[] |
no_license
|
zl264/bms
|
https://github.com/zl264/bms
|
a6c6ba7f51b3c63349cd953dc49377bcdd56a48a
|
e5cc1b21a7a0df03b715bf81774a0e6e9c8d6547
|
refs/heads/master
| 2023-02-03T21:34:38.103000 | 2020-12-24T04:02:48 | 2020-12-24T04:02:48 | 315,324,326 | 0 | 1 | null | false | 2020-12-21T00:36:07 | 2020-11-23T13:29:23 | 2020-12-21T00:27:58 | 2020-12-21T00:36:06 | 1,215 | 0 | 1 | 0 |
HTML
| false | false |
package com.java.bms.driver.mapper;
import com.java.bms.driver.DO.CongressApplyDriverDO;
import com.java.bms.driver.VO.UserDriverVO;
import com.java.bms.driver.VO.CongressDriver;
import com.java.bms.driver.VO.DriverVO;
import com.java.bms.other.DO.UserDO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
/**
* 对于司机用户登录注册的数据库访问的控制
*/
@Mapper
@Repository
public interface DriverMapper {
/**
* 通过用户名和密码来查找输入的用户名密码是否正确
* @param username 用户名
* @param password 密码
* @return 返回按照用户名和密码得到的用户
*/
@Select("select * from driverLogin where username=#{username} and password=#{password}")
UserDO driverLogin(String username, String password);
/**
* 通过用户名判断该用户名有没有被注册
* @param username 用户名
* @return 返回用户名或者NULL
*/
@Select("select * from driverLogin where username=#{username}")
String isRegister(String username);
/**
* 对用户输入的用户名和密码进行注册
* @param username 用户名
* @param password 密码
* @return 返回1或者0
*/
@Insert("insert into driverLogin(username,password) values(#{username},#{password})")
int driverRegister(String username,String password);
/**
* 通过司机ID获取司机信息
* @param driverId
* @return
*/
@Select("select * from driver where driverId = #{driverId}")
DriverVO getDriverByDriverId(int driverId);
/**
* 填入司机信息
* @param driverId
* @param name
* @param tel
* @param capacity
* @param licensePlateNumber
* @param sex
* @param age
* @param idCardNo
* @return
*/
@Insert("insert into driver(driverId,username,name,tel,capacity,licensePlateNumber,sex,age,idCardNo)" +
"values(#{driverId},#{username},#{name},#{tel},#{capacity},#{licensePlateNumber},#{sex},#{age},#{idCardNo})")
int addDriverInformation(int driverId,String username,String name,String tel,int capacity,String licensePlateNumber,String sex,int age,String idCardNo);
/**
* 修改司机信息
* @param driverId
* @param name
* @param tel
* @param capacity
* @param licensePlateNumber
* @param sex
* @param age
* @param idCardNo
* @return
*/
@Update("update driver set username = #{username},name = #{name}, tel = #{tel},capacity = #{capacity}," +
"licensePlateNumber = #{licensePlateNumber}, sex = #{sex},age = #{age},idCardNo = #{idCardNo} " +
" where driverId = #{driverId}")
int updateDriverInformation(int driverId,String username,String name,String tel,int capacity,String licensePlateNumber,String sex,int age,String idCardNo);
/**
*
* @param username
* @return
*/
@Select("select id from driverLogin where username = #{username}")
int getDriverIdByUsername(String username);
/**
* 修改司机信息
* @param driverId
* @param name
* @param tel
* @param capacity
* @param licensePlateNumber
* @param sex
* @param age
* @param idCardNo
* @return
*/
@Update("update driver set username = #{username},name = #{name}, tel = #{tel},capacity = #{capacity}," +
"licensePlateNumber = #{licensePlateNumber}, sex = #{sex},age = #{age},idCardNo = #{idCardNo} " +
" where driverId = #{driverId}")
int alterDriverInformation(int driverId,String username,String name,String tel,int capacity,String licensePlateNumber,String sex,int age,String idCardNo);
/**
* 获取所有申请该司机的会议
* @param driverId
* @return
*/
@Select("select congressApplyDriver.driverId,congress.congressId,congress.title from congressApplyDriver,congress " +
"where congressApplyDriver.driverId = #{driverId} and congressApplyDriver.congressId = congress.congressId")
List<CongressApplyDriverDO> getApplyCongressesByDriverId(int driverId);
/**
* 通过司机ID获取他要接送的会议,时间地点已经确定好
* @param driverId
* @return
*/
@Select("select congressDriver.driverId,congress.congressId,congress.title,congressDriver.time,congressDriver.place" +
" from congressDriver,congress " +
"where congressDriver.driverId = #{driverId} and congressDriver.congressId = congress.congressId " +
" and congressDriver.place is not null and congressDriver.time is not null")
List<CongressDriver> getCongressByDriverId(int driverId);
/**
* 通过司机ID获取他要接送的会议,时间地点可能未确定好
* @param driverId
* @return
*/
@Select("select congressDriver.driverId,congress.congressId,congress.title,congressDriver.time,congressDriver.place" +
" from congressDriver,congress " +
"where congressDriver.driverId = #{driverId} and congressDriver.congressId = congress.congressId")
List<CongressDriver> getAllCongressByDriverId(int driverId);
/**
* 删除会议申请司机记录
* @param driverId
* @param congressId
* @return
*/
@Delete("delete from congressApplyDriver where driverId = #{driverId} and congressId = #{congressId}")
int deleteApplyCongressByDriverIdAndCongressId(int driverId,int congressId);
/**
* 添加司机要接送的会议的记录
* @param driverId
* @param congressId
* @return
*/
@Insert("insert into congressDriver(driverId,congressId) " +
"values(#{driverId},#{congressId})")
int addCongressDriver(int driverId, int congressId);
/**
* 添加司机拒绝会议的记录
* @param driverId
* @param congressId
* @return
*/
@Insert("insert into driverRefuseCongress(driverId,congressId)" +
"values(#{driverId},#{congressId})")
int addDriverRefuseCongress(int driverId,int congressId);
@Update("update congressDriver set time = #{time} " +
"where congressId = #{congressId} and driverId = #{driverId}")
int addTime(int congressId,int driverId,LocalDateTime time);
/**
* 通过司机ID和会议ID删除接送任务
* @param driverId
* @param congressId
* @return
*/
@Delete("delete from congressDriver where driverId = #{driverId} and congressId = #{congressId}")
int deleteCongressDriver(int driverId,int congressId);
/**
* 删除司机所有的接送任务
* @param driverId
* @param congressId
* @return
*/
@Delete("delete from userDriver where driverId = #{driverId} and congressId = #{congressId}")
int deleteUserDriver(int driverId,int congressId);
/**
* 获取司机接送的人员名单
* @param driverId
* @param congressId
* @return
*/
@Select("select userDriver.*,commonUser.username,commonUser.tel,congressNote.arrivalTime from userDriver,commonUser,congressNote " +
"where userDriver.driverId = #{driverId} and userDriver.congressId = #{congressId} " +
"and userDriver.commonId = commonUser.commonId and congressNote.congressId = #{congressId}" +
" and congressNote.commonId = userDriver.commonId")
List<UserDriverVO> getList(int driverId,int congressId);
/**
* 判断用户名和手机号是否一致
* @param username
* @param tel
* @return
*/
@Select("select count(*) from driver where username = #{username} and tel = #{tel}")
int usernameAndTelIsRight(String username,String tel);
/**
* 更新密码
* @param driverId
* @param password
* @return
*/
@Update("update driverLogin set password = #{password} " +
"where id = #{driverId}")
int updatePassword(int driverId,String password);
/**
* 更新司机图片
* @param image
* @param driverId
* @return
*/
@Update("update driver set image = #{image} where driverId = #{driverId}")
int updateDriverImage(String image,int driverId);
}
|
UTF-8
|
Java
| 8,279 |
java
|
DriverMapper.java
|
Java
|
[
{
"context": " * @param username 用户名\n * @param password 密码\n * @return 返回按照用户名和密码得到的用户\n */\n @Selec",
"end": 578,
"score": 0.9824143648147583,
"start": 576,
"tag": "PASSWORD",
"value": "密码"
},
{
"context": " * @param username 用户名\n * @param password 密码\n * @return 返回1或者0\n */\n @Insert(\"insert",
"end": 1059,
"score": 0.9531000256538391,
"start": 1057,
"tag": "PASSWORD",
"value": "密码"
},
{
"context": "ge,idCardNo)\" +\n \"values(#{driverId},#{username},#{name},#{tel},#{capacity},#{licensePlateNumber}",
"end": 1798,
"score": 0.6974245309829712,
"start": 1790,
"tag": "USERNAME",
"value": "username"
},
{
"context": "\n */\n @Update(\"update driver set username = #{username},name = #{name}, tel = #{tel},capacity = ",
"end": 2299,
"score": 0.5982890129089355,
"start": 2299,
"tag": "USERNAME",
"value": ""
},
{
"context": " */\n @Update(\"update driver set username = #{username},name = #{name}, tel = #{tel},capacity = #{capaci",
"end": 2310,
"score": 0.6631929874420166,
"start": 2302,
"tag": "USERNAME",
"value": "username"
},
{
"context": "ct(\"select id from driverLogin where username = #{username}\")\n int getDriverIdByUsername(String username)",
"end": 2812,
"score": 0.7572100162506104,
"start": 2804,
"tag": "USERNAME",
"value": "username"
},
{
"context": " */\n @Update(\"update driver set username = #{username},name = #{name}, tel = #{tel},capacity = #{capaci",
"end": 3137,
"score": 0.8661946058273315,
"start": 3129,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package com.java.bms.driver.mapper;
import com.java.bms.driver.DO.CongressApplyDriverDO;
import com.java.bms.driver.VO.UserDriverVO;
import com.java.bms.driver.VO.CongressDriver;
import com.java.bms.driver.VO.DriverVO;
import com.java.bms.other.DO.UserDO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
/**
* 对于司机用户登录注册的数据库访问的控制
*/
@Mapper
@Repository
public interface DriverMapper {
/**
* 通过用户名和密码来查找输入的用户名密码是否正确
* @param username 用户名
* @param password 密码
* @return 返回按照用户名和密码得到的用户
*/
@Select("select * from driverLogin where username=#{username} and password=#{password}")
UserDO driverLogin(String username, String password);
/**
* 通过用户名判断该用户名有没有被注册
* @param username 用户名
* @return 返回用户名或者NULL
*/
@Select("select * from driverLogin where username=#{username}")
String isRegister(String username);
/**
* 对用户输入的用户名和密码进行注册
* @param username 用户名
* @param password 密码
* @return 返回1或者0
*/
@Insert("insert into driverLogin(username,password) values(#{username},#{password})")
int driverRegister(String username,String password);
/**
* 通过司机ID获取司机信息
* @param driverId
* @return
*/
@Select("select * from driver where driverId = #{driverId}")
DriverVO getDriverByDriverId(int driverId);
/**
* 填入司机信息
* @param driverId
* @param name
* @param tel
* @param capacity
* @param licensePlateNumber
* @param sex
* @param age
* @param idCardNo
* @return
*/
@Insert("insert into driver(driverId,username,name,tel,capacity,licensePlateNumber,sex,age,idCardNo)" +
"values(#{driverId},#{username},#{name},#{tel},#{capacity},#{licensePlateNumber},#{sex},#{age},#{idCardNo})")
int addDriverInformation(int driverId,String username,String name,String tel,int capacity,String licensePlateNumber,String sex,int age,String idCardNo);
/**
* 修改司机信息
* @param driverId
* @param name
* @param tel
* @param capacity
* @param licensePlateNumber
* @param sex
* @param age
* @param idCardNo
* @return
*/
@Update("update driver set username = #{username},name = #{name}, tel = #{tel},capacity = #{capacity}," +
"licensePlateNumber = #{licensePlateNumber}, sex = #{sex},age = #{age},idCardNo = #{idCardNo} " +
" where driverId = #{driverId}")
int updateDriverInformation(int driverId,String username,String name,String tel,int capacity,String licensePlateNumber,String sex,int age,String idCardNo);
/**
*
* @param username
* @return
*/
@Select("select id from driverLogin where username = #{username}")
int getDriverIdByUsername(String username);
/**
* 修改司机信息
* @param driverId
* @param name
* @param tel
* @param capacity
* @param licensePlateNumber
* @param sex
* @param age
* @param idCardNo
* @return
*/
@Update("update driver set username = #{username},name = #{name}, tel = #{tel},capacity = #{capacity}," +
"licensePlateNumber = #{licensePlateNumber}, sex = #{sex},age = #{age},idCardNo = #{idCardNo} " +
" where driverId = #{driverId}")
int alterDriverInformation(int driverId,String username,String name,String tel,int capacity,String licensePlateNumber,String sex,int age,String idCardNo);
/**
* 获取所有申请该司机的会议
* @param driverId
* @return
*/
@Select("select congressApplyDriver.driverId,congress.congressId,congress.title from congressApplyDriver,congress " +
"where congressApplyDriver.driverId = #{driverId} and congressApplyDriver.congressId = congress.congressId")
List<CongressApplyDriverDO> getApplyCongressesByDriverId(int driverId);
/**
* 通过司机ID获取他要接送的会议,时间地点已经确定好
* @param driverId
* @return
*/
@Select("select congressDriver.driverId,congress.congressId,congress.title,congressDriver.time,congressDriver.place" +
" from congressDriver,congress " +
"where congressDriver.driverId = #{driverId} and congressDriver.congressId = congress.congressId " +
" and congressDriver.place is not null and congressDriver.time is not null")
List<CongressDriver> getCongressByDriverId(int driverId);
/**
* 通过司机ID获取他要接送的会议,时间地点可能未确定好
* @param driverId
* @return
*/
@Select("select congressDriver.driverId,congress.congressId,congress.title,congressDriver.time,congressDriver.place" +
" from congressDriver,congress " +
"where congressDriver.driverId = #{driverId} and congressDriver.congressId = congress.congressId")
List<CongressDriver> getAllCongressByDriverId(int driverId);
/**
* 删除会议申请司机记录
* @param driverId
* @param congressId
* @return
*/
@Delete("delete from congressApplyDriver where driverId = #{driverId} and congressId = #{congressId}")
int deleteApplyCongressByDriverIdAndCongressId(int driverId,int congressId);
/**
* 添加司机要接送的会议的记录
* @param driverId
* @param congressId
* @return
*/
@Insert("insert into congressDriver(driverId,congressId) " +
"values(#{driverId},#{congressId})")
int addCongressDriver(int driverId, int congressId);
/**
* 添加司机拒绝会议的记录
* @param driverId
* @param congressId
* @return
*/
@Insert("insert into driverRefuseCongress(driverId,congressId)" +
"values(#{driverId},#{congressId})")
int addDriverRefuseCongress(int driverId,int congressId);
@Update("update congressDriver set time = #{time} " +
"where congressId = #{congressId} and driverId = #{driverId}")
int addTime(int congressId,int driverId,LocalDateTime time);
/**
* 通过司机ID和会议ID删除接送任务
* @param driverId
* @param congressId
* @return
*/
@Delete("delete from congressDriver where driverId = #{driverId} and congressId = #{congressId}")
int deleteCongressDriver(int driverId,int congressId);
/**
* 删除司机所有的接送任务
* @param driverId
* @param congressId
* @return
*/
@Delete("delete from userDriver where driverId = #{driverId} and congressId = #{congressId}")
int deleteUserDriver(int driverId,int congressId);
/**
* 获取司机接送的人员名单
* @param driverId
* @param congressId
* @return
*/
@Select("select userDriver.*,commonUser.username,commonUser.tel,congressNote.arrivalTime from userDriver,commonUser,congressNote " +
"where userDriver.driverId = #{driverId} and userDriver.congressId = #{congressId} " +
"and userDriver.commonId = commonUser.commonId and congressNote.congressId = #{congressId}" +
" and congressNote.commonId = userDriver.commonId")
List<UserDriverVO> getList(int driverId,int congressId);
/**
* 判断用户名和手机号是否一致
* @param username
* @param tel
* @return
*/
@Select("select count(*) from driver where username = #{username} and tel = #{tel}")
int usernameAndTelIsRight(String username,String tel);
/**
* 更新密码
* @param driverId
* @param password
* @return
*/
@Update("update driverLogin set password = #{password} " +
"where id = #{driverId}")
int updatePassword(int driverId,String password);
/**
* 更新司机图片
* @param image
* @param driverId
* @return
*/
@Update("update driver set image = #{image} where driverId = #{driverId}")
int updateDriverImage(String image,int driverId);
}
| 8,279 | 0.650383 | 0.650123 | 242 | 30.805784 | 34.24184 | 159 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512397 | false | false |
3
|
9f41ee6fb6deae73b03267157fbb6a8edb396f35
| 27,479,200,791,807 |
aa5a7cad88378b59b59c3827a3e760ac6342c71a
|
/Assignment04.java
|
80e810d817375c0ccec5982d9bdeb5bbf2176d4f
|
[] |
no_license
|
sephiroth042/CSE110_ASSIGNMENT04
|
https://github.com/sephiroth042/CSE110_ASSIGNMENT04
|
bd7545f1fb17ee7505975dfeed024c7e4fda3cd8
|
30a0d12581ad00c7b67b313a363b3b9b52c52541
|
refs/heads/main
| 2023-07-31T18:38:52.423000 | 2021-09-16T06:16:19 | 2021-09-16T06:16:19 | 407,044,471 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// CSE 110 : 74845 / ONLINE
// Assignment : 4
// Author : MORRIS, CHRIS 1223564576
// Description : MASTER MIND
import java.util.Scanner;
import java.util.Random;
public class Assignment04 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Random random = new Random();
final int NUMBER_LENGTH = 4;
int[] solutionArray = new int[NUMBER_LENGTH];
int numberCorrect = 0;
int guessCount = 0;
for(int i = 0; i < NUMBER_LENGTH; i++){
solutionArray[i] = random.nextInt(10);
}
while(numberCorrect < NUMBER_LENGTH){
guessCount++;
promptGame(guessCount);
int guess = in.nextInt();
int[] guessArray = convertToArray(guess);
numberCorrect = correctCounter(guessArray, solutionArray);
}
}
//prompt user to play game
public static void promptGame(int guessCount){
System.out.println("----- MASTERMIND -----");
System.out.println("Guess the 4 digit number!");
System.out.println("Guess " + guessCount + ":");
}
public static int[] convertToArray(int n) {
int [] temp = new int[String.valueOf(n).length()]; // Calculate the length of digits
int i = String.valueOf(n).length()-1 ; // Initialize the value to the last index
do {
temp[i] = n % 10;
n = n / 10;
i--;
} while(n>0);
return temp;
}
public static int correctCounter(int gArray[] , int sArray[]){
int count = 0;
for(int i = 0; i < sArray.length; i++){
int temp = gArray[i];
int temp2 = sArray[i];
if(temp == temp2){
count++;
}
else{
count = 0;
}
}
System.out.println("You matched " + count);
return count;
}
}
|
UTF-8
|
Java
| 1,970 |
java
|
Assignment04.java
|
Java
|
[
{
"context": "74845 / ONLINE\n// Assignment : 4\n// Author : MORRIS, CHRIS 1223564576\n// Description : MASTER MIND\n\ni",
"end": 74,
"score": 0.9998193979263306,
"start": 68,
"tag": "NAME",
"value": "MORRIS"
},
{
"context": "ONLINE\n// Assignment : 4\n// Author : MORRIS, CHRIS 1223564576\n// Description : MASTER MIND\n\nimport ja",
"end": 81,
"score": 0.8753563761711121,
"start": 76,
"tag": "NAME",
"value": "CHRIS"
}
] | null |
[] |
// CSE 110 : 74845 / ONLINE
// Assignment : 4
// Author : MORRIS, CHRIS 1223564576
// Description : MASTER MIND
import java.util.Scanner;
import java.util.Random;
public class Assignment04 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Random random = new Random();
final int NUMBER_LENGTH = 4;
int[] solutionArray = new int[NUMBER_LENGTH];
int numberCorrect = 0;
int guessCount = 0;
for(int i = 0; i < NUMBER_LENGTH; i++){
solutionArray[i] = random.nextInt(10);
}
while(numberCorrect < NUMBER_LENGTH){
guessCount++;
promptGame(guessCount);
int guess = in.nextInt();
int[] guessArray = convertToArray(guess);
numberCorrect = correctCounter(guessArray, solutionArray);
}
}
//prompt user to play game
public static void promptGame(int guessCount){
System.out.println("----- MASTERMIND -----");
System.out.println("Guess the 4 digit number!");
System.out.println("Guess " + guessCount + ":");
}
public static int[] convertToArray(int n) {
int [] temp = new int[String.valueOf(n).length()]; // Calculate the length of digits
int i = String.valueOf(n).length()-1 ; // Initialize the value to the last index
do {
temp[i] = n % 10;
n = n / 10;
i--;
} while(n>0);
return temp;
}
public static int correctCounter(int gArray[] , int sArray[]){
int count = 0;
for(int i = 0; i < sArray.length; i++){
int temp = gArray[i];
int temp2 = sArray[i];
if(temp == temp2){
count++;
}
else{
count = 0;
}
}
System.out.println("You matched " + count);
return count;
}
}
| 1,970 | 0.518782 | 0.498985 | 70 | 27.128571 | 21.849434 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542857 | false | false |
3
|
bf6e07e7ce543985a3d74cacd6cc028c3d9ab263
| 5,377,299,058,315 |
3bac0b2ae891609e7ff91a5dccbeb2e053bf575c
|
/IOCProj12-ArrayInjection/src/main/java/com/nit/test/ArrayInjectionTest.java
|
4b0fa7722583b83796dc5121807bf794ccddd3f6
|
[] |
no_license
|
kartik777p/NTSP613-Spring
|
https://github.com/kartik777p/NTSP613-Spring
|
b17f10d3fed1749e0f0fdfba078c9e102dd66ff0
|
6a58ba35904d30c86c9bc7fcba48d8389c5ccdaa
|
refs/heads/main
| 2023-03-07T03:52:40.936000 | 2021-02-22T06:46:25 | 2021-02-22T06:46:25 | 324,771,612 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.nit.test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import com.nit.beans.College;
public class ArrayInjectionTest {
public static void main(String[] args) {
DefaultListableBeanFactory factory=null;
XmlBeanDefinitionReader reader=null;
College col=null;
//create container
factory=new DefaultListableBeanFactory();
reader=new XmlBeanDefinitionReader(factory);
reader.loadBeanDefinitions("com/nit/cfgs/applicationContext.xml");
//get target class obj
col=factory.getBean("college",College.class);
//print obj data
System.out.println(col);
}
}
|
UTF-8
|
Java
| 711 |
java
|
ArrayInjectionTest.java
|
Java
|
[] | null |
[] |
package com.nit.test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import com.nit.beans.College;
public class ArrayInjectionTest {
public static void main(String[] args) {
DefaultListableBeanFactory factory=null;
XmlBeanDefinitionReader reader=null;
College col=null;
//create container
factory=new DefaultListableBeanFactory();
reader=new XmlBeanDefinitionReader(factory);
reader.loadBeanDefinitions("com/nit/cfgs/applicationContext.xml");
//get target class obj
col=factory.getBean("college",College.class);
//print obj data
System.out.println(col);
}
}
| 711 | 0.766526 | 0.766526 | 24 | 27.625 | 22.932533 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.541667 | false | false |
3
|
4e3ee009f7b486fab84ebd2f4a30143dca00f2b2
| 32,873,679,703,946 |
1aab138364c12e1084f2303b0501a5d9d5a10fcf
|
/library/src/main/java/se/sammygadd/library/halclient/HalContainer.java
|
8e40c30bf6d975056ea64fc33a118d2bdb061893
|
[] |
no_license
|
sammyhenningsson/HALClientLibrary
|
https://github.com/sammyhenningsson/HALClientLibrary
|
0d5aa093227a981fe9de409aeef9bf684a7c7393
|
370bbc509ef01e17f3a55385659c40e1c7bb382d
|
refs/heads/master
| 2020-04-26T01:30:45.549000 | 2019-04-11T05:07:40 | 2019-04-11T05:07:40 | 173,206,595 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package se.sammygadd.library.halclient;
import java.util.ArrayList;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModelProviders;
import se.sammygadd.library.halclient.resources.Error;
import se.sammygadd.library.halclient.resources.Form;
import se.sammygadd.library.halclient.resources.Resource;
import se.sammygadd.library.halclient.resources.ValidationError;
import se.sammygadd.library.halclient.layouts.FormLayout;
import se.sammygadd.library.halclient.layouts.HalLayout;
public class HalContainer extends Container {
public interface OnNavigateToListener {
void onNavigateTo(String rel, String uri);
}
public interface OnSubmitFormListener {
void onSubmitForm(Form form);
}
protected OnNavigateToListener mOnNavigateToListener;
protected OnSubmitFormListener mOnSubmitFormListener;
public HalContainer(AppCompatActivity activity) {
super(activity);
mActivity = activity;
mViewModel = ViewModelProviders.of(activity).get(ResourceViewModel.class);
mView = new MutableLiveData<>();
mBackStack = new ArrayList<>();
setOnNavigateToListener(null);
setOnSubmitFormListener(null);
ApiService.create(activity.getApplicationContext());
}
private OnNavigateToListener defaultOnNavigateToListener() {
return (rel, uri) -> showResource(uri);
}
private OnSubmitFormListener defaultOnSubmitFormListener() {
return (form) -> {
mViewModel.submitForm(form).observe(mActivity, result -> {
mView.setValue(getView(result, form));
});
};
}
public void setOnNavigateToListener(OnNavigateToListener listener) {
if (listener == null) {
listener = defaultOnNavigateToListener();
}
mOnNavigateToListener = listener;
}
public void setOnSubmitFormListener(OnSubmitFormListener listener) {
if (listener == null) {
listener = defaultOnSubmitFormListener();
}
mOnSubmitFormListener = listener;
}
public HalLayout getHALLayout(Resource resource) {
return new HalLayout(mActivity, resource, mOnNavigateToListener);
}
public HalLayout getErrorLayout(Error error) {
// Currently there is no special view for errors
return new HalLayout(mActivity, error, mOnNavigateToListener);
}
public FormLayout getFormLayout(Form form) {
return new FormLayout(mActivity, form, mOnNavigateToListener, mOnSubmitFormListener);
}
public FormLayout getFormLayout(Form form, ValidationError validationError) {
return new FormLayout(mActivity, form, validationError, mOnNavigateToListener, mOnSubmitFormListener);
}
}
|
UTF-8
|
Java
| 2,812 |
java
|
HalContainer.java
|
Java
|
[] | null |
[] |
package se.sammygadd.library.halclient;
import java.util.ArrayList;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModelProviders;
import se.sammygadd.library.halclient.resources.Error;
import se.sammygadd.library.halclient.resources.Form;
import se.sammygadd.library.halclient.resources.Resource;
import se.sammygadd.library.halclient.resources.ValidationError;
import se.sammygadd.library.halclient.layouts.FormLayout;
import se.sammygadd.library.halclient.layouts.HalLayout;
public class HalContainer extends Container {
public interface OnNavigateToListener {
void onNavigateTo(String rel, String uri);
}
public interface OnSubmitFormListener {
void onSubmitForm(Form form);
}
protected OnNavigateToListener mOnNavigateToListener;
protected OnSubmitFormListener mOnSubmitFormListener;
public HalContainer(AppCompatActivity activity) {
super(activity);
mActivity = activity;
mViewModel = ViewModelProviders.of(activity).get(ResourceViewModel.class);
mView = new MutableLiveData<>();
mBackStack = new ArrayList<>();
setOnNavigateToListener(null);
setOnSubmitFormListener(null);
ApiService.create(activity.getApplicationContext());
}
private OnNavigateToListener defaultOnNavigateToListener() {
return (rel, uri) -> showResource(uri);
}
private OnSubmitFormListener defaultOnSubmitFormListener() {
return (form) -> {
mViewModel.submitForm(form).observe(mActivity, result -> {
mView.setValue(getView(result, form));
});
};
}
public void setOnNavigateToListener(OnNavigateToListener listener) {
if (listener == null) {
listener = defaultOnNavigateToListener();
}
mOnNavigateToListener = listener;
}
public void setOnSubmitFormListener(OnSubmitFormListener listener) {
if (listener == null) {
listener = defaultOnSubmitFormListener();
}
mOnSubmitFormListener = listener;
}
public HalLayout getHALLayout(Resource resource) {
return new HalLayout(mActivity, resource, mOnNavigateToListener);
}
public HalLayout getErrorLayout(Error error) {
// Currently there is no special view for errors
return new HalLayout(mActivity, error, mOnNavigateToListener);
}
public FormLayout getFormLayout(Form form) {
return new FormLayout(mActivity, form, mOnNavigateToListener, mOnSubmitFormListener);
}
public FormLayout getFormLayout(Form form, ValidationError validationError) {
return new FormLayout(mActivity, form, validationError, mOnNavigateToListener, mOnSubmitFormListener);
}
}
| 2,812 | 0.71835 | 0.71835 | 81 | 33.703705 | 27.612148 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62963 | false | false |
3
|
1e6ad8e096cedc5019c896178c89abf80fff245a
| 9,139,690,425,328 |
7157ca27ceeb5c9ea66ec88522e1965b0420a0a5
|
/lichkin-spring-boot-activiti-api/src/main/java/com/lichkin/activiti/beans/out/impl/GetProcessTaskFormOut.java
|
878cde5ffa465ae631e1892d2e5fbc6d314ab2e2
|
[
"MIT"
] |
permissive
|
xclfly/lichkin-spring-boot-activiti-api
|
https://github.com/xclfly/lichkin-spring-boot-activiti-api
|
e07591fa485b0a9fdbe35a8e25964fe4c8514970
|
9e0718123f00232e6eed2e1a6d21322dc38b9b95
|
refs/heads/master
| 2020-03-28T16:46:52.610000 | 2018-08-22T11:42:46 | 2018-08-22T11:42:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lichkin.activiti.beans.out.impl;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* 获取流程节点表单
* @author SuZhou LichKin Information Technology Co.; Ltd.
*/
@Getter
@Setter
@ToString
public class GetProcessTaskFormOut {
/** 任务节点表单json */
private String formJson;
/** 用户ID */
private String userId;
/** 用户姓名 */
private String userName;
}
|
UTF-8
|
Java
| 423 |
java
|
GetProcessTaskFormOut.java
|
Java
|
[
{
"context": "mport lombok.ToString;\n\n/**\n * 获取流程节点表单\n * @author SuZhou LichKin Information Technology Co.; Ltd.\n */\n@Getter\n@Set",
"end": 156,
"score": 0.9994810223579407,
"start": 142,
"tag": "NAME",
"value": "SuZhou LichKin"
}
] | null |
[] |
package com.lichkin.activiti.beans.out.impl;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* 获取流程节点表单
* @author <NAME> Information Technology Co.; Ltd.
*/
@Getter
@Setter
@ToString
public class GetProcessTaskFormOut {
/** 任务节点表单json */
private String formJson;
/** 用户ID */
private String userId;
/** 用户姓名 */
private String userName;
}
| 415 | 0.723238 | 0.723238 | 24 | 14.958333 | 14.926149 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false |
3
|
ddbb797aff3f54118ed9a93b03aec17dff9758ef
| 4,320,737,148,313 |
0479cd2038e90aec063c9ada738507f22cf1a2bb
|
/core/src/com/apps/pluralism/shooter/actors/menu/ShareButton.java
|
d84e4aa85002b924719c11c5e0065d7b055623ff
|
[] |
no_license
|
pluralism/ShooterGame
|
https://github.com/pluralism/ShooterGame
|
1944f294cd8013bc7ede4032a7961ec63b549220
|
a1c5e02093f4ec9efade65c8ed7953a07870fa03
|
refs/heads/master
| 2018-05-13T05:07:03.572000 | 2015-12-07T23:35:07 | 2015-12-07T23:35:07 | 47,296,655 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.apps.pluralism.shooter.actors.menu;
import com.apps.pluralism.shooter.utils.Constants;
import com.badlogic.gdx.math.Rectangle;
public class ShareButton extends GameButton {
public interface ShareButtonListener {
void onShare();
}
private ShareButtonListener listener;
public ShareButton(Rectangle bounds, ShareButtonListener listener) {
super(bounds);
this.listener = listener;
}
@Override
protected String getRegionName() {
return Constants.SHARE_REGION_NAME;
}
@Override
public void touched() {
listener.onShare();
}
}
|
UTF-8
|
Java
| 627 |
java
|
ShareButton.java
|
Java
|
[] | null |
[] |
package com.apps.pluralism.shooter.actors.menu;
import com.apps.pluralism.shooter.utils.Constants;
import com.badlogic.gdx.math.Rectangle;
public class ShareButton extends GameButton {
public interface ShareButtonListener {
void onShare();
}
private ShareButtonListener listener;
public ShareButton(Rectangle bounds, ShareButtonListener listener) {
super(bounds);
this.listener = listener;
}
@Override
protected String getRegionName() {
return Constants.SHARE_REGION_NAME;
}
@Override
public void touched() {
listener.onShare();
}
}
| 627 | 0.685805 | 0.685805 | 31 | 19.225807 | 20.254366 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.322581 | false | false |
3
|
034491d146997288e6bcc47d93139ca5e07944e1
| 6,545,530,178,052 |
a8eb13e507d8c3c0bbf515dc757dd12d5b86c6c1
|
/eating-and-exercise/src/main/java/com/aimxcel/abclearn/eatingandexercise/view/HeartNode.java
|
2e59b98a97e5de37a451745a43a4ab1ed1ba0054
|
[] |
no_license
|
venkat-thota/java-simulations
|
https://github.com/venkat-thota/java-simulations
|
41bb30375c1a2dedff1e1d64fade90c0ab2eac6a
|
d4c94d9cc84c9ee57c7b541843f8235352726f5e
|
refs/heads/master
| 2020-12-04T01:33:55.211000 | 2020-01-24T16:26:12 | 2020-01-24T16:26:12 | 231,548,090 | 0 | 0 | null | false | 2020-10-13T18:37:51 | 2020-01-03T08:47:26 | 2020-01-24T16:26:21 | 2020-10-13T18:37:50 | 67,751 | 0 | 0 | 4 |
Java
| false | false |
package com.aimxcel.abclearn.eatingandexercise.view;
import java.awt.*;
import com.aimxcel.abclearn.common.aimxcelcommon.math.Function;
import com.aimxcel.abclearn.common.aimxcelcommon.math.MathUtil;
import com.aimxcel.abclearn.common.aimxcelcommon.view.util.BufferedImageUtils;
import com.aimxcel.abclearn.common.aimxcelcommon.view.util.DoubleGeneralPath;
import com.aimxcel.abclearn.core.aimxcelcore.nodes.AimxcelPPath;
import com.aimxcel.abclearn.eatingandexercise.EatingAndExerciseResources;
import com.aimxcel.abclearn.eatingandexercise.model.Human;
import com.aimxcel.abclearn.aimxcel2dcore.nodes.PImage;
public class HeartNode extends PImage {
/**
*
*/
private static final long serialVersionUID = 1L;
private PImage heart;
private Human human;
private AimxcelPPath smilePath;
public HeartNode( Human human ) {
this.human = human;
heart = new PImage( EatingAndExerciseResources.getImage( "heart.png" ) );
addChild( heart );
double eyeDX = 80;
double eyeY = 50;
double eyeScale = 0.4;
PImage leftEye = new PImage( BufferedImageUtils.multiScale( EatingAndExerciseResources.getImage( "eye.png" ), eyeScale ) );
leftEye.setOffset( heart.getFullBounds().getWidth() / 2 - leftEye.getFullBounds().getWidth() / 2 - eyeDX / 2, eyeY );
addChild( leftEye );
PImage rightEye = new PImage( BufferedImageUtils.multiScale( EatingAndExerciseResources.getImage( "eye.png" ), eyeScale ) );
rightEye.setOffset( heart.getFullBounds().getWidth() / 2 - rightEye.getFullBounds().getWidth() / 2 + eyeDX / 2, eyeY );
addChild( rightEye );
smilePath = new AimxcelPPath( new BasicStroke( 14f ), Color.black );
addChild( smilePath );
human.addListener( new Human.Adapter() {
public void heartHealthChanged() {
updateSmile();
}
} );
updateSmile();
}
private void updateSmile() {
DoubleGeneralPath smile = new DoubleGeneralPath();
double smileInsetScaleX = 0.3;
double smileYFrac = 0.6;
double happiness = new Function.LinearFunction( 0, 1, -3, 1 ).evaluate( human.getHeartHealth() );
happiness = MathUtil.clamp( -0.5, happiness, 1 );
// System.out.println( "human.getHeartHealth(); = " + human.getHeartHealth() + ", happiness=" + happiness );
double controlPointDY = 50 * happiness;
smile.moveTo( heart.getFullBounds().getWidth() * smileInsetScaleX, heart.getFullBounds().getHeight() * smileYFrac );
smile.curveTo( heart.getFullBounds().getWidth() * 0.4, heart.getFullBounds().getHeight() * smileYFrac + controlPointDY,
heart.getFullBounds().getWidth() * 0.6, heart.getFullBounds().getHeight() * smileYFrac + controlPointDY,
heart.getFullBounds().getWidth() * ( 1 - smileInsetScaleX ), heart.getFullBounds().getHeight() * smileYFrac
);
smilePath.setOffset( 0, happiness < 0 ? Math.abs( happiness ) * 20 : 0 );
smilePath.setPathTo( smile.getGeneralPath() );
}
}
|
UTF-8
|
Java
| 3,102 |
java
|
HeartNode.java
|
Java
|
[] | null |
[] |
package com.aimxcel.abclearn.eatingandexercise.view;
import java.awt.*;
import com.aimxcel.abclearn.common.aimxcelcommon.math.Function;
import com.aimxcel.abclearn.common.aimxcelcommon.math.MathUtil;
import com.aimxcel.abclearn.common.aimxcelcommon.view.util.BufferedImageUtils;
import com.aimxcel.abclearn.common.aimxcelcommon.view.util.DoubleGeneralPath;
import com.aimxcel.abclearn.core.aimxcelcore.nodes.AimxcelPPath;
import com.aimxcel.abclearn.eatingandexercise.EatingAndExerciseResources;
import com.aimxcel.abclearn.eatingandexercise.model.Human;
import com.aimxcel.abclearn.aimxcel2dcore.nodes.PImage;
public class HeartNode extends PImage {
/**
*
*/
private static final long serialVersionUID = 1L;
private PImage heart;
private Human human;
private AimxcelPPath smilePath;
public HeartNode( Human human ) {
this.human = human;
heart = new PImage( EatingAndExerciseResources.getImage( "heart.png" ) );
addChild( heart );
double eyeDX = 80;
double eyeY = 50;
double eyeScale = 0.4;
PImage leftEye = new PImage( BufferedImageUtils.multiScale( EatingAndExerciseResources.getImage( "eye.png" ), eyeScale ) );
leftEye.setOffset( heart.getFullBounds().getWidth() / 2 - leftEye.getFullBounds().getWidth() / 2 - eyeDX / 2, eyeY );
addChild( leftEye );
PImage rightEye = new PImage( BufferedImageUtils.multiScale( EatingAndExerciseResources.getImage( "eye.png" ), eyeScale ) );
rightEye.setOffset( heart.getFullBounds().getWidth() / 2 - rightEye.getFullBounds().getWidth() / 2 + eyeDX / 2, eyeY );
addChild( rightEye );
smilePath = new AimxcelPPath( new BasicStroke( 14f ), Color.black );
addChild( smilePath );
human.addListener( new Human.Adapter() {
public void heartHealthChanged() {
updateSmile();
}
} );
updateSmile();
}
private void updateSmile() {
DoubleGeneralPath smile = new DoubleGeneralPath();
double smileInsetScaleX = 0.3;
double smileYFrac = 0.6;
double happiness = new Function.LinearFunction( 0, 1, -3, 1 ).evaluate( human.getHeartHealth() );
happiness = MathUtil.clamp( -0.5, happiness, 1 );
// System.out.println( "human.getHeartHealth(); = " + human.getHeartHealth() + ", happiness=" + happiness );
double controlPointDY = 50 * happiness;
smile.moveTo( heart.getFullBounds().getWidth() * smileInsetScaleX, heart.getFullBounds().getHeight() * smileYFrac );
smile.curveTo( heart.getFullBounds().getWidth() * 0.4, heart.getFullBounds().getHeight() * smileYFrac + controlPointDY,
heart.getFullBounds().getWidth() * 0.6, heart.getFullBounds().getHeight() * smileYFrac + controlPointDY,
heart.getFullBounds().getWidth() * ( 1 - smileInsetScaleX ), heart.getFullBounds().getHeight() * smileYFrac
);
smilePath.setOffset( 0, happiness < 0 ? Math.abs( happiness ) * 20 : 0 );
smilePath.setPathTo( smile.getGeneralPath() );
}
}
| 3,102 | 0.675371 | 0.662798 | 67 | 45.283581 | 40.649506 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.970149 | false | false |
3
|
a98dbf51e6e8800fb1bb814b6429c42a6a84f379
| 14,465,449,879,685 |
732c405103e0d4e78537d78ec3c2f6e65804af5f
|
/SpringJPA-Gladiator/src/test/java/com/lti/test/TestWishlist.java
|
fcbc0235c2797a3e91580f00a8feefdd001a6fc1
|
[] |
no_license
|
Quadsquad04/ProjectGladiator
|
https://github.com/Quadsquad04/ProjectGladiator
|
6bde6bca6bbe3a46ec99b91786109a3e154f576b
|
0bce1afbf56aac7fe60b764d9cb3de2f4b7c7009
|
refs/heads/master
| 2022-12-31T18:34:47.780000 | 2020-10-11T21:34:04 | 2020-10-11T21:34:04 | 297,029,605 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lti.test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.lti.entity.Wishlist;
import com.lti.repo.CartRepo;
import com.lti.repo.WishlistRepo;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:appctx.xml")
public class TestWishlist {
@Autowired
private WishlistRepo repo;
@Test
public void testSave() {
Wishlist wslst = new Wishlist();
wslst.setWishlistid(7001);
wslst.setQuantity(10);
repo.save(wslst);
}
@Test
public void testFetchWishlistById() {
Wishlist wslst= repo.fetch(7001);
System.out.println(wslst.getWishlistid()+"\t"+wslst.getQuantity());
}
@Test
public void testUpdate() {
Wishlist wslst = repo.fetch(7001);
wslst.setWishlistid(7001);
wslst.setQuantity(12);
repo.update(wslst);
}
}
|
UTF-8
|
Java
| 1,011 |
java
|
TestWishlist.java
|
Java
|
[] | null |
[] |
package com.lti.test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.lti.entity.Wishlist;
import com.lti.repo.CartRepo;
import com.lti.repo.WishlistRepo;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:appctx.xml")
public class TestWishlist {
@Autowired
private WishlistRepo repo;
@Test
public void testSave() {
Wishlist wslst = new Wishlist();
wslst.setWishlistid(7001);
wslst.setQuantity(10);
repo.save(wslst);
}
@Test
public void testFetchWishlistById() {
Wishlist wslst= repo.fetch(7001);
System.out.println(wslst.getWishlistid()+"\t"+wslst.getQuantity());
}
@Test
public void testUpdate() {
Wishlist wslst = repo.fetch(7001);
wslst.setWishlistid(7001);
wslst.setQuantity(12);
repo.update(wslst);
}
}
| 1,011 | 0.758655 | 0.735905 | 45 | 21.466667 | 20.093781 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.244444 | false | false |
3
|
ede4285fc82c3443bd08fc45e30b183123cee055
| 15,238,543,998,900 |
eb087a41ddfc702598abbbcf6b71b7a01337d1d4
|
/src/main/java/com/vstepura/web/ServiseLayer.java
|
78eaafc51ee077a1664a05f1c86540b75dbea1fd
|
[] |
no_license
|
Styopa89/viewer
|
https://github.com/Styopa89/viewer
|
55d15e17e65fef6692093115c15cf247f392d913
|
12b2013e400d225109e97f1e4ab33feb30ce95e3
|
refs/heads/master
| 2021-01-19T14:34:38.163000 | 2017-04-18T15:17:42 | 2017-04-18T15:17:42 | 88,172,167 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.vstepura.web;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.*;
public class ServiseLayer extends HttpServlet {
private static final String DB_DRIVER = "org.h2.Driver";
private static final String DB_CONNECTION = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1";
private static final String DB_USER = "";
private static final String DB_PASSWORD = "";
private Statement stmt = null;
private ResultSet rs = null;
private Connection connection = null;
public ServiseLayer() throws SQLException {
connection = getDBConnection();
}
public void addPerson(Person p) throws SQLException {
try {
createTable();
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String firstName = request.getParameter("firstName");
String lastName = request.getParameter("lastName");
String sex = request.getParameter("sex");
String sqlQuery = "INSERT INTO infotable (name, lastName, sex) "
+ "VALUES ('"+ firstName+"','"+ lastName+"','"+ sex+"')";
connection = getDBConnection();
sqlExecute(connection, sqlQuery);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/hello.jsp");
dispatcher.forward(request, response);
}
public String getServletInfo() {
return "H2 - h2_viewer";
}
private void sqlExecute(Connection connection, String sql) {
try {
stmt = connection.createStatement();
stmt.executeUpdate(sql);
} catch (Exception e) {
} finally {
try {
stmt.close();
connection.close();
} catch (SQLException sqle) {
sqle.printStackTrace();
}
}
}
public void createTable() throws SQLException {
try {
connection.setAutoCommit(false);
stmt = connection.createStatement();
// stmt.execute("CREATE TABLE PERSON(id int primary key, firstname varchar(255))");
stmt.execute("CREATE TABLE PERSON(id int primary key, firstname varchar(50), secondname varchar(50), sex varchar(50))");
stmt.execute("INSERT INTO PERSON(id, firstname, secondname, sex) VALUES(1, 'Anju', 'Anju', 'Anju')");
stmt.execute("INSERT INTO PERSON(id, firstname, secondname, sex) VALUES(2, 'Sonia', 'Anju', 'Anju')");
stmt.execute("INSERT INTO PERSON(id, firstname, secondname, sex) VALUES(3, 'Asha', 'Anju', 'Anju')");
ResultSet rs = stmt.executeQuery("select * from PERSON");
System.out.println("H2 In-Memory Database inserted through Statement");
while (rs.next()) {
System.out.println("Id " + rs.getInt("id") + " Name " + rs.getString("firstname")
+ " SecondName " + rs.getString("secondname") + " Sex " + rs.getString("sex"));
}
stmt.execute("DROP TABLE PERSON");
stmt.close();
connection.commit();
} catch (SQLException e) {
System.out.println("Exception Message " + e.getLocalizedMessage());
} catch (Exception e) {
e.printStackTrace();
} finally {
connection.close();
}
}
private static Connection getDBConnection() {
Connection dbConnection = null;
try {
Class.forName(DB_DRIVER);
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
try {
dbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER, DB_PASSWORD);
return dbConnection;
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return dbConnection;
}
}
|
UTF-8
|
Java
| 4,408 |
java
|
ServiseLayer.java
|
Java
|
[
{
"context": "PERSON(id, firstname, secondname, sex) VALUES(1, 'Anju', 'Anju', 'Anju')\");\n stmt.execute(\"IN",
"end": 2826,
"score": 0.9996770620346069,
"start": 2822,
"tag": "NAME",
"value": "Anju"
},
{
"context": "d, firstname, secondname, sex) VALUES(1, 'Anju', 'Anju', 'Anju')\");\n stmt.execute(\"INSERT INT",
"end": 2834,
"score": 0.9881281852722168,
"start": 2830,
"tag": "NAME",
"value": "Anju"
},
{
"context": "PERSON(id, firstname, secondname, sex) VALUES(2, 'Sonia', 'Anju', 'Anju')\");\n stmt.execute(\"IN",
"end": 2941,
"score": 0.9997833967208862,
"start": 2936,
"tag": "NAME",
"value": "Sonia"
},
{
"context": ", firstname, secondname, sex) VALUES(2, 'Sonia', 'Anju', 'Anju')\");\n stmt.execute(\"INSERT INT",
"end": 2949,
"score": 0.9936115145683289,
"start": 2945,
"tag": "NAME",
"value": "Anju"
},
{
"context": "ame, secondname, sex) VALUES(2, 'Sonia', 'Anju', 'Anju')\");\n stmt.execute(\"INSERT INTO PERSON",
"end": 2957,
"score": 0.5869032740592957,
"start": 2953,
"tag": "NAME",
"value": "Anju"
},
{
"context": "PERSON(id, firstname, secondname, sex) VALUES(3, 'Asha', 'Anju', 'Anju')\");\n\n ResultSet rs = ",
"end": 3055,
"score": 0.9997202157974243,
"start": 3051,
"tag": "NAME",
"value": "Asha"
},
{
"context": "d, firstname, secondname, sex) VALUES(3, 'Asha', 'Anju', 'Anju')\");\n\n ResultSet rs = stmt.exe",
"end": 3063,
"score": 0.9824854731559753,
"start": 3059,
"tag": "NAME",
"value": "Anju"
}
] | null |
[] |
package com.vstepura.web;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.*;
public class ServiseLayer extends HttpServlet {
private static final String DB_DRIVER = "org.h2.Driver";
private static final String DB_CONNECTION = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1";
private static final String DB_USER = "";
private static final String DB_PASSWORD = "";
private Statement stmt = null;
private ResultSet rs = null;
private Connection connection = null;
public ServiseLayer() throws SQLException {
connection = getDBConnection();
}
public void addPerson(Person p) throws SQLException {
try {
createTable();
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String firstName = request.getParameter("firstName");
String lastName = request.getParameter("lastName");
String sex = request.getParameter("sex");
String sqlQuery = "INSERT INTO infotable (name, lastName, sex) "
+ "VALUES ('"+ firstName+"','"+ lastName+"','"+ sex+"')";
connection = getDBConnection();
sqlExecute(connection, sqlQuery);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/hello.jsp");
dispatcher.forward(request, response);
}
public String getServletInfo() {
return "H2 - h2_viewer";
}
private void sqlExecute(Connection connection, String sql) {
try {
stmt = connection.createStatement();
stmt.executeUpdate(sql);
} catch (Exception e) {
} finally {
try {
stmt.close();
connection.close();
} catch (SQLException sqle) {
sqle.printStackTrace();
}
}
}
public void createTable() throws SQLException {
try {
connection.setAutoCommit(false);
stmt = connection.createStatement();
// stmt.execute("CREATE TABLE PERSON(id int primary key, firstname varchar(255))");
stmt.execute("CREATE TABLE PERSON(id int primary key, firstname varchar(50), secondname varchar(50), sex varchar(50))");
stmt.execute("INSERT INTO PERSON(id, firstname, secondname, sex) VALUES(1, 'Anju', 'Anju', 'Anju')");
stmt.execute("INSERT INTO PERSON(id, firstname, secondname, sex) VALUES(2, 'Sonia', 'Anju', 'Anju')");
stmt.execute("INSERT INTO PERSON(id, firstname, secondname, sex) VALUES(3, 'Asha', 'Anju', 'Anju')");
ResultSet rs = stmt.executeQuery("select * from PERSON");
System.out.println("H2 In-Memory Database inserted through Statement");
while (rs.next()) {
System.out.println("Id " + rs.getInt("id") + " Name " + rs.getString("firstname")
+ " SecondName " + rs.getString("secondname") + " Sex " + rs.getString("sex"));
}
stmt.execute("DROP TABLE PERSON");
stmt.close();
connection.commit();
} catch (SQLException e) {
System.out.println("Exception Message " + e.getLocalizedMessage());
} catch (Exception e) {
e.printStackTrace();
} finally {
connection.close();
}
}
private static Connection getDBConnection() {
Connection dbConnection = null;
try {
Class.forName(DB_DRIVER);
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
try {
dbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER, DB_PASSWORD);
return dbConnection;
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return dbConnection;
}
}
| 4,408 | 0.595281 | 0.591198 | 121 | 35.429752 | 30.147249 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.752066 | false | false |
3
|
f3b8455949434d7ef7eb9ad386e7cf8b3c4ef849
| 29,171,417,883,034 |
74a9114ace9927a58d145d7799afc1195ed07d1a
|
/app/src/main/java/uqac/dim/androidprojet/mj_boule/MazeGame.java
|
97e967d2021e799b73eb23ba3c99910bde3e15b4
|
[] |
no_license
|
LaurentGENTY/android-trainer-UQAC
|
https://github.com/LaurentGENTY/android-trainer-UQAC
|
1bc7d68b52adcb18aa1f9a3b129e744d81f91e99
|
a4be12ddd3fa01da4d7f5a37f9daa22694a44e93
|
refs/heads/master
| 2022-12-28T08:04:03.137000 | 2020-10-19T16:53:47 | 2020-10-19T16:53:47 | 291,542,522 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package uqac.dim.androidprojet.mj_boule;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.SurfaceView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import uqac.dim.androidprojet.R;
import uqac.dim.androidprojet.mj_falling.Ring;
public class MazeGame extends AppCompatActivity {
//ma vue : éléments sur l'écran
private MazeView view;
//données
private MazeData mData;
//éléments du labyrinthe
private Ball ball;
private ArrayList<Wall> walls = null;
//gap
private static int GAP;
//widgets graphiques
private LinearLayout all;
private LinearLayout game;
private LinearLayout buttonsLayout;
private LinearLayout otherButtons;
private LinearLayout gameButtons;
private Button optionsButton;
private Button parametersButton;
private Button quitButton;
private Button pauseButton;
private ImageView imageLives;
private TextView textLives;
//vies du joueur
private int lives = 5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//on créér tous les éléments pour jouer : les éléments graphiques
//je crée ma vue
view = new MazeView(this);
//faire en sorte de faire le labyrinthe selon la taille de l'écran + ball + autres constantes
initSizes();
//init des boutons etc
setGraphics();
setContentView(all);
//et les données physiques des objets
mData = new MazeData(this, getBaseContext(), getApplicationContext());
//init la balle
ball = new Ball();
//je la met dans les deux moteurs
view.setBall(ball);
mData.setBall(ball);
//je créé le labyrinthe
walls = new ArrayList<Wall>();
//init decalage des walls et de la balle
this.setGAP(Ball.RADIUS * 2);
Ball.setGAP(Ball.RADIUS * 2);
Wall.setGAP(Ball.RADIUS * 2);
try {
walls = mData.createMaze(Integer.parseInt(getIntent().getStringExtra("Niveau")));
} catch (WrongWallType wrongWallType) {
wrongWallType.printStackTrace();
}
Log.i("MazeGame", "J'ai build mon labyrinthe");
Log.i("BALLXY", ball.getX() + " " + ball.getY());
view.setWalls(walls);
}
protected void save_levels() {
String level1 = "VVVVVVVVVVVVVVVVVVVV" +
"V V" +
"V S V" +
"V V" +
"V V" +
"V V" +
"V V" +
"V V" +
"V V" +
"V V" +
"V E V" +
"V V" +
"VVVVVVVVVVVVVVVVVVVV";
String level2 = "VVVVVVVVVVVVVVVVVVVV" +
"V V V" +
"V S V V" +
"V V V" +
"V V" +
"V V" +
"V V" +
"V V" +
"V V V" +
"V V E V" +
"V V V" +
"VVVVVVVVVVVVVVVVVVVV";
String level3 = "VVVVVVVVVVVVVVVVVVVV" +
"VVVVV S VVVVV" +
"VVVV VVVV" +
"VVV VVV" +
"VV VV" +
"VVV VVV" +
"VVVV VVVV" +
"VVVVV VVVVV" +
"VVVVVV VVVVVV" +
"VVVVVVV VVVVVVV" +
"VVVVVVVVV VVVVVVVV" +
"VVVVVVVVVVEVVVVVVVVV" +
"VVVVVVVVVVVVVVVVVVVV";
String level4 = "VVVVVVVVVVVVVVVVVVVV" +
"VE EV" +
"VVVVVV VVVVVV" +
"VE V V EV" +
"V V V V V" +
"V V V V" +
"V VVV S VVV V" +
"V V" +
"V V VVV V V" +
"V V V V" +
"V V VV VVVVVV VV V V" +
"VEV E VEV" +
"VVVVVVVVVVVVVVVVVVVV";
try {
OutputStreamWriter outputStreamWriter1 = new OutputStreamWriter(getApplicationContext().openFileOutput("maze1.txt", Context.MODE_PRIVATE));
outputStreamWriter1.write(level1);
outputStreamWriter1.close();
OutputStreamWriter outputStreamWriter2 = new OutputStreamWriter(getApplicationContext().openFileOutput("maze2.txt", Context.MODE_PRIVATE));
outputStreamWriter2.write(level2);
outputStreamWriter2.close();
OutputStreamWriter outputStreamWriter3 = new OutputStreamWriter(getApplicationContext().openFileOutput("maze3.txt", Context.MODE_PRIVATE));
outputStreamWriter3.write(level3);
outputStreamWriter3.close();
OutputStreamWriter outputStreamWriter4 = new OutputStreamWriter(getApplicationContext().openFileOutput("maze4.txt", Context.MODE_PRIVATE));
outputStreamWriter4.write(level4);
outputStreamWriter4.close();
} catch (IOException e) {
Log.e("Exception", "File write failed: " + e.toString());
}
}
private void setGraphics() {
all = new LinearLayout(this);
all.setOrientation(LinearLayout.VERTICAL);
//linear layout qui contiendra le jeu
game = new LinearLayout(this);
//layout qui contiendra tous les boutons
buttonsLayout = new LinearLayout(this);
buttonsLayout.setOrientation(LinearLayout.VERTICAL);
gameButtons = new LinearLayout(this);
gameButtons.setOrientation(LinearLayout.HORIZONTAL);
otherButtons = new LinearLayout(this);
otherButtons.setOrientation(LinearLayout.HORIZONTAL);
parametersButton = new Button(this);
optionsButton = new Button(this);
quitButton = new Button(this);
pauseButton = new Button(this);
imageLives = new ImageView(this);
textLives = new TextView(this);
setImage();
setText();
//premiere ligne
parametersButton.setWidth(MazeView.getWIDTH()/2);
parametersButton.setHeight(MazeView.getHEIGHT()/10);
parametersButton.setText("PARAMETRES");
gameButtons.addView(parametersButton);
pauseButton.setWidth(MazeView.getWIDTH()/2);
pauseButton.setHeight(MazeView.getHEIGHT()/10);
pauseButton.setText("PAUSE");
gameButtons.addView(pauseButton);
buttonsLayout.addView(gameButtons);
//deuxieme ligne
optionsButton.setWidth(MazeView.getWIDTH()/2);
optionsButton.setHeight(MazeView.getHEIGHT()/10);
optionsButton.setText("OPTIONS");
otherButtons.addView(optionsButton);
quitButton.setWidth(MazeView.getWIDTH()/2);
quitButton.setHeight(MazeView.getHEIGHT()/10);
quitButton.setText("QUITTER");
otherButtons.addView(quitButton);
buttonsLayout.addView(otherButtons);
//on ajoute le tout
//le layout du jeu contient notre surfaceview custom
game.addView(view);
//ensuite on ajoute tous les éléments dans le layout final
all.addView(game);
all.addView(imageLives);
all.addView(textLives);
all.addView(buttonsLayout);
}
private void setText() {
textLives.setText(": "+Integer.toString(this.lives));
textLives.setX(-MazeView.getWIDTH()/2 + Ball.RADIUS*3 + 150);
textLives.setY(0);
}
private void setImage() {
imageLives.setY(0);
imageLives.setX(-MazeView.getWIDTH()/2 + Ball.RADIUS*3);
Bitmap _scratch = BitmapFactory.decodeResource(getResources(),
R.drawable.pokeball);
int outWidth = 0;
int outHeight = 0;
final int maxSize = Ball.RADIUS * 6;
int inWidth = _scratch.getWidth();
int inHeight = _scratch.getHeight();
if (inWidth > inHeight) {
outWidth = maxSize;
outHeight = (inHeight * maxSize) / inWidth;
} else {
outHeight = maxSize;
outWidth = (inWidth * maxSize) / inHeight;
}
Bitmap resizedBitmap = Bitmap.createScaledBitmap(_scratch, outWidth, outHeight, false);
imageLives.setImageBitmap(resizedBitmap);
}
private void initSizes() {
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
Ball.setRADIUS(width / 44);
MazeView.setWIDTH(width);
MazeView.setHEIGHT(height);
view.getHolder().setFixedSize(MazeView.getWIDTH(), MazeView.getHEIGHT()/2);
}
@Override
public void finish() {
Log.i("COLLISION","end");
Intent intent = new Intent();
intent.putExtra("lives", lives);
setResult(RESULT_OK, intent);
super.finish();
}
@Override
protected void onResume() {
super.onResume();
mData.resume();
}
@Override
protected void onPause() {
super.onPause();
mData.pause();
}
public static int getGAP() {
return GAP;
}
public static void setGAP(int GAP) {
MazeGame.GAP = GAP;
}
public void setLives(int lives) {
this.lives = lives;
}
public void end() {
this.finish();
}
}
|
UTF-8
|
Java
| 10,455 |
java
|
MazeGame.java
|
Java
|
[] | null |
[] |
package uqac.dim.androidprojet.mj_boule;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.SurfaceView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import uqac.dim.androidprojet.R;
import uqac.dim.androidprojet.mj_falling.Ring;
public class MazeGame extends AppCompatActivity {
//ma vue : éléments sur l'écran
private MazeView view;
//données
private MazeData mData;
//éléments du labyrinthe
private Ball ball;
private ArrayList<Wall> walls = null;
//gap
private static int GAP;
//widgets graphiques
private LinearLayout all;
private LinearLayout game;
private LinearLayout buttonsLayout;
private LinearLayout otherButtons;
private LinearLayout gameButtons;
private Button optionsButton;
private Button parametersButton;
private Button quitButton;
private Button pauseButton;
private ImageView imageLives;
private TextView textLives;
//vies du joueur
private int lives = 5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//on créér tous les éléments pour jouer : les éléments graphiques
//je crée ma vue
view = new MazeView(this);
//faire en sorte de faire le labyrinthe selon la taille de l'écran + ball + autres constantes
initSizes();
//init des boutons etc
setGraphics();
setContentView(all);
//et les données physiques des objets
mData = new MazeData(this, getBaseContext(), getApplicationContext());
//init la balle
ball = new Ball();
//je la met dans les deux moteurs
view.setBall(ball);
mData.setBall(ball);
//je créé le labyrinthe
walls = new ArrayList<Wall>();
//init decalage des walls et de la balle
this.setGAP(Ball.RADIUS * 2);
Ball.setGAP(Ball.RADIUS * 2);
Wall.setGAP(Ball.RADIUS * 2);
try {
walls = mData.createMaze(Integer.parseInt(getIntent().getStringExtra("Niveau")));
} catch (WrongWallType wrongWallType) {
wrongWallType.printStackTrace();
}
Log.i("MazeGame", "J'ai build mon labyrinthe");
Log.i("BALLXY", ball.getX() + " " + ball.getY());
view.setWalls(walls);
}
protected void save_levels() {
String level1 = "VVVVVVVVVVVVVVVVVVVV" +
"V V" +
"V S V" +
"V V" +
"V V" +
"V V" +
"V V" +
"V V" +
"V V" +
"V V" +
"V E V" +
"V V" +
"VVVVVVVVVVVVVVVVVVVV";
String level2 = "VVVVVVVVVVVVVVVVVVVV" +
"V V V" +
"V S V V" +
"V V V" +
"V V" +
"V V" +
"V V" +
"V V" +
"V V V" +
"V V E V" +
"V V V" +
"VVVVVVVVVVVVVVVVVVVV";
String level3 = "VVVVVVVVVVVVVVVVVVVV" +
"VVVVV S VVVVV" +
"VVVV VVVV" +
"VVV VVV" +
"VV VV" +
"VVV VVV" +
"VVVV VVVV" +
"VVVVV VVVVV" +
"VVVVVV VVVVVV" +
"VVVVVVV VVVVVVV" +
"VVVVVVVVV VVVVVVVV" +
"VVVVVVVVVVEVVVVVVVVV" +
"VVVVVVVVVVVVVVVVVVVV";
String level4 = "VVVVVVVVVVVVVVVVVVVV" +
"VE EV" +
"VVVVVV VVVVVV" +
"VE V V EV" +
"V V V V V" +
"V V V V" +
"V VVV S VVV V" +
"V V" +
"V V VVV V V" +
"V V V V" +
"V V VV VVVVVV VV V V" +
"VEV E VEV" +
"VVVVVVVVVVVVVVVVVVVV";
try {
OutputStreamWriter outputStreamWriter1 = new OutputStreamWriter(getApplicationContext().openFileOutput("maze1.txt", Context.MODE_PRIVATE));
outputStreamWriter1.write(level1);
outputStreamWriter1.close();
OutputStreamWriter outputStreamWriter2 = new OutputStreamWriter(getApplicationContext().openFileOutput("maze2.txt", Context.MODE_PRIVATE));
outputStreamWriter2.write(level2);
outputStreamWriter2.close();
OutputStreamWriter outputStreamWriter3 = new OutputStreamWriter(getApplicationContext().openFileOutput("maze3.txt", Context.MODE_PRIVATE));
outputStreamWriter3.write(level3);
outputStreamWriter3.close();
OutputStreamWriter outputStreamWriter4 = new OutputStreamWriter(getApplicationContext().openFileOutput("maze4.txt", Context.MODE_PRIVATE));
outputStreamWriter4.write(level4);
outputStreamWriter4.close();
} catch (IOException e) {
Log.e("Exception", "File write failed: " + e.toString());
}
}
private void setGraphics() {
all = new LinearLayout(this);
all.setOrientation(LinearLayout.VERTICAL);
//linear layout qui contiendra le jeu
game = new LinearLayout(this);
//layout qui contiendra tous les boutons
buttonsLayout = new LinearLayout(this);
buttonsLayout.setOrientation(LinearLayout.VERTICAL);
gameButtons = new LinearLayout(this);
gameButtons.setOrientation(LinearLayout.HORIZONTAL);
otherButtons = new LinearLayout(this);
otherButtons.setOrientation(LinearLayout.HORIZONTAL);
parametersButton = new Button(this);
optionsButton = new Button(this);
quitButton = new Button(this);
pauseButton = new Button(this);
imageLives = new ImageView(this);
textLives = new TextView(this);
setImage();
setText();
//premiere ligne
parametersButton.setWidth(MazeView.getWIDTH()/2);
parametersButton.setHeight(MazeView.getHEIGHT()/10);
parametersButton.setText("PARAMETRES");
gameButtons.addView(parametersButton);
pauseButton.setWidth(MazeView.getWIDTH()/2);
pauseButton.setHeight(MazeView.getHEIGHT()/10);
pauseButton.setText("PAUSE");
gameButtons.addView(pauseButton);
buttonsLayout.addView(gameButtons);
//deuxieme ligne
optionsButton.setWidth(MazeView.getWIDTH()/2);
optionsButton.setHeight(MazeView.getHEIGHT()/10);
optionsButton.setText("OPTIONS");
otherButtons.addView(optionsButton);
quitButton.setWidth(MazeView.getWIDTH()/2);
quitButton.setHeight(MazeView.getHEIGHT()/10);
quitButton.setText("QUITTER");
otherButtons.addView(quitButton);
buttonsLayout.addView(otherButtons);
//on ajoute le tout
//le layout du jeu contient notre surfaceview custom
game.addView(view);
//ensuite on ajoute tous les éléments dans le layout final
all.addView(game);
all.addView(imageLives);
all.addView(textLives);
all.addView(buttonsLayout);
}
private void setText() {
textLives.setText(": "+Integer.toString(this.lives));
textLives.setX(-MazeView.getWIDTH()/2 + Ball.RADIUS*3 + 150);
textLives.setY(0);
}
private void setImage() {
imageLives.setY(0);
imageLives.setX(-MazeView.getWIDTH()/2 + Ball.RADIUS*3);
Bitmap _scratch = BitmapFactory.decodeResource(getResources(),
R.drawable.pokeball);
int outWidth = 0;
int outHeight = 0;
final int maxSize = Ball.RADIUS * 6;
int inWidth = _scratch.getWidth();
int inHeight = _scratch.getHeight();
if (inWidth > inHeight) {
outWidth = maxSize;
outHeight = (inHeight * maxSize) / inWidth;
} else {
outHeight = maxSize;
outWidth = (inWidth * maxSize) / inHeight;
}
Bitmap resizedBitmap = Bitmap.createScaledBitmap(_scratch, outWidth, outHeight, false);
imageLives.setImageBitmap(resizedBitmap);
}
private void initSizes() {
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
Ball.setRADIUS(width / 44);
MazeView.setWIDTH(width);
MazeView.setHEIGHT(height);
view.getHolder().setFixedSize(MazeView.getWIDTH(), MazeView.getHEIGHT()/2);
}
@Override
public void finish() {
Log.i("COLLISION","end");
Intent intent = new Intent();
intent.putExtra("lives", lives);
setResult(RESULT_OK, intent);
super.finish();
}
@Override
protected void onResume() {
super.onResume();
mData.resume();
}
@Override
protected void onPause() {
super.onPause();
mData.pause();
}
public static int getGAP() {
return GAP;
}
public static void setGAP(int GAP) {
MazeGame.GAP = GAP;
}
public void setLives(int lives) {
this.lives = lives;
}
public void end() {
this.finish();
}
}
| 10,455 | 0.557972 | 0.552511 | 343 | 29.425655 | 24.128654 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.504373 | false | false |
3
|
3dc6b100a147ea3eb658ec49c27de003bf732609
| 13,030,930,800,978 |
171b877c3bc31ff0d06f50f4c9788ae911c0eb24
|
/src/test/java/com/WebStore/pages/HomePage.java
|
23e9aa7987f0b28370b36b9baa32f8598ac5feee
|
[] |
no_license
|
TolikTetenkin/webstaurantstore
|
https://github.com/TolikTetenkin/webstaurantstore
|
e4a7a29c7dc0e720d5765c03dfbba0736f0fd21a
|
73f4a1e65ed23527a7f368de3f10cc89fe6777c6
|
refs/heads/master
| 2020-08-15T20:42:15.136000 | 2019-10-15T21:57:24 | 2019-10-15T21:57:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.WebStore.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.WebStore.utils.BaseClass;
public class HomePage extends BaseClass {
public HomePage() {
PageFactory.initElements(driver, this);
}
@FindBy(className="banner-logo")
private WebElement bannerLogo;
@FindBy(id="searchval")
private WebElement searchBox;
@FindBy(css="input[type='submit']")
private WebElement searchButton;
@FindBy(linkText="Cart")
private WebElement cart;
public WebElement getBannerLogo() {
return bannerLogo;
}
public WebElement getSearchBox() {
return searchBox;
}
public WebElement getSearchButton() {
return searchButton;
}
public WebElement getCart() {
return cart;
}
}
|
UTF-8
|
Java
| 834 |
java
|
HomePage.java
|
Java
|
[] | null |
[] |
package com.WebStore.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.WebStore.utils.BaseClass;
public class HomePage extends BaseClass {
public HomePage() {
PageFactory.initElements(driver, this);
}
@FindBy(className="banner-logo")
private WebElement bannerLogo;
@FindBy(id="searchval")
private WebElement searchBox;
@FindBy(css="input[type='submit']")
private WebElement searchButton;
@FindBy(linkText="Cart")
private WebElement cart;
public WebElement getBannerLogo() {
return bannerLogo;
}
public WebElement getSearchBox() {
return searchBox;
}
public WebElement getSearchButton() {
return searchButton;
}
public WebElement getCart() {
return cart;
}
}
| 834 | 0.752998 | 0.752998 | 45 | 17.533333 | 16.170755 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.088889 | false | false |
3
|
bb792beaa44a59f275f2d854d3c1c63470f8bc9b
| 17,910,013,633,301 |
08eeb39ad8abc455077607d69f197bd6df1582c2
|
/src/main/java/cz/ixi/fusionweb/drools/listeners/ProductSearchListener.java
|
9a0d0c09d6424ec7a66a5575b0b9bdb29deb7170
|
[] |
no_license
|
IxiCZ/fusionweb
|
https://github.com/IxiCZ/fusionweb
|
3a837da5d8b635f2e436392f8a789ec559c9d0b8
|
9652e925fc88681ca4572730557e505024a8e3c6
|
refs/heads/master
| 2020-06-02T01:48:14.728000 | 2013-05-02T11:26:26 | 2013-05-02T11:26:26 | 7,191,388 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cz.ixi.fusionweb.drools.listeners;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import cz.ixi.fusionweb.drools.model.ProductSearchSuccessfulEvent;
import cz.ixi.fusionweb.drools.model.ProductSearchUnsuccessfulEvent;
import cz.ixi.fusionweb.drools.rules.DroolsResourcesBean;
import cz.ixi.fusionweb.ejb.ProductBean;
import cz.ixi.fusionweb.entities.User;
/**
* Inserts events of searching products into drools working memory.
*/
@ManagedBean(name = "productSearchListener")
public class ProductSearchListener {
@EJB
DroolsResourcesBean drools;
@EJB
private ProductBean products;
/**
* Creates and inserts an event representing either successful or unsuccessful product search.
*
* @param searchedKeyword searched keyword
* @param user user realizing the search
*/
public void search(String searchedKeyword, User user) {
if (products.searchProductCount(searchedKeyword) == 0) {
if (user != null) {
drools.insertFact(new ProductSearchUnsuccessfulEvent(searchedKeyword, user.getUsername()));
} else {
drools.insertFact(new ProductSearchUnsuccessfulEvent(searchedKeyword, null));
}
} else {
if (user != null) {
drools.insertFact(new ProductSearchSuccessfulEvent(searchedKeyword, user.getUsername()));
} else {
drools.insertFact(new ProductSearchSuccessfulEvent(searchedKeyword, null));
}
}
}
}
|
UTF-8
|
Java
| 1,415 |
java
|
ProductSearchListener.java
|
Java
|
[] | null |
[] |
package cz.ixi.fusionweb.drools.listeners;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import cz.ixi.fusionweb.drools.model.ProductSearchSuccessfulEvent;
import cz.ixi.fusionweb.drools.model.ProductSearchUnsuccessfulEvent;
import cz.ixi.fusionweb.drools.rules.DroolsResourcesBean;
import cz.ixi.fusionweb.ejb.ProductBean;
import cz.ixi.fusionweb.entities.User;
/**
* Inserts events of searching products into drools working memory.
*/
@ManagedBean(name = "productSearchListener")
public class ProductSearchListener {
@EJB
DroolsResourcesBean drools;
@EJB
private ProductBean products;
/**
* Creates and inserts an event representing either successful or unsuccessful product search.
*
* @param searchedKeyword searched keyword
* @param user user realizing the search
*/
public void search(String searchedKeyword, User user) {
if (products.searchProductCount(searchedKeyword) == 0) {
if (user != null) {
drools.insertFact(new ProductSearchUnsuccessfulEvent(searchedKeyword, user.getUsername()));
} else {
drools.insertFact(new ProductSearchUnsuccessfulEvent(searchedKeyword, null));
}
} else {
if (user != null) {
drools.insertFact(new ProductSearchSuccessfulEvent(searchedKeyword, user.getUsername()));
} else {
drools.insertFact(new ProductSearchSuccessfulEvent(searchedKeyword, null));
}
}
}
}
| 1,415 | 0.74629 | 0.745583 | 46 | 29.76087 | 29.212255 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.782609 | false | false |
3
|
2ac6aaddf09c40e6b72cb552c15fd3b6c5c7bc7c
| 11,819,750,032,403 |
1967af71ea6cf453b680be1e3ff35a1309c7eae2
|
/CommandSign/src/io/github/hsyyid/commandsigns/data/commands/CommandsData.java
|
b1b72e55dc1949e323711c0c74e139f41f1b16c7
|
[
"MIT"
] |
permissive
|
DuFxonz/CommandSign
|
https://github.com/DuFxonz/CommandSign
|
be6b64bbb12e87b5cea17f3f080db83a21f58dbd
|
31ca385d8081c7c0e4d4e20dcd6123dc7d07f97d
|
refs/heads/master
| 2021-05-14T08:21:26.314000 | 2018-01-04T18:27:49 | 2018-01-04T18:27:49 | 116,293,294 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.github.hsyyid.commandsigns.data.commands;
import org.spongepowered.api.data.manipulator.mutable.ListData;
import org.spongepowered.api.data.value.mutable.ListValue;
public interface CommandsData extends ListData<String, CommandsData, ImmutableCommandsData>
{
ListValue<String> commands();
}
|
UTF-8
|
Java
| 305 |
java
|
CommandsData.java
|
Java
|
[
{
"context": "package io.github.hsyyid.commandsigns.data.commands;\n\nimport org.spongepow",
"end": 24,
"score": 0.9976644515991211,
"start": 18,
"tag": "USERNAME",
"value": "hsyyid"
}
] | null |
[] |
package io.github.hsyyid.commandsigns.data.commands;
import org.spongepowered.api.data.manipulator.mutable.ListData;
import org.spongepowered.api.data.value.mutable.ListValue;
public interface CommandsData extends ListData<String, CommandsData, ImmutableCommandsData>
{
ListValue<String> commands();
}
| 305 | 0.832787 | 0.832787 | 9 | 32.888889 | 32.463467 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.777778 | false | false |
3
|
07d8bf6d6dac39312d69838d30c3a9edc1634204
| 12,970,801,262,406 |
91682c22fa06d64b6fff5008e86260297f28ce0b
|
/mobile-runescape-client/src/main/java/class180.java
|
c513c2ed77366ff87c2cb2bd17eb8dba37cc1acd
|
[
"BSD-2-Clause"
] |
permissive
|
morscape/mors-desktop
|
https://github.com/morscape/mors-desktop
|
a32b441b08605bd4cd16604dc3d1bc0b9da62ec9
|
230174cdfd2e409816c7699756f1a98e89c908d9
|
refs/heads/master
| 2023-02-06T15:35:04.524000 | 2020-12-27T22:00:22 | 2020-12-27T22:00:22 | 324,747,526 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Decompiled with CFR 0.150.
*
* Could not load the following classes:
* net.runelite.mapping.ObfuscatedName
*/
import java.util.HashMap;
import net.runelite.mapping.ObfuscatedName;
@ObfuscatedName(value="ly")
public class class180 {
static {
new HashMap();
}
@ObfuscatedName(value="ap")
static void method6606(int n, byte by) {
if (n != Client.gameState) {
if (Client.gameState == 0) {
Client.field4740.method5749();
}
if (n == 20 || n == 40 || n == 45) {
Client.field4771 = 0;
Client.field4774 = 0;
Client.field4775 = 0;
Client.field4792.method7084(n);
if (n == 45) {
if (class119.field3363.method5314()) {
class119.field3363.method5321(true);
} else {
class119.field3363.sort(Login.Login_password, true);
}
class297.method10926(false);
}
}
if (n != 20 && n != 40 && class317.field6183 != null) {
class317.field6183.close();
class317.field6183 = null;
}
if (Client.gameState == 25) {
Client.field4797 = 0;
Client.field4789 = 0;
Client.field4796 = 1;
Client.field4794 = 0;
Client.field4788 = 1;
}
if (n != 5 && n != 10) {
if (n != 20) {
if (n != 11) {
class69.method4106();
Client.field4740.method5740(class294.field6004);
} else {
class28.method854(class61.field2439, class259.field4373, false, 4, Client.field4740.field3567.vmethod11005());
}
} else {
by = Client.gameState != 11 ? (byte)0 : (byte)4;
class28.method854(class61.field2439, class259.field4373, true, by, Client.field4740.field3567.vmethod11005());
}
} else {
class28.method854(class61.field2439, class259.field4373, true, 0, Client.field4740.field3567.vmethod11005());
}
Client.gameState = n;
return;
}
}
}
|
UTF-8
|
Java
| 2,375 |
java
|
class180.java
|
Java
|
[] | null |
[] |
/*
* Decompiled with CFR 0.150.
*
* Could not load the following classes:
* net.runelite.mapping.ObfuscatedName
*/
import java.util.HashMap;
import net.runelite.mapping.ObfuscatedName;
@ObfuscatedName(value="ly")
public class class180 {
static {
new HashMap();
}
@ObfuscatedName(value="ap")
static void method6606(int n, byte by) {
if (n != Client.gameState) {
if (Client.gameState == 0) {
Client.field4740.method5749();
}
if (n == 20 || n == 40 || n == 45) {
Client.field4771 = 0;
Client.field4774 = 0;
Client.field4775 = 0;
Client.field4792.method7084(n);
if (n == 45) {
if (class119.field3363.method5314()) {
class119.field3363.method5321(true);
} else {
class119.field3363.sort(Login.Login_password, true);
}
class297.method10926(false);
}
}
if (n != 20 && n != 40 && class317.field6183 != null) {
class317.field6183.close();
class317.field6183 = null;
}
if (Client.gameState == 25) {
Client.field4797 = 0;
Client.field4789 = 0;
Client.field4796 = 1;
Client.field4794 = 0;
Client.field4788 = 1;
}
if (n != 5 && n != 10) {
if (n != 20) {
if (n != 11) {
class69.method4106();
Client.field4740.method5740(class294.field6004);
} else {
class28.method854(class61.field2439, class259.field4373, false, 4, Client.field4740.field3567.vmethod11005());
}
} else {
by = Client.gameState != 11 ? (byte)0 : (byte)4;
class28.method854(class61.field2439, class259.field4373, true, by, Client.field4740.field3567.vmethod11005());
}
} else {
class28.method854(class61.field2439, class259.field4373, true, 0, Client.field4740.field3567.vmethod11005());
}
Client.gameState = n;
return;
}
}
}
| 2,375 | 0.469053 | 0.356632 | 66 | 34.969696 | 27.200697 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
3
|
d9c35a182e14e20a424347fab4571be203cb9165
| 21,260,088,181,327 |
8494b14c8ee43165f002e8ff1b81adde8d1ee37a
|
/src/nio_p/ExamFinishController.java
|
d490c9ba237f07543095ee7644119c20feb4de6c
|
[] |
no_license
|
freakywaffle/hta
|
https://github.com/freakywaffle/hta
|
96fb452367c123936fce19f741773e29d204ecd8
|
44301f445a2fc6179bfedb369277bc1d76260d5b
|
refs/heads/master
| 2020-04-02T20:22:34.016000 | 2018-10-26T03:50:40 | 2018-10-26T03:50:40 | 154,766,873 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package nio_p;
import java.io.IOException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
public class ExamFinishController implements Initializable {
@FXML Label nol;
@FXML Label namel;
@FXML Label korl;
@FXML Label engl;
@FXML Label matl;
@FXML Label suml;
@FXML Label avgl;
String name;
String no;
double avg;
double sum;
double kor;
double mat;
double eng;
String str;
@Override
public void initialize(URL location, ResourceBundle resources) {
// TODO Auto-generated method stub
no = resources.getObject("no").toString();
name = resources.getObject("name").toString();
kor = Double.parseDouble(resources.getObject("korJum").toString());
eng = Double.parseDouble(resources.getObject("engJum").toString());
mat = Double.parseDouble(resources.getObject("matJum").toString());
sum = kor+eng+mat;
avg = sum/3;
nol.setText(no);
namel.setText(name);
korl.setText(kor+"");
engl.setText(eng+"");
matl.setText(mat+"");
suml.setText(sum+"");
avgl.setText(avg+"");
str = "번호:"+no +",이름:"+name +",국어:"+kor+",영어:"+eng+",수학:"+mat+",합계:"+sum+",평균:"+avg;
}
public void writeResult() throws IOException {
FileChannel channel = FileChannel.open(Paths.get("Test/result.txt"), StandardOpenOption.CREATE, StandardOpenOption.APPEND);
Charset charset = Charset.defaultCharset();
ByteBuffer buf = charset.encode(str);
channel.write(buf);
channel.close();
}
}
|
UHC
|
Java
| 1,859 |
java
|
ExamFinishController.java
|
Java
|
[] | null |
[] |
package nio_p;
import java.io.IOException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
public class ExamFinishController implements Initializable {
@FXML Label nol;
@FXML Label namel;
@FXML Label korl;
@FXML Label engl;
@FXML Label matl;
@FXML Label suml;
@FXML Label avgl;
String name;
String no;
double avg;
double sum;
double kor;
double mat;
double eng;
String str;
@Override
public void initialize(URL location, ResourceBundle resources) {
// TODO Auto-generated method stub
no = resources.getObject("no").toString();
name = resources.getObject("name").toString();
kor = Double.parseDouble(resources.getObject("korJum").toString());
eng = Double.parseDouble(resources.getObject("engJum").toString());
mat = Double.parseDouble(resources.getObject("matJum").toString());
sum = kor+eng+mat;
avg = sum/3;
nol.setText(no);
namel.setText(name);
korl.setText(kor+"");
engl.setText(eng+"");
matl.setText(mat+"");
suml.setText(sum+"");
avgl.setText(avg+"");
str = "번호:"+no +",이름:"+name +",국어:"+kor+",영어:"+eng+",수학:"+mat+",합계:"+sum+",평균:"+avg;
}
public void writeResult() throws IOException {
FileChannel channel = FileChannel.open(Paths.get("Test/result.txt"), StandardOpenOption.CREATE, StandardOpenOption.APPEND);
Charset charset = Charset.defaultCharset();
ByteBuffer buf = charset.encode(str);
channel.write(buf);
channel.close();
}
}
| 1,859 | 0.675587 | 0.675041 | 79 | 21.177216 | 22.843863 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.810127 | false | false |
3
|
ebfb692d1c9571b551773d4a2b3354f26600def7
| 22,686,017,285,359 |
96ce6fc25e2dcd1f7c63e25ba81d6ca095b9db99
|
/appium_framework/src/test/java/pages/CalendarLaunchScreen.java
|
ecc06703fdea4c05840152cb723f85e821ca8a4b
|
[] |
no_license
|
Ranju14/appium_framework
|
https://github.com/Ranju14/appium_framework
|
516f69e5d62b30c73ec1a244f6585455e3dcf6db
|
7345994310c68ac441e7573be08c6c6ae42d7279
|
refs/heads/main
| 2023-03-28T23:27:26.600000 | 2021-03-25T14:09:51 | 2021-03-25T14:09:51 | 350,137,208 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pages;
import org.openqa.selenium.By;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
public class CalendarLaunchScreen extends BasePage {
private AndroidElement nextPageArrow ;
public CalendarLaunchScreen(AndroidDriver<AndroidElement> driver) {
super(driver);
nextPageArrow = driver.findElement(By.id("next_arrow"));
}
public CalendarLaunchConfirmationScreen gotoConfirmationScreen() {
nextPageArrow.click();
nextPageArrow.click();
return new CalendarLaunchConfirmationScreen(driver);
}
}
|
UTF-8
|
Java
| 575 |
java
|
CalendarLaunchScreen.java
|
Java
|
[] | null |
[] |
package pages;
import org.openqa.selenium.By;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
public class CalendarLaunchScreen extends BasePage {
private AndroidElement nextPageArrow ;
public CalendarLaunchScreen(AndroidDriver<AndroidElement> driver) {
super(driver);
nextPageArrow = driver.findElement(By.id("next_arrow"));
}
public CalendarLaunchConfirmationScreen gotoConfirmationScreen() {
nextPageArrow.click();
nextPageArrow.click();
return new CalendarLaunchConfirmationScreen(driver);
}
}
| 575 | 0.803478 | 0.803478 | 22 | 25.181818 | 24.758169 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.136364 | false | false |
3
|
f4f02fb55489ab25fc38e932d3ef36719c0364ca
| 10,376,641,024,589 |
d7fefdaff92c98f6cc12c19f4aedaf2968be6a9a
|
/src/programpesel/ReturnNumbers.java
|
825b99a8281dd54036ad761755aa509c6bde71b0
|
[] |
no_license
|
AlekKrajanowski/PeselDecoded
|
https://github.com/AlekKrajanowski/PeselDecoded
|
1b6d69461c771b8b4e11c0cc7ce1018b12187aa9
|
92c6dd86cde50759c853f797944ea9ecc3dc1dda
|
refs/heads/master
| 2020-05-18T06:00:07.240000 | 2019-04-30T08:42:50 | 2019-04-30T08:42:50 | 184,222,312 | 1 | 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 programpesel;
/**
*
* @author Alek
*/
//Klasa zawierająca zwrot poszczególnych cyfr Peselu
public class ReturnNumbers {
//Zwraca liczbę opisującą miesiąc
int monthReturn(String number)throws Exception{
int monthNumber = Integer.parseInt(number.substring(2,4));
return monthNumber;
}
//Zwraca liczbę opisującą płeć
int sexReturn(String number)throws Exception{
int sexNumber = Integer.parseInt(number.substring(9,10));
return sexNumber;
}
//Zwraca liczbę opisującą dzień urodzenia
int dayReturn(String number)throws Exception{
int dayNumber = Integer.parseInt(number.substring(4,6));
return dayNumber;
}
//Zwraca liczbę opisującą w jakim roczniku jest dana osoba
int yearReturn(String number)throws Exception{
int yearNumber = Integer.parseInt(number.substring(2,3));
return yearNumber;
}
//Zwraca końcówkę roku urodzenia
int endReturn(String number)throws Exception{
int endNumber = Integer.parseInt(number.substring(0,2));
return endNumber;
}
}
|
UTF-8
|
Java
| 1,421 |
java
|
ReturnNumbers.java
|
Java
|
[
{
"context": "itor.\n */\npackage programpesel;\n\n/**\n *\n * @author Alek\n */\n//Klasa zawierająca zwrot poszczególnych cyfr",
"end": 230,
"score": 0.9942626357078552,
"start": 226,
"tag": "NAME",
"value": "Alek"
}
] | 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 programpesel;
/**
*
* @author Alek
*/
//Klasa zawierająca zwrot poszczególnych cyfr Peselu
public class ReturnNumbers {
//Zwraca liczbę opisującą miesiąc
int monthReturn(String number)throws Exception{
int monthNumber = Integer.parseInt(number.substring(2,4));
return monthNumber;
}
//Zwraca liczbę opisującą płeć
int sexReturn(String number)throws Exception{
int sexNumber = Integer.parseInt(number.substring(9,10));
return sexNumber;
}
//Zwraca liczbę opisującą dzień urodzenia
int dayReturn(String number)throws Exception{
int dayNumber = Integer.parseInt(number.substring(4,6));
return dayNumber;
}
//Zwraca liczbę opisującą w jakim roczniku jest dana osoba
int yearReturn(String number)throws Exception{
int yearNumber = Integer.parseInt(number.substring(2,3));
return yearNumber;
}
//Zwraca końcówkę roku urodzenia
int endReturn(String number)throws Exception{
int endNumber = Integer.parseInt(number.substring(0,2));
return endNumber;
}
}
| 1,421 | 0.641429 | 0.633571 | 54 | 24.925926 | 23.280775 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.351852 | false | false |
3
|
17fcd47c1cb61190dc1915c07c307b43b8efdc41
| 24,404,004,209,235 |
3020d12414a5b2ff67a2a2ee40ac8a99770fe154
|
/app/src/main/java/com/example/gaston/rickyapp/model/Villano.java
|
dfd8125d39116c4e02a60d317ad1915cfe4448c4
|
[] |
no_license
|
gasvel/WhereOnEarthIsRickyFortAndroidGrupo9
|
https://github.com/gasvel/WhereOnEarthIsRickyFortAndroidGrupo9
|
fa0d10b6442477d5708aacdb38820a1fb323749e
|
05f1dcf32ff99178beff808276271c7bcd96923c
|
refs/heads/master
| 2020-04-05T13:39:57.581000 | 2017-07-06T15:39:47 | 2017-07-06T15:39:47 | 94,960,260 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.gaston.rickyapp.model;
import java.io.Serializable;
import java.util.List;
public class Villano implements Serializable {
private int id;
private String nombre;
private String sexo;
private List<String> senas_particulares;
private List<String> hobbies;
public Villano(String nNombre, String nSexo, List<String> senas, List<String> nHobbies){
this.nombre = nNombre;
this.senas_particulares = senas;
this.sexo = nSexo;
this.hobbies = nHobbies;
}
public Villano(){
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getSexo() {
return sexo;
}
public void setSexo(String sexo) {
this.sexo = sexo;
}
public List<String> getSenas_particulares() {
return senas_particulares;
}
public void setSenas_particulares(List<String> senas_particulares) {
this.senas_particulares = senas_particulares;
}
public List<String> getHobbies() {
return hobbies;
}
public void setHobbies(List<String> hobbies) {
this.hobbies = hobbies;
}
}
|
UTF-8
|
Java
| 1,334 |
java
|
Villano.java
|
Java
|
[
{
"context": "package com.example.gaston.rickyapp.model;\n\n\nimport java.io.Serializable;\nim",
"end": 26,
"score": 0.9937859177589417,
"start": 20,
"tag": "USERNAME",
"value": "gaston"
}
] | null |
[] |
package com.example.gaston.rickyapp.model;
import java.io.Serializable;
import java.util.List;
public class Villano implements Serializable {
private int id;
private String nombre;
private String sexo;
private List<String> senas_particulares;
private List<String> hobbies;
public Villano(String nNombre, String nSexo, List<String> senas, List<String> nHobbies){
this.nombre = nNombre;
this.senas_particulares = senas;
this.sexo = nSexo;
this.hobbies = nHobbies;
}
public Villano(){
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getSexo() {
return sexo;
}
public void setSexo(String sexo) {
this.sexo = sexo;
}
public List<String> getSenas_particulares() {
return senas_particulares;
}
public void setSenas_particulares(List<String> senas_particulares) {
this.senas_particulares = senas_particulares;
}
public List<String> getHobbies() {
return hobbies;
}
public void setHobbies(List<String> hobbies) {
this.hobbies = hobbies;
}
}
| 1,334 | 0.62069 | 0.62069 | 68 | 18.617647 | 19.654388 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.367647 | false | false |
3
|
cd26f6a4871ca702a6679518119e46c11bed3a36
| 24,404,004,212,614 |
5e1da9684bb5d9dda590445bb95ef513147d23b4
|
/zt-order/zt-order-service/src/main/java/com/zsyc/zt/order/config/MybatisPlusConfig.java
|
1b95b799f9b5bdae4567c02f77e1207e54bc14ea
|
[] |
no_license
|
liutaota/b2b2
|
https://github.com/liutaota/b2b2
|
4df87e2d3f7597bf36334112e3203bf92deba6c8
|
3d71bd4062170e5c99e5e59d7dd10f3a8c00a5fd
|
refs/heads/master
| 2023-03-15T11:10:38.699000 | 2021-03-05T08:13:15 | 2021-03-05T08:13:15 | 344,737,055 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zsyc.zt.order.config;
import com.baomidou.mybatisplus.extension.incrementer.OracleKeyGenerator;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 单数据源配置(jeecg.datasource.open = false时生效)
*
* @Author zhoujf
*/
@Configuration
@MapperScan(value = {"com.zsyc.zt.order.**.mapper*"})
public class MybatisPlusConfig {
@Bean
public OracleKeyGenerator oracleKeyGenerator() {
return new OracleKeyGenerator();
}
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
return paginationInterceptor;
}
}
|
UTF-8
|
Java
| 853 |
java
|
MybatisPlusConfig.java
|
Java
|
[
{
"context": "配置(jeecg.datasource.open = false时生效)\n *\n * @Author zhoujf\n */\n@Configuration\n@MapperScan(value = {\"com.zsyc",
"end": 413,
"score": 0.9995365142822266,
"start": 407,
"tag": "USERNAME",
"value": "zhoujf"
}
] | null |
[] |
package com.zsyc.zt.order.config;
import com.baomidou.mybatisplus.extension.incrementer.OracleKeyGenerator;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 单数据源配置(jeecg.datasource.open = false时生效)
*
* @Author zhoujf
*/
@Configuration
@MapperScan(value = {"com.zsyc.zt.order.**.mapper*"})
public class MybatisPlusConfig {
@Bean
public OracleKeyGenerator oracleKeyGenerator() {
return new OracleKeyGenerator();
}
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
return paginationInterceptor;
}
}
| 853 | 0.76775 | 0.76775 | 29 | 27.655172 | 26.320669 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.310345 | false | false |
3
|
090ea523f32f563fe6ce99e50e933e84ed40dc3d
| 33,200,097,221,511 |
43f34f99ce1d93d396aba691f063a88b63a749d7
|
/learn-concurrency/14-Timer TimerTask/src/main/java/example/TimerExample.java
|
a66ca434cbd2c1afae57e76bcb29adab02d6ca7d
|
[] |
no_license
|
Kimcatt/java
|
https://github.com/Kimcatt/java
|
3d5ea771a0249d9b8ceccd6bfeb07f467fc490db
|
2df7751b5090162c8b1918d78b2c4f31b5412cbc
|
refs/heads/master
| 2020-03-21T07:24:52.390000 | 2018-07-12T17:47:42 | 2018-07-12T17:47:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package example;
import java.util.Timer;
import java.util.TimerTask;
/**
* @date 2018.7.12
*/
public class TimerExample {
public static void main(String[] args) {
elementaryUsage();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.exit(-1);
}
public static void elementaryUsage() {
Timer timer = new Timer();
int n = 4;
for (int i = 0; i < n; i++) {
timer.schedule(new TimerTask() {
@Override
public void run() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.format("正在执行任务,当前线程%s...%n", Thread.currentThread().getName());
}
}, 1000);
}
}
}
|
UTF-8
|
Java
| 739 |
java
|
TimerExample.java
|
Java
|
[] | null |
[] |
package example;
import java.util.Timer;
import java.util.TimerTask;
/**
* @date 2018.7.12
*/
public class TimerExample {
public static void main(String[] args) {
elementaryUsage();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.exit(-1);
}
public static void elementaryUsage() {
Timer timer = new Timer();
int n = 4;
for (int i = 0; i < n; i++) {
timer.schedule(new TimerTask() {
@Override
public void run() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.format("正在执行任务,当前线程%s...%n", Thread.currentThread().getName());
}
}, 1000);
}
}
}
| 739 | 0.603905 | 0.574616 | 39 | 17.384615 | 16.204803 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.461539 | false | false |
3
|
6824f095f5cd5f0184a7ed05b572e9c24b1a2193
| 32,847,909,905,156 |
c71805ffef9751dd439e53aa00d7f5501e54eec3
|
/src/main/java/net/thumbtack/school/backend/threads/exercise_16/Exercise_16.java
|
9feb681e89b1d5259c563ebe53294c079df0f244
|
[] |
no_license
|
SergeyMurashkin/tos2018
|
https://github.com/SergeyMurashkin/tos2018
|
562e47a73185ef1db7ddbb2df25fbc8820eef621
|
ddef4a88b93b61214187c764fd3ce94425f427a9
|
refs/heads/master
| 2022-09-10T12:47:15.394000 | 2019-04-29T09:51:44 | 2019-04-29T09:51:44 | 213,416,133 | 0 | 0 | null | false | 2022-06-21T02:00:03 | 2019-10-07T15:12:16 | 2019-10-07T15:13:23 | 2022-06-21T01:59:59 | 254 | 0 | 0 | 4 |
Java
| false | false |
package net.thumbtack.school.backend.threads.exercise_16;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedDeque;
public class Exercise_16 {
// 16) Реализовать очередь задач. Задача - экземпляр класса Task или его наследника,
// имплементирующего Executable - свой интерфейс с единственным методом void execute().
// Потоки - разработчики ставят в очередь экземпляры Task , потоки - исполнители берут их из очереди и исполняют.
// Количество тех и других потоков может быть любым и задается через командную строку main.
public static final int LIMIT = 30;
public static volatile int count = 0;
public static volatile Boolean isEnd = false;
public static void main(String[] args) {
Queue<MyTask> taskQueue = new ConcurrentLinkedDeque<>();
Object lock = new Object();
TaskDeveloper taskDeveloper1 = new TaskDeveloper(taskQueue, lock);
TaskDeveloper taskDeveloper2 = new TaskDeveloper(taskQueue, lock);
TaskDeveloper taskDeveloper3 = new TaskDeveloper(taskQueue, lock);
TaskDeveloper taskDeveloper4 = new TaskDeveloper(taskQueue, lock);
TaskPerformer taskPerformer1 = new TaskPerformer(taskQueue);
TaskPerformer taskPerformer2 = new TaskPerformer(taskQueue);
TaskPerformer taskPerformer3 = new TaskPerformer(taskQueue);
TaskPerformer taskPerformer4 = new TaskPerformer(taskQueue);
taskDeveloper1.start();
taskDeveloper2.start();
taskDeveloper3.start();
taskPerformer1.start();
taskPerformer2.start();
taskPerformer3.start();
taskPerformer4.start();
try {
taskDeveloper1.join();
taskDeveloper2.join();
taskDeveloper3.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
count = LIMIT+100;
taskDeveloper4.start();
try {
taskDeveloper4.join();
taskPerformer1.join();
taskPerformer2.join();
taskPerformer3.join();
taskPerformer4.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 2,466 |
java
|
Exercise_16.java
|
Java
|
[] | null |
[] |
package net.thumbtack.school.backend.threads.exercise_16;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedDeque;
public class Exercise_16 {
// 16) Реализовать очередь задач. Задача - экземпляр класса Task или его наследника,
// имплементирующего Executable - свой интерфейс с единственным методом void execute().
// Потоки - разработчики ставят в очередь экземпляры Task , потоки - исполнители берут их из очереди и исполняют.
// Количество тех и других потоков может быть любым и задается через командную строку main.
public static final int LIMIT = 30;
public static volatile int count = 0;
public static volatile Boolean isEnd = false;
public static void main(String[] args) {
Queue<MyTask> taskQueue = new ConcurrentLinkedDeque<>();
Object lock = new Object();
TaskDeveloper taskDeveloper1 = new TaskDeveloper(taskQueue, lock);
TaskDeveloper taskDeveloper2 = new TaskDeveloper(taskQueue, lock);
TaskDeveloper taskDeveloper3 = new TaskDeveloper(taskQueue, lock);
TaskDeveloper taskDeveloper4 = new TaskDeveloper(taskQueue, lock);
TaskPerformer taskPerformer1 = new TaskPerformer(taskQueue);
TaskPerformer taskPerformer2 = new TaskPerformer(taskQueue);
TaskPerformer taskPerformer3 = new TaskPerformer(taskQueue);
TaskPerformer taskPerformer4 = new TaskPerformer(taskQueue);
taskDeveloper1.start();
taskDeveloper2.start();
taskDeveloper3.start();
taskPerformer1.start();
taskPerformer2.start();
taskPerformer3.start();
taskPerformer4.start();
try {
taskDeveloper1.join();
taskDeveloper2.join();
taskDeveloper3.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
count = LIMIT+100;
taskDeveloper4.start();
try {
taskDeveloper4.join();
taskPerformer1.join();
taskPerformer2.join();
taskPerformer3.join();
taskPerformer4.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
| 2,466 | 0.659246 | 0.64289 | 69 | 30.89855 | 28.733732 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.594203 | false | false |
3
|
65cebbebcfa1012123e7ff316bcbbae4cac15265
| 11,192,684,803,262 |
e38fdce381e29ed9bdf69d9fedaf5561c8de4689
|
/src/main/java/ru/finaljava/repository/CrudDishRepository.java
|
011c3cfdcfbca151d5839b7695c782adaf8e2b70
|
[] |
no_license
|
mitry1974/finaljava
|
https://github.com/mitry1974/finaljava
|
b0d26373f02fb327cea58d1fc6531cfc35b3ef18
|
55428baf525917c70b27b0b46b03c4f310ae474e
|
refs/heads/master
| 2020-03-28T00:25:26.008000 | 2018-09-26T05:46:23 | 2018-09-26T05:46:23 | 147,410,577 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.finaljava.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import ru.finaljava.model.Dish;
import java.util.List;
@Transactional(readOnly = true)
public interface CrudDishRepository extends JpaRepository<Dish, Integer> {
@Modifying
@Transactional
@Query("DELETE from Dish d WHERE d.id=:id")
int delete(@Param("id") int id);
@Query("SELECT d.id as id, d.name as name, d.type as type FROM Dish d")
List<Dish> getAll();
}
|
UTF-8
|
Java
| 717 |
java
|
CrudDishRepository.java
|
Java
|
[] | null |
[] |
package ru.finaljava.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import ru.finaljava.model.Dish;
import java.util.List;
@Transactional(readOnly = true)
public interface CrudDishRepository extends JpaRepository<Dish, Integer> {
@Modifying
@Transactional
@Query("DELETE from Dish d WHERE d.id=:id")
int delete(@Param("id") int id);
@Query("SELECT d.id as id, d.name as name, d.type as type FROM Dish d")
List<Dish> getAll();
}
| 717 | 0.771269 | 0.771269 | 21 | 33.142857 | 24.938564 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.619048 | false | false |
3
|
f8ebfd1a59222d0181f499c334662eb137d3e49c
| 30,769,145,736,606 |
d2b8052f95384e034b86368319022c78b908c70a
|
/src/main/java/hoami/java_validator/controller/UserResultController.java
|
45a50c58ab9582be5926de4f683183de8446b554
|
[] |
no_license
|
Thinh545/java_validator
|
https://github.com/Thinh545/java_validator
|
78fb059d67fc9ec771c94a62539354c6c6c6babf
|
6657f62001ef33bd7fd7a9d3a7e7e566ad8044c6
|
refs/heads/master
| 2020-04-11T08:59:43.594000 | 2019-01-03T11:19:42 | 2019-01-03T11:19:42 | 161,662,578 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package hoami.java_validator.controller;
import static hoami.java_validator.Validator.Rules.StringRuleBuilder.stringRule;
import static hoami.java_validator.Validator.ValidatorBuilder.rules;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import hoami.java_validator.Validator.Validator;
import hoami.java_validator.Validator.ValidatorRegistry;
import hoami.java_validator.Validator.Core.ErrorManager;
import hoami.java_validator.Validator.Core.Selector;
import hoami.java_validator.Validator.Messages.EngMessagesFactory;
import hoami.java_validator.Validator.Messages.MessageFactory;
import hoami.java_validator.Validator.Util.User;
import static hoami.java_validator.Validator.Rules.ComparableRuleBuilder.cmpRule;
import static hoami.java_validator.Validator.ValidatorBuilder.rules;
import static hoami.java_validator.Validator.Rules.StringRuleBuilder.stringRule;
/**
* Servlet implementation class UserResultController
*/
public class UserResultController extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public UserResultController() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
String username = (String) request.getParameter("username");
int userage = -1;
Date userdate = null;
try {
userage = Integer.parseInt(request.getParameter("userage"));
userdate = new SimpleDateFormat("yyyy-MM-dd").parse((request.getParameter("userdate")));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String useremail = (String) request.getParameter("useremail");
String userpassword = (String) request.getParameter("userpassword");
User user = new User(username, userage, userdate, useremail, userpassword);
PrintWriter pw = response.getWriter();
EngMessagesFactory.create();
Date minDate = new Date(), maxDate = new Date();
minDate.setTime(0);
Validator emailValidator = rules(stringRule("email").notEmpty().minLength(5).matches(EMAIL_PATTERN).notMatches("admin@gmail.com")).build();
Validator userValidator = ValidatorRegistry.register("user_validator", rules(
stringRule("user.name").notEmpty().maxLength(50),
cmpRule("user.age").notNull().greatherEqualsThan(1),
cmpRule("user.birthday").notNull().range(minDate, maxDate),
stringRule("user.email").notNull(),
stringRule("user.password").notEmpty().notContains("!").notContains("&").notContains("*").minLength(8).maxLength(50)
).include(emailValidator, "user"));
try {
Selector userSelector = userValidator.validate_selector(user);
String userNameResult = userSelector.select("user.name", String.class);
int userAgeResult = userSelector.select("user.age", Integer.class);
Date userBirthdayResult = userSelector.select("user.birthday", Date.class);
String userEmailResult = userSelector.select("user.email", String.class);
String userPasswordResult = userSelector.select("user.password", String.class);
System.out.println("");
System.out.println(userNameResult + " -- " + userAgeResult + " -- " + userBirthdayResult + " -- " + userEmailResult + " -- " + userPasswordResult);
pw.println("Your user data is valid: " + userNameResult + " -- " + userAgeResult + " -- " + userBirthdayResult + " -- " + userEmailResult + " -- " + userPasswordResult);
}
catch(Exception e) {
System.out.println("");
ErrorManager errors = userValidator.validate_error_manager(user);
e.printStackTrace();
pw.write(errors.getResult());
}
}
}
|
UTF-8
|
Java
| 4,565 |
java
|
UserResultController.java
|
Java
|
[
{
"context": "\tString username = (String) request.getParameter(\"username\");\n\t\tint userage = -1;\n\t\tDate userdate = null;\n\t\t",
"end": 2279,
"score": 0.9990230202674866,
"start": 2271,
"tag": "USERNAME",
"value": "username"
},
{
"context": ").minLength(5).matches(EMAIL_PATTERN).notMatches(\"admin@gmail.com\")).build();\n\t\t\n\t\tValidator userValidator = Valida",
"end": 3080,
"score": 0.9999127388000488,
"start": 3065,
"tag": "EMAIL",
"value": "admin@gmail.com"
}
] | null |
[] |
package hoami.java_validator.controller;
import static hoami.java_validator.Validator.Rules.StringRuleBuilder.stringRule;
import static hoami.java_validator.Validator.ValidatorBuilder.rules;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import hoami.java_validator.Validator.Validator;
import hoami.java_validator.Validator.ValidatorRegistry;
import hoami.java_validator.Validator.Core.ErrorManager;
import hoami.java_validator.Validator.Core.Selector;
import hoami.java_validator.Validator.Messages.EngMessagesFactory;
import hoami.java_validator.Validator.Messages.MessageFactory;
import hoami.java_validator.Validator.Util.User;
import static hoami.java_validator.Validator.Rules.ComparableRuleBuilder.cmpRule;
import static hoami.java_validator.Validator.ValidatorBuilder.rules;
import static hoami.java_validator.Validator.Rules.StringRuleBuilder.stringRule;
/**
* Servlet implementation class UserResultController
*/
public class UserResultController extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public UserResultController() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
String username = (String) request.getParameter("username");
int userage = -1;
Date userdate = null;
try {
userage = Integer.parseInt(request.getParameter("userage"));
userdate = new SimpleDateFormat("yyyy-MM-dd").parse((request.getParameter("userdate")));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String useremail = (String) request.getParameter("useremail");
String userpassword = (String) request.getParameter("userpassword");
User user = new User(username, userage, userdate, useremail, userpassword);
PrintWriter pw = response.getWriter();
EngMessagesFactory.create();
Date minDate = new Date(), maxDate = new Date();
minDate.setTime(0);
Validator emailValidator = rules(stringRule("email").notEmpty().minLength(5).matches(EMAIL_PATTERN).notMatches("<EMAIL>")).build();
Validator userValidator = ValidatorRegistry.register("user_validator", rules(
stringRule("user.name").notEmpty().maxLength(50),
cmpRule("user.age").notNull().greatherEqualsThan(1),
cmpRule("user.birthday").notNull().range(minDate, maxDate),
stringRule("user.email").notNull(),
stringRule("user.password").notEmpty().notContains("!").notContains("&").notContains("*").minLength(8).maxLength(50)
).include(emailValidator, "user"));
try {
Selector userSelector = userValidator.validate_selector(user);
String userNameResult = userSelector.select("user.name", String.class);
int userAgeResult = userSelector.select("user.age", Integer.class);
Date userBirthdayResult = userSelector.select("user.birthday", Date.class);
String userEmailResult = userSelector.select("user.email", String.class);
String userPasswordResult = userSelector.select("user.password", String.class);
System.out.println("");
System.out.println(userNameResult + " -- " + userAgeResult + " -- " + userBirthdayResult + " -- " + userEmailResult + " -- " + userPasswordResult);
pw.println("Your user data is valid: " + userNameResult + " -- " + userAgeResult + " -- " + userBirthdayResult + " -- " + userEmailResult + " -- " + userPasswordResult);
}
catch(Exception e) {
System.out.println("");
ErrorManager errors = userValidator.validate_error_manager(user);
e.printStackTrace();
pw.write(errors.getResult());
}
}
}
| 4,557 | 0.738664 | 0.734502 | 109 | 40.880733 | 36.824585 | 172 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.082569 | false | false |
3
|
83246d991f0c9edbce2f8cdb0e2a32f0f9559605
| 3,006,477,130,565 |
98b3a5cfa1b6e119285600271417d9d975b65349
|
/Week_03/myGateway/src/main/java/com/pikachu/gateway/outbound/netty4/NettyOutboundHandler.java
|
cab6abd4cab0169b7605eca15fb851b8403c2052
|
[] |
no_license
|
iceyang1991/JAVA-01
|
https://github.com/iceyang1991/JAVA-01
|
e4cb677bf675401ba2ebd18a58af24ac37bdddf0
|
59648b5935b68f22e0bb42230239d8751fe4ea6a
|
refs/heads/main
| 2023-02-28T05:23:52.565000 | 2021-01-30T16:20:01 | 2021-01-30T16:20:01 | 328,561,455 | 0 | 0 | null | true | 2021-01-11T05:47:54 | 2021-01-11T05:47:53 | 2021-01-10T13:30:11 | 2021-01-11T05:22:03 | 2 | 0 | 0 | 0 | null | false | false |
package com.pikachu.gateway.outbound.netty4;
import com.pikachu.gateway.filter.HeaderHttpRequestFilter;
import com.pikachu.gateway.filter.HttpRequestFilter;
import com.pikachu.gateway.router.HttpEndpointRouter;
import com.pikachu.gateway.router.WeightRoundRobinHttpRouter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpRequest;
import java.net.URISyntaxException;
import java.util.List;
public class NettyOutboundHandler {
private List<String> backendUrls;
private NettyHttpClient nettyHttpClient;
HttpEndpointRouter router = new WeightRoundRobinHttpRouter();
HttpRequestFilter filter = new HeaderHttpRequestFilter();
public NettyOutboundHandler(List<String> backendUrls) {
this.backendUrls = backendUrls;
nettyHttpClient = new NettyHttpClient();
}
public void handle(FullHttpRequest fullRequest, ChannelHandlerContext ctx) throws InterruptedException, URISyntaxException {
String backendUrl = router.route(this.backendUrls);
backendUrl = backendUrl.endsWith("/") ? backendUrl.substring(0, backendUrl.length() - 1) : backendUrl;
System.out.println("当前请求的服务地址:" + backendUrl + "------" + System.currentTimeMillis());
System.out.println("当前请求的headers中属性pikachu的值:" + fullRequest.headers().get("pikachu") + "------" + System.currentTimeMillis());
filter.filter(fullRequest, ctx);
System.out.println("过滤器在请求的headers中增加属性pikachu的值:" + fullRequest.headers().get("pikachu") + "------" + System.currentTimeMillis());
nettyHttpClient.connect(fullRequest, ctx, backendUrl);
}
}
|
UTF-8
|
Java
| 1,695 |
java
|
NettyOutboundHandler.java
|
Java
|
[] | null |
[] |
package com.pikachu.gateway.outbound.netty4;
import com.pikachu.gateway.filter.HeaderHttpRequestFilter;
import com.pikachu.gateway.filter.HttpRequestFilter;
import com.pikachu.gateway.router.HttpEndpointRouter;
import com.pikachu.gateway.router.WeightRoundRobinHttpRouter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpRequest;
import java.net.URISyntaxException;
import java.util.List;
public class NettyOutboundHandler {
private List<String> backendUrls;
private NettyHttpClient nettyHttpClient;
HttpEndpointRouter router = new WeightRoundRobinHttpRouter();
HttpRequestFilter filter = new HeaderHttpRequestFilter();
public NettyOutboundHandler(List<String> backendUrls) {
this.backendUrls = backendUrls;
nettyHttpClient = new NettyHttpClient();
}
public void handle(FullHttpRequest fullRequest, ChannelHandlerContext ctx) throws InterruptedException, URISyntaxException {
String backendUrl = router.route(this.backendUrls);
backendUrl = backendUrl.endsWith("/") ? backendUrl.substring(0, backendUrl.length() - 1) : backendUrl;
System.out.println("当前请求的服务地址:" + backendUrl + "------" + System.currentTimeMillis());
System.out.println("当前请求的headers中属性pikachu的值:" + fullRequest.headers().get("pikachu") + "------" + System.currentTimeMillis());
filter.filter(fullRequest, ctx);
System.out.println("过滤器在请求的headers中增加属性pikachu的值:" + fullRequest.headers().get("pikachu") + "------" + System.currentTimeMillis());
nettyHttpClient.connect(fullRequest, ctx, backendUrl);
}
}
| 1,695 | 0.751078 | 0.74923 | 35 | 45.371429 | 38.742435 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false |
3
|
72b8be16accd2ddddb50b8844bb1fc15ef586e01
| 8,091,718,430,377 |
a0b3e77790630ac4de591c9105e2b1d4e3bd9c8f
|
/jrap-workflow/src/main/java/com/jingrui/jrap/activiti/manager/CustomGroupDataManager.java
|
f40eaa03fd978d36f567aed87df87039e7de92c9
|
[] |
no_license
|
IvanStephenYuan/JRAP_Lease
|
https://github.com/IvanStephenYuan/JRAP_Lease
|
799c0b1a88fecb0b7d4b9ab73f8da9b47ce19fdb
|
4b4b08d4c23e9181718374eb77676095d3a298dc
|
refs/heads/master
| 2022-12-23T07:54:57.213000 | 2019-06-11T07:43:48 | 2019-06-11T07:43:48 | 174,286,707 | 3 | 5 | null | false | 2022-12-16T09:43:59 | 2019-03-07T06:39:02 | 2021-11-18T18:48:15 | 2022-12-16T09:43:56 | 69,772 | 5 | 5 | 25 |
JavaScript
| false | false |
package com.jingrui.jrap.activiti.manager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.jingrui.jrap.core.IRequest;
import com.jingrui.jrap.core.impl.RequestHelper;
import com.jingrui.jrap.hr.mapper.PositionMapper;
import org.activiti.engine.identity.Group;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.persistence.entity.GroupEntity;
import org.activiti.engine.impl.persistence.entity.data.impl.MybatisGroupDataManager;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import com.jingrui.jrap.activiti.util.ActivitiUtils;
import com.jingrui.jrap.hr.dto.Position;
import com.jingrui.jrap.message.IMessageConsumer;
import com.jingrui.jrap.message.TopicMonitor;
/**
* @author shengyang.zhou@jingrui.com
*/
@TopicMonitor(channel = "position.change")
public class CustomGroupDataManager extends MybatisGroupDataManager
implements IMessageConsumer<Position>, InitializingBean {
@Autowired
private PositionMapper positionMapper;
private Map<String, Map<String, GroupEntity>> multiLangGroupCache = new HashMap<>();
@Autowired
private SpringProcessEngineConfiguration pec;
public CustomGroupDataManager() {
super(null);
}
@Override
public List<Group> findGroupsByUser(String userId) {
List<Position> positions = positionMapper.getPositionByEmployeeCode(userId);
List<Group> gs = new ArrayList<>();
for (Position position : positions) {
gs.add(ActivitiUtils.toActivitiGroup(position));
}
return gs;
}
/**
* 这个方法使用非常频繁,做缓存支持
*
* @param entityId
* @return
*/
@Override
public GroupEntity findById(String entityId) {
IRequest request = RequestHelper.getCurrentRequest(true);
Map<String, GroupEntity> groupCache = multiLangGroupCache.get(request.getLocale());
if (groupCache == null) {
groupCache = new HashMap<>();
multiLangGroupCache.put(request.getLocale(), groupCache);
}
GroupEntity groupEntity = groupCache.get(entityId);
if (groupEntity == null) {
Position position = positionMapper.getPositionByCode(entityId);
groupEntity = ActivitiUtils.toActivitiGroup(position);
groupCache.put(entityId, groupEntity);
}
return groupEntity;
}
@Override
public void onMessage(Position message, String pattern) {
multiLangGroupCache.forEach((k, v) -> v.remove(message.getPositionCode()));
}
@Override
public void afterPropertiesSet() throws Exception {
this.processEngineConfiguration = pec;
}
}
|
UTF-8
|
Java
| 2,889 |
java
|
CustomGroupDataManager.java
|
Java
|
[
{
"context": "jingrui.jrap.message.TopicMonitor;\n\n/**\n * @author shengyang.zhou@jingrui.com\n */\n@TopicMonitor(channel = \"position.change\")\npu",
"end": 959,
"score": 0.9999005198478699,
"start": 933,
"tag": "EMAIL",
"value": "shengyang.zhou@jingrui.com"
}
] | null |
[] |
package com.jingrui.jrap.activiti.manager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.jingrui.jrap.core.IRequest;
import com.jingrui.jrap.core.impl.RequestHelper;
import com.jingrui.jrap.hr.mapper.PositionMapper;
import org.activiti.engine.identity.Group;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.persistence.entity.GroupEntity;
import org.activiti.engine.impl.persistence.entity.data.impl.MybatisGroupDataManager;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import com.jingrui.jrap.activiti.util.ActivitiUtils;
import com.jingrui.jrap.hr.dto.Position;
import com.jingrui.jrap.message.IMessageConsumer;
import com.jingrui.jrap.message.TopicMonitor;
/**
* @author <EMAIL>
*/
@TopicMonitor(channel = "position.change")
public class CustomGroupDataManager extends MybatisGroupDataManager
implements IMessageConsumer<Position>, InitializingBean {
@Autowired
private PositionMapper positionMapper;
private Map<String, Map<String, GroupEntity>> multiLangGroupCache = new HashMap<>();
@Autowired
private SpringProcessEngineConfiguration pec;
public CustomGroupDataManager() {
super(null);
}
@Override
public List<Group> findGroupsByUser(String userId) {
List<Position> positions = positionMapper.getPositionByEmployeeCode(userId);
List<Group> gs = new ArrayList<>();
for (Position position : positions) {
gs.add(ActivitiUtils.toActivitiGroup(position));
}
return gs;
}
/**
* 这个方法使用非常频繁,做缓存支持
*
* @param entityId
* @return
*/
@Override
public GroupEntity findById(String entityId) {
IRequest request = RequestHelper.getCurrentRequest(true);
Map<String, GroupEntity> groupCache = multiLangGroupCache.get(request.getLocale());
if (groupCache == null) {
groupCache = new HashMap<>();
multiLangGroupCache.put(request.getLocale(), groupCache);
}
GroupEntity groupEntity = groupCache.get(entityId);
if (groupEntity == null) {
Position position = positionMapper.getPositionByCode(entityId);
groupEntity = ActivitiUtils.toActivitiGroup(position);
groupCache.put(entityId, groupEntity);
}
return groupEntity;
}
@Override
public void onMessage(Position message, String pattern) {
multiLangGroupCache.forEach((k, v) -> v.remove(message.getPositionCode()));
}
@Override
public void afterPropertiesSet() throws Exception {
this.processEngineConfiguration = pec;
}
}
| 2,870 | 0.719636 | 0.719636 | 85 | 32.611763 | 26.39924 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.541176 | false | false |
3
|
b1a1c97817b02588c8bd7af286612dfafd5e16e1
| 4,243,427,724,744 |
9ebc1ae3ac22bef186615bf5e338e1b1d19aa717
|
/src/leetcode/LeetCode_31.java
|
91724d8e01b58c1d472963bc96c62c7cede1c989
|
[] |
no_license
|
xinil502/Exercises
|
https://github.com/xinil502/Exercises
|
2924029969bcff76ef044e033c97849f629e2acd
|
0d1542a31134667203590949dd1730eba74f2828
|
refs/heads/master
| 2023-06-20T13:39:05.309000 | 2021-07-22T13:35:22 | 2021-07-22T13:35:22 | 261,132,544 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package leetcode;
import java.util.Arrays;
/**
* 31. 下一个排列
*/
public class LeetCode_31 {
public static void main(String[] args) {
int[] nums = Utils.createArray();
Solution_31 sol = new Solution_31();
sol.nextPermutation(nums);
System.out.println(Arrays.toString(nums));
}
}
class Solution_31 {
public void nextPermutation(int[] nums) {
int i, j, k = nums.length;
for (i = k - 2; i >= 0; --i) {
if (nums[i] < nums[i + 1]) {
break;
}
}
int temp;
if (i != -1) {
for (j = k - 1; j > i; --j) {
if (nums[i] < nums[j]) {
break;
}
}
temp = nums[i] ^ nums[j];
nums[i] = temp ^ nums[i];
nums[j] = temp ^ nums[j];
}
for (j = 1; i + j < k - j; ++j) {
temp = nums[i + j] ^ nums[k - j];
nums[i + j] = temp ^ nums[i + j];
nums[k - j] = temp ^ nums[k - j];
}
}
}
|
UTF-8
|
Java
| 1,063 |
java
|
LeetCode_31.java
|
Java
|
[] | null |
[] |
package leetcode;
import java.util.Arrays;
/**
* 31. 下一个排列
*/
public class LeetCode_31 {
public static void main(String[] args) {
int[] nums = Utils.createArray();
Solution_31 sol = new Solution_31();
sol.nextPermutation(nums);
System.out.println(Arrays.toString(nums));
}
}
class Solution_31 {
public void nextPermutation(int[] nums) {
int i, j, k = nums.length;
for (i = k - 2; i >= 0; --i) {
if (nums[i] < nums[i + 1]) {
break;
}
}
int temp;
if (i != -1) {
for (j = k - 1; j > i; --j) {
if (nums[i] < nums[j]) {
break;
}
}
temp = nums[i] ^ nums[j];
nums[i] = temp ^ nums[i];
nums[j] = temp ^ nums[j];
}
for (j = 1; i + j < k - j; ++j) {
temp = nums[i + j] ^ nums[k - j];
nums[i + j] = temp ^ nums[i + j];
nums[k - j] = temp ^ nums[k - j];
}
}
}
| 1,063 | 0.403609 | 0.388414 | 43 | 23.511627 | 16.514084 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.55814 | false | false |
3
|
e367ec414d5c2e1b72d5bdf791ffd1d3e55f383a
| 31,275,951,886,539 |
e880fe26b496b2d7254262df9c825d6de66e62ca
|
/Tic.java
|
2f937eb1460cab4ebe3ac8238535e967509ad5c5
|
[] |
no_license
|
asad9711/Tictactoe-in-java
|
https://github.com/asad9711/Tictactoe-in-java
|
f689bb9674c7e2f5fdf3eb6fd1f3e6fc62f9118d
|
92f2bf2200ed5cb1a0ded7b73e1ba25b1e44e97f
|
refs/heads/master
| 2016-08-12T03:31:57.315000 | 2016-01-25T12:57:52 | 2016-01-25T12:57:52 | 50,350,580 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
class Tic implements ActionListener
{
JFrame f;
JButton b1,b2,b3;
JLabel l;
JButton b[][]=new JButton[3][3];
String x1,x2;
int counter=0;
public Tic(String x)
{
f=new JFrame(x);
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
b[i][j]=new JButton();
b[i][j].setBounds(80+100*j,30+100*i,100,100);
b[i][j].setFont(new Font("Arial", Font.PLAIN, 40));
f.add(b[i][j]);
b[i][j].addActionListener(this);
}
}
b1=new JButton("player1");
b2=new JButton("player2");
b3=new JButton("refresh");
b1.addActionListener(this);
b1.setBounds(100,360,100,50);
b1.setFont(new Font("Arial", Font.PLAIN, 20));
b2.addActionListener(this);
b2.setBounds(220,360,100,50);
b2.setFont(new Font("Arial", Font.PLAIN, 20));
b3.setBounds(130,500,200,50);
b3.setFont(new Font("Arial", Font.PLAIN, 20));
b3.addActionListener(this);
l=new JLabel();
l.setFont(new Font("Arial", Font.PLAIN, 60));
l.setBounds(100,420,350,70);
l.setOpaque(true);
f.add(l);
f.add(b1);
f.add(b2);
f.add(b3);
f.setSize(500,700);
f.setLayout(null);
l.setText(" ");
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.setVisible(true);
}
public static void main(String s[])
{
new Tic("tic tac toe");
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
x1=b1.getText();
}
else if(e.getSource()==b2)
{
x1=b2.getText();
}
else if(e.getSource()==b3)
{
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
b[i][j].setText(" ");
}
}
counter=0;
l.setText(" ");
}
else
{
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
if(e.getSource()==b[i][j])
{
counter++;
if(x1.equals("player1"))
{
b[i][j].setText("0");
}
else
{
b[i][j].setText("X");
}
checkrow();
checkcol();
checkdiag();
if(counter==9)
l.setText("TIE");
}
}
}
}
}
public void checkrow()
{
for(int i=0;i<3;i++)
{
if(b[0][i].getText().equals("0")&&b[1][i].getText().equals("0")&&b[2][i].getText().equals("0"))
l.setText("player1 won");
else if(b[0][i].getText().equals("X")&&b[1][i].getText().equals("X")&&b[2][i].getText().equals("X"))
l.setText("player2 won");
}
}
public void checkcol()
{
for(int i=0;i<3;i++)
{
if(b[i][0].getText().equals("0")&&b[i][1].getText().equals("0")&&b[i][2].getText().equals("0"))
l.setText("player1 won");
else if(b[i][0].getText().equals("X")&&b[i][1].getText().equals("X")&&b[i][2].getText().equals("X"))
l.setText("player2 won");
}
}
public void checkdiag()
{
if(b[0][0].getText().equals("0")&&b[1][1].getText().equals("0")&&b[2][2].getText().equals("0"))
l.setText("player1 won");
if(b[0][0].getText().equals("X")&&b[1][1].getText().equals("X")&&b[2][2].getText().equals("X"))
l.setText("player2 won");
if(b[0][2].getText().equals("0")&&b[1][1].getText().equals("0")&&b[2][0].getText().equals("0"))
l.setText("player1 won");
if(b[0][2].getText().equals("X")&&b[1][1].getText().equals("X")&&b[2][0].getText().equals("X"))
l.setText("player2 won");
}
}
|
UTF-8
|
Java
| 3,098 |
java
|
Tic.java
|
Java
|
[] | null |
[] |
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
class Tic implements ActionListener
{
JFrame f;
JButton b1,b2,b3;
JLabel l;
JButton b[][]=new JButton[3][3];
String x1,x2;
int counter=0;
public Tic(String x)
{
f=new JFrame(x);
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
b[i][j]=new JButton();
b[i][j].setBounds(80+100*j,30+100*i,100,100);
b[i][j].setFont(new Font("Arial", Font.PLAIN, 40));
f.add(b[i][j]);
b[i][j].addActionListener(this);
}
}
b1=new JButton("player1");
b2=new JButton("player2");
b3=new JButton("refresh");
b1.addActionListener(this);
b1.setBounds(100,360,100,50);
b1.setFont(new Font("Arial", Font.PLAIN, 20));
b2.addActionListener(this);
b2.setBounds(220,360,100,50);
b2.setFont(new Font("Arial", Font.PLAIN, 20));
b3.setBounds(130,500,200,50);
b3.setFont(new Font("Arial", Font.PLAIN, 20));
b3.addActionListener(this);
l=new JLabel();
l.setFont(new Font("Arial", Font.PLAIN, 60));
l.setBounds(100,420,350,70);
l.setOpaque(true);
f.add(l);
f.add(b1);
f.add(b2);
f.add(b3);
f.setSize(500,700);
f.setLayout(null);
l.setText(" ");
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.setVisible(true);
}
public static void main(String s[])
{
new Tic("tic tac toe");
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
x1=b1.getText();
}
else if(e.getSource()==b2)
{
x1=b2.getText();
}
else if(e.getSource()==b3)
{
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
b[i][j].setText(" ");
}
}
counter=0;
l.setText(" ");
}
else
{
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
if(e.getSource()==b[i][j])
{
counter++;
if(x1.equals("player1"))
{
b[i][j].setText("0");
}
else
{
b[i][j].setText("X");
}
checkrow();
checkcol();
checkdiag();
if(counter==9)
l.setText("TIE");
}
}
}
}
}
public void checkrow()
{
for(int i=0;i<3;i++)
{
if(b[0][i].getText().equals("0")&&b[1][i].getText().equals("0")&&b[2][i].getText().equals("0"))
l.setText("player1 won");
else if(b[0][i].getText().equals("X")&&b[1][i].getText().equals("X")&&b[2][i].getText().equals("X"))
l.setText("player2 won");
}
}
public void checkcol()
{
for(int i=0;i<3;i++)
{
if(b[i][0].getText().equals("0")&&b[i][1].getText().equals("0")&&b[i][2].getText().equals("0"))
l.setText("player1 won");
else if(b[i][0].getText().equals("X")&&b[i][1].getText().equals("X")&&b[i][2].getText().equals("X"))
l.setText("player2 won");
}
}
public void checkdiag()
{
if(b[0][0].getText().equals("0")&&b[1][1].getText().equals("0")&&b[2][2].getText().equals("0"))
l.setText("player1 won");
if(b[0][0].getText().equals("X")&&b[1][1].getText().equals("X")&&b[2][2].getText().equals("X"))
l.setText("player2 won");
if(b[0][2].getText().equals("0")&&b[1][1].getText().equals("0")&&b[2][0].getText().equals("0"))
l.setText("player1 won");
if(b[0][2].getText().equals("X")&&b[1][1].getText().equals("X")&&b[2][0].getText().equals("X"))
l.setText("player2 won");
}
}
| 3,098 | 0.58328 | 0.523564 | 146 | 20.219177 | 22.795845 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.739726 | false | false |
3
|
844dd75ab8ed87bc8b9f4fd87cd22ea90f4963a8
| 2,559,800,553,068 |
7cfec25738a9b464fa3b2dd1bbacaf461a41f1fd
|
/caduceus/src/main/java/com/dreamail/mercury/mail/hearbeat/.svn/text-base/HearbeatTimer.java.svn-base
|
64a6d22bebfbf6d420b9bdab477b19b520764da2
|
[] |
no_license
|
samanhappy/mercury
|
https://github.com/samanhappy/mercury
|
7730041036b9ca2dcea0779cff6dc554c02901af
|
dd9f86cc59fe4628556fd84f5cbf38e118304f2b
|
refs/heads/master
| 2020-04-08T07:55:22.490000 | 2012-12-12T06:48:06 | 2012-12-12T06:48:06 | 7,125,642 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dreamail.mercury.mail.hearbeat;
import java.util.Timer;
public class HearbeatTimer implements Runnable{
private static long intervalTime = 2000;
public void run() {
Timer timer = new Timer(false);
timer.schedule(new HearbeatTimerTask(), 0, intervalTime);
}
}
|
UTF-8
|
Java
| 281 |
HearbeatTimer.java.svn-base
|
Java
|
[] | null |
[] |
package com.dreamail.mercury.mail.hearbeat;
import java.util.Timer;
public class HearbeatTimer implements Runnable{
private static long intervalTime = 2000;
public void run() {
Timer timer = new Timer(false);
timer.schedule(new HearbeatTimerTask(), 0, intervalTime);
}
}
| 281 | 0.758007 | 0.740214 | 12 | 22.416666 | 20.842499 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.166667 | false | false |
3
|
|
7f2a1875cbe9606fc0b823a6f45d5a67aaf9ae95
| 29,059,748,774,241 |
e42ad12fedf5e89c894471b4adaecd8ac94cc267
|
/src/main/java/com/workspace/shop/service/ShopService.java
|
a7624ae929785c87054bc18b7b481eedbb338bfd
|
[] |
no_license
|
pr0xy-TNU/ShopTest
|
https://github.com/pr0xy-TNU/ShopTest
|
36579be32b7e29f83f1aae87b81dd8fc5235a3b7
|
54951113b5c4e942486408e9e698363fe1c28a8b
|
refs/heads/master
| 2020-03-08T05:14:46.900000 | 2018-04-04T14:27:06 | 2018-04-04T14:27:06 | 127,943,382 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.workspace.shop.service;
import com.workspace.shop.dao.IShopDao;
import com.workspace.shop.entities.ShopEntity;
import com.workspace.shop.repository.IShopRepository;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@ComponentScan(value = {"com.workspace.shop.dao", "com.workspace.shop.service"})
public class ShopService implements IShopService {
@Autowired
private IShopRepository shopRepository;
@Autowired
private IShopDao shopDao;
@Transactional(readOnly = true)
@Override
public ShopEntity findById(int id) {
return shopDao.getShopById(id);
}
@Transactional(readOnly = true)
@Override
public List<ShopEntity> findAll() {
return shopDao.getAllShops();
}
@Transactional(readOnly = true)
@Override
public boolean isExist(int id) {
return shopDao.isExist(id);
}
@Transactional(readOnly = true)
@Override
public List<ShopEntity> getAllShops() {
return shopDao.getAllShops();
}
@Transactional(readOnly = true)
@Override
public ShopEntity getShopById(int id) {
return shopDao.getShopById(id);
}
@Transactional(readOnly = false)
@Override
public int save(ShopEntity shopEntity) {
return shopDao.save(shopEntity);
}
@Transactional
@Override
public void update(int id, ShopEntity shopEntity) {
shopDao.update(id, shopEntity);
}
@Transactional
@Override
public int create(ShopEntity shopEntity) {
return shopDao.create(shopEntity);
}
}
|
UTF-8
|
Java
| 1,781 |
java
|
ShopService.java
|
Java
|
[] | null |
[] |
package com.workspace.shop.service;
import com.workspace.shop.dao.IShopDao;
import com.workspace.shop.entities.ShopEntity;
import com.workspace.shop.repository.IShopRepository;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@ComponentScan(value = {"com.workspace.shop.dao", "com.workspace.shop.service"})
public class ShopService implements IShopService {
@Autowired
private IShopRepository shopRepository;
@Autowired
private IShopDao shopDao;
@Transactional(readOnly = true)
@Override
public ShopEntity findById(int id) {
return shopDao.getShopById(id);
}
@Transactional(readOnly = true)
@Override
public List<ShopEntity> findAll() {
return shopDao.getAllShops();
}
@Transactional(readOnly = true)
@Override
public boolean isExist(int id) {
return shopDao.isExist(id);
}
@Transactional(readOnly = true)
@Override
public List<ShopEntity> getAllShops() {
return shopDao.getAllShops();
}
@Transactional(readOnly = true)
@Override
public ShopEntity getShopById(int id) {
return shopDao.getShopById(id);
}
@Transactional(readOnly = false)
@Override
public int save(ShopEntity shopEntity) {
return shopDao.save(shopEntity);
}
@Transactional
@Override
public void update(int id, ShopEntity shopEntity) {
shopDao.update(id, shopEntity);
}
@Transactional
@Override
public int create(ShopEntity shopEntity) {
return shopDao.create(shopEntity);
}
}
| 1,781 | 0.707468 | 0.707468 | 70 | 24.442858 | 20.262306 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.314286 | false | false |
3
|
b76da6c97c56e178f77e4e0db8a666337d515399
| 29,884,382,481,838 |
075a980c2ed392e02d8e1c85310e8ff4f8a0dc3c
|
/Basic/src/queuelinkedlist/MyListQueueTest.java
|
b9044574d589a63e115d2142e0834c2500eac00e
|
[] |
no_license
|
cijbest/Java
|
https://github.com/cijbest/Java
|
27722b02c671565431750e49b25478303ba66c70
|
b6327276c65b999510d433c0746b9c7c73d7902f
|
refs/heads/master
| 2021-03-30T15:40:32.880000 | 2017-08-15T11:18:32 | 2017-08-15T11:18:32 | 100,369,871 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package queuelinkedlist;
public class MyListQueueTest {
public static void main(String[] args) {
Queue queue = new MyListQueue();
queue.enQueue("A");
queue.enQueue("B");
queue.enQueue("C");
queue.printAll();
System.out.println(queue.deQueue());
queue.printAll();
}
}
|
UTF-8
|
Java
| 290 |
java
|
MyListQueueTest.java
|
Java
|
[] | null |
[] |
package queuelinkedlist;
public class MyListQueueTest {
public static void main(String[] args) {
Queue queue = new MyListQueue();
queue.enQueue("A");
queue.enQueue("B");
queue.enQueue("C");
queue.printAll();
System.out.println(queue.deQueue());
queue.printAll();
}
}
| 290 | 0.672414 | 0.672414 | 17 | 16.058823 | 14.198055 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.529412 | false | false |
3
|
52143f719599f1c04ba468c86dd812e8ad79ba94
| 21,964,462,800,221 |
35c4899bafe4d40f80e7644a96e4c70864fd9a58
|
/entity/src/main/java/com/hoe/entity/Config.java
|
d66264d6183b6e5084169e1c47a08ac227424dff
|
[] |
no_license
|
LingLuoYi/hoe2.0
|
https://github.com/LingLuoYi/hoe2.0
|
6a54a64dfe949006f8f67ad580c6ca07cafff97c
|
92c5eb6b607efe7a6203b0e73ee9002c9bc36f43
|
refs/heads/master
| 2020-05-02T03:46:58.097000 | 2019-03-26T08:03:33 | 2019-03-26T08:03:33 | 177,736,424 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hoe.entity;
import javax.persistence.*;
import java.math.BigDecimal;
@Entity(name ="cloud_config")
public class Config {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String desPass;
//des加密密码,必须是8的倍数
@Column(length = 11)
private Integer saltLength;
//用户加密密码长度
@Column(columnDefinition = "decimal(19,16)")
private BigDecimal coin;
//理论出币
private Double btcExchange;
//btc价格
private String adminEmail;
//接收通知的邮箱
private String coding;
//编码
private String amdinIp;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDesPass() {
return desPass;
}
public void setDesPass(String desPass) {
this.desPass = desPass;
}
public Integer getSaltLength() {
return saltLength;
}
public void setSaltLength(Integer saltLength) {
this.saltLength = saltLength;
}
public BigDecimal getCoin() {
return coin;
}
public void setCoin(BigDecimal coin) {
this.coin = coin;
}
public Double getBtcExchange() {
return btcExchange;
}
public void setBtcExchange(Double btcExchange) {
this.btcExchange = btcExchange;
}
public String getAdminEmail() {
return adminEmail;
}
public void setAdminEmail(String adminEmail) {
this.adminEmail = adminEmail;
}
public String getCoding() {
return coding;
}
public void setCoding(String coding) {
this.coding = coding;
}
public String getAmdinIp() {
return amdinIp;
}
public void setAmdinIp(String amdinIp) {
this.amdinIp = amdinIp;
}
}
|
UTF-8
|
Java
| 1,869 |
java
|
Config.java
|
Java
|
[] | null |
[] |
package com.hoe.entity;
import javax.persistence.*;
import java.math.BigDecimal;
@Entity(name ="cloud_config")
public class Config {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String desPass;
//des加密密码,必须是8的倍数
@Column(length = 11)
private Integer saltLength;
//用户加密密码长度
@Column(columnDefinition = "decimal(19,16)")
private BigDecimal coin;
//理论出币
private Double btcExchange;
//btc价格
private String adminEmail;
//接收通知的邮箱
private String coding;
//编码
private String amdinIp;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDesPass() {
return desPass;
}
public void setDesPass(String desPass) {
this.desPass = desPass;
}
public Integer getSaltLength() {
return saltLength;
}
public void setSaltLength(Integer saltLength) {
this.saltLength = saltLength;
}
public BigDecimal getCoin() {
return coin;
}
public void setCoin(BigDecimal coin) {
this.coin = coin;
}
public Double getBtcExchange() {
return btcExchange;
}
public void setBtcExchange(Double btcExchange) {
this.btcExchange = btcExchange;
}
public String getAdminEmail() {
return adminEmail;
}
public void setAdminEmail(String adminEmail) {
this.adminEmail = adminEmail;
}
public String getCoding() {
return coding;
}
public void setCoding(String coding) {
this.coding = coding;
}
public String getAmdinIp() {
return amdinIp;
}
public void setAmdinIp(String amdinIp) {
this.amdinIp = amdinIp;
}
}
| 1,869 | 0.615769 | 0.611882 | 100 | 17.01 | 16.021545 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.28 | false | false |
3
|
fb9521614ecf2bd26f055a499fdd8352660aa0ba
| 23,338,852,342,932 |
fa4eeaedbde3419b519b26ca30cba6629c5f7613
|
/src/main/java/com/mydemo/test/ExtendTest.java
|
4ec6225b078af5e2ac35521acec5a7f3c6c1459c
|
[] |
no_license
|
854590394/TestForMJL
|
https://github.com/854590394/TestForMJL
|
31f629e30aa86d7bd55491ed05ac67fb5aa2486b
|
b6c99298f9201d59479524a9f227c60ee3910655
|
refs/heads/master
| 2022-09-24T21:23:42.938000 | 2022-08-30T03:29:48 | 2022-08-30T03:29:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mydemo.test;
/**
* description: 继承,静态数据,以及类加载
* time: 2021.11.2
*/
public class ExtendTest {
public static class A {
public String a;
{
this.a = "a";
System.out.println("default A");
}
public A() {
System.out.println("init A");
}
public void out() {
System.out.println("A");
}
@Override
public String toString() {
return "A{" + "a='" + a + '\'' + '}';
}
}
public static class B extends A {
{
this.a = "b";
System.out.println("default B");
}
public B() {
System.out.println("init B");
}
public void out() {
System.out.println("B");
}
}
public static class C extends B {
public static String a = "A";
{
this.a = "c";
System.out.println("default C");
}
public C() {
System.out.println("init C");
}
public void out() {
System.out.println("C");
}
}
public static void main(String[] args) {
C c = new C();
System.out.println( C.a);
}
}
|
UTF-8
|
Java
| 1,265 |
java
|
ExtendTest.java
|
Java
|
[] | null |
[] |
package com.mydemo.test;
/**
* description: 继承,静态数据,以及类加载
* time: 2021.11.2
*/
public class ExtendTest {
public static class A {
public String a;
{
this.a = "a";
System.out.println("default A");
}
public A() {
System.out.println("init A");
}
public void out() {
System.out.println("A");
}
@Override
public String toString() {
return "A{" + "a='" + a + '\'' + '}';
}
}
public static class B extends A {
{
this.a = "b";
System.out.println("default B");
}
public B() {
System.out.println("init B");
}
public void out() {
System.out.println("B");
}
}
public static class C extends B {
public static String a = "A";
{
this.a = "c";
System.out.println("default C");
}
public C() {
System.out.println("init C");
}
public void out() {
System.out.println("C");
}
}
public static void main(String[] args) {
C c = new C();
System.out.println( C.a);
}
}
| 1,265 | 0.429379 | 0.423729 | 59 | 20 | 14.675011 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.305085 | false | false |
3
|
b3ec98c31ee42964282bcac6e27e1b4cbac91032
| 22,574,348,172,690 |
053acd645565b00e39cef72c994209f21d98aa4a
|
/sell/src/main/java/com/imooc/utils/ResultUtils.java
|
8245d40946c2c4f71f4df2e002e9d7fbc16f670d
|
[] |
no_license
|
wangzhu-hongshi/MyProjectLibrary
|
https://github.com/wangzhu-hongshi/MyProjectLibrary
|
463e0414e459692ee94fb7b64bc45649d0e96381
|
8c0c8432bd17d0511ae2e21348b661d9c3131f8a
|
refs/heads/master
| 2022-12-25T21:32:58.445000 | 2019-11-27T14:09:21 | 2019-11-27T14:09:21 | 224,441,335 | 0 | 0 | null | false | 2022-12-16T02:36:54 | 2019-11-27T13:50:02 | 2019-11-27T15:00:42 | 2022-12-16T02:36:53 | 109,279 | 0 | 0 | 47 |
Java
| false | false |
package com.imooc.utils;
import com.imooc.VO.ResultVO;
import java.util.List;
/**
* ResultUtils 数据封装的工具类
*/
public class ResultUtils {
public static ResultVO sucess(List list){
ResultVO resultVO=new ResultVO();
resultVO.setData(list);
resultVO.setCode(0);
resultVO.setMsg("成功");
return resultVO;
}
public static ResultVO sucess(){
return sucess(null);
}
public static ResultVO error(Integer code,String msg){
ResultVO resultVO=new ResultVO();
resultVO.setCode(code);
resultVO.setMsg(msg);
return resultVO;
}
}
|
UTF-8
|
Java
| 640 |
java
|
ResultUtils.java
|
Java
|
[] | null |
[] |
package com.imooc.utils;
import com.imooc.VO.ResultVO;
import java.util.List;
/**
* ResultUtils 数据封装的工具类
*/
public class ResultUtils {
public static ResultVO sucess(List list){
ResultVO resultVO=new ResultVO();
resultVO.setData(list);
resultVO.setCode(0);
resultVO.setMsg("成功");
return resultVO;
}
public static ResultVO sucess(){
return sucess(null);
}
public static ResultVO error(Integer code,String msg){
ResultVO resultVO=new ResultVO();
resultVO.setCode(code);
resultVO.setMsg(msg);
return resultVO;
}
}
| 640 | 0.633871 | 0.632258 | 28 | 21.142857 | 15.938978 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
3
|
8d272778766d858b8430657003369072ea7991a0
| 26,001,732,059,648 |
58434fd4cb91f1652b999fe58a26ec225621f1d8
|
/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java
|
c7125bb9fe9cfa32ee6a061b517905c65bc25e2b
|
[
"BSD-3-Clause"
] |
permissive
|
eclipse/jgit
|
https://github.com/eclipse/jgit
|
774e397a2e5d4f5cdef739bf265cc270ea6cf45d
|
051d92e202dc75e4197b29c6222ac289217994ec
|
refs/heads/master
| 2016-09-23T15:12:32.597000 | 2016-09-23T08:57:16 | 2016-09-23T08:57:17 | 1,553,790 | 943 | 561 |
NOASSERTION
| false | 2021-06-22T11:24:03 | 2011-04-01T02:12:20 | 2021-06-16T07:23:36 | 2021-06-15T00:06:05 | 114,518 | 1,016 | 529 | 46 |
Java
| false | false |
package org.eclipse.jgit.internal.storage.dfs;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.GC;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.INSERT;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.UNREACHABLE_GARBAGE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.junit.Before;
import org.junit.Test;
public class DfsGarbageCollectorTest {
private TestRepository<InMemoryRepository> git;
private InMemoryRepository repo;
private DfsObjDatabase odb;
@Before
public void setUp() throws IOException {
DfsRepositoryDescription desc = new DfsRepositoryDescription("test");
git = new TestRepository<>(new InMemoryRepository(desc));
repo = git.getRepository();
odb = repo.getObjectDatabase();
}
@Test
public void testCollectionWithNoGarbage() throws Exception {
RevCommit commit0 = commit().message("0").create();
RevCommit commit1 = commit().message("1").parent(commit0).create();
git.update("master", commit1);
assertTrue("commit0 reachable", isReachable(repo, commit0));
assertTrue("commit1 reachable", isReachable(repo, commit1));
// Packs start out as INSERT.
assertEquals(2, odb.getPacks().length);
for (DfsPackFile pack : odb.getPacks()) {
assertEquals(INSERT, pack.getPackDescription().getPackSource());
}
gcNoTtl();
// Single GC pack present with all objects.
assertEquals(1, odb.getPacks().length);
DfsPackFile pack = odb.getPacks()[0];
assertEquals(GC, pack.getPackDescription().getPackSource());
assertTrue("commit0 in pack", isObjectInPack(commit0, pack));
assertTrue("commit1 in pack", isObjectInPack(commit1, pack));
}
@Test
public void testCollectionWithGarbage() throws Exception {
RevCommit commit0 = commit().message("0").create();
RevCommit commit1 = commit().message("1").parent(commit0).create();
git.update("master", commit0);
assertTrue("commit0 reachable", isReachable(repo, commit0));
assertFalse("commit1 garbage", isReachable(repo, commit1));
gcNoTtl();
assertEquals(2, odb.getPacks().length);
DfsPackFile gc = null;
DfsPackFile garbage = null;
for (DfsPackFile pack : odb.getPacks()) {
DfsPackDescription d = pack.getPackDescription();
if (d.getPackSource() == GC) {
gc = pack;
} else if (d.getPackSource() == UNREACHABLE_GARBAGE) {
garbage = pack;
} else {
fail("unexpected " + d.getPackSource());
}
}
assertNotNull("created GC pack", gc);
assertTrue(isObjectInPack(commit0, gc));
assertNotNull("created UNREACHABLE_GARBAGE pack", garbage);
assertTrue(isObjectInPack(commit1, garbage));
}
@Test
public void testCollectionWithGarbageAndGarbagePacksPurged()
throws Exception {
RevCommit commit0 = commit().message("0").create();
RevCommit commit1 = commit().message("1").parent(commit0).create();
git.update("master", commit0);
gcNoTtl();
gcWithTtl();
// The repository has an UNREACHABLE_GARBAGE pack that could have
// expired, but since we never purge the most recent UNREACHABLE_GARBAGE
// pack, it must have survived the GC.
boolean commit1Found = false;
for (DfsPackFile pack : odb.getPacks()) {
DfsPackDescription d = pack.getPackDescription();
if (d.getPackSource() == GC) {
assertTrue("has commit0", isObjectInPack(commit0, pack));
assertFalse("no commit1", isObjectInPack(commit1, pack));
} else if (d.getPackSource() == UNREACHABLE_GARBAGE) {
commit1Found |= isObjectInPack(commit1, pack);
} else {
fail("unexpected " + d.getPackSource());
}
}
assertTrue("garbage commit1 still readable", commit1Found);
// Find oldest UNREACHABLE_GARBAGE; it will be pruned by next GC.
DfsPackDescription oldestGarbagePack = null;
for (DfsPackFile pack : odb.getPacks()) {
DfsPackDescription d = pack.getPackDescription();
if (d.getPackSource() == UNREACHABLE_GARBAGE) {
oldestGarbagePack = oldestPack(oldestGarbagePack, d);
}
}
assertNotNull("has UNREACHABLE_GARBAGE", oldestGarbagePack);
gcWithTtl();
assertTrue("has packs", odb.getPacks().length > 0);
for (DfsPackFile pack : odb.getPacks()) {
assertNotEquals(oldestGarbagePack, pack.getPackDescription());
}
}
@Test
public void testCollectionWithGarbageCoalescence() throws Exception {
RevCommit commit0 = commit().message("0").create();
RevCommit commit1 = commit().message("1").parent(commit0).create();
git.update("master", commit0);
for (int i = 0; i < 3; i++) {
commit1 = commit().message("g" + i).parent(commit1).create();
// Make sure we don't have more than 1 UNREACHABLE_GARBAGE pack
// because they're coalesced.
gcNoTtl();
assertEquals(1, countPacks(UNREACHABLE_GARBAGE));
}
}
@Test
public void testCollectionWithGarbageNoCoalescence() throws Exception {
RevCommit commit0 = commit().message("0").create();
RevCommit commit1 = commit().message("1").parent(commit0).create();
git.update("master", commit0);
for (int i = 0; i < 3; i++) {
commit1 = commit().message("g" + i).parent(commit1).create();
DfsGarbageCollector gc = new DfsGarbageCollector(repo);
gc.setCoalesceGarbageLimit(0);
gc.setGarbageTtl(0, TimeUnit.MILLISECONDS);
run(gc);
assertEquals(1 + i, countPacks(UNREACHABLE_GARBAGE));
}
}
private TestRepository<InMemoryRepository>.CommitBuilder commit() {
return git.commit();
}
private void gcNoTtl() throws IOException {
DfsGarbageCollector gc = new DfsGarbageCollector(repo);
gc.setGarbageTtl(0, TimeUnit.MILLISECONDS); // disable TTL
run(gc);
}
private void gcWithTtl() throws InterruptedException, IOException {
// Wait for the system clock to move by at least 1 millisecond.
// This allows the DfsGarbageCollector to recognize the boundary.
long start = System.currentTimeMillis();
do {
Thread.sleep(10);
} while (System.currentTimeMillis() <= start);
DfsGarbageCollector gc = new DfsGarbageCollector(repo);
gc.setGarbageTtl(1, TimeUnit.MILLISECONDS);
run(gc);
}
private void run(DfsGarbageCollector gc) throws IOException {
assertTrue("gc repacked", gc.pack(null));
odb.clearCache();
}
private static boolean isReachable(Repository repo, AnyObjectId id)
throws IOException {
try (RevWalk rw = new RevWalk(repo)) {
for (Ref ref : repo.getAllRefs().values()) {
rw.markStart(rw.parseCommit(ref.getObjectId()));
}
for (RevCommit next; (next = rw.next()) != null;) {
if (AnyObjectId.equals(next, id)) {
return true;
}
}
}
return false;
}
private boolean isObjectInPack(AnyObjectId id, DfsPackFile pack)
throws IOException {
try (DfsReader reader = new DfsReader(odb)) {
return pack.hasObject(reader, id);
}
}
private static DfsPackDescription oldestPack(DfsPackDescription a,
DfsPackDescription b) {
if (a != null && a.getLastModified() < b.getLastModified()) {
return a;
}
return b;
}
private int countPacks(PackSource source) throws IOException {
int cnt = 0;
for (DfsPackFile pack : odb.getPacks()) {
if (pack.getPackDescription().getPackSource() == source) {
cnt++;
}
}
return cnt;
}
}
|
UTF-8
|
Java
| 7,713 |
java
|
DfsGarbageCollectorTest.java
|
Java
|
[] | null |
[] |
package org.eclipse.jgit.internal.storage.dfs;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.GC;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.INSERT;
import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.UNREACHABLE_GARBAGE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.junit.Before;
import org.junit.Test;
public class DfsGarbageCollectorTest {
private TestRepository<InMemoryRepository> git;
private InMemoryRepository repo;
private DfsObjDatabase odb;
@Before
public void setUp() throws IOException {
DfsRepositoryDescription desc = new DfsRepositoryDescription("test");
git = new TestRepository<>(new InMemoryRepository(desc));
repo = git.getRepository();
odb = repo.getObjectDatabase();
}
@Test
public void testCollectionWithNoGarbage() throws Exception {
RevCommit commit0 = commit().message("0").create();
RevCommit commit1 = commit().message("1").parent(commit0).create();
git.update("master", commit1);
assertTrue("commit0 reachable", isReachable(repo, commit0));
assertTrue("commit1 reachable", isReachable(repo, commit1));
// Packs start out as INSERT.
assertEquals(2, odb.getPacks().length);
for (DfsPackFile pack : odb.getPacks()) {
assertEquals(INSERT, pack.getPackDescription().getPackSource());
}
gcNoTtl();
// Single GC pack present with all objects.
assertEquals(1, odb.getPacks().length);
DfsPackFile pack = odb.getPacks()[0];
assertEquals(GC, pack.getPackDescription().getPackSource());
assertTrue("commit0 in pack", isObjectInPack(commit0, pack));
assertTrue("commit1 in pack", isObjectInPack(commit1, pack));
}
@Test
public void testCollectionWithGarbage() throws Exception {
RevCommit commit0 = commit().message("0").create();
RevCommit commit1 = commit().message("1").parent(commit0).create();
git.update("master", commit0);
assertTrue("commit0 reachable", isReachable(repo, commit0));
assertFalse("commit1 garbage", isReachable(repo, commit1));
gcNoTtl();
assertEquals(2, odb.getPacks().length);
DfsPackFile gc = null;
DfsPackFile garbage = null;
for (DfsPackFile pack : odb.getPacks()) {
DfsPackDescription d = pack.getPackDescription();
if (d.getPackSource() == GC) {
gc = pack;
} else if (d.getPackSource() == UNREACHABLE_GARBAGE) {
garbage = pack;
} else {
fail("unexpected " + d.getPackSource());
}
}
assertNotNull("created GC pack", gc);
assertTrue(isObjectInPack(commit0, gc));
assertNotNull("created UNREACHABLE_GARBAGE pack", garbage);
assertTrue(isObjectInPack(commit1, garbage));
}
@Test
public void testCollectionWithGarbageAndGarbagePacksPurged()
throws Exception {
RevCommit commit0 = commit().message("0").create();
RevCommit commit1 = commit().message("1").parent(commit0).create();
git.update("master", commit0);
gcNoTtl();
gcWithTtl();
// The repository has an UNREACHABLE_GARBAGE pack that could have
// expired, but since we never purge the most recent UNREACHABLE_GARBAGE
// pack, it must have survived the GC.
boolean commit1Found = false;
for (DfsPackFile pack : odb.getPacks()) {
DfsPackDescription d = pack.getPackDescription();
if (d.getPackSource() == GC) {
assertTrue("has commit0", isObjectInPack(commit0, pack));
assertFalse("no commit1", isObjectInPack(commit1, pack));
} else if (d.getPackSource() == UNREACHABLE_GARBAGE) {
commit1Found |= isObjectInPack(commit1, pack);
} else {
fail("unexpected " + d.getPackSource());
}
}
assertTrue("garbage commit1 still readable", commit1Found);
// Find oldest UNREACHABLE_GARBAGE; it will be pruned by next GC.
DfsPackDescription oldestGarbagePack = null;
for (DfsPackFile pack : odb.getPacks()) {
DfsPackDescription d = pack.getPackDescription();
if (d.getPackSource() == UNREACHABLE_GARBAGE) {
oldestGarbagePack = oldestPack(oldestGarbagePack, d);
}
}
assertNotNull("has UNREACHABLE_GARBAGE", oldestGarbagePack);
gcWithTtl();
assertTrue("has packs", odb.getPacks().length > 0);
for (DfsPackFile pack : odb.getPacks()) {
assertNotEquals(oldestGarbagePack, pack.getPackDescription());
}
}
@Test
public void testCollectionWithGarbageCoalescence() throws Exception {
RevCommit commit0 = commit().message("0").create();
RevCommit commit1 = commit().message("1").parent(commit0).create();
git.update("master", commit0);
for (int i = 0; i < 3; i++) {
commit1 = commit().message("g" + i).parent(commit1).create();
// Make sure we don't have more than 1 UNREACHABLE_GARBAGE pack
// because they're coalesced.
gcNoTtl();
assertEquals(1, countPacks(UNREACHABLE_GARBAGE));
}
}
@Test
public void testCollectionWithGarbageNoCoalescence() throws Exception {
RevCommit commit0 = commit().message("0").create();
RevCommit commit1 = commit().message("1").parent(commit0).create();
git.update("master", commit0);
for (int i = 0; i < 3; i++) {
commit1 = commit().message("g" + i).parent(commit1).create();
DfsGarbageCollector gc = new DfsGarbageCollector(repo);
gc.setCoalesceGarbageLimit(0);
gc.setGarbageTtl(0, TimeUnit.MILLISECONDS);
run(gc);
assertEquals(1 + i, countPacks(UNREACHABLE_GARBAGE));
}
}
private TestRepository<InMemoryRepository>.CommitBuilder commit() {
return git.commit();
}
private void gcNoTtl() throws IOException {
DfsGarbageCollector gc = new DfsGarbageCollector(repo);
gc.setGarbageTtl(0, TimeUnit.MILLISECONDS); // disable TTL
run(gc);
}
private void gcWithTtl() throws InterruptedException, IOException {
// Wait for the system clock to move by at least 1 millisecond.
// This allows the DfsGarbageCollector to recognize the boundary.
long start = System.currentTimeMillis();
do {
Thread.sleep(10);
} while (System.currentTimeMillis() <= start);
DfsGarbageCollector gc = new DfsGarbageCollector(repo);
gc.setGarbageTtl(1, TimeUnit.MILLISECONDS);
run(gc);
}
private void run(DfsGarbageCollector gc) throws IOException {
assertTrue("gc repacked", gc.pack(null));
odb.clearCache();
}
private static boolean isReachable(Repository repo, AnyObjectId id)
throws IOException {
try (RevWalk rw = new RevWalk(repo)) {
for (Ref ref : repo.getAllRefs().values()) {
rw.markStart(rw.parseCommit(ref.getObjectId()));
}
for (RevCommit next; (next = rw.next()) != null;) {
if (AnyObjectId.equals(next, id)) {
return true;
}
}
}
return false;
}
private boolean isObjectInPack(AnyObjectId id, DfsPackFile pack)
throws IOException {
try (DfsReader reader = new DfsReader(odb)) {
return pack.hasObject(reader, id);
}
}
private static DfsPackDescription oldestPack(DfsPackDescription a,
DfsPackDescription b) {
if (a != null && a.getLastModified() < b.getLastModified()) {
return a;
}
return b;
}
private int countPacks(PackSource source) throws IOException {
int cnt = 0;
for (DfsPackFile pack : odb.getPacks()) {
if (pack.getPackDescription().getPackSource() == source) {
cnt++;
}
}
return cnt;
}
}
| 7,713 | 0.721898 | 0.711915 | 239 | 31.271967 | 25.197739 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.351465 | false | false |
3
|
e827fde80db37adda90aff69128d570758f488a3
| 7,232,724,987,331 |
0a94aec8b9f81cab6a024a6d28155721299515dd
|
/src/main/java/com/example/demo/controllers/CategoryController.java
|
1f07e3403e726ea7df4264869ef25ddf21408866
|
[] |
no_license
|
mounirrouissi/reactiveSpringAngularApp
|
https://github.com/mounirrouissi/reactiveSpringAngularApp
|
3bbfe5f1802e49efaa3a590687219ac7cef675a6
|
45ddffbc311d38a6144dacb74b4eb84a39ce1c2e
|
refs/heads/main
| 2023-06-24T21:24:55.239000 | 2021-07-16T18:13:20 | 2021-07-16T18:13:20 | 386,724,719 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.demo.controllers;
import com.example.demo.models.Book;
import com.example.demo.models.Category;
import com.example.demo.repos.BookRepo;
import com.example.demo.repos.ProductCategoryRepo;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import javax.websocket.server.PathParam;
import java.util.List;
@RestController
@CrossOrigin(origins = "*")
public class CategoryController {
private ProductCategoryRepo categoryRepo;
private BookRepo bookRepo;
public CategoryController(ProductCategoryRepo categoryRepo, BookRepo bookRepo) {
this.categoryRepo = categoryRepo;
this.bookRepo = bookRepo;
}
// comment here again
@GetMapping("/categories")
public List<Category> getCat() {
return categoryRepo.findAll();
}
@GetMapping("/categories/{id}")
public List<Book> getBooksByCategory(@PathVariable int id/*, @PathParam(value="page")int page , @PathParam(value = "size") int size*/) {
System.out.println(" pagination called here");
/* System.out.println(page);
System.out.println(size);*/
var byId = categoryRepo.findById((long) id).get();
return byId.getBooks();
// return new PageImpl<Book>(books.subList(1, 5), PageRequest.of(page, size), books.size());
/* Page<Book> pages = new PageImpl<>((List<Book>) books, PageRequest.of(page, size), books.size());
return pages;*/
}
}
|
UTF-8
|
Java
| 1,611 |
java
|
CategoryController.java
|
Java
|
[] | null |
[] |
package com.example.demo.controllers;
import com.example.demo.models.Book;
import com.example.demo.models.Category;
import com.example.demo.repos.BookRepo;
import com.example.demo.repos.ProductCategoryRepo;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import javax.websocket.server.PathParam;
import java.util.List;
@RestController
@CrossOrigin(origins = "*")
public class CategoryController {
private ProductCategoryRepo categoryRepo;
private BookRepo bookRepo;
public CategoryController(ProductCategoryRepo categoryRepo, BookRepo bookRepo) {
this.categoryRepo = categoryRepo;
this.bookRepo = bookRepo;
}
// comment here again
@GetMapping("/categories")
public List<Category> getCat() {
return categoryRepo.findAll();
}
@GetMapping("/categories/{id}")
public List<Book> getBooksByCategory(@PathVariable int id/*, @PathParam(value="page")int page , @PathParam(value = "size") int size*/) {
System.out.println(" pagination called here");
/* System.out.println(page);
System.out.println(size);*/
var byId = categoryRepo.findById((long) id).get();
return byId.getBooks();
// return new PageImpl<Book>(books.subList(1, 5), PageRequest.of(page, size), books.size());
/* Page<Book> pages = new PageImpl<>((List<Book>) books, PageRequest.of(page, size), books.size());
return pages;*/
}
}
| 1,611 | 0.718187 | 0.716946 | 50 | 31.219999 | 30.556368 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.68 | false | false |
3
|
76b36a381ee172aa132c11ae122f8b9c71328d90
| 27,341,761,808,395 |
606ce511e42ffa5e3d9c6fc8d144286dbfce59d7
|
/src/com/apitesting/SumOfCourse.java
|
7e414dbcf5c909f6730a0b7c683f55adccbbd702
|
[] |
no_license
|
umeshkumre/RestAssuredFramework
|
https://github.com/umeshkumre/RestAssuredFramework
|
63f744be02db5895f487b8c678723167d1c24b59
|
4572a173bab6a14750edc05c5b9649cc3d8d2c6a
|
refs/heads/master
| 2022-09-10T06:19:35.123000 | 2020-06-01T12:12:32 | 2020-06-01T12:12:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.apitesting;
import org.testng.annotations.Test;
import com.files.Bodycode;
import io.restassured.path.json.JsonPath;
public class SumOfCourse {
@Test
public void sumCourse()
{
int sum=0;
JsonPath js=new JsonPath(Bodycode.coursePrice());
int count=js.getInt("courses.size()");
System.out.println(count);
for(int i=0;i<count;i++)
{
int price=js.getInt("courses["+i+"].price");
int copies=js.getInt("courses["+i+"].copies");
int purchaseAmt=price*copies;
System.out.println(purchaseAmt);
sum=sum+purchaseAmt;
}
System.out.println(sum);
}
}
|
UTF-8
|
Java
| 634 |
java
|
SumOfCourse.java
|
Java
|
[] | null |
[] |
package com.apitesting;
import org.testng.annotations.Test;
import com.files.Bodycode;
import io.restassured.path.json.JsonPath;
public class SumOfCourse {
@Test
public void sumCourse()
{
int sum=0;
JsonPath js=new JsonPath(Bodycode.coursePrice());
int count=js.getInt("courses.size()");
System.out.println(count);
for(int i=0;i<count;i++)
{
int price=js.getInt("courses["+i+"].price");
int copies=js.getInt("courses["+i+"].copies");
int purchaseAmt=price*copies;
System.out.println(purchaseAmt);
sum=sum+purchaseAmt;
}
System.out.println(sum);
}
}
| 634 | 0.646688 | 0.643533 | 37 | 16.135136 | 16.910196 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.189189 | false | false |
3
|
3be57ecf834121e586ad775b8e571167c37e8fa0
| 21,191,368,682,215 |
bf8cd95eaf55e7a39016620870f1c15c5239f441
|
/app/src/main/java/xebia/nytimes/popular/activity/MainActivity.java
|
915b87fe43ed07fd3e2a4e03900fb3562794421f
|
[] |
no_license
|
shefiarashid890/Dubai-Test
|
https://github.com/shefiarashid890/Dubai-Test
|
f3e1e3d80b9ca709795a4b1484a237747f99f7c1
|
e5cf07339169cdd0a444b514a43cc2534f7e60e9
|
refs/heads/master
| 2020-06-12T16:32:01.063000 | 2019-06-29T03:48:55 | 2019-06-29T03:48:55 | 194,359,681 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package xebia.nytimes.popular.activity;
import android.app.SearchManager;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import java.util.List;
import xebia.nytimes.popular.constant.NYTimesConstants;
import xebia.nytimes.popular.R;
import xebia.nytimes.popular.adapter.NYTimesAdapter;
import xebia.nytimes.popular.model.NYDetails;
import xebia.nytimes.popular.model.Result;
import xebia.nytimes.popular.rest.ApiClient;
import xebia.nytimes.popular.rest.ApiInterface;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity extends AppCompatActivity {
private static final String TAG = MainActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(getString(R.string.app_name));
setSupportActionBar(toolbar);
if (NYTimesConstants.API_KEY.isEmpty()) {
Toast.makeText(getApplicationContext(), "Please obtain your API KEY https://developer.nytimes.com/get-started", Toast.LENGTH_LONG).show();
return;
}
final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.ny_times_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
ApiInterface apiService =
ApiClient.getClient().create(ApiInterface.class);
Call<NYDetails> call = apiService.getPopularNYDetails(NYTimesConstants.API_KEY);
call.enqueue(new Callback<NYDetails>() {
@Override
public void onResponse(Call<NYDetails> call, Response<NYDetails> response) {
List<Result> movies = response.body().getResults();
recyclerView.setAdapter(new NYTimesAdapter(movies, R.layout.list_item_nytimes, MainActivity.this));
}
@Override
public void onFailure(Call<NYDetails> call, Throwable t) {
// Failed
Log.e(TAG, t.toString());
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.menu, menu);
MenuItem searchViewItem = menu.findItem(R.id.menuSearch);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
final SearchView searchView = (SearchView) searchViewItem.getActionView();
searchView.setQueryHint("Search");
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setIconifiedByDefault(true);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
return true;
}
public String getAPIKey() {
return NYTimesConstants.API_KEY;
}
}
|
UTF-8
|
Java
| 3,598 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package xebia.nytimes.popular.activity;
import android.app.SearchManager;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
import java.util.List;
import xebia.nytimes.popular.constant.NYTimesConstants;
import xebia.nytimes.popular.R;
import xebia.nytimes.popular.adapter.NYTimesAdapter;
import xebia.nytimes.popular.model.NYDetails;
import xebia.nytimes.popular.model.Result;
import xebia.nytimes.popular.rest.ApiClient;
import xebia.nytimes.popular.rest.ApiInterface;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity extends AppCompatActivity {
private static final String TAG = MainActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(getString(R.string.app_name));
setSupportActionBar(toolbar);
if (NYTimesConstants.API_KEY.isEmpty()) {
Toast.makeText(getApplicationContext(), "Please obtain your API KEY https://developer.nytimes.com/get-started", Toast.LENGTH_LONG).show();
return;
}
final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.ny_times_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
ApiInterface apiService =
ApiClient.getClient().create(ApiInterface.class);
Call<NYDetails> call = apiService.getPopularNYDetails(NYTimesConstants.API_KEY);
call.enqueue(new Callback<NYDetails>() {
@Override
public void onResponse(Call<NYDetails> call, Response<NYDetails> response) {
List<Result> movies = response.body().getResults();
recyclerView.setAdapter(new NYTimesAdapter(movies, R.layout.list_item_nytimes, MainActivity.this));
}
@Override
public void onFailure(Call<NYDetails> call, Throwable t) {
// Failed
Log.e(TAG, t.toString());
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.menu, menu);
MenuItem searchViewItem = menu.findItem(R.id.menuSearch);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
final SearchView searchView = (SearchView) searchViewItem.getActionView();
searchView.setQueryHint("Search");
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setIconifiedByDefault(true);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
return true;
}
public String getAPIKey() {
return NYTimesConstants.API_KEY;
}
}
| 3,598 | 0.696498 | 0.694275 | 100 | 34.98 | 29.430929 | 150 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62 | false | false |
3
|
2fa11a8ab866c2b7197e0dd2cc5f5b6fcc7e7e70
| 13,400,298,011,751 |
3e587ccb8bb4d0c33d14539399ffe5a7726800af
|
/controller/src/main/java/com/phonebook/controller/validators/UserValidator.java
|
e13c05311a55f198f65525dee5b71275f35e6fa3
|
[] |
no_license
|
Shapoval1van/-phone-book
|
https://github.com/Shapoval1van/-phone-book
|
dfe45043811d21f54bd46c2c3c4ac9c5a835faea
|
739e44bd500c2809280f13db7802a9da36386ca4
|
refs/heads/master
| 2020-04-06T06:57:39.784000 | 2016-09-02T08:41:00 | 2016-09-02T08:41:00 | 62,207,485 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.phonebook.controller.validators;
import com.phonebook.model.User;
import com.phonebook.service.Iml.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Component
public class UserValidator implements Validator {
private UserServiceImpl userService;
@Autowired
public void setUserService(UserServiceImpl userService) {
this.userService = userService;
}
public boolean supports(Class<?> aClass) {
return User.class.isAssignableFrom(aClass);
}
public void validate(Object o, Errors errors) {
User user = (User)o;
ValidationUtils.rejectIfEmptyOrWhitespace(errors,"userName","validator.writeSpace");
ValidationUtils.rejectIfEmptyOrWhitespace(errors,"password","validator.writeSpace");
ValidationUtils.rejectIfEmptyOrWhitespace(errors,"passwordConfirm","validator.writeSpace");
if(userService.findUserByUsername(user.getUserName())!=null){
errors.rejectValue("userName","validator.userExist");
}
if(!user.getPassword().equals(user.getPasswordConfirm())){
errors.rejectValue("password","validator.passwordDontMatch");
}
if(user.getUserName().length()<5 || user.getUserName().length()>15){
errors.rejectValue("userName","validator.userNameSize");
}
if(user.getPassword().length()<6 || user.getPassword().length()>15){
errors.rejectValue("password","validator.passwordSize");
}
if(!passwordValidation(user.getPassword())){
errors.rejectValue("password","validator.passwordType");
}
}
private boolean passwordValidation(String password){
Pattern pattern = Pattern.compile("[a-z]+");
Matcher matcher = pattern.matcher(password);
if(matcher.find()){
Pattern patternNum = Pattern.compile("[0-9]+");
Matcher matcherNum = patternNum.matcher(password);
if(matcherNum.find()){
return true;
}
}
return false;
}
}
|
UTF-8
|
Java
| 2,339 |
java
|
UserValidator.java
|
Java
|
[] | null |
[] |
package com.phonebook.controller.validators;
import com.phonebook.model.User;
import com.phonebook.service.Iml.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Component
public class UserValidator implements Validator {
private UserServiceImpl userService;
@Autowired
public void setUserService(UserServiceImpl userService) {
this.userService = userService;
}
public boolean supports(Class<?> aClass) {
return User.class.isAssignableFrom(aClass);
}
public void validate(Object o, Errors errors) {
User user = (User)o;
ValidationUtils.rejectIfEmptyOrWhitespace(errors,"userName","validator.writeSpace");
ValidationUtils.rejectIfEmptyOrWhitespace(errors,"password","validator.writeSpace");
ValidationUtils.rejectIfEmptyOrWhitespace(errors,"passwordConfirm","validator.writeSpace");
if(userService.findUserByUsername(user.getUserName())!=null){
errors.rejectValue("userName","validator.userExist");
}
if(!user.getPassword().equals(user.getPasswordConfirm())){
errors.rejectValue("password","validator.passwordDontMatch");
}
if(user.getUserName().length()<5 || user.getUserName().length()>15){
errors.rejectValue("userName","validator.userNameSize");
}
if(user.getPassword().length()<6 || user.getPassword().length()>15){
errors.rejectValue("password","validator.passwordSize");
}
if(!passwordValidation(user.getPassword())){
errors.rejectValue("password","validator.passwordType");
}
}
private boolean passwordValidation(String password){
Pattern pattern = Pattern.compile("[a-z]+");
Matcher matcher = pattern.matcher(password);
if(matcher.find()){
Pattern patternNum = Pattern.compile("[0-9]+");
Matcher matcherNum = patternNum.matcher(password);
if(matcherNum.find()){
return true;
}
}
return false;
}
}
| 2,339 | 0.683625 | 0.680205 | 63 | 36.126984 | 27.989506 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.698413 | false | false |
3
|
1d12e823dcd98acda9d1cdb235dd7a4288148ae5
| 13,400,298,011,409 |
acbe5a2174e7073f2ed74b98f6bbceef4ec9eded
|
/src/standardCoffee/StandardCoffee.java
|
e0ac55058cd4a0e371458cf323ce0e2310a3df1f
|
[] |
no_license
|
kunuraja/digital-coffee-machine
|
https://github.com/kunuraja/digital-coffee-machine
|
34bea5cb02faee1653db42da525a60b98f44a2bd
|
1719fb852c067cb6fef8dc4e10f58a986a7b54a1
|
refs/heads/master
| 2023-06-26T02:23:02.193000 | 2021-07-21T12:18:49 | 2021-07-21T12:18:49 | 388,027,996 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package standardCoffee;
import advancedCoffee.AdvancedStandard;
public interface StandardCoffee extends AdvancedStandard {
}
|
UTF-8
|
Java
| 128 |
java
|
StandardCoffee.java
|
Java
|
[] | null |
[] |
package standardCoffee;
import advancedCoffee.AdvancedStandard;
public interface StandardCoffee extends AdvancedStandard {
}
| 128 | 0.851563 | 0.851563 | 7 | 17.285715 | 21.789345 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false |
3
|
3da214c7689538b7c787deb0c0b5a6331ee78cde
| 4,801,773,504,024 |
75977f961f184cc1d4e18c337b3c80e52c6a7538
|
/extension/src/main/java/com/maxdemarzi/users/Users.java
|
a2e7e48679e629ffe2504b4af4d04374dafcc4c6
|
[
"MIT"
] |
permissive
|
bvigga/dating_site
|
https://github.com/bvigga/dating_site
|
83bb5c3c9adea10c77c590e71b22cd163ac1e6ff
|
dd702ef28f9529d1bebd46a6dbb42278acec0e91
|
refs/heads/master
| 2021-09-27T09:47:52.823000 | 2018-11-07T18:20:08 | 2018-11-07T18:20:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.maxdemarzi.users;
import com.maxdemarzi.CustomObjectMapper;
import com.maxdemarzi.schema.Labels;
import com.maxdemarzi.schema.RelationshipTypes;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.codehaus.jackson.map.ObjectMapper;
import org.neo4j.graphdb.*;
import javax.ws.rs.*;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.time.ZonedDateTime;
import java.util.*;
import static com.maxdemarzi.Time.utc;
import static com.maxdemarzi.schema.Properties.*;
@Path("/users")
public class Users {
private static final ObjectMapper objectMapper = CustomObjectMapper.getInstance();
@GET
@Path("/{username}")
public Response getUser(@PathParam("username") final String username, @Context GraphDatabaseService db) throws IOException {
Map<String, Object> results;
try (Transaction tx = db.beginTx()) {
Node user = findUser(username, db);
results = user.getAllProperties();
tx.success();
}
return Response.ok().entity(objectMapper.writeValueAsString(results)).build();
}
@GET
@Path("/{username}/profile")
public Response getProfile(@PathParam("username") final String username,
@QueryParam("username2") final String username2,
@Context GraphDatabaseService db) throws IOException {
Map<String, Object> results;
try (Transaction tx = db.beginTx()) {
Node user = findUser(username, db);
results = getUserAttributes(user);
HashSet<Node> userHas = new HashSet<>();
HashSet<Node> userWants = new HashSet<>();
for (Relationship r1 : user.getRelationships(Direction.OUTGOING, RelationshipTypes.WANTS)) {
userHas.add(r1.getEndNode());
}
for (Relationship r1 : user.getRelationships(Direction.OUTGOING, RelationshipTypes.WANTS)) {
userWants.add(r1.getEndNode());
}
if (username2 != null && !username.equals(username2)) {
Node user2 = findUser(username2, db);
HashSet<Node> user2Has = new HashSet<>();
HashSet<Node> user2Wants = new HashSet<>();
for (Relationship r1 : user2.getRelationships(Direction.OUTGOING, RelationshipTypes.WANTS)) {
user2Has.add(r1.getEndNode());
}
for (Relationship r1 : user2.getRelationships(Direction.OUTGOING, RelationshipTypes.WANTS)) {
user2Wants.add(r1.getEndNode());
}
results.put(HAVE, userHas.stream().filter(user2Wants::contains).count());
results.put(WANT, userWants.stream().filter(user2Has::contains).count());
}
tx.success();
}
return Response.ok().entity(objectMapper.writeValueAsString(results)).build();
}
@POST
public Response createUser(String body, @Context GraphDatabaseService db) throws IOException {
HashMap parameters = UserValidator.validate(body);
Map<String, Object> results;
String username = ((String)parameters.get(USERNAME)).toLowerCase();
String email = ((String)parameters.get(EMAIL)).toLowerCase();
try (Transaction tx = db.beginTx()) {
Node user = db.findNode(Labels.User, USERNAME, username);
if (user == null) {
user = db.findNode(Labels.User, EMAIL, email);
if (user == null) {
user = db.createNode(Labels.User);
user.setProperty(EMAIL, email);
user.setProperty(NAME, parameters.get(NAME));
user.setProperty(BIO, parameters.get(BIO));
user.setProperty(USERNAME, username);
user.setProperty(PASSWORD, parameters.get(PASSWORD));
user.setProperty(IS, parameters.get(IS));
user.setProperty(IS_LOOKING_FOR, parameters.get(IS_LOOKING_FOR));
user.setProperty(HASH, new Md5Hash(email).toString());
user.setProperty(TIME, ZonedDateTime.now(utc));
user.setProperty(DISTANCE, parameters.get(DISTANCE));
Node city = db.findNode(Labels.City, FULL_NAME, parameters.get(CITY));
user.createRelationshipTo(city, RelationshipTypes.IN_LOCATION);
Node state = city.getSingleRelationship(RelationshipTypes.IN_LOCATION, Direction.OUTGOING).getEndNode();
Node timezone = state.getSingleRelationship(RelationshipTypes.IN_TIMEZONE, Direction.OUTGOING).getEndNode();
user.setProperty(TIMEZONE, timezone.getProperty(NAME));
results = user.getAllProperties();
} else {
throw UserExceptions.existingEmailParameter;
}
} else {
throw UserExceptions.existingUsernameParameter;
}
tx.success();
}
return Response.ok().entity(objectMapper.writeValueAsString(results)).build();
}
@PUT
public Response updateUser(String body, @Context GraphDatabaseService db) throws IOException {
HashMap parameters = UserValidator.update(body);
Map<String, Object> results;
try (Transaction tx = db.beginTx()) {
Node user = db.findNode(Labels.User, USERNAME, parameters.get(USERNAME));
if (user != null) {
if(parameters.containsKey(EMAIL)) { user.setProperty(EMAIL, parameters.get(EMAIL)); }
if(parameters.containsKey(NAME)) { user.setProperty(NAME, parameters.get(NAME)); }
if(parameters.containsKey(PASSWORD)) { user.setProperty(PASSWORD, parameters.get(PASSWORD)); }
if(parameters.containsKey(IS)) { user.setProperty(IS, parameters.get(IS)); }
if(parameters.containsKey(IS_LOOKING_FOR)) { user.setProperty(IS_LOOKING_FOR, parameters.get(IS_LOOKING_FOR)); }
if(parameters.containsKey(HASH)) { user.setProperty(HASH, new Md5Hash(((String)parameters.get(EMAIL)).toLowerCase()).toString()); }
if(parameters.containsKey(DISTANCE)) { user.setProperty(DISTANCE, parameters.get(DISTANCE)); }
if(parameters.containsKey(CITY)) {
Node city = db.findNode(Labels.City, FULL_NAME, parameters.get(CITY));
user.getSingleRelationship(RelationshipTypes.IN_LOCATION, Direction.OUTGOING).delete();
user.createRelationshipTo(city, RelationshipTypes.IN_LOCATION);
Node state = city.getSingleRelationship(RelationshipTypes.IN_LOCATION, Direction.OUTGOING).getEndNode();
Node timezone = state.getSingleRelationship(RelationshipTypes.IN_TIMEZONE, Direction.OUTGOING).getEndNode();
user.setProperty(TIMEZONE, timezone.getProperty(NAME));
}
results = user.getAllProperties();
} else {
throw UserExceptions.userNotFound;
}
tx.success();
}
return Response.ok().entity(objectMapper.writeValueAsString(results)).build();
}
public static Node findUser(String username, @Context GraphDatabaseService db) {
if (username == null) { return null; }
Node user = db.findNode(Labels.User, USERNAME, username.toLowerCase());
if (user == null) { throw UserExceptions.userNotFound; }
return user;
}
public static Map<String, Object> getUserAttributes(Node user) {
Map<String, Object> results;
results = user.getAllProperties();
results.remove(EMAIL);
results.remove(PASSWORD);
Integer likes = user.getDegree(RelationshipTypes.LIKES, Direction.OUTGOING);
Integer hates = user.getDegree(RelationshipTypes.HATES, Direction.OUTGOING);
Integer highFives = user.getDegree(RelationshipTypes.HIGH_FIVED, Direction.OUTGOING);
Integer lowFives = user.getDegree(RelationshipTypes.LOW_FIVED, Direction.OUTGOING);
Integer has = user.getDegree(RelationshipTypes.HAS, Direction.OUTGOING);
Integer wants = user.getDegree(RelationshipTypes.WANTS, Direction.OUTGOING);
Integer locations = user.getDegree(RelationshipTypes.IN_LOCATION, Direction.OUTGOING);
Integer conversations = user.getDegree(RelationshipTypes.PART_OF, Direction.OUTGOING);
Integer posts = user.getDegree(Direction.OUTGOING) - likes - hates - highFives - lowFives - has - wants - locations - conversations;
results.put(LIKES, likes);
results.put(HATES, hates);
results.put(LOW_FIVES, lowFives);
results.put(HIGH_FIVES, highFives);
results.put(HAS, has);
results.put(WANTS, wants);
results.put(POSTS, posts);
String city = (String)user.getSingleRelationship(RelationshipTypes.IN_LOCATION, Direction.OUTGOING).getEndNode().getProperty(FULL_NAME);
results.put(CITY, city);
return results;
}
}
|
UTF-8
|
Java
| 9,174 |
java
|
Users.java
|
Java
|
[
{
"context": " if (username2 != null && !username.equals(username2)) {\n Node user2 = findUser(usernam",
"end": 2128,
"score": 0.9413437843322754,
"start": 2119,
"tag": "USERNAME",
"value": "username2"
},
{
"context": "));\n user.setProperty(USERNAME, username);\n user.setProperty(PASSWORD, ",
"end": 3883,
"score": 0.9889200329780579,
"start": 3875,
"tag": "USERNAME",
"value": "username"
},
{
"context": "{\n Node user = db.findNode(Labels.User, USERNAME, parameters.get(USERNAME));\n if (u",
"end": 5525,
"score": 0.6470558047294617,
"start": 5521,
"tag": "NAME",
"value": "USER"
},
{
"context": "db.findNode(Labels.User, USERNAME, parameters.get(USERNAME));\n if (user != null) {\n ",
"end": 5554,
"score": 0.6789825558662415,
"start": 5546,
"tag": "USERNAME",
"value": "USERNAME"
}
] | null |
[] |
package com.maxdemarzi.users;
import com.maxdemarzi.CustomObjectMapper;
import com.maxdemarzi.schema.Labels;
import com.maxdemarzi.schema.RelationshipTypes;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.codehaus.jackson.map.ObjectMapper;
import org.neo4j.graphdb.*;
import javax.ws.rs.*;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.time.ZonedDateTime;
import java.util.*;
import static com.maxdemarzi.Time.utc;
import static com.maxdemarzi.schema.Properties.*;
@Path("/users")
public class Users {
private static final ObjectMapper objectMapper = CustomObjectMapper.getInstance();
@GET
@Path("/{username}")
public Response getUser(@PathParam("username") final String username, @Context GraphDatabaseService db) throws IOException {
Map<String, Object> results;
try (Transaction tx = db.beginTx()) {
Node user = findUser(username, db);
results = user.getAllProperties();
tx.success();
}
return Response.ok().entity(objectMapper.writeValueAsString(results)).build();
}
@GET
@Path("/{username}/profile")
public Response getProfile(@PathParam("username") final String username,
@QueryParam("username2") final String username2,
@Context GraphDatabaseService db) throws IOException {
Map<String, Object> results;
try (Transaction tx = db.beginTx()) {
Node user = findUser(username, db);
results = getUserAttributes(user);
HashSet<Node> userHas = new HashSet<>();
HashSet<Node> userWants = new HashSet<>();
for (Relationship r1 : user.getRelationships(Direction.OUTGOING, RelationshipTypes.WANTS)) {
userHas.add(r1.getEndNode());
}
for (Relationship r1 : user.getRelationships(Direction.OUTGOING, RelationshipTypes.WANTS)) {
userWants.add(r1.getEndNode());
}
if (username2 != null && !username.equals(username2)) {
Node user2 = findUser(username2, db);
HashSet<Node> user2Has = new HashSet<>();
HashSet<Node> user2Wants = new HashSet<>();
for (Relationship r1 : user2.getRelationships(Direction.OUTGOING, RelationshipTypes.WANTS)) {
user2Has.add(r1.getEndNode());
}
for (Relationship r1 : user2.getRelationships(Direction.OUTGOING, RelationshipTypes.WANTS)) {
user2Wants.add(r1.getEndNode());
}
results.put(HAVE, userHas.stream().filter(user2Wants::contains).count());
results.put(WANT, userWants.stream().filter(user2Has::contains).count());
}
tx.success();
}
return Response.ok().entity(objectMapper.writeValueAsString(results)).build();
}
@POST
public Response createUser(String body, @Context GraphDatabaseService db) throws IOException {
HashMap parameters = UserValidator.validate(body);
Map<String, Object> results;
String username = ((String)parameters.get(USERNAME)).toLowerCase();
String email = ((String)parameters.get(EMAIL)).toLowerCase();
try (Transaction tx = db.beginTx()) {
Node user = db.findNode(Labels.User, USERNAME, username);
if (user == null) {
user = db.findNode(Labels.User, EMAIL, email);
if (user == null) {
user = db.createNode(Labels.User);
user.setProperty(EMAIL, email);
user.setProperty(NAME, parameters.get(NAME));
user.setProperty(BIO, parameters.get(BIO));
user.setProperty(USERNAME, username);
user.setProperty(PASSWORD, parameters.get(PASSWORD));
user.setProperty(IS, parameters.get(IS));
user.setProperty(IS_LOOKING_FOR, parameters.get(IS_LOOKING_FOR));
user.setProperty(HASH, new Md5Hash(email).toString());
user.setProperty(TIME, ZonedDateTime.now(utc));
user.setProperty(DISTANCE, parameters.get(DISTANCE));
Node city = db.findNode(Labels.City, FULL_NAME, parameters.get(CITY));
user.createRelationshipTo(city, RelationshipTypes.IN_LOCATION);
Node state = city.getSingleRelationship(RelationshipTypes.IN_LOCATION, Direction.OUTGOING).getEndNode();
Node timezone = state.getSingleRelationship(RelationshipTypes.IN_TIMEZONE, Direction.OUTGOING).getEndNode();
user.setProperty(TIMEZONE, timezone.getProperty(NAME));
results = user.getAllProperties();
} else {
throw UserExceptions.existingEmailParameter;
}
} else {
throw UserExceptions.existingUsernameParameter;
}
tx.success();
}
return Response.ok().entity(objectMapper.writeValueAsString(results)).build();
}
@PUT
public Response updateUser(String body, @Context GraphDatabaseService db) throws IOException {
HashMap parameters = UserValidator.update(body);
Map<String, Object> results;
try (Transaction tx = db.beginTx()) {
Node user = db.findNode(Labels.User, USERNAME, parameters.get(USERNAME));
if (user != null) {
if(parameters.containsKey(EMAIL)) { user.setProperty(EMAIL, parameters.get(EMAIL)); }
if(parameters.containsKey(NAME)) { user.setProperty(NAME, parameters.get(NAME)); }
if(parameters.containsKey(PASSWORD)) { user.setProperty(PASSWORD, parameters.get(PASSWORD)); }
if(parameters.containsKey(IS)) { user.setProperty(IS, parameters.get(IS)); }
if(parameters.containsKey(IS_LOOKING_FOR)) { user.setProperty(IS_LOOKING_FOR, parameters.get(IS_LOOKING_FOR)); }
if(parameters.containsKey(HASH)) { user.setProperty(HASH, new Md5Hash(((String)parameters.get(EMAIL)).toLowerCase()).toString()); }
if(parameters.containsKey(DISTANCE)) { user.setProperty(DISTANCE, parameters.get(DISTANCE)); }
if(parameters.containsKey(CITY)) {
Node city = db.findNode(Labels.City, FULL_NAME, parameters.get(CITY));
user.getSingleRelationship(RelationshipTypes.IN_LOCATION, Direction.OUTGOING).delete();
user.createRelationshipTo(city, RelationshipTypes.IN_LOCATION);
Node state = city.getSingleRelationship(RelationshipTypes.IN_LOCATION, Direction.OUTGOING).getEndNode();
Node timezone = state.getSingleRelationship(RelationshipTypes.IN_TIMEZONE, Direction.OUTGOING).getEndNode();
user.setProperty(TIMEZONE, timezone.getProperty(NAME));
}
results = user.getAllProperties();
} else {
throw UserExceptions.userNotFound;
}
tx.success();
}
return Response.ok().entity(objectMapper.writeValueAsString(results)).build();
}
public static Node findUser(String username, @Context GraphDatabaseService db) {
if (username == null) { return null; }
Node user = db.findNode(Labels.User, USERNAME, username.toLowerCase());
if (user == null) { throw UserExceptions.userNotFound; }
return user;
}
public static Map<String, Object> getUserAttributes(Node user) {
Map<String, Object> results;
results = user.getAllProperties();
results.remove(EMAIL);
results.remove(PASSWORD);
Integer likes = user.getDegree(RelationshipTypes.LIKES, Direction.OUTGOING);
Integer hates = user.getDegree(RelationshipTypes.HATES, Direction.OUTGOING);
Integer highFives = user.getDegree(RelationshipTypes.HIGH_FIVED, Direction.OUTGOING);
Integer lowFives = user.getDegree(RelationshipTypes.LOW_FIVED, Direction.OUTGOING);
Integer has = user.getDegree(RelationshipTypes.HAS, Direction.OUTGOING);
Integer wants = user.getDegree(RelationshipTypes.WANTS, Direction.OUTGOING);
Integer locations = user.getDegree(RelationshipTypes.IN_LOCATION, Direction.OUTGOING);
Integer conversations = user.getDegree(RelationshipTypes.PART_OF, Direction.OUTGOING);
Integer posts = user.getDegree(Direction.OUTGOING) - likes - hates - highFives - lowFives - has - wants - locations - conversations;
results.put(LIKES, likes);
results.put(HATES, hates);
results.put(LOW_FIVES, lowFives);
results.put(HIGH_FIVES, highFives);
results.put(HAS, has);
results.put(WANTS, wants);
results.put(POSTS, posts);
String city = (String)user.getSingleRelationship(RelationshipTypes.IN_LOCATION, Direction.OUTGOING).getEndNode().getProperty(FULL_NAME);
results.put(CITY, city);
return results;
}
}
| 9,174 | 0.63015 | 0.627316 | 187 | 48.064171 | 36.774296 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.005348 | false | false |
3
|
f9b7a3e97404a5fb03d58d8868e09cfe46feecf6
| 13,829,794,749,752 |
9487876c134ea74cbfb29a265f24d8c7cf30be15
|
/src/main/java/easy/UniqueWordAbbreviation288.java
|
24052637b2829cb00262e416a512bb6062d38565
|
[] |
no_license
|
sonyfe25cp/LeetCode-OJ
|
https://github.com/sonyfe25cp/LeetCode-OJ
|
ef00eda4a130326a623200b782de43cb440ced50
|
d3bf2fb21a717ecab7b15d80e0069aaee30c11f2
|
refs/heads/master
| 2021-01-10T03:37:10.278000 | 2016-01-02T13:06:46 | 2016-01-02T13:06:46 | 45,093,259 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package easy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by OmarTech on 15-12-7.
*/
public class UniqueWordAbbreviation288 {
public void findUnique(String[] dict) {
Map<String, Integer> map = new HashMap<>();
Map<String, List<String>> originMap = new HashMap<>();
for (String string : dict) {
String abbr = string;
if (string.length() > 2) {
abbr = "" + string.charAt(0) + (string.length() - 2) + string.charAt(string.length() - 1);
}
Integer integer = map.get(abbr);
if (integer == null) {
integer = 0;
}
integer++;
map.put(abbr, integer);
List<String> strings = originMap.get(abbr);
if (strings == null) {
strings = new ArrayList<>();
}
strings.add(string);
originMap.put(abbr, strings);
}
for (Map.Entry<String, Integer> entry : map.entrySet()) {
String abbr = entry.getKey();
List<String> strings = originMap.get(abbr);
if (entry.getValue() == 1) {
System.out.println("isUnique(\"" + strings.get(0) + "\") -> true");
} else {
for (String s : strings) {
System.out.println("isUnique(\"" + s + "\") -> false");
}
}
}
}
}
|
UTF-8
|
Java
| 1,487 |
java
|
UniqueWordAbbreviation288.java
|
Java
|
[
{
"context": "til.List;\nimport java.util.Map;\n\n/**\n * Created by OmarTech on 15-12-7.\n */\npublic class UniqueWordAbbreviati",
"end": 141,
"score": 0.9974594116210938,
"start": 133,
"tag": "USERNAME",
"value": "OmarTech"
}
] | null |
[] |
package easy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by OmarTech on 15-12-7.
*/
public class UniqueWordAbbreviation288 {
public void findUnique(String[] dict) {
Map<String, Integer> map = new HashMap<>();
Map<String, List<String>> originMap = new HashMap<>();
for (String string : dict) {
String abbr = string;
if (string.length() > 2) {
abbr = "" + string.charAt(0) + (string.length() - 2) + string.charAt(string.length() - 1);
}
Integer integer = map.get(abbr);
if (integer == null) {
integer = 0;
}
integer++;
map.put(abbr, integer);
List<String> strings = originMap.get(abbr);
if (strings == null) {
strings = new ArrayList<>();
}
strings.add(string);
originMap.put(abbr, strings);
}
for (Map.Entry<String, Integer> entry : map.entrySet()) {
String abbr = entry.getKey();
List<String> strings = originMap.get(abbr);
if (entry.getValue() == 1) {
System.out.println("isUnique(\"" + strings.get(0) + "\") -> true");
} else {
for (String s : strings) {
System.out.println("isUnique(\"" + s + "\") -> false");
}
}
}
}
}
| 1,487 | 0.487559 | 0.477471 | 47 | 30.638298 | 23.169519 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.553191 | false | false |
3
|
03f04070ebb48d0cfcfdb37d62185a6339c470d0
| 9,569,187,187,186 |
c107c8e5d91403684894a3803c32e3642107cb79
|
/Interview_Revision_Book/src/Arrays/Merge_Two_Sorted_Arrays.java
|
8b712424d3d9a4ce997eaea4e19f724e52d87314
|
[] |
no_license
|
BhavyaaArora-08/Your_GoTo_Tool_For_All_Algos_And_DS
|
https://github.com/BhavyaaArora-08/Your_GoTo_Tool_For_All_Algos_And_DS
|
822a1c2c4cad1caa00394b5685f660f6aec915a3
|
a553b2b758be7f113045dfa94ed06c4d87ea852b
|
refs/heads/master
| 2022-04-08T17:31:46.397000 | 2020-03-18T17:40:59 | 2020-03-18T17:40:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Arrays;
public class Merge_Two_Sorted_Arrays {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] arr1= {1,5,7,10};
int[] arr2= {3,9,11};
one(arr1, arr2);
}
//TC: O(n+m) SC: O(n+m)
public static void one(int[] arr1,int[] arr2)
{
int[] arr=new int[arr1.length+arr2.length];
int i=0,j=0,k=0;
while(i<arr1.length && j<arr2.length)
{
while(i<arr1.length && arr1[i]<arr2[j])
arr[k++]=arr1[i++];
while(i<arr1.length && j<arr2.length && arr2[j]<arr1[i])
arr[k++]=arr2[j++];
}
while(i<arr1.length)
arr[k++]=arr1[i++];
while(j<arr2.length)
arr[k++]=arr2[j++];
for(int val:arr)
System.out.println(val);
}
//Try doing Inplace too
public static void two(int[] arr1,int[] arr2)
{
}
}
|
UTF-8
|
Java
| 844 |
java
|
Merge_Two_Sorted_Arrays.java
|
Java
|
[] | null |
[] |
package Arrays;
public class Merge_Two_Sorted_Arrays {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] arr1= {1,5,7,10};
int[] arr2= {3,9,11};
one(arr1, arr2);
}
//TC: O(n+m) SC: O(n+m)
public static void one(int[] arr1,int[] arr2)
{
int[] arr=new int[arr1.length+arr2.length];
int i=0,j=0,k=0;
while(i<arr1.length && j<arr2.length)
{
while(i<arr1.length && arr1[i]<arr2[j])
arr[k++]=arr1[i++];
while(i<arr1.length && j<arr2.length && arr2[j]<arr1[i])
arr[k++]=arr2[j++];
}
while(i<arr1.length)
arr[k++]=arr1[i++];
while(j<arr2.length)
arr[k++]=arr2[j++];
for(int val:arr)
System.out.println(val);
}
//Try doing Inplace too
public static void two(int[] arr1,int[] arr2)
{
}
}
| 844 | 0.543839 | 0.5 | 45 | 16.755556 | 16.407526 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.155555 | false | false |
3
|
dec44d9eac4ad4213db138a5a3a5d3f474d9e33d
| 20,624,433,025,029 |
58e2858afdd3dae3f91ae5dd060b7cd196ba3968
|
/components/pendientes/AccesoDatos/cu.uci.abos.dataprovider.jisis/src/cu/uci/abos/dataprovider/jisis/internal/utils/JisisUtil.java
|
108352bd7839914b3796f7c149ee3ad4b2444ccb
|
[] |
no_license
|
lafaurie/ABCD3
|
https://github.com/lafaurie/ABCD3
|
d9203dddef6ff63453e63eb120c788cba116d795
|
cd7b6281f926eaf0ec17abca6888cf01a40ee57a
|
refs/heads/master
| 2020-03-20T06:58:13.643000 | 2017-02-09T21:09:46 | 2017-02-09T21:09:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cu.uci.abos.dataprovider.jisis.internal.utils;
import java.io.IOException;
import org.unesco.jisis.corelib.client.ConnectionNIO;
import org.unesco.jisis.corelib.client.ConnectionPool;
import org.unesco.jisis.corelib.common.IConnection;
import org.unesco.jisis.corelib.exceptions.DbException;
public class JisisUtil {
public static IConnection getConnection(String dbServer, int dbPort,
String username, String password) {
IConnection connection = null;
int i = ConnectionPool.findConnection(dbServer, dbPort);
if (i == -1) {
try {
connection = ConnectionNIO.connect(dbServer, dbPort, username,
password);
} catch (DbException | IOException e) {
e.printStackTrace();
}
ConnectionPool.addConnection(connection);
} else {
connection = ConnectionPool.getConnections().get(i).getConnection();
}
return connection;
}
}
|
UTF-8
|
Java
| 902 |
java
|
JisisUtil.java
|
Java
|
[] | null |
[] |
package cu.uci.abos.dataprovider.jisis.internal.utils;
import java.io.IOException;
import org.unesco.jisis.corelib.client.ConnectionNIO;
import org.unesco.jisis.corelib.client.ConnectionPool;
import org.unesco.jisis.corelib.common.IConnection;
import org.unesco.jisis.corelib.exceptions.DbException;
public class JisisUtil {
public static IConnection getConnection(String dbServer, int dbPort,
String username, String password) {
IConnection connection = null;
int i = ConnectionPool.findConnection(dbServer, dbPort);
if (i == -1) {
try {
connection = ConnectionNIO.connect(dbServer, dbPort, username,
password);
} catch (DbException | IOException e) {
e.printStackTrace();
}
ConnectionPool.addConnection(connection);
} else {
connection = ConnectionPool.getConnections().get(i).getConnection();
}
return connection;
}
}
| 902 | 0.726164 | 0.725055 | 30 | 28.066668 | 24.02212 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.233333 | false | false |
3
|
946e1ee4dee0b0c1f06bddfc9d2520f497519bdb
| 22,926,535,484,983 |
1483319b913ad27ae755ae26cae68ab7b4e7208a
|
/src/main/java/frc/robot/autonomous/paths/StraightAndShoot.java
|
60f0492c687c8e32f9c52d2e0b27d856390c4a37
|
[] |
no_license
|
Red4219/2021Bot
|
https://github.com/Red4219/2021Bot
|
b8d793d30f9530374c74661b2a731b449f99abfe
|
3ab433291a4677180b99d67de9ef2d44602a48e0
|
refs/heads/main
| 2023-08-04T01:03:17.912000 | 2021-09-09T23:08:05 | 2021-09-09T23:08:05 | 365,579,783 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package frc.robot.autonomous.paths;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import frc.robot.autonomous.actions.DriveTillDistance;
import frc.robot.autonomous.actions.Shoot;
import frc.robot.autonomous.actions.StraightDrive;
/*
* This autonomous path just drives forward
*
* Author: Francisco Fabregat
*/
public class StraightAndShoot extends SequentialCommandGroup {
/*
* Autonomous Path to Drive Straight
*/
public StraightAndShoot() {
addCommands(
/* Drives forward for 6ft 0in */
//new StraightDrive(true, 6, 0, false),
new DriveTillDistance(90),
new Shoot()
);
}
}
|
UTF-8
|
Java
| 686 |
java
|
StraightAndShoot.java
|
Java
|
[
{
"context": "autonomous path just drives forward\n * \n * Author: Francisco Fabregat\n */\npublic class StraightAndShoot extends Sequent",
"end": 329,
"score": 0.9998739957809448,
"start": 311,
"tag": "NAME",
"value": "Francisco Fabregat"
}
] | null |
[] |
package frc.robot.autonomous.paths;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import frc.robot.autonomous.actions.DriveTillDistance;
import frc.robot.autonomous.actions.Shoot;
import frc.robot.autonomous.actions.StraightDrive;
/*
* This autonomous path just drives forward
*
* Author: <NAME>
*/
public class StraightAndShoot extends SequentialCommandGroup {
/*
* Autonomous Path to Drive Straight
*/
public StraightAndShoot() {
addCommands(
/* Drives forward for 6ft 0in */
//new StraightDrive(true, 6, 0, false),
new DriveTillDistance(90),
new Shoot()
);
}
}
| 674 | 0.680758 | 0.670554 | 27 | 24.444445 | 21.283506 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.407407 | false | false |
3
|
cb17f19094ec1e06bd9ad87534495c8ded224602
| 3,676,492,051,741 |
03bfdc8ddd783dcbfa7c29df56cef9927baa7ef1
|
/src/utility/leetcode/array/MinmumSortedRotatedArray.java
|
290aa853b112016a9993e197a94542412464f58f
|
[] |
no_license
|
indreshgahoi/topcode
|
https://github.com/indreshgahoi/topcode
|
efab5b468cb36383f692360220dc0f553dcb9bc3
|
1e46619f787feea450265ab643423b0a9de8c70c
|
refs/heads/master
| 2021-01-18T23:31:15.255000 | 2019-03-26T05:12:07 | 2019-03-26T05:12:07 | 12,508,946 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package utility.leetcode.array;
class MinmumSortedRotatedArray {
public int findMin(int[] num) {
int l = 0 ;
int r = num.length-1;
int mid ;
while(l <= r){
mid = l +(r-l)/2 ;
if(num[l] < num[r]) return num[l] ;
else if(mid>0 && num[mid-1]>num[mid] ) return num[mid] ;
else if(mid < num.length-1 && num[mid+1] < num[mid]) return num[mid+1] ;
if(num[l] < num[mid]){
l = mid+1 ;
}else {
r = mid-1 ;
}
}
return num[l] ;
}
public static void main(String[] args) {
System.out.println("MinmumSortedRotatedArray");
}
}
class MinmumSortedRotatedArrayDuplicate {
public int findMin(int[] num) {
int l = 0 ;
int r = num.length-1;
int mid ;
while(l < r){
mid = l +(r-l)/2 ;
if(num[l] < num[r]) return num[l] ;
else if(mid>0 && num[mid-1]>num[mid] ) return num[mid] ;
else if(mid < num.length-1 && num[mid+1] < num[mid]) return num[mid+1] ;
if(num[l] == num[mid]){
l++ ;
continue ;
}
if(num[l] < num[mid]){
l = mid + 1 ;
}else {
r = mid - 1 ;
}
//System.out.println("l:"+ l + " r:"+r);
}
return num[l] ;
}
public static void main(String[] args) {
int [] nums = new int[]{5,5,7,7} ;
int minValue = new MinmumSortedRotatedArrayDuplicate().findMin(nums);
System.out.println(" min value "+ minValue);
}
}
|
UTF-8
|
Java
| 1,501 |
java
|
MinmumSortedRotatedArray.java
|
Java
|
[] | null |
[] |
package utility.leetcode.array;
class MinmumSortedRotatedArray {
public int findMin(int[] num) {
int l = 0 ;
int r = num.length-1;
int mid ;
while(l <= r){
mid = l +(r-l)/2 ;
if(num[l] < num[r]) return num[l] ;
else if(mid>0 && num[mid-1]>num[mid] ) return num[mid] ;
else if(mid < num.length-1 && num[mid+1] < num[mid]) return num[mid+1] ;
if(num[l] < num[mid]){
l = mid+1 ;
}else {
r = mid-1 ;
}
}
return num[l] ;
}
public static void main(String[] args) {
System.out.println("MinmumSortedRotatedArray");
}
}
class MinmumSortedRotatedArrayDuplicate {
public int findMin(int[] num) {
int l = 0 ;
int r = num.length-1;
int mid ;
while(l < r){
mid = l +(r-l)/2 ;
if(num[l] < num[r]) return num[l] ;
else if(mid>0 && num[mid-1]>num[mid] ) return num[mid] ;
else if(mid < num.length-1 && num[mid+1] < num[mid]) return num[mid+1] ;
if(num[l] == num[mid]){
l++ ;
continue ;
}
if(num[l] < num[mid]){
l = mid + 1 ;
}else {
r = mid - 1 ;
}
//System.out.println("l:"+ l + " r:"+r);
}
return num[l] ;
}
public static void main(String[] args) {
int [] nums = new int[]{5,5,7,7} ;
int minValue = new MinmumSortedRotatedArrayDuplicate().findMin(nums);
System.out.println(" min value "+ minValue);
}
}
| 1,501 | 0.49034 | 0.47435 | 58 | 24.879311 | 19.916271 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.327586 | false | false |
3
|
5c880ccd727135b2587d3be0d2f074cc0a08d701
| 17,961,553,280,992 |
1afedc1a2643f387a0e20edfd220f19bf32330c0
|
/src/main/java/com/bjpowernode/finance/service/impl/FundProductServiceImpl.java
|
5314b75bd9d8d806375d7c3dc09d6e1a25c7595e
|
[] |
no_license
|
taiiii/propertyManagement
|
https://github.com/taiiii/propertyManagement
|
febfe500beea9a70d6f102f72945c304a2b34ef9
|
107a0fcabff23e3e1d93257f82695fdb5e4db18b
|
refs/heads/master
| 2023-06-23T13:37:41.541000 | 2021-07-19T14:58:49 | 2021-07-19T14:59:03 | 387,504,677 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bjpowernode.finance.service.impl;
import com.bjpowernode.finance.entity.FundProduct;
import com.bjpowernode.finance.mapper.FundProductMapper;
import com.bjpowernode.finance.service.FundProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class FundProductServiceImpl implements FundProductService {
@Autowired
FundProductMapper fundProductMapper;
@Override
public List<FundProduct> selectAllFundProduct() {
return fundProductMapper.selectByExample(null);
}
@Override
public FundProduct selectFundProductById(Integer id) {
return fundProductMapper.selectByPrimaryKey(id);
}
@Override
@Transactional
public Integer insertFundProduct(FundProduct fundProduct) {
return fundProductMapper.insertSelective(fundProduct);
}
@Override
@Transactional
public Integer updateFundProduct(FundProduct fundProduct) {
return fundProductMapper.updateByPrimaryKeySelective(fundProduct);
}
@Override
@Transactional
public Integer deleteFundProductById(Integer id) {
return fundProductMapper.deleteByPrimaryKey(id);
}
}
|
UTF-8
|
Java
| 1,313 |
java
|
FundProductServiceImpl.java
|
Java
|
[] | null |
[] |
package com.bjpowernode.finance.service.impl;
import com.bjpowernode.finance.entity.FundProduct;
import com.bjpowernode.finance.mapper.FundProductMapper;
import com.bjpowernode.finance.service.FundProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class FundProductServiceImpl implements FundProductService {
@Autowired
FundProductMapper fundProductMapper;
@Override
public List<FundProduct> selectAllFundProduct() {
return fundProductMapper.selectByExample(null);
}
@Override
public FundProduct selectFundProductById(Integer id) {
return fundProductMapper.selectByPrimaryKey(id);
}
@Override
@Transactional
public Integer insertFundProduct(FundProduct fundProduct) {
return fundProductMapper.insertSelective(fundProduct);
}
@Override
@Transactional
public Integer updateFundProduct(FundProduct fundProduct) {
return fundProductMapper.updateByPrimaryKeySelective(fundProduct);
}
@Override
@Transactional
public Integer deleteFundProductById(Integer id) {
return fundProductMapper.deleteByPrimaryKey(id);
}
}
| 1,313 | 0.776847 | 0.776847 | 42 | 30.261906 | 25.372519 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
3
|
f74d092b1ca7b8f7ea35d300619d6b69e8aff707
| 3,788,161,220,784 |
bba771b9b7d5bf437546d768fd59541de1d57bfd
|
/src/main/java/com/glowingpigeon/columbiare/state/premade/A1S1_1.java
|
5225605909c14404cf42a05e6bdbf39e5f0d773b
|
[
"MIT"
] |
permissive
|
eyanje/Columbiare-Java
|
https://github.com/eyanje/Columbiare-Java
|
163fe1251b14bef6cf066b2572c0d1d087d08ca6
|
6a5229bdbfbd03a2f802c46951546f740ba23141
|
refs/heads/master
| 2020-05-02T22:38:05.554000 | 2019-06-05T17:11:02 | 2019-06-05T17:11:02 | 178,257,448 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.glowingpigeon.columbiare.state.premade;
import com.glowingpigeon.columbiare.audio.AudioManager;
import com.glowingpigeon.columbiare.data.*;
import com.glowingpigeon.columbiare.state.*;
import javafx.scene.canvas.GraphicsContext;
public class A1S1_1 extends PlaySection {
private boolean transition;
public A1S1_1(Save save, GraphicsContext graphicsContext) {
super(save, graphicsContext);
save.recomputeSolids();
transition = false;
AudioManager.playMusic("audio/act1.au");
}
@Override
public void update(Save save) {
super.update(save);
if (save.getPlayer().getX() > 4096 && save.getPlayer().getY() <= 468) {
transition = true;
save.setProgress("a1s2");
}
}
public Section getNextSection() {
if (transition) {
return new A1S2(getSave(), getGraphicsContext());
}
return this;
}
}
|
UTF-8
|
Java
| 957 |
java
|
A1S1_1.java
|
Java
|
[] | null |
[] |
package com.glowingpigeon.columbiare.state.premade;
import com.glowingpigeon.columbiare.audio.AudioManager;
import com.glowingpigeon.columbiare.data.*;
import com.glowingpigeon.columbiare.state.*;
import javafx.scene.canvas.GraphicsContext;
public class A1S1_1 extends PlaySection {
private boolean transition;
public A1S1_1(Save save, GraphicsContext graphicsContext) {
super(save, graphicsContext);
save.recomputeSolids();
transition = false;
AudioManager.playMusic("audio/act1.au");
}
@Override
public void update(Save save) {
super.update(save);
if (save.getPlayer().getX() > 4096 && save.getPlayer().getY() <= 468) {
transition = true;
save.setProgress("a1s2");
}
}
public Section getNextSection() {
if (transition) {
return new A1S2(getSave(), getGraphicsContext());
}
return this;
}
}
| 957 | 0.639498 | 0.62069 | 38 | 24.210526 | 21.770523 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.473684 | false | false |
3
|
d636a6cd138db3a324706fcf90fa5257f08516ba
| 31,464,930,466,506 |
8988c577894030296d935c0ec4398d41430e86dd
|
/notepad/src/main/java/com/training/view/View.java
|
3ce932104b89039cfc7e4c0cf5347664cf8bceea
|
[] |
no_license
|
Zhuchkov/Training
|
https://github.com/Zhuchkov/Training
|
a52e768ea1569c73ff442d681ae6cb6635d8e007
|
3033160d8dca63459f6bc70889a2edaf2299d4cc
|
refs/heads/master
| 2021-01-19T20:27:30.509000 | 2017-05-26T09:43:59 | 2017-05-26T09:43:59 | 88,509,157 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.training.view;
import com.training.model.Note;
public class View {
public static String DATA_REQUEST = "info.note.creation";
public static String INPUT_REQUEST_STRING = "request.input.string";
public static String INPUT_WRONG_STRING = "error.input.string";
public static String SAVE_REQUEST = "request.input.save";
public static String WRONG_UNMERIC_INPUT = "error.input.numeric";
public static String NICKNAME_OCCUPIED = "error.database.unick.nicknme";
public static String DB_EXCEPTION = "error.database.unknown";
public static String REQUEST_INPUT_LANGUAGE = "request.input.language";
public void print(String... output) {
for (String s : output) {
System.out.print(ResourceManager.INSTANCE.getStringUTF8Encoded(s)+" ");
}
System.out.println("\n");
}
public void print(String output) {
System.out.println(ResourceManager.INSTANCE.getStringUTF8Encoded(output));
}
public void printNote(Note note) {
System.out.println(note.toString());
}
}
|
UTF-8
|
Java
| 1,002 |
java
|
View.java
|
Java
|
[] | null |
[] |
package com.training.view;
import com.training.model.Note;
public class View {
public static String DATA_REQUEST = "info.note.creation";
public static String INPUT_REQUEST_STRING = "request.input.string";
public static String INPUT_WRONG_STRING = "error.input.string";
public static String SAVE_REQUEST = "request.input.save";
public static String WRONG_UNMERIC_INPUT = "error.input.numeric";
public static String NICKNAME_OCCUPIED = "error.database.unick.nicknme";
public static String DB_EXCEPTION = "error.database.unknown";
public static String REQUEST_INPUT_LANGUAGE = "request.input.language";
public void print(String... output) {
for (String s : output) {
System.out.print(ResourceManager.INSTANCE.getStringUTF8Encoded(s)+" ");
}
System.out.println("\n");
}
public void print(String output) {
System.out.println(ResourceManager.INSTANCE.getStringUTF8Encoded(output));
}
public void printNote(Note note) {
System.out.println(note.toString());
}
}
| 1,002 | 0.738523 | 0.736527 | 32 | 30.3125 | 28.523497 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4375 | false | false |
3
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.