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
024cf6e8f14fc1506ef5f6fee7fb331df112bae2
11,416,023,102,523
73631c5f1e0f89fa97744680785a2e5ec29b28ec
/src/main/java/au/com/iglooit/silverwater/service/dao/EnquireDAO.java
4e15481a5668e96d260d945aa61c14faba6e9c06
[]
no_license
igloooooo/silverwater
https://github.com/igloooooo/silverwater
fe5d6f3eadb7fef660b5ae97355786a5ba240b66
82892671617d91b5f577a067e320eb683e243f2c
refs/heads/master
2021-01-02T22:51:12.647000
2015-01-07T13:00:29
2015-01-07T13:00:29
27,011,507
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package au.com.iglooit.silverwater.service.dao; import au.com.iglooit.silverwater.model.entity.Enquire; /** * Created by nicholaszhu on 24/12/2014. */ public interface EnquireDAO extends IEntityService<Enquire>{ void createEnquire(Enquire enquire); }
UTF-8
Java
259
java
EnquireDAO.java
Java
[ { "context": "lverwater.model.entity.Enquire;\n\n/**\n * Created by nicholaszhu on 24/12/2014.\n */\npublic interface EnquireDAO ex", "end": 135, "score": 0.9995916485786438, "start": 124, "tag": "USERNAME", "value": "nicholaszhu" } ]
null
[]
package au.com.iglooit.silverwater.service.dao; import au.com.iglooit.silverwater.model.entity.Enquire; /** * Created by nicholaszhu on 24/12/2014. */ public interface EnquireDAO extends IEntityService<Enquire>{ void createEnquire(Enquire enquire); }
259
0.776062
0.745174
10
24.9
24.192768
60
false
false
0
0
0
0
0
0
0.3
false
false
2
f50840dbfd5dbc86cd8c621be9f59bdec81299a8
4,380,866,697,659
7a11ea0a5875fa85f744c0b1e5d4de6487eef740
/app/src/main/java/com/example/khutroapp/ui/screenchutro/activity_detailroom/connect/DetailKhachThueConnect.java
79bdb471165f2ea236592b4257a35b3614e28b28
[]
no_license
TrongHieu1998/KhuTroApp
https://github.com/TrongHieu1998/KhuTroApp
26c6aa6fd07fb4c1ea84c88d8913568aeeac8497
7798458701a404b017d9f187b0fa208c9ddbca2e
refs/heads/master
2022-12-03T22:48:40.175000
2020-08-10T16:19:27
2020-08-10T16:19:27
277,440,386
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.khutroapp.ui.screenchutro.activity_detailroom.connect; import android.os.AsyncTask; import com.example.khutroapp.ui.connect.JDBCController; import com.example.khutroapp.ui.screenchutro.activity_detailroom.model.DetailKhachThueModel; import com.example.khutroapp.ui.screens.activity_indexwater.model.IndexWaterModel; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; public class DetailKhachThueConnect { private static final String TAG = "k"; private JDBCController jdbcController = new JDBCController(); private Connection connection; public DetailKhachThueConnect() { connection = jdbcController.ConnnectionData(); // Tạo kết nối tới database } public List<DetailKhachThueModel> loadDetailKT (String tenphong) throws SQLException { List<DetailKhachThueModel> list = new ArrayList<>(); Statement statement = connection.createStatement(); String sql ="SELECT TENKT,CONVERT(varchar,NGAYSINH, 103) NGAYSINH,GIOITINH,SDT,QUEQUAN\n" + "FROM KHACHTHUE,PHONG,KHACHTHUEPHONG\n" + "WHERE KHACHTHUEPHONG.MAPHONG=PHONG.MAPHONG AND KHACHTHUE.MAKT=KHACHTHUEPHONG.MAKT AND TENPHONG='"+tenphong+"'"; // Thực thi câu lệnh SQL trả về đối tượng ResultSet. // Mọi kết quả trả về sẽ được lưu trong ResultSet ResultSet rs = statement.executeQuery(sql); while (rs.next()) { boolean add = list.add(new DetailKhachThueModel( rs.getString("TENKT"), rs.getString("NGAYSINH"), rs.getString("GIOITINH"), rs.getString("SDT"), rs.getString("QUEQUAN") )); } connection.close();// Đóng kết nối return list; } private class connect extends AsyncTask<Void,Void,Connection> { @Override protected Connection doInBackground(Void... voids) { connection = jdbcController.ConnnectionData(); // Tạo kết nối tới database return connection; } } }
UTF-8
Java
2,208
java
DetailKhachThueConnect.java
Java
[]
null
[]
package com.example.khutroapp.ui.screenchutro.activity_detailroom.connect; import android.os.AsyncTask; import com.example.khutroapp.ui.connect.JDBCController; import com.example.khutroapp.ui.screenchutro.activity_detailroom.model.DetailKhachThueModel; import com.example.khutroapp.ui.screens.activity_indexwater.model.IndexWaterModel; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; public class DetailKhachThueConnect { private static final String TAG = "k"; private JDBCController jdbcController = new JDBCController(); private Connection connection; public DetailKhachThueConnect() { connection = jdbcController.ConnnectionData(); // Tạo kết nối tới database } public List<DetailKhachThueModel> loadDetailKT (String tenphong) throws SQLException { List<DetailKhachThueModel> list = new ArrayList<>(); Statement statement = connection.createStatement(); String sql ="SELECT TENKT,CONVERT(varchar,NGAYSINH, 103) NGAYSINH,GIOITINH,SDT,QUEQUAN\n" + "FROM KHACHTHUE,PHONG,KHACHTHUEPHONG\n" + "WHERE KHACHTHUEPHONG.MAPHONG=PHONG.MAPHONG AND KHACHTHUE.MAKT=KHACHTHUEPHONG.MAKT AND TENPHONG='"+tenphong+"'"; // Thực thi câu lệnh SQL trả về đối tượng ResultSet. // Mọi kết quả trả về sẽ được lưu trong ResultSet ResultSet rs = statement.executeQuery(sql); while (rs.next()) { boolean add = list.add(new DetailKhachThueModel( rs.getString("TENKT"), rs.getString("NGAYSINH"), rs.getString("GIOITINH"), rs.getString("SDT"), rs.getString("QUEQUAN") )); } connection.close();// Đóng kết nối return list; } private class connect extends AsyncTask<Void,Void,Connection> { @Override protected Connection doInBackground(Void... voids) { connection = jdbcController.ConnnectionData(); // Tạo kết nối tới database return connection; } } }
2,208
0.68013
0.678737
53
39.64151
32.000057
128
false
false
0
0
0
0
0
0
0.716981
false
false
2
2ad2d9266a983794d810058a53227489782692a4
3,616,362,476,447
2d6deb8ea83a83dca75117e40348aabbc6b589a2
/src/xmlReader/XMLReader.java
605a40f1bd3e49f81b3f6f80005cc36bb5e2383e
[]
no_license
enorvio/demo-system
https://github.com/enorvio/demo-system
d06feb4dcfbaf7601b5d82733987b6e197a4fd9f
2814f811d6b2a5ea54f1c7bc2eb62084f8e981de
refs/heads/master
2020-04-12T21:24:45.146000
2019-04-05T08:39:07
2019-04-05T08:39:07
162,761,288
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package xmlReader; import java.io.File; import javax.swing.tree.DefaultMutableTreeNode; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; public class XMLReader { public String filename; public DefaultMutableTreeNode tree; public relationalCategory.Table invoices; public relationalCategory.Table orderlines; public XMLReader(String filename) { try { File inputFile = new File(filename); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); UserHandler userhandler = new UserHandler(new DefaultMutableTreeNode("invoices")); saxParser.parse(inputFile, userhandler); this.tree = userhandler.getTree(); this.invoices = userhandler.getInvoices(); this.orderlines = userhandler.getOrderlines(); } catch (Exception e) { e.printStackTrace(); } } public XMLReader(String filename, DefaultMutableTreeNode root) { try { File inputFile = new File(filename); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); UserHandler userhandler = new UserHandler(root); saxParser.parse(inputFile, userhandler); this.tree = userhandler.getTree(); this.invoices = userhandler.getInvoices(); this.orderlines = userhandler.getOrderlines(); } catch (Exception e) { e.printStackTrace(); } } public DefaultMutableTreeNode getTree() { return this.tree; } public relationalCategory.Table getInvoices() { return this.invoices; } public relationalCategory.Table getOrderlines() { return this.orderlines; } }
UTF-8
Java
1,864
java
XMLReader.java
Java
[]
null
[]
package xmlReader; import java.io.File; import javax.swing.tree.DefaultMutableTreeNode; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; public class XMLReader { public String filename; public DefaultMutableTreeNode tree; public relationalCategory.Table invoices; public relationalCategory.Table orderlines; public XMLReader(String filename) { try { File inputFile = new File(filename); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); UserHandler userhandler = new UserHandler(new DefaultMutableTreeNode("invoices")); saxParser.parse(inputFile, userhandler); this.tree = userhandler.getTree(); this.invoices = userhandler.getInvoices(); this.orderlines = userhandler.getOrderlines(); } catch (Exception e) { e.printStackTrace(); } } public XMLReader(String filename, DefaultMutableTreeNode root) { try { File inputFile = new File(filename); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); UserHandler userhandler = new UserHandler(root); saxParser.parse(inputFile, userhandler); this.tree = userhandler.getTree(); this.invoices = userhandler.getInvoices(); this.orderlines = userhandler.getOrderlines(); } catch (Exception e) { e.printStackTrace(); } } public DefaultMutableTreeNode getTree() { return this.tree; } public relationalCategory.Table getInvoices() { return this.invoices; } public relationalCategory.Table getOrderlines() { return this.orderlines; } }
1,864
0.650751
0.650751
59
30.59322
23.972527
94
false
false
0
0
0
0
0
0
0.559322
false
false
2
43e9bf3e74b93ad1817f4bd320e6f8512f284246
15,195,594,305,082
9e42d238f31d8278a8ddcf56b768c90441d711fb
/irh-service-api/irh-service-goods-api/src/main/java/top/imuster/goods/api/pojo/ProductDemandInfo.java
5836cf10b0556fac27be20e7d17ffc256f4891ff
[]
no_license
yufengshaobiao/irh
https://github.com/yufengshaobiao/irh
d876e6e117c46f6e8cf266a06d9b93fa9386154d
4a43d7ab92a117ab02658bd1d29a26a334638f88
refs/heads/rel
2022-12-06T06:01:25.906000
2020-09-04T08:35:00
2020-09-04T08:35:00
457,726,873
2
0
null
true
2022-02-10T10:10:46
2022-02-10T10:10:45
2021-12-01T13:18:57
2020-09-04T08:37:24
2,656
0
0
0
null
false
false
package top.imuster.goods.api.pojo; import com.fasterxml.jackson.annotation.JsonInclude; import org.springframework.data.elasticsearch.annotations.Document; import top.imuster.common.base.domain.BaseDomain; import top.imuster.common.core.validate.ValidateGroup; import javax.validation.constraints.NotNull; /** * * @author 黄明人 * @since 2020-01-16 10:19:41 */ @JsonInclude(JsonInclude.Include.NON_EMPTY) @Document(indexName = "demand", type = "demand") public class ProductDemandInfo extends BaseDomain { private static final long serialVersionUID = 7996610101L; public ProductDemandInfo() { //默认无参构造方法 } // 会员需求表 主键 @NotNull(groups = ValidateGroup.editGroup.class, message = "主键不能为空,请刷新后重试") private Long id; // 标题, max length: 255 @NotNull(groups = ValidateGroup.releaseGroup.class, message = "标题不能为空") private String topic; // 分类id @NotNull(groups = ValidateGroup.releaseGroup.class, message = "分类不能为空") private Long categoryId; // 内容, max length: 255 @NotNull(groups = ValidateGroup.releaseGroup.class, message = "内容不能为空") private String content; // 发布人 private Long consumerId; //封面图片 private String mainPic; //自定义的标签名称 private String tagNames; //浏览次数 private Long browserTimes; private String otherPics; private Integer replyTotal; private Integer collectTotal; // 状态 1-无效 2-有效 // private Short state; public Integer getCollectTotal() { return collectTotal; } public void setCollectTotal(Integer collectTotal) { this.collectTotal = collectTotal; } public Integer getReplyTotal() { return replyTotal; } public void setReplyTotal(Integer replyTotal) { this.replyTotal = replyTotal; } public String getOtherPics() { return otherPics; } public void setOtherPics(String otherPics) { this.otherPics = otherPics; } public Long getBrowserTimes() { return browserTimes; } public void setBrowserTimes(Long browserTimes) { this.browserTimes = browserTimes; } public String getTagNames() { return tagNames; } public void setTagNames(String tagNames) { this.tagNames = tagNames; } public String getMainPic() { return mainPic; } public void setMainPic(String mainPic) { this.mainPic = mainPic; } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getTopic() { return this.topic; } public void setTopic(String topic) { this.topic = topic; } public Long getCategoryId() { return this.categoryId; } public void setCategoryId(Long categoryId) { this.categoryId = categoryId; } public String getContent() { return this.content; } public void setContent(String content) { this.content = content; } public Long getConsumerId() { return this.consumerId; } public void setConsumerId(Long consumerId) { this.consumerId = consumerId; } }
UTF-8
Java
3,001
java
ProductDemandInfo.java
Java
[ { "context": "lidation.constraints.NotNull;\n\n/**\n * \n * @author 黄明人\n * @since 2020-01-16 10:19:41\n */\n@JsonInclude(Js", "end": 333, "score": 0.9367229342460632, "start": 330, "tag": "NAME", "value": "黄明人" } ]
null
[]
package top.imuster.goods.api.pojo; import com.fasterxml.jackson.annotation.JsonInclude; import org.springframework.data.elasticsearch.annotations.Document; import top.imuster.common.base.domain.BaseDomain; import top.imuster.common.core.validate.ValidateGroup; import javax.validation.constraints.NotNull; /** * * @author 黄明人 * @since 2020-01-16 10:19:41 */ @JsonInclude(JsonInclude.Include.NON_EMPTY) @Document(indexName = "demand", type = "demand") public class ProductDemandInfo extends BaseDomain { private static final long serialVersionUID = 7996610101L; public ProductDemandInfo() { //默认无参构造方法 } // 会员需求表 主键 @NotNull(groups = ValidateGroup.editGroup.class, message = "主键不能为空,请刷新后重试") private Long id; // 标题, max length: 255 @NotNull(groups = ValidateGroup.releaseGroup.class, message = "标题不能为空") private String topic; // 分类id @NotNull(groups = ValidateGroup.releaseGroup.class, message = "分类不能为空") private Long categoryId; // 内容, max length: 255 @NotNull(groups = ValidateGroup.releaseGroup.class, message = "内容不能为空") private String content; // 发布人 private Long consumerId; //封面图片 private String mainPic; //自定义的标签名称 private String tagNames; //浏览次数 private Long browserTimes; private String otherPics; private Integer replyTotal; private Integer collectTotal; // 状态 1-无效 2-有效 // private Short state; public Integer getCollectTotal() { return collectTotal; } public void setCollectTotal(Integer collectTotal) { this.collectTotal = collectTotal; } public Integer getReplyTotal() { return replyTotal; } public void setReplyTotal(Integer replyTotal) { this.replyTotal = replyTotal; } public String getOtherPics() { return otherPics; } public void setOtherPics(String otherPics) { this.otherPics = otherPics; } public Long getBrowserTimes() { return browserTimes; } public void setBrowserTimes(Long browserTimes) { this.browserTimes = browserTimes; } public String getTagNames() { return tagNames; } public void setTagNames(String tagNames) { this.tagNames = tagNames; } public String getMainPic() { return mainPic; } public void setMainPic(String mainPic) { this.mainPic = mainPic; } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getTopic() { return this.topic; } public void setTopic(String topic) { this.topic = topic; } public Long getCategoryId() { return this.categoryId; } public void setCategoryId(Long categoryId) { this.categoryId = categoryId; } public String getContent() { return this.content; } public void setContent(String content) { this.content = content; } public Long getConsumerId() { return this.consumerId; } public void setConsumerId(Long consumerId) { this.consumerId = consumerId; } }
3,001
0.727752
0.716497
146
18.479452
19.271748
76
false
false
0
0
0
0
0
0
1.143836
false
false
2
ea7eddf088e0bf6de9b78fe7f7962162c452c7df
36,412,732,773,708
25ebff5cefb8ef95256dfa92f3cd6a785e674088
/Algorithms/src/leetcode/reverseNodeInKGroup.java
499520eae71210fa7a37cb9089a46beb757f466c
[]
no_license
rambabuiitk/algorithms
https://github.com/rambabuiitk/algorithms
04fcedd7c71a363972abd2415ce9c57be61d2a13
73a95589fe94687537da1cf8cafe38473b69115e
refs/heads/master
2020-05-30T04:04:41.726000
2013-06-28T05:24:18
2013-06-28T05:24:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. You may not alter the values in the nodes, only nodes itself may be changed. Only constant memory is allowed. For example, Given this linked list: 1->2->3->4->5 For k = 2, you should return: 2->1->4->3->5 For k = 3, you should return: 3->2->1->4->5 */ /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */ public class Solution { public ListNode reverseKGroup(ListNode head, int k) { // Start typing your Java solution below // DO NOT write main() function ListNode current = head; ListNode next = null; ListNode prev = null; int count = 0; while(current !=null && count++ <k) { current = current.next; } if (count < k) return head; count = 0; current = head; /*reverse first k nodes of the linked list */ while (current != null && count < k) { next = current.next; current.next = prev; prev = current; current = next; count++; } /* next is now a pointer to (k+1)th node Recursively call for the list starting from current. And make rest of the list as next of first node */ if(next != null) { head.next = reverseKGroup(next, k); } /* prev is new head of the input list */ return prev; } }
UTF-8
Java
1,762
java
reverseNodeInKGroup.java
Java
[]
null
[]
/* Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. You may not alter the values in the nodes, only nodes itself may be changed. Only constant memory is allowed. For example, Given this linked list: 1->2->3->4->5 For k = 2, you should return: 2->1->4->3->5 For k = 3, you should return: 3->2->1->4->5 */ /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */ public class Solution { public ListNode reverseKGroup(ListNode head, int k) { // Start typing your Java solution below // DO NOT write main() function ListNode current = head; ListNode next = null; ListNode prev = null; int count = 0; while(current !=null && count++ <k) { current = current.next; } if (count < k) return head; count = 0; current = head; /*reverse first k nodes of the linked list */ while (current != null && count < k) { next = current.next; current.next = prev; prev = current; current = next; count++; } /* next is now a pointer to (k+1)th node Recursively call for the list starting from current. And make rest of the list as next of first node */ if(next != null) { head.next = reverseKGroup(next, k); } /* prev is new head of the input list */ return prev; } }
1,762
0.5437
0.53235
65
26.107693
22.378645
100
false
false
0
0
0
0
0
0
0.4
false
false
9
2d9eae99cd4c978a4d11e4b3b9de7db127884012
29,351,806,555,342
5ec52940812cd2f3a050cc12fdd3db0f2b9a9761
/src/test/java/services/CategoryServiceTest.java
b26aef94548b33fc375805f77da066d0115161f2
[]
no_license
JuanRubiio/D07-Acme-HandyWorker
https://github.com/JuanRubiio/D07-Acme-HandyWorker
d8f1a24f65ede30f17fa80befa3bf25edfb2777b
04e2166331d1fe9af9525a3df1a9f5332b575bed
refs/heads/master
2020-04-16T08:21:46.175000
2019-01-17T21:51:32
2019-01-17T21:51:32
165,422,136
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package services; import java.util.Collection; import java.util.List; import javax.transaction.Transactional; 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 org.springframework.util.Assert; import utilities.AbstractTest; import domain.Category; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:spring/datasource.xml", "classpath:spring/config/packages.xml" }) @Transactional public class CategoryServiceTest extends AbstractTest { @Autowired private CategoryService categoryService; @Test public void createCategoryTest() { final Category category = this.categoryService.create(); category.setEngName("name"); category.setEspName("nombre"); final Category prueba = this.categoryService.save(category); final Category cat = this.categoryService.findOne(prueba.getId()); Assert.notNull(cat); } @Test public void createChildrenCategoryTest() { final Collection<Category> cat = this.categoryService.findAll(); final List<Category> car = (List<Category>) cat; final Category category = this.categoryService.create(car.get(2).getId()); category.setEngName("name"); category.setEspName("nombre"); final Category tt = this.categoryService.save(category); final Category prueba = this.categoryService.findOne(tt.getId()); Assert.notNull(prueba); } @Test(expected = IllegalArgumentException.class) public void deleteCategoryTest() { final Category category = this.categoryService.findOne(1390); this.categoryService.delete(category); this.categoryService.findOne(1390); } }
UTF-8
Java
1,775
java
CategoryServiceTest.java
Java
[]
null
[]
package services; import java.util.Collection; import java.util.List; import javax.transaction.Transactional; 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 org.springframework.util.Assert; import utilities.AbstractTest; import domain.Category; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:spring/datasource.xml", "classpath:spring/config/packages.xml" }) @Transactional public class CategoryServiceTest extends AbstractTest { @Autowired private CategoryService categoryService; @Test public void createCategoryTest() { final Category category = this.categoryService.create(); category.setEngName("name"); category.setEspName("nombre"); final Category prueba = this.categoryService.save(category); final Category cat = this.categoryService.findOne(prueba.getId()); Assert.notNull(cat); } @Test public void createChildrenCategoryTest() { final Collection<Category> cat = this.categoryService.findAll(); final List<Category> car = (List<Category>) cat; final Category category = this.categoryService.create(car.get(2).getId()); category.setEngName("name"); category.setEspName("nombre"); final Category tt = this.categoryService.save(category); final Category prueba = this.categoryService.findOne(tt.getId()); Assert.notNull(prueba); } @Test(expected = IllegalArgumentException.class) public void deleteCategoryTest() { final Category category = this.categoryService.findOne(1390); this.categoryService.delete(category); this.categoryService.findOne(1390); } }
1,775
0.787606
0.780845
60
28.566668
24.298399
76
false
false
0
0
0
0
0
0
1.3
false
false
9
3e16c0f3719d7ce8293c7afa2ecf5a1c3612bc65
5,866,925,341,634
7de42e057a3c9e1086e34f07ff5743c3eaf1dc37
/zeus-manage/zeus-manage-service/src/main/java/com/zeus/manage/service/ItemDescService.java
84cba96658072f7ae045fa9b590fdcc37f6c1298
[ "Apache-2.0" ]
permissive
baojiawei1230/TaoTaoB2CMall
https://github.com/baojiawei1230/TaoTaoB2CMall
0a3ba7286ed6328babc9e059377a0c0baae0eb91
29c5b8b9b13d8a1b49556d74ce51834fa64cb0b0
refs/heads/master
2020-12-30T13:29:24.982000
2017-06-16T09:26:26
2017-06-16T09:26:26
91,226,535
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zeus.manage.service; import com.zeus.manage.pojo.ItemDesc; import org.springframework.stereotype.Service; @Service public class ItemDescService extends BaseService<ItemDesc> { }
UTF-8
Java
202
java
ItemDescService.java
Java
[]
null
[]
package com.zeus.manage.service; import com.zeus.manage.pojo.ItemDesc; import org.springframework.stereotype.Service; @Service public class ItemDescService extends BaseService<ItemDesc> { }
202
0.782178
0.782178
9
20.444445
22.14152
60
false
false
0
0
0
0
0
0
0.333333
false
false
9
48850556ae23a22d77059bb1d7325924b97299f9
12,128,987,664,139
27e34c027f9ed06e5ebb1c1d1d8a088560dc0399
/java/com/example/logindemo/unsubscribe.java
dbb63186ff244ae672a75741a96e9f8291188e2a
[]
no_license
shilpasunil/Newspaper-Agency-Automaton-Software
https://github.com/shilpasunil/Newspaper-Agency-Automaton-Software
b5f0699640cffda86fe58fb65fa24c139cedeb9f
5cd4d121bc1254cb600907d602d98568aef15c67
refs/heads/main
2023-06-03T03:05:54.557000
2021-06-22T06:00:59
2021-06-22T06:00:59
379,139,753
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.logindemo; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class unsubscribe extends AppCompatActivity { private Button Unsub; private EditText Article; DBart DB; public final static String MESSAGE_KEY ="shilpa.senddata.message_key"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_unsubscribe); DB = new DBart(this); Unsub =(Button)findViewById(R.id.btnUnsub); Article =(EditText)findViewById(R.id.etUnsub); Intent intent = getIntent(); String message = intent.getStringExtra(MESSAGE_KEY); Unsub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String article = Article.getText().toString(); if(article.equals(" ")) Toast.makeText(unsubscribe.this, "Please provide article info", Toast.LENGTH_SHORT).show(); else { Boolean check = DB.checkarticle(article); if (!check) { Toast.makeText(unsubscribe.this, "Not Subscribed to unsubscribe", Toast.LENGTH_SHORT).show(); } else { Boolean delete = DB.delete(message, article); if (delete) { Toast.makeText(unsubscribe.this, "Unsubscribed Successfully", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(unsubscribe.this, homeCust.class); intent.putExtra(MESSAGE_KEY,message); startActivity(intent); } else { Toast.makeText(unsubscribe.this, "Unsubscription failed", Toast.LENGTH_SHORT).show(); } } } } }); } }
UTF-8
Java
2,241
java
unsubscribe.java
Java
[ { "context": "DB;\r\n public final static String MESSAGE_KEY =\"shilpa.senddata.message_key\";\r\n\r\n @Override\r\n protected void onCreate(B", "end": 500, "score": 0.9981824159622192, "start": 473, "tag": "KEY", "value": "shilpa.senddata.message_key" } ]
null
[]
package com.example.logindemo; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class unsubscribe extends AppCompatActivity { private Button Unsub; private EditText Article; DBart DB; public final static String MESSAGE_KEY ="shilpa.senddata.message_key"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_unsubscribe); DB = new DBart(this); Unsub =(Button)findViewById(R.id.btnUnsub); Article =(EditText)findViewById(R.id.etUnsub); Intent intent = getIntent(); String message = intent.getStringExtra(MESSAGE_KEY); Unsub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String article = Article.getText().toString(); if(article.equals(" ")) Toast.makeText(unsubscribe.this, "Please provide article info", Toast.LENGTH_SHORT).show(); else { Boolean check = DB.checkarticle(article); if (!check) { Toast.makeText(unsubscribe.this, "Not Subscribed to unsubscribe", Toast.LENGTH_SHORT).show(); } else { Boolean delete = DB.delete(message, article); if (delete) { Toast.makeText(unsubscribe.this, "Unsubscribed Successfully", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(unsubscribe.this, homeCust.class); intent.putExtra(MESSAGE_KEY,message); startActivity(intent); } else { Toast.makeText(unsubscribe.this, "Unsubscription failed", Toast.LENGTH_SHORT).show(); } } } } }); } }
2,241
0.565819
0.565819
58
36.672413
30.303856
117
false
false
0
0
0
0
0
0
0.724138
false
false
9
e36dcb3ab3e6bc652df49e3671f0d652d56c11b6
12,532,714,597,284
10ad1d0736d8951bef5ab35c6744fa16559423e2
/m2/given_parser/ast/Program.java
3bc3512ed7477ad470edd747a28067654c3e6e54
[]
no_license
edorn18/KeyLimePie
https://github.com/edorn18/KeyLimePie
660c3f420f2a36c369a6e5e5da5045e4ed75e506
5c3cd7a0e093201442dbfd73ccab74cecba65ec5
refs/heads/master
2021-01-18T23:15:34.940000
2017-06-12T00:39:25
2017-06-12T00:39:25
87,100,822
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ast; import java.util.List; import java.util.ArrayList; import java.util.Hashtable; import java.io.PrintWriter; import java.util.Enumeration; public class Program { private final List<TypeDeclaration> types; private final List<Declaration> decls; private final List<Function> funcs; private Hashtable<String,Type> globalTable; private Hashtable<String, Hashtable<String,Type>> structTable; private Hashtable<String, Hashtable<String,Type>> funcTable; private List<Block> allBlockList = new ArrayList<Block>(); private List<Block> startBlockList = new ArrayList<Block>(); private List<Block> endBlockList = new ArrayList<Block>(); private String inputFile = ""; public Program(List<TypeDeclaration> types, List<Declaration> decls, List<Function> funcs) { this.types = types; this.decls = decls; this.funcs = funcs; } public void printAll(String fileName) { this.inputFile = fileName; //printTypes(); //printDecls(); //printFuncs(); makeSymbolTables(); try { System.out.println("Checking for main..."); checkForMain(); System.out.println("Successfully found main function"); System.out.println("Running type checking..."); checkType(); System.out.println("Finished type checking successfully with no errors"); } catch (Exception e) { System.out.println(e.getMessage()); System.out.println(e.toString()); } try { printCFG(); } catch (Exception e) { System.out.println(e.getMessage()); System.out.println(e.toString()); System.out.println("I'm in line #" + e.getStackTrace()[0].getLineNumber()); } printLlvmFile(); } public void printCFG() { for (int i = 0; i < funcs.size(); i++) { funcs.get(i).buildCFG(allBlockList, startBlockList, endBlockList, globalTable, types); } /* for (int i = 0; i < allBlockList.size() ; i++) { System.out.println("Block " + allBlockList.get(i).getLabel()); System.out.print("Links to block(s): "); for (int j = 0; j < allBlockList.get(i).getList().size(); j++) { System.out.print(allBlockList.get(i).getList().get(j).getLabel() + ", "); } System.out.println(); System.out.println(); // block i prints block i's links } */ } public void makeSymbolTables() { makeGlobalTable(); makeStructTable(); makeFuncTable(); } private void makeGlobalTable() { globalTable = new Hashtable<String,Type>(); for (int i = 0; i < decls.size(); i++) { globalTable.put(decls.get(i).getDeclName(), decls.get(i).getDeclType()); } for (int i = 0; i < funcs.size(); i++) { globalTable.put(funcs.get(i).getFunctionName(), new FuncType(funcs.get(i).getFunctionParams(), funcs.get(i).getFunctionRetType())); } } public void printLlvmFile() { try { String shortInputName = inputFile.substring(inputFile.lastIndexOf('/') + 1, inputFile.length() - 5); PrintWriter outFile = new PrintWriter(shortInputName + ".ll", "UTF-8"); int funcCounter = 0; outFile.println("target triple=\"x86_64\""); // print struct declarations for (int i = 0; i < types.size(); i++) { String structName = types.get(i).getTypeName(); List<Declaration> fieldList = types.get(i).getFields(); List<LLVMType> llvmTypeList = new ArrayList<LLVMType>(); for (int j = 0; j < fieldList.size(); j++) { Type t = fieldList.get(j).getDeclType(); if (t instanceof StructType) { llvmTypeList.add(new LLVMStructType(((StructType)t).getStructName())); } else { llvmTypeList.add(new iType(64)); } } LLVMDeclareStructInstruction newLLVMInstr = new LLVMDeclareStructInstruction(structName, llvmTypeList); newLLVMInstr.printInstruction(outFile); } outFile.println(""); // print global vars for (int m = 0; m < decls.size(); m++) { outFile.print("@" + decls.get(m).getDeclName() + " = common global "); if (decls.get(m).getDeclType() instanceof StructType) { Type t = decls.get(m).getDeclType(); LLVMStructType llstruct = new LLVMStructType(((StructType)t).getStructName()); outFile.print(llstruct.getLLVMTypeName() + " "); outFile.print("null, align 8\n\n"); } else { outFile.print("i64 " ); outFile.print("0, align 8\n\n"); } } // print func declarations, func params, and LU's int countForFuncParams = 0; for (int i = 0; i < allBlockList.size(); i++) { if (funcCounter < startBlockList.size() && startBlockList.get(funcCounter) == allBlockList.get(i)) { String funcName = funcs.get(funcCounter).getFunctionName(); if (funcCounter != 0) { outFile.print("}\n\ndefine "); } else if (funcCounter == 0) { outFile.print("define "); } if (!(funcs.get(funcCounter).getFunctionRetType() instanceof VoidType)) { if (funcs.get(funcCounter).getFunctionRetType() instanceof StructType) { LLVMStructType t = new LLVMStructType(((StructType)(funcs.get(funcCounter).getFunctionRetType())).getStructName()); outFile.print(t.getLLVMTypeName() + " "); } else { outFile.print("i64 "); } } else { outFile.print("void "); } outFile.print("@" + funcName + "("); if (funcs.get(countForFuncParams).getFunctionName() == funcName) { List<Declaration> funcParams = funcs.get(countForFuncParams).getFunctionParams(); for (int j = 0; j < funcParams.size(); j++) { if (!(funcParams.get(j).getDeclType() instanceof StructType)) { outFile.print("i64 "); } // Not sure about this StructType: if (funcParams.get(j).getDeclType() instanceof StructType) { Type t = funcParams.get(j).getDeclType(); LLVMStructType llstruct = new LLVMStructType(((StructType)t).getStructName()); outFile.print(llstruct.getLLVMTypeName() + " "); } if (j < funcParams.size() - 1) { outFile.print("%" + funcParams.get(j).getDeclName() + ", "); } else if (j == funcParams.size() - 1) { outFile.println("%" + funcParams.get(j).getDeclName() + ")"); } } if (funcParams.size() == 0) { outFile.println(")"); } countForFuncParams++; } outFile.println("{"); outFile.println("LU" + allBlockList.get(i).getLabel() + ":"); allBlockList.get(i).printInstructions(outFile); funcCounter++; } else { outFile.println("LU" + allBlockList.get(i).getLabel() + ":"); allBlockList.get(i).printInstructions(outFile); } } outFile.print("}\n\n"); outFile.println("declare i8* @malloc(i64)"); outFile.println("declare void @free(i8*)"); outFile.println("declare i32 @printf(i8*, ...)"); outFile.println("declare i32 @scanf(i8*, ...)"); outFile.println("@.println = private unnamed_addr constant [5 x i8] c\"%ld\\0A\\00\", align 1"); outFile.println("@.print = private unnamed_addr constant [5 x i8] c\"%ld \\00\", align 1"); outFile.println("@.read = private unnamed_addr constant [4 x i8] c\"%ld\\00\", align 1"); outFile.println("@.read_scratch = common global i64 0, align 8"); /* for (int i = 0; i < startBlockList.size(); i++) { String funcName = funcs.get(funcCounter).getFunctionName(); outFile.print("define "); outFile.println("@" + funcName + "()"); outFile.println("{"); outFile.println("}"); outFile.println(""); funcCounter++; } */ outFile.close(); } catch (Exception e) { System.out.println(e.getMessage()); } } private void makeStructTable() { Hashtable<String,Type> fieldsTable; List<Declaration> fieldsList; structTable = new Hashtable<String, Hashtable<String,Type>>(); for (int i = 0; i < types.size(); i++) { //System.out.println("Adding a struct"); fieldsTable = new Hashtable<String,Type>(); fieldsList = types.get(i).getFields(); for (int j = 0; j < fieldsList.size(); j++) { fieldsTable.put(fieldsList.get(j).getDeclName(), fieldsList.get(j).getDeclType()); //System.out.println("This is id in struct followed by its type"); //System.out.println(fieldsList.get(j).getDeclName() + " " + decls.get(j).getDeclType().getClass().getName()); } structTable.put(types.get(i).getTypeName(), fieldsTable); } } private void makeFuncTable() { Hashtable<String,Type> globalClone; List<Declaration> paramList; List<Declaration> localList; funcTable = new Hashtable<String, Hashtable<String, Type>>(); for (int i = 0; i < funcs.size(); i++) { //System.out.println("Adding a function"); globalClone = (Hashtable<String,Type>) globalTable.clone(); paramList = funcs.get(i).getFunctionParams(); localList = funcs.get(i).getFunctionLocals(); for (int j = 0; j < paramList.size(); j++) { globalClone.put(paramList.get(j).getDeclName(), paramList.get(j).getDeclType()); } for (int j = 0; j < localList.size(); j++) { globalClone.put(localList.get(j).getDeclName(), localList.get(j).getDeclType()); } funcTable.put(funcs.get(i).getFunctionName(), globalClone); //System.out.println("Here is the global table"); //System.out.println(globalTable); //System.out.println("Here is the function table"); //System.out.println(globalClone); } } public void checkForMain() { if (funcTable.get("main") == null) { throw new IllegalArgumentException("No main function was found"); } } public void checkType() { for (int i = 0; i < funcs.size(); i++) { funcs.get(i).checkType(funcTable, structTable); } } private void printTypes() { System.out.println("Printing the type list"); for (int i = 0; i < types.size(); i++) { System.out.println(types.get(i).getTypeName()); } System.out.println(""); } private void printDecls() { System.out.println("Printing the decl list"); for (int i = 0; i < decls.size(); i++) { System.out.println(decls.get(i).getDeclName()); } System.out.println(""); } private void printFuncs() { System.out.println("Printing the func list"); for (int i = 0; i < funcs.size(); i++) { System.out.println(funcs.get(i).getFunctionName()); } System.out.println(""); } }
UTF-8
Java
11,800
java
Program.java
Java
[]
null
[]
package ast; import java.util.List; import java.util.ArrayList; import java.util.Hashtable; import java.io.PrintWriter; import java.util.Enumeration; public class Program { private final List<TypeDeclaration> types; private final List<Declaration> decls; private final List<Function> funcs; private Hashtable<String,Type> globalTable; private Hashtable<String, Hashtable<String,Type>> structTable; private Hashtable<String, Hashtable<String,Type>> funcTable; private List<Block> allBlockList = new ArrayList<Block>(); private List<Block> startBlockList = new ArrayList<Block>(); private List<Block> endBlockList = new ArrayList<Block>(); private String inputFile = ""; public Program(List<TypeDeclaration> types, List<Declaration> decls, List<Function> funcs) { this.types = types; this.decls = decls; this.funcs = funcs; } public void printAll(String fileName) { this.inputFile = fileName; //printTypes(); //printDecls(); //printFuncs(); makeSymbolTables(); try { System.out.println("Checking for main..."); checkForMain(); System.out.println("Successfully found main function"); System.out.println("Running type checking..."); checkType(); System.out.println("Finished type checking successfully with no errors"); } catch (Exception e) { System.out.println(e.getMessage()); System.out.println(e.toString()); } try { printCFG(); } catch (Exception e) { System.out.println(e.getMessage()); System.out.println(e.toString()); System.out.println("I'm in line #" + e.getStackTrace()[0].getLineNumber()); } printLlvmFile(); } public void printCFG() { for (int i = 0; i < funcs.size(); i++) { funcs.get(i).buildCFG(allBlockList, startBlockList, endBlockList, globalTable, types); } /* for (int i = 0; i < allBlockList.size() ; i++) { System.out.println("Block " + allBlockList.get(i).getLabel()); System.out.print("Links to block(s): "); for (int j = 0; j < allBlockList.get(i).getList().size(); j++) { System.out.print(allBlockList.get(i).getList().get(j).getLabel() + ", "); } System.out.println(); System.out.println(); // block i prints block i's links } */ } public void makeSymbolTables() { makeGlobalTable(); makeStructTable(); makeFuncTable(); } private void makeGlobalTable() { globalTable = new Hashtable<String,Type>(); for (int i = 0; i < decls.size(); i++) { globalTable.put(decls.get(i).getDeclName(), decls.get(i).getDeclType()); } for (int i = 0; i < funcs.size(); i++) { globalTable.put(funcs.get(i).getFunctionName(), new FuncType(funcs.get(i).getFunctionParams(), funcs.get(i).getFunctionRetType())); } } public void printLlvmFile() { try { String shortInputName = inputFile.substring(inputFile.lastIndexOf('/') + 1, inputFile.length() - 5); PrintWriter outFile = new PrintWriter(shortInputName + ".ll", "UTF-8"); int funcCounter = 0; outFile.println("target triple=\"x86_64\""); // print struct declarations for (int i = 0; i < types.size(); i++) { String structName = types.get(i).getTypeName(); List<Declaration> fieldList = types.get(i).getFields(); List<LLVMType> llvmTypeList = new ArrayList<LLVMType>(); for (int j = 0; j < fieldList.size(); j++) { Type t = fieldList.get(j).getDeclType(); if (t instanceof StructType) { llvmTypeList.add(new LLVMStructType(((StructType)t).getStructName())); } else { llvmTypeList.add(new iType(64)); } } LLVMDeclareStructInstruction newLLVMInstr = new LLVMDeclareStructInstruction(structName, llvmTypeList); newLLVMInstr.printInstruction(outFile); } outFile.println(""); // print global vars for (int m = 0; m < decls.size(); m++) { outFile.print("@" + decls.get(m).getDeclName() + " = common global "); if (decls.get(m).getDeclType() instanceof StructType) { Type t = decls.get(m).getDeclType(); LLVMStructType llstruct = new LLVMStructType(((StructType)t).getStructName()); outFile.print(llstruct.getLLVMTypeName() + " "); outFile.print("null, align 8\n\n"); } else { outFile.print("i64 " ); outFile.print("0, align 8\n\n"); } } // print func declarations, func params, and LU's int countForFuncParams = 0; for (int i = 0; i < allBlockList.size(); i++) { if (funcCounter < startBlockList.size() && startBlockList.get(funcCounter) == allBlockList.get(i)) { String funcName = funcs.get(funcCounter).getFunctionName(); if (funcCounter != 0) { outFile.print("}\n\ndefine "); } else if (funcCounter == 0) { outFile.print("define "); } if (!(funcs.get(funcCounter).getFunctionRetType() instanceof VoidType)) { if (funcs.get(funcCounter).getFunctionRetType() instanceof StructType) { LLVMStructType t = new LLVMStructType(((StructType)(funcs.get(funcCounter).getFunctionRetType())).getStructName()); outFile.print(t.getLLVMTypeName() + " "); } else { outFile.print("i64 "); } } else { outFile.print("void "); } outFile.print("@" + funcName + "("); if (funcs.get(countForFuncParams).getFunctionName() == funcName) { List<Declaration> funcParams = funcs.get(countForFuncParams).getFunctionParams(); for (int j = 0; j < funcParams.size(); j++) { if (!(funcParams.get(j).getDeclType() instanceof StructType)) { outFile.print("i64 "); } // Not sure about this StructType: if (funcParams.get(j).getDeclType() instanceof StructType) { Type t = funcParams.get(j).getDeclType(); LLVMStructType llstruct = new LLVMStructType(((StructType)t).getStructName()); outFile.print(llstruct.getLLVMTypeName() + " "); } if (j < funcParams.size() - 1) { outFile.print("%" + funcParams.get(j).getDeclName() + ", "); } else if (j == funcParams.size() - 1) { outFile.println("%" + funcParams.get(j).getDeclName() + ")"); } } if (funcParams.size() == 0) { outFile.println(")"); } countForFuncParams++; } outFile.println("{"); outFile.println("LU" + allBlockList.get(i).getLabel() + ":"); allBlockList.get(i).printInstructions(outFile); funcCounter++; } else { outFile.println("LU" + allBlockList.get(i).getLabel() + ":"); allBlockList.get(i).printInstructions(outFile); } } outFile.print("}\n\n"); outFile.println("declare i8* @malloc(i64)"); outFile.println("declare void @free(i8*)"); outFile.println("declare i32 @printf(i8*, ...)"); outFile.println("declare i32 @scanf(i8*, ...)"); outFile.println("@.println = private unnamed_addr constant [5 x i8] c\"%ld\\0A\\00\", align 1"); outFile.println("@.print = private unnamed_addr constant [5 x i8] c\"%ld \\00\", align 1"); outFile.println("@.read = private unnamed_addr constant [4 x i8] c\"%ld\\00\", align 1"); outFile.println("@.read_scratch = common global i64 0, align 8"); /* for (int i = 0; i < startBlockList.size(); i++) { String funcName = funcs.get(funcCounter).getFunctionName(); outFile.print("define "); outFile.println("@" + funcName + "()"); outFile.println("{"); outFile.println("}"); outFile.println(""); funcCounter++; } */ outFile.close(); } catch (Exception e) { System.out.println(e.getMessage()); } } private void makeStructTable() { Hashtable<String,Type> fieldsTable; List<Declaration> fieldsList; structTable = new Hashtable<String, Hashtable<String,Type>>(); for (int i = 0; i < types.size(); i++) { //System.out.println("Adding a struct"); fieldsTable = new Hashtable<String,Type>(); fieldsList = types.get(i).getFields(); for (int j = 0; j < fieldsList.size(); j++) { fieldsTable.put(fieldsList.get(j).getDeclName(), fieldsList.get(j).getDeclType()); //System.out.println("This is id in struct followed by its type"); //System.out.println(fieldsList.get(j).getDeclName() + " " + decls.get(j).getDeclType().getClass().getName()); } structTable.put(types.get(i).getTypeName(), fieldsTable); } } private void makeFuncTable() { Hashtable<String,Type> globalClone; List<Declaration> paramList; List<Declaration> localList; funcTable = new Hashtable<String, Hashtable<String, Type>>(); for (int i = 0; i < funcs.size(); i++) { //System.out.println("Adding a function"); globalClone = (Hashtable<String,Type>) globalTable.clone(); paramList = funcs.get(i).getFunctionParams(); localList = funcs.get(i).getFunctionLocals(); for (int j = 0; j < paramList.size(); j++) { globalClone.put(paramList.get(j).getDeclName(), paramList.get(j).getDeclType()); } for (int j = 0; j < localList.size(); j++) { globalClone.put(localList.get(j).getDeclName(), localList.get(j).getDeclType()); } funcTable.put(funcs.get(i).getFunctionName(), globalClone); //System.out.println("Here is the global table"); //System.out.println(globalTable); //System.out.println("Here is the function table"); //System.out.println(globalClone); } } public void checkForMain() { if (funcTable.get("main") == null) { throw new IllegalArgumentException("No main function was found"); } } public void checkType() { for (int i = 0; i < funcs.size(); i++) { funcs.get(i).checkType(funcTable, structTable); } } private void printTypes() { System.out.println("Printing the type list"); for (int i = 0; i < types.size(); i++) { System.out.println(types.get(i).getTypeName()); } System.out.println(""); } private void printDecls() { System.out.println("Printing the decl list"); for (int i = 0; i < decls.size(); i++) { System.out.println(decls.get(i).getDeclName()); } System.out.println(""); } private void printFuncs() { System.out.println("Printing the func list"); for (int i = 0; i < funcs.size(); i++) { System.out.println(funcs.get(i).getFunctionName()); } System.out.println(""); } }
11,800
0.545509
0.539068
300
38.333332
28.744198
142
false
false
0
0
0
0
0
0
0.77
false
false
9
f038ad5c3c442489feca8704b2e9aaaca2015a9a
9,208,409,910,808
c21212e6f62cf335e9b75ef3fb1f8c9d7f75e1f7
/app/src/main/java/service/song/com/serviceexcise/MyService.java
87da2e9b14240575d91c2944b04c9737578ae856
[]
no_license
BantonSong/ServiceExcise
https://github.com/BantonSong/ServiceExcise
29ad1511a9406f0a4171d6e6c65139c77847baf1
75eafb0b74251d51a7adffc152106cab47eeeca7
refs/heads/master
2020-06-16T20:37:21.166000
2016-11-29T10:15:08
2016-11-29T10:15:08
75,068,116
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package service.song.com.serviceexcise; import android.app.Notification; import android.app.PendingIntent; import android.app.Service; import android.content.Intent; import android.content.res.Configuration; import android.os.IBinder; import android.support.annotation.Nullable; public class MyService extends Service { @Override public void onCreate() { super.onCreate(); Utils.log("MyService", "onCreate"); Notification notification = new Notification(R.mipmap.ic_launcher, getText(R.string.app_name), System.currentTimeMillis()); Intent notificationIntent = new Intent(this, MainActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); // notification.setLatestEventInfo(this, "这是通知的标题", "这是通知的内容", pendingIntent); startForeground(1001, notification); } @Override public void onStart(Intent intent, int startId) { Utils.log("MyService", "onStart"); super.onStart(intent, startId); } @Override public int onStartCommand(Intent intent, int flags, int startId) { new Thread() { @Override public void run() { // 执行具体耗时任务 super.run(); } }.start(); Utils.log("MyService", "onStartCommand"); return super.onStartCommand(intent, flags, startId); } @Nullable @Override public IBinder onBind(Intent intent) { Utils.log("MyService", "onBind"); MyBinder binder = new MyBinder(); return binder; } @Override public void onRebind(Intent intent) { Utils.log("MyService", "onRebind"); super.onRebind(intent); } @Override public boolean onUnbind(Intent intent) { Utils.log("MyService", "onUnbind"); return super.onUnbind(intent); } @Override public void onTaskRemoved(Intent rootIntent) { Utils.log("MyService", "onTaskRemoved"); super.onTaskRemoved(rootIntent); } @Override public void onConfigurationChanged(Configuration newConfig) { Utils.log("MyService", "onConfigurationChanged"); super.onConfigurationChanged(newConfig); } @Override public void onLowMemory() { Utils.log("MyService", "onLowMemory"); super.onLowMemory(); } @Override public void onTrimMemory(int level) { Utils.log("MyService", "onTrimMemory"); super.onTrimMemory(level); } @Override public void onDestroy() { Utils.log("MyService", "onDestroy"); super.onDestroy(); } }
UTF-8
Java
2,692
java
MyService.java
Java
[]
null
[]
package service.song.com.serviceexcise; import android.app.Notification; import android.app.PendingIntent; import android.app.Service; import android.content.Intent; import android.content.res.Configuration; import android.os.IBinder; import android.support.annotation.Nullable; public class MyService extends Service { @Override public void onCreate() { super.onCreate(); Utils.log("MyService", "onCreate"); Notification notification = new Notification(R.mipmap.ic_launcher, getText(R.string.app_name), System.currentTimeMillis()); Intent notificationIntent = new Intent(this, MainActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); // notification.setLatestEventInfo(this, "这是通知的标题", "这是通知的内容", pendingIntent); startForeground(1001, notification); } @Override public void onStart(Intent intent, int startId) { Utils.log("MyService", "onStart"); super.onStart(intent, startId); } @Override public int onStartCommand(Intent intent, int flags, int startId) { new Thread() { @Override public void run() { // 执行具体耗时任务 super.run(); } }.start(); Utils.log("MyService", "onStartCommand"); return super.onStartCommand(intent, flags, startId); } @Nullable @Override public IBinder onBind(Intent intent) { Utils.log("MyService", "onBind"); MyBinder binder = new MyBinder(); return binder; } @Override public void onRebind(Intent intent) { Utils.log("MyService", "onRebind"); super.onRebind(intent); } @Override public boolean onUnbind(Intent intent) { Utils.log("MyService", "onUnbind"); return super.onUnbind(intent); } @Override public void onTaskRemoved(Intent rootIntent) { Utils.log("MyService", "onTaskRemoved"); super.onTaskRemoved(rootIntent); } @Override public void onConfigurationChanged(Configuration newConfig) { Utils.log("MyService", "onConfigurationChanged"); super.onConfigurationChanged(newConfig); } @Override public void onLowMemory() { Utils.log("MyService", "onLowMemory"); super.onLowMemory(); } @Override public void onTrimMemory(int level) { Utils.log("MyService", "onTrimMemory"); super.onTrimMemory(level); } @Override public void onDestroy() { Utils.log("MyService", "onDestroy"); super.onDestroy(); } }
2,692
0.637085
0.634819
92
27.782608
22.463413
102
false
false
0
0
0
0
0
0
0.706522
false
false
9
7094eb7ac58fdb3c1d35e2329e4f0a96a6887c09
3,178,275,829,302
4378d83a0a47fa7c934d6855defbc2695b2dbae2
/Day1204-SpringDataJPA/src/main/java/com/example/Day1204SpringDataJpaApplication.java
a6dfc3d10c3199ba87ff7e7deccf2bd3352640c7
[]
no_license
JacoboLi/SpringDataJPA
https://github.com/JacoboLi/SpringDataJPA
052a5f3c73f761ff38f0478369b96bbecfcac4f1
0e1e2e681f8d8d3cfff73ff430b1037e0f1ba5e8
refs/heads/master
2020-04-09T22:45:54.017000
2018-12-06T07:46:23
2018-12-06T07:46:23
160,638,229
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Day1204SpringDataJpaApplication { public static void main(String[] args) { SpringApplication.run(Day1204SpringDataJpaApplication.class, args); } }
UTF-8
Java
331
java
Day1204SpringDataJpaApplication.java
Java
[]
null
[]
package com.example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Day1204SpringDataJpaApplication { public static void main(String[] args) { SpringApplication.run(Day1204SpringDataJpaApplication.class, args); } }
331
0.836858
0.812689
12
26.583334
25.96619
69
false
false
0
0
0
0
0
0
0.75
false
false
9
17e185820435d2a67fefbfb5c43529889fceaeb5
10,376,641,010,996
1ad14ec2ac1ed01ea6fba920e403b7dc517f25a8
/onlinechat/src/main/java/exam/Main3.java
99e5b1f7e92f837f3ec54f33f54df160a772f1b7
[]
no_license
Debri/Demos
https://github.com/Debri/Demos
de5ddda7c2945f9a114c74f51f58b976ccdf060e
6fac2cc63b94d60263f7ad17c3bf41337f64902b
refs/heads/master
2021-06-15T01:15:59.979000
2017-04-16T14:49:05
2017-04-16T14:49:05
67,612,991
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package exam; import java.util.Scanner; /** * Created by Liuqi * Date: 2017/4/11. */ public class Main3 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); doPrint(n); } public static void doPrint(int n) { int[] a = new int[50]; int sum = 0; int l = 0; int left = 0; for (int i = 2; i <= n; i++) { a[l++] = i; sum += i; if (sum > n) { sum -= i; l--; left = n - sum; break; } } for (int i = l - 1; left > 0; left--) { a[i]++; i--; if (i < 0) { i = l - 1; } } for (int i=0;i<l-1;i++){ System.out.print(a[i]+" --"); System.out.println(a[l-1]); } } }
UTF-8
Java
938
java
Main3.java
Java
[ { "context": "xam;\n\nimport java.util.Scanner;\n\n/**\n * Created by Liuqi\n * Date: 2017/4/11.\n */\npublic class Main3 {\n\n ", "end": 65, "score": 0.998236358165741, "start": 60, "tag": "NAME", "value": "Liuqi" } ]
null
[]
package exam; import java.util.Scanner; /** * Created by Liuqi * Date: 2017/4/11. */ public class Main3 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); doPrint(n); } public static void doPrint(int n) { int[] a = new int[50]; int sum = 0; int l = 0; int left = 0; for (int i = 2; i <= n; i++) { a[l++] = i; sum += i; if (sum > n) { sum -= i; l--; left = n - sum; break; } } for (int i = l - 1; left > 0; left--) { a[i]++; i--; if (i < 0) { i = l - 1; } } for (int i=0;i<l-1;i++){ System.out.print(a[i]+" --"); System.out.println(a[l-1]); } } }
938
0.359275
0.336887
45
19.844444
13.665781
49
false
false
0
0
0
0
0
0
0.577778
false
false
9
b97e38a8295381e076f6ae30465baa397638df13
8,315,056,711,826
de3c2d89f623527b35cc5dd936773f32946025d2
/src/main/java/p655io/reactivex/internal/p669a/Functions.java
bfed3e0de004d54d3a9dd10c4655157b2b8d0aa7
[]
no_license
ren19890419/lvxing
https://github.com/ren19890419/lvxing
5f89f7b118df59fd1da06aaba43bd9b41b5da1e6
239875461cb39e58183ac54e93565ec5f7f28ddb
refs/heads/master
2023-04-15T08:56:25.048000
2020-06-05T10:46:05
2020-06-05T10:46:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package p655io.reactivex.internal.p669a; import java.util.Comparator; import java.util.concurrent.Callable; import org.p705b.Subscription; import p655io.reactivex.exceptions.OnErrorNotImplementedException; import p655io.reactivex.p664d.C8083a; import p655io.reactivex.p664d.C8084j; import p655io.reactivex.p664d.Consumer; import p655io.reactivex.p664d.Function; import p655io.reactivex.p664d.LongConsumer; import p655io.reactivex.p666f.RxJavaPlugins; /* renamed from: io.reactivex.internal.a.a */ public final class Functions { /* renamed from: a */ static final Function<Object, Object> f27468a = new C8109i(); /* renamed from: b */ public static final Runnable f27469b = new C8106f(); /* renamed from: c */ public static final C8083a f27470c = new C8103c(); /* renamed from: d */ static final Consumer<Object> f27471d = new C8104d(); /* renamed from: e */ public static final Consumer<Throwable> f27472e = new C8107g(); /* renamed from: f */ public static final Consumer<Throwable> f27473f = new C8114n(); /* renamed from: g */ public static final LongConsumer f27474g = new C8105e(); /* renamed from: h */ static final C8084j<Object> f27475h = new C8115o(); /* renamed from: i */ static final C8084j<Object> f27476i = new C8108h(); /* renamed from: j */ static final Callable<Object> f27477j = new C8113m(); /* renamed from: k */ static final Comparator<Object> f27478k = new C8112l(); /* renamed from: l */ public static final Consumer<Subscription> f27479l = new C8111k(); /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$a */ static final class C8101a<T, U> implements Function<T, U> { /* renamed from: a */ final Class<U> f27480a; C8101a(Class<U> cls) { this.f27480a = cls; } public U apply(T t) throws Exception { return this.f27480a.cast(t); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$b */ static final class C8102b<T, U> implements C8084j<T> { /* renamed from: a */ final Class<U> f27481a; C8102b(Class<U> cls) { this.f27481a = cls; } public boolean test(T t) throws Exception { return this.f27481a.isInstance(t); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$c */ static final class C8103c implements C8083a { /* renamed from: a */ public void mo19849a() { } public String toString() { return "EmptyAction"; } C8103c() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$d */ static final class C8104d implements Consumer<Object> { public void accept(Object obj) { } public String toString() { return "EmptyConsumer"; } C8104d() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$e */ static final class C8105e implements LongConsumer { C8105e() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$f */ static final class C8106f implements Runnable { public void run() { } public String toString() { return "EmptyRunnable"; } C8106f() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$g */ static final class C8107g implements Consumer<Throwable> { C8107g() { } /* renamed from: a */ public void accept(Throwable th) { RxJavaPlugins.m34959a(th); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$h */ static final class C8108h implements C8084j<Object> { public boolean test(Object obj) { return false; } C8108h() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$i */ static final class C8109i implements Function<Object, Object> { public Object apply(Object obj) { return obj; } public String toString() { return "IdentityFunction"; } C8109i() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$j */ static final class C8110j<T, U> implements Function<T, U>, Callable<U> { /* renamed from: a */ final U f27482a; C8110j(U u) { this.f27482a = u; } public U call() throws Exception { return this.f27482a; } public U apply(T t) throws Exception { return this.f27482a; } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$k */ static final class C8111k implements Consumer<Subscription> { C8111k() { } /* renamed from: a */ public void accept(Subscription cVar) throws Exception { cVar.request(Long.MAX_VALUE); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$l */ static final class C8112l implements Comparator<Object> { C8112l() { } public int compare(Object obj, Object obj2) { return ((Comparable) obj).compareTo(obj2); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$m */ static final class C8113m implements Callable<Object> { public Object call() { return null; } C8113m() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$n */ static final class C8114n implements Consumer<Throwable> { C8114n() { } /* renamed from: a */ public void accept(Throwable th) { RxJavaPlugins.m34959a((Throwable) new OnErrorNotImplementedException(th)); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$o */ static final class C8115o implements C8084j<Object> { public boolean test(Object obj) { return true; } C8115o() { } } /* renamed from: a */ public static <T> Function<T, T> m35035a() { return f27468a; } /* renamed from: b */ public static <T> Consumer<T> m35038b() { return f27471d; } /* renamed from: a */ public static <T> Callable<T> m35037a(T t) { return new C8110j(t); } /* renamed from: b */ public static <T, U> Function<T, U> m35039b(U u) { return new C8110j(u); } /* renamed from: a */ public static <T, U> Function<T, U> m35036a(Class<U> cls) { return new C8101a(cls); } /* renamed from: b */ public static <T, U> C8084j<T> m35040b(Class<U> cls) { return new C8102b(cls); } }
UTF-8
Java
7,078
java
Functions.java
Java
[]
null
[]
package p655io.reactivex.internal.p669a; import java.util.Comparator; import java.util.concurrent.Callable; import org.p705b.Subscription; import p655io.reactivex.exceptions.OnErrorNotImplementedException; import p655io.reactivex.p664d.C8083a; import p655io.reactivex.p664d.C8084j; import p655io.reactivex.p664d.Consumer; import p655io.reactivex.p664d.Function; import p655io.reactivex.p664d.LongConsumer; import p655io.reactivex.p666f.RxJavaPlugins; /* renamed from: io.reactivex.internal.a.a */ public final class Functions { /* renamed from: a */ static final Function<Object, Object> f27468a = new C8109i(); /* renamed from: b */ public static final Runnable f27469b = new C8106f(); /* renamed from: c */ public static final C8083a f27470c = new C8103c(); /* renamed from: d */ static final Consumer<Object> f27471d = new C8104d(); /* renamed from: e */ public static final Consumer<Throwable> f27472e = new C8107g(); /* renamed from: f */ public static final Consumer<Throwable> f27473f = new C8114n(); /* renamed from: g */ public static final LongConsumer f27474g = new C8105e(); /* renamed from: h */ static final C8084j<Object> f27475h = new C8115o(); /* renamed from: i */ static final C8084j<Object> f27476i = new C8108h(); /* renamed from: j */ static final Callable<Object> f27477j = new C8113m(); /* renamed from: k */ static final Comparator<Object> f27478k = new C8112l(); /* renamed from: l */ public static final Consumer<Subscription> f27479l = new C8111k(); /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$a */ static final class C8101a<T, U> implements Function<T, U> { /* renamed from: a */ final Class<U> f27480a; C8101a(Class<U> cls) { this.f27480a = cls; } public U apply(T t) throws Exception { return this.f27480a.cast(t); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$b */ static final class C8102b<T, U> implements C8084j<T> { /* renamed from: a */ final Class<U> f27481a; C8102b(Class<U> cls) { this.f27481a = cls; } public boolean test(T t) throws Exception { return this.f27481a.isInstance(t); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$c */ static final class C8103c implements C8083a { /* renamed from: a */ public void mo19849a() { } public String toString() { return "EmptyAction"; } C8103c() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$d */ static final class C8104d implements Consumer<Object> { public void accept(Object obj) { } public String toString() { return "EmptyConsumer"; } C8104d() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$e */ static final class C8105e implements LongConsumer { C8105e() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$f */ static final class C8106f implements Runnable { public void run() { } public String toString() { return "EmptyRunnable"; } C8106f() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$g */ static final class C8107g implements Consumer<Throwable> { C8107g() { } /* renamed from: a */ public void accept(Throwable th) { RxJavaPlugins.m34959a(th); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$h */ static final class C8108h implements C8084j<Object> { public boolean test(Object obj) { return false; } C8108h() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$i */ static final class C8109i implements Function<Object, Object> { public Object apply(Object obj) { return obj; } public String toString() { return "IdentityFunction"; } C8109i() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$j */ static final class C8110j<T, U> implements Function<T, U>, Callable<U> { /* renamed from: a */ final U f27482a; C8110j(U u) { this.f27482a = u; } public U call() throws Exception { return this.f27482a; } public U apply(T t) throws Exception { return this.f27482a; } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$k */ static final class C8111k implements Consumer<Subscription> { C8111k() { } /* renamed from: a */ public void accept(Subscription cVar) throws Exception { cVar.request(Long.MAX_VALUE); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$l */ static final class C8112l implements Comparator<Object> { C8112l() { } public int compare(Object obj, Object obj2) { return ((Comparable) obj).compareTo(obj2); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$m */ static final class C8113m implements Callable<Object> { public Object call() { return null; } C8113m() { } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$n */ static final class C8114n implements Consumer<Throwable> { C8114n() { } /* renamed from: a */ public void accept(Throwable th) { RxJavaPlugins.m34959a((Throwable) new OnErrorNotImplementedException(th)); } } /* compiled from: Functions */ /* renamed from: io.reactivex.internal.a.a$o */ static final class C8115o implements C8084j<Object> { public boolean test(Object obj) { return true; } C8115o() { } } /* renamed from: a */ public static <T> Function<T, T> m35035a() { return f27468a; } /* renamed from: b */ public static <T> Consumer<T> m35038b() { return f27471d; } /* renamed from: a */ public static <T> Callable<T> m35037a(T t) { return new C8110j(t); } /* renamed from: b */ public static <T, U> Function<T, U> m35039b(U u) { return new C8110j(u); } /* renamed from: a */ public static <T, U> Function<T, U> m35036a(Class<U> cls) { return new C8101a(cls); } /* renamed from: b */ public static <T, U> C8084j<T> m35040b(Class<U> cls) { return new C8102b(cls); } }
7,078
0.577988
0.515965
264
25.810606
20.71401
86
false
false
0
0
0
0
0
0
0.25
false
false
9
68730a4806af734e298fa64d8b6b0c439a75e519
28,595,892,281,556
c133ca70c4ea4e1c19433ca417946dc6762277e6
/guns-admin/src/main/java/com/stylefeng/guns/core/common/billcode/impl/FollowGeneratorImpl.java
e8a504529e70ba2915c6a9acb6fe7f7e7e6d35b3
[ "Apache-2.0" ]
permissive
chenguiwen1995/yijaiyi
https://github.com/chenguiwen1995/yijaiyi
0122623c26d40471c8340365a4159a821d285045
ac9c7470460330f21eab6ed459d6a10c47845958
refs/heads/master
2022-11-01T01:44:07.175000
2019-06-19T14:51:19
2019-06-19T14:51:19
170,969,799
0
3
NOASSERTION
false
2022-10-12T20:23:21
2019-02-16T06:12:58
2019-06-19T14:51:34
2022-10-12T20:23:19
5,615
0
2
6
JavaScript
false
false
package com.stylefeng.guns.core.common.billcode.impl; import com.stylefeng.guns.core.common.billcode.Generator; import com.stylefeng.guns.modular.fl.service.IFollowHService; import com.stylefeng.guns.modular.system.model.Follow; import com.stylefeng.guns.modular.system.model.FollowH; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; @Component public class FollowGeneratorImpl { @Autowired private IFollowHService iFollowHService; @Autowired private Generator generator; public String getCode() { List<FollowH> list = this.iFollowHService.selectList(null); String lastCode = null; if (null == list || 0 == list.size()){ lastCode = null; }else { lastCode = list.get(list.size()-1).getCode(); } return generator.getInstance().generaterNextNumber(lastCode,"SF"); } }
UTF-8
Java
955
java
FollowGeneratorImpl.java
Java
[]
null
[]
package com.stylefeng.guns.core.common.billcode.impl; import com.stylefeng.guns.core.common.billcode.Generator; import com.stylefeng.guns.modular.fl.service.IFollowHService; import com.stylefeng.guns.modular.system.model.Follow; import com.stylefeng.guns.modular.system.model.FollowH; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; @Component public class FollowGeneratorImpl { @Autowired private IFollowHService iFollowHService; @Autowired private Generator generator; public String getCode() { List<FollowH> list = this.iFollowHService.selectList(null); String lastCode = null; if (null == list || 0 == list.size()){ lastCode = null; }else { lastCode = list.get(list.size()-1).getCode(); } return generator.getInstance().generaterNextNumber(lastCode,"SF"); } }
955
0.713089
0.710995
33
27.939394
24.276114
74
false
false
0
0
0
0
0
0
0.545455
false
false
9
8aa013c66693ea9c77b1466dcf719a9f480046ac
4,715,874,103,490
3676038b81349d2082b9f534041d304795ffa9e8
/src/main/java/packCarShop/packCar/CarDao.java
25cc30a42bbb41b9258a165a914607812cc1c3b9
[]
no_license
Jarekszu2/Gda_60_jdbc_carShop-Car-Zlecenie-_Timestamp
https://github.com/Jarekszu2/Gda_60_jdbc_carShop-Car-Zlecenie-_Timestamp
26b352548571edb94ca95f3ea3215fb53c1f6e42
f233e2fab91ce6e0ce548c1c2d579384f56bc95e
refs/heads/master
2022-06-25T14:59:19.450000
2019-08-29T21:57:02
2019-08-29T21:57:02
204,764,942
0
0
null
false
2022-06-21T01:46:21
2019-08-27T18:26:13
2019-08-30T00:51:47
2022-06-21T01:46:21
9
0
0
1
Java
false
false
package packCarShop.packCar; import packCarShop.MysqlConnection; import java.sql.*; import java.util.ArrayList; import java.util.List; import static packCarShop.packCar.CarQueries.*; public class CarDao { private MysqlConnection mysqlConnection; // public CarDao() throws SQLException, IOException { // mysqlConnection = new MysqlConnection(); // createTableIfNotExists(); // } public CarDao(MysqlConnection mysqlConnection) throws SQLException { this.mysqlConnection = mysqlConnection; createTableIfNotExists(); } private void createTableIfNotExists() throws SQLException { try (Connection connection = mysqlConnection.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(CREATE_TABLE_QUERY)) { statement.execute(); } } } public void insertCar(Car car) throws SQLException { try (Connection connection = mysqlConnection.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS)) { statement.setString(1, car.getNummerReg()); statement.setInt(2, car.getPrzebieg()); statement.setString(3, car.getMarkModel()); statement.setInt(4, car.getYear()); statement.setString(5, car.getType()); statement.setString(6, car.getUserName()); // boolean success = statement.execute(); // jeśli interesuje nas czy w wyniku otrzymaliśmy dane int affectedRecords = statement.executeUpdate(); // jeśli interesuje nas ile rekordów zostało zmienionych ResultSet resultSet = statement.getGeneratedKeys(); if (resultSet.next()) { Integer generatedId = resultSet.getInt(1); System.out.println("Został utworzony rekord o identyfikatorze: " + generatedId); } } } } public List<Car> listAllCars() throws SQLException { List<Car> carList = new ArrayList<>(); try (Connection connection = mysqlConnection.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(SELECT_ALL_QUERY)) { ResultSet resultSet = statement.executeQuery(); loadMultipleCarsFromResultSet(carList, resultSet); } } return carList; } private Car loadCarFromResultSet(ResultSet resultSet) throws SQLException { Car car = new Car(); car.setNummerId(resultSet.getInt(1)); car.setNummerReg(resultSet.getString(2)); car.setPrzebieg(resultSet.getInt(3)); car.setMarkModel(resultSet.getString(4)); car.setYear(resultSet.getInt(5)); car.setType(resultSet.getString(6)); car.setUserName(resultSet.getString(7)); return car; } private void loadMultipleCarsFromResultSet(List<Car> carList, ResultSet resultSet) throws SQLException { while (resultSet.next()) { Car car = loadCarFromResultSet(resultSet); carList.add(car); } } public boolean deleteCarById(int deletedId) throws SQLException { try (Connection connection = mysqlConnection.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(DELETE_QUERY, Statement.RETURN_GENERATED_KEYS)) { statement.setInt(1, deletedId); // boolean success = statement.execute(); statement.execute(); System.out.println("Usunięto studenta o id = " + deletedId); // Statement.RETURN_GENERATED_KEYS // do dodania w try (PreparedStatemenr... // int affectedRecords = statement.executeUpdate(); // // if (affectedRecords > 0) { // // usuneliśmy rekord // System.out.println("Usunięto studenta o id: " + deletedId); // System.out.println("Ilość zmienionych rekordów: " + affectedRecords); // return true; // } } } return false; } public List<Car> getListByCarUsersName(String searchedName) throws SQLException { return getCars(searchedName, SELECT_BY_NAME_QUERY); } public List<Car> listWhereNummerRegLike(String nameLike) throws SQLException { return getCars(nameLike, SELECT_WHERE_NUMMERREG_LIKE_QUERY); } public List<Car> listWhereMarkModelLike(String nameLike) throws SQLException { return getCars(nameLike, SELECT_BY_MARKMODEL_LIKE_QUERY); } private List<Car> getCars(String nameLike, String selectWhereNummerregLikeQuery) throws SQLException { List<Car> carList = new ArrayList<>(); try (Connection connection = mysqlConnection.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(selectWhereNummerregLikeQuery)) { statement.setString(1, "%" + nameLike + "%"); ResultSet resultSet = statement.executeQuery(); loadMultipleCarsFromResultSet(carList, resultSet); } } return carList; } }
UTF-8
Java
5,290
java
CarDao.java
Java
[]
null
[]
package packCarShop.packCar; import packCarShop.MysqlConnection; import java.sql.*; import java.util.ArrayList; import java.util.List; import static packCarShop.packCar.CarQueries.*; public class CarDao { private MysqlConnection mysqlConnection; // public CarDao() throws SQLException, IOException { // mysqlConnection = new MysqlConnection(); // createTableIfNotExists(); // } public CarDao(MysqlConnection mysqlConnection) throws SQLException { this.mysqlConnection = mysqlConnection; createTableIfNotExists(); } private void createTableIfNotExists() throws SQLException { try (Connection connection = mysqlConnection.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(CREATE_TABLE_QUERY)) { statement.execute(); } } } public void insertCar(Car car) throws SQLException { try (Connection connection = mysqlConnection.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS)) { statement.setString(1, car.getNummerReg()); statement.setInt(2, car.getPrzebieg()); statement.setString(3, car.getMarkModel()); statement.setInt(4, car.getYear()); statement.setString(5, car.getType()); statement.setString(6, car.getUserName()); // boolean success = statement.execute(); // jeśli interesuje nas czy w wyniku otrzymaliśmy dane int affectedRecords = statement.executeUpdate(); // jeśli interesuje nas ile rekordów zostało zmienionych ResultSet resultSet = statement.getGeneratedKeys(); if (resultSet.next()) { Integer generatedId = resultSet.getInt(1); System.out.println("Został utworzony rekord o identyfikatorze: " + generatedId); } } } } public List<Car> listAllCars() throws SQLException { List<Car> carList = new ArrayList<>(); try (Connection connection = mysqlConnection.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(SELECT_ALL_QUERY)) { ResultSet resultSet = statement.executeQuery(); loadMultipleCarsFromResultSet(carList, resultSet); } } return carList; } private Car loadCarFromResultSet(ResultSet resultSet) throws SQLException { Car car = new Car(); car.setNummerId(resultSet.getInt(1)); car.setNummerReg(resultSet.getString(2)); car.setPrzebieg(resultSet.getInt(3)); car.setMarkModel(resultSet.getString(4)); car.setYear(resultSet.getInt(5)); car.setType(resultSet.getString(6)); car.setUserName(resultSet.getString(7)); return car; } private void loadMultipleCarsFromResultSet(List<Car> carList, ResultSet resultSet) throws SQLException { while (resultSet.next()) { Car car = loadCarFromResultSet(resultSet); carList.add(car); } } public boolean deleteCarById(int deletedId) throws SQLException { try (Connection connection = mysqlConnection.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(DELETE_QUERY, Statement.RETURN_GENERATED_KEYS)) { statement.setInt(1, deletedId); // boolean success = statement.execute(); statement.execute(); System.out.println("Usunięto studenta o id = " + deletedId); // Statement.RETURN_GENERATED_KEYS // do dodania w try (PreparedStatemenr... // int affectedRecords = statement.executeUpdate(); // // if (affectedRecords > 0) { // // usuneliśmy rekord // System.out.println("Usunięto studenta o id: " + deletedId); // System.out.println("Ilość zmienionych rekordów: " + affectedRecords); // return true; // } } } return false; } public List<Car> getListByCarUsersName(String searchedName) throws SQLException { return getCars(searchedName, SELECT_BY_NAME_QUERY); } public List<Car> listWhereNummerRegLike(String nameLike) throws SQLException { return getCars(nameLike, SELECT_WHERE_NUMMERREG_LIKE_QUERY); } public List<Car> listWhereMarkModelLike(String nameLike) throws SQLException { return getCars(nameLike, SELECT_BY_MARKMODEL_LIKE_QUERY); } private List<Car> getCars(String nameLike, String selectWhereNummerregLikeQuery) throws SQLException { List<Car> carList = new ArrayList<>(); try (Connection connection = mysqlConnection.getConnection()) { try (PreparedStatement statement = connection.prepareStatement(selectWhereNummerregLikeQuery)) { statement.setString(1, "%" + nameLike + "%"); ResultSet resultSet = statement.executeQuery(); loadMultipleCarsFromResultSet(carList, resultSet); } } return carList; } }
5,290
0.629973
0.626753
142
36.169014
33.789944
124
false
false
0
0
0
0
0
0
0.514085
false
false
9
6b4e50182920b7a4ed0e92f28bece4f53b6ee61b
30,331,059,080,869
364a27603247e1eea61953a26561347e61b60336
/src/main/java/com/lumotime/arcface/pool/CompareFaceTask.java
75e18ed416697340387ab80ac1078aa158d22dcc
[]
no_license
qaz734913414/ArcFaceEngine
https://github.com/qaz734913414/ArcFaceEngine
0305280719a1955076785c75f668dc3dc861898c
fcfe63d39186a664a270fe54c1c47a5eef305d8d
refs/heads/master
2022-11-16T22:36:48.046000
2020-07-13T10:11:01
2020-07-13T10:11:01
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lumotime.arcface.pool; import com.arcsoft.face.FaceFeature; import com.google.common.collect.Lists; import com.lumotime.arcface.FaceEngineService; import com.lumotime.arcface.data.UserCompareInfo; import com.lumotime.arcface.data.UserFeatureInfo; import com.lumotime.arcface.engine.RukFaceEngine; import com.lumotime.arcface.exception.FaceEngineException; import com.lumotime.arcface.exception.FaceHandleException; import com.lumotime.arcface.facelibrary.FaceRecognition; import com.orhanobut.logger.Logger; import org.apache.commons.pool2.impl.GenericObjectPool; import java.util.List; import java.util.concurrent.Callable; /** * <p>文件名称: CompareFaceTask </p> * <p>所属包名: com.lumotime.arcface.pool</p> * <p>描述: 人脸库比对任务 </p> * <p>feature: * * </p> * <p>创建时间: 2020/6/29 15:39 </p> * * @author <a href="mail to: cnrivkaer@outlook.com" rel="nofollow">lumo</a> * @version v1.0 */ public class CompareFaceTask implements Callable<List<UserCompareInfo>> { /** * 人脸库特征数据列表 */ private List<UserFeatureInfo> userFeatureInfoList; /** * 1: N 待查找的人脸 */ private FaceFeature targetFaceFeature; /** * 人脸阈值 */ private float passRate; public CompareFaceTask(List<UserFeatureInfo> userFeatureInfoList, FaceFeature targetFaceFeature, float passRate) { this.userFeatureInfoList = userFeatureInfoList; this.targetFaceFeature = targetFaceFeature; this.passRate = passRate; } @Override public List<UserCompareInfo> call() throws Exception { RukFaceEngine faceEngine = null; GenericObjectPool<RukFaceEngine> faceEngineGeneralPool = FaceEngineService.getInstance() .getFaceEngineGeneralPool(); //识别到的人脸列表 List<UserCompareInfo> resultUserInfoList = Lists.newLinkedList(); try { if (faceEngineGeneralPool == null){ throw new FaceEngineException("fetch face engine pool failure"); } faceEngine = faceEngineGeneralPool.borrowObject(); if (faceEngine == null){ throw new FaceEngineException("fetch face engine failure"); } if (userFeatureInfoList == null || userFeatureInfoList.isEmpty()){ throw new FaceHandleException("User Feature info list empty!!!"); } if (targetFaceFeature == null){ throw new FaceHandleException("Not found target face feature !!!"); } FaceFeature faceFeature = new FaceFeature(); for (UserFeatureInfo userFeatureInfo : userFeatureInfoList) { faceFeature.setFeatureData(userFeatureInfo.getFeature()); Float faceSimilar = faceEngine.compareFace(faceFeature, targetFaceFeature); if (faceSimilar != null && faceSimilar > passRate){ UserCompareInfo userCompareInfo = new UserCompareInfo(userFeatureInfo, faceSimilar); // 将比对的结果添加到结果列表中 resultUserInfoList.add(userCompareInfo); } } }catch (Exception ex){ Logger.e(ex, "Compare Face Task failure"); } finally { if (faceEngine != null){ faceEngineGeneralPool.returnObject(faceEngine); } } return resultUserInfoList; } }
UTF-8
Java
3,508
java
CompareFaceTask.java
Java
[ { "context": "20/6/29 15:39 </p>\n *\n * @author <a href=\"mail to: cnrivkaer@outlook.com\" rel=\"nofollow\">lumo</a>\n * @version v1.0\n */\npub", "end": 855, "score": 0.999930202960968, "start": 834, "tag": "EMAIL", "value": "cnrivkaer@outlook.com" } ]
null
[]
package com.lumotime.arcface.pool; import com.arcsoft.face.FaceFeature; import com.google.common.collect.Lists; import com.lumotime.arcface.FaceEngineService; import com.lumotime.arcface.data.UserCompareInfo; import com.lumotime.arcface.data.UserFeatureInfo; import com.lumotime.arcface.engine.RukFaceEngine; import com.lumotime.arcface.exception.FaceEngineException; import com.lumotime.arcface.exception.FaceHandleException; import com.lumotime.arcface.facelibrary.FaceRecognition; import com.orhanobut.logger.Logger; import org.apache.commons.pool2.impl.GenericObjectPool; import java.util.List; import java.util.concurrent.Callable; /** * <p>文件名称: CompareFaceTask </p> * <p>所属包名: com.lumotime.arcface.pool</p> * <p>描述: 人脸库比对任务 </p> * <p>feature: * * </p> * <p>创建时间: 2020/6/29 15:39 </p> * * @author <a href="mail to: <EMAIL>" rel="nofollow">lumo</a> * @version v1.0 */ public class CompareFaceTask implements Callable<List<UserCompareInfo>> { /** * 人脸库特征数据列表 */ private List<UserFeatureInfo> userFeatureInfoList; /** * 1: N 待查找的人脸 */ private FaceFeature targetFaceFeature; /** * 人脸阈值 */ private float passRate; public CompareFaceTask(List<UserFeatureInfo> userFeatureInfoList, FaceFeature targetFaceFeature, float passRate) { this.userFeatureInfoList = userFeatureInfoList; this.targetFaceFeature = targetFaceFeature; this.passRate = passRate; } @Override public List<UserCompareInfo> call() throws Exception { RukFaceEngine faceEngine = null; GenericObjectPool<RukFaceEngine> faceEngineGeneralPool = FaceEngineService.getInstance() .getFaceEngineGeneralPool(); //识别到的人脸列表 List<UserCompareInfo> resultUserInfoList = Lists.newLinkedList(); try { if (faceEngineGeneralPool == null){ throw new FaceEngineException("fetch face engine pool failure"); } faceEngine = faceEngineGeneralPool.borrowObject(); if (faceEngine == null){ throw new FaceEngineException("fetch face engine failure"); } if (userFeatureInfoList == null || userFeatureInfoList.isEmpty()){ throw new FaceHandleException("User Feature info list empty!!!"); } if (targetFaceFeature == null){ throw new FaceHandleException("Not found target face feature !!!"); } FaceFeature faceFeature = new FaceFeature(); for (UserFeatureInfo userFeatureInfo : userFeatureInfoList) { faceFeature.setFeatureData(userFeatureInfo.getFeature()); Float faceSimilar = faceEngine.compareFace(faceFeature, targetFaceFeature); if (faceSimilar != null && faceSimilar > passRate){ UserCompareInfo userCompareInfo = new UserCompareInfo(userFeatureInfo, faceSimilar); // 将比对的结果添加到结果列表中 resultUserInfoList.add(userCompareInfo); } } }catch (Exception ex){ Logger.e(ex, "Compare Face Task failure"); } finally { if (faceEngine != null){ faceEngineGeneralPool.returnObject(faceEngine); } } return resultUserInfoList; } }
3,494
0.647163
0.64273
94
35.010639
27.715691
118
false
false
0
0
0
0
0
0
0.457447
false
false
9
05d494661d0f3d7ef1532273d8b94bdba2720c29
21,586,505,643,777
ea59d2d6698595fdf4881d989101a0a03c6cd738
/app/src/main/java/com/example/newsapp/appyHighAssignment/Application/IbaseApp.java
f8b5ff013ee2c32178c76472e526624915fb74a8
[]
no_license
Mehraj-ud-din-Bhat/newsapp
https://github.com/Mehraj-ud-din-Bhat/newsapp
d8b25bf3f01c9c49b6c97e1edf58cb71c1b77926
d97dedb1079da1485ea9a8d103658eafb94566b0
refs/heads/master
2023-04-28T13:39:43.698000
2021-05-08T11:04:16
2021-05-08T11:04:16
365,142,503
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Created BY MEHRAJ UD DIN BHAT on 5/7/21 4:07 PM * mehrajb33@gmail.com * Copyright (c) 2021. All Rights Reserved * LastModified 5/7/21 11:34 AM * / */ package com.example.newsapp.appyHighAssignment.Application; //---------------------------------------------------------------------------------------------- //ALL THE APPLICATION VIEW INTERFACES WILL EXTEND THIS INTERFACE: TO IMPLEMENT THE Common METHODS //--------------------------------------------------------------------------------------------- public interface IbaseApp { void showLoader(); void hideLoader(); void onError(String msg); void onSuccess(); }
UTF-8
Java
648
java
IbaseApp.java
Java
[ { "context": "/*\n * Created BY MEHRAJ UD DIN BHAT on 5/7/21 4:07 PM\n * mehrajb33@gmail.com\n * Copy", "end": 35, "score": 0.9997855424880981, "start": 17, "tag": "NAME", "value": "MEHRAJ UD DIN BHAT" }, { "context": "reated BY MEHRAJ UD DIN BHAT on 5/7/21 4:07 PM\n * mehrajb33@gmail.com\n * Copyright (c) 2021. All Rights Reserved\n * Las", "end": 77, "score": 0.9999315142631531, "start": 58, "tag": "EMAIL", "value": "mehrajb33@gmail.com" } ]
null
[]
/* * Created BY <NAME> on 5/7/21 4:07 PM * <EMAIL> * Copyright (c) 2021. All Rights Reserved * LastModified 5/7/21 11:34 AM * / */ package com.example.newsapp.appyHighAssignment.Application; //---------------------------------------------------------------------------------------------- //ALL THE APPLICATION VIEW INTERFACES WILL EXTEND THIS INTERFACE: TO IMPLEMENT THE Common METHODS //--------------------------------------------------------------------------------------------- public interface IbaseApp { void showLoader(); void hideLoader(); void onError(String msg); void onSuccess(); }
624
0.498457
0.466049
24
26
31.404617
97
false
false
0
0
0
0
0
0
0.208333
false
false
9
e1d9904c43dfd3b8c2ef0b524b5a3edfecb619b3
14,293,651,197,930
96cde7382916571f25ece6ba3cb66ad3ac7eee98
/wfs-city-data/src/main/java/com/hx/wfs/city/data/service/CityService.java
df2f4c113189a2d448785695807f097e6e05699d
[]
no_license
jxustcmh/wfs
https://github.com/jxustcmh/wfs
509e7759646bc2b4e5e40898537af8425b9da8b6
2e687822a8f501cdddcde5e78bdc8f75d20fecfb
refs/heads/master
2020-08-23T10:51:34.623000
2019-10-28T16:27:42
2019-10-28T16:27:42
216,599,991
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hx.wfs.city.data.service; import com.hx.wfs.city.data.model.City; import java.util.List; /** @author jxlgcmh @date 2019-10-22 10:46 */ public interface CityService{ int deleteByPrimaryKey(String areaid); int insert(City record); int insertSelective(City record); City selectByPrimaryKey(String areaid); int updateByPrimaryKeySelective(City record); int updateByPrimaryKey(City record); List<City> selectAll(); }
UTF-8
Java
467
java
CityService.java
Java
[ { "context": "a.model.City;\n\nimport java.util.List;\n\n/**\n@author jxlgcmh\n@date 2019-10-22 10:46\n*/\npublic interface CitySe", "end": 123, "score": 0.9996951222419739, "start": 116, "tag": "USERNAME", "value": "jxlgcmh" } ]
null
[]
package com.hx.wfs.city.data.service; import com.hx.wfs.city.data.model.City; import java.util.List; /** @author jxlgcmh @date 2019-10-22 10:46 */ public interface CityService{ int deleteByPrimaryKey(String areaid); int insert(City record); int insertSelective(City record); City selectByPrimaryKey(String areaid); int updateByPrimaryKeySelective(City record); int updateByPrimaryKey(City record); List<City> selectAll(); }
467
0.719486
0.69379
27
16.296297
17.519966
49
false
false
0
0
0
0
0
0
0.37037
false
false
9
753e39b4f081cbeaae2ca0e72938af5d4f858581
22,625,887,741,879
560549b3985d98f753d4d61017c9fbfd4a72cdfb
/railway-application-system/src/main/java/railway/application/system/models/Passenger.java
8511b01110b0079e28e574e57bb577810437f4e7
[ "Apache-2.0" ]
permissive
vManav123/Railway-Reservation-System
https://github.com/vManav123/Railway-Reservation-System
6e90c37bfde460b38c11090dde45421b85a05ccf
c4ebcf34f241b9434364fb9ebea0f9e890c4c032
refs/heads/main
2023-04-13T17:32:18.557000
2022-06-11T03:27:30
2022-06-11T03:27:30
362,695,805
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package railway.application.system.models; import lombok.*; @AllArgsConstructor @NoArgsConstructor @Getter @Setter @ToString public class Passenger { private String passenger_name; private int age; private String email_address; private String contact_no; private String sex; private String quota; private String class_name; }
UTF-8
Java
357
java
Passenger.java
Java
[]
null
[]
package railway.application.system.models; import lombok.*; @AllArgsConstructor @NoArgsConstructor @Getter @Setter @ToString public class Passenger { private String passenger_name; private int age; private String email_address; private String contact_no; private String sex; private String quota; private String class_name; }
357
0.745098
0.745098
19
17.789474
12.663994
42
false
false
0
0
0
0
0
0
0.473684
false
false
9
f94cd7a0e1171e57761944c117d0c6e6226aafb0
26,147,760,928,121
b3d60483680ab9223885e4a1225c506c73f0316c
/NotificationServiceForWearableDevices/src/com/wearable/service/ClassBean.java
68a4f6234e350df5ea5639bb42948b8a68abc23b
[]
no_license
sajadparacha/iot
https://github.com/sajadparacha/iot
3152e415dece79a86b80b87659f00727febf8375
c1079bea92ab9cfd87d6a49338a8548a2d4194c6
refs/heads/master
2022-10-25T11:00:45.406000
2022-09-24T10:27:01
2022-09-24T10:27:01
199,463,880
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wearable.service; public class ClassBean { private String className; private String section; private StudentBean studentBean; public String getSection() { return section; } public void setSection(String section) { this.section = section; } public String getClassName() { return className; } public void setClassName(String className) { this.className = className; } public StudentBean getStudentBean() { return studentBean; } public void setStudentBean(StudentBean studentBean) { this.studentBean = studentBean; } }
UTF-8
Java
536
java
ClassBean.java
Java
[]
null
[]
package com.wearable.service; public class ClassBean { private String className; private String section; private StudentBean studentBean; public String getSection() { return section; } public void setSection(String section) { this.section = section; } public String getClassName() { return className; } public void setClassName(String className) { this.className = className; } public StudentBean getStudentBean() { return studentBean; } public void setStudentBean(StudentBean studentBean) { this.studentBean = studentBean; } }
536
0.783582
0.783582
26
19.615385
15.640374
53
false
false
0
0
0
0
0
0
0.615385
false
false
9
5947d4a80e417f0eced91011634230f6c1b0289b
17,686,675,356,476
ce9ed6a495b8c25bfa4ea57fc133b2a0c3aaf67d
/10_metalsoft/MetalSoft_Desktop/src/metalsoft/negocio/ventas/DetalleProductoPresupuesto.java
4754c906ba109228959da475d15e4880b08c5025
[]
no_license
hemoreno33/metalurgica
https://github.com/hemoreno33/metalurgica
23804ae1d966b175b4409630ef08cd937de29202
db0d4406e9151fd4b91de21f7a4e18c63f4c8ce6
refs/heads/master
2015-08-21T12:41:46.716000
2011-11-22T18:37:44
2011-11-22T18:37:44
32,117,254
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//Source file: D:\\Mis documentos\\Facultad\\Proyecto Final\\Repositorio\\metalurgica\\10_metalsoft\\rational\\metalsoft\\sistema\\ventas\\PlanProcedimientos.java package metalsoft.negocio.ventas; import java.util.ArrayList; import java.util.Date; import metalsoft.negocio.almacenamiento.MateriaPrima; import metalsoft.util.Calculos; public class DetalleProductoPresupuesto { private ArrayList<DetallePiezaPresupuesto> detallePiezaPresupuesto; private Pieza pieza; private MateriaPrima materiaPrima; private double preciomateriaprima; int cantidadPieza,cantidadMateriaPrima; /** * @roseuid 4C27ED190048 */ public DetalleProductoPresupuesto() { } public double getPreciomateriaprima() { return preciomateriaprima; } public void setPreciomateriaprima(double preciomateriaprima) { this.preciomateriaprima = preciomateriaprima; } public int getCantidadMateriaPrima() { return cantidadMateriaPrima; } public void setCantidadMateriaPrima(int cantidadMateriaPrima) { this.cantidadMateriaPrima = cantidadMateriaPrima; } public int getCantidadPieza() { return cantidadPieza; } public void setCantidadPieza(int cantidadPieza) { this.cantidadPieza = cantidadPieza; } public MateriaPrima getMateriaPrima() { return materiaPrima; } public void setMateriaPrima(MateriaPrima materiaPrima) { this.materiaPrima = materiaPrima; } public boolean agregarDetallePiezaPresupuesto(DetallePiezaPresupuesto dpp) { if(detallePiezaPresupuesto==null)detallePiezaPresupuesto=new ArrayList<DetallePiezaPresupuesto>(); return detallePiezaPresupuesto.add(dpp); } public ArrayList<DetallePiezaPresupuesto> getDetallePiezaPresupuesto() { return detallePiezaPresupuesto; } public void setDetallePiezaPresupuesto(ArrayList<DetallePiezaPresupuesto> detallePiezaPresupuesto) { this.detallePiezaPresupuesto = detallePiezaPresupuesto; } public Pieza getPieza() { return pieza; } public void setPieza(Pieza pieza) { this.pieza = pieza; } public DetallePiezaPresupuesto crearDetallePiezaPresupuesto() { return new DetallePiezaPresupuesto(); } public static int calcularCapacidadMateriaPrima(double altoMatPrima, double anchoMatPrima, double largoMatPrima, double altoPieza, double anchoPieza, double largoPieza, String nombrePieza, String nombreMateriaPrima) { return Calculos.calcularCapacidadMateriaPrima(altoMatPrima,anchoMatPrima,largoMatPrima,altoPieza,anchoPieza,largoPieza,nombrePieza,nombreMateriaPrima); } public static int calcularCantidadMateriaPrima(int capacidadMatPrima, int cantPiezas) { return Calculos.calcularCantidadMateriaPrima(capacidadMatPrima,cantPiezas); } }
UTF-8
Java
2,974
java
DetalleProductoPresupuesto.java
Java
[]
null
[]
//Source file: D:\\Mis documentos\\Facultad\\Proyecto Final\\Repositorio\\metalurgica\\10_metalsoft\\rational\\metalsoft\\sistema\\ventas\\PlanProcedimientos.java package metalsoft.negocio.ventas; import java.util.ArrayList; import java.util.Date; import metalsoft.negocio.almacenamiento.MateriaPrima; import metalsoft.util.Calculos; public class DetalleProductoPresupuesto { private ArrayList<DetallePiezaPresupuesto> detallePiezaPresupuesto; private Pieza pieza; private MateriaPrima materiaPrima; private double preciomateriaprima; int cantidadPieza,cantidadMateriaPrima; /** * @roseuid 4C27ED190048 */ public DetalleProductoPresupuesto() { } public double getPreciomateriaprima() { return preciomateriaprima; } public void setPreciomateriaprima(double preciomateriaprima) { this.preciomateriaprima = preciomateriaprima; } public int getCantidadMateriaPrima() { return cantidadMateriaPrima; } public void setCantidadMateriaPrima(int cantidadMateriaPrima) { this.cantidadMateriaPrima = cantidadMateriaPrima; } public int getCantidadPieza() { return cantidadPieza; } public void setCantidadPieza(int cantidadPieza) { this.cantidadPieza = cantidadPieza; } public MateriaPrima getMateriaPrima() { return materiaPrima; } public void setMateriaPrima(MateriaPrima materiaPrima) { this.materiaPrima = materiaPrima; } public boolean agregarDetallePiezaPresupuesto(DetallePiezaPresupuesto dpp) { if(detallePiezaPresupuesto==null)detallePiezaPresupuesto=new ArrayList<DetallePiezaPresupuesto>(); return detallePiezaPresupuesto.add(dpp); } public ArrayList<DetallePiezaPresupuesto> getDetallePiezaPresupuesto() { return detallePiezaPresupuesto; } public void setDetallePiezaPresupuesto(ArrayList<DetallePiezaPresupuesto> detallePiezaPresupuesto) { this.detallePiezaPresupuesto = detallePiezaPresupuesto; } public Pieza getPieza() { return pieza; } public void setPieza(Pieza pieza) { this.pieza = pieza; } public DetallePiezaPresupuesto crearDetallePiezaPresupuesto() { return new DetallePiezaPresupuesto(); } public static int calcularCapacidadMateriaPrima(double altoMatPrima, double anchoMatPrima, double largoMatPrima, double altoPieza, double anchoPieza, double largoPieza, String nombrePieza, String nombreMateriaPrima) { return Calculos.calcularCapacidadMateriaPrima(altoMatPrima,anchoMatPrima,largoMatPrima,altoPieza,anchoPieza,largoPieza,nombrePieza,nombreMateriaPrima); } public static int calcularCantidadMateriaPrima(int capacidadMatPrima, int cantPiezas) { return Calculos.calcularCantidadMateriaPrima(capacidadMatPrima,cantPiezas); } }
2,974
0.723605
0.719906
97
28.659794
38.396973
221
false
false
0
0
0
0
0
0
0.453608
false
false
9
43db173da0526f72bc54757c9e0a1d3611400c28
22,239,340,700,884
11d3617d136c9db410364d6c4f1e53a5e5daf494
/Pauza/src/AvgustZadaci/SocialSecurityNumber.java
0a085f1c35826753796cedaf5eb8e3342a74cf31
[]
no_license
Apokalipsa/BILD-IT-Zadaci
https://github.com/Apokalipsa/BILD-IT-Zadaci
ac6a24f7924353ec32afe63b0ee832b04f24a2ef
28be1ea4bfc87f83687023ddd7b8f78dc5f7c071
refs/heads/master
2020-05-18T15:37:16.566000
2015-09-18T18:00:51
2015-09-18T18:00:51
39,474,793
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package AvgustZadaci; import java.util.Scanner; public class SocialSecurityNumber { public static void main(String[] args) { Scanner input = new Scanner(System.in); // trazimo unos od korisnika System.out.println("Provjera Social Security Number !"); System.out.println("Unesite svoj SSN"); String unos = input.nextLine(); boolean isSSN = true; if (unos.length() != 11) { // ukoliko unos nema 11 elemenata program ispisuje da broj nije ispravan isSSN = false; } if (!Character.isDigit(unos.charAt(0))) // uslov za provjeru da li je prvi elemenat unosa broj isSSN = false; // ako nije program vraca broj nije ispravan else if (unos.charAt(2) != '_') // ukoliko je sledeci elemenat nije znak program opet vraca neispravan broj isSSN = false; else if (unos.charAt(5) != '_') // isto tako i peti index se provjerava da li ima potrebni znak isSSN = false; System.out.println(isSSN); // ispis potvrde da je broj ispravan if (isSSN == true) System.out.println(unos + " ovaj broj je ispravan"); else // u zavisnosti od uslova ispis u konzoli System.out.println(unos + " ovaj broj nije ispravan! Molimo pokusajte ponovo"); } }
UTF-8
Java
1,362
java
SocialSecurityNumber.java
Java
[]
null
[]
package AvgustZadaci; import java.util.Scanner; public class SocialSecurityNumber { public static void main(String[] args) { Scanner input = new Scanner(System.in); // trazimo unos od korisnika System.out.println("Provjera Social Security Number !"); System.out.println("Unesite svoj SSN"); String unos = input.nextLine(); boolean isSSN = true; if (unos.length() != 11) { // ukoliko unos nema 11 elemenata program ispisuje da broj nije ispravan isSSN = false; } if (!Character.isDigit(unos.charAt(0))) // uslov za provjeru da li je prvi elemenat unosa broj isSSN = false; // ako nije program vraca broj nije ispravan else if (unos.charAt(2) != '_') // ukoliko je sledeci elemenat nije znak program opet vraca neispravan broj isSSN = false; else if (unos.charAt(5) != '_') // isto tako i peti index se provjerava da li ima potrebni znak isSSN = false; System.out.println(isSSN); // ispis potvrde da je broj ispravan if (isSSN == true) System.out.println(unos + " ovaj broj je ispravan"); else // u zavisnosti od uslova ispis u konzoli System.out.println(unos + " ovaj broj nije ispravan! Molimo pokusajte ponovo"); } }
1,362
0.605727
0.600587
32
40.5625
40.171459
121
false
false
0
0
0
0
0
0
1.9375
false
false
9
c166f776c8da11d98f7c0bd727311670e06ef778
39,144,331,950,631
cc16a38859a219a0688ef179babd31160ff0fcd4
/src/guess_number_higher_or_lower_2/BadSolution.java
29427b86afb5ee8fe5bab7e508ca51bb564e3b03
[]
no_license
harperjiang/LeetCode
https://github.com/harperjiang/LeetCode
f1ab4ee796b3de1b2f0ec03ceb443908c20e68b1
83edba731e0070ab175e5cb42ea4ac3c0b1a90c8
refs/heads/master
2023-06-12T20:19:24.988000
2023-06-01T13:47:22
2023-06-01T13:47:22
94,937,003
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package guess_number_higher_or_lower_2; import java.text.MessageFormat; public class BadSolution { int[] recursive(int n) { if (n == 0) { return new int[]{-1, 0}; } if (n == 1) { return new int[]{0, 0}; } if (n == 2) { return new int[]{1, 1}; } if (n == 3) { return new int[]{2, 1}; } if (n == 4) { return new int[]{4, 2}; } if (n == 5) { return new int[]{6, 2}; } if (buffer[n] != null) { return buffer[n]; } int min = Integer.MAX_VALUE; int cmin = -1; int imindx = -1; for (int i = 1; i <= n; i++) { int[] fhalf = recursive(i - 1); int[] shalf = recursive(n - i); int imin, cimin; imin = i + Math.max(fhalf[0], shalf[0] + shalf[1] * i); cimin = Math.max(fhalf[1], shalf[1]) + 1; if (imin < min) { min = imin; cmin = cimin; imindx = i; } } System.out.println(MessageFormat.format("{0},{1}={2},{3}", n, imindx, min, cmin)); buffer[n] = new int[]{min, cmin}; return buffer[n]; } int[][] buffer = new int[201][]; public int getMoneyAmount(int n) { return recursive(n)[0]; } public static void main(String[] args) { System.out.println(new BadSolution().getMoneyAmount(62)); } }
UTF-8
Java
1,517
java
BadSolution.java
Java
[]
null
[]
package guess_number_higher_or_lower_2; import java.text.MessageFormat; public class BadSolution { int[] recursive(int n) { if (n == 0) { return new int[]{-1, 0}; } if (n == 1) { return new int[]{0, 0}; } if (n == 2) { return new int[]{1, 1}; } if (n == 3) { return new int[]{2, 1}; } if (n == 4) { return new int[]{4, 2}; } if (n == 5) { return new int[]{6, 2}; } if (buffer[n] != null) { return buffer[n]; } int min = Integer.MAX_VALUE; int cmin = -1; int imindx = -1; for (int i = 1; i <= n; i++) { int[] fhalf = recursive(i - 1); int[] shalf = recursive(n - i); int imin, cimin; imin = i + Math.max(fhalf[0], shalf[0] + shalf[1] * i); cimin = Math.max(fhalf[1], shalf[1]) + 1; if (imin < min) { min = imin; cmin = cimin; imindx = i; } } System.out.println(MessageFormat.format("{0},{1}={2},{3}", n, imindx, min, cmin)); buffer[n] = new int[]{min, cmin}; return buffer[n]; } int[][] buffer = new int[201][]; public int getMoneyAmount(int n) { return recursive(n)[0]; } public static void main(String[] args) { System.out.println(new BadSolution().getMoneyAmount(62)); } }
1,517
0.423863
0.398154
58
25.155172
18.124855
90
false
false
0
0
0
0
0
0
0.758621
false
false
9
a34cb6074f5e939b8b1dbceb79761f57495e70ad
38,517,266,735,236
be4762b7dce2621f2877031f44e4a276a0b20373
/Array.java
43c6a0edf8bfde4fb60b41107cea0ff770e8023d
[]
no_license
yoonserin/JAVA_study
https://github.com/yoonserin/JAVA_study
0da60e7e7309249b1b4e0c122147097cd9822ce6
7e35c6b5475a5a8420abdd77ed267e7a2bb40f0f
refs/heads/main
2023-06-12T08:22:01.031000
2021-07-09T12:17:35
2021-07-09T12:17:35
381,022,634
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package serin_java_practice; import java.util.Arrays; import java.util.Scanner; public class MainClass { public static void main(String[] args) { int[] arr1 = {1, 2, 3, 4, 5}; //배열의 초기화와 선언을 동시에 함 int[] arr2 = new int[5]; //크기가 5인 배열 멤버를 0으로 초기화 int[] arr3 = null; //배열을 null로 초기화 int[] arr4 = null; System.out.println(Arrays.toString(arr1)); System.out.println(Arrays.toString(arr2)); //Arrays.toString(arr): arr의 멤버 출력 arr3 = Arrays.copyOf(arr1, 3); //Arrays.copyOf(arr, n): arr의 멤버를 n번까지 복사 arr4 = arr1; //arr1 = arr2: arr2의 레퍼런스 = arr1의 레퍼런스 System.out.println(Arrays.toString(arr3)); System.out.println(Arrays.toString(arr4)); System.out.println(arr1); System.out.println(arr2); System.out.println(arr3); System.out.println(arr4); } }
UHC
Java
923
java
Array.java
Java
[]
null
[]
package serin_java_practice; import java.util.Arrays; import java.util.Scanner; public class MainClass { public static void main(String[] args) { int[] arr1 = {1, 2, 3, 4, 5}; //배열의 초기화와 선언을 동시에 함 int[] arr2 = new int[5]; //크기가 5인 배열 멤버를 0으로 초기화 int[] arr3 = null; //배열을 null로 초기화 int[] arr4 = null; System.out.println(Arrays.toString(arr1)); System.out.println(Arrays.toString(arr2)); //Arrays.toString(arr): arr의 멤버 출력 arr3 = Arrays.copyOf(arr1, 3); //Arrays.copyOf(arr, n): arr의 멤버를 n번까지 복사 arr4 = arr1; //arr1 = arr2: arr2의 레퍼런스 = arr1의 레퍼런스 System.out.println(Arrays.toString(arr3)); System.out.println(Arrays.toString(arr4)); System.out.println(arr1); System.out.println(arr2); System.out.println(arr3); System.out.println(arr4); } }
923
0.657143
0.621118
37
20.783783
15.423982
44
false
false
0
0
0
0
0
0
2.108108
false
false
9
387afb35f55b292686f272414e3c7d473aa99e2e
32,220,844,721,138
101921861d03adaf109dae16e742019cccb79f0f
/src/gridWorld2_Critter/Predator.java
e495928daeb21416fd6085ed24dc792975f81f6c
[]
no_license
ThomasTaubert/uebungen-aufgabenblaetter1617
https://github.com/ThomasTaubert/uebungen-aufgabenblaetter1617
fda0ca93bc4b0cf4095eac4064f14e3d1cf2d01a
ccf5c85993dff28ae95aae40f3a204ffff4abed7
refs/heads/master
2021-01-12T12:32:44.005000
2017-02-02T11:27:07
2017-02-02T11:27:07
72,548,271
0
0
null
true
2016-11-01T15:15:27
2016-11-01T15:15:27
2016-11-01T14:35:36
2016-11-01T14:18:12
2
0
0
0
null
null
null
package gridWorld2_Critter; import java.util.ArrayList; import gridworld.framework.actor.Actor; import gridworld.framework.actor.Critter; class Predator extends Critter { public Predator() { // TODO Auto-generated constructor stub } @Override public void processActors(ArrayList<Actor> actors){ for (Actor actor : actors){ if (actor instanceof BabyBug){ actor.removeSelfFromGrid(); break; } } } }
UTF-8
Java
453
java
Predator.java
Java
[]
null
[]
package gridWorld2_Critter; import java.util.ArrayList; import gridworld.framework.actor.Actor; import gridworld.framework.actor.Critter; class Predator extends Critter { public Predator() { // TODO Auto-generated constructor stub } @Override public void processActors(ArrayList<Actor> actors){ for (Actor actor : actors){ if (actor instanceof BabyBug){ actor.removeSelfFromGrid(); break; } } } }
453
0.688742
0.686534
24
16.875
16.783703
52
false
false
0
0
0
0
0
0
1.333333
false
false
9
fb37bdf4ae1e1045d8343780e14421797b18557e
36,421,322,716,434
731eabcec9375e233892c14802313ce058fdd317
/src/UpdateInfo.java
b5dd59174cfd0469d36fd3b7f3830f23ac0e3c02
[]
no_license
nmnsharma007/CaseStudy2_ATM
https://github.com/nmnsharma007/CaseStudy2_ATM
d798c0ec0a918b56366c71c925d1d77c70290333
ac178c22368bf76c852e8783ce9427466bbdf482
refs/heads/main
2023-01-08T09:08:55.871000
2020-11-10T11:03:22
2020-11-10T11:03:22
309,331,782
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class UpdateInfo extends Atm { public void start() {//start the updating process System.out.println("Press 1 to change your PIN"); System.out.println("Press 2 to change your registered mobile number"); System.out.println("Press any other number to go back"); int n = scan.nextInt(); if(n == 1) { System.out.println("Enter your account number"); int number = scan.nextInt(); int[] customer = database.fetch(number); if(customer[0] == -1) { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered account number doesn't exist"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } else { System.out.println("Enter your old pin"); int pin = scan.nextInt(); if(customer[1] == pin) { changePin(customer); } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered pin was wrong"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } } else if(n == 2) { System.out.println("Enter your account number"); int number = scan.nextInt(); int[] customer = database.fetch(number); if(customer[0] == -1) { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered account number doesn't exist"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } else { System.out.println("Enter your pin"); int pin = scan.nextInt(); if(customer[1] == pin) { changePhoneNumber(customer); } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered pin was wrong"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } } } public void changePin(int[] customer) {//method to change PIN System.out.println("We have sent you OTP on your registered mobile number.Please enter it"); int otp = super.showOtpMessage(customer); int enter = scan.nextInt(); if(otp == enter) { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("Enter a new pin. The pin must consist of exactly of 5 digits"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); int newPin = scan.nextInt(); if(Integer.toString(newPin).length() == 5) { database.updatePin(customer[0], Integer.valueOf(newPin)); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("Your pin as been changed succesfully"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered pin is not valid."); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered OTP was wrong or not entered"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } public void changePhoneNumber(int[] customer) {//method to change phone number System.out.println("We have sent you OTP on your old registered mobile number.Please enter it"); int otp = super.showOtpMessage(customer); int enter = scan.nextInt(); if(otp == enter) { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("Enter a new phone number. The phone number must consist of exactly of 6 digits"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); int newPhone = scan.nextInt(); if(Integer.toString(newPhone).length() == 6) { database.updatePhone(customer[0], Integer.valueOf(newPhone)); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("Your phone as been changed succesfully"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered phone is not valid."); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered OTP was wrong or not entered"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } }
UTF-8
Java
5,603
java
UpdateInfo.java
Java
[]
null
[]
public class UpdateInfo extends Atm { public void start() {//start the updating process System.out.println("Press 1 to change your PIN"); System.out.println("Press 2 to change your registered mobile number"); System.out.println("Press any other number to go back"); int n = scan.nextInt(); if(n == 1) { System.out.println("Enter your account number"); int number = scan.nextInt(); int[] customer = database.fetch(number); if(customer[0] == -1) { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered account number doesn't exist"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } else { System.out.println("Enter your old pin"); int pin = scan.nextInt(); if(customer[1] == pin) { changePin(customer); } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered pin was wrong"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } } else if(n == 2) { System.out.println("Enter your account number"); int number = scan.nextInt(); int[] customer = database.fetch(number); if(customer[0] == -1) { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered account number doesn't exist"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } else { System.out.println("Enter your pin"); int pin = scan.nextInt(); if(customer[1] == pin) { changePhoneNumber(customer); } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered pin was wrong"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } } } public void changePin(int[] customer) {//method to change PIN System.out.println("We have sent you OTP on your registered mobile number.Please enter it"); int otp = super.showOtpMessage(customer); int enter = scan.nextInt(); if(otp == enter) { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("Enter a new pin. The pin must consist of exactly of 5 digits"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); int newPin = scan.nextInt(); if(Integer.toString(newPin).length() == 5) { database.updatePin(customer[0], Integer.valueOf(newPin)); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("Your pin as been changed succesfully"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered pin is not valid."); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered OTP was wrong or not entered"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } public void changePhoneNumber(int[] customer) {//method to change phone number System.out.println("We have sent you OTP on your old registered mobile number.Please enter it"); int otp = super.showOtpMessage(customer); int enter = scan.nextInt(); if(otp == enter) { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("Enter a new phone number. The phone number must consist of exactly of 6 digits"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); int newPhone = scan.nextInt(); if(Integer.toString(newPhone).length() == 6) { database.updatePhone(customer[0], Integer.valueOf(newPhone)); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("Your phone as been changed succesfully"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered phone is not valid."); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } else { System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); System.out.println(); System.out.println("The entered OTP was wrong or not entered"); System.out.println(); System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } }
5,603
0.741032
0.738176
134
40.820896
32.539951
104
false
false
0
0
0
0
66
0.282706
3.80597
false
false
9
a85461b48ca4c09915044088086a87676de8bad9
33,801,392,682,997
332bb6832c2a5464fea3164c1fa02980865f3555
/HotelAdministrationSystem/src/database/DbConnection.java
7328e266006e5a9d3f7405dbfb64c55ef9bf80d8
[]
no_license
abk666/HotelAdministrationProject
https://github.com/abk666/HotelAdministrationProject
d5bad10633b07776cfb205762c887867c86d4087
b257da4787f9027cc8889706bd47264c63a145ac
refs/heads/master
2023-07-01T08:24:38.929000
2021-08-05T04:15:02
2021-08-05T04:15:02
387,466,182
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package database; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class DbConnection { private String url="jdbc:mysql://localhost:3308/hoteldb?useSSL=false"; private String user="root"; private String password="12345"; public Connection getConnection() { Connection connection=null; try { connection=DriverManager.getConnection(url, user, password); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return connection; } }
UTF-8
Java
521
java
DbConnection.java
Java
[ { "context": "vate String user=\"root\";\nprivate String password=\"12345\";\n\npublic Connection getConnection() {\n\tConnectio", "end": 267, "score": 0.999195396900177, "start": 262, "tag": "PASSWORD", "value": "12345" } ]
null
[]
package database; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class DbConnection { private String url="jdbc:mysql://localhost:3308/hoteldb?useSSL=false"; private String user="root"; private String password="<PASSWORD>"; public Connection getConnection() { Connection connection=null; try { connection=DriverManager.getConnection(url, user, password); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return connection; } }
526
0.765835
0.74856
23
21.652174
18.793173
70
false
false
0
0
0
0
0
0
1.043478
false
false
9
7bf1e7902a2b1f663cb182238332f9b61c5f2ea6
36,404,142,845,875
3eb90edb9e1e0d6bc880b60df03c32bfb3a4cf11
/src/main/java/com/it/wufen/single/lazy/Singleton4.java
cdc0a98bba1b35d4c8154ff82cf2121e8dc38553
[]
no_license
wufen1994/designModel
https://github.com/wufen1994/designModel
b28ae90172999c643c0521710b4d8c9c6e44786b
d821e7406af85805cb13f5e31d56782d8e2a32a6
refs/heads/master
2023-09-01T14:18:08.905000
2021-11-04T02:06:59
2021-11-04T02:06:59
422,516,863
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.it.wufen.single.lazy; /** * @创建人 wufeng * @创建时间 2021/9/10 * @描述 懒汉式-双重检查 **/ public class Singleton4 { private static volatile Singleton4 singleton4; private Singleton4(){} public static Singleton4 getSingleton4() { if (singleton4 == null){ synchronized (Singleton4.class){ if (singleton4 == null){ singleton4 = new Singleton4(); } } } return singleton4; } }
UTF-8
Java
525
java
Singleton4.java
Java
[ { "context": "package com.it.wufen.single.lazy;\n\n/**\n * @创建人 wufeng\n * @创建时间 2021/9/10\n * @描述 懒汉式-双重检查\n **/\npublic cl", "end": 53, "score": 0.9954957962036133, "start": 47, "tag": "USERNAME", "value": "wufeng" } ]
null
[]
package com.it.wufen.single.lazy; /** * @创建人 wufeng * @创建时间 2021/9/10 * @描述 懒汉式-双重检查 **/ public class Singleton4 { private static volatile Singleton4 singleton4; private Singleton4(){} public static Singleton4 getSingleton4() { if (singleton4 == null){ synchronized (Singleton4.class){ if (singleton4 == null){ singleton4 = new Singleton4(); } } } return singleton4; } }
525
0.543611
0.505071
22
21.40909
16.505259
50
false
false
0
0
0
0
0
0
0.181818
false
false
9
9a3500b91f7a602092260cb2245d38cd7a2b9d2b
39,745,627,363,835
a5ad3939625d56aca63b6f7327d363db102212fb
/src/main/java/com/stavshamir/bag/suggester/AliasSuggestion.java
033f3561f9d53dca21e7bf4c827f1081afaf5f29
[ "MIT" ]
permissive
stavshamir/bag
https://github.com/stavshamir/bag
d7de94266fbb2d053bb608a1aff8712f4b3eb145
7176c47cd893a858cad6021112497228a70eb593
refs/heads/master
2021-07-04T16:30:23.873000
2019-02-10T11:34:31
2019-02-10T11:34:31
135,985,614
42
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stavshamir.bag.suggester; import com.stavshamir.bag.alias.Alias; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class AliasSuggestion { private final Alias alias; private final long count; public AliasSuggestion(String command, long count) { this.alias = new Alias(suggestName(command), command); this.count = count; } public void setAliasName(String aliasName) { alias.setName(aliasName); } public Alias getAlias() { return alias; } public long getCount() { return count; } private String suggestName(String command) { List<String> words = Arrays .stream(command.split(" ")) .map(String::toLowerCase) .map(s -> s.replaceAll("[^a-z]", "")) .filter(s -> s.length() > 0) .collect(Collectors.toList()); if (words.size() > 1) { return suggestNameMultipleWords(words); } return suggestNameSingleWord(words.get(0)); } private String suggestNameSingleWord(String command) { return command .toLowerCase() .replaceAll("[^a-z]", "") .substring(0, 2); } private String suggestNameMultipleWords(List<String> words) { final int maxNameSize = 3; return words.stream() .limit(maxNameSize) .reduce("", (a, b) -> a + b.substring(0, 1)); } }
UTF-8
Java
1,522
java
AliasSuggestion.java
Java
[]
null
[]
package com.stavshamir.bag.suggester; import com.stavshamir.bag.alias.Alias; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class AliasSuggestion { private final Alias alias; private final long count; public AliasSuggestion(String command, long count) { this.alias = new Alias(suggestName(command), command); this.count = count; } public void setAliasName(String aliasName) { alias.setName(aliasName); } public Alias getAlias() { return alias; } public long getCount() { return count; } private String suggestName(String command) { List<String> words = Arrays .stream(command.split(" ")) .map(String::toLowerCase) .map(s -> s.replaceAll("[^a-z]", "")) .filter(s -> s.length() > 0) .collect(Collectors.toList()); if (words.size() > 1) { return suggestNameMultipleWords(words); } return suggestNameSingleWord(words.get(0)); } private String suggestNameSingleWord(String command) { return command .toLowerCase() .replaceAll("[^a-z]", "") .substring(0, 2); } private String suggestNameMultipleWords(List<String> words) { final int maxNameSize = 3; return words.stream() .limit(maxNameSize) .reduce("", (a, b) -> a + b.substring(0, 1)); } }
1,522
0.572273
0.567017
58
25.241379
20.008886
65
false
false
0
0
0
0
0
0
0.448276
false
false
9
a7403541fc1a13d32e88d860741d88be0a54e331
39,745,627,364,063
ebb59d1c5f24e221fe10e01f5ccd88316eadfff4
/DefaultMethodsTest.java
b60806a71e01020262df105d75471c80ae87699c
[]
no_license
shirishphatangare/Java_Eight_Practice
https://github.com/shirishphatangare/Java_Eight_Practice
2beb43ece8d9fab05e35c9c662b01bbca4741824
72995fe8970d15b4a9174b2c2b2c67f2c1a8f729
refs/heads/master
2020-04-02T07:05:03.779000
2018-10-24T01:10:15
2018-10-24T01:10:15
154,180,963
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Default methods functionality can be achieved with abstract classes (see AbtractClassTest class) .However, default methods in interfaces have a specific purpose concerning backward compatibility. * Before Java 8, interfaces could have only abstract methods. The implementation of these methods has to be provided in a separate class. * So, if a new method is to be added in an interface, then its implementation code has to be provided in the class implementing the same interface. * To overcome this issue, Java 8 has introduced the concept of default methods which allow the interfaces to have methods with implementation without * affecting the classes that implement the interface. */ public class DefaultMethodsTest implements TestDefaultMethod1,TestDefaultMethod2{ public static void main(String[] args) { DefaultMethodsTest test = new DefaultMethodsTest(); test.abstractMethod(); test.defaultMethod(); TestDefaultMethod1.staticDefaultMethod(); } @Override public void abstractMethod() { // For Abstract method with same signature, there is no issue because this method must be implemented in a class System.out.println("Inside Implemented abstract method.."); } // To avoid multiple inheritance issue, a default method with same signature (defaultMethod) in 2 interfaces (TestDefaultMethod1,TestDefaultMethod2) implemented by this class (DefaultMethodsTest) public void defaultMethod() { System.out.println("This is overidden default method "); // use super keyword to call the defaultMethods of TestDefaultMethod1 and TestDefaultMethod2 interfaces TestDefaultMethod1.super.defaultMethod(); TestDefaultMethod2.super.defaultMethod(); } } /* * Default methods enable you to add new functionality to existing interfaces and ensure binary compatibility with code written for older versions of those interfaces. * In particular, default methods enable you to add methods that accept lambda expressions as parameters to existing interfaces. */ interface TestDefaultMethod1{ public void abstractMethod(); default void defaultMethod() { System.out.println("Inside Default Method of TestDefaultMethod1 interface.."); } static void staticDefaultMethod(){ System.out.println("Inside Static Default Method of TestDefaultMethod1 interface.."); } } interface TestDefaultMethod2{ public void abstractMethod(); default void defaultMethod() { System.out.println("Inside Default Method of TestDefaultMethod2 interface.."); } } /* When you extend an interface that contains a default method, you can do the following: A) Not mention the default method at all, which lets your extended interface inherit the default method. B) Redeclare the default method, which makes it abstract. C) Redefine the default method, which overrides it. */
UTF-8
Java
2,812
java
DefaultMethodsTest.java
Java
[]
null
[]
/* * Default methods functionality can be achieved with abstract classes (see AbtractClassTest class) .However, default methods in interfaces have a specific purpose concerning backward compatibility. * Before Java 8, interfaces could have only abstract methods. The implementation of these methods has to be provided in a separate class. * So, if a new method is to be added in an interface, then its implementation code has to be provided in the class implementing the same interface. * To overcome this issue, Java 8 has introduced the concept of default methods which allow the interfaces to have methods with implementation without * affecting the classes that implement the interface. */ public class DefaultMethodsTest implements TestDefaultMethod1,TestDefaultMethod2{ public static void main(String[] args) { DefaultMethodsTest test = new DefaultMethodsTest(); test.abstractMethod(); test.defaultMethod(); TestDefaultMethod1.staticDefaultMethod(); } @Override public void abstractMethod() { // For Abstract method with same signature, there is no issue because this method must be implemented in a class System.out.println("Inside Implemented abstract method.."); } // To avoid multiple inheritance issue, a default method with same signature (defaultMethod) in 2 interfaces (TestDefaultMethod1,TestDefaultMethod2) implemented by this class (DefaultMethodsTest) public void defaultMethod() { System.out.println("This is overidden default method "); // use super keyword to call the defaultMethods of TestDefaultMethod1 and TestDefaultMethod2 interfaces TestDefaultMethod1.super.defaultMethod(); TestDefaultMethod2.super.defaultMethod(); } } /* * Default methods enable you to add new functionality to existing interfaces and ensure binary compatibility with code written for older versions of those interfaces. * In particular, default methods enable you to add methods that accept lambda expressions as parameters to existing interfaces. */ interface TestDefaultMethod1{ public void abstractMethod(); default void defaultMethod() { System.out.println("Inside Default Method of TestDefaultMethod1 interface.."); } static void staticDefaultMethod(){ System.out.println("Inside Static Default Method of TestDefaultMethod1 interface.."); } } interface TestDefaultMethod2{ public void abstractMethod(); default void defaultMethod() { System.out.println("Inside Default Method of TestDefaultMethod2 interface.."); } } /* When you extend an interface that contains a default method, you can do the following: A) Not mention the default method at all, which lets your extended interface inherit the default method. B) Redeclare the default method, which makes it abstract. C) Redefine the default method, which overrides it. */
2,812
0.785206
0.779161
67
40.925373
52.853024
199
false
false
0
0
0
0
0
0
1.104478
false
false
9
64bea4ec7396a8320522d17eaa8067a488f7f49f
39,015,482,961,043
e9c754dae8fb75b6e6bb4d85f26d8e449a697ad9
/src/main/java/com/ravunana/manda/service/dto/ClienteDTO.java
e6acf35c5d6b928d4b624d9d7ec48160f6320019
[]
no_license
ravunana/manda-negocio
https://github.com/ravunana/manda-negocio
2089848c2e6e3b417e4d16bfeb0e675a8cffdf82
3a30f454a3b59fc2ed159074b647f02d0b512353
refs/heads/develop
2022-12-25T06:56:56.414000
2020-06-19T11:07:55
2020-06-19T11:07:55
228,268,755
3
0
null
false
2022-12-16T04:42:18
2019-12-15T23:41:09
2020-06-19T11:08:33
2022-12-16T04:42:18
12,673
1
0
8
Java
false
false
package com.ravunana.manda.service.dto; import javax.validation.constraints.*; import java.io.Serializable; import java.util.Objects; import javax.persistence.Lob; /** * A DTO for the {@link com.ravunana.manda.domain.Cliente} entity. */ public class ClienteDTO implements Serializable { private Long id; private Boolean ativo; @Lob private String perfilProfissional; private Double satisfacao; private Double frequencia; private String canalUsado; @NotNull private String numero; private Boolean autofacturacao; private Long pessoaId; private String pessoaNome; private Long contaId; private String contaDescricao; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Boolean isAtivo() { return ativo; } public void setAtivo(Boolean ativo) { this.ativo = ativo; } public String getPerfilProfissional() { return perfilProfissional; } public void setPerfilProfissional(String perfilProfissional) { this.perfilProfissional = perfilProfissional; } public Double getSatisfacao() { return satisfacao; } public void setSatisfacao(Double satisfacao) { this.satisfacao = satisfacao; } public Double getFrequencia() { return frequencia; } public void setFrequencia(Double frequencia) { this.frequencia = frequencia; } public String getCanalUsado() { return canalUsado; } public void setCanalUsado(String canalUsado) { this.canalUsado = canalUsado; } public String getNumero() { return numero; } public void setNumero(String numero) { this.numero = numero; } public Boolean isAutofacturacao() { return autofacturacao; } public void setAutofacturacao(Boolean autofacturacao) { this.autofacturacao = autofacturacao; } public Long getPessoaId() { return pessoaId; } public void setPessoaId(Long pessoaId) { this.pessoaId = pessoaId; } public String getPessoaNome() { return pessoaNome; } public void setPessoaNome(String pessoaNome) { this.pessoaNome = pessoaNome; } public Long getContaId() { return contaId; } public void setContaId(Long contaId) { this.contaId = contaId; } public String getContaDescricao() { return contaDescricao; } public void setContaDescricao(String contaDescricao) { this.contaDescricao = contaDescricao; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ClienteDTO clienteDTO = (ClienteDTO) o; if (clienteDTO.getId() == null || getId() == null) { return false; } return Objects.equals(getId(), clienteDTO.getId()); } @Override public int hashCode() { return Objects.hashCode(getId()); } @Override public String toString() { return "ClienteDTO{" + "id=" + getId() + ", ativo='" + isAtivo() + "'" + ", perfilProfissional='" + getPerfilProfissional() + "'" + ", satisfacao=" + getSatisfacao() + ", frequencia=" + getFrequencia() + ", canalUsado='" + getCanalUsado() + "'" + ", numero='" + getNumero() + "'" + ", autofacturacao='" + isAutofacturacao() + "'" + ", pessoa=" + getPessoaId() + ", pessoa='" + getPessoaNome() + "'" + ", conta=" + getContaId() + ", conta='" + getContaDescricao() + "'" + "}"; } }
UTF-8
Java
3,834
java
ClienteDTO.java
Java
[]
null
[]
package com.ravunana.manda.service.dto; import javax.validation.constraints.*; import java.io.Serializable; import java.util.Objects; import javax.persistence.Lob; /** * A DTO for the {@link com.ravunana.manda.domain.Cliente} entity. */ public class ClienteDTO implements Serializable { private Long id; private Boolean ativo; @Lob private String perfilProfissional; private Double satisfacao; private Double frequencia; private String canalUsado; @NotNull private String numero; private Boolean autofacturacao; private Long pessoaId; private String pessoaNome; private Long contaId; private String contaDescricao; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Boolean isAtivo() { return ativo; } public void setAtivo(Boolean ativo) { this.ativo = ativo; } public String getPerfilProfissional() { return perfilProfissional; } public void setPerfilProfissional(String perfilProfissional) { this.perfilProfissional = perfilProfissional; } public Double getSatisfacao() { return satisfacao; } public void setSatisfacao(Double satisfacao) { this.satisfacao = satisfacao; } public Double getFrequencia() { return frequencia; } public void setFrequencia(Double frequencia) { this.frequencia = frequencia; } public String getCanalUsado() { return canalUsado; } public void setCanalUsado(String canalUsado) { this.canalUsado = canalUsado; } public String getNumero() { return numero; } public void setNumero(String numero) { this.numero = numero; } public Boolean isAutofacturacao() { return autofacturacao; } public void setAutofacturacao(Boolean autofacturacao) { this.autofacturacao = autofacturacao; } public Long getPessoaId() { return pessoaId; } public void setPessoaId(Long pessoaId) { this.pessoaId = pessoaId; } public String getPessoaNome() { return pessoaNome; } public void setPessoaNome(String pessoaNome) { this.pessoaNome = pessoaNome; } public Long getContaId() { return contaId; } public void setContaId(Long contaId) { this.contaId = contaId; } public String getContaDescricao() { return contaDescricao; } public void setContaDescricao(String contaDescricao) { this.contaDescricao = contaDescricao; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ClienteDTO clienteDTO = (ClienteDTO) o; if (clienteDTO.getId() == null || getId() == null) { return false; } return Objects.equals(getId(), clienteDTO.getId()); } @Override public int hashCode() { return Objects.hashCode(getId()); } @Override public String toString() { return "ClienteDTO{" + "id=" + getId() + ", ativo='" + isAtivo() + "'" + ", perfilProfissional='" + getPerfilProfissional() + "'" + ", satisfacao=" + getSatisfacao() + ", frequencia=" + getFrequencia() + ", canalUsado='" + getCanalUsado() + "'" + ", numero='" + getNumero() + "'" + ", autofacturacao='" + isAutofacturacao() + "'" + ", pessoa=" + getPessoaId() + ", pessoa='" + getPessoaNome() + "'" + ", conta=" + getContaId() + ", conta='" + getContaDescricao() + "'" + "}"; } }
3,834
0.584768
0.584768
173
21.16185
19.27313
70
false
false
0
0
0
0
0
0
0.369942
false
false
9
11992cea45c1ce4533f2b7a30375a9133a7397b0
39,015,482,959,521
8c197fd714e5fec908acaae8201ea8c9bb537d80
/javamodule/src/myjava/MyJavaClass.java
285549f1432141d9ac9854cdd6350826448128f0
[]
no_license
fanmingyi/ProtocGradlePlugin
https://github.com/fanmingyi/ProtocGradlePlugin
51e1ffb57b4998202096d22a7f2dbe1aa2af0c7a
fb3386c7cbd03035863bd79cee8a316becd883ba
refs/heads/main
2023-01-25T02:12:21.496000
2020-12-06T12:26:41
2020-12-06T12:26:41
318,745,876
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class MyJavaClass { }
UTF-8
Java
29
java
MyJavaClass.java
Java
[]
null
[]
public class MyJavaClass { }
29
0.758621
0.758621
2
13.5
12.5
26
false
false
0
0
0
0
0
0
0
false
false
9
9027ee9285d9c8a8c85750173070f7412d80ac83
34,711,925,741,539
86430693abce1cea967e753f6d921a54dc4e24d8
/Client/computeragent/src/Service/DiskUsingParser.java
ffc5ce149112f4dcd2fbc192205ad2686f3ee72f
[]
no_license
herongbo/monitor
https://github.com/herongbo/monitor
7ac605fea78754e6a3294c050fa301af62acc554
fd3900076691194c3dc803ab7697f6071231fa92
refs/heads/master
2020-03-21T13:09:35.361000
2019-08-12T13:21:36
2019-08-12T13:21:36
138,590,908
2
0
null
false
2020-07-17T03:50:33
2018-06-25T12:17:32
2020-07-17T03:43:26
2020-07-17T03:50:31
19,198
1
0
0
JavaScript
false
false
package Service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import utils.ReflectionUtils; import utils.StringFormat; import Entity.CpuInfoEntity; import Entity.DiskInfoEntity; import Entity.DiskUsingEntity; public class DiskUsingParser { public DiskUsingEntity parse(List<String> list) { DiskUsingEntity diskEntity=new DiskUsingEntity(); DiskUsingEntity.Disk_core diskEntityCore=new DiskUsingEntity.Disk_core(); diskEntity.disk_list.add(diskEntityCore); String[] row=StringFormat.removeMoreSpace(list.get(0)).split(" "); for(int i=1;i<list.size();i++) { String[] str=StringFormat.removeMoreSpace(list.get(i)).split(" "); for(int j=1;j<str.length;j++) { try { //1block不能通过反射注入 if(row[j-1].trim().equals("1K-blocks")) { diskEntityCore.setOnek_blocks(str[j-1]); }else { new ReflectionUtils().invokeSetterMethod(diskEntityCore, StringFormat.formatKey(row[j-1]), str[j-1]); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } //一组数据解析完成创建新对象 DiskUsingEntity.Disk_core diskEntityCoreTemp=diskEntityCore; diskEntity.disk_list.add(diskEntityCoreTemp); diskEntityCore=new DiskUsingEntity.Disk_core(); } return diskEntity; } }
UTF-8
Java
1,378
java
DiskUsingParser.java
Java
[]
null
[]
package Service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import utils.ReflectionUtils; import utils.StringFormat; import Entity.CpuInfoEntity; import Entity.DiskInfoEntity; import Entity.DiskUsingEntity; public class DiskUsingParser { public DiskUsingEntity parse(List<String> list) { DiskUsingEntity diskEntity=new DiskUsingEntity(); DiskUsingEntity.Disk_core diskEntityCore=new DiskUsingEntity.Disk_core(); diskEntity.disk_list.add(diskEntityCore); String[] row=StringFormat.removeMoreSpace(list.get(0)).split(" "); for(int i=1;i<list.size();i++) { String[] str=StringFormat.removeMoreSpace(list.get(i)).split(" "); for(int j=1;j<str.length;j++) { try { //1block不能通过反射注入 if(row[j-1].trim().equals("1K-blocks")) { diskEntityCore.setOnek_blocks(str[j-1]); }else { new ReflectionUtils().invokeSetterMethod(diskEntityCore, StringFormat.formatKey(row[j-1]), str[j-1]); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } //一组数据解析完成创建新对象 DiskUsingEntity.Disk_core diskEntityCoreTemp=diskEntityCore; diskEntity.disk_list.add(diskEntityCoreTemp); diskEntityCore=new DiskUsingEntity.Disk_core(); } return diskEntity; } }
1,378
0.70509
0.698353
49
26.265306
23.43186
108
false
false
0
0
0
0
0
0
3.102041
false
false
9
23160f36f7280e9c0680bafc6a1f56b65ab3a0e5
38,225,208,963,306
4ec455cafb0922891bae84fedae8379a366d5f37
/src/main/controllers/ControllerAbout.java
4b730361673ebd808240a43574a4487b80cb0ff6
[]
no_license
Malatan/SimplerSchool
https://github.com/Malatan/SimplerSchool
8a47481f5e5ee5f7e21c0fc5edadf4886135b430
822d10d9cb87dc06d3eecc98a8d58c10bad4a810
refs/heads/master
2022-07-12T13:20:44.711000
2019-06-08T00:22:49
2019-06-08T00:22:49
169,471,518
0
0
null
true
2019-02-06T20:25:38
2019-02-06T20:25:38
2019-02-06T18:37:11
2019-02-06T18:37:10
4,973
0
0
0
null
false
null
package main.controllers; import com.jfoenix.controls.JFXButton; import javafx.fxml.FXML; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; import main.utils.Console; import main.utils.LanguageBundle; import main.utils.WindowStyle; public class ControllerAbout { @FXML private AnchorPane subContentPane; @FXML private JFXButton closeBtn; public void initialize() { Console.print("Opening about gui", "gui"); initLangBindings(); AnchorPane.setBottomAnchor(subContentPane, 0.0); AnchorPane.setTopAnchor(subContentPane, 0.0); AnchorPane.setLeftAnchor(subContentPane, 0.0); AnchorPane.setRightAnchor(subContentPane, 0.0); } public void initLangBindings() { closeBtn.setText(LanguageBundle.get("close")); } @FXML public void close() { WindowStyle.close((Stage) subContentPane.getScene().getWindow()); } }
UTF-8
Java
866
java
ControllerAbout.java
Java
[]
null
[]
package main.controllers; import com.jfoenix.controls.JFXButton; import javafx.fxml.FXML; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; import main.utils.Console; import main.utils.LanguageBundle; import main.utils.WindowStyle; public class ControllerAbout { @FXML private AnchorPane subContentPane; @FXML private JFXButton closeBtn; public void initialize() { Console.print("Opening about gui", "gui"); initLangBindings(); AnchorPane.setBottomAnchor(subContentPane, 0.0); AnchorPane.setTopAnchor(subContentPane, 0.0); AnchorPane.setLeftAnchor(subContentPane, 0.0); AnchorPane.setRightAnchor(subContentPane, 0.0); } public void initLangBindings() { closeBtn.setText(LanguageBundle.get("close")); } @FXML public void close() { WindowStyle.close((Stage) subContentPane.getScene().getWindow()); } }
866
0.755196
0.745958
36
23.055555
18.612936
67
false
false
0
0
0
0
0
0
1.388889
false
false
9
df8751188037884bcafcf8e6b4cc1680fae7af30
22,960,895,187,230
e26489a87aa8196ca45b8f32ff34e27987804472
/src/main/java/com/web/data/pojo/Notification.java
54ab5048e39040c8d8f6e0d610b6e76f1ac23c7c
[]
no_license
shulaoh/springmvc_mybatis_project
https://github.com/shulaoh/springmvc_mybatis_project
2e0c07459a005ea0f928f9d8b1fd2bcd885726d0
b81f82ab0261e10fae313677ec3bbb0a0484264d
refs/heads/master
2020-03-21T13:04:18.654000
2018-07-29T01:31:27
2018-07-29T01:31:27
138,586,386
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.web.data.pojo; import java.sql.Timestamp; public class Notification { private String notificationId; public String getNotificationId() { return notificationId; } public void setNotificationId(String notificationId) { this.notificationId = notificationId; } private String userId; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getLessonId() { return lessonId; } public void setLessonId(String lessonId) { this.lessonId = lessonId; } public String getNotificationType() { return notificationType; } public void setNotificationType(String notificationType) { this.notificationType = notificationType; } public Timestamp getNotificationDatetime() { return notificationDatetime; } public void setNotificationDatetime(Timestamp notificationDatetime) { this.notificationDatetime = notificationDatetime; } private String lessonId; private String notificationType; private Timestamp notificationDatetime; private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
UTF-8
Java
1,360
java
Notification.java
Java
[]
null
[]
package com.web.data.pojo; import java.sql.Timestamp; public class Notification { private String notificationId; public String getNotificationId() { return notificationId; } public void setNotificationId(String notificationId) { this.notificationId = notificationId; } private String userId; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getLessonId() { return lessonId; } public void setLessonId(String lessonId) { this.lessonId = lessonId; } public String getNotificationType() { return notificationType; } public void setNotificationType(String notificationType) { this.notificationType = notificationType; } public Timestamp getNotificationDatetime() { return notificationDatetime; } public void setNotificationDatetime(Timestamp notificationDatetime) { this.notificationDatetime = notificationDatetime; } private String lessonId; private String notificationType; private Timestamp notificationDatetime; private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
1,360
0.672059
0.672059
66
19.60606
19.77516
73
false
false
0
0
0
0
0
0
0.30303
false
false
9
2bd42bb69b759fa421dc379388cda19c23310bd3
32,908,039,437,114
72640b4d6433ae719ea3b453045f0bb7b950d6fe
/app/src/main/java/com/example/firebasecrud/BakiUser.java
ef04b601abaaed4a327feb435f8c2ee544aca7de
[]
no_license
shahkutub/FirebaseCrud
https://github.com/shahkutub/FirebaseCrud
81bb81f42471a7e8e90e870e257f5992f62aef26
17f26c170faa1bedc5de9e3a81c9ede346a91ccf
refs/heads/master
2023-02-21T07:07:29.413000
2021-01-07T09:51:59
2021-01-07T09:51:59
325,753,158
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.firebasecrud; import com.google.firebase.database.IgnoreExtraProperties; @IgnoreExtraProperties public class BakiUser { private String name; private String address; private String total_price; private String initial_pay; private String current_due; private String jamanot_name; private String jamanot_mobile; private String grohon_date; private String commitment_to_pay_date; public BakiUser() { } public BakiUser(String name, String address, String total_price, String initial_pay, String current_due, String jamanot_name, String jamanot_mobile, String grohon_date, String commitment_to_pay_date) { this.name = name; this.address = address; this.total_price = total_price; this.initial_pay = initial_pay; this.current_due = current_due; this.jamanot_name = jamanot_name; this.jamanot_mobile = jamanot_mobile; this.grohon_date = grohon_date; this.commitment_to_pay_date = commitment_to_pay_date; } public String getGrohon_date() { return grohon_date; } public void setGrohon_date(String grohon_date) { this.grohon_date = grohon_date; } public String getCommitment_to_pay_date() { return commitment_to_pay_date; } public void setCommitment_to_pay_date(String commitment_to_pay_date) { this.commitment_to_pay_date = commitment_to_pay_date; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getTotal_price() { return total_price; } public void setTotal_price(String total_price) { this.total_price = total_price; } public String getInitial_pay() { return initial_pay; } public void setInitial_pay(String initial_pay) { this.initial_pay = initial_pay; } public String getCurrent_due() { return current_due; } public void setCurrent_due(String current_due) { this.current_due = current_due; } public String getJamanot_name() { return jamanot_name; } public void setJamanot_name(String jamanot_name) { this.jamanot_name = jamanot_name; } public String getJamanot_mobile() { return jamanot_mobile; } public void setJamanot_mobile(String jamanot_mobile) { this.jamanot_mobile = jamanot_mobile; } }
UTF-8
Java
2,621
java
BakiUser.java
Java
[ { "context": "ring commitment_to_pay_date) {\n this.name = name;\n this.address = address;\n this.tot", "end": 697, "score": 0.5357643961906433, "start": 693, "tag": "NAME", "value": "name" } ]
null
[]
package com.example.firebasecrud; import com.google.firebase.database.IgnoreExtraProperties; @IgnoreExtraProperties public class BakiUser { private String name; private String address; private String total_price; private String initial_pay; private String current_due; private String jamanot_name; private String jamanot_mobile; private String grohon_date; private String commitment_to_pay_date; public BakiUser() { } public BakiUser(String name, String address, String total_price, String initial_pay, String current_due, String jamanot_name, String jamanot_mobile, String grohon_date, String commitment_to_pay_date) { this.name = name; this.address = address; this.total_price = total_price; this.initial_pay = initial_pay; this.current_due = current_due; this.jamanot_name = jamanot_name; this.jamanot_mobile = jamanot_mobile; this.grohon_date = grohon_date; this.commitment_to_pay_date = commitment_to_pay_date; } public String getGrohon_date() { return grohon_date; } public void setGrohon_date(String grohon_date) { this.grohon_date = grohon_date; } public String getCommitment_to_pay_date() { return commitment_to_pay_date; } public void setCommitment_to_pay_date(String commitment_to_pay_date) { this.commitment_to_pay_date = commitment_to_pay_date; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getTotal_price() { return total_price; } public void setTotal_price(String total_price) { this.total_price = total_price; } public String getInitial_pay() { return initial_pay; } public void setInitial_pay(String initial_pay) { this.initial_pay = initial_pay; } public String getCurrent_due() { return current_due; } public void setCurrent_due(String current_due) { this.current_due = current_due; } public String getJamanot_name() { return jamanot_name; } public void setJamanot_name(String jamanot_name) { this.jamanot_name = jamanot_name; } public String getJamanot_mobile() { return jamanot_mobile; } public void setJamanot_mobile(String jamanot_mobile) { this.jamanot_mobile = jamanot_mobile; } }
2,621
0.645555
0.645555
104
24.201923
26.3053
205
false
false
0
0
0
0
0
0
0.442308
false
false
9
de8b0678926d1ccaa3a7dc62393318fb2e4b35f2
32,667,521,271,363
ce8104fca92ac709da37375fbb5c30ad4cd87035
/foodinfo/src/main/java/com/foodinfo/repository/FoodItemInventoryRespository.java
1ac4f0e2e612de069f58f9b390e14c2f2e7ab936
[]
no_license
jxchap/Grocery_Store_foodinfoMicroservice
https://github.com/jxchap/Grocery_Store_foodinfoMicroservice
a2b271ae53c6c62e231dc64f12d6808f684e6949
48806d0628df041e401f49702f15ee6f73b8ae1d
refs/heads/master
2023-04-25T15:09:14.328000
2021-05-17T05:06:47
2021-05-17T05:06:47
368,059,141
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.foodinfo.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import com.foodinfo.domain.FoodItemInventory; public interface FoodItemInventoryRespository extends JpaRepository<FoodItemInventory, Long>{ List<FoodItemInventory> findByFoodItemIdOrderByExpirationDateAsc(long foodItemId); }
UTF-8
Java
351
java
FoodItemInventoryRespository.java
Java
[]
null
[]
package com.foodinfo.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import com.foodinfo.domain.FoodItemInventory; public interface FoodItemInventoryRespository extends JpaRepository<FoodItemInventory, Long>{ List<FoodItemInventory> findByFoodItemIdOrderByExpirationDateAsc(long foodItemId); }
351
0.851852
0.851852
13
26
32.823536
93
false
false
0
0
0
0
0
0
0.615385
false
false
9
2c640ae4119f691eedbde2df7a9d35a08a84071b
10,204,842,314,878
62dd6f93402ee9fe30917ebb21665b0473ec4fec
/src/main/java/me/finn/tson/util/TypeUtil.java
6baef43256cfd52a71b8e0f34943fac6542ba59c
[]
no_license
Taptzuz/Tson
https://github.com/Taptzuz/Tson
7b0caabd1dda72c9597e8c4902ed6eeb2606be9b
4071a82732277cef3ae5e57f950068c396aa2f60
refs/heads/master
2023-07-11T05:25:39.854000
2021-08-22T02:27:10
2021-08-22T02:27:10
374,428,934
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.finn.tson.util; import java.util.HashSet; import java.util.Set; /** * @author Finn on 25.05.2021 */ public class TypeUtil { private static final Set<Class<?>> primitiveTypes = new HashSet<>(), objectTypes = new HashSet<>(); static { objectTypes.add(String.class); objectTypes.add(Boolean.class); objectTypes.add(Character.class); objectTypes.add(Number.class); objectTypes.add(Byte.class); objectTypes.add(Short.class); objectTypes.add(Integer.class); objectTypes.add(Long.class); objectTypes.add(Float.class); objectTypes.add(Double.class); primitiveTypes.add(boolean.class); primitiveTypes.add(char.class); primitiveTypes.add(byte.class); primitiveTypes.add(short.class); primitiveTypes.add(int.class); primitiveTypes.add(long.class); primitiveTypes.add(float.class); primitiveTypes.add(double.class); } public static Set<Class<?>> getPrimitiveTypes() { return primitiveTypes; } public static Set<Class<?>> getObjectTypes() { return objectTypes; } }
UTF-8
Java
1,160
java
TypeUtil.java
Java
[ { "context": "til.HashSet;\nimport java.util.Set;\n\n/**\n * @author Finn on 25.05.2021\n */\npublic class TypeUtil {\n\n pr", "end": 96, "score": 0.7066494226455688, "start": 92, "tag": "USERNAME", "value": "Finn" } ]
null
[]
package me.finn.tson.util; import java.util.HashSet; import java.util.Set; /** * @author Finn on 25.05.2021 */ public class TypeUtil { private static final Set<Class<?>> primitiveTypes = new HashSet<>(), objectTypes = new HashSet<>(); static { objectTypes.add(String.class); objectTypes.add(Boolean.class); objectTypes.add(Character.class); objectTypes.add(Number.class); objectTypes.add(Byte.class); objectTypes.add(Short.class); objectTypes.add(Integer.class); objectTypes.add(Long.class); objectTypes.add(Float.class); objectTypes.add(Double.class); primitiveTypes.add(boolean.class); primitiveTypes.add(char.class); primitiveTypes.add(byte.class); primitiveTypes.add(short.class); primitiveTypes.add(int.class); primitiveTypes.add(long.class); primitiveTypes.add(float.class); primitiveTypes.add(double.class); } public static Set<Class<?>> getPrimitiveTypes() { return primitiveTypes; } public static Set<Class<?>> getObjectTypes() { return objectTypes; } }
1,160
0.643103
0.636207
42
26.619047
20.801731
103
false
false
0
0
0
0
0
0
0.595238
false
false
9
d4c144ae0f3c9c9a124d73cb3958ce84b3979b9e
15,075,335,231,968
a4a7c13c70956c33516726d10b0badd139f4db23
/src/test/java/site/zhanghao/test/TTParkCMS/PayInfoServiceTest.java
c11c15505864b3b7bbfe44befc4080f9ba9ae17a
[]
no_license
605901202/SpringBootDemo
https://github.com/605901202/SpringBootDemo
20900add94505d01d22f9dc21b2de9d6cca11778
cda6bf4d65ca0c22851feb4cbdc1f19144916dd4
refs/heads/master
2018-04-05T13:42:50.898000
2016-12-19T00:29:14
2016-12-19T00:29:14
72,060,028
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package site.zhanghao.test.TTParkCMS; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import site.zhanghao.service.PayInfoService; /** * Created by 张昊 on 2016/12/15. */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest public class PayInfoServiceTest { @Autowired private PayInfoService payInfoService; @Test public void test() throws Exception { /** * 0:全部 * 1:现金 * 2:银联 * 3:RFID * 4:优惠券 * 5:支付宝 * 6:微信支付 */ payInfoService.getPayInfoByPayTypeCode("1"); } }
UTF-8
Java
873
java
PayInfoServiceTest.java
Java
[ { "context": "anghao.service.PayInfoService;\n\n/**\n * Created by 张昊 on 2016/12/15.\n */\n@RunWith(SpringJUnit4ClassRunn", "end": 408, "score": 0.5844402313232422, "start": 406, "tag": "USERNAME", "value": "张昊" } ]
null
[]
package site.zhanghao.test.TTParkCMS; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import site.zhanghao.service.PayInfoService; /** * Created by 张昊 on 2016/12/15. */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest public class PayInfoServiceTest { @Autowired private PayInfoService payInfoService; @Test public void test() throws Exception { /** * 0:全部 * 1:现金 * 2:银联 * 3:RFID * 4:优惠券 * 5:支付宝 * 6:微信支付 */ payInfoService.getPayInfoByPayTypeCode("1"); } }
873
0.684588
0.661888
36
22.25
19.710932
71
false
false
0
0
0
0
0
0
0.277778
false
false
9
169d5eb61dbf78adb5ea46bf83e3c933e745378f
16,655,883,193,058
e9c5caaa0ff77631bae1bf98a039408c1f547e36
/src/pkagent/LeftAntenna.java
3c971770de5a0b0fdc19cb3fabc633ac3a2f13f7
[]
no_license
sc4brain/CPTSimulator
https://github.com/sc4brain/CPTSimulator
537e19135b6b07e1fa9cee7bfe6945ddf992d4de
c155c8727ea28a7cb075135799f3398aa09fcf9e
refs/heads/master
2021-01-24T22:36:21.590000
2013-11-01T05:41:18
2013-11-01T05:41:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pkagent; import java.awt.geom.Point2D; import pkfield.Field; public class LeftAntenna implements OdorSensor { private Point2D.Double gp; private double angle; private Point2D.Double spL; private double k = 5; // mm private double f = 10; //mm private boolean stimuL = false; private Field fd; public LeftAntenna(Field fd_, Point2D.Double gp_, double angle_){ fd = fd_; gp = gp_; angle = angle_; spL = new Point2D.Double(gp.x + f * Math.cos(angle) + k * Math.cos(angle + Math.PI / 2), gp.y + f * Math.sin(angle) + k * Math.sin(angle + Math.PI / 2)); } public void move(Point2D.Double gp_, double angle_){ gp = gp_; angle = angle_; spL.setLocation(gp.x + f * Math.cos(angle) + k * Math.cos(angle + Math.PI / 2), gp.y + f * Math.sin(angle)+ k * Math.sin(angle + Math.PI / 2)); } public boolean isSense(double rand){ stimuL = false; if (rand <= fd.getRate(spL.x, spL.y)) { stimuL = true; } //System.out.print(fd.getRate(spL.x, spL.y) + " "); return stimuL; } public double getPotential(){ return -1; } public Point2D.Double getap() { return spL; } }
UTF-8
Java
1,133
java
LeftAntenna.java
Java
[]
null
[]
package pkagent; import java.awt.geom.Point2D; import pkfield.Field; public class LeftAntenna implements OdorSensor { private Point2D.Double gp; private double angle; private Point2D.Double spL; private double k = 5; // mm private double f = 10; //mm private boolean stimuL = false; private Field fd; public LeftAntenna(Field fd_, Point2D.Double gp_, double angle_){ fd = fd_; gp = gp_; angle = angle_; spL = new Point2D.Double(gp.x + f * Math.cos(angle) + k * Math.cos(angle + Math.PI / 2), gp.y + f * Math.sin(angle) + k * Math.sin(angle + Math.PI / 2)); } public void move(Point2D.Double gp_, double angle_){ gp = gp_; angle = angle_; spL.setLocation(gp.x + f * Math.cos(angle) + k * Math.cos(angle + Math.PI / 2), gp.y + f * Math.sin(angle)+ k * Math.sin(angle + Math.PI / 2)); } public boolean isSense(double rand){ stimuL = false; if (rand <= fd.getRate(spL.x, spL.y)) { stimuL = true; } //System.out.print(fd.getRate(spL.x, spL.y) + " "); return stimuL; } public double getPotential(){ return -1; } public Point2D.Double getap() { return spL; } }
1,133
0.631068
0.617829
50
21.66
21.290947
81
false
false
0
0
0
0
0
0
1.96
false
false
9
a81a64c5a0015c449c509bdfde8600d87815ea94
29,231,547,443,163
51b5ceb96cc3e089705cfc6377666664640c37b2
/src/com/telezone/services/ISetCoordinate.java
6cc9dab916236062a45ada18ee90ba2e464a07f6
[]
no_license
penglingnuo/kj133
https://github.com/penglingnuo/kj133
fdbd28e7c5e082198312d7d286e81a4d4b6c6a20
bb1e78c04a869dad00f0bd21a9c21b361b7443da
refs/heads/master
2021-01-13T03:44:10.374000
2016-12-24T15:16:30
2016-12-24T15:16:30
77,226,569
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.telezone.services; import java.util.List; import java.util.Map; public interface ISetCoordinate { /** * * * @Date 2010 - 08 - 15 * * @author LYee * * @return String */ String saveXYOfCardreaderOrLocator(String type, String id, String x, String y, String mapid); /** * * * @Date 2010 - 08 - 15 * * @author LYee * * @return Map */ Map GetAllCoordinate(); /** * * @param cardid * @return */ List GetCardReader(String cardid); }
UTF-8
Java
498
java
ISetCoordinate.java
Java
[ { "context": " * \n\t * \n\t * @Date 2010 - 08 - 15\n\t * \n\t * @author LYee\n\t * \n\t * @return String\n\t */\n\tString saveXYOfCard", "end": 174, "score": 0.9785743355751038, "start": 170, "tag": "USERNAME", "value": "LYee" }, { "context": " * \n\t * \n\t * @Date 2010 - 08 - 15\n\t * \n\t * @author LYee\n\t * \n\t * @return Map\n\t */\n\tMap GetAllCoordinate()", "end": 362, "score": 0.975675106048584, "start": 358, "tag": "USERNAME", "value": "LYee" } ]
null
[]
package com.telezone.services; import java.util.List; import java.util.Map; public interface ISetCoordinate { /** * * * @Date 2010 - 08 - 15 * * @author LYee * * @return String */ String saveXYOfCardreaderOrLocator(String type, String id, String x, String y, String mapid); /** * * * @Date 2010 - 08 - 15 * * @author LYee * * @return Map */ Map GetAllCoordinate(); /** * * @param cardid * @return */ List GetCardReader(String cardid); }
498
0.594378
0.562249
36
12.833333
17.067677
94
false
false
0
0
0
0
0
0
1.027778
false
false
9
dbfb92530d10076c9526f7b6d7279e85bd81c97b
11,699,490,947,013
2a03338d627f40300dd502460bcd7681e97ab86a
/app/src/main/java/github/a3sung/dreammemo/LocalDreamAdapter.java
0747d24cbba4c92f303b445c4fe315ecfd8fd508
[]
no_license
3sung/dream_memo_android
https://github.com/3sung/dream_memo_android
43a5841fdc56a0cc1ee86fb370bf5afbf4396a27
b8846c4a2d522e2c70944eb11cc2335225393ffc
refs/heads/master
2020-04-08T16:21:40.544000
2018-12-13T05:28:29
2018-12-13T05:28:29
159,515,128
0
1
null
false
2018-12-01T08:52:28
2018-11-28T14:32:06
2018-11-28T16:23:01
2018-12-01T08:52:27
133
0
1
0
Java
false
null
package github.a3sung.dreammemo; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import org.w3c.dom.Text; import java.util.ArrayList; import java.util.List; public class LocalDreamAdapter extends BaseAdapter { private List<BoardDream> itemList; public LocalDreamAdapter(List<BoardDream> dataSet){ itemList = dataSet; } @Override public int getCount() { return itemList.size(); } @Override public Object getItem(int i) { return itemList.get(i); } @Override public long getItemId(int i) { return i; } @Override public View getView(int position, View view, ViewGroup viewGroup) { final int pos = position; final Context context = viewGroup.getContext(); if (view == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.local_list_item, viewGroup, false); } TextView titleText = (TextView) view.findViewById(R.id.local_item_title); TextView keywordsText = (TextView) view.findViewById(R.id.local_item_keywords); TextView dateText = (TextView) view.findViewById(R.id.local_item_date); BoardDream selectItem = itemList.get(pos); titleText.setText(selectItem.getTitle()); keywordsText.setText(selectItem.getKeywords()); dateText.setText(selectItem.getTime()); return view; } }
UTF-8
Java
1,632
java
LocalDreamAdapter.java
Java
[ { "context": "package github.a3sung.dreammemo;\n\nimport android.content.Context;\nimpor", "end": 21, "score": 0.9422444105148315, "start": 15, "tag": "USERNAME", "value": "a3sung" } ]
null
[]
package github.a3sung.dreammemo; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import org.w3c.dom.Text; import java.util.ArrayList; import java.util.List; public class LocalDreamAdapter extends BaseAdapter { private List<BoardDream> itemList; public LocalDreamAdapter(List<BoardDream> dataSet){ itemList = dataSet; } @Override public int getCount() { return itemList.size(); } @Override public Object getItem(int i) { return itemList.get(i); } @Override public long getItemId(int i) { return i; } @Override public View getView(int position, View view, ViewGroup viewGroup) { final int pos = position; final Context context = viewGroup.getContext(); if (view == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.local_list_item, viewGroup, false); } TextView titleText = (TextView) view.findViewById(R.id.local_item_title); TextView keywordsText = (TextView) view.findViewById(R.id.local_item_keywords); TextView dateText = (TextView) view.findViewById(R.id.local_item_date); BoardDream selectItem = itemList.get(pos); titleText.setText(selectItem.getTitle()); keywordsText.setText(selectItem.getKeywords()); dateText.setText(selectItem.getTime()); return view; } }
1,632
0.68076
0.679534
60
26.200001
26.317167
113
false
false
0
0
0
0
0
0
0.516667
false
false
9
f9de113519cc2ef6df62045c8e1b7231c87c4fc0
5,583,457,512,606
110484cbd104794785ed59447db5c51b3078f2d3
/src/mask/utils/gridSpace/GridCell.java
c66ddb7f954e93518d10b447132f96c330db8309
[]
no_license
juzcn/MASK
https://github.com/juzcn/MASK
53caab4f11b2adeb61516cb67d2f0f88e810ea2b
787c8597ca1c00de54d3c3f3da786812b6556b31
refs/heads/master
2021-01-10T09:34:58.052000
2016-02-04T04:06:02
2016-02-04T04:06:02
49,419,491
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 mask.utils.gridSpace; import java.io.Serializable; /** * * @author zj */ public class GridCell<T extends Serializable> implements Serializable { private final int row, column; private final T value; public GridCell(int row, int column, T value) { this.row = row; this.column = column; this.value = value; } /** * @return the row */ public int getRow() { return row; } /** * @return the column */ public int getColumn() { return column; } /** * @return the value */ public T getValue() { return value; } }
UTF-8
Java
883
java
GridCell.java
Java
[ { "context": "mport java.io.Serializable;\r\n\r\n/**\r\n *\r\n * @author zj\r\n */\r\npublic class GridCell<T extends Serializable>", "end": 277, "score": 0.9940689206123352, "start": 275, "tag": "USERNAME", "value": "zj" } ]
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 mask.utils.gridSpace; import java.io.Serializable; /** * * @author zj */ public class GridCell<T extends Serializable> implements Serializable { private final int row, column; private final T value; public GridCell(int row, int column, T value) { this.row = row; this.column = column; this.value = value; } /** * @return the row */ public int getRow() { return row; } /** * @return the column */ public int getColumn() { return column; } /** * @return the value */ public T getValue() { return value; } }
883
0.558324
0.558324
45
17.622223
18.76082
79
false
false
0
0
0
0
0
0
0.355556
false
false
9
65631f057ce9360044416bef7a8f3a72c6e1bae9
16,784,732,218,487
49a5004f62754676ea98993ac6ac7736f40c2b16
/src/main/java/com/booksapp/controllers/AccountController.java
51ce898c4b32251b0bf9b209f368de738b5c4857
[]
no_license
wbtaro/BooksAppSpringBoot
https://github.com/wbtaro/BooksAppSpringBoot
7c6126fb41dd1b8d7cda98ee3919d0fbc7fe3c9a
a29e7aab318ccc8040e383a3665c84730043e868
refs/heads/master
2022-11-25T12:06:34.122000
2020-07-29T07:37:26
2020-07-31T11:08:07
283,925,389
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.booksapp.controllers; import java.security.Principal; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import com.booksapp.controllers.forms.AccountForm; import com.booksapp.domain.model.Account; import com.booksapp.domain.service.AccountService; @Controller public class AccountController { @Autowired private ModelMapper modelMapper; @Autowired private AccountService accountService; @GetMapping("/signup") public String createForm(@ModelAttribute AccountForm AccountForm) { return "/account/signup"; } @PostMapping("/signup") public String create(@ModelAttribute @Validated AccountForm accountForm, BindingResult result, Model model) { if(result.hasErrors()) { return "/account/signup"; } if(accountForm.getPassword().getPassword().isEmpty()) { return "/account/signup"; } Account account = modelMapper.map(accountForm, Account.class); accountService.insertOne(account); return "redirect:/login"; } @GetMapping("/account/edit") public String edit(@ModelAttribute AccountForm accountForm, Model model, Principal principal) { Account account = accountService.findByEmail(principal.getName()); modelMapper.map(account, accountForm); return "/account/edit"; } @PostMapping("/account") public String update(@ModelAttribute @Validated AccountForm accountForm, BindingResult result, Model model, Principal principal) { if(result.hasErrors()) { return "/account/edit"; } int id = accountService.findByEmail(principal.getName()).getId(); Account account = modelMapper.map(accountForm, Account.class); account.setId(id); accountService.updateOne(account); return "redirect:/mypage"; } }
UTF-8
Java
2,283
java
AccountController.java
Java
[]
null
[]
package com.booksapp.controllers; import java.security.Principal; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import com.booksapp.controllers.forms.AccountForm; import com.booksapp.domain.model.Account; import com.booksapp.domain.service.AccountService; @Controller public class AccountController { @Autowired private ModelMapper modelMapper; @Autowired private AccountService accountService; @GetMapping("/signup") public String createForm(@ModelAttribute AccountForm AccountForm) { return "/account/signup"; } @PostMapping("/signup") public String create(@ModelAttribute @Validated AccountForm accountForm, BindingResult result, Model model) { if(result.hasErrors()) { return "/account/signup"; } if(accountForm.getPassword().getPassword().isEmpty()) { return "/account/signup"; } Account account = modelMapper.map(accountForm, Account.class); accountService.insertOne(account); return "redirect:/login"; } @GetMapping("/account/edit") public String edit(@ModelAttribute AccountForm accountForm, Model model, Principal principal) { Account account = accountService.findByEmail(principal.getName()); modelMapper.map(account, accountForm); return "/account/edit"; } @PostMapping("/account") public String update(@ModelAttribute @Validated AccountForm accountForm, BindingResult result, Model model, Principal principal) { if(result.hasErrors()) { return "/account/edit"; } int id = accountService.findByEmail(principal.getName()).getId(); Account account = modelMapper.map(accountForm, Account.class); account.setId(id); accountService.updateOne(account); return "redirect:/mypage"; } }
2,283
0.722733
0.722733
69
32.086956
29.055538
134
false
false
0
0
0
0
0
0
0.594203
false
false
9
fb437fc2822135108e1390d50bada17d5e88dbc2
5,738,076,374,182
922f03c64097ec738f7e16843648277605d0cc1b
/core/models/synpop/src/java/com/pb/models/synpopV3/HHCat.java
f2ab77edb4bd32268da7064c235666ee8a24b334
[]
no_license
BayAreaMetro/travel-model-one
https://github.com/BayAreaMetro/travel-model-one
a98c00efab65e5819059da1ffc7224edb17bcb4f
6097dedc7ec5eccc28cce24b527e94413bb6b895
refs/heads/master
2023-09-03T19:49:42.450000
2023-08-25T22:19:31
2023-08-25T22:19:31
22,737,958
21
22
null
false
2023-09-12T21:46:05
2014-08-07T22:04:09
2023-05-10T21:17:08
2023-09-12T21:46:03
443,436
23
26
9
Java
false
false
/* * Copyright 2006 PB Consult Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.pb.models.synpopV3; import org.apache.log4j.Logger; /** * <p>Company: PB Consult, Parsons Brinckerhoff</p> * @author Wu Sun * @version 1.0, Jan. 8, 2004 * * This class represents one HH catetory. */ public class HHCat { protected Logger logger; //control variable values protected String [] ctrlVals; //number of control variables protected int NoCtrlVars; /** * Constructor. * @param ctrlVal represents control variable values. */ public HHCat(String [] ctrlVals) { logger=Logger.getLogger("com.pb.models.synpopV3"); this.ctrlVals=ctrlVals; NoCtrlVars=ctrlVals.length; } /** * get control variable values * @return */ public String [] getCtrlVarVals(){ return ctrlVals; } public void print(){ for(int i=0; i<NoCtrlVars; i++){ logger.info("name="+ControlVarIndex.getCtrlVarName(i)+" value="+ctrlVals[i]); } } /** * compare this object with a given HHCat object * @param hhcat * @return */ public boolean equals(HHCat hhcat){ boolean result=true; String [] hhcatVal=hhcat.getCtrlVarVals(); String tempVal=null; for(int i=0; i<NoCtrlVars; i++){ tempVal=ctrlVals[i]; if(!tempVal.equalsIgnoreCase(hhcatVal[i])){ result=false; break; } } return result; } }
UTF-8
Java
1,936
java
HHCat.java
Java
[ { "context": "y: PB Consult, Parsons Brinckerhoff</p>\n * @author Wu Sun\n * @version 1.0, Jan. 8, 2004\n *\n * This class re", "end": 747, "score": 0.9994621872901917, "start": 741, "tag": "NAME", "value": "Wu Sun" } ]
null
[]
/* * Copyright 2006 PB Consult Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.pb.models.synpopV3; import org.apache.log4j.Logger; /** * <p>Company: PB Consult, Parsons Brinckerhoff</p> * @author <NAME> * @version 1.0, Jan. 8, 2004 * * This class represents one HH catetory. */ public class HHCat { protected Logger logger; //control variable values protected String [] ctrlVals; //number of control variables protected int NoCtrlVars; /** * Constructor. * @param ctrlVal represents control variable values. */ public HHCat(String [] ctrlVals) { logger=Logger.getLogger("com.pb.models.synpopV3"); this.ctrlVals=ctrlVals; NoCtrlVars=ctrlVals.length; } /** * get control variable values * @return */ public String [] getCtrlVarVals(){ return ctrlVals; } public void print(){ for(int i=0; i<NoCtrlVars; i++){ logger.info("name="+ControlVarIndex.getCtrlVarName(i)+" value="+ctrlVals[i]); } } /** * compare this object with a given HHCat object * @param hhcat * @return */ public boolean equals(HHCat hhcat){ boolean result=true; String [] hhcatVal=hhcat.getCtrlVarVals(); String tempVal=null; for(int i=0; i<NoCtrlVars; i++){ tempVal=ctrlVals[i]; if(!tempVal.equalsIgnoreCase(hhcatVal[i])){ result=false; break; } } return result; } }
1,936
0.666839
0.656508
82
22.621952
21.791496
81
false
false
0
0
0
0
0
0
0.682927
false
false
9
fd2478ab260293d26649358b2a3c1df5508c9f87
21,234,318,315,550
f57c9d57f967289ebc50d9709d8fb6564b1a7898
/src/main/java/com/ylz/bizDo/jtapp/basicHealthEntity/findHealthInfo/entity/CancerScreen.java
74125b335ac3162b76d630d503e11db8c736c17b
[]
no_license
zzr156/familydoctor
https://github.com/zzr156/familydoctor
dc78838040fcc838f252f498e101900b9ab1eda6
a0d24b24f27b209c748ce1767109fc46b076d785
refs/heads/master
2022-12-23T18:59:12.892000
2019-12-14T02:46:48
2019-12-14T02:46:48
227,955,558
2
1
null
false
2022-12-16T02:48:39
2019-12-14T02:37:27
2022-12-10T10:43:59
2022-12-16T02:48:36
24,266
1
1
17
Java
false
false
/** * */ package com.ylz.bizDo.jtapp.basicHealthEntity.findHealthInfo.entity; import java.io.Serializable; /** *<p>Title:CancerScreen</p> *<p>Description:</p> *<p>Company:ylz</p> *@author cairongjie *@date 2016-7-8 下午3:19:18 */ public class CancerScreen implements Serializable{ /** * */ private static final long serialVersionUID = 1L; private String AFP; private String CFA; public CancerScreen(){} public CancerScreen(String AFP,String CFA){ this.AFP=AFP; this.CFA=CFA; } /** * @return the aFP */ public String getAFP() { return AFP; } /** * @param aFP the aFP to set */ public void setAFP(String aFP) { AFP = aFP; } /** * @return the cFA */ public String getCFA() { return CFA; } /** * @param cFA the cFA to set */ public void setCFA(String cFA) { CFA = cFA; } }
UTF-8
Java
843
java
CancerScreen.java
Java
[ { "context": "<p>Description:</p>\n *<p>Company:ylz</p>\n *@author cairongjie\n *@date 2016-7-8 下午3:19:18\n */\npublic class Cance", "end": 208, "score": 0.999492347240448, "start": 198, "tag": "USERNAME", "value": "cairongjie" } ]
null
[]
/** * */ package com.ylz.bizDo.jtapp.basicHealthEntity.findHealthInfo.entity; import java.io.Serializable; /** *<p>Title:CancerScreen</p> *<p>Description:</p> *<p>Company:ylz</p> *@author cairongjie *@date 2016-7-8 下午3:19:18 */ public class CancerScreen implements Serializable{ /** * */ private static final long serialVersionUID = 1L; private String AFP; private String CFA; public CancerScreen(){} public CancerScreen(String AFP,String CFA){ this.AFP=AFP; this.CFA=CFA; } /** * @return the aFP */ public String getAFP() { return AFP; } /** * @param aFP the aFP to set */ public void setAFP(String aFP) { AFP = aFP; } /** * @return the cFA */ public String getCFA() { return CFA; } /** * @param cFA the cFA to set */ public void setCFA(String cFA) { CFA = cFA; } }
843
0.631704
0.617402
56
13.982142
14.956474
68
false
false
0
0
0
0
0
0
1
false
false
9
a31fa4e9ebf8e190d8ac9750fd23fcbc0ffbc6a9
8,890,582,321,192
025f85f5f84561b55967f4e5b64ed2014e2fa346
/app/src/main/java/anthony/uteq/ojsmobileapp/PubsActivity.java
de839676348d6f7fcf2cf3fc10a5e9c289a48101
[]
no_license
ANTHONYPACHAY/OJS_Mobile_APP
https://github.com/ANTHONYPACHAY/OJS_Mobile_APP
3a13ff5ca9b2b7fdcbb815116e73ed600e1689d7
cb86ffe4d3309c83198af1eb07d44c06ced3d269
refs/heads/master
2023-07-15T22:02:38.340000
2021-09-03T04:53:48
2021-09-03T04:53:48
402,646,583
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package anthony.uteq.ojsmobileapp; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.text.Html; import android.text.method.ScrollingMovementMethod; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.bumptech.glide.Glide; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; import com.mindorks.placeholderview.PlaceHolderView; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; import anthony.uteq.ojsmobileapp.controller.Card_pubsManager; import anthony.uteq.ojsmobileapp.models.AuthorsObject; import anthony.uteq.ojsmobileapp.models.IssueObject; import anthony.uteq.ojsmobileapp.models.PubsObject; import anthony.uteq.ojsmobileapp.models.JournalObject; import anthony.uteq.ojsmobileapp.utiles.Alerts; import anthony.uteq.ojsmobileapp.utiles.DataStatic; import anthony.uteq.ojsmobileapp.utiles.Methods; import anthony.uteq.ojsmobileapp.utiles.MyLogs; public class PubsActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pubs); getSupportActionBar().hide(); onLoadPubsData(); } private void onLoadPubsData() { Bundle bundle = this.getIntent().getExtras(); String data = bundle.getString("issueObject"); JsonObject jso = Methods.stringToJSON(data); Gson gson = new Gson(); IssueObject issueObject = gson.fromJson(jso, IssueObject.class); ImageView imgIssue = (ImageView) findViewById(R.id.imgIssue); TextView journalName = (TextView) findViewById(R.id.journalName); journalName.setText(issueObject.getTitle()); Glide.with(PubsActivity.this).load(issueObject.getCover()).into(imgIssue); gerIPubs(issueObject.getIssue_id()); MyLogs.info("LLegue, dame las publicacionesss\n" + data); } public void createElements(List<PubsObject> elements) { for (PubsObject elem : elements) { PlaceHolderView CardElement = (PlaceHolderView) findViewById(R.id.pubsView); CardElement.addView(new Card_pubsManager(PubsActivity.this, CardElement, elem)); MyLogs.info("agg 1 pubx1"); } } private void gerIPubs(String pubs_id) { RequestQueue queue = Volley.newRequestQueue(this); StringRequest request = new StringRequest( Request.Method.GET, DataStatic.gerUrlApi("pubs.php?i_id=" + pubs_id), new com.android.volley.Response.Listener<String>() { @Override public void onResponse(String response) { MyLogs.info("ws todo bien"); //Procesar las respuesta y armar un Array con estos List<PubsObject> data = processResponse(response); MyLogs.info("Proceso las publicaciones"); //método para mostrar los datos en el activity createElements(data); } }, new com.android.volley.Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { MyLogs.error("we error" + error.getMessage() + "\n" + DataStatic.gerUrlApi("journals.php")); Alerts.MessageToast(PubsActivity.this, "Data Error"); } } ); queue.add(request); } private List<PubsObject> processResponse(String response) { List<PubsObject> data = new ArrayList<>(); Gson gson = new Gson();//convertidor de jsonObjecto a Object.class //Convertir el string de respuesta(con formato JsonArray) en un JsonArray JsonArray jarr = Methods.stringToJsonArray(response); //validar cantidad de elementos, para informar en caso de no encontrar alguno if (jarr.size() > 0) { //recorrer los items for (int ind = 0; ind < jarr.size(); ind++) { //convertir el elemento del json en jsonObject(por defecto los items dentro de // JsonArray son de tipo JsonElement) JsonObject jso = Methods.JsonElementToJSO(jarr.get(ind)); //Verificar cantidad de keys dentor del json (si hay 0 lo mas probable es que haya // ocurrido algún problema durante la conversión de JsonElement a JsonObject) if (jso.size() > 0) { //Casteo de JsonObject s Java.class (en este caso SuperItem) MyLogs.info("leyendo"); PubsObject item = new PubsObject(); item.setSection(Methods.JsonToString(jso, "section", "")); item.setPublication_id(Methods.JsonToString(jso, "publication_id", "")); item.setTitle(Methods.JsonToString(jso, "title", "")); item.setDoi(Methods.JsonToString(jso, "doi", "")); item.setAbstract_(Methods.JsonToString(jso, "abstract", "")); item.setDate_published(Methods.JsonToString(jso, "date_published", "")); item.setSubmission_id(Methods.JsonToString(jso, "submission_id", "")); item.setSection_id(Methods.JsonToString(jso, "section_id", "")); item.setSeq(Methods.JsonToString(jso, "seq", "")); item.setGaleys(Methods.JsonToString(jso, "galeys", "")); JsonArray jarrKeywords = Methods.JsonToArray(jso, "keywords"); String keys = ""; for (int i = 0; i < jarrKeywords.size(); i++) { JsonObject keyjso = Methods.JsonElementToJSO(jarrKeywords.get(i)); String minkey = Methods.JsonToString(keyjso, "keyword", ""); keys += minkey; if (i < jarrKeywords.size() - 1) { keys += minkey.length() > 0 ? ", " : ""; } } MyLogs.error("acutor: "+jarrKeywords.size()); item.setKeywords(keys); String auth = ""; try { JsonArray jarrAutors = Methods.JsonToArray(jso, "authors"); for (int i = 0; i < jarrAutors.size(); i++) { JsonObject keyauth = Methods.JsonElementToJSO(jarrAutors.get(i)); String minkey = ""; minkey += "nombres: "+Methods.JsonToString(keyauth, "nombres", "") + "\n"; minkey += "filiacion: "+Methods.JsonToString(keyauth, "filiacion", "") + "\n"; minkey += "email:" + Methods.JsonToString(keyauth, "email", "") + "\n"; auth += minkey; if (i < jarrKeywords.size() - 1) { auth += minkey.length() > 0 ? "\n" : ""; } } }catch (Exception e){ MyLogs.error("[Autthos list]: " + e.getMessage()); } item.setAuthors(auth); //agrega el item a la lista data.add(item); } } } else { //Toast indicando la ausencia de elementos Alerts.MessageToast(PubsActivity.this, "No hay registros."); } //retorno de la lista con todos los elementos return data; } public void back(View view){ onBackPressed(); } }
UTF-8
Java
8,132
java
PubsActivity.java
Java
[]
null
[]
package anthony.uteq.ojsmobileapp; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.text.Html; import android.text.method.ScrollingMovementMethod; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.bumptech.glide.Glide; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; import com.mindorks.placeholderview.PlaceHolderView; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; import anthony.uteq.ojsmobileapp.controller.Card_pubsManager; import anthony.uteq.ojsmobileapp.models.AuthorsObject; import anthony.uteq.ojsmobileapp.models.IssueObject; import anthony.uteq.ojsmobileapp.models.PubsObject; import anthony.uteq.ojsmobileapp.models.JournalObject; import anthony.uteq.ojsmobileapp.utiles.Alerts; import anthony.uteq.ojsmobileapp.utiles.DataStatic; import anthony.uteq.ojsmobileapp.utiles.Methods; import anthony.uteq.ojsmobileapp.utiles.MyLogs; public class PubsActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pubs); getSupportActionBar().hide(); onLoadPubsData(); } private void onLoadPubsData() { Bundle bundle = this.getIntent().getExtras(); String data = bundle.getString("issueObject"); JsonObject jso = Methods.stringToJSON(data); Gson gson = new Gson(); IssueObject issueObject = gson.fromJson(jso, IssueObject.class); ImageView imgIssue = (ImageView) findViewById(R.id.imgIssue); TextView journalName = (TextView) findViewById(R.id.journalName); journalName.setText(issueObject.getTitle()); Glide.with(PubsActivity.this).load(issueObject.getCover()).into(imgIssue); gerIPubs(issueObject.getIssue_id()); MyLogs.info("LLegue, dame las publicacionesss\n" + data); } public void createElements(List<PubsObject> elements) { for (PubsObject elem : elements) { PlaceHolderView CardElement = (PlaceHolderView) findViewById(R.id.pubsView); CardElement.addView(new Card_pubsManager(PubsActivity.this, CardElement, elem)); MyLogs.info("agg 1 pubx1"); } } private void gerIPubs(String pubs_id) { RequestQueue queue = Volley.newRequestQueue(this); StringRequest request = new StringRequest( Request.Method.GET, DataStatic.gerUrlApi("pubs.php?i_id=" + pubs_id), new com.android.volley.Response.Listener<String>() { @Override public void onResponse(String response) { MyLogs.info("ws todo bien"); //Procesar las respuesta y armar un Array con estos List<PubsObject> data = processResponse(response); MyLogs.info("Proceso las publicaciones"); //método para mostrar los datos en el activity createElements(data); } }, new com.android.volley.Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { MyLogs.error("we error" + error.getMessage() + "\n" + DataStatic.gerUrlApi("journals.php")); Alerts.MessageToast(PubsActivity.this, "Data Error"); } } ); queue.add(request); } private List<PubsObject> processResponse(String response) { List<PubsObject> data = new ArrayList<>(); Gson gson = new Gson();//convertidor de jsonObjecto a Object.class //Convertir el string de respuesta(con formato JsonArray) en un JsonArray JsonArray jarr = Methods.stringToJsonArray(response); //validar cantidad de elementos, para informar en caso de no encontrar alguno if (jarr.size() > 0) { //recorrer los items for (int ind = 0; ind < jarr.size(); ind++) { //convertir el elemento del json en jsonObject(por defecto los items dentro de // JsonArray son de tipo JsonElement) JsonObject jso = Methods.JsonElementToJSO(jarr.get(ind)); //Verificar cantidad de keys dentor del json (si hay 0 lo mas probable es que haya // ocurrido algún problema durante la conversión de JsonElement a JsonObject) if (jso.size() > 0) { //Casteo de JsonObject s Java.class (en este caso SuperItem) MyLogs.info("leyendo"); PubsObject item = new PubsObject(); item.setSection(Methods.JsonToString(jso, "section", "")); item.setPublication_id(Methods.JsonToString(jso, "publication_id", "")); item.setTitle(Methods.JsonToString(jso, "title", "")); item.setDoi(Methods.JsonToString(jso, "doi", "")); item.setAbstract_(Methods.JsonToString(jso, "abstract", "")); item.setDate_published(Methods.JsonToString(jso, "date_published", "")); item.setSubmission_id(Methods.JsonToString(jso, "submission_id", "")); item.setSection_id(Methods.JsonToString(jso, "section_id", "")); item.setSeq(Methods.JsonToString(jso, "seq", "")); item.setGaleys(Methods.JsonToString(jso, "galeys", "")); JsonArray jarrKeywords = Methods.JsonToArray(jso, "keywords"); String keys = ""; for (int i = 0; i < jarrKeywords.size(); i++) { JsonObject keyjso = Methods.JsonElementToJSO(jarrKeywords.get(i)); String minkey = Methods.JsonToString(keyjso, "keyword", ""); keys += minkey; if (i < jarrKeywords.size() - 1) { keys += minkey.length() > 0 ? ", " : ""; } } MyLogs.error("acutor: "+jarrKeywords.size()); item.setKeywords(keys); String auth = ""; try { JsonArray jarrAutors = Methods.JsonToArray(jso, "authors"); for (int i = 0; i < jarrAutors.size(); i++) { JsonObject keyauth = Methods.JsonElementToJSO(jarrAutors.get(i)); String minkey = ""; minkey += "nombres: "+Methods.JsonToString(keyauth, "nombres", "") + "\n"; minkey += "filiacion: "+Methods.JsonToString(keyauth, "filiacion", "") + "\n"; minkey += "email:" + Methods.JsonToString(keyauth, "email", "") + "\n"; auth += minkey; if (i < jarrKeywords.size() - 1) { auth += minkey.length() > 0 ? "\n" : ""; } } }catch (Exception e){ MyLogs.error("[Autthos list]: " + e.getMessage()); } item.setAuthors(auth); //agrega el item a la lista data.add(item); } } } else { //Toast indicando la ausencia de elementos Alerts.MessageToast(PubsActivity.this, "No hay registros."); } //retorno de la lista con todos los elementos return data; } public void back(View view){ onBackPressed(); } }
8,132
0.577562
0.576086
178
44.674156
28.218361
116
false
false
0
0
0
0
0
0
0.814607
false
false
9
4ce290243608952309a5b023a981f6637258b101
20,083,267,082,596
d1f87fa9aebbbf6c837c33c44a71771ff0e4348e
/src/com/ultrakline/parse/ParseTDXDayFile.java
48bc0dd7d1a26460e3288aa28707b1b65fb875df
[ "Apache-2.0" ]
permissive
HendryGoo/SiNong
https://github.com/HendryGoo/SiNong
602381c9652f33f0e081550d5f1e805f8f2215be
4903554f80ff06b51a81f6a8300a0b5d03c1233c
refs/heads/master
2021-01-10T17:50:10.060000
2016-02-15T11:55:03
2016-02-15T11:55:03
51,651,813
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ultrakline.parse; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ultrakline.UKProp; import com.ultrakline.domian.StockDayEntity; public class ParseTDXDayFile { private Logger log = LoggerFactory.getLogger(ParseTDXDayFile.class); private UKProp ukprop = UKProp.getInstance(); public void parse(File sFile, String stockCode) { try { String fileName = sFile.getName(); String kdayDataDir = sFile.getParentFile().getParentFile().getAbsolutePath() + File.separator + "kdayData"; File kdayFile = new File(kdayDataDir, fileName.replace(".day", ".csv")); File sqlFile = new File(ukprop.getSqlStoreDir(), fileName.replace(".day", ".sql")); File jsonFile = new File(ukprop.getJsonStoreDir(), fileName.replace(".day", ".js")); log.info("parse day file {} begin", fileName); DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(sFile))); byte[] buf = new byte[32]; int preClose = 0; StringBuffer csvSB = new StringBuffer(); StringBuffer sqlSB = new StringBuffer(); StringBuffer jsonDataSB = new StringBuffer(); String tmpSQL = ""; jsonDataSB.append("var data=[\r\n"); long days = sFile.length() / 32; log.info(" days is {}", days); String dateLine = ""; String[] result = new String[5]; // Map<String,String> firstDayMap=new HashMap<String,String>(); for (long i = 0; i < days; i++) { dis.read(buf); result = splitDayData(buf); if (i == 0) { log.info(" stock is {} start date is {}", stockCode, result[4]); ukprop.putStartDate(stockCode, result[4]); } dateLine = result[0].replace("$preClose", preClose + ""); tmpSQL = result[1].replace("$stockCode", stockCode); tmpSQL = tmpSQL.replace("$no", (i + 1) + ""); tmpSQL = tmpSQL.replace("$preClose", preClose + ""); sqlSB.append(tmpSQL).append("\r\n"); csvSB.append(stockCode).append(","); csvSB.append(dateLine).append("\r\n"); if (i == days - 1) { jsonDataSB.append(result[2].replace("$preClose", preClose + "")).append("\r\n"); } else { jsonDataSB.append(result[2].replace("$preClose", preClose + "")).append(",").append("\r\n"); } log.debug("[{}] -->[{} data is [{}] json data is {}", stockCode, i, dateLine, result[2]); preClose = Integer.parseInt(result[3]); } jsonDataSB.append("\r\n];"); dis.close(); // /// log.info("parse day file {} End", fileName); FileWriter fw = new FileWriter(kdayFile); csvSB.append("commit;\r\n"); fw.write(csvSB.toString()); fw.close(); log.info(" csv convert finished [{}] -->[{}] ", fileName, kdayFile.getName()); FileWriter sqlfw = new FileWriter(sqlFile); sqlfw.write(sqlSB.toString()); sqlfw.close(); log.info(" sql convert finished [{}] -->[{}] ", fileName, sqlFile.getName()); FileWriter jsonfw = new FileWriter(jsonFile); jsonfw.write(jsonDataSB.toString()); jsonfw.close(); log.info(" sql convert finished [{}] -->[{}] ", fileName, jsonFile.getName()); } catch (Exception ex) { ex.printStackTrace(); } } public int convert(byte[] bs) { StringBuffer hexBuf = new StringBuffer(); String temp = ""; String temp2 = ""; String temp3 = ""; for (int i = 0; i < bs.length; i++) { temp2 = temp2 + bs[i]; temp3 = temp3 + (bs[i] & 0xFF); temp = Integer.toHexString(bs[i] & 0xFF); if (temp.length() == 1) hexBuf.append("0"); hexBuf.append(Integer.toHexString(bs[i] & 0xFF)); } int result = 0; try{ result = Integer.valueOf(hexBuf.toString(), 16); }catch(Exception ex){ log.error(" orig Byte is {} ,t3 is {} byte is {},date is {} ", temp2, temp3, hexBuf.toString(), result); } return result; } public String[] splitDayData(byte[] buf) { // TODO // StockDayEntity sde=new StockDayEntity(); String[] result = new String[5]; // TODO read from properties StringBuffer sqlSB = new StringBuffer( "insert into stock_ex_day (stock_code,ex_days,ex_date,pre_close,ex_open,ex_top,ex_low,ex_close,ex_amount,ex_vol) values ("); sqlSB.append("'$stockCode',$no,"); String openDay = ""; StringBuffer dlsb = new StringBuffer(); StringBuffer jsonSB = new StringBuffer(); // ////////////////// byte[] day = new byte[4]; byte[] opens = new byte[4]; byte[] top = new byte[4]; byte[] low = new byte[4]; byte[] cls = new byte[4]; byte[] amont = new byte[4]; byte[] vol = new byte[4]; day[0] = buf[3]; day[1] = buf[2]; day[2] = buf[1]; day[3] = buf[0]; int days = convert(day); openDay = formatData(days); dlsb.append(days).append(",$preClose,"); sqlSB.append(days).append(",$preClose,"); jsonSB.append("[").append(formatData(days)).append(",$preClose,"); // System.out.println(i+":"+buf[0]+" H:"+hex); // System.out.println(i +); /// opens[0] = buf[7]; opens[1] = buf[6]; opens[2] = buf[5]; opens[3] = buf[4]; int openPrice = convert(opens); dlsb.append(openPrice).append(","); sqlSB.append(openPrice).append(","); jsonSB.append(openPrice).append(","); // //////// top[0] = buf[11]; top[1] = buf[10]; top[2] = buf[9]; top[3] = buf[8]; int topPrice = convert(top); dlsb.append(topPrice).append(","); sqlSB.append(topPrice).append(","); jsonSB.append(topPrice).append(","); // / low[0] = buf[15]; low[1] = buf[14]; low[2] = buf[13]; low[3] = buf[12]; int lowPrice = convert(low); dlsb.append(lowPrice).append(","); sqlSB.append(lowPrice).append(","); jsonSB.append(lowPrice).append(","); // cls[0] = buf[19]; cls[1] = buf[18]; cls[2] = buf[17]; cls[3] = buf[16]; int closePrice = convert(cls); dlsb.append(closePrice).append(","); sqlSB.append(closePrice).append(","); jsonSB.append(closePrice).append(","); // //////////// amont[0] = buf[23]; amont[1] = buf[22]; amont[2] = buf[21]; amont[3] = buf[20]; int total = convert(amont); dlsb.append(total).append(","); sqlSB.append(total).append(","); jsonSB.append(total).append(","); // / vol[0] = buf[27]; vol[1] = buf[26]; vol[2] = buf[25]; vol[3] = buf[24]; int voltotal = convert(vol); dlsb.append(voltotal); sqlSB.append(voltotal).append(");"); jsonSB.append(voltotal).append("]"); // //////////////////// result[0] = dlsb.toString(); result[1] = sqlSB.toString(); result[2] = jsonSB.toString(); result[3] = closePrice + ""; result[4] = openDay; return result; } public String formatData(int dateInt) { String temp = dateInt + ""; String result = dateInt / 10000 + "-" + temp.substring(4, 6) + "-" + temp.substring(6); return result; } }
UTF-8
Java
6,777
java
ParseTDXDayFile.java
Java
[]
null
[]
package com.ultrakline.parse; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ultrakline.UKProp; import com.ultrakline.domian.StockDayEntity; public class ParseTDXDayFile { private Logger log = LoggerFactory.getLogger(ParseTDXDayFile.class); private UKProp ukprop = UKProp.getInstance(); public void parse(File sFile, String stockCode) { try { String fileName = sFile.getName(); String kdayDataDir = sFile.getParentFile().getParentFile().getAbsolutePath() + File.separator + "kdayData"; File kdayFile = new File(kdayDataDir, fileName.replace(".day", ".csv")); File sqlFile = new File(ukprop.getSqlStoreDir(), fileName.replace(".day", ".sql")); File jsonFile = new File(ukprop.getJsonStoreDir(), fileName.replace(".day", ".js")); log.info("parse day file {} begin", fileName); DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(sFile))); byte[] buf = new byte[32]; int preClose = 0; StringBuffer csvSB = new StringBuffer(); StringBuffer sqlSB = new StringBuffer(); StringBuffer jsonDataSB = new StringBuffer(); String tmpSQL = ""; jsonDataSB.append("var data=[\r\n"); long days = sFile.length() / 32; log.info(" days is {}", days); String dateLine = ""; String[] result = new String[5]; // Map<String,String> firstDayMap=new HashMap<String,String>(); for (long i = 0; i < days; i++) { dis.read(buf); result = splitDayData(buf); if (i == 0) { log.info(" stock is {} start date is {}", stockCode, result[4]); ukprop.putStartDate(stockCode, result[4]); } dateLine = result[0].replace("$preClose", preClose + ""); tmpSQL = result[1].replace("$stockCode", stockCode); tmpSQL = tmpSQL.replace("$no", (i + 1) + ""); tmpSQL = tmpSQL.replace("$preClose", preClose + ""); sqlSB.append(tmpSQL).append("\r\n"); csvSB.append(stockCode).append(","); csvSB.append(dateLine).append("\r\n"); if (i == days - 1) { jsonDataSB.append(result[2].replace("$preClose", preClose + "")).append("\r\n"); } else { jsonDataSB.append(result[2].replace("$preClose", preClose + "")).append(",").append("\r\n"); } log.debug("[{}] -->[{} data is [{}] json data is {}", stockCode, i, dateLine, result[2]); preClose = Integer.parseInt(result[3]); } jsonDataSB.append("\r\n];"); dis.close(); // /// log.info("parse day file {} End", fileName); FileWriter fw = new FileWriter(kdayFile); csvSB.append("commit;\r\n"); fw.write(csvSB.toString()); fw.close(); log.info(" csv convert finished [{}] -->[{}] ", fileName, kdayFile.getName()); FileWriter sqlfw = new FileWriter(sqlFile); sqlfw.write(sqlSB.toString()); sqlfw.close(); log.info(" sql convert finished [{}] -->[{}] ", fileName, sqlFile.getName()); FileWriter jsonfw = new FileWriter(jsonFile); jsonfw.write(jsonDataSB.toString()); jsonfw.close(); log.info(" sql convert finished [{}] -->[{}] ", fileName, jsonFile.getName()); } catch (Exception ex) { ex.printStackTrace(); } } public int convert(byte[] bs) { StringBuffer hexBuf = new StringBuffer(); String temp = ""; String temp2 = ""; String temp3 = ""; for (int i = 0; i < bs.length; i++) { temp2 = temp2 + bs[i]; temp3 = temp3 + (bs[i] & 0xFF); temp = Integer.toHexString(bs[i] & 0xFF); if (temp.length() == 1) hexBuf.append("0"); hexBuf.append(Integer.toHexString(bs[i] & 0xFF)); } int result = 0; try{ result = Integer.valueOf(hexBuf.toString(), 16); }catch(Exception ex){ log.error(" orig Byte is {} ,t3 is {} byte is {},date is {} ", temp2, temp3, hexBuf.toString(), result); } return result; } public String[] splitDayData(byte[] buf) { // TODO // StockDayEntity sde=new StockDayEntity(); String[] result = new String[5]; // TODO read from properties StringBuffer sqlSB = new StringBuffer( "insert into stock_ex_day (stock_code,ex_days,ex_date,pre_close,ex_open,ex_top,ex_low,ex_close,ex_amount,ex_vol) values ("); sqlSB.append("'$stockCode',$no,"); String openDay = ""; StringBuffer dlsb = new StringBuffer(); StringBuffer jsonSB = new StringBuffer(); // ////////////////// byte[] day = new byte[4]; byte[] opens = new byte[4]; byte[] top = new byte[4]; byte[] low = new byte[4]; byte[] cls = new byte[4]; byte[] amont = new byte[4]; byte[] vol = new byte[4]; day[0] = buf[3]; day[1] = buf[2]; day[2] = buf[1]; day[3] = buf[0]; int days = convert(day); openDay = formatData(days); dlsb.append(days).append(",$preClose,"); sqlSB.append(days).append(",$preClose,"); jsonSB.append("[").append(formatData(days)).append(",$preClose,"); // System.out.println(i+":"+buf[0]+" H:"+hex); // System.out.println(i +); /// opens[0] = buf[7]; opens[1] = buf[6]; opens[2] = buf[5]; opens[3] = buf[4]; int openPrice = convert(opens); dlsb.append(openPrice).append(","); sqlSB.append(openPrice).append(","); jsonSB.append(openPrice).append(","); // //////// top[0] = buf[11]; top[1] = buf[10]; top[2] = buf[9]; top[3] = buf[8]; int topPrice = convert(top); dlsb.append(topPrice).append(","); sqlSB.append(topPrice).append(","); jsonSB.append(topPrice).append(","); // / low[0] = buf[15]; low[1] = buf[14]; low[2] = buf[13]; low[3] = buf[12]; int lowPrice = convert(low); dlsb.append(lowPrice).append(","); sqlSB.append(lowPrice).append(","); jsonSB.append(lowPrice).append(","); // cls[0] = buf[19]; cls[1] = buf[18]; cls[2] = buf[17]; cls[3] = buf[16]; int closePrice = convert(cls); dlsb.append(closePrice).append(","); sqlSB.append(closePrice).append(","); jsonSB.append(closePrice).append(","); // //////////// amont[0] = buf[23]; amont[1] = buf[22]; amont[2] = buf[21]; amont[3] = buf[20]; int total = convert(amont); dlsb.append(total).append(","); sqlSB.append(total).append(","); jsonSB.append(total).append(","); // / vol[0] = buf[27]; vol[1] = buf[26]; vol[2] = buf[25]; vol[3] = buf[24]; int voltotal = convert(vol); dlsb.append(voltotal); sqlSB.append(voltotal).append(");"); jsonSB.append(voltotal).append("]"); // //////////////////// result[0] = dlsb.toString(); result[1] = sqlSB.toString(); result[2] = jsonSB.toString(); result[3] = closePrice + ""; result[4] = openDay; return result; } public String formatData(int dateInt) { String temp = dateInt + ""; String result = dateInt / 10000 + "-" + temp.substring(4, 6) + "-" + temp.substring(6); return result; } }
6,777
0.617087
0.597314
220
29.804546
22.760672
128
false
false
0
0
0
0
0
0
3.168182
false
false
9
92bdf7d31048573c55840b5108760bd429c6add6
2,138,893,716,165
e7658e4a4bed0e1aecfc6dcb20ff6c46530b465d
/app/src/main/java/com/eip/red/caritathelp/Models/Notifications/NotificationsJson.java
1417edef59a4901f925999e26a68a9f6e3eacba2
[]
no_license
Caritathelp/caritathelp-android
https://github.com/Caritathelp/caritathelp-android
844ef0b95b1b36f2a9357a31e68e92e63bf92c5e
5fcbc2d49b07ebd0056b1923772c80b90ccb10a4
refs/heads/master
2021-01-18T16:22:16.721000
2016-12-08T11:57:13
2016-12-08T11:57:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.eip.red.caritathelp.Models.Notifications; import java.util.List; /** * Created by pierr on 21/04/2016. */ public class NotificationsJson { private int status; private String message; private List<Notification> response; public int getStatus() { return status; } public String getMessage() { return message; } public List<Notification> getResponse() { return response; } }
UTF-8
Java
483
java
NotificationsJson.java
Java
[ { "context": "ations;\n\nimport java.util.List;\n\n/**\n * Created by pierr on 21/04/2016.\n */\n\npublic class NotificationsJso", "end": 102, "score": 0.9995967149734497, "start": 97, "tag": "USERNAME", "value": "pierr" } ]
null
[]
package com.eip.red.caritathelp.Models.Notifications; import java.util.List; /** * Created by pierr on 21/04/2016. */ public class NotificationsJson { private int status; private String message; private List<Notification> response; public int getStatus() { return status; } public String getMessage() { return message; } public List<Notification> getResponse() { return response; } }
483
0.610766
0.594203
26
17.576923
17.274199
53
false
false
0
0
0
0
0
0
0.307692
false
false
9
8261c7fed99ea9ac262f5bb38b382857ec0387b1
21,586,505,683,902
76c451e661a5a923562189ed177aabb25dccf8fa
/src/main/java/co/com/sofka/personalizedtraining/domain/entrenador/commands/CrearEntrenador.java
fc51aada34b46269fb10ecbff9e2dffb43fc6429
[]
no_license
Darley36/Reto_DDD
https://github.com/Darley36/Reto_DDD
8cb5f5bd25f14480c6bd08edf9bf01c36aa0ba52
e3fab2d948924fa3e2ce342d760ad97c2b9d4aab
refs/heads/main
2023-09-01T02:57:26.159000
2021-10-02T04:03:34
2021-10-02T04:03:34
411,899,726
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package co.com.sofka.personalizedtraining.domain.entrenador.commands; import co.com.sofka.domain.generic.Command; import co.com.sofka.personalizedtraining.domain.entrenador.values.Email; import co.com.sofka.personalizedtraining.domain.entrenador.values.EntrenadorId; import co.com.sofka.personalizedtraining.domain.entrenador.values.Nombre; public class CrearEntrenador extends Command { private final EntrenadorId entrenadorId; private final Nombre nombre; private final Email email; public CrearEntrenador(EntrenadorId entrenadorId, Nombre nombre, Email email) { this.entrenadorId = entrenadorId; this.nombre = nombre; this.email = email; } public EntrenadorId getEntrenadorId() { return entrenadorId; } public Nombre getNombre() { return nombre; } public Email getEmail() { return email; } }
UTF-8
Java
893
java
CrearEntrenador.java
Java
[]
null
[]
package co.com.sofka.personalizedtraining.domain.entrenador.commands; import co.com.sofka.domain.generic.Command; import co.com.sofka.personalizedtraining.domain.entrenador.values.Email; import co.com.sofka.personalizedtraining.domain.entrenador.values.EntrenadorId; import co.com.sofka.personalizedtraining.domain.entrenador.values.Nombre; public class CrearEntrenador extends Command { private final EntrenadorId entrenadorId; private final Nombre nombre; private final Email email; public CrearEntrenador(EntrenadorId entrenadorId, Nombre nombre, Email email) { this.entrenadorId = entrenadorId; this.nombre = nombre; this.email = email; } public EntrenadorId getEntrenadorId() { return entrenadorId; } public Nombre getNombre() { return nombre; } public Email getEmail() { return email; } }
893
0.733483
0.733483
30
28.766666
25.894251
83
false
false
0
0
0
0
0
0
0.533333
false
false
9
522df8a03d8dc49adcb0f3451489f9a6795b83fd
10,127,532,903,064
0fdfc7468f11c2929e621a8d0966d4774aae7d24
/src/main/java/net/nemerosa/ontrack/jenkins/extension/OntrackTriggerContextExtensionPoint.java
601973f98b45ed25389e4abbf1fe474ba13f1dbe
[ "MIT" ]
permissive
daniel-beck-bot/ontrack-plugin
https://github.com/daniel-beck-bot/ontrack-plugin
0e7170b9d918ee829df0726d0e838c21dc74e223
2d18e01e9fb44787c3dbeaae1126410ed5062906
refs/heads/master
2021-02-07T14:02:20.612000
2019-08-20T17:15:00
2019-08-20T17:15:00
244,035,505
0
0
MIT
true
2020-02-29T20:19:41
2020-02-29T20:19:41
2019-08-20T17:15:08
2019-08-20T17:15:07
561
0
0
0
null
false
false
package net.nemerosa.ontrack.jenkins.extension; import antlr.ANTLRException; import hudson.Extension; import javaposse.jobdsl.dsl.helpers.triggers.TriggerContext; import javaposse.jobdsl.plugin.ContextExtensionPoint; import javaposse.jobdsl.plugin.DslExtensionMethod; import net.nemerosa.ontrack.jenkins.OntrackTrigger; @Extension(optional = true) public class OntrackTriggerContextExtensionPoint extends ContextExtensionPoint { /** * Trigger */ @DslExtensionMethod(context = TriggerContext.class) public OntrackTrigger ontrackTrigger(String spec, String project, String branch, String promotion, String parameterName, String minimumResult) throws ANTLRException { return new OntrackTrigger(spec, project, branch, promotion, parameterName, minimumResult); } /** * Trigger */ @DslExtensionMethod(context = TriggerContext.class) public OntrackTrigger ontrackTrigger(String spec, String project, String branch, String promotion, String parameterName) throws ANTLRException { return ontrackTrigger(spec, project, branch, promotion, parameterName, null); } /** * Trigger with default parameter name */ @DslExtensionMethod(context = TriggerContext.class) public OntrackTrigger ontrackTrigger(String spec, String project, String branch, String promotion) throws ANTLRException { return ontrackTrigger(spec, project, branch, promotion, "VERSION"); } }
UTF-8
Java
1,452
java
OntrackTriggerContextExtensionPoint.java
Java
[]
null
[]
package net.nemerosa.ontrack.jenkins.extension; import antlr.ANTLRException; import hudson.Extension; import javaposse.jobdsl.dsl.helpers.triggers.TriggerContext; import javaposse.jobdsl.plugin.ContextExtensionPoint; import javaposse.jobdsl.plugin.DslExtensionMethod; import net.nemerosa.ontrack.jenkins.OntrackTrigger; @Extension(optional = true) public class OntrackTriggerContextExtensionPoint extends ContextExtensionPoint { /** * Trigger */ @DslExtensionMethod(context = TriggerContext.class) public OntrackTrigger ontrackTrigger(String spec, String project, String branch, String promotion, String parameterName, String minimumResult) throws ANTLRException { return new OntrackTrigger(spec, project, branch, promotion, parameterName, minimumResult); } /** * Trigger */ @DslExtensionMethod(context = TriggerContext.class) public OntrackTrigger ontrackTrigger(String spec, String project, String branch, String promotion, String parameterName) throws ANTLRException { return ontrackTrigger(spec, project, branch, promotion, parameterName, null); } /** * Trigger with default parameter name */ @DslExtensionMethod(context = TriggerContext.class) public OntrackTrigger ontrackTrigger(String spec, String project, String branch, String promotion) throws ANTLRException { return ontrackTrigger(spec, project, branch, promotion, "VERSION"); } }
1,452
0.764463
0.764463
37
38.243244
43.130478
170
false
false
0
0
0
0
0
0
0.972973
false
false
9
19503407c6e20521b718f5eb5b94232668a69b57
31,181,462,635,589
e49d6458ab2745b163a67f5c2a38c8826adac305
/Arminius The Gem of Peace/src/com/overrtime/world/items/Stone_Item.java
7453a4e57fdaa44f4e39b4ef626df5e8dd9d7d44
[]
no_license
Carter9510/Arminius-The-Gem-of-Peace
https://github.com/Carter9510/Arminius-The-Gem-of-Peace
6ef24c382b6fae1f78f27dd2ce646f26898cd44c
4045dd7cc8fdba23f50bee506f7f7c23230cb5c1
refs/heads/master
2020-05-18T21:06:27.928000
2015-04-07T00:32:44
2015-04-07T00:32:44
33,513,248
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.overrtime.world.items; import java.awt.Graphics; import com.overrtime.game.Display; public class Stone_Item extends Item{ @SuppressWarnings("static-access") public Stone_Item() { setTexture(Display.getTextures().stone); } public void tick() { } public void render(Graphics g) { g.drawImage(getTexture(),x,y,32,32,null); drawStack(g); } }
UTF-8
Java
382
java
Stone_Item.java
Java
[]
null
[]
package com.overrtime.world.items; import java.awt.Graphics; import com.overrtime.game.Display; public class Stone_Item extends Item{ @SuppressWarnings("static-access") public Stone_Item() { setTexture(Display.getTextures().stone); } public void tick() { } public void render(Graphics g) { g.drawImage(getTexture(),x,y,32,32,null); drawStack(g); } }
382
0.693717
0.683246
25
14.28
15.890928
43
false
false
0
0
0
0
0
0
1.32
false
false
9
ecef1a0340832aa70a844a998829b43c0c007425
7,335,804,191,955
17e7177fd1aaa76106774cb40c19429e6e009069
/src/main/java/br/com/OpetBrothers/repository/entity/LocalizacaoEntity.java
c7d73ab1e405ce5c385b5549cdf48a9df3de328a
[]
no_license
LucasGalvaoNunes/encontrefacil-webservice
https://github.com/LucasGalvaoNunes/encontrefacil-webservice
1548605d86716e017a5bba8dd732f16d89bb767a
0e5831c7997f1def16bcf2205766062fea6d1238
refs/heads/master
2020-03-07T13:07:04.048000
2018-03-31T21:01:20
2018-03-31T21:01:20
127,493,055
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.OpetBrothers.repository.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; import org.hibernate.annotations.GenericGenerator; @Entity @Table(name="LOCALIZACAO") @XmlRootElement public class LocalizacaoEntity { @Id @Column(name="ID_LOCALIZACAO") @GeneratedValue(generator="id_localizacao") @GenericGenerator(name="id_localizacao", strategy = "increment") private int id_Localizacao; @Column(name="LONGITUDE") private String longitude; @Column(name="LATITUDE") private String latitude; @Column(name="CIDADE") private String cidade; @Column(name="ESTADO") private String estado; @Column(name="BAIRRO") private String bairro; public int getId_Localizacao() { return id_Localizacao; } public void setId_Localizacao(int id_Localizacao) { this.id_Localizacao = id_Localizacao; } public String getLongitude() { return longitude; } public void setLongitude(String longitude) { this.longitude = longitude; } public String getLatitude() { return latitude; } public void setLatitude(String latitude) { this.latitude = latitude; } public String getCidade() { return cidade; } public void setCidade(String cidade) { this.cidade = cidade; } public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } public String getBairro() { return bairro; } public void setBairro(String bairro) { this.bairro = bairro; } }
UTF-8
Java
1,725
java
LocalizacaoEntity.java
Java
[]
null
[]
package br.com.OpetBrothers.repository.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; import org.hibernate.annotations.GenericGenerator; @Entity @Table(name="LOCALIZACAO") @XmlRootElement public class LocalizacaoEntity { @Id @Column(name="ID_LOCALIZACAO") @GeneratedValue(generator="id_localizacao") @GenericGenerator(name="id_localizacao", strategy = "increment") private int id_Localizacao; @Column(name="LONGITUDE") private String longitude; @Column(name="LATITUDE") private String latitude; @Column(name="CIDADE") private String cidade; @Column(name="ESTADO") private String estado; @Column(name="BAIRRO") private String bairro; public int getId_Localizacao() { return id_Localizacao; } public void setId_Localizacao(int id_Localizacao) { this.id_Localizacao = id_Localizacao; } public String getLongitude() { return longitude; } public void setLongitude(String longitude) { this.longitude = longitude; } public String getLatitude() { return latitude; } public void setLatitude(String latitude) { this.latitude = latitude; } public String getCidade() { return cidade; } public void setCidade(String cidade) { this.cidade = cidade; } public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } public String getBairro() { return bairro; } public void setBairro(String bairro) { this.bairro = bairro; } }
1,725
0.697391
0.697391
90
17.166666
16.690149
68
false
false
0
0
0
0
0
0
1.1
false
false
9
084404fa88e3c045617e2689f97d8250d4feea0f
11,751,030,541,403
cbed972ecd032534673af74615fc3d1a60089b1d
/src/java/servlets/membre/genres/Accueil.java
438f3eb06aecf4c3c2ffce9a3cb9c5bfed8d932f
[]
no_license
haxakl/E-commerce-Musique
https://github.com/haxakl/E-commerce-Musique
e46f49daf124f23b56470ccc8db937436d54dd99
6766c224ca899060f792f836e54c6271291912e7
refs/heads/master
2021-01-19T09:41:45.370000
2014-06-14T10:26:54
2014-06-14T10:26:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package servlets.membre.genres; import java.io.IOException; import java.util.Collection; import javax.ejb.EJB; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import musique.gestionnaires.GestionnaireMusiques; import musique.modeles.Genre; import utilisateurs.gestionnaires.GestionnaireUtilisateurs; /** * * @author julien */ @WebServlet(name = "ListerGenres", urlPatterns = {"/admin/genres"}) public class Accueil extends HttpServlet { @EJB private GestionnaireMusiques gestionnaireMusiques; @EJB private GestionnaireUtilisateurs gestionnaireUtilisateurs; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Il n'y a pas d'utilisateurs Collection<Genre> liste; // Page affichée int numPage = 1; if (request.getParameter("page") != null) { numPage = Integer.parseInt(request.getParameter("page")); } // Un état if (request.getParameter("etat") != null) { request.setAttribute("etat", request.getParameter("etat")); } // Nombre affichée par page int nbAffiche; if (request.getParameter("nbAffiche") != null) { nbAffiche = Integer.parseInt(request.getParameter("nbAffiche")); } else { nbAffiche = 30; } // Recupère tous les utilisateurs Collection<Genre> listeAllGenres = gestionnaireMusiques.getAllGenres(); double totalMusiques = listeAllGenres.size(); liste = gestionnaireMusiques.getGenres((numPage - 1) * nbAffiche, nbAffiche); if (totalMusiques == 0) { request.setAttribute("nbPages", Math.ceil(liste.size() / nbAffiche)); } else { request.setAttribute("nbPages", (int) Math.ceil(totalMusiques / nbAffiche)); } request.setAttribute("page", numPage); request.setAttribute("nbAffiche", nbAffiche); request.setAttribute("listeAllGenres", liste); this.getServletContext().getRequestDispatcher("/view/backoffice/genres/accueil.jsp").forward(request, response); } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
UTF-8
Java
3,961
java
Accueil.java
Java
[ { "context": "aires.GestionnaireUtilisateurs;\n\n/**\n *\n * @author julien\n */\n@WebServlet(name = \"ListerGenres\", urlPattern", "end": 493, "score": 0.9044086337089539, "start": 487, "tag": "USERNAME", "value": "julien" } ]
null
[]
package servlets.membre.genres; import java.io.IOException; import java.util.Collection; import javax.ejb.EJB; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import musique.gestionnaires.GestionnaireMusiques; import musique.modeles.Genre; import utilisateurs.gestionnaires.GestionnaireUtilisateurs; /** * * @author julien */ @WebServlet(name = "ListerGenres", urlPatterns = {"/admin/genres"}) public class Accueil extends HttpServlet { @EJB private GestionnaireMusiques gestionnaireMusiques; @EJB private GestionnaireUtilisateurs gestionnaireUtilisateurs; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Il n'y a pas d'utilisateurs Collection<Genre> liste; // Page affichée int numPage = 1; if (request.getParameter("page") != null) { numPage = Integer.parseInt(request.getParameter("page")); } // Un état if (request.getParameter("etat") != null) { request.setAttribute("etat", request.getParameter("etat")); } // Nombre affichée par page int nbAffiche; if (request.getParameter("nbAffiche") != null) { nbAffiche = Integer.parseInt(request.getParameter("nbAffiche")); } else { nbAffiche = 30; } // Recupère tous les utilisateurs Collection<Genre> listeAllGenres = gestionnaireMusiques.getAllGenres(); double totalMusiques = listeAllGenres.size(); liste = gestionnaireMusiques.getGenres((numPage - 1) * nbAffiche, nbAffiche); if (totalMusiques == 0) { request.setAttribute("nbPages", Math.ceil(liste.size() / nbAffiche)); } else { request.setAttribute("nbPages", (int) Math.ceil(totalMusiques / nbAffiche)); } request.setAttribute("page", numPage); request.setAttribute("nbAffiche", nbAffiche); request.setAttribute("listeAllGenres", liste); this.getServletContext().getRequestDispatcher("/view/backoffice/genres/accueil.jsp").forward(request, response); } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
3,961
0.667172
0.665909
117
32.820515
27.801991
123
false
false
0
0
0
0
0
0
0.42735
false
false
9
6452ed4b6a8c4bbe1b25e33fd3aca234cb15d9fc
11,751,030,543,149
d1648980785a9b034d303398af81e580c40b5edd
/Final_Peeps/Peeps_Post/src/main/java/com/gnjk/post/mypost/service/ReplyService.java
d1a99566c123753311c8254dc1940f7235f78069
[]
no_license
hxnky/PEEPS
https://github.com/hxnky/PEEPS
2388b4c1c1ea56d0304b806c7a777fbb5f11ab09
61c4d6df4f7a1ccf7b355f59c26c47775510a276
refs/heads/master
2023-04-03T07:05:45.061000
2021-03-13T09:26:37
2021-03-13T09:26:37
330,603,649
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gnjk.post.mypost.service; import java.util.List; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.gnjk.post.mypost.dao.CommentDao; import com.gnjk.post.mypost.dao.PostDao; import com.gnjk.post.mypost.domain.Reply; import com.gnjk.post.mypost.domain.ReplyRequest; @Service public class ReplyService { private CommentDao dao; @Autowired private SqlSessionTemplate template; // 대댓글 조회 // 인덱스로 아이디 검사해서 list.add public List<Reply> selectReList(int cmt_idx) { dao = template.getMapper(CommentDao.class); return dao.selectReList(cmt_idx); } // 대댓글 작성 public int InsertReply(ReplyRequest request) { dao = template.getMapper(CommentDao.class); int result = 0; Reply reply = request.GetRe(); result = dao.insertReply(reply); return result; } // 대댓글 수정 public int EditReply(int re_idx, String re_content) { dao = template.getMapper(CommentDao.class); int result = 0; System.out.println(re_idx); System.out.println("댓글 수정 : " + re_content); result = dao.updateReply(re_idx, re_content); return result; } // 대댓글 삭제 public int DelReply(int re_idx) { dao = template.getMapper(CommentDao.class); int result = 0; result = dao.deleteReply(re_idx); return result; } }
UTF-8
Java
1,432
java
ReplyService.java
Java
[]
null
[]
package com.gnjk.post.mypost.service; import java.util.List; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.gnjk.post.mypost.dao.CommentDao; import com.gnjk.post.mypost.dao.PostDao; import com.gnjk.post.mypost.domain.Reply; import com.gnjk.post.mypost.domain.ReplyRequest; @Service public class ReplyService { private CommentDao dao; @Autowired private SqlSessionTemplate template; // 대댓글 조회 // 인덱스로 아이디 검사해서 list.add public List<Reply> selectReList(int cmt_idx) { dao = template.getMapper(CommentDao.class); return dao.selectReList(cmt_idx); } // 대댓글 작성 public int InsertReply(ReplyRequest request) { dao = template.getMapper(CommentDao.class); int result = 0; Reply reply = request.GetRe(); result = dao.insertReply(reply); return result; } // 대댓글 수정 public int EditReply(int re_idx, String re_content) { dao = template.getMapper(CommentDao.class); int result = 0; System.out.println(re_idx); System.out.println("댓글 수정 : " + re_content); result = dao.updateReply(re_idx, re_content); return result; } // 대댓글 삭제 public int DelReply(int re_idx) { dao = template.getMapper(CommentDao.class); int result = 0; result = dao.deleteReply(re_idx); return result; } }
1,432
0.726138
0.723935
73
17.657534
19.0502
62
false
false
0
0
0
0
0
0
1.150685
false
false
9
67aef0743b636f598d325ceda26d81d5b4810252
21,560,735,885,258
34782d4ec9fa6c645b5f84122582955f8f4687dc
/Month05-code/src/day13/WaitAndNotify/BaoziPu.java
93c77bb52e74483340911b9fdc7ef7b752e192ad
[]
no_license
chanderz/base-code
https://github.com/chanderz/base-code
f604fd1b42fd6ba3096317d84a5d8b7ab99aa020
df1bb0e10f411822acd0e45192e5c29d4f555912
refs/heads/master
2023-09-04T08:18:03.094000
2021-11-07T09:16:26
2021-11-07T09:16:26
359,077,249
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package day13.WaitAndNotify; /** * * * * @Description:produce Baozi(Thread class) * * * * @Author:Zhaozheng * * * * @CreateTime:2021年08月01日 13:33 * * */ public class BaoziPu extends Thread { private Baozi bz; public BaoziPu(Baozi bz){ this.bz = bz; } @Override public void run() { int count = 0; while (true) { synchronized (bz) { if (bz.condition) { try { bz.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } if (count % 2 == 0) { bz.setPi("薄皮"); bz.setXian("粉丝"); } else { bz.setPi("厚皮"); bz.setXian("牛肉"); } count++; System.out.println("包子铺正在生产" + bz.getPi() + bz.getXian() + "包子"); try { Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } bz.condition = true; bz.notifyAll(); System.out.println("包子生产完成:" + bz.getPi() + bz.getXian()); System.out.println("-----------"); } } } }
UTF-8
Java
1,432
java
BaoziPu.java
Java
[ { "context": "ion:produce Baozi(Thread class)\n * *\n * * @Author:Zhaozheng\n * *\n * * @CreateTime:2021年08月01日 13:33\n * *\n */\n", "end": 112, "score": 0.9998254776000977, "start": 103, "tag": "NAME", "value": "Zhaozheng" } ]
null
[]
package day13.WaitAndNotify; /** * * * * @Description:produce Baozi(Thread class) * * * * @Author:Zhaozheng * * * * @CreateTime:2021年08月01日 13:33 * * */ public class BaoziPu extends Thread { private Baozi bz; public BaoziPu(Baozi bz){ this.bz = bz; } @Override public void run() { int count = 0; while (true) { synchronized (bz) { if (bz.condition) { try { bz.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } if (count % 2 == 0) { bz.setPi("薄皮"); bz.setXian("粉丝"); } else { bz.setPi("厚皮"); bz.setXian("牛肉"); } count++; System.out.println("包子铺正在生产" + bz.getPi() + bz.getXian() + "包子"); try { Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } bz.condition = true; bz.notifyAll(); System.out.println("包子生产完成:" + bz.getPi() + bz.getXian()); System.out.println("-----------"); } } } }
1,432
0.385234
0.370614
51
25.82353
17.820131
81
false
false
0
0
0
0
0
0
0.352941
false
false
9
a7eda522e8df00384afad1ec830b05424f3d9f1d
20,581,483,327,481
2961594b0066b6105535e8128e3677aabfab1db1
/src/main/java/com/company/core/webshop/model/Product.java
9e486d40b942d568217e794c3e70ab6ecb445a90
[]
no_license
mikaMek/webshop
https://github.com/mikaMek/webshop
bfaabf8ffd039ce9fc250bf131ea22736416cad3
372594f78412932deed66ac465aa4533d9bb96b3
refs/heads/master
2020-04-24T21:22:25.969000
2019-02-24T21:33:05
2019-02-24T21:33:05
172,275,432
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company.core.webshop.model; import java.io.Serializable; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.ObjectIdGenerators; @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="productId") @Entity @Table(name="product") public class Product implements Serializable { /** * */ private static final long serialVersionUID = -7964495756080406240L; @Id @GeneratedValue private int id; private String productId; private String productName; private String productDescription; private String category; @OneToMany(mappedBy="parent", cascade = {CascadeType.ALL, CascadeType.MERGE, CascadeType.PERSIST}) private List<Variant> variants; public Product() { super(); } public Product(String productId, String productName, String productDescription, String category, List<Variant> variants) { super(); this.productId = productId; this.productName = productName; this.productDescription = productDescription; this.category = category; this.variants = variants; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public String getProductDescription() { return productDescription; } public void setProductDescription(String productDescription) { this.productDescription = productDescription; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public List<Variant> getVariants() { return variants; } public void setVariants(List<Variant> variants) { this.variants = variants; } }
UTF-8
Java
2,154
java
Product.java
Java
[]
null
[]
package com.company.core.webshop.model; import java.io.Serializable; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.ObjectIdGenerators; @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="productId") @Entity @Table(name="product") public class Product implements Serializable { /** * */ private static final long serialVersionUID = -7964495756080406240L; @Id @GeneratedValue private int id; private String productId; private String productName; private String productDescription; private String category; @OneToMany(mappedBy="parent", cascade = {CascadeType.ALL, CascadeType.MERGE, CascadeType.PERSIST}) private List<Variant> variants; public Product() { super(); } public Product(String productId, String productName, String productDescription, String category, List<Variant> variants) { super(); this.productId = productId; this.productName = productName; this.productDescription = productDescription; this.category = category; this.variants = variants; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public String getProductDescription() { return productDescription; } public void setProductDescription(String productDescription) { this.productDescription = productDescription; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public List<Variant> getVariants() { return variants; } public void setVariants(List<Variant> variants) { this.variants = variants; } }
2,154
0.764624
0.755803
95
21.673685
22.251406
99
false
false
0
0
0
0
0
0
1.357895
false
false
9
e99c1d2cc1c5c0e2a27539836104d55e81569c14
3,204,045,650,784
373cb1aa9b227313e9f696965b885941a9e5a195
/Family/src/Family/CheckStatus.java
8f3cf101687eb6d2a47f0abd423cdf35e8c02fc0
[]
no_license
atanbhardwaj/BasicJavaPrograms
https://github.com/atanbhardwaj/BasicJavaPrograms
8d579379b7ef23e3a8e98e63a1c8c653714d5ebc
47a52fe144e50ef1ad179ed2e4c6145590aa9879
refs/heads/master
2023-02-06T22:22:54.083000
2021-01-01T17:48:23
2021-01-01T17:48:23
326,027,458
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Family; public class CheckStatus extends Family_S implements InterA{ public CheckStatus() { super("Ram", "Sita", "Male"); } public void checkRelation(String fn, String mn, String g) { if((fn.equals("Ram"))&&(mn.equals("Sita"))) { System.out.println("Belongs to the same Family \n"); if(g.equals("Male")) System.out.println("Brother Brother"); else if(g.equals("Female")) System.out.println("Sister Sister"); else System.out.println("Brother Sister"); } else System.out.println("Does not belong to the same Family \n"); } }
UTF-8
Java
572
java
CheckStatus.java
Java
[]
null
[]
package Family; public class CheckStatus extends Family_S implements InterA{ public CheckStatus() { super("Ram", "Sita", "Male"); } public void checkRelation(String fn, String mn, String g) { if((fn.equals("Ram"))&&(mn.equals("Sita"))) { System.out.println("Belongs to the same Family \n"); if(g.equals("Male")) System.out.println("Brother Brother"); else if(g.equals("Female")) System.out.println("Sister Sister"); else System.out.println("Brother Sister"); } else System.out.println("Does not belong to the same Family \n"); } }
572
0.664336
0.664336
21
26.285715
21.83301
63
false
false
0
0
0
0
0
0
2.476191
false
false
9
9ed63c9417343b5680cb7ccff188fcbff402b685
21,114,059,277,900
fc4150290b10e2e331b55e54e628798eabaa47ad
/HAL/.svn/pristine/b2/b2e57ddf675b27f95a87fa13d08d865b3312f7d8.svn-base
e1d2420f7442793d89bb6a2b5ffe7aa9a8a88086
[]
no_license
vadhwa11/newproject2
https://github.com/vadhwa11/newproject2
8e40bd4acfd4edc6b721eeca8636f8b7d589af2b
fc9bd770fdadf650f004323f85884dc143827f4d
refs/heads/master
2020-05-05T04:01:05.628000
2019-04-05T14:38:10
2019-04-05T14:38:10
179,694,408
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jkt.hms.workservices.controller; import static jkt.hms.util.RequestConstants.FROM_DATE; import static jkt.hms.util.RequestConstants.MINOR_WORK_DETAIL; import static jkt.hms.util.RequestConstants.MINOR_WORK_DETAIL_SEARCH_FOR_COMPLETION_WORK_JSP; import static jkt.hms.util.RequestConstants.MINOR_WORK_NO; import static jkt.hms.util.RequestConstants.MINOR_WORK_PROPOSAL_DEPARTMENT; import static jkt.hms.util.RequestConstants.MINOR_WORK_TYPE_ID; import static jkt.hms.util.RequestConstants.TO_DATE; import static jkt.hms.util.RequestConstants.WORK_CATEGORY; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import jkt.hms.masters.handler.CommonMasterHandlerService; import jkt.hms.workservices.handler.MinorWorkDetailSearchForCompletionWorkHandlerService; import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.multiaction.MultiActionController; public class MinorWorkDetailSearchForCompletionWorkController extends MultiActionController { MinorWorkDetailSearchForCompletionWorkHandlerService minorWorkDetailSearchForCompletionWorkHandlerService = null; CommonMasterHandlerService commonMasterHandlerService = null; @SuppressWarnings("unchecked") public ModelAndView showMinorWorkDetailSearchForCompletionWorkJsp( HttpServletRequest request, HttpServletResponse response) { Map<String, Object> map = new HashMap<String, Object>(); String jsp = ""; String title = ""; map = minorWorkDetailSearchForCompletionWorkHandlerService .showMinorWorkDetailSearchForCompletionWorkJsp(); jsp += MINOR_WORK_DETAIL_SEARCH_FOR_COMPLETION_WORK_JSP; jsp += ".jsp"; title = "Minor Work Detail Search For Completion Work"; map.put("contentJsp", jsp); map.put("title", title); return new ModelAndView("indexB", "map", map); } @SuppressWarnings("unchecked") public ModelAndView searchMinorWorkDetailSearchForCompletionWork( HttpServletRequest request, HttpServletResponse response) throws ServletRequestBindingException { Map<String, Object> map = new HashMap<String, Object>(); String jsp = ""; String title = ""; AgendaDTO minorWorkDetailSearchForCompletionWorkDTO = new AgendaDTO(); if (request.getParameter(TO_DATE) != null && !request.getParameter(TO_DATE).equalsIgnoreCase("")) { minorWorkDetailSearchForCompletionWorkDTO.setToDate(request .getParameter(TO_DATE)); } if (request.getParameter(FROM_DATE) != null && !request.getParameter(FROM_DATE).equalsIgnoreCase("")) { minorWorkDetailSearchForCompletionWorkDTO.setFromDate(request .getParameter(FROM_DATE)); } if (request.getParameter(MINOR_WORK_TYPE_ID) != null && !request.getParameter(MINOR_WORK_TYPE_ID).equalsIgnoreCase( "0")) { minorWorkDetailSearchForCompletionWorkDTO.setWorkTypeName(request .getParameter(MINOR_WORK_TYPE_ID)); } if (request.getParameter(MINOR_WORK_NO) != null && !request.getParameter(MINOR_WORK_NO).equalsIgnoreCase("")) { minorWorkDetailSearchForCompletionWorkDTO.setMinorWorkNo(request .getParameter(MINOR_WORK_NO)); } if (request.getParameter(WORK_CATEGORY) != null && !request.getParameter(WORK_CATEGORY).equalsIgnoreCase("")) { minorWorkDetailSearchForCompletionWorkDTO .setWorkCategoryName(request.getParameter(WORK_CATEGORY)); } if (!request.getParameter(MINOR_WORK_PROPOSAL_DEPARTMENT) .equalsIgnoreCase("0") && request.getParameter(MINOR_WORK_PROPOSAL_DEPARTMENT) != null) { minorWorkDetailSearchForCompletionWorkDTO.setDepartment(request .getParameter(MINOR_WORK_PROPOSAL_DEPARTMENT)); } if (!request.getParameter(MINOR_WORK_DETAIL).equalsIgnoreCase("0") && request.getParameter(MINOR_WORK_DETAIL) != null) { minorWorkDetailSearchForCompletionWorkDTO.setWorkDetails(request .getParameter(MINOR_WORK_DETAIL)); } map = minorWorkDetailSearchForCompletionWorkHandlerService .searchMinorWorkDetailSearchForCompletionWork(minorWorkDetailSearchForCompletionWorkDTO); jsp = MINOR_WORK_DETAIL_SEARCH_FOR_COMPLETION_WORK_JSP; jsp += ".jsp"; map.put("search", "search"); map.put("contentJsp", jsp); map.put("title", title); return new ModelAndView("indexB", "map", map); } public CommonMasterHandlerService getCommonMasterHandlerService() { return commonMasterHandlerService; } public void setCommonMasterHandlerService( CommonMasterHandlerService commonMasterHandlerService) { this.commonMasterHandlerService = commonMasterHandlerService; } public MinorWorkDetailSearchForCompletionWorkHandlerService getMinorWorkDetailSearchForCompletionWorkHandlerService() { return minorWorkDetailSearchForCompletionWorkHandlerService; } public void setMinorWorkDetailSearchForCompletionWorkHandlerService( MinorWorkDetailSearchForCompletionWorkHandlerService minorWorkDetailSearchForCompletionWorkHandlerService) { this.minorWorkDetailSearchForCompletionWorkHandlerService = minorWorkDetailSearchForCompletionWorkHandlerService; } }
UTF-8
Java
5,117
b2e57ddf675b27f95a87fa13d08d865b3312f7d8.svn-base
Java
[]
null
[]
package jkt.hms.workservices.controller; import static jkt.hms.util.RequestConstants.FROM_DATE; import static jkt.hms.util.RequestConstants.MINOR_WORK_DETAIL; import static jkt.hms.util.RequestConstants.MINOR_WORK_DETAIL_SEARCH_FOR_COMPLETION_WORK_JSP; import static jkt.hms.util.RequestConstants.MINOR_WORK_NO; import static jkt.hms.util.RequestConstants.MINOR_WORK_PROPOSAL_DEPARTMENT; import static jkt.hms.util.RequestConstants.MINOR_WORK_TYPE_ID; import static jkt.hms.util.RequestConstants.TO_DATE; import static jkt.hms.util.RequestConstants.WORK_CATEGORY; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import jkt.hms.masters.handler.CommonMasterHandlerService; import jkt.hms.workservices.handler.MinorWorkDetailSearchForCompletionWorkHandlerService; import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.multiaction.MultiActionController; public class MinorWorkDetailSearchForCompletionWorkController extends MultiActionController { MinorWorkDetailSearchForCompletionWorkHandlerService minorWorkDetailSearchForCompletionWorkHandlerService = null; CommonMasterHandlerService commonMasterHandlerService = null; @SuppressWarnings("unchecked") public ModelAndView showMinorWorkDetailSearchForCompletionWorkJsp( HttpServletRequest request, HttpServletResponse response) { Map<String, Object> map = new HashMap<String, Object>(); String jsp = ""; String title = ""; map = minorWorkDetailSearchForCompletionWorkHandlerService .showMinorWorkDetailSearchForCompletionWorkJsp(); jsp += MINOR_WORK_DETAIL_SEARCH_FOR_COMPLETION_WORK_JSP; jsp += ".jsp"; title = "Minor Work Detail Search For Completion Work"; map.put("contentJsp", jsp); map.put("title", title); return new ModelAndView("indexB", "map", map); } @SuppressWarnings("unchecked") public ModelAndView searchMinorWorkDetailSearchForCompletionWork( HttpServletRequest request, HttpServletResponse response) throws ServletRequestBindingException { Map<String, Object> map = new HashMap<String, Object>(); String jsp = ""; String title = ""; AgendaDTO minorWorkDetailSearchForCompletionWorkDTO = new AgendaDTO(); if (request.getParameter(TO_DATE) != null && !request.getParameter(TO_DATE).equalsIgnoreCase("")) { minorWorkDetailSearchForCompletionWorkDTO.setToDate(request .getParameter(TO_DATE)); } if (request.getParameter(FROM_DATE) != null && !request.getParameter(FROM_DATE).equalsIgnoreCase("")) { minorWorkDetailSearchForCompletionWorkDTO.setFromDate(request .getParameter(FROM_DATE)); } if (request.getParameter(MINOR_WORK_TYPE_ID) != null && !request.getParameter(MINOR_WORK_TYPE_ID).equalsIgnoreCase( "0")) { minorWorkDetailSearchForCompletionWorkDTO.setWorkTypeName(request .getParameter(MINOR_WORK_TYPE_ID)); } if (request.getParameter(MINOR_WORK_NO) != null && !request.getParameter(MINOR_WORK_NO).equalsIgnoreCase("")) { minorWorkDetailSearchForCompletionWorkDTO.setMinorWorkNo(request .getParameter(MINOR_WORK_NO)); } if (request.getParameter(WORK_CATEGORY) != null && !request.getParameter(WORK_CATEGORY).equalsIgnoreCase("")) { minorWorkDetailSearchForCompletionWorkDTO .setWorkCategoryName(request.getParameter(WORK_CATEGORY)); } if (!request.getParameter(MINOR_WORK_PROPOSAL_DEPARTMENT) .equalsIgnoreCase("0") && request.getParameter(MINOR_WORK_PROPOSAL_DEPARTMENT) != null) { minorWorkDetailSearchForCompletionWorkDTO.setDepartment(request .getParameter(MINOR_WORK_PROPOSAL_DEPARTMENT)); } if (!request.getParameter(MINOR_WORK_DETAIL).equalsIgnoreCase("0") && request.getParameter(MINOR_WORK_DETAIL) != null) { minorWorkDetailSearchForCompletionWorkDTO.setWorkDetails(request .getParameter(MINOR_WORK_DETAIL)); } map = minorWorkDetailSearchForCompletionWorkHandlerService .searchMinorWorkDetailSearchForCompletionWork(minorWorkDetailSearchForCompletionWorkDTO); jsp = MINOR_WORK_DETAIL_SEARCH_FOR_COMPLETION_WORK_JSP; jsp += ".jsp"; map.put("search", "search"); map.put("contentJsp", jsp); map.put("title", title); return new ModelAndView("indexB", "map", map); } public CommonMasterHandlerService getCommonMasterHandlerService() { return commonMasterHandlerService; } public void setCommonMasterHandlerService( CommonMasterHandlerService commonMasterHandlerService) { this.commonMasterHandlerService = commonMasterHandlerService; } public MinorWorkDetailSearchForCompletionWorkHandlerService getMinorWorkDetailSearchForCompletionWorkHandlerService() { return minorWorkDetailSearchForCompletionWorkHandlerService; } public void setMinorWorkDetailSearchForCompletionWorkHandlerService( MinorWorkDetailSearchForCompletionWorkHandlerService minorWorkDetailSearchForCompletionWorkHandlerService) { this.minorWorkDetailSearchForCompletionWorkHandlerService = minorWorkDetailSearchForCompletionWorkHandlerService; } }
5,117
0.800664
0.800078
120
41.650002
29.558599
120
false
false
0
0
0
0
0
0
2.333333
false
false
9
22ec6b97473bfcff3065408514130b70a29c755e
18,408,229,866,979
ff8585cab0038987f10cdd1a0cafb12f9e1a7e0e
/SpringBoot-Test-demo/src/main/java/com/example/demo/controller/OneController.java
2f84ab92da4e5a8a343f91bc11a90b05714564f1
[]
no_license
lllyc-png/master-lyc
https://github.com/lllyc-png/master-lyc
2eb757d509577d1cdba7a47ac19d62353f76debc
9c2b59c1da4607d4434d7a890cf48738dfb56ac8
refs/heads/lllyc-png-patch-1
2023-04-17T15:57:55.235000
2020-08-14T12:32:24
2020-08-14T12:32:24
253,786,605
2
0
null
false
2021-04-22T19:11:13
2020-04-07T12:29:27
2020-08-14T12:32:27
2021-04-22T19:11:13
150
0
0
1
HTML
false
false
package com.example.demo.controller; import com.example.demo.controller.vo.ResponseVo; import com.example.demo.entity.User; import com.example.demo.mapper.UserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController public class OneController { /*private User user = new User(1,"zs","wqfdqhfhfshq113123"); @PostMapping("/getCode") public ResponseVo getCode(@RequestParam int id){ if(user.getId()==id){ System.out.println("出去了"); return ResponseVo.ok(user.getCode()); } return ResponseVo.ok(null); } @PostMapping("/showUser") public ResponseVo showUser(@RequestParam String code){ System.out.println("进来了"); return ResponseVo.ok("成功了"); }*/ @Autowired UserMapper userMapper; @PostMapping("/getCode") public ResponseVo getCode(@RequestParam String id){ System.out.println(id); String code = userMapper.getCode(id); System.out.println(code); return ResponseVo.ok(code); } @PostMapping("/getId") public ResponseVo getId(@RequestParam String code){ System.out.println(code); Integer id = userMapper.getId(code); System.out.println(id); return ResponseVo.ok(id); } }
UTF-8
Java
1,546
java
OneController.java
Java
[]
null
[]
package com.example.demo.controller; import com.example.demo.controller.vo.ResponseVo; import com.example.demo.entity.User; import com.example.demo.mapper.UserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController public class OneController { /*private User user = new User(1,"zs","wqfdqhfhfshq113123"); @PostMapping("/getCode") public ResponseVo getCode(@RequestParam int id){ if(user.getId()==id){ System.out.println("出去了"); return ResponseVo.ok(user.getCode()); } return ResponseVo.ok(null); } @PostMapping("/showUser") public ResponseVo showUser(@RequestParam String code){ System.out.println("进来了"); return ResponseVo.ok("成功了"); }*/ @Autowired UserMapper userMapper; @PostMapping("/getCode") public ResponseVo getCode(@RequestParam String id){ System.out.println(id); String code = userMapper.getCode(id); System.out.println(code); return ResponseVo.ok(code); } @PostMapping("/getId") public ResponseVo getId(@RequestParam String code){ System.out.println(code); Integer id = userMapper.getId(code); System.out.println(id); return ResponseVo.ok(id); } }
1,546
0.657723
0.653141
53
26.830189
21.055843
64
false
false
0
0
0
0
0
0
0.471698
false
false
9
eabe060703ef58a9a2b347a76712b21b0c56d1ee
2,637,109,948,043
e0071774cd75a70a2c66f89b4a2d4b82d278b74c
/Journeys/src/main/java/com/journeys/service/DayManagerImpl.java
8875bf329e673174065fcc002b0c6aecf1aefc36
[]
no_license
Axtima/Journeys
https://github.com/Axtima/Journeys
7ee7f38de3210bf738fd27706568d9a95d34c42e
d906f3da3474e41c69b5850f23f41425d2a19238
refs/heads/master
2020-06-08T17:11:03.401000
2015-02-02T23:27:07
2015-02-02T23:27:07
30,179,038
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.journeys.service; import java.util.Calendar; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.journeys.dao.DayDAO; import com.journeys.entity.Day; import com.journeys.util.Validator; @Service public class DayManagerImpl implements DayManager { @Autowired private DayDAO dayDAO; @Transactional public void addDay(Day day) throws ServiceException { validate(day, true); dayDAO.addDay(day); } @Transactional public Day getDayById(Integer dayId) { return dayDAO.getDayById(dayId); } @Transactional public List<Day> getAllDays() { return dayDAO.getAllDays(); } @Transactional public Day getPreviousDay(Integer journeyId, Date date) { return dayDAO.getPreviousDay(journeyId, date); } @Transactional public Day getNextDay(Integer journeyId, Date date) { return dayDAO.getNextDay(journeyId, date); } @Transactional public void editDay(Day day) throws ServiceException { validate(day, false); day.setLastModificationDate(Calendar.getInstance().getTime()); dayDAO.editDay(day); } @Transactional public void deleteDay(Integer dayId) { dayDAO.deleteDay(dayId); } private boolean validate(Day day, boolean add) throws ServiceException { if (Validator.isNull(day.getTitle())) { throw new ServiceException("Veuillez saisir un titre"); } if (Validator.isNotNull(day.getPictureUrl()) && !Validator.isUrl(day.getPictureUrl())) { throw new ServiceException("Veuillez saisir une url valide pour l'illustration"); } return true; } public void setDayDAO(DayDAO dayDAO) { this.dayDAO = dayDAO; } }
UTF-8
Java
1,830
java
DayManagerImpl.java
Java
[]
null
[]
package com.journeys.service; import java.util.Calendar; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.journeys.dao.DayDAO; import com.journeys.entity.Day; import com.journeys.util.Validator; @Service public class DayManagerImpl implements DayManager { @Autowired private DayDAO dayDAO; @Transactional public void addDay(Day day) throws ServiceException { validate(day, true); dayDAO.addDay(day); } @Transactional public Day getDayById(Integer dayId) { return dayDAO.getDayById(dayId); } @Transactional public List<Day> getAllDays() { return dayDAO.getAllDays(); } @Transactional public Day getPreviousDay(Integer journeyId, Date date) { return dayDAO.getPreviousDay(journeyId, date); } @Transactional public Day getNextDay(Integer journeyId, Date date) { return dayDAO.getNextDay(journeyId, date); } @Transactional public void editDay(Day day) throws ServiceException { validate(day, false); day.setLastModificationDate(Calendar.getInstance().getTime()); dayDAO.editDay(day); } @Transactional public void deleteDay(Integer dayId) { dayDAO.deleteDay(dayId); } private boolean validate(Day day, boolean add) throws ServiceException { if (Validator.isNull(day.getTitle())) { throw new ServiceException("Veuillez saisir un titre"); } if (Validator.isNotNull(day.getPictureUrl()) && !Validator.isUrl(day.getPictureUrl())) { throw new ServiceException("Veuillez saisir une url valide pour l'illustration"); } return true; } public void setDayDAO(DayDAO dayDAO) { this.dayDAO = dayDAO; } }
1,830
0.728962
0.728962
77
22.766233
23.166195
90
false
false
0
0
0
0
0
0
1.207792
false
false
9
7b66eb5452e17c71e27e9b4340b6c1ab04081147
23,398,981,845,410
2b47adde24331e57ebdb0481dcb0fda5e49f0394
/src/main/java/com/verizon/tsp/models/Tickets.java
9beacd0f210fc912716634b2fc3bad329479dc31
[]
no_license
rajesh-pathak/VerizonProjectMain
https://github.com/rajesh-pathak/VerizonProjectMain
14ec089007824ec956f1af4fe359d1000cc1933f
96ff5f217ecc2bc8e39847e9aa8fd1cac469d9ee
refs/heads/master
2020-04-03T09:09:17.316000
2018-10-29T05:17:49
2018-10-29T05:17:49
155,155,809
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.verizon.tsp.models; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; @Entity @Table(name="tickets") public class Tickets { @Id private long ticketId; @OneToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "userId", nullable = false) private User user; private TicketType ticketType; private String content; private String status; @OneToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "planId", nullable = false) private PlanDetails plan; @OneToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "tcId", nullable = false) private TelecomCircle tc; @OneToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "csaId", nullable = false) private CSA csa; public long getTicketId() { return ticketId; } public void setTicketId(long ticketId) { this.ticketId = ticketId; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public TicketType getTicketType() { return ticketType; } public void setTicketType(TicketType ticketType) { this.ticketType = ticketType; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public Tickets(long ticketId, User user, TicketType ticketType, String content, String status, PlanDetails plan, TelecomCircle tc,CSA csa) { super(); this.ticketId = ticketId; this.user = user; this.ticketType = ticketType; this.content = content; this.status = status; this.plan = plan; this.tc = tc; this.csa=csa; } public PlanDetails getPlan() { return plan; } public void setPlan(PlanDetails plan) { this.plan = plan; } public TelecomCircle getTc() { return tc; } public void setTc(TelecomCircle tc) { this.tc = tc; } public CSA getCsa() { return csa; } public void setCsa(CSA csa) { this.csa = csa; } public Tickets() { super(); // TODO Auto-generated constructor stub } }
UTF-8
Java
2,311
java
Tickets.java
Java
[]
null
[]
package com.verizon.tsp.models; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; @Entity @Table(name="tickets") public class Tickets { @Id private long ticketId; @OneToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "userId", nullable = false) private User user; private TicketType ticketType; private String content; private String status; @OneToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "planId", nullable = false) private PlanDetails plan; @OneToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "tcId", nullable = false) private TelecomCircle tc; @OneToOne(fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "csaId", nullable = false) private CSA csa; public long getTicketId() { return ticketId; } public void setTicketId(long ticketId) { this.ticketId = ticketId; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public TicketType getTicketType() { return ticketType; } public void setTicketType(TicketType ticketType) { this.ticketType = ticketType; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public Tickets(long ticketId, User user, TicketType ticketType, String content, String status, PlanDetails plan, TelecomCircle tc,CSA csa) { super(); this.ticketId = ticketId; this.user = user; this.ticketType = ticketType; this.content = content; this.status = status; this.plan = plan; this.tc = tc; this.csa=csa; } public PlanDetails getPlan() { return plan; } public void setPlan(PlanDetails plan) { this.plan = plan; } public TelecomCircle getTc() { return tc; } public void setTc(TelecomCircle tc) { this.tc = tc; } public CSA getCsa() { return csa; } public void setCsa(CSA csa) { this.csa = csa; } public Tickets() { super(); // TODO Auto-generated constructor stub } }
2,311
0.708784
0.708784
105
21.009523
17.982794
113
false
false
0
0
0
0
0
0
1.657143
false
false
9
25b1208908bcc7866a8f8fb2385f5645a070fe62
730,144,483,346
6e26ee30e4544d6f40dbe1245a5d7b0b9994173b
/src/cursojv/trabj6/jppf/JPPF-5.2.8-application-template/src/org/jppf/application/template/TemplateJPPFTask.java
6f181dbd346d93cdcb0a8a0be8c0e66f02f46a38
[ "Apache-2.0" ]
permissive
favargas/jhome
https://github.com/favargas/jhome
60b7974eef81e719fc8972f4510e622bc785baab
94a9a6513429a5ab7569f3101955d8c9e09e0b9c
refs/heads/master
2019-01-20T22:57:39.992000
2018-02-03T13:07:58
2018-02-03T13:07:58
97,170,272
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * JPPF. * Copyright (C) 2005-2016 JPPF Team. * http://www.jppf.org * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jppf.application.template; import org.jppf.node.protocol.AbstractTask; import java.util.Arrays; import java.util.ArrayList; import java.util.stream.Collectors; import java.util.List; /** * This class is a template for a standard JPPF task. * There are 3 parts to a task that is to be executed on a JPPF grid: * <ol> * <li>the task initialization: this is done on the client side, generally from the task constructor, * or via explicit method calls on the task from the application runner.</li> * <li>the task execution: this part is performed by the node. It consists in invoking the {@link #run() run()} method, * and handling an eventual uncaught {@link java.lang.Throwable Throwable} that would result from this invocation.</li> * <li>getting the execution results: the task itself, after its execution, is considered as the result. * JPPF provides the convenience methods {@link org.jppf.node.protocol.Task#setResult(java.lang.Object) setResult(Object)} and * {@link org.jppf.server.node.Task#getResult() getResult()} * to this effect, however any accessible attribute of the task will be available when the task is returned to the client.</li> * </ol> * @author Laurent Cohen */ public class TemplateJPPFTask extends AbstractTask<String> { public String lineaComen; /** * Perform initializations on the client side, * before the task is executed by the node. */ public TemplateJPPFTask() { // perform initializations here ... } /** * Perform initializations on the client side with a String, * before the task is executed by the node. * @param linea es la linea a procesar. */ public TemplateJPPFTask(String linea) { this.lineaComen = linea; } /** * This method contains the code that will be executed by a node. * Any uncaught {@link java.lang.Throwable Throwable} will be stored in the task via a call to {@link org.jppf.node.protocol.Task#setThrowable(java.lang.Throwable) Task.setThrowable(Throwable)}. */ @Override public void run() { // write your task code here. System.out.println("Node Executing JPPF Task on line: "+this.lineaComen); // ... // eventually set the execution results //setResult("the execution was performed successfully on line: "+this.lineaComen); setResult(getNGramas(this.lineaComen)); } /** * Este metodo getText recibe una line con todo tipo de caracter y devuelve una linea limpia * * @param linea recibe un string para limpiarlo de caracteres no validos. * @return lineaLimpia retorna una linea limpia. */ public String getText(String linea){ String cvsSplitBy =" "; String lineaLimpia = linea; //separa linea de archivo .csv por comas String[] columna = linea.split(cvsSplitBy); // Characters that are considered to separate words //"word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?", //usamos replaceAll para eliminar simbolos extranos lineaLimpia = lineaLimpia.replaceAll("[\\\\¡!'?*-+%,^#&@$.:/)(\"]*", ""); //usamos replaceAll para eliminar non-Latin symbols lineaLimpia = lineaLimpia.replaceAll("[^\\x00-\\x7F]", ""); lineaLimpia = "_I "+lineaLimpia+" _F"; return lineaLimpia; }//method getTest() /** * Este metodo printUnigramas recibe una linea y retorna un string de unigramas. * * @param linea linea para extraer unigramas * @return strUnigramas retorna un String de unigramas separados por coma */ public String printUnigramas(String linea){ String lnSplitBy = " "; String nl = this.getText(linea); String lineaTemp = Arrays.stream(nl.split(" ")).distinct().collect(Collectors.joining(" ")); String[] itemLinea = lineaTemp.split(lnSplitBy); List<String> unigramas = new ArrayList<String>(); if (itemLinea.length >= 1){ for(int i = 0; i < itemLinea.length; i++) { if(itemLinea[i] != ""){ //System.out.println(" "+itemLinea[i]+" 1"); unigramas.add(itemLinea[i]+" 1"); } } } String strUnigramas = String.join(",", unigramas); return strUnigramas; }//method printUnigrama() /** * Este metodo printBigramas recibe una linea y retorna un string de brigramas. * * @param linea linea para extraer bigramas * @return strBigramas retorna un String de bigramas separados por coma */ public String printBigramas(String linea){ String lnSplitBy = " "; String nl = this.getText(linea); String[] itemLinea = nl.split(lnSplitBy); List<String> bigramas = new ArrayList<String>(); if (itemLinea.length >= 2){ for(int i = 0; i < itemLinea.length; i++) { int j = i; if(++j <= itemLinea.length-1){ bigramas.add(itemLinea[i]+"_"+itemLinea[j]+" 1"); } } } //CON LA FUNCION .distint().collect() SE ELIMINAN LOS REPETIDOS bigramas = bigramas.stream().distinct().collect(Collectors.toList()); //bigramas.forEach(bg -> { System.out.println(" "+bg); }); String strBigramas = String.join(",", bigramas); return strBigramas; }//method printBigramas() /** * Este metodo printTrigramas recibe una linea y retorna un string de trigramas. * * @param linea linea para extraer trigramas * @return strTrigramas retorna un String de trigramas separados por coma * */ public String printTrigramas(String linea){ String lnSplitBy = " "; int count = 0; String nl = this.getText(linea); String[] itemLinea = nl.split(lnSplitBy); List<String> trigramas = new ArrayList<String>(); if (itemLinea.length >= 3){ for(int i = 0; i < itemLinea.length; i++) { int j = i; int k = ++j; if( ++k<= itemLinea.length-1){ trigramas.add(itemLinea[i]+"_"+itemLinea[j]+"_"+itemLinea[k]+" 1"); } } } //CON LA FUNCION .distint().collect() SE ELIMINAN LOS REPETIDOS trigramas = trigramas.stream().distinct().collect(Collectors.toList()); //trigramas.forEach(tg -> { System.out.println(" "+tg); }); String strTrigramas = String.join(",", trigramas); return strTrigramas; }//method printTrigramas() /** * Este metodo getNGramas recibe una linea y retorna un string de NGRANMAS. * * @param userInput String linea ingresada por la linea de comandos. * @return nGramas String de NGRANMAS separados por coma. */ public String getNGramas(String userInput){ String nGramas = ""; nGramas += this.printUnigramas(userInput); nGramas += ","+this.printBigramas(userInput); nGramas += ","+this.printTrigramas(userInput); return nGramas; }//method getNGramas() }
UTF-8
Java
7,388
java
TemplateJPPFTask.java
Java
[ { "context": "s returned to the client.</li>\n * </ol>\n * @author Laurent Cohen\n */\npublic class TemplateJPPFTask extends Abstrac", "end": 1842, "score": 0.9998247623443604, "start": 1829, "tag": "NAME", "value": "Laurent Cohen" } ]
null
[]
/* * JPPF. * Copyright (C) 2005-2016 JPPF Team. * http://www.jppf.org * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jppf.application.template; import org.jppf.node.protocol.AbstractTask; import java.util.Arrays; import java.util.ArrayList; import java.util.stream.Collectors; import java.util.List; /** * This class is a template for a standard JPPF task. * There are 3 parts to a task that is to be executed on a JPPF grid: * <ol> * <li>the task initialization: this is done on the client side, generally from the task constructor, * or via explicit method calls on the task from the application runner.</li> * <li>the task execution: this part is performed by the node. It consists in invoking the {@link #run() run()} method, * and handling an eventual uncaught {@link java.lang.Throwable Throwable} that would result from this invocation.</li> * <li>getting the execution results: the task itself, after its execution, is considered as the result. * JPPF provides the convenience methods {@link org.jppf.node.protocol.Task#setResult(java.lang.Object) setResult(Object)} and * {@link org.jppf.server.node.Task#getResult() getResult()} * to this effect, however any accessible attribute of the task will be available when the task is returned to the client.</li> * </ol> * @author <NAME> */ public class TemplateJPPFTask extends AbstractTask<String> { public String lineaComen; /** * Perform initializations on the client side, * before the task is executed by the node. */ public TemplateJPPFTask() { // perform initializations here ... } /** * Perform initializations on the client side with a String, * before the task is executed by the node. * @param linea es la linea a procesar. */ public TemplateJPPFTask(String linea) { this.lineaComen = linea; } /** * This method contains the code that will be executed by a node. * Any uncaught {@link java.lang.Throwable Throwable} will be stored in the task via a call to {@link org.jppf.node.protocol.Task#setThrowable(java.lang.Throwable) Task.setThrowable(Throwable)}. */ @Override public void run() { // write your task code here. System.out.println("Node Executing JPPF Task on line: "+this.lineaComen); // ... // eventually set the execution results //setResult("the execution was performed successfully on line: "+this.lineaComen); setResult(getNGramas(this.lineaComen)); } /** * Este metodo getText recibe una line con todo tipo de caracter y devuelve una linea limpia * * @param linea recibe un string para limpiarlo de caracteres no validos. * @return lineaLimpia retorna una linea limpia. */ public String getText(String linea){ String cvsSplitBy =" "; String lineaLimpia = linea; //separa linea de archivo .csv por comas String[] columna = linea.split(cvsSplitBy); // Characters that are considered to separate words //"word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?", //usamos replaceAll para eliminar simbolos extranos lineaLimpia = lineaLimpia.replaceAll("[\\\\¡!'?*-+%,^#&@$.:/)(\"]*", ""); //usamos replaceAll para eliminar non-Latin symbols lineaLimpia = lineaLimpia.replaceAll("[^\\x00-\\x7F]", ""); lineaLimpia = "_I "+lineaLimpia+" _F"; return lineaLimpia; }//method getTest() /** * Este metodo printUnigramas recibe una linea y retorna un string de unigramas. * * @param linea linea para extraer unigramas * @return strUnigramas retorna un String de unigramas separados por coma */ public String printUnigramas(String linea){ String lnSplitBy = " "; String nl = this.getText(linea); String lineaTemp = Arrays.stream(nl.split(" ")).distinct().collect(Collectors.joining(" ")); String[] itemLinea = lineaTemp.split(lnSplitBy); List<String> unigramas = new ArrayList<String>(); if (itemLinea.length >= 1){ for(int i = 0; i < itemLinea.length; i++) { if(itemLinea[i] != ""){ //System.out.println(" "+itemLinea[i]+" 1"); unigramas.add(itemLinea[i]+" 1"); } } } String strUnigramas = String.join(",", unigramas); return strUnigramas; }//method printUnigrama() /** * Este metodo printBigramas recibe una linea y retorna un string de brigramas. * * @param linea linea para extraer bigramas * @return strBigramas retorna un String de bigramas separados por coma */ public String printBigramas(String linea){ String lnSplitBy = " "; String nl = this.getText(linea); String[] itemLinea = nl.split(lnSplitBy); List<String> bigramas = new ArrayList<String>(); if (itemLinea.length >= 2){ for(int i = 0; i < itemLinea.length; i++) { int j = i; if(++j <= itemLinea.length-1){ bigramas.add(itemLinea[i]+"_"+itemLinea[j]+" 1"); } } } //CON LA FUNCION .distint().collect() SE ELIMINAN LOS REPETIDOS bigramas = bigramas.stream().distinct().collect(Collectors.toList()); //bigramas.forEach(bg -> { System.out.println(" "+bg); }); String strBigramas = String.join(",", bigramas); return strBigramas; }//method printBigramas() /** * Este metodo printTrigramas recibe una linea y retorna un string de trigramas. * * @param linea linea para extraer trigramas * @return strTrigramas retorna un String de trigramas separados por coma * */ public String printTrigramas(String linea){ String lnSplitBy = " "; int count = 0; String nl = this.getText(linea); String[] itemLinea = nl.split(lnSplitBy); List<String> trigramas = new ArrayList<String>(); if (itemLinea.length >= 3){ for(int i = 0; i < itemLinea.length; i++) { int j = i; int k = ++j; if( ++k<= itemLinea.length-1){ trigramas.add(itemLinea[i]+"_"+itemLinea[j]+"_"+itemLinea[k]+" 1"); } } } //CON LA FUNCION .distint().collect() SE ELIMINAN LOS REPETIDOS trigramas = trigramas.stream().distinct().collect(Collectors.toList()); //trigramas.forEach(tg -> { System.out.println(" "+tg); }); String strTrigramas = String.join(",", trigramas); return strTrigramas; }//method printTrigramas() /** * Este metodo getNGramas recibe una linea y retorna un string de NGRANMAS. * * @param userInput String linea ingresada por la linea de comandos. * @return nGramas String de NGRANMAS separados por coma. */ public String getNGramas(String userInput){ String nGramas = ""; nGramas += this.printUnigramas(userInput); nGramas += ","+this.printBigramas(userInput); nGramas += ","+this.printTrigramas(userInput); return nGramas; }//method getNGramas() }
7,381
0.65886
0.654934
235
30.434042
31.858446
196
false
false
0
0
0
0
0
0
0.382979
false
false
9
d70137d532e635b6e00300d4eed84e41c066cc3b
34,222,299,435,391
76df6ac69bd8cbb739f14e30c3e1daddb001a08f
/src/main/java/org/example/searchEngine/services/indexer/Indexer.java
e0a8581b616799b287643d111afc5af32e331288
[]
no_license
AndriyKonogray/searchEngine
https://github.com/AndriyKonogray/searchEngine
dd2947fb1f76a9585db77066df7f426a70c2fe68
8c8e16b6f8390d0d68ca848d44b06d44b43c46ce
refs/heads/master
2022-12-25T03:48:06.403000
2020-10-06T07:14:14
2020-10-06T07:14:14
299,047,525
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.example.searchEngine.services.indexer; import java.io.IOException; import java.util.Set; public interface Indexer { void index(Indexable object) throws IOException; void index(Set<Indexable> object) throws IOException; }
UTF-8
Java
245
java
Indexer.java
Java
[]
null
[]
package org.example.searchEngine.services.indexer; import java.io.IOException; import java.util.Set; public interface Indexer { void index(Indexable object) throws IOException; void index(Set<Indexable> object) throws IOException; }
245
0.779592
0.779592
11
21.272728
21.996243
57
false
false
0
0
0
0
0
0
0.454545
false
false
9
245280f0af725213093a65c91e8a5f36331988f3
27,118,423,575,100
0f522a2df6ce85fa4b6277c37a02f02ba0052e95
/src/main/java/co/com/uni5d/controller/pruebaController.java
716188c55967a99078edcec53e617693617a653c
[]
no_license
rogerreyes/Uni5dController
https://github.com/rogerreyes/Uni5dController
a7b8a9ed87b49c8c7bbec1101f767cae97f2b119
86809459e4cd325268e1dd4241dec0d2da330d64
refs/heads/master
2020-02-26T16:59:24.937000
2017-02-10T21:18:31
2017-02-10T21:18:31
80,746,957
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package co.com.uni5d.controller; import java.time.LocalDate; import java.time.Month; import org.json.simple.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import co.com.uni5d.services.ConsultasService; @RestController public class pruebaController { @Autowired private ConsultasService consultaService; /* * @RequestMapping(value="/uni5d", method=RequestMethod.GET) public * ResponseEntity<JSONObject> consultaItinerarios(){ JSONObject obj = * consultaService.consultarItinerario("BOG-sky", "CUN-sky", * LocalDate.of(2017, Month.FEBRUARY, 10), LocalDate.of(2017, * Month.FEBRUARY, 20), 1); System.err.println(obj); return new * ResponseEntity<JSONObject>(HttpStatus.OK); } */ @RequestMapping(value = "/uni5d", method = RequestMethod.GET) public ResponseEntity<JSONObject> consultaItinerarios() { JSONObject obj = consultaService.consultarItinerario("BOG-sky", "CUN-sky", LocalDate.of(2017, Month.FEBRUARY, 10), LocalDate.of(2017, Month.FEBRUARY, 20), 1); consultaService.guardarJSON(obj); return new ResponseEntity<JSONObject>(obj, HttpStatus.OK); } }
UTF-8
Java
1,398
java
pruebaController.java
Java
[]
null
[]
package co.com.uni5d.controller; import java.time.LocalDate; import java.time.Month; import org.json.simple.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import co.com.uni5d.services.ConsultasService; @RestController public class pruebaController { @Autowired private ConsultasService consultaService; /* * @RequestMapping(value="/uni5d", method=RequestMethod.GET) public * ResponseEntity<JSONObject> consultaItinerarios(){ JSONObject obj = * consultaService.consultarItinerario("BOG-sky", "CUN-sky", * LocalDate.of(2017, Month.FEBRUARY, 10), LocalDate.of(2017, * Month.FEBRUARY, 20), 1); System.err.println(obj); return new * ResponseEntity<JSONObject>(HttpStatus.OK); } */ @RequestMapping(value = "/uni5d", method = RequestMethod.GET) public ResponseEntity<JSONObject> consultaItinerarios() { JSONObject obj = consultaService.consultarItinerario("BOG-sky", "CUN-sky", LocalDate.of(2017, Month.FEBRUARY, 10), LocalDate.of(2017, Month.FEBRUARY, 20), 1); consultaService.guardarJSON(obj); return new ResponseEntity<JSONObject>(obj, HttpStatus.OK); } }
1,398
0.783977
0.762518
39
34.846153
27.492226
87
false
false
0
0
0
0
0
0
1.538462
false
false
9
7b7a48618522a63588e01cd4decba7a50455d5bd
3,874,060,564,863
1e36cbd1c160ca6b29a248bb234d1cf7990fa5c6
/src/main/java/cug/swt/ssns/Interface/impl/RegisterImpl.java
4707e62940e2496bbe03e20035975353623ff9cb
[]
no_license
WillZ22/SSNS
https://github.com/WillZ22/SSNS
35d17a765327d5740d4408f5c86a4d2b9f718648
3265acd2c1c5433869c0781b1a5df60039787168
refs/heads/master
2020-04-09T04:55:04.212000
2018-12-18T07:15:38
2018-12-18T07:15:38
160,043,213
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cug.swt.ssns.Interface.impl; import javax.jws.WebService; import org.springframework.beans.factory.annotation.Autowired; import cug.swt.ssns.Interface.Register; import cug.swt.ssns.service.RegisterService; @WebService(name = "registerservice",endpointInterface = "cug.swt.ssns.Interface.Register") public class RegisterImpl implements Register{ @Autowired RegisterService registerService; @Override public String register(String sensorId, String sosAdress, String frequence) throws Exception { // TODO Auto-generated method stub return registerService.register(sensorId, sosAdress, frequence); } @Override public String unregister(String sensorsID) throws Exception { // TODO Auto-generated method stub return registerService.unregister(sensorsID); } }
UTF-8
Java
814
java
RegisterImpl.java
Java
[]
null
[]
package cug.swt.ssns.Interface.impl; import javax.jws.WebService; import org.springframework.beans.factory.annotation.Autowired; import cug.swt.ssns.Interface.Register; import cug.swt.ssns.service.RegisterService; @WebService(name = "registerservice",endpointInterface = "cug.swt.ssns.Interface.Register") public class RegisterImpl implements Register{ @Autowired RegisterService registerService; @Override public String register(String sensorId, String sosAdress, String frequence) throws Exception { // TODO Auto-generated method stub return registerService.register(sensorId, sosAdress, frequence); } @Override public String unregister(String sensorsID) throws Exception { // TODO Auto-generated method stub return registerService.unregister(sensorsID); } }
814
0.772727
0.772727
28
27.071428
28.475464
95
false
false
0
0
0
0
0
0
1.071429
false
false
9
c78de6510396581246bd69bfb6360a3ad05b725c
34,608,846,480,712
928922e5ee1daf2488d5dd1c90bc3fced77a5b51
/src/com/romullogirardi/huntersharklotofacilandroid/model/network/NetworkConstants.java
8ddeea83b138998439a9c192cbcb05dda8b04ce0
[]
no_license
romullogirardi/HunterSharkLotofacilAndroid
https://github.com/romullogirardi/HunterSharkLotofacilAndroid
9acf0c03085fae28ab0ccc8e2dc0841be6b8e5eb
78855be69a52938279d58e9eddf79b39725ca01b
refs/heads/master
2021-01-17T04:44:35.737000
2016-11-07T09:57:01
2016-11-07T09:57:01
37,034,036
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.romullogirardi.huntersharklotofacilandroid.model.network; public class NetworkConstants { //CONSTANTES RELATIVAS AO Communicator public static final int COMMUNICATOR_SENDER_PORT = 6667; public static final int COMMUNICATOR_RECEIVER_PORT = 6667; public static int COMMUNICATOR_TRIES = 5; public static int COMMUNICATOR_TIMEOUT = 8000; // Valor em ms }
UTF-8
Java
370
java
NetworkConstants.java
Java
[ { "context": "package com.romullogirardi.huntersharklotofacilandroid.model.network;\n\npubli", "end": 26, "score": 0.716738224029541, "start": 15, "tag": "USERNAME", "value": "ullogirardi" } ]
null
[]
package com.romullogirardi.huntersharklotofacilandroid.model.network; public class NetworkConstants { //CONSTANTES RELATIVAS AO Communicator public static final int COMMUNICATOR_SENDER_PORT = 6667; public static final int COMMUNICATOR_RECEIVER_PORT = 6667; public static int COMMUNICATOR_TRIES = 5; public static int COMMUNICATOR_TIMEOUT = 8000; // Valor em ms }
370
0.802703
0.767568
10
36.099998
25.594727
69
false
false
0
0
0
0
0
0
1.1
false
false
9
bdcecb130ba4d1f6b1fd7774f9e11209df07b7bb
27,419,071,280,426
8eab9aa0ca721568838aed2f7f316f4864158ad3
/sequenceGenerator/SequenceGenerator.java
50b213f4da162eb7e6b02f8516ce3a4b3c1c10eb
[]
no_license
kamilagalka/sorting_algorithms
https://github.com/kamilagalka/sorting_algorithms
0d401f41f9efe191eae1f9a298a27d5bb57af8ac
6a92a0b22fdd6d2762bfe39dc665941680ccd483
refs/heads/master
2022-04-10T19:14:53.700000
2020-03-17T17:24:45
2020-03-17T17:24:45
184,641,349
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; import java.util.Random; public class SequenceGenerator { private static void saveSequence(int[][] array, String filename) { try { ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(filename)); objectOutputStream.writeObject(array); } catch (IOException e) { System.out.println("No such file"); } } int[] generateRandomSequence(int length, int lowerBound, int upperBound) { if (upperBound > 0 && lowerBound < 0 || lowerBound == 0 && upperBound > 0) { upperBound += 1; } int[] sequence = new int[length]; Random random = new Random(); for (int i = 0; i < length; i++) { sequence[i] = random.nextInt(upperBound - lowerBound) + lowerBound; } return sequence; } int[] generateSortedSequence(int length, int lowerBound, int upperBound) { int[] sequence = generateRandomSequence(length, lowerBound, upperBound); Quicksort quicksort = new Quicksort(); quicksort.runAlgorithm(sequence); return sequence; } int[] generateHalfSortedSequence(int length, int lowerBound, int upperBound) { int[] sortedHalf = generateSortedSequence(length / 2, lowerBound, lowerBound + (upperBound - lowerBound) / 2); int[] randomHalf = generateRandomSequence(length / 2, lowerBound + (upperBound - lowerBound) / 2, upperBound); int[] sequence = new int[length]; for (int i = 0; i < length / 2; i++) { sequence[i] = sortedHalf[i]; sequence[i + length / 2] = randomHalf[i]; } return sequence; } int[] generateSortedBackwardsSequence(int length, int lowerBound, int upperBound) { int[] sequenceInAscendingOrder = generateSortedSequence(length, lowerBound, upperBound); int[] sequence = new int[length]; for (int i = length - 1; i >= 0; i--) { sequence[length - 1 - i] = sequenceInAscendingOrder[i]; } return sequence; } private static void clearAllSequences(int[] sequence_lengths) { String[] sequence_types = new String[4]; sequence_types[0] = "random"; sequence_types[1] = "half_sorted"; sequence_types[2] = "sorted"; sequence_types[3] = "sorted_backwards"; try { PrintWriter pw; for (int sequence_length : sequence_lengths) { for (String sequence_type : sequence_types) { pw = new PrintWriter("sequences\\" + ((Integer) sequence_length).toString() + "_" + sequence_type + ".txt"); pw.print(""); pw.close(); } } } catch (IOException e) { System.out.println("No such file"); } } public static void main(String[] args) { SequenceGenerator sequenceGenerator = new SequenceGenerator(); int numberOfSequences = 100; int lowerBound = -100000; int upperBound = 100000; int[] sequence_lengths = new int[4]; sequence_lengths[0] = 100000; sequence_lengths[1] = 500000; sequence_lengths[2] = 1000000; sequence_lengths[3] = 2000000; clearAllSequences(sequence_lengths); for (int sequence_length : sequence_lengths) { int[][] randomSequences = new int[numberOfSequences][]; int[][] halfSortedSequences = new int[numberOfSequences][]; int[][] sortedSequences = new int[numberOfSequences][]; int[][] sortedBackwardsSequences = new int[numberOfSequences][]; for (int i = 0; i < numberOfSequences; i++) { randomSequences[i] = sequenceGenerator.generateRandomSequence(sequence_length, lowerBound, upperBound);// "sequences\\" + ((Integer) sequence_length).toString() + "_random.txt") halfSortedSequences[i] = sequenceGenerator.generateHalfSortedSequence(sequence_length, lowerBound, upperBound); //"sequences\\" + ((Integer) sequence_length).toString() + "_half_sorted.txt"; } saveSequence(randomSequences, "sequences\\" + ((Integer) sequence_length).toString() + "_random.txt"); saveSequence(halfSortedSequences, "sequences\\" + ((Integer) sequence_length).toString() + "_half_sorted.txt"); randomSequences = null; halfSortedSequences = null; for (int i = 0; i < numberOfSequences; i++) { sortedSequences[i] = sequenceGenerator.generateSortedSequence(sequence_length, lowerBound, upperBound); //"sequences\\" + ((Integer) sequence_length).toString() + "_sorted.txt"); sortedBackwardsSequences[i] = sequenceGenerator.generateSortedBackwardsSequence(sequence_length, lowerBound, upperBound);// "sequences\\" + ((Integer) sequence_length).toString() + "_sorted_backwards.txt"); } saveSequence(sortedSequences, "sequences\\" + ((Integer) sequence_length).toString() + "_sorted.txt"); saveSequence(sortedBackwardsSequences, "sequences\\" + ((Integer) sequence_length).toString() + "_sorted_backwards.txt"); } } }
UTF-8
Java
5,216
java
SequenceGenerator.java
Java
[]
null
[]
import java.io.*; import java.util.Random; public class SequenceGenerator { private static void saveSequence(int[][] array, String filename) { try { ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(filename)); objectOutputStream.writeObject(array); } catch (IOException e) { System.out.println("No such file"); } } int[] generateRandomSequence(int length, int lowerBound, int upperBound) { if (upperBound > 0 && lowerBound < 0 || lowerBound == 0 && upperBound > 0) { upperBound += 1; } int[] sequence = new int[length]; Random random = new Random(); for (int i = 0; i < length; i++) { sequence[i] = random.nextInt(upperBound - lowerBound) + lowerBound; } return sequence; } int[] generateSortedSequence(int length, int lowerBound, int upperBound) { int[] sequence = generateRandomSequence(length, lowerBound, upperBound); Quicksort quicksort = new Quicksort(); quicksort.runAlgorithm(sequence); return sequence; } int[] generateHalfSortedSequence(int length, int lowerBound, int upperBound) { int[] sortedHalf = generateSortedSequence(length / 2, lowerBound, lowerBound + (upperBound - lowerBound) / 2); int[] randomHalf = generateRandomSequence(length / 2, lowerBound + (upperBound - lowerBound) / 2, upperBound); int[] sequence = new int[length]; for (int i = 0; i < length / 2; i++) { sequence[i] = sortedHalf[i]; sequence[i + length / 2] = randomHalf[i]; } return sequence; } int[] generateSortedBackwardsSequence(int length, int lowerBound, int upperBound) { int[] sequenceInAscendingOrder = generateSortedSequence(length, lowerBound, upperBound); int[] sequence = new int[length]; for (int i = length - 1; i >= 0; i--) { sequence[length - 1 - i] = sequenceInAscendingOrder[i]; } return sequence; } private static void clearAllSequences(int[] sequence_lengths) { String[] sequence_types = new String[4]; sequence_types[0] = "random"; sequence_types[1] = "half_sorted"; sequence_types[2] = "sorted"; sequence_types[3] = "sorted_backwards"; try { PrintWriter pw; for (int sequence_length : sequence_lengths) { for (String sequence_type : sequence_types) { pw = new PrintWriter("sequences\\" + ((Integer) sequence_length).toString() + "_" + sequence_type + ".txt"); pw.print(""); pw.close(); } } } catch (IOException e) { System.out.println("No such file"); } } public static void main(String[] args) { SequenceGenerator sequenceGenerator = new SequenceGenerator(); int numberOfSequences = 100; int lowerBound = -100000; int upperBound = 100000; int[] sequence_lengths = new int[4]; sequence_lengths[0] = 100000; sequence_lengths[1] = 500000; sequence_lengths[2] = 1000000; sequence_lengths[3] = 2000000; clearAllSequences(sequence_lengths); for (int sequence_length : sequence_lengths) { int[][] randomSequences = new int[numberOfSequences][]; int[][] halfSortedSequences = new int[numberOfSequences][]; int[][] sortedSequences = new int[numberOfSequences][]; int[][] sortedBackwardsSequences = new int[numberOfSequences][]; for (int i = 0; i < numberOfSequences; i++) { randomSequences[i] = sequenceGenerator.generateRandomSequence(sequence_length, lowerBound, upperBound);// "sequences\\" + ((Integer) sequence_length).toString() + "_random.txt") halfSortedSequences[i] = sequenceGenerator.generateHalfSortedSequence(sequence_length, lowerBound, upperBound); //"sequences\\" + ((Integer) sequence_length).toString() + "_half_sorted.txt"; } saveSequence(randomSequences, "sequences\\" + ((Integer) sequence_length).toString() + "_random.txt"); saveSequence(halfSortedSequences, "sequences\\" + ((Integer) sequence_length).toString() + "_half_sorted.txt"); randomSequences = null; halfSortedSequences = null; for (int i = 0; i < numberOfSequences; i++) { sortedSequences[i] = sequenceGenerator.generateSortedSequence(sequence_length, lowerBound, upperBound); //"sequences\\" + ((Integer) sequence_length).toString() + "_sorted.txt"); sortedBackwardsSequences[i] = sequenceGenerator.generateSortedBackwardsSequence(sequence_length, lowerBound, upperBound);// "sequences\\" + ((Integer) sequence_length).toString() + "_sorted_backwards.txt"); } saveSequence(sortedSequences, "sequences\\" + ((Integer) sequence_length).toString() + "_sorted.txt"); saveSequence(sortedBackwardsSequences, "sequences\\" + ((Integer) sequence_length).toString() + "_sorted_backwards.txt"); } } }
5,216
0.607745
0.594517
118
43.203388
44.847305
222
false
false
0
0
0
0
0
0
0.864407
false
false
9
fa9b8f0f1b6c3ed8e78d3eed99e9bc63003d78a6
16,192,026,716,141
c3fd707a6b2a23d24cc76587465ae5cb86319fa7
/sally/src/main/java/com/quicksoft/sally/model/PlantillaModel.java
01776e3d0c706b6b55e91ebf1acbd12240b8cd01
[]
no_license
JuanDanielCR/Sally
https://github.com/JuanDanielCR/Sally
dc0968564da64ca6eeded48189b032fd2dd10769
de588e05cbb300c65851880f4aa7e0220c259d9c
refs/heads/master
2021-08-28T05:32:05.814000
2017-12-11T09:11:41
2017-12-11T09:11:41
111,438,212
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.quicksoft.sally.model; public class PlantillaModel { private Integer estatus; private ClienteModel creador; private ClienteModel dueño; private String objetivo; public PlantillaModel() { super(); } public PlantillaModel(Integer estatus, ClienteModel creador, ClienteModel dueño, String objetivo) { super(); this.estatus = estatus; this.creador = creador; this.dueño = dueño; this.objetivo = objetivo; } public Integer getEstatus() { return estatus; } public void setEstatus(Integer estatus) { this.estatus = estatus; } public ClienteModel getCreador() { return creador; } public void setCreador(ClienteModel creador) { this.creador = creador; } public ClienteModel getDueño() { return dueño; } public void setDueño(ClienteModel dueño) { this.dueño = dueño; } public String getObjetivo() { return objetivo; } public void setObjetivo(String objetivo) { this.objetivo = objetivo; } }
UTF-8
Java
960
java
PlantillaModel.java
Java
[]
null
[]
package com.quicksoft.sally.model; public class PlantillaModel { private Integer estatus; private ClienteModel creador; private ClienteModel dueño; private String objetivo; public PlantillaModel() { super(); } public PlantillaModel(Integer estatus, ClienteModel creador, ClienteModel dueño, String objetivo) { super(); this.estatus = estatus; this.creador = creador; this.dueño = dueño; this.objetivo = objetivo; } public Integer getEstatus() { return estatus; } public void setEstatus(Integer estatus) { this.estatus = estatus; } public ClienteModel getCreador() { return creador; } public void setCreador(ClienteModel creador) { this.creador = creador; } public ClienteModel getDueño() { return dueño; } public void setDueño(ClienteModel dueño) { this.dueño = dueño; } public String getObjetivo() { return objetivo; } public void setObjetivo(String objetivo) { this.objetivo = objetivo; } }
960
0.730526
0.730526
44
20.59091
18.430851
100
false
false
0
0
0
0
0
0
1.727273
false
false
9
e4ec80bbabc612d23524ebc4b058f0590593b340
18,519,899,029,367
fd17c0e91ab7f9bc2880081045b13185b460136b
/app/src/main/java/gv_fiqst/ghostfollower/data/dagger/DbModule.java
ab76099248def8c34b568bc8108c479ea64c2788
[]
no_license
GVFiQst/GhostFollower
https://github.com/GVFiQst/GhostFollower
aa61901d0fb983e57dd880480296a17d57ecb4ea
8b69dcc1293e4b9a4abae6fbe5ba965bd2a3bc3c
refs/heads/master
2020-03-15T17:23:28.051000
2018-05-05T15:13:06
2018-05-05T15:13:06
132,258,881
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gv_fiqst.ghostfollower.data.dagger; import android.arch.persistence.room.Room; import android.content.Context; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import gv_fiqst.ghostfollower.data.impl.DbChooserImpl; import gv_fiqst.ghostfollower.data.impl.GfDatabase; import gv_fiqst.ghostfollower.data.impl.InstagramRepository; import gv_fiqst.ghostfollower.data.impl.TwitterRepository; import gv_fiqst.ghostfollower.domain.repo.DbChooser; @Module public class DbModule { @Provides @Singleton GfDatabase provideDatabase(Context context) { return Room.databaseBuilder(context, GfDatabase.class, "GhostFollowerDatabase").build(); } @Provides @Singleton TwitterRepository provideRoomRepository(GfDatabase database) { return new TwitterRepository(database); } @Provides @Singleton InstagramRepository provideInstagramRepository(GfDatabase database) { return new InstagramRepository(database); } @Provides @Singleton DbChooser provideDbChooser(TwitterRepository twitter, InstagramRepository instagram) { return new DbChooserImpl(twitter, instagram); } }
UTF-8
Java
1,190
java
DbModule.java
Java
[]
null
[]
package gv_fiqst.ghostfollower.data.dagger; import android.arch.persistence.room.Room; import android.content.Context; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import gv_fiqst.ghostfollower.data.impl.DbChooserImpl; import gv_fiqst.ghostfollower.data.impl.GfDatabase; import gv_fiqst.ghostfollower.data.impl.InstagramRepository; import gv_fiqst.ghostfollower.data.impl.TwitterRepository; import gv_fiqst.ghostfollower.domain.repo.DbChooser; @Module public class DbModule { @Provides @Singleton GfDatabase provideDatabase(Context context) { return Room.databaseBuilder(context, GfDatabase.class, "GhostFollowerDatabase").build(); } @Provides @Singleton TwitterRepository provideRoomRepository(GfDatabase database) { return new TwitterRepository(database); } @Provides @Singleton InstagramRepository provideInstagramRepository(GfDatabase database) { return new InstagramRepository(database); } @Provides @Singleton DbChooser provideDbChooser(TwitterRepository twitter, InstagramRepository instagram) { return new DbChooserImpl(twitter, instagram); } }
1,190
0.767227
0.767227
43
26.674419
26.410641
96
false
false
0
0
0
0
0
0
0.44186
false
false
9
7c4fe6b09d77f137b59fb46e44586fe052ab6fc1
24,661,702,263,054
8f91cc6bdebfe1ff6a619bca550796ddb46eede8
/web/src/main/java/com/nilo/dms/web/controller/mobile/ProblemController.java
1b59355c5880c46a769d27ba2ad511b97274c69f
[]
no_license
biubiubiu255/nilo-dms
https://github.com/biubiubiu255/nilo-dms
3a0ea594a3091144d7a823e69d8530d293848ae1
81dd1774cd0ace2c77516d0f1b836e99146d084c
refs/heads/master
2021-04-03T06:45:39.207000
2018-05-22T12:04:22
2018-05-22T12:04:22
125,043,212
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nilo.dms.web.controller.mobile; import com.alibaba.fastjson.JSON; import com.nilo.dms.common.Principal; import com.nilo.dms.service.order.AbnormalOrderService; import com.nilo.dms.service.order.RiderOptService; import com.nilo.dms.service.order.model.AbnormalOrder; import com.nilo.dms.service.order.model.AbnormalParam; import com.nilo.dms.web.controller.BaseController; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpRequest; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import java.util.Arrays; @Controller @RequestMapping("/mobile/rider/problem") public class ProblemController extends BaseController { @Autowired private RiderOptService riderOptService; @RequestMapping(value = "/scan.html") public String customers() { return "mobile/rider/problem/scan"; } @RequestMapping(value = "/save.html", method = RequestMethod.POST) @ResponseBody public String save(@RequestParam("logisticsNo") String orderNo, @RequestParam("reason") String reason, @RequestParam("memo") String remark) { Principal me = (Principal) SecurityUtils.getSubject().getPrincipal(); //获取merchantId String merchantId = me.getMerchantId(); try { AbnormalParam param = new AbnormalParam(); param.setMerchantId(merchantId); param.setOptBy(me.getUserId()); param.setRemark(remark); param.setOrderNo(orderNo); param.setReason(reason); riderOptService.refuse(param); } catch (Exception e) { return toJsonErrorMsg(e.getMessage()); } return toJsonTrueMsg(); } }
UTF-8
Java
2,061
java
ProblemController.java
Java
[]
null
[]
package com.nilo.dms.web.controller.mobile; import com.alibaba.fastjson.JSON; import com.nilo.dms.common.Principal; import com.nilo.dms.service.order.AbnormalOrderService; import com.nilo.dms.service.order.RiderOptService; import com.nilo.dms.service.order.model.AbnormalOrder; import com.nilo.dms.service.order.model.AbnormalParam; import com.nilo.dms.web.controller.BaseController; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpRequest; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import java.util.Arrays; @Controller @RequestMapping("/mobile/rider/problem") public class ProblemController extends BaseController { @Autowired private RiderOptService riderOptService; @RequestMapping(value = "/scan.html") public String customers() { return "mobile/rider/problem/scan"; } @RequestMapping(value = "/save.html", method = RequestMethod.POST) @ResponseBody public String save(@RequestParam("logisticsNo") String orderNo, @RequestParam("reason") String reason, @RequestParam("memo") String remark) { Principal me = (Principal) SecurityUtils.getSubject().getPrincipal(); //获取merchantId String merchantId = me.getMerchantId(); try { AbnormalParam param = new AbnormalParam(); param.setMerchantId(merchantId); param.setOptBy(me.getUserId()); param.setRemark(remark); param.setOrderNo(orderNo); param.setReason(reason); riderOptService.refuse(param); } catch (Exception e) { return toJsonErrorMsg(e.getMessage()); } return toJsonTrueMsg(); } }
2,061
0.725328
0.725328
64
31.140625
24.010979
84
false
false
0
0
0
0
0
0
0.671875
false
false
9
c7ea002ee4f469426737edf98fbd2fa598cee47d
4,913,442,647,033
14dd5b54a32488fb258d15258e3945e19a966d5a
/code/tweetsccore/src/test/java/com/jmorenov/tweetsccore/candidates/method/AccentedCandidatesMethodTest.java
f568035c3a3f8ea763b26efd52ec50f5f7421de8
[ "MIT" ]
permissive
jmorenov/TweetSC
https://github.com/jmorenov/TweetSC
3c2fb6e0df5c04d3634dccf684423b7d05c81b23
e380ae788fa34081508253de61c711c03e03bacc
refs/heads/master
2021-03-19T15:21:28.206000
2018-07-18T21:51:32
2018-07-18T21:51:32
123,106,193
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jmorenov.tweetsccore.candidates.method; import com.jmorenov.tweetsccore.candidates.Candidate; import com.jmorenov.tweetsccore.candidates.method.AccentedCandidatesMethod; import com.jmorenov.tweetsccore.extra.OOV; import org.junit.Test; import java.util.List; import static junit.framework.TestCase.assertEquals; public class AccentedCandidatesMethodTest { @Test public void accentedCandidatesMethodShouldGenerateTheCorrectCandidatesFromCamion () { OOV oov = new OOV("camion", 0, 5); AccentedCandidatesMethod method = new AccentedCandidatesMethod(); List<Candidate> candidates = method.generateCandidates(oov); assertEquals("Error generating candidates", 1, candidates.size()); assertEquals("Error generating candidates", "camión", candidates.get(0).getCandidate()); } @Test public void accentedCandidatesMethodShouldGenerateTheCorrectCandidatesFromEspana () { OOV oov = new OOV("espana", 0, 5); AccentedCandidatesMethod method = new AccentedCandidatesMethod(); List<Candidate> candidates = method.generateCandidates(oov); assertEquals("Error generating candidates", 1, candidates.size()); assertEquals("Error generating candidates", "España", candidates.get(0).getCandidate()); } }
UTF-8
Java
1,307
java
AccentedCandidatesMethodTest.java
Java
[]
null
[]
package com.jmorenov.tweetsccore.candidates.method; import com.jmorenov.tweetsccore.candidates.Candidate; import com.jmorenov.tweetsccore.candidates.method.AccentedCandidatesMethod; import com.jmorenov.tweetsccore.extra.OOV; import org.junit.Test; import java.util.List; import static junit.framework.TestCase.assertEquals; public class AccentedCandidatesMethodTest { @Test public void accentedCandidatesMethodShouldGenerateTheCorrectCandidatesFromCamion () { OOV oov = new OOV("camion", 0, 5); AccentedCandidatesMethod method = new AccentedCandidatesMethod(); List<Candidate> candidates = method.generateCandidates(oov); assertEquals("Error generating candidates", 1, candidates.size()); assertEquals("Error generating candidates", "camión", candidates.get(0).getCandidate()); } @Test public void accentedCandidatesMethodShouldGenerateTheCorrectCandidatesFromEspana () { OOV oov = new OOV("espana", 0, 5); AccentedCandidatesMethod method = new AccentedCandidatesMethod(); List<Candidate> candidates = method.generateCandidates(oov); assertEquals("Error generating candidates", 1, candidates.size()); assertEquals("Error generating candidates", "España", candidates.get(0).getCandidate()); } }
1,307
0.748659
0.742529
32
39.78125
33.796944
96
false
false
0
0
0
0
68
0.104215
0.90625
false
false
9
2365f3e6a37fde0a525877fc34b91a238917f466
4,707,284,199,770
95fcf359f2816ac60f8f1678824881f297b73618
/src/zone/webtraining/bookmarker/dao/BookmarksDatabaseDao.java
34ac1a755a144a7dd95b71ea7bdab5e3a08a8d0f
[]
no_license
webtrainingmx/curso-profesional-java-noviembre-2017
https://github.com/webtrainingmx/curso-profesional-java-noviembre-2017
8eb195d7f13da02ac84b859f3ac570cace8f834b
dbf6ae19251d94c32c39d2b3126c208ac0a0387e
refs/heads/master
2021-08-24T03:37:04.512000
2017-12-07T22:38:21
2017-12-07T22:38:21
112,413,284
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package zone.webtraining.bookmarker.dao; import zone.webtraining.bookmarker.models.Bookmark; import java.util.Collection; public class BookmarksDatabaseDao implements BookmarksDao { public Collection<Bookmark> getAll() { return null; } public Bookmark get(Long id) { return null; } public Bookmark update(Bookmark bookmark) { return null; } public Bookmark create(Bookmark bookmark) { return null; } public Bookmark delete(Bookmark bookmark) { return null; } }
UTF-8
Java
547
java
BookmarksDatabaseDao.java
Java
[]
null
[]
package zone.webtraining.bookmarker.dao; import zone.webtraining.bookmarker.models.Bookmark; import java.util.Collection; public class BookmarksDatabaseDao implements BookmarksDao { public Collection<Bookmark> getAll() { return null; } public Bookmark get(Long id) { return null; } public Bookmark update(Bookmark bookmark) { return null; } public Bookmark create(Bookmark bookmark) { return null; } public Bookmark delete(Bookmark bookmark) { return null; } }
547
0.67276
0.67276
27
19.296297
19.32723
59
false
false
0
0
0
0
0
0
0.296296
false
false
9
eda265c6c9aa78676caad0329ab1a920d4cb7071
7,919,919,709,225
c0107bbc5d258171fd5be858573155ba4dfbf017
/PrevfixToBinaryTree/src/prevfixtobinarytree/PrevfixToBinaryTree.java
e220481656f6fd218f2ba93acbbf2e2b6f5c4998
[]
no_license
maglorelensar/DataStructures
https://github.com/maglorelensar/DataStructures
aeec3c49e540831cddc8abf55eb6c7df2113004d
0af366be62d25f5ab995eb4817e8a1352948fea2
refs/heads/master
2021-01-09T13:46:47.857000
2020-02-23T10:15:57
2020-02-23T10:15:57
242,324,300
6
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 prevfixtobinarytree; import java.util.Stack; /** * * @author Casper */ public class PrevfixToBinaryTree { public static void main(String args[]) { infixToPostfix itp=new infixToPostfix(); prevfixToTree ptt = new prevfixToTree(); String postfix = itp.infixToPostfix("(a+b)*(c-d)"); char[] charDizi = postfix.toCharArray(); Dugum root = ptt.prevfixTree(charDizi); System.out.println("Sıralanmadan Önce"); System.out.println("(a+b)*(c-d)"); System.out.println("İnOrder Sıralama Tree"); ptt.inorder(root); System.out.println(" "); System.out.println("Postorder Sıralama Tree"); ptt.postorder(root); System.out.println(" "); System.out.println("Prevorder Sıralama Tree"); ptt.prevorder(root); } }
UTF-8
Java
1,054
java
PrevfixToBinaryTree.java
Java
[ { "context": "ytree;\n\nimport java.util.Stack;\n\n/**\n *\n * @author Casper\n */\n\n\npublic class PrevfixToBinaryTree {\n\n \n\n ", "end": 264, "score": 0.9978128671646118, "start": 258, "tag": "NAME", "value": "Casper" } ]
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 prevfixtobinarytree; import java.util.Stack; /** * * @author Casper */ public class PrevfixToBinaryTree { public static void main(String args[]) { infixToPostfix itp=new infixToPostfix(); prevfixToTree ptt = new prevfixToTree(); String postfix = itp.infixToPostfix("(a+b)*(c-d)"); char[] charDizi = postfix.toCharArray(); Dugum root = ptt.prevfixTree(charDizi); System.out.println("Sıralanmadan Önce"); System.out.println("(a+b)*(c-d)"); System.out.println("İnOrder Sıralama Tree"); ptt.inorder(root); System.out.println(" "); System.out.println("Postorder Sıralama Tree"); ptt.postorder(root); System.out.println(" "); System.out.println("Prevorder Sıralama Tree"); ptt.prevorder(root); } }
1,054
0.624046
0.624046
41
24.560976
22.508587
79
false
false
0
0
0
0
0
0
0.487805
false
false
9
309b6e5f519572f21bd7d375a27dda8fef1f5503
21,380,347,210,039
2107eeb770672fdad44dc6364876a5e12fb08a07
/app/src/main/java/com/cola/myapplication/MyAppWidgetProvider.java
313fd6856c76a556a27067a03ecca0b1eefb8cc0
[]
no_license
coalwang/MyApplication5
https://github.com/coalwang/MyApplication5
ff8283aadae1efba0aba97e52bfc2809773f3508
0314bfdfb49faf6a2513d3f974f19afa214fbccd
refs/heads/master
2020-04-16T17:33:08.015000
2019-01-15T03:44:32
2019-01-15T03:44:32
165,779,543
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cola.myapplication; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.widget.Toast; public class MyAppWidgetProvider extends AppWidgetProvider { @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (intent.getAction().equals("ACTION_CLICK")){ Toast.makeText(context, "被点击了", Toast.LENGTH_SHORT).show(); } } //每次桌面小部件更新时都调用一次该方法 @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); } }
UTF-8
Java
792
java
MyAppWidgetProvider.java
Java
[]
null
[]
package com.cola.myapplication; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.widget.Toast; public class MyAppWidgetProvider extends AppWidgetProvider { @Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (intent.getAction().equals("ACTION_CLICK")){ Toast.makeText(context, "被点击了", Toast.LENGTH_SHORT).show(); } } //每次桌面小部件更新时都调用一次该方法 @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); } }
792
0.729947
0.729947
25
28.92
26.746096
98
false
false
0
0
0
0
0
0
0.68
false
false
9
9a84bf49e14958a65d53167a42939a9bd9a1977f
13,692,355,776,908
3dde1ab78ceb707a6ecd6d78e1e100512d1caac8
/src/com/chat/client/Client.java
3861e76cefb245bff6a30fb8c51d4f242fd36680
[]
no_license
EvgeniySiganov/Chat
https://github.com/EvgeniySiganov/Chat
9e5b7bde9c644d04d91beadc0e3746e14cb6ecf8
a5a15efd22f8d3703ae65badb1a705653d9d7df1
refs/heads/master
2023-04-09T06:20:16.782000
2021-04-23T15:15:44
2021-04-23T15:15:44
360,924,227
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.chat.client; import com.chat.Connection; import com.chat.ConsoleHelper; import com.chat.Message; import com.chat.MessageType; import java.io.IOException; import java.net.Socket; /** * Client exchange messages with Server */ public class Client { protected Connection connection; /** * clientConnected is true when Client connected with Server */ private volatile boolean clientConnected; public static void main(String[] args) { new Client().run(); } /** * Create support thread and wait until it connect with Server. * Read message with console and send it to Server * Enter "exit" for finish typing text */ public void run() { SocketThread socketThread = getSocketThread(); socketThread.setDaemon(true); socketThread.start(); synchronized (this) { try { wait(); } catch (InterruptedException e) { ConsoleHelper.writeMessage("Error during instant connecting with Server from address: " + connection.getRemoteSocketAddress()); return; } } if (clientConnected) { ConsoleHelper.writeMessage("Соединение установлено.\n" + "Для выхода наберите команду 'exit'."); } else { ConsoleHelper.writeMessage("Произошла ошибка во время работы клиента."); return; } //this is were are sent messages from to the server when connect fixed while (clientConnected) { String text = ConsoleHelper.readString(); if ("exit".equals(text)) { break; } if(shouldSendTextFromConsole()){ //main thread writing to sendTextMessage(text); } } } /** * Request server address * @return String server address */ protected String getServerAddress() { ConsoleHelper.writeMessage("Enter server address"); return ConsoleHelper.readString(); } /** * Request server port * * @return int server port */ protected int getServerPort() { ConsoleHelper.writeMessage("Enter server port"); return ConsoleHelper.readInt(); } /** * Request user name * * @return String user name */ protected String getUserName() { ConsoleHelper.writeMessage("Enter your name"); return ConsoleHelper.readString(); } /** * In current version this Client always return true * Further if Client will don`t must send text in console, this method will override and return false * * @return boolean true */ protected boolean shouldSendTextFromConsole() { return true; } /** * Create new instance SocketTread * * @return new instance SocketTread */ protected SocketThread getSocketThread() { return new SocketThread(); } /** * Create text message and send it to Server * If IOException will be thrown the field clientConnected value will be set false * * @param text content that will be send to Server */ protected void sendTextMessage(String text) { try { connection.send(new Message(MessageType.TEXT, text)); } catch (IOException e) { ConsoleHelper.writeMessage("Error during sending text message from address: " + connection.getRemoteSocketAddress()); clientConnected = false; } } /** * SocketTread response for socket connection and reading Server messages */ public class SocketThread extends Thread { @Override public void run() { String address = getServerAddress(); int port = getServerPort(); try (Socket socket = new Socket(address, port)){ connection = new Connection(socket); clientHandshake(); //additional thread listening to clientMainLoop(); } catch (IOException | ClassNotFoundException e) { notifyConnectionStatusChanged(false); } } /** * This method represents Client for Server * @throws IOException when message type incorrect * @throws ClassNotFoundException when deserialize is failed */ protected void clientHandshake() throws IOException, ClassNotFoundException{ while (true){ Message messageReceive = connection.receive(); if(messageReceive.getType() == MessageType.NAME_REQUEST){ connection.send(new Message(MessageType.USER_NAME, getUserName())); } else if(messageReceive.getType() == MessageType.NAME_ACCEPTED){ notifyConnectionStatusChanged(true); break; } else { throw new IOException("Unexpected MessageType"); } } } /** * General loop for processing messages * @throws IOException when message type incorrect * @throws ClassNotFoundException when deserialize is failed */ protected void clientMainLoop()throws IOException, ClassNotFoundException{ while (true){ Message messageReceive = connection.receive(); if(messageReceive.getType() == MessageType.TEXT){ processIncomingMessage(messageReceive.getData()); } else if(messageReceive.getType() == MessageType.USER_ADDED){ informAboutAddingNewUser(messageReceive.getData()); } else if(messageReceive.getType() == MessageType.USER_REMOVED){ informAboutDeletingNewUser(messageReceive.getData()); } else { throw new IOException("Unexpected MessageType"); } } } /** * Print text message in console * @param message this text will print in console */ protected void processIncomingMessage(String message){ ConsoleHelper.writeMessage(message); } /** * Print notification about joining user to chat * @param userName this name will print in console */ protected void informAboutAddingNewUser(String userName){ ConsoleHelper.writeMessage(userName + " joined to chat"); } /** * Print notification about deleting user from chat * @param userName this name will print in console */ protected void informAboutDeletingNewUser(String userName){ ConsoleHelper.writeMessage(userName + " going out from chat"); } /** * Sets the value clientConnected for outer class Client * Notify waiting thread started from outer class Client * @param clientConnected is true for Client connected with Server */ protected void notifyConnectionStatusChanged(boolean clientConnected){ Client.this.clientConnected = clientConnected; synchronized (Client.this){ Client.this.notify(); } } } }
UTF-8
Java
7,536
java
Client.java
Java
[]
null
[]
package com.chat.client; import com.chat.Connection; import com.chat.ConsoleHelper; import com.chat.Message; import com.chat.MessageType; import java.io.IOException; import java.net.Socket; /** * Client exchange messages with Server */ public class Client { protected Connection connection; /** * clientConnected is true when Client connected with Server */ private volatile boolean clientConnected; public static void main(String[] args) { new Client().run(); } /** * Create support thread and wait until it connect with Server. * Read message with console and send it to Server * Enter "exit" for finish typing text */ public void run() { SocketThread socketThread = getSocketThread(); socketThread.setDaemon(true); socketThread.start(); synchronized (this) { try { wait(); } catch (InterruptedException e) { ConsoleHelper.writeMessage("Error during instant connecting with Server from address: " + connection.getRemoteSocketAddress()); return; } } if (clientConnected) { ConsoleHelper.writeMessage("Соединение установлено.\n" + "Для выхода наберите команду 'exit'."); } else { ConsoleHelper.writeMessage("Произошла ошибка во время работы клиента."); return; } //this is were are sent messages from to the server when connect fixed while (clientConnected) { String text = ConsoleHelper.readString(); if ("exit".equals(text)) { break; } if(shouldSendTextFromConsole()){ //main thread writing to sendTextMessage(text); } } } /** * Request server address * @return String server address */ protected String getServerAddress() { ConsoleHelper.writeMessage("Enter server address"); return ConsoleHelper.readString(); } /** * Request server port * * @return int server port */ protected int getServerPort() { ConsoleHelper.writeMessage("Enter server port"); return ConsoleHelper.readInt(); } /** * Request user name * * @return String user name */ protected String getUserName() { ConsoleHelper.writeMessage("Enter your name"); return ConsoleHelper.readString(); } /** * In current version this Client always return true * Further if Client will don`t must send text in console, this method will override and return false * * @return boolean true */ protected boolean shouldSendTextFromConsole() { return true; } /** * Create new instance SocketTread * * @return new instance SocketTread */ protected SocketThread getSocketThread() { return new SocketThread(); } /** * Create text message and send it to Server * If IOException will be thrown the field clientConnected value will be set false * * @param text content that will be send to Server */ protected void sendTextMessage(String text) { try { connection.send(new Message(MessageType.TEXT, text)); } catch (IOException e) { ConsoleHelper.writeMessage("Error during sending text message from address: " + connection.getRemoteSocketAddress()); clientConnected = false; } } /** * SocketTread response for socket connection and reading Server messages */ public class SocketThread extends Thread { @Override public void run() { String address = getServerAddress(); int port = getServerPort(); try (Socket socket = new Socket(address, port)){ connection = new Connection(socket); clientHandshake(); //additional thread listening to clientMainLoop(); } catch (IOException | ClassNotFoundException e) { notifyConnectionStatusChanged(false); } } /** * This method represents Client for Server * @throws IOException when message type incorrect * @throws ClassNotFoundException when deserialize is failed */ protected void clientHandshake() throws IOException, ClassNotFoundException{ while (true){ Message messageReceive = connection.receive(); if(messageReceive.getType() == MessageType.NAME_REQUEST){ connection.send(new Message(MessageType.USER_NAME, getUserName())); } else if(messageReceive.getType() == MessageType.NAME_ACCEPTED){ notifyConnectionStatusChanged(true); break; } else { throw new IOException("Unexpected MessageType"); } } } /** * General loop for processing messages * @throws IOException when message type incorrect * @throws ClassNotFoundException when deserialize is failed */ protected void clientMainLoop()throws IOException, ClassNotFoundException{ while (true){ Message messageReceive = connection.receive(); if(messageReceive.getType() == MessageType.TEXT){ processIncomingMessage(messageReceive.getData()); } else if(messageReceive.getType() == MessageType.USER_ADDED){ informAboutAddingNewUser(messageReceive.getData()); } else if(messageReceive.getType() == MessageType.USER_REMOVED){ informAboutDeletingNewUser(messageReceive.getData()); } else { throw new IOException("Unexpected MessageType"); } } } /** * Print text message in console * @param message this text will print in console */ protected void processIncomingMessage(String message){ ConsoleHelper.writeMessage(message); } /** * Print notification about joining user to chat * @param userName this name will print in console */ protected void informAboutAddingNewUser(String userName){ ConsoleHelper.writeMessage(userName + " joined to chat"); } /** * Print notification about deleting user from chat * @param userName this name will print in console */ protected void informAboutDeletingNewUser(String userName){ ConsoleHelper.writeMessage(userName + " going out from chat"); } /** * Sets the value clientConnected for outer class Client * Notify waiting thread started from outer class Client * @param clientConnected is true for Client connected with Server */ protected void notifyConnectionStatusChanged(boolean clientConnected){ Client.this.clientConnected = clientConnected; synchronized (Client.this){ Client.this.notify(); } } } }
7,536
0.58007
0.58007
243
29.683128
26.129513
105
false
false
0
0
0
0
0
0
0.251029
false
false
9
1395e0525742ff57cabf605bb3ac0821b088d269
747,324,320,326
5cc18516e1c60ca71ccf4ff35240e150faef0365
/src/sistemaGanadero/Camion.java
9b0c5a146cc89f02309811f3198e4917294b67c7
[]
no_license
alvaro-muri/tpeProg2
https://github.com/alvaro-muri/tpeProg2
61ab6da1be0b2713233b1d4c07cfe124eaa33a02
6fc3b0e4c9ba07cde7494712bb2ff81b16fbe01a
refs/heads/master
2020-08-27T14:15:27.703000
2019-11-20T19:35:04
2019-11-20T19:35:04
217,401,771
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sistemaGanadero; import java.util.ArrayList; public class Camion { private int capacidad; private ArrayList <Animal> animales; public Camion(int capacidad){ this.capacidad=capacidad; animales=new ArrayList <Animal>(); } public void CargarCamion(Condicion c,Lugar cl){ ArrayList <Animal> aux=cl.getAnimales(c); int i=0; while(i<capacidad && i<aux.size()){ animales.add(aux.get(i)); i++; } for(Animal a:animales) cl.venderAnimal(a); } public void printAnimales(){ for(Animal a: animales) System.out.println(a.print()); System.out.println(); } }
UTF-8
Java
588
java
Camion.java
Java
[]
null
[]
package sistemaGanadero; import java.util.ArrayList; public class Camion { private int capacidad; private ArrayList <Animal> animales; public Camion(int capacidad){ this.capacidad=capacidad; animales=new ArrayList <Animal>(); } public void CargarCamion(Condicion c,Lugar cl){ ArrayList <Animal> aux=cl.getAnimales(c); int i=0; while(i<capacidad && i<aux.size()){ animales.add(aux.get(i)); i++; } for(Animal a:animales) cl.venderAnimal(a); } public void printAnimales(){ for(Animal a: animales) System.out.println(a.print()); System.out.println(); } }
588
0.702381
0.70068
25
22.559999
13.365867
48
false
false
0
0
0
0
0
0
2.08
false
false
9
2a9ba60f3c3d27890fa3890cfc74d0e58bc94aae
747,324,320,722
6afff60ec87917babf022dc1e93caeaee904772e
/src/variabler1/Oppgave4.java
53d056605015fe8075519ab4764111e7f8524bf7
[]
no_license
s336154/ProgrammeringModuler
https://github.com/s336154/ProgrammeringModuler
27883e5d54dde4c886f8023a3c9e636f5a15e53e
e26da28ad8639309eceb3453df157cb306e816bd
refs/heads/master
2023-08-30T16:30:13.062000
2021-10-30T10:37:18
2021-10-30T10:37:18
422,851,438
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package variabler1; //Endre oppgave 3 slik at det vises følgende i meldingsboksen (f.eks inndata): // //Navn : Ole Olsen //Adresse : Osloveien 23 //Postnummer : 0470 //Poststed : Oslo //Alder : 21 år. // //Tips: bruk \n for å få ny linje import static javax.swing.JOptionPane. *; public class Oppgave4 { public static void main(String[] args) { String fornavn = showInputDialog("Skriv inn fornavn;"); String etternavn = showInputDialog("Skriv inn etternavn"); String alder = showInputDialog("Skriv inn alderen"); String adresse = showInputDialog("Skriv inn adressen"); String postnr = showInputDialog("Skriv inn postnnmmeret"); String poststed = showInputDialog("Skriv inn poststed"); String ut = "Navn : "+fornavn+" "+etternavn+ "\n" + "Adresse : "+adresse+"\n" + "Postnummer : "+postnr+"\n" + "Poststed : "+poststed+"\n" + "Alder : "+alder+" år."; showMessageDialog(null, ut); } }
UTF-8
Java
1,034
java
Oppgave4.java
Java
[ { "context": "ende i meldingsboksen (f.eks inndata):\n//\n//Navn : Ole Olsen\n//Adresse : Osloveien 23\n//Postnummer : 0470\n//Po", "end": 120, "score": 0.9998813271522522, "start": 111, "tag": "NAME", "value": "Ole Olsen" } ]
null
[]
package variabler1; //Endre oppgave 3 slik at det vises følgende i meldingsboksen (f.eks inndata): // //Navn : <NAME> //Adresse : Osloveien 23 //Postnummer : 0470 //Poststed : Oslo //Alder : 21 år. // //Tips: bruk \n for å få ny linje import static javax.swing.JOptionPane. *; public class Oppgave4 { public static void main(String[] args) { String fornavn = showInputDialog("Skriv inn fornavn;"); String etternavn = showInputDialog("Skriv inn etternavn"); String alder = showInputDialog("Skriv inn alderen"); String adresse = showInputDialog("Skriv inn adressen"); String postnr = showInputDialog("Skriv inn postnnmmeret"); String poststed = showInputDialog("Skriv inn poststed"); String ut = "Navn : "+fornavn+" "+etternavn+ "\n" + "Adresse : "+adresse+"\n" + "Postnummer : "+postnr+"\n" + "Poststed : "+poststed+"\n" + "Alder : "+alder+" år."; showMessageDialog(null, ut); } }
1,031
0.609329
0.598639
29
34.482758
23.707441
78
false
false
0
0
0
0
0
0
0.413793
false
false
9
1745c75a6dea335d2ec7f14612354857215420aa
6,717,328,861,584
25587613b4eb203ac093b4b93aefd6c738b2a3d5
/TextShared/src/main/java/com/bluebrim/text/impl/shared/xtg/CoXtgNullToken.java
fcc78e41bc350e1e4a352477eb9492acecb5f119
[ "Apache-2.0" ]
permissive
goranstack/bluebrim
https://github.com/goranstack/bluebrim
80b4f5d2aba0a5cadbda310d673b97ce64d84e6e
eb6edbeada72ed7fd1294391396432cb25575fe0
refs/heads/master
2021-05-02T07:39:42.782000
2018-06-19T14:30:14
2018-06-19T14:30:14
35,280,662
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bluebrim.text.impl.shared.xtg; /** * Xtg scanner null token * * @author: Dennis */ class CoXtgNullToken extends CoXtgToken { }
UTF-8
Java
147
java
CoXtgNullToken.java
Java
[ { "context": "tg;\n\n/**\n * Xtg scanner null token\n * \n * @author: Dennis\n */\n \nclass CoXtgNullToken extends CoXtgToken\n{\n}", "end": 96, "score": 0.9998182654380798, "start": 90, "tag": "NAME", "value": "Dennis" } ]
null
[]
package com.bluebrim.text.impl.shared.xtg; /** * Xtg scanner null token * * @author: Dennis */ class CoXtgNullToken extends CoXtgToken { }
147
0.693878
0.693878
11
12.363636
15.32243
42
false
false
0
0
0
0
0
0
0.090909
false
false
9
835dd40461233a47c222894ec12cbd82a727ab57
6,717,328,863,515
dc599e9ff38515bc4505450fa6b2a07f2bc83a3c
/algorithms/java/test/BitManipulation/BinaryWatchTest.java
91cf02a9e62b096a1a0304147198d99a3733706f
[]
no_license
Jack47/leetcode
https://github.com/Jack47/leetcode
dd53da8b884074f23bc04eb14429fe7a6bdf3aca
aed4f6a90b6a69ffcd737b919eb5ba0113a47d40
refs/heads/master
2021-01-10T16:27:41.855000
2018-07-20T08:53:36
2018-07-20T08:53:36
44,210,364
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package BitManipulation; import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.junit.Test; public class BinaryWatchTest { @Test public void test() { BinaryWatch bw = new BinaryWatch(); List<String> results = bw.readBinaryWatch(0); assertEquals("", new ArrayList<String>() { { add("0:00"); } }, results); results = bw.readBinaryWatch(1); assertEquals(new ArrayList<String>() { { add("0:01"); add("0:02"); add("0:04"); add("0:08"); add("0:16"); add("0:32"); add("1:00"); add("2:00"); add("4:00"); add("8:00"); } }, results); results = bw.readBinaryWatch(9); assertEquals(Collections.<String>emptyList(), results); } }
UTF-8
Java
1,013
java
BinaryWatchTest.java
Java
[]
null
[]
package BitManipulation; import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.junit.Test; public class BinaryWatchTest { @Test public void test() { BinaryWatch bw = new BinaryWatch(); List<String> results = bw.readBinaryWatch(0); assertEquals("", new ArrayList<String>() { { add("0:00"); } }, results); results = bw.readBinaryWatch(1); assertEquals(new ArrayList<String>() { { add("0:01"); add("0:02"); add("0:04"); add("0:08"); add("0:16"); add("0:32"); add("1:00"); add("2:00"); add("4:00"); add("8:00"); } }, results); results = bw.readBinaryWatch(9); assertEquals(Collections.<String>emptyList(), results); } }
1,013
0.478776
0.443238
41
23.707317
15.720491
63
false
false
0
0
0
0
0
0
0.682927
false
false
9
8d149c79c0f678377b2433ebbab22eff1e45969b
28,492,813,058,759
d64e2b8c95fed22ffb602267bb97e444e7a2d002
/Mybatis/chap04-dynamic-sql-lecture-source/src/com/greedy/section01/xml/Application.java
899e344039fab37e62d477907223a87f9b47462e
[]
no_license
NaraWee/Lecture
https://github.com/NaraWee/Lecture
895b8270fd652061e5344129beada8b9a3df3fb3
c845478209a88ccf94e5ea4c1a2f517c97295186
refs/heads/master
2023-07-15T12:56:56.810000
2021-08-10T14:22:39
2021-08-10T14:22:39
374,026,281
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.greedy.section01.xml; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Scanner; import java.util.Set; import com.greedy.common.SearchCriteria; public class Application { public static void main(String[] args) { Scanner sc = new Scanner(System.in); do { System.out.println("====== 마이바티스 동적 SQL (조건문) ======"); System.out.println("1. if 확인하기"); System.out.println("2. choose(when, otherwise) 확인하기"); System.out.println("3. foreach 확인하기"); System.out.println("4. trim(where, set) 확인하기"); System.out.println("9. 종료하기"); System.out.print("메뉴를 선택하세요 : "); int no = sc.nextInt(); switch(no) { case 1 : ifSubMenu(); break; case 2 : chooseSubMenu(); break; case 3 : foreachSubMenu(); break; case 4 : trimSubMenu(); break; case 9 : System.out.println("프로그램을 종료합니다."); break; } } while(true); } private static void trimSubMenu() { Scanner sc = new Scanner(System.in); MenuService menuService = new MenuService(); do { System.out.println("=========== trim 서브 메뉴 =========="); System.out.println("1. 검색조건이 있는 경우 메뉴코드로 조회, 단 없으면 전체 조회"); System.out.println("2. 메뉴 혹은 카테고리로 검색, 단 메뉴의 카테고리 둘 다 일치하는 경우도 검색하며, 검색 조건이 없는 경우 전체 검색"); System.out.println("3. 원하는 메뉴 정보만 수정하기"); System.out.println("9. 이전 메뉴로"); System.out.print("메뉴 번호를 입력하세요 : "); int no = sc.nextInt(); switch(no) { case 1 : menuService.searchMenuByCodeOrSearchAll(inputAllOrOne()); break; case 2 : menuService.searchMenuByNameOrCategory(inputSearchCriteriaMap()); break; case 3 : menuService.modifyMenu(inputChangeInfo()); break; case 9 : return; } } while(true); } private static Map<String, Object> inputChangeInfo() { Scanner sc = new Scanner(System.in); System.out.print("변경할 메뉴 코드를 입력하세요 : "); int code = sc.nextInt(); System.out.print("변경할 메뉴 이름을 입력하세요 : "); sc.nextLine(); String name = sc.nextLine(); System.out.print("변경할 카테고리 코드를 입력하세요 : "); int categoryCode = sc.nextInt(); System.out.print("판매 여부를 결정해주세요(Y/N) : "); sc.nextLine(); String orderableStatus = sc.nextLine(); Map<String, Object> criteria = new HashMap<>(); criteria.put("code", code); criteria.put("name", name); criteria.put("categoryCode", categoryCode); criteria.put("orderableStatus", orderableStatus); return criteria; } private static Map<String, Object> inputSearchCriteriaMap() { Scanner sc = new Scanner(System.in); System.out.print("검색할 조건을 입력하세요(category or name or both or null) : "); String condition = sc.nextLine(); Map<String, Object> criteria = new HashMap<>(); if("category".equals(condition)) { System.out.print("검색할 카테고리 코드를 입력하세요 : "); int categoryValue = sc.nextInt(); criteria.put("categoryValue", categoryValue); } else if("name".equals(condition)) { System.out.print("검색할 이름을 입력하세요 : "); String nameValue = sc.nextLine(); criteria.put("nameValue", nameValue); } else if("both".equals(condition)) { System.out.print("검색할 이름이 입력하세요 : "); String nameValue = sc.nextLine(); System.out.print("검색할 카테고리 코드를 입력하세요 : "); int categoryValue = sc.nextInt(); criteria.put("nameValue", nameValue); criteria.put("categoryValue", categoryValue); } return criteria; } private static SearchCriteria inputAllOrOne() { Scanner sc = new Scanner(System.in); System.out.print("검색 조건을 입력하시겠습니까?(예 or 아니오) : "); boolean hasSearchValue = "예".equals(sc.nextLine())? true : false; SearchCriteria searchCriteria = new SearchCriteria(); if(hasSearchValue) { System.out.print("검색할 메뉴 코드를 입력하세요 : "); String code = sc.nextLine(); searchCriteria.setCondition("menuCode"); searchCriteria.setValue(code); } return searchCriteria; } private static void foreachSubMenu() { Scanner sc = new Scanner(System.in); MenuService menuService = new MenuService(); do { System.out.println("========== foreach 서브 메뉴 =========="); System.out.println("1. 랜덤한 메뉴 5개 추출해서 조회하기"); System.out.println("9. 이전 메뉴로"); System.out.print("메뉴 번호를 입력하세요 : "); int no = sc.nextInt(); switch(no) { case 1 : menuService.searchMenuByRandomMenuCode(createRandomMenuCodeList()); break; case 9 : return; } } while(true); } private static List<Integer> createRandomMenuCodeList() { Set<Integer> set = new HashSet<>(); while(set.size() < 5) { /* 현재 메뉴 번호는 1~20번 까지이다. */ int temp = ((int)(Math.random()*20)) + 1; set.add(temp); } List<Integer> list = new ArrayList<>(set); Collections.sort(list); return list; } private static void ifSubMenu() { Scanner sc = new Scanner(System.in); MenuService menuService = new MenuService(); do { System.out.println("========== if 서브 메뉴 ==========="); System.out.println("1. 원하는 금액대에 적합한 추천 메뉴 목록 보여주기"); System.out.println("2. 메뉴이름 혹은 카테고리명으로 검색하여 메뉴 목록 보여주기"); System.out.println("9. 이전 메뉴로"); System.out.print("메뉴 번호를 입력하세요 : "); int no = sc.nextInt(); switch(no) { case 1 : menuService.selectMenuByPrice(inputPrice()); break; case 2 : menuService.searchMenu(inputSearchCriteria()); break; case 9 : return; } } while(true); } private static void chooseSubMenu() { Scanner sc = new Scanner(System.in); MenuService menuService = new MenuService(); do { System.out.println("========== choose 서브 메뉴 =========="); System.out.println("1. 카테고리 상위 분류별 메뉴 보여주기(식사, 음료, 디저트)"); System.out.println("9. 이전 메뉴로"); System.out.print("메뉴 번호를 입력하세요 : "); int no = sc.nextInt(); switch(no) { case 1 : menuService.searchMenuBySupCategory(inputSupCategory()); break; case 9 : return; } } while(true); } private static SearchCriteria inputSupCategory() { Scanner sc = new Scanner(System.in); System.out.print("상위 분류를 입력해주세요(식사, 음료, 디저트) : "); String value = sc.nextLine(); return new SearchCriteria("category", value); } private static int inputPrice() { Scanner sc = new Scanner(System.in); System.out.print("검색하실 가격의 최대 금액을 입력해주세요 : "); int price = sc.nextInt(); return price; } private static SearchCriteria inputSearchCriteria() { Scanner sc = new Scanner(System.in); System.out.print("검색 기준을 입력해주세요(name or category) : "); String condition = sc.nextLine(); System.out.print("검색어를 입력해주세요 : "); String value = sc.nextLine(); return new SearchCriteria(condition, value); } }
UTF-8
Java
7,592
java
Application.java
Java
[]
null
[]
package com.greedy.section01.xml; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Scanner; import java.util.Set; import com.greedy.common.SearchCriteria; public class Application { public static void main(String[] args) { Scanner sc = new Scanner(System.in); do { System.out.println("====== 마이바티스 동적 SQL (조건문) ======"); System.out.println("1. if 확인하기"); System.out.println("2. choose(when, otherwise) 확인하기"); System.out.println("3. foreach 확인하기"); System.out.println("4. trim(where, set) 확인하기"); System.out.println("9. 종료하기"); System.out.print("메뉴를 선택하세요 : "); int no = sc.nextInt(); switch(no) { case 1 : ifSubMenu(); break; case 2 : chooseSubMenu(); break; case 3 : foreachSubMenu(); break; case 4 : trimSubMenu(); break; case 9 : System.out.println("프로그램을 종료합니다."); break; } } while(true); } private static void trimSubMenu() { Scanner sc = new Scanner(System.in); MenuService menuService = new MenuService(); do { System.out.println("=========== trim 서브 메뉴 =========="); System.out.println("1. 검색조건이 있는 경우 메뉴코드로 조회, 단 없으면 전체 조회"); System.out.println("2. 메뉴 혹은 카테고리로 검색, 단 메뉴의 카테고리 둘 다 일치하는 경우도 검색하며, 검색 조건이 없는 경우 전체 검색"); System.out.println("3. 원하는 메뉴 정보만 수정하기"); System.out.println("9. 이전 메뉴로"); System.out.print("메뉴 번호를 입력하세요 : "); int no = sc.nextInt(); switch(no) { case 1 : menuService.searchMenuByCodeOrSearchAll(inputAllOrOne()); break; case 2 : menuService.searchMenuByNameOrCategory(inputSearchCriteriaMap()); break; case 3 : menuService.modifyMenu(inputChangeInfo()); break; case 9 : return; } } while(true); } private static Map<String, Object> inputChangeInfo() { Scanner sc = new Scanner(System.in); System.out.print("변경할 메뉴 코드를 입력하세요 : "); int code = sc.nextInt(); System.out.print("변경할 메뉴 이름을 입력하세요 : "); sc.nextLine(); String name = sc.nextLine(); System.out.print("변경할 카테고리 코드를 입력하세요 : "); int categoryCode = sc.nextInt(); System.out.print("판매 여부를 결정해주세요(Y/N) : "); sc.nextLine(); String orderableStatus = sc.nextLine(); Map<String, Object> criteria = new HashMap<>(); criteria.put("code", code); criteria.put("name", name); criteria.put("categoryCode", categoryCode); criteria.put("orderableStatus", orderableStatus); return criteria; } private static Map<String, Object> inputSearchCriteriaMap() { Scanner sc = new Scanner(System.in); System.out.print("검색할 조건을 입력하세요(category or name or both or null) : "); String condition = sc.nextLine(); Map<String, Object> criteria = new HashMap<>(); if("category".equals(condition)) { System.out.print("검색할 카테고리 코드를 입력하세요 : "); int categoryValue = sc.nextInt(); criteria.put("categoryValue", categoryValue); } else if("name".equals(condition)) { System.out.print("검색할 이름을 입력하세요 : "); String nameValue = sc.nextLine(); criteria.put("nameValue", nameValue); } else if("both".equals(condition)) { System.out.print("검색할 이름이 입력하세요 : "); String nameValue = sc.nextLine(); System.out.print("검색할 카테고리 코드를 입력하세요 : "); int categoryValue = sc.nextInt(); criteria.put("nameValue", nameValue); criteria.put("categoryValue", categoryValue); } return criteria; } private static SearchCriteria inputAllOrOne() { Scanner sc = new Scanner(System.in); System.out.print("검색 조건을 입력하시겠습니까?(예 or 아니오) : "); boolean hasSearchValue = "예".equals(sc.nextLine())? true : false; SearchCriteria searchCriteria = new SearchCriteria(); if(hasSearchValue) { System.out.print("검색할 메뉴 코드를 입력하세요 : "); String code = sc.nextLine(); searchCriteria.setCondition("menuCode"); searchCriteria.setValue(code); } return searchCriteria; } private static void foreachSubMenu() { Scanner sc = new Scanner(System.in); MenuService menuService = new MenuService(); do { System.out.println("========== foreach 서브 메뉴 =========="); System.out.println("1. 랜덤한 메뉴 5개 추출해서 조회하기"); System.out.println("9. 이전 메뉴로"); System.out.print("메뉴 번호를 입력하세요 : "); int no = sc.nextInt(); switch(no) { case 1 : menuService.searchMenuByRandomMenuCode(createRandomMenuCodeList()); break; case 9 : return; } } while(true); } private static List<Integer> createRandomMenuCodeList() { Set<Integer> set = new HashSet<>(); while(set.size() < 5) { /* 현재 메뉴 번호는 1~20번 까지이다. */ int temp = ((int)(Math.random()*20)) + 1; set.add(temp); } List<Integer> list = new ArrayList<>(set); Collections.sort(list); return list; } private static void ifSubMenu() { Scanner sc = new Scanner(System.in); MenuService menuService = new MenuService(); do { System.out.println("========== if 서브 메뉴 ==========="); System.out.println("1. 원하는 금액대에 적합한 추천 메뉴 목록 보여주기"); System.out.println("2. 메뉴이름 혹은 카테고리명으로 검색하여 메뉴 목록 보여주기"); System.out.println("9. 이전 메뉴로"); System.out.print("메뉴 번호를 입력하세요 : "); int no = sc.nextInt(); switch(no) { case 1 : menuService.selectMenuByPrice(inputPrice()); break; case 2 : menuService.searchMenu(inputSearchCriteria()); break; case 9 : return; } } while(true); } private static void chooseSubMenu() { Scanner sc = new Scanner(System.in); MenuService menuService = new MenuService(); do { System.out.println("========== choose 서브 메뉴 =========="); System.out.println("1. 카테고리 상위 분류별 메뉴 보여주기(식사, 음료, 디저트)"); System.out.println("9. 이전 메뉴로"); System.out.print("메뉴 번호를 입력하세요 : "); int no = sc.nextInt(); switch(no) { case 1 : menuService.searchMenuBySupCategory(inputSupCategory()); break; case 9 : return; } } while(true); } private static SearchCriteria inputSupCategory() { Scanner sc = new Scanner(System.in); System.out.print("상위 분류를 입력해주세요(식사, 음료, 디저트) : "); String value = sc.nextLine(); return new SearchCriteria("category", value); } private static int inputPrice() { Scanner sc = new Scanner(System.in); System.out.print("검색하실 가격의 최대 금액을 입력해주세요 : "); int price = sc.nextInt(); return price; } private static SearchCriteria inputSearchCriteria() { Scanner sc = new Scanner(System.in); System.out.print("검색 기준을 입력해주세요(name or category) : "); String condition = sc.nextLine(); System.out.print("검색어를 입력해주세요 : "); String value = sc.nextLine(); return new SearchCriteria(condition, value); } }
7,592
0.645524
0.63915
249
25.465864
21.584053
93
false
false
0
0
0
0
0
0
2.759036
false
false
9
150aa10a79eb7ff9ba55e688c787b799adeb89f8
2,989,297,260,182
96c9c11f7e2344bf7a658b94c0791ac099168708
/src/main/java/cz/tmsoft/springbatchmongo/service/ImportDataProccesor.java
f782bd6218d3a9f0860622bbb11f2e20852aa152
[]
no_license
tommari82/spring-batch-mongo
https://github.com/tommari82/spring-batch-mongo
47df100bdbc67283a07a42b78b6f42bca576fbb2
272bd18eeed0ea09f7f2b9592adfbdfb7e898e75
refs/heads/main
2023-08-21T15:56:48.005000
2021-10-21T11:22:37
2021-10-21T11:22:37
419,692,914
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cz.tmsoft.springbatchmongo.service; import cz.tmsoft.springbatchmongo.domain.ImportData; import org.springframework.batch.item.ItemProcessor; /** * @author tomas.marianek * @since 22.09.2021 */ public class ImportDataProccesor implements ItemProcessor<ImportData, ImportData> { @Override public ImportData process(final ImportData item) throws Exception { return item; } }
UTF-8
Java
407
java
ImportDataProccesor.java
Java
[ { "context": "ramework.batch.item.ItemProcessor;\n\n/**\n * @author tomas.marianek\n * @since 22.09.2021\n */\npublic class ImportDataP", "end": 181, "score": 0.9573454856872559, "start": 167, "tag": "NAME", "value": "tomas.marianek" } ]
null
[]
package cz.tmsoft.springbatchmongo.service; import cz.tmsoft.springbatchmongo.domain.ImportData; import org.springframework.batch.item.ItemProcessor; /** * @author tomas.marianek * @since 22.09.2021 */ public class ImportDataProccesor implements ItemProcessor<ImportData, ImportData> { @Override public ImportData process(final ImportData item) throws Exception { return item; } }
407
0.761671
0.742015
15
26.133333
26.767809
84
false
false
0
0
0
0
0
0
0.333333
false
false
9
181630605de9a40f7c8a040675aa54d08cae775c
22,024,592,337,262
9ab759b9a777cf1abf2fb3c4752b5120dae76471
/app/src/main/java/com/thundersoft/view/GLPointCloud.java
4b053e93f483dd76e61e5b8b033d401bc72b814c
[]
no_license
chanielqian/chaniel
https://github.com/chanielqian/chaniel
011bad4570885dac219d72b8061ba305d23499c8
c02d5212315c09cdbfae4d9922abb8bcac621241
refs/heads/master
2020-04-07T22:23:57.326000
2018-11-28T07:36:31
2018-11-28T07:36:31
158,768,650
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.thundersoft.view; import android.opengl.GLES20; import android.util.Log; /****************************************************************************** ** File name: TofView ** ** Creation date: 18-8-12 ** ** Author: Junxin Gao ** ** Description: ** ** Copyright (c) 2018 ThunderSoft All rights reserved. ** ******************************************************************************/ public class GLPointCloud { private static final String TAG = "GLPointCloud"; private final String vertexShaderCode = "attribute vec4 vPosition;" + "uniform mat4 uMat;" + "void main() {" + "vec4 wp = vPosition;" + " wp = uMat * wp;" + " gl_Position = wp;" + " gl_PointSize = 1.0;" + "}"; private final String fragmentShaderCode = "precision mediump float;" + "uniform vec4 vColor;" + "void main() {" + " gl_FragColor = vColor;" + "}"; private final int mProgram; float color[] = {0.63671875f, 0.76953125f, 0.22265625f, 0.0f}; public GLPointCloud() { int vertexShader = loadShader( GLES20.GL_VERTEX_SHADER, vertexShaderCode); int fragmentShader = loadShader( GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode); mProgram = GLES20.glCreateProgram(); GLES20.glAttachShader(mProgram, vertexShader); GLES20.glAttachShader(mProgram, fragmentShader); GLES20.glLinkProgram(mProgram); } public void draw() { PointCloudData mCloudData = PointCloudController.getInstance().getPointCloudData(); if (mCloudData == null || mCloudData.isValid() == false) { Log.e(TAG, "PointCloudData invalid"); return; } GLES20.glUseProgram(mProgram); checkGlError("glUseProgram"); int positionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition"); checkGlError("glGetAttribLocztion"); GLES20.glEnableVertexAttribArray(positionHandle); checkGlError("glEnableVertexAttribArray"); mCloudData.acquireLock(); GLES20.glVertexAttribPointer( positionHandle, mCloudData.getPixelChannel(), mCloudData.getGLType(), false, mCloudData.getStride(), mCloudData.getBuffer()); checkGlError("glVertexAttribPointer"); int colorHandle = GLES20.glGetUniformLocation(mProgram, "vColor"); checkGlError("glGetUniformLocation"); GLES20.glUniform4fv(colorHandle, 1, color, 0); checkGlError("glUniform4fv"); int matHandle = GLES20.glGetUniformLocation(mProgram, "uMat"); GLES20.glUniformMatrix4fv(matHandle, 1, false, GLPerspective.calculateMatrix()); checkGlError("glUniformMatrix4fv"); GLES20.glDrawArrays(GLES20.GL_POINTS, 0, mCloudData.getElementNum()); checkGlError("glDrawArrays"); mCloudData.releaseLock(); GLES20.glDisableVertexAttribArray(positionHandle); } public static int loadShader(int type, String shaderCode) { int shader = GLES20.glCreateShader(type); GLES20.glShaderSource(shader, shaderCode); GLES20.glCompileShader(shader); return shader; } public static void checkGlError(String glOperation) { int error; while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { Log.e(TAG, glOperation + ": glError " + error); throw new RuntimeException(glOperation + ": glError " + error); } } }
UTF-8
Java
3,948
java
GLPointCloud.java
Java
[ { "context": " **\n ** Author: Junxin Gao ", "end": 349, "score": 0.9998444318771362, "start": 339, "tag": "NAME", "value": "Junxin Gao" } ]
null
[]
package com.thundersoft.view; import android.opengl.GLES20; import android.util.Log; /****************************************************************************** ** File name: TofView ** ** Creation date: 18-8-12 ** ** Author: <NAME> ** ** Description: ** ** Copyright (c) 2018 ThunderSoft All rights reserved. ** ******************************************************************************/ public class GLPointCloud { private static final String TAG = "GLPointCloud"; private final String vertexShaderCode = "attribute vec4 vPosition;" + "uniform mat4 uMat;" + "void main() {" + "vec4 wp = vPosition;" + " wp = uMat * wp;" + " gl_Position = wp;" + " gl_PointSize = 1.0;" + "}"; private final String fragmentShaderCode = "precision mediump float;" + "uniform vec4 vColor;" + "void main() {" + " gl_FragColor = vColor;" + "}"; private final int mProgram; float color[] = {0.63671875f, 0.76953125f, 0.22265625f, 0.0f}; public GLPointCloud() { int vertexShader = loadShader( GLES20.GL_VERTEX_SHADER, vertexShaderCode); int fragmentShader = loadShader( GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode); mProgram = GLES20.glCreateProgram(); GLES20.glAttachShader(mProgram, vertexShader); GLES20.glAttachShader(mProgram, fragmentShader); GLES20.glLinkProgram(mProgram); } public void draw() { PointCloudData mCloudData = PointCloudController.getInstance().getPointCloudData(); if (mCloudData == null || mCloudData.isValid() == false) { Log.e(TAG, "PointCloudData invalid"); return; } GLES20.glUseProgram(mProgram); checkGlError("glUseProgram"); int positionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition"); checkGlError("glGetAttribLocztion"); GLES20.glEnableVertexAttribArray(positionHandle); checkGlError("glEnableVertexAttribArray"); mCloudData.acquireLock(); GLES20.glVertexAttribPointer( positionHandle, mCloudData.getPixelChannel(), mCloudData.getGLType(), false, mCloudData.getStride(), mCloudData.getBuffer()); checkGlError("glVertexAttribPointer"); int colorHandle = GLES20.glGetUniformLocation(mProgram, "vColor"); checkGlError("glGetUniformLocation"); GLES20.glUniform4fv(colorHandle, 1, color, 0); checkGlError("glUniform4fv"); int matHandle = GLES20.glGetUniformLocation(mProgram, "uMat"); GLES20.glUniformMatrix4fv(matHandle, 1, false, GLPerspective.calculateMatrix()); checkGlError("glUniformMatrix4fv"); GLES20.glDrawArrays(GLES20.GL_POINTS, 0, mCloudData.getElementNum()); checkGlError("glDrawArrays"); mCloudData.releaseLock(); GLES20.glDisableVertexAttribArray(positionHandle); } public static int loadShader(int type, String shaderCode) { int shader = GLES20.glCreateShader(type); GLES20.glShaderSource(shader, shaderCode); GLES20.glCompileShader(shader); return shader; } public static void checkGlError(String glOperation) { int error; while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { Log.e(TAG, glOperation + ": glError " + error); throw new RuntimeException(glOperation + ": glError " + error); } } }
3,944
0.541287
0.516464
120
31.9
27.680738
91
false
false
0
0
0
0
0
0
0.683333
false
false
9
3db0ac43e59f8be10121ed1447ed139774318dae
32,495,722,581,367
f64fd41ab24cb8c00bacc0d9a9c8c1f507f860b6
/src/main/java/db/ParallelRefactoring.java
d738ba20feb4ecce029a049257c7fc9549b01a9d
[]
no_license
mohayemin/parallel-refactoring-analysis
https://github.com/mohayemin/parallel-refactoring-analysis
d0c6eb3a5a93ba1916bdfaf685dc216b461c70c3
bbe49c15170e23a3807ba0ba82109e8f1283c4fc
refs/heads/master
2023-01-31T06:44:31.276000
2020-12-12T15:30:12
2020-12-12T15:30:12
308,876,038
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package db; import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; @DatabaseTable(tableName = "parallel_refactoring") public class ParallelRefactoring { @DatabaseField(generatedId = true) public int id; @DatabaseField(columnName = "merge_commit_hash") public String mergeCommitHash; @DatabaseField(columnName = "refactoring1_id") public int refactoring1Id; @DatabaseField(columnName = "refactoring2_id") public int refactoring2Id; // below are redundant columns for analytics @DatabaseField(columnName = "base_commit_hash") public String baseCommitHash; @DatabaseField(columnName = "refactoring_pair") public String refactoringPair; @DatabaseField(columnName = "refactoring1_type") public String refactoring1Type; @DatabaseField(columnName = "refactoring2_type") public String refactoring2Type; @DatabaseField(columnName = "refactoring1_commit_hash") public String refactoring1CommitHash; @DatabaseField(columnName = "refactoring2_commit_hash") public String refactoring2CommitHash; @DatabaseField(columnName = "refactoring1_detail") public String refactoring1Detail; @DatabaseField(columnName = "refactoring2_detail") public String refactoring2Detail; @DatabaseField(columnName = "refactoring1_commit_id") public int refactoring1CommitId; @DatabaseField(columnName = "refactoring2_commit_id") public int refactoring2CommitId; @DatabaseField(columnName = "is_merge_conflicting") public boolean isMergeConflicting; @DatabaseField(columnName = "project_id") public int projectId; public ParallelRefactoring() { } public ParallelRefactoring(RefactoringDbItem refactoring1, RefactoringDbItem refactoring2, MergeCommit mergeCommit) { if (refactoring1.refactoringType.compareTo(refactoring2.refactoringType) > 0) { // the reordering is done for the sake of consistency in the pair // this will make analysis easier var copyOf2 = refactoring2; refactoring2 = refactoring1; refactoring1 = copyOf2; } mergeCommitHash = mergeCommit.commitHash; refactoring1Id = refactoring1.id; refactoring2Id = refactoring2.id; baseCommitHash = mergeCommit.baseCommitHash; refactoring1Type = refactoring1.refactoringType; refactoring2Type = refactoring2.refactoringType; refactoringPair = refactoring1Type + "," + refactoring2Type; refactoring1CommitHash = refactoring1.commitHash; refactoring2CommitHash = refactoring2.commitHash; refactoring1Detail = refactoring1.refactoringDetail; refactoring2Detail = refactoring2.refactoringDetail; refactoring1CommitId = refactoring1.refactoringCommitId; refactoring2CommitId = refactoring2.refactoringCommitId; isMergeConflicting = mergeCommit.isConflicting; this.projectId = refactoring1.projectId; } }
UTF-8
Java
3,012
java
ParallelRefactoring.java
Java
[]
null
[]
package db; import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; @DatabaseTable(tableName = "parallel_refactoring") public class ParallelRefactoring { @DatabaseField(generatedId = true) public int id; @DatabaseField(columnName = "merge_commit_hash") public String mergeCommitHash; @DatabaseField(columnName = "refactoring1_id") public int refactoring1Id; @DatabaseField(columnName = "refactoring2_id") public int refactoring2Id; // below are redundant columns for analytics @DatabaseField(columnName = "base_commit_hash") public String baseCommitHash; @DatabaseField(columnName = "refactoring_pair") public String refactoringPair; @DatabaseField(columnName = "refactoring1_type") public String refactoring1Type; @DatabaseField(columnName = "refactoring2_type") public String refactoring2Type; @DatabaseField(columnName = "refactoring1_commit_hash") public String refactoring1CommitHash; @DatabaseField(columnName = "refactoring2_commit_hash") public String refactoring2CommitHash; @DatabaseField(columnName = "refactoring1_detail") public String refactoring1Detail; @DatabaseField(columnName = "refactoring2_detail") public String refactoring2Detail; @DatabaseField(columnName = "refactoring1_commit_id") public int refactoring1CommitId; @DatabaseField(columnName = "refactoring2_commit_id") public int refactoring2CommitId; @DatabaseField(columnName = "is_merge_conflicting") public boolean isMergeConflicting; @DatabaseField(columnName = "project_id") public int projectId; public ParallelRefactoring() { } public ParallelRefactoring(RefactoringDbItem refactoring1, RefactoringDbItem refactoring2, MergeCommit mergeCommit) { if (refactoring1.refactoringType.compareTo(refactoring2.refactoringType) > 0) { // the reordering is done for the sake of consistency in the pair // this will make analysis easier var copyOf2 = refactoring2; refactoring2 = refactoring1; refactoring1 = copyOf2; } mergeCommitHash = mergeCommit.commitHash; refactoring1Id = refactoring1.id; refactoring2Id = refactoring2.id; baseCommitHash = mergeCommit.baseCommitHash; refactoring1Type = refactoring1.refactoringType; refactoring2Type = refactoring2.refactoringType; refactoringPair = refactoring1Type + "," + refactoring2Type; refactoring1CommitHash = refactoring1.commitHash; refactoring2CommitHash = refactoring2.commitHash; refactoring1Detail = refactoring1.refactoringDetail; refactoring2Detail = refactoring2.refactoringDetail; refactoring1CommitId = refactoring1.refactoringCommitId; refactoring2CommitId = refactoring2.refactoringCommitId; isMergeConflicting = mergeCommit.isConflicting; this.projectId = refactoring1.projectId; } }
3,012
0.732404
0.712483
79
37.126583
24.202923
121
false
false
0
0
0
0
0
0
0.506329
false
false
9
bf6cded30d1e9329d85ba6640a80e037df890ddf
16,183,436,789,053
67932eda5fbcf0b45d16d29552dc139a188fa600
/Java/Practice/example.java
c2e3184006f293edf23a51eba9d625a969f2ed5a
[]
no_license
purmonth/computer_science
https://github.com/purmonth/computer_science
5598ae2fba7854cfe401990b1446cda53f200e47
576c4f1557eb9ca9f9d11a11d56afce4eb66d561
refs/heads/master
2020-08-01T06:36:08.900000
2020-07-09T08:00:08
2020-07-09T08:00:08
210,901,501
0
0
null
false
2021-04-27T18:17:47
2019-09-25T17:23:04
2021-04-27T18:17:07
2021-04-27T18:17:47
58,039
0
0
1
C
false
false
package contralSystem; import java.util.*; //需求:製作一個簡單的學生資訊管理系統,通過鍵盤選擇操作進行新增學生 //(學號,姓名,性別,年齡,成績)的資訊,這些資訊通過陣列儲存,同時 //還可以進行查詢某個或全體學生資訊,修改學生資訊,刪除學生資訊的操作。 //(要求有一定的優化,例如對使用者輸入資訊是否符合要求的處理)。 public class Main { static Stu[] stu=new Stu[100]; static int number=0; static Scanner scanner=new Scanner(System.in); public static void main(String args[]){ int choice; System.out.println("這是一個學生資訊管理系統,最大容量為100,歡迎您對本系統的使用"); while(true){ System.out.println("1.學生資訊新增"); System.out.println("2.學生資訊檢視"); System.out.println("3.學生資訊修改"); System.out.println("4.學生資訊刪除"); System.out.println("5.學生資訊按成績從低到高排序"); System.out.println("6.退出本作業系統"); System.out.println("請輸入你要進行的操作"); choice=scanner.nextInt(); if(choice==6)break; switch(choice){ case 1: add(); break;//新增學生資訊 case 2: show();break;//查詢學生資訊 case 3: change();break;//修改學生資訊 case 4: delete();break;//刪除學生資訊 case 5: paixu();break;//對學生資訊排序 } } System.out.println("感謝您對本系統的使用,歡迎下次繼續使用"); } static void add(){//新增學生資訊 while(true){ System.out.println("點選任意鍵繼續新增學生資訊,停止新增輸入0"); if(scanner.nextInt()==0)break; System.out.println("請輸入該學生的學號,姓名,性別,年齡,成績"); stu[number]=new Stu(); stu[number].setStuNum(scanner.next()); stu[number].setName(scanner.next()); stu[number].setGender(scanner.next()); stu[number].setAge(scanner.nextInt()); stu[number].setScore(scanner.nextInt()); number++; System.out.println("新增成功"); } } static void show(){//展示學生資訊 System.out.println("這些學生的學號,姓名,性別,年齡,成績分別為"); for(int i=0;i<number;i++) System.out.println(stu[i].getStuNum()+"\t"+stu[i].getName()+"\t"+"\t"+stu[i].getGender()+"\t"+stu[i].getAge()+"\t"+stu[i].getScore()); System.out.println(); } static void paixu(){//對學生資訊進行排序 int j; Stu temp=new Stu(); for(int i=0;i<number;i++) { for(j=i+1;j<number;j++) if(stu[i].getScore()>stu[j].getScore()) {temp=stu[i];stu[i]=stu[j];stu[j]=temp;} } System.out.println("排序完成,選擇”學生資訊檢視“進行檢視"); } static void change(){//改變學生資訊 System.out.println("請輸入要修改資訊的學生學號"); String stunumber=scanner.next(); for(int i=0;i<number;i++) { if(stunumber.equals(stu[i].getStuNum())){ System.out.println("請輸入要修改的學生的資訊"); stu[i].setStuNum(scanner.next()); stu[i].setName(scanner.next()); stu[i].setGender(scanner.next()); stu[i].setAge(scanner.nextInt()); stu[i].setScore(scanner.nextInt()); break; } if(number==i) System.out.println("對不起查無此人"); } } static void delete(){//刪除學生資訊 System.out.println("請輸入要刪除資訊的學生學號"); String stunumber=scanner.next(); int i; for( i=0;i<number;i++) if(stunumber.equals(stu[i].getStuNum())) break; if(number==i)System.out.println("對不起查無此人"); for(;i<number-1;i++) stu[i]=stu[i+1]; number--; System.out.println("刪除完成"); } }
UTF-8
Java
4,306
java
example.java
Java
[]
null
[]
package contralSystem; import java.util.*; //需求:製作一個簡單的學生資訊管理系統,通過鍵盤選擇操作進行新增學生 //(學號,姓名,性別,年齡,成績)的資訊,這些資訊通過陣列儲存,同時 //還可以進行查詢某個或全體學生資訊,修改學生資訊,刪除學生資訊的操作。 //(要求有一定的優化,例如對使用者輸入資訊是否符合要求的處理)。 public class Main { static Stu[] stu=new Stu[100]; static int number=0; static Scanner scanner=new Scanner(System.in); public static void main(String args[]){ int choice; System.out.println("這是一個學生資訊管理系統,最大容量為100,歡迎您對本系統的使用"); while(true){ System.out.println("1.學生資訊新增"); System.out.println("2.學生資訊檢視"); System.out.println("3.學生資訊修改"); System.out.println("4.學生資訊刪除"); System.out.println("5.學生資訊按成績從低到高排序"); System.out.println("6.退出本作業系統"); System.out.println("請輸入你要進行的操作"); choice=scanner.nextInt(); if(choice==6)break; switch(choice){ case 1: add(); break;//新增學生資訊 case 2: show();break;//查詢學生資訊 case 3: change();break;//修改學生資訊 case 4: delete();break;//刪除學生資訊 case 5: paixu();break;//對學生資訊排序 } } System.out.println("感謝您對本系統的使用,歡迎下次繼續使用"); } static void add(){//新增學生資訊 while(true){ System.out.println("點選任意鍵繼續新增學生資訊,停止新增輸入0"); if(scanner.nextInt()==0)break; System.out.println("請輸入該學生的學號,姓名,性別,年齡,成績"); stu[number]=new Stu(); stu[number].setStuNum(scanner.next()); stu[number].setName(scanner.next()); stu[number].setGender(scanner.next()); stu[number].setAge(scanner.nextInt()); stu[number].setScore(scanner.nextInt()); number++; System.out.println("新增成功"); } } static void show(){//展示學生資訊 System.out.println("這些學生的學號,姓名,性別,年齡,成績分別為"); for(int i=0;i<number;i++) System.out.println(stu[i].getStuNum()+"\t"+stu[i].getName()+"\t"+"\t"+stu[i].getGender()+"\t"+stu[i].getAge()+"\t"+stu[i].getScore()); System.out.println(); } static void paixu(){//對學生資訊進行排序 int j; Stu temp=new Stu(); for(int i=0;i<number;i++) { for(j=i+1;j<number;j++) if(stu[i].getScore()>stu[j].getScore()) {temp=stu[i];stu[i]=stu[j];stu[j]=temp;} } System.out.println("排序完成,選擇”學生資訊檢視“進行檢視"); } static void change(){//改變學生資訊 System.out.println("請輸入要修改資訊的學生學號"); String stunumber=scanner.next(); for(int i=0;i<number;i++) { if(stunumber.equals(stu[i].getStuNum())){ System.out.println("請輸入要修改的學生的資訊"); stu[i].setStuNum(scanner.next()); stu[i].setName(scanner.next()); stu[i].setGender(scanner.next()); stu[i].setAge(scanner.nextInt()); stu[i].setScore(scanner.nextInt()); break; } if(number==i) System.out.println("對不起查無此人"); } } static void delete(){//刪除學生資訊 System.out.println("請輸入要刪除資訊的學生學號"); String stunumber=scanner.next(); int i; for( i=0;i<number;i++) if(stunumber.equals(stu[i].getStuNum())) break; if(number==i)System.out.println("對不起查無此人"); for(;i<number-1;i++) stu[i]=stu[i+1]; number--; System.out.println("刪除完成"); } }
4,306
0.532615
0.524461
107
31.093458
20.410065
142
false
false
0
0
0
0
0
0
0.719626
false
false
9
0b205ff9c8b6b3cb438ef273964d79c3a3ec1deb
3,375,844,304,658
6c26af1bf448bc7035d35c125946f64649dc3d2e
/src/com/essences/CandyTasteType.java
4bab23d9776d37494075b7ebe912a6e1c7b71673
[]
no_license
SergeyStroganoff/Java.-Collections-MainTask
https://github.com/SergeyStroganoff/Java.-Collections-MainTask
1547313498d9ee9258801d58a4a4d7f3243a1060
51b9ac6b5caa5f72d53282fae9f5ba840c889b68
refs/heads/master
2023-01-28T00:49:46.011000
2020-12-15T16:06:03
2020-12-15T16:06:03
314,550,475
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.essences; public enum CandyTasteType { LEMON("Лемонный"), MINTY("Мятный"), WATERMELON("Арбуз"), FRUIT_MIX("Фруктовый миикс"), Milk("Сливочный"), CCOFEMILK("Кофе с молоком"); public String CandyTasteTypeName; CandyTasteType(String candyTasteTypeName) { CandyTasteTypeName = candyTasteTypeName; } }
UTF-8
Java
410
java
CandyTasteType.java
Java
[]
null
[]
package com.essences; public enum CandyTasteType { LEMON("Лемонный"), MINTY("Мятный"), WATERMELON("Арбуз"), FRUIT_MIX("Фруктовый миикс"), Milk("Сливочный"), CCOFEMILK("Кофе с молоком"); public String CandyTasteTypeName; CandyTasteType(String candyTasteTypeName) { CandyTasteTypeName = candyTasteTypeName; } }
410
0.676966
0.676966
16
21.25
15.742062
48
false
false
0
0
0
0
0
0
0.5625
false
false
9
947a46bb38a8b83b24eca91a0e006faa0ca52a7c
1,425,929,146,511
786f6bc8d34cd6fc448873ef7f67bfd04088bd29
/src/Option1.java
729f5c6123efa1eb5d624487585a6ad2fdf7e64f
[]
no_license
timotiushaniel/client-server-socket-chat-app
https://github.com/timotiushaniel/client-server-socket-chat-app
41a61249738a8ee27af9c2293cce451ffc7a58a8
961ccc45b38fa080d4ddc500911dfe0f2ff836be
refs/heads/master
2022-12-17T18:30:14.532000
2020-09-20T18:00:00
2020-09-20T18:02:39
297,131,225
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Option1 { private String title; private String id_category; private String nama_category; public Option1(String title, String id_category, String nama_category) { this.title = title; this.id_category = id_category; this.nama_category = nama_category; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getId_category() { return id_category; } public void setId_category(String id_category) { this.id_category = id_category; } public String getNama_category() { return nama_category; } public void setNama_category(String nama_category) { this.nama_category = nama_category; } @Override public String toString() { return String.format("%-35s %-55s", title, nama_category); } }
UTF-8
Java
924
java
Option1.java
Java
[]
null
[]
public class Option1 { private String title; private String id_category; private String nama_category; public Option1(String title, String id_category, String nama_category) { this.title = title; this.id_category = id_category; this.nama_category = nama_category; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getId_category() { return id_category; } public void setId_category(String id_category) { this.id_category = id_category; } public String getNama_category() { return nama_category; } public void setNama_category(String nama_category) { this.nama_category = nama_category; } @Override public String toString() { return String.format("%-35s %-55s", title, nama_category); } }
924
0.617965
0.611472
41
21.536585
20.212406
76
false
false
0
0
0
0
0
0
0.414634
false
false
9
6434217b76cfb7e0402b91c491ce256f34c55642
7,258,494,763,229
d8ab31f6c38c11f80f4f4cb28b04c19d859656c4
/src/com/icehousecorp/gof/commandpattern/Light.java
36b0f90f720aa68776056d796f81d5daa50a6ede
[]
no_license
PlumpMath/DesignPattern-343
https://github.com/PlumpMath/DesignPattern-343
2361b9a177daba1f1d920475cb135e8623713978
58af3b66faecc9b743c4f4ee7b1186007dbb0afa
refs/heads/master
2021-01-20T09:36:53.019000
2016-04-08T12:51:12
2016-04-08T12:51:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.icehousecorp.gof.commandpattern; /** * Created by mexanjuadha on 2/18/16. */ public class Light { public void onLight() { } public void offLight() { } }
UTF-8
Java
188
java
Light.java
Java
[ { "context": "cehousecorp.gof.commandpattern;\n\n/**\n * Created by mexanjuadha on 2/18/16.\n */\npublic class Light {\n\n public ", "end": 75, "score": 0.9993759393692017, "start": 64, "tag": "USERNAME", "value": "mexanjuadha" } ]
null
[]
package com.icehousecorp.gof.commandpattern; /** * Created by mexanjuadha on 2/18/16. */ public class Light { public void onLight() { } public void offLight() { } }
188
0.62234
0.595745
15
11.533334
14.813807
44
false
false
0
0
0
0
0
0
0.066667
false
false
9
94a5f888a2e29cc6bde79158dc9a200ac9f8ba14
19,215,683,741,864
a0fb5628174889309ab9fc88363cb858f5c3c36c
/src/Restraunt.java
011cce6cf297064aeca115aeeb5b4695c6798045
[]
no_license
VivekMadarapu/FastFoodSecurityRush
https://github.com/VivekMadarapu/FastFoodSecurityRush
c1a6347a8ec4b9722a9fff5a44a21949acd13eaa
159d8a243b19e28dc0135ebdb6512130b8cf8f6b
refs/heads/master
2022-12-14T02:34:43.981000
2020-09-03T14:12:09
2020-09-03T14:12:09
292,588,484
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import libraries.StdDraw; import java.awt.*; import java.io.File; import java.io.FileNotFoundException; import java.util.*; public class Restraunt { private int reputation; private ArrayDeque<Customer>[] lanes; Random random = new Random(); public Restraunt() { reputation = 50; lanes = new ArrayDeque[3]; lanes[0] = new ArrayDeque<>(); lanes[1] = new ArrayDeque<>(); lanes[2] = new ArrayDeque<>(); } public void update(double multiplier) throws FileNotFoundException { for (int l = 0; l < 3;l++) { if(lanes[l].size() < 7) { if (random.nextDouble() < 0.9) { Customer customer = new Customer(new Color(random.nextInt(255),random.nextInt(255),random.nextInt(255))); if(customer.getColor().getRed() < 100 && customer.getColor().getGreen() < 100 && customer.getColor().getBlue() < 100) { customer.setPotTheif(true); generateItems(customer, false); } else generateItems(customer, true); lanes[l].addLast(customer); } } if (!lanes[l].isEmpty() && random.nextDouble() < 0.01 + multiplier) { Customer removed = lanes[l].removeFirst(); if(removed.isFlagged() && (removed.getItems().contains("Knife") || removed.getItems().contains("Gun") || removed.getItems().contains("Bomb")|| removed.getItems().contains("Grenade"))) reputation += 10; else if(!removed.isFlagged() && (removed.getItems().contains("Knife") || removed.getItems().contains("Gun") || removed.getItems().contains("Bomb") || removed.getItems().contains("Grenade"))) reputation -= 10; else if(removed.isFlagged() && !(removed.getItems().contains("Knife") || removed.getItems().contains("Gun") || removed.getItems().contains("Bomb") || removed.getItems().contains("Grenade"))) reputation -= 20; StdDraw.setPenColor(new Color(165, 165, 110)); StdDraw.filledRectangle(0.75, 0.05, 0.12, 0.03); StdDraw.setPenColor(Color.BLACK); StdDraw.textLeft(0.65, 0.04, "Reputation: " + reputation); } } } public ArrayDeque<Customer>[] getLanes(){ return lanes; } public int getReputation() { return reputation; } public void setReputation(int reputation) { this.reputation = reputation; } private void generateItems(Customer customer, boolean safe) throws FileNotFoundException { Scanner items; if(safe) items = new Scanner(new File("items_safe.txt")); else items = new Scanner(new File("items.txt")); while (items.hasNext()) { if(random.nextDouble() < 0.6) customer.addItem(items.nextLine()); else items.nextLine(); } } }
UTF-8
Java
3,161
java
Restraunt.java
Java
[]
null
[]
import libraries.StdDraw; import java.awt.*; import java.io.File; import java.io.FileNotFoundException; import java.util.*; public class Restraunt { private int reputation; private ArrayDeque<Customer>[] lanes; Random random = new Random(); public Restraunt() { reputation = 50; lanes = new ArrayDeque[3]; lanes[0] = new ArrayDeque<>(); lanes[1] = new ArrayDeque<>(); lanes[2] = new ArrayDeque<>(); } public void update(double multiplier) throws FileNotFoundException { for (int l = 0; l < 3;l++) { if(lanes[l].size() < 7) { if (random.nextDouble() < 0.9) { Customer customer = new Customer(new Color(random.nextInt(255),random.nextInt(255),random.nextInt(255))); if(customer.getColor().getRed() < 100 && customer.getColor().getGreen() < 100 && customer.getColor().getBlue() < 100) { customer.setPotTheif(true); generateItems(customer, false); } else generateItems(customer, true); lanes[l].addLast(customer); } } if (!lanes[l].isEmpty() && random.nextDouble() < 0.01 + multiplier) { Customer removed = lanes[l].removeFirst(); if(removed.isFlagged() && (removed.getItems().contains("Knife") || removed.getItems().contains("Gun") || removed.getItems().contains("Bomb")|| removed.getItems().contains("Grenade"))) reputation += 10; else if(!removed.isFlagged() && (removed.getItems().contains("Knife") || removed.getItems().contains("Gun") || removed.getItems().contains("Bomb") || removed.getItems().contains("Grenade"))) reputation -= 10; else if(removed.isFlagged() && !(removed.getItems().contains("Knife") || removed.getItems().contains("Gun") || removed.getItems().contains("Bomb") || removed.getItems().contains("Grenade"))) reputation -= 20; StdDraw.setPenColor(new Color(165, 165, 110)); StdDraw.filledRectangle(0.75, 0.05, 0.12, 0.03); StdDraw.setPenColor(Color.BLACK); StdDraw.textLeft(0.65, 0.04, "Reputation: " + reputation); } } } public ArrayDeque<Customer>[] getLanes(){ return lanes; } public int getReputation() { return reputation; } public void setReputation(int reputation) { this.reputation = reputation; } private void generateItems(Customer customer, boolean safe) throws FileNotFoundException { Scanner items; if(safe) items = new Scanner(new File("items_safe.txt")); else items = new Scanner(new File("items.txt")); while (items.hasNext()) { if(random.nextDouble() < 0.6) customer.addItem(items.nextLine()); else items.nextLine(); } } }
3,161
0.534325
0.513129
91
33.736263
40.890053
206
false
false
0
0
0
0
0
0
0.725275
false
false
9
cce75c5303764d0c72d1e947372fb06c1da6a233
19,215,683,742,959
e1c5dc4992cde429dd03f00bcc5ecfd52fb8e801
/app/src/main/java/com/ghostwan/robotsdk/sdk/exception/RobotAlreadyAnimatingException.java
d8927d8b5dc34c3019d28a64c8aa2d5e91a214e9
[]
no_license
ghostwan/robotkit-java
https://github.com/ghostwan/robotkit-java
00f7fe8c5a2fc3e95f0019d4e401968c30eda2dc
28633028439a0e5cc35edd6cc54ef6f0aef14fb0
refs/heads/master
2021-09-07T23:17:59.088000
2018-03-02T21:53:40
2018-03-02T21:53:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ghostwan.robotsdk.sdk.exception; /** * Created by erwan on 28/02/2018. */ public class RobotAlreadyAnimatingException extends RuntimeException { }
UTF-8
Java
163
java
RobotAlreadyAnimatingException.java
Java
[ { "context": "hostwan.robotsdk.sdk.exception;\n\n/**\n * Created by erwan on 28/02/2018.\n */\n\npublic class RobotAlreadyAnim", "end": 69, "score": 0.9996464252471924, "start": 64, "tag": "USERNAME", "value": "erwan" } ]
null
[]
package com.ghostwan.robotsdk.sdk.exception; /** * Created by erwan on 28/02/2018. */ public class RobotAlreadyAnimatingException extends RuntimeException { }
163
0.773006
0.723926
8
19.375
25.01968
70
false
false
0
0
0
0
0
0
0.125
false
false
9
f9345e163d295e17b96a6fe2c2471214048747c7
1,864,015,831,002
8ede539471eef697219ae15d425c34cacd5f1d66
/src/main/java/com/assessment/hero/mapping/HeroMapper.java
12c84d16479b55e73a5469f59ff779bad87372ec
[ "MIT" ]
permissive
jj091000/hero-association
https://github.com/jj091000/hero-association
e0e2fad23662b09b725ce4e8eccdeeb1db19a1c7
07afdf12b754a86854a2d4b054cf52e3aa3826b1
refs/heads/master
2020-07-26T16:03:34.009000
2019-09-17T23:53:24
2019-09-17T23:53:24
208,698,101
0
0
MIT
false
2019-09-17T23:53:25
2019-09-16T03:02:28
2019-09-17T00:13:53
2019-09-17T23:53:25
29
0
0
0
Java
false
false
package com.assessment.hero.mapping; import com.assessment.hero.model.Hero; import com.assessment.hero.repository.database.model.HeroDAO; import org.springframework.stereotype.Component; @Component public class HeroMapper { public HeroDAO mapHeroToHeroDAO(Hero hero){ HeroDAO heroDAO = new HeroDAO(); heroDAO.setFirstName(hero.getFirstName()); heroDAO.setLastName(hero.getLastName()); heroDAO.setSuperHeroName(hero.getSuperHeroName()); return heroDAO; } public Hero mapHeroDAOToHero(HeroDAO heroDAO) { Hero hero = new Hero(); hero.setFirstName(heroDAO.getFirstName()); hero.setLastName(heroDAO.getLastName()); hero.setSuperHeroName(heroDAO.getSuperHeroName()); return hero; } public void mapUpdatedInfo(Hero target, Hero source){ if(source.getFirstName() != null) { target.setFirstName(source.getFirstName()); } if(source.getLastName() != null) { target.setLastName(source.getLastName()); } } }
UTF-8
Java
1,060
java
HeroMapper.java
Java
[]
null
[]
package com.assessment.hero.mapping; import com.assessment.hero.model.Hero; import com.assessment.hero.repository.database.model.HeroDAO; import org.springframework.stereotype.Component; @Component public class HeroMapper { public HeroDAO mapHeroToHeroDAO(Hero hero){ HeroDAO heroDAO = new HeroDAO(); heroDAO.setFirstName(hero.getFirstName()); heroDAO.setLastName(hero.getLastName()); heroDAO.setSuperHeroName(hero.getSuperHeroName()); return heroDAO; } public Hero mapHeroDAOToHero(HeroDAO heroDAO) { Hero hero = new Hero(); hero.setFirstName(heroDAO.getFirstName()); hero.setLastName(heroDAO.getLastName()); hero.setSuperHeroName(heroDAO.getSuperHeroName()); return hero; } public void mapUpdatedInfo(Hero target, Hero source){ if(source.getFirstName() != null) { target.setFirstName(source.getFirstName()); } if(source.getLastName() != null) { target.setLastName(source.getLastName()); } } }
1,060
0.670755
0.670755
34
30.17647
21.760015
61
false
false
0
0
0
0
0
0
0.5
false
false
9
11071fee5723c038830ed0520bf217edd4d9ed85
30,786,325,640,416
c51a00caf72017380329d2b4bb6bf696c6be6e50
/src/rubikscube/RubiksCube.java
12b1f44b86e9fe51af61635161c670d0baf32349
[]
no_license
jasonwwong/RubiksCubeSolver
https://github.com/jasonwwong/RubiksCubeSolver
6cacd0bb12a5c676695b17f936da33d4b2bd9714
ae89b5966064d6bfe9b7b773b5bcc885e877fa44
refs/heads/master
2021-01-02T22:59:14.145000
2013-12-23T02:48:57
2013-12-23T02:48:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rubikscube; import java.util.Arrays; public class RubiksCube { private final int SIDES = 6; /* * Red = 0 * Green = 1 * Yellow = 2 * Blue = 3 * Orange = 4 * White = 5 */ private final int ROWS = 3; private final int COLUMNS = 3; public String state [][][] = new String [SIDES][ROWS][COLUMNS]; int index = 0; /* * main for testing purposes * format for input string "G W Y O B R B" * format for direction to rotate "R1O2W" */ public static void main(String[] args) { //RubiksCube game = new RubiksCube("G G W R R G R R G O W W O G O Y Y Y G G O Y Y Y R B G Y Y R R B R R W W B O Y B O B B O B O G O W W B W W B"); //RubiksCube game = new RubiksCube("RRRRRRRRRGGGGGGGGGYYYYYYYYYBBBBBBBBBOOOOOOOOOWWWWWWWWW"); RubiksCube game = new RubiksCube("R R R R R R R R R G G G G G G G G G Y Y Y Y Y Y Y Y Y B B B B B B B B B O O O O O O O O O W W W W W W W W W"); System.out.println(game); // String d = "Y2"; // game.rotate(d); // System.out.println(game); // d = "Y2"; // game.rotate(d); // System.out.println(game); }//end of main public RubiksCube(String initialState) { fillArray(initialState); } /* * high level rotation of the cube * clockwise rotation of a side of the cube * */ public void rotate(String direction) { //use to charArray()????? String [] tokens = new String [direction.length()]; String rotate; int turns; // Tokenizes the rotation directions index = 0; for (int i = 0; i <tokens.length; i++) { tokens[i] = direction.substring(i, i+1); } //Use the rotation directions to manipulate the cube, changing to the rotated state for (int i = 0; i <tokens.length; i = i+2) { String color = tokens[i]; turns = Integer.parseInt(tokens[i+1]); rotateFace(turns, color); } } /* * rotates the face clockwise the number of turns * returns the new string representing the turned side */ public void rotateFace(int turns, String color) { //System.out.println("in rotateFace() color is " + color); switch (color) { case ("R"): //Store corner2 String temp11 = state[0][0][2]; String temp12 = state[3][0][2]; String temp13 = state[5][2][2]; //move corner1 to corner2 state[0][0][2] = state[0][0][0]; state[5][2][2] = state[1][0][0]; state[3][0][2] = state[5][2][0]; //Store corner4 temp2 String temp21 = state[0][2][2]; String temp22 = state[2][0][2]; String temp23 = state[3][0][0]; //move corner2(temp1) to corner4 state[0][2][2] = temp11; state[2][0][2] = temp12; state[3][0][0] = temp13; //store corner3 to temp1 temp11 = state[0][2][0]; temp12= state[1][0][2]; temp13 = state[2][0][0]; //move corner4(temp2) to corner3 state[0][2][0] = temp21; state[1][0][2] = temp22; state[2][0][0] = temp23; //move corner3 to corner1 state[0][0][0] = temp11; state[1][0][0] = temp13; state[5][2][0] = temp12; //copy side4 to temp1 temp11 = state[0][1][0]; temp12 = state[1][0][1]; //move side3 to side4 state[0][1][0] = state[0][2][1]; state[1][0][1] = state[2][0][1]; //move side2 to side3 state[0][2][1] = state[0][1][2]; state[2][0][1] = state[3][0][1]; //move side1 to side2 state[0][1][2] = state[0][0][1]; state[3][0][1] = state[5][2][1]; //move side4(temp1) to side1 state[0][0][1] = temp11; state[5][2][1] = temp12; break; case("G"): //copy corner4 to temp String temp1 = state[1][2][0]; String temp2 = state[4][2][0]; String temp3 = state[5][0][0]; //move corner3 to corner4 state[1][2][0]= state[1][2][2]; state[4][2][0]= state[2][2][0]; state[5][0][0]= state[4][0][0]; //move corner2 to corner3 state[2][2][0]= state[0][2][0]; state[1][2][2]= state[1][0][2]; state[4][0][0]= state[2][0][0]; //move corner1 to corner2 state[0][2][0]= state[5][2][0]; state[1][0][2]= state[1][0][0]; state[2][0][0]= state[0][0][0]; //move corner4(temp) to corner1 state[0][0][0]= temp3; state[1][0][0]= temp1; state[5][2][0]= temp2; //copy side4 to temp1 temp11 = state[1][1][0]; temp12 = state[5][1][0]; //move side3 to side4 state[1][1][0] = state[1][2][1]; state[5][1][0] = state[4][1][0]; //move side2 to side3 state[1][2][1] = state[1][1][2]; state[4][1][0] = state[2][1][0]; //move side1 to side2 state[1][1][2] = state[1][0][1]; state[2][1][0] = state[0][1][0]; //move side4(temp1) to side1 state[0][1][0] = temp12; state[1][0][1] = temp11; break; case("Y"): //copy corner4 to temp String temp4 = state[1][2][2]; String temp5 = state[2][2][0]; String temp6 = state[4][0][0]; //move corner3 to corner4 state[1][2][2]= state[4][0][2]; state[2][2][0]= state[2][2][2]; state[4][0][0]= state[3][2][0]; //move corner2 to corner3 state[2][2][2]= state[2][0][2]; state[3][2][0]= state[0][2][2]; state[4][0][2]= state[3][0][0]; //move corner1 to corner2 state[2][0][2]= state[2][0][0]; state[0][2][2]= state[1][0][2]; state[3][0][0]= state[0][2][0]; //move corner4(temp) to corner1 state[0][2][0]= temp4; state[1][0][2]= temp6; state[2][0][0]= temp5; //copy side4 to temp1 temp11 = state[1][1][2]; temp12 = state[2][1][0]; //move side3 to side4 state[1][1][2] = state[4][0][1]; state[2][1][0] = state[2][2][1]; //move side2 to side3 state[2][2][1] = state[2][1][2]; state[4][0][1] = state[3][1][0]; //move side1 to side2 state[2][1][2] = state[2][0][1]; state[3][1][0] = state[0][2][1]; //move side4(temp1) to side1 state[0][2][1] = temp11; state[2][0][1] = temp12; break; case("B"): //copy corner4 to temp String temp7 = state[2][2][2]; String temp8 = state[3][2][0]; String temp9 = state[4][0][2]; //move corner3 to corner4 state[2][2][2]= state[4][2][2]; state[3][2][0]= state[3][2][2]; state[4][0][2]= state[5][0][2]; //move corner2 to corner3 state[3][2][2]= state[3][0][2]; state[4][2][2]= state[5][2][2]; state[5][0][2]= state[0][0][2]; //move corner1 to corner2 state[0][0][2]= state[2][0][2]; state[3][0][2]= state[3][0][0]; state[5][2][2]= state[0][2][2]; //move corner4(temp) to corner1 state[0][2][2]= temp7; state[2][0][2]= temp9; state[3][0][0]= temp8; //copy side4 to temp1 temp11 = state[2][1][2]; temp12 = state[3][1][0]; //move side3 to side4 state[2][1][2] = state[4][1][2]; state[3][1][0] = state[3][2][1]; //move side2 to side3 state[4][1][2] = state[5][1][2]; state[3][2][1] = state[3][1][2]; //move side1 to side2 state[5][1][2] = state[0][1][2]; state[3][1][2] = state[3][0][1]; //move side4(temp1) to side1 state[0][1][2] = temp11; state[3][0][1] = temp12; break; case("O"): //copy corner4 to temp String temp14 = state[1][2][0]; String temp15 = state[4][2][0]; String temp16 = state[5][0][0]; //move corner3 to corner4 state[1][2][0]= state[5][0][2]; state[4][2][0]= state[4][2][2]; state[5][0][0]= state[3][2][2]; //move corner2 to corner3 state[3][2][2]= state[2][2][2]; state[4][2][2]= state[4][0][2]; state[5][0][2]= state[3][2][0]; //move corner1 to corner2 state[2][2][2]= state[1][2][2]; state[4][0][2]= state[4][0][0]; state[3][2][0]= state[2][2][0]; //move corner4(temp) to corner1 state[1][2][2]= temp16; state[2][2][0]= temp14; state[4][0][0]= temp15; //copy side4 to temp1 String temp17 = state[1][2][1]; String temp18 = state[4][1][0]; //move side3 to side4 state[1][2][1] = state[5][0][1]; state[4][1][0] = state[4][2][1]; //move side2 to side3 state[5][0][1] = state[3][2][1]; state[4][2][1] = state[4][1][2]; //move side1 to side2 state[3][2][1] = state[2][2][1]; state[4][1][2] = state[4][0][1]; //move side4(temp1) to side1 state[2][2][1] = temp17; state[4][0][1] = temp18; break; case("W"): //copy corner4 to temp String temp19 = state[0][0][0]; String temp20 = state[1][0][0]; String temp24 = state[5][2][0]; //move corner3 to corner4 state[0][0][0]= state[3][0][2]; state[1][0][0]= state[0][0][2]; state[5][2][0]= state[5][2][2]; //move corner2 to corner3 state[0][0][2]= state[3][2][2]; state[3][0][2]= state[4][2][2]; state[5][2][2]= state[5][0][2]; //move corner1 to corner2 state[3][2][2]= state[4][2][0]; state[4][2][2]= state[1][2][0]; state[5][0][2]= state[5][0][0]; //move corner4(temp) to corner1 state[4][2][0]= temp20; state[1][2][0]= temp19; state[5][0][0]= temp24; //copy side4 to temp1 String temp25 = state[1][1][0]; String temp26 = state[5][1][0]; //move side3 to side4 state[1][1][0] = state[0][0][1]; state[5][1][0] = state[5][2][1]; //move side2 to side3 state[0][0][1] = state[3][1][2]; state[5][2][1] = state[5][1][2]; //move side1 to side2 state[3][1][2] = state[4][2][1]; state[5][1][2] = state[5][0][1]; //move side4(temp1) to side1 state[4][2][1] = temp25; state[5][0][1] = temp26; break; } turns--; if(turns > 0) { rotateFace(turns, color); } } /* * returns the filled side of the cube */ public String[][] fillSide(String ordered ){ String[][] manipulated = new String[3][3]; int index = 0; for(int i = 0; i < manipulated.length; i++) { for (int j = 0; j < manipulated[i].length; j++) { if (index == ordered.length()) manipulated[i][j] = ordered.substring(ordered.length()); else manipulated[i][j] = (ordered.substring(index, index + 1)); index++; } } return manipulated; } public int[] getColors(String s) { int color = 0; int [] colors = new int[5]; switch (s) { case "R": colors[0] = 0; colors[1] = 1; colors[2] = 2; colors[3] = 3; colors[4] = 5; break; case "G": color = 1; colors[1] = 1; colors[2] = 0; colors[3] = 2; colors[4] = 4; colors[5] = 5; break; case "Y": color = 2; break; case "B": color = 3; break; case "O": color = 4; break; case "W": color = 5; break; default: break; } return colors; } /* Do I still need this????? * returns the 2D array of the color requested */ public String[][] getSide(String color){ String[][] side = new String[3][3]; switch (color) { case "R": side = state[0].clone(); break; case "G": side = state[1].clone(); break; case "Y": side = state[2].clone(); break; case "B": side = state[3].clone(); break; case "O": side = state[4].clone(); break; case "W": side = state[5].clone(); break; } return side; } /* * returns the 3 faces of the corner cubies */ public String getCornerCubies() { String t = null; //Corner Cube1 String s = state[2][0][0]; s = s.concat(state[1][0][2]); s = s.concat(state[0][2][0]); //Corner Cube2 s = s.concat(state[2][0][2]); s = s.concat(state[3][0][0]); s = s.concat(state[0][2][2]); //Corner Cube3 s = s.concat(state[2][2][0]); s = s.concat(state[1][2][2]); s = s.concat(state[4][0][0]); //Corner Cube4 s = s.concat(state[2][2][2]); s = s.concat(state[3][2][0]); s = s.concat(state[4][0][2]); //Corner Cube5 s = s.concat(state[5][0][0]); s = s.concat(state[1][2][0]); s = s.concat(state[4][2][0]); //Corner Cube6 s = s.concat(state[5][0][2]); s = s.concat(state[3][2][2]); s = s.concat(state[4][2][2]); //Corner Cube7 s = s.concat(state[5][2][0]); s = s.concat(state[1][0][0]); s = s.concat(state[0][0][0]); t = s; //} return t; } public String getFirstSixSideCubies() { String t = null; //Sides Cube1 String s = state[5][2][1]; s = s.concat(state[0][0][1]); //Sides Cube2 s = s.concat(state[1][0][1]); s = s.concat(state[0][1][0]); //Sides Cube3 s = s.concat(state[3][0][1]); s = s.concat(state[0][1][2]); //Sides Cube4 s = s.concat(state[2][0][1]); s = s.concat(state[0][2][1]); //Sides Cube5 s = s.concat(state[2][1][0]); s = s.concat(state[1][1][2]); //Sides Cube6 s = s.concat(state[2][1][2]); s = s.concat(state[3][1][0]); t = s; return t; } public String getOtherSixSideCubies() { String t = null; //Sides Cube1 String s = state[5][1][0]; s = s.concat(state[1][1][0]); //Sides Cube2 s = s.concat(state[1][2][1]); s = s.concat(state[4][1][0]); //Sides Cube3 s = s.concat(state[2][2][1]); s = s.concat(state[4][0][1]); //Sides Cube4 s = s.concat(state[3][2][1]); s = s.concat(state[4][1][2]); //Sides Cube5 s = s.concat(state[5][0][1]); s = s.concat(state[4][2][1]); //Sides Cube6 s = s.concat(state[5][1][2]); s = s.concat(state[3][1][2]); t = s; return t; } /* * from the input string finds the center color of each side to correctly orient the sides */ public String[] getCenter(String[] tokens) { String[] side = new String[54]; String[][][] ordered = new String [6][3][3]; for (int i = 4; i <=49; i = i +9) { String s = tokens[i]; if (s.equalsIgnoreCase("R")) { System.arraycopy(tokens, i - 4, side, 0, 9); } else if (s.equalsIgnoreCase("G")) { System.arraycopy(tokens, i - 4, side, 9, 9); } else if (s.equals("Y")) { System.arraycopy(tokens, i -4, side, 18, 9); } else if (s.equals("B")) { System.arraycopy(tokens, i -4, side, 27, 9); } else if (s.equals("O")) { System.arraycopy(tokens, i -4, side, 36, 9); } else if (s.equals("W")) { System.arraycopy(tokens, i -4, side, 45, 9); } } System.arraycopy(side, 0, tokens, 0, 54); return tokens; } /* * creates a string out of a 2D array */ public String arrayToString(String[][] side) { String s = ""; for (int i = 0; i < side.length; i++) { for (int j = 0; j < side[i].length; j++) { s = s.concat(side[i][j]); } } return s; } /* * returns the representation of the cube in a 3D array */ public String[][][] fillArray(String initialState) { String t = initialState.toUpperCase(); String[] tokens = t.split("\\s"); tokens = getCenter(tokens); int index = 0; for(int i = 0; i < state.length; i++) { for (int j=0; j < state[i].length; j++) { for (int k=0; k < state[i][j].length; k++) { state[i][j][k] = (tokens[index++]); } } } return state; } protected void setState(String[][][] state) { this.state = state; } /* * returns the 3D array representing the state of the game */ protected String[][][] getState() { return state; } /* String[] formatString(String input) { String t = input.toUpperCase(); String[] tokens = t.split("\\s"); return tokens; } */ @Override /* * Returns a the cube's state represented as a string of the colors * @see java.lang.Object#toString() */ public String toString() { String s = ""; for(int i = 0; i < state.length; i++) { for (int j=0; j < state[i].length; j++) { for (int k=0; k < state[i][j].length; k++) { String t = (state[i][j][k]); s = s.concat(t); } } } return s; } }
UTF-8
Java
16,073
java
RubiksCube.java
Java
[]
null
[]
package rubikscube; import java.util.Arrays; public class RubiksCube { private final int SIDES = 6; /* * Red = 0 * Green = 1 * Yellow = 2 * Blue = 3 * Orange = 4 * White = 5 */ private final int ROWS = 3; private final int COLUMNS = 3; public String state [][][] = new String [SIDES][ROWS][COLUMNS]; int index = 0; /* * main for testing purposes * format for input string "G W Y O B R B" * format for direction to rotate "R1O2W" */ public static void main(String[] args) { //RubiksCube game = new RubiksCube("G G W R R G R R G O W W O G O Y Y Y G G O Y Y Y R B G Y Y R R B R R W W B O Y B O B B O B O G O W W B W W B"); //RubiksCube game = new RubiksCube("RRRRRRRRRGGGGGGGGGYYYYYYYYYBBBBBBBBBOOOOOOOOOWWWWWWWWW"); RubiksCube game = new RubiksCube("R R R R R R R R R G G G G G G G G G Y Y Y Y Y Y Y Y Y B B B B B B B B B O O O O O O O O O W W W W W W W W W"); System.out.println(game); // String d = "Y2"; // game.rotate(d); // System.out.println(game); // d = "Y2"; // game.rotate(d); // System.out.println(game); }//end of main public RubiksCube(String initialState) { fillArray(initialState); } /* * high level rotation of the cube * clockwise rotation of a side of the cube * */ public void rotate(String direction) { //use to charArray()????? String [] tokens = new String [direction.length()]; String rotate; int turns; // Tokenizes the rotation directions index = 0; for (int i = 0; i <tokens.length; i++) { tokens[i] = direction.substring(i, i+1); } //Use the rotation directions to manipulate the cube, changing to the rotated state for (int i = 0; i <tokens.length; i = i+2) { String color = tokens[i]; turns = Integer.parseInt(tokens[i+1]); rotateFace(turns, color); } } /* * rotates the face clockwise the number of turns * returns the new string representing the turned side */ public void rotateFace(int turns, String color) { //System.out.println("in rotateFace() color is " + color); switch (color) { case ("R"): //Store corner2 String temp11 = state[0][0][2]; String temp12 = state[3][0][2]; String temp13 = state[5][2][2]; //move corner1 to corner2 state[0][0][2] = state[0][0][0]; state[5][2][2] = state[1][0][0]; state[3][0][2] = state[5][2][0]; //Store corner4 temp2 String temp21 = state[0][2][2]; String temp22 = state[2][0][2]; String temp23 = state[3][0][0]; //move corner2(temp1) to corner4 state[0][2][2] = temp11; state[2][0][2] = temp12; state[3][0][0] = temp13; //store corner3 to temp1 temp11 = state[0][2][0]; temp12= state[1][0][2]; temp13 = state[2][0][0]; //move corner4(temp2) to corner3 state[0][2][0] = temp21; state[1][0][2] = temp22; state[2][0][0] = temp23; //move corner3 to corner1 state[0][0][0] = temp11; state[1][0][0] = temp13; state[5][2][0] = temp12; //copy side4 to temp1 temp11 = state[0][1][0]; temp12 = state[1][0][1]; //move side3 to side4 state[0][1][0] = state[0][2][1]; state[1][0][1] = state[2][0][1]; //move side2 to side3 state[0][2][1] = state[0][1][2]; state[2][0][1] = state[3][0][1]; //move side1 to side2 state[0][1][2] = state[0][0][1]; state[3][0][1] = state[5][2][1]; //move side4(temp1) to side1 state[0][0][1] = temp11; state[5][2][1] = temp12; break; case("G"): //copy corner4 to temp String temp1 = state[1][2][0]; String temp2 = state[4][2][0]; String temp3 = state[5][0][0]; //move corner3 to corner4 state[1][2][0]= state[1][2][2]; state[4][2][0]= state[2][2][0]; state[5][0][0]= state[4][0][0]; //move corner2 to corner3 state[2][2][0]= state[0][2][0]; state[1][2][2]= state[1][0][2]; state[4][0][0]= state[2][0][0]; //move corner1 to corner2 state[0][2][0]= state[5][2][0]; state[1][0][2]= state[1][0][0]; state[2][0][0]= state[0][0][0]; //move corner4(temp) to corner1 state[0][0][0]= temp3; state[1][0][0]= temp1; state[5][2][0]= temp2; //copy side4 to temp1 temp11 = state[1][1][0]; temp12 = state[5][1][0]; //move side3 to side4 state[1][1][0] = state[1][2][1]; state[5][1][0] = state[4][1][0]; //move side2 to side3 state[1][2][1] = state[1][1][2]; state[4][1][0] = state[2][1][0]; //move side1 to side2 state[1][1][2] = state[1][0][1]; state[2][1][0] = state[0][1][0]; //move side4(temp1) to side1 state[0][1][0] = temp12; state[1][0][1] = temp11; break; case("Y"): //copy corner4 to temp String temp4 = state[1][2][2]; String temp5 = state[2][2][0]; String temp6 = state[4][0][0]; //move corner3 to corner4 state[1][2][2]= state[4][0][2]; state[2][2][0]= state[2][2][2]; state[4][0][0]= state[3][2][0]; //move corner2 to corner3 state[2][2][2]= state[2][0][2]; state[3][2][0]= state[0][2][2]; state[4][0][2]= state[3][0][0]; //move corner1 to corner2 state[2][0][2]= state[2][0][0]; state[0][2][2]= state[1][0][2]; state[3][0][0]= state[0][2][0]; //move corner4(temp) to corner1 state[0][2][0]= temp4; state[1][0][2]= temp6; state[2][0][0]= temp5; //copy side4 to temp1 temp11 = state[1][1][2]; temp12 = state[2][1][0]; //move side3 to side4 state[1][1][2] = state[4][0][1]; state[2][1][0] = state[2][2][1]; //move side2 to side3 state[2][2][1] = state[2][1][2]; state[4][0][1] = state[3][1][0]; //move side1 to side2 state[2][1][2] = state[2][0][1]; state[3][1][0] = state[0][2][1]; //move side4(temp1) to side1 state[0][2][1] = temp11; state[2][0][1] = temp12; break; case("B"): //copy corner4 to temp String temp7 = state[2][2][2]; String temp8 = state[3][2][0]; String temp9 = state[4][0][2]; //move corner3 to corner4 state[2][2][2]= state[4][2][2]; state[3][2][0]= state[3][2][2]; state[4][0][2]= state[5][0][2]; //move corner2 to corner3 state[3][2][2]= state[3][0][2]; state[4][2][2]= state[5][2][2]; state[5][0][2]= state[0][0][2]; //move corner1 to corner2 state[0][0][2]= state[2][0][2]; state[3][0][2]= state[3][0][0]; state[5][2][2]= state[0][2][2]; //move corner4(temp) to corner1 state[0][2][2]= temp7; state[2][0][2]= temp9; state[3][0][0]= temp8; //copy side4 to temp1 temp11 = state[2][1][2]; temp12 = state[3][1][0]; //move side3 to side4 state[2][1][2] = state[4][1][2]; state[3][1][0] = state[3][2][1]; //move side2 to side3 state[4][1][2] = state[5][1][2]; state[3][2][1] = state[3][1][2]; //move side1 to side2 state[5][1][2] = state[0][1][2]; state[3][1][2] = state[3][0][1]; //move side4(temp1) to side1 state[0][1][2] = temp11; state[3][0][1] = temp12; break; case("O"): //copy corner4 to temp String temp14 = state[1][2][0]; String temp15 = state[4][2][0]; String temp16 = state[5][0][0]; //move corner3 to corner4 state[1][2][0]= state[5][0][2]; state[4][2][0]= state[4][2][2]; state[5][0][0]= state[3][2][2]; //move corner2 to corner3 state[3][2][2]= state[2][2][2]; state[4][2][2]= state[4][0][2]; state[5][0][2]= state[3][2][0]; //move corner1 to corner2 state[2][2][2]= state[1][2][2]; state[4][0][2]= state[4][0][0]; state[3][2][0]= state[2][2][0]; //move corner4(temp) to corner1 state[1][2][2]= temp16; state[2][2][0]= temp14; state[4][0][0]= temp15; //copy side4 to temp1 String temp17 = state[1][2][1]; String temp18 = state[4][1][0]; //move side3 to side4 state[1][2][1] = state[5][0][1]; state[4][1][0] = state[4][2][1]; //move side2 to side3 state[5][0][1] = state[3][2][1]; state[4][2][1] = state[4][1][2]; //move side1 to side2 state[3][2][1] = state[2][2][1]; state[4][1][2] = state[4][0][1]; //move side4(temp1) to side1 state[2][2][1] = temp17; state[4][0][1] = temp18; break; case("W"): //copy corner4 to temp String temp19 = state[0][0][0]; String temp20 = state[1][0][0]; String temp24 = state[5][2][0]; //move corner3 to corner4 state[0][0][0]= state[3][0][2]; state[1][0][0]= state[0][0][2]; state[5][2][0]= state[5][2][2]; //move corner2 to corner3 state[0][0][2]= state[3][2][2]; state[3][0][2]= state[4][2][2]; state[5][2][2]= state[5][0][2]; //move corner1 to corner2 state[3][2][2]= state[4][2][0]; state[4][2][2]= state[1][2][0]; state[5][0][2]= state[5][0][0]; //move corner4(temp) to corner1 state[4][2][0]= temp20; state[1][2][0]= temp19; state[5][0][0]= temp24; //copy side4 to temp1 String temp25 = state[1][1][0]; String temp26 = state[5][1][0]; //move side3 to side4 state[1][1][0] = state[0][0][1]; state[5][1][0] = state[5][2][1]; //move side2 to side3 state[0][0][1] = state[3][1][2]; state[5][2][1] = state[5][1][2]; //move side1 to side2 state[3][1][2] = state[4][2][1]; state[5][1][2] = state[5][0][1]; //move side4(temp1) to side1 state[4][2][1] = temp25; state[5][0][1] = temp26; break; } turns--; if(turns > 0) { rotateFace(turns, color); } } /* * returns the filled side of the cube */ public String[][] fillSide(String ordered ){ String[][] manipulated = new String[3][3]; int index = 0; for(int i = 0; i < manipulated.length; i++) { for (int j = 0; j < manipulated[i].length; j++) { if (index == ordered.length()) manipulated[i][j] = ordered.substring(ordered.length()); else manipulated[i][j] = (ordered.substring(index, index + 1)); index++; } } return manipulated; } public int[] getColors(String s) { int color = 0; int [] colors = new int[5]; switch (s) { case "R": colors[0] = 0; colors[1] = 1; colors[2] = 2; colors[3] = 3; colors[4] = 5; break; case "G": color = 1; colors[1] = 1; colors[2] = 0; colors[3] = 2; colors[4] = 4; colors[5] = 5; break; case "Y": color = 2; break; case "B": color = 3; break; case "O": color = 4; break; case "W": color = 5; break; default: break; } return colors; } /* Do I still need this????? * returns the 2D array of the color requested */ public String[][] getSide(String color){ String[][] side = new String[3][3]; switch (color) { case "R": side = state[0].clone(); break; case "G": side = state[1].clone(); break; case "Y": side = state[2].clone(); break; case "B": side = state[3].clone(); break; case "O": side = state[4].clone(); break; case "W": side = state[5].clone(); break; } return side; } /* * returns the 3 faces of the corner cubies */ public String getCornerCubies() { String t = null; //Corner Cube1 String s = state[2][0][0]; s = s.concat(state[1][0][2]); s = s.concat(state[0][2][0]); //Corner Cube2 s = s.concat(state[2][0][2]); s = s.concat(state[3][0][0]); s = s.concat(state[0][2][2]); //Corner Cube3 s = s.concat(state[2][2][0]); s = s.concat(state[1][2][2]); s = s.concat(state[4][0][0]); //Corner Cube4 s = s.concat(state[2][2][2]); s = s.concat(state[3][2][0]); s = s.concat(state[4][0][2]); //Corner Cube5 s = s.concat(state[5][0][0]); s = s.concat(state[1][2][0]); s = s.concat(state[4][2][0]); //Corner Cube6 s = s.concat(state[5][0][2]); s = s.concat(state[3][2][2]); s = s.concat(state[4][2][2]); //Corner Cube7 s = s.concat(state[5][2][0]); s = s.concat(state[1][0][0]); s = s.concat(state[0][0][0]); t = s; //} return t; } public String getFirstSixSideCubies() { String t = null; //Sides Cube1 String s = state[5][2][1]; s = s.concat(state[0][0][1]); //Sides Cube2 s = s.concat(state[1][0][1]); s = s.concat(state[0][1][0]); //Sides Cube3 s = s.concat(state[3][0][1]); s = s.concat(state[0][1][2]); //Sides Cube4 s = s.concat(state[2][0][1]); s = s.concat(state[0][2][1]); //Sides Cube5 s = s.concat(state[2][1][0]); s = s.concat(state[1][1][2]); //Sides Cube6 s = s.concat(state[2][1][2]); s = s.concat(state[3][1][0]); t = s; return t; } public String getOtherSixSideCubies() { String t = null; //Sides Cube1 String s = state[5][1][0]; s = s.concat(state[1][1][0]); //Sides Cube2 s = s.concat(state[1][2][1]); s = s.concat(state[4][1][0]); //Sides Cube3 s = s.concat(state[2][2][1]); s = s.concat(state[4][0][1]); //Sides Cube4 s = s.concat(state[3][2][1]); s = s.concat(state[4][1][2]); //Sides Cube5 s = s.concat(state[5][0][1]); s = s.concat(state[4][2][1]); //Sides Cube6 s = s.concat(state[5][1][2]); s = s.concat(state[3][1][2]); t = s; return t; } /* * from the input string finds the center color of each side to correctly orient the sides */ public String[] getCenter(String[] tokens) { String[] side = new String[54]; String[][][] ordered = new String [6][3][3]; for (int i = 4; i <=49; i = i +9) { String s = tokens[i]; if (s.equalsIgnoreCase("R")) { System.arraycopy(tokens, i - 4, side, 0, 9); } else if (s.equalsIgnoreCase("G")) { System.arraycopy(tokens, i - 4, side, 9, 9); } else if (s.equals("Y")) { System.arraycopy(tokens, i -4, side, 18, 9); } else if (s.equals("B")) { System.arraycopy(tokens, i -4, side, 27, 9); } else if (s.equals("O")) { System.arraycopy(tokens, i -4, side, 36, 9); } else if (s.equals("W")) { System.arraycopy(tokens, i -4, side, 45, 9); } } System.arraycopy(side, 0, tokens, 0, 54); return tokens; } /* * creates a string out of a 2D array */ public String arrayToString(String[][] side) { String s = ""; for (int i = 0; i < side.length; i++) { for (int j = 0; j < side[i].length; j++) { s = s.concat(side[i][j]); } } return s; } /* * returns the representation of the cube in a 3D array */ public String[][][] fillArray(String initialState) { String t = initialState.toUpperCase(); String[] tokens = t.split("\\s"); tokens = getCenter(tokens); int index = 0; for(int i = 0; i < state.length; i++) { for (int j=0; j < state[i].length; j++) { for (int k=0; k < state[i][j].length; k++) { state[i][j][k] = (tokens[index++]); } } } return state; } protected void setState(String[][][] state) { this.state = state; } /* * returns the 3D array representing the state of the game */ protected String[][][] getState() { return state; } /* String[] formatString(String input) { String t = input.toUpperCase(); String[] tokens = t.split("\\s"); return tokens; } */ @Override /* * Returns a the cube's state represented as a string of the colors * @see java.lang.Object#toString() */ public String toString() { String s = ""; for(int i = 0; i < state.length; i++) { for (int j=0; j < state[i].length; j++) { for (int k=0; k < state[i][j].length; k++) { String t = (state[i][j][k]); s = s.concat(t); } } } return s; } }
16,073
0.512474
0.435513
753
20.346613
17.656548
160
false
false
0
0
0
0
0
0
3.367862
false
false
9
4d2e123c3a340bef653531551940b454c6df8c2c
9,620,726,802,754
c27bb110eac4feebab6250d4ff5b5325df33074a
/web/src/main/java/nl/tehdreamteam/se42/web/command/Command.java
7dad8ac33c8bca0049a1a2495f5ef07b3a6c9901
[ "Unlicense" ]
permissive
TehDreamTeam/SE42
https://github.com/TehDreamTeam/SE42
d2a76eeb9889a18bc5034a069e4888c643349e6e
fb305b80ee0b4f4b81f61f041aceaac02cee7686
refs/heads/master
2021-01-19T21:51:06.096000
2017-06-14T08:36:24
2017-06-14T08:36:24
88,714,891
0
0
null
false
2017-06-14T08:36:25
2017-04-19T07:30:08
2017-04-19T12:00:29
2017-06-14T08:36:24
256
0
0
5
Java
null
null
package nl.tehdreamteam.se42.web.command; /** * Represents a single {@code Command} that can be executed. */ public interface Command { /** * Executes this {@code Command} using the given input. * * @param handler The {@link CommandHandler} in which this {@code Command} gets executed. * @param line The full input-{@code line} that was executed (not including the {@code Command} itself). * @param args The {@code arguments} of this {@code Command}. */ void execute(CommandHandler handler, String line, String[] args); /** * Gets the {@code name} of this {@code Command}. * * @return The {@code name} of this {@code Command}. */ String getName(); /** * Gets the {@code description} of this {@code Command}. * * @return The {@code description} of this {@code Command}. */ String getDescription(); /** * Gets all {@code identifiers} of this {@code Command}. * * @return All {@code identifiers} of this {@code Command}. */ String[] getIdentifiers(); }
UTF-8
Java
1,086
java
Command.java
Java
[]
null
[]
package nl.tehdreamteam.se42.web.command; /** * Represents a single {@code Command} that can be executed. */ public interface Command { /** * Executes this {@code Command} using the given input. * * @param handler The {@link CommandHandler} in which this {@code Command} gets executed. * @param line The full input-{@code line} that was executed (not including the {@code Command} itself). * @param args The {@code arguments} of this {@code Command}. */ void execute(CommandHandler handler, String line, String[] args); /** * Gets the {@code name} of this {@code Command}. * * @return The {@code name} of this {@code Command}. */ String getName(); /** * Gets the {@code description} of this {@code Command}. * * @return The {@code description} of this {@code Command}. */ String getDescription(); /** * Gets all {@code identifiers} of this {@code Command}. * * @return All {@code identifiers} of this {@code Command}. */ String[] getIdentifiers(); }
1,086
0.606814
0.604972
38
27.578947
30.198145
111
false
false
0
0
0
0
0
0
0.184211
false
false
9
93ad4cbe87a1e1e6585ac664431456e0659ab4e4
2,920,577,795,237
d8ea2f49142067fe4dce6d29d9f3c1e871e48a03
/SpringEx/src/main/java/controller/UserServices.java
7959eeff543ba9d553a8f1a81f8bdeec80e6faea
[]
no_license
sahunikash/SpringBoot1
https://github.com/sahunikash/SpringBoot1
c65aa87e6dd6cd3bf4f5bf621889b9c49141fc2b
1fca91ef680e568eae1cda3aafa10fc4af4ea237
refs/heads/master
2020-04-15T11:03:20.731000
2019-01-08T09:22:12
2019-01-08T09:22:12
164,611,416
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import java.util.ArrayList; import java.util.List; import javax.swing.text.html.FormSubmitEvent.MethodType; import javax.xml.ws.Response; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.handler.UserRoleAuthorizationInterceptor; import com.Repository.CustomerRepository; import com.dto.UserEntity; import com.service.impl.UserServiceImpl; @RestController @Component public class UserServices { @Autowired UserServiceImpl userServices; @RequestMapping("/getuserinfo") public List<UserEntity> getUserDetails() { return userServices.findAll(); } @RequestMapping(value = "/updateUserinfo", method = RequestMethod.POST) public ResponseEntity updateUserDetails(@RequestBody UserEntity users) { System.out.println(users.getFirstName()); userServices.save(users); return ResponseEntity.status(HttpStatus.OK).build(); } }
UTF-8
Java
1,298
java
UserServices.java
Java
[]
null
[]
package controller; import java.util.ArrayList; import java.util.List; import javax.swing.text.html.FormSubmitEvent.MethodType; import javax.xml.ws.Response; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.handler.UserRoleAuthorizationInterceptor; import com.Repository.CustomerRepository; import com.dto.UserEntity; import com.service.impl.UserServiceImpl; @RestController @Component public class UserServices { @Autowired UserServiceImpl userServices; @RequestMapping("/getuserinfo") public List<UserEntity> getUserDetails() { return userServices.findAll(); } @RequestMapping(value = "/updateUserinfo", method = RequestMethod.POST) public ResponseEntity updateUserDetails(@RequestBody UserEntity users) { System.out.println(users.getFirstName()); userServices.save(users); return ResponseEntity.status(HttpStatus.OK).build(); } }
1,298
0.827427
0.827427
41
30.658537
24.38273
80
false
false
0
0
0
0
0
0
0.926829
false
false
9
10e86310347f4ca227c3b00b0de9941ae66ec618
635,655,160,117
bdebea14d7b043c5c970c49c2741ed5223af9260
/Supplier-Assurance-Backend/src/main/java/McCollCo/Supplier/Assurance/Backend/repositories/QuestionRepository.java
def9c14df8e4d5932276606c7cf937beb91998f6
[]
no_license
michaelmccoll/SupplierAssurance
https://github.com/michaelmccoll/SupplierAssurance
0ea0fd8b154c07a566529affb25edb6e704a84a9
6e569625f609e5fa052aecfa7db6a5730ad6c808
refs/heads/main
2023-08-11T13:58:43.258000
2021-09-27T17:43:10
2021-09-27T17:43:10
394,412,981
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package McCollCo.Supplier.Assurance.Backend.repositories; import McCollCo.Supplier.Assurance.Backend.models.Question; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface QuestionRepository extends JpaRepository<Question, Long> { }
UTF-8
Java
322
java
QuestionRepository.java
Java
[]
null
[]
package McCollCo.Supplier.Assurance.Backend.repositories; import McCollCo.Supplier.Assurance.Backend.models.Question; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface QuestionRepository extends JpaRepository<Question, Long> { }
322
0.857143
0.857143
9
34.777779
29.275616
75
false
false
0
0
0
0
0
0
0.555556
false
false
9
8c34d78fa4f99c793b6169e76465b7475b380c6c
3,693,671,881,991
7b5c4993993cb394c2427c9f1455de17c26351ec
/src/main/java/ca/mali/fomparser/ParameterValueCell.java
bc32f7a6ca02a48e87d810490c9b34a834c96f7d
[ "Apache-2.0" ]
permissive
EMostafaAli/HlaListener
https://github.com/EMostafaAli/HlaListener
c391566e3f10f149c416a8361921853ca52a81be
bc9ba2e0e607b13118f77ffd574492f5240b8a17
refs/heads/master
2021-06-03T11:42:26.661000
2018-08-11T18:33:03
2018-08-11T18:33:03
34,214,796
4
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2015-2016, Mostafa Ali (engabdomostafa@gmail.com) * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. Redistributions * in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ package ca.mali.fomparser; import ca.mali.fomparser.datatype.AbstractDataType; import javafx.scene.control.TableCell; import javafx.scene.layout.Region; /** * @author Mostafa Ali <engabdomostafa@gmail.com> */ public class ParameterValueCell extends TableCell<ParameterValuePair, AbstractDataType> { private boolean initialTime = true; @Override protected void updateItem(AbstractDataType item, boolean empty) { super.updateItem(item, empty); if (empty || item == null) { setGraphic(null); setText(null); } else { Region r = item.getControl(initialTime); initialTime = false; if (r != null) { this.widthProperty().addListener((observable, oldValue, newValue) -> r.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2)); } setGraphic(r); } } }
UTF-8
Java
2,293
java
ParameterValueCell.java
Java
[ { "context": "/*\n * Copyright (c) 2015-2016, Mostafa Ali (engabdomostafa@gmail.com)\n * All rights reserved", "end": 42, "score": 0.9998365044593811, "start": 31, "tag": "NAME", "value": "Mostafa Ali" }, { "context": "/*\n * Copyright (c) 2015-2016, Mostafa Ali (engabdomostafa@gmail.com)\n * All rights reserved.\n * Redistribution and us", "end": 68, "score": 0.9999348521232605, "start": 44, "tag": "EMAIL", "value": "engabdomostafa@gmail.com" }, { "context": "import javafx.scene.layout.Region;\n\n/**\n * @author Mostafa Ali <engabdomostafa@gmail.com>\n */\npublic class Param", "end": 1573, "score": 0.9998267292976379, "start": 1562, "tag": "NAME", "value": "Mostafa Ali" }, { "context": "scene.layout.Region;\n\n/**\n * @author Mostafa Ali <engabdomostafa@gmail.com>\n */\npublic class ParameterValueCell extends Tabl", "end": 1599, "score": 0.9999351501464844, "start": 1575, "tag": "EMAIL", "value": "engabdomostafa@gmail.com" } ]
null
[]
/* * Copyright (c) 2015-2016, <NAME> (<EMAIL>) * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. Redistributions * in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ package ca.mali.fomparser; import ca.mali.fomparser.datatype.AbstractDataType; import javafx.scene.control.TableCell; import javafx.scene.layout.Region; /** * @author <NAME> <<EMAIL>> */ public class ParameterValueCell extends TableCell<ParameterValuePair, AbstractDataType> { private boolean initialTime = true; @Override protected void updateItem(AbstractDataType item, boolean empty) { super.updateItem(item, empty); if (empty || item == null) { setGraphic(null); setText(null); } else { Region r = item.getControl(initialTime); initialTime = false; if (r != null) { this.widthProperty().addListener((observable, oldValue, newValue) -> r.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2)); } setGraphic(r); } } }
2,249
0.719145
0.71522
55
40.69091
29.780331
148
false
false
0
0
0
0
0
0
0.763636
false
false
9
7ca077f94a01beb536465251cf0feb179529fe3d
3,693,671,881,705
5f361f8ccbf9a438635d01e7be3ecfefa99aef89
/nfsdb-core/src/main/java/com/nfsdb/ha/comsumer/JournalDeltaConsumer.java
8efda52f96da1ddd326d84b4d19d738b21e2ca48
[]
no_license
olegroshka/nfsdb
https://github.com/olegroshka/nfsdb
f2c9a47f07854a080c33ca003182ad2a8d7191c8
2d9913b09cdc8c1bfd5c8f430be580434dc0a0d9
refs/heads/master
2021-01-17T14:37:18.302000
2015-07-17T05:47:18
2015-07-17T05:47:18
35,828,771
0
1
null
true
2015-05-18T16:19:34
2015-05-18T16:19:34
2015-05-06T23:13:01
2015-05-17T20:14:27
6,503
0
0
0
null
null
null
/* * Copyright (c) 2014. Vlad Ilyushchenko * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.nfsdb.ha.comsumer; import com.nfsdb.JournalWriter; import com.nfsdb.Partition; import com.nfsdb.collections.ObjList; import com.nfsdb.exceptions.IncompatibleJournalException; import com.nfsdb.exceptions.JournalException; import com.nfsdb.exceptions.JournalNetworkException; import com.nfsdb.ha.AbstractChannelConsumer; import com.nfsdb.ha.model.JournalServerState; import com.nfsdb.utils.Interval; import java.nio.channels.ReadableByteChannel; public class JournalDeltaConsumer extends AbstractChannelConsumer { private final JournalWriter journal; private final JournalServerStateConsumer journalServerStateConsumer = new JournalServerStateConsumer(); private final JournalSymbolTableConsumer journalSymbolTableConsumer; private final ObjList<PartitionDeltaConsumer> partitionDeltaConsumers = new ObjList<>(); private JournalServerState state; private PartitionDeltaConsumer lagPartitionDeltaConsumer; public JournalDeltaConsumer(JournalWriter journal) { this.journal = journal; this.journalSymbolTableConsumer = new JournalSymbolTableConsumer(journal); } @Override public void free() { journalServerStateConsumer.free(); journalSymbolTableConsumer.free(); for (int i = 0, k = partitionDeltaConsumers.size(); i < k; i++) { partitionDeltaConsumers.getQuick(i).free(); } if (lagPartitionDeltaConsumer != null) { lagPartitionDeltaConsumer.free(); } } @Override protected void commit() throws JournalNetworkException { try { journal.commit(false, state.getTxn(), state.getTxPin()); } catch (JournalException e) { throw new JournalNetworkException(e); } } @Override @SuppressWarnings("unchecked") protected void doRead(ReadableByteChannel channel) throws JournalNetworkException { try { reset(); journalServerStateConsumer.read(channel); this.state = journalServerStateConsumer.getValue(); if (state.getTxn() == -1) { journal.notifyTxError(); throw new IncompatibleJournalException("Server refused txn for %s", journal.getLocation()); } if (state.getTxn() < journal.getTxn()) { journal.rollback(state.getTxn(), state.getTxPin()); return; } journal.beginTx(); createPartitions(state); if (state.isSymbolTables()) { journalSymbolTableConsumer.read(channel); } for (int i = 0, k = state.getNonLagPartitionCount(); i < k; i++) { JournalServerState.PartitionMetadata meta = state.getMeta(i); if (meta.getEmpty() == 0) { PartitionDeltaConsumer partitionDeltaConsumer = getPartitionDeltaConsumer(meta.getPartitionIndex()); partitionDeltaConsumer.read(channel); } } if (state.getLagPartitionName() == null && journal.hasIrregularPartition()) { // delete lag partition journal.removeIrregularPartition(); } else if (state.getLagPartitionName() != null) { if (lagPartitionDeltaConsumer == null || !journal.hasIrregularPartition() || !state.getLagPartitionName().equals(journal.getIrregularPartition().getName())) { Partition temp = journal.createTempPartition(state.getLagPartitionName()); lagPartitionDeltaConsumer = new PartitionDeltaConsumer(temp.open()); journal.setIrregularPartition(temp); } lagPartitionDeltaConsumer.read(channel); } } catch (JournalException e) { throw new JournalNetworkException(e); } } private void createPartitions(JournalServerState metadata) throws JournalException { int pc = journal.nonLagPartitionCount() - 1; for (int i = 0, k = metadata.getNonLagPartitionCount(); i < k; i++) { JournalServerState.PartitionMetadata partitionMetadata = metadata.getMeta(i); if (partitionMetadata.getPartitionIndex() > pc) { Interval interval = new Interval(partitionMetadata.getIntervalEnd(), partitionMetadata.getIntervalStart()); journal.createPartition(interval, partitionMetadata.getPartitionIndex()); } } } private PartitionDeltaConsumer getPartitionDeltaConsumer(int partitionIndex) throws JournalException { PartitionDeltaConsumer consumer = partitionDeltaConsumers.getQuiet(partitionIndex); if (consumer == null) { consumer = new PartitionDeltaConsumer(journal.getPartition(partitionIndex, true)); partitionDeltaConsumers.extendAndSet(partitionIndex, consumer); } return consumer; } private void reset() throws JournalException { for (int i = 0, k = partitionDeltaConsumers.size(); i < k; i++) { PartitionDeltaConsumer c = partitionDeltaConsumers.getAndSetQuick(i, null); if (c != null) { c.free(); } journal.getPartition(i, false).close(); } } }
UTF-8
Java
5,914
java
JournalDeltaConsumer.java
Java
[ { "context": "/*\n * Copyright (c) 2014. Vlad Ilyushchenko\n *\n * Licensed under the Apache License, Version ", "end": 43, "score": 0.9991130828857422, "start": 26, "tag": "NAME", "value": "Vlad Ilyushchenko" } ]
null
[]
/* * Copyright (c) 2014. <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.nfsdb.ha.comsumer; import com.nfsdb.JournalWriter; import com.nfsdb.Partition; import com.nfsdb.collections.ObjList; import com.nfsdb.exceptions.IncompatibleJournalException; import com.nfsdb.exceptions.JournalException; import com.nfsdb.exceptions.JournalNetworkException; import com.nfsdb.ha.AbstractChannelConsumer; import com.nfsdb.ha.model.JournalServerState; import com.nfsdb.utils.Interval; import java.nio.channels.ReadableByteChannel; public class JournalDeltaConsumer extends AbstractChannelConsumer { private final JournalWriter journal; private final JournalServerStateConsumer journalServerStateConsumer = new JournalServerStateConsumer(); private final JournalSymbolTableConsumer journalSymbolTableConsumer; private final ObjList<PartitionDeltaConsumer> partitionDeltaConsumers = new ObjList<>(); private JournalServerState state; private PartitionDeltaConsumer lagPartitionDeltaConsumer; public JournalDeltaConsumer(JournalWriter journal) { this.journal = journal; this.journalSymbolTableConsumer = new JournalSymbolTableConsumer(journal); } @Override public void free() { journalServerStateConsumer.free(); journalSymbolTableConsumer.free(); for (int i = 0, k = partitionDeltaConsumers.size(); i < k; i++) { partitionDeltaConsumers.getQuick(i).free(); } if (lagPartitionDeltaConsumer != null) { lagPartitionDeltaConsumer.free(); } } @Override protected void commit() throws JournalNetworkException { try { journal.commit(false, state.getTxn(), state.getTxPin()); } catch (JournalException e) { throw new JournalNetworkException(e); } } @Override @SuppressWarnings("unchecked") protected void doRead(ReadableByteChannel channel) throws JournalNetworkException { try { reset(); journalServerStateConsumer.read(channel); this.state = journalServerStateConsumer.getValue(); if (state.getTxn() == -1) { journal.notifyTxError(); throw new IncompatibleJournalException("Server refused txn for %s", journal.getLocation()); } if (state.getTxn() < journal.getTxn()) { journal.rollback(state.getTxn(), state.getTxPin()); return; } journal.beginTx(); createPartitions(state); if (state.isSymbolTables()) { journalSymbolTableConsumer.read(channel); } for (int i = 0, k = state.getNonLagPartitionCount(); i < k; i++) { JournalServerState.PartitionMetadata meta = state.getMeta(i); if (meta.getEmpty() == 0) { PartitionDeltaConsumer partitionDeltaConsumer = getPartitionDeltaConsumer(meta.getPartitionIndex()); partitionDeltaConsumer.read(channel); } } if (state.getLagPartitionName() == null && journal.hasIrregularPartition()) { // delete lag partition journal.removeIrregularPartition(); } else if (state.getLagPartitionName() != null) { if (lagPartitionDeltaConsumer == null || !journal.hasIrregularPartition() || !state.getLagPartitionName().equals(journal.getIrregularPartition().getName())) { Partition temp = journal.createTempPartition(state.getLagPartitionName()); lagPartitionDeltaConsumer = new PartitionDeltaConsumer(temp.open()); journal.setIrregularPartition(temp); } lagPartitionDeltaConsumer.read(channel); } } catch (JournalException e) { throw new JournalNetworkException(e); } } private void createPartitions(JournalServerState metadata) throws JournalException { int pc = journal.nonLagPartitionCount() - 1; for (int i = 0, k = metadata.getNonLagPartitionCount(); i < k; i++) { JournalServerState.PartitionMetadata partitionMetadata = metadata.getMeta(i); if (partitionMetadata.getPartitionIndex() > pc) { Interval interval = new Interval(partitionMetadata.getIntervalEnd(), partitionMetadata.getIntervalStart()); journal.createPartition(interval, partitionMetadata.getPartitionIndex()); } } } private PartitionDeltaConsumer getPartitionDeltaConsumer(int partitionIndex) throws JournalException { PartitionDeltaConsumer consumer = partitionDeltaConsumers.getQuiet(partitionIndex); if (consumer == null) { consumer = new PartitionDeltaConsumer(journal.getPartition(partitionIndex, true)); partitionDeltaConsumers.extendAndSet(partitionIndex, consumer); } return consumer; } private void reset() throws JournalException { for (int i = 0, k = partitionDeltaConsumers.size(); i < k; i++) { PartitionDeltaConsumer c = partitionDeltaConsumers.getAndSetQuick(i, null); if (c != null) { c.free(); } journal.getPartition(i, false).close(); } } }
5,903
0.654549
0.652012
148
38.959461
32.244396
123
false
false
0
0
0
0
0
0
0.581081
false
false
9
71b5866f5b90c97496c4a3b9bb5cc2176f0d8af7
2,465,311,230,018
27bb59064beea083b36adcfbbfa9921ecab912b1
/annocultor_solr4/src/main/java/eu/annocultor/xconverter/impl/XConverterFactory.java
b1e41ea2cb2ec2e3f45f843d7d249dd7da169364
[ "Apache-2.0" ]
permissive
europeana/tools
https://github.com/europeana/tools
8c494ca3962957f1434cf54fa5842d27fa610216
3865ea939a522fdfec5bed4a3697f07fed882594
refs/heads/master
2020-05-21T20:25:56.276000
2019-12-11T12:37:46
2019-12-11T12:37:46
11,627,616
2
6
null
false
2019-12-11T12:38:27
2013-07-24T06:10:56
2019-12-11T12:35:39
2019-12-11T12:38:24
323,329
3
3
8
Java
false
false
/* * Copyright 2005-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package eu.annocultor.xconverter.impl; import java.net.URI; import java.util.HashMap; import java.util.Map; import eu.annocultor.common.Language.Lang; import eu.annocultor.context.Environment; import eu.annocultor.context.Namespace; import eu.annocultor.path.Path; import eu.annocultor.tagger.vocabularies.VocabularyOfPeople; import eu.annocultor.tagger.vocabularies.VocabularyOfPlaces; import eu.annocultor.tagger.vocabularies.VocabularyOfTerms; import eu.annocultor.tagger.vocabularies.VocabularyOfTime; import eu.annocultor.triple.Property; import eu.annocultor.xconverter.api.Graph; import eu.annocultor.xconverter.api.Resource; /** * XML API factory. * * @author Borys Omelayenko * */ public class XConverterFactory { public static final String MERGED_SOURCES_OUTER_TAG_FILE = "file"; public static final String MERGED_SOURCES_OUTER_TAG_FILESET = "fileset"; public void init() throws Exception { } public XConverterFactory(Environment environment) { super(); this.environment = environment; try { init(); } catch (Exception e) { //throw new RuntimeException(e); } } Map<String, Graph> destinations = new HashMap<String, Graph>(); public void addGraph(String id, Graph graph) { if (graph == null) { throw new RuntimeException("Null graph"); } destinations.put(id, graph); } public Graph makeGraph(String id) throws Exception { if (!destinations.containsKey(id)) { throw new Exception("Named graph with id " + id + " was not declared in the destinations section"); } return destinations.get(id); } public void addNamespace(String nick, String url) throws Exception { environment.getNamespaces().addNamespace(url, nick); } private Environment environment; public Environment getEnvironment() { return environment; } public String makeString(String string) { return string; } public Resource makeResource(String uri) throws Exception { return new Resource(new URI(new Path(uri, environment.getNamespaces()).getPath())); } public Path makePath(String path) throws Exception { // Prefix fileset/file/ is here for a purpose: // (multiple) source files are wrapped into a single XML file // where each file is surrounded with fileset/file tag return new Path(path.startsWith("/") ? ("/" + MERGED_SOURCES_OUTER_TAG_FILESET + "/" + MERGED_SOURCES_OUTER_TAG_FILE + path) : path, environment.getNamespaces()); } public Namespace makeNamespace(String nick) throws Exception { if (environment == null || environment.getNamespaces() == null) { throw new Exception("Null environment or namespaces"); } String uri = environment.getNamespaces().getUri(nick); if (uri == null) { throw new Exception("Namespaces with nick " + nick + " is not declared in the <namespaces> section"); } return new Namespace(uri, nick, true); } public Property makeProperty(String path) throws Exception { return new Property(new Path(path, environment.getNamespaces())); } public Lang makeLang(String lang) throws Exception { return Lang.valueOf(lang); } private Map<String, VocabularyOfTerms> vocabulariesOfTerms = new HashMap<String, VocabularyOfTerms>(); private Map<String, VocabularyOfPeople> vocabulariesOfPeople = new HashMap<String, VocabularyOfPeople>(); private Map<String, VocabularyOfPlaces> vocabulariesOfPlaces = new HashMap<String, VocabularyOfPlaces>(); private Map<String, VocabularyOfTime> vocabulariesOfTime = new HashMap<String, VocabularyOfTime>(); public VocabularyOfTerms makeVocabularyOfTerms(String id) throws Exception { VocabularyOfTerms vocabulary = vocabulariesOfTerms.get(id); if (vocabulary == null) throw new NullPointerException("Vocabulary " + id + " is not defined in XML under tag <vocabularies>"); return vocabulary; } public void addVocabularyOfTerms(String id, VocabularyOfTerms vocabulary) throws Exception { if (vocabulariesOfTerms.containsKey(id)) { throw new Exception("Vocabulary " + id + " already exists"); } vocabulariesOfTerms.put(id, vocabulary); } public VocabularyOfTime makeVocabularyOfTime(String id) throws Exception { VocabularyOfTime vocabulary = vocabulariesOfTime.get(id); if (vocabulary == null) throw new NullPointerException("Vocabulary " + id + " is not defined in XML under tag <vocabularies>"); return vocabulary; } public void addVocabularyOfTime(String id, VocabularyOfTime vocabulary) throws Exception { if (vocabulariesOfTime.containsKey(id)) { throw new Exception("Vocabulary " + id + " already exists"); } vocabulariesOfTime.put(id, vocabulary); } // public VocabularyOfTerms getVocabularyOfTerms(String id) // { // return vocabulariesOfTerms.get(id); // } public VocabularyOfPeople makeVocabularyOfPeople(String id) throws Exception { VocabularyOfPeople vocabulary = vocabulariesOfPeople.get(id); if (vocabulary == null) throw new NullPointerException("Vocabulary " + id + " is not defined in XML under tag <vocabularies>"); return vocabulary; } public void addVocabularyOfPeople(String id, VocabularyOfPeople vocabulary) throws Exception { if (vocabulariesOfPeople.containsKey(id)) { throw new Exception("Vocabulary " + id + " already exists"); } vocabulariesOfPeople.put(id, vocabulary); } // public VocabularyOfPeople getVocabularyOfPeople(String id) // { // return vocabulariesOfPeople.get(id); // } public VocabularyOfPlaces makeVocabularyOfPlaces(String id) throws Exception { VocabularyOfPlaces vocabulary = vocabulariesOfPlaces.get(id); if (vocabulary == null) throw new NullPointerException("Vocabulary " + id + " is not defined in XML under tag <vocabularies>"); return vocabulary; } public void addVocabularyOfPlaces(String id, VocabularyOfPlaces vocabulary) throws Exception { if (vocabulariesOfPlaces.containsKey(id)) { throw new Exception("Vocabulary " + id + " already exists"); } vocabulariesOfPlaces.put(id, vocabulary); } // public VocabularyOfPlaces getVocabularyOfPlaces(String id) // { // return vocabulariesOfPlaces.get(id); // } public class MapPathToProperty { public MapPathToProperty(Path srcPath, Property dstProperty) { super(); this.srcPath = srcPath; this.dstProperty = dstProperty; } private Path srcPath; private Property dstProperty; public Path getSrcPath() { return srcPath; } public Property getDstProperty() { return dstProperty; } } public MapObjectToObject makeMap(String srcValue, String dstValue) throws Exception { return new MapObjectToObject(makeString(srcValue), makeString(dstValue)); } public MapObjectToObject makeMap(Path srcValue, Property dstValue) throws Exception { return new MapObjectToObject(srcValue, dstValue); } public class MapObjectToObject { public MapObjectToObject(Object srcValue, Object dstValue) { super(); this.srcValue = srcValue; this.dstValue = dstValue; } private Object srcValue; private Object dstValue; public Object getSrcValue() { return srcValue; } public Object getDstValue() { return dstValue; } } }
UTF-8
Java
7,920
java
XConverterFactory.java
Java
[ { "context": "urce;\n\n\r\n/**\r\n * XML API factory.\r\n * \r\n * @author Borys Omelayenko\r\n * \r\n */\r\npublic class XConverterFactory\r\n{\r\n\r\n\t", "end": 1322, "score": 0.9997043609619141, "start": 1306, "tag": "NAME", "value": "Borys Omelayenko" } ]
null
[]
/* * Copyright 2005-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package eu.annocultor.xconverter.impl; import java.net.URI; import java.util.HashMap; import java.util.Map; import eu.annocultor.common.Language.Lang; import eu.annocultor.context.Environment; import eu.annocultor.context.Namespace; import eu.annocultor.path.Path; import eu.annocultor.tagger.vocabularies.VocabularyOfPeople; import eu.annocultor.tagger.vocabularies.VocabularyOfPlaces; import eu.annocultor.tagger.vocabularies.VocabularyOfTerms; import eu.annocultor.tagger.vocabularies.VocabularyOfTime; import eu.annocultor.triple.Property; import eu.annocultor.xconverter.api.Graph; import eu.annocultor.xconverter.api.Resource; /** * XML API factory. * * @author <NAME> * */ public class XConverterFactory { public static final String MERGED_SOURCES_OUTER_TAG_FILE = "file"; public static final String MERGED_SOURCES_OUTER_TAG_FILESET = "fileset"; public void init() throws Exception { } public XConverterFactory(Environment environment) { super(); this.environment = environment; try { init(); } catch (Exception e) { //throw new RuntimeException(e); } } Map<String, Graph> destinations = new HashMap<String, Graph>(); public void addGraph(String id, Graph graph) { if (graph == null) { throw new RuntimeException("Null graph"); } destinations.put(id, graph); } public Graph makeGraph(String id) throws Exception { if (!destinations.containsKey(id)) { throw new Exception("Named graph with id " + id + " was not declared in the destinations section"); } return destinations.get(id); } public void addNamespace(String nick, String url) throws Exception { environment.getNamespaces().addNamespace(url, nick); } private Environment environment; public Environment getEnvironment() { return environment; } public String makeString(String string) { return string; } public Resource makeResource(String uri) throws Exception { return new Resource(new URI(new Path(uri, environment.getNamespaces()).getPath())); } public Path makePath(String path) throws Exception { // Prefix fileset/file/ is here for a purpose: // (multiple) source files are wrapped into a single XML file // where each file is surrounded with fileset/file tag return new Path(path.startsWith("/") ? ("/" + MERGED_SOURCES_OUTER_TAG_FILESET + "/" + MERGED_SOURCES_OUTER_TAG_FILE + path) : path, environment.getNamespaces()); } public Namespace makeNamespace(String nick) throws Exception { if (environment == null || environment.getNamespaces() == null) { throw new Exception("Null environment or namespaces"); } String uri = environment.getNamespaces().getUri(nick); if (uri == null) { throw new Exception("Namespaces with nick " + nick + " is not declared in the <namespaces> section"); } return new Namespace(uri, nick, true); } public Property makeProperty(String path) throws Exception { return new Property(new Path(path, environment.getNamespaces())); } public Lang makeLang(String lang) throws Exception { return Lang.valueOf(lang); } private Map<String, VocabularyOfTerms> vocabulariesOfTerms = new HashMap<String, VocabularyOfTerms>(); private Map<String, VocabularyOfPeople> vocabulariesOfPeople = new HashMap<String, VocabularyOfPeople>(); private Map<String, VocabularyOfPlaces> vocabulariesOfPlaces = new HashMap<String, VocabularyOfPlaces>(); private Map<String, VocabularyOfTime> vocabulariesOfTime = new HashMap<String, VocabularyOfTime>(); public VocabularyOfTerms makeVocabularyOfTerms(String id) throws Exception { VocabularyOfTerms vocabulary = vocabulariesOfTerms.get(id); if (vocabulary == null) throw new NullPointerException("Vocabulary " + id + " is not defined in XML under tag <vocabularies>"); return vocabulary; } public void addVocabularyOfTerms(String id, VocabularyOfTerms vocabulary) throws Exception { if (vocabulariesOfTerms.containsKey(id)) { throw new Exception("Vocabulary " + id + " already exists"); } vocabulariesOfTerms.put(id, vocabulary); } public VocabularyOfTime makeVocabularyOfTime(String id) throws Exception { VocabularyOfTime vocabulary = vocabulariesOfTime.get(id); if (vocabulary == null) throw new NullPointerException("Vocabulary " + id + " is not defined in XML under tag <vocabularies>"); return vocabulary; } public void addVocabularyOfTime(String id, VocabularyOfTime vocabulary) throws Exception { if (vocabulariesOfTime.containsKey(id)) { throw new Exception("Vocabulary " + id + " already exists"); } vocabulariesOfTime.put(id, vocabulary); } // public VocabularyOfTerms getVocabularyOfTerms(String id) // { // return vocabulariesOfTerms.get(id); // } public VocabularyOfPeople makeVocabularyOfPeople(String id) throws Exception { VocabularyOfPeople vocabulary = vocabulariesOfPeople.get(id); if (vocabulary == null) throw new NullPointerException("Vocabulary " + id + " is not defined in XML under tag <vocabularies>"); return vocabulary; } public void addVocabularyOfPeople(String id, VocabularyOfPeople vocabulary) throws Exception { if (vocabulariesOfPeople.containsKey(id)) { throw new Exception("Vocabulary " + id + " already exists"); } vocabulariesOfPeople.put(id, vocabulary); } // public VocabularyOfPeople getVocabularyOfPeople(String id) // { // return vocabulariesOfPeople.get(id); // } public VocabularyOfPlaces makeVocabularyOfPlaces(String id) throws Exception { VocabularyOfPlaces vocabulary = vocabulariesOfPlaces.get(id); if (vocabulary == null) throw new NullPointerException("Vocabulary " + id + " is not defined in XML under tag <vocabularies>"); return vocabulary; } public void addVocabularyOfPlaces(String id, VocabularyOfPlaces vocabulary) throws Exception { if (vocabulariesOfPlaces.containsKey(id)) { throw new Exception("Vocabulary " + id + " already exists"); } vocabulariesOfPlaces.put(id, vocabulary); } // public VocabularyOfPlaces getVocabularyOfPlaces(String id) // { // return vocabulariesOfPlaces.get(id); // } public class MapPathToProperty { public MapPathToProperty(Path srcPath, Property dstProperty) { super(); this.srcPath = srcPath; this.dstProperty = dstProperty; } private Path srcPath; private Property dstProperty; public Path getSrcPath() { return srcPath; } public Property getDstProperty() { return dstProperty; } } public MapObjectToObject makeMap(String srcValue, String dstValue) throws Exception { return new MapObjectToObject(makeString(srcValue), makeString(dstValue)); } public MapObjectToObject makeMap(Path srcValue, Property dstValue) throws Exception { return new MapObjectToObject(srcValue, dstValue); } public class MapObjectToObject { public MapObjectToObject(Object srcValue, Object dstValue) { super(); this.srcValue = srcValue; this.dstValue = dstValue; } private Object srcValue; private Object dstValue; public Object getSrcValue() { return srcValue; } public Object getDstValue() { return dstValue; } } }
7,910
0.72298
0.721465
299
24.9398
28.58742
164
false
false
0
0
0
0
0
0
1.598662
false
false
9
ccc8fe1dcb9c2a93585cf499fad6860e54149158
12,257,836,671,430
d422e6bef4d71b84e6d301f84633d24eca8e6b1f
/design-parttens-demo/src/main/java/com/adeng/patterns/structural/proxy/cglib/CglibProxy.java
08433be751f0848feaedcefd35cadc0a06086a35
[]
no_license
adeng-wc/j2ee-demo
https://github.com/adeng-wc/j2ee-demo
f5b90dfd370217fb046f1d9976325bd236634b38
09326d9a6e2a8a4d7710e3a26651c76fde30f598
refs/heads/master
2023-04-30T08:40:26.015000
2023-04-23T08:12:02
2023-04-23T08:12:02
174,507,762
0
1
null
false
2022-12-29T12:06:08
2019-03-08T09:27:22
2022-05-20T09:39:46
2022-12-29T12:06:06
2,323
0
0
15
Java
false
false
package com.adeng.patterns.structural.proxy.cglib; import net.sf.cglib.proxy.Enhancer; import net.sf.cglib.proxy.MethodInterceptor; import net.sf.cglib.proxy.MethodProxy; import java.lang.reflect.Method; /** * Cglib Proxy */ public class CglibProxy { public Object getInstance(Class clazz) { //增强类 Enhancer enhancer = new Enhancer(); //设置代理对象继承的类 enhancer.setSuperclass(clazz); /* *//* 设置回调,执行所有有返回类型方法都会被替换成"Hello cglib" *//* e.setCallback(new FixedValue() { @Override public Object loadObject() throws Exception { return "Hello cglib"; } });*/ /* *//* 代理对象的每个方法被调用都会`InvocationHandler`拦截, InvocationHandler可以对被调用方法进行解析,但是调用invoke方法会死循环 *//* e.setCallback(new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { System.out.println("InvocationHandler被调用"); System.out.println("Method:"+method.toString()); System.out.println(proxy.getClass().toString()); if (method.getDeclaringClass() != Object.class && method.getReturnType() == String.class) { return method.invoke(proxy, args); } else { throw new RuntimeException("你想调用什么方法?"); } } });*/ /* MethodInterceptor 可以对代理对象方法进行调动。 */ enhancer.setCallback(new MethodInterceptor() { @Override public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { System.out.println("MethodInterceptor.intercept() 被" + method.toString() + "调用"); System.out.println(obj.getClass().toString()); return proxy.invokeSuper(obj, args); } }); return enhancer.create(); } }
UTF-8
Java
2,261
java
CglibProxy.java
Java
[]
null
[]
package com.adeng.patterns.structural.proxy.cglib; import net.sf.cglib.proxy.Enhancer; import net.sf.cglib.proxy.MethodInterceptor; import net.sf.cglib.proxy.MethodProxy; import java.lang.reflect.Method; /** * Cglib Proxy */ public class CglibProxy { public Object getInstance(Class clazz) { //增强类 Enhancer enhancer = new Enhancer(); //设置代理对象继承的类 enhancer.setSuperclass(clazz); /* *//* 设置回调,执行所有有返回类型方法都会被替换成"Hello cglib" *//* e.setCallback(new FixedValue() { @Override public Object loadObject() throws Exception { return "Hello cglib"; } });*/ /* *//* 代理对象的每个方法被调用都会`InvocationHandler`拦截, InvocationHandler可以对被调用方法进行解析,但是调用invoke方法会死循环 *//* e.setCallback(new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { System.out.println("InvocationHandler被调用"); System.out.println("Method:"+method.toString()); System.out.println(proxy.getClass().toString()); if (method.getDeclaringClass() != Object.class && method.getReturnType() == String.class) { return method.invoke(proxy, args); } else { throw new RuntimeException("你想调用什么方法?"); } } });*/ /* MethodInterceptor 可以对代理对象方法进行调动。 */ enhancer.setCallback(new MethodInterceptor() { @Override public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { System.out.println("MethodInterceptor.intercept() 被" + method.toString() + "调用"); System.out.println(obj.getClass().toString()); return proxy.invokeSuper(obj, args); } }); return enhancer.create(); } }
2,261
0.555231
0.555231
70
28.357143
26.691378
115
false
false
0
0
0
0
0
0
0.4
false
false
9
610ae6031b88c318a146617564eb4de7935bc69d
13,228,499,278,183
345a2904196373e2ef3e2e821b970402cf111991
/Group24_project/src/java/Players.java
f7c085caf1473c4e11898d14215f5063c17094fa
[]
no_license
LakshikaDamithri/PacMan-Game
https://github.com/LakshikaDamithri/PacMan-Game
4048d279b0bdcfd1e2606575c711c0d85ee8f6fc
2226fe9ae9993e208a29bda0404bf907857aa8f6
refs/heads/master
2020-12-25T18:53:08.071000
2017-08-13T23:17:08
2017-08-13T23:17:08
94,011,199
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//player class public class Players{ int playerID; int x; int y; int score; public Players(int ID, int xp, int yp, int scorep) { this.playerID = ID; this.x = xp; this.y = yp; this.score = scorep; } //update player position public void updatePlayers(int event){ if ( event ==40 && (y<44)){ y++; } else if (event==38 && (y>0)){ y--; } else if(event == 37 && (x > 0)){ x--; } else if( event==39 && (x<44)){ x++; } } //player string @Override public String toString() { return "[ \"P"+playerID+"\","+score+" , "+x+" , "+y+"]"; } }
UTF-8
Java
796
java
Players.java
Java
[]
null
[]
//player class public class Players{ int playerID; int x; int y; int score; public Players(int ID, int xp, int yp, int scorep) { this.playerID = ID; this.x = xp; this.y = yp; this.score = scorep; } //update player position public void updatePlayers(int event){ if ( event ==40 && (y<44)){ y++; } else if (event==38 && (y>0)){ y--; } else if(event == 37 && (x > 0)){ x--; } else if( event==39 && (x<44)){ x++; } } //player string @Override public String toString() { return "[ \"P"+playerID+"\","+score+" , "+x+" , "+y+"]"; } }
796
0.390704
0.373116
37
19.513514
15.066737
64
false
false
0
0
0
0
0
0
0.513514
false
false
9