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
b36b0b8b662cdfeed20602c09bc1e4bf63d883e5
16,226,386,488,387
db9e9e4e75c89ea34de1bc92f58e902c864d7df5
/Level_1/Q_42576.java
7a4eb83e80f64b131d878799891d1a1ee9ad1e4f
[]
no_license
DongJinJeong/programmers_algorithm_java
https://github.com/DongJinJeong/programmers_algorithm_java
ad8c37f3fea472260c165570a1ab7da50e6ab5ab
3e0235d4a3c705deb0f6413d485aa1436d8354bd
refs/heads/main
2023-02-13T09:32:46.650000
2021-01-19T02:15:45
2021-01-19T02:15:45
322,183,353
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package programmers; import org.junit.Assert; import org.junit.Test; import java.util.Arrays; public class Q_42576 { public String solution(String[] participant, String[] completion) { String answer = ""; String temp = ""; Arrays.sort(participant); Arrays.sort(completion); int i = 0; while(i < completion.length){ if(!completion[i].equals(participant[i])){ temp = participant[i]; break; }else{ i++; } } if(!temp.equals("")){ answer = temp; } else { answer = participant[participant.length-1]; } return answer; } @Test public void 정답 () { Assert.assertEquals("leo", solution(new String[]{"leo", "kiki", "eden"}, new String[]{"eden", "kiki"})); Assert.assertEquals("vinko", solution(new String[]{"marina", "josipa", "nikola", "vinko", "filipa"}, new String[]{"marina", "josipa", "nikola", "filipa"})); Assert.assertEquals("mislav", solution(new String[]{"mislav", "stanko", "mislav", "ana"}, new String[]{"stanko", "ana", "mislav"})); } }
UTF-8
Java
1,191
java
Q_42576.java
Java
[ { "context": "sert.assertEquals(\"vinko\", solution(new String[]{\"marina\", \"josipa\", \"nikola\", \"vinko\", \"filipa\"}, new Str", "end": 939, "score": 0.9997309446334839, "start": 933, "tag": "NAME", "value": "marina" }, { "context": "tEquals(\"vinko\", solution(new String[]{\"m...
null
[]
package programmers; import org.junit.Assert; import org.junit.Test; import java.util.Arrays; public class Q_42576 { public String solution(String[] participant, String[] completion) { String answer = ""; String temp = ""; Arrays.sort(participant); Arrays.sort(completion); int i = 0; while(i < completion.length){ if(!completion[i].equals(participant[i])){ temp = participant[i]; break; }else{ i++; } } if(!temp.equals("")){ answer = temp; } else { answer = participant[participant.length-1]; } return answer; } @Test public void 정답 () { Assert.assertEquals("leo", solution(new String[]{"leo", "kiki", "eden"}, new String[]{"eden", "kiki"})); Assert.assertEquals("vinko", solution(new String[]{"marina", "josipa", "nikola", "vinko", "filipa"}, new String[]{"marina", "josipa", "nikola", "filipa"})); Assert.assertEquals("mislav", solution(new String[]{"mislav", "stanko", "mislav", "ana"}, new String[]{"stanko", "ana", "mislav"})); } }
1,191
0.535805
0.529907
42
27.261906
35.317646
164
false
false
0
0
0
0
0
0
0.952381
false
false
3
1dd23f4f128efedc407fa18abba0305d595af315
11,888,469,491,505
c3a96f8a1d252e63a142ff40696dd63fb6671274
/marketing-tool-dao/src/main/java/cn/rongcapital/mkt/dao/dataauth/OrganizationDao.java
4d5b3f4e1609611a22cdbbcff3930d6fc268b915
[]
no_license
moutainhigh/martketing-cloud
https://github.com/moutainhigh/martketing-cloud
efd607b0fb7b6d3521123a6edf2e74524e54fbf6
6526ddca1484ad49947371f4d07fb5860d385628
refs/heads/master
2023-03-17T09:36:21.723000
2017-07-17T03:20:31
2017-07-17T03:20:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.rongcapital.mkt.dao.dataauth; import java.util.List; import cn.rongcapital.mkt.dataauth.po.Organization; public interface OrganizationDao { int insert(Organization org); int updateById(Organization org); Organization getNodeById(Long id); List<Organization> getChildNodeById(Long id); List<Organization> selectList(Organization org); }
UTF-8
Java
382
java
OrganizationDao.java
Java
[]
null
[]
package cn.rongcapital.mkt.dao.dataauth; import java.util.List; import cn.rongcapital.mkt.dataauth.po.Organization; public interface OrganizationDao { int insert(Organization org); int updateById(Organization org); Organization getNodeById(Long id); List<Organization> getChildNodeById(Long id); List<Organization> selectList(Organization org); }
382
0.748691
0.748691
18
19.222221
19.80616
51
false
false
0
0
0
0
0
0
0.888889
false
false
3
69daf96961b941ccaf2d2241b4a37681a3f0dd8e
3,289,944,968,209
ea28df06622444b593d98d8845fe6baef3693987
/src/main/java/com/balimiao/arithmetic/data/BinaryTreeNode.java
5a94e186f45e9404aa9b4d51a6589a553bb39028
[]
no_license
13671148038/java8base
https://github.com/13671148038/java8base
3df7cc5fb4bcddbd1e001e69721421e592f8fc08
93ef5035c902ee93c3ce78fe5f54d94b39e7ab85
refs/heads/master
2022-10-11T03:24:07.775000
2022-07-08T06:15:59
2022-07-08T06:15:59
169,551,091
0
1
null
false
2022-10-05T18:21:27
2019-02-07T10:01:51
2021-11-30T03:31:46
2022-10-05T18:21:24
1,435
0
1
5
Java
false
false
package com.balimiao.arithmetic.data; /** * @Description: 二叉树的节点 * @Author zhushaopeng * @Date 2020/9/28 **/ public class BinaryTreeNode { //值 private Integer value; //左节点 private BinaryTreeNode leftNode; //右节点 private BinaryTreeNode rightNode; public BinaryTreeNode() { } public BinaryTreeNode(Integer value) { this.value = value; } public Integer getValue() { return value; } public void setValue(Integer value) { this.value = value; } public BinaryTreeNode getLeftNode() { return leftNode; } public void setLeftNode(BinaryTreeNode leftNode) { this.leftNode = leftNode; } public BinaryTreeNode getRightNode() { return rightNode; } public void setRightNode(BinaryTreeNode rightNode) { this.rightNode = rightNode; } }
UTF-8
Java
901
java
BinaryTreeNode.java
Java
[ { "context": "etic.data;\n\n/**\n * @Description: 二叉树的节点\n * @Author zhushaopeng\n * @Date 2020/9/28\n **/\npublic class Binary", "end": 83, "score": 0.5962537527084351, "start": 78, "tag": "USERNAME", "value": "zhush" }, { "context": "ata;\n\n/**\n * @Description: 二叉树的节点\n * @Author...
null
[]
package com.balimiao.arithmetic.data; /** * @Description: 二叉树的节点 * @Author zhushaopeng * @Date 2020/9/28 **/ public class BinaryTreeNode { //值 private Integer value; //左节点 private BinaryTreeNode leftNode; //右节点 private BinaryTreeNode rightNode; public BinaryTreeNode() { } public BinaryTreeNode(Integer value) { this.value = value; } public Integer getValue() { return value; } public void setValue(Integer value) { this.value = value; } public BinaryTreeNode getLeftNode() { return leftNode; } public void setLeftNode(BinaryTreeNode leftNode) { this.leftNode = leftNode; } public BinaryTreeNode getRightNode() { return rightNode; } public void setRightNode(BinaryTreeNode rightNode) { this.rightNode = rightNode; } }
901
0.629714
0.621714
46
18.02174
16.512827
56
false
false
0
0
0
0
0
0
0.23913
false
false
3
f1d54da47b71791b58183c0fa62a78f1893db250
3,289,944,970,722
c74686e0c4788c6027af6c762056301cac68e751
/src/main/java/com/hay/betadvisor/model/Offer.java
793cc287cde23a41195929ab8b5a2d8ae561729e
[]
no_license
sgoenko/betadvisor
https://github.com/sgoenko/betadvisor
41c65451bcedaf252edd3aca394e940b1c07f214
930d2e2f86eef8b9ffb89142387f9d5c6ee322b3
refs/heads/master
2023-02-03T03:55:12.193000
2020-12-22T19:11:12
2020-12-22T19:11:12
315,944,318
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hay.betadvisor.model; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToOne; import javax.persistence.Table; import com.hay.betadvisor.model.dto.EventDto; @Entity @Table(name = "offer") public class Offer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @ManyToOne @JoinColumn(name = "event_id", nullable = false) private Event event; @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "bookmaker_id", referencedColumnName = "id") private Bookmaker bookmaker; private double home; private double guest; private double draw; private double profit; public Offer() { } public Offer(EventDto e) { this.home = e.getHome(); this.guest = e.getGuest(); this.draw = e.getDraw(); this.profit = e.getProfit(); } public int getId() { return id; } public void setId(int id) { this.id = id; } public Event getEvent() { return event; } public void setEvent(Event event) { this.event = event; } public Bookmaker getBookmaker() { return bookmaker; } public void setBookmaker(Bookmaker bookmaker) { this.bookmaker = bookmaker; } public double getHome() { return home; } public void setHome(double home) { this.home = home; } public double getGuest() { return guest; } public void setGuest(double guest) { this.guest = guest; } public double getDraw() { return draw; } public void setDraw(double draw) { this.draw = draw; } public double getProfit() { return profit; } public void setProfit(double profit) { this.profit = profit; } public void setProfit() { profit = (1 / home + 1 / guest + 1 / draw - 1) * 100; } }
UTF-8
Java
1,885
java
Offer.java
Java
[]
null
[]
package com.hay.betadvisor.model; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToOne; import javax.persistence.Table; import com.hay.betadvisor.model.dto.EventDto; @Entity @Table(name = "offer") public class Offer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @ManyToOne @JoinColumn(name = "event_id", nullable = false) private Event event; @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "bookmaker_id", referencedColumnName = "id") private Bookmaker bookmaker; private double home; private double guest; private double draw; private double profit; public Offer() { } public Offer(EventDto e) { this.home = e.getHome(); this.guest = e.getGuest(); this.draw = e.getDraw(); this.profit = e.getProfit(); } public int getId() { return id; } public void setId(int id) { this.id = id; } public Event getEvent() { return event; } public void setEvent(Event event) { this.event = event; } public Bookmaker getBookmaker() { return bookmaker; } public void setBookmaker(Bookmaker bookmaker) { this.bookmaker = bookmaker; } public double getHome() { return home; } public void setHome(double home) { this.home = home; } public double getGuest() { return guest; } public void setGuest(double guest) { this.guest = guest; } public double getDraw() { return draw; } public void setDraw(double draw) { this.draw = draw; } public double getProfit() { return profit; } public void setProfit(double profit) { this.profit = profit; } public void setProfit() { profit = (1 / home + 1 / guest + 1 / draw - 1) * 100; } }
1,885
0.706101
0.702387
106
16.783018
15.910721
64
false
false
0
0
0
0
0
0
1.179245
false
false
3
79abfdadd7bf980af9791a50c09495d297c0f55d
5,042,291,622,992
0bc2cf5b8b65c294d5b24576c63fad2552944d57
/Docker-Compose2UML_nonokawa2019/docker-compose2uml/src/main/java/io/github/nnkwrik/astah/astah/creator/element/CsDiagramCreator.java
7d8f99b4bd1c1f031f3fe555620956112ba44c3f
[ "Apache-2.0" ]
permissive
kisolab/astah_plugins_released
https://github.com/kisolab/astah_plugins_released
d3cc036b9fde5886ad914f391b51f30c9676ae2b
e1ed674e998f953ab9becefc9bd9c474b8c569b7
refs/heads/main
2023-03-11T13:04:15.848000
2021-02-19T05:28:49
2021-02-19T05:28:49
331,816,243
0
4
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.github.nnkwrik.astah.astah.creator.element; import com.change_vision.jude.api.inf.editor.CompositeStructureDiagramEditor; import com.change_vision.jude.api.inf.exception.InvalidEditingException; import com.change_vision.jude.api.inf.model.ICompositeStructureDiagram; import com.change_vision.jude.api.inf.model.INamedElement; import io.github.nnkwrik.astah.exception.AstahAPIRuntimeException; /** * astahで合成構造図を作成するクリエイター * * @author Reika Nonokawa */ public class CsDiagramCreator { /** * 合成構造図を作成する * * @param csDiagramEditor * @param parent * @param name * @return */ public ICompositeStructureDiagram createCompositeStructureDiagram( CompositeStructureDiagramEditor csDiagramEditor, INamedElement parent, String name) { ICompositeStructureDiagram csDiagram = null; try { csDiagram = csDiagramEditor.createCompositeStructureDiagram(parent, name); } catch (InvalidEditingException e) { throw new AstahAPIRuntimeException(e); } return csDiagram; } }
UTF-8
Java
1,209
java
CsDiagramCreator.java
Java
[ { "context": "\r\n\r\n/**\r\n * astahで合成構造図を作成するクリエイター\r\n *\r\n * @author Reika Nonokawa\r\n */\r\npublic class CsDiagramCreator {\r\n\r\n /**\r", "end": 475, "score": 0.9998617172241211, "start": 461, "tag": "NAME", "value": "Reika Nonokawa" } ]
null
[]
package io.github.nnkwrik.astah.astah.creator.element; import com.change_vision.jude.api.inf.editor.CompositeStructureDiagramEditor; import com.change_vision.jude.api.inf.exception.InvalidEditingException; import com.change_vision.jude.api.inf.model.ICompositeStructureDiagram; import com.change_vision.jude.api.inf.model.INamedElement; import io.github.nnkwrik.astah.exception.AstahAPIRuntimeException; /** * astahで合成構造図を作成するクリエイター * * @author <NAME> */ public class CsDiagramCreator { /** * 合成構造図を作成する * * @param csDiagramEditor * @param parent * @param name * @return */ public ICompositeStructureDiagram createCompositeStructureDiagram( CompositeStructureDiagramEditor csDiagramEditor, INamedElement parent, String name) { ICompositeStructureDiagram csDiagram = null; try { csDiagram = csDiagramEditor.createCompositeStructureDiagram(parent, name); } catch (InvalidEditingException e) { throw new AstahAPIRuntimeException(e); } return csDiagram; } }
1,201
0.68658
0.68658
37
29.216217
26.236074
86
false
false
0
0
0
0
0
0
0.351351
false
false
3
2ed610dcdfba5b459427e704287290a1099c7b3a
154,618,837,525
dafa4d90823972d30a18b8c8ae08d0671b4e262d
/dsc-dscexpen/src/main/java/com/dscexpen/date/HolidayUtil.java
f70a51b804e6f89e62808457c3b5678fdcad72aa
[]
no_license
dujianjun/dinfoSuccesCom
https://github.com/dujianjun/dinfoSuccesCom
401517d26c2f52e9cd72df80bc188b291ad4bda6
47fd73fc752617bdced8242ec56a7c2b30d120ab
refs/heads/master
2022-12-26T02:28:04.322000
2021-07-18T07:37:52
2021-07-18T07:37:52
172,716,774
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dscexpen.date; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import com.dscexpen.tools.FileUtils; import org.apache.log4j.Logger; import jxl.Cell; import jxl.CellType; import jxl.DateCell; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; /** * 根据读取配置的excel判断是否为法定节假日,及法定工作日 * @author Administrator * */ public class HolidayUtil { private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); private List<String> holidays = new ArrayList<String>(); private List<String> workdays = new ArrayList<String>(); private Date now = new Date(); private Logger logger = Logger.getLogger(HolidayUtil.class); /** * 判断当天是否是工作日 (工作日:true;节假日:false) * @param filePath * @return */ public boolean isWorkDay(String filePath){ boolean flag = true; parseExcel(filePath);//读取excel中的节假日和工作日 int dateType = getDateType(); //如果excel不存在当前日期。判断是否周六日 if(dateType==0){ Calendar c = Calendar.getInstance(); if(c.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY|| c.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY){ flag = false; } }else{//如果存在当前日期,根据返回的类型判断 if(dateType==1){//节假日 flag = false; } /* else if(dateType==2){//工作日 flag = true; }*/ } logger.info("当前日期是:"+(flag==true?"工作日":"节假日")); return flag; } /** * 根据判断当前时间是否是节假日还是工作日 (excel中不存在当前日期:0;节假日:1;工作日:2) * 如果当前日期在excel中的节假日和工作日都写了,默认的工作日 * @return */ private int getDateType(){ int type = 0; String today = sdf.format(now); if(holidays.size()>0){ for(String holiday:holidays){ if(holiday.equals(today)){ type = 1; break; } } } if(workdays.size()>0){ for(String workday:workdays){ if(workday.equals(today)){ type = 2; } } } return type; } /** * 读取excel中的节假日和工作日 * @param filePath */ private void parseExcel(String filePath){ if(filePath==null||"".equals(filePath)){ return ; } Workbook workbook = null; try { File file =new File(filePath); if(!file.exists()){ System.out.println("文件不存在"); } workbook = Workbook.getWorkbook(new FileInputStream(filePath)); Sheet sheets[] = workbook.getSheets(); if(sheets==null||sheets.length==0){ return; } Sheet sheet = sheets[0];//取到第一个sheet int rows = sheet.getRows(); //获取第一列数据-节假日 for(int rowIndex = 1;rowIndex <rows;rowIndex++){ Cell cell = sheet.getCell(0, rowIndex); if(cell==null){ break; } if(cell.getType() == CellType.DATE){ DateCell dateCell = (DateCell)cell; Date date = dateCell.getDate(); String dateStr = sdf.format(date); holidays.add(dateStr); } } //获取第二列数据-额外工作日 for(int rowIndex = 1;rowIndex <rows;rowIndex++){ Cell cell = sheet.getCell(1, rowIndex); if(cell==null){ break; } if(cell.getType() == CellType.DATE){ DateCell dateCell = (DateCell)cell; Date date = dateCell.getDate(); String dateStr = sdf.format(date); workdays.add(dateStr); } } logger.info(holidays.toString()); logger.info(workdays.toString()); } catch (BiffException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if(workbook!=null){ workbook.close(); workbook = null; } } } public static void main(String[] args) { HolidayUtil h = new HolidayUtil(); String path = FileUtils.class.getResource("/").getPath() + "com/geex/file/HolidayUtil2.xls"; h.parseExcel(path); System.out.println(111111111); } }
UTF-8
Java
5,113
java
HolidayUtil.java
Java
[ { "context": "\n\n\n/**\n * 根据读取配置的excel判断是否为法定节假日,及法定工作日\n * @author Administrator\n *\n */\npublic class HolidayUtil {\n\n private Si", "end": 513, "score": 0.5176519155502319, "start": 500, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package com.dscexpen.date; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import com.dscexpen.tools.FileUtils; import org.apache.log4j.Logger; import jxl.Cell; import jxl.CellType; import jxl.DateCell; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; /** * 根据读取配置的excel判断是否为法定节假日,及法定工作日 * @author Administrator * */ public class HolidayUtil { private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); private List<String> holidays = new ArrayList<String>(); private List<String> workdays = new ArrayList<String>(); private Date now = new Date(); private Logger logger = Logger.getLogger(HolidayUtil.class); /** * 判断当天是否是工作日 (工作日:true;节假日:false) * @param filePath * @return */ public boolean isWorkDay(String filePath){ boolean flag = true; parseExcel(filePath);//读取excel中的节假日和工作日 int dateType = getDateType(); //如果excel不存在当前日期。判断是否周六日 if(dateType==0){ Calendar c = Calendar.getInstance(); if(c.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY|| c.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY){ flag = false; } }else{//如果存在当前日期,根据返回的类型判断 if(dateType==1){//节假日 flag = false; } /* else if(dateType==2){//工作日 flag = true; }*/ } logger.info("当前日期是:"+(flag==true?"工作日":"节假日")); return flag; } /** * 根据判断当前时间是否是节假日还是工作日 (excel中不存在当前日期:0;节假日:1;工作日:2) * 如果当前日期在excel中的节假日和工作日都写了,默认的工作日 * @return */ private int getDateType(){ int type = 0; String today = sdf.format(now); if(holidays.size()>0){ for(String holiday:holidays){ if(holiday.equals(today)){ type = 1; break; } } } if(workdays.size()>0){ for(String workday:workdays){ if(workday.equals(today)){ type = 2; } } } return type; } /** * 读取excel中的节假日和工作日 * @param filePath */ private void parseExcel(String filePath){ if(filePath==null||"".equals(filePath)){ return ; } Workbook workbook = null; try { File file =new File(filePath); if(!file.exists()){ System.out.println("文件不存在"); } workbook = Workbook.getWorkbook(new FileInputStream(filePath)); Sheet sheets[] = workbook.getSheets(); if(sheets==null||sheets.length==0){ return; } Sheet sheet = sheets[0];//取到第一个sheet int rows = sheet.getRows(); //获取第一列数据-节假日 for(int rowIndex = 1;rowIndex <rows;rowIndex++){ Cell cell = sheet.getCell(0, rowIndex); if(cell==null){ break; } if(cell.getType() == CellType.DATE){ DateCell dateCell = (DateCell)cell; Date date = dateCell.getDate(); String dateStr = sdf.format(date); holidays.add(dateStr); } } //获取第二列数据-额外工作日 for(int rowIndex = 1;rowIndex <rows;rowIndex++){ Cell cell = sheet.getCell(1, rowIndex); if(cell==null){ break; } if(cell.getType() == CellType.DATE){ DateCell dateCell = (DateCell)cell; Date date = dateCell.getDate(); String dateStr = sdf.format(date); workdays.add(dateStr); } } logger.info(holidays.toString()); logger.info(workdays.toString()); } catch (BiffException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if(workbook!=null){ workbook.close(); workbook = null; } } } public static void main(String[] args) { HolidayUtil h = new HolidayUtil(); String path = FileUtils.class.getResource("/").getPath() + "com/geex/file/HolidayUtil2.xls"; h.parseExcel(path); System.out.println(111111111); } }
5,113
0.512914
0.506937
181
24.889503
19.797565
100
false
false
0
0
0
0
0
0
0.441989
false
false
3
7cbe56c2dfad6f5036220ede2bbaf2590a8dbfae
32,530,082,340,014
83eedf0c7377c58449e2e94914a5f343501a9bf0
/app/src/main/java/top/elune/demo/requestservice/v1/interfaces/IRequestService.java
794f88d57cfd14e35fe0246a7d651e362c029676
[]
no_license
OCTSJimmy/RequestService
https://github.com/OCTSJimmy/RequestService
d6f34a9b4f7dd38cc9be87c6e5ba823adc3802a6
c0f2d22e812979dfb2af37dfd4179e7b1f6e5b6c
refs/heads/master
2021-01-19T06:47:09.492000
2017-04-07T04:51:23
2017-04-07T04:51:23
86,704,462
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package top.elune.demo.requestservice.v1.interfaces; import java.io.IOException; import java.util.List; import top.elune.demo.requestservice.v1.pojo.RequestArgs; public interface IRequestService { /** * 请求核心代码 * * @param args * 请求参数列表 * @return 请求结果 */ String request(RequestArgs args) throws IOException; /** * 提供该类支持的请求方式 * * @return 所支持的请求方式 */ List<String> getSupportMethods(); /** * @return 取得优先级, * 返回值的绝对值越小, * 则优先级越高,从1开始计算 * 0将作为保留数,为0,则表示放弃优先级 * (即优先级最低) * 相同优先级,将先按类名ASCII升序排序 * 再按hashcode()升序排序, * 最后按系统原始hashcode升序排序 * <p> * 优先级较高的类对象,将优先参与解析 * 当该类对象支持的请求方式存在, * 与即将开始的请求中, * 参数表配置的请求方式一致的设定, * 即进入请求解析流程,这将导致 * 优先级较低的类对象,将会被忽略 * 不论请求成功与否,都不再参与解析 * <p> * 当该类不存在匹配的请求方式, * 则取较低且最临近的对象展开新一轮匹配 */ int getPriority(); }
UTF-8
Java
1,423
java
IRequestService.java
Java
[]
null
[]
package top.elune.demo.requestservice.v1.interfaces; import java.io.IOException; import java.util.List; import top.elune.demo.requestservice.v1.pojo.RequestArgs; public interface IRequestService { /** * 请求核心代码 * * @param args * 请求参数列表 * @return 请求结果 */ String request(RequestArgs args) throws IOException; /** * 提供该类支持的请求方式 * * @return 所支持的请求方式 */ List<String> getSupportMethods(); /** * @return 取得优先级, * 返回值的绝对值越小, * 则优先级越高,从1开始计算 * 0将作为保留数,为0,则表示放弃优先级 * (即优先级最低) * 相同优先级,将先按类名ASCII升序排序 * 再按hashcode()升序排序, * 最后按系统原始hashcode升序排序 * <p> * 优先级较高的类对象,将优先参与解析 * 当该类对象支持的请求方式存在, * 与即将开始的请求中, * 参数表配置的请求方式一致的设定, * 即进入请求解析流程,这将导致 * 优先级较低的类对象,将会被忽略 * 不论请求成功与否,都不再参与解析 * <p> * 当该类不存在匹配的请求方式, * 则取较低且最临近的对象展开新一轮匹配 */ int getPriority(); }
1,423
0.593443
0.587978
47
18.468084
13.373284
57
false
false
0
0
0
0
0
0
0.148936
false
false
3
8ca083fba681108a6eb9db6f8cbb42d69c7acd78
3,582,002,736,742
20b563707f4c10f53c26e8ec1671845f01a4719d
/factory-pattern/src/main/java/com/wen/factory/method/ArrayListFactory.java
4258367a1606c7ec903c9d7459564d37887f9da8
[]
no_license
huwenwen/design-pattern
https://github.com/huwenwen/design-pattern
4dedd7e01ca4924d50306e1b9a7778118a6c17d8
efb1cb5bd5905673e9c797e245c88cd23f0e0e67
refs/heads/master
2021-08-15T22:31:27.471000
2017-11-18T12:01:18
2017-11-18T12:01:18
110,682,066
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wen.factory.method; import java.util.ArrayList; import java.util.List; /** * @author huwenwen * @since 18/11/2017 */ public class ArrayListFactory extends AbstractFactory { public List getList() { return new ArrayList(); } }
UTF-8
Java
258
java
ArrayListFactory.java
Java
[ { "context": ".ArrayList;\nimport java.util.List;\n\n/**\n * @author huwenwen\n * @since 18/11/2017\n */\npublic class ArrayListFa", "end": 108, "score": 0.9995234608650208, "start": 100, "tag": "USERNAME", "value": "huwenwen" } ]
null
[]
package com.wen.factory.method; import java.util.ArrayList; import java.util.List; /** * @author huwenwen * @since 18/11/2017 */ public class ArrayListFactory extends AbstractFactory { public List getList() { return new ArrayList(); } }
258
0.689922
0.658915
14
17.428572
15.678531
55
false
false
0
0
0
0
0
0
0.285714
false
false
3
912e70edf7bb9a1619b654952f08d6071e50d47c
1,906,965,486,771
d9a2b20899fe6bb3593cf7b3f647ceacfa512c3f
/app/src/main/java/com/example/mathe/gerenciadorpartes/Controller/Banco.java
b11c14f5fa75aea2b235a80efdb264401f442d98
[]
no_license
mofreitas/GerenciadorPartes
https://github.com/mofreitas/GerenciadorPartes
20d9b972aec6b14a14a52d63dcaa995771abbd45
e528f720cdbe7ff01e68114ac4dd379f1e6c8c33
refs/heads/master
2020-03-16T17:16:06.336000
2018-05-10T02:47:43
2018-05-10T02:47:43
132,821,178
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.mathe.gerenciadorpartes.Controller; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import java.util.ArrayList; import com.example.mathe.gerenciadorpartes.Model.Ponto; import com.example.mathe.gerenciadorpartes.Model.Publicador; /** * Created by mathe on 17/12/2017. */ public class Banco{ private SQLiteDatabase db; private CriaBanco banco; public Banco(Context contexto) { banco = new CriaBanco(contexto); } public Cursor partesPendentes(){ Cursor dados = null; db=banco.getReadableDatabase(); try { //A rawquery é usado quando queremos uma queery personalizada (inner joins, etc) //A consulta abaixo obtem: // pontos_publicadores.id, nome do publicador, ponto, nome do ajudante, data de conclusão, tipo da parte (leitura, ...), nome do ponto e se ele foi notificado //se pontos_publicadores.passou for nulo, o que indica que a parte ainda não foi feita, ordenando em ordem decrescente //pela data de conclusão da parte //Para fazer dois inner join com a mesma tabela, precisamos dar nomes diferentes para cada inner join dados = db.rawQuery("SELECT ppub._id, public.nome as publicador, ppub.ponto_id, ajuda.nome as ajudante, ppub.data_conc, ppub.tipo_parte, pontos.nome, ppub.notificado " + "from pontos_publicadores as ppub " + "left join publicadores as public on " + "public._id = ppub.public_id " + "left join publicadores as ajuda on " + "ajuda._id = ppub.comp_id " + "inner join pontos on " + "pontos._id = ppub.ponto_id " + "where ppub.passou is null " + "ORDER BY ppub.data_conc DESC", null); if (dados != null) { dados.moveToFirst(); } } finally { return dados; //dados.close() db.close() não são chamados pois o cursor apenas está disponível enquanto o banco de dados //e o cursor estão abertos } } public Cursor obterPublicadores(){ Cursor consulta = null; try{ db = banco.getReadableDatabase(); //Consulta na tabela publicadores os que forem ativos (ativo = 1) //Para cada variável do selection, colocamos "?". Eles serão subtituidos em ordem pelos //valores contidos no vetor "selectionArgs" consulta = db.query("publicadores", null, "ativo = ?", new String[] {"1"}, null, null, null); if(consulta != null){ //Tem que ser chamado para mover o ponteiro para a primeira linha da consulta consulta.moveToFirst(); } } finally { return consulta; } } public Cursor obterSugeridos(){ Cursor consulta = null; db = banco.getReadableDatabase(); try { //https://stackoverflow.com/questions/19432913/select-info-from-table-where-row-has-max-date //Nesta consulta, fazemos uso de Derived table (inner join com uma tabela personalizada) e subquery (query feita dentro do select). //Nesta consulta, queremos obter a última parte feita pelo publicador, bem como suas informações. // publicador.id, o nome do publicador, o número de partes (incluindo as que ele fará), a maior data de conclusão, o sexo e // o ponto sugerido em sua ultima parte //Para isso, a primeira Derived table "pub_info" obtem da tabela pontos_publicadores os dados abaixo agrupados pelo public.id: // public_id, data de conclusão máxima e a contagem de partes //Já em psug, obtemos os pontos sugeridos de cada ponto_publicador //Por fim, com a tabela pub tem prioridade, para cada publicador, são buscadas as informações nas derived tables se o //publicador for ativo. consulta = db.rawQuery("select pub._id, pub.nome, pub_info.npartes, pub_info.datamax, pub.sexo, psug.ponto_sugerido " + " from publicadores as pub " + " left join (select ppub.public_id, max(ppub.data_conc) as datamax, count(ppub.public_id) as npartes " + " from pontos_publicadores as ppub " + " where ppub.ponto_id != 0 " + " group by ppub.public_id) as pub_info on " + " pub._id = pub_info.public_id " + " left join (select ppub._id, ppub.ponto_sugerido " + " from pontos_publicadores as ppub) as psug on " + " psug._id = pub._id " + " where pub.ativo = 1 " + " order by pub_info.datamax asc", null); if (consulta != null) { consulta.moveToFirst(); } } finally { return consulta; } } public void InserirPublicador(ContentValues valores){ try { db = banco.getWritableDatabase(); db.insert("publicadores", null, valores); } finally { if(db.isOpen()) { db.close(); } } } public void InserirPartes(ContentValues valores){ try { db = banco.getWritableDatabase(); db.insert("pontos_publicadores", null, valores); } finally { if(db.isOpen()) { db.close(); } } } public Cursor obterHistorico(String arg, int tipo){ Cursor consulta = null; try { db = banco.getReadableDatabase(); //Nas consultas abaixo, obtemos: // id do publicador, nome do publicador, nome do ajudante, ponto, data de conclusão da parte, // tipo da parte, se passou ou não e o ponto sugerido para a próxima parte. //quando passou != null (indicando que a parte ainda não foi finalizada), divergindo, em cada caso, //na seleção dos dados, de forma que: switch(tipo) { case 2: //Consulta data ou nome publicador //Neste caso, quando o nome do publicador ou a data de conclusão contem "arg" consulta = db.rawQuery("SELECT public._id, public.nome, comp.nome, ppub.ponto_id, ppub.data_conc, ppub.tipo_parte, ppub.passou, ppub.ponto_sugerido " + "from pontos_publicadores as ppub " + "left join publicadores as public on " + "public._id = ppub.public_id " + "left join publicadores as comp on " + "comp._id = ppub.comp_id " + "WHERE (public.nome like ? or ppub.data_conc like ?) and (ppub.passou is not null) " + "ORDER BY ppub.data_conc DESC", new String[]{"%"+arg+"%", "%"+arg+"%"}); break; case 3: //Consulta publicador id //Neste caso, quando o id do publicador = arg consulta = db.rawQuery("SELECT public._id, public.nome, comp.nome, ppub.ponto_id, ppub.data_conc, ppub.tipo_parte, ppub.passou, ppub.ponto_sugerido " + "from pontos_publicadores as ppub " + "left join publicadores as public on " + "public._id = ppub.public_id " + "left join publicadores as comp on " + "comp._id = ppub.comp_id " + "WHERE ppub.public_id = ? and ppub.passou is not null " + "ORDER BY ppub.data_conc DESC", new String[]{arg}); break; default: //Consulta padrão //Neste caso, todos os registros são retornados consulta = db.rawQuery("SELECT public._id, public.nome, comp.nome, ppub.ponto_id, ppub.data_conc, ppub.tipo_parte, ppub.passou, ppub.ponto_sugerido " + "from pontos_publicadores as ppub " + "left join publicadores as public on " + "public._id = ppub.public_id " + "left join publicadores as comp on " + "comp._id = ppub.comp_id " + "where ppub.passou IS NOT NULL " + "ORDER BY ppub.data_conc DESC", null); break; } if(consulta != null){ consulta.moveToFirst(); } } finally { return consulta; //dados.close() db.close() não são chamados pois o cursor apenas está disponível enquanto o banco de dados //e o cursor estão abertos } } public void closeBanco(){ db.close(); } public ArrayList<Ponto> obterPontos(){ Cursor consulta = null; ArrayList<Ponto> pontos = new ArrayList<>(); try{ db = banco.getReadableDatabase(); consulta = db.query("pontos", null, null, null, null, null, null); consulta.moveToFirst(); //O método [nome do cursor].get[Int, String, ...](x) obtém aquela variável do tipo especificado na linha em que //o cursor está apontando na coluna de índice x, começando do 0 while(!consulta.isAfterLast()){ pontos.add(new Ponto(consulta.getInt(0), consulta.getString(1), consulta.getInt(2))); //move o ponteiro para a próxima linha consulta.moveToNext(); } consulta.close();; } finally { if(db.isOpen()){ db.close(); } return pontos; } } public void removerParte(int id){ try { db = banco.getWritableDatabase(); db.delete("pontos_publicadores", "_id = ?", new String[]{String.valueOf(id)}); } finally { if(db.isOpen()){ db.close(); } } } //todo verificar se "pontosugerido" retorna um int/verificar o que é colocado no contentvalues no metodo concluir parte (testar por debug) public void concluirParte(ContentValues valores, String id){ try { //Se ponto sugerido for 0, consideramos que esse valor não foi informado pelo usuário, portanto ele é removido //do contentvalues "valores" para que no banco assuma o valor NULL if(valores.get("ponto_sugerido").equals(0)) { valores.remove("ponto_sugerido"); } db = banco.getWritableDatabase(); db.update("pontos_publicadores", valores, "_id = ?", new String[]{id}); } finally { if(db.isOpen()){ db.close(); } } } public void substituirParte(ContentValues valores, String id){ try { db = banco.getWritableDatabase(); db.update("pontos_publicadores", valores, "_id = ?", new String[]{id}); } finally { if(db.isOpen()){ db.close(); } } } //Desativamos um publicador por tornar ativo = 0 //Além disso, deletamos as partes pendentes do publicador a ser desativado (passou = null) public void desativarPublicador(String arg){ ContentValues valores = new ContentValues(); valores.put("ativo", 0); try{ db = banco.getWritableDatabase(); db.update("publicadores", valores, "_id = ?", new String[]{arg}); db.delete("pontos_publicadores", "public_id = ? and passou is null", new String[]{arg}); } finally { if(db.isOpen()){ db.close(); } } } public void setNotificado(String arg){ ContentValues valores = new ContentValues(); valores.put("notificado", 1); try{ db = banco.getWritableDatabase(); db.update("pontos_publicadores", valores, "_id = ?", new String[]{arg}); } finally { if(db.isOpen()){ db.close(); } } } }
UTF-8
Java
12,913
java
Banco.java
Java
[ { "context": "nciadorpartes.Model.Publicador;\n\n/**\n * Created by mathe on 17/12/2017.\n */\n\npublic class Banco{\n\n priv", "end": 425, "score": 0.9993774890899658, "start": 420, "tag": "USERNAME", "value": "mathe" } ]
null
[]
package com.example.mathe.gerenciadorpartes.Controller; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import java.util.ArrayList; import com.example.mathe.gerenciadorpartes.Model.Ponto; import com.example.mathe.gerenciadorpartes.Model.Publicador; /** * Created by mathe on 17/12/2017. */ public class Banco{ private SQLiteDatabase db; private CriaBanco banco; public Banco(Context contexto) { banco = new CriaBanco(contexto); } public Cursor partesPendentes(){ Cursor dados = null; db=banco.getReadableDatabase(); try { //A rawquery é usado quando queremos uma queery personalizada (inner joins, etc) //A consulta abaixo obtem: // pontos_publicadores.id, nome do publicador, ponto, nome do ajudante, data de conclusão, tipo da parte (leitura, ...), nome do ponto e se ele foi notificado //se pontos_publicadores.passou for nulo, o que indica que a parte ainda não foi feita, ordenando em ordem decrescente //pela data de conclusão da parte //Para fazer dois inner join com a mesma tabela, precisamos dar nomes diferentes para cada inner join dados = db.rawQuery("SELECT ppub._id, public.nome as publicador, ppub.ponto_id, ajuda.nome as ajudante, ppub.data_conc, ppub.tipo_parte, pontos.nome, ppub.notificado " + "from pontos_publicadores as ppub " + "left join publicadores as public on " + "public._id = ppub.public_id " + "left join publicadores as ajuda on " + "ajuda._id = ppub.comp_id " + "inner join pontos on " + "pontos._id = ppub.ponto_id " + "where ppub.passou is null " + "ORDER BY ppub.data_conc DESC", null); if (dados != null) { dados.moveToFirst(); } } finally { return dados; //dados.close() db.close() não são chamados pois o cursor apenas está disponível enquanto o banco de dados //e o cursor estão abertos } } public Cursor obterPublicadores(){ Cursor consulta = null; try{ db = banco.getReadableDatabase(); //Consulta na tabela publicadores os que forem ativos (ativo = 1) //Para cada variável do selection, colocamos "?". Eles serão subtituidos em ordem pelos //valores contidos no vetor "selectionArgs" consulta = db.query("publicadores", null, "ativo = ?", new String[] {"1"}, null, null, null); if(consulta != null){ //Tem que ser chamado para mover o ponteiro para a primeira linha da consulta consulta.moveToFirst(); } } finally { return consulta; } } public Cursor obterSugeridos(){ Cursor consulta = null; db = banco.getReadableDatabase(); try { //https://stackoverflow.com/questions/19432913/select-info-from-table-where-row-has-max-date //Nesta consulta, fazemos uso de Derived table (inner join com uma tabela personalizada) e subquery (query feita dentro do select). //Nesta consulta, queremos obter a última parte feita pelo publicador, bem como suas informações. // publicador.id, o nome do publicador, o número de partes (incluindo as que ele fará), a maior data de conclusão, o sexo e // o ponto sugerido em sua ultima parte //Para isso, a primeira Derived table "pub_info" obtem da tabela pontos_publicadores os dados abaixo agrupados pelo public.id: // public_id, data de conclusão máxima e a contagem de partes //Já em psug, obtemos os pontos sugeridos de cada ponto_publicador //Por fim, com a tabela pub tem prioridade, para cada publicador, são buscadas as informações nas derived tables se o //publicador for ativo. consulta = db.rawQuery("select pub._id, pub.nome, pub_info.npartes, pub_info.datamax, pub.sexo, psug.ponto_sugerido " + " from publicadores as pub " + " left join (select ppub.public_id, max(ppub.data_conc) as datamax, count(ppub.public_id) as npartes " + " from pontos_publicadores as ppub " + " where ppub.ponto_id != 0 " + " group by ppub.public_id) as pub_info on " + " pub._id = pub_info.public_id " + " left join (select ppub._id, ppub.ponto_sugerido " + " from pontos_publicadores as ppub) as psug on " + " psug._id = pub._id " + " where pub.ativo = 1 " + " order by pub_info.datamax asc", null); if (consulta != null) { consulta.moveToFirst(); } } finally { return consulta; } } public void InserirPublicador(ContentValues valores){ try { db = banco.getWritableDatabase(); db.insert("publicadores", null, valores); } finally { if(db.isOpen()) { db.close(); } } } public void InserirPartes(ContentValues valores){ try { db = banco.getWritableDatabase(); db.insert("pontos_publicadores", null, valores); } finally { if(db.isOpen()) { db.close(); } } } public Cursor obterHistorico(String arg, int tipo){ Cursor consulta = null; try { db = banco.getReadableDatabase(); //Nas consultas abaixo, obtemos: // id do publicador, nome do publicador, nome do ajudante, ponto, data de conclusão da parte, // tipo da parte, se passou ou não e o ponto sugerido para a próxima parte. //quando passou != null (indicando que a parte ainda não foi finalizada), divergindo, em cada caso, //na seleção dos dados, de forma que: switch(tipo) { case 2: //Consulta data ou nome publicador //Neste caso, quando o nome do publicador ou a data de conclusão contem "arg" consulta = db.rawQuery("SELECT public._id, public.nome, comp.nome, ppub.ponto_id, ppub.data_conc, ppub.tipo_parte, ppub.passou, ppub.ponto_sugerido " + "from pontos_publicadores as ppub " + "left join publicadores as public on " + "public._id = ppub.public_id " + "left join publicadores as comp on " + "comp._id = ppub.comp_id " + "WHERE (public.nome like ? or ppub.data_conc like ?) and (ppub.passou is not null) " + "ORDER BY ppub.data_conc DESC", new String[]{"%"+arg+"%", "%"+arg+"%"}); break; case 3: //Consulta publicador id //Neste caso, quando o id do publicador = arg consulta = db.rawQuery("SELECT public._id, public.nome, comp.nome, ppub.ponto_id, ppub.data_conc, ppub.tipo_parte, ppub.passou, ppub.ponto_sugerido " + "from pontos_publicadores as ppub " + "left join publicadores as public on " + "public._id = ppub.public_id " + "left join publicadores as comp on " + "comp._id = ppub.comp_id " + "WHERE ppub.public_id = ? and ppub.passou is not null " + "ORDER BY ppub.data_conc DESC", new String[]{arg}); break; default: //Consulta padrão //Neste caso, todos os registros são retornados consulta = db.rawQuery("SELECT public._id, public.nome, comp.nome, ppub.ponto_id, ppub.data_conc, ppub.tipo_parte, ppub.passou, ppub.ponto_sugerido " + "from pontos_publicadores as ppub " + "left join publicadores as public on " + "public._id = ppub.public_id " + "left join publicadores as comp on " + "comp._id = ppub.comp_id " + "where ppub.passou IS NOT NULL " + "ORDER BY ppub.data_conc DESC", null); break; } if(consulta != null){ consulta.moveToFirst(); } } finally { return consulta; //dados.close() db.close() não são chamados pois o cursor apenas está disponível enquanto o banco de dados //e o cursor estão abertos } } public void closeBanco(){ db.close(); } public ArrayList<Ponto> obterPontos(){ Cursor consulta = null; ArrayList<Ponto> pontos = new ArrayList<>(); try{ db = banco.getReadableDatabase(); consulta = db.query("pontos", null, null, null, null, null, null); consulta.moveToFirst(); //O método [nome do cursor].get[Int, String, ...](x) obtém aquela variável do tipo especificado na linha em que //o cursor está apontando na coluna de índice x, começando do 0 while(!consulta.isAfterLast()){ pontos.add(new Ponto(consulta.getInt(0), consulta.getString(1), consulta.getInt(2))); //move o ponteiro para a próxima linha consulta.moveToNext(); } consulta.close();; } finally { if(db.isOpen()){ db.close(); } return pontos; } } public void removerParte(int id){ try { db = banco.getWritableDatabase(); db.delete("pontos_publicadores", "_id = ?", new String[]{String.valueOf(id)}); } finally { if(db.isOpen()){ db.close(); } } } //todo verificar se "pontosugerido" retorna um int/verificar o que é colocado no contentvalues no metodo concluir parte (testar por debug) public void concluirParte(ContentValues valores, String id){ try { //Se ponto sugerido for 0, consideramos que esse valor não foi informado pelo usuário, portanto ele é removido //do contentvalues "valores" para que no banco assuma o valor NULL if(valores.get("ponto_sugerido").equals(0)) { valores.remove("ponto_sugerido"); } db = banco.getWritableDatabase(); db.update("pontos_publicadores", valores, "_id = ?", new String[]{id}); } finally { if(db.isOpen()){ db.close(); } } } public void substituirParte(ContentValues valores, String id){ try { db = banco.getWritableDatabase(); db.update("pontos_publicadores", valores, "_id = ?", new String[]{id}); } finally { if(db.isOpen()){ db.close(); } } } //Desativamos um publicador por tornar ativo = 0 //Além disso, deletamos as partes pendentes do publicador a ser desativado (passou = null) public void desativarPublicador(String arg){ ContentValues valores = new ContentValues(); valores.put("ativo", 0); try{ db = banco.getWritableDatabase(); db.update("publicadores", valores, "_id = ?", new String[]{arg}); db.delete("pontos_publicadores", "public_id = ? and passou is null", new String[]{arg}); } finally { if(db.isOpen()){ db.close(); } } } public void setNotificado(String arg){ ContentValues valores = new ContentValues(); valores.put("notificado", 1); try{ db = banco.getWritableDatabase(); db.update("pontos_publicadores", valores, "_id = ?", new String[]{arg}); } finally { if(db.isOpen()){ db.close(); } } } }
12,913
0.528296
0.525886
297
42.316498
38.125889
181
false
false
0
0
0
0
0
0
0.680135
false
false
3
e7b28d069eaeb2b4339a9dcbf62a5faf2c50037f
16,655,883,182,869
942b007e3ad820f48cd69e4e27a252f716435e9d
/src/Dao/ListTranIDDAO.java
98540195850f3bceb4a5efd1dcc9a69a7aa0857f
[]
no_license
Ausadamos/Project_JAVA_SecurityMatrix
https://github.com/Ausadamos/Project_JAVA_SecurityMatrix
bf134736183089ace1745e937cd1b52bea5dacd6
3fff8cd1e19790bf1ae466e6b54d5416fc97484e
refs/heads/master
2021-04-09T16:14:10.470000
2018-03-18T18:57:08
2018-03-18T18:57:08
125,757,397
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import Bean.ListTranIDBean; import Connect.ConnectionManager; public class ListTranIDDAO { static Connection Con = null; static ResultSet rs = null; public ArrayList<ListTranIDBean> ListTranID() { PreparedStatement pstmt = null; ArrayList<ListTranIDBean> Ab = new ArrayList<ListTranIDBean>(); String sql = " SELECT * FROM `tranid`ORDER BY tranid.Code;"; try { Con = ConnectionManager.getConnection(); pstmt = Con.prepareStatement(sql); rs = pstmt.executeQuery(); while (rs.next()) { ListTranIDBean tranID = new ListTranIDBean(); tranID.setIdTranID(rs.getInt("IdTranID")); tranID.setCode(rs.getString("Code")); tranID.setDetail(rs.getString("Detail")); Ab.add(tranID); } pstmt.close(); Con.close(); rs.close(); } catch (Exception e) { e.printStackTrace(); } return Ab; } public ArrayList<ListTranIDBean> ListTranIDShowData(int IdUser) { PreparedStatement pstmt = null; ArrayList<ListTranIDBean> Ab = new ArrayList<ListTranIDBean>(); String sql = " SELECT `Id_TranID`, tranid.Code , module.NameModule FROM `users_tranid`,tranid,module WHERE users_tranid.Id_TranID = tranid.IdTranID AND tranid.IdModule = module.IdModule AND users_tranid.Id_User = ? "; try { Con = ConnectionManager.getConnection(); pstmt = Con.prepareStatement(sql); pstmt.setInt(1,IdUser); rs = pstmt.executeQuery(); while (rs.next()) { ListTranIDBean tranID = new ListTranIDBean(); tranID.setIdTranID(rs.getInt("Id_TranID")); tranID.setCode(rs.getString("Code")); tranID.setNameModule(rs.getString("NameModule")); Ab.add(tranID); } pstmt.close(); Con.close(); rs.close(); } catch (Exception e) { e.printStackTrace(); } return Ab; } public ArrayList<ListTranIDBean> ListTranIDInquiry(int[] TranID2,int IdUser) { PreparedStatement pstmt = null; ArrayList<ListTranIDBean> Ab = new ArrayList<ListTranIDBean>(); String sql = " SELECT `Id_TranID`, tranid.Code , module.NameModule FROM `users_tranid`,tranid,module WHERE users_tranid.Id_TranID = tranid.IdTranID AND tranid.IdModule = module.IdModule AND users_tranid.Id_User = ? AND tranid.IdModule = ? "; try { System.out.print("ÁÒ˹éÒDaoáÅéÇ"); Con = ConnectionManager.getConnection(); ListTranIDBean tranID = null; int i = 0; while(i < TranID2.length){ pstmt = Con.prepareStatement(sql); pstmt.setInt(1,IdUser); pstmt.setInt(2,TranID2[i]); rs = pstmt.executeQuery(); while(rs.next()) { tranID = new ListTranIDBean(); tranID.setIdTranID(rs.getInt("Id_TranID")); tranID.setCode(rs.getString("Code")); tranID.setNameModule(rs.getString("NameModule")); Ab.add(tranID); } i++; } pstmt.close(); Con.close(); rs.close(); } catch (Exception e) { e.printStackTrace(); } return Ab; } }
WINDOWS-1252
Java
3,073
java
ListTranIDDAO.java
Java
[]
null
[]
package Dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import Bean.ListTranIDBean; import Connect.ConnectionManager; public class ListTranIDDAO { static Connection Con = null; static ResultSet rs = null; public ArrayList<ListTranIDBean> ListTranID() { PreparedStatement pstmt = null; ArrayList<ListTranIDBean> Ab = new ArrayList<ListTranIDBean>(); String sql = " SELECT * FROM `tranid`ORDER BY tranid.Code;"; try { Con = ConnectionManager.getConnection(); pstmt = Con.prepareStatement(sql); rs = pstmt.executeQuery(); while (rs.next()) { ListTranIDBean tranID = new ListTranIDBean(); tranID.setIdTranID(rs.getInt("IdTranID")); tranID.setCode(rs.getString("Code")); tranID.setDetail(rs.getString("Detail")); Ab.add(tranID); } pstmt.close(); Con.close(); rs.close(); } catch (Exception e) { e.printStackTrace(); } return Ab; } public ArrayList<ListTranIDBean> ListTranIDShowData(int IdUser) { PreparedStatement pstmt = null; ArrayList<ListTranIDBean> Ab = new ArrayList<ListTranIDBean>(); String sql = " SELECT `Id_TranID`, tranid.Code , module.NameModule FROM `users_tranid`,tranid,module WHERE users_tranid.Id_TranID = tranid.IdTranID AND tranid.IdModule = module.IdModule AND users_tranid.Id_User = ? "; try { Con = ConnectionManager.getConnection(); pstmt = Con.prepareStatement(sql); pstmt.setInt(1,IdUser); rs = pstmt.executeQuery(); while (rs.next()) { ListTranIDBean tranID = new ListTranIDBean(); tranID.setIdTranID(rs.getInt("Id_TranID")); tranID.setCode(rs.getString("Code")); tranID.setNameModule(rs.getString("NameModule")); Ab.add(tranID); } pstmt.close(); Con.close(); rs.close(); } catch (Exception e) { e.printStackTrace(); } return Ab; } public ArrayList<ListTranIDBean> ListTranIDInquiry(int[] TranID2,int IdUser) { PreparedStatement pstmt = null; ArrayList<ListTranIDBean> Ab = new ArrayList<ListTranIDBean>(); String sql = " SELECT `Id_TranID`, tranid.Code , module.NameModule FROM `users_tranid`,tranid,module WHERE users_tranid.Id_TranID = tranid.IdTranID AND tranid.IdModule = module.IdModule AND users_tranid.Id_User = ? AND tranid.IdModule = ? "; try { System.out.print("ÁÒ˹éÒDaoáÅéÇ"); Con = ConnectionManager.getConnection(); ListTranIDBean tranID = null; int i = 0; while(i < TranID2.length){ pstmt = Con.prepareStatement(sql); pstmt.setInt(1,IdUser); pstmt.setInt(2,TranID2[i]); rs = pstmt.executeQuery(); while(rs.next()) { tranID = new ListTranIDBean(); tranID.setIdTranID(rs.getInt("Id_TranID")); tranID.setCode(rs.getString("Code")); tranID.setNameModule(rs.getString("NameModule")); Ab.add(tranID); } i++; } pstmt.close(); Con.close(); rs.close(); } catch (Exception e) { e.printStackTrace(); } return Ab; } }
3,073
0.665361
0.662749
162
17.907408
29.889675
242
false
false
0
0
0
0
0
0
1.932099
false
false
3
c786f37bb28cd062fcf4858e4b9c64f6a09ab5f3
16,784,732,201,125
fcc882ccb65e213b1fc07c754672fb126a923ed5
/test/com/giaolang/mathutil/core/DataDrivenMathUtilTest.java
f47e30100005bd7e15e56bce264d82979b29ef60
[]
no_license
ManhPhanDuc/mathutilant-testing
https://github.com/ManhPhanDuc/mathutilant-testing
b7d87a7db466b9aabc481d302e92e09f99dae74b
66cb7d2ab0179c654894e22d9f331cb41d211291
refs/heads/main
2023-08-13T23:39:05.717000
2021-10-01T03:29:14
2021-10-01T03:29:14
null
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 com.giaolang.mathutil.core; import org.junit.*; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; /** * * @author Admin */ @RunWith(value=Parameterized.class) public class DataDrivenMathUtilTest { @Parameter(value=0) public int intput;//ung voi cot 0 @Parameter(value =1) public long expected;//ung voi cot 1 @Test //no se tu loop qua cac ham unit o duoi public void checkFactorialGivenCorrectArgumentReturnsWell() { assertEquals(expected,MathUtil.getFactorial(intput)); } @Parameterized.Parameters public static Object[][] initData() { //int a[]={1,1,2,3,4,5,8,13,21};//mang 8 phan tu //mang 8 bien int co san value return new Integer[][] { {0,1}, {1,1}, {3,6}, {5,120}, {7,5040}, };//dang chuan bi bo data //sau dua dua cho ham getfacotrial() //assert equal(1,?) //date driven testing } }
UTF-8
Java
1,414
java
DataDrivenMathUtilTest.java
Java
[ { "context": "unners.Parameterized.Parameter;\n\n/**\n *\n * @author Admin\n */\n@RunWith(value=Parameterized.class)\npublic cl", "end": 457, "score": 0.9119807481765747, "start": 452, "tag": "USERNAME", "value": "Admin" } ]
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 com.giaolang.mathutil.core; import org.junit.*; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; /** * * @author Admin */ @RunWith(value=Parameterized.class) public class DataDrivenMathUtilTest { @Parameter(value=0) public int intput;//ung voi cot 0 @Parameter(value =1) public long expected;//ung voi cot 1 @Test //no se tu loop qua cac ham unit o duoi public void checkFactorialGivenCorrectArgumentReturnsWell() { assertEquals(expected,MathUtil.getFactorial(intput)); } @Parameterized.Parameters public static Object[][] initData() { //int a[]={1,1,2,3,4,5,8,13,21};//mang 8 phan tu //mang 8 bien int co san value return new Integer[][] { {0,1}, {1,1}, {3,6}, {5,120}, {7,5040}, };//dang chuan bi bo data //sau dua dua cho ham getfacotrial() //assert equal(1,?) //date driven testing } }
1,414
0.588402
0.565064
49
27.857143
20.105843
79
false
false
0
0
0
0
0
0
0.714286
false
false
3
c8733ec3b0a8a62c6cf411d3203c6de69c8aae26
32,908,039,430,417
b96100b84ce1516350808488eb08dfe7149e7704
/src/main/java/org/telegram/client/pojo/ChannelChat.java
cfd48ad99647e0ef1d6a1d320a0d0a93256cc284
[]
no_license
sangharshgautam/gennie
https://github.com/sangharshgautam/gennie
216509fcd85ed639f2569dd053426adc4b5a2304
651badaec9b614b5b703321a0dc2c0bb7f4ca78e
refs/heads/master
2021-01-15T15:43:52.586000
2016-10-13T22:05:45
2016-10-13T22:05:45
50,056,613
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.telegram.client.pojo; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.xml.bind.annotation.XmlType; @Entity @DiscriminatorValue("channel") @XmlType(name="channel") public class ChannelChat extends Chat{ }
UTF-8
Java
262
java
ChannelChat.java
Java
[]
null
[]
package org.telegram.client.pojo; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.xml.bind.annotation.XmlType; @Entity @DiscriminatorValue("channel") @XmlType(name="channel") public class ChannelChat extends Chat{ }
262
0.812977
0.812977
12
20.833334
17.057907
44
false
false
0
0
0
0
0
0
0.333333
false
false
3
96c3b1052e3d8ed1ee4650c11d69396143d77530
28,132,035,841,007
4c3af76e873da78932443ed8fd34b9a81e63f602
/src/main/java/tracelink/D.java
c3f61ae39b3eb35bd00104692051cdb12a532991
[]
no_license
pravesh1992/thread_deadlock_example
https://github.com/pravesh1992/thread_deadlock_example
c3d396986e8fc4692780c40ee521a87614e651c7
ecac08e6f40f8467ad864a5914dcb76bc7ae578d
refs/heads/master
2020-09-08T12:25:12.215000
2020-06-22T04:27:02
2020-06-22T04:27:02
221,133,262
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tracelink; import common.C; public class D extends C { public float m(float x1, float x2) { return 0; } public static void main(String[] args) { D d = new D(); System.out.println(d); Integer a = null; int b = a; System.out.println(b); } // @Override // float m(float x, float y) { // return 0; // } // @Override // public int m(int x, int y) throws IOException { // return 0; // } }
UTF-8
Java
441
java
D.java
Java
[]
null
[]
package tracelink; import common.C; public class D extends C { public float m(float x1, float x2) { return 0; } public static void main(String[] args) { D d = new D(); System.out.println(d); Integer a = null; int b = a; System.out.println(b); } // @Override // float m(float x, float y) { // return 0; // } // @Override // public int m(int x, int y) throws IOException { // return 0; // } }
441
0.571429
0.560091
29
14.24138
13.750625
51
false
false
0
0
0
0
0
0
0.448276
false
false
3
ce93a62e55c223063e91ebf8ede01c5e2aed0cfe
5,059,471,535,201
4727b815561a123529f1a03550453cad3b110d56
/GUISafetyQues.java
2a238c9c9f8139930d7ded98f978247c842e6b55
[]
no_license
katherinexu/BookRecommendationEngine
https://github.com/katherinexu/BookRecommendationEngine
4ef533c34a1cdeef5017b8b8a3f5cef014ad45f3
5234853a048ee6e40e61cd384e2713dc99f96d35
refs/heads/master
2018-01-09T18:42:15.204000
2016-03-05T06:54:17
2016-03-05T06:54:17
50,440,267
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* GUISafetyQues.java * This method is used to set three safety questions for all users in order to find the password if needed. * Constantine, Katherine, Michael */ import javax.swing.*; import java.awt.*; import java.awt.event.*; public class GUISafetyQues { JLabel ques1, ques2, ques3, info, warning, nullWarning; //Declare component Label JPanel contentPane; //Declare component panel JFrame frame; //Declare JFrame JButton finish, setNull; //Declare component buttons JTextField as1, as2, as3; //Declare component textfields Font f = new Font("Times New Roman", Font.BOLD, 15); //define font /** * Constructor to setup GUI components and event handling; * Pre: null; * Post: the safety questions will be set and stored into database. */ public GUISafetyQues() { frame = new JFrame("Safety Questions"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); contentPane = new JPanel(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); //To use BoxLayout to line items up contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); //Create empty borders around items ques1 = new JLabel(CustInfo.safetyQues[0]); ques1.setFont(f); //To keep the font of texts on items the same ques1.setAlignmentX(JLabel.CENTER_ALIGNMENT); //To line the items up at the centre of the window ques1.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); ques2 = new JLabel(CustInfo.safetyQues[1]); ques2.setFont(f); ques2.setAlignmentX(JLabel.CENTER_ALIGNMENT); ques2.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); ques3 = new JLabel(CustInfo.safetyQues[2]); ques3.setFont(f); ques3.setAlignmentX(JLabel.CENTER_ALIGNMENT); ques3.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); info = new JLabel("Please answer the three safety questions below: "); info.setFont(f); info.setAlignmentX(JLabel.CENTER_ALIGNMENT); info.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); as1 = new JTextField(40); as1.setEditable(true); //To allow the textfield to be editted as2 = new JTextField(40); as2.setEditable(true); as3 = new JTextField(40); as3.setEditable(true); warning = new JLabel("Please provide an unique answer to each question."); warning.setAlignmentX(JLabel.CENTER_ALIGNMENT); warning.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); nullWarning = new JLabel("The answers should be longer than 3 characters."); nullWarning.setAlignmentX(JLabel.CENTER_ALIGNMENT); nullWarning.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); finish = new JButton("Save"); finish.setFont(f); finish.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String ans1 = as1.getText(); String ans2 = as2.getText(); String ans3 = as3.getText(); if (ans1.length() < 3 || ans2.length() < 3 || ans3.length() < 3) { frame.setVisible(false); frame.remove(warning); frame.add(nullWarning); frame.setSize(480, 310); frame.setVisible(true); } else { if (ans1.equals(ans2) || ans2.equals(ans3) || ans1.equals(ans3)) { frame.setVisible(false); frame.remove(nullWarning); frame.add(warning); frame.setSize(480, 310); frame.setVisible(true); } else { GUIUserOpen.up.addCust(GUIUserOpen.UserID, GUIUserOpen.password); //If the user finished safety questions, add the customer in GUIUserOpen.engine.SafetyQuestion(ans1, ans2, ans3); //To write the answers into file frame.setVisible(false); GUIUserOpen open = new GUIUserOpen(true);//Go to main page to let the user log in } } } }); finish.setAlignmentX(JLabel.CENTER_ALIGNMENT); finish.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); setNull = new JButton("Clean"); setNull.setFont(f); setNull.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { frame.setVisible(false); //Close the current window GUISafetyQues que = new GUISafetyQues(); //Create a new window for enter the answers again } }); setNull.setAlignmentX(JLabel.CENTER_ALIGNMENT); setNull.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); contentPane.add(info); contentPane.add(ques1); contentPane.add(as1); contentPane.add(ques2); contentPane.add(as2); contentPane.add(ques3); contentPane.add(as3); contentPane.add(finish); contentPane.add(setNull); frame.setContentPane(contentPane); frame.pack(); frame.setVisible(true); //Open the pop-up window frame.setLocationRelativeTo(null); //Set the location of the pop-up window at the centre of the computer } private void runGUI() { JFrame.setDefaultLookAndFeelDecorated(true); GUISafetyQues que = new GUISafetyQues(); } }
UTF-8
Java
5,736
java
GUISafetyQues.java
Java
[ { "context": "users in order to find the password if needed. \n* Constantine, Katherine, Michael\n*/ \n\nimport javax.swing.*; \nim", "end": 145, "score": 0.9474524855613708, "start": 134, "tag": "NAME", "value": "Constantine" }, { "context": "r to find the password if needed. \n* ...
null
[]
/* GUISafetyQues.java * This method is used to set three safety questions for all users in order to find the password if needed. * Constantine, Katherine, Michael */ import javax.swing.*; import java.awt.*; import java.awt.event.*; public class GUISafetyQues { JLabel ques1, ques2, ques3, info, warning, nullWarning; //Declare component Label JPanel contentPane; //Declare component panel JFrame frame; //Declare JFrame JButton finish, setNull; //Declare component buttons JTextField as1, as2, as3; //Declare component textfields Font f = new Font("Times New Roman", Font.BOLD, 15); //define font /** * Constructor to setup GUI components and event handling; * Pre: null; * Post: the safety questions will be set and stored into database. */ public GUISafetyQues() { frame = new JFrame("Safety Questions"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); contentPane = new JPanel(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); //To use BoxLayout to line items up contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); //Create empty borders around items ques1 = new JLabel(CustInfo.safetyQues[0]); ques1.setFont(f); //To keep the font of texts on items the same ques1.setAlignmentX(JLabel.CENTER_ALIGNMENT); //To line the items up at the centre of the window ques1.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); ques2 = new JLabel(CustInfo.safetyQues[1]); ques2.setFont(f); ques2.setAlignmentX(JLabel.CENTER_ALIGNMENT); ques2.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); ques3 = new JLabel(CustInfo.safetyQues[2]); ques3.setFont(f); ques3.setAlignmentX(JLabel.CENTER_ALIGNMENT); ques3.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); info = new JLabel("Please answer the three safety questions below: "); info.setFont(f); info.setAlignmentX(JLabel.CENTER_ALIGNMENT); info.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); as1 = new JTextField(40); as1.setEditable(true); //To allow the textfield to be editted as2 = new JTextField(40); as2.setEditable(true); as3 = new JTextField(40); as3.setEditable(true); warning = new JLabel("Please provide an unique answer to each question."); warning.setAlignmentX(JLabel.CENTER_ALIGNMENT); warning.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); nullWarning = new JLabel("The answers should be longer than 3 characters."); nullWarning.setAlignmentX(JLabel.CENTER_ALIGNMENT); nullWarning.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); finish = new JButton("Save"); finish.setFont(f); finish.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String ans1 = as1.getText(); String ans2 = as2.getText(); String ans3 = as3.getText(); if (ans1.length() < 3 || ans2.length() < 3 || ans3.length() < 3) { frame.setVisible(false); frame.remove(warning); frame.add(nullWarning); frame.setSize(480, 310); frame.setVisible(true); } else { if (ans1.equals(ans2) || ans2.equals(ans3) || ans1.equals(ans3)) { frame.setVisible(false); frame.remove(nullWarning); frame.add(warning); frame.setSize(480, 310); frame.setVisible(true); } else { GUIUserOpen.up.addCust(GUIUserOpen.UserID, GUIUserOpen.password); //If the user finished safety questions, add the customer in GUIUserOpen.engine.SafetyQuestion(ans1, ans2, ans3); //To write the answers into file frame.setVisible(false); GUIUserOpen open = new GUIUserOpen(true);//Go to main page to let the user log in } } } }); finish.setAlignmentX(JLabel.CENTER_ALIGNMENT); finish.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); setNull = new JButton("Clean"); setNull.setFont(f); setNull.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { frame.setVisible(false); //Close the current window GUISafetyQues que = new GUISafetyQues(); //Create a new window for enter the answers again } }); setNull.setAlignmentX(JLabel.CENTER_ALIGNMENT); setNull.setBorder(BorderFactory.createEmptyBorder(5, 12, 5, 12)); contentPane.add(info); contentPane.add(ques1); contentPane.add(as1); contentPane.add(ques2); contentPane.add(as2); contentPane.add(ques3); contentPane.add(as3); contentPane.add(finish); contentPane.add(setNull); frame.setContentPane(contentPane); frame.pack(); frame.setVisible(true); //Open the pop-up window frame.setLocationRelativeTo(null); //Set the location of the pop-up window at the centre of the computer } private void runGUI() { JFrame.setDefaultLookAndFeelDecorated(true); GUISafetyQues que = new GUISafetyQues(); } }
5,736
0.6053
0.582462
116
48.448277
27.988403
147
false
false
0
0
0
0
0
0
1.224138
false
false
3
1ce3aa2d59fa5824f5af66b85aaf14d32219a422
5,059,471,531,908
e2ca54baecaae1c88b97544a4744fb2d30cc51c1
/src/examenm5_castro/Jam.java
1933d0a7b13b17f49eddec8e4e3bbf0d1d8bc7ff
[]
no_license
J48137541/ExamenM5_Castro
https://github.com/J48137541/ExamenM5_Castro
ba5e78ba021b62219e3f6955ec08cb74b897ab38
b5b3f97af72bd22f5b64820f7008a91ab325335f
refs/heads/master
2020-03-17T17:25:52.277000
2018-05-17T09:11:45
2018-05-17T09:11:45
133,787,986
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 examenm5_castro; /** * * @author alumne */ public class Jam { //declaracio de totes les variables de la clase Jam private String contents; private String date; private int capacity; private static int numTotalJars, noJam = 0; //es el contructor de Jam que te 3 parametres, 2 Strings i 1 int Jam(String contents, String date, int size) { this.contents = contents; this.date = date; capacity = size; numTotalJars++; } /** * * Metode boolean que retorna un true si la capacitat es = a 0 * @return */ public boolean empty() { return (capacity == 0); } /** * En el primer metode es per visualitzar els contents + data + capacitat * * En el segond metode es per veure el número total de Jars creats des de l'inici * * En el tercer metode es per veure el número de Jars que s'han quedat sense melmelada des de l'inici dels temps * */ public void print() { System.out.println(contents + " " + date + " " + capacity + " fl. oz."); System.out.println("El número total de Jars creats des de l'inici dels temps són: " + Jam.getNumTotalJars()); System.out.println("El número de Jars que s'han quedat sense melmelada des de l'inici dels temps: " + Jam.getNoJam()); } /** * Aquest metode primer comprova que no estigui vuit i despres si el liquid es mes petit que la capacitat * mostra el liquid i el contents. Si es mes grand mostra la capacitat i el contingut i suma 1 a noJAM * * Si no fa lo de dalt salta al altra condicio que mostra per pantalla un missatge * * @param fluidOz */ public void spread(int fluidOz) { if (!empty()) { if (fluidOz < capacity) { System.out.println("Spreading " + fluidOz + " fluid ounces of " + contents); capacity = capacity - fluidOz; } else { System.out.println("Spreading " + capacity + " fluid ounces of " + contents); capacity = 0; noJam++; } } else { System.out.println("No jam in the Jar!"); } } /** *int que retorna el numero total de Jars * * @return */ public static int getNumTotalJars() { return numTotalJars; } /** * Int que retorna el numero de noJam * * @return */ public static int getNoJam() { return noJam; } }
UTF-8
Java
2,519
java
Jam.java
Java
[ { "context": "r.\n */\npackage examenm5_castro;\n\n/**\n *\n * @author alumne\n */\npublic class Jam {\n //declaracio de totes ", "end": 235, "score": 0.9981120228767395, "start": 229, "tag": "USERNAME", "value": "alumne" } ]
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 examenm5_castro; /** * * @author alumne */ public class Jam { //declaracio de totes les variables de la clase Jam private String contents; private String date; private int capacity; private static int numTotalJars, noJam = 0; //es el contructor de Jam que te 3 parametres, 2 Strings i 1 int Jam(String contents, String date, int size) { this.contents = contents; this.date = date; capacity = size; numTotalJars++; } /** * * Metode boolean que retorna un true si la capacitat es = a 0 * @return */ public boolean empty() { return (capacity == 0); } /** * En el primer metode es per visualitzar els contents + data + capacitat * * En el segond metode es per veure el número total de Jars creats des de l'inici * * En el tercer metode es per veure el número de Jars que s'han quedat sense melmelada des de l'inici dels temps * */ public void print() { System.out.println(contents + " " + date + " " + capacity + " fl. oz."); System.out.println("El número total de Jars creats des de l'inici dels temps són: " + Jam.getNumTotalJars()); System.out.println("El número de Jars que s'han quedat sense melmelada des de l'inici dels temps: " + Jam.getNoJam()); } /** * Aquest metode primer comprova que no estigui vuit i despres si el liquid es mes petit que la capacitat * mostra el liquid i el contents. Si es mes grand mostra la capacitat i el contingut i suma 1 a noJAM * * Si no fa lo de dalt salta al altra condicio que mostra per pantalla un missatge * * @param fluidOz */ public void spread(int fluidOz) { if (!empty()) { if (fluidOz < capacity) { System.out.println("Spreading " + fluidOz + " fluid ounces of " + contents); capacity = capacity - fluidOz; } else { System.out.println("Spreading " + capacity + " fluid ounces of " + contents); capacity = 0; noJam++; } } else { System.out.println("No jam in the Jar!"); } } /** *int que retorna el numero total de Jars * * @return */ public static int getNumTotalJars() { return numTotalJars; } /** * Int que retorna el numero de noJam * * @return */ public static int getNoJam() { return noJam; } }
2,519
0.632856
0.629276
90
26.933332
31.069027
120
false
false
0
0
0
0
0
0
1.077778
false
false
3
5bf290190af8dc3e65dfa091c971cc66b81568ce
11,476,152,649,974
b1380b6e213c629796ed819e2142678fecd151ce
/example_app/src/main/java/io/particle/cloudsdk/example_app/ValueActivity.java
0c8143971e7c01538f1c62932dc5c16a1505441d
[ "Apache-2.0" ]
permissive
automategreen/spark-sdk-android
https://github.com/automategreen/spark-sdk-android
7753fed0078ee30cdd6d5d3d2cfcadd4330f943f
fe1d6b01f8c3ce4f1fec9bd01f3b080df5c8ec98
refs/heads/master
2021-01-16T17:09:28.511000
2016-02-05T01:22:02
2016-02-05T01:22:02
51,043,277
0
1
null
true
2016-02-04T01:16:52
2016-02-04T01:16:52
2016-01-30T21:30:02
2016-01-28T17:25:49
487
0
0
0
null
null
null
package io.particle.cloudsdk.example_app; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import java.io.IOException; import io.particle.android.sdk.cloud.ParticleCloud; import io.particle.android.sdk.cloud.ParticleCloudException; import io.particle.android.sdk.cloud.ParticleDevice; import io.particle.android.sdk.utils.Async; import io.particle.android.sdk.utils.Toaster; public class ValueActivity extends AppCompatActivity { private static final String ARG_VALUE = "ARG_VALUE"; private static final String ARG_DEVICEID = "ARG_DEVICEID"; private TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_value); tv = (TextView) findViewById(R.id.value); tv.setText(String.valueOf(getIntent().getIntExtra(ARG_VALUE, 0))); findViewById(R.id.refresh_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //... // Do network work on background thread Async.executeAsync(ParticleCloud.get(ValueActivity.this), new Async.ApiWork<ParticleCloud, Object>() { @Override public Object callApi(ParticleCloud ParticleCloud) throws ParticleCloudException, IOException { ParticleDevice device = ParticleCloud.getDevice(getIntent().getStringExtra(ARG_DEVICEID)); Object variable; try { variable = device.getVariable("analogvalue"); } catch (ParticleDevice.VariableDoesNotExistException e) { Toaster.l(ValueActivity.this, e.getMessage()); variable = -1; } return variable; } @Override public void onSuccess(Object i) { // this goes on the main thread tv.setText(i.toString()); } @Override public void onFailure(ParticleCloudException e) { e.printStackTrace(); } }); } }); } public static Intent buildIntent(Context ctx, Integer value, String deviceid) { Intent intent = new Intent(ctx, ValueActivity.class); intent.putExtra(ARG_VALUE, value); intent.putExtra(ARG_DEVICEID, deviceid); return intent; } }
UTF-8
Java
2,748
java
ValueActivity.java
Java
[]
null
[]
package io.particle.cloudsdk.example_app; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import java.io.IOException; import io.particle.android.sdk.cloud.ParticleCloud; import io.particle.android.sdk.cloud.ParticleCloudException; import io.particle.android.sdk.cloud.ParticleDevice; import io.particle.android.sdk.utils.Async; import io.particle.android.sdk.utils.Toaster; public class ValueActivity extends AppCompatActivity { private static final String ARG_VALUE = "ARG_VALUE"; private static final String ARG_DEVICEID = "ARG_DEVICEID"; private TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_value); tv = (TextView) findViewById(R.id.value); tv.setText(String.valueOf(getIntent().getIntExtra(ARG_VALUE, 0))); findViewById(R.id.refresh_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //... // Do network work on background thread Async.executeAsync(ParticleCloud.get(ValueActivity.this), new Async.ApiWork<ParticleCloud, Object>() { @Override public Object callApi(ParticleCloud ParticleCloud) throws ParticleCloudException, IOException { ParticleDevice device = ParticleCloud.getDevice(getIntent().getStringExtra(ARG_DEVICEID)); Object variable; try { variable = device.getVariable("analogvalue"); } catch (ParticleDevice.VariableDoesNotExistException e) { Toaster.l(ValueActivity.this, e.getMessage()); variable = -1; } return variable; } @Override public void onSuccess(Object i) { // this goes on the main thread tv.setText(i.toString()); } @Override public void onFailure(ParticleCloudException e) { e.printStackTrace(); } }); } }); } public static Intent buildIntent(Context ctx, Integer value, String deviceid) { Intent intent = new Intent(ctx, ValueActivity.class); intent.putExtra(ARG_VALUE, value); intent.putExtra(ARG_DEVICEID, deviceid); return intent; } }
2,748
0.600437
0.599345
74
36.135136
29.498659
118
false
false
0
0
0
0
0
0
0.594595
false
false
3
83f25f96df38fca55b901f904f15fc7139060886
9,268,539,467,097
a2e1a8b026dcc579c4dc69a63be52f163cec3e3b
/src/main/java/com/web/service/UserInfoService.java
fe78b3f7566384228aa4bba95dbaece494f156f6
[]
no_license
yinHengCQ/SSM-OrderManager
https://github.com/yinHengCQ/SSM-OrderManager
e0c0ff19cfe1fe8a08350a9a1d9e0a1c8e5ea43a
d78b78a736fcf70414699caf988bc6c4478045a0
refs/heads/master
2021-01-23T00:33:58.915000
2017-06-07T15:12:01
2017-06-07T15:12:01
92,817,211
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.web.service; import com.web.entity.UserInfo; public interface UserInfoService extends CommonService<UserInfo> { }
UTF-8
Java
136
java
UserInfoService.java
Java
[]
null
[]
package com.web.service; import com.web.entity.UserInfo; public interface UserInfoService extends CommonService<UserInfo> { }
136
0.764706
0.764706
7
17.428572
23.200106
66
false
false
0
0
0
0
0
0
0.285714
false
false
3
4f121ac4c5ead11e002b5b0a892866519a4cf33c
33,243,046,871,861
dca68775411c8f4800fd987d524c67ff37ecd480
/src/main/java/com/oracle/labor/web/PersonalArchivingHandler.java
0010c6ae2da2b4e88078b46ac34101dd93e083ab
[]
no_license
laborTest/labor
https://github.com/laborTest/labor
5c62decefed1abadc918166852ff8c52f6e85eb8
c1ef51e233a4022b836f346e6f51327ff35a8b2d
refs/heads/master
2020-03-15T10:38:35.658000
2018-06-03T07:14:07
2018-06-03T07:14:07
132,103,552
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.oracle.labor.web; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.oracle.labor.service.PersonnelRecordService; /** * 个人归档service * @author dingshuangen * */ @Controller @RequestMapping("/service") public class PersonalArchivingHandler { @Autowired PersonnelRecordService service; /** * 查询信息 * @param citizenId * @param bipName * @param startTime * @param endTime * @param status * @param map * @return */ @RequestMapping("/select") public String selectPersonalInfo(String citizenId,String bipName,String startTime,String endTime,String status,Map<String,Object> map) { map.put("infoList", service.getpersonalInfo(citizenId, bipName, startTime, endTime, status)); return "service/zj/grqz/qzgd_2"; } /** * 归档 * @param jobId * @return */ @RequestMapping(value="/archive") public Object personalArchiving(String[] jobId) { service.personalArchiving(jobId); return "redirect:/service/zj/grqz/qzgd_1.jsp"; } }
UTF-8
Java
1,210
java
PersonalArchivingHandler.java
Java
[ { "context": "lRecordService;\r\n\r\n/**\r\n * 个人归档service\r\n * @author dingshuangen\r\n *\r\n */\r\n@Controller\r\n@RequestMapping(\"/service\"", "end": 342, "score": 0.9994766116142273, "start": 330, "tag": "USERNAME", "value": "dingshuangen" } ]
null
[]
package com.oracle.labor.web; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.oracle.labor.service.PersonnelRecordService; /** * 个人归档service * @author dingshuangen * */ @Controller @RequestMapping("/service") public class PersonalArchivingHandler { @Autowired PersonnelRecordService service; /** * 查询信息 * @param citizenId * @param bipName * @param startTime * @param endTime * @param status * @param map * @return */ @RequestMapping("/select") public String selectPersonalInfo(String citizenId,String bipName,String startTime,String endTime,String status,Map<String,Object> map) { map.put("infoList", service.getpersonalInfo(citizenId, bipName, startTime, endTime, status)); return "service/zj/grqz/qzgd_2"; } /** * 归档 * @param jobId * @return */ @RequestMapping(value="/archive") public Object personalArchiving(String[] jobId) { service.personalArchiving(jobId); return "redirect:/service/zj/grqz/qzgd_1.jsp"; } }
1,210
0.705882
0.704202
51
21.333334
26.168135
137
false
false
0
0
0
0
0
0
1.137255
false
false
3
15e5d1aad8b3a3659ae2baa2b7031aca80ea88b9
5,660,766,896,510
eba02c1fd1978361594502050ddc05468e1fa3e7
/src/main/java/home/javaphite/beholder/extraction/UrlDataExtractor.java
54915f3bc57ca2d6985d39a7ad574f8595c2aedb
[ "MIT" ]
permissive
Javaphite/beholder-ms
https://github.com/Javaphite/beholder-ms
f3bcc6298409bbced560a00150eea59780496d6f
d334b5bfcfadc5b446913a7bb431defeaf6bb579
refs/heads/master
2018-10-17T05:15:02.189000
2018-09-30T14:52:03
2018-09-30T14:52:03
132,463,282
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package home.javaphite.beholder.extraction; import home.javaphite.beholder.data.DataSchema; import home.javaphite.beholder.load.LoadService; import home.javaphite.beholder.storage.StorageService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.UnaryOperator; public abstract class UrlDataExtractor { static final Logger LOG = LoggerFactory.getLogger(UrlDataExtractor.class); String sourceUrl; DataSchema dataSchema; LoadService loadService; StorageService storageService; UrlDataExtractor(DataSchema dataSchema, String sourceUrl) { this.dataSchema = dataSchema; this.sourceUrl = sourceUrl; } abstract Set<Map<String, Object>> extract(); /** * Template method for getting text content of URL defined source, * extraction data from it and queuing those data for storage. * * @implNote relies on concrete implementation of {@code extract} method. */ public void extractFromSource() { LOG.info("Getting content of {}", sourceUrl); Set<Map<String, Object>> dataLines = extract(); dataLines.forEach(storageService::queue); LOG.info("Data of {} prepared and queued for storage", sourceUrl); } public void setStorageService(StorageService storageService) { this.storageService = storageService; } public void setLoadService(LoadService loadService) { this.loadService = loadService; } }
UTF-8
Java
1,567
java
UrlDataExtractor.java
Java
[]
null
[]
package home.javaphite.beholder.extraction; import home.javaphite.beholder.data.DataSchema; import home.javaphite.beholder.load.LoadService; import home.javaphite.beholder.storage.StorageService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.UnaryOperator; public abstract class UrlDataExtractor { static final Logger LOG = LoggerFactory.getLogger(UrlDataExtractor.class); String sourceUrl; DataSchema dataSchema; LoadService loadService; StorageService storageService; UrlDataExtractor(DataSchema dataSchema, String sourceUrl) { this.dataSchema = dataSchema; this.sourceUrl = sourceUrl; } abstract Set<Map<String, Object>> extract(); /** * Template method for getting text content of URL defined source, * extraction data from it and queuing those data for storage. * * @implNote relies on concrete implementation of {@code extract} method. */ public void extractFromSource() { LOG.info("Getting content of {}", sourceUrl); Set<Map<String, Object>> dataLines = extract(); dataLines.forEach(storageService::queue); LOG.info("Data of {} prepared and queued for storage", sourceUrl); } public void setStorageService(StorageService storageService) { this.storageService = storageService; } public void setLoadService(LoadService loadService) { this.loadService = loadService; } }
1,567
0.724314
0.723038
49
30.979591
24.24239
78
false
false
0
0
0
0
0
0
0.632653
false
false
3
e4297da4b183434de22d4d7bd26774e2544772c1
5,660,766,900,306
50fc171465f6586175272b995fcfc5c32d1467fa
/ExampleAllAutomation/src/test/java/com/TestRunner/TestNGFeatures.java
52ca63f07c70aeb544219e2c2da23195a27bf2a2
[]
no_license
mdirfan201/ExampleAllAutomation
https://github.com/mdirfan201/ExampleAllAutomation
eb935cd860acc1968a9830483f030713801b2d76
dc1ae1e4b3c57e54f1b261af8314ad86a0080a68
refs/heads/master
2023-03-28T15:31:18.521000
2021-03-24T17:42:33
2021-03-24T17:42:33
336,997,984
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.TestRunner; import org.openqa.selenium.WebDriver; import org.testng.annotations.Test; public class TestNGFeatures { static WebDriver driver; @Test() public void login() { System.out.println("Login"); int i=9/4; System.out.println("The value of i is: "+ i); } @Test(dependsOnMethods="login") public void Homepage() { System.out.println("Homepage is totally depend on login test"); } @Test(dependsOnMethods="login") public void search() { System.out.println("searh"); } @Test(dependsOnMethods="login") public void Regstrationpage() { System.out.println("Resgistration page"); } }
UTF-8
Java
641
java
TestNGFeatures.java
Java
[]
null
[]
package com.TestRunner; import org.openqa.selenium.WebDriver; import org.testng.annotations.Test; public class TestNGFeatures { static WebDriver driver; @Test() public void login() { System.out.println("Login"); int i=9/4; System.out.println("The value of i is: "+ i); } @Test(dependsOnMethods="login") public void Homepage() { System.out.println("Homepage is totally depend on login test"); } @Test(dependsOnMethods="login") public void search() { System.out.println("searh"); } @Test(dependsOnMethods="login") public void Regstrationpage() { System.out.println("Resgistration page"); } }
641
0.689548
0.686427
36
16.805555
17.068195
65
false
false
0
0
0
0
0
0
1.361111
false
false
3
dcfcbce2042b3bfb9673570719f06ca7983440bc
26,654,567,106,666
b451d80fa0f3d831a705ed58314b56dcd180ef4a
/kpluswebup_dao/src/main/java/com/kpluswebup/web/domain/CustomerDTO.java
07eaa60fb97f74936fee7206cd5a816c49f92bf7
[]
no_license
beppezhang/sobe
https://github.com/beppezhang/sobe
8cbd9bbfcc81330964c2212c2a75f71fe98cc8df
5fafd84d96a3b082edbadced064a9c135115e719
refs/heads/master
2021-01-13T06:03:19.431000
2017-06-22T03:35:54
2017-06-22T03:35:54
95,071,332
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kpluswebup.web.domain; import java.util.Date; import org.apache.ibatis.type.Alias; @Alias("customerDTO") public class CustomerDTO extends BaseDTO { private Long id; private Integer loginTimes;//登录错误次数 private String mainID; // 会员编号 private String username; //用户名 private String password; //密码 private Date lastLoginTime;//最后登录时间 private String nick; private String name; //联系人名称 真实姓名 private String avatar; private String email; private String mobile; private Double scoreIntotal; // 累计积分 private Double amount; // 账户余额 private Double score; // 可用积分 private String gradeID; // 会员等级编号 private Integer sex; // 1:男2:女 private Date birthday; private Integer age; private String countryID; private String provinceID; private String cityID; private String districtID; private Integer isDelete; private Integer status; // 1:正常 2:锁定 3:未审核 4:审核失败 private Date updateTime; // 用户更新时间 private String lastLoginIP; private String registerIP; private String telephone; private String address; private String zip; private String creator; private Date createTime; private String modifier; private Date modifyTime; private String usermemberID; // 用户下级会员ID private String referee; // 推荐人 private String openid; // 微信id private String qrcodeurl; // 邀请会员二维码 private String companyName; //公司名称 private String openingBank; //开户银行 private String accountNumber; //银行帐号 private String bankAccount; //银行帐户 private String picURL1; //营业执照 private String picURL2; //税务登记证 private String picURL3; //组织机构代码 private String invoice; //发票信息 public String getInvoice() { return invoice; } public String getOpeningBank() { return openingBank; } public void setOpeningBank(String openingBank) { this.openingBank = openingBank; } public String getAccountNumber() { return accountNumber; } public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } public String getBankAccount() { return bankAccount; } public void setBankAccount(String bankAccount) { this.bankAccount = bankAccount; } public void setInvoice(String invoice) { this.invoice = invoice; } public String getUsermemberID() { return usermemberID; } public void setUsermemberID(String usermemberID) { this.usermemberID = usermemberID; } public String getMainID() { return mainID; } public void setMainID(String mainID) { this.mainID = mainID; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Date getLastLoginTime() { return lastLoginTime; } public void setLastLoginTime(Date lastLoginTime) { this.lastLoginTime = lastLoginTime; } public String getNick() { return nick; } public void setNick(String nick) { this.nick = nick; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } public Integer getLoginTimes() { return loginTimes; } public void setLoginTimes(Integer loginTimes) { this.loginTimes = loginTimes; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public Double getScoreIntotal() { return scoreIntotal; } public void setScoreIntotal(Double scoreIntotal) { this.scoreIntotal = scoreIntotal; } public Double getAmount() { return amount; } public void setAmount(Double amount) { this.amount = amount; } public Double getScore() { return score; } public void setScore(Double score) { this.score = score; } public String getGradeID() { return gradeID; } public void setGradeID(String gradeID) { this.gradeID = gradeID; } public Integer getSex() { return sex; } public void setSex(Integer sex) { this.sex = sex; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public String getCountryID() { return countryID; } public void setCountryID(String countryID) { this.countryID = countryID; } public String getProvinceID() { return provinceID; } public void setProvinceID(String provinceID) { this.provinceID = provinceID; } public String getCityID() { return cityID; } public void setCityID(String cityID) { this.cityID = cityID; } public Integer getIsDelete() { return isDelete; } public void setIsDelete(Integer isDelete) { this.isDelete = isDelete; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getLastLoginIP() { return lastLoginIP; } public void setLastLoginIP(String lastLoginIP) { this.lastLoginIP = lastLoginIP; } public String getRegisterIP() { return registerIP; } public void setRegisterIP(String registerIP) { this.registerIP = registerIP; } public String getTelephone() { return telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public String getCreator() { return creator; } public void setCreator(String creator) { this.creator = creator; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getModifier() { return modifier; } public void setModifier(String modifier) { this.modifier = modifier; } public Date getModifyTime() { return modifyTime; } public void setModifyTime(Date modifyTime) { this.modifyTime = modifyTime; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getDistrictID() { return districtID; } public void setDistrictID(String districtID) { this.districtID = districtID; } public String getReferee() { return referee; } public void setReferee(String referee) { this.referee = referee; } public String getOpenid() { return openid; } public void setOpenid(String openid) { this.openid = openid; } public String getQrcodeurl() { return qrcodeurl; } public void setQrcodeurl(String qrcodeurl) { this.qrcodeurl = qrcodeurl; } public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String getPicURL1() { return picURL1; } public void setPicURL1(String picURL1) { this.picURL1 = picURL1; } public String getPicURL2() { return picURL2; } public void setPicURL2(String picURL2) { this.picURL2 = picURL2; } public String getPicURL3() { return picURL3; } public void setPicURL3(String picURL3) { this.picURL3 = picURL3; } }
UTF-8
Java
9,118
java
CustomerDTO.java
Java
[ { "context": "D; // 会员编号\n\n private String username; //用户名\n\n private String password; //密码\n\n private", "end": 316, "score": 0.9991883635520935, "start": 313, "tag": "USERNAME", "value": "用户名" }, { "context": "username; //用户名\n\n private String password; //...
null
[]
package com.kpluswebup.web.domain; import java.util.Date; import org.apache.ibatis.type.Alias; @Alias("customerDTO") public class CustomerDTO extends BaseDTO { private Long id; private Integer loginTimes;//登录错误次数 private String mainID; // 会员编号 private String username; //用户名 private String password; //密码 private Date lastLoginTime;//最后登录时间 private String nick; private String name; //联系人名称 真实姓名 private String avatar; private String email; private String mobile; private Double scoreIntotal; // 累计积分 private Double amount; // 账户余额 private Double score; // 可用积分 private String gradeID; // 会员等级编号 private Integer sex; // 1:男2:女 private Date birthday; private Integer age; private String countryID; private String provinceID; private String cityID; private String districtID; private Integer isDelete; private Integer status; // 1:正常 2:锁定 3:未审核 4:审核失败 private Date updateTime; // 用户更新时间 private String lastLoginIP; private String registerIP; private String telephone; private String address; private String zip; private String creator; private Date createTime; private String modifier; private Date modifyTime; private String usermemberID; // 用户下级会员ID private String referee; // 推荐人 private String openid; // 微信id private String qrcodeurl; // 邀请会员二维码 private String companyName; //公司名称 private String openingBank; //开户银行 private String accountNumber; //银行帐号 private String bankAccount; //银行帐户 private String picURL1; //营业执照 private String picURL2; //税务登记证 private String picURL3; //组织机构代码 private String invoice; //发票信息 public String getInvoice() { return invoice; } public String getOpeningBank() { return openingBank; } public void setOpeningBank(String openingBank) { this.openingBank = openingBank; } public String getAccountNumber() { return accountNumber; } public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } public String getBankAccount() { return bankAccount; } public void setBankAccount(String bankAccount) { this.bankAccount = bankAccount; } public void setInvoice(String invoice) { this.invoice = invoice; } public String getUsermemberID() { return usermemberID; } public void setUsermemberID(String usermemberID) { this.usermemberID = usermemberID; } public String getMainID() { return mainID; } public void setMainID(String mainID) { this.mainID = mainID; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return <PASSWORD>; } public void setPassword(String password) { this.password = <PASSWORD>; } public Date getLastLoginTime() { return lastLoginTime; } public void setLastLoginTime(Date lastLoginTime) { this.lastLoginTime = lastLoginTime; } public String getNick() { return nick; } public void setNick(String nick) { this.nick = nick; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } public Integer getLoginTimes() { return loginTimes; } public void setLoginTimes(Integer loginTimes) { this.loginTimes = loginTimes; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public Double getScoreIntotal() { return scoreIntotal; } public void setScoreIntotal(Double scoreIntotal) { this.scoreIntotal = scoreIntotal; } public Double getAmount() { return amount; } public void setAmount(Double amount) { this.amount = amount; } public Double getScore() { return score; } public void setScore(Double score) { this.score = score; } public String getGradeID() { return gradeID; } public void setGradeID(String gradeID) { this.gradeID = gradeID; } public Integer getSex() { return sex; } public void setSex(Integer sex) { this.sex = sex; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public String getCountryID() { return countryID; } public void setCountryID(String countryID) { this.countryID = countryID; } public String getProvinceID() { return provinceID; } public void setProvinceID(String provinceID) { this.provinceID = provinceID; } public String getCityID() { return cityID; } public void setCityID(String cityID) { this.cityID = cityID; } public Integer getIsDelete() { return isDelete; } public void setIsDelete(Integer isDelete) { this.isDelete = isDelete; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getLastLoginIP() { return lastLoginIP; } public void setLastLoginIP(String lastLoginIP) { this.lastLoginIP = lastLoginIP; } public String getRegisterIP() { return registerIP; } public void setRegisterIP(String registerIP) { this.registerIP = registerIP; } public String getTelephone() { return telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public String getCreator() { return creator; } public void setCreator(String creator) { this.creator = creator; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getModifier() { return modifier; } public void setModifier(String modifier) { this.modifier = modifier; } public Date getModifyTime() { return modifyTime; } public void setModifyTime(Date modifyTime) { this.modifyTime = modifyTime; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getDistrictID() { return districtID; } public void setDistrictID(String districtID) { this.districtID = districtID; } public String getReferee() { return referee; } public void setReferee(String referee) { this.referee = referee; } public String getOpenid() { return openid; } public void setOpenid(String openid) { this.openid = openid; } public String getQrcodeurl() { return qrcodeurl; } public void setQrcodeurl(String qrcodeurl) { this.qrcodeurl = qrcodeurl; } public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String getPicURL1() { return picURL1; } public void setPicURL1(String picURL1) { this.picURL1 = picURL1; } public String getPicURL2() { return picURL2; } public void setPicURL2(String picURL2) { this.picURL2 = picURL2; } public String getPicURL3() { return picURL3; } public void setPicURL3(String picURL3) { this.picURL3 = picURL3; } }
9,122
0.604961
0.601917
478
17.556486
16.956625
62
false
false
0
0
0
0
0
0
0.378661
false
false
3
83b05420294aa47c567cfbdd5fbd63c13ed1f1f8
12,154,757,518,322
30cda8cf11e3ea45feae731925922123c317576d
/app/src/main/java/com/notinglife/android/LocationHelper/fragment/DeviceListFragment.java
67bab00e415d159b7f390bd3d692a0a91bd7b345
[]
no_license
saginardo/LocationHelperApp
https://github.com/saginardo/LocationHelperApp
742de67e20ccd19acf819edb77d473e6779275da
7baa0b6706f4ba7129ca211caa6d94bec27d7bb0
refs/heads/master
2021-01-01T04:08:34.503000
2017-07-13T14:05:07
2017-07-13T14:05:07
97,128,157
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.notinglife.android.LocationHelper.fragment; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.content.LocalBroadcastManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.GestureDetector; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import com.notinglife.android.LocationHelper.R; import com.notinglife.android.LocationHelper.activity.DeviceDetailActivity; import com.notinglife.android.LocationHelper.adapter.DeviceRecyclerAdapter; import com.notinglife.android.LocationHelper.dao.DeviceRawDao; import com.notinglife.android.LocationHelper.domain.LocationDevice; import com.notinglife.android.LocationHelper.utils.DialogUtil; import com.notinglife.android.LocationHelper.utils.LogUtil; import com.notinglife.android.LocationHelper.utils.ToastUtil; import com.notinglife.android.LocationHelper.view.EmptyRecyclerView; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; /** * ${DESCRIPTION} * * @author saginardo * @version ${VERSION} * date 2017-06-13 19:31 */ public class DeviceListFragment extends Fragment implements View.OnClickListener { public static final String LOCATIONDEVICE = "LOCATIONDEVICE"; public static final String DEVICEPOSITION = "DEVICEPOSITION"; private static final String TAG = "DeviceListFragment"; //showdialog标志位 private final static int DELETE_BY_ID = 0; private final static int DELETE_ALL = 1; private final static int UPDATE_DEVICE = 2; private final static int ON_SAVE_DATA = 3; //接收到ContentFragment的消息的标志位 private final static int UNDO_SAVE = 4; private final static int ON_RECEIVE_LOCATION_DATA = 5; private final static int ON_RECEIVE_SCAN_RESULT = 6; private final static int ON_EDIT_DEVICE = 7; private final static int ON_DELETE_ALL_DATA = 8; //设备维护标志位 private final static int DEVICE_REPAIR = 50; private final static int DEVICE_REPAIR_DOWN = 51; @BindView(R.id.device_list_toolBar) Toolbar mDeviceListToolBar; @BindView(R.id.progress_bar) ProgressBar mProgressBar; @BindView(R.id.id_recyclerview) EmptyRecyclerView mRecyclerView; @BindView(R.id.id_empty_view) View mEmptyView; private DeviceRecyclerAdapter mDeviceRecyclerAdapter; private List<LocationDevice> mList; private DeviceRawDao mDao; private MyHandler mHandler; public Activity mActivity; private LocalBroadcastManager broadcastManager; private MyReceiver mReceiver; private Unbinder mUnBinder; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = getActivity(); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = View.inflate(mActivity, R.layout.fragment_device_list, null); mUnBinder = ButterKnife.bind(this, view); mDao = new DeviceRawDao(mActivity); mList = new ArrayList<>(); if (mDao.queryAll() != null) { mList.addAll(mDao.queryAll()); } LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity); mRecyclerView.setLayoutManager(layoutManager); mDeviceRecyclerAdapter = new DeviceRecyclerAdapter(mActivity, mList); mRecyclerView.setAdapter(mDeviceRecyclerAdapter); mRecyclerView.setEmptyView(mEmptyView); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener(mActivity, mRecyclerView, new RecyclerItemClickListener.OnItemClickListener() { @Override public void onItemClick(View view, int position) { // FIXED: 2017/6/12 单击事件的处理,预计实现点击进入详情页修改 Intent intent = new Intent(); LocationDevice locationDevice = mList.get(position); Bundle bundle = new Bundle(); bundle.putSerializable(LOCATIONDEVICE, locationDevice); intent.putExtra(DEVICEPOSITION, position); intent.putExtra(LOCATIONDEVICE, bundle);//传入mList中的position信息,便于回传修改 intent.setClass(mActivity, DeviceDetailActivity.class); startActivity(intent); } @Override public void onItemLongClick(View view, int position) { DialogUtil.showDeviceEditDialog(mActivity, mHandler, "删除设备信息", null, mList.get(position), position, DELETE_BY_ID); } })); //滑动事件 /*ItemTouchHelper.SimpleCallback mCallback = new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.LEFT|ItemTouchHelper.RIGHT) { @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { return false; } @Override public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { int position = viewHolder.getAdapterPosition(); LocationDevice device = mList.remove(position); mDao.deleteById(device.mID); mDeviceRecyclerAdapter.notifyItemRemoved(position); } @Override public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive); if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) { //左右滑动时改变Item的透明度 final float alpha = 1 - Math.abs(dX) / (float) viewHolder.itemView.getWidth(); viewHolder.itemView.setAlpha(alpha); viewHolder.itemView.setTranslationX(dX); } } }; ItemTouchHelper itemTouchHelper = new ItemTouchHelper(mCallback); itemTouchHelper.attachToRecyclerView(mRecyclerView);*/ return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); //动态注册本地广播,以便通知设备的添加和删除,可以及时更新recyclerview broadcastManager = LocalBroadcastManager.getInstance(mActivity); IntentFilter filter = new IntentFilter(); filter.addAction("com.notinglife.android.action.DATA_CHANGED"); //DeviceDetailActivity 发送的修改设备信息的广播 mReceiver = new MyReceiver(); broadcastManager.registerReceiver(mReceiver, filter); mHandler = new MyHandler(DeviceListFragment.this); mDeviceListToolBar.setTitle("设备列表"); mDeviceListToolBar.inflateMenu(R.menu.device_list_toolbar); mDeviceListToolBar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.menu_search_button: DialogUtil.showSearchDialog(mActivity); return true; case R.id.menu_refresh_mode: if (mDao.queryAll() != null) { mList.clear(); mList.addAll(mDao.queryAll()); mDeviceRecyclerAdapter.notifyDataSetChanged(); } return true; // TODO: 2017/6/30 编辑模式 case R.id.menu_edit_mode: return true; default: return false; } } }); } @Override public void onDestroy() { super.onDestroy(); broadcastManager.unregisterReceiver(mReceiver); } @Override public void onDestroyView() { super.onDestroyView(); mUnBinder.unbind(); } private static class MyHandler extends Handler { WeakReference<DeviceListFragment> mFragment; MyHandler(DeviceListFragment fragment) { mFragment = new WeakReference<>(fragment); } @Override public void handleMessage(Message msg) { super.handleMessage(msg); int flag = msg.what; int position = msg.arg1; DeviceListFragment fragment = mFragment.get(); LocationDevice tmpDevice = (LocationDevice) msg.obj; if (fragment != null) { if (flag == DELETE_BY_ID) { if (tmpDevice != null && tmpDevice.mID != null && tmpDevice.mID > 0) { int delete = fragment.mDao.deleteById(tmpDevice.mID); if (delete == 1) { ToastUtil.showShortToast(fragment.getActivity(), "成功删除设备信息"); fragment.mList.remove(position); fragment.mDeviceRecyclerAdapter.notifyItemRemoved(position); } else { //这里应该判断不到,在修改之前已经查询输入的ID是否合法,考虑是否删除? ToastUtil.showShortToast(fragment.getActivity(), "删除失败,请检查ID是否输入错误"); } } } if (flag == ON_SAVE_DATA) { // TODO: 2017/6/15 暂时没有mList的position信息 List<LocationDevice> locationDevices = fragment.mDao.queryAll(); fragment.mList.clear(); fragment.mList.addAll(locationDevices); fragment.mDeviceRecyclerAdapter.notifyDataSetChanged(); } if (flag == UNDO_SAVE) { // TODO: 2017/6/15 暂时没有mList的position信息 fragment.mDao.deleteById(tmpDevice.mID); List<LocationDevice> locationDevices = fragment.mDao.queryAll(); fragment.mList.clear(); fragment.mList.addAll(locationDevices); fragment.mDeviceRecyclerAdapter.notifyDataSetChanged(); } if (flag == ON_EDIT_DEVICE) { if (tmpDevice != null && tmpDevice.mID != null && tmpDevice.mID > 0) { int update = fragment.mDao.update(tmpDevice); if (update == 1) { ToastUtil.showShortToast(fragment.getActivity(), "成功修改设备信息"); position = fragment.mList.indexOf(tmpDevice); fragment.mList.set(position, tmpDevice); fragment.mDeviceRecyclerAdapter.notifyItemChanged(position); } else { ToastUtil.showShortToast(fragment.getActivity(), "修改失败,请检查ID是否输入错误"); } } } if (flag == ON_DELETE_ALL_DATA) { fragment.mList.clear(); fragment.mDeviceRecyclerAdapter.notifyDataSetChanged(); } if (flag == DEVICE_REPAIR_DOWN) { position = fragment.mList.indexOf(tmpDevice); //因为待维护设备列表的position和deviceListFragment不一致,不能直接使用 LogUtil.i(TAG, "position = " + position); fragment.mList.set(position, tmpDevice); fragment.mDeviceRecyclerAdapter.notifyItemChanged(position); } } } } @Override public void onClick(View v) { List<LocationDevice> locationDevices = null; LocationDevice deviceToDo = null; //查询出来的临时对象 int position; switch (v.getId()) { /*case R.id.bt_query_by_id: String queryString = mQueryId.getText().toString(); if (TextUtils.isEmpty(queryString)) { ToastUtil.showShortToast(mActivity, "请输入有效的设备的ID"); return; } deviceToDo = mDao.queryById(queryString); // FIXMD: 2017/6/13 对象为空,就没有必要判断对象的数据;对象不为空,就还需要判断对象数据不为空 if (deviceToDo == null) { ToastUtil.showShortToast(mActivity, "没有查询到设备,请检查输入的设备ID"); return; } else { mList.clear(); mList.add(deviceToDo); LogUtil.i(mList.toString()); mDeviceRecyclerAdapter.notifyDataSetChanged(); } break; case R.id.bt_query_all: locationDevices = mDao.queryAll(); if (locationDevices == null || locationDevices.size() == 0) { ToastUtil.showShortToast(mActivity, "没有查询到设备信息"); return; } else { LogUtil.i("点击了 全部查询"); mList.clear(); mList.addAll(locationDevices); mDeviceRecyclerAdapter.notifyDataSetChanged(); } break; case R.id.bt_delete_by_id: String deleteString = mDeleteId.getText().toString(); if (TextUtils.isEmpty(deleteString)) { ToastUtil.showShortToast(mActivity, "请输入有效的设备的ID"); return; } deviceToDo = mDao.queryById(deleteString); if (deviceToDo == null) { ToastUtil.showShortToast(mActivity, "没有查询到需要删除的设备"); return; } position = mList.indexOf(deviceToDo); //// FIXED: 2017/6/13 rework //showDeviceEditDialog(v, "删除当前设备", null, deviceToDo, position, DELETE_BY_ID); DialogUtil.showDeviceEditDialog(v, mActivity, mHandler, "删除当前设备", null, deviceToDo, position, DELETE_BY_ID); break; case R.id.bt_delete_all: if (mList == null || mList.size() == 0) { ToastUtil.showShortToast(mActivity, "当前没有设备数据"); return; } // FIXED: 2017/6/13 rework //showDeviceEditDialog(v, "删除所有设备信息", "请确认是否删除所有设备信息", null, -1, DELETE_ALL); DialogUtil.showDeviceEditDialog(v, mActivity, mHandler, "删除所有设备信息", "请确认是否删除所有设备信息", null, -1, DELETE_ALL); break; case R.id.bt_send_data: locationDevices = mDao.queryAll(); if (locationDevices == null || locationDevices.size() == 0) { ToastUtil.showShortToast(mActivity, "当前没有数据,无法发送"); return; } FileUtil.saveListToFile(mActivity, mDao.queryAll()); Intent intentShareFile = new Intent(Intent.ACTION_SEND); String myFilePath = mActivity.getExternalFilesDir("data").getPath(); File file = new File(myFilePath, "data.txt"); if (file.exists()) { intentShareFile.setType("application/pdf"); intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + file)); intentShareFile.putExtra(Intent.EXTRA_SUBJECT, "Sharing File..."); intentShareFile.putExtra(Intent.EXTRA_TEXT, "Sharing File..."); startActivity(Intent.createChooser(intentShareFile, "Share File")); } else { ToastUtil.showShortToast(mActivity, "没有数据文件"); } break; case R.id.bt_update_by_id: String deviceId = mUpdateId.getText().toString(); deviceToDo = mDao.queryById(deviceId); if (deviceToDo == null) { ToastUtil.showShortToast(mActivity, "查询不到该设备,请检查输入ID"); return; } // FIXED: 2017/6/13 如何获得对象的位置 // 通过重写 对象的 hashCode和equals方法,判断查询出来的对象是同一个对象,从而获取在mList中的位置 position = mList.indexOf(deviceToDo); //showDeviceEditDialog(v, "修改设备信息", null, deviceToDo, position, UPDATE_DEVICE); DialogUtil.showDeviceEditDialog(v, mActivity, mHandler, "修改设备信息", null, deviceToDo, position, UPDATE_DEVICE);*/ default: break; } } private static class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener { public interface OnItemClickListener { void onItemClick(View view, int position); void onItemLongClick(View view, int position); } private OnItemClickListener mListener; private GestureDetector mGestureDetector; public RecyclerItemClickListener(Context context, final RecyclerView recyclerView, OnItemClickListener listener) { mListener = listener; mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapUp(MotionEvent e) { return true; } @Override public void onLongPress(MotionEvent e) { View childView = recyclerView.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null) { mListener.onItemLongClick(childView, recyclerView.getChildAdapterPosition(childView)); } } }); } @Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildAdapterPosition(childView)); } return false; } @Override public void onTouchEvent(RecyclerView view, MotionEvent motionEvent) { } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { } } private class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { int flag = intent.getIntExtra("flag", -1); int position = intent.getIntExtra(DEVICEPOSITION, -1); Message message = Message.obtain(); message.what = flag; message.obj = intent.getBundleExtra("DEVICE_DATA").getSerializable("DEVICE_DATA"); message.arg1 = position; mHandler.sendMessage(message); } } }
UTF-8
Java
20,528
java
DeviceListFragment.java
Java
[ { "context": "fe.Unbinder;\n\n\n/**\n * ${DESCRIPTION}\n *\n * @author saginardo\n * @version ${VERSION}\n * date 2017-06-1", "end": 1632, "score": 0.9991094470024109, "start": 1623, "tag": "USERNAME", "value": "saginardo" } ]
null
[]
package com.notinglife.android.LocationHelper.fragment; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.content.LocalBroadcastManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.GestureDetector; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; import com.notinglife.android.LocationHelper.R; import com.notinglife.android.LocationHelper.activity.DeviceDetailActivity; import com.notinglife.android.LocationHelper.adapter.DeviceRecyclerAdapter; import com.notinglife.android.LocationHelper.dao.DeviceRawDao; import com.notinglife.android.LocationHelper.domain.LocationDevice; import com.notinglife.android.LocationHelper.utils.DialogUtil; import com.notinglife.android.LocationHelper.utils.LogUtil; import com.notinglife.android.LocationHelper.utils.ToastUtil; import com.notinglife.android.LocationHelper.view.EmptyRecyclerView; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; /** * ${DESCRIPTION} * * @author saginardo * @version ${VERSION} * date 2017-06-13 19:31 */ public class DeviceListFragment extends Fragment implements View.OnClickListener { public static final String LOCATIONDEVICE = "LOCATIONDEVICE"; public static final String DEVICEPOSITION = "DEVICEPOSITION"; private static final String TAG = "DeviceListFragment"; //showdialog标志位 private final static int DELETE_BY_ID = 0; private final static int DELETE_ALL = 1; private final static int UPDATE_DEVICE = 2; private final static int ON_SAVE_DATA = 3; //接收到ContentFragment的消息的标志位 private final static int UNDO_SAVE = 4; private final static int ON_RECEIVE_LOCATION_DATA = 5; private final static int ON_RECEIVE_SCAN_RESULT = 6; private final static int ON_EDIT_DEVICE = 7; private final static int ON_DELETE_ALL_DATA = 8; //设备维护标志位 private final static int DEVICE_REPAIR = 50; private final static int DEVICE_REPAIR_DOWN = 51; @BindView(R.id.device_list_toolBar) Toolbar mDeviceListToolBar; @BindView(R.id.progress_bar) ProgressBar mProgressBar; @BindView(R.id.id_recyclerview) EmptyRecyclerView mRecyclerView; @BindView(R.id.id_empty_view) View mEmptyView; private DeviceRecyclerAdapter mDeviceRecyclerAdapter; private List<LocationDevice> mList; private DeviceRawDao mDao; private MyHandler mHandler; public Activity mActivity; private LocalBroadcastManager broadcastManager; private MyReceiver mReceiver; private Unbinder mUnBinder; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = getActivity(); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = View.inflate(mActivity, R.layout.fragment_device_list, null); mUnBinder = ButterKnife.bind(this, view); mDao = new DeviceRawDao(mActivity); mList = new ArrayList<>(); if (mDao.queryAll() != null) { mList.addAll(mDao.queryAll()); } LinearLayoutManager layoutManager = new LinearLayoutManager(mActivity); mRecyclerView.setLayoutManager(layoutManager); mDeviceRecyclerAdapter = new DeviceRecyclerAdapter(mActivity, mList); mRecyclerView.setAdapter(mDeviceRecyclerAdapter); mRecyclerView.setEmptyView(mEmptyView); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener(mActivity, mRecyclerView, new RecyclerItemClickListener.OnItemClickListener() { @Override public void onItemClick(View view, int position) { // FIXED: 2017/6/12 单击事件的处理,预计实现点击进入详情页修改 Intent intent = new Intent(); LocationDevice locationDevice = mList.get(position); Bundle bundle = new Bundle(); bundle.putSerializable(LOCATIONDEVICE, locationDevice); intent.putExtra(DEVICEPOSITION, position); intent.putExtra(LOCATIONDEVICE, bundle);//传入mList中的position信息,便于回传修改 intent.setClass(mActivity, DeviceDetailActivity.class); startActivity(intent); } @Override public void onItemLongClick(View view, int position) { DialogUtil.showDeviceEditDialog(mActivity, mHandler, "删除设备信息", null, mList.get(position), position, DELETE_BY_ID); } })); //滑动事件 /*ItemTouchHelper.SimpleCallback mCallback = new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.LEFT|ItemTouchHelper.RIGHT) { @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { return false; } @Override public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { int position = viewHolder.getAdapterPosition(); LocationDevice device = mList.remove(position); mDao.deleteById(device.mID); mDeviceRecyclerAdapter.notifyItemRemoved(position); } @Override public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive); if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) { //左右滑动时改变Item的透明度 final float alpha = 1 - Math.abs(dX) / (float) viewHolder.itemView.getWidth(); viewHolder.itemView.setAlpha(alpha); viewHolder.itemView.setTranslationX(dX); } } }; ItemTouchHelper itemTouchHelper = new ItemTouchHelper(mCallback); itemTouchHelper.attachToRecyclerView(mRecyclerView);*/ return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); //动态注册本地广播,以便通知设备的添加和删除,可以及时更新recyclerview broadcastManager = LocalBroadcastManager.getInstance(mActivity); IntentFilter filter = new IntentFilter(); filter.addAction("com.notinglife.android.action.DATA_CHANGED"); //DeviceDetailActivity 发送的修改设备信息的广播 mReceiver = new MyReceiver(); broadcastManager.registerReceiver(mReceiver, filter); mHandler = new MyHandler(DeviceListFragment.this); mDeviceListToolBar.setTitle("设备列表"); mDeviceListToolBar.inflateMenu(R.menu.device_list_toolbar); mDeviceListToolBar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.menu_search_button: DialogUtil.showSearchDialog(mActivity); return true; case R.id.menu_refresh_mode: if (mDao.queryAll() != null) { mList.clear(); mList.addAll(mDao.queryAll()); mDeviceRecyclerAdapter.notifyDataSetChanged(); } return true; // TODO: 2017/6/30 编辑模式 case R.id.menu_edit_mode: return true; default: return false; } } }); } @Override public void onDestroy() { super.onDestroy(); broadcastManager.unregisterReceiver(mReceiver); } @Override public void onDestroyView() { super.onDestroyView(); mUnBinder.unbind(); } private static class MyHandler extends Handler { WeakReference<DeviceListFragment> mFragment; MyHandler(DeviceListFragment fragment) { mFragment = new WeakReference<>(fragment); } @Override public void handleMessage(Message msg) { super.handleMessage(msg); int flag = msg.what; int position = msg.arg1; DeviceListFragment fragment = mFragment.get(); LocationDevice tmpDevice = (LocationDevice) msg.obj; if (fragment != null) { if (flag == DELETE_BY_ID) { if (tmpDevice != null && tmpDevice.mID != null && tmpDevice.mID > 0) { int delete = fragment.mDao.deleteById(tmpDevice.mID); if (delete == 1) { ToastUtil.showShortToast(fragment.getActivity(), "成功删除设备信息"); fragment.mList.remove(position); fragment.mDeviceRecyclerAdapter.notifyItemRemoved(position); } else { //这里应该判断不到,在修改之前已经查询输入的ID是否合法,考虑是否删除? ToastUtil.showShortToast(fragment.getActivity(), "删除失败,请检查ID是否输入错误"); } } } if (flag == ON_SAVE_DATA) { // TODO: 2017/6/15 暂时没有mList的position信息 List<LocationDevice> locationDevices = fragment.mDao.queryAll(); fragment.mList.clear(); fragment.mList.addAll(locationDevices); fragment.mDeviceRecyclerAdapter.notifyDataSetChanged(); } if (flag == UNDO_SAVE) { // TODO: 2017/6/15 暂时没有mList的position信息 fragment.mDao.deleteById(tmpDevice.mID); List<LocationDevice> locationDevices = fragment.mDao.queryAll(); fragment.mList.clear(); fragment.mList.addAll(locationDevices); fragment.mDeviceRecyclerAdapter.notifyDataSetChanged(); } if (flag == ON_EDIT_DEVICE) { if (tmpDevice != null && tmpDevice.mID != null && tmpDevice.mID > 0) { int update = fragment.mDao.update(tmpDevice); if (update == 1) { ToastUtil.showShortToast(fragment.getActivity(), "成功修改设备信息"); position = fragment.mList.indexOf(tmpDevice); fragment.mList.set(position, tmpDevice); fragment.mDeviceRecyclerAdapter.notifyItemChanged(position); } else { ToastUtil.showShortToast(fragment.getActivity(), "修改失败,请检查ID是否输入错误"); } } } if (flag == ON_DELETE_ALL_DATA) { fragment.mList.clear(); fragment.mDeviceRecyclerAdapter.notifyDataSetChanged(); } if (flag == DEVICE_REPAIR_DOWN) { position = fragment.mList.indexOf(tmpDevice); //因为待维护设备列表的position和deviceListFragment不一致,不能直接使用 LogUtil.i(TAG, "position = " + position); fragment.mList.set(position, tmpDevice); fragment.mDeviceRecyclerAdapter.notifyItemChanged(position); } } } } @Override public void onClick(View v) { List<LocationDevice> locationDevices = null; LocationDevice deviceToDo = null; //查询出来的临时对象 int position; switch (v.getId()) { /*case R.id.bt_query_by_id: String queryString = mQueryId.getText().toString(); if (TextUtils.isEmpty(queryString)) { ToastUtil.showShortToast(mActivity, "请输入有效的设备的ID"); return; } deviceToDo = mDao.queryById(queryString); // FIXMD: 2017/6/13 对象为空,就没有必要判断对象的数据;对象不为空,就还需要判断对象数据不为空 if (deviceToDo == null) { ToastUtil.showShortToast(mActivity, "没有查询到设备,请检查输入的设备ID"); return; } else { mList.clear(); mList.add(deviceToDo); LogUtil.i(mList.toString()); mDeviceRecyclerAdapter.notifyDataSetChanged(); } break; case R.id.bt_query_all: locationDevices = mDao.queryAll(); if (locationDevices == null || locationDevices.size() == 0) { ToastUtil.showShortToast(mActivity, "没有查询到设备信息"); return; } else { LogUtil.i("点击了 全部查询"); mList.clear(); mList.addAll(locationDevices); mDeviceRecyclerAdapter.notifyDataSetChanged(); } break; case R.id.bt_delete_by_id: String deleteString = mDeleteId.getText().toString(); if (TextUtils.isEmpty(deleteString)) { ToastUtil.showShortToast(mActivity, "请输入有效的设备的ID"); return; } deviceToDo = mDao.queryById(deleteString); if (deviceToDo == null) { ToastUtil.showShortToast(mActivity, "没有查询到需要删除的设备"); return; } position = mList.indexOf(deviceToDo); //// FIXED: 2017/6/13 rework //showDeviceEditDialog(v, "删除当前设备", null, deviceToDo, position, DELETE_BY_ID); DialogUtil.showDeviceEditDialog(v, mActivity, mHandler, "删除当前设备", null, deviceToDo, position, DELETE_BY_ID); break; case R.id.bt_delete_all: if (mList == null || mList.size() == 0) { ToastUtil.showShortToast(mActivity, "当前没有设备数据"); return; } // FIXED: 2017/6/13 rework //showDeviceEditDialog(v, "删除所有设备信息", "请确认是否删除所有设备信息", null, -1, DELETE_ALL); DialogUtil.showDeviceEditDialog(v, mActivity, mHandler, "删除所有设备信息", "请确认是否删除所有设备信息", null, -1, DELETE_ALL); break; case R.id.bt_send_data: locationDevices = mDao.queryAll(); if (locationDevices == null || locationDevices.size() == 0) { ToastUtil.showShortToast(mActivity, "当前没有数据,无法发送"); return; } FileUtil.saveListToFile(mActivity, mDao.queryAll()); Intent intentShareFile = new Intent(Intent.ACTION_SEND); String myFilePath = mActivity.getExternalFilesDir("data").getPath(); File file = new File(myFilePath, "data.txt"); if (file.exists()) { intentShareFile.setType("application/pdf"); intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + file)); intentShareFile.putExtra(Intent.EXTRA_SUBJECT, "Sharing File..."); intentShareFile.putExtra(Intent.EXTRA_TEXT, "Sharing File..."); startActivity(Intent.createChooser(intentShareFile, "Share File")); } else { ToastUtil.showShortToast(mActivity, "没有数据文件"); } break; case R.id.bt_update_by_id: String deviceId = mUpdateId.getText().toString(); deviceToDo = mDao.queryById(deviceId); if (deviceToDo == null) { ToastUtil.showShortToast(mActivity, "查询不到该设备,请检查输入ID"); return; } // FIXED: 2017/6/13 如何获得对象的位置 // 通过重写 对象的 hashCode和equals方法,判断查询出来的对象是同一个对象,从而获取在mList中的位置 position = mList.indexOf(deviceToDo); //showDeviceEditDialog(v, "修改设备信息", null, deviceToDo, position, UPDATE_DEVICE); DialogUtil.showDeviceEditDialog(v, mActivity, mHandler, "修改设备信息", null, deviceToDo, position, UPDATE_DEVICE);*/ default: break; } } private static class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener { public interface OnItemClickListener { void onItemClick(View view, int position); void onItemLongClick(View view, int position); } private OnItemClickListener mListener; private GestureDetector mGestureDetector; public RecyclerItemClickListener(Context context, final RecyclerView recyclerView, OnItemClickListener listener) { mListener = listener; mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapUp(MotionEvent e) { return true; } @Override public void onLongPress(MotionEvent e) { View childView = recyclerView.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null) { mListener.onItemLongClick(childView, recyclerView.getChildAdapterPosition(childView)); } } }); } @Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildAdapterPosition(childView)); } return false; } @Override public void onTouchEvent(RecyclerView view, MotionEvent motionEvent) { } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { } } private class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { int flag = intent.getIntExtra("flag", -1); int position = intent.getIntExtra(DEVICEPOSITION, -1); Message message = Message.obtain(); message.what = flag; message.obj = intent.getBundleExtra("DEVICE_DATA").getSerializable("DEVICE_DATA"); message.arg1 = position; mHandler.sendMessage(message); } } }
20,528
0.589849
0.584732
467
40.850105
30.646059
178
false
false
0
0
0
0
0
0
0.745182
false
false
3
12486f41df0f380173868b3c3dc3c911f03324cf
37,151,467,114,657
fc7eaf57fc87faa8321bcdf83130a63f70e3f18c
/app/src/main/java/com/mobilephonemasts/app/presentation/tenants/TenantsViewState.java
f90c63963ae8583c7134ac9de346f7417ade2c0d
[]
no_license
RussellBoad/mobile-phone-masts
https://github.com/RussellBoad/mobile-phone-masts
98a1243cd52b9dbd05216fa2de5872ba761b6778
cbe471ea4ebf2e6d6dcddbc887fc21d394d6ce63
refs/heads/master
2020-03-12T08:58:20.808000
2018-05-13T11:15:44
2018-05-13T11:15:44
130,541,383
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mobilephonemasts.app.presentation.tenants; import android.support.annotation.NonNull; import com.google.auto.value.AutoValue; import java.util.Collections; import java.util.Map; import static com.mobilephonemasts.app.presentation.tenants.TenantsViewState.Status.ERROR; import static com.mobilephonemasts.app.presentation.tenants.TenantsViewState.Status.LOADING; import static com.mobilephonemasts.app.presentation.tenants.TenantsViewState.Status.SUCCESS; @AutoValue public abstract class TenantsViewState { public enum Status { LOADING, SUCCESS, ERROR } @NonNull public abstract TenantsViewState.Status status(); @NonNull public abstract String message(); @NonNull public abstract Map<String, Integer> tenants(); public static TenantsViewState loading() { return new AutoValue_TenantsViewState(LOADING, "", Collections.emptyMap()); } public static TenantsViewState success( @NonNull Map<String, Integer> tenants) { return new AutoValue_TenantsViewState(SUCCESS, "", tenants); } public static TenantsViewState error(String errorMessage) { return new AutoValue_TenantsViewState(ERROR, errorMessage, Collections.emptyMap()); } }
UTF-8
Java
1,238
java
TenantsViewState.java
Java
[]
null
[]
package com.mobilephonemasts.app.presentation.tenants; import android.support.annotation.NonNull; import com.google.auto.value.AutoValue; import java.util.Collections; import java.util.Map; import static com.mobilephonemasts.app.presentation.tenants.TenantsViewState.Status.ERROR; import static com.mobilephonemasts.app.presentation.tenants.TenantsViewState.Status.LOADING; import static com.mobilephonemasts.app.presentation.tenants.TenantsViewState.Status.SUCCESS; @AutoValue public abstract class TenantsViewState { public enum Status { LOADING, SUCCESS, ERROR } @NonNull public abstract TenantsViewState.Status status(); @NonNull public abstract String message(); @NonNull public abstract Map<String, Integer> tenants(); public static TenantsViewState loading() { return new AutoValue_TenantsViewState(LOADING, "", Collections.emptyMap()); } public static TenantsViewState success( @NonNull Map<String, Integer> tenants) { return new AutoValue_TenantsViewState(SUCCESS, "", tenants); } public static TenantsViewState error(String errorMessage) { return new AutoValue_TenantsViewState(ERROR, errorMessage, Collections.emptyMap()); } }
1,238
0.758481
0.758481
40
29.950001
31.044283
92
false
false
0
0
0
0
0
0
0.6
false
false
3
216fce149585ab77d6388b00dcdefdc04a4c0a8e
36,412,732,751,203
8bb0196eeeaeebb3a7478df5c1a9fe0ebe177c78
/java-foundation/src/main/java/com/learn/javafoundation/atomicInteger/TestAtomicInteger.java
0fa32b380ec2d43c94671d851b7c9130c5102d9d
[]
no_license
liux1506/learn
https://github.com/liux1506/learn
8ad3cf39dfcb96aaab8c94bbb561463481fe612b
d33cce2c61ffec8d033f9f25a88b2e88fb09f6e7
refs/heads/master
2022-07-12T17:49:48.439000
2020-01-02T09:17:51
2020-01-02T09:17:51
190,174,820
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.learn.javafoundation.atomicInteger; import java.util.concurrent.atomic.AtomicInteger; /** * class:TestAtomicInteger * description: * * @date:2019/6/6 * @author:liux1506 */ public class TestAtomicInteger { private int shareI = 0; private AtomicInteger atomicLoop = new AtomicInteger(0); private int loop = 0; public static void main(String[] args) throws Exception { TestAtomicInteger t = new TestAtomicInteger(); t.testMethod(); System.out.println(t); } public void testMethod() throws Exception { Thread th1 = new Thread(new ThreadTest()); Thread th2 = new Thread(new ThreadTest()); th1.start(); th2.start(); th1.join(); th2.join(); } public synchronized void add() { shareI++; } class ThreadTest implements Runnable { @Override public void run() { // testAtomicInteger(); testInt(); } } public void testInt() { //测试,输出结果随机,为线程不安全,可加synchronized解决,有性能问题 for (; loop < 100000; loop++) { add(); } } public void testAtomicInteger() { //输出100000,线程安全 for (; atomicLoop.getAndAdd(1) < 100000; ) { add(); } } @Override public String toString() { return "" + shareI; } }
UTF-8
Java
1,295
java
TestAtomicInteger.java
Java
[ { "context": "r\n * description:\n *\n * @date:2019/6/6\n * @author:liux1506\n */\n\npublic class TestAtomicInteger {\n\n private ", "end": 187, "score": 0.9996602535247803, "start": 179, "tag": "USERNAME", "value": "liux1506" } ]
null
[]
package com.learn.javafoundation.atomicInteger; import java.util.concurrent.atomic.AtomicInteger; /** * class:TestAtomicInteger * description: * * @date:2019/6/6 * @author:liux1506 */ public class TestAtomicInteger { private int shareI = 0; private AtomicInteger atomicLoop = new AtomicInteger(0); private int loop = 0; public static void main(String[] args) throws Exception { TestAtomicInteger t = new TestAtomicInteger(); t.testMethod(); System.out.println(t); } public void testMethod() throws Exception { Thread th1 = new Thread(new ThreadTest()); Thread th2 = new Thread(new ThreadTest()); th1.start(); th2.start(); th1.join(); th2.join(); } public synchronized void add() { shareI++; } class ThreadTest implements Runnable { @Override public void run() { // testAtomicInteger(); testInt(); } } public void testInt() { //测试,输出结果随机,为线程不安全,可加synchronized解决,有性能问题 for (; loop < 100000; loop++) { add(); } } public void testAtomicInteger() { //输出100000,线程安全 for (; atomicLoop.getAndAdd(1) < 100000; ) { add(); } } @Override public String toString() { return "" + shareI; } }
1,295
0.634882
0.603912
63
18.476191
18.559948
67
false
false
0
0
0
0
0
0
0.380952
false
false
3
0110a775a8b78941da283e38907e8b788d8fc61d
9,165,460,239,467
fa66349e1be1df0dd69547cb69955b91975a0182
/src/main/java/seedu/address/logic/parser/UpdateClientCommandParser.java
0c1d18ae5e5d5b847cd668f01aaf324f630a5a6d
[ "LicenseRef-scancode-other-permissive", "MIT" ]
permissive
Syasyazman/tp
https://github.com/Syasyazman/tp
be85b978e26bb62e56da6c2bf0a487ec4e3e3993
7931a7f452ef2787da1a99d59e1bcaa995678610
refs/heads/master
2023-01-09T00:40:16.218000
2020-11-09T15:35:41
2020-11-09T15:35:41
295,982,710
0
0
NOASSERTION
true
2020-09-16T09:14:50
2020-09-16T09:14:48
2020-09-12T02:27:03
2020-09-11T17:51:26
11,418
0
0
0
null
false
false
package seedu.address.logic.parser; import static java.util.Objects.requireNonNull; import static seedu.address.logic.parser.CliSyntax.UPDATE_CLIENT_PREFIX_ADDRESS; import static seedu.address.logic.parser.CliSyntax.UPDATE_CLIENT_PREFIX_CLIENTID; import static seedu.address.logic.parser.CliSyntax.UPDATE_CLIENT_PREFIX_EMAIL; import static seedu.address.logic.parser.CliSyntax.UPDATE_CLIENT_PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.UPDATE_CLIENT_PREFIX_PHONE; import seedu.address.commons.core.index.Index; import seedu.address.logic.commands.UpdateClientCommand; import seedu.address.logic.commands.UpdatedClientFields; import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; import seedu.address.model.person.Phone; /** * Parses input arguments and creates a new UpdateClientCommand object */ public class UpdateClientCommandParser implements Parser<UpdateClientCommand> { public static final String COMMAND_WORD = "update-client"; /** * Parses the given {@code String} of arguments in the context of the UpdateClientCommand * and returns an UpdateClientCommand object for execution. * @throws ParseException if the user input does not conform the expected format */ public UpdateClientCommand parse(String args) throws ParseException { assert args.contains(UPDATE_CLIENT_PREFIX_CLIENTID.toString()); requireNonNull(args); Index clientId; Name name; Address address; Email email; Phone phone; UpdatedClientFields fieldsToUpdate = new UpdatedClientFields(); ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, UPDATE_CLIENT_PREFIX_CLIENTID, UPDATE_CLIENT_PREFIX_NAME, UPDATE_CLIENT_PREFIX_ADDRESS, UPDATE_CLIENT_PREFIX_EMAIL, UPDATE_CLIENT_PREFIX_PHONE); if (args.contains(UPDATE_CLIENT_PREFIX_CLIENTID.toString())) { clientId = ParserUtil.parseClientIndex(argMultimap.getValue(UPDATE_CLIENT_PREFIX_CLIENTID).get()); fieldsToUpdate.setClientId(clientId); } if (args.contains(UPDATE_CLIENT_PREFIX_ADDRESS.toString())) { address = ParserUtil.parseAddress(argMultimap.getValue(UPDATE_CLIENT_PREFIX_ADDRESS).get()); fieldsToUpdate.setAddress(address); } if (args.contains(UPDATE_CLIENT_PREFIX_EMAIL.toString())) { email = ParserUtil.parseEmail(argMultimap.getValue(UPDATE_CLIENT_PREFIX_EMAIL).get()); fieldsToUpdate.setEmail(email); } if (args.contains(UPDATE_CLIENT_PREFIX_NAME.toString())) { name = ParserUtil.parseName(argMultimap.getValue(UPDATE_CLIENT_PREFIX_NAME).get()); fieldsToUpdate.setName(name); } if (args.contains(UPDATE_CLIENT_PREFIX_PHONE.toString())) { phone = ParserUtil.parsePhone(argMultimap.getValue(UPDATE_CLIENT_PREFIX_PHONE).get()); fieldsToUpdate.setPhone(phone); } return new UpdateClientCommand(fieldsToUpdate); } }
UTF-8
Java
3,273
java
UpdateClientCommandParser.java
Java
[]
null
[]
package seedu.address.logic.parser; import static java.util.Objects.requireNonNull; import static seedu.address.logic.parser.CliSyntax.UPDATE_CLIENT_PREFIX_ADDRESS; import static seedu.address.logic.parser.CliSyntax.UPDATE_CLIENT_PREFIX_CLIENTID; import static seedu.address.logic.parser.CliSyntax.UPDATE_CLIENT_PREFIX_EMAIL; import static seedu.address.logic.parser.CliSyntax.UPDATE_CLIENT_PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.UPDATE_CLIENT_PREFIX_PHONE; import seedu.address.commons.core.index.Index; import seedu.address.logic.commands.UpdateClientCommand; import seedu.address.logic.commands.UpdatedClientFields; import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; import seedu.address.model.person.Phone; /** * Parses input arguments and creates a new UpdateClientCommand object */ public class UpdateClientCommandParser implements Parser<UpdateClientCommand> { public static final String COMMAND_WORD = "update-client"; /** * Parses the given {@code String} of arguments in the context of the UpdateClientCommand * and returns an UpdateClientCommand object for execution. * @throws ParseException if the user input does not conform the expected format */ public UpdateClientCommand parse(String args) throws ParseException { assert args.contains(UPDATE_CLIENT_PREFIX_CLIENTID.toString()); requireNonNull(args); Index clientId; Name name; Address address; Email email; Phone phone; UpdatedClientFields fieldsToUpdate = new UpdatedClientFields(); ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, UPDATE_CLIENT_PREFIX_CLIENTID, UPDATE_CLIENT_PREFIX_NAME, UPDATE_CLIENT_PREFIX_ADDRESS, UPDATE_CLIENT_PREFIX_EMAIL, UPDATE_CLIENT_PREFIX_PHONE); if (args.contains(UPDATE_CLIENT_PREFIX_CLIENTID.toString())) { clientId = ParserUtil.parseClientIndex(argMultimap.getValue(UPDATE_CLIENT_PREFIX_CLIENTID).get()); fieldsToUpdate.setClientId(clientId); } if (args.contains(UPDATE_CLIENT_PREFIX_ADDRESS.toString())) { address = ParserUtil.parseAddress(argMultimap.getValue(UPDATE_CLIENT_PREFIX_ADDRESS).get()); fieldsToUpdate.setAddress(address); } if (args.contains(UPDATE_CLIENT_PREFIX_EMAIL.toString())) { email = ParserUtil.parseEmail(argMultimap.getValue(UPDATE_CLIENT_PREFIX_EMAIL).get()); fieldsToUpdate.setEmail(email); } if (args.contains(UPDATE_CLIENT_PREFIX_NAME.toString())) { name = ParserUtil.parseName(argMultimap.getValue(UPDATE_CLIENT_PREFIX_NAME).get()); fieldsToUpdate.setName(name); } if (args.contains(UPDATE_CLIENT_PREFIX_PHONE.toString())) { phone = ParserUtil.parsePhone(argMultimap.getValue(UPDATE_CLIENT_PREFIX_PHONE).get()); fieldsToUpdate.setPhone(phone); } return new UpdateClientCommand(fieldsToUpdate); } }
3,273
0.700886
0.700886
79
40.430378
32.20845
110
false
false
0
0
0
0
0
0
0.518987
false
false
3
5f0f8b5321f81191cc015fc2e3c2e2bf13d9a45e
31,653,909,029,710
2c89a73d069d8a9f67c0cf2987e52f35895048aa
/src/main/java/spark/sample/SampleConfig.java
9206f3eb828f50fc0b29a06bcfeb1717beaed211
[]
no_license
code-j/spark-sample
https://github.com/code-j/spark-sample
9270e8e461ca2dfbfb251858b06298551bd86d6f
9a3e66f4725edf2cfd1485fb7e7faf7dd29b8be9
refs/heads/master
2021-08-23T19:30:40.167000
2017-12-06T07:15:05
2017-12-06T07:15:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package spark.sample; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaSparkContext; public class SampleConfig { public static SparkConf conf() { SparkConf sparkConf = new SparkConf(); sparkConf.set("spark.driver.host", "127.0.0.1"); sparkConf.setMaster("local[*]"); sparkConf.setAppName("Hello Spark"); return sparkConf; } public static JavaSparkContext context() { JavaSparkContext context = new JavaSparkContext(conf()); return context; } }
UTF-8
Java
489
java
SampleConfig.java
Java
[ { "context": "parkConf();\n\t\tsparkConf.set(\"spark.driver.host\", \"127.0.0.1\");\n\t\tsparkConf.setMaster(\"local[*]\");\n\t\tsparkConf", "end": 261, "score": 0.9984554648399353, "start": 252, "tag": "IP_ADDRESS", "value": "127.0.0.1" } ]
null
[]
package spark.sample; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaSparkContext; public class SampleConfig { public static SparkConf conf() { SparkConf sparkConf = new SparkConf(); sparkConf.set("spark.driver.host", "127.0.0.1"); sparkConf.setMaster("local[*]"); sparkConf.setAppName("Hello Spark"); return sparkConf; } public static JavaSparkContext context() { JavaSparkContext context = new JavaSparkContext(conf()); return context; } }
489
0.740286
0.728016
20
23.450001
19.350645
58
false
false
0
0
0
0
0
0
1.45
false
false
3
51798eb469dc00b30fd113ec4f5a79bd8fe181bd
15,788,299,846,567
f052d65b25c0f2a81bf5b61e8f21397c2cf2e89c
/client/src/test/java/at/ac/tuwien/inso/ticketline/client/unittest/PerformanceServiceTest.java
2507920e0f0a2efc32984adab3efe29db9cee6bc
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
pinkgoldpeach/Ticketline
https://github.com/pinkgoldpeach/Ticketline
063be949f331777939f381a7a03f305b79394959
1d4a27d24665dd33f18fd78defa490236eb7fadc
refs/heads/master
2021-01-12T03:03:00.771000
2017-01-05T21:43:12
2017-01-05T21:43:12
78,149,690
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package at.ac.tuwien.inso.ticketline.client.unittest; /** * */ public class PerformanceServiceTest { }
UTF-8
Java
107
java
PerformanceServiceTest.java
Java
[]
null
[]
package at.ac.tuwien.inso.ticketline.client.unittest; /** * */ public class PerformanceServiceTest { }
107
0.728972
0.728972
8
12.375
19.286896
53
false
false
0
0
0
0
0
0
0.125
false
false
3
9be82ad95aa22de32fd56a1cb19ff4438329605c
10,222,022,200,049
dfa945d8bfa2d4e2b8006a2cfffdf4ec7217cee7
/eitaa-src/messenger/exoplayer/MediaCodecVideoTrackRenderer.java
2f9805d479ca143771174ed992e796df5a8a9a9f
[]
no_license
ondfly/cmp_eitaa_telegram
https://github.com/ondfly/cmp_eitaa_telegram
fd0b258fec8318bd5380baba4708882014c70dc1
79a1473e04f5fe57fe05570117dfda9a3e8c755d
refs/heads/master
2020-03-14T13:03:57.239000
2018-04-30T17:18:47
2018-05-01T17:16:21
131,624,694
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ir.eitaa.messenger.exoplayer; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.content.Context; import android.media.MediaCodec; import android.media.MediaCodec.BufferInfo; import android.media.MediaCrypto; import android.os.Handler; import android.os.SystemClock; import android.view.Surface; import ir.eitaa.messenger.exoplayer.drm.DrmSessionManager; import ir.eitaa.messenger.exoplayer.drm.FrameworkMediaCrypto; import ir.eitaa.messenger.exoplayer.util.MimeTypes; import ir.eitaa.messenger.exoplayer.util.TraceUtil; import ir.eitaa.messenger.exoplayer.util.Util; import java.nio.ByteBuffer; @TargetApi(16) public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer { private static final String KEY_CROP_BOTTOM = "crop-bottom"; private static final String KEY_CROP_LEFT = "crop-left"; private static final String KEY_CROP_RIGHT = "crop-right"; private static final String KEY_CROP_TOP = "crop-top"; public static final int MSG_SET_SURFACE = 1; private final long allowedJoiningTimeUs; private int consecutiveDroppedFrameCount; private int currentHeight; private float currentPixelWidthHeightRatio; private int currentUnappliedRotationDegrees; private int currentWidth; private long droppedFrameAccumulationStartTimeMs; private int droppedFrameCount; private final EventListener eventListener; private final VideoFrameReleaseTimeHelper frameReleaseTimeHelper; private long joiningDeadlineUs; private int lastReportedHeight; private float lastReportedPixelWidthHeightRatio; private int lastReportedUnappliedRotationDegrees; private int lastReportedWidth; private final int maxDroppedFrameCountToNotify; private float pendingPixelWidthHeightRatio; private int pendingRotationDegrees; private boolean renderedFirstFrame; private boolean reportedDrawnToSurface; private Surface surface; private final int videoScalingMode; public MediaCodecVideoTrackRenderer(Context paramContext, SampleSource paramSampleSource, MediaCodecSelector paramMediaCodecSelector, int paramInt) { this(paramContext, paramSampleSource, paramMediaCodecSelector, paramInt, 0L); } public MediaCodecVideoTrackRenderer(Context paramContext, SampleSource paramSampleSource, MediaCodecSelector paramMediaCodecSelector, int paramInt, long paramLong) { this(paramContext, paramSampleSource, paramMediaCodecSelector, paramInt, paramLong, null, null, -1); } public MediaCodecVideoTrackRenderer(Context paramContext, SampleSource paramSampleSource, MediaCodecSelector paramMediaCodecSelector, int paramInt1, long paramLong, Handler paramHandler, EventListener paramEventListener, int paramInt2) { this(paramContext, paramSampleSource, paramMediaCodecSelector, paramInt1, paramLong, null, false, paramHandler, paramEventListener, paramInt2); } public MediaCodecVideoTrackRenderer(Context paramContext, SampleSource paramSampleSource, MediaCodecSelector paramMediaCodecSelector, int paramInt1, long paramLong, DrmSessionManager<FrameworkMediaCrypto> paramDrmSessionManager, boolean paramBoolean, Handler paramHandler, EventListener paramEventListener, int paramInt2) { super(paramSampleSource, paramMediaCodecSelector, paramDrmSessionManager, paramBoolean, paramHandler, paramEventListener); this.frameReleaseTimeHelper = new VideoFrameReleaseTimeHelper(paramContext); this.videoScalingMode = paramInt1; this.allowedJoiningTimeUs = (1000L * paramLong); this.eventListener = paramEventListener; this.maxDroppedFrameCountToNotify = paramInt2; this.joiningDeadlineUs = -1L; this.currentWidth = -1; this.currentHeight = -1; this.currentPixelWidthHeightRatio = -1.0F; this.pendingPixelWidthHeightRatio = -1.0F; this.lastReportedWidth = -1; this.lastReportedHeight = -1; this.lastReportedPixelWidthHeightRatio = -1.0F; } private void maybeNotifyDrawnToSurface() { if ((this.eventHandler == null) || (this.eventListener == null) || (this.reportedDrawnToSurface)) { return; } final Surface localSurface = this.surface; this.eventHandler.post(new Runnable() { public void run() { MediaCodecVideoTrackRenderer.this.eventListener.onDrawnToSurface(localSurface); } }); this.reportedDrawnToSurface = true; } private void maybeNotifyDroppedFrameCount() { if ((this.eventHandler == null) || (this.eventListener == null) || (this.droppedFrameCount == 0)) { return; } long l1 = SystemClock.elapsedRealtime(); final int i = this.droppedFrameCount; long l2 = this.droppedFrameAccumulationStartTimeMs; this.eventHandler.post(new Runnable() { public void run() { MediaCodecVideoTrackRenderer.this.eventListener.onDroppedFrames(i, this.val$elapsedToNotify); } }); this.droppedFrameCount = 0; this.droppedFrameAccumulationStartTimeMs = l1; } private void maybeNotifyVideoSizeChanged() { if ((this.eventHandler == null) || (this.eventListener == null) || ((this.lastReportedWidth == this.currentWidth) && (this.lastReportedHeight == this.currentHeight) && (this.lastReportedUnappliedRotationDegrees == this.currentUnappliedRotationDegrees) && (this.lastReportedPixelWidthHeightRatio == this.currentPixelWidthHeightRatio))) { return; } final int i = this.currentWidth; final int j = this.currentHeight; final int k = this.currentUnappliedRotationDegrees; final float f = this.currentPixelWidthHeightRatio; this.eventHandler.post(new Runnable() { public void run() { MediaCodecVideoTrackRenderer.this.eventListener.onVideoSizeChanged(i, j, k, f); } }); this.lastReportedWidth = i; this.lastReportedHeight = j; this.lastReportedUnappliedRotationDegrees = k; this.lastReportedPixelWidthHeightRatio = f; } @SuppressLint({"InlinedApi"}) private void maybeSetMaxInputSize(android.media.MediaFormat paramMediaFormat, boolean paramBoolean) { if (paramMediaFormat.containsKey("max-input-size")) { return; } int i = paramMediaFormat.getInteger("height"); int j = i; if (paramBoolean) { j = i; if (paramMediaFormat.containsKey("max-height")) { j = Math.max(i, paramMediaFormat.getInteger("max-height")); } } i = paramMediaFormat.getInteger("width"); int k = i; if (paramBoolean) { k = i; if (paramMediaFormat.containsKey("max-width")) { k = Math.max(j, paramMediaFormat.getInteger("max-width")); } } String str = paramMediaFormat.getString("mime"); i = -1; switch (str.hashCode()) { default: switch (i) { default: return; case 0: case 1: label160: i = k * j; j = 2; } break; } for (;;) { paramMediaFormat.setInteger("max-input-size", i * 3 / (j * 2)); return; if (!str.equals("video/3gpp")) { break label160; } i = 0; break label160; if (!str.equals("video/mp4v-es")) { break label160; } i = 1; break label160; if (!str.equals("video/avc")) { break label160; } i = 2; break label160; if (!str.equals("video/x-vnd.on2.vp8")) { break label160; } i = 3; break label160; if (!str.equals("video/hevc")) { break label160; } i = 4; break label160; if (!str.equals("video/x-vnd.on2.vp9")) { break label160; } i = 5; break label160; if ("BRAVIA 4K 2015".equals(Util.MODEL)) { break; } i = (k + 15) / 16 * ((j + 15) / 16) * 16 * 16; j = 2; continue; i = k * j; j = 2; continue; i = k * j; j = 4; } } private void setSurface(Surface paramSurface) throws ExoPlaybackException { if (this.surface == paramSurface) {} int i; do { return; this.surface = paramSurface; this.reportedDrawnToSurface = false; i = getState(); } while ((i != 2) && (i != 3)); releaseCodec(); maybeInitCodec(); } protected boolean canReconfigureCodec(MediaCodec paramMediaCodec, boolean paramBoolean, MediaFormat paramMediaFormat1, MediaFormat paramMediaFormat2) { return (paramMediaFormat2.mimeType.equals(paramMediaFormat1.mimeType)) && ((paramBoolean) || ((paramMediaFormat1.width == paramMediaFormat2.width) && (paramMediaFormat1.height == paramMediaFormat2.height))); } protected void configureCodec(MediaCodec paramMediaCodec, boolean paramBoolean, android.media.MediaFormat paramMediaFormat, MediaCrypto paramMediaCrypto) { maybeSetMaxInputSize(paramMediaFormat, paramBoolean); paramMediaCodec.configure(paramMediaFormat, this.surface, paramMediaCrypto, 0); } protected void dropOutputBuffer(MediaCodec paramMediaCodec, int paramInt) { TraceUtil.beginSection("dropVideoBuffer"); paramMediaCodec.releaseOutputBuffer(paramInt, false); TraceUtil.endSection(); paramMediaCodec = this.codecCounters; paramMediaCodec.droppedOutputBufferCount += 1; this.droppedFrameCount += 1; this.consecutiveDroppedFrameCount += 1; this.codecCounters.maxConsecutiveDroppedOutputBufferCount = Math.max(this.consecutiveDroppedFrameCount, this.codecCounters.maxConsecutiveDroppedOutputBufferCount); if (this.droppedFrameCount == this.maxDroppedFrameCountToNotify) { maybeNotifyDroppedFrameCount(); } } public void handleMessage(int paramInt, Object paramObject) throws ExoPlaybackException { if (paramInt == 1) { setSurface((Surface)paramObject); return; } super.handleMessage(paramInt, paramObject); } protected boolean handlesTrack(MediaCodecSelector paramMediaCodecSelector, MediaFormat paramMediaFormat) throws MediaCodecUtil.DecoderQueryException { boolean bool2 = false; paramMediaFormat = paramMediaFormat.mimeType; boolean bool1 = bool2; if (MimeTypes.isVideo(paramMediaFormat)) { if (!"video/x-unknown".equals(paramMediaFormat)) { bool1 = bool2; if (paramMediaCodecSelector.getDecoderInfo(paramMediaFormat, false) == null) {} } else { bool1 = true; } } return bool1; } protected final boolean haveRenderedFirstFrame() { return this.renderedFirstFrame; } protected boolean isReady() { if ((super.isReady()) && ((this.renderedFirstFrame) || (!codecInitialized()) || (getSourceState() == 2))) { this.joiningDeadlineUs = -1L; } do { return true; if (this.joiningDeadlineUs == -1L) { return false; } } while (SystemClock.elapsedRealtime() * 1000L < this.joiningDeadlineUs); this.joiningDeadlineUs = -1L; return false; } protected void onDisabled() throws ExoPlaybackException { this.currentWidth = -1; this.currentHeight = -1; this.currentPixelWidthHeightRatio = -1.0F; this.pendingPixelWidthHeightRatio = -1.0F; this.lastReportedWidth = -1; this.lastReportedHeight = -1; this.lastReportedPixelWidthHeightRatio = -1.0F; this.frameReleaseTimeHelper.disable(); super.onDisabled(); } protected void onDiscontinuity(long paramLong) throws ExoPlaybackException { super.onDiscontinuity(paramLong); this.renderedFirstFrame = false; this.consecutiveDroppedFrameCount = 0; this.joiningDeadlineUs = -1L; } protected void onEnabled(int paramInt, long paramLong, boolean paramBoolean) throws ExoPlaybackException { super.onEnabled(paramInt, paramLong, paramBoolean); if ((paramBoolean) && (this.allowedJoiningTimeUs > 0L)) { this.joiningDeadlineUs = (SystemClock.elapsedRealtime() * 1000L + this.allowedJoiningTimeUs); } this.frameReleaseTimeHelper.enable(); } protected void onInputFormatChanged(MediaFormatHolder paramMediaFormatHolder) throws ExoPlaybackException { super.onInputFormatChanged(paramMediaFormatHolder); float f; if (paramMediaFormatHolder.format.pixelWidthHeightRatio == -1.0F) { f = 1.0F; this.pendingPixelWidthHeightRatio = f; if (paramMediaFormatHolder.format.rotationDegrees != -1) { break label55; } } label55: for (int i = 0;; i = paramMediaFormatHolder.format.rotationDegrees) { this.pendingRotationDegrees = i; return; f = paramMediaFormatHolder.format.pixelWidthHeightRatio; break; } } protected void onOutputFormatChanged(MediaCodec paramMediaCodec, android.media.MediaFormat paramMediaFormat) { int i; int j; if ((paramMediaFormat.containsKey("crop-right")) && (paramMediaFormat.containsKey("crop-left")) && (paramMediaFormat.containsKey("crop-bottom")) && (paramMediaFormat.containsKey("crop-top"))) { i = 1; if (i == 0) { break label167; } j = paramMediaFormat.getInteger("crop-right") - paramMediaFormat.getInteger("crop-left") + 1; label59: this.currentWidth = j; if (i == 0) { break label178; } i = paramMediaFormat.getInteger("crop-bottom") - paramMediaFormat.getInteger("crop-top") + 1; label85: this.currentHeight = i; this.currentPixelWidthHeightRatio = this.pendingPixelWidthHeightRatio; if (Util.SDK_INT < 21) { break label188; } if ((this.pendingRotationDegrees == 90) || (this.pendingRotationDegrees == 270)) { i = this.currentWidth; this.currentWidth = this.currentHeight; this.currentHeight = i; this.currentPixelWidthHeightRatio = (1.0F / this.currentPixelWidthHeightRatio); } } for (;;) { paramMediaCodec.setVideoScalingMode(this.videoScalingMode); return; i = 0; break; label167: j = paramMediaFormat.getInteger("width"); break label59; label178: i = paramMediaFormat.getInteger("height"); break label85; label188: this.currentUnappliedRotationDegrees = this.pendingRotationDegrees; } } protected void onStarted() { super.onStarted(); this.droppedFrameCount = 0; this.droppedFrameAccumulationStartTimeMs = SystemClock.elapsedRealtime(); } protected void onStopped() { this.joiningDeadlineUs = -1L; maybeNotifyDroppedFrameCount(); super.onStopped(); } protected boolean processOutputBuffer(long paramLong1, long paramLong2, MediaCodec paramMediaCodec, ByteBuffer paramByteBuffer, MediaCodec.BufferInfo paramBufferInfo, int paramInt, boolean paramBoolean) { if (paramBoolean) { skipOutputBuffer(paramMediaCodec, paramInt); this.consecutiveDroppedFrameCount = 0; return true; } if (!this.renderedFirstFrame) { if (Util.SDK_INT >= 21) { renderOutputBufferV21(paramMediaCodec, paramInt, System.nanoTime()); } for (;;) { this.consecutiveDroppedFrameCount = 0; return true; renderOutputBuffer(paramMediaCodec, paramInt); } } if (getState() != 3) { return false; } long l2 = SystemClock.elapsedRealtime(); long l3 = paramBufferInfo.presentationTimeUs; long l1 = System.nanoTime(); paramLong1 = this.frameReleaseTimeHelper.adjustReleaseTime(paramBufferInfo.presentationTimeUs, l1 + 1000L * (l3 - paramLong1 - (l2 * 1000L - paramLong2))); paramLong2 = (paramLong1 - l1) / 1000L; if (paramLong2 < -30000L) { dropOutputBuffer(paramMediaCodec, paramInt); return true; } if (Util.SDK_INT >= 21) { if (paramLong2 < 50000L) { renderOutputBufferV21(paramMediaCodec, paramInt, paramLong1); this.consecutiveDroppedFrameCount = 0; return true; } } else if (paramLong2 < 30000L) { if (paramLong2 > 11000L) {} try { Thread.sleep((paramLong2 - 10000L) / 1000L); renderOutputBuffer(paramMediaCodec, paramInt); this.consecutiveDroppedFrameCount = 0; return true; } catch (InterruptedException paramByteBuffer) { for (;;) { Thread.currentThread().interrupt(); } } } return false; } protected void renderOutputBuffer(MediaCodec paramMediaCodec, int paramInt) { maybeNotifyVideoSizeChanged(); TraceUtil.beginSection("releaseOutputBuffer"); paramMediaCodec.releaseOutputBuffer(paramInt, true); TraceUtil.endSection(); paramMediaCodec = this.codecCounters; paramMediaCodec.renderedOutputBufferCount += 1; this.renderedFirstFrame = true; maybeNotifyDrawnToSurface(); } @TargetApi(21) protected void renderOutputBufferV21(MediaCodec paramMediaCodec, int paramInt, long paramLong) { maybeNotifyVideoSizeChanged(); TraceUtil.beginSection("releaseOutputBuffer"); paramMediaCodec.releaseOutputBuffer(paramInt, paramLong); TraceUtil.endSection(); paramMediaCodec = this.codecCounters; paramMediaCodec.renderedOutputBufferCount += 1; this.renderedFirstFrame = true; maybeNotifyDrawnToSurface(); } protected boolean shouldInitCodec() { return (super.shouldInitCodec()) && (this.surface != null) && (this.surface.isValid()); } protected void skipOutputBuffer(MediaCodec paramMediaCodec, int paramInt) { TraceUtil.beginSection("skipVideoBuffer"); paramMediaCodec.releaseOutputBuffer(paramInt, false); TraceUtil.endSection(); paramMediaCodec = this.codecCounters; paramMediaCodec.skippedOutputBufferCount += 1; } public static abstract interface EventListener extends MediaCodecTrackRenderer.EventListener { public abstract void onDrawnToSurface(Surface paramSurface); public abstract void onDroppedFrames(int paramInt, long paramLong); public abstract void onVideoSizeChanged(int paramInt1, int paramInt2, int paramInt3, float paramFloat); } } /* Location: /dex2jar/eitaa-dex2jar.jar!/ir/eitaa/messenger/exoplayer/MediaCodecVideoTrackRenderer.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
18,283
java
MediaCodecVideoTrackRenderer.java
Java
[]
null
[]
package ir.eitaa.messenger.exoplayer; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.content.Context; import android.media.MediaCodec; import android.media.MediaCodec.BufferInfo; import android.media.MediaCrypto; import android.os.Handler; import android.os.SystemClock; import android.view.Surface; import ir.eitaa.messenger.exoplayer.drm.DrmSessionManager; import ir.eitaa.messenger.exoplayer.drm.FrameworkMediaCrypto; import ir.eitaa.messenger.exoplayer.util.MimeTypes; import ir.eitaa.messenger.exoplayer.util.TraceUtil; import ir.eitaa.messenger.exoplayer.util.Util; import java.nio.ByteBuffer; @TargetApi(16) public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer { private static final String KEY_CROP_BOTTOM = "crop-bottom"; private static final String KEY_CROP_LEFT = "crop-left"; private static final String KEY_CROP_RIGHT = "crop-right"; private static final String KEY_CROP_TOP = "crop-top"; public static final int MSG_SET_SURFACE = 1; private final long allowedJoiningTimeUs; private int consecutiveDroppedFrameCount; private int currentHeight; private float currentPixelWidthHeightRatio; private int currentUnappliedRotationDegrees; private int currentWidth; private long droppedFrameAccumulationStartTimeMs; private int droppedFrameCount; private final EventListener eventListener; private final VideoFrameReleaseTimeHelper frameReleaseTimeHelper; private long joiningDeadlineUs; private int lastReportedHeight; private float lastReportedPixelWidthHeightRatio; private int lastReportedUnappliedRotationDegrees; private int lastReportedWidth; private final int maxDroppedFrameCountToNotify; private float pendingPixelWidthHeightRatio; private int pendingRotationDegrees; private boolean renderedFirstFrame; private boolean reportedDrawnToSurface; private Surface surface; private final int videoScalingMode; public MediaCodecVideoTrackRenderer(Context paramContext, SampleSource paramSampleSource, MediaCodecSelector paramMediaCodecSelector, int paramInt) { this(paramContext, paramSampleSource, paramMediaCodecSelector, paramInt, 0L); } public MediaCodecVideoTrackRenderer(Context paramContext, SampleSource paramSampleSource, MediaCodecSelector paramMediaCodecSelector, int paramInt, long paramLong) { this(paramContext, paramSampleSource, paramMediaCodecSelector, paramInt, paramLong, null, null, -1); } public MediaCodecVideoTrackRenderer(Context paramContext, SampleSource paramSampleSource, MediaCodecSelector paramMediaCodecSelector, int paramInt1, long paramLong, Handler paramHandler, EventListener paramEventListener, int paramInt2) { this(paramContext, paramSampleSource, paramMediaCodecSelector, paramInt1, paramLong, null, false, paramHandler, paramEventListener, paramInt2); } public MediaCodecVideoTrackRenderer(Context paramContext, SampleSource paramSampleSource, MediaCodecSelector paramMediaCodecSelector, int paramInt1, long paramLong, DrmSessionManager<FrameworkMediaCrypto> paramDrmSessionManager, boolean paramBoolean, Handler paramHandler, EventListener paramEventListener, int paramInt2) { super(paramSampleSource, paramMediaCodecSelector, paramDrmSessionManager, paramBoolean, paramHandler, paramEventListener); this.frameReleaseTimeHelper = new VideoFrameReleaseTimeHelper(paramContext); this.videoScalingMode = paramInt1; this.allowedJoiningTimeUs = (1000L * paramLong); this.eventListener = paramEventListener; this.maxDroppedFrameCountToNotify = paramInt2; this.joiningDeadlineUs = -1L; this.currentWidth = -1; this.currentHeight = -1; this.currentPixelWidthHeightRatio = -1.0F; this.pendingPixelWidthHeightRatio = -1.0F; this.lastReportedWidth = -1; this.lastReportedHeight = -1; this.lastReportedPixelWidthHeightRatio = -1.0F; } private void maybeNotifyDrawnToSurface() { if ((this.eventHandler == null) || (this.eventListener == null) || (this.reportedDrawnToSurface)) { return; } final Surface localSurface = this.surface; this.eventHandler.post(new Runnable() { public void run() { MediaCodecVideoTrackRenderer.this.eventListener.onDrawnToSurface(localSurface); } }); this.reportedDrawnToSurface = true; } private void maybeNotifyDroppedFrameCount() { if ((this.eventHandler == null) || (this.eventListener == null) || (this.droppedFrameCount == 0)) { return; } long l1 = SystemClock.elapsedRealtime(); final int i = this.droppedFrameCount; long l2 = this.droppedFrameAccumulationStartTimeMs; this.eventHandler.post(new Runnable() { public void run() { MediaCodecVideoTrackRenderer.this.eventListener.onDroppedFrames(i, this.val$elapsedToNotify); } }); this.droppedFrameCount = 0; this.droppedFrameAccumulationStartTimeMs = l1; } private void maybeNotifyVideoSizeChanged() { if ((this.eventHandler == null) || (this.eventListener == null) || ((this.lastReportedWidth == this.currentWidth) && (this.lastReportedHeight == this.currentHeight) && (this.lastReportedUnappliedRotationDegrees == this.currentUnappliedRotationDegrees) && (this.lastReportedPixelWidthHeightRatio == this.currentPixelWidthHeightRatio))) { return; } final int i = this.currentWidth; final int j = this.currentHeight; final int k = this.currentUnappliedRotationDegrees; final float f = this.currentPixelWidthHeightRatio; this.eventHandler.post(new Runnable() { public void run() { MediaCodecVideoTrackRenderer.this.eventListener.onVideoSizeChanged(i, j, k, f); } }); this.lastReportedWidth = i; this.lastReportedHeight = j; this.lastReportedUnappliedRotationDegrees = k; this.lastReportedPixelWidthHeightRatio = f; } @SuppressLint({"InlinedApi"}) private void maybeSetMaxInputSize(android.media.MediaFormat paramMediaFormat, boolean paramBoolean) { if (paramMediaFormat.containsKey("max-input-size")) { return; } int i = paramMediaFormat.getInteger("height"); int j = i; if (paramBoolean) { j = i; if (paramMediaFormat.containsKey("max-height")) { j = Math.max(i, paramMediaFormat.getInteger("max-height")); } } i = paramMediaFormat.getInteger("width"); int k = i; if (paramBoolean) { k = i; if (paramMediaFormat.containsKey("max-width")) { k = Math.max(j, paramMediaFormat.getInteger("max-width")); } } String str = paramMediaFormat.getString("mime"); i = -1; switch (str.hashCode()) { default: switch (i) { default: return; case 0: case 1: label160: i = k * j; j = 2; } break; } for (;;) { paramMediaFormat.setInteger("max-input-size", i * 3 / (j * 2)); return; if (!str.equals("video/3gpp")) { break label160; } i = 0; break label160; if (!str.equals("video/mp4v-es")) { break label160; } i = 1; break label160; if (!str.equals("video/avc")) { break label160; } i = 2; break label160; if (!str.equals("video/x-vnd.on2.vp8")) { break label160; } i = 3; break label160; if (!str.equals("video/hevc")) { break label160; } i = 4; break label160; if (!str.equals("video/x-vnd.on2.vp9")) { break label160; } i = 5; break label160; if ("BRAVIA 4K 2015".equals(Util.MODEL)) { break; } i = (k + 15) / 16 * ((j + 15) / 16) * 16 * 16; j = 2; continue; i = k * j; j = 2; continue; i = k * j; j = 4; } } private void setSurface(Surface paramSurface) throws ExoPlaybackException { if (this.surface == paramSurface) {} int i; do { return; this.surface = paramSurface; this.reportedDrawnToSurface = false; i = getState(); } while ((i != 2) && (i != 3)); releaseCodec(); maybeInitCodec(); } protected boolean canReconfigureCodec(MediaCodec paramMediaCodec, boolean paramBoolean, MediaFormat paramMediaFormat1, MediaFormat paramMediaFormat2) { return (paramMediaFormat2.mimeType.equals(paramMediaFormat1.mimeType)) && ((paramBoolean) || ((paramMediaFormat1.width == paramMediaFormat2.width) && (paramMediaFormat1.height == paramMediaFormat2.height))); } protected void configureCodec(MediaCodec paramMediaCodec, boolean paramBoolean, android.media.MediaFormat paramMediaFormat, MediaCrypto paramMediaCrypto) { maybeSetMaxInputSize(paramMediaFormat, paramBoolean); paramMediaCodec.configure(paramMediaFormat, this.surface, paramMediaCrypto, 0); } protected void dropOutputBuffer(MediaCodec paramMediaCodec, int paramInt) { TraceUtil.beginSection("dropVideoBuffer"); paramMediaCodec.releaseOutputBuffer(paramInt, false); TraceUtil.endSection(); paramMediaCodec = this.codecCounters; paramMediaCodec.droppedOutputBufferCount += 1; this.droppedFrameCount += 1; this.consecutiveDroppedFrameCount += 1; this.codecCounters.maxConsecutiveDroppedOutputBufferCount = Math.max(this.consecutiveDroppedFrameCount, this.codecCounters.maxConsecutiveDroppedOutputBufferCount); if (this.droppedFrameCount == this.maxDroppedFrameCountToNotify) { maybeNotifyDroppedFrameCount(); } } public void handleMessage(int paramInt, Object paramObject) throws ExoPlaybackException { if (paramInt == 1) { setSurface((Surface)paramObject); return; } super.handleMessage(paramInt, paramObject); } protected boolean handlesTrack(MediaCodecSelector paramMediaCodecSelector, MediaFormat paramMediaFormat) throws MediaCodecUtil.DecoderQueryException { boolean bool2 = false; paramMediaFormat = paramMediaFormat.mimeType; boolean bool1 = bool2; if (MimeTypes.isVideo(paramMediaFormat)) { if (!"video/x-unknown".equals(paramMediaFormat)) { bool1 = bool2; if (paramMediaCodecSelector.getDecoderInfo(paramMediaFormat, false) == null) {} } else { bool1 = true; } } return bool1; } protected final boolean haveRenderedFirstFrame() { return this.renderedFirstFrame; } protected boolean isReady() { if ((super.isReady()) && ((this.renderedFirstFrame) || (!codecInitialized()) || (getSourceState() == 2))) { this.joiningDeadlineUs = -1L; } do { return true; if (this.joiningDeadlineUs == -1L) { return false; } } while (SystemClock.elapsedRealtime() * 1000L < this.joiningDeadlineUs); this.joiningDeadlineUs = -1L; return false; } protected void onDisabled() throws ExoPlaybackException { this.currentWidth = -1; this.currentHeight = -1; this.currentPixelWidthHeightRatio = -1.0F; this.pendingPixelWidthHeightRatio = -1.0F; this.lastReportedWidth = -1; this.lastReportedHeight = -1; this.lastReportedPixelWidthHeightRatio = -1.0F; this.frameReleaseTimeHelper.disable(); super.onDisabled(); } protected void onDiscontinuity(long paramLong) throws ExoPlaybackException { super.onDiscontinuity(paramLong); this.renderedFirstFrame = false; this.consecutiveDroppedFrameCount = 0; this.joiningDeadlineUs = -1L; } protected void onEnabled(int paramInt, long paramLong, boolean paramBoolean) throws ExoPlaybackException { super.onEnabled(paramInt, paramLong, paramBoolean); if ((paramBoolean) && (this.allowedJoiningTimeUs > 0L)) { this.joiningDeadlineUs = (SystemClock.elapsedRealtime() * 1000L + this.allowedJoiningTimeUs); } this.frameReleaseTimeHelper.enable(); } protected void onInputFormatChanged(MediaFormatHolder paramMediaFormatHolder) throws ExoPlaybackException { super.onInputFormatChanged(paramMediaFormatHolder); float f; if (paramMediaFormatHolder.format.pixelWidthHeightRatio == -1.0F) { f = 1.0F; this.pendingPixelWidthHeightRatio = f; if (paramMediaFormatHolder.format.rotationDegrees != -1) { break label55; } } label55: for (int i = 0;; i = paramMediaFormatHolder.format.rotationDegrees) { this.pendingRotationDegrees = i; return; f = paramMediaFormatHolder.format.pixelWidthHeightRatio; break; } } protected void onOutputFormatChanged(MediaCodec paramMediaCodec, android.media.MediaFormat paramMediaFormat) { int i; int j; if ((paramMediaFormat.containsKey("crop-right")) && (paramMediaFormat.containsKey("crop-left")) && (paramMediaFormat.containsKey("crop-bottom")) && (paramMediaFormat.containsKey("crop-top"))) { i = 1; if (i == 0) { break label167; } j = paramMediaFormat.getInteger("crop-right") - paramMediaFormat.getInteger("crop-left") + 1; label59: this.currentWidth = j; if (i == 0) { break label178; } i = paramMediaFormat.getInteger("crop-bottom") - paramMediaFormat.getInteger("crop-top") + 1; label85: this.currentHeight = i; this.currentPixelWidthHeightRatio = this.pendingPixelWidthHeightRatio; if (Util.SDK_INT < 21) { break label188; } if ((this.pendingRotationDegrees == 90) || (this.pendingRotationDegrees == 270)) { i = this.currentWidth; this.currentWidth = this.currentHeight; this.currentHeight = i; this.currentPixelWidthHeightRatio = (1.0F / this.currentPixelWidthHeightRatio); } } for (;;) { paramMediaCodec.setVideoScalingMode(this.videoScalingMode); return; i = 0; break; label167: j = paramMediaFormat.getInteger("width"); break label59; label178: i = paramMediaFormat.getInteger("height"); break label85; label188: this.currentUnappliedRotationDegrees = this.pendingRotationDegrees; } } protected void onStarted() { super.onStarted(); this.droppedFrameCount = 0; this.droppedFrameAccumulationStartTimeMs = SystemClock.elapsedRealtime(); } protected void onStopped() { this.joiningDeadlineUs = -1L; maybeNotifyDroppedFrameCount(); super.onStopped(); } protected boolean processOutputBuffer(long paramLong1, long paramLong2, MediaCodec paramMediaCodec, ByteBuffer paramByteBuffer, MediaCodec.BufferInfo paramBufferInfo, int paramInt, boolean paramBoolean) { if (paramBoolean) { skipOutputBuffer(paramMediaCodec, paramInt); this.consecutiveDroppedFrameCount = 0; return true; } if (!this.renderedFirstFrame) { if (Util.SDK_INT >= 21) { renderOutputBufferV21(paramMediaCodec, paramInt, System.nanoTime()); } for (;;) { this.consecutiveDroppedFrameCount = 0; return true; renderOutputBuffer(paramMediaCodec, paramInt); } } if (getState() != 3) { return false; } long l2 = SystemClock.elapsedRealtime(); long l3 = paramBufferInfo.presentationTimeUs; long l1 = System.nanoTime(); paramLong1 = this.frameReleaseTimeHelper.adjustReleaseTime(paramBufferInfo.presentationTimeUs, l1 + 1000L * (l3 - paramLong1 - (l2 * 1000L - paramLong2))); paramLong2 = (paramLong1 - l1) / 1000L; if (paramLong2 < -30000L) { dropOutputBuffer(paramMediaCodec, paramInt); return true; } if (Util.SDK_INT >= 21) { if (paramLong2 < 50000L) { renderOutputBufferV21(paramMediaCodec, paramInt, paramLong1); this.consecutiveDroppedFrameCount = 0; return true; } } else if (paramLong2 < 30000L) { if (paramLong2 > 11000L) {} try { Thread.sleep((paramLong2 - 10000L) / 1000L); renderOutputBuffer(paramMediaCodec, paramInt); this.consecutiveDroppedFrameCount = 0; return true; } catch (InterruptedException paramByteBuffer) { for (;;) { Thread.currentThread().interrupt(); } } } return false; } protected void renderOutputBuffer(MediaCodec paramMediaCodec, int paramInt) { maybeNotifyVideoSizeChanged(); TraceUtil.beginSection("releaseOutputBuffer"); paramMediaCodec.releaseOutputBuffer(paramInt, true); TraceUtil.endSection(); paramMediaCodec = this.codecCounters; paramMediaCodec.renderedOutputBufferCount += 1; this.renderedFirstFrame = true; maybeNotifyDrawnToSurface(); } @TargetApi(21) protected void renderOutputBufferV21(MediaCodec paramMediaCodec, int paramInt, long paramLong) { maybeNotifyVideoSizeChanged(); TraceUtil.beginSection("releaseOutputBuffer"); paramMediaCodec.releaseOutputBuffer(paramInt, paramLong); TraceUtil.endSection(); paramMediaCodec = this.codecCounters; paramMediaCodec.renderedOutputBufferCount += 1; this.renderedFirstFrame = true; maybeNotifyDrawnToSurface(); } protected boolean shouldInitCodec() { return (super.shouldInitCodec()) && (this.surface != null) && (this.surface.isValid()); } protected void skipOutputBuffer(MediaCodec paramMediaCodec, int paramInt) { TraceUtil.beginSection("skipVideoBuffer"); paramMediaCodec.releaseOutputBuffer(paramInt, false); TraceUtil.endSection(); paramMediaCodec = this.codecCounters; paramMediaCodec.skippedOutputBufferCount += 1; } public static abstract interface EventListener extends MediaCodecTrackRenderer.EventListener { public abstract void onDrawnToSurface(Surface paramSurface); public abstract void onDroppedFrames(int paramInt, long paramLong); public abstract void onVideoSizeChanged(int paramInt1, int paramInt2, int paramInt3, float paramFloat); } } /* Location: /dex2jar/eitaa-dex2jar.jar!/ir/eitaa/messenger/exoplayer/MediaCodecVideoTrackRenderer.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
18,283
0.693322
0.676749
559
31.708408
37.021183
340
false
false
0
0
0
0
0
0
0.719141
false
false
3
508e799f5babb066dad93ca7532f8724100d53b2
7,284,264,554,688
3c0857ee8c40bcbc4a690c3f1835f42c1898958b
/src/test/java/com/spring/proyecto2/Prueba_Metodo_Editar.java
303bc6abbb596576a4362d5ac1f3dc755439546e
[]
no_license
SengoZ/Proyecto2-AgendaTelefonica
https://github.com/SengoZ/Proyecto2-AgendaTelefonica
31dc811c929444028bcc9df8b2a4a3412721525a
a297a5fc6005b716cc59ccfdf7d7b4981f50a57f
refs/heads/master
2020-04-30T01:47:35.995000
2019-03-29T07:24:33
2019-03-29T07:24:33
176,539,324
0
0
null
false
2019-03-29T07:24:33
2019-03-19T15:11:58
2019-03-27T14:02:03
2019-03-29T07:24:33
3,783
0
0
0
Java
false
null
package com.spring.proyecto2; import static org.junit.Assert.assertNotEquals; import java.util.ArrayList; import java.util.List; import org.hibernate.Hibernate; 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.test.context.junit4.SpringRunner; import com.spring.proyecto2.dao.AgendaDao; import com.spring.proyecto2.model.Contacto; import com.spring.proyecto2.model.Direccion; import com.spring.proyecto2.model.Persona; import com.spring.proyecto2.model.Provincia; import com.spring.proyecto2.model.Telefono; import com.spring.proyecto2.services.AgendaService; import junit.framework.TestCase; @RunWith(SpringRunner.class) @SpringBootTest public class Prueba_Metodo_Editar extends TestCase { @Autowired AgendaService services; @Autowired AgendaDao repository; @Test public void inicializar_Persona() { } @Test public void inicializar_Direccion() { } @Test public void inicializar_Telefono() { } /** * Falla prueba unitaria */ @Test public void prueba_Editar() { Persona p = services.buscarId(3); String antiguo = p.getNombre(); p.setNombre("Ramón"); System.out.println("************************"); services.add(p, p.getDireccions().get(0), p.getTelefonos().get(0), p.getDireccions().get(0).getProvincia()); //repository.save(p); System.out.println("*****************************************************************"); String nuevo = services.buscarId(3).getNombre(); assertEquals(antiguo, nuevo); } }
UTF-8
Java
1,689
java
Prueba_Metodo_Editar.java
Java
[ { "context": "\t\tString antiguo = p.getNombre();\r\n\t\tp.setNombre(\"Ramón\");\r\n\t\tSystem.out.println(\"***********************", "end": 1311, "score": 0.9997694492340088, "start": 1306, "tag": "NAME", "value": "Ramón" } ]
null
[]
package com.spring.proyecto2; import static org.junit.Assert.assertNotEquals; import java.util.ArrayList; import java.util.List; import org.hibernate.Hibernate; 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.test.context.junit4.SpringRunner; import com.spring.proyecto2.dao.AgendaDao; import com.spring.proyecto2.model.Contacto; import com.spring.proyecto2.model.Direccion; import com.spring.proyecto2.model.Persona; import com.spring.proyecto2.model.Provincia; import com.spring.proyecto2.model.Telefono; import com.spring.proyecto2.services.AgendaService; import junit.framework.TestCase; @RunWith(SpringRunner.class) @SpringBootTest public class Prueba_Metodo_Editar extends TestCase { @Autowired AgendaService services; @Autowired AgendaDao repository; @Test public void inicializar_Persona() { } @Test public void inicializar_Direccion() { } @Test public void inicializar_Telefono() { } /** * Falla prueba unitaria */ @Test public void prueba_Editar() { Persona p = services.buscarId(3); String antiguo = p.getNombre(); p.setNombre("Ramón"); System.out.println("************************"); services.add(p, p.getDireccions().get(0), p.getTelefonos().get(0), p.getDireccions().get(0).getProvincia()); //repository.save(p); System.out.println("*****************************************************************"); String nuevo = services.buscarId(3).getNombre(); assertEquals(antiguo, nuevo); } }
1,689
0.691351
0.683057
65
23.969231
23.352793
110
false
false
0
0
0
0
0
0
1.246154
false
false
3
078bad96549ccdd7bb1b36de521a8e7d3abcf9b5
18,511,309,085,409
1eb1a37c6beeab0f47be7a9f62f92eda79b76ea5
/app/src/main/java/wiki/scene/basefragmentv2018/MyApp.java
9f10fd532ebef8805fa8104cfc8cbef43dc8ab70
[]
no_license
sceneren/BaseFragmentV2018
https://github.com/sceneren/BaseFragmentV2018
5c4f9eef636a1e93667c08b61a519d2775ecf750
8832e6f66ba631a7abe30e81bd92dd2f04cf86b8
refs/heads/master
2020-03-28T11:54:27.443000
2018-09-11T10:38:18
2018-09-11T10:38:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package wiki.scene.basefragmentv2018; import android.annotation.SuppressLint; import android.content.Context; import com.blankj.utilcode.util.AppUtils; import com.blankj.utilcode.util.CrashUtils; import com.blankj.utilcode.util.LogUtils; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; import wiki.scene.baselibrary.base.BaseApp; import wiki.scene.baselibrary.util.PermissionHelper; public class MyApp extends BaseApp { private RefWatcher refWatcher; @Override public void onCreate() { super.onCreate(); if (LeakCanary.isInAnalyzerProcess(this)) { return; } refWatcher = LeakCanary.install(this); applyStoragePermission(); initCrash(); } @SuppressLint("MissingPermission") private void initCrash() { CrashUtils.init(new CrashUtils.OnCrashListener() { @Override public void onCrash(String crashInfo, Throwable e) { LogUtils.e(crashInfo); AppUtils.relaunchApp(); } }); } private void applyStoragePermission() { PermissionHelper.requestStorage(new PermissionHelper.OnPermissionGrantedListener() { @Override public void onPermissionGranted() { initCrash(); } }); } public static RefWatcher getRefWatcher(Context context) { MyApp application = (MyApp) context.getApplicationContext(); return application.refWatcher; } }
UTF-8
Java
1,535
java
MyApp.java
Java
[]
null
[]
package wiki.scene.basefragmentv2018; import android.annotation.SuppressLint; import android.content.Context; import com.blankj.utilcode.util.AppUtils; import com.blankj.utilcode.util.CrashUtils; import com.blankj.utilcode.util.LogUtils; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; import wiki.scene.baselibrary.base.BaseApp; import wiki.scene.baselibrary.util.PermissionHelper; public class MyApp extends BaseApp { private RefWatcher refWatcher; @Override public void onCreate() { super.onCreate(); if (LeakCanary.isInAnalyzerProcess(this)) { return; } refWatcher = LeakCanary.install(this); applyStoragePermission(); initCrash(); } @SuppressLint("MissingPermission") private void initCrash() { CrashUtils.init(new CrashUtils.OnCrashListener() { @Override public void onCrash(String crashInfo, Throwable e) { LogUtils.e(crashInfo); AppUtils.relaunchApp(); } }); } private void applyStoragePermission() { PermissionHelper.requestStorage(new PermissionHelper.OnPermissionGrantedListener() { @Override public void onPermissionGranted() { initCrash(); } }); } public static RefWatcher getRefWatcher(Context context) { MyApp application = (MyApp) context.getApplicationContext(); return application.refWatcher; } }
1,535
0.661889
0.659283
55
26.90909
21.499491
92
false
false
0
0
0
0
0
0
0.436364
false
false
3
bf9d83d62269b91fb04383096a6c9efd546507d6
16,501,264,407,642
3e62dea783ba41a0895a97cbc8431f24737c0d72
/trunk/src/plm-hmcf/src/main/java/com/sinitek/sirm/busin/plm/entity/IPLMReviewRight.java
d95792be05043aac621fab509bc78c81d144d50b
[]
no_license
zhanght86/plm-hmcf
https://github.com/zhanght86/plm-hmcf
7cf8f8257755e0184c4ceaed0a8bdc7b93a767d5
94de14dc426a290cd9a2650e3c45d86f40831cb4
refs/heads/master
2019-08-31T09:39:27.747000
2017-05-26T00:57:14
2017-05-26T00:57:14
98,046,242
0
2
null
true
2017-07-22T17:12:15
2017-07-22T17:12:15
2017-05-26T01:31:41
2017-05-26T01:31:24
18,133
0
0
0
null
null
null
/** * File Name: IPLMReviewRight.java * * File Desc: 复核权限设置 * * Module Name: 产品管理 * * Module AB: 产品管理 * * Author: MetaDB Framework * * History: 2015-06-23 created by MetaDB Framework */ package com.sinitek.sirm.busin.plm.entity; import com.sinitek.base.metadb.*; /** * 复核权限设置 * * @author MetaDB Framework * @version 1.0 */ public interface IPLMReviewRight extends IMetaObjectImpl { /** * 对应实体名称,取值为PLMREVIEWRIGHT */ public static final String ENTITY_NAME = "PLMREVIEWRIGHT"; /** * 获得用户的orgid属性值 * * @return 用户的orgid属性值 */ public String getOrgid(); /** * 设置用户的orgid属性值 * * @param value 用户的orgid属性值 */ public void setOrgid(String value); /** * 获得名称属性值 * * @return 名称属性值 */ public String getSourceName(); /** * 设置名称属性值 * * @param value 名称属性值 */ public void setSourceName(String value); }
UTF-8
Java
1,125
java
IPLMReviewRight.java
Java
[]
null
[]
/** * File Name: IPLMReviewRight.java * * File Desc: 复核权限设置 * * Module Name: 产品管理 * * Module AB: 产品管理 * * Author: MetaDB Framework * * History: 2015-06-23 created by MetaDB Framework */ package com.sinitek.sirm.busin.plm.entity; import com.sinitek.base.metadb.*; /** * 复核权限设置 * * @author MetaDB Framework * @version 1.0 */ public interface IPLMReviewRight extends IMetaObjectImpl { /** * 对应实体名称,取值为PLMREVIEWRIGHT */ public static final String ENTITY_NAME = "PLMREVIEWRIGHT"; /** * 获得用户的orgid属性值 * * @return 用户的orgid属性值 */ public String getOrgid(); /** * 设置用户的orgid属性值 * * @param value 用户的orgid属性值 */ public void setOrgid(String value); /** * 获得名称属性值 * * @return 名称属性值 */ public String getSourceName(); /** * 设置名称属性值 * * @param value 名称属性值 */ public void setSourceName(String value); }
1,125
0.580645
0.570239
60
15.033334
15.927928
62
false
false
0
0
0
0
0
0
0.116667
false
false
3
f864e74f3c6f56045ad16ee0ae37fa44c6ad985a
35,278,861,425,146
e5396336fd8ce2835641757316219b1c81e8dbc8
/src/main/java/ham/arhat/hash/filter/CloseFilter.java
ddf24e1335679c37aec6287c34b1f4d4c9ecf577
[]
no_license
dalalsunil1986/amhat
https://github.com/dalalsunil1986/amhat
58ebdfc0f605bfddb050be160619c90dfb9e3b83
d910a5cc68a01e36a8d0692a948633aafab4b400
refs/heads/master
2020-06-15T00:48:35.672000
2019-05-06T17:26:09
2019-05-06T17:26:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ham.arhat.hash.filter; import ham.arhat.hash.message.SecretsMessage; import ham.arhat.message.CloseMessage; import ham.arhat.message.TransportMessageType; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.mina.core.filterchain.IoFilterAdapter; import org.apache.mina.core.future.DefaultWriteFuture; import org.apache.mina.core.future.IoFutureListener; import org.apache.mina.core.future.WriteFuture; import org.apache.mina.core.session.IdleStatus; import org.apache.mina.core.session.IoSession; import org.apache.mina.core.write.DefaultWriteRequest; import org.apache.mina.core.write.WriteRequest; import static ham.arhat.message.TransportMessageType.CLOSE_ACK; import static ham.arhat.message.TransportMessageType.CLOSE_FIN; /** * Adds special handling to allow secrets to be sent before closing the connection */ @Slf4j @RequiredArgsConstructor public class CloseFilter extends IoFilterAdapter { private final boolean client; // Close status of the incoming receive channel private static String ATTRIB_RECEIVE_CLOSE = "receiveClose"; // Close status of the outbound send channel private static String ATTRIB_SEND_CLOSE = "sendClose"; @Override public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception { // TODO nextFilter.sessionIdle(session, status); } // Message Handling @Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { if (message instanceof CloseMessage) closeMessageReceived(nextFilter, session, ((CloseMessage) message).getType()); else if (session.getAttribute(ATTRIB_RECEIVE_CLOSE) == null) // Don't forward any messages after receiving a close nextFilter.messageReceived(session, message); } @Override public void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception { // Don't forward close messages or special class messages final Object message = writeRequest.getMessage(); if (!(message instanceof CloseMessage || message instanceof Class)) nextFilter.messageSent(session, writeRequest); } @Override public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception { if (writeRequest.getMessage() == CloseMessage.class) { // Only send the close once. if (session.getAttribute(ATTRIB_SEND_CLOSE) != null) return; writeMessage(nextFilter, session, new CloseMessage(CLOSE_FIN), () -> { // Check someone else didn't jump in. if (session.getAttribute(ATTRIB_SEND_CLOSE) == null) session.setAttribute(ATTRIB_SEND_CLOSE, CLOSE_FIN); }); } else if (session.getAttribute(ATTRIB_SEND_CLOSE) == null) // Don't forward messages after we have started closing the socket. nextFilter.filterWrite(session, writeRequest); } // Close Handling @Override public void inputClosed(NextFilter nextFilter, IoSession session) throws Exception { hardClose(nextFilter, session); } @Override public void sessionClosed(NextFilter nextFilter, IoSession session) throws Exception { hardClose(nextFilter, session); } private void closeMessageReceived(NextFilter nextFilter, IoSession session, TransportMessageType messageType) { switch (messageType) { case CLOSE_FIN: session.setAttribute(ATTRIB_RECEIVE_CLOSE, CLOSE_FIN); // Let the app know that the remote side is closing. nextFilter.inputClosed(session); writeMessage(nextFilter, session, new CloseMessage(CLOSE_ACK), () -> { session.setAttribute(ATTRIB_RECEIVE_CLOSE, CLOSE_ACK); finalizeConnection(nextFilter, session, ATTRIB_SEND_CLOSE); }); break; case CLOSE_ACK: { final TransportMessageType current = (TransportMessageType) session.getAttribute(ATTRIB_SEND_CLOSE); if (current != CLOSE_FIN) { log.error("Protocol Violation, received CLOSE_ACK when current state is: " + current); return; } session.setAttribute(ATTRIB_SEND_CLOSE, CLOSE_ACK); finalizeConnection(nextFilter, session, ATTRIB_RECEIVE_CLOSE); break; } } } private void finalizeConnection(NextFilter nextFilter, IoSession session, String validateAttribute) { if (CLOSE_ACK != session.getAttribute(validateAttribute)) return; // Both sides have acknowledged the close so write out the secrets and close the connection. writeMessage(nextFilter, session, SecretsMessage.class, () -> { // We don't care if the write succeeds we are going to close either way. nextFilter.filterClose(session); }); } private void writeMessage(NextFilter nextFilter, IoSession session, Object message, Runnable callback) { IoFutureListener<WriteFuture> listener = x -> { callback.run(); }; final DefaultWriteFuture future = new DefaultWriteFuture(session); future.addListener(listener); nextFilter.filterWrite(session, new DefaultWriteRequest(message, future)); } private void hardClose(NextFilter nextFilter, IoSession session) { session.setAttribute(ATTRIB_RECEIVE_CLOSE, CLOSE_ACK); session.setAttribute(ATTRIB_SEND_CLOSE, CLOSE_ACK); session.closeNow(); nextFilter.sessionClosed(session); } }
UTF-8
Java
5,842
java
CloseFilter.java
Java
[]
null
[]
package ham.arhat.hash.filter; import ham.arhat.hash.message.SecretsMessage; import ham.arhat.message.CloseMessage; import ham.arhat.message.TransportMessageType; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.mina.core.filterchain.IoFilterAdapter; import org.apache.mina.core.future.DefaultWriteFuture; import org.apache.mina.core.future.IoFutureListener; import org.apache.mina.core.future.WriteFuture; import org.apache.mina.core.session.IdleStatus; import org.apache.mina.core.session.IoSession; import org.apache.mina.core.write.DefaultWriteRequest; import org.apache.mina.core.write.WriteRequest; import static ham.arhat.message.TransportMessageType.CLOSE_ACK; import static ham.arhat.message.TransportMessageType.CLOSE_FIN; /** * Adds special handling to allow secrets to be sent before closing the connection */ @Slf4j @RequiredArgsConstructor public class CloseFilter extends IoFilterAdapter { private final boolean client; // Close status of the incoming receive channel private static String ATTRIB_RECEIVE_CLOSE = "receiveClose"; // Close status of the outbound send channel private static String ATTRIB_SEND_CLOSE = "sendClose"; @Override public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) throws Exception { // TODO nextFilter.sessionIdle(session, status); } // Message Handling @Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { if (message instanceof CloseMessage) closeMessageReceived(nextFilter, session, ((CloseMessage) message).getType()); else if (session.getAttribute(ATTRIB_RECEIVE_CLOSE) == null) // Don't forward any messages after receiving a close nextFilter.messageReceived(session, message); } @Override public void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception { // Don't forward close messages or special class messages final Object message = writeRequest.getMessage(); if (!(message instanceof CloseMessage || message instanceof Class)) nextFilter.messageSent(session, writeRequest); } @Override public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception { if (writeRequest.getMessage() == CloseMessage.class) { // Only send the close once. if (session.getAttribute(ATTRIB_SEND_CLOSE) != null) return; writeMessage(nextFilter, session, new CloseMessage(CLOSE_FIN), () -> { // Check someone else didn't jump in. if (session.getAttribute(ATTRIB_SEND_CLOSE) == null) session.setAttribute(ATTRIB_SEND_CLOSE, CLOSE_FIN); }); } else if (session.getAttribute(ATTRIB_SEND_CLOSE) == null) // Don't forward messages after we have started closing the socket. nextFilter.filterWrite(session, writeRequest); } // Close Handling @Override public void inputClosed(NextFilter nextFilter, IoSession session) throws Exception { hardClose(nextFilter, session); } @Override public void sessionClosed(NextFilter nextFilter, IoSession session) throws Exception { hardClose(nextFilter, session); } private void closeMessageReceived(NextFilter nextFilter, IoSession session, TransportMessageType messageType) { switch (messageType) { case CLOSE_FIN: session.setAttribute(ATTRIB_RECEIVE_CLOSE, CLOSE_FIN); // Let the app know that the remote side is closing. nextFilter.inputClosed(session); writeMessage(nextFilter, session, new CloseMessage(CLOSE_ACK), () -> { session.setAttribute(ATTRIB_RECEIVE_CLOSE, CLOSE_ACK); finalizeConnection(nextFilter, session, ATTRIB_SEND_CLOSE); }); break; case CLOSE_ACK: { final TransportMessageType current = (TransportMessageType) session.getAttribute(ATTRIB_SEND_CLOSE); if (current != CLOSE_FIN) { log.error("Protocol Violation, received CLOSE_ACK when current state is: " + current); return; } session.setAttribute(ATTRIB_SEND_CLOSE, CLOSE_ACK); finalizeConnection(nextFilter, session, ATTRIB_RECEIVE_CLOSE); break; } } } private void finalizeConnection(NextFilter nextFilter, IoSession session, String validateAttribute) { if (CLOSE_ACK != session.getAttribute(validateAttribute)) return; // Both sides have acknowledged the close so write out the secrets and close the connection. writeMessage(nextFilter, session, SecretsMessage.class, () -> { // We don't care if the write succeeds we are going to close either way. nextFilter.filterClose(session); }); } private void writeMessage(NextFilter nextFilter, IoSession session, Object message, Runnable callback) { IoFutureListener<WriteFuture> listener = x -> { callback.run(); }; final DefaultWriteFuture future = new DefaultWriteFuture(session); future.addListener(listener); nextFilter.filterWrite(session, new DefaultWriteRequest(message, future)); } private void hardClose(NextFilter nextFilter, IoSession session) { session.setAttribute(ATTRIB_RECEIVE_CLOSE, CLOSE_ACK); session.setAttribute(ATTRIB_SEND_CLOSE, CLOSE_ACK); session.closeNow(); nextFilter.sessionClosed(session); } }
5,842
0.678535
0.678021
146
39.013699
33.49197
116
false
false
0
0
0
0
0
0
0.712329
false
false
3
959f51b646eec0f8e5186b21eff5887eae357465
36,275,293,826,843
05ba8cb2bac726d44e41eb61531bcd95cd3bc115
/MyTravelingDiary/XingKa/app/src/main/java/com/ruihai/xingka/api/model/XKRepo.java
f8a392ac19511ce2f623385da0b7b6079d35a51b
[ "Apache-2.0" ]
permissive
LegendKe/MyTravelingDiary
https://github.com/LegendKe/MyTravelingDiary
78d75a6c60f1cc548660af63dbfc109becd24866
0bcb2a558fc5eacdae35573b43b03fbb2d46b341
refs/heads/master
2021-01-11T09:17:18.563000
2016-12-22T02:01:54
2016-12-22T02:01:54
77,099,508
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ruihai.xingka.api.model; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Created by zecker on 15/8/11. */ public class XKRepo { @SerializedName("success") private boolean success; @SerializedName("code") private int code; @SerializedName("msg") private String msg; @SerializedName("tagInfo") private List<TagInfo> tagInfo; @SerializedName("addInfo") private List<AddInfo> addInfo; @SerializedName("maybeInfo") private List<MaybeInfo> maybeInfo; @SerializedName("version") private int version; @SerializedName("recommendInfo") private List<RecommendInfo> recommendInfo; @SerializedName("returnGuid") private String returnGuid; @SerializedName("userSearchList") private List<SearchUser> searchUserList; @SerializedName("messageInfo") private List<MessageInfo> messageInfos; @SerializedName("type") private String type; public String getType() { return type; } public void setType(String type) { this.type = type; } public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } public List<MessageInfo> getMessageInfos() { return messageInfos; } public void setMessageInfos(List<MessageInfo> messageInfos) { this.messageInfos = messageInfos; } public List<RecommendInfo> getRecommendInfo() { return recommendInfo; } public void setRecommendInfo(List<RecommendInfo> recommendInfo) { this.recommendInfo = recommendInfo; } public List<MaybeInfo> getMaybeInfo() { return maybeInfo; } public void setMaybeInfo(List<MaybeInfo> maybeInfo) { this.maybeInfo = maybeInfo; } public List<AddInfo> getAddInfo() { return addInfo; } public void setAddInfo(List<AddInfo> addInfo) { this.addInfo = addInfo; } public List<TagInfo> getTagInfo() { return tagInfo; } public void setTagInfo(List<TagInfo> tagInfo) { this.tagInfo = tagInfo; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public String getReturnGuid() { return returnGuid; } public void setReturnGuid(String returnGuid) { this.returnGuid = returnGuid; } public List<SearchUser> getSearchUserList() { return searchUserList; } public void setSearchUserList(List<SearchUser> searchUserList) { this.searchUserList = searchUserList; } }
UTF-8
Java
2,923
java
XKRepo.java
Java
[ { "context": "edName;\n\nimport java.util.List;\n\n/**\n * Created by zecker on 15/8/11.\n */\npublic class XKRepo {\n @Serial", "end": 138, "score": 0.9995698928833008, "start": 132, "tag": "USERNAME", "value": "zecker" } ]
null
[]
package com.ruihai.xingka.api.model; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Created by zecker on 15/8/11. */ public class XKRepo { @SerializedName("success") private boolean success; @SerializedName("code") private int code; @SerializedName("msg") private String msg; @SerializedName("tagInfo") private List<TagInfo> tagInfo; @SerializedName("addInfo") private List<AddInfo> addInfo; @SerializedName("maybeInfo") private List<MaybeInfo> maybeInfo; @SerializedName("version") private int version; @SerializedName("recommendInfo") private List<RecommendInfo> recommendInfo; @SerializedName("returnGuid") private String returnGuid; @SerializedName("userSearchList") private List<SearchUser> searchUserList; @SerializedName("messageInfo") private List<MessageInfo> messageInfos; @SerializedName("type") private String type; public String getType() { return type; } public void setType(String type) { this.type = type; } public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } public List<MessageInfo> getMessageInfos() { return messageInfos; } public void setMessageInfos(List<MessageInfo> messageInfos) { this.messageInfos = messageInfos; } public List<RecommendInfo> getRecommendInfo() { return recommendInfo; } public void setRecommendInfo(List<RecommendInfo> recommendInfo) { this.recommendInfo = recommendInfo; } public List<MaybeInfo> getMaybeInfo() { return maybeInfo; } public void setMaybeInfo(List<MaybeInfo> maybeInfo) { this.maybeInfo = maybeInfo; } public List<AddInfo> getAddInfo() { return addInfo; } public void setAddInfo(List<AddInfo> addInfo) { this.addInfo = addInfo; } public List<TagInfo> getTagInfo() { return tagInfo; } public void setTagInfo(List<TagInfo> tagInfo) { this.tagInfo = tagInfo; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public String getReturnGuid() { return returnGuid; } public void setReturnGuid(String returnGuid) { this.returnGuid = returnGuid; } public List<SearchUser> getSearchUserList() { return searchUserList; } public void setSearchUserList(List<SearchUser> searchUserList) { this.searchUserList = searchUserList; } }
2,923
0.642148
0.640438
133
20.977444
18.118851
69
false
false
0
0
0
0
0
0
0.293233
false
false
3
efb26c997363e6eb89b6dd60bfd96b2937ff012c
4,715,874,124,239
e2d1ad7bfd684f4d49469130e166efd6f47b59af
/common/src/main/java/com/snowbuffer/study/java/common/excel2/parser/HutoolExcelParser.java
0b0a1e81bf71fd9011c58ca430a42fdeea82f3d8
[]
no_license
snowbuffer/jdk-java-basic
https://github.com/snowbuffer/jdk-java-basic
8545aef243c2d0a2749ea888dbe92bec9b49751c
2414167f93569d878b2d802b9c70af906b605c7a
refs/heads/master
2022-12-22T22:10:11.575000
2021-07-06T06:13:38
2021-07-06T06:13:38
172,832,856
0
1
null
false
2022-12-16T04:40:12
2019-02-27T03:04:57
2021-07-06T06:13:46
2022-12-16T04:40:09
3,604
0
1
15
Java
false
false
package com.snowbuffer.study.java.common.excel2.parser; import cn.hutool.poi.excel.ExcelReader; import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.style.StyleUtil; import com.snowbuffer.study.java.common.excel2.ExcelConfigFactory; import com.snowbuffer.study.java.common.excel2.annotation.ExcelColumn; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.IndexedColors; import java.io.File; import java.util.List; import java.util.Map; import java.util.UUID; /** * Description: * * @author cjb * @since 2021-06-10 15:28 */ @Slf4j public class HutoolExcelParser<T> implements ExcelParser<T> { private Class<T> clazz; private Map<String, ExcelColumn> headMap; public HutoolExcelParser(Class<T> clazz) { this.clazz = clazz; this.headMap = ExcelConfigFactory.getExcelColumnConfig(clazz); } @Override public List<T> parse(String filePath) { ExcelReader excelReader = ExcelUtil.getReader(filePath, 0); for (Map.Entry<String, ExcelColumn> entry : headMap.entrySet()) { String fieldName = entry.getKey(); ExcelColumn columnConfig = entry.getValue(); excelReader.addHeaderAlias(columnConfig.columnName(), fieldName); } return excelReader.read(0, 1, Integer.MAX_VALUE, this.clazz); } @Override public File write(List<T> dataList) { String tempAbsolutePath = touchNewFile(System.getProperty("user.dir") + File.separator + "tmp"); return doWrite(dataList, tempAbsolutePath); } private File doWrite(List<T> dataList, String tempAbsolutePath) { ExcelWriter writer = ExcelUtil.getWriter(tempAbsolutePath); // CellStyle style = writer.getStyleSet().getHeadCellStyle(); CellStyle cellStyle = writer.getStyleSet().getCellStyle(); StyleUtil.setBorder(cellStyle, BorderStyle.NONE, IndexedColors.BLACK); int counter = 0; for (Map.Entry<String, ExcelColumn> entry : headMap.entrySet()) { String fieldName = entry.getKey(); ExcelColumn columnConfig = entry.getValue(); writer.addHeaderAlias(fieldName, columnConfig.columnName()); int width = columnConfig.width(); if (width != -1) { writer.setColumnWidth(counter++, width); } } writer.write(dataList, true); writer.setRowHeight(0, 30); writer.close(); return new File(tempAbsolutePath); } private String touchNewFile(String dir) { File srcFile = new File(dir); if (!srcFile.exists()) { srcFile.mkdirs(); } return dir + File.separator + UUID.randomUUID() + ".xlsx"; } }
UTF-8
Java
2,856
java
HutoolExcelParser.java
Java
[ { "context": "java.util.UUID;\n\n/**\n * Description:\n *\n * @author cjb\n * @since 2021-06-10 15:28\n */\n@Slf4j\npublic clas", "end": 663, "score": 0.9996575117111206, "start": 660, "tag": "USERNAME", "value": "cjb" } ]
null
[]
package com.snowbuffer.study.java.common.excel2.parser; import cn.hutool.poi.excel.ExcelReader; import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.style.StyleUtil; import com.snowbuffer.study.java.common.excel2.ExcelConfigFactory; import com.snowbuffer.study.java.common.excel2.annotation.ExcelColumn; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.IndexedColors; import java.io.File; import java.util.List; import java.util.Map; import java.util.UUID; /** * Description: * * @author cjb * @since 2021-06-10 15:28 */ @Slf4j public class HutoolExcelParser<T> implements ExcelParser<T> { private Class<T> clazz; private Map<String, ExcelColumn> headMap; public HutoolExcelParser(Class<T> clazz) { this.clazz = clazz; this.headMap = ExcelConfigFactory.getExcelColumnConfig(clazz); } @Override public List<T> parse(String filePath) { ExcelReader excelReader = ExcelUtil.getReader(filePath, 0); for (Map.Entry<String, ExcelColumn> entry : headMap.entrySet()) { String fieldName = entry.getKey(); ExcelColumn columnConfig = entry.getValue(); excelReader.addHeaderAlias(columnConfig.columnName(), fieldName); } return excelReader.read(0, 1, Integer.MAX_VALUE, this.clazz); } @Override public File write(List<T> dataList) { String tempAbsolutePath = touchNewFile(System.getProperty("user.dir") + File.separator + "tmp"); return doWrite(dataList, tempAbsolutePath); } private File doWrite(List<T> dataList, String tempAbsolutePath) { ExcelWriter writer = ExcelUtil.getWriter(tempAbsolutePath); // CellStyle style = writer.getStyleSet().getHeadCellStyle(); CellStyle cellStyle = writer.getStyleSet().getCellStyle(); StyleUtil.setBorder(cellStyle, BorderStyle.NONE, IndexedColors.BLACK); int counter = 0; for (Map.Entry<String, ExcelColumn> entry : headMap.entrySet()) { String fieldName = entry.getKey(); ExcelColumn columnConfig = entry.getValue(); writer.addHeaderAlias(fieldName, columnConfig.columnName()); int width = columnConfig.width(); if (width != -1) { writer.setColumnWidth(counter++, width); } } writer.write(dataList, true); writer.setRowHeight(0, 30); writer.close(); return new File(tempAbsolutePath); } private String touchNewFile(String dir) { File srcFile = new File(dir); if (!srcFile.exists()) { srcFile.mkdirs(); } return dir + File.separator + UUID.randomUUID() + ".xlsx"; } }
2,856
0.669468
0.660364
88
31.454546
26.367985
104
false
false
0
0
0
0
0
0
0.670455
false
false
3
0bbf7b468f7b6efb70a0d3e715b014d6d253317a
10,393,820,856,992
0d50d57140a6d5d8f6ace3361496f4f0b4e1d5bb
/src/com/example/demo/pass/algorithm/recursion/T_9714.java
99974d2c35ec20dcff733f2f72fe10e6abb2350e
[]
no_license
My1deA/Algorithm-2006
https://github.com/My1deA/Algorithm-2006
3870bd01577d0c52664c328874d8cd9261f0be7f
85f628ba3494bcde33c3942f254454a7396e5133
refs/heads/master
2023-06-27T11:07:57.352000
2021-07-31T14:44:01
2021-07-31T14:44:01
269,584,997
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo.pass.algorithm.recursion; // 9714 圣诞礼物 recursion /*Description 圣诞节到了,圣诞老人给 N 个小朋友准备了 M 个同样的礼物。每个小朋友有一个袜子(袜子不编号,无区别,认为袜子都相同),圣诞老人将 M 个礼物装到 N 个袜子中的放法有多少种? 注意: 1)若M=7 N=3,那么5,1,1的放法和1,5,1的放法算是同一种装法。 2)允许袜子为空。 3)M和N无大小关系,M可以比N大,M也可以比N小。 Input 输入数据包含两个整数 M,N。1<=M,N<=50。 M在前,N在后,中间空格。 Output 输出共有几种不同的放法。 Sample Input Sample Output 7 3 8 解法一:按书上算法求"对正整数n进行划分,最大加数不超过m的划分个数",因为此题"对正整数n进行划分,不超过m项的划分个数"与之是相等的. 解法二:设d[i][j]表示i划分为j份,视为i个球放入j个盒子的方法数。盒子是无差别的。有如下递推关系: (1)j个盒子有空的,d[i][j] = d[i][j-1],把某一空盒子拿出来放一边; (2)j个盒子都不空,d[i][j] = d[i-j][j],每个盒子扣掉1个球; (3)d[i][0]=0,i>=1; d[i][1]=1,i>=1; d[0][j]=1, j>=1 因此:d[i][j] = d[i][j-1]+ d[i-j][j]。 n划分为m份的划分数为d[n][m]。*/ public class T_9714 { public static int put(int i,int j){ // 没有礼物 或者 没人分 if(i < 1 || j < 1){ return 0; } // 只有一个礼物 或者 只有一个人分 if(i==1 || j==1){ return 1; } // 礼物 比 人少 (允许礼物为空) if(i<j){ return put(i,i); } //礼物每人一个 + 少一个人的礼物分总数 if(i==j){ return put(i,j-1)+1; } //少一个人的礼物分总数 + 每个人都拿一份 return put(i,j-1)+put(i-j,j); } public static void main(String[] args) { int n=7,m=3; System.out.println(put(n,m)); } }
UTF-8
Java
2,245
java
T_9714.java
Java
[]
null
[]
package com.example.demo.pass.algorithm.recursion; // 9714 圣诞礼物 recursion /*Description 圣诞节到了,圣诞老人给 N 个小朋友准备了 M 个同样的礼物。每个小朋友有一个袜子(袜子不编号,无区别,认为袜子都相同),圣诞老人将 M 个礼物装到 N 个袜子中的放法有多少种? 注意: 1)若M=7 N=3,那么5,1,1的放法和1,5,1的放法算是同一种装法。 2)允许袜子为空。 3)M和N无大小关系,M可以比N大,M也可以比N小。 Input 输入数据包含两个整数 M,N。1<=M,N<=50。 M在前,N在后,中间空格。 Output 输出共有几种不同的放法。 Sample Input Sample Output 7 3 8 解法一:按书上算法求"对正整数n进行划分,最大加数不超过m的划分个数",因为此题"对正整数n进行划分,不超过m项的划分个数"与之是相等的. 解法二:设d[i][j]表示i划分为j份,视为i个球放入j个盒子的方法数。盒子是无差别的。有如下递推关系: (1)j个盒子有空的,d[i][j] = d[i][j-1],把某一空盒子拿出来放一边; (2)j个盒子都不空,d[i][j] = d[i-j][j],每个盒子扣掉1个球; (3)d[i][0]=0,i>=1; d[i][1]=1,i>=1; d[0][j]=1, j>=1 因此:d[i][j] = d[i][j-1]+ d[i-j][j]。 n划分为m份的划分数为d[n][m]。*/ public class T_9714 { public static int put(int i,int j){ // 没有礼物 或者 没人分 if(i < 1 || j < 1){ return 0; } // 只有一个礼物 或者 只有一个人分 if(i==1 || j==1){ return 1; } // 礼物 比 人少 (允许礼物为空) if(i<j){ return put(i,i); } //礼物每人一个 + 少一个人的礼物分总数 if(i==j){ return put(i,j-1)+1; } //少一个人的礼物分总数 + 每个人都拿一份 return put(i,j-1)+put(i-j,j); } public static void main(String[] args) { int n=7,m=3; System.out.println(put(n,m)); } }
2,245
0.494182
0.459274
61
22.950819
21.294519
97
false
false
0
0
0
0
0
0
0.47541
false
false
3
f677d56e4685114ca7fe0136b4cbbfcc655a0b7b
12,549,894,467,586
00027bf3f90bca5c33b9b17f8c8266b8285b17a1
/Spring/SpringJdbc_Maven/springjdbc/src/main/java/com/nextbox/jdbc/springjdbc/dao/NamedParameterJdbcDaoSupportImpl.java
837478c55373218897d25c77244f3ff7a4424176
[]
no_license
nextbox/Labs
https://github.com/nextbox/Labs
12c4567f0d12449d8b9fbb31e92c26bb614b6a8b
3b11e6bbd576c90ff3582f944fb064c0f0abb2d8
refs/heads/master
2020-04-16T12:42:08.700000
2014-08-25T02:48:30
2014-08-25T02:48:30
13,454,172
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nextbox.jdbc.springjdbc.dao; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcDaoSupport; import org.springframework.stereotype.Repository; @Repository public class NamedParameterJdbcDaoSupportImpl extends NamedParameterJdbcDaoSupport { @Autowired private DataSource dataSource; public void getCircleCount(){ String sql="select count(*) from circle"; System.out.println("From NamedParameterJdbcDaoSupportImpl, total number of circle:" +getJdbcTemplate().queryForObject(sql, Integer.class)); } }
UTF-8
Java
636
java
NamedParameterJdbcDaoSupportImpl.java
Java
[]
null
[]
package com.nextbox.jdbc.springjdbc.dao; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcDaoSupport; import org.springframework.stereotype.Repository; @Repository public class NamedParameterJdbcDaoSupportImpl extends NamedParameterJdbcDaoSupport { @Autowired private DataSource dataSource; public void getCircleCount(){ String sql="select count(*) from circle"; System.out.println("From NamedParameterJdbcDaoSupportImpl, total number of circle:" +getJdbcTemplate().queryForObject(sql, Integer.class)); } }
636
0.81761
0.81761
21
29.285715
29.494379
85
false
false
0
0
0
0
0
0
1.142857
false
false
3
b3ecf89e6d638e019bbdabf8ee9a05fc6a9bb734
37,082,747,658,598
c28a6f2c8ce8f986b5c22fd602e7349e68af8f9c
/android/frameworks/base/core/java/android/os/RecoverySignature.java
f9955a7500070e504e045f1091bbbd4847acfc4d
[ "LicenseRef-scancode-unicode", "Apache-2.0" ]
permissive
BPI-SINOVOIP/BPI-1296-Android6
https://github.com/BPI-SINOVOIP/BPI-1296-Android6
d6ade74367696c644a1b053b308d164ba53d3f8c
1ba45ab7555440dc3721d6acda3e831e7a3e3ff3
refs/heads/master
2023-02-24T18:23:02.110000
2019-08-09T04:01:16
2019-08-09T04:01:16
166,341,197
0
5
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C) 2014 Realtek Semiconductor Corp. * Author: stanely * History: * 2014.04.21 : First draft */ package android.os; import android.util.TypedValue; import android.util.Log; import java.io.File; import java.io.FileOutputStream; import java.io.BufferedOutputStream; import java.nio.charset.Charset; import java.util.Arrays; /* The conten of file should look like below: * boot-recovery * recovery * --update_package=CACHE:update.zip * --locale=en_GB * * --wipe_data * --wipe_cache */ /** * Implement this class for our purpose * @hide */ public class RecoverySignature { public static String TAG = "RecoverySignature"; private byte[] command; private byte[] status; private byte[] recovery; private File outFile; public RecoverySignature(String filename) { if(filename.length() != 0) { outFile = new File(filename); } command = new byte[32]; status = new byte[32]; recovery = new byte[1024]; // TODO: too big? } public Boolean writeRecoverySignature(Boolean flag) { Log.d(TAG, "call writeRecoverySignature, flag = " + flag); if(flag == true) { try { BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(outFile)); Log.d(TAG, "1) call writeRecoverySignature, flag = " + flag); if(bos != null) { Log.d(TAG, "2) call writeRecoverySignature, flag = " + flag); bos.write(command, 0, command.length); bos.write(status, 0, status.length); bos.write(recovery, 0, recovery.length); //bos.write(command, 0, 32); //bos.write(status, 0, 32); //bos.write(recovery, 0, 1024); bos.flush(); } } catch (Exception e) { e.printStackTrace(); } } return true; } // total 32 bytes length public void setRecoverySignatureCommand(String cmd) { Log.d(TAG, "call setRecoverySignatureCommand, cmd = " + cmd); //Log.d(TAG, "call setRecoverySignatureCommand, command.length = " + command.length); for(int i = 0; i < cmd.getBytes().length; i++) { command[i] = cmd.getBytes()[i]; } //Log.d(TAG, "call setRecoverySignatureCommand, command = " + new String(command) + ", command.length = " + command.length); } // total 32 bytes length, so far we don't care the content public void setRecoverySignatureStatus(String tstatus) { Log.d(TAG, "call setRecoverySignatureStatus, tstatus = " + tstatus); //Log.d(TAG, "call setRecoverySignatureStatus, status.length = " + status.length); //for(int i = 0; i < tstatus.getBytes().length; i++) { for(int i = 0; i < 32; i++) { status[i] = '1'; } //Log.d(TAG, "call setRecoverySignatureStatus, status = " + new String(status) + ", status.length = " + status.length); } // total 1024 bytes length public void setRecoverySignatureRecovery(String recoveryStr) { Log.d(TAG, "call setRecoverySignatureRecovery, recoveryStr = " + recoveryStr); //Log.d(TAG, "call setRecoverySignatureRecovery, recovery.length = " + recovery.length); for(int i = 0; i < recoveryStr.getBytes().length; i++) { recovery[i] = recoveryStr.getBytes()[i]; } //Log.d(TAG, "call setRecoverySignatureRecovery, recovery = " + new String(recovery) + ", recovery.legnth = " + recovery.length); } }
UTF-8
Java
3,633
java
RecoverySignature.java
Java
[ { "context": "ht (C) 2014 Realtek Semiconductor Corp.\n * Author: stanely\n * History:\n * 2014.04.21 : First draft\n */\n", "end": 71, "score": 0.9720599055290222, "start": 64, "tag": "USERNAME", "value": "stanely" } ]
null
[]
/* * Copyright (C) 2014 Realtek Semiconductor Corp. * Author: stanely * History: * 2014.04.21 : First draft */ package android.os; import android.util.TypedValue; import android.util.Log; import java.io.File; import java.io.FileOutputStream; import java.io.BufferedOutputStream; import java.nio.charset.Charset; import java.util.Arrays; /* The conten of file should look like below: * boot-recovery * recovery * --update_package=CACHE:update.zip * --locale=en_GB * * --wipe_data * --wipe_cache */ /** * Implement this class for our purpose * @hide */ public class RecoverySignature { public static String TAG = "RecoverySignature"; private byte[] command; private byte[] status; private byte[] recovery; private File outFile; public RecoverySignature(String filename) { if(filename.length() != 0) { outFile = new File(filename); } command = new byte[32]; status = new byte[32]; recovery = new byte[1024]; // TODO: too big? } public Boolean writeRecoverySignature(Boolean flag) { Log.d(TAG, "call writeRecoverySignature, flag = " + flag); if(flag == true) { try { BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(outFile)); Log.d(TAG, "1) call writeRecoverySignature, flag = " + flag); if(bos != null) { Log.d(TAG, "2) call writeRecoverySignature, flag = " + flag); bos.write(command, 0, command.length); bos.write(status, 0, status.length); bos.write(recovery, 0, recovery.length); //bos.write(command, 0, 32); //bos.write(status, 0, 32); //bos.write(recovery, 0, 1024); bos.flush(); } } catch (Exception e) { e.printStackTrace(); } } return true; } // total 32 bytes length public void setRecoverySignatureCommand(String cmd) { Log.d(TAG, "call setRecoverySignatureCommand, cmd = " + cmd); //Log.d(TAG, "call setRecoverySignatureCommand, command.length = " + command.length); for(int i = 0; i < cmd.getBytes().length; i++) { command[i] = cmd.getBytes()[i]; } //Log.d(TAG, "call setRecoverySignatureCommand, command = " + new String(command) + ", command.length = " + command.length); } // total 32 bytes length, so far we don't care the content public void setRecoverySignatureStatus(String tstatus) { Log.d(TAG, "call setRecoverySignatureStatus, tstatus = " + tstatus); //Log.d(TAG, "call setRecoverySignatureStatus, status.length = " + status.length); //for(int i = 0; i < tstatus.getBytes().length; i++) { for(int i = 0; i < 32; i++) { status[i] = '1'; } //Log.d(TAG, "call setRecoverySignatureStatus, status = " + new String(status) + ", status.length = " + status.length); } // total 1024 bytes length public void setRecoverySignatureRecovery(String recoveryStr) { Log.d(TAG, "call setRecoverySignatureRecovery, recoveryStr = " + recoveryStr); //Log.d(TAG, "call setRecoverySignatureRecovery, recovery.length = " + recovery.length); for(int i = 0; i < recoveryStr.getBytes().length; i++) { recovery[i] = recoveryStr.getBytes()[i]; } //Log.d(TAG, "call setRecoverySignatureRecovery, recovery = " + new String(recovery) + ", recovery.legnth = " + recovery.length); } }
3,633
0.588494
0.574181
105
33.580952
30.631693
137
false
false
0
0
0
0
0
0
0.885714
false
false
3
6f8a57c7deb728ae2b67593adb65f60679895775
37,443,524,904,773
7f8ad78a6d63a94c4ae5a45f2eb8b14456201b90
/qq/src/main/java/com/handsome/didi/Bean/Find.java
dc776022f48bda4a3702e3f4b1c6907bb463ceb1
[]
no_license
ZSCDumin/YaNi
https://github.com/ZSCDumin/YaNi
4541f31f517988c737a77f9a5cd42713793168aa
e0043053b0a60b64aaa339300285372157198edd
refs/heads/master
2021-05-08T05:37:57.958000
2017-09-20T10:44:38
2017-09-20T10:44:38
106,506,917
2
0
null
true
2017-10-11T04:47:34
2017-10-11T04:47:34
2017-09-27T01:53:10
2017-09-20T10:47:32
48,007
0
0
0
null
null
null
package com.handsome.didi.Bean; import java.util.List; import cn.bmob.v3.BmobObject; /** * Created by handsome on 2016/4/14. */ public class Find extends BmobObject { //店铺ID public String S_OID; //用户发表内容 public String user_post; //用户名 public String user_name; //用户发表主题 public String user_theme; //发表展示图 public List<String> user_pic_url; //用户浏览 public int user_scan; //发现类型,0-用户发现 1-编辑推荐 public int type; //发现类型 public interface TYPE { int TYPE_USER = 0x00; int TYPE_EDIT = 0x01; } //编辑推荐大标题 public List<String> big_title; //编辑推荐小标题 public List<String> small_title; }
UTF-8
Java
789
java
Find.java
Java
[ { "context": "\n\nimport cn.bmob.v3.BmobObject;\n\n/**\n * Created by handsome on 2016/4/14.\n */\npublic class Find extends BmobO", "end": 114, "score": 0.9995567798614502, "start": 106, "tag": "USERNAME", "value": "handsome" } ]
null
[]
package com.handsome.didi.Bean; import java.util.List; import cn.bmob.v3.BmobObject; /** * Created by handsome on 2016/4/14. */ public class Find extends BmobObject { //店铺ID public String S_OID; //用户发表内容 public String user_post; //用户名 public String user_name; //用户发表主题 public String user_theme; //发表展示图 public List<String> user_pic_url; //用户浏览 public int user_scan; //发现类型,0-用户发现 1-编辑推荐 public int type; //发现类型 public interface TYPE { int TYPE_USER = 0x00; int TYPE_EDIT = 0x01; } //编辑推荐大标题 public List<String> big_title; //编辑推荐小标题 public List<String> small_title; }
789
0.619259
0.595556
37
17.243244
12.749998
38
false
false
0
0
0
0
0
0
0.378378
false
false
3
ee52a0498b0a1190f34e895e801ef8b6df2ed1f2
35,278,861,415,590
3cc75c002f0dafa70a19e635864d92138c735654
/dt-business/business-web/src/main/java/com/fight/dt/business/web/controller/OptionalShareController.java
7c2f9355e28563c99de65d9f8908411061569f3e
[]
no_license
masterzxt/team
https://github.com/masterzxt/team
171f87790be74f385acbaca8dd192f8bb9cf9bf0
bd9849f6bc8765137734a16c898b36069e84973e
refs/heads/master
2020-12-02T18:11:36.111000
2017-07-29T05:27:45
2017-07-29T05:27:45
96,491,028
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fight.dt.business.web.controller; import com.fight.dt.business.common.beans.OptionalShare; import com.fight.dt.business.common.beans.User; import com.fight.dt.business.common.core.MsgEnum; import com.fight.dt.business.service.OptionalShareService; import com.fight.dt.business.service.impl.DtSpringSecurityService; import io.swagger.annotations.Api; import org.apache.zookeeper.Op; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; import java.util.List; /** * Created by zhangwei on 17/7/27. */ @RestController("optionalShareController") @RequestMapping("/api/opt") @Api("OptionalShare") public class OptionalShareController { private static final Logger logger = LoggerFactory.getLogger(OptionalShareController.class); @Resource private OptionalShareService optionalShareService; @Resource private DtSpringSecurityService dtSpringSecurityService; @RequestMapping("/save") @PreAuthorize("isAuthenticated()") public Map<String, Object> saveOptionalShare(String shareId) { User user = dtSpringSecurityService.getUser(); Map<String, Object> resultMap = new HashMap<>(); OptionalShare optionalShare = new OptionalShare(); optionalShare.setShareId(shareId); optionalShare.setUserId(user.getId()); optionalShare.setStatus("1"); optionalShare.setOperator(user.getNickname()); optionalShareService.insert(optionalShare); resultMap.put("code", MsgEnum.SUCCESS.getCode()); resultMap.put("msg", "save optional share success !"); return resultMap; } @RequestMapping("/lists") @PreAuthorize("isAuthenticated()") public Map<String, Object> getOptionShareList() { Map<String, Object> resultMap = new HashMap<>(); List<OptionalShare> optionalShareList = optionalShareService.getByUserId(dtSpringSecurityService.getUser().getId()); for (OptionalShare optionalShare : optionalShareList) { optionalShareService.findShareDetail(optionalShare); } resultMap.put("code", MsgEnum.SUCCESS.getCode()); resultMap.put("result", optionalShareList); resultMap.put("msg", "get option share list success !"); return resultMap; } }
UTF-8
Java
2,640
java
OptionalShareController.java
Java
[ { "context": "til.Map;\nimport java.util.List;\n\n/**\n * Created by zhangwei on 17/7/27.\n */\n@RestController(\"optionalShareCon", "end": 900, "score": 0.9987905621528625, "start": 892, "tag": "USERNAME", "value": "zhangwei" } ]
null
[]
package com.fight.dt.business.web.controller; import com.fight.dt.business.common.beans.OptionalShare; import com.fight.dt.business.common.beans.User; import com.fight.dt.business.common.core.MsgEnum; import com.fight.dt.business.service.OptionalShareService; import com.fight.dt.business.service.impl.DtSpringSecurityService; import io.swagger.annotations.Api; import org.apache.zookeeper.Op; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; import java.util.List; /** * Created by zhangwei on 17/7/27. */ @RestController("optionalShareController") @RequestMapping("/api/opt") @Api("OptionalShare") public class OptionalShareController { private static final Logger logger = LoggerFactory.getLogger(OptionalShareController.class); @Resource private OptionalShareService optionalShareService; @Resource private DtSpringSecurityService dtSpringSecurityService; @RequestMapping("/save") @PreAuthorize("isAuthenticated()") public Map<String, Object> saveOptionalShare(String shareId) { User user = dtSpringSecurityService.getUser(); Map<String, Object> resultMap = new HashMap<>(); OptionalShare optionalShare = new OptionalShare(); optionalShare.setShareId(shareId); optionalShare.setUserId(user.getId()); optionalShare.setStatus("1"); optionalShare.setOperator(user.getNickname()); optionalShareService.insert(optionalShare); resultMap.put("code", MsgEnum.SUCCESS.getCode()); resultMap.put("msg", "save optional share success !"); return resultMap; } @RequestMapping("/lists") @PreAuthorize("isAuthenticated()") public Map<String, Object> getOptionShareList() { Map<String, Object> resultMap = new HashMap<>(); List<OptionalShare> optionalShareList = optionalShareService.getByUserId(dtSpringSecurityService.getUser().getId()); for (OptionalShare optionalShare : optionalShareList) { optionalShareService.findShareDetail(optionalShare); } resultMap.put("code", MsgEnum.SUCCESS.getCode()); resultMap.put("result", optionalShareList); resultMap.put("msg", "get option share list success !"); return resultMap; } }
2,640
0.745076
0.742045
66
39
24.956326
124
false
false
0
0
0
0
0
0
0.742424
false
false
3
788ac351beb8c666f67fcee10d4f200e7ffc4555
38,293,928,430,830
d1efa11ed0337e95b740a6e6f75bdbadc0136e0b
/src/main/java/com/generic/file/parser/parser/processor/CSVFileParserProcessor.java
5e021a4e8aae2e82c22b6c7d3d4a135eda050277
[]
no_license
rahuldcosta/generic-file-parser
https://github.com/rahuldcosta/generic-file-parser
9897f9eb85101176a144c46edf4f2ff5a5e9174d
7ecac6a64938d29ff853ff6d0e62a8fbe5a3e9a2
refs/heads/main
2023-01-14T15:55:36.091000
2020-11-24T08:55:32
2020-11-24T08:55:32
315,573,812
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.generic.file.parser.parser.processor; import com.generic.file.parser.compressor.Compressor; import com.generic.file.parser.encoder.Encoder; import com.generic.file.parser.encryptor.Encryptor; import com.generic.file.parser.parser.CSVFileParser; import com.generic.file.parser.parser.Parser; public class CSVFileParserProcessor implements Parser<CSVFileParser> { @Override public CSVFileParser getParser(String fileName, String filePath, Compressor compressor, Encryptor encryptor, Encoder encoder) { return CSVFileParser.Builder.newInstance(fileName, filePath) .withCompressor(compressor) .withEncoder(encoder) .withEncryptor(encryptor) .build(); } }
UTF-8
Java
749
java
CSVFileParserProcessor.java
Java
[]
null
[]
package com.generic.file.parser.parser.processor; import com.generic.file.parser.compressor.Compressor; import com.generic.file.parser.encoder.Encoder; import com.generic.file.parser.encryptor.Encryptor; import com.generic.file.parser.parser.CSVFileParser; import com.generic.file.parser.parser.Parser; public class CSVFileParserProcessor implements Parser<CSVFileParser> { @Override public CSVFileParser getParser(String fileName, String filePath, Compressor compressor, Encryptor encryptor, Encoder encoder) { return CSVFileParser.Builder.newInstance(fileName, filePath) .withCompressor(compressor) .withEncoder(encoder) .withEncryptor(encryptor) .build(); } }
749
0.740988
0.740988
18
40.611111
31.150421
131
false
false
0
0
0
0
0
0
0.666667
false
false
3
63693c725278f79ffb3ab17299b1516532de0cdf
36,739,150,280,289
f6a1d03a5273d981de7f08a86d5f91d4ff42311c
/src/dev/stockanalyzer/gui/StockGUI.java
5bde732c65d2747b5e31abc28e1398e1c194cb96
[]
no_license
asarow/stockanalyzer
https://github.com/asarow/stockanalyzer
2601afb38ee6a68c1314911159d1bf10fec26e4a
4b5a9dfcd21066bda3c1ca0d2c2d83cc94a0520f
refs/heads/master
2020-05-19T22:11:03.190000
2016-02-19T18:33:48
2016-02-19T18:33:48
39,865,985
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dev.stockanalyzer.gui; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTable; import javax.swing.JTabbedPane; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JRadioButton; import javax.swing.ButtonGroup; import javax.swing.JFileChooser; import java.util.*; import java.io.*; import dev.stockanalyzer.pulldata.DataExtractor; /** * This class builds the GUI for the stock analyzer and contains accessors * for use in the model view controller class. * * @author Amandeep Sarow */ public class StockGUI extends JFrame { private JPanel northPanel = new JPanel(); private JPanel centerPanel = new JPanel(new GridLayout(DataExtractor .getDataSize(), 1)); private JPanel southPanel = new JPanel(); private JPanel eastPanel = new JPanel(); private JPanel isPanel, bsPanel, cfPanel; private JTextField tickerField = new JTextField("AAPL", 4); private JTabbedPane pane; private JRadioButton annual, quarter; private JButton tickerButton, buildFinancialsButton, exportButton, fileButton; private JLabel[] stockLabels = new JLabel[DataExtractor.getDataSize()*2]; private JLabel[] isLabels = new JLabel[150]; private JLabel[] bsLabels = new JLabel[200]; private JLabel[] cfLabels = new JLabel[150]; private JFrame backgroundFrame; private File file; private int numOfPeriods = 4; private boolean activeFrame = false; private final int x = 450, y = 300, bgX = 850, bgY = 300; private final String ANNUAL = "annual", QUARTERLY = "quarterly"; private final String[] headers = {"Operating Expenses", "Income from Continuing Operations", "Non-recurring Events", "Assets", "Current Assets", "Liabilities", "Current Liabilities", "Stockholders'" + " Equity", "Operating Activities, Cash" + " Flows Provided By or Used In", "Investing Activities, Cash Flows" + " Provided By or Used In", "Financing" + " Activities, Cash Flows Provided By" + " or Used In"}; /** Public constructor for creation of the GUI */ public StockGUI() { setTitle("Financial Data Extractor v1.0"); setSize(x, y); setLocation(400,300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); add(northPanel, BorderLayout.NORTH); add(centerPanel); add(eastPanel, BorderLayout.EAST); addNorthComponents(); addCenterComponents(); addEastComponents(); } /** * Displays the stock labels and stock data. This method is called inside * the StockModelViewController class. * * @param stockData an array containing various stock information to be * displayed. */ public void displayStockData(String[] stockData) { for (int i = 0; i < stockLabels.length; i++) { if (i%2 != 0) stockLabels[i].setText(stockData[i/2]); } } /** * Displays the income statement, balance sheet, and statement of cash * flows in a new window. */ public void displayFinancialStatementsData (ArrayList<ArrayList<String>> is, ArrayList<ArrayList<String>> bs, ArrayList<ArrayList<String>> cf) { /* numOfPeriods represents the number of columns needed to display the financial data. */ if (getSelectedButton().equals(ANNUAL)) { numOfPeriods = 3; } else if (getSelectedButton().equals(QUARTERLY)) { numOfPeriods = 4; } /* To ensure both frames are closed when the user hits the 'X' button, activeFrame is set to true indicating there are multuple windows open */ activeFrame = true; backgroundFrame.setVisible(true); backgroundFrame.setLocation(bgX, bgY); /* The ability to save and export is only available if the user has built the financial statements */ fileButton.setEnabled(true); exportButton.setEnabled(true); // Methods to display the data displayIncomeStatement(is); displayBalanceSheet(bs); displayCashFlows(cf); } /** * Checks if an existing financial statement window is currently * running. * * @return true if a GUI is currently open, false otherwise. */ public boolean isFrameActive() { return activeFrame; } /** * Closes the existing financial statement window. */ public void closeRunningFrame() { backgroundFrame.dispatchEvent(new WindowEvent(backgroundFrame, WindowEvent.WINDOW_CLOSING)); activeFrame = false; } /** * Takes an ActionListener parameter from the model view controller and * updates the GUI with financial statement information for a given stock * ticker. * * @param financialButtonListener an ActionListener for the Build * Financials button from the mvc. */ public void getFinancialData(ActionListener financialButtonListener) { buildFinancialsButton.addActionListener(financialButtonListener); } /** * Takes an ActionListener paramter from the model view controller and * stores the user-selected save path from the GUI. * *@param fileButtonListener an ActonListener for the Save As button * from the mvc. */ public void findSavePath(ActionListener fileButtonListener) { fileButton.addActionListener(fileButtonListener); } /** * Takes an ActionListener paramter from the model view controller and * stores the user-selected exports the financial data to the save path. * *@param exportButtonListener an ActonListener for the export button * from the mvc. */ public void exportFinancialData(ActionListener exportButtonListener) { exportButton.addActionListener(exportButtonListener); } /** * Takes an ActionListener parameter from the model view controller and * updates the stock data for a given stock ticker when the 'GO!' button * is pressed. * * @param tickerButtonListener an ActionListener for the GO! button from * the mvc. */ public void getStockData(ActionListener tickerButtonListener) { tickerButton.addActionListener(tickerButtonListener); } /** * Getter for the stock ticker symbol input by the user. * * @return the stock ticker provided as input by the user. */ public String getTicker() { return tickerField.getText(); } /** * Getter which retrieves the financial statement data directly from the * GUI. * * @return data from the income statement, balance sheet, and statement * of cash flows. */ public ArrayList<ArrayList<String>> getFinancialStatementsData() { ArrayList<ArrayList<String>> data = new ArrayList<ArrayList<String>>(); // empty placeholders ArrayList<String> isHolder = new ArrayList<String>(); ArrayList<String> bsHolder = new ArrayList<String>(); ArrayList<String> cfHolder = new ArrayList<String>(); data.add(isHolder); data.add(bsHolder); data.add(cfHolder); for (int i = 0; i < isLabels.length; i++) { data.get(0).add(isLabels[i].getText()); } for (int i = 0; i < bsLabels.length; i++) { data.get(1).add(bsLabels[i].getText()); } for (int i = 0; i < cfLabels.length; i++) { data.get(2).add(cfLabels[i].getText()); } /* Since the data has been slightly modified for viewing purposes (i.e. a new line after each financial statement header), for exporting to excel, the structure of the data needs to be consistent which is why the data is retrieved from the GUI instead of the FinancialsExtractor class which contains the raw data for the financial statements */ return data; } /** * Allows the user to select a save-path for exporting financial * statements. This method is called by the model view controller. * * @return a String representing the save-path. */ public String storeSavePath() { JFileChooser chooser = new JFileChooser(); chooser.setSelectedFile(new File(getTicker() + getSelectedButton() + ".xls")); int returnVal = chooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { return chooser.getSelectedFile().getAbsolutePath(); } else { System.out.println("Failed selecting a save path"); return null; } } /** * Returns the type of financial statement option selected. * * @return the type of financial statement (quarterly or annual). */ public String getSelectedButton() { if (annual.isSelected()) { return "annual"; } else { return "quarterly"; } } /** * Builds the GUI for the financial statements each time the user * chooses to. */ public void loadBackgroundFrame(String periodType) { backgroundFrame = new JFrame("Financial Statements"); backgroundFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); backgroundFrame.setSize(1000,600); backgroundFrame.setResizable(false); pane = new JTabbedPane(); if (periodType.equals("annual")) { numOfPeriods = 3; } else if (periodType.equals("quarterly")) { numOfPeriods = 4; } /* The number of columns is dependent on the type of financial statement (quarterly or annual) */ isPanel = new JPanel(new GridLayout(0, numOfPeriods+1)); bsPanel = new JPanel(new GridLayout(0, numOfPeriods+1)); cfPanel = new JPanel(new GridLayout(0, numOfPeriods+1)); pane.addTab("Income Statement", null, isPanel); pane.addTab("Balance Sheet", null, bsPanel); pane.addTab("Cash Flows", null, cfPanel); backgroundFrame.add(pane); /* Initialize labels for each type of statement */ for (int i = 0; i < isLabels.length; i++) { isPanel.add(isLabels[i] = new JLabel()); } for (int i = 0; i < bsLabels.length; i++) { bsPanel.add(bsLabels[i] = new JLabel()); } for (int i = 0; i < cfLabels.length; i++) { cfPanel.add(cfLabels[i] = new JLabel()); } } /* Begin private methods */ /** Adds GUI elements to the north JPanel bar */ private void addNorthComponents() { ButtonGroup group = new ButtonGroup(); annual = new JRadioButton("Annual"); quarter = new JRadioButton("Quarter"); tickerButton = new JButton("Go!"); buildFinancialsButton = new JButton("Build financials"); northPanel.add(tickerField); northPanel.add(tickerButton); northPanel.add(buildFinancialsButton); group.add(annual); group.add(quarter); northPanel.add(annual); northPanel.add(quarter); annual.setSelected(true); } /** Adds GUI elements to the center panel. */ private void addCenterComponents() { // Spaces are placeholders for data to be displayed String[] labels = {"Name: ", "" , "Price: ", " ", "Change:", " " , "Market Cap:", " ", "EBITDA", " ", "PE Ratio" , " "}; for (int i = 0; i < stockLabels.length; i++) { centerPanel.add(stockLabels[i] = new JLabel(labels[i])); } } /** Adds GUI elements to the east panel */ private void addEastComponents() { exportButton = new JButton("Export"); fileButton = new JButton("Save As"); eastPanel.add(fileButton); eastPanel.add(exportButton); fileButton.setEnabled(false); exportButton.setEnabled(false); } /** Updates the GUI with income statement data */ private void displayIncomeStatement(ArrayList<ArrayList<String>> is) { // Remove any empty Strings for (int i = 0; i < is.size(); i++) { for (int j = 0; j < is.get(i).size(); j++) { if (is.get(i).get(j).isEmpty()) is.get(i).remove(j); } } int counter = 0; for (int i = 0; i < is.size(); i++) { for (int j = 0; j < is.get(i).size(); j++) { String label = is.get(i).get(j); for (int k = 0; k < headers.length; k++) { if (label.trim().equals(headers[k])) { for (int l = 0; l < numOfPeriods; l++) { // Set the labels to empty for each header is.get(i).add(j+1, " "); } } } isLabels[counter].setText(is.get(i).get(j)); counter++; } } } /** Updates the GUI with balance sheet data */ private void displayBalanceSheet(ArrayList<ArrayList<String>> bs) { for (int i = 0; i < bs.size(); i++) { for (int j = 0; j < bs.get(i).size(); j++) { if (bs.get(i).get(j).isEmpty()) bs.get(i).remove(j); } } int counter = 0; for (int i = 0; i < bs.size(); i++) { for (int j = 0; j < bs.get(i).size(); j++) { String label = bs.get(i).get(j); for (int k = 0; k < headers.length; k++) { if (label.trim().equals(headers[k])) { for (int l = 0; l < numOfPeriods; l++) { bs.get(i).add(j+1, " "); } } } bsLabels[counter].setText(bs.get(i).get(j)); counter++; } } } /** Updates the GUI with cash flow data */ private void displayCashFlows(ArrayList<ArrayList<String>> cf) { for (int i = 0; i < cf.size(); i++) { for (int j = 0; j < cf.get(i).size(); j++) { if (cf.get(i).get(j).isEmpty()) cf.get(i).remove(j); } } int counter = 0; for (int i = 0; i < cf.size(); i++) { for (int j = 0; j < cf.get(i).size(); j++) { String label = cf.get(i).get(j); for (int k = 0; k < headers.length; k++) { if (label.trim().equals(headers[k])) { for (int l = 0; l < numOfPeriods; l++) { cf.get(i).add(j+1, " "); } } } cfLabels[counter].setText(cf.get(i).get(j)); counter++; } } } }
UTF-8
Java
14,333
java
StockGUI.java
Java
[ { "context": "n the model view controller class.\r\n *\r\n * @author Amandeep Sarow\r\n */\r\npublic class StockGUI extends JFrame {\r\n p", "end": 771, "score": 0.991429328918457, "start": 757, "tag": "NAME", "value": "Amandeep Sarow" } ]
null
[]
package dev.stockanalyzer.gui; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTable; import javax.swing.JTabbedPane; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JRadioButton; import javax.swing.ButtonGroup; import javax.swing.JFileChooser; import java.util.*; import java.io.*; import dev.stockanalyzer.pulldata.DataExtractor; /** * This class builds the GUI for the stock analyzer and contains accessors * for use in the model view controller class. * * @author <NAME> */ public class StockGUI extends JFrame { private JPanel northPanel = new JPanel(); private JPanel centerPanel = new JPanel(new GridLayout(DataExtractor .getDataSize(), 1)); private JPanel southPanel = new JPanel(); private JPanel eastPanel = new JPanel(); private JPanel isPanel, bsPanel, cfPanel; private JTextField tickerField = new JTextField("AAPL", 4); private JTabbedPane pane; private JRadioButton annual, quarter; private JButton tickerButton, buildFinancialsButton, exportButton, fileButton; private JLabel[] stockLabels = new JLabel[DataExtractor.getDataSize()*2]; private JLabel[] isLabels = new JLabel[150]; private JLabel[] bsLabels = new JLabel[200]; private JLabel[] cfLabels = new JLabel[150]; private JFrame backgroundFrame; private File file; private int numOfPeriods = 4; private boolean activeFrame = false; private final int x = 450, y = 300, bgX = 850, bgY = 300; private final String ANNUAL = "annual", QUARTERLY = "quarterly"; private final String[] headers = {"Operating Expenses", "Income from Continuing Operations", "Non-recurring Events", "Assets", "Current Assets", "Liabilities", "Current Liabilities", "Stockholders'" + " Equity", "Operating Activities, Cash" + " Flows Provided By or Used In", "Investing Activities, Cash Flows" + " Provided By or Used In", "Financing" + " Activities, Cash Flows Provided By" + " or Used In"}; /** Public constructor for creation of the GUI */ public StockGUI() { setTitle("Financial Data Extractor v1.0"); setSize(x, y); setLocation(400,300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); add(northPanel, BorderLayout.NORTH); add(centerPanel); add(eastPanel, BorderLayout.EAST); addNorthComponents(); addCenterComponents(); addEastComponents(); } /** * Displays the stock labels and stock data. This method is called inside * the StockModelViewController class. * * @param stockData an array containing various stock information to be * displayed. */ public void displayStockData(String[] stockData) { for (int i = 0; i < stockLabels.length; i++) { if (i%2 != 0) stockLabels[i].setText(stockData[i/2]); } } /** * Displays the income statement, balance sheet, and statement of cash * flows in a new window. */ public void displayFinancialStatementsData (ArrayList<ArrayList<String>> is, ArrayList<ArrayList<String>> bs, ArrayList<ArrayList<String>> cf) { /* numOfPeriods represents the number of columns needed to display the financial data. */ if (getSelectedButton().equals(ANNUAL)) { numOfPeriods = 3; } else if (getSelectedButton().equals(QUARTERLY)) { numOfPeriods = 4; } /* To ensure both frames are closed when the user hits the 'X' button, activeFrame is set to true indicating there are multuple windows open */ activeFrame = true; backgroundFrame.setVisible(true); backgroundFrame.setLocation(bgX, bgY); /* The ability to save and export is only available if the user has built the financial statements */ fileButton.setEnabled(true); exportButton.setEnabled(true); // Methods to display the data displayIncomeStatement(is); displayBalanceSheet(bs); displayCashFlows(cf); } /** * Checks if an existing financial statement window is currently * running. * * @return true if a GUI is currently open, false otherwise. */ public boolean isFrameActive() { return activeFrame; } /** * Closes the existing financial statement window. */ public void closeRunningFrame() { backgroundFrame.dispatchEvent(new WindowEvent(backgroundFrame, WindowEvent.WINDOW_CLOSING)); activeFrame = false; } /** * Takes an ActionListener parameter from the model view controller and * updates the GUI with financial statement information for a given stock * ticker. * * @param financialButtonListener an ActionListener for the Build * Financials button from the mvc. */ public void getFinancialData(ActionListener financialButtonListener) { buildFinancialsButton.addActionListener(financialButtonListener); } /** * Takes an ActionListener paramter from the model view controller and * stores the user-selected save path from the GUI. * *@param fileButtonListener an ActonListener for the Save As button * from the mvc. */ public void findSavePath(ActionListener fileButtonListener) { fileButton.addActionListener(fileButtonListener); } /** * Takes an ActionListener paramter from the model view controller and * stores the user-selected exports the financial data to the save path. * *@param exportButtonListener an ActonListener for the export button * from the mvc. */ public void exportFinancialData(ActionListener exportButtonListener) { exportButton.addActionListener(exportButtonListener); } /** * Takes an ActionListener parameter from the model view controller and * updates the stock data for a given stock ticker when the 'GO!' button * is pressed. * * @param tickerButtonListener an ActionListener for the GO! button from * the mvc. */ public void getStockData(ActionListener tickerButtonListener) { tickerButton.addActionListener(tickerButtonListener); } /** * Getter for the stock ticker symbol input by the user. * * @return the stock ticker provided as input by the user. */ public String getTicker() { return tickerField.getText(); } /** * Getter which retrieves the financial statement data directly from the * GUI. * * @return data from the income statement, balance sheet, and statement * of cash flows. */ public ArrayList<ArrayList<String>> getFinancialStatementsData() { ArrayList<ArrayList<String>> data = new ArrayList<ArrayList<String>>(); // empty placeholders ArrayList<String> isHolder = new ArrayList<String>(); ArrayList<String> bsHolder = new ArrayList<String>(); ArrayList<String> cfHolder = new ArrayList<String>(); data.add(isHolder); data.add(bsHolder); data.add(cfHolder); for (int i = 0; i < isLabels.length; i++) { data.get(0).add(isLabels[i].getText()); } for (int i = 0; i < bsLabels.length; i++) { data.get(1).add(bsLabels[i].getText()); } for (int i = 0; i < cfLabels.length; i++) { data.get(2).add(cfLabels[i].getText()); } /* Since the data has been slightly modified for viewing purposes (i.e. a new line after each financial statement header), for exporting to excel, the structure of the data needs to be consistent which is why the data is retrieved from the GUI instead of the FinancialsExtractor class which contains the raw data for the financial statements */ return data; } /** * Allows the user to select a save-path for exporting financial * statements. This method is called by the model view controller. * * @return a String representing the save-path. */ public String storeSavePath() { JFileChooser chooser = new JFileChooser(); chooser.setSelectedFile(new File(getTicker() + getSelectedButton() + ".xls")); int returnVal = chooser.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { return chooser.getSelectedFile().getAbsolutePath(); } else { System.out.println("Failed selecting a save path"); return null; } } /** * Returns the type of financial statement option selected. * * @return the type of financial statement (quarterly or annual). */ public String getSelectedButton() { if (annual.isSelected()) { return "annual"; } else { return "quarterly"; } } /** * Builds the GUI for the financial statements each time the user * chooses to. */ public void loadBackgroundFrame(String periodType) { backgroundFrame = new JFrame("Financial Statements"); backgroundFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); backgroundFrame.setSize(1000,600); backgroundFrame.setResizable(false); pane = new JTabbedPane(); if (periodType.equals("annual")) { numOfPeriods = 3; } else if (periodType.equals("quarterly")) { numOfPeriods = 4; } /* The number of columns is dependent on the type of financial statement (quarterly or annual) */ isPanel = new JPanel(new GridLayout(0, numOfPeriods+1)); bsPanel = new JPanel(new GridLayout(0, numOfPeriods+1)); cfPanel = new JPanel(new GridLayout(0, numOfPeriods+1)); pane.addTab("Income Statement", null, isPanel); pane.addTab("Balance Sheet", null, bsPanel); pane.addTab("Cash Flows", null, cfPanel); backgroundFrame.add(pane); /* Initialize labels for each type of statement */ for (int i = 0; i < isLabels.length; i++) { isPanel.add(isLabels[i] = new JLabel()); } for (int i = 0; i < bsLabels.length; i++) { bsPanel.add(bsLabels[i] = new JLabel()); } for (int i = 0; i < cfLabels.length; i++) { cfPanel.add(cfLabels[i] = new JLabel()); } } /* Begin private methods */ /** Adds GUI elements to the north JPanel bar */ private void addNorthComponents() { ButtonGroup group = new ButtonGroup(); annual = new JRadioButton("Annual"); quarter = new JRadioButton("Quarter"); tickerButton = new JButton("Go!"); buildFinancialsButton = new JButton("Build financials"); northPanel.add(tickerField); northPanel.add(tickerButton); northPanel.add(buildFinancialsButton); group.add(annual); group.add(quarter); northPanel.add(annual); northPanel.add(quarter); annual.setSelected(true); } /** Adds GUI elements to the center panel. */ private void addCenterComponents() { // Spaces are placeholders for data to be displayed String[] labels = {"Name: ", "" , "Price: ", " ", "Change:", " " , "Market Cap:", " ", "EBITDA", " ", "PE Ratio" , " "}; for (int i = 0; i < stockLabels.length; i++) { centerPanel.add(stockLabels[i] = new JLabel(labels[i])); } } /** Adds GUI elements to the east panel */ private void addEastComponents() { exportButton = new JButton("Export"); fileButton = new JButton("Save As"); eastPanel.add(fileButton); eastPanel.add(exportButton); fileButton.setEnabled(false); exportButton.setEnabled(false); } /** Updates the GUI with income statement data */ private void displayIncomeStatement(ArrayList<ArrayList<String>> is) { // Remove any empty Strings for (int i = 0; i < is.size(); i++) { for (int j = 0; j < is.get(i).size(); j++) { if (is.get(i).get(j).isEmpty()) is.get(i).remove(j); } } int counter = 0; for (int i = 0; i < is.size(); i++) { for (int j = 0; j < is.get(i).size(); j++) { String label = is.get(i).get(j); for (int k = 0; k < headers.length; k++) { if (label.trim().equals(headers[k])) { for (int l = 0; l < numOfPeriods; l++) { // Set the labels to empty for each header is.get(i).add(j+1, " "); } } } isLabels[counter].setText(is.get(i).get(j)); counter++; } } } /** Updates the GUI with balance sheet data */ private void displayBalanceSheet(ArrayList<ArrayList<String>> bs) { for (int i = 0; i < bs.size(); i++) { for (int j = 0; j < bs.get(i).size(); j++) { if (bs.get(i).get(j).isEmpty()) bs.get(i).remove(j); } } int counter = 0; for (int i = 0; i < bs.size(); i++) { for (int j = 0; j < bs.get(i).size(); j++) { String label = bs.get(i).get(j); for (int k = 0; k < headers.length; k++) { if (label.trim().equals(headers[k])) { for (int l = 0; l < numOfPeriods; l++) { bs.get(i).add(j+1, " "); } } } bsLabels[counter].setText(bs.get(i).get(j)); counter++; } } } /** Updates the GUI with cash flow data */ private void displayCashFlows(ArrayList<ArrayList<String>> cf) { for (int i = 0; i < cf.size(); i++) { for (int j = 0; j < cf.get(i).size(); j++) { if (cf.get(i).get(j).isEmpty()) cf.get(i).remove(j); } } int counter = 0; for (int i = 0; i < cf.size(); i++) { for (int j = 0; j < cf.get(i).size(); j++) { String label = cf.get(i).get(j); for (int k = 0; k < headers.length; k++) { if (label.trim().equals(headers[k])) { for (int l = 0; l < numOfPeriods; l++) { cf.get(i).add(j+1, " "); } } } cfLabels[counter].setText(cf.get(i).get(j)); counter++; } } } }
14,325
0.616689
0.610549
448
29.984375
23.94492
79
false
false
0
0
0
0
0
0
1.232143
false
false
3
d5ca8352cb45c6f4535b2eb3123cfe83222d63f7
35,897,336,700,632
cc31b7839c25ad10d709785beebaaffca8925bdd
/app/src/main/java/com/example/proga2_laba/Service/organization/Organization.java
98ff22d40ebce91508d352bd30c951804f24d885
[]
no_license
AntonBuikooo/AnroidEnterpriseApp
https://github.com/AntonBuikooo/AnroidEnterpriseApp
a1f1ba1f43fb39b93214e6b8cb409474b5c3245f
9a63a93586b6fc45f724864cef68ab1447c6f911
refs/heads/master
2023-07-19T21:48:14.970000
2019-10-24T19:44:54
2019-10-24T19:44:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.proga2_laba.Service.organization; public enum Organization { BELSTU(8), BELGUIR(6), BENTY(6); Organization(int rating){ this.count = count; this.rating = rating; } private int count; private int rating; public int getCount(){ return count; } public void setCount(int count){ this.count = count; } public int getRating() { return rating; } }
UTF-8
Java
459
java
Organization.java
Java
[]
null
[]
package com.example.proga2_laba.Service.organization; public enum Organization { BELSTU(8), BELGUIR(6), BENTY(6); Organization(int rating){ this.count = count; this.rating = rating; } private int count; private int rating; public int getCount(){ return count; } public void setCount(int count){ this.count = count; } public int getRating() { return rating; } }
459
0.586057
0.577342
27
16
13.740991
53
false
false
0
0
0
0
0
0
0.407407
false
false
3
836f7455c474d19e488c41b51900306b540e6ba9
38,448,547,252,589
e5a99f7d7647e3a792b2cc72be5f1aef592caf14
/src/org/giswater/model/ImportRpt.java
31c16323256363115af96c28039bbf3849a553b8
[]
no_license
Giswater/giswater
https://github.com/Giswater/giswater
d88d37dd6c452603c87ff69a7082a2a1a884be5e
12f5d89e750063473492d092498633c7444534fe
refs/heads/master-3.1
2022-04-27T21:16:21.510000
2022-04-18T20:59:44
2022-04-18T20:59:44
13,443,214
40
24
null
false
2019-03-27T08:43:15
2013-10-09T13:36:56
2019-03-20T12:49:40
2019-03-27T08:43:15
58,604
25
18
2
Java
false
null
/* * This file is part of Giswater * Copyright (C) 2013 Tecnics Associats * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Author: * David Erill <derill@giswater.org> */ package org.giswater.model; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Types; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import javax.swing.JOptionPane; import org.giswater.dao.MainDao; import org.giswater.dao.PropertiesDao; import org.giswater.util.Utils; public class ImportRpt extends Model { private static String insertSql; private static int lineNumber; // Number of lines read or current line to process private static ArrayList<String> fileContent; private static int totalLines; // Total number of lines inside .rpt file private static ArrayList<String> pollutants; private static String firstLine; private static String lastTimeHydraulic = ""; private static boolean continueProcess = true; private static boolean abortRptProcess = false; private static File fileRpt; private static String resultName; private static LinkedHashMap<Integer, RptTarget> mapRptTargets = null; private static RptTarget rptTarget; // Current Target being processed // Each rptElem corresponds to one line of a .rpt file private static RptToken rptToken = null; private static ArrayList<RptToken> rptTokens; private static ArrayList<ArrayList<RptToken>> rptTokensList; private static final String TABLE_CAT_RESULT = "rpt_cat_result"; private static final String TABLE_SELECTOR_RESULT = "rpt_selector_result"; // Import RPT file into Postgis tables public static boolean process(File fileRpt, String resultName) { Utils.getLogger().info("importRpt"); abortRptProcess = false; ImportRpt.fileRpt = fileRpt; ImportRpt.resultName = resultName; // Ask confirmation to user String importRpt = PropertiesDao.getPropertiesFile().get("AUTO_IMPORT_RPT", "false").toLowerCase(); if (importRpt.equals("false")) { int res = Utils.showYesNoDialog("import_sure"); if (res == JOptionPane.NO_OPTION) return false; } // Check if we want to overwrite previous results Boolean overwriteResult = Boolean.parseBoolean(PropertiesDao.getPropertiesFile().get("OVERWRITE_RESULT", "false")); // Check if Project Name exists in rpt_result_id boolean exists = false; if (existsProjectName()) { exists = true; } // Open RPT file if (!openRptFile()) { return false; } Utils.getLogger().info("Getting contents of .rpt file..."); if (!getRptContent()) { return false; } Utils.getLogger().info("Getting contents completed"); // Initialize targets initRptTargets(); // UD if (softwareName.equals("ud")) { processUD(overwriteResult, exists); } // WS else { processWS(overwriteResult, exists); } // Execute SQL function gw_fct_rpt2pg('result_id') executeRpt2Pg(resultName); // Insert into result_selection commiting transaction MainDao.setResultSelect(MainDao.getSchema(), TABLE_SELECTOR_RESULT, resultName); return true; } // Execute SQL function gw_fct_rpt2pg() private static void executeRpt2Pg(String resultName) { if (MainDao.checkFunction(MainDao.getSchema(), "gw_fct_rpt2pg")) { Utils.getLogger().info("Execution function 'gw_fct_rpt2pg()'"); String sql = "SELECT "+MainDao.getSchema()+".gw_fct_rpt2pg('"+resultName+"');"; String result = MainDao.queryToString(sql); Utils.getLogger().info("Result function 'gw_fct_rpt2pg()': "+result); } else { Utils.getLogger().info("Doesn't exist function 'gw_fct_rpt2pg()'"); } } private static boolean processUD(Boolean overwrite, Boolean exists) { // Iterate over targets Iterator<Entry<Integer, RptTarget>> it = mapRptTargets.entrySet().iterator(); while (it.hasNext()) { insertSql = ""; Map.Entry<Integer, RptTarget> mapEntry = it.next(); rptTarget = mapEntry.getValue(); boolean ok = processRptTarget(); if (abortRptProcess) return false; if (!continueProcess) return false; postProcessTarget(ok, true, overwrite, exists); } return true; } private static boolean processWS(Boolean overwrite, boolean exists) { // Iterate over targets String sql = ""; Iterator<Entry<Integer, RptTarget>> it = mapRptTargets.entrySet().iterator(); while (it.hasNext()) { insertSql = ""; Map.Entry<Integer, RptTarget> mapEntry = it.next(); rptTarget = mapEntry.getValue(); boolean ok = false; boolean processTarget = true; boolean continueTarget; // Target node or arc if (rptTarget.getId() == 40 || rptTarget.getId() == 50) { processTarget = false; continueTarget = true; if (overwrite) { sql = "DELETE FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); MainDao.executeUpdateSql(sql); } else { if (exists) { sql = "DELETE FROM "+MainDao.getSchema()+"."+rptTarget.getTable() + " WHERE result_id = '"+resultName+"'"; MainDao.executeUpdateSql(sql); } } while (continueTarget) { insertSql = ""; ok = processRptTargetWS(); if (abortRptProcess) return false; if (ok) { if (!insertSql.equals("")) { // Check if time is set and update it if (firstLine.length() > 15) { firstLine = firstLine.substring(15, 24).trim(); sql = "UPDATE "+MainDao.getSchema()+"."+rptTarget.getTable() + " SET time = '"+firstLine+"' WHERE time is null;"; insertSql+= sql; } } if (!MainDao.executeUpdateSql(insertSql)) { return false; } } continueTarget = (lineNumber > 0); } } // Target different than node or arc else { ok = processRptTargetWS(); if (abortRptProcess) return false; } if (!continueProcess) return false; postProcessTarget(ok, processTarget, overwrite, exists); } // end iterations over targets (while) return true; } private static boolean postProcessTarget(boolean ok, boolean processTarget, boolean overwrite, boolean exists) { String sql; if (ok && processTarget) { if (overwrite) { sql = "DELETE FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); MainDao.executeUpdateSql(sql); } else { if (exists && rptTarget.getId() != 10) { sql = "DELETE FROM "+MainDao.getSchema()+"."+rptTarget.getTable() + " WHERE result_id = '"+resultName+"'"; MainDao.executeUpdateSql(sql); } } if (!insertSql.equals("")) { boolean status = MainDao.executeUpdateSql(insertSql); if (!status) { String msg = Utils.getBundleString("ImportRpt.import_aborted"); //$NON-NLS-1$ msg+= "\n" + rptTarget.getDescription(); msg+= Utils.getBundleString("ImportRpt.open_log"); //$NON-NLS-1$ Utils.showError(msg); return false; } } } return true; } private static String readLine(){ String line = fileContent.get(lineNumber - 1); return line; } private static boolean initRptTargets() { // Get info from rpt_target into memory mapRptTargets = new LinkedHashMap<Integer, RptTarget>(); String sql = "SELECT id, db_table, description, type, title_lines, tokens, parametrized" + " FROM rpt_target" + " WHERE type <> 0" + " ORDER BY id"; try { ResultSet rs = MainDao.getResultset(connectionDrivers, sql, true, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); while (rs.next()) { RptTarget rptTarget = new RptTarget(rs); mapRptTargets.put(rptTarget.getId(), rptTarget); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); return false; } // Iterate over targets and get info from rpt_target_fields into memory Iterator<Entry<Integer, RptTarget>> it = mapRptTargets.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Integer, RptTarget> mapEntry = it.next(); RptTarget rptTarget = mapEntry.getValue(); sql = "SELECT target_id || '_' || db_name as id, target_id, rpt_name, db_name, db_type" + " FROM rpt_target_fields" + " WHERE target_id = "+rptTarget.getId(); ResultSet rs = MainDao.getResultset(connectionDrivers, sql, true, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); try { while (rs.next()) { RptTargetField rptTargetField = new RptTargetField(rs); rptTarget.addRptTargetField(rptTargetField); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); return false; } } return true; } private static boolean getRptContent() { fileContent = new ArrayList<String>(); Boolean ok = true; String line; try { long fileLength = rat.length(); lineNumber = 0; while (rat.getFilePointer() < fileLength) { lineNumber++; line = rat.readLine().trim(); fileContent.add(line); } totalLines = lineNumber; lineNumber = 0; } catch (IOException e) { Utils.showError(e); ok = false; } return ok; } private static boolean existsProjectName() { String sql = "SELECT * FROM "+MainDao.getSchema()+"."+TABLE_CAT_RESULT+ " WHERE result_id = '"+resultName+"'"; try { PreparedStatement ps = MainDao.getConnectionPostgis().prepareStatement(sql); ResultSet rs = ps.executeQuery(); return rs.next(); } catch (SQLException e) { Utils.showError(e, sql); return false; } } private static boolean openRptFile() { Boolean ok = true; try { rat = new RandomAccessFile(fileRpt, "r"); lineNumber = 0; } catch (FileNotFoundException e) { Utils.showError("inp_error_notfound", fileRpt.getAbsolutePath()); ok = false; } return ok; } // Process current RptTarget (UD) private static boolean processRptTarget() { // Read lines until rpt.getDescription() is found boolean found = false; String line; String aux; Utils.getLogger().info("Target: "+rptTarget.getId()+ " - "+rptTarget.getDescription()); // Read lines until rpt.getDescription() is found while (!found) { if (lineNumber >= totalLines) { lineNumber = 0; return false; } lineNumber++; line = readLine(); if (line.length() >= rptTarget.getDescription().length()) { aux = line.substring(0, rptTarget.getDescription().length()).toLowerCase(); if (aux.equals(rptTarget.getDescription().toLowerCase())) { found = true; Utils.getLogger().info("Target line number: "+lineNumber); } } } if (rptTarget.getType() == 3 || rptTarget.getType() == 5 || rptTarget.getType() == 6) { getPollutants(); } // Jump number of lines specified in rpt.getTitleLines() for (int i = 1; i <= rptTarget.getTitleLines(); i++) { lineNumber++; line = readLine(); // Check if we have reached next Target if (line.contains("No ")) { return false; } } // Get Database fields related to this Target if (rptTarget.getColumnCount() == 0) { String sql = "SELECT * FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); try { ResultSet rs = MainDao.getResultset(sql); ResultSetMetaData rsmd = rs.getMetaData(); for (int i = 1; i <= rsmd.getColumnCount(); i++) { rptTarget.addColumnName(rsmd.getColumnName(i)); rptTarget.addColumnType(rsmd.getColumnType(i)); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); } } // Read following lines until blank line is found rptTokensList = new ArrayList<ArrayList<RptToken>>(); rptTokens = new ArrayList<RptToken>(); if (rptTarget.getId() == 10) { parseLinesAnalysis(); processTokensAnalysis(); } else if (rptTarget.getType() == 2 && rptTarget.getId() != 10) { continueProcess = parseLines(); processTokensCheck(); } else if (rptTarget.getType() == 3) { continueProcess = parseLines(); processTokens3(); } else { continueProcess = parseLines(); } return true; } private static boolean processTokensCheck() { boolean result; if (rptTarget.getParametrized() == 0) { result = processTokens(); } else { result = processTokensParametrized(); } return result; } // UD private static boolean parseLinesAnalysis() { boolean result = true; rptTokens = new ArrayList<RptToken>(); boolean blankLine = false; while (!blankLine) { lineNumber++; String line = readLine(); blankLine = (line.length() == 0); if (!blankLine) { Scanner scanner = new Scanner(line); parseLine2(scanner, true); } if (abortRptProcess) { return false; } } return result; } // UD private static void getPollutants() { String line = ""; int jumpLines; if (rptTarget.getType() == 3) { lineNumber--; line = readLine(); } else { jumpLines = (rptTarget.getType() == 5) ? 4 : 5; for (int i = 1; i <= jumpLines; i++) { lineNumber++; line = readLine(); } } boolean blankLine = (line.length() == 0); if (!blankLine) { Scanner scanner = new Scanner(line); if (rptTarget.getType() == 3 || rptTarget.getType() == 6) { int jumpScanner = (rptTarget.getType() == 3) ? 1 : 4; for (int i = 0; i < jumpScanner; i++) { scanner.next(); } } // Get pollutant name parseLine1(scanner); pollutants = new ArrayList<String>(); for (int i = 0; i < rptTokens.size(); i++) { pollutants.add(rptTokens.get(i).getRptValue()); } } } // Parse all lines private static boolean parseLines() { boolean result = true; rptTokens = new ArrayList<RptToken>(); boolean blankLine = false; boolean valid = true; while (!blankLine && valid) { lineNumber++; String line = readLine(); blankLine = (line.length() == 0); if (softwareName.equals("ws") && rptTarget.getId() == 30) { valid = !line.contains("---"); } if (!blankLine && valid) { line = line.replace("-", " -"); Scanner scanner = new Scanner(line); if (rptTarget.getType() == 1) { parseLine1(scanner); result = processTokensCheck(); if (!result) return false; } else if (rptTarget.getType() == 2) { parseLine2(scanner, true); } else if (rptTarget.getType() == 3) { rptTokens = new ArrayList<RptToken>(); parseLine2(scanner, false); rptTokensList.add(rptTokens); } else if (rptTarget.getType() == 4) { parseLineType4(scanner); processTokensCheck(); } else if (rptTarget.getType() == 5) { parseLine1(scanner); processTokens5(); } else if (rptTarget.getType() == 6) { parseLine1(scanner); processTokens6(); } else if (rptTarget.getType() == 7) { parseLine1(scanner); processTokens6(); } } if (abortRptProcess) { return false; } } return result; } // Parse values of current line private static void parseLine1(Scanner scanner) { rptTokens = new ArrayList<RptToken>(); String rptValue = ""; while (scanner.hasNext()) { rptValue = scanner.next(); RptToken rptToken = new RptToken("", rptValue); rptTokens.add(rptToken); } } private static void parseLineType4(Scanner scanner) { rptTokens = new ArrayList<RptToken>(); String rptValue = ""; while (scanner.hasNext()) { rptValue+= " "+scanner.next(); } rptToken = new RptToken("", rptValue.trim()); rptTokens.add(rptToken); } // Parse values of current line that contains ".." in it private static void parseLine2(Scanner scanner, boolean together) { String rptName = ""; String rptValue = ""; String token; boolean valueFound = false; int numTokens = 0; while (scanner.hasNext()) { token = scanner.next(); if (token.contains("..")) { valueFound = true; } if (valueFound && !token.contains("..")) { numTokens++; if (numTokens <= rptTarget.getTokens()) { if (together) { rptValue+= token + " "; } else { rptName = rptName.substring(0, rptName.length() - 1); rptToken = new RptToken(rptName, token); rptTokens.add(rptToken); } } } if (!valueFound && !token.contains("..")) { rptName+= token.toLowerCase() + "_"; } } if (valueFound && together) { rptName = rptName.substring(0, rptName.length() - 1); rptToken = new RptToken(rptName, rptValue.trim()); rptTokens.add(rptToken); } } private static boolean processTokens() { String fields = "result_id, "; String values = "'"+resultName+"', "; boolean ignoreToken = false; if (softwareName.equals("ws")) { if (rptTokens.size() < 2) { Utils.logError("Line not valid"); return true; } } // Customization for target Storage Volume Summary // Ignore field number 4 if: target = 110 and number of tokens > 9 // Not checking if version = 5.1 to avoid further errors if (rptTarget.getId() == 110 && rptTokens.size() > 9) { // Ignoring value for this target... ignoreToken = true; } for (int i=0; i<rptTokens.size(); i++) { RptToken rptToken = rptTokens.get(i); int j = i+3; String value = rptToken.getRptValue(); Integer dbType; if (ignoreToken && i > 4) { j--; } switch (rptTarget.getColumnType(j)) { case Types.NUMERIC: case Types.DOUBLE: case Types.INTEGER: dbType = 1; break; default: dbType = 0; break; } if (ignoreToken && i == 4) { // Ignoring value for this target... } else { String result = processField(rptTarget.getColumnName(j), value, dbType); if (result.equals("-1")) { abortRptProcess = true; return false; } values+= result+", "; fields+= rptTarget.getColumnName(j) + ", "; } } // Build SQL Insert sentence insertSql+= buildSql(rptTarget, fields, values); return true; } private static boolean processTokensParametrized() { String fields = "result_id, "; String values = "'"+resultName+"', "; if (softwareName.equals("ws")) { if (rptTokens.size() < 2) { Utils.logError("Line not valid"); return true; } } // Set ResultSet for rpt destination table String sqlDest = "SELECT * FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); ResultSet rsDest = MainDao.getResultset(sqlDest); // Iterate over rptTokens for (int i=0; i<rptTokens.size(); i++) { RptToken rptToken = rptTokens.get(i); // Search if that RptTargetField exists in the Database String sql = "SELECT db_name, db_type" + " FROM rpt_target_fields" + " WHERE target_id = "+rptTarget.getId()+" AND lower(rpt_name) = '"+rptToken.getRptName()+"'"; ResultSet rs = MainDao.getResultset(connectionDrivers, sql, true, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); try { if (rs.next()) { // Check if that field exists in rpt destination table String fieldName = rs.getString("db_name"); boolean exists = MainDao.checkColumn(rsDest, fieldName); if (exists) { fields+= fieldName + ", "; String rptValue = rptToken.getRptValue(); Integer dbType = rs.getInt("db_type"); String result = processField(fieldName, rptValue, dbType); if (result.equals("-1")) { return false; } values+= result+", "; } else { Utils.getLogger().info("Field not exists in table '"+rptTarget.getTable()+"': "+fieldName); } } else { Utils.getLogger().info("Target field not found in driver database: "+rptToken.getRptName()); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); return false; } } // Build SQL Insert sentence insertSql+= buildSql(rptTarget, fields, values); return true; } private static void processTokens3() { // Iterate over pollutants for (int i=0; i<pollutants.size(); i++) { String fields = "result_id, poll_id, "; String values = "'"+resultName+"', '"+pollutants.get(i)+"', "; // Iterate over fields for (int j=0; j<rptTokensList.size(); j++) { String value = rptTokensList.get(j).get(i).getRptValue(); values += "'"+value+"', "; fields += rptTarget.getColumnName(j + 4) + ", "; } // Build SQL Insert sentence insertSql+= buildSql(rptTarget, fields, values); } } private static void processTokens5() { String fields = "result_id, subc_id, poll_id, value"; String fixedValues = "'"+resultName+"', '"+rptTokens.get(0).getRptValue()+ "', "; // No permetre tipus String (peta a Subcatchment) try { Integer.parseInt(rptTokens.get(0).getRptValue()); } catch (NumberFormatException e) { return; } // Iterate over pollutants if (rptTokens.size() > pollutants.size()) { for (int i=0; i<pollutants.size(); i++) { Double units = Double.valueOf(rptTokens.get(i+1).getRptValue()); String values = fixedValues + "'"+pollutants.get(i)+"', "+units; String sql = "INSERT INTO "+MainDao.getSchema()+"."+rptTarget.getTable()+" ("+fields+") VALUES ("+values+");\n"; insertSql+= sql; } } } // Outfall Loading Summary (only) private static void processTokens6() { String fields = "result_id, node_id, flow_freq, avg_flow, max_flow, total_vol"; String fields2 = "result_id, node_id, poll_id, value"; String fixedValues = "'"+resultName+"', '"+rptTokens.get(0).getRptValue()+ "', "; // If found separator o resume line skip them if (rptTokens.size() < 5 || rptTokens.get(0).getRptValue().equals("System")) { return; } // Iterate over first 5 fields String values = fixedValues; for (int j=1; j<5; j++) { values+= rptTokens.get(j).getRptValue() + ", "; } values = values.substring(0, values.length() - 2); String sql = "INSERT INTO "+MainDao.getSchema()+"."+rptTarget.getTable()+" ("+fields+") VALUES ("+values+");\n"; insertSql += sql; // Table name hardcoded. Not present in sqlite database for (int i = 0; i < pollutants.size(); i++) { int j = i+5; Double units = Double.valueOf(rptTokens.get(j).getRptValue()); values = fixedValues + "'"+pollutants.get(i)+"', "+units; sql = "DELETE FROM "+MainDao.getSchema()+".rpt_outfallload_sum " + "WHERE result_id = '"+resultName+"' AND node_id = '"+rptTokens.get(0).getRptValue()+"' AND poll_id = '"+pollutants.get(i)+ "';\n"; insertSql+= sql; sql = "INSERT INTO "+MainDao.getSchema()+".rpt_outfallload_sum ("+fields2+") VALUES ("+values+");\n"; insertSql+= sql; } } private static boolean processTokensAnalysis() { String fields = "result_id, "; String values = "'"+resultName+"', "; // Set ResultSet for rpt destination table String sqlDest = "SELECT * FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); ResultSet rsDest = MainDao.getResultset(sqlDest); // Iterate over rptTokens for (int i=0; i<rptTokens.size(); i++) { RptToken rptToken = rptTokens.get(i); // Search if that RptTargetField exists in the Database String sql = "SELECT db_name, db_type" + " FROM rpt_target_fields" + " WHERE target_id = "+rptTarget.getId()+" AND lower(rpt_name) = '"+rptToken.getRptName()+"'"; ResultSet rs = MainDao.getResultset(connectionDrivers, sql, true, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); try { if (rs.next()) { // Check if that field exists in rpt destination table String fieldName = rs.getString("db_name"); boolean exists = MainDao.checkColumn(rsDest, fieldName); if (exists) { fields+= fieldName + ", "; String rptValue = rptToken.getRptValue(); Integer dbType = rs.getInt("db_type"); String result = processField(fieldName, rptValue, dbType); if (result.equals("-1")) { return false; } values+= result+", "; } else { Utils.getLogger().info("Field not exists in table '"+rptTarget.getTable()+"': "+fieldName); } } else { Utils.getLogger().info("Target field not found in driver database: "+rptToken.getRptName()); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); return false; } } // Build SQL Update sentence insertSql+= buildSqlUpdate(rptTarget, fields, values); return true; } private static String processField(String fieldName, String rptValue, Integer dbType) { String result; if (dbType != 0) { boolean ok = Utils.isNumeric(rptValue); if (!ok) { String msg = Utils.getBundleString("ImportRpt.error_line_number")+lineNumber; //$NON-NLS-1$ msg+= "\nField "+fieldName+ Utils.getBundleString("ImportRpt.invalid_numeric_value")+rptValue; //$NON-NLS-2$ msg+= Utils.getBundleString("ImportRpt.import_process"); //$NON-NLS-1$ Utils.showError(msg); result = "-1"; } result = rptValue; } else { result = "'"+rptValue+"'"; } return result; } private static String buildSql(RptTarget rptTarget, String fields, String values) { fields = fields.substring(0, fields.length() - 2); values = values.substring(0, values.length() - 2); String sql = "INSERT INTO "+MainDao.getSchema()+"."+rptTarget.getTable()+" ("+fields+") VALUES ("+values+");\n"; return sql; } private static String buildSqlUpdate(RptTarget rptTarget, String fields, String values) { fields = fields.substring(0, fields.length() - 2); values = values.substring(0, values.length() - 2); String sql = "UPDATE "+MainDao.getSchema()+"."+rptTarget.getTable(); sql += " SET ("+fields+") = ("+values+")"; sql += " WHERE result_id = '"+resultName+"';"; return sql; } // WS private static boolean processRptTargetWS() { boolean found = false; String line = ""; String aux; Utils.getLogger().info("Target: "+rptTarget.getId()+" - "+rptTarget.getDescription()); // Read lines until rpt.getDescription() is found while (!found) { if (lineNumber >= totalLines) { lineNumber = 0; return false; } lineNumber++; line = readLine(); if (line.length() >= rptTarget.getDescription().length()) { aux = line.substring(0, rptTarget.getDescription().length()).toLowerCase(); if (aux.equals(rptTarget.getDescription().toLowerCase())) { found = true; firstLine = line; Utils.getLogger().info("Target line number: " + lineNumber); } } } int jumpLines = rptTarget.getTitleLines(); String fieldsList = "*"; // Target node if (rptTarget.getId() == 40) { jumpLines = 2; fieldsList = "id, result_id, node_id"; for (int i=1; i<=2; i++) { lineNumber++; line = readLine(); } Scanner scanner = new Scanner(line); parseLine1(scanner); for (int i=0; i<rptTokens.size(); i++) { String column = rptTokens.get(i).getRptValue().toLowerCase(); if (column.equals("node")) { // Just ignore them } else if (column.equals("pressure")) { fieldsList+= ", press"; } // Quality else if (column.equals("quality") || column.equals("chemical") || column.equals("%_factor") || column.equals("age")) { fieldsList+= ", quality"; } // Elevation, Demand, Head else if (column.equals("elevation") || column.equals("demand") || column.equals("head") || column.equals("quality")) { fieldsList+= ", "+column; } } fieldsList+= ", other, time"; } // Target arc else if (rptTarget.getId() == 50) { jumpLines = 2; fieldsList = "id, result_id, arc_id"; for (int i=1; i<=2; i++) { lineNumber++; line = readLine(); } Scanner scanner = new Scanner(line); parseLine1(scanner); for (int i=0; i<rptTokens.size(); i++) { String column = rptTokens.get(i).getRptValue().toLowerCase(); if (column.equals("node") || column.equals("status")) { // Just ignore them } else if (column.equals("velocity") || column.equals("velocityunit")) { fieldsList+= ", vel"; } else if (column.equals("f-factor")) { fieldsList+= ", ffactor"; } // Length, Diameter, Flow, Headloss, Setting, Reaction else if (column.equals("length") || column.equals("diameter") || column.equals("flow") || column.equals("headloss") || column.equals("setting") || column.equals("reaction")) { fieldsList+= ", "+column; } } fieldsList+= ", other, time"; } // Jump number of lines specified in rpt.getTitleLines() for (int i = 1; i <= jumpLines; i++) { lineNumber++; line = readLine(); // Check if we have reached next Target if (line.contains("No ")) { return false; } } // Get Database fields related to this Target if (rptTarget.getColumnCount() == 0) { String sql = "SELECT "+fieldsList+" FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); try { ResultSet rs = MainDao.getResultset(sql); ResultSetMetaData rsmd = rs.getMetaData(); for (int i=1; i<=rsmd.getColumnCount(); i++){ rptTarget.addColumnName(rsmd.getColumnName(i)); rptTarget.addColumnType(rsmd.getColumnType(i)); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); } } // Read following lines until blank line is found rptTokensList = new ArrayList<ArrayList<RptToken>>(); // Target Hydraulic Status if (rptTarget.getId() == 20) { parseLinesHydraulic(); } else { parseLines(); // Target Input Data File if (rptTarget.getId() == 10) { processTokensInputData(); } } return true; } // WS: Parse all lines of Hydraulic Status Target private static void parseLinesHydraulic() { rptTokens = new ArrayList<RptToken>(); boolean blankLine = false; int numBlankLines = 0; while (numBlankLines < 2) { try { lineNumber++; String line = readLine(); blankLine = (line.length()==0); if (!blankLine) { Scanner scanner = new Scanner(line); rptTokens = parseLineHydraulic(scanner); processTokensHydraulic(); numBlankLines = 0; } else { numBlankLines++; } } catch (Exception e) { Utils.logError(e); } } } // WS: Parse values of current line private static ArrayList<RptToken> parseLineHydraulic(Scanner scanner) { ArrayList<RptToken> tokens = new ArrayList<RptToken>(); String token = ""; String first = ""; boolean firstWord = true; while (scanner.hasNext()) { if (firstWord) { first = scanner.next(); firstWord = false; } else { token+= " " + scanner.next(); } } RptToken rptFirst = new RptToken("first", first.trim()); RptToken rptToken = new RptToken("token", token.trim()); tokens.add(rptFirst); tokens.add(rptToken); return tokens; } // WS private static void processTokensHydraulic() { String fields = "result_id, time, text"; String values = "'"+resultName+"', "; String time; String text = ""; time = rptTokens.get(0).getRptValue(); time = rptTokens.get(0).getRptValue().substring(0, time.length() - 1); if (time.substring(0, 7).toLowerCase().equals("warning")){ text = rptTokens.get(0).getRptValue() + " "; time = lastTimeHydraulic; } else{ lastTimeHydraulic = time; } text += rptTokens.get(1).getRptValue(); values += "'"+time+"', '"+text+"'"; String sql = "INSERT INTO "+MainDao.getSchema()+"."+rptTarget.getTable()+" ("+fields+") VALUES ("+values+");\n"; insertSql += sql; } // WS private static boolean processTokensInputData() { // Number of fields without water quality parameters final int NORMAL_NUM_FIELDS = 19; Boolean existWaterFields = false; String fields = "result_id, "; String values = "'"+resultName+"', "; String sql = "SELECT * FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); try { ResultSet rs = MainDao.getResultset(sql); ResultSetMetaData rsmd = rs.getMetaData(); int m = 2; if (rptTokens.size() > NORMAL_NUM_FIELDS) { existWaterFields = true; m = 0; } //System.out.println(rsmd.getColumnCount()); // 24 if (rptTokens.size() < rsmd.getColumnCount() - 6) { Utils.logError("Line not valid"); return true; } rs.close(); int k = 0; for (int j=3; j<rsmd.getColumnCount() - m; j++) { int i = j-3; int columnIndex = j-k; if (existWaterFields) { if (i == 14) { columnIndex = rsmd.getColumnCount() - 1; k++; } else if (i == 15) { columnIndex = rsmd.getColumnCount(); k++; } } String fieldName = rsmd.getColumnName(columnIndex); fields+= fieldName + ", "; String rptValue = rptTokens.get(i).getRptValue(); Integer dbType; switch (rptTarget.getColumnType(columnIndex)) { case Types.NUMERIC: case Types.DOUBLE: case Types.INTEGER: dbType = 1; break; default: dbType = 0; break; } String result = processField(rptTarget.getColumnName(j), rptValue, dbType); if (result.equals("-1")) { abortRptProcess = true; return false; } values+= result+", "; } } catch (SQLException e) { Utils.showError(e, sql); } // Build SQL Update sentence insertSql+= buildSqlUpdate(rptTarget, fields, values); return true; } }
UTF-8
Java
35,907
java
ImportRpt.java
Java
[ { "context": "http://www.gnu.org/licenses/>.\n * \n * Author:\n * David Erill <derill@giswater.org>\n */\npackage org.giswater.mo", "end": 758, "score": 0.9996605515480042, "start": 747, "tag": "NAME", "value": "David Erill" }, { "context": ".org/licenses/>.\n * \n * Author:\n * ...
null
[]
/* * This file is part of Giswater * Copyright (C) 2013 Tecnics Associats * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Author: * <NAME> <<EMAIL>> */ package org.giswater.model; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Types; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import javax.swing.JOptionPane; import org.giswater.dao.MainDao; import org.giswater.dao.PropertiesDao; import org.giswater.util.Utils; public class ImportRpt extends Model { private static String insertSql; private static int lineNumber; // Number of lines read or current line to process private static ArrayList<String> fileContent; private static int totalLines; // Total number of lines inside .rpt file private static ArrayList<String> pollutants; private static String firstLine; private static String lastTimeHydraulic = ""; private static boolean continueProcess = true; private static boolean abortRptProcess = false; private static File fileRpt; private static String resultName; private static LinkedHashMap<Integer, RptTarget> mapRptTargets = null; private static RptTarget rptTarget; // Current Target being processed // Each rptElem corresponds to one line of a .rpt file private static RptToken rptToken = null; private static ArrayList<RptToken> rptTokens; private static ArrayList<ArrayList<RptToken>> rptTokensList; private static final String TABLE_CAT_RESULT = "rpt_cat_result"; private static final String TABLE_SELECTOR_RESULT = "rpt_selector_result"; // Import RPT file into Postgis tables public static boolean process(File fileRpt, String resultName) { Utils.getLogger().info("importRpt"); abortRptProcess = false; ImportRpt.fileRpt = fileRpt; ImportRpt.resultName = resultName; // Ask confirmation to user String importRpt = PropertiesDao.getPropertiesFile().get("AUTO_IMPORT_RPT", "false").toLowerCase(); if (importRpt.equals("false")) { int res = Utils.showYesNoDialog("import_sure"); if (res == JOptionPane.NO_OPTION) return false; } // Check if we want to overwrite previous results Boolean overwriteResult = Boolean.parseBoolean(PropertiesDao.getPropertiesFile().get("OVERWRITE_RESULT", "false")); // Check if Project Name exists in rpt_result_id boolean exists = false; if (existsProjectName()) { exists = true; } // Open RPT file if (!openRptFile()) { return false; } Utils.getLogger().info("Getting contents of .rpt file..."); if (!getRptContent()) { return false; } Utils.getLogger().info("Getting contents completed"); // Initialize targets initRptTargets(); // UD if (softwareName.equals("ud")) { processUD(overwriteResult, exists); } // WS else { processWS(overwriteResult, exists); } // Execute SQL function gw_fct_rpt2pg('result_id') executeRpt2Pg(resultName); // Insert into result_selection commiting transaction MainDao.setResultSelect(MainDao.getSchema(), TABLE_SELECTOR_RESULT, resultName); return true; } // Execute SQL function gw_fct_rpt2pg() private static void executeRpt2Pg(String resultName) { if (MainDao.checkFunction(MainDao.getSchema(), "gw_fct_rpt2pg")) { Utils.getLogger().info("Execution function 'gw_fct_rpt2pg()'"); String sql = "SELECT "+MainDao.getSchema()+".gw_fct_rpt2pg('"+resultName+"');"; String result = MainDao.queryToString(sql); Utils.getLogger().info("Result function 'gw_fct_rpt2pg()': "+result); } else { Utils.getLogger().info("Doesn't exist function 'gw_fct_rpt2pg()'"); } } private static boolean processUD(Boolean overwrite, Boolean exists) { // Iterate over targets Iterator<Entry<Integer, RptTarget>> it = mapRptTargets.entrySet().iterator(); while (it.hasNext()) { insertSql = ""; Map.Entry<Integer, RptTarget> mapEntry = it.next(); rptTarget = mapEntry.getValue(); boolean ok = processRptTarget(); if (abortRptProcess) return false; if (!continueProcess) return false; postProcessTarget(ok, true, overwrite, exists); } return true; } private static boolean processWS(Boolean overwrite, boolean exists) { // Iterate over targets String sql = ""; Iterator<Entry<Integer, RptTarget>> it = mapRptTargets.entrySet().iterator(); while (it.hasNext()) { insertSql = ""; Map.Entry<Integer, RptTarget> mapEntry = it.next(); rptTarget = mapEntry.getValue(); boolean ok = false; boolean processTarget = true; boolean continueTarget; // Target node or arc if (rptTarget.getId() == 40 || rptTarget.getId() == 50) { processTarget = false; continueTarget = true; if (overwrite) { sql = "DELETE FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); MainDao.executeUpdateSql(sql); } else { if (exists) { sql = "DELETE FROM "+MainDao.getSchema()+"."+rptTarget.getTable() + " WHERE result_id = '"+resultName+"'"; MainDao.executeUpdateSql(sql); } } while (continueTarget) { insertSql = ""; ok = processRptTargetWS(); if (abortRptProcess) return false; if (ok) { if (!insertSql.equals("")) { // Check if time is set and update it if (firstLine.length() > 15) { firstLine = firstLine.substring(15, 24).trim(); sql = "UPDATE "+MainDao.getSchema()+"."+rptTarget.getTable() + " SET time = '"+firstLine+"' WHERE time is null;"; insertSql+= sql; } } if (!MainDao.executeUpdateSql(insertSql)) { return false; } } continueTarget = (lineNumber > 0); } } // Target different than node or arc else { ok = processRptTargetWS(); if (abortRptProcess) return false; } if (!continueProcess) return false; postProcessTarget(ok, processTarget, overwrite, exists); } // end iterations over targets (while) return true; } private static boolean postProcessTarget(boolean ok, boolean processTarget, boolean overwrite, boolean exists) { String sql; if (ok && processTarget) { if (overwrite) { sql = "DELETE FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); MainDao.executeUpdateSql(sql); } else { if (exists && rptTarget.getId() != 10) { sql = "DELETE FROM "+MainDao.getSchema()+"."+rptTarget.getTable() + " WHERE result_id = '"+resultName+"'"; MainDao.executeUpdateSql(sql); } } if (!insertSql.equals("")) { boolean status = MainDao.executeUpdateSql(insertSql); if (!status) { String msg = Utils.getBundleString("ImportRpt.import_aborted"); //$NON-NLS-1$ msg+= "\n" + rptTarget.getDescription(); msg+= Utils.getBundleString("ImportRpt.open_log"); //$NON-NLS-1$ Utils.showError(msg); return false; } } } return true; } private static String readLine(){ String line = fileContent.get(lineNumber - 1); return line; } private static boolean initRptTargets() { // Get info from rpt_target into memory mapRptTargets = new LinkedHashMap<Integer, RptTarget>(); String sql = "SELECT id, db_table, description, type, title_lines, tokens, parametrized" + " FROM rpt_target" + " WHERE type <> 0" + " ORDER BY id"; try { ResultSet rs = MainDao.getResultset(connectionDrivers, sql, true, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); while (rs.next()) { RptTarget rptTarget = new RptTarget(rs); mapRptTargets.put(rptTarget.getId(), rptTarget); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); return false; } // Iterate over targets and get info from rpt_target_fields into memory Iterator<Entry<Integer, RptTarget>> it = mapRptTargets.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Integer, RptTarget> mapEntry = it.next(); RptTarget rptTarget = mapEntry.getValue(); sql = "SELECT target_id || '_' || db_name as id, target_id, rpt_name, db_name, db_type" + " FROM rpt_target_fields" + " WHERE target_id = "+rptTarget.getId(); ResultSet rs = MainDao.getResultset(connectionDrivers, sql, true, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); try { while (rs.next()) { RptTargetField rptTargetField = new RptTargetField(rs); rptTarget.addRptTargetField(rptTargetField); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); return false; } } return true; } private static boolean getRptContent() { fileContent = new ArrayList<String>(); Boolean ok = true; String line; try { long fileLength = rat.length(); lineNumber = 0; while (rat.getFilePointer() < fileLength) { lineNumber++; line = rat.readLine().trim(); fileContent.add(line); } totalLines = lineNumber; lineNumber = 0; } catch (IOException e) { Utils.showError(e); ok = false; } return ok; } private static boolean existsProjectName() { String sql = "SELECT * FROM "+MainDao.getSchema()+"."+TABLE_CAT_RESULT+ " WHERE result_id = '"+resultName+"'"; try { PreparedStatement ps = MainDao.getConnectionPostgis().prepareStatement(sql); ResultSet rs = ps.executeQuery(); return rs.next(); } catch (SQLException e) { Utils.showError(e, sql); return false; } } private static boolean openRptFile() { Boolean ok = true; try { rat = new RandomAccessFile(fileRpt, "r"); lineNumber = 0; } catch (FileNotFoundException e) { Utils.showError("inp_error_notfound", fileRpt.getAbsolutePath()); ok = false; } return ok; } // Process current RptTarget (UD) private static boolean processRptTarget() { // Read lines until rpt.getDescription() is found boolean found = false; String line; String aux; Utils.getLogger().info("Target: "+rptTarget.getId()+ " - "+rptTarget.getDescription()); // Read lines until rpt.getDescription() is found while (!found) { if (lineNumber >= totalLines) { lineNumber = 0; return false; } lineNumber++; line = readLine(); if (line.length() >= rptTarget.getDescription().length()) { aux = line.substring(0, rptTarget.getDescription().length()).toLowerCase(); if (aux.equals(rptTarget.getDescription().toLowerCase())) { found = true; Utils.getLogger().info("Target line number: "+lineNumber); } } } if (rptTarget.getType() == 3 || rptTarget.getType() == 5 || rptTarget.getType() == 6) { getPollutants(); } // Jump number of lines specified in rpt.getTitleLines() for (int i = 1; i <= rptTarget.getTitleLines(); i++) { lineNumber++; line = readLine(); // Check if we have reached next Target if (line.contains("No ")) { return false; } } // Get Database fields related to this Target if (rptTarget.getColumnCount() == 0) { String sql = "SELECT * FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); try { ResultSet rs = MainDao.getResultset(sql); ResultSetMetaData rsmd = rs.getMetaData(); for (int i = 1; i <= rsmd.getColumnCount(); i++) { rptTarget.addColumnName(rsmd.getColumnName(i)); rptTarget.addColumnType(rsmd.getColumnType(i)); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); } } // Read following lines until blank line is found rptTokensList = new ArrayList<ArrayList<RptToken>>(); rptTokens = new ArrayList<RptToken>(); if (rptTarget.getId() == 10) { parseLinesAnalysis(); processTokensAnalysis(); } else if (rptTarget.getType() == 2 && rptTarget.getId() != 10) { continueProcess = parseLines(); processTokensCheck(); } else if (rptTarget.getType() == 3) { continueProcess = parseLines(); processTokens3(); } else { continueProcess = parseLines(); } return true; } private static boolean processTokensCheck() { boolean result; if (rptTarget.getParametrized() == 0) { result = processTokens(); } else { result = processTokensParametrized(); } return result; } // UD private static boolean parseLinesAnalysis() { boolean result = true; rptTokens = new ArrayList<RptToken>(); boolean blankLine = false; while (!blankLine) { lineNumber++; String line = readLine(); blankLine = (line.length() == 0); if (!blankLine) { Scanner scanner = new Scanner(line); parseLine2(scanner, true); } if (abortRptProcess) { return false; } } return result; } // UD private static void getPollutants() { String line = ""; int jumpLines; if (rptTarget.getType() == 3) { lineNumber--; line = readLine(); } else { jumpLines = (rptTarget.getType() == 5) ? 4 : 5; for (int i = 1; i <= jumpLines; i++) { lineNumber++; line = readLine(); } } boolean blankLine = (line.length() == 0); if (!blankLine) { Scanner scanner = new Scanner(line); if (rptTarget.getType() == 3 || rptTarget.getType() == 6) { int jumpScanner = (rptTarget.getType() == 3) ? 1 : 4; for (int i = 0; i < jumpScanner; i++) { scanner.next(); } } // Get pollutant name parseLine1(scanner); pollutants = new ArrayList<String>(); for (int i = 0; i < rptTokens.size(); i++) { pollutants.add(rptTokens.get(i).getRptValue()); } } } // Parse all lines private static boolean parseLines() { boolean result = true; rptTokens = new ArrayList<RptToken>(); boolean blankLine = false; boolean valid = true; while (!blankLine && valid) { lineNumber++; String line = readLine(); blankLine = (line.length() == 0); if (softwareName.equals("ws") && rptTarget.getId() == 30) { valid = !line.contains("---"); } if (!blankLine && valid) { line = line.replace("-", " -"); Scanner scanner = new Scanner(line); if (rptTarget.getType() == 1) { parseLine1(scanner); result = processTokensCheck(); if (!result) return false; } else if (rptTarget.getType() == 2) { parseLine2(scanner, true); } else if (rptTarget.getType() == 3) { rptTokens = new ArrayList<RptToken>(); parseLine2(scanner, false); rptTokensList.add(rptTokens); } else if (rptTarget.getType() == 4) { parseLineType4(scanner); processTokensCheck(); } else if (rptTarget.getType() == 5) { parseLine1(scanner); processTokens5(); } else if (rptTarget.getType() == 6) { parseLine1(scanner); processTokens6(); } else if (rptTarget.getType() == 7) { parseLine1(scanner); processTokens6(); } } if (abortRptProcess) { return false; } } return result; } // Parse values of current line private static void parseLine1(Scanner scanner) { rptTokens = new ArrayList<RptToken>(); String rptValue = ""; while (scanner.hasNext()) { rptValue = scanner.next(); RptToken rptToken = new RptToken("", rptValue); rptTokens.add(rptToken); } } private static void parseLineType4(Scanner scanner) { rptTokens = new ArrayList<RptToken>(); String rptValue = ""; while (scanner.hasNext()) { rptValue+= " "+scanner.next(); } rptToken = new RptToken("", rptValue.trim()); rptTokens.add(rptToken); } // Parse values of current line that contains ".." in it private static void parseLine2(Scanner scanner, boolean together) { String rptName = ""; String rptValue = ""; String token; boolean valueFound = false; int numTokens = 0; while (scanner.hasNext()) { token = scanner.next(); if (token.contains("..")) { valueFound = true; } if (valueFound && !token.contains("..")) { numTokens++; if (numTokens <= rptTarget.getTokens()) { if (together) { rptValue+= token + " "; } else { rptName = rptName.substring(0, rptName.length() - 1); rptToken = new RptToken(rptName, token); rptTokens.add(rptToken); } } } if (!valueFound && !token.contains("..")) { rptName+= token.toLowerCase() + "_"; } } if (valueFound && together) { rptName = rptName.substring(0, rptName.length() - 1); rptToken = new RptToken(rptName, rptValue.trim()); rptTokens.add(rptToken); } } private static boolean processTokens() { String fields = "result_id, "; String values = "'"+resultName+"', "; boolean ignoreToken = false; if (softwareName.equals("ws")) { if (rptTokens.size() < 2) { Utils.logError("Line not valid"); return true; } } // Customization for target Storage Volume Summary // Ignore field number 4 if: target = 110 and number of tokens > 9 // Not checking if version = 5.1 to avoid further errors if (rptTarget.getId() == 110 && rptTokens.size() > 9) { // Ignoring value for this target... ignoreToken = true; } for (int i=0; i<rptTokens.size(); i++) { RptToken rptToken = rptTokens.get(i); int j = i+3; String value = rptToken.getRptValue(); Integer dbType; if (ignoreToken && i > 4) { j--; } switch (rptTarget.getColumnType(j)) { case Types.NUMERIC: case Types.DOUBLE: case Types.INTEGER: dbType = 1; break; default: dbType = 0; break; } if (ignoreToken && i == 4) { // Ignoring value for this target... } else { String result = processField(rptTarget.getColumnName(j), value, dbType); if (result.equals("-1")) { abortRptProcess = true; return false; } values+= result+", "; fields+= rptTarget.getColumnName(j) + ", "; } } // Build SQL Insert sentence insertSql+= buildSql(rptTarget, fields, values); return true; } private static boolean processTokensParametrized() { String fields = "result_id, "; String values = "'"+resultName+"', "; if (softwareName.equals("ws")) { if (rptTokens.size() < 2) { Utils.logError("Line not valid"); return true; } } // Set ResultSet for rpt destination table String sqlDest = "SELECT * FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); ResultSet rsDest = MainDao.getResultset(sqlDest); // Iterate over rptTokens for (int i=0; i<rptTokens.size(); i++) { RptToken rptToken = rptTokens.get(i); // Search if that RptTargetField exists in the Database String sql = "SELECT db_name, db_type" + " FROM rpt_target_fields" + " WHERE target_id = "+rptTarget.getId()+" AND lower(rpt_name) = '"+rptToken.getRptName()+"'"; ResultSet rs = MainDao.getResultset(connectionDrivers, sql, true, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); try { if (rs.next()) { // Check if that field exists in rpt destination table String fieldName = rs.getString("db_name"); boolean exists = MainDao.checkColumn(rsDest, fieldName); if (exists) { fields+= fieldName + ", "; String rptValue = rptToken.getRptValue(); Integer dbType = rs.getInt("db_type"); String result = processField(fieldName, rptValue, dbType); if (result.equals("-1")) { return false; } values+= result+", "; } else { Utils.getLogger().info("Field not exists in table '"+rptTarget.getTable()+"': "+fieldName); } } else { Utils.getLogger().info("Target field not found in driver database: "+rptToken.getRptName()); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); return false; } } // Build SQL Insert sentence insertSql+= buildSql(rptTarget, fields, values); return true; } private static void processTokens3() { // Iterate over pollutants for (int i=0; i<pollutants.size(); i++) { String fields = "result_id, poll_id, "; String values = "'"+resultName+"', '"+pollutants.get(i)+"', "; // Iterate over fields for (int j=0; j<rptTokensList.size(); j++) { String value = rptTokensList.get(j).get(i).getRptValue(); values += "'"+value+"', "; fields += rptTarget.getColumnName(j + 4) + ", "; } // Build SQL Insert sentence insertSql+= buildSql(rptTarget, fields, values); } } private static void processTokens5() { String fields = "result_id, subc_id, poll_id, value"; String fixedValues = "'"+resultName+"', '"+rptTokens.get(0).getRptValue()+ "', "; // No permetre tipus String (peta a Subcatchment) try { Integer.parseInt(rptTokens.get(0).getRptValue()); } catch (NumberFormatException e) { return; } // Iterate over pollutants if (rptTokens.size() > pollutants.size()) { for (int i=0; i<pollutants.size(); i++) { Double units = Double.valueOf(rptTokens.get(i+1).getRptValue()); String values = fixedValues + "'"+pollutants.get(i)+"', "+units; String sql = "INSERT INTO "+MainDao.getSchema()+"."+rptTarget.getTable()+" ("+fields+") VALUES ("+values+");\n"; insertSql+= sql; } } } // Outfall Loading Summary (only) private static void processTokens6() { String fields = "result_id, node_id, flow_freq, avg_flow, max_flow, total_vol"; String fields2 = "result_id, node_id, poll_id, value"; String fixedValues = "'"+resultName+"', '"+rptTokens.get(0).getRptValue()+ "', "; // If found separator o resume line skip them if (rptTokens.size() < 5 || rptTokens.get(0).getRptValue().equals("System")) { return; } // Iterate over first 5 fields String values = fixedValues; for (int j=1; j<5; j++) { values+= rptTokens.get(j).getRptValue() + ", "; } values = values.substring(0, values.length() - 2); String sql = "INSERT INTO "+MainDao.getSchema()+"."+rptTarget.getTable()+" ("+fields+") VALUES ("+values+");\n"; insertSql += sql; // Table name hardcoded. Not present in sqlite database for (int i = 0; i < pollutants.size(); i++) { int j = i+5; Double units = Double.valueOf(rptTokens.get(j).getRptValue()); values = fixedValues + "'"+pollutants.get(i)+"', "+units; sql = "DELETE FROM "+MainDao.getSchema()+".rpt_outfallload_sum " + "WHERE result_id = '"+resultName+"' AND node_id = '"+rptTokens.get(0).getRptValue()+"' AND poll_id = '"+pollutants.get(i)+ "';\n"; insertSql+= sql; sql = "INSERT INTO "+MainDao.getSchema()+".rpt_outfallload_sum ("+fields2+") VALUES ("+values+");\n"; insertSql+= sql; } } private static boolean processTokensAnalysis() { String fields = "result_id, "; String values = "'"+resultName+"', "; // Set ResultSet for rpt destination table String sqlDest = "SELECT * FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); ResultSet rsDest = MainDao.getResultset(sqlDest); // Iterate over rptTokens for (int i=0; i<rptTokens.size(); i++) { RptToken rptToken = rptTokens.get(i); // Search if that RptTargetField exists in the Database String sql = "SELECT db_name, db_type" + " FROM rpt_target_fields" + " WHERE target_id = "+rptTarget.getId()+" AND lower(rpt_name) = '"+rptToken.getRptName()+"'"; ResultSet rs = MainDao.getResultset(connectionDrivers, sql, true, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); try { if (rs.next()) { // Check if that field exists in rpt destination table String fieldName = rs.getString("db_name"); boolean exists = MainDao.checkColumn(rsDest, fieldName); if (exists) { fields+= fieldName + ", "; String rptValue = rptToken.getRptValue(); Integer dbType = rs.getInt("db_type"); String result = processField(fieldName, rptValue, dbType); if (result.equals("-1")) { return false; } values+= result+", "; } else { Utils.getLogger().info("Field not exists in table '"+rptTarget.getTable()+"': "+fieldName); } } else { Utils.getLogger().info("Target field not found in driver database: "+rptToken.getRptName()); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); return false; } } // Build SQL Update sentence insertSql+= buildSqlUpdate(rptTarget, fields, values); return true; } private static String processField(String fieldName, String rptValue, Integer dbType) { String result; if (dbType != 0) { boolean ok = Utils.isNumeric(rptValue); if (!ok) { String msg = Utils.getBundleString("ImportRpt.error_line_number")+lineNumber; //$NON-NLS-1$ msg+= "\nField "+fieldName+ Utils.getBundleString("ImportRpt.invalid_numeric_value")+rptValue; //$NON-NLS-2$ msg+= Utils.getBundleString("ImportRpt.import_process"); //$NON-NLS-1$ Utils.showError(msg); result = "-1"; } result = rptValue; } else { result = "'"+rptValue+"'"; } return result; } private static String buildSql(RptTarget rptTarget, String fields, String values) { fields = fields.substring(0, fields.length() - 2); values = values.substring(0, values.length() - 2); String sql = "INSERT INTO "+MainDao.getSchema()+"."+rptTarget.getTable()+" ("+fields+") VALUES ("+values+");\n"; return sql; } private static String buildSqlUpdate(RptTarget rptTarget, String fields, String values) { fields = fields.substring(0, fields.length() - 2); values = values.substring(0, values.length() - 2); String sql = "UPDATE "+MainDao.getSchema()+"."+rptTarget.getTable(); sql += " SET ("+fields+") = ("+values+")"; sql += " WHERE result_id = '"+resultName+"';"; return sql; } // WS private static boolean processRptTargetWS() { boolean found = false; String line = ""; String aux; Utils.getLogger().info("Target: "+rptTarget.getId()+" - "+rptTarget.getDescription()); // Read lines until rpt.getDescription() is found while (!found) { if (lineNumber >= totalLines) { lineNumber = 0; return false; } lineNumber++; line = readLine(); if (line.length() >= rptTarget.getDescription().length()) { aux = line.substring(0, rptTarget.getDescription().length()).toLowerCase(); if (aux.equals(rptTarget.getDescription().toLowerCase())) { found = true; firstLine = line; Utils.getLogger().info("Target line number: " + lineNumber); } } } int jumpLines = rptTarget.getTitleLines(); String fieldsList = "*"; // Target node if (rptTarget.getId() == 40) { jumpLines = 2; fieldsList = "id, result_id, node_id"; for (int i=1; i<=2; i++) { lineNumber++; line = readLine(); } Scanner scanner = new Scanner(line); parseLine1(scanner); for (int i=0; i<rptTokens.size(); i++) { String column = rptTokens.get(i).getRptValue().toLowerCase(); if (column.equals("node")) { // Just ignore them } else if (column.equals("pressure")) { fieldsList+= ", press"; } // Quality else if (column.equals("quality") || column.equals("chemical") || column.equals("%_factor") || column.equals("age")) { fieldsList+= ", quality"; } // Elevation, Demand, Head else if (column.equals("elevation") || column.equals("demand") || column.equals("head") || column.equals("quality")) { fieldsList+= ", "+column; } } fieldsList+= ", other, time"; } // Target arc else if (rptTarget.getId() == 50) { jumpLines = 2; fieldsList = "id, result_id, arc_id"; for (int i=1; i<=2; i++) { lineNumber++; line = readLine(); } Scanner scanner = new Scanner(line); parseLine1(scanner); for (int i=0; i<rptTokens.size(); i++) { String column = rptTokens.get(i).getRptValue().toLowerCase(); if (column.equals("node") || column.equals("status")) { // Just ignore them } else if (column.equals("velocity") || column.equals("velocityunit")) { fieldsList+= ", vel"; } else if (column.equals("f-factor")) { fieldsList+= ", ffactor"; } // Length, Diameter, Flow, Headloss, Setting, Reaction else if (column.equals("length") || column.equals("diameter") || column.equals("flow") || column.equals("headloss") || column.equals("setting") || column.equals("reaction")) { fieldsList+= ", "+column; } } fieldsList+= ", other, time"; } // Jump number of lines specified in rpt.getTitleLines() for (int i = 1; i <= jumpLines; i++) { lineNumber++; line = readLine(); // Check if we have reached next Target if (line.contains("No ")) { return false; } } // Get Database fields related to this Target if (rptTarget.getColumnCount() == 0) { String sql = "SELECT "+fieldsList+" FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); try { ResultSet rs = MainDao.getResultset(sql); ResultSetMetaData rsmd = rs.getMetaData(); for (int i=1; i<=rsmd.getColumnCount(); i++){ rptTarget.addColumnName(rsmd.getColumnName(i)); rptTarget.addColumnType(rsmd.getColumnType(i)); } rs.close(); } catch (SQLException e) { Utils.showError(e, sql); } } // Read following lines until blank line is found rptTokensList = new ArrayList<ArrayList<RptToken>>(); // Target Hydraulic Status if (rptTarget.getId() == 20) { parseLinesHydraulic(); } else { parseLines(); // Target Input Data File if (rptTarget.getId() == 10) { processTokensInputData(); } } return true; } // WS: Parse all lines of Hydraulic Status Target private static void parseLinesHydraulic() { rptTokens = new ArrayList<RptToken>(); boolean blankLine = false; int numBlankLines = 0; while (numBlankLines < 2) { try { lineNumber++; String line = readLine(); blankLine = (line.length()==0); if (!blankLine) { Scanner scanner = new Scanner(line); rptTokens = parseLineHydraulic(scanner); processTokensHydraulic(); numBlankLines = 0; } else { numBlankLines++; } } catch (Exception e) { Utils.logError(e); } } } // WS: Parse values of current line private static ArrayList<RptToken> parseLineHydraulic(Scanner scanner) { ArrayList<RptToken> tokens = new ArrayList<RptToken>(); String token = ""; String first = ""; boolean firstWord = true; while (scanner.hasNext()) { if (firstWord) { first = scanner.next(); firstWord = false; } else { token+= " " + scanner.next(); } } RptToken rptFirst = new RptToken("first", first.trim()); RptToken rptToken = new RptToken("token", token.trim()); tokens.add(rptFirst); tokens.add(rptToken); return tokens; } // WS private static void processTokensHydraulic() { String fields = "result_id, time, text"; String values = "'"+resultName+"', "; String time; String text = ""; time = rptTokens.get(0).getRptValue(); time = rptTokens.get(0).getRptValue().substring(0, time.length() - 1); if (time.substring(0, 7).toLowerCase().equals("warning")){ text = rptTokens.get(0).getRptValue() + " "; time = lastTimeHydraulic; } else{ lastTimeHydraulic = time; } text += rptTokens.get(1).getRptValue(); values += "'"+time+"', '"+text+"'"; String sql = "INSERT INTO "+MainDao.getSchema()+"."+rptTarget.getTable()+" ("+fields+") VALUES ("+values+");\n"; insertSql += sql; } // WS private static boolean processTokensInputData() { // Number of fields without water quality parameters final int NORMAL_NUM_FIELDS = 19; Boolean existWaterFields = false; String fields = "result_id, "; String values = "'"+resultName+"', "; String sql = "SELECT * FROM "+MainDao.getSchema()+"."+rptTarget.getTable(); try { ResultSet rs = MainDao.getResultset(sql); ResultSetMetaData rsmd = rs.getMetaData(); int m = 2; if (rptTokens.size() > NORMAL_NUM_FIELDS) { existWaterFields = true; m = 0; } //System.out.println(rsmd.getColumnCount()); // 24 if (rptTokens.size() < rsmd.getColumnCount() - 6) { Utils.logError("Line not valid"); return true; } rs.close(); int k = 0; for (int j=3; j<rsmd.getColumnCount() - m; j++) { int i = j-3; int columnIndex = j-k; if (existWaterFields) { if (i == 14) { columnIndex = rsmd.getColumnCount() - 1; k++; } else if (i == 15) { columnIndex = rsmd.getColumnCount(); k++; } } String fieldName = rsmd.getColumnName(columnIndex); fields+= fieldName + ", "; String rptValue = rptTokens.get(i).getRptValue(); Integer dbType; switch (rptTarget.getColumnType(columnIndex)) { case Types.NUMERIC: case Types.DOUBLE: case Types.INTEGER: dbType = 1; break; default: dbType = 0; break; } String result = processField(rptTarget.getColumnName(j), rptValue, dbType); if (result.equals("-1")) { abortRptProcess = true; return false; } values+= result+", "; } } catch (SQLException e) { Utils.showError(e, sql); } // Build SQL Update sentence insertSql+= buildSqlUpdate(rptTarget, fields, values); return true; } }
35,890
0.596318
0.590553
1,246
27.817818
24.91526
135
false
false
0
0
0
0
0
0
3.071429
false
false
3
ec5bb1d48bfceab209093fb5fd461cd5118f5510
37,125,697,336,823
8138da3b905564d6b2933d5ebae6b7d5b3d9d20c
/wb/t20190615/MkFlowerPng.java
80fe03cb75bfc0dd83a52bcf8ed845164f03a172
[ "MIT" ]
permissive
stackprobe/Spica01
https://github.com/stackprobe/Spica01
08f0fa0eb67dbc146d3116e74451ade79b9e0589
1e4e1b3e1b20bafc85805f6cf0ee01a16b39a9de
refs/heads/master
2021-06-30T07:16:34.917000
2020-09-29T14:24:10
2020-09-29T14:24:10
155,574,647
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package wb.t20190615; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; import javax.imageio.ImageIO; public class MkFlowerPng { public static void main(String[] args) { try { main2(); System.out.println("OK!"); } catch(Throwable e) { e.printStackTrace(); } System.exit(0); } private static BufferedImage _bi; private static void main2() throws Exception { int w = 320; int h = 320; _bi = ImageIO.read(new File( "C:/wb2/20191201_html/HtmlTests/HtmlTest17/res/src/flower301.png" )); writeFlower("C:/temp/flower301-00.png", 0, 0, w, h); writeFlower("C:/temp/flower301-10.png", w, 0, w, h); writeFlower("C:/temp/flower301-01.png", 0, h, w, h); writeFlower("C:/temp/flower301-11.png", w, h, w, h); _bi = ImageIO.read(new File( "C:/wb2/20191201_html/HtmlTests/HtmlTest17/res/src/flower302.png" )); writeFlower("C:/temp/flower302-00.png", 0, 0, w, h); writeFlower("C:/temp/flower302-10.png", w, 0, w, h); writeFlower("C:/temp/flower302-01.png", 0, h, w, h); writeFlower("C:/temp/flower302-11.png", w, h, w, h); } private static void writeFlower(String wFile, int l, int t, int w, int h) throws Exception { int r = l + w - 1; int b = t + h - 1; int x1 = r; int x2 = l; int y1 = b; int y2 = t; for(int x = l; x <= r; x++) { for(int y = t; y <= b; y++) { int argb = _bi.getRGB(x, y); int a = (argb >>> 24) & 0xff; System.out.println("a: " + a); // test if(a != 0) { x1 = Math.min(x1, x); x2 = Math.max(x2, x); y1 = Math.min(y1, y); y2 = Math.max(y2, y); } } } l = x1; r = x2; t = y1; b = y2; System.out.println("LTRB: " + l + ", " + t + ", " + r + ", " + b); // test int MARGIN = 10; l -= MARGIN; t -= MARGIN; r += MARGIN; b += MARGIN; w = r - l + 1; h = b - t + 1; BufferedImage img = _bi.getSubimage(l, t, w, h); try(FileOutputStream writer = new FileOutputStream(wFile)) { ImageIO.write(img, "png", writer); } } }
UTF-8
Java
2,033
java
MkFlowerPng.java
Java
[]
null
[]
package wb.t20190615; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; import javax.imageio.ImageIO; public class MkFlowerPng { public static void main(String[] args) { try { main2(); System.out.println("OK!"); } catch(Throwable e) { e.printStackTrace(); } System.exit(0); } private static BufferedImage _bi; private static void main2() throws Exception { int w = 320; int h = 320; _bi = ImageIO.read(new File( "C:/wb2/20191201_html/HtmlTests/HtmlTest17/res/src/flower301.png" )); writeFlower("C:/temp/flower301-00.png", 0, 0, w, h); writeFlower("C:/temp/flower301-10.png", w, 0, w, h); writeFlower("C:/temp/flower301-01.png", 0, h, w, h); writeFlower("C:/temp/flower301-11.png", w, h, w, h); _bi = ImageIO.read(new File( "C:/wb2/20191201_html/HtmlTests/HtmlTest17/res/src/flower302.png" )); writeFlower("C:/temp/flower302-00.png", 0, 0, w, h); writeFlower("C:/temp/flower302-10.png", w, 0, w, h); writeFlower("C:/temp/flower302-01.png", 0, h, w, h); writeFlower("C:/temp/flower302-11.png", w, h, w, h); } private static void writeFlower(String wFile, int l, int t, int w, int h) throws Exception { int r = l + w - 1; int b = t + h - 1; int x1 = r; int x2 = l; int y1 = b; int y2 = t; for(int x = l; x <= r; x++) { for(int y = t; y <= b; y++) { int argb = _bi.getRGB(x, y); int a = (argb >>> 24) & 0xff; System.out.println("a: " + a); // test if(a != 0) { x1 = Math.min(x1, x); x2 = Math.max(x2, x); y1 = Math.min(y1, y); y2 = Math.max(y2, y); } } } l = x1; r = x2; t = y1; b = y2; System.out.println("LTRB: " + l + ", " + t + ", " + r + ", " + b); // test int MARGIN = 10; l -= MARGIN; t -= MARGIN; r += MARGIN; b += MARGIN; w = r - l + 1; h = b - t + 1; BufferedImage img = _bi.getSubimage(l, t, w, h); try(FileOutputStream writer = new FileOutputStream(wFile)) { ImageIO.write(img, "png", writer); } } }
2,033
0.572061
0.513527
96
20.177084
21.056469
93
false
false
0
0
0
0
0
0
2.739583
false
false
3
4ef18f2eb72ce43ee1b6232083f601b806ca44b9
37,245,956,423,415
072024ff0c83ca4c66d53c66d3d489b45a16466a
/src/com/yjb/cic/linkedlist/No23EntryNodeInListLoop.java
b894569b55a7ed5cba8771ec15222bbb645f8fbc
[]
no_license
JiabingYang/CodingInterviewChinese2
https://github.com/JiabingYang/CodingInterviewChinese2
1e5fe939997a80e9fae816dd1643d89efeaab8a2
0c8880d8208abc70763cf2d030be528bc29e722e
refs/heads/master
2021-05-05T23:53:51.256000
2019-02-27T08:35:31
2019-02-27T08:35:31
116,843,548
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yjb.cic.linkedlist; /** * 面试题23:链表中环的入口结点 * 题目:一个链表中包含环,如何找出环的入口结点?例如,在图3.8的链表中, * 环的入口结点是结点3。 */ public class No23EntryNodeInListLoop { private static ListNode meetingNode(ListNode head) { ListNode fast = head; ListNode slow = head; while (true) { if (fast == null || fast.next == null) { return null; //遇到null了,说明不存在环 } slow = slow.next; fast = fast.next.next; if (fast == slow) { break; //第一次相遇 } } slow = head; //slow从头开始走, while (slow != fast) { //二者相遇在环的起始结点,则退出 slow = slow.next; fast = fast.next; } return slow; } /* ---------------- 依赖 -------------- */ private static class ListNode { private int val; private ListNode next; ListNode(int val) { this.val = val; } @Override public String toString() { return val + ""; } } /* ---------------- test -------------- */ /** * 测试代码来自: * https://github.com/Wang-Jun-Chao/coding-interviews/blob/master/src/Test56.java */ public static void main(String[] args) { test01(); test02(); test03(); } // 1->2->3->4->5->6 private static void test01() { ListNode n1 = new ListNode(1); ListNode n2 = new ListNode(2); ListNode n3 = new ListNode(3); ListNode n4 = new ListNode(4); ListNode n5 = new ListNode(5); ListNode n6 = new ListNode(6); n1.next = n2; n2.next = n3; n3.next = n4; n4.next = n5; n5.next = n6; System.out.println(meetingNode(n1)); } // 1->2->3->4->5->6 // ^ | // | | // +--------+ private static void test02() { ListNode n1 = new ListNode(1); ListNode n2 = new ListNode(2); ListNode n3 = new ListNode(3); ListNode n4 = new ListNode(4); ListNode n5 = new ListNode(5); ListNode n6 = new ListNode(6); n1.next = n2; n2.next = n3; n3.next = n4; n4.next = n5; n5.next = n6; n6.next = n3; System.out.println(meetingNode(n1)); } // 1->2->3->4->5->6 <-+ // | | // +---+ private static void test03() { ListNode n1 = new ListNode(1); ListNode n2 = new ListNode(2); ListNode n3 = new ListNode(3); ListNode n4 = new ListNode(4); ListNode n5 = new ListNode(5); ListNode n6 = new ListNode(6); n1.next = n2; n2.next = n3; n3.next = n4; n4.next = n5; n5.next = n6; n6.next = n6; System.out.println(meetingNode(n1)); } }
UTF-8
Java
3,064
java
No23EntryNodeInListLoop.java
Java
[ { "context": "\n /**\n * 测试代码来自:\n * https://github.com/Wang-Jun-Chao/coding-interviews/blob/master/src/Test56.java\n ", "end": 1155, "score": 0.9874063730239868, "start": 1142, "tag": "USERNAME", "value": "Wang-Jun-Chao" } ]
null
[]
package com.yjb.cic.linkedlist; /** * 面试题23:链表中环的入口结点 * 题目:一个链表中包含环,如何找出环的入口结点?例如,在图3.8的链表中, * 环的入口结点是结点3。 */ public class No23EntryNodeInListLoop { private static ListNode meetingNode(ListNode head) { ListNode fast = head; ListNode slow = head; while (true) { if (fast == null || fast.next == null) { return null; //遇到null了,说明不存在环 } slow = slow.next; fast = fast.next.next; if (fast == slow) { break; //第一次相遇 } } slow = head; //slow从头开始走, while (slow != fast) { //二者相遇在环的起始结点,则退出 slow = slow.next; fast = fast.next; } return slow; } /* ---------------- 依赖 -------------- */ private static class ListNode { private int val; private ListNode next; ListNode(int val) { this.val = val; } @Override public String toString() { return val + ""; } } /* ---------------- test -------------- */ /** * 测试代码来自: * https://github.com/Wang-Jun-Chao/coding-interviews/blob/master/src/Test56.java */ public static void main(String[] args) { test01(); test02(); test03(); } // 1->2->3->4->5->6 private static void test01() { ListNode n1 = new ListNode(1); ListNode n2 = new ListNode(2); ListNode n3 = new ListNode(3); ListNode n4 = new ListNode(4); ListNode n5 = new ListNode(5); ListNode n6 = new ListNode(6); n1.next = n2; n2.next = n3; n3.next = n4; n4.next = n5; n5.next = n6; System.out.println(meetingNode(n1)); } // 1->2->3->4->5->6 // ^ | // | | // +--------+ private static void test02() { ListNode n1 = new ListNode(1); ListNode n2 = new ListNode(2); ListNode n3 = new ListNode(3); ListNode n4 = new ListNode(4); ListNode n5 = new ListNode(5); ListNode n6 = new ListNode(6); n1.next = n2; n2.next = n3; n3.next = n4; n4.next = n5; n5.next = n6; n6.next = n3; System.out.println(meetingNode(n1)); } // 1->2->3->4->5->6 <-+ // | | // +---+ private static void test03() { ListNode n1 = new ListNode(1); ListNode n2 = new ListNode(2); ListNode n3 = new ListNode(3); ListNode n4 = new ListNode(4); ListNode n5 = new ListNode(5); ListNode n6 = new ListNode(6); n1.next = n2; n2.next = n3; n3.next = n4; n4.next = n5; n5.next = n6; n6.next = n6; System.out.println(meetingNode(n1)); } }
3,064
0.460545
0.421439
118
23.271187
15.703104
85
false
false
0
0
0
0
0
0
0.533898
false
false
3
5b38449ebc72f7b452763fcc4ef0adf39369a2cf
38,293,928,434,989
ca2ceb6d5f3e7714fe657a121e773fec6cf28122
/scheduling/eve_scheduling/src/main/java/com/almende/eve/scheduling/SimpleScheduler.java
ba8ef4225c1e66cd193d42554132ca548a3b47af
[]
no_license
GertBoxem/eve-java
https://github.com/GertBoxem/eve-java
81cdb74332a7f3d8587c5e1ae408a05c2ba379c5
72e1f8847d315e46ee320538cfd0010f16082930
refs/heads/master
2021-01-15T20:28:06.149000
2015-03-18T14:29:40
2015-03-18T14:29:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright: Almende B.V. (2014), Rotterdam, The Netherlands * License: The Apache Software License, Version 2.0 */ package com.almende.eve.scheduling; import java.net.URI; import java.net.URISyntaxException; import java.util.logging.Level; import java.util.logging.Logger; import org.joda.time.DateTime; import com.almende.eve.capabilities.handler.Handler; import com.almende.eve.scheduling.clock.Clock; import com.almende.eve.scheduling.clock.RunnableClock; import com.almende.eve.transport.Receiver; import com.almende.util.uuid.UUID; import com.fasterxml.jackson.databind.node.ObjectNode; /** * The Class SimpleScheduler. */ public class SimpleScheduler implements Scheduler { private static final Logger LOG = Logger.getLogger(SimpleScheduler.class .getName()); private URI schedulerUrl = null; private Handler<Receiver> handle = null; private Clock clock = null; private ObjectNode myParams = null; /** * Instantiates a new abstract scheduler. * * @param params * the params * @param handle * the handle */ public SimpleScheduler(final ObjectNode params, final Handler<Receiver> handle) { if (params.has("senderUrl")) { try { schedulerUrl = new URI(params.get("senderUrl").asText()); } catch (final URISyntaxException e) { LOG.log(Level.WARNING, "Couldn't parse scheduler senderUrl from parameters.", e); } } if (schedulerUrl == null) { try { schedulerUrl = new URI("local:unnamed_scheduler"); } catch (final URISyntaxException e1) { LOG.log(Level.SEVERE, "", e1); } } this.handle = handle; myParams = params; } /* * (non-Javadoc) * @see com.almende.eve.scheduling.Scheduler#schedule(java.lang.Object, * org.joda.time.DateTime) */ @Override public String schedule(final Object msg, final DateTime due) { if (clock == null) { clock = new RunnableClock(); } final String uuid = new UUID().toString(); clock.requestTrigger(uuid, due, new Runnable() { @Override public void run() { handle.get().receive(msg, schedulerUrl, null); } }); return uuid; } /* * (non-Javadoc) * @see com.almende.eve.scheduling.Scheduler#cancel(java.lang.String) */ @Override public void cancel(final String id) { if (clock == null) { clock = new RunnableClock(); return; } clock.cancel(id); } /* * (non-Javadoc) * @see com.almende.eve.scheduling.Scheduler#clear() */ @Override public void clear() { if (clock == null) { clock = new RunnableClock(); return; } clock.clear(); } /** * Gets the scheduler url. * * @return the scheduler url */ public URI getSchedulerUrl() { return schedulerUrl; } /** * Gets the handle. * * @return the handle */ public Handler<Receiver> getHandle() { return handle; } /** * Gets the clock. * * @return the clock */ public Clock getClock() { return clock; } /** * @param clock * the clock to set */ protected void setClock(Clock clock) { this.clock = clock; } /* * (non-Javadoc) * @see com.almende.eve.capabilities.Capability#getParams() */ @Override public ObjectNode getParams() { return myParams; } @Override public String schedule(Object msg, int delay) { return schedule(msg, DateTime.now().plus(delay)); } @Override public String schedule(Object msg, long delay) { return schedule(msg, DateTime.now().plus(delay)); } @Override public long now() { return System.currentTimeMillis(); } @Override public void delete() { clear(); SimpleSchedulerConfig config = new SimpleSchedulerConfig(getParams()); SimpleSchedulerBuilder.delete(config.getId()); } }
UTF-8
Java
3,710
java
SimpleScheduler.java
Java
[ { "context": "/*\n * Copyright: Almende B.V. (2014), Rotterdam, The Netherlands\n * License: Th", "end": 28, "score": 0.9820303320884705, "start": 17, "tag": "NAME", "value": "Almende B.V" } ]
null
[]
/* * Copyright: <NAME>. (2014), Rotterdam, The Netherlands * License: The Apache Software License, Version 2.0 */ package com.almende.eve.scheduling; import java.net.URI; import java.net.URISyntaxException; import java.util.logging.Level; import java.util.logging.Logger; import org.joda.time.DateTime; import com.almende.eve.capabilities.handler.Handler; import com.almende.eve.scheduling.clock.Clock; import com.almende.eve.scheduling.clock.RunnableClock; import com.almende.eve.transport.Receiver; import com.almende.util.uuid.UUID; import com.fasterxml.jackson.databind.node.ObjectNode; /** * The Class SimpleScheduler. */ public class SimpleScheduler implements Scheduler { private static final Logger LOG = Logger.getLogger(SimpleScheduler.class .getName()); private URI schedulerUrl = null; private Handler<Receiver> handle = null; private Clock clock = null; private ObjectNode myParams = null; /** * Instantiates a new abstract scheduler. * * @param params * the params * @param handle * the handle */ public SimpleScheduler(final ObjectNode params, final Handler<Receiver> handle) { if (params.has("senderUrl")) { try { schedulerUrl = new URI(params.get("senderUrl").asText()); } catch (final URISyntaxException e) { LOG.log(Level.WARNING, "Couldn't parse scheduler senderUrl from parameters.", e); } } if (schedulerUrl == null) { try { schedulerUrl = new URI("local:unnamed_scheduler"); } catch (final URISyntaxException e1) { LOG.log(Level.SEVERE, "", e1); } } this.handle = handle; myParams = params; } /* * (non-Javadoc) * @see com.almende.eve.scheduling.Scheduler#schedule(java.lang.Object, * org.joda.time.DateTime) */ @Override public String schedule(final Object msg, final DateTime due) { if (clock == null) { clock = new RunnableClock(); } final String uuid = new UUID().toString(); clock.requestTrigger(uuid, due, new Runnable() { @Override public void run() { handle.get().receive(msg, schedulerUrl, null); } }); return uuid; } /* * (non-Javadoc) * @see com.almende.eve.scheduling.Scheduler#cancel(java.lang.String) */ @Override public void cancel(final String id) { if (clock == null) { clock = new RunnableClock(); return; } clock.cancel(id); } /* * (non-Javadoc) * @see com.almende.eve.scheduling.Scheduler#clear() */ @Override public void clear() { if (clock == null) { clock = new RunnableClock(); return; } clock.clear(); } /** * Gets the scheduler url. * * @return the scheduler url */ public URI getSchedulerUrl() { return schedulerUrl; } /** * Gets the handle. * * @return the handle */ public Handler<Receiver> getHandle() { return handle; } /** * Gets the clock. * * @return the clock */ public Clock getClock() { return clock; } /** * @param clock * the clock to set */ protected void setClock(Clock clock) { this.clock = clock; } /* * (non-Javadoc) * @see com.almende.eve.capabilities.Capability#getParams() */ @Override public ObjectNode getParams() { return myParams; } @Override public String schedule(Object msg, int delay) { return schedule(msg, DateTime.now().plus(delay)); } @Override public String schedule(Object msg, long delay) { return schedule(msg, DateTime.now().plus(delay)); } @Override public long now() { return System.currentTimeMillis(); } @Override public void delete() { clear(); SimpleSchedulerConfig config = new SimpleSchedulerConfig(getParams()); SimpleSchedulerBuilder.delete(config.getId()); } }
3,705
0.665768
0.663612
176
20.079546
19.414862
76
false
false
0
0
0
0
0
0
1.829545
false
false
3
e048c1f67ba27f115237e272945ea3874230a996
35,940,286,377,453
26bba5208fc095333181000b060f45be528d8224
/app/src/main/java/aires/com/fitcook/webservice/WebService.java
71c2cf88a761a8050acd2b88cb556d6dc0490c7a
[]
no_license
saulosaires/FitCook
https://github.com/saulosaires/FitCook
26fcb8763d448e49bc5db8baba41b115b9076a84
8edca4b44c372813df6a3c5e02bb165e9753a185
refs/heads/master
2021-01-17T08:31:25.663000
2018-03-19T03:27:51
2018-03-19T03:27:51
40,696,644
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package aires.com.fitcook.webservice; import android.util.Log; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import org.json.JSONObject; import aires.com.fitcook.FitCookApp; public class WebService { public static final String url="http://mean-pingy.rhcloud.com/api/"; public static final String retrieve="retrieveApp"; public static void retrieveRecipes(long time,final CallBack callBack){ if(callBack==null) { throw new IllegalArgumentException("callBack cant be null"); } StringBuilder mUrl = new StringBuilder(url); mUrl.append(retrieve).append("?time=").append(time); Log.v("WebService",mUrl.toString()); JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, mUrl.toString(), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { callBack.onResponse(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { callBack.onErrorResponse(error); } }); FitCookApp.addRequest(jsonObjectRequest, retrieve); } public static abstract class CallBack { public abstract void onResponse(JSONObject response); public abstract void onErrorResponse(VolleyError error); } }
UTF-8
Java
1,816
java
WebService.java
Java
[]
null
[]
package aires.com.fitcook.webservice; import android.util.Log; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import org.json.JSONObject; import aires.com.fitcook.FitCookApp; public class WebService { public static final String url="http://mean-pingy.rhcloud.com/api/"; public static final String retrieve="retrieveApp"; public static void retrieveRecipes(long time,final CallBack callBack){ if(callBack==null) { throw new IllegalArgumentException("callBack cant be null"); } StringBuilder mUrl = new StringBuilder(url); mUrl.append(retrieve).append("?time=").append(time); Log.v("WebService",mUrl.toString()); JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, mUrl.toString(), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { callBack.onResponse(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { callBack.onErrorResponse(error); } }); FitCookApp.addRequest(jsonObjectRequest, retrieve); } public static abstract class CallBack { public abstract void onResponse(JSONObject response); public abstract void onErrorResponse(VolleyError error); } }
1,816
0.572687
0.572687
62
28.290323
26.973337
111
false
false
0
0
0
0
0
0
0.419355
false
false
3
b5545d6a892a743334b4ed502e5358fc5733834c
35,940,286,376,632
4cfcea4ffc1c23a3be0f2750bfc867bcf2a47c54
/src/main/java/com/mycompany/MathLibrary.java
fec1f2224eefe9ea2981ce9069476fe62b0edd84
[]
no_license
nmanandhar-blogs/simpleApp
https://github.com/nmanandhar-blogs/simpleApp
2d6b7dca34708e9da15f78478f5ad53ec1a93ec6
a9bdfaa821da8bc96b77cbb8ba4455685dcc4d6b
refs/heads/master
2021-01-15T17:41:08.064000
2015-05-16T11:28:31
2015-05-16T11:28:31
35,721,006
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mycompany; /** * Created by nirmal on 5/16/2015. */ public class MathLibrary { public static final boolean NOT_PRIME = false; public static final boolean PRIME = true; boolean isPrime(int number) { if (number < 2) return NOT_PRIME; for (int i = 2; i < number; i++) { if (number % i == 0) return NOT_PRIME; } return PRIME; } Long factorial(int number) { if (number < 0) throw new Error("Cannot compute factorial for negative number"); else if (number == 0) //factorial of 0 is 1 return 1L; else return 1L * number * factorial(number - 1); } }
UTF-8
Java
716
java
MathLibrary.java
Java
[ { "context": "package com.mycompany;\n\n/**\n * Created by nirmal on 5/16/2015.\n */\npublic class MathLibrary {\n\n ", "end": 48, "score": 0.9992114901542664, "start": 42, "tag": "USERNAME", "value": "nirmal" } ]
null
[]
package com.mycompany; /** * Created by nirmal on 5/16/2015. */ public class MathLibrary { public static final boolean NOT_PRIME = false; public static final boolean PRIME = true; boolean isPrime(int number) { if (number < 2) return NOT_PRIME; for (int i = 2; i < number; i++) { if (number % i == 0) return NOT_PRIME; } return PRIME; } Long factorial(int number) { if (number < 0) throw new Error("Cannot compute factorial for negative number"); else if (number == 0) //factorial of 0 is 1 return 1L; else return 1L * number * factorial(number - 1); } }
716
0.537709
0.513967
29
23.689655
19.543238
76
false
false
0
0
0
0
0
0
0.37931
false
false
3
8f27106e756bf19ab14aec4df7b868d7bb0a4fb0
36,507,222,056,264
731aebf21b56d37cbcb4b7064459c29e7f297f84
/Retail Store Application/src/InventoryManager.java
6e01053c817affd8167b4a1c95af91fcb93aad6a
[]
no_license
ratragul/Projects
https://github.com/ratragul/Projects
fbb984a2c8298e5cd7fca51b077f3ff380c58e07
a7c78d169edc2b46d21d9732fcc6f4bb40c58511
refs/heads/master
2021-07-16T19:15:45.332000
2017-10-23T17:08:50
2017-10-23T17:08:50
105,845,580
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; /** * The Class InventoryManager. It Manages the class of Section, Categories, Aisle, Product. */ public class InventoryManager { /** The sections. */ private ArrayList<Section> sections; /** The aisles. */ private ArrayList<Aisle> aisles; /** The categories. */ private ArrayList<Category> categories; /** The products. */ private ArrayList<Product> products; /** * Instantiates a new inventory manager. */ public InventoryManager() { sections = new ArrayList<>(); aisles = new ArrayList<>(); categories = new ArrayList<>(); products = new ArrayList<>(); } /** * Adds a Section to the store. * * @param name the name * @param description the description * @return true, if successful */ public boolean addSection(String name, String description) { Section section = getSection(name); // Create a new Section if existingSection is null if (section == null) { section = new Section(name, description); sections.add(section); return true; } return false; } /** * Adds the aisle to the Section determined by sectionName. * * @param sectionName the section name * @return true, if successful */ public boolean addAisle(String sectionName) { Section existingSection = getSection(sectionName); // If the Section exists add the new Aisle into the list. if (existingSection != null) { Aisle newAisle = new Aisle(existingSection); existingSection.getAisles().add(newAisle); aisles.add(newAisle); return true; } return false; } /** * Adds a Category in the Inventory. * * @param categoryName the category name * @param aisleNum the aisle number * @return true, if successful */ public boolean addCategory(String categoryName, int aisleNum) { Aisle aisle = getAisle(aisleNum); Category category; // if the aisle exists then we add this category into the aisle if (aisle != null) { category = new Category(categoryName, aisle); aisle.getCategories().add(category); categories.add(category); return true; } return false; } /** * Adds the product. * * @param productName the product name * @param category the category * @return true, if successful */ public boolean addProduct(String productName, Category category) { Product product = getProduct(productName); // adds a new Product if it doesn't exist if (product == null) { product = new Product(productName); category.getProducts().add(product); product.setCategory(category); products.add(product); return true; } return false; } /** * Gets the section. * * @param sectionName the section name * @return the section */ public Section getSection(String sectionName) { // iterate sections, and looks for a match with the // section's name and sectionName for (Section section : sections) { if (section.getName().equals(sectionName)) { return section; } } return null; } /** * Gets the aisle. * * @param aisleNum the aisle num * @return the aisle */ public Aisle getAisle(int aisleNum) { // current range of aisleNum if (aisleNum - 1 < aisles.size()) { return aisles.get(aisleNum - 1); } return null; } /** * Gets the category. * * @param categoryName the category name * @return the category */ public Category getCategory(String categoryName) { for (Category category : categories) { if (category.getName().equals(categoryName)) { return category; } } return null; } /** * Gets the product from the Category. * * @param productName the product name * @return the product */ public Product getProduct(String productName) { for (Product product : products) { if (product.getName().equals(productName)) { return product; } } return null; } /** * Removes the section. * * @param sectionName the section name * @return true, if successful */ public boolean removeSection(String sectionName) { Section section = getSection(sectionName); if (section != null) { cleanseAisles(section); sections.remove(section); return true; } return false; } /** * Removes the aisle. * * @param aisleNum the aisle number * @return true, if successful */ public boolean removeAisle(int aisleNum) { if (aisleNum - 1 < aisles.size()) { // get the aisle from our list Aisle aisle = aisles.get(aisleNum - 1); // find the parent Section section = aisle.getSection(); // remove it from the parent and then remove // it from our list section.getAisles().remove(aisle); aisles.remove(aisle); getClass().getName(); cleanseCategory(aisle); return true; } return false; } /** * Removes the category from the Aisle. * * @param categoryName the category name * @return true, if successful */ public boolean removeCategory(String categoryName) { Category category = getCategory(categoryName); if (category != null) { Aisle aisle = category.getAisle(); cleanseProduct(category); aisle.getCategories().remove(category); categories.remove(category); return true; } return false; } /** * Removes the product. * * @param productName the product name * @return true, if successful */ public boolean removeProduct(String productName) { Product product = getProduct(productName); if (product != null) { Category category = product.getCategory(); category.getProducts().remove(product); products.remove(product); return true; } return false; } /** * Deletes aisles whose parent is this section. * * @param section the section */ private void cleanseAisles(Section section) { Iterator<Aisle> iter = aisles.iterator(); while (iter.hasNext()) { Aisle aisle = iter.next(); if (aisle.getSection() == section) { cleanseCategory(aisle); iter.remove(); } } } /** * Deletes categories whose parent is this aisle. * * @param aisle the aisle */ private void cleanseCategory(Aisle aisle) { Iterator<Category> iter = categories.iterator(); while (iter.hasNext()) { Category category = iter.next(); if (category.getAisle() == aisle) { cleanseProduct(category); iter.remove(); } } } /** * Deletes products whose parent is this category. * * @param category */ private void cleanseProduct(Category category) { Iterator<Product> iter = products.iterator(); while (iter.hasNext()) { Product product = iter.next(); if (product.getCategory() == category) { iter.remove(); } } } public void store() throws IOException{ WriteToFile.location(sections, aisles, categories, products); } public void load() throws ClassNotFoundException, IOException { this.sections = WriteToFile.setSection(); this.aisles = WriteToFile.setAisles(); this.categories = WriteToFile.setCategories(); this.products = WriteToFile.setProducts(); } }
UTF-8
Java
7,459
java
InventoryManager.java
Java
[]
null
[]
import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; /** * The Class InventoryManager. It Manages the class of Section, Categories, Aisle, Product. */ public class InventoryManager { /** The sections. */ private ArrayList<Section> sections; /** The aisles. */ private ArrayList<Aisle> aisles; /** The categories. */ private ArrayList<Category> categories; /** The products. */ private ArrayList<Product> products; /** * Instantiates a new inventory manager. */ public InventoryManager() { sections = new ArrayList<>(); aisles = new ArrayList<>(); categories = new ArrayList<>(); products = new ArrayList<>(); } /** * Adds a Section to the store. * * @param name the name * @param description the description * @return true, if successful */ public boolean addSection(String name, String description) { Section section = getSection(name); // Create a new Section if existingSection is null if (section == null) { section = new Section(name, description); sections.add(section); return true; } return false; } /** * Adds the aisle to the Section determined by sectionName. * * @param sectionName the section name * @return true, if successful */ public boolean addAisle(String sectionName) { Section existingSection = getSection(sectionName); // If the Section exists add the new Aisle into the list. if (existingSection != null) { Aisle newAisle = new Aisle(existingSection); existingSection.getAisles().add(newAisle); aisles.add(newAisle); return true; } return false; } /** * Adds a Category in the Inventory. * * @param categoryName the category name * @param aisleNum the aisle number * @return true, if successful */ public boolean addCategory(String categoryName, int aisleNum) { Aisle aisle = getAisle(aisleNum); Category category; // if the aisle exists then we add this category into the aisle if (aisle != null) { category = new Category(categoryName, aisle); aisle.getCategories().add(category); categories.add(category); return true; } return false; } /** * Adds the product. * * @param productName the product name * @param category the category * @return true, if successful */ public boolean addProduct(String productName, Category category) { Product product = getProduct(productName); // adds a new Product if it doesn't exist if (product == null) { product = new Product(productName); category.getProducts().add(product); product.setCategory(category); products.add(product); return true; } return false; } /** * Gets the section. * * @param sectionName the section name * @return the section */ public Section getSection(String sectionName) { // iterate sections, and looks for a match with the // section's name and sectionName for (Section section : sections) { if (section.getName().equals(sectionName)) { return section; } } return null; } /** * Gets the aisle. * * @param aisleNum the aisle num * @return the aisle */ public Aisle getAisle(int aisleNum) { // current range of aisleNum if (aisleNum - 1 < aisles.size()) { return aisles.get(aisleNum - 1); } return null; } /** * Gets the category. * * @param categoryName the category name * @return the category */ public Category getCategory(String categoryName) { for (Category category : categories) { if (category.getName().equals(categoryName)) { return category; } } return null; } /** * Gets the product from the Category. * * @param productName the product name * @return the product */ public Product getProduct(String productName) { for (Product product : products) { if (product.getName().equals(productName)) { return product; } } return null; } /** * Removes the section. * * @param sectionName the section name * @return true, if successful */ public boolean removeSection(String sectionName) { Section section = getSection(sectionName); if (section != null) { cleanseAisles(section); sections.remove(section); return true; } return false; } /** * Removes the aisle. * * @param aisleNum the aisle number * @return true, if successful */ public boolean removeAisle(int aisleNum) { if (aisleNum - 1 < aisles.size()) { // get the aisle from our list Aisle aisle = aisles.get(aisleNum - 1); // find the parent Section section = aisle.getSection(); // remove it from the parent and then remove // it from our list section.getAisles().remove(aisle); aisles.remove(aisle); getClass().getName(); cleanseCategory(aisle); return true; } return false; } /** * Removes the category from the Aisle. * * @param categoryName the category name * @return true, if successful */ public boolean removeCategory(String categoryName) { Category category = getCategory(categoryName); if (category != null) { Aisle aisle = category.getAisle(); cleanseProduct(category); aisle.getCategories().remove(category); categories.remove(category); return true; } return false; } /** * Removes the product. * * @param productName the product name * @return true, if successful */ public boolean removeProduct(String productName) { Product product = getProduct(productName); if (product != null) { Category category = product.getCategory(); category.getProducts().remove(product); products.remove(product); return true; } return false; } /** * Deletes aisles whose parent is this section. * * @param section the section */ private void cleanseAisles(Section section) { Iterator<Aisle> iter = aisles.iterator(); while (iter.hasNext()) { Aisle aisle = iter.next(); if (aisle.getSection() == section) { cleanseCategory(aisle); iter.remove(); } } } /** * Deletes categories whose parent is this aisle. * * @param aisle the aisle */ private void cleanseCategory(Aisle aisle) { Iterator<Category> iter = categories.iterator(); while (iter.hasNext()) { Category category = iter.next(); if (category.getAisle() == aisle) { cleanseProduct(category); iter.remove(); } } } /** * Deletes products whose parent is this category. * * @param category */ private void cleanseProduct(Category category) { Iterator<Product> iter = products.iterator(); while (iter.hasNext()) { Product product = iter.next(); if (product.getCategory() == category) { iter.remove(); } } } public void store() throws IOException{ WriteToFile.location(sections, aisles, categories, products); } public void load() throws ClassNotFoundException, IOException { this.sections = WriteToFile.setSection(); this.aisles = WriteToFile.setAisles(); this.categories = WriteToFile.setCategories(); this.products = WriteToFile.setProducts(); } }
7,459
0.629709
0.629173
325
21.950769
18.961922
91
false
false
0
0
0
0
0
0
0.329231
false
false
3
b9b97908efda8c9d3e9b9cbbff9980dd9c9abf9b
36,541,581,800,028
ce2b333a8983d0c6092745cc6c0642ff9323c8f5
/Prueba/src/modelo/Bloque.java
3ffc4105f8682479e84a9dd2c2fd844d33a05569
[]
no_license
jfcastillo/Football-Game
https://github.com/jfcastillo/Football-Game
6021325cbad0080f9542a7c98459480c04597525
7f9a0de4efc8c15d86316a20917c7fad13bad743
refs/heads/master
2021-06-27T12:43:05.580000
2021-02-10T03:34:13
2021-02-10T03:34:13
210,434,357
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package modelo; /** * Esta clase se encarga cargar los datos de los bloques del mapa. **/ public class Bloque extends ObjetoMapa { /** * Constante que representa el ancho del personaje */ public final static int ANCHO = 32; /** * Constante que representa el largo del personaje */ public final static int ALTO = 32; /** * Constante que representa la ruta de la imagen del bloque */ public final static String BLOQUE = "./resources/Imagenes/bloques/bloqueblanco.png"; public final static String LINEA = "./resources/Imagenes/bloques/whiteline.png"; /** * Atributo que representa el ancho del bloque */ private int ancho; /** * Atributo que representa el largo del bloque */ private int largo; /* * Constructor de la clase Bloque. Se encarga de inicializar las relaciones y atributos. * * @param posicionX * @param posicionY * @param rutaImagen * @param identificador */ public Bloque(int posicionX, int posicionY, String rutaImagen, int identificador) { super(posicionX, posicionY, rutaImagen, true, identificador); ancho = ANCHO; largo = ALTO; } /** * @return ancho */ public int getAncho() { return ancho; } /** * @return largo */ public int getLargo() { return largo; } }
UTF-8
Java
1,325
java
Bloque.java
Java
[]
null
[]
package modelo; /** * Esta clase se encarga cargar los datos de los bloques del mapa. **/ public class Bloque extends ObjetoMapa { /** * Constante que representa el ancho del personaje */ public final static int ANCHO = 32; /** * Constante que representa el largo del personaje */ public final static int ALTO = 32; /** * Constante que representa la ruta de la imagen del bloque */ public final static String BLOQUE = "./resources/Imagenes/bloques/bloqueblanco.png"; public final static String LINEA = "./resources/Imagenes/bloques/whiteline.png"; /** * Atributo que representa el ancho del bloque */ private int ancho; /** * Atributo que representa el largo del bloque */ private int largo; /* * Constructor de la clase Bloque. Se encarga de inicializar las relaciones y atributos. * * @param posicionX * @param posicionY * @param rutaImagen * @param identificador */ public Bloque(int posicionX, int posicionY, String rutaImagen, int identificador) { super(posicionX, posicionY, rutaImagen, true, identificador); ancho = ANCHO; largo = ALTO; } /** * @return ancho */ public int getAncho() { return ancho; } /** * @return largo */ public int getLargo() { return largo; } }
1,325
0.651321
0.648302
63
19.031746
24.343422
89
false
false
0
0
0
0
0
0
1.15873
false
false
3
8294d586c33c8214832f3ee55d59cc5869c2739c
39,462,159,544,415
0ad4acef4a15663b1c2498089c0c9127fea4e203
/src/main/java/com/lgy/nowcoder/JumpBox.java
107bfcc7e98b727e0d4b3c2ec73ab63bb60ddc34
[]
no_license
lgykuuga/learngit
https://github.com/lgykuuga/learngit
88f103740d4711b5084694c4ad8cb6e9f7f6aa7d
870638677589731078da2c0e82f5f70330b06cbc
refs/heads/master
2021-06-18T21:32:03.559000
2021-04-06T03:30:31
2021-04-06T03:30:31
194,051,240
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lgy.nowcoder; import java.io.BufferedReader; import java.io.InputStreamReader; /** * @Description 跳盒子 * * 时间限制:1秒 * * 空间限制:32768K * * 小v在公司负责游戏运营,今天收到一款申请新上架的游戏“跳一跳”,为了确保提供给广大玩家朋友们的游戏都是高品质的,按照运营流程小v必须对新游戏进行全方位了解体验和评估。这款游戏的规则如下: * * 有n个盒子排成了一行,每个盒子上面有一个数字a[i],表示在该盒子上的人最多能向右移动a[i]个盒子(比如当前所在盒子上的数字是3,则表示可以一次向右前进1个盒子,2个盒子或者3个盒子)。 * * 现在小v从左边第一个盒子上开始体验游戏,请问最少需要移动几次能到最后一个盒子上? * * 输入描述: * * 输入 :2 2 3 0 4 * * 表示现在有5个盒子,上面的数字分别是2, 2, 3, 0, 4。 * * * 输出描述: * * 输出:2 * * 小v有两种跳法: * * 跳法1:盒子1 -> 盒子2 -> 盒子3 -> 盒子5,共3下 * * 跳法2:盒子1 -> 盒子3 -> 盒子5,共2下 * * 跳法2的步骤数最少,所以输出最少步数:2。 * * * 输入例子1: * * 2 2 3 0 4 * * * 输出例子1: * * 2 * @Author LGy * @Date 2019/11/15 11:48 **/ public class JumpBox { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputStr = br.readLine(); int[] input = CommonsUtils.parseInts(inputStr.split(" ")); int output = solution(input); System.out.println(output); } private static int solution(int[] input) { //如果只有一个盒子 if (input.length == 1) { return 1; } return -1; } }
UTF-8
Java
1,890
java
JumpBox.java
Java
[ { "context": " *\n * 2 2 3 0 4\n *\n *\n * 输出例子1:\n *\n * 2\n * @Author LGy\n * @Date 2019/11/15 11:48\n **/\npublic class JumpB", "end": 686, "score": 0.9994601011276245, "start": 683, "tag": "USERNAME", "value": "LGy" } ]
null
[]
package com.lgy.nowcoder; import java.io.BufferedReader; import java.io.InputStreamReader; /** * @Description 跳盒子 * * 时间限制:1秒 * * 空间限制:32768K * * 小v在公司负责游戏运营,今天收到一款申请新上架的游戏“跳一跳”,为了确保提供给广大玩家朋友们的游戏都是高品质的,按照运营流程小v必须对新游戏进行全方位了解体验和评估。这款游戏的规则如下: * * 有n个盒子排成了一行,每个盒子上面有一个数字a[i],表示在该盒子上的人最多能向右移动a[i]个盒子(比如当前所在盒子上的数字是3,则表示可以一次向右前进1个盒子,2个盒子或者3个盒子)。 * * 现在小v从左边第一个盒子上开始体验游戏,请问最少需要移动几次能到最后一个盒子上? * * 输入描述: * * 输入 :2 2 3 0 4 * * 表示现在有5个盒子,上面的数字分别是2, 2, 3, 0, 4。 * * * 输出描述: * * 输出:2 * * 小v有两种跳法: * * 跳法1:盒子1 -> 盒子2 -> 盒子3 -> 盒子5,共3下 * * 跳法2:盒子1 -> 盒子3 -> 盒子5,共2下 * * 跳法2的步骤数最少,所以输出最少步数:2。 * * * 输入例子1: * * 2 2 3 0 4 * * * 输出例子1: * * 2 * @Author LGy * @Date 2019/11/15 11:48 **/ public class JumpBox { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inputStr = br.readLine(); int[] input = CommonsUtils.parseInts(inputStr.split(" ")); int output = solution(input); System.out.println(output); } private static int solution(int[] input) { //如果只有一个盒子 if (input.length == 1) { return 1; } return -1; } }
1,890
0.608065
0.56129
74
15.756757
22.142542
105
false
false
0
0
0
0
0
0
0.189189
false
false
3
e61289f6720846be6b4ddfa9ac9752746ba8caf3
33,938,831,629,492
b1e17a1b27d3f4c5fb74109af2156ec2e38db151
/Summoning/nonAIOSummoner/src/nonAIOSummoner/Functions/Banking.java
0b717555f5719512d89cb81a968f731fcacd5420
[]
no_license
sompi/XoBot
https://github.com/sompi/XoBot
3ffcc2efd7d728597f43d4ff5d807552309ff7ce
9ce1326351d22161134716d0952627a05275912d
refs/heads/master
2020-07-10T03:13:22.769000
2019-08-24T14:33:00
2019-08-24T14:33:00
204,152,946
1
0
null
true
2019-08-24T12:15:15
2019-08-24T12:15:15
2019-06-08T17:27:33
2019-06-08T17:27:31
307
0
0
0
null
false
false
package nonAIOSummoner.Functions; import nonAIOSummoner.Data.Data; import xobot.script.methods.Bank; import xobot.script.methods.GameObjects; import xobot.script.methods.Players; import xobot.script.util.Time; import xobot.script.wrappers.interactive.GameObject; public class Banking { public static boolean atHome(){ return Data.HOME_AREA.contains(Players.getMyPlayer().getLocation()); } public static boolean canBank(){ GameObject bank = GameObjects.getNearest(Data.BANK_ID); return bank != null; } public static void doBank(){ Data.status = "Banking"; GameObject bank = GameObjects.getNearest(Data.BANK_ID); bank.interact("use-quickly"); if (Time.sleep(()-> Bank.isOpen(), 12000)){ Bank.depositAllExcept(Data.DONT_BANK_ITEMS); } } }
UTF-8
Java
841
java
Banking.java
Java
[]
null
[]
package nonAIOSummoner.Functions; import nonAIOSummoner.Data.Data; import xobot.script.methods.Bank; import xobot.script.methods.GameObjects; import xobot.script.methods.Players; import xobot.script.util.Time; import xobot.script.wrappers.interactive.GameObject; public class Banking { public static boolean atHome(){ return Data.HOME_AREA.contains(Players.getMyPlayer().getLocation()); } public static boolean canBank(){ GameObject bank = GameObjects.getNearest(Data.BANK_ID); return bank != null; } public static void doBank(){ Data.status = "Banking"; GameObject bank = GameObjects.getNearest(Data.BANK_ID); bank.interact("use-quickly"); if (Time.sleep(()-> Bank.isOpen(), 12000)){ Bank.depositAllExcept(Data.DONT_BANK_ITEMS); } } }
841
0.68371
0.677765
29
28
21.79845
76
false
false
0
0
0
0
0
0
0.517241
false
false
3
1feec740a2bce9a9b5ff2ba45e721253c834077c
36,816,459,701,064
16a3db81bf340123e71e34fe38148a024c8acd0c
/src/com/main/BasicEnemy.java
f31c43dc6b02e3308a1e5add7df62e5aef12807c
[]
no_license
SandraBostrom/PacmanGame
https://github.com/SandraBostrom/PacmanGame
78618c2960172199072703880ad93c3d19825d03
7c28eb6c4bd1826cc1c1d93332f04e9c7a979f5c
refs/heads/main
2023-05-10T08:11:23.302000
2021-06-05T05:16:43
2021-06-05T05:16:43
374,026,612
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.main; import com.main.object.GameObject; import com.main.object.ID; import java.awt.*; public class BasicEnemy extends GameObject { public BasicEnemy(int x, int y, ID id) { super(x, y, id); velX =5; velY= 5; } @Override public void tick() { x += velX; y += velY; if(y <=0 || y >= Game.HEIGHT -32) velY *= -1; if(x <=0 || x >= Game.WIDTH -16) velX *= -1; } @Override public void render(Graphics g) { g.setColor(Color.red); g.fillRect(x,y,16,16); } }
UTF-8
Java
574
java
BasicEnemy.java
Java
[]
null
[]
package com.main; import com.main.object.GameObject; import com.main.object.ID; import java.awt.*; public class BasicEnemy extends GameObject { public BasicEnemy(int x, int y, ID id) { super(x, y, id); velX =5; velY= 5; } @Override public void tick() { x += velX; y += velY; if(y <=0 || y >= Game.HEIGHT -32) velY *= -1; if(x <=0 || x >= Game.WIDTH -16) velX *= -1; } @Override public void render(Graphics g) { g.setColor(Color.red); g.fillRect(x,y,16,16); } }
574
0.526132
0.501742
32
16.9375
16.271021
53
false
false
0
0
0
0
0
0
0.75
false
false
3
89060728e9b2b0d360be316ce89a1abb848b3275
13,632,226,200,282
38b8901beff9faa8bb611f0b8ccb55970050d735
/src/anno/User.java
9d2958ac038fafe1e39f943e5ae878b56a259329
[]
no_license
gghaaa/OZTestAnno
https://github.com/gghaaa/OZTestAnno
f8ea39e3b4d193a0c26ea03a9c4092c9e38d0eff
cb49b863006dfa12c0a77dac77e7d3fb39b05e80
refs/heads/master
2015-08-10T04:32:39.434000
2014-01-23T05:07:12
2014-01-23T05:07:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package anno; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface User { public String userId() default "(none)"; public String password() default "(none)"; public String gruopID() default "(none)"; public String userDescription() default "(none)"; public String oldPassword() default "(none)"; public String newPassword() default "(none)"; }
UTF-8
Java
544
java
User.java
Java
[ { "context": "ult \"(none)\";\n\tpublic String password() default \"(none)\";\n\tpublic String gruopID() default \"(none)\";\n\tpu", "end": 348, "score": 0.8131017684936523, "start": 344, "tag": "PASSWORD", "value": "none" } ]
null
[]
package anno; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface User { public String userId() default "(none)"; public String password() default "(<PASSWORD>)"; public String gruopID() default "(none)"; public String userDescription() default "(none)"; public String oldPassword() default "(none)"; public String newPassword() default "(none)"; }
550
0.766544
0.766544
18
29.222221
17.576992
50
false
false
0
0
0
0
0
0
1
false
false
3
8940accc89c2e3dfb7759ee29b1a9b341949218f
30,494,267,808,737
bf1f86a0d5e0ef6178350a0cc2cb86ba0cc28310
/yj-projects/mall-common/src/java/com/gt/mall/biz/provider/fee/SkuChangeHistoryProvider.java
754dedec2b5009b22173cdb3b27eaa3ccc2981ab
[]
no_license
yandizheng/yj-project
https://github.com/yandizheng/yj-project
97ac3618a9bedf4e70e39d543fefe13da2c48a3e
63f9bbf6ee50187381601072ef5de7f4911e45f4
refs/heads/master
2018-01-12T07:22:26.320000
2015-05-25T01:31:36
2015-05-25T01:31:36
36,202,900
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gt.mall.biz.provider.fee; import java.util.Map; import com.gt.core.util.StringUtils; public class SkuChangeHistoryProvider { private final static String tableName = "sku_change_history"; public String listHistoryByAttr(Map<String, Object> parameter){ StringBuilder sql = new StringBuilder(); sql.append("select a.*, b.title itemName,c.`name` supplierName") .append(" from ") .append(tableName) .append(" a ") .append(" LEFT JOIN item b on a.item_id = b.id ") .append(" LEFT JOIN item_supplier c on b.seller_id = c.plat_user_id ") .append(" where 1=1 "); if (parameter.get("code") != null && StringUtils.hasText((String) parameter.get("code"))){ sql.append(" and a.code like CONCAT('%',#{code},'%') "); } if(parameter.get("status") != null && StringUtils.hasText((String) parameter.get("status"))){ sql.append(" and a.status = #{status} "); } sql.append(" order by a.status asc, a.create_time desc ") .append(" limit #{offset},#{fetchSize} "); return sql.toString(); } public String countHistoryByAttr(Map<String, Object> parameter){ StringBuilder sql = new StringBuilder(); sql.append("select count(*) ") .append(" from ") .append(tableName) .append(" a ") .append(" where 1=1 "); if (parameter.get("code") != null && StringUtils.hasText((String) parameter.get("code"))){ sql.append(" and a.code like CONCAT('%',#{code},'%') "); } if(parameter.get("status") != null && StringUtils.hasText((String) parameter.get("status"))){ sql.append(" and a.status = #{status} "); } return sql.toString(); } }
UTF-8
Java
1,602
java
SkuChangeHistoryProvider.java
Java
[]
null
[]
package com.gt.mall.biz.provider.fee; import java.util.Map; import com.gt.core.util.StringUtils; public class SkuChangeHistoryProvider { private final static String tableName = "sku_change_history"; public String listHistoryByAttr(Map<String, Object> parameter){ StringBuilder sql = new StringBuilder(); sql.append("select a.*, b.title itemName,c.`name` supplierName") .append(" from ") .append(tableName) .append(" a ") .append(" LEFT JOIN item b on a.item_id = b.id ") .append(" LEFT JOIN item_supplier c on b.seller_id = c.plat_user_id ") .append(" where 1=1 "); if (parameter.get("code") != null && StringUtils.hasText((String) parameter.get("code"))){ sql.append(" and a.code like CONCAT('%',#{code},'%') "); } if(parameter.get("status") != null && StringUtils.hasText((String) parameter.get("status"))){ sql.append(" and a.status = #{status} "); } sql.append(" order by a.status asc, a.create_time desc ") .append(" limit #{offset},#{fetchSize} "); return sql.toString(); } public String countHistoryByAttr(Map<String, Object> parameter){ StringBuilder sql = new StringBuilder(); sql.append("select count(*) ") .append(" from ") .append(tableName) .append(" a ") .append(" where 1=1 "); if (parameter.get("code") != null && StringUtils.hasText((String) parameter.get("code"))){ sql.append(" and a.code like CONCAT('%',#{code},'%') "); } if(parameter.get("status") != null && StringUtils.hasText((String) parameter.get("status"))){ sql.append(" and a.status = #{status} "); } return sql.toString(); } }
1,602
0.64794
0.645443
50
31.040001
22.792946
72
false
false
0
0
0
0
0
0
2.26
false
false
3
c68fb246701296d9993c6f1911b82fef939a6749
26,414,048,879,269
73a06b244c479cec65557c58ebf52ceeeef9d5b2
/health_interface/src/main/java/com/itheima/service/OrderService.java
60c1e166b50f3f9d51e6e5326bde5333f215c859
[]
no_license
qingfeng-git/health
https://github.com/qingfeng-git/health
9c973686af46be3a3bad87271e287fd9330dc336
a913a2ab16191cc53a4b7f013be7e8c8b158d2b9
refs/heads/master
2022-12-12T01:02:32.719000
2019-12-15T00:59:54
2019-12-15T00:59:54
292,563,025
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.itheima.service; import com.itheima.entity.Result; import com.itheima.pojo.Member; import java.util.Map; public interface OrderService { Result order(Map map) throws Exception; Map findById(Integer id)throws Exception; Member findBytelephone(String telephone); void add(Member member); void delet(String string); }
UTF-8
Java
357
java
OrderService.java
Java
[]
null
[]
package com.itheima.service; import com.itheima.entity.Result; import com.itheima.pojo.Member; import java.util.Map; public interface OrderService { Result order(Map map) throws Exception; Map findById(Integer id)throws Exception; Member findBytelephone(String telephone); void add(Member member); void delet(String string); }
357
0.742297
0.742297
21
16
17.517338
45
false
false
0
0
0
0
0
0
0.428571
false
false
3
22a6d89e1e8ff88819bba69b885edcf13cff8e54
11,373,073,466,897
bb3f64f022ff79fd3388473268a992771b3265a3
/app/src/main/java/com/roamtech/telephony/roamapp/activity/UnbindPhoneActivity.java
9fbe99feffb97f062422d53066b04a47b74d4bdf
[]
no_license
caibinglong1987/roamApp-studio
https://github.com/caibinglong1987/roamApp-studio
775eda4fcc0826222b2cf27728d786f46165616e
5ea826122c2041b919169f5fd04ace8c04de82bf
refs/heads/master
2021-08-08T12:45:27.916000
2017-11-10T09:58:18
2017-11-10T09:58:18
109,642,996
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.roamtech.telephony.roamapp.activity; import com.roamtech.telephony.roamapp.R; import com.roamtech.telephony.roamapp.base.BaseActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class UnbindPhoneActivity extends BaseActivity { private TextView tvBindedPhoneTip; private TextView tvUnBindPhone; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_unbindphone); } @Override public void initView(Bundle savedInstanceState) { // TODO Auto-generated method stub super.initView(savedInstanceState); tvBindedPhoneTip = (TextView) findViewById(R.id.tv_bindedphonetip); tvUnBindPhone = (TextView) findViewById(R.id.tv_unbindphone); tvBindedPhoneTip.setText("已绑手机:+86 188****1224"); } @Override public void setListener() { // TODO Auto-generated method stub super.setListener(); tvUnBindPhone.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub super.onClick(v); if (v == tvUnBindPhone) { } } }
UTF-8
Java
1,142
java
UnbindPhoneActivity.java
Java
[]
null
[]
package com.roamtech.telephony.roamapp.activity; import com.roamtech.telephony.roamapp.R; import com.roamtech.telephony.roamapp.base.BaseActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class UnbindPhoneActivity extends BaseActivity { private TextView tvBindedPhoneTip; private TextView tvUnBindPhone; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_unbindphone); } @Override public void initView(Bundle savedInstanceState) { // TODO Auto-generated method stub super.initView(savedInstanceState); tvBindedPhoneTip = (TextView) findViewById(R.id.tv_bindedphonetip); tvUnBindPhone = (TextView) findViewById(R.id.tv_unbindphone); tvBindedPhoneTip.setText("已绑手机:+86 188****1224"); } @Override public void setListener() { // TODO Auto-generated method stub super.setListener(); tvUnBindPhone.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub super.onClick(v); if (v == tvUnBindPhone) { } } }
1,142
0.765901
0.757951
46
23.608696
20.815418
69
false
false
0
0
0
0
0
0
1.347826
false
false
3
180c1b14548e964b6a06581a127b7701e8a90d43
26,989,574,509,752
c8d0c73a151d99b9c0b4c6908bc49a55de723e7c
/BaekJoon/1001_A-B.java
75d0a2d1c5c6e088f795c54ce0e14645b55f40c5
[]
no_license
Ubinyou/Problem-Solving
https://github.com/Ubinyou/Problem-Solving
1d4e258b7c24908d96aef2a45b2c27922112dd2f
4d46d389299413657d8f3f77101aa4bb9b4937fb
refs/heads/main
2023-07-01T13:16:52.932000
2023-07-01T10:10:02
2023-07-01T10:10:02
359,124,053
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int a, b; a = sc. nextInt(); b = sc. nextInt(); System.out.println(a-b); } }
UTF-8
Java
239
java
1001_A-B.java
Java
[]
null
[]
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int a, b; a = sc. nextInt(); b = sc. nextInt(); System.out.println(a-b); } }
239
0.539749
0.539749
10
22.9
13.25481
45
false
false
0
0
0
0
0
0
0.8
false
false
3
71ffad09ed3d7c6d7db8c7340c8acd888da1f68f
7,859,790,197,129
5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1
/Code Snippet Repository/Hibernate/Hibernate1247.java
9ac293af2db0d17c55c5fd258feeed65eddb6073
[]
no_license
saber13812002/DeepCRM
https://github.com/saber13812002/DeepCRM
3336a244d4852a364800af3181e03e868cf6f9f5
be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9
refs/heads/master
2023-03-16T00:08:06.473000
2018-04-18T05:29:50
2018-04-18T05:29:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public static void bindAnyMetaDefs(XAnnotatedElement annotatedElement, MetadataBuildingContext context) { AnyMetaDef defAnn = annotatedElement.getAnnotation( AnyMetaDef.class ); AnyMetaDefs defsAnn = annotatedElement.getAnnotation( AnyMetaDefs.class ); boolean mustHaveName = XClass.class.isAssignableFrom( annotatedElement.getClass() ) || XPackage.class.isAssignableFrom( annotatedElement.getClass() ); if ( defAnn != null ) { checkAnyMetaDefValidity( mustHaveName, defAnn, annotatedElement ); bindAnyMetaDef( defAnn, context ); } if ( defsAnn != null ) { for (AnyMetaDef def : defsAnn.value()) { checkAnyMetaDefValidity( mustHaveName, def, annotatedElement ); bindAnyMetaDef( def, context ); } } }
UTF-8
Java
740
java
Hibernate1247.java
Java
[]
null
[]
public static void bindAnyMetaDefs(XAnnotatedElement annotatedElement, MetadataBuildingContext context) { AnyMetaDef defAnn = annotatedElement.getAnnotation( AnyMetaDef.class ); AnyMetaDefs defsAnn = annotatedElement.getAnnotation( AnyMetaDefs.class ); boolean mustHaveName = XClass.class.isAssignableFrom( annotatedElement.getClass() ) || XPackage.class.isAssignableFrom( annotatedElement.getClass() ); if ( defAnn != null ) { checkAnyMetaDefValidity( mustHaveName, defAnn, annotatedElement ); bindAnyMetaDef( defAnn, context ); } if ( defsAnn != null ) { for (AnyMetaDef def : defsAnn.value()) { checkAnyMetaDefValidity( mustHaveName, def, annotatedElement ); bindAnyMetaDef( def, context ); } } }
740
0.75
0.75
16
45.1875
32.226189
105
false
false
0
0
0
0
0
0
3.4375
false
false
3
6dff5778c7ff8cb0b835e46072ee51e8165586ca
22,256,520,561,301
04c8f4e83572a6cfcf84d8c8522a1834f068914b
/src/main/java/es/indra/hlf/vaadin/isfar/model/AdministracionPaciente.java
3d5dea95dd53073d70eecc2aa4f55856a34b7dd9
[]
no_license
fjroa/vaadin
https://github.com/fjroa/vaadin
d39874b7108452a6bf26b9e17b04ff0f0fca10e4
8dfde9f00ee4b86f1eb1da0ad841c47bf18054d9
refs/heads/master
2021-01-01T15:49:35.142000
2014-10-24T13:10:43
2014-10-24T13:10:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package es.indra.hlf.vaadin.isfar.model; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Transient; import javax.persistence.Version; /** * Clase de dominio para la entidad AdministracionPaciente. * * @author INDRA */ @SuppressWarnings("serial") @Entity @Table(name = "ADMINISTRACION_PACIENTE") @SequenceGenerator(name = "SEQ_ADMIN_PACIENTE", sequenceName = "SEQ_ADMIN_PACIENTE", allocationSize = 1) public class AdministracionPaciente implements Serializable { /** * Codigo de la administracion. */ private Integer id; /** * Objeto de la clase Paciente. */ private Paciente paciente; /** * Codigo del Medicamento. */ private Long codMedicamento; /** * codMedicamentoCentro String. */ private String codMedicamentoCentro; /** * Descripcion del Medicamento. */ private String descMedicamento; /** * Descripcion del Medicamento, en un formato mas legible. */ private String descPresentacion; /** * Indica en que unidades esta especificada la frecuencia * posibles valores especificados en PrescripcionMedicamento.UNIDAD_FREC_XXX * tipoUnidadFrecuencia int. */ private int tipoUnidadFrecuencia; /** * Frecuencia del medicamento. */ private Float frecuencia; /** * Cantidad prescrita del medicamento. */ private Float cantidadPrescrita; /** * Cantidad prescrita del medicamento modificada (Es la nueva cantidad a administrar). */ private Float cantidadAdministracion; /** * Fecha y Hora de la administracion. */ private Date fechaHoraAdm; /** * Motivo de la administracion. */ private Motivo motivoAdm; /** * Observaciones sobre la administracion. */ private String observaciones; /** * Codigo del responsable de la administracion. */ private String codUsuarioResponsable; /** * Fecha y Hora de la creacion. */ private Date fechaHoraCreacion; /** * codUnidades Integer. */ private Integer codUnidades; /** * Unidades del medicamento. */ private String unidades; /** * Modo de administracion del medicamento si es no unidosis. */ private String modoAdministracion; /** * Codigo de la via de administracion. */ private Integer codViaAdministracion; /** * Descripcion de la via de administracion. */ private String descViaAdministracion; /** * nResultados. */ private Integer nResultados; /** * Codigo de fluido al que pertenece el multimedicamento. */ private Integer codFluido; /** * Indica si es componente base. */ private boolean base; /** * fechaHoraPrevistaAdministracion Date. */ private Date fechaHoraPrevistaAdmin; /** * Codigo de centro. */ private String codCentro; /** * Descripcion del centro. */ private String descCentro; /** * Linea asistencial de ejecución de la administración. * codAreaEjecucion String. */ private String codAreaEjecucion; /** * Codigo del episodio asociado. */ private String codEpisodio; /** * codEpisodioEjecucion String. */ private String codEpisodioEjecucion; /** * codAsistenciaEjecucion String. */ private String codAsistenciaEjecucion; /** * Numero de lote. */ private String numLote; /** * hbmVersion long. */ private long hbmVersion; /** * Attribute codUsuarioAuditoria. */ private String codUsuarioAuditoria; //NOPMD /** * codCentroEjecucion String. */ private String codCentroEjecucion; /** * descCentroEjecucion String. */ private String descCentroEjecucion; /** * codServicioEjecucion String. */ private String codServicioEjecucion; /** * descServicioEjecucion String. */ private String descServicioEjecucion; /** * ISEC: codProtocoloEjecucion. */ private String codProtocoloEjecucion; /** * ISEC: codActividadEjecucion. */ private String codActividadEjecucion; /** * ISEC: codHojaVisitaEjecucion. */ private String codHojaVisitaEjecucion; /*************/ /** METODOS **/ /*************/ /** * Devuelve el valor de codUsuarioAuditoria. * @return the codUsuarioAuditoria */ @Column(name = "USER_AUDIT") public String getCodUsuarioAuditoria() { return codUsuarioAuditoria; } /** * Modifica el valor de codUsuarioAuditoria. * @param codUsuarioAuditoriaValue a asignar */ public void setCodUsuarioAuditoria(final String codUsuarioAuditoriaValue) { //NOPMD this.codUsuarioAuditoria = codUsuarioAuditoriaValue; } /** * Constructor por defecto. */ public AdministracionPaciente() { super(); } /** * Constructor. * * @param codAdmPaciente Integer */ public AdministracionPaciente(final Integer codAdmPaciente) { super(); this.id = codAdmPaciente; } /** * Obtiene el valor del campo "id". * * @return El valor del campo "id". */ @Basic @Id @Column(name = "CODADMINISTRACIONPACIENTE") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_ADMIN_PACIENTE") public Integer getId() { return id; } /** * Establece el valor del campo "id". * * @param idNew El valor del campo "id". */ public void setId(final Integer idNew) { this.id = idNew; } /** * Devuelvo el objeto Paciente. * * @return the paciente */ @ManyToOne @JoinColumn(name = "CODPACIENTE") public Paciente getPaciente() { return paciente; } /** * Establezco el objeto Paciente. * * @param pacienteNew the Paciente to set */ public void setPaciente(final Paciente pacienteNew) { this.paciente = pacienteNew; } /** * Devuelvo el codigo del medicamento. * * @return the codMedicamento */ @Basic @Column(name = "CODMEDICAMENTO", length = 25) public Long getCodMedicamento() { return codMedicamento; } /** * Establezco el codigo del medicamento. * * @param codMedicamentoNew new value for codMedicamento */ public void setCodMedicamento(final Long codMedicamentoNew) { this.codMedicamento = codMedicamentoNew; } /** * Obtiene el valor del campo "codMedicamentoCentro". * * @return El valor del campo "codMedicamentoCentro". */ @Column public String getCodMedicamentoCentro() { return codMedicamentoCentro; } /** * Establece el valor del campo "codMedicamentoCentro". * * @param codMedicamentoCentro * El valor del campo "codMedicamentoCentro". */ public void setCodMedicamentoCentro(String codMedicamentoCentro) { this.codMedicamentoCentro = codMedicamentoCentro; } /** * Devuelvo la descripcion del medicamento. * * @return the descMedicamento */ @Basic @Column(name = "DESCMEDICAMENTO", length = 255) public String getDescMedicamento() { return descMedicamento; } /** * Establezco la descripcion del medicamento. * * @param descMedicamentoNew new value for descMedicamento */ public void setDescMedicamento(final String descMedicamentoNew) { this.descMedicamento = descMedicamentoNew; } /** * Obtiene el valor del campo "descPresentacion". * * @return El valor del campo "descPresentacion". */ @Column(name = "DESCPRESENTACION", length = 255) public String getDescPresentacion() { return descPresentacion; } /** * Establece el valor del campo "descPresentacion". * * @param descPresentacionNew * El valor del campo "descPresentacion". */ public void setDescPresentacion(final String descPresentacionNew) { this.descPresentacion = descPresentacionNew; } /** * Obtiene el valor del campo "tipoUnidadFrecuencia". * * @return El valor del campo "tipoUnidadFrecuencia". */ @Column public int getTipoUnidadFrecuencia() { return tipoUnidadFrecuencia; } /** * Establece el valor del campo "tipoUnidadFrecuencia". * * @param tipoUnidadFrecuencia * El valor del campo "tipoUnidadFrecuencia". */ public void setTipoUnidadFrecuencia(int tipoUnidadFrecuencia) { this.tipoUnidadFrecuencia = tipoUnidadFrecuencia; } /** * Devuelvo la frecuencia del medicamento. * * @return the frecuencia */ @Basic @Column(name = "FRECUENCIA") public Float getFrecuencia() { return frecuencia; } /** * Establezco la frecuencia del medicamento. * * @param frecuenciaNew new value for frecuencia */ public void setFrecuencia(final Float frecuenciaNew) { this.frecuencia = frecuenciaNew; } /** * Obtiene el valor del campo "cantidadPrescrita". * * @return El valor del campo "cantidadPrescrita". */ @Basic @Column(name = "CANTIDADPRESCRITA") public Float getCantidadPrescrita() { return cantidadPrescrita; } /** * Establece el valor del campo "cantidadPrescrita". * * @param cantidadPrescritaNew El valor del campo "cantidadPrescrita". */ public void setCantidadPrescrita(final Float cantidadPrescritaNew) { this.cantidadPrescrita = cantidadPrescritaNew; } /** * Obtiene el valor del campo "cantidadAdministracion". * * @return El valor del campo "cantidadAdministracion". */ @Basic @Column(name = "CANTIDADADMINISTRACION") public Float getCantidadAdministracion() { return cantidadAdministracion; } /** * Establece el valor del campo "cantidadAdministracion". * * @param cantidadAdministracionNew El valor del campo "cantidadAdministracion". */ public void setCantidadAdministracion(final Float cantidadAdministracionNew) { this.cantidadAdministracion = cantidadAdministracionNew; } /** * Devuelvo la Fecha y Hora de la administracion. * * @return the fechaHoraAdm */ @Basic @Column(name = "FECHAHORAADMINISTRACION") public Date getFechaHoraAdm() { return fechaHoraAdm; } /** * Establezco la Fecha y Hora de la administracion. * * @param fechaHoraAdmNew new value for fechaHoraAdm */ public void setFechaHoraAdm(final Date fechaHoraAdmNew) { this.fechaHoraAdm = fechaHoraAdmNew; } /** * Devuelvo el objeto Motivo. * * @return the motivoAdm */ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "CODMOTIVOADMINISTRACION") public Motivo getMotivoAdm() { return motivoAdm; } /** * Establezco el objeto Motivo. * * @param motivoAdmNew the motivoAdm to set */ public void setMotivoAdm(final Motivo motivoAdmNew) { this.motivoAdm = motivoAdmNew; } /** * Devuelvo las observaciones. * * @return the observaciones */ @Basic @Column(name = "OBSERVACIONESADMINISTRACION", length = 255) public String getObservaciones() { return observaciones; } /** * Establezco las observaciones. * * @param observacionesNew the observaciones to set */ public void setObservaciones(final String observacionesNew) { this.observaciones = observacionesNew; } /** * Devuelvo el codigo del responsable. * * @return the codUsuarioResponsable */ @Basic @Column(name = "CODUSUARIORESPONSABLE", length = 25) public String getCodUsuarioResponsable() { return codUsuarioResponsable; } /** * Establezco el codigo del responsable. * * @param codUsuarioResponsableNew the codUsuarioResponsable to set */ public void setCodUsuarioResponsable(final String codUsuarioResponsableNew) { this.codUsuarioResponsable = codUsuarioResponsableNew; } /** * Devuelvo la Fecha y Hora de creacion. * * @return the fechaHoraCreacion */ @Basic @Column(name = "FECHAHORACREACION") public Date getFechaHoraCreacion() { return fechaHoraCreacion; } /** * Establezco la Fecha y Hora de creacion. * * @param fechaHoraCreacionNew the fechaHoraCreacion to set */ public void setFechaHoraCreacion(final Date fechaHoraCreacionNew) { this.fechaHoraCreacion = fechaHoraCreacionNew; } /** * nResultados. * * @return the nResultados */ @Transient public Integer getNResultados() { return nResultados; } /** * nResultados. * * @param resultados the nResultados to set */ public void setNResultados(final Integer resultados) { nResultados = resultados; } /** * Obtiene el valor del campo "codUnidades". * * @return El valor del campo "codUnidades". */ @Column public Integer getCodUnidades() { return codUnidades; } /** * Establece el valor del campo "codUnidades". * * @param codUnidades * El valor del campo "codUnidades". */ public void setCodUnidades(Integer codUnidades) { this.codUnidades = codUnidades; } /** * unidades. * * @return the unidades */ @Basic @Column public String getUnidades() { return unidades; } /** * unidades. * * @param unidadesNew the unidades to set */ public void setUnidades(final String unidadesNew) { this.unidades = unidadesNew; } /** * Obtiene el valor del campo "modoAdministracion". * @return the modoAdministracion */ @Basic @Column(length = 100) public String getModoAdministracion() { return modoAdministracion; } /** * Establece el valor del campo "modoAdministracion". * @param modoAdministracionNew the modoAdministracion to set */ public void setModoAdministracion(final String modoAdministracionNew) { this.modoAdministracion = modoAdministracionNew; } /** * codViaAdministracion. * * @return the codViaAdministracion */ @Basic @Column public Integer getCodViaAdministracion() { return codViaAdministracion; } /** * codViaAdministracion. * * @param codViaAdministracionNew the codViaAdministracion to set */ public void setCodViaAdministracion(final Integer codViaAdministracionNew) { this.codViaAdministracion = codViaAdministracionNew; } /** * descViaAdministracion. * * @return the descViaAdministracion */ @Basic @Column public String getDescViaAdministracion() { return descViaAdministracion; } /** * descViaAdministracion. * * @param descViaAdministracionNew the descViaAdministracion to set */ public void setDescViaAdministracion(final String descViaAdministracionNew) { this.descViaAdministracion = descViaAdministracionNew; } /** * Obtiene el valor del campo "codFluido". * * @return codFluido */ @Basic @Column(name = "CODFLUIDO") public Integer getCodFluido() { return codFluido; } /** * Establece el valor del campo "codFluido". * * @param codFluidoNew Integer the codFluido to set */ public void setCodFluido(final Integer codFluidoNew) { this.codFluido = codFluidoNew; } /** * Obtiene el valor del campo "base". * * @return base */ @Basic @Column(name = "BASE") public boolean isBase() { return base; } /** * Establece el valor del campo "base". * * @param baseNew Boolean the base to set */ public void setBase(final boolean baseNew) { this.base = baseNew; } /** * Obtiene el valor del campo "fechaHoraPrevistaAdmin". * * @return El valor del campo "fechaHoraPrevistaAdmin". */ @Column(name = "FECHAHORAPREVISTAADMINISTRACIO") public Date getFechaHoraPrevistaAdmin() { return fechaHoraPrevistaAdmin; } /** * Establece el valor del campo "fechaHoraPrevistaAdmin". * * @param fechaHoraPrevistaAdminNew El valor del campo "fechaHoraPrevistaAdmin". */ public void setFechaHoraPrevistaAdmin(final Date fechaHoraPrevistaAdminNew) { this.fechaHoraPrevistaAdmin = fechaHoraPrevistaAdminNew; } /** * Obtiene el codigo del centro. * * @return codCentro */ @Basic @Column(name = "CODCENTRO") public String getCodCentro() { return codCentro; } /** * Establece el codigo del centro. * * @param codCentroNew String */ public void setCodCentro(final String codCentroNew) { this.codCentro = codCentroNew; } /** * Obtiene la descripcion del centro. * * @return descCentro */ @Basic @Column(name = "DESCCENTRO") public String getDescCentro() { return descCentro; } /** * Establece la descripcion del centro. * * @param descCentroNew String */ public void setDescCentro(final String descCentroNew) { this.descCentro = descCentroNew; } /** * Devuelve el codigo del episodio asociado. * @return the codEpisodio */ @Column(name="CODEPISODIO") public String getCodEpisodio() { return codEpisodio; } /** * Establece el codigo del episodio asociado. * @param codEpisodioNew the codEpisodio to set */ public void setCodEpisodio(final String codEpisodioNew) { this.codEpisodio = codEpisodioNew; } /** * Obtiene el valor del campo "codEpisodioEjecucion". * * @return El valor del campo "codEpisodioEjecucion". */ @Column(name="CODEPISODIOEJECUCION") public String getCodEpisodioEjecucion() { return codEpisodioEjecucion; } /** * Establece el valor del campo "codEpisodioEjecucion". * * @param codEpisodioEjecucion * El valor del campo "codEpisodioEjecucion". */ public void setCodEpisodioEjecucion(String codEpisodioEjecucion) { this.codEpisodioEjecucion = codEpisodioEjecucion; } /** * Obtiene el valor del campo "codAsistenciaEjecucion". * * @return El valor del campo "codAsistenciaEjecucion". */ @Column(name="CODASISTENCIAEJECUCION") public String getCodAsistenciaEjecucion() { return codAsistenciaEjecucion; } /** * Establece el valor del campo "codAsistenciaEjecucion". * * @param codAsistenciaEjecucion * El valor del campo "codAsistenciaEjecucion". */ public void setCodAsistenciaEjecucion(String codAsistenciaEjecucion) { this.codAsistenciaEjecucion = codAsistenciaEjecucion; } /** * Devuelve el codigo del numLote. * @return the numLote */ @Basic @Column(name = "NLOTE") public String getNumLote() { return numLote; } /** * Establece el codigo del numLote. * @param numLoteNew the numLote to set */ public void setNumLote(final String numLoteNew) { this.numLote = numLoteNew; } /** * Obtiene el valor del campo "hbmVersion". * * @return El valor del campo "hbmVersion". */ @Version @Column(name = "HBM_VERSION") public long getHbmVersion() { return hbmVersion; } /** * Establece el valor del campo "hbmVersion". * * @param hbmVersionNew * El valor del campo "hbmVersion". */ public void setHbmVersion(final long hbmVersionNew) { this.hbmVersion = hbmVersionNew; } /** * Obtiene el valor del campo "codCentroEjecucion". * * @return El valor del campo "codCentroEjecucion". */ @Column public String getCodCentroEjecucion() { return codCentroEjecucion; } /** * Establece el valor del campo "codCentroEjecucion". * * @param codCentroEjecucion * El valor del campo "codCentroEjecucion". */ public void setCodCentroEjecucion(String codCentroEjecucion) { this.codCentroEjecucion = codCentroEjecucion; } /** * Obtiene el valor del campo "descCentroEjecucion". * * @return El valor del campo "descCentroEjecucion". */ @Column public String getDescCentroEjecucion() { return descCentroEjecucion; } /** * Establece el valor del campo "descCentroEjecucion". * * @param descCentroEjecucion * El valor del campo "descCentroEjecucion". */ public void setDescCentroEjecucion(String descCentroEjecucion) { this.descCentroEjecucion = descCentroEjecucion; } /** * Obtiene el valor del campo "codServicioEjecucion". * * @return El valor del campo "codServicioEjecucion". */ @Column public String getCodServicioEjecucion() { return codServicioEjecucion; } /** * Establece el valor del campo "codServicioEjecucion". * * @param codServicioEjecucion * El valor del campo "codServicioEjecucion". */ public void setCodServicioEjecucion(String codServicioEjecucion) { this.codServicioEjecucion = codServicioEjecucion; } /** * Obtiene el valor del campo "descServicioEjecucion". * * @return El valor del campo "descServicioEjecucion". */ @Column public String getDescServicioEjecucion() { return descServicioEjecucion; } /** * Establece el valor del campo "descServicioEjecucion". * * @param descServicioEjecucion * El valor del campo "descServicioEjecucion". */ public void setDescServicioEjecucion(String descServicioEjecucion) { this.descServicioEjecucion = descServicioEjecucion; } /** * Obtiene el valor del campo "codAreaEjecucion". * * @return El valor del campo "codAreaEjecucion". */ @Column public String getCodAreaEjecucion() { return codAreaEjecucion; } /** * Establece el valor del campo "codAreaEjecucion". * * @param codAreaEjecucion * El valor del campo "codAreaEjecucion". */ public void setCodAreaEjecucion(String codAreaEjecucion) { this.codAreaEjecucion = codAreaEjecucion; } /** * @return the codProtocoloEjecucion */ @Column(name="CODPROTOCOLOEJECUCION") public String getCodProtocoloEjecucion() { return codProtocoloEjecucion; } /** * @param codProtocoloEjecucion the codProtocoloEjecucion to set */ public void setCodProtocoloEjecucion(String codProtocoloEjecucion) { this.codProtocoloEjecucion = codProtocoloEjecucion; } /** * @return the codActividadEjecucion */ @Column(name="CODACTIVIDADEJECUCION") public String getCodActividadEjecucion() { return codActividadEjecucion; } /** * @param codActividadEjecucion the codActividadEjecucion to set */ public void setCodActividadEjecucion(String codActividadEjecucion) { this.codActividadEjecucion = codActividadEjecucion; } /** * @return the codHojaVisitaEjecucion */ @Column(name="CODHOJAVISITAEJECUCION") public String getCodHojaVisitaEjecucion() { return codHojaVisitaEjecucion; } /** * @param codHojaVisitaEjecucion the codHojaVisitaEjecucion to set */ public void setCodHojaVisitaEjecucion(String codHojaVisitaEjecucion) { this.codHojaVisitaEjecucion = codHojaVisitaEjecucion; } }
UTF-8
Java
23,561
java
AdministracionPaciente.java
Java
[ { "context": "a la entidad AdministracionPaciente.\n *\n * @author INDRA\n */\n@SuppressWarnings(\"serial\")\n@Entity\n@Table(na", "end": 643, "score": 0.7945442199707031, "start": 638, "tag": "USERNAME", "value": "INDRA" } ]
null
[]
package es.indra.hlf.vaadin.isfar.model; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Transient; import javax.persistence.Version; /** * Clase de dominio para la entidad AdministracionPaciente. * * @author INDRA */ @SuppressWarnings("serial") @Entity @Table(name = "ADMINISTRACION_PACIENTE") @SequenceGenerator(name = "SEQ_ADMIN_PACIENTE", sequenceName = "SEQ_ADMIN_PACIENTE", allocationSize = 1) public class AdministracionPaciente implements Serializable { /** * Codigo de la administracion. */ private Integer id; /** * Objeto de la clase Paciente. */ private Paciente paciente; /** * Codigo del Medicamento. */ private Long codMedicamento; /** * codMedicamentoCentro String. */ private String codMedicamentoCentro; /** * Descripcion del Medicamento. */ private String descMedicamento; /** * Descripcion del Medicamento, en un formato mas legible. */ private String descPresentacion; /** * Indica en que unidades esta especificada la frecuencia * posibles valores especificados en PrescripcionMedicamento.UNIDAD_FREC_XXX * tipoUnidadFrecuencia int. */ private int tipoUnidadFrecuencia; /** * Frecuencia del medicamento. */ private Float frecuencia; /** * Cantidad prescrita del medicamento. */ private Float cantidadPrescrita; /** * Cantidad prescrita del medicamento modificada (Es la nueva cantidad a administrar). */ private Float cantidadAdministracion; /** * Fecha y Hora de la administracion. */ private Date fechaHoraAdm; /** * Motivo de la administracion. */ private Motivo motivoAdm; /** * Observaciones sobre la administracion. */ private String observaciones; /** * Codigo del responsable de la administracion. */ private String codUsuarioResponsable; /** * Fecha y Hora de la creacion. */ private Date fechaHoraCreacion; /** * codUnidades Integer. */ private Integer codUnidades; /** * Unidades del medicamento. */ private String unidades; /** * Modo de administracion del medicamento si es no unidosis. */ private String modoAdministracion; /** * Codigo de la via de administracion. */ private Integer codViaAdministracion; /** * Descripcion de la via de administracion. */ private String descViaAdministracion; /** * nResultados. */ private Integer nResultados; /** * Codigo de fluido al que pertenece el multimedicamento. */ private Integer codFluido; /** * Indica si es componente base. */ private boolean base; /** * fechaHoraPrevistaAdministracion Date. */ private Date fechaHoraPrevistaAdmin; /** * Codigo de centro. */ private String codCentro; /** * Descripcion del centro. */ private String descCentro; /** * Linea asistencial de ejecución de la administración. * codAreaEjecucion String. */ private String codAreaEjecucion; /** * Codigo del episodio asociado. */ private String codEpisodio; /** * codEpisodioEjecucion String. */ private String codEpisodioEjecucion; /** * codAsistenciaEjecucion String. */ private String codAsistenciaEjecucion; /** * Numero de lote. */ private String numLote; /** * hbmVersion long. */ private long hbmVersion; /** * Attribute codUsuarioAuditoria. */ private String codUsuarioAuditoria; //NOPMD /** * codCentroEjecucion String. */ private String codCentroEjecucion; /** * descCentroEjecucion String. */ private String descCentroEjecucion; /** * codServicioEjecucion String. */ private String codServicioEjecucion; /** * descServicioEjecucion String. */ private String descServicioEjecucion; /** * ISEC: codProtocoloEjecucion. */ private String codProtocoloEjecucion; /** * ISEC: codActividadEjecucion. */ private String codActividadEjecucion; /** * ISEC: codHojaVisitaEjecucion. */ private String codHojaVisitaEjecucion; /*************/ /** METODOS **/ /*************/ /** * Devuelve el valor de codUsuarioAuditoria. * @return the codUsuarioAuditoria */ @Column(name = "USER_AUDIT") public String getCodUsuarioAuditoria() { return codUsuarioAuditoria; } /** * Modifica el valor de codUsuarioAuditoria. * @param codUsuarioAuditoriaValue a asignar */ public void setCodUsuarioAuditoria(final String codUsuarioAuditoriaValue) { //NOPMD this.codUsuarioAuditoria = codUsuarioAuditoriaValue; } /** * Constructor por defecto. */ public AdministracionPaciente() { super(); } /** * Constructor. * * @param codAdmPaciente Integer */ public AdministracionPaciente(final Integer codAdmPaciente) { super(); this.id = codAdmPaciente; } /** * Obtiene el valor del campo "id". * * @return El valor del campo "id". */ @Basic @Id @Column(name = "CODADMINISTRACIONPACIENTE") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_ADMIN_PACIENTE") public Integer getId() { return id; } /** * Establece el valor del campo "id". * * @param idNew El valor del campo "id". */ public void setId(final Integer idNew) { this.id = idNew; } /** * Devuelvo el objeto Paciente. * * @return the paciente */ @ManyToOne @JoinColumn(name = "CODPACIENTE") public Paciente getPaciente() { return paciente; } /** * Establezco el objeto Paciente. * * @param pacienteNew the Paciente to set */ public void setPaciente(final Paciente pacienteNew) { this.paciente = pacienteNew; } /** * Devuelvo el codigo del medicamento. * * @return the codMedicamento */ @Basic @Column(name = "CODMEDICAMENTO", length = 25) public Long getCodMedicamento() { return codMedicamento; } /** * Establezco el codigo del medicamento. * * @param codMedicamentoNew new value for codMedicamento */ public void setCodMedicamento(final Long codMedicamentoNew) { this.codMedicamento = codMedicamentoNew; } /** * Obtiene el valor del campo "codMedicamentoCentro". * * @return El valor del campo "codMedicamentoCentro". */ @Column public String getCodMedicamentoCentro() { return codMedicamentoCentro; } /** * Establece el valor del campo "codMedicamentoCentro". * * @param codMedicamentoCentro * El valor del campo "codMedicamentoCentro". */ public void setCodMedicamentoCentro(String codMedicamentoCentro) { this.codMedicamentoCentro = codMedicamentoCentro; } /** * Devuelvo la descripcion del medicamento. * * @return the descMedicamento */ @Basic @Column(name = "DESCMEDICAMENTO", length = 255) public String getDescMedicamento() { return descMedicamento; } /** * Establezco la descripcion del medicamento. * * @param descMedicamentoNew new value for descMedicamento */ public void setDescMedicamento(final String descMedicamentoNew) { this.descMedicamento = descMedicamentoNew; } /** * Obtiene el valor del campo "descPresentacion". * * @return El valor del campo "descPresentacion". */ @Column(name = "DESCPRESENTACION", length = 255) public String getDescPresentacion() { return descPresentacion; } /** * Establece el valor del campo "descPresentacion". * * @param descPresentacionNew * El valor del campo "descPresentacion". */ public void setDescPresentacion(final String descPresentacionNew) { this.descPresentacion = descPresentacionNew; } /** * Obtiene el valor del campo "tipoUnidadFrecuencia". * * @return El valor del campo "tipoUnidadFrecuencia". */ @Column public int getTipoUnidadFrecuencia() { return tipoUnidadFrecuencia; } /** * Establece el valor del campo "tipoUnidadFrecuencia". * * @param tipoUnidadFrecuencia * El valor del campo "tipoUnidadFrecuencia". */ public void setTipoUnidadFrecuencia(int tipoUnidadFrecuencia) { this.tipoUnidadFrecuencia = tipoUnidadFrecuencia; } /** * Devuelvo la frecuencia del medicamento. * * @return the frecuencia */ @Basic @Column(name = "FRECUENCIA") public Float getFrecuencia() { return frecuencia; } /** * Establezco la frecuencia del medicamento. * * @param frecuenciaNew new value for frecuencia */ public void setFrecuencia(final Float frecuenciaNew) { this.frecuencia = frecuenciaNew; } /** * Obtiene el valor del campo "cantidadPrescrita". * * @return El valor del campo "cantidadPrescrita". */ @Basic @Column(name = "CANTIDADPRESCRITA") public Float getCantidadPrescrita() { return cantidadPrescrita; } /** * Establece el valor del campo "cantidadPrescrita". * * @param cantidadPrescritaNew El valor del campo "cantidadPrescrita". */ public void setCantidadPrescrita(final Float cantidadPrescritaNew) { this.cantidadPrescrita = cantidadPrescritaNew; } /** * Obtiene el valor del campo "cantidadAdministracion". * * @return El valor del campo "cantidadAdministracion". */ @Basic @Column(name = "CANTIDADADMINISTRACION") public Float getCantidadAdministracion() { return cantidadAdministracion; } /** * Establece el valor del campo "cantidadAdministracion". * * @param cantidadAdministracionNew El valor del campo "cantidadAdministracion". */ public void setCantidadAdministracion(final Float cantidadAdministracionNew) { this.cantidadAdministracion = cantidadAdministracionNew; } /** * Devuelvo la Fecha y Hora de la administracion. * * @return the fechaHoraAdm */ @Basic @Column(name = "FECHAHORAADMINISTRACION") public Date getFechaHoraAdm() { return fechaHoraAdm; } /** * Establezco la Fecha y Hora de la administracion. * * @param fechaHoraAdmNew new value for fechaHoraAdm */ public void setFechaHoraAdm(final Date fechaHoraAdmNew) { this.fechaHoraAdm = fechaHoraAdmNew; } /** * Devuelvo el objeto Motivo. * * @return the motivoAdm */ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "CODMOTIVOADMINISTRACION") public Motivo getMotivoAdm() { return motivoAdm; } /** * Establezco el objeto Motivo. * * @param motivoAdmNew the motivoAdm to set */ public void setMotivoAdm(final Motivo motivoAdmNew) { this.motivoAdm = motivoAdmNew; } /** * Devuelvo las observaciones. * * @return the observaciones */ @Basic @Column(name = "OBSERVACIONESADMINISTRACION", length = 255) public String getObservaciones() { return observaciones; } /** * Establezco las observaciones. * * @param observacionesNew the observaciones to set */ public void setObservaciones(final String observacionesNew) { this.observaciones = observacionesNew; } /** * Devuelvo el codigo del responsable. * * @return the codUsuarioResponsable */ @Basic @Column(name = "CODUSUARIORESPONSABLE", length = 25) public String getCodUsuarioResponsable() { return codUsuarioResponsable; } /** * Establezco el codigo del responsable. * * @param codUsuarioResponsableNew the codUsuarioResponsable to set */ public void setCodUsuarioResponsable(final String codUsuarioResponsableNew) { this.codUsuarioResponsable = codUsuarioResponsableNew; } /** * Devuelvo la Fecha y Hora de creacion. * * @return the fechaHoraCreacion */ @Basic @Column(name = "FECHAHORACREACION") public Date getFechaHoraCreacion() { return fechaHoraCreacion; } /** * Establezco la Fecha y Hora de creacion. * * @param fechaHoraCreacionNew the fechaHoraCreacion to set */ public void setFechaHoraCreacion(final Date fechaHoraCreacionNew) { this.fechaHoraCreacion = fechaHoraCreacionNew; } /** * nResultados. * * @return the nResultados */ @Transient public Integer getNResultados() { return nResultados; } /** * nResultados. * * @param resultados the nResultados to set */ public void setNResultados(final Integer resultados) { nResultados = resultados; } /** * Obtiene el valor del campo "codUnidades". * * @return El valor del campo "codUnidades". */ @Column public Integer getCodUnidades() { return codUnidades; } /** * Establece el valor del campo "codUnidades". * * @param codUnidades * El valor del campo "codUnidades". */ public void setCodUnidades(Integer codUnidades) { this.codUnidades = codUnidades; } /** * unidades. * * @return the unidades */ @Basic @Column public String getUnidades() { return unidades; } /** * unidades. * * @param unidadesNew the unidades to set */ public void setUnidades(final String unidadesNew) { this.unidades = unidadesNew; } /** * Obtiene el valor del campo "modoAdministracion". * @return the modoAdministracion */ @Basic @Column(length = 100) public String getModoAdministracion() { return modoAdministracion; } /** * Establece el valor del campo "modoAdministracion". * @param modoAdministracionNew the modoAdministracion to set */ public void setModoAdministracion(final String modoAdministracionNew) { this.modoAdministracion = modoAdministracionNew; } /** * codViaAdministracion. * * @return the codViaAdministracion */ @Basic @Column public Integer getCodViaAdministracion() { return codViaAdministracion; } /** * codViaAdministracion. * * @param codViaAdministracionNew the codViaAdministracion to set */ public void setCodViaAdministracion(final Integer codViaAdministracionNew) { this.codViaAdministracion = codViaAdministracionNew; } /** * descViaAdministracion. * * @return the descViaAdministracion */ @Basic @Column public String getDescViaAdministracion() { return descViaAdministracion; } /** * descViaAdministracion. * * @param descViaAdministracionNew the descViaAdministracion to set */ public void setDescViaAdministracion(final String descViaAdministracionNew) { this.descViaAdministracion = descViaAdministracionNew; } /** * Obtiene el valor del campo "codFluido". * * @return codFluido */ @Basic @Column(name = "CODFLUIDO") public Integer getCodFluido() { return codFluido; } /** * Establece el valor del campo "codFluido". * * @param codFluidoNew Integer the codFluido to set */ public void setCodFluido(final Integer codFluidoNew) { this.codFluido = codFluidoNew; } /** * Obtiene el valor del campo "base". * * @return base */ @Basic @Column(name = "BASE") public boolean isBase() { return base; } /** * Establece el valor del campo "base". * * @param baseNew Boolean the base to set */ public void setBase(final boolean baseNew) { this.base = baseNew; } /** * Obtiene el valor del campo "fechaHoraPrevistaAdmin". * * @return El valor del campo "fechaHoraPrevistaAdmin". */ @Column(name = "FECHAHORAPREVISTAADMINISTRACIO") public Date getFechaHoraPrevistaAdmin() { return fechaHoraPrevistaAdmin; } /** * Establece el valor del campo "fechaHoraPrevistaAdmin". * * @param fechaHoraPrevistaAdminNew El valor del campo "fechaHoraPrevistaAdmin". */ public void setFechaHoraPrevistaAdmin(final Date fechaHoraPrevistaAdminNew) { this.fechaHoraPrevistaAdmin = fechaHoraPrevistaAdminNew; } /** * Obtiene el codigo del centro. * * @return codCentro */ @Basic @Column(name = "CODCENTRO") public String getCodCentro() { return codCentro; } /** * Establece el codigo del centro. * * @param codCentroNew String */ public void setCodCentro(final String codCentroNew) { this.codCentro = codCentroNew; } /** * Obtiene la descripcion del centro. * * @return descCentro */ @Basic @Column(name = "DESCCENTRO") public String getDescCentro() { return descCentro; } /** * Establece la descripcion del centro. * * @param descCentroNew String */ public void setDescCentro(final String descCentroNew) { this.descCentro = descCentroNew; } /** * Devuelve el codigo del episodio asociado. * @return the codEpisodio */ @Column(name="CODEPISODIO") public String getCodEpisodio() { return codEpisodio; } /** * Establece el codigo del episodio asociado. * @param codEpisodioNew the codEpisodio to set */ public void setCodEpisodio(final String codEpisodioNew) { this.codEpisodio = codEpisodioNew; } /** * Obtiene el valor del campo "codEpisodioEjecucion". * * @return El valor del campo "codEpisodioEjecucion". */ @Column(name="CODEPISODIOEJECUCION") public String getCodEpisodioEjecucion() { return codEpisodioEjecucion; } /** * Establece el valor del campo "codEpisodioEjecucion". * * @param codEpisodioEjecucion * El valor del campo "codEpisodioEjecucion". */ public void setCodEpisodioEjecucion(String codEpisodioEjecucion) { this.codEpisodioEjecucion = codEpisodioEjecucion; } /** * Obtiene el valor del campo "codAsistenciaEjecucion". * * @return El valor del campo "codAsistenciaEjecucion". */ @Column(name="CODASISTENCIAEJECUCION") public String getCodAsistenciaEjecucion() { return codAsistenciaEjecucion; } /** * Establece el valor del campo "codAsistenciaEjecucion". * * @param codAsistenciaEjecucion * El valor del campo "codAsistenciaEjecucion". */ public void setCodAsistenciaEjecucion(String codAsistenciaEjecucion) { this.codAsistenciaEjecucion = codAsistenciaEjecucion; } /** * Devuelve el codigo del numLote. * @return the numLote */ @Basic @Column(name = "NLOTE") public String getNumLote() { return numLote; } /** * Establece el codigo del numLote. * @param numLoteNew the numLote to set */ public void setNumLote(final String numLoteNew) { this.numLote = numLoteNew; } /** * Obtiene el valor del campo "hbmVersion". * * @return El valor del campo "hbmVersion". */ @Version @Column(name = "HBM_VERSION") public long getHbmVersion() { return hbmVersion; } /** * Establece el valor del campo "hbmVersion". * * @param hbmVersionNew * El valor del campo "hbmVersion". */ public void setHbmVersion(final long hbmVersionNew) { this.hbmVersion = hbmVersionNew; } /** * Obtiene el valor del campo "codCentroEjecucion". * * @return El valor del campo "codCentroEjecucion". */ @Column public String getCodCentroEjecucion() { return codCentroEjecucion; } /** * Establece el valor del campo "codCentroEjecucion". * * @param codCentroEjecucion * El valor del campo "codCentroEjecucion". */ public void setCodCentroEjecucion(String codCentroEjecucion) { this.codCentroEjecucion = codCentroEjecucion; } /** * Obtiene el valor del campo "descCentroEjecucion". * * @return El valor del campo "descCentroEjecucion". */ @Column public String getDescCentroEjecucion() { return descCentroEjecucion; } /** * Establece el valor del campo "descCentroEjecucion". * * @param descCentroEjecucion * El valor del campo "descCentroEjecucion". */ public void setDescCentroEjecucion(String descCentroEjecucion) { this.descCentroEjecucion = descCentroEjecucion; } /** * Obtiene el valor del campo "codServicioEjecucion". * * @return El valor del campo "codServicioEjecucion". */ @Column public String getCodServicioEjecucion() { return codServicioEjecucion; } /** * Establece el valor del campo "codServicioEjecucion". * * @param codServicioEjecucion * El valor del campo "codServicioEjecucion". */ public void setCodServicioEjecucion(String codServicioEjecucion) { this.codServicioEjecucion = codServicioEjecucion; } /** * Obtiene el valor del campo "descServicioEjecucion". * * @return El valor del campo "descServicioEjecucion". */ @Column public String getDescServicioEjecucion() { return descServicioEjecucion; } /** * Establece el valor del campo "descServicioEjecucion". * * @param descServicioEjecucion * El valor del campo "descServicioEjecucion". */ public void setDescServicioEjecucion(String descServicioEjecucion) { this.descServicioEjecucion = descServicioEjecucion; } /** * Obtiene el valor del campo "codAreaEjecucion". * * @return El valor del campo "codAreaEjecucion". */ @Column public String getCodAreaEjecucion() { return codAreaEjecucion; } /** * Establece el valor del campo "codAreaEjecucion". * * @param codAreaEjecucion * El valor del campo "codAreaEjecucion". */ public void setCodAreaEjecucion(String codAreaEjecucion) { this.codAreaEjecucion = codAreaEjecucion; } /** * @return the codProtocoloEjecucion */ @Column(name="CODPROTOCOLOEJECUCION") public String getCodProtocoloEjecucion() { return codProtocoloEjecucion; } /** * @param codProtocoloEjecucion the codProtocoloEjecucion to set */ public void setCodProtocoloEjecucion(String codProtocoloEjecucion) { this.codProtocoloEjecucion = codProtocoloEjecucion; } /** * @return the codActividadEjecucion */ @Column(name="CODACTIVIDADEJECUCION") public String getCodActividadEjecucion() { return codActividadEjecucion; } /** * @param codActividadEjecucion the codActividadEjecucion to set */ public void setCodActividadEjecucion(String codActividadEjecucion) { this.codActividadEjecucion = codActividadEjecucion; } /** * @return the codHojaVisitaEjecucion */ @Column(name="CODHOJAVISITAEJECUCION") public String getCodHojaVisitaEjecucion() { return codHojaVisitaEjecucion; } /** * @param codHojaVisitaEjecucion the codHojaVisitaEjecucion to set */ public void setCodHojaVisitaEjecucion(String codHojaVisitaEjecucion) { this.codHojaVisitaEjecucion = codHojaVisitaEjecucion; } }
23,561
0.659366
0.658644
990
22.79697
21.512135
104
false
false
0
0
0
0
0
0
0.524242
false
false
3
d09ba414270090e586fe6f8fa716d20b175ff897
8,899,172,280,702
9db7fbf09112dc40955e8be590513e11bc5d4625
/src/main/java/cn/colony/lab/hbase/MyHbaseBolt.java
2e6bc4121df37edf69cc3a04574ae78eb00a3b31
[]
no_license
endeavormoquan/GitPlatformNGUN
https://github.com/endeavormoquan/GitPlatformNGUN
b642c0810f35c011fad78c175eae444946961bbc
d1773b34adb551da418b3b71c3ecf95bb8799bc7
refs/heads/master
2020-03-26T20:54:19.382000
2018-09-16T12:00:53
2018-09-16T12:00:53
145,353,857
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.colony.lab.hbase; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.util.Bytes; import org.apache.storm.task.TopologyContext; import org.apache.storm.topology.BasicOutputCollector; import org.apache.storm.topology.OutputFieldsDeclarer; import org.apache.storm.topology.base.BaseBasicBolt; import org.apache.storm.tuple.Tuple; import org.junit.Test; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; public class MyHbaseBolt extends BaseBasicBolt{ private static final Log LOG = LogFactory.getLog(MyHbaseBolt.class); private static final long serialVersionUID = 8098376166042660822L; private Configuration hbaseConf = null; private Connection connection = null; private Admin admin = null; private SimpleDateFormat df = null; private String timeReversed = null; private String rowKey = null; private String[] families = {"baseinfo","datainfo"};//暂定hbase数据表有两个列族:基本信息和数据信息 @Override public void prepare(Map stormConf, TopologyContext context) { try { hbaseConf = HBaseConfiguration.create(); hbaseConf.set("hbase.zookeeper.quorum", "master"); hbaseConf.set("hbase.rootdir", "hdfs://master:9000/hbase"); hbaseConf.set("zookeeper.znode.parent", "/hbase"); hbaseConf.set("hbase.zookeeper.property.clientPort", "2181"); connection = ConnectionFactory.createConnection(hbaseConf); admin = connection.getAdmin();//TODO do not forget to close the admin? where to close the admin? LOG.info("admin got-------------------------------"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); LOG.info("admin got failed"); } df = new SimpleDateFormat("yyyyMMddHHmmss"); super.prepare(stormConf, context); } private void HBaseOperation(HashMap<String, String> hashMap) throws IOException{ //small table operation TableName tableName = TableName.valueOf(hashMap.get("name").getBytes()); boolean isTableExists = admin.tableExists(tableName); if (isTableExists == false){ LOG.info("TABLE:"+hashMap.get("name")+" DOES NOT EXIST, CREATE NOW"); //为一个新的卫星建立一个新的表 HTableDescriptor descriptor = new HTableDescriptor(tableName); for (String family : families){ HColumnDescriptor cd = new HColumnDescriptor(family); descriptor.addFamily(cd); } admin.createTable(descriptor); } //如果该卫星之前已经创建了表,那么就直接插入数据,到这一步时,一定有一个和该卫星对应的表 //采用翻转时间戳加上卫星名称的方式设计行键 timeReversed = new StringBuffer(df.format(new Date())).reverse().toString(); rowKey = timeReversed + hashMap.get("name"); Table table = connection.getTable(tableName); Put p = new Put(Bytes.toBytes(rowKey)); //TODO 插入数据:测试时只看固定的几个tag,实际使用时,这里还要琢磨一下 p.addColumn(Bytes.toBytes(families[0]), Bytes.toBytes("name"), Bytes.toBytes(hashMap.get("name"))); p.addColumn(Bytes.toBytes(families[0]), Bytes.toBytes("time"), Bytes.toBytes(hashMap.get("time"))); p.addColumn(Bytes.toBytes(families[1]), Bytes.toBytes("data"), Bytes.toBytes(hashMap.get("data"))); table.put(p); table.close(); } @Test public void jsonTest(){ String jsonString = "{\"satainfo\":{\"keys\":\"name:time:data\",\"time\":\"20180806095544\",\"data\":\"57f77471-e444-4baf-a489-dfa365cdb77d\",\"name\":\"sata1\"}}"; System.out.println(jsonString); JSONObject jsonObject = JSON.parseObject(jsonString); String container = jsonObject.getJSONObject("satainfo").getString("keys"); System.out.println(container); } @Override public void execute(Tuple input, BasicOutputCollector collector) { String jsonString = input.getString(0); LOG.info("RECIEVED JSONSTING: " + jsonString); JSONObject jsonObject = JSON.parseObject(jsonString); //TODO consider if the parse is failed String container = jsonObject.getJSONObject("satainfo").getString("keys"); LOG.info("CONTAINER: " + container); if (container != null){ String[] keys = container.split(":"); HashMap<String, String> hashMap = new HashMap<>(); for (String key : keys){ String value = jsonObject.getJSONObject("satainfo").getString(key); hashMap.put(key, value); } try { HBaseOperation(hashMap); } catch (IOException e) { e.printStackTrace(); } } else{ LOG.error("problems occured when parse, CONTAINER is NULL!"); } } @Override public void declareOutputFields(OutputFieldsDeclarer arg0) { } }
GB18030
Java
5,248
java
MyHbaseBolt.java
Java
[ { "context": "\n\t\tString jsonString = \"{\\\"satainfo\\\":{\\\"keys\\\":\\\"name:time:data\\\",\\\"time\\\":\\\"20180806095544\\\",\\\"data\\\":\\\"57f77471", "end": 3776, "score": 0.9980390667915344, "start": 3762, "tag": "KEY", "value": "name:time:data" }, { "context": "ata\\\",\...
null
[]
package cn.colony.lab.hbase; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.util.Bytes; import org.apache.storm.task.TopologyContext; import org.apache.storm.topology.BasicOutputCollector; import org.apache.storm.topology.OutputFieldsDeclarer; import org.apache.storm.topology.base.BaseBasicBolt; import org.apache.storm.tuple.Tuple; import org.junit.Test; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; public class MyHbaseBolt extends BaseBasicBolt{ private static final Log LOG = LogFactory.getLog(MyHbaseBolt.class); private static final long serialVersionUID = 8098376166042660822L; private Configuration hbaseConf = null; private Connection connection = null; private Admin admin = null; private SimpleDateFormat df = null; private String timeReversed = null; private String rowKey = null; private String[] families = {"baseinfo","datainfo"};//暂定hbase数据表有两个列族:基本信息和数据信息 @Override public void prepare(Map stormConf, TopologyContext context) { try { hbaseConf = HBaseConfiguration.create(); hbaseConf.set("hbase.zookeeper.quorum", "master"); hbaseConf.set("hbase.rootdir", "hdfs://master:9000/hbase"); hbaseConf.set("zookeeper.znode.parent", "/hbase"); hbaseConf.set("hbase.zookeeper.property.clientPort", "2181"); connection = ConnectionFactory.createConnection(hbaseConf); admin = connection.getAdmin();//TODO do not forget to close the admin? where to close the admin? LOG.info("admin got-------------------------------"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); LOG.info("admin got failed"); } df = new SimpleDateFormat("yyyyMMddHHmmss"); super.prepare(stormConf, context); } private void HBaseOperation(HashMap<String, String> hashMap) throws IOException{ //small table operation TableName tableName = TableName.valueOf(hashMap.get("name").getBytes()); boolean isTableExists = admin.tableExists(tableName); if (isTableExists == false){ LOG.info("TABLE:"+hashMap.get("name")+" DOES NOT EXIST, CREATE NOW"); //为一个新的卫星建立一个新的表 HTableDescriptor descriptor = new HTableDescriptor(tableName); for (String family : families){ HColumnDescriptor cd = new HColumnDescriptor(family); descriptor.addFamily(cd); } admin.createTable(descriptor); } //如果该卫星之前已经创建了表,那么就直接插入数据,到这一步时,一定有一个和该卫星对应的表 //采用翻转时间戳加上卫星名称的方式设计行键 timeReversed = new StringBuffer(df.format(new Date())).reverse().toString(); rowKey = timeReversed + hashMap.get("name"); Table table = connection.getTable(tableName); Put p = new Put(Bytes.toBytes(rowKey)); //TODO 插入数据:测试时只看固定的几个tag,实际使用时,这里还要琢磨一下 p.addColumn(Bytes.toBytes(families[0]), Bytes.toBytes("name"), Bytes.toBytes(hashMap.get("name"))); p.addColumn(Bytes.toBytes(families[0]), Bytes.toBytes("time"), Bytes.toBytes(hashMap.get("time"))); p.addColumn(Bytes.toBytes(families[1]), Bytes.toBytes("data"), Bytes.toBytes(hashMap.get("data"))); table.put(p); table.close(); } @Test public void jsonTest(){ String jsonString = "{\"satainfo\":{\"keys\":\"name:time:data\",\"time\":\"20180806095544\",\"data\":\"57f77471-e444-4baf-a489-dfa365cdb77d\",\"name\":\"sata1\"}}"; System.out.println(jsonString); JSONObject jsonObject = JSON.parseObject(jsonString); String container = jsonObject.getJSONObject("satainfo").getString("keys"); System.out.println(container); } @Override public void execute(Tuple input, BasicOutputCollector collector) { String jsonString = input.getString(0); LOG.info("RECIEVED JSONSTING: " + jsonString); JSONObject jsonObject = JSON.parseObject(jsonString); //TODO consider if the parse is failed String container = jsonObject.getJSONObject("satainfo").getString("keys"); LOG.info("CONTAINER: " + container); if (container != null){ String[] keys = container.split(":"); HashMap<String, String> hashMap = new HashMap<>(); for (String key : keys){ String value = jsonObject.getJSONObject("satainfo").getString(key); hashMap.put(key, value); } try { HBaseOperation(hashMap); } catch (IOException e) { e.printStackTrace(); } } else{ LOG.error("problems occured when parse, CONTAINER is NULL!"); } } @Override public void declareOutputFields(OutputFieldsDeclarer arg0) { } }
5,248
0.737285
0.724069
138
35.188404
27.68889
166
false
false
0
0
0
0
0
0
2.311594
false
false
3
d250ec438738de4318ffc9baff5af4098ff1cb5e
30,992,484,022,766
e9e21fa70a7f56e580097690a466a52cfee95c7b
/src/GeeksForGeeks/Arrays/MaxSumIncreasingSubSeq.java
1d04a1dcce2ce0027eaad97ed4593b2550673be3
[]
no_license
parikhv15/CTCI_6
https://github.com/parikhv15/CTCI_6
49a01bef36dabb3db527154e9ce75d1adf3038a7
434daeabc98547af254c03cbf1d3f888dadf6ede
refs/heads/master
2021-01-21T13:34:05.300000
2019-12-05T22:59:31
2019-12-05T22:59:31
51,869,784
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package GeeksForGeeks.Arrays; /** * Created by vrajp on 4/1/2016. */ public class MaxSumIncreasingSubSeq { public static void main(String a[]) { MaxSumIncreasingSubSeq msis = new MaxSumIncreasingSubSeq(); int arr[] = {10, 5, 4, 3}; System.out.println(msis.findMaxSum(arr, -1, 0)); } public int findMaxSum(int[] nums, int index, int sum) { if (index >= nums.length) return sum; int max = Integer.MIN_VALUE; for (int i = index + 1 ; i < nums.length; i++) { if (sum == 0 || nums[i] > nums[index]) { max = Math.max(max, findMaxSum(nums, i, sum + nums[i])); } if (sum == 0 && index == -1) max = Math.max(max, findMaxSum(nums, i, sum)); } return max == Integer.MIN_VALUE ? sum : max; } }
UTF-8
Java
853
java
MaxSumIncreasingSubSeq.java
Java
[ { "context": "package GeeksForGeeks.Arrays;\n\n/**\n * Created by vrajp on 4/1/2016.\n */\npublic class MaxSumIncreasingSub", "end": 54, "score": 0.9995624423027039, "start": 49, "tag": "USERNAME", "value": "vrajp" } ]
null
[]
package GeeksForGeeks.Arrays; /** * Created by vrajp on 4/1/2016. */ public class MaxSumIncreasingSubSeq { public static void main(String a[]) { MaxSumIncreasingSubSeq msis = new MaxSumIncreasingSubSeq(); int arr[] = {10, 5, 4, 3}; System.out.println(msis.findMaxSum(arr, -1, 0)); } public int findMaxSum(int[] nums, int index, int sum) { if (index >= nums.length) return sum; int max = Integer.MIN_VALUE; for (int i = index + 1 ; i < nums.length; i++) { if (sum == 0 || nums[i] > nums[index]) { max = Math.max(max, findMaxSum(nums, i, sum + nums[i])); } if (sum == 0 && index == -1) max = Math.max(max, findMaxSum(nums, i, sum)); } return max == Integer.MIN_VALUE ? sum : max; } }
853
0.52286
0.502931
33
24.848484
24.124828
72
false
false
0
0
0
0
0
0
0.787879
false
false
3
86dde70229105192cc233ca32dfa69f9ddfcd281
17,420,387,391,465
3850cece1a187819787a53c348fab45057a8185f
/src/main/java/com/cappuccino/foodcourter/models/db/Product.java
badb6bfba844c5f5b8eb341f6d8e7488f024d105
[]
no_license
cappuccinoVkHack/foodcourter
https://github.com/cappuccinoVkHack/foodcourter
6556472a11703a71099a87b2c2d19e50a3bbc4fc
18d5fa65f4446f05f11105a40ba917af6345ba79
refs/heads/master
2020-08-02T12:05:35.846000
2019-09-28T23:04:31
2019-09-28T23:04:31
211,345,997
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cappuccino.foodcourter.models.db; import javax.persistence.*; import java.util.List; /** * @author Oybek Kasimov <MrKasimov> oibekkasymov@gmail.com * @project foodcourter * @since 28.09.2019 */ @Entity @Table(name = "products") public class Product extends Auditable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Integer id; @Column(name = "name") private String name; @Column(name = "price") private Double price; @Column(name = "need_to_promote", nullable = false) private Boolean needToPromote; @Column(name = "description") private String description; @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH) @JoinTable( name = "products_images", joinColumns = @JoinColumn(name="product_id"), inverseJoinColumns = @JoinColumn(name="image_id") ) private List<FileAttachment> images; public List<FileAttachment> getImages() { return images; } public Product setImages(List<FileAttachment> images) { this.images = images; return this; } public Integer getId() { return id; } public Product setId(Integer id) { this.id = id; return this; } public String getName() { return name; } public Product setName(String name) { this.name = name; return this; } public Double getPrice() { return price; } public Product setPrice(Double price) { this.price = price; return this; } public Boolean getNeedToPromote() { return needToPromote; } public Product setNeedToPromote(Boolean needToPromote) { this.needToPromote = needToPromote; return this; } public String getDescription() { return description; } public Product setDescription(String description) { this.description = description; return this; } }
UTF-8
Java
2,019
java
Product.java
Java
[ { "context": "sistence.*;\nimport java.util.List;\n\n/**\n * @author Oybek Kasimov <MrKasimov> oibekkasymov@gmail.com\n * @project fo", "end": 127, "score": 0.9998937845230103, "start": 114, "tag": "NAME", "value": "Oybek Kasimov" }, { "context": "rt java.util.List;\n\n/**\n * @autho...
null
[]
package com.cappuccino.foodcourter.models.db; import javax.persistence.*; import java.util.List; /** * @author <NAME> <MrKasimov> <EMAIL> * @project foodcourter * @since 28.09.2019 */ @Entity @Table(name = "products") public class Product extends Auditable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Integer id; @Column(name = "name") private String name; @Column(name = "price") private Double price; @Column(name = "need_to_promote", nullable = false) private Boolean needToPromote; @Column(name = "description") private String description; @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH) @JoinTable( name = "products_images", joinColumns = @JoinColumn(name="product_id"), inverseJoinColumns = @JoinColumn(name="image_id") ) private List<FileAttachment> images; public List<FileAttachment> getImages() { return images; } public Product setImages(List<FileAttachment> images) { this.images = images; return this; } public Integer getId() { return id; } public Product setId(Integer id) { this.id = id; return this; } public String getName() { return name; } public Product setName(String name) { this.name = name; return this; } public Double getPrice() { return price; } public Product setPrice(Double price) { this.price = price; return this; } public Boolean getNeedToPromote() { return needToPromote; } public Product setNeedToPromote(Boolean needToPromote) { this.needToPromote = needToPromote; return this; } public String getDescription() { return description; } public Product setDescription(String description) { this.description = description; return this; } }
1,997
0.623081
0.619118
93
20.709677
18.623363
68
false
false
0
0
0
0
0
0
0.333333
false
false
3
e3a30e08a07eb627cf0a172591672e155b40cc41
33,492,154,997,631
d94a9c963d41805edfdc50d2784e763eb9f0400e
/debugger/app/src/main/java/ru/kefungus/debugger/Debugger.java
65c30211154a71b92d2421d42b7d8a06b4dab9b0
[]
no_license
Roggired/mspi-joke
https://github.com/Roggired/mspi-joke
f0e816c6c39350b94127a039f40199f50668a71c
76f085f7f95a7245f9d2f4f7fea3c49cfd6564df
refs/heads/main
2023-04-29T21:04:25.116000
2021-05-19T18:01:31
2021-05-19T18:01:31
368,953,181
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.kefungus.debugger; import com.sun.jdi.*; import com.sun.jdi.connect.AttachingConnector; import com.sun.jdi.connect.Connector; import com.sun.jdi.connect.IllegalConnectorArgumentsException; import com.sun.jdi.event.*; import com.sun.jdi.request.BreakpointRequest; import com.sun.jdi.request.ClassPrepareRequest; import com.sun.jdi.request.EventRequestManager; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.function.Consumer; import static com.sun.jdi.Bootstrap.*; public class Debugger { public static void main(String[] args) throws IOException, IllegalConnectorArgumentsException, IncompatibleThreadStateException, InterruptedException, AbsentInformationException, ClassNotLoadedException, InvalidTypeException { VirtualMachineManager vmm = virtualMachineManager(); AttachingConnector at = vmm.attachingConnectors() .stream() .filter(it -> "dt_socket".equalsIgnoreCase(it.transport().name())) .findAny() .orElseThrow(RuntimeException::new); Map<String, Connector.Argument> arguments = at.defaultArguments(); arguments.get("port").setValue("7896"); arguments.get("hostname").setValue("127.0.0.1"); VirtualMachine vm = at.attach(arguments); EventRequestManager erm = vm.eventRequestManager(); ClassPrepareRequest r = erm.createClassPrepareRequest(); r.addClassFilter("ru.kefungus.joke.App"); r.enable(); EventQueue queue = vm.eventQueue(); boolean active = true; while (active) { EventSet eventSet = queue.remove(); EventIterator it = eventSet.eventIterator(); while (it.hasNext()) { Event event = it.nextEvent(); if (event instanceof ClassPrepareEvent) { ClassPrepareEvent evt = (ClassPrepareEvent) event; ClassType classType = (ClassType) evt.referenceType(); classType.methodsByName("main").forEach(m -> { List<Location> locations = null; try { locations = m.allLineLocations(); } catch (AbsentInformationException ex) { throw new RuntimeException(ex); } Location location = locations.get(3); BreakpointRequest bpReq = erm.createBreakpointRequest(location); bpReq.enable(); }); } if (event instanceof BreakpointEvent) { event.request().disable(); ThreadReference thread = ((BreakpointEvent) event).thread(); StackFrame stackFrame = thread.frame(0); Map<LocalVariable, Value> visibleVariables = stackFrame.getValues(stackFrame.visibleVariables()); for (Map.Entry<LocalVariable, Value> entry : visibleVariables.entrySet()) { if (entry.getKey().name().equalsIgnoreCase("message")) { stackFrame.setValue(entry.getKey(), vm.mirrorOf("Алексей Евгеньевич, доставьте макс балл за 2 лабку, пожалуйста ^_^")); } } active = false; } vm.resume(); } } } }
UTF-8
Java
3,512
java
Debugger.java
Java
[ { "context": "96\");\n arguments.get(\"hostname\").setValue(\"127.0.0.1\");\n\n VirtualMachine vm = at.attach(argumen", "end": 1263, "score": 0.9992985129356384, "start": 1254, "tag": "IP_ADDRESS", "value": "127.0.0.1" }, { "context": " stackFrame.setValue(entry.getKey(...
null
[]
package ru.kefungus.debugger; import com.sun.jdi.*; import com.sun.jdi.connect.AttachingConnector; import com.sun.jdi.connect.Connector; import com.sun.jdi.connect.IllegalConnectorArgumentsException; import com.sun.jdi.event.*; import com.sun.jdi.request.BreakpointRequest; import com.sun.jdi.request.ClassPrepareRequest; import com.sun.jdi.request.EventRequestManager; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.function.Consumer; import static com.sun.jdi.Bootstrap.*; public class Debugger { public static void main(String[] args) throws IOException, IllegalConnectorArgumentsException, IncompatibleThreadStateException, InterruptedException, AbsentInformationException, ClassNotLoadedException, InvalidTypeException { VirtualMachineManager vmm = virtualMachineManager(); AttachingConnector at = vmm.attachingConnectors() .stream() .filter(it -> "dt_socket".equalsIgnoreCase(it.transport().name())) .findAny() .orElseThrow(RuntimeException::new); Map<String, Connector.Argument> arguments = at.defaultArguments(); arguments.get("port").setValue("7896"); arguments.get("hostname").setValue("127.0.0.1"); VirtualMachine vm = at.attach(arguments); EventRequestManager erm = vm.eventRequestManager(); ClassPrepareRequest r = erm.createClassPrepareRequest(); r.addClassFilter("ru.kefungus.joke.App"); r.enable(); EventQueue queue = vm.eventQueue(); boolean active = true; while (active) { EventSet eventSet = queue.remove(); EventIterator it = eventSet.eventIterator(); while (it.hasNext()) { Event event = it.nextEvent(); if (event instanceof ClassPrepareEvent) { ClassPrepareEvent evt = (ClassPrepareEvent) event; ClassType classType = (ClassType) evt.referenceType(); classType.methodsByName("main").forEach(m -> { List<Location> locations = null; try { locations = m.allLineLocations(); } catch (AbsentInformationException ex) { throw new RuntimeException(ex); } Location location = locations.get(3); BreakpointRequest bpReq = erm.createBreakpointRequest(location); bpReq.enable(); }); } if (event instanceof BreakpointEvent) { event.request().disable(); ThreadReference thread = ((BreakpointEvent) event).thread(); StackFrame stackFrame = thread.frame(0); Map<LocalVariable, Value> visibleVariables = stackFrame.getValues(stackFrame.visibleVariables()); for (Map.Entry<LocalVariable, Value> entry : visibleVariables.entrySet()) { if (entry.getKey().name().equalsIgnoreCase("message")) { stackFrame.setValue(entry.getKey(), vm.mirrorOf("<NAME>, доставьте макс балл за 2 лабку, пожалуйста ^_^")); } } active = false; } vm.resume(); } } } }
3,483
0.588558
0.584802
82
41.207317
35.716274
230
false
false
0
0
0
0
0
0
0.695122
false
false
3
681a4adbcf71eeecd4c66114ff0a392eb025183a
28,793,460,773,113
e419b88c6db101765029e0b16b7c9f100b13304f
/gemfire-examples/gemfire-data/src/main/java/io/pivotal/bds/gemfire/data/securities/AccountStatus.java
d5ecb5cb5fc86d947dfb0a58c0a8c76365a717da
[ "Apache-2.0" ]
permissive
anisacozzy/gemfire-fe
https://github.com/anisacozzy/gemfire-fe
479326adeba57a75dca7773cb70508607304a426
15c1d1ab12af6b903d5df6170b7d34e33f5fe2fc
refs/heads/master
2023-03-20T02:49:11.899000
2020-12-16T18:27:23
2020-12-16T18:27:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.pivotal.bds.gemfire.data.securities; import java.util.Date; public class AccountStatus { private AccountKey key; private Date lastUpdatedOn; private double balance; public AccountStatus() { } public AccountStatus(AccountKey key, Date lastUpdatedOn, double balance) { this.key = key; this.lastUpdatedOn = lastUpdatedOn; this.balance = balance; } public AccountKey getKey() { return key; } public void setKey(AccountKey key) { this.key = key; } public Date getLastUpdatedOn() { return lastUpdatedOn; } public void setLastUpdatedOn(Date lastUpdatedOn) { this.lastUpdatedOn = lastUpdatedOn; } public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AccountStatus other = (AccountStatus) obj; if (Double.doubleToLongBits(balance) != Double.doubleToLongBits(other.balance)) return false; if (key == null) { if (other.key != null) return false; } else if (!key.equals(other.key)) return false; if (lastUpdatedOn == null) { if (other.lastUpdatedOn != null) return false; } else if (!lastUpdatedOn.equals(other.lastUpdatedOn)) return false; return true; } @Override public String toString() { return "AccountStatus [key=" + key + ", lastUpdatedOn=" + lastUpdatedOn + ", balance=" + balance + "]"; } }
UTF-8
Java
1,818
java
AccountStatus.java
Java
[]
null
[]
package io.pivotal.bds.gemfire.data.securities; import java.util.Date; public class AccountStatus { private AccountKey key; private Date lastUpdatedOn; private double balance; public AccountStatus() { } public AccountStatus(AccountKey key, Date lastUpdatedOn, double balance) { this.key = key; this.lastUpdatedOn = lastUpdatedOn; this.balance = balance; } public AccountKey getKey() { return key; } public void setKey(AccountKey key) { this.key = key; } public Date getLastUpdatedOn() { return lastUpdatedOn; } public void setLastUpdatedOn(Date lastUpdatedOn) { this.lastUpdatedOn = lastUpdatedOn; } public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AccountStatus other = (AccountStatus) obj; if (Double.doubleToLongBits(balance) != Double.doubleToLongBits(other.balance)) return false; if (key == null) { if (other.key != null) return false; } else if (!key.equals(other.key)) return false; if (lastUpdatedOn == null) { if (other.lastUpdatedOn != null) return false; } else if (!lastUpdatedOn.equals(other.lastUpdatedOn)) return false; return true; } @Override public String toString() { return "AccountStatus [key=" + key + ", lastUpdatedOn=" + lastUpdatedOn + ", balance=" + balance + "]"; } }
1,818
0.580308
0.580308
73
23.90411
21.563646
111
false
false
0
0
0
0
0
0
0.39726
false
false
3
313b4ced7a6952f51ce9b97ecff1699661060d54
21,852,793,631,217
ce3eb64bf344cfb2c7384a95493fc09b5af5f296
/source/vn/spring/zebra/helperservice/UserSaveFile.java
29253e9138eb262a6fdbb9ceada98d3cb50354b5
[ "MIT" ]
permissive
ngphloc/zebra
https://github.com/ngphloc/zebra
d8da06eb4578bac5af69c381c1b7462a08bf37af
2d99addaaec70d29bb9ed9ffcef95425ffb88bd0
refs/heads/master
2022-05-25T06:22:32.342000
2022-05-03T02:49:06
2022-05-03T02:49:06
41,139,150
2
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package vn.spring.zebra.helperservice; import java.io.FileWriter; import java.io.IOException; import java.net.URLDecoder; import javax.servlet.*; import javax.servlet.http.*; import vn.spring.zebra.ZebraStatic; /** * @author Loc Nguyen * Email: ng_phloc@yahoo.com * Phone: 84-90-8222007 * Affiliation: University of Science, 2008, Vietnam. * All Rights Reserved. */ public class UserSaveFile extends HttpServlet { private static final long serialVersionUID = 1L; public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = request.getSession(true); if (session != null) { synchronized (session.getId()) { try { doPost(request, response); } catch (ServletException se) { System.out.println("ServletException"); } catch (IOException ie) { System.out.println("IOException"); } } } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { String xmlfile = URLDecoder.decode(request.getParameter("xmlfile"),"UTF-8"); int startIndex = xmlfile.indexOf("[") + 1; int endIndex = xmlfile.indexOf("]"); String filepath = xmlfile.substring(startIndex, endIndex); //E.g: W:/wow/xmlroot/bayes/tutorial.bif if(filepath.indexOf(":") != -1) { //In case filepath = bayes/tutorial.bif filepath = ZebraStatic.getWowRoot() + filepath; } int startData = xmlfile.indexOf("\n") + 1; String xmlData = xmlfile.substring(startData); try { FileWriter out = new FileWriter(filepath); out.write(xmlData); out.close(); } catch (Exception e) { System.out.println("Exception while trying to save!"); } } }
UTF-8
Java
1,824
java
UserSaveFile.java
Java
[ { "context": "mport vn.spring.zebra.ZebraStatic;\n\n/**\n * @author Loc Nguyen\n * Email: ng_phloc@yahoo.com\n * Phone: 84-90-8222", "end": 240, "score": 0.9998254179954529, "start": 230, "tag": "NAME", "value": "Loc Nguyen" }, { "context": ".ZebraStatic;\n\n/**\n * @author Loc Nguye...
null
[]
package vn.spring.zebra.helperservice; import java.io.FileWriter; import java.io.IOException; import java.net.URLDecoder; import javax.servlet.*; import javax.servlet.http.*; import vn.spring.zebra.ZebraStatic; /** * @author <NAME> * Email: <EMAIL> * Phone: 84-90-8222007 * Affiliation: University of Science, 2008, Vietnam. * All Rights Reserved. */ public class UserSaveFile extends HttpServlet { private static final long serialVersionUID = 1L; public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = request.getSession(true); if (session != null) { synchronized (session.getId()) { try { doPost(request, response); } catch (ServletException se) { System.out.println("ServletException"); } catch (IOException ie) { System.out.println("IOException"); } } } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { String xmlfile = URLDecoder.decode(request.getParameter("xmlfile"),"UTF-8"); int startIndex = xmlfile.indexOf("[") + 1; int endIndex = xmlfile.indexOf("]"); String filepath = xmlfile.substring(startIndex, endIndex); //E.g: W:/wow/xmlroot/bayes/tutorial.bif if(filepath.indexOf(":") != -1) { //In case filepath = bayes/tutorial.bif filepath = ZebraStatic.getWowRoot() + filepath; } int startData = xmlfile.indexOf("\n") + 1; String xmlData = xmlfile.substring(startData); try { FileWriter out = new FileWriter(filepath); out.write(xmlData); out.close(); } catch (Exception e) { System.out.println("Exception while trying to save!"); } } }
1,809
0.672697
0.661732
64
27.5
25.945858
120
false
false
0
0
0
0
0
0
1.4375
false
false
3
5b1f8c86ef90bd57f484a05ac5916c31c2bcab7e
7,911,329,789,487
61d019c076b821f5b4845cabf6f634a63fe6bd82
/yaogd-IPC/src/main/java/com/yaogd/ipc/service/ADPVPushService.java
f5c8159148ab5c3fbb45c0271b96ce86fc9fbc24
[]
no_license
yaoguangdong/funcunit
https://github.com/yaoguangdong/funcunit
8f6b3b24c1b38b39e5cdb8c70076e814a96b3b14
6c7fac7cbcf9f161064c6d1500f97be9b7933ecf
refs/heads/master
2021-05-11T04:44:56.255000
2018-10-15T07:44:27
2018-10-15T07:44:27
58,425,472
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yaogd.ipc.service; import android.app.Service; import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; import com.yaogd.lib.A; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.net.URLDecoder; import java.security.MessageDigest; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; /** * 广告曝光上送服务 * app启动时,启动 * app结束时,停止 * author yaoguangdong * 2015-12-11 */ public class ADPVPushService extends Service { private static final String TAG = "ADPVPushService"; private static final int PUSH_LIMIT = 100;//每次发送的最大数量 private static final int COMMAND_THIRD_REPORT = 0x300;//第三方统计上报 private static final int COMMAND_INSERT_ADPV = 0x310;//插入广告统计数据 private static final int COMMAND_SEND_ADPV = 0x320;//发送广告统计数据 private Handler mHandler = new Handler(){ @Override public void handleMessage(Message msg) { switch(msg.what){ case COMMAND_THIRD_REPORT: handleThirdAdReport(); break; case COMMAND_INSERT_ADPV: handleInsertPv(); break; case COMMAND_SEND_ADPV: push(); break; } super.handleMessage(msg); } }; /** * 处理第三方上报 */ private void handleThirdAdReport(){ for(int index = 0; index < urlsTemp.length; index++){ try { String realUrl = URLDecoder.decode(urlsTemp[index]); Caller.GetRequest getRequest = new Caller.GetRequest(realUrl.trim(), true, null); Caller.get(getRequest); } catch (Exception e) { e.printStackTrace(); } } } /** * 处理统计数据入库 */ private void handleInsertPv(){ try { //插入数据 ADPVDB.getInstance(getBaseContext()).insertADPVData(pvEntityTemp); } catch (Exception e) { e.printStackTrace(); } } private boolean isSending = false ; private int scheduleTimes = 0; /** * 590增加实时上报调度策略 */ private void scheduleNextPush(){ if(scheduleTimes > 0){ mHandler.sendEmptyMessageDelayed(COMMAND_SEND_ADPV, 200); scheduleTimes--; } } /** * 590增加实时上报调度策略 */ private void stopSchedule(){ if(scheduleTimes > 0){ mHandler.removeMessages(COMMAND_SEND_ADPV); scheduleTimes = 0; } } /** * 上送当前统计的pv */ private void push(){ try { if( ! isSending){ if( ! Caller.netIsAvailable(getBaseContext())){ isSending = false ; stopSchedule(); return ; } final List<ADPVEntity> pvEntitys = ADPVDB.getInstance(getBaseContext()).getADPVData(PUSH_LIMIT); if(pvEntitys == null || pvEntitys.isEmpty()){ isSending = false ; stopSchedule(); return ; } isSending = true ; Map<String ,String> params = getPostParams(packJsonParam(pvEntitys)); Caller.PostRequest post = new Caller.PostRequest("http://xxx", params, new Caller.ResponseListener() { @Override public void onReceiveData(int code, String data) { boolean isSuccess = false; if(data != null){ JSONObject jresult = new JSONObject(); try { isSuccess = jresult.getInt("returncode") == 0; } catch (JSONException e) { isSuccess = false; e.printStackTrace(); } } if(isSuccess){ if(pvEntitys != null && ! pvEntitys.isEmpty()){ int size = pvEntitys.size(); int [] ids = new int[size]; for(int i = 0; i < size; i++){ ids[i] = pvEntitys.get(i)._id; } ADPVDB.getInstance(getBaseContext()).deleteADPVData(ids); } } isSending = false ; scheduleNextPush(); } @Override public void onFailure(int code, String msg) { A.d("onFailure:" + msg) ; isSending = false ; scheduleNextPush(); } }); A.d("post,data:" + params.toString()); Caller.post(post); }else{ scheduleTimes++; } } catch (Exception e) { isSending = false ; e.printStackTrace() ; } } private String packJsonParam(List<ADPVEntity> list){ if(list == null || list.isEmpty()){ return "" ; } JSONArray jarray = new JSONArray() ; try { for(ADPVEntity pv : list){ JSONObject jobj = new JSONObject(); jobj.put("pvid", pv.pvid); jobj.put("tp", pv.type); jobj.put("t1", pv.beginTime) ; jobj.put("t2", pv.endTime) ; jobj.put("it", pv.imgType) ; jarray.put(jobj) ; } return jarray.toString() ; } catch (JSONException e) { e.printStackTrace(); return "" ; } } /** * 封装post请求的参数 */ public Map<String, String> getPostParams(String pvData) { Map<String, String> params = new HashMap<String, String>(); params.put("v", "5.9.5");// app params.put("pm", "2");// android。这个字段广告那边用作他用,改用platform字段表示 params.put("platform", "2");// 1-pc 2-app 3-m端 params.put("a", "2");// 主软件 params.put("_adpvtime", pvData);// 需要上传的数据集合 params.put("_timestamp", String.valueOf(System.currentTimeMillis()));// 时间戳,用于签名校验 params.put("_sign", getPostSignature(params, "@7U$aPOE@$")); return params; } /** * 将post请求的参数进行签名 */ public String getPostSignature(Map<String, String> params, String appKey) { Map<String, String> map = new TreeMap<String, String>(); for (String key : params.keySet()) { map.put(key, params.get(key)); } StringBuffer sb = new StringBuffer(); sb.append(appKey); for (Map.Entry<String, String> entry : map.entrySet()) { sb.append(entry.getKey()); sb.append(entry.getValue()); } sb.append(appKey); return md5s(sb.toString()).toUpperCase(); } /** * 为字符加密为md5 * * @param plainText * 要加密字符 * @return md5值 */ public static String md5s(String plainText) { String str = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(plainText.getBytes()); byte b[] = md.digest(); int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) i += 256; if (i < 16) buf.append("0"); buf.append(Integer.toHexString(i)); } str = buf.toString(); } catch (Exception e) { e.printStackTrace(); } return str; } // 暂存接口数据,减少经过消息队里传输的耗时 private ADPVEntity[] pvEntityTemp; private String[] urlsTemp; private IADPVInterface.Stub myBinder = new IADPVInterface.Stub(){ @Override public void save(ADPVEntity[] pvEntity) throws RemoteException { pvEntityTemp = pvEntity; if(pvEntityTemp != null){ Message msg = mHandler.obtainMessage(); msg.what = COMMAND_INSERT_ADPV; mHandler.sendMessage(msg); } } @Override public void push() throws RemoteException { //delay 200ms :解决bug:上报速度快于插入数据时,数据延迟上报问题 mHandler.sendEmptyMessageDelayed(COMMAND_SEND_ADPV, 200); } @Override public void thirdpush(String[] urls) throws RemoteException { urlsTemp = urls; if(urlsTemp != null && urlsTemp.length > 0){ Message msg = mHandler.obtainMessage(); msg.what = COMMAND_THIRD_REPORT; mHandler.sendMessage(msg); } } }; @Override public IBinder onBind(Intent i) { return myBinder; } @Override public void onCreate() { A.d("Log,ADPVPushService onCreate()"); super.onCreate(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { return super.onStartCommand(intent, flags, startId); } @Override public void onDestroy() { super.onDestroy(); } }
UTF-8
Java
10,006
java
ADPVPushService.java
Java
[ { "context": "**\n * 广告曝光上送服务\n * app启动时,启动\n * app结束时,停止\n * author yaoguangdong\n * 2015-12-11\n */\npublic class ADPVPushService ex", "end": 546, "score": 0.9996992945671082, "start": 534, "tag": "USERNAME", "value": "yaoguangdong" } ]
null
[]
package com.yaogd.ipc.service; import android.app.Service; import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; import com.yaogd.lib.A; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.net.URLDecoder; import java.security.MessageDigest; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; /** * 广告曝光上送服务 * app启动时,启动 * app结束时,停止 * author yaoguangdong * 2015-12-11 */ public class ADPVPushService extends Service { private static final String TAG = "ADPVPushService"; private static final int PUSH_LIMIT = 100;//每次发送的最大数量 private static final int COMMAND_THIRD_REPORT = 0x300;//第三方统计上报 private static final int COMMAND_INSERT_ADPV = 0x310;//插入广告统计数据 private static final int COMMAND_SEND_ADPV = 0x320;//发送广告统计数据 private Handler mHandler = new Handler(){ @Override public void handleMessage(Message msg) { switch(msg.what){ case COMMAND_THIRD_REPORT: handleThirdAdReport(); break; case COMMAND_INSERT_ADPV: handleInsertPv(); break; case COMMAND_SEND_ADPV: push(); break; } super.handleMessage(msg); } }; /** * 处理第三方上报 */ private void handleThirdAdReport(){ for(int index = 0; index < urlsTemp.length; index++){ try { String realUrl = URLDecoder.decode(urlsTemp[index]); Caller.GetRequest getRequest = new Caller.GetRequest(realUrl.trim(), true, null); Caller.get(getRequest); } catch (Exception e) { e.printStackTrace(); } } } /** * 处理统计数据入库 */ private void handleInsertPv(){ try { //插入数据 ADPVDB.getInstance(getBaseContext()).insertADPVData(pvEntityTemp); } catch (Exception e) { e.printStackTrace(); } } private boolean isSending = false ; private int scheduleTimes = 0; /** * 590增加实时上报调度策略 */ private void scheduleNextPush(){ if(scheduleTimes > 0){ mHandler.sendEmptyMessageDelayed(COMMAND_SEND_ADPV, 200); scheduleTimes--; } } /** * 590增加实时上报调度策略 */ private void stopSchedule(){ if(scheduleTimes > 0){ mHandler.removeMessages(COMMAND_SEND_ADPV); scheduleTimes = 0; } } /** * 上送当前统计的pv */ private void push(){ try { if( ! isSending){ if( ! Caller.netIsAvailable(getBaseContext())){ isSending = false ; stopSchedule(); return ; } final List<ADPVEntity> pvEntitys = ADPVDB.getInstance(getBaseContext()).getADPVData(PUSH_LIMIT); if(pvEntitys == null || pvEntitys.isEmpty()){ isSending = false ; stopSchedule(); return ; } isSending = true ; Map<String ,String> params = getPostParams(packJsonParam(pvEntitys)); Caller.PostRequest post = new Caller.PostRequest("http://xxx", params, new Caller.ResponseListener() { @Override public void onReceiveData(int code, String data) { boolean isSuccess = false; if(data != null){ JSONObject jresult = new JSONObject(); try { isSuccess = jresult.getInt("returncode") == 0; } catch (JSONException e) { isSuccess = false; e.printStackTrace(); } } if(isSuccess){ if(pvEntitys != null && ! pvEntitys.isEmpty()){ int size = pvEntitys.size(); int [] ids = new int[size]; for(int i = 0; i < size; i++){ ids[i] = pvEntitys.get(i)._id; } ADPVDB.getInstance(getBaseContext()).deleteADPVData(ids); } } isSending = false ; scheduleNextPush(); } @Override public void onFailure(int code, String msg) { A.d("onFailure:" + msg) ; isSending = false ; scheduleNextPush(); } }); A.d("post,data:" + params.toString()); Caller.post(post); }else{ scheduleTimes++; } } catch (Exception e) { isSending = false ; e.printStackTrace() ; } } private String packJsonParam(List<ADPVEntity> list){ if(list == null || list.isEmpty()){ return "" ; } JSONArray jarray = new JSONArray() ; try { for(ADPVEntity pv : list){ JSONObject jobj = new JSONObject(); jobj.put("pvid", pv.pvid); jobj.put("tp", pv.type); jobj.put("t1", pv.beginTime) ; jobj.put("t2", pv.endTime) ; jobj.put("it", pv.imgType) ; jarray.put(jobj) ; } return jarray.toString() ; } catch (JSONException e) { e.printStackTrace(); return "" ; } } /** * 封装post请求的参数 */ public Map<String, String> getPostParams(String pvData) { Map<String, String> params = new HashMap<String, String>(); params.put("v", "5.9.5");// app params.put("pm", "2");// android。这个字段广告那边用作他用,改用platform字段表示 params.put("platform", "2");// 1-pc 2-app 3-m端 params.put("a", "2");// 主软件 params.put("_adpvtime", pvData);// 需要上传的数据集合 params.put("_timestamp", String.valueOf(System.currentTimeMillis()));// 时间戳,用于签名校验 params.put("_sign", getPostSignature(params, "@7U$aPOE@$")); return params; } /** * 将post请求的参数进行签名 */ public String getPostSignature(Map<String, String> params, String appKey) { Map<String, String> map = new TreeMap<String, String>(); for (String key : params.keySet()) { map.put(key, params.get(key)); } StringBuffer sb = new StringBuffer(); sb.append(appKey); for (Map.Entry<String, String> entry : map.entrySet()) { sb.append(entry.getKey()); sb.append(entry.getValue()); } sb.append(appKey); return md5s(sb.toString()).toUpperCase(); } /** * 为字符加密为md5 * * @param plainText * 要加密字符 * @return md5值 */ public static String md5s(String plainText) { String str = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(plainText.getBytes()); byte b[] = md.digest(); int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) i += 256; if (i < 16) buf.append("0"); buf.append(Integer.toHexString(i)); } str = buf.toString(); } catch (Exception e) { e.printStackTrace(); } return str; } // 暂存接口数据,减少经过消息队里传输的耗时 private ADPVEntity[] pvEntityTemp; private String[] urlsTemp; private IADPVInterface.Stub myBinder = new IADPVInterface.Stub(){ @Override public void save(ADPVEntity[] pvEntity) throws RemoteException { pvEntityTemp = pvEntity; if(pvEntityTemp != null){ Message msg = mHandler.obtainMessage(); msg.what = COMMAND_INSERT_ADPV; mHandler.sendMessage(msg); } } @Override public void push() throws RemoteException { //delay 200ms :解决bug:上报速度快于插入数据时,数据延迟上报问题 mHandler.sendEmptyMessageDelayed(COMMAND_SEND_ADPV, 200); } @Override public void thirdpush(String[] urls) throws RemoteException { urlsTemp = urls; if(urlsTemp != null && urlsTemp.length > 0){ Message msg = mHandler.obtainMessage(); msg.what = COMMAND_THIRD_REPORT; mHandler.sendMessage(msg); } } }; @Override public IBinder onBind(Intent i) { return myBinder; } @Override public void onCreate() { A.d("Log,ADPVPushService onCreate()"); super.onCreate(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { return super.onStartCommand(intent, flags, startId); } @Override public void onDestroy() { super.onDestroy(); } }
10,006
0.493737
0.486326
328
28.207317
22.496469
112
false
false
0
0
0
0
0
0
0.554878
false
false
3
4ddd7af863c7a2df302539ebcfef160a48e6adb6
8,907,762,196,887
8b5000bb87ee9a993d8d448f133b20817a23a1f4
/AliExpress/src/main/java/managers/AccountManager.java
847b97ae6541ebde7ba08cac06b4e05e08f56325
[]
no_license
Ivana-Spiridonovska/svs-talent
https://github.com/Ivana-Spiridonovska/svs-talent
568ff5d7d50663f66bc1f799a46a1a0def1d03d8
6ebd11a03a3a56f5112bf4471f655d09a91a34cb
refs/heads/master
2021-01-21T19:28:57.195000
2015-04-18T13:45:26
2015-04-18T13:45:26
31,987,539
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package managers; import java.sql.SQLException; import app.Menu; import controller.customer.CustomerController; public class AccountManager { private static AccountManager instance = new AccountManager(); private Menu menu; CustomerController controller = new CustomerController(); private AccountManager() { } public static AccountManager getInstance() { instance.menu = new Menu(); instance.menu.addHeader("\nCustomer menu:"); instance.menu.addOption("Register customer"); instance.menu.addOption("List register customers"); instance.menu.addOption("Update customer registation"); instance.menu.addOption("Unregister customer"); instance.menu.addOption("Back"); instance.menu.addTail("Enter your option:"); return instance; } public void run() throws SQLException{ boolean finished = false; while (!finished) { menu.display(); String choice = menu.getUserSelection(); switch (choice) { case "1": controller.registerCustomer(); break; case "2": controller.findCustomers(); break; case "3": controller.updateCustomer(); break; case "4": controller.unregisterCustomer(); break; case "5": MainMenuManager.getInstance().run(); finished = true; break; } } } }
UTF-8
Java
1,269
java
AccountManager.java
Java
[]
null
[]
package managers; import java.sql.SQLException; import app.Menu; import controller.customer.CustomerController; public class AccountManager { private static AccountManager instance = new AccountManager(); private Menu menu; CustomerController controller = new CustomerController(); private AccountManager() { } public static AccountManager getInstance() { instance.menu = new Menu(); instance.menu.addHeader("\nCustomer menu:"); instance.menu.addOption("Register customer"); instance.menu.addOption("List register customers"); instance.menu.addOption("Update customer registation"); instance.menu.addOption("Unregister customer"); instance.menu.addOption("Back"); instance.menu.addTail("Enter your option:"); return instance; } public void run() throws SQLException{ boolean finished = false; while (!finished) { menu.display(); String choice = menu.getUserSelection(); switch (choice) { case "1": controller.registerCustomer(); break; case "2": controller.findCustomers(); break; case "3": controller.updateCustomer(); break; case "4": controller.unregisterCustomer(); break; case "5": MainMenuManager.getInstance().run(); finished = true; break; } } } }
1,269
0.70528
0.70134
56
21.660715
18.272028
63
false
false
0
0
0
0
0
0
2.392857
false
false
3
f822ae3c3657c438f374f1e52b269062341086fb
6,640,019,477,308
e44d1f5599b9e9fa90ef18bca981592fb86e8072
/SplatoonOOTD/app/src/main/java/com/monotone_effect/splatoonootd/GearListActivity.java
4d8860e2aaf107e698efd4c92c07894b5eaab166
[]
no_license
monotone-effect/SplatoonOOTD
https://github.com/monotone-effect/SplatoonOOTD
6c6f677bb0aa7367b1bca76fc1af44413caad9e6
8cabc9b039dc8d4d361d509288d0439c284123c4
refs/heads/master
2019-07-10T09:03:00.603000
2017-10-18T07:57:52
2017-10-18T07:57:52
91,222,141
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.monotone_effect.splatoonootd; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; /** * ギア一覧表示アクティビティ クラス */ public class GearListActivity extends ContentActivity implements GearDetailDialogFragment.GearDetailDialogListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void setContent() { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.content, GearListFragment.newInstance(this)); transaction.commit(); } @Override public void onDialogCloseClick(GearDetailDialogFragment dialog) { } @Override public void onDialogSelectClick(GearDetailDialogFragment dialog) { } }
UTF-8
Java
855
java
GearListActivity.java
Java
[]
null
[]
package com.monotone_effect.splatoonootd; import android.os.Bundle; import android.support.v4.app.FragmentTransaction; /** * ギア一覧表示アクティビティ クラス */ public class GearListActivity extends ContentActivity implements GearDetailDialogFragment.GearDetailDialogListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void setContent() { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.content, GearListFragment.newInstance(this)); transaction.commit(); } @Override public void onDialogCloseClick(GearDetailDialogFragment dialog) { } @Override public void onDialogSelectClick(GearDetailDialogFragment dialog) { } }
855
0.743621
0.742406
32
24.71875
30.459229
116
false
false
0
0
0
0
0
0
0.25
false
false
3
14f24ec1fdec1034e848bd07043fe375254b82e2
27,075,473,886,884
7c76eef3a58eb603278d940c51c80cb717052449
/uk/ac/cam/jc841/tick2/TinyLife.java
a8302245983f13aac05e0299895d93d5b903ba59
[]
no_license
jchoules/java_work
https://github.com/jchoules/java_work
e70e05d0440aa0cde1bc12c943c6ae72c08fbccf
c09c8bc29f85735f7146f9815a8adfcc3538a2ab
refs/heads/master
2021-08-20T05:59:38.606000
2017-11-28T10:45:52
2017-11-28T10:45:52
112,323,252
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package uk.ac.cam.jc841.tick2; public class TinyLife { public static boolean getCell(long world, int col, int row) { if (col >= 0 && col < 8 && row >= 0 && row < 8) { int position = col + row * 8; return PackedLong.get(world, position); } else { return false; } } public static long setCell(long world, int col, int row, boolean value) { if (col >= 0 && col < 8 && row >= 0 && row < 8) { int position = col + row * 8; return PackedLong.set(world, position, value); } else { return world; } } public static int countNeighbours(long world, int col, int row) { int count = 0; for (int rowOffset = -1; rowOffset <= 1; rowOffset++) { for (int colOffset = -1; colOffset <= 1; colOffset++) { if (!(rowOffset == 0 && colOffset == 0) && getCell(world, col + colOffset, row + rowOffset)) { count++; } } } return count; } public static boolean computeCell(long world, int col, int row) { boolean liveCell = getCell(world, col, row); int neighbours = countNeighbours(world, col, row); boolean nextCell = false; if (neighbours < 2) { nextCell = false; } if (liveCell && (neighbours == 2 || neighbours == 3)) { nextCell = true; } if (liveCell && neighbours > 3) { nextCell = false; } if (!liveCell && neighbours == 3) { nextCell = true; } return nextCell; } public static long nextGeneration(long world) { long next = world; for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { boolean nextCell = computeCell(world, col, row); next = setCell(next, col, row, nextCell); } } return next; } public static void play(long world) throws Exception { int userResponse = 0; while (userResponse != 'q') { print(world); userResponse = System.in.read(); world = nextGeneration(world); } } public static void print(long world) { System.out.println("-"); for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { System.out.print(getCell(world, col, row) ? "#" : "_"); } System.out.println(); } } public static void main(String[] args) throws Exception { play(Long.decode(args[0])); } }
UTF-8
Java
2,336
java
TinyLife.java
Java
[]
null
[]
package uk.ac.cam.jc841.tick2; public class TinyLife { public static boolean getCell(long world, int col, int row) { if (col >= 0 && col < 8 && row >= 0 && row < 8) { int position = col + row * 8; return PackedLong.get(world, position); } else { return false; } } public static long setCell(long world, int col, int row, boolean value) { if (col >= 0 && col < 8 && row >= 0 && row < 8) { int position = col + row * 8; return PackedLong.set(world, position, value); } else { return world; } } public static int countNeighbours(long world, int col, int row) { int count = 0; for (int rowOffset = -1; rowOffset <= 1; rowOffset++) { for (int colOffset = -1; colOffset <= 1; colOffset++) { if (!(rowOffset == 0 && colOffset == 0) && getCell(world, col + colOffset, row + rowOffset)) { count++; } } } return count; } public static boolean computeCell(long world, int col, int row) { boolean liveCell = getCell(world, col, row); int neighbours = countNeighbours(world, col, row); boolean nextCell = false; if (neighbours < 2) { nextCell = false; } if (liveCell && (neighbours == 2 || neighbours == 3)) { nextCell = true; } if (liveCell && neighbours > 3) { nextCell = false; } if (!liveCell && neighbours == 3) { nextCell = true; } return nextCell; } public static long nextGeneration(long world) { long next = world; for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { boolean nextCell = computeCell(world, col, row); next = setCell(next, col, row, nextCell); } } return next; } public static void play(long world) throws Exception { int userResponse = 0; while (userResponse != 'q') { print(world); userResponse = System.in.read(); world = nextGeneration(world); } } public static void print(long world) { System.out.println("-"); for (int row = 0; row < 8; row++) { for (int col = 0; col < 8; col++) { System.out.print(getCell(world, col, row) ? "#" : "_"); } System.out.println(); } } public static void main(String[] args) throws Exception { play(Long.decode(args[0])); } }
2,336
0.558647
0.543236
88
25.545454
22.742586
102
false
false
0
0
0
0
0
0
0.784091
false
false
3
d21fa57a1c98e0c9ac62b964e70465a6a358616c
6,451,040,940,332
7c74c46dbdb0e1c4481589a3f5e4efb2e69aa7d3
/plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/dialogs/SQLQueryParameterBindDialog.java
e22d0edf069a76a0efceca46865d6b343995de18
[ "EPL-2.0", "Apache-2.0" ]
permissive
liuyuanyuan/dbeaver
https://github.com/liuyuanyuan/dbeaver
dc6eaff3d963e7ee5c60ff3a6060a8b72aeb332b
b70691864375c824a95e40510f5a8a3c3283b160
refs/heads/devel
2021-06-10T09:40:51.669000
2019-09-18T03:31:55
2019-09-18T03:31:55
104,036,382
3
1
Apache-2.0
true
2019-09-18T03:31:57
2017-09-19T06:38:53
2019-09-09T07:55:41
2019-09-18T03:31:56
230,036
0
0
0
Java
false
false
/* * DBeaver - Universal Database Manager * Copyright (C) 2010-2019 Serge Rider (serge@jkiss.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.jkiss.dbeaver.ui.editors.sql.dialogs; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.StatusDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; import org.jkiss.dbeaver.model.DBIcon; import org.jkiss.dbeaver.model.sql.SQLQueryParameter; import org.jkiss.dbeaver.ui.controls.TableColumnSortListener; import org.jkiss.dbeaver.ui.editors.sql.internal.SQLEditorMessages; import org.jkiss.dbeaver.ui.editors.sql.registry.SQLQueryParameterRegistry; import org.jkiss.dbeaver.ui.DBeaverIcons; import org.jkiss.dbeaver.ui.UIUtils; import org.jkiss.dbeaver.ui.controls.CustomTableEditor; import org.jkiss.dbeaver.utils.GeneralUtils; import org.jkiss.utils.CommonUtils; import java.util.*; import java.util.List; /** * Parameter binding */ public class SQLQueryParameterBindDialog extends StatusDialog { private static final String DIALOG_ID = "DBeaver.SQLQueryParameterBindDialog";//$NON-NLS-1$ private static final String PARAM_HIDE_IF_SET = "PARAM_HIDE_IF_SET";//$NON-NLS-1$ private List<SQLQueryParameter> parameters; private final Map<String, List<SQLQueryParameter>> dupParameters = new HashMap<>(); private static Map<String, SQLQueryParameterRegistry.ParameterInfo> savedParamValues = new HashMap<>(); private Button hideIfSetCheck; private Table paramTable; public SQLQueryParameterBindDialog(Shell shell, List<SQLQueryParameter> parameters) { super(shell); this.parameters = parameters; // Restore saved values from registry SQLQueryParameterRegistry registry = SQLQueryParameterRegistry.getInstance(); for (SQLQueryParameter param : this.parameters) { if (param.isNamed() && param.getValue() == null) { SQLQueryParameterRegistry.ParameterInfo paramInfo = registry.getParameter(param.getName()); if (paramInfo != null) { param.setValue(paramInfo.value); } } } } @Override protected IDialogSettings getDialogBoundsSettings() { return UIUtils.getDialogSettings(DIALOG_ID); } @Override protected boolean isResizable() { return true; } @Override public boolean isHelpAvailable() { return false; } @Override protected Control createDialogArea(Composite parent) { getShell().setText(SQLEditorMessages.dialog_sql_param_title); final Composite composite = (Composite)super.createDialogArea(parent); paramTable = new Table(composite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); final GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = 400; gd.heightHint = 200; paramTable.setLayoutData(gd); paramTable.setHeaderVisible(true); paramTable.setLinesVisible(true); final TableColumn indexColumn = UIUtils.createTableColumn(paramTable, SWT.LEFT, "#"); indexColumn.addListener(SWT.Selection, new TableColumnSortListener(paramTable, 0)); indexColumn.setWidth(40); final TableColumn nameColumn = UIUtils.createTableColumn(paramTable, SWT.LEFT, SQLEditorMessages.dialog_sql_param_column_name); nameColumn.addListener(SWT.Selection, new TableColumnSortListener(paramTable, 1)); nameColumn.setWidth(100); final TableColumn valueColumn = UIUtils.createTableColumn(paramTable, SWT.LEFT, SQLEditorMessages.dialog_sql_param_column_value); valueColumn.setWidth(200); fillParameterList(isHideIfSet()); final CustomTableEditor tableEditor = new CustomTableEditor(paramTable) { { firstTraverseIndex = 2; lastTraverseIndex = 2; editOnEnter = false; } @Override protected Control createEditor(Table table, int index, TableItem item) { if (index != 2) { return null; } SQLQueryParameter param = (SQLQueryParameter) item.getData(); Text editor = new Text(table, SWT.BORDER); editor.setText(CommonUtils.notEmpty(param.getValue())); editor.selectAll(); editor.addTraverseListener(e -> { if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.CTRL) == SWT.CTRL) { UIUtils.asyncExec(SQLQueryParameterBindDialog.this::okPressed); } }); return editor; } @Override protected void saveEditorValue(Control control, int index, TableItem item) { SQLQueryParameter param = (SQLQueryParameter) item.getData(); String newValue = ((Text) control).getText(); item.setText(2, newValue); param.setValue(newValue); if (param.isNamed()) { final List<SQLQueryParameter> dups = dupParameters.get(param.getName()); if (dups != null) { for (SQLQueryParameter dup : dups) { dup.setValue(newValue); } } } savedParamValues.put( param.getName().toUpperCase(Locale.ENGLISH), new SQLQueryParameterRegistry.ParameterInfo(param.getName(), newValue)); } }; if (!parameters.isEmpty()) { UIUtils.asyncExec(() -> { paramTable.select(0); tableEditor.showEditor(paramTable.getItem(0), 2); }); } hideIfSetCheck = UIUtils.createCheckbox(composite, SQLEditorMessages.dialog_sql_param_hide_checkbox, SQLEditorMessages.dialog_sql_param_hide_checkbox_tip, isHideIfSet(), 1); hideIfSetCheck.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fillParameterList(hideIfSetCheck.getSelection()); } }); updateStatus(GeneralUtils.makeInfoStatus(SQLEditorMessages.dialog_sql_param_hint)); return composite; } private void fillParameterList(boolean hideVariables) { paramTable.removeAll(); for (SQLQueryParameter param : parameters) { if (hideVariables && param.isVariableSet()) { continue; } if (param.getPrevious() != null) { // Skip duplicates List<SQLQueryParameter> dups = dupParameters.computeIfAbsent(param.getName(), k -> new ArrayList<>()); dups.add(param); continue; } TableItem item = new TableItem(paramTable, SWT.NONE); item.setData(param); item.setImage(DBeaverIcons.getImage(DBIcon.TREE_ATTRIBUTE)); item.setText(0, String.valueOf(param.getOrdinalPosition() + 1)); item.setText(1, param.getVarName()); item.setText(2, CommonUtils.notEmpty(param.getValue())); } } @Override protected void createButtonsForButtonBar(Composite parent) { Button skipButton = UIUtils.createDialogButton(parent, IDialogConstants.IGNORE_LABEL, new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setReturnCode(IDialogConstants.IGNORE_ID); close(); } }); skipButton.setToolTipText("Ignore parameters and execute query/script as is"); ((GridLayout) parent.getLayout()).numColumns++; super.createButtonsForButtonBar(parent); } @Override protected void okPressed() { SQLQueryParameterRegistry registry = SQLQueryParameterRegistry.getInstance(); for (SQLQueryParameterRegistry.ParameterInfo param : savedParamValues.values()) { registry.setParameter(param.name, param.value); } registry.save(); if (hideIfSetCheck != null) { getDialogBoundsSettings().put(PARAM_HIDE_IF_SET, hideIfSetCheck.getSelection()); } super.okPressed(); } public static boolean isHideIfSet() { return UIUtils.getDialogSettings(DIALOG_ID).getBoolean(PARAM_HIDE_IF_SET); } }
UTF-8
Java
9,249
java
SQLQueryParameterBindDialog.java
Java
[ { "context": "versal Database Manager\n * Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)\n *\n * Licensed under the Apache", "end": 81, "score": 0.9998717308044434, "start": 70, "tag": "NAME", "value": "Serge Rider" }, { "context": "e Manager\n * Copyright (C) 2010-2019 Serge ...
null
[]
/* * DBeaver - Universal Database Manager * Copyright (C) 2010-2019 <NAME> (<EMAIL>) * * 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.jkiss.dbeaver.ui.editors.sql.dialogs; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.StatusDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; import org.jkiss.dbeaver.model.DBIcon; import org.jkiss.dbeaver.model.sql.SQLQueryParameter; import org.jkiss.dbeaver.ui.controls.TableColumnSortListener; import org.jkiss.dbeaver.ui.editors.sql.internal.SQLEditorMessages; import org.jkiss.dbeaver.ui.editors.sql.registry.SQLQueryParameterRegistry; import org.jkiss.dbeaver.ui.DBeaverIcons; import org.jkiss.dbeaver.ui.UIUtils; import org.jkiss.dbeaver.ui.controls.CustomTableEditor; import org.jkiss.dbeaver.utils.GeneralUtils; import org.jkiss.utils.CommonUtils; import java.util.*; import java.util.List; /** * Parameter binding */ public class SQLQueryParameterBindDialog extends StatusDialog { private static final String DIALOG_ID = "DBeaver.SQLQueryParameterBindDialog";//$NON-NLS-1$ private static final String PARAM_HIDE_IF_SET = "PARAM_HIDE_IF_SET";//$NON-NLS-1$ private List<SQLQueryParameter> parameters; private final Map<String, List<SQLQueryParameter>> dupParameters = new HashMap<>(); private static Map<String, SQLQueryParameterRegistry.ParameterInfo> savedParamValues = new HashMap<>(); private Button hideIfSetCheck; private Table paramTable; public SQLQueryParameterBindDialog(Shell shell, List<SQLQueryParameter> parameters) { super(shell); this.parameters = parameters; // Restore saved values from registry SQLQueryParameterRegistry registry = SQLQueryParameterRegistry.getInstance(); for (SQLQueryParameter param : this.parameters) { if (param.isNamed() && param.getValue() == null) { SQLQueryParameterRegistry.ParameterInfo paramInfo = registry.getParameter(param.getName()); if (paramInfo != null) { param.setValue(paramInfo.value); } } } } @Override protected IDialogSettings getDialogBoundsSettings() { return UIUtils.getDialogSettings(DIALOG_ID); } @Override protected boolean isResizable() { return true; } @Override public boolean isHelpAvailable() { return false; } @Override protected Control createDialogArea(Composite parent) { getShell().setText(SQLEditorMessages.dialog_sql_param_title); final Composite composite = (Composite)super.createDialogArea(parent); paramTable = new Table(composite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); final GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = 400; gd.heightHint = 200; paramTable.setLayoutData(gd); paramTable.setHeaderVisible(true); paramTable.setLinesVisible(true); final TableColumn indexColumn = UIUtils.createTableColumn(paramTable, SWT.LEFT, "#"); indexColumn.addListener(SWT.Selection, new TableColumnSortListener(paramTable, 0)); indexColumn.setWidth(40); final TableColumn nameColumn = UIUtils.createTableColumn(paramTable, SWT.LEFT, SQLEditorMessages.dialog_sql_param_column_name); nameColumn.addListener(SWT.Selection, new TableColumnSortListener(paramTable, 1)); nameColumn.setWidth(100); final TableColumn valueColumn = UIUtils.createTableColumn(paramTable, SWT.LEFT, SQLEditorMessages.dialog_sql_param_column_value); valueColumn.setWidth(200); fillParameterList(isHideIfSet()); final CustomTableEditor tableEditor = new CustomTableEditor(paramTable) { { firstTraverseIndex = 2; lastTraverseIndex = 2; editOnEnter = false; } @Override protected Control createEditor(Table table, int index, TableItem item) { if (index != 2) { return null; } SQLQueryParameter param = (SQLQueryParameter) item.getData(); Text editor = new Text(table, SWT.BORDER); editor.setText(CommonUtils.notEmpty(param.getValue())); editor.selectAll(); editor.addTraverseListener(e -> { if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.CTRL) == SWT.CTRL) { UIUtils.asyncExec(SQLQueryParameterBindDialog.this::okPressed); } }); return editor; } @Override protected void saveEditorValue(Control control, int index, TableItem item) { SQLQueryParameter param = (SQLQueryParameter) item.getData(); String newValue = ((Text) control).getText(); item.setText(2, newValue); param.setValue(newValue); if (param.isNamed()) { final List<SQLQueryParameter> dups = dupParameters.get(param.getName()); if (dups != null) { for (SQLQueryParameter dup : dups) { dup.setValue(newValue); } } } savedParamValues.put( param.getName().toUpperCase(Locale.ENGLISH), new SQLQueryParameterRegistry.ParameterInfo(param.getName(), newValue)); } }; if (!parameters.isEmpty()) { UIUtils.asyncExec(() -> { paramTable.select(0); tableEditor.showEditor(paramTable.getItem(0), 2); }); } hideIfSetCheck = UIUtils.createCheckbox(composite, SQLEditorMessages.dialog_sql_param_hide_checkbox, SQLEditorMessages.dialog_sql_param_hide_checkbox_tip, isHideIfSet(), 1); hideIfSetCheck.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fillParameterList(hideIfSetCheck.getSelection()); } }); updateStatus(GeneralUtils.makeInfoStatus(SQLEditorMessages.dialog_sql_param_hint)); return composite; } private void fillParameterList(boolean hideVariables) { paramTable.removeAll(); for (SQLQueryParameter param : parameters) { if (hideVariables && param.isVariableSet()) { continue; } if (param.getPrevious() != null) { // Skip duplicates List<SQLQueryParameter> dups = dupParameters.computeIfAbsent(param.getName(), k -> new ArrayList<>()); dups.add(param); continue; } TableItem item = new TableItem(paramTable, SWT.NONE); item.setData(param); item.setImage(DBeaverIcons.getImage(DBIcon.TREE_ATTRIBUTE)); item.setText(0, String.valueOf(param.getOrdinalPosition() + 1)); item.setText(1, param.getVarName()); item.setText(2, CommonUtils.notEmpty(param.getValue())); } } @Override protected void createButtonsForButtonBar(Composite parent) { Button skipButton = UIUtils.createDialogButton(parent, IDialogConstants.IGNORE_LABEL, new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setReturnCode(IDialogConstants.IGNORE_ID); close(); } }); skipButton.setToolTipText("Ignore parameters and execute query/script as is"); ((GridLayout) parent.getLayout()).numColumns++; super.createButtonsForButtonBar(parent); } @Override protected void okPressed() { SQLQueryParameterRegistry registry = SQLQueryParameterRegistry.getInstance(); for (SQLQueryParameterRegistry.ParameterInfo param : savedParamValues.values()) { registry.setParameter(param.name, param.value); } registry.save(); if (hideIfSetCheck != null) { getDialogBoundsSettings().put(PARAM_HIDE_IF_SET, hideIfSetCheck.getSelection()); } super.okPressed(); } public static boolean isHideIfSet() { return UIUtils.getDialogSettings(DIALOG_ID).getBoolean(PARAM_HIDE_IF_SET); } }
9,236
0.637799
0.633258
239
37.698746
31.423967
137
false
false
0
0
0
0
0
0
0.623431
false
false
3
287a2351d0f1708cff31e13e71574623076ab413
15,006,615,789,290
ca6f69aa087bc2ba8604a2f802ffb5ff58fdab5d
/app/src/main/java/com/Solver/Solver/Adepter/ScheduleAdapter.java
1b7446ae2a6957a97bafe739f909f4dfe2fe875b
[]
no_license
Shamim48/SolverTechnologyLtd-master
https://github.com/Shamim48/SolverTechnologyLtd-master
5d946aa15206508d14cca41068365f407dd7706e
1e2d0b083126ece1bf0e414c6bf8bc21cdf502f6
refs/heads/master
2022-06-20T04:29:07.065000
2019-12-05T15:26:37
2019-12-05T15:26:37
211,634,778
0
0
null
false
2022-06-02T21:21:22
2019-09-29T09:02:49
2019-12-05T15:26:51
2022-06-02T21:21:22
101,060
0
0
8
Java
false
false
package com.Solver.Solver.Adepter; import android.content.Context; import android.view.LayoutInflater; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.PopupMenu; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.Solver.Solver.ModelClass.Factories; import com.Solver.Solver.ModelClass.JobC; import com.Solver.Solver.ModelClass.JobCategory; import com.Solver.Solver.ModelClass.Schedule; import com.Solver.Solver.ModelClass.SignUp; import com.Solver.Solver.ModelClass.User; import com.Solver.Solver.R; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.Query; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import java.util.List; public class ScheduleAdapter extends RecyclerView.Adapter<ScheduleAdapter.ScheduleHolder> { Context context; List<Schedule> schedulesList; int slNum=1; private FirebaseUser currentUser; DatabaseReference databaseReference; FirebaseUser getCurrentUser; StorageReference storageReference; String userEmail; String factoryName; String userName; String jobTitle; String category; StringBuffer jobBuffer=new StringBuffer(); String jobCategory=""; String jobTitleId; String jobCategoryId; JobC jobOb; public ScheduleAdapter(Context context, List<Schedule> schedulesList) { this.context = context; this.schedulesList = schedulesList; } @NonNull @Override public ScheduleHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view =LayoutInflater.from(context).inflate(R.layout.schedule_row, parent, false); ScheduleHolder scheduleHolder=new ScheduleHolder(view); return scheduleHolder; } @Override public void onBindViewHolder(@NonNull final ScheduleHolder holder, final int position) { final Schedule schedule=schedulesList.get(position); DatabaseReference jobRef=FirebaseDatabase.getInstance().getReference("Utility").child("Job"); DatabaseReference jobCategoryRef=FirebaseDatabase.getInstance().getReference("Utility").child("Job_Category"); holder.dateTv.setText(schedule.getDate()+" Work Plan."); /* try { if(!(schedulesList.get(position).getEmployeeName().equals(""))){ holder.userNameTV.setText(schedule.getEmployeeName()); } }catch (Exception e){ }*/ //schedulesList.get(position).getEmp_id() try { if(!(schedulesList.get(position).getEmp_id().equals(""))){ DatabaseReference empName=FirebaseDatabase.getInstance().getReference("User"); Query userInfoRef=empName.orderByChild("userId").equalTo(schedulesList.get(position).getEmp_id()); userInfoRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot data:dataSnapshot.getChildren()){ SignUp user=data.getValue(SignUp.class); userName=user.getName(); } holder.userNameTV.setText(userName); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } }catch (Exception e){ } // if(!(schedulesList.get(position).getCompanyName().equals(""))){ String comId=String.valueOf(schedulesList.get(position).getFactoryId()); DatabaseReference companyREf=FirebaseDatabase.getInstance().getReference("factories"); Query facQuery=companyREf.orderByChild("customer_id").equalTo(schedulesList.get(position).getFactoryId()); facQuery.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot data:dataSnapshot.getChildren()){ Factories factories=data.getValue(Factories.class); factoryName=factories.getCompany_name(); } holder.companyNameTV.setText(factoryName); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); /* }else { holder.companyNameTV.setText(factoryName); } */ /*for (int i=0;i<=schedule.getList().size();i++){ holder.jobInfoTv.append(schedule.getList().get(i).getJobTitle()+"\nCategory:"+schedule.getList().get(i).getCategory()+"\nDes: "+schedule.getList().get(i).getJobDes()+"\n\n"); }*/ /* try { for (int i=0;i<=schedulesList.get(position).getList().size();i++){ // jobOb=jobC; jobTitleId=schedulesList.get(position).getList().get(i).getJobId(); jobCategoryId=schedulesList.get(position).getList().get(i).getCategoryId(); Query jobQuery=jobRef.orderByChild("jobId").equalTo(jobTitleId); if(!(schedulesList.get(position).getUserId().equals(""))){ jobQuery.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for(DataSnapshot data:dataSnapshot.getChildren()){ JobC jobttlt=data.getValue(JobC.class); jobTitle=jobttlt.getJobTitle(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); Query categoryQuery=jobCategoryRef.orderByChild("jobCategoryId").equalTo(jobCategoryId); categoryQuery.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot data:dataSnapshot.getChildren()){ JobCategory jobCategory1=data.getValue(JobCategory.class); category=jobCategory1.getJobCategoryName(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); // job.append("Job Name: ").append(jobTitle).append("(").append(category).append(").\nDes: ").append(jobC.getJobDes()).append(" .\n\n"); jobBuffer.append("Job Name: "+jobTitle+"("+category+").\nDes: "+schedulesList.get(position).getList().get(i).getJobDes()+" .\n\n"); }else { if(schedulesList.get(position).getList().get(i).getCategory().equals("Chose category")){ jobCategory=""; }else { jobCategory=schedulesList.get(position).getList().get(i).getCategory(); } // job.append("Job Name: ").append(jobC.getJobTitle()).append("(").append(jobCategory).append(").\nDes: ").append(jobC.getJobDes()).append(" .\n\n"); jobBuffer.append("Job Name: "+schedulesList.get(position).getList().get(i).getJobTitle()+"("+jobCategory+").\nDes: "+schedulesList.get(position).getList().get(i).getJobDes()+" .\n\n"); } } holder.jobInfoTv.setText(jobBuffer); }catch (NullPointerException e){ } */ try { for (JobC jobC:schedule.getList()){ jobOb=jobC; jobTitleId=jobC.getJobId(); jobCategoryId=jobC.getCategoryId(); Query jobQuery=jobRef.orderByChild("jobId").equalTo(jobTitleId); /* if(!(schedulesList.get(position).getUserId().equals(""))){ jobQuery.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for(DataSnapshot data:dataSnapshot.getChildren()){ JobC jobttlt=data.getValue(JobC.class); jobTitle=jobttlt.getJobTitle(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); Query categoryQuery=jobCategoryRef.orderByChild("jobCategoryId").equalTo(jobCategoryId); categoryQuery.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot data:dataSnapshot.getChildren()){ JobCategory jobCategory1=data.getValue(JobCategory.class); category=jobCategory1.getJobCategoryName(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); // job.append("Job Name: ").append(jobTitle).append("(").append(category).append(").\nDes: ").append(jobC.getJobDes()).append(" .\n\n"); jobBuffer.append("Job Name: "+jobTitle+"("+category+").\nDes: "+jobC.getJobDes()+" .\n\n"); }else {*/ if(jobC.getCategory().equals("Chose category")){ jobCategory=""; }else { jobCategory=jobC.getCategory(); } // job.append("Job Name: ").append(jobC.getJobTitle()).append("(").append(jobCategory).append(").\nDes: ").append(jobC.getJobDes()).append(" .\n\n"); jobBuffer.append("Job Name: "+jobC.getJobTitle()+"("+jobCategory+").\nDes: "+jobC.getJobDes()+" .\n\n"); // } } holder.jobInfoTv.setText(jobBuffer); }catch (NullPointerException e){ } /* try { for (int i=0;i<=schedulesList.get(position).getList().size();i++){ holder.jobInfoTv.append("Job Name: "+schedule.getList().get(i).getJobTitle()+" .\nCategory:"+schedule.getList().get(i).getCategory()+" .\nDes: "+schedule.getList().get(i).getJobDes()+" .\n\n"); } }catch (Exception e){ } */ if(!(userEmail.equals("solver.apps.bd@gmail.com"))){ holder.row_menuTv.setText(null); }else { holder.row_menuTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PopupMenu popupMenu=new PopupMenu(context,view); MenuInflater inflater=popupMenu.getMenuInflater(); inflater.inflate(R.menu.delete_row,popupMenu.getMenu()); popupMenu.show(); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { switch (menuItem.getItemId()){ case R.id.deleteRowId: databaseReference= FirebaseDatabase.getInstance().getReference().child("Schedule").child("All_ScheduleTbl"); String key=schedule.getScheduleId().toString(); databaseReference.child(schedule.getScheduleId()).removeValue(); Toast.makeText(context,"Delete Successful",Toast.LENGTH_SHORT).show(); break; } return false; } }); } }); } } @Override public int getItemCount() { return schedulesList.size(); } public class ScheduleHolder extends RecyclerView.ViewHolder{ TextView dateTv; TextView userNameTV; TextView companyNameTV; TextView jobInfoTv; TextView row_menuTv; public ScheduleHolder(@NonNull View itemView) { super(itemView); dateTv=itemView.findViewById(R.id.scheduleDateId); userNameTV=itemView.findViewById(R.id.nameUSDId); companyNameTV=itemView.findViewById(R.id.comNameSdId); jobInfoTv=itemView.findViewById(R.id.jobSdId); row_menuTv=itemView.findViewById(R.id.row_menuSdId); try { currentUser= FirebaseAuth.getInstance().getCurrentUser(); userEmail=currentUser.getEmail(); getCurrentUser=FirebaseAuth.getInstance().getCurrentUser(); }catch (Exception e){ Toast.makeText(context,"Exception: "+e,Toast.LENGTH_SHORT).show(); } } } }
UTF-8
Java
14,233
java
ScheduleAdapter.java
Java
[ { "context": "ring userEmail;\n String factoryName;\n String userName;\n String jobTitle;\n String category;\n St", "end": 1770, "score": 0.751905620098114, "start": 1762, "tag": "USERNAME", "value": "userName" }, { "context": " e){\n\n }\n*/\n if(!(userE...
null
[]
package com.Solver.Solver.Adepter; import android.content.Context; import android.view.LayoutInflater; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.PopupMenu; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.Solver.Solver.ModelClass.Factories; import com.Solver.Solver.ModelClass.JobC; import com.Solver.Solver.ModelClass.JobCategory; import com.Solver.Solver.ModelClass.Schedule; import com.Solver.Solver.ModelClass.SignUp; import com.Solver.Solver.ModelClass.User; import com.Solver.Solver.R; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.Query; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import java.util.List; public class ScheduleAdapter extends RecyclerView.Adapter<ScheduleAdapter.ScheduleHolder> { Context context; List<Schedule> schedulesList; int slNum=1; private FirebaseUser currentUser; DatabaseReference databaseReference; FirebaseUser getCurrentUser; StorageReference storageReference; String userEmail; String factoryName; String userName; String jobTitle; String category; StringBuffer jobBuffer=new StringBuffer(); String jobCategory=""; String jobTitleId; String jobCategoryId; JobC jobOb; public ScheduleAdapter(Context context, List<Schedule> schedulesList) { this.context = context; this.schedulesList = schedulesList; } @NonNull @Override public ScheduleHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view =LayoutInflater.from(context).inflate(R.layout.schedule_row, parent, false); ScheduleHolder scheduleHolder=new ScheduleHolder(view); return scheduleHolder; } @Override public void onBindViewHolder(@NonNull final ScheduleHolder holder, final int position) { final Schedule schedule=schedulesList.get(position); DatabaseReference jobRef=FirebaseDatabase.getInstance().getReference("Utility").child("Job"); DatabaseReference jobCategoryRef=FirebaseDatabase.getInstance().getReference("Utility").child("Job_Category"); holder.dateTv.setText(schedule.getDate()+" Work Plan."); /* try { if(!(schedulesList.get(position).getEmployeeName().equals(""))){ holder.userNameTV.setText(schedule.getEmployeeName()); } }catch (Exception e){ }*/ //schedulesList.get(position).getEmp_id() try { if(!(schedulesList.get(position).getEmp_id().equals(""))){ DatabaseReference empName=FirebaseDatabase.getInstance().getReference("User"); Query userInfoRef=empName.orderByChild("userId").equalTo(schedulesList.get(position).getEmp_id()); userInfoRef.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot data:dataSnapshot.getChildren()){ SignUp user=data.getValue(SignUp.class); userName=user.getName(); } holder.userNameTV.setText(userName); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } }catch (Exception e){ } // if(!(schedulesList.get(position).getCompanyName().equals(""))){ String comId=String.valueOf(schedulesList.get(position).getFactoryId()); DatabaseReference companyREf=FirebaseDatabase.getInstance().getReference("factories"); Query facQuery=companyREf.orderByChild("customer_id").equalTo(schedulesList.get(position).getFactoryId()); facQuery.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot data:dataSnapshot.getChildren()){ Factories factories=data.getValue(Factories.class); factoryName=factories.getCompany_name(); } holder.companyNameTV.setText(factoryName); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); /* }else { holder.companyNameTV.setText(factoryName); } */ /*for (int i=0;i<=schedule.getList().size();i++){ holder.jobInfoTv.append(schedule.getList().get(i).getJobTitle()+"\nCategory:"+schedule.getList().get(i).getCategory()+"\nDes: "+schedule.getList().get(i).getJobDes()+"\n\n"); }*/ /* try { for (int i=0;i<=schedulesList.get(position).getList().size();i++){ // jobOb=jobC; jobTitleId=schedulesList.get(position).getList().get(i).getJobId(); jobCategoryId=schedulesList.get(position).getList().get(i).getCategoryId(); Query jobQuery=jobRef.orderByChild("jobId").equalTo(jobTitleId); if(!(schedulesList.get(position).getUserId().equals(""))){ jobQuery.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for(DataSnapshot data:dataSnapshot.getChildren()){ JobC jobttlt=data.getValue(JobC.class); jobTitle=jobttlt.getJobTitle(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); Query categoryQuery=jobCategoryRef.orderByChild("jobCategoryId").equalTo(jobCategoryId); categoryQuery.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot data:dataSnapshot.getChildren()){ JobCategory jobCategory1=data.getValue(JobCategory.class); category=jobCategory1.getJobCategoryName(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); // job.append("Job Name: ").append(jobTitle).append("(").append(category).append(").\nDes: ").append(jobC.getJobDes()).append(" .\n\n"); jobBuffer.append("Job Name: "+jobTitle+"("+category+").\nDes: "+schedulesList.get(position).getList().get(i).getJobDes()+" .\n\n"); }else { if(schedulesList.get(position).getList().get(i).getCategory().equals("Chose category")){ jobCategory=""; }else { jobCategory=schedulesList.get(position).getList().get(i).getCategory(); } // job.append("Job Name: ").append(jobC.getJobTitle()).append("(").append(jobCategory).append(").\nDes: ").append(jobC.getJobDes()).append(" .\n\n"); jobBuffer.append("Job Name: "+schedulesList.get(position).getList().get(i).getJobTitle()+"("+jobCategory+").\nDes: "+schedulesList.get(position).getList().get(i).getJobDes()+" .\n\n"); } } holder.jobInfoTv.setText(jobBuffer); }catch (NullPointerException e){ } */ try { for (JobC jobC:schedule.getList()){ jobOb=jobC; jobTitleId=jobC.getJobId(); jobCategoryId=jobC.getCategoryId(); Query jobQuery=jobRef.orderByChild("jobId").equalTo(jobTitleId); /* if(!(schedulesList.get(position).getUserId().equals(""))){ jobQuery.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for(DataSnapshot data:dataSnapshot.getChildren()){ JobC jobttlt=data.getValue(JobC.class); jobTitle=jobttlt.getJobTitle(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); Query categoryQuery=jobCategoryRef.orderByChild("jobCategoryId").equalTo(jobCategoryId); categoryQuery.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot data:dataSnapshot.getChildren()){ JobCategory jobCategory1=data.getValue(JobCategory.class); category=jobCategory1.getJobCategoryName(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); // job.append("Job Name: ").append(jobTitle).append("(").append(category).append(").\nDes: ").append(jobC.getJobDes()).append(" .\n\n"); jobBuffer.append("Job Name: "+jobTitle+"("+category+").\nDes: "+jobC.getJobDes()+" .\n\n"); }else {*/ if(jobC.getCategory().equals("Chose category")){ jobCategory=""; }else { jobCategory=jobC.getCategory(); } // job.append("Job Name: ").append(jobC.getJobTitle()).append("(").append(jobCategory).append(").\nDes: ").append(jobC.getJobDes()).append(" .\n\n"); jobBuffer.append("Job Name: "+jobC.getJobTitle()+"("+jobCategory+").\nDes: "+jobC.getJobDes()+" .\n\n"); // } } holder.jobInfoTv.setText(jobBuffer); }catch (NullPointerException e){ } /* try { for (int i=0;i<=schedulesList.get(position).getList().size();i++){ holder.jobInfoTv.append("Job Name: "+schedule.getList().get(i).getJobTitle()+" .\nCategory:"+schedule.getList().get(i).getCategory()+" .\nDes: "+schedule.getList().get(i).getJobDes()+" .\n\n"); } }catch (Exception e){ } */ if(!(userEmail.equals("<EMAIL>"))){ holder.row_menuTv.setText(null); }else { holder.row_menuTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PopupMenu popupMenu=new PopupMenu(context,view); MenuInflater inflater=popupMenu.getMenuInflater(); inflater.inflate(R.menu.delete_row,popupMenu.getMenu()); popupMenu.show(); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { switch (menuItem.getItemId()){ case R.id.deleteRowId: databaseReference= FirebaseDatabase.getInstance().getReference().child("Schedule").child("All_ScheduleTbl"); String key=schedule.getScheduleId().toString(); databaseReference.child(schedule.getScheduleId()).removeValue(); Toast.makeText(context,"Delete Successful",Toast.LENGTH_SHORT).show(); break; } return false; } }); } }); } } @Override public int getItemCount() { return schedulesList.size(); } public class ScheduleHolder extends RecyclerView.ViewHolder{ TextView dateTv; TextView userNameTV; TextView companyNameTV; TextView jobInfoTv; TextView row_menuTv; public ScheduleHolder(@NonNull View itemView) { super(itemView); dateTv=itemView.findViewById(R.id.scheduleDateId); userNameTV=itemView.findViewById(R.id.nameUSDId); companyNameTV=itemView.findViewById(R.id.comNameSdId); jobInfoTv=itemView.findViewById(R.id.jobSdId); row_menuTv=itemView.findViewById(R.id.row_menuSdId); try { currentUser= FirebaseAuth.getInstance().getCurrentUser(); userEmail=currentUser.getEmail(); getCurrentUser=FirebaseAuth.getInstance().getCurrentUser(); }catch (Exception e){ Toast.makeText(context,"Exception: "+e,Toast.LENGTH_SHORT).show(); } } } }
14,216
0.568678
0.568116
366
37.890709
37.741196
209
false
false
0
0
0
0
0
0
0.431694
false
false
3
bee75b74637c17db43d6a78fb26a16951757e8d4
15,006,615,792,150
742a0ce7e00b4e573a7fb9edb2012b2e16395bbd
/src/main/java/com/needayeah/elasticsearch/web/controller/admin/AdminController.java
1e3b653db5b01ca013c2ccee35bf0aeb09733071
[]
no_license
MrfrankyLee/elasticsearch-project
https://github.com/MrfrankyLee/elasticsearch-project
9b8381795fea961c7a246b35c2d48207c70b4555
c7fb41de41246ea5f9646ecdc3a2da720f91b4d4
refs/heads/master
2020-04-03T12:03:35.668000
2018-11-01T05:29:08
2018-11-01T05:29:08
155,220,358
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.needayeah.elasticsearch.web.controller.admin; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; 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.RestController; @Controller @RequestMapping("/admin") @Api(value = "/admin", description = "用户") public class AdminController { @RequestMapping(value = "/center",method = RequestMethod.GET) @ApiOperation(notes = "adminCenterPage",value = "进入后台管理页面",httpMethod = "GET") public String adminCenterPage(){ return "/admin/center"; } @RequestMapping(value = "/welcome",method = RequestMethod.GET) @ApiOperation(notes = "welcomePage",value = "欢迎页面",httpMethod = "GET") public String welcomePage(){ return "/admin/welcome"; } @RequestMapping(value = "/login",method = RequestMethod.GET) @ApiOperation(notes = "AdminLogin",value = "后台登录页面",httpMethod = "GET") public String AdminLogin(){ return "/admin/login"; } }
UTF-8
Java
1,184
java
AdminController.java
Java
[]
null
[]
package com.needayeah.elasticsearch.web.controller.admin; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; 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.RestController; @Controller @RequestMapping("/admin") @Api(value = "/admin", description = "用户") public class AdminController { @RequestMapping(value = "/center",method = RequestMethod.GET) @ApiOperation(notes = "adminCenterPage",value = "进入后台管理页面",httpMethod = "GET") public String adminCenterPage(){ return "/admin/center"; } @RequestMapping(value = "/welcome",method = RequestMethod.GET) @ApiOperation(notes = "welcomePage",value = "欢迎页面",httpMethod = "GET") public String welcomePage(){ return "/admin/welcome"; } @RequestMapping(value = "/login",method = RequestMethod.GET) @ApiOperation(notes = "AdminLogin",value = "后台登录页面",httpMethod = "GET") public String AdminLogin(){ return "/admin/login"; } }
1,184
0.72465
0.72465
34
32.64706
26.557243
82
false
false
0
0
0
0
0
0
0.588235
false
false
3
fcc70baba18941a98eab293d7b325ecbb3bf5c15
4,939,212,416,311
8cd932cd7e233d136f7f60a5a57ffe0057d5bfab
/src/main/java/ddv/com/hcmanagement/service/UserService.java
3b0313688240a4ad4986325b2ecbda2c1f78b357
[]
no_license
damdravic/HSmanagement
https://github.com/damdravic/HSmanagement
eb32def08c7da7dfaf71ee3c3f998c560ef08f9c
dcb8ba51f606560724f481460371e6c9dd20db09
refs/heads/master
2022-12-16T04:37:02.849000
2020-09-23T17:52:46
2020-09-23T17:52:46
298,029,638
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ddv.com.hcmanagement.service; import ddv.com.hcmanagement.security.User; import ddv.com.hcmanagement.security.UserRole; import org.springframework.stereotype.Service; import java.util.Set; public interface UserService { User createUser(User user, Set<UserRole> userRole); }
UTF-8
Java
291
java
UserService.java
Java
[]
null
[]
package ddv.com.hcmanagement.service; import ddv.com.hcmanagement.security.User; import ddv.com.hcmanagement.security.UserRole; import org.springframework.stereotype.Service; import java.util.Set; public interface UserService { User createUser(User user, Set<UserRole> userRole); }
291
0.800687
0.800687
13
21.384615
21.09881
55
false
false
0
0
0
0
0
0
0.538462
false
false
3
8306b25f6390e8448e8877770df996d09146917e
16,810,501,998,555
f3e7434ab409d03d457c69d1c1ca52ed57f7383c
/src/main/java/com/iceniro/ticket/dataProcess/FileUitl.java
71d3c94ae0122bf1e1d20dc81a10ff2c88688e27
[]
no_license
IceNiro/analysis
https://github.com/IceNiro/analysis
5b4b06d5960be725925052c8d70fdd04e00875e4
fc5227166dc6c20e154cb300b97653cfe08e1719
refs/heads/master
2020-03-27T23:19:18.655000
2018-09-06T02:18:32
2018-09-06T02:18:32
147,308,654
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.iceniro.ticket.dataProcess; import com.sun.istack.internal.NotNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.*; import java.util.ArrayList; import java.util.List; /** * @author gan.jiangwei * @since 2018/9/3 0003. */ public class FileUitl { private final static Logger logger = LogManager.getLogger(FileUitl.class); static String path = FileUitl.class.getClassLoader().getResource("stations").getPath(); public static List<String> readFile() { try { List<String> lines = new ArrayList<String>(); File file = new File(path); BufferedReader is = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line; while ((line = is.readLine()) != null) { lines.add(line); } return lines; } catch (Exception e) { e.printStackTrace(); } return null; } public static void writeFile(String content) { try { File file = new File(path); BufferedWriter bw = new BufferedWriter(new FileWriter(file, true)); bw.newLine(); bw.write(content); bw.flush(); bw.close(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { List<String> list = readFile(); for (String item : list) { String[] detail = item.split("\\|"); for (int i = 0; i < detail.length; i = i + 5) { String name = detail[i + 1]; String code = detail[i + 2]; writeFile(code + ":" + name); } } } }
UTF-8
Java
1,771
java
FileUitl.java
Java
[ { "context": ".ArrayList;\nimport java.util.List;\n\n/**\n * @author gan.jiangwei\n * @since 2018/9/3 0003.\n */\npublic class FileUit", "end": 263, "score": 0.9023721814155579, "start": 251, "tag": "NAME", "value": "gan.jiangwei" } ]
null
[]
package com.iceniro.ticket.dataProcess; import com.sun.istack.internal.NotNull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.*; import java.util.ArrayList; import java.util.List; /** * @author gan.jiangwei * @since 2018/9/3 0003. */ public class FileUitl { private final static Logger logger = LogManager.getLogger(FileUitl.class); static String path = FileUitl.class.getClassLoader().getResource("stations").getPath(); public static List<String> readFile() { try { List<String> lines = new ArrayList<String>(); File file = new File(path); BufferedReader is = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line; while ((line = is.readLine()) != null) { lines.add(line); } return lines; } catch (Exception e) { e.printStackTrace(); } return null; } public static void writeFile(String content) { try { File file = new File(path); BufferedWriter bw = new BufferedWriter(new FileWriter(file, true)); bw.newLine(); bw.write(content); bw.flush(); bw.close(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { List<String> list = readFile(); for (String item : list) { String[] detail = item.split("\\|"); for (int i = 0; i < detail.length; i = i + 5) { String name = detail[i + 1]; String code = detail[i + 2]; writeFile(code + ":" + name); } } } }
1,771
0.55223
0.543196
60
28.516666
22.873924
101
false
false
0
0
0
0
0
0
0.55
false
false
3
45988f4ccf1926ecb8d4e3ef18707bdc97da4bd8
17,575,006,198,192
ebca924ac0b6408c93bac779cab27c611da6e82c
/p309.java
52eafeb9c91f03fc7f07a731a9f18897d82a0d04
[]
no_license
MiYazJE/Acepta-el-reto
https://github.com/MiYazJE/Acepta-el-reto
f3780661e0d0f5b7cfe8d9225c8f6ee8d729e0d9
eb0bf9f14d104f4e125222fb21a135176cd22583
refs/heads/master
2023-05-01T18:40:34.284000
2023-04-23T08:17:51
2023-04-23T08:17:51
150,253,495
30
29
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; // 15 + 8 - 7 + 10 - 3 // 23 16 26 23 public class p309 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int casos; int resultado = 0; int n2; String signo; casos = s.nextInt(); for(int i=0; i<casos; i++) { resultado = s.nextInt(); signo = s.next(); n2 = s.nextInt(); while(!signo.equals(".")) { if(signo.equals("+")) { resultado += n2; } else if(signo.equals("-")) { resultado -= n2; } signo = s.next(); if(signo.equals(".")) { System.out.print(resultado); resultado = 0; } else { System.out.print(resultado + ", "); n2 = s.nextInt(); } } System.out.println(); } } }
UTF-8
Java
764
java
p309.java
Java
[]
null
[]
import java.util.Scanner; // 15 + 8 - 7 + 10 - 3 // 23 16 26 23 public class p309 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int casos; int resultado = 0; int n2; String signo; casos = s.nextInt(); for(int i=0; i<casos; i++) { resultado = s.nextInt(); signo = s.next(); n2 = s.nextInt(); while(!signo.equals(".")) { if(signo.equals("+")) { resultado += n2; } else if(signo.equals("-")) { resultado -= n2; } signo = s.next(); if(signo.equals(".")) { System.out.print(resultado); resultado = 0; } else { System.out.print(resultado + ", "); n2 = s.nextInt(); } } System.out.println(); } } }
764
0.505236
0.471204
67
10.417911
12.637482
41
false
false
0
0
0
0
0
0
1.80597
false
false
3
b540d91bfa8a17371ad27e09d654640b3f15f7af
26,474,178,446,390
1c537a761c95a80ddbbc372c0547883547780daa
/org/apache/commons/lang3/StringUtils.java
d1cef658fc92239cc8b50fb93bfa616420e19754
[]
no_license
NiotGG/spigot-1.8.8
https://github.com/NiotGG/spigot-1.8.8
eae8881f4a37eaecb58442e3558bea2634247b54
b2bbec2f037678a3f99d298a5a6a6cb1b98e79ce
refs/heads/master
2020-03-31T13:21:08.009000
2018-10-09T13:00:33
2018-10-09T13:00:33
152,251,977
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* */ package org.apache.commons.lang3; /* */ /* */ import java.io.UnsupportedEncodingException; /* */ import java.nio.charset.Charset; /* */ import java.text.Normalizer; /* */ import java.text.Normalizer.Form; /* */ import java.util.ArrayList; /* */ import java.util.Arrays; /* */ import java.util.Iterator; /* */ import java.util.List; /* */ import java.util.Locale; /* */ import java.util.regex.Matcher; /* */ import java.util.regex.Pattern; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class StringUtils /* */ { /* */ public static final String SPACE = " "; /* */ public static final String EMPTY = ""; /* */ public static final String LF = "\n"; /* */ public static final String CR = "\r"; /* */ public static final int INDEX_NOT_FOUND = -1; /* */ private static final int PAD_LIMIT = 8192; /* 183 */ private static final Pattern WHITESPACE_PATTERN = Pattern.compile("(?: |\\u00A0|\\s|[\\s&&[^ ]])\\s*"); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isEmpty(CharSequence paramCharSequence) /* */ { /* 219 */ return (paramCharSequence == null) || (paramCharSequence.length() == 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNotEmpty(CharSequence paramCharSequence) /* */ { /* 238 */ return !isEmpty(paramCharSequence); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAnyEmpty(CharSequence... paramVarArgs) /* */ { /* 259 */ if (ArrayUtils.isEmpty(paramVarArgs)) { /* 260 */ return true; /* */ } /* 262 */ for (CharSequence localCharSequence : paramVarArgs) { /* 263 */ if (isEmpty(localCharSequence)) { /* 264 */ return true; /* */ } /* */ } /* 267 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNoneEmpty(CharSequence... paramVarArgs) /* */ { /* 288 */ return !isAnyEmpty(paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isBlank(CharSequence paramCharSequence) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 308 */ if ((paramCharSequence == null) || ((i = paramCharSequence.length()) == 0)) { /* 309 */ return true; /* */ } /* 311 */ for (int j = 0; j < i; j++) { /* 312 */ if (!Character.isWhitespace(paramCharSequence.charAt(j))) { /* 313 */ return false; /* */ } /* */ } /* 316 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNotBlank(CharSequence paramCharSequence) /* */ { /* 337 */ return !isBlank(paramCharSequence); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAnyBlank(CharSequence... paramVarArgs) /* */ { /* 359 */ if (ArrayUtils.isEmpty(paramVarArgs)) { /* 360 */ return true; /* */ } /* 362 */ for (CharSequence localCharSequence : paramVarArgs) { /* 363 */ if (isBlank(localCharSequence)) { /* 364 */ return true; /* */ } /* */ } /* 367 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNoneBlank(CharSequence... paramVarArgs) /* */ { /* 389 */ return !isAnyBlank(paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String trim(String paramString) /* */ { /* 418 */ return paramString == null ? null : paramString.trim(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String trimToNull(String paramString) /* */ { /* 444 */ String str = trim(paramString); /* 445 */ return isEmpty(str) ? null : str; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String trimToEmpty(String paramString) /* */ { /* 470 */ return paramString == null ? "" : paramString.trim(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String strip(String paramString) /* */ { /* 498 */ return strip(paramString, null); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String stripToNull(String paramString) /* */ { /* 525 */ if (paramString == null) { /* 526 */ return null; /* */ } /* 528 */ paramString = strip(paramString, null); /* 529 */ return paramString.isEmpty() ? null : paramString; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String stripToEmpty(String paramString) /* */ { /* 555 */ return paramString == null ? "" : strip(paramString, null); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String strip(String paramString1, String paramString2) /* */ { /* 585 */ if (isEmpty(paramString1)) { /* 586 */ return paramString1; /* */ } /* 588 */ paramString1 = stripStart(paramString1, paramString2); /* 589 */ return stripEnd(paramString1, paramString2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String stripStart(String paramString1, String paramString2) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 618 */ if ((paramString1 == null) || ((i = paramString1.length()) == 0)) { /* 619 */ return paramString1; /* */ } /* 621 */ int j = 0; /* 622 */ if (paramString2 == null) { /* 623 */ while ((j != i) && (Character.isWhitespace(paramString1.charAt(j)))) /* 624 */ j++; /* */ } /* 626 */ if (paramString2.isEmpty()) { /* 627 */ return paramString1; /* */ } /* 629 */ while ((j != i) && (paramString2.indexOf(paramString1.charAt(j)) != -1)) { /* 630 */ j++; /* */ } /* */ /* 633 */ return paramString1.substring(j); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String stripEnd(String paramString1, String paramString2) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 663 */ if ((paramString1 == null) || ((i = paramString1.length()) == 0)) { /* 664 */ return paramString1; /* */ } /* */ /* 667 */ if (paramString2 == null) { /* 668 */ while ((i != 0) && (Character.isWhitespace(paramString1.charAt(i - 1)))) /* 669 */ i--; /* */ } /* 671 */ if (paramString2.isEmpty()) { /* 672 */ return paramString1; /* */ } /* 674 */ while ((i != 0) && (paramString2.indexOf(paramString1.charAt(i - 1)) != -1)) { /* 675 */ i--; /* */ } /* */ /* 678 */ return paramString1.substring(0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] stripAll(String... paramVarArgs) /* */ { /* 703 */ return stripAll(paramVarArgs, null); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] stripAll(String[] paramArrayOfString, String paramString) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 733 */ if ((paramArrayOfString == null) || ((i = paramArrayOfString.length) == 0)) { /* 734 */ return paramArrayOfString; /* */ } /* 736 */ String[] arrayOfString = new String[i]; /* 737 */ for (int j = 0; j < i; j++) { /* 738 */ arrayOfString[j] = strip(paramArrayOfString[j], paramString); /* */ } /* 740 */ return arrayOfString; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String stripAccents(String paramString) /* */ { /* 762 */ if (paramString == null) { /* 763 */ return null; /* */ } /* 765 */ Pattern localPattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+"); /* 766 */ String str = Normalizer.normalize(paramString, Normalizer.Form.NFD); /* */ /* 768 */ return localPattern.matcher(str).replaceAll(""); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean equals(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 795 */ if (paramCharSequence1 == paramCharSequence2) { /* 796 */ return true; /* */ } /* 798 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 799 */ return false; /* */ } /* 801 */ if (((paramCharSequence1 instanceof String)) && ((paramCharSequence2 instanceof String))) { /* 802 */ return paramCharSequence1.equals(paramCharSequence2); /* */ } /* 804 */ return CharSequenceUtils.regionMatches(paramCharSequence1, false, 0, paramCharSequence2, 0, Math.max(paramCharSequence1.length(), paramCharSequence2.length())); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean equalsIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 829 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) /* 830 */ return paramCharSequence1 == paramCharSequence2; /* 831 */ if (paramCharSequence1 == paramCharSequence2) /* 832 */ return true; /* 833 */ if (paramCharSequence1.length() != paramCharSequence2.length()) { /* 834 */ return false; /* */ } /* 836 */ return CharSequenceUtils.regionMatches(paramCharSequence1, true, 0, paramCharSequence2, 0, paramCharSequence1.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOf(CharSequence paramCharSequence, int paramInt) /* */ { /* 863 */ if (isEmpty(paramCharSequence)) { /* 864 */ return -1; /* */ } /* 866 */ return CharSequenceUtils.indexOf(paramCharSequence, paramInt, 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOf(CharSequence paramCharSequence, int paramInt1, int paramInt2) /* */ { /* 896 */ if (isEmpty(paramCharSequence)) { /* 897 */ return -1; /* */ } /* 899 */ return CharSequenceUtils.indexOf(paramCharSequence, paramInt1, paramInt2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 927 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 928 */ return -1; /* */ } /* 930 */ return CharSequenceUtils.indexOf(paramCharSequence1, paramCharSequence2, 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 967 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 968 */ return -1; /* */ } /* 970 */ return CharSequenceUtils.indexOf(paramCharSequence1, paramCharSequence2, paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int ordinalIndexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 1008 */ return ordinalIndexOf(paramCharSequence1, paramCharSequence2, paramInt, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static int ordinalIndexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt, boolean paramBoolean) /* */ { /* 1026 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null) || (paramInt <= 0)) { /* 1027 */ return -1; /* */ } /* 1029 */ if (paramCharSequence2.length() == 0) { /* 1030 */ return paramBoolean ? paramCharSequence1.length() : 0; /* */ } /* 1032 */ int i = 0; /* 1033 */ int j = paramBoolean ? paramCharSequence1.length() : -1; /* */ do { /* 1035 */ if (paramBoolean) { /* 1036 */ j = CharSequenceUtils.lastIndexOf(paramCharSequence1, paramCharSequence2, j - 1); /* */ } else { /* 1038 */ j = CharSequenceUtils.indexOf(paramCharSequence1, paramCharSequence2, j + 1); /* */ } /* 1040 */ if (j < 0) { /* 1041 */ return j; /* */ } /* 1043 */ i++; /* 1044 */ } while (i < paramInt); /* 1045 */ return j; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1074 */ return indexOfIgnoreCase(paramCharSequence1, paramCharSequence2, 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 1110 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1111 */ return -1; /* */ } /* 1113 */ if (paramInt < 0) { /* 1114 */ paramInt = 0; /* */ } /* 1116 */ int i = paramCharSequence1.length() - paramCharSequence2.length() + 1; /* 1117 */ if (paramInt > i) { /* 1118 */ return -1; /* */ } /* 1120 */ if (paramCharSequence2.length() == 0) { /* 1121 */ return paramInt; /* */ } /* 1123 */ for (int j = paramInt; j < i; j++) { /* 1124 */ if (CharSequenceUtils.regionMatches(paramCharSequence1, true, j, paramCharSequence2, 0, paramCharSequence2.length())) { /* 1125 */ return j; /* */ } /* */ } /* 1128 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOf(CharSequence paramCharSequence, int paramInt) /* */ { /* 1154 */ if (isEmpty(paramCharSequence)) { /* 1155 */ return -1; /* */ } /* 1157 */ return CharSequenceUtils.lastIndexOf(paramCharSequence, paramInt, paramCharSequence.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOf(CharSequence paramCharSequence, int paramInt1, int paramInt2) /* */ { /* 1192 */ if (isEmpty(paramCharSequence)) { /* 1193 */ return -1; /* */ } /* 1195 */ return CharSequenceUtils.lastIndexOf(paramCharSequence, paramInt1, paramInt2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1222 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1223 */ return -1; /* */ } /* 1225 */ return CharSequenceUtils.lastIndexOf(paramCharSequence1, paramCharSequence2, paramCharSequence1.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastOrdinalIndexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 1263 */ return ordinalIndexOf(paramCharSequence1, paramCharSequence2, paramInt, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 1303 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1304 */ return -1; /* */ } /* 1306 */ return CharSequenceUtils.lastIndexOf(paramCharSequence1, paramCharSequence2, paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOfIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1333 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1334 */ return -1; /* */ } /* 1336 */ return lastIndexOfIgnoreCase(paramCharSequence1, paramCharSequence2, paramCharSequence1.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOfIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 1372 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1373 */ return -1; /* */ } /* 1375 */ if (paramInt > paramCharSequence1.length() - paramCharSequence2.length()) { /* 1376 */ paramInt = paramCharSequence1.length() - paramCharSequence2.length(); /* */ } /* 1378 */ if (paramInt < 0) { /* 1379 */ return -1; /* */ } /* 1381 */ if (paramCharSequence2.length() == 0) { /* 1382 */ return paramInt; /* */ } /* */ /* 1385 */ for (int i = paramInt; i >= 0; i--) { /* 1386 */ if (CharSequenceUtils.regionMatches(paramCharSequence1, true, i, paramCharSequence2, 0, paramCharSequence2.length())) { /* 1387 */ return i; /* */ } /* */ } /* 1390 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean contains(CharSequence paramCharSequence, int paramInt) /* */ { /* 1416 */ if (isEmpty(paramCharSequence)) { /* 1417 */ return false; /* */ } /* 1419 */ return CharSequenceUtils.indexOf(paramCharSequence, paramInt, 0) >= 0; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean contains(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1445 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1446 */ return false; /* */ } /* 1448 */ return CharSequenceUtils.indexOf(paramCharSequence1, paramCharSequence2, 0) >= 0; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1476 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1477 */ return false; /* */ } /* 1479 */ int i = paramCharSequence2.length(); /* 1480 */ int j = paramCharSequence1.length() - i; /* 1481 */ for (int k = 0; k <= j; k++) { /* 1482 */ if (CharSequenceUtils.regionMatches(paramCharSequence1, true, k, paramCharSequence2, 0, i)) { /* 1483 */ return true; /* */ } /* */ } /* 1486 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsWhitespace(CharSequence paramCharSequence) /* */ { /* 1499 */ if (isEmpty(paramCharSequence)) { /* 1500 */ return false; /* */ } /* 1502 */ int i = paramCharSequence.length(); /* 1503 */ for (int j = 0; j < i; j++) { /* 1504 */ if (Character.isWhitespace(paramCharSequence.charAt(j))) { /* 1505 */ return true; /* */ } /* */ } /* 1508 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfAny(CharSequence paramCharSequence, char... paramVarArgs) /* */ { /* 1537 */ if ((isEmpty(paramCharSequence)) || (ArrayUtils.isEmpty(paramVarArgs))) { /* 1538 */ return -1; /* */ } /* 1540 */ int i = paramCharSequence.length(); /* 1541 */ int j = i - 1; /* 1542 */ int k = paramVarArgs.length; /* 1543 */ int m = k - 1; /* 1544 */ for (int n = 0; n < i; n++) { /* 1545 */ char c = paramCharSequence.charAt(n); /* 1546 */ for (int i1 = 0; i1 < k; i1++) { /* 1547 */ if (paramVarArgs[i1] == c) { /* 1548 */ if ((n < j) && (i1 < m) && (Character.isHighSurrogate(c))) /* */ { /* 1550 */ if (paramVarArgs[(i1 + 1)] == paramCharSequence.charAt(n + 1)) { /* 1551 */ return n; /* */ } /* */ } else { /* 1554 */ return n; /* */ } /* */ } /* */ } /* */ } /* 1559 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfAny(CharSequence paramCharSequence, String paramString) /* */ { /* 1586 */ if ((isEmpty(paramCharSequence)) || (isEmpty(paramString))) { /* 1587 */ return -1; /* */ } /* 1589 */ return indexOfAny(paramCharSequence, paramString.toCharArray()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsAny(CharSequence paramCharSequence, char... paramVarArgs) /* */ { /* 1619 */ if ((isEmpty(paramCharSequence)) || (ArrayUtils.isEmpty(paramVarArgs))) { /* 1620 */ return false; /* */ } /* 1622 */ int i = paramCharSequence.length(); /* 1623 */ int j = paramVarArgs.length; /* 1624 */ int k = i - 1; /* 1625 */ int m = j - 1; /* 1626 */ for (int n = 0; n < i; n++) { /* 1627 */ char c = paramCharSequence.charAt(n); /* 1628 */ for (int i1 = 0; i1 < j; i1++) { /* 1629 */ if (paramVarArgs[i1] == c) { /* 1630 */ if (Character.isHighSurrogate(c)) { /* 1631 */ if (i1 == m) /* */ { /* 1633 */ return true; /* */ } /* 1635 */ if ((n < k) && (paramVarArgs[(i1 + 1)] == paramCharSequence.charAt(n + 1))) { /* 1636 */ return true; /* */ } /* */ } /* */ else { /* 1640 */ return true; /* */ } /* */ } /* */ } /* */ } /* 1645 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsAny(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1677 */ if (paramCharSequence2 == null) { /* 1678 */ return false; /* */ } /* 1680 */ return containsAny(paramCharSequence1, CharSequenceUtils.toCharArray(paramCharSequence2)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfAnyBut(CharSequence paramCharSequence, char... paramVarArgs) /* */ { /* 1710 */ if ((isEmpty(paramCharSequence)) || (ArrayUtils.isEmpty(paramVarArgs))) { /* 1711 */ return -1; /* */ } /* 1713 */ int i = paramCharSequence.length(); /* 1714 */ int j = i - 1; /* 1715 */ int k = paramVarArgs.length; /* 1716 */ int m = k - 1; /* */ label127: /* 1718 */ for (int n = 0; n < i; n++) { /* 1719 */ char c = paramCharSequence.charAt(n); /* 1720 */ for (int i1 = 0; i1 < k; i1++) { /* 1721 */ if ((paramVarArgs[i1] == c) && ( /* 1722 */ (n >= j) || (i1 >= m) || (!Character.isHighSurrogate(c)) || /* 1723 */ (paramVarArgs[(i1 + 1)] == paramCharSequence.charAt(n + 1)))) { /* */ break label127; /* */ } /* */ } /* */ /* */ /* */ /* */ /* 1731 */ return n; /* */ } /* 1733 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfAnyBut(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1760 */ if ((isEmpty(paramCharSequence1)) || (isEmpty(paramCharSequence2))) { /* 1761 */ return -1; /* */ } /* 1763 */ int i = paramCharSequence1.length(); /* 1764 */ for (int j = 0; j < i; j++) { /* 1765 */ char c = paramCharSequence1.charAt(j); /* 1766 */ int k = CharSequenceUtils.indexOf(paramCharSequence2, c, 0) >= 0 ? 1 : 0; /* 1767 */ if ((j + 1 < i) && (Character.isHighSurrogate(c))) { /* 1768 */ int m = paramCharSequence1.charAt(j + 1); /* 1769 */ if ((k != 0) && (CharSequenceUtils.indexOf(paramCharSequence2, m, 0) < 0)) { /* 1770 */ return j; /* */ } /* */ } /* 1773 */ else if (k == 0) { /* 1774 */ return j; /* */ } /* */ } /* */ /* 1778 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsOnly(CharSequence paramCharSequence, char... paramVarArgs) /* */ { /* 1807 */ if ((paramVarArgs == null) || (paramCharSequence == null)) { /* 1808 */ return false; /* */ } /* 1810 */ if (paramCharSequence.length() == 0) { /* 1811 */ return true; /* */ } /* 1813 */ if (paramVarArgs.length == 0) { /* 1814 */ return false; /* */ } /* 1816 */ return indexOfAnyBut(paramCharSequence, paramVarArgs) == -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsOnly(CharSequence paramCharSequence, String paramString) /* */ { /* 1843 */ if ((paramCharSequence == null) || (paramString == null)) { /* 1844 */ return false; /* */ } /* 1846 */ return containsOnly(paramCharSequence, paramString.toCharArray()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsNone(CharSequence paramCharSequence, char... paramVarArgs) /* */ { /* 1875 */ if ((paramCharSequence == null) || (paramVarArgs == null)) { /* 1876 */ return true; /* */ } /* 1878 */ int i = paramCharSequence.length(); /* 1879 */ int j = i - 1; /* 1880 */ int k = paramVarArgs.length; /* 1881 */ int m = k - 1; /* 1882 */ for (int n = 0; n < i; n++) { /* 1883 */ char c = paramCharSequence.charAt(n); /* 1884 */ for (int i1 = 0; i1 < k; i1++) { /* 1885 */ if (paramVarArgs[i1] == c) { /* 1886 */ if (Character.isHighSurrogate(c)) { /* 1887 */ if (i1 == m) /* */ { /* 1889 */ return false; /* */ } /* 1891 */ if ((n < j) && (paramVarArgs[(i1 + 1)] == paramCharSequence.charAt(n + 1))) { /* 1892 */ return false; /* */ } /* */ } /* */ else { /* 1896 */ return false; /* */ } /* */ } /* */ } /* */ } /* 1901 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsNone(CharSequence paramCharSequence, String paramString) /* */ { /* 1928 */ if ((paramCharSequence == null) || (paramString == null)) { /* 1929 */ return true; /* */ } /* 1931 */ return containsNone(paramCharSequence, paramString.toCharArray()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfAny(CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 1964 */ if ((paramCharSequence == null) || (paramVarArgs == null)) { /* 1965 */ return -1; /* */ } /* 1967 */ int i = paramVarArgs.length; /* */ /* */ /* 1970 */ int j = Integer.MAX_VALUE; /* */ /* 1972 */ int k = 0; /* 1973 */ for (int m = 0; m < i; m++) { /* 1974 */ CharSequence localCharSequence = paramVarArgs[m]; /* 1975 */ if (localCharSequence != null) /* */ { /* */ /* 1978 */ k = CharSequenceUtils.indexOf(paramCharSequence, localCharSequence, 0); /* 1979 */ if (k != -1) /* */ { /* */ /* */ /* 1983 */ if (k < j) /* 1984 */ j = k; /* */ } /* */ } /* */ } /* 1988 */ return j == Integer.MAX_VALUE ? -1 : j; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOfAny(CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 2018 */ if ((paramCharSequence == null) || (paramVarArgs == null)) { /* 2019 */ return -1; /* */ } /* 2021 */ int i = paramVarArgs.length; /* 2022 */ int j = -1; /* 2023 */ int k = 0; /* 2024 */ for (int m = 0; m < i; m++) { /* 2025 */ CharSequence localCharSequence = paramVarArgs[m]; /* 2026 */ if (localCharSequence != null) /* */ { /* */ /* 2029 */ k = CharSequenceUtils.lastIndexOf(paramCharSequence, localCharSequence, paramCharSequence.length()); /* 2030 */ if (k > j) /* 2031 */ j = k; /* */ } /* */ } /* 2034 */ return j; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substring(String paramString, int paramInt) /* */ { /* 2064 */ if (paramString == null) { /* 2065 */ return null; /* */ } /* */ /* */ /* 2069 */ if (paramInt < 0) { /* 2070 */ paramInt = paramString.length() + paramInt; /* */ } /* */ /* 2073 */ if (paramInt < 0) { /* 2074 */ paramInt = 0; /* */ } /* 2076 */ if (paramInt > paramString.length()) { /* 2077 */ return ""; /* */ } /* */ /* 2080 */ return paramString.substring(paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substring(String paramString, int paramInt1, int paramInt2) /* */ { /* 2119 */ if (paramString == null) { /* 2120 */ return null; /* */ } /* */ /* */ /* 2124 */ if (paramInt2 < 0) { /* 2125 */ paramInt2 = paramString.length() + paramInt2; /* */ } /* 2127 */ if (paramInt1 < 0) { /* 2128 */ paramInt1 = paramString.length() + paramInt1; /* */ } /* */ /* */ /* 2132 */ if (paramInt2 > paramString.length()) { /* 2133 */ paramInt2 = paramString.length(); /* */ } /* */ /* */ /* 2137 */ if (paramInt1 > paramInt2) { /* 2138 */ return ""; /* */ } /* */ /* 2141 */ if (paramInt1 < 0) { /* 2142 */ paramInt1 = 0; /* */ } /* 2144 */ if (paramInt2 < 0) { /* 2145 */ paramInt2 = 0; /* */ } /* */ /* 2148 */ return paramString.substring(paramInt1, paramInt2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String left(String paramString, int paramInt) /* */ { /* 2174 */ if (paramString == null) { /* 2175 */ return null; /* */ } /* 2177 */ if (paramInt < 0) { /* 2178 */ return ""; /* */ } /* 2180 */ if (paramString.length() <= paramInt) { /* 2181 */ return paramString; /* */ } /* 2183 */ return paramString.substring(0, paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String right(String paramString, int paramInt) /* */ { /* 2207 */ if (paramString == null) { /* 2208 */ return null; /* */ } /* 2210 */ if (paramInt < 0) { /* 2211 */ return ""; /* */ } /* 2213 */ if (paramString.length() <= paramInt) { /* 2214 */ return paramString; /* */ } /* 2216 */ return paramString.substring(paramString.length() - paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String mid(String paramString, int paramInt1, int paramInt2) /* */ { /* 2245 */ if (paramString == null) { /* 2246 */ return null; /* */ } /* 2248 */ if ((paramInt2 < 0) || (paramInt1 > paramString.length())) { /* 2249 */ return ""; /* */ } /* 2251 */ if (paramInt1 < 0) { /* 2252 */ paramInt1 = 0; /* */ } /* 2254 */ if (paramString.length() <= paramInt1 + paramInt2) { /* 2255 */ return paramString.substring(paramInt1); /* */ } /* 2257 */ return paramString.substring(paramInt1, paramInt1 + paramInt2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringBefore(String paramString1, String paramString2) /* */ { /* 2290 */ if ((isEmpty(paramString1)) || (paramString2 == null)) { /* 2291 */ return paramString1; /* */ } /* 2293 */ if (paramString2.isEmpty()) { /* 2294 */ return ""; /* */ } /* 2296 */ int i = paramString1.indexOf(paramString2); /* 2297 */ if (i == -1) { /* 2298 */ return paramString1; /* */ } /* 2300 */ return paramString1.substring(0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringAfter(String paramString1, String paramString2) /* */ { /* 2332 */ if (isEmpty(paramString1)) { /* 2333 */ return paramString1; /* */ } /* 2335 */ if (paramString2 == null) { /* 2336 */ return ""; /* */ } /* 2338 */ int i = paramString1.indexOf(paramString2); /* 2339 */ if (i == -1) { /* 2340 */ return ""; /* */ } /* 2342 */ return paramString1.substring(i + paramString2.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringBeforeLast(String paramString1, String paramString2) /* */ { /* 2373 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 2374 */ return paramString1; /* */ } /* 2376 */ int i = paramString1.lastIndexOf(paramString2); /* 2377 */ if (i == -1) { /* 2378 */ return paramString1; /* */ } /* 2380 */ return paramString1.substring(0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringAfterLast(String paramString1, String paramString2) /* */ { /* 2413 */ if (isEmpty(paramString1)) { /* 2414 */ return paramString1; /* */ } /* 2416 */ if (isEmpty(paramString2)) { /* 2417 */ return ""; /* */ } /* 2419 */ int i = paramString1.lastIndexOf(paramString2); /* 2420 */ if ((i == -1) || (i == paramString1.length() - paramString2.length())) { /* 2421 */ return ""; /* */ } /* 2423 */ return paramString1.substring(i + paramString2.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringBetween(String paramString1, String paramString2) /* */ { /* 2450 */ return substringBetween(paramString1, paramString2, paramString2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringBetween(String paramString1, String paramString2, String paramString3) /* */ { /* 2481 */ if ((paramString1 == null) || (paramString2 == null) || (paramString3 == null)) { /* 2482 */ return null; /* */ } /* 2484 */ int i = paramString1.indexOf(paramString2); /* 2485 */ if (i != -1) { /* 2486 */ int j = paramString1.indexOf(paramString3, i + paramString2.length()); /* 2487 */ if (j != -1) { /* 2488 */ return paramString1.substring(i + paramString2.length(), j); /* */ } /* */ } /* 2491 */ return null; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] substringsBetween(String paramString1, String paramString2, String paramString3) /* */ { /* 2517 */ if ((paramString1 == null) || (isEmpty(paramString2)) || (isEmpty(paramString3))) { /* 2518 */ return null; /* */ } /* 2520 */ int i = paramString1.length(); /* 2521 */ if (i == 0) { /* 2522 */ return ArrayUtils.EMPTY_STRING_ARRAY; /* */ } /* 2524 */ int j = paramString3.length(); /* 2525 */ int k = paramString2.length(); /* 2526 */ ArrayList localArrayList = new ArrayList(); /* 2527 */ int m = 0; /* 2528 */ while (m < i - j) { /* 2529 */ int n = paramString1.indexOf(paramString2, m); /* 2530 */ if (n < 0) { /* */ break; /* */ } /* 2533 */ n += k; /* 2534 */ int i1 = paramString1.indexOf(paramString3, n); /* 2535 */ if (i1 < 0) { /* */ break; /* */ } /* 2538 */ localArrayList.add(paramString1.substring(n, i1)); /* 2539 */ m = i1 + j; /* */ } /* 2541 */ if (localArrayList.isEmpty()) { /* 2542 */ return null; /* */ } /* 2544 */ return (String[])localArrayList.toArray(new String[localArrayList.size()]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] split(String paramString) /* */ { /* 2575 */ return split(paramString, null, -1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] split(String paramString, char paramChar) /* */ { /* 2603 */ return splitWorker(paramString, paramChar, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] split(String paramString1, String paramString2) /* */ { /* 2632 */ return splitWorker(paramString1, paramString2, -1, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] split(String paramString1, String paramString2, int paramInt) /* */ { /* 2666 */ return splitWorker(paramString1, paramString2, paramInt, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByWholeSeparator(String paramString1, String paramString2) /* */ { /* 2693 */ return splitByWholeSeparatorWorker(paramString1, paramString2, -1, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByWholeSeparator(String paramString1, String paramString2, int paramInt) /* */ { /* 2724 */ return splitByWholeSeparatorWorker(paramString1, paramString2, paramInt, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByWholeSeparatorPreserveAllTokens(String paramString1, String paramString2) /* */ { /* 2753 */ return splitByWholeSeparatorWorker(paramString1, paramString2, -1, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByWholeSeparatorPreserveAllTokens(String paramString1, String paramString2, int paramInt) /* */ { /* 2786 */ return splitByWholeSeparatorWorker(paramString1, paramString2, paramInt, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String[] splitByWholeSeparatorWorker(String paramString1, String paramString2, int paramInt, boolean paramBoolean) /* */ { /* 2805 */ if (paramString1 == null) { /* 2806 */ return null; /* */ } /* */ /* 2809 */ int i = paramString1.length(); /* */ /* 2811 */ if (i == 0) { /* 2812 */ return ArrayUtils.EMPTY_STRING_ARRAY; /* */ } /* */ /* 2815 */ if ((paramString2 == null) || ("".equals(paramString2))) /* */ { /* 2817 */ return splitWorker(paramString1, null, paramInt, paramBoolean); /* */ } /* */ /* 2820 */ int j = paramString2.length(); /* */ /* 2822 */ ArrayList localArrayList = new ArrayList(); /* 2823 */ int k = 0; /* 2824 */ int m = 0; /* 2825 */ int n = 0; /* 2826 */ while (n < i) { /* 2827 */ n = paramString1.indexOf(paramString2, m); /* */ /* 2829 */ if (n > -1) { /* 2830 */ if (n > m) { /* 2831 */ k++; /* */ /* 2833 */ if (k == paramInt) { /* 2834 */ n = i; /* 2835 */ localArrayList.add(paramString1.substring(m)); /* */ } /* */ else /* */ { /* 2839 */ localArrayList.add(paramString1.substring(m, n)); /* */ /* */ /* */ /* */ /* 2844 */ m = n + j; /* */ } /* */ } /* */ else { /* 2848 */ if (paramBoolean) { /* 2849 */ k++; /* 2850 */ if (k == paramInt) { /* 2851 */ n = i; /* 2852 */ localArrayList.add(paramString1.substring(m)); /* */ } else { /* 2854 */ localArrayList.add(""); /* */ } /* */ } /* 2857 */ m = n + j; /* */ } /* */ } /* */ else { /* 2861 */ localArrayList.add(paramString1.substring(m)); /* 2862 */ n = i; /* */ } /* */ } /* */ /* 2866 */ return (String[])localArrayList.toArray(new String[localArrayList.size()]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitPreserveAllTokens(String paramString) /* */ { /* 2895 */ return splitWorker(paramString, null, -1, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitPreserveAllTokens(String paramString, char paramChar) /* */ { /* 2931 */ return splitWorker(paramString, paramChar, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String[] splitWorker(String paramString, char paramChar, boolean paramBoolean) /* */ { /* 2949 */ if (paramString == null) { /* 2950 */ return null; /* */ } /* 2952 */ int i = paramString.length(); /* 2953 */ if (i == 0) { /* 2954 */ return ArrayUtils.EMPTY_STRING_ARRAY; /* */ } /* 2956 */ ArrayList localArrayList = new ArrayList(); /* 2957 */ int j = 0;int k = 0; /* 2958 */ int m = 0; /* 2959 */ int n = 0; /* 2960 */ while (j < i) /* 2961 */ if (paramString.charAt(j) == paramChar) { /* 2962 */ if ((m != 0) || (paramBoolean)) { /* 2963 */ localArrayList.add(paramString.substring(k, j)); /* 2964 */ m = 0; /* 2965 */ n = 1; /* */ } /* 2967 */ j++;k = j; /* */ } /* */ else { /* 2970 */ n = 0; /* 2971 */ m = 1; /* 2972 */ j++; /* */ } /* 2974 */ if ((m != 0) || ((paramBoolean) && (n != 0))) { /* 2975 */ localArrayList.add(paramString.substring(k, j)); /* */ } /* 2977 */ return (String[])localArrayList.toArray(new String[localArrayList.size()]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitPreserveAllTokens(String paramString1, String paramString2) /* */ { /* 3014 */ return splitWorker(paramString1, paramString2, -1, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitPreserveAllTokens(String paramString1, String paramString2, int paramInt) /* */ { /* 3054 */ return splitWorker(paramString1, paramString2, paramInt, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String[] splitWorker(String paramString1, String paramString2, int paramInt, boolean paramBoolean) /* */ { /* 3076 */ if (paramString1 == null) { /* 3077 */ return null; /* */ } /* 3079 */ int i = paramString1.length(); /* 3080 */ if (i == 0) { /* 3081 */ return ArrayUtils.EMPTY_STRING_ARRAY; /* */ } /* 3083 */ ArrayList localArrayList = new ArrayList(); /* 3084 */ int j = 1; /* 3085 */ int k = 0;int m = 0; /* 3086 */ int n = 0; /* 3087 */ int i1 = 0; /* 3088 */ if (paramString2 == null) /* */ { /* 3090 */ while (k < i) /* 3091 */ if (Character.isWhitespace(paramString1.charAt(k))) { /* 3092 */ if ((n != 0) || (paramBoolean)) { /* 3093 */ i1 = 1; /* 3094 */ if (j++ == paramInt) { /* 3095 */ k = i; /* 3096 */ i1 = 0; /* */ } /* 3098 */ localArrayList.add(paramString1.substring(m, k)); /* 3099 */ n = 0; /* */ } /* 3101 */ k++;m = k; /* */ } /* */ else { /* 3104 */ i1 = 0; /* 3105 */ n = 1; /* 3106 */ k++; /* */ } } /* 3108 */ if (paramString2.length() == 1) /* */ { /* 3110 */ int i2 = paramString2.charAt(0); /* 3111 */ while (k < i) { /* 3112 */ if (paramString1.charAt(k) == i2) { /* 3113 */ if ((n != 0) || (paramBoolean)) { /* 3114 */ i1 = 1; /* 3115 */ if (j++ == paramInt) { /* 3116 */ k = i; /* 3117 */ i1 = 0; /* */ } /* 3119 */ localArrayList.add(paramString1.substring(m, k)); /* 3120 */ n = 0; /* */ } /* 3122 */ k++;m = k; /* */ } /* */ else { /* 3125 */ i1 = 0; /* 3126 */ n = 1; /* 3127 */ k++; /* */ } /* */ } /* */ } else { /* 3131 */ while (k < i) /* 3132 */ if (paramString2.indexOf(paramString1.charAt(k)) >= 0) { /* 3133 */ if ((n != 0) || (paramBoolean)) { /* 3134 */ i1 = 1; /* 3135 */ if (j++ == paramInt) { /* 3136 */ k = i; /* 3137 */ i1 = 0; /* */ } /* 3139 */ localArrayList.add(paramString1.substring(m, k)); /* 3140 */ n = 0; /* */ } /* 3142 */ k++;m = k; /* */ } /* */ else { /* 3145 */ i1 = 0; /* 3146 */ n = 1; /* 3147 */ k++; /* */ } /* */ } /* 3150 */ if ((n != 0) || ((paramBoolean) && (i1 != 0))) { /* 3151 */ localArrayList.add(paramString1.substring(m, k)); /* */ } /* 3153 */ return (String[])localArrayList.toArray(new String[localArrayList.size()]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByCharacterType(String paramString) /* */ { /* 3176 */ return splitByCharacterType(paramString, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByCharacterTypeCamelCase(String paramString) /* */ { /* 3204 */ return splitByCharacterType(paramString, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String[] splitByCharacterType(String paramString, boolean paramBoolean) /* */ { /* 3222 */ if (paramString == null) { /* 3223 */ return null; /* */ } /* 3225 */ if (paramString.isEmpty()) { /* 3226 */ return ArrayUtils.EMPTY_STRING_ARRAY; /* */ } /* 3228 */ char[] arrayOfChar = paramString.toCharArray(); /* 3229 */ ArrayList localArrayList = new ArrayList(); /* 3230 */ int i = 0; /* 3231 */ int j = Character.getType(arrayOfChar[i]); /* 3232 */ for (int k = i + 1; k < arrayOfChar.length; k++) { /* 3233 */ int m = Character.getType(arrayOfChar[k]); /* 3234 */ if (m != j) /* */ { /* */ /* 3237 */ if ((paramBoolean) && (m == 2) && (j == 1)) { /* 3238 */ int n = k - 1; /* 3239 */ if (n != i) { /* 3240 */ localArrayList.add(new String(arrayOfChar, i, n - i)); /* 3241 */ i = n; /* */ } /* */ } else { /* 3244 */ localArrayList.add(new String(arrayOfChar, i, k - i)); /* 3245 */ i = k; /* */ } /* 3247 */ j = m; /* */ } } /* 3249 */ localArrayList.add(new String(arrayOfChar, i, arrayOfChar.length - i)); /* 3250 */ return (String[])localArrayList.toArray(new String[localArrayList.size()]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static <T> String join(T... paramVarArgs) /* */ { /* 3278 */ return join(paramVarArgs, null); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Object[] paramArrayOfObject, char paramChar) /* */ { /* 3304 */ if (paramArrayOfObject == null) { /* 3305 */ return null; /* */ } /* 3307 */ return join(paramArrayOfObject, paramChar, 0, paramArrayOfObject.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(long[] paramArrayOfLong, char paramChar) /* */ { /* 3336 */ if (paramArrayOfLong == null) { /* 3337 */ return null; /* */ } /* 3339 */ return join(paramArrayOfLong, paramChar, 0, paramArrayOfLong.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(int[] paramArrayOfInt, char paramChar) /* */ { /* 3368 */ if (paramArrayOfInt == null) { /* 3369 */ return null; /* */ } /* 3371 */ return join(paramArrayOfInt, paramChar, 0, paramArrayOfInt.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(short[] paramArrayOfShort, char paramChar) /* */ { /* 3400 */ if (paramArrayOfShort == null) { /* 3401 */ return null; /* */ } /* 3403 */ return join(paramArrayOfShort, paramChar, 0, paramArrayOfShort.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(byte[] paramArrayOfByte, char paramChar) /* */ { /* 3432 */ if (paramArrayOfByte == null) { /* 3433 */ return null; /* */ } /* 3435 */ return join(paramArrayOfByte, paramChar, 0, paramArrayOfByte.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(char[] paramArrayOfChar, char paramChar) /* */ { /* 3464 */ if (paramArrayOfChar == null) { /* 3465 */ return null; /* */ } /* 3467 */ return join(paramArrayOfChar, paramChar, 0, paramArrayOfChar.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(float[] paramArrayOfFloat, char paramChar) /* */ { /* 3496 */ if (paramArrayOfFloat == null) { /* 3497 */ return null; /* */ } /* 3499 */ return join(paramArrayOfFloat, paramChar, 0, paramArrayOfFloat.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(double[] paramArrayOfDouble, char paramChar) /* */ { /* 3528 */ if (paramArrayOfDouble == null) { /* 3529 */ return null; /* */ } /* 3531 */ return join(paramArrayOfDouble, paramChar, 0, paramArrayOfDouble.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Object[] paramArrayOfObject, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3562 */ if (paramArrayOfObject == null) { /* 3563 */ return null; /* */ } /* 3565 */ int i = paramInt2 - paramInt1; /* 3566 */ if (i <= 0) { /* 3567 */ return ""; /* */ } /* 3569 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3570 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3571 */ if (j > paramInt1) { /* 3572 */ localStringBuilder.append(paramChar); /* */ } /* 3574 */ if (paramArrayOfObject[j] != null) { /* 3575 */ localStringBuilder.append(paramArrayOfObject[j]); /* */ } /* */ } /* 3578 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(long[] paramArrayOfLong, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3613 */ if (paramArrayOfLong == null) { /* 3614 */ return null; /* */ } /* 3616 */ int i = paramInt2 - paramInt1; /* 3617 */ if (i <= 0) { /* 3618 */ return ""; /* */ } /* 3620 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3621 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3622 */ if (j > paramInt1) { /* 3623 */ localStringBuilder.append(paramChar); /* */ } /* 3625 */ localStringBuilder.append(paramArrayOfLong[j]); /* */ } /* 3627 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(int[] paramArrayOfInt, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3662 */ if (paramArrayOfInt == null) { /* 3663 */ return null; /* */ } /* 3665 */ int i = paramInt2 - paramInt1; /* 3666 */ if (i <= 0) { /* 3667 */ return ""; /* */ } /* 3669 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3670 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3671 */ if (j > paramInt1) { /* 3672 */ localStringBuilder.append(paramChar); /* */ } /* 3674 */ localStringBuilder.append(paramArrayOfInt[j]); /* */ } /* 3676 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(byte[] paramArrayOfByte, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3711 */ if (paramArrayOfByte == null) { /* 3712 */ return null; /* */ } /* 3714 */ int i = paramInt2 - paramInt1; /* 3715 */ if (i <= 0) { /* 3716 */ return ""; /* */ } /* 3718 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3719 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3720 */ if (j > paramInt1) { /* 3721 */ localStringBuilder.append(paramChar); /* */ } /* 3723 */ localStringBuilder.append(paramArrayOfByte[j]); /* */ } /* 3725 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(short[] paramArrayOfShort, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3760 */ if (paramArrayOfShort == null) { /* 3761 */ return null; /* */ } /* 3763 */ int i = paramInt2 - paramInt1; /* 3764 */ if (i <= 0) { /* 3765 */ return ""; /* */ } /* 3767 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3768 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3769 */ if (j > paramInt1) { /* 3770 */ localStringBuilder.append(paramChar); /* */ } /* 3772 */ localStringBuilder.append(paramArrayOfShort[j]); /* */ } /* 3774 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(char[] paramArrayOfChar, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3809 */ if (paramArrayOfChar == null) { /* 3810 */ return null; /* */ } /* 3812 */ int i = paramInt2 - paramInt1; /* 3813 */ if (i <= 0) { /* 3814 */ return ""; /* */ } /* 3816 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3817 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3818 */ if (j > paramInt1) { /* 3819 */ localStringBuilder.append(paramChar); /* */ } /* 3821 */ localStringBuilder.append(paramArrayOfChar[j]); /* */ } /* 3823 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(double[] paramArrayOfDouble, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3858 */ if (paramArrayOfDouble == null) { /* 3859 */ return null; /* */ } /* 3861 */ int i = paramInt2 - paramInt1; /* 3862 */ if (i <= 0) { /* 3863 */ return ""; /* */ } /* 3865 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3866 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3867 */ if (j > paramInt1) { /* 3868 */ localStringBuilder.append(paramChar); /* */ } /* 3870 */ localStringBuilder.append(paramArrayOfDouble[j]); /* */ } /* 3872 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(float[] paramArrayOfFloat, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3907 */ if (paramArrayOfFloat == null) { /* 3908 */ return null; /* */ } /* 3910 */ int i = paramInt2 - paramInt1; /* 3911 */ if (i <= 0) { /* 3912 */ return ""; /* */ } /* 3914 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3915 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3916 */ if (j > paramInt1) { /* 3917 */ localStringBuilder.append(paramChar); /* */ } /* 3919 */ localStringBuilder.append(paramArrayOfFloat[j]); /* */ } /* 3921 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Object[] paramArrayOfObject, String paramString) /* */ { /* 3949 */ if (paramArrayOfObject == null) { /* 3950 */ return null; /* */ } /* 3952 */ return join(paramArrayOfObject, paramString, 0, paramArrayOfObject.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Object[] paramArrayOfObject, String paramString, int paramInt1, int paramInt2) /* */ { /* 3991 */ if (paramArrayOfObject == null) { /* 3992 */ return null; /* */ } /* 3994 */ if (paramString == null) { /* 3995 */ paramString = ""; /* */ } /* */ /* */ /* */ /* 4000 */ int i = paramInt2 - paramInt1; /* 4001 */ if (i <= 0) { /* 4002 */ return ""; /* */ } /* */ /* 4005 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* */ /* 4007 */ for (int j = paramInt1; j < paramInt2; j++) { /* 4008 */ if (j > paramInt1) { /* 4009 */ localStringBuilder.append(paramString); /* */ } /* 4011 */ if (paramArrayOfObject[j] != null) { /* 4012 */ localStringBuilder.append(paramArrayOfObject[j]); /* */ } /* */ } /* 4015 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Iterator<?> paramIterator, char paramChar) /* */ { /* 4035 */ if (paramIterator == null) { /* 4036 */ return null; /* */ } /* 4038 */ if (!paramIterator.hasNext()) { /* 4039 */ return ""; /* */ } /* 4041 */ Object localObject1 = paramIterator.next(); /* 4042 */ if (!paramIterator.hasNext()) /* */ { /* 4044 */ localObject2 = ObjectUtils.toString(localObject1); /* 4045 */ return (String)localObject2; /* */ } /* */ /* */ /* 4049 */ Object localObject2 = new StringBuilder(256); /* 4050 */ if (localObject1 != null) { /* 4051 */ ((StringBuilder)localObject2).append(localObject1); /* */ } /* */ /* 4054 */ while (paramIterator.hasNext()) { /* 4055 */ ((StringBuilder)localObject2).append(paramChar); /* 4056 */ Object localObject3 = paramIterator.next(); /* 4057 */ if (localObject3 != null) { /* 4058 */ ((StringBuilder)localObject2).append(localObject3); /* */ } /* */ } /* */ /* 4062 */ return ((StringBuilder)localObject2).toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Iterator<?> paramIterator, String paramString) /* */ { /* 4081 */ if (paramIterator == null) { /* 4082 */ return null; /* */ } /* 4084 */ if (!paramIterator.hasNext()) { /* 4085 */ return ""; /* */ } /* 4087 */ Object localObject1 = paramIterator.next(); /* 4088 */ if (!paramIterator.hasNext()) /* */ { /* 4090 */ localObject2 = ObjectUtils.toString(localObject1); /* 4091 */ return (String)localObject2; /* */ } /* */ /* */ /* 4095 */ Object localObject2 = new StringBuilder(256); /* 4096 */ if (localObject1 != null) { /* 4097 */ ((StringBuilder)localObject2).append(localObject1); /* */ } /* */ /* 4100 */ while (paramIterator.hasNext()) { /* 4101 */ if (paramString != null) { /* 4102 */ ((StringBuilder)localObject2).append(paramString); /* */ } /* 4104 */ Object localObject3 = paramIterator.next(); /* 4105 */ if (localObject3 != null) { /* 4106 */ ((StringBuilder)localObject2).append(localObject3); /* */ } /* */ } /* 4109 */ return ((StringBuilder)localObject2).toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Iterable<?> paramIterable, char paramChar) /* */ { /* 4127 */ if (paramIterable == null) { /* 4128 */ return null; /* */ } /* 4130 */ return join(paramIterable.iterator(), paramChar); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Iterable<?> paramIterable, String paramString) /* */ { /* 4148 */ if (paramIterable == null) { /* 4149 */ return null; /* */ } /* 4151 */ return join(paramIterable.iterator(), paramString); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String deleteWhitespace(String paramString) /* */ { /* 4171 */ if (isEmpty(paramString)) { /* 4172 */ return paramString; /* */ } /* 4174 */ int i = paramString.length(); /* 4175 */ char[] arrayOfChar = new char[i]; /* 4176 */ int j = 0; /* 4177 */ for (int k = 0; k < i; k++) { /* 4178 */ if (!Character.isWhitespace(paramString.charAt(k))) { /* 4179 */ arrayOfChar[(j++)] = paramString.charAt(k); /* */ } /* */ } /* 4182 */ if (j == i) { /* 4183 */ return paramString; /* */ } /* 4185 */ return new String(arrayOfChar, 0, j); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String removeStart(String paramString1, String paramString2) /* */ { /* 4215 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4216 */ return paramString1; /* */ } /* 4218 */ if (paramString1.startsWith(paramString2)) { /* 4219 */ return paramString1.substring(paramString2.length()); /* */ } /* 4221 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String removeStartIgnoreCase(String paramString1, String paramString2) /* */ { /* 4250 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4251 */ return paramString1; /* */ } /* 4253 */ if (startsWithIgnoreCase(paramString1, paramString2)) { /* 4254 */ return paramString1.substring(paramString2.length()); /* */ } /* 4256 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String removeEnd(String paramString1, String paramString2) /* */ { /* 4284 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4285 */ return paramString1; /* */ } /* 4287 */ if (paramString1.endsWith(paramString2)) { /* 4288 */ return paramString1.substring(0, paramString1.length() - paramString2.length()); /* */ } /* 4290 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String removeEndIgnoreCase(String paramString1, String paramString2) /* */ { /* 4320 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4321 */ return paramString1; /* */ } /* 4323 */ if (endsWithIgnoreCase(paramString1, paramString2)) { /* 4324 */ return paramString1.substring(0, paramString1.length() - paramString2.length()); /* */ } /* 4326 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String remove(String paramString1, String paramString2) /* */ { /* 4353 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4354 */ return paramString1; /* */ } /* 4356 */ return replace(paramString1, paramString2, "", -1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String remove(String paramString, char paramChar) /* */ { /* 4379 */ if ((isEmpty(paramString)) || (paramString.indexOf(paramChar) == -1)) { /* 4380 */ return paramString; /* */ } /* 4382 */ char[] arrayOfChar = paramString.toCharArray(); /* 4383 */ int i = 0; /* 4384 */ for (int j = 0; j < arrayOfChar.length; j++) { /* 4385 */ if (arrayOfChar[j] != paramChar) { /* 4386 */ arrayOfChar[(i++)] = arrayOfChar[j]; /* */ } /* */ } /* 4389 */ return new String(arrayOfChar, 0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replaceOnce(String paramString1, String paramString2, String paramString3) /* */ { /* 4418 */ return replace(paramString1, paramString2, paramString3, 1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replacePattern(String paramString1, String paramString2, String paramString3) /* */ { /* 4442 */ return Pattern.compile(paramString2, 32).matcher(paramString1).replaceAll(paramString3); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String removePattern(String paramString1, String paramString2) /* */ { /* 4458 */ return replacePattern(paramString1, paramString2, ""); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replace(String paramString1, String paramString2, String paramString3) /* */ { /* 4485 */ return replace(paramString1, paramString2, paramString3, -1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replace(String paramString1, String paramString2, String paramString3, int paramInt) /* */ { /* 4517 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2)) || (paramString3 == null) || (paramInt == 0)) { /* 4518 */ return paramString1; /* */ } /* 4520 */ int i = 0; /* 4521 */ int j = paramString1.indexOf(paramString2, i); /* 4522 */ if (j == -1) { /* 4523 */ return paramString1; /* */ } /* 4525 */ int k = paramString2.length(); /* 4526 */ int m = paramString3.length() - k; /* 4527 */ m = m < 0 ? 0 : m; /* 4528 */ m *= (paramInt > 64 ? 64 : paramInt < 0 ? 16 : paramInt); /* 4529 */ StringBuilder localStringBuilder = new StringBuilder(paramString1.length() + m); /* 4530 */ while (j != -1) { /* 4531 */ localStringBuilder.append(paramString1.substring(i, j)).append(paramString3); /* 4532 */ i = j + k; /* 4533 */ paramInt--; if (paramInt == 0) { /* */ break; /* */ } /* 4536 */ j = paramString1.indexOf(paramString2, i); /* */ } /* 4538 */ localStringBuilder.append(paramString1.substring(i)); /* 4539 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replaceEach(String paramString, String[] paramArrayOfString1, String[] paramArrayOfString2) /* */ { /* 4582 */ return replaceEach(paramString, paramArrayOfString1, paramArrayOfString2, false, 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replaceEachRepeatedly(String paramString, String[] paramArrayOfString1, String[] paramArrayOfString2) /* */ { /* 4632 */ int i = paramArrayOfString1 == null ? 0 : paramArrayOfString1.length; /* 4633 */ return replaceEach(paramString, paramArrayOfString1, paramArrayOfString2, true, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String replaceEach(String paramString, String[] paramArrayOfString1, String[] paramArrayOfString2, boolean paramBoolean, int paramInt) /* */ { /* 4690 */ if ((paramString == null) || (paramString.isEmpty()) || (paramArrayOfString1 == null) || (paramArrayOfString1.length == 0) || (paramArrayOfString2 == null) || (paramArrayOfString2.length == 0)) /* */ { /* 4692 */ return paramString; /* */ } /* */ /* */ /* 4696 */ if (paramInt < 0) { /* 4697 */ throw new IllegalStateException("Aborting to protect against StackOverflowError - output of one loop is the input of another"); /* */ } /* */ /* */ /* 4701 */ int i = paramArrayOfString1.length; /* 4702 */ int j = paramArrayOfString2.length; /* */ /* */ /* 4705 */ if (i != j) { /* 4706 */ throw new IllegalArgumentException("Search and Replace array lengths don't match: " + i + " vs " + j); /* */ } /* */ /* */ /* */ /* */ /* */ /* 4713 */ boolean[] arrayOfBoolean = new boolean[i]; /* */ /* */ /* 4716 */ int k = -1; /* 4717 */ int m = -1; /* 4718 */ int n = -1; /* */ /* */ /* */ /* 4722 */ for (int i1 = 0; i1 < i; i1++) { /* 4723 */ if ((arrayOfBoolean[i1] == 0) && (paramArrayOfString1[i1] != null) && (!paramArrayOfString1[i1].isEmpty()) && (paramArrayOfString2[i1] != null)) /* */ { /* */ /* */ /* 4727 */ n = paramString.indexOf(paramArrayOfString1[i1]); /* */ /* */ /* 4730 */ if (n == -1) { /* 4731 */ arrayOfBoolean[i1] = true; /* */ } /* 4733 */ else if ((k == -1) || (n < k)) { /* 4734 */ k = n; /* 4735 */ m = i1; /* */ } /* */ } /* */ } /* */ /* */ /* */ /* 4742 */ if (k == -1) { /* 4743 */ return paramString; /* */ } /* */ /* 4746 */ i1 = 0; /* */ /* */ /* 4749 */ int i2 = 0; /* */ /* */ /* 4752 */ for (int i3 = 0; i3 < paramArrayOfString1.length; i3++) { /* 4753 */ if ((paramArrayOfString1[i3] != null) && (paramArrayOfString2[i3] != null)) /* */ { /* */ /* 4756 */ i4 = paramArrayOfString2[i3].length() - paramArrayOfString1[i3].length(); /* 4757 */ if (i4 > 0) { /* 4758 */ i2 += 3 * i4; /* */ } /* */ } /* */ } /* 4762 */ i2 = Math.min(i2, paramString.length() / 5); /* */ /* 4764 */ StringBuilder localStringBuilder = new StringBuilder(paramString.length() + i2); /* */ /* 4766 */ while (k != -1) /* */ { /* 4768 */ for (i4 = i1; i4 < k; i4++) { /* 4769 */ localStringBuilder.append(paramString.charAt(i4)); /* */ } /* 4771 */ localStringBuilder.append(paramArrayOfString2[m]); /* */ /* 4773 */ i1 = k + paramArrayOfString1[m].length(); /* */ /* 4775 */ k = -1; /* 4776 */ m = -1; /* 4777 */ n = -1; /* */ /* */ /* 4780 */ for (i4 = 0; i4 < i; i4++) { /* 4781 */ if ((arrayOfBoolean[i4] == 0) && (paramArrayOfString1[i4] != null) && (!paramArrayOfString1[i4].isEmpty()) && (paramArrayOfString2[i4] != null)) /* */ { /* */ /* */ /* 4785 */ n = paramString.indexOf(paramArrayOfString1[i4], i1); /* */ /* */ /* 4788 */ if (n == -1) { /* 4789 */ arrayOfBoolean[i4] = true; /* */ } /* 4791 */ else if ((k == -1) || (n < k)) { /* 4792 */ k = n; /* 4793 */ m = i4; /* */ } /* */ } /* */ } /* */ } /* */ /* */ /* 4800 */ int i4 = paramString.length(); /* 4801 */ for (int i5 = i1; i5 < i4; i5++) { /* 4802 */ localStringBuilder.append(paramString.charAt(i5)); /* */ } /* 4804 */ String str = localStringBuilder.toString(); /* 4805 */ if (!paramBoolean) { /* 4806 */ return str; /* */ } /* */ /* 4809 */ return replaceEach(str, paramArrayOfString1, paramArrayOfString2, paramBoolean, paramInt - 1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replaceChars(String paramString, char paramChar1, char paramChar2) /* */ { /* 4835 */ if (paramString == null) { /* 4836 */ return null; /* */ } /* 4838 */ return paramString.replace(paramChar1, paramChar2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replaceChars(String paramString1, String paramString2, String paramString3) /* */ { /* 4878 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4879 */ return paramString1; /* */ } /* 4881 */ if (paramString3 == null) { /* 4882 */ paramString3 = ""; /* */ } /* 4884 */ int i = 0; /* 4885 */ int j = paramString3.length(); /* 4886 */ int k = paramString1.length(); /* 4887 */ StringBuilder localStringBuilder = new StringBuilder(k); /* 4888 */ for (int m = 0; m < k; m++) { /* 4889 */ char c = paramString1.charAt(m); /* 4890 */ int n = paramString2.indexOf(c); /* 4891 */ if (n >= 0) { /* 4892 */ i = 1; /* 4893 */ if (n < j) { /* 4894 */ localStringBuilder.append(paramString3.charAt(n)); /* */ } /* */ } else { /* 4897 */ localStringBuilder.append(c); /* */ } /* */ } /* 4900 */ if (i != 0) { /* 4901 */ return localStringBuilder.toString(); /* */ } /* 4903 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String overlay(String paramString1, String paramString2, int paramInt1, int paramInt2) /* */ { /* 4938 */ if (paramString1 == null) { /* 4939 */ return null; /* */ } /* 4941 */ if (paramString2 == null) { /* 4942 */ paramString2 = ""; /* */ } /* 4944 */ int i = paramString1.length(); /* 4945 */ if (paramInt1 < 0) { /* 4946 */ paramInt1 = 0; /* */ } /* 4948 */ if (paramInt1 > i) { /* 4949 */ paramInt1 = i; /* */ } /* 4951 */ if (paramInt2 < 0) { /* 4952 */ paramInt2 = 0; /* */ } /* 4954 */ if (paramInt2 > i) { /* 4955 */ paramInt2 = i; /* */ } /* 4957 */ if (paramInt1 > paramInt2) { /* 4958 */ int j = paramInt1; /* 4959 */ paramInt1 = paramInt2; /* 4960 */ paramInt2 = j; /* */ } /* 4962 */ return i + paramInt1 - paramInt2 + paramString2.length() + 1 + paramString1.substring(0, paramInt1) + paramString2 + paramString1.substring(paramInt2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String chomp(String paramString) /* */ { /* 4997 */ if (isEmpty(paramString)) { /* 4998 */ return paramString; /* */ } /* */ /* 5001 */ if (paramString.length() == 1) { /* 5002 */ i = paramString.charAt(0); /* 5003 */ if ((i == 13) || (i == 10)) { /* 5004 */ return ""; /* */ } /* 5006 */ return paramString; /* */ } /* */ /* 5009 */ int i = paramString.length() - 1; /* 5010 */ int j = paramString.charAt(i); /* */ /* 5012 */ if (j == 10) { /* 5013 */ if (paramString.charAt(i - 1) == '\r') { /* 5014 */ i--; /* */ } /* 5016 */ } else if (j != 13) { /* 5017 */ i++; /* */ } /* 5019 */ return paramString.substring(0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public static String chomp(String paramString1, String paramString2) /* */ { /* 5051 */ return removeEnd(paramString1, paramString2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String chop(String paramString) /* */ { /* 5080 */ if (paramString == null) { /* 5081 */ return null; /* */ } /* 5083 */ int i = paramString.length(); /* 5084 */ if (i < 2) { /* 5085 */ return ""; /* */ } /* 5087 */ int j = i - 1; /* 5088 */ String str = paramString.substring(0, j); /* 5089 */ int k = paramString.charAt(j); /* 5090 */ if ((k == 10) && (str.charAt(j - 1) == '\r')) { /* 5091 */ return str.substring(0, j - 1); /* */ } /* 5093 */ return str; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String repeat(String paramString, int paramInt) /* */ { /* 5122 */ if (paramString == null) { /* 5123 */ return null; /* */ } /* 5125 */ if (paramInt <= 0) { /* 5126 */ return ""; /* */ } /* 5128 */ int i = paramString.length(); /* 5129 */ if ((paramInt == 1) || (i == 0)) { /* 5130 */ return paramString; /* */ } /* 5132 */ if ((i == 1) && (paramInt <= 8192)) { /* 5133 */ return repeat(paramString.charAt(0), paramInt); /* */ } /* */ /* 5136 */ int j = i * paramInt; /* 5137 */ switch (i) { /* */ case 1: /* 5139 */ return repeat(paramString.charAt(0), paramInt); /* */ case 2: /* 5141 */ int k = paramString.charAt(0); /* 5142 */ int m = paramString.charAt(1); /* 5143 */ char[] arrayOfChar = new char[j]; /* 5144 */ for (int n = paramInt * 2 - 2; n >= 0; n--) { /* 5145 */ arrayOfChar[n] = k; /* 5146 */ arrayOfChar[(n + 1)] = m;n--; /* */ } /* */ /* 5148 */ return new String(arrayOfChar); /* */ } /* 5150 */ StringBuilder localStringBuilder = new StringBuilder(j); /* 5151 */ for (int i1 = 0; i1 < paramInt; i1++) { /* 5152 */ localStringBuilder.append(paramString); /* */ } /* 5154 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String repeat(String paramString1, String paramString2, int paramInt) /* */ { /* 5179 */ if ((paramString1 == null) || (paramString2 == null)) { /* 5180 */ return repeat(paramString1, paramInt); /* */ } /* */ /* 5183 */ String str = repeat(paramString1 + paramString2, paramInt); /* 5184 */ return removeEnd(str, paramString2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String repeat(char paramChar, int paramInt) /* */ { /* 5210 */ char[] arrayOfChar = new char[paramInt]; /* 5211 */ for (int i = paramInt - 1; i >= 0; i--) { /* 5212 */ arrayOfChar[i] = paramChar; /* */ } /* 5214 */ return new String(arrayOfChar); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String rightPad(String paramString, int paramInt) /* */ { /* 5237 */ return rightPad(paramString, paramInt, ' '); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String rightPad(String paramString, int paramInt, char paramChar) /* */ { /* 5262 */ if (paramString == null) { /* 5263 */ return null; /* */ } /* 5265 */ int i = paramInt - paramString.length(); /* 5266 */ if (i <= 0) { /* 5267 */ return paramString; /* */ } /* 5269 */ if (i > 8192) { /* 5270 */ return rightPad(paramString, paramInt, String.valueOf(paramChar)); /* */ } /* 5272 */ return paramString.concat(repeat(paramChar, i)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String rightPad(String paramString1, int paramInt, String paramString2) /* */ { /* 5299 */ if (paramString1 == null) { /* 5300 */ return null; /* */ } /* 5302 */ if (isEmpty(paramString2)) { /* 5303 */ paramString2 = " "; /* */ } /* 5305 */ int i = paramString2.length(); /* 5306 */ int j = paramString1.length(); /* 5307 */ int k = paramInt - j; /* 5308 */ if (k <= 0) { /* 5309 */ return paramString1; /* */ } /* 5311 */ if ((i == 1) && (k <= 8192)) { /* 5312 */ return rightPad(paramString1, paramInt, paramString2.charAt(0)); /* */ } /* */ /* 5315 */ if (k == i) /* 5316 */ return paramString1.concat(paramString2); /* 5317 */ if (k < i) { /* 5318 */ return paramString1.concat(paramString2.substring(0, k)); /* */ } /* 5320 */ char[] arrayOfChar1 = new char[k]; /* 5321 */ char[] arrayOfChar2 = paramString2.toCharArray(); /* 5322 */ for (int m = 0; m < k; m++) { /* 5323 */ arrayOfChar1[m] = arrayOfChar2[(m % i)]; /* */ } /* 5325 */ return paramString1.concat(new String(arrayOfChar1)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String leftPad(String paramString, int paramInt) /* */ { /* 5349 */ return leftPad(paramString, paramInt, ' '); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String leftPad(String paramString, int paramInt, char paramChar) /* */ { /* 5374 */ if (paramString == null) { /* 5375 */ return null; /* */ } /* 5377 */ int i = paramInt - paramString.length(); /* 5378 */ if (i <= 0) { /* 5379 */ return paramString; /* */ } /* 5381 */ if (i > 8192) { /* 5382 */ return leftPad(paramString, paramInt, String.valueOf(paramChar)); /* */ } /* 5384 */ return repeat(paramChar, i).concat(paramString); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String leftPad(String paramString1, int paramInt, String paramString2) /* */ { /* 5411 */ if (paramString1 == null) { /* 5412 */ return null; /* */ } /* 5414 */ if (isEmpty(paramString2)) { /* 5415 */ paramString2 = " "; /* */ } /* 5417 */ int i = paramString2.length(); /* 5418 */ int j = paramString1.length(); /* 5419 */ int k = paramInt - j; /* 5420 */ if (k <= 0) { /* 5421 */ return paramString1; /* */ } /* 5423 */ if ((i == 1) && (k <= 8192)) { /* 5424 */ return leftPad(paramString1, paramInt, paramString2.charAt(0)); /* */ } /* */ /* 5427 */ if (k == i) /* 5428 */ return paramString2.concat(paramString1); /* 5429 */ if (k < i) { /* 5430 */ return paramString2.substring(0, k).concat(paramString1); /* */ } /* 5432 */ char[] arrayOfChar1 = new char[k]; /* 5433 */ char[] arrayOfChar2 = paramString2.toCharArray(); /* 5434 */ for (int m = 0; m < k; m++) { /* 5435 */ arrayOfChar1[m] = arrayOfChar2[(m % i)]; /* */ } /* 5437 */ return new String(arrayOfChar1).concat(paramString1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int length(CharSequence paramCharSequence) /* */ { /* 5453 */ return paramCharSequence == null ? 0 : paramCharSequence.length(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String center(String paramString, int paramInt) /* */ { /* 5482 */ return center(paramString, paramInt, ' '); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String center(String paramString, int paramInt, char paramChar) /* */ { /* 5510 */ if ((paramString == null) || (paramInt <= 0)) { /* 5511 */ return paramString; /* */ } /* 5513 */ int i = paramString.length(); /* 5514 */ int j = paramInt - i; /* 5515 */ if (j <= 0) { /* 5516 */ return paramString; /* */ } /* 5518 */ paramString = leftPad(paramString, i + j / 2, paramChar); /* 5519 */ paramString = rightPad(paramString, paramInt, paramChar); /* 5520 */ return paramString; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String center(String paramString1, int paramInt, String paramString2) /* */ { /* 5550 */ if ((paramString1 == null) || (paramInt <= 0)) { /* 5551 */ return paramString1; /* */ } /* 5553 */ if (isEmpty(paramString2)) { /* 5554 */ paramString2 = " "; /* */ } /* 5556 */ int i = paramString1.length(); /* 5557 */ int j = paramInt - i; /* 5558 */ if (j <= 0) { /* 5559 */ return paramString1; /* */ } /* 5561 */ paramString1 = leftPad(paramString1, i + j / 2, paramString2); /* 5562 */ paramString1 = rightPad(paramString1, paramInt, paramString2); /* 5563 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String upperCase(String paramString) /* */ { /* 5588 */ if (paramString == null) { /* 5589 */ return null; /* */ } /* 5591 */ return paramString.toUpperCase(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String upperCase(String paramString, Locale paramLocale) /* */ { /* 5611 */ if (paramString == null) { /* 5612 */ return null; /* */ } /* 5614 */ return paramString.toUpperCase(paramLocale); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String lowerCase(String paramString) /* */ { /* 5637 */ if (paramString == null) { /* 5638 */ return null; /* */ } /* 5640 */ return paramString.toLowerCase(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String lowerCase(String paramString, Locale paramLocale) /* */ { /* 5660 */ if (paramString == null) { /* 5661 */ return null; /* */ } /* 5663 */ return paramString.toLowerCase(paramLocale); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String capitalize(String paramString) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 5688 */ if ((paramString == null) || ((i = paramString.length()) == 0)) { /* 5689 */ return paramString; /* */ } /* */ /* 5692 */ char c = paramString.charAt(0); /* 5693 */ if (Character.isTitleCase(c)) /* */ { /* 5695 */ return paramString; /* */ } /* */ /* 5698 */ return i + Character.toTitleCase(c) + paramString.substring(1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String uncapitalize(String paramString) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 5726 */ if ((paramString == null) || ((i = paramString.length()) == 0)) { /* 5727 */ return paramString; /* */ } /* */ /* 5730 */ char c = paramString.charAt(0); /* 5731 */ if (Character.isLowerCase(c)) /* */ { /* 5733 */ return paramString; /* */ } /* */ /* 5736 */ return i + Character.toLowerCase(c) + paramString.substring(1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String swapCase(String paramString) /* */ { /* 5770 */ if (isEmpty(paramString)) { /* 5771 */ return paramString; /* */ } /* */ /* 5774 */ char[] arrayOfChar = paramString.toCharArray(); /* */ /* 5776 */ for (int i = 0; i < arrayOfChar.length; i++) { /* 5777 */ char c = arrayOfChar[i]; /* 5778 */ if (Character.isUpperCase(c)) { /* 5779 */ arrayOfChar[i] = Character.toLowerCase(c); /* 5780 */ } else if (Character.isTitleCase(c)) { /* 5781 */ arrayOfChar[i] = Character.toLowerCase(c); /* 5782 */ } else if (Character.isLowerCase(c)) { /* 5783 */ arrayOfChar[i] = Character.toUpperCase(c); /* */ } /* */ } /* 5786 */ return new String(arrayOfChar); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int countMatches(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 5812 */ if ((isEmpty(paramCharSequence1)) || (isEmpty(paramCharSequence2))) { /* 5813 */ return 0; /* */ } /* 5815 */ int i = 0; /* 5816 */ int j = 0; /* 5817 */ while ((j = CharSequenceUtils.indexOf(paramCharSequence1, paramCharSequence2, j)) != -1) { /* 5818 */ i++; /* 5819 */ j += paramCharSequence2.length(); /* */ } /* 5821 */ return i; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAlpha(CharSequence paramCharSequence) /* */ { /* 5847 */ if (isEmpty(paramCharSequence)) { /* 5848 */ return false; /* */ } /* 5850 */ int i = paramCharSequence.length(); /* 5851 */ for (int j = 0; j < i; j++) { /* 5852 */ if (!Character.isLetter(paramCharSequence.charAt(j))) { /* 5853 */ return false; /* */ } /* */ } /* 5856 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAlphaSpace(CharSequence paramCharSequence) /* */ { /* 5882 */ if (paramCharSequence == null) { /* 5883 */ return false; /* */ } /* 5885 */ int i = paramCharSequence.length(); /* 5886 */ for (int j = 0; j < i; j++) { /* 5887 */ if ((!Character.isLetter(paramCharSequence.charAt(j))) && (paramCharSequence.charAt(j) != ' ')) { /* 5888 */ return false; /* */ } /* */ } /* 5891 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAlphanumeric(CharSequence paramCharSequence) /* */ { /* 5917 */ if (isEmpty(paramCharSequence)) { /* 5918 */ return false; /* */ } /* 5920 */ int i = paramCharSequence.length(); /* 5921 */ for (int j = 0; j < i; j++) { /* 5922 */ if (!Character.isLetterOrDigit(paramCharSequence.charAt(j))) { /* 5923 */ return false; /* */ } /* */ } /* 5926 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAlphanumericSpace(CharSequence paramCharSequence) /* */ { /* 5952 */ if (paramCharSequence == null) { /* 5953 */ return false; /* */ } /* 5955 */ int i = paramCharSequence.length(); /* 5956 */ for (int j = 0; j < i; j++) { /* 5957 */ if ((!Character.isLetterOrDigit(paramCharSequence.charAt(j))) && (paramCharSequence.charAt(j) != ' ')) { /* 5958 */ return false; /* */ } /* */ } /* 5961 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAsciiPrintable(CharSequence paramCharSequence) /* */ { /* 5991 */ if (paramCharSequence == null) { /* 5992 */ return false; /* */ } /* 5994 */ int i = paramCharSequence.length(); /* 5995 */ for (int j = 0; j < i; j++) { /* 5996 */ if (!CharUtils.isAsciiPrintable(paramCharSequence.charAt(j))) { /* 5997 */ return false; /* */ } /* */ } /* 6000 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNumeric(CharSequence paramCharSequence) /* */ { /* 6034 */ if (isEmpty(paramCharSequence)) { /* 6035 */ return false; /* */ } /* 6037 */ int i = paramCharSequence.length(); /* 6038 */ for (int j = 0; j < i; j++) { /* 6039 */ if (!Character.isDigit(paramCharSequence.charAt(j))) { /* 6040 */ return false; /* */ } /* */ } /* 6043 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNumericSpace(CharSequence paramCharSequence) /* */ { /* 6071 */ if (paramCharSequence == null) { /* 6072 */ return false; /* */ } /* 6074 */ int i = paramCharSequence.length(); /* 6075 */ for (int j = 0; j < i; j++) { /* 6076 */ if ((!Character.isDigit(paramCharSequence.charAt(j))) && (paramCharSequence.charAt(j) != ' ')) { /* 6077 */ return false; /* */ } /* */ } /* 6080 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isWhitespace(CharSequence paramCharSequence) /* */ { /* 6104 */ if (paramCharSequence == null) { /* 6105 */ return false; /* */ } /* 6107 */ int i = paramCharSequence.length(); /* 6108 */ for (int j = 0; j < i; j++) { /* 6109 */ if (!Character.isWhitespace(paramCharSequence.charAt(j))) { /* 6110 */ return false; /* */ } /* */ } /* 6113 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAllLowerCase(CharSequence paramCharSequence) /* */ { /* 6136 */ if ((paramCharSequence == null) || (isEmpty(paramCharSequence))) { /* 6137 */ return false; /* */ } /* 6139 */ int i = paramCharSequence.length(); /* 6140 */ for (int j = 0; j < i; j++) { /* 6141 */ if (!Character.isLowerCase(paramCharSequence.charAt(j))) { /* 6142 */ return false; /* */ } /* */ } /* 6145 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAllUpperCase(CharSequence paramCharSequence) /* */ { /* 6168 */ if ((paramCharSequence == null) || (isEmpty(paramCharSequence))) { /* 6169 */ return false; /* */ } /* 6171 */ int i = paramCharSequence.length(); /* 6172 */ for (int j = 0; j < i; j++) { /* 6173 */ if (!Character.isUpperCase(paramCharSequence.charAt(j))) { /* 6174 */ return false; /* */ } /* */ } /* 6177 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String defaultString(String paramString) /* */ { /* 6199 */ return paramString == null ? "" : paramString; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String defaultString(String paramString1, String paramString2) /* */ { /* 6220 */ return paramString1 == null ? paramString2 : paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static <T extends CharSequence> T defaultIfBlank(T paramT1, T paramT2) /* */ { /* 6242 */ return isBlank(paramT1) ? paramT2 : paramT1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static <T extends CharSequence> T defaultIfEmpty(T paramT1, T paramT2) /* */ { /* 6264 */ return isEmpty(paramT1) ? paramT2 : paramT1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String reverse(String paramString) /* */ { /* 6284 */ if (paramString == null) { /* 6285 */ return null; /* */ } /* 6287 */ return new StringBuilder(paramString).reverse().toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String reverseDelimited(String paramString, char paramChar) /* */ { /* 6310 */ if (paramString == null) { /* 6311 */ return null; /* */ } /* */ /* */ /* 6315 */ String[] arrayOfString = split(paramString, paramChar); /* 6316 */ ArrayUtils.reverse(arrayOfString); /* 6317 */ return join(arrayOfString, paramChar); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String abbreviate(String paramString, int paramInt) /* */ { /* 6354 */ return abbreviate(paramString, 0, paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String abbreviate(String paramString, int paramInt1, int paramInt2) /* */ { /* 6393 */ if (paramString == null) { /* 6394 */ return null; /* */ } /* 6396 */ if (paramInt2 < 4) { /* 6397 */ throw new IllegalArgumentException("Minimum abbreviation width is 4"); /* */ } /* 6399 */ if (paramString.length() <= paramInt2) { /* 6400 */ return paramString; /* */ } /* 6402 */ if (paramInt1 > paramString.length()) { /* 6403 */ paramInt1 = paramString.length(); /* */ } /* 6405 */ if (paramString.length() - paramInt1 < paramInt2 - 3) { /* 6406 */ paramInt1 = paramString.length() - (paramInt2 - 3); /* */ } /* 6408 */ String str = "..."; /* 6409 */ if (paramInt1 <= 4) { /* 6410 */ return paramString.substring(0, paramInt2 - 3) + "..."; /* */ } /* 6412 */ if (paramInt2 < 7) { /* 6413 */ throw new IllegalArgumentException("Minimum abbreviation width with offset is 7"); /* */ } /* 6415 */ if (paramInt1 + paramInt2 - 3 < paramString.length()) { /* 6416 */ return "..." + abbreviate(paramString.substring(paramInt1), paramInt2 - 3); /* */ } /* 6418 */ return "..." + paramString.substring(paramString.length() - (paramInt2 - 3)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String abbreviateMiddle(String paramString1, String paramString2, int paramInt) /* */ { /* 6451 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 6452 */ return paramString1; /* */ } /* */ /* 6455 */ if ((paramInt >= paramString1.length()) || (paramInt < paramString2.length() + 2)) { /* 6456 */ return paramString1; /* */ } /* */ /* 6459 */ int i = paramInt - paramString2.length(); /* 6460 */ int j = i / 2 + i % 2; /* 6461 */ int k = paramString1.length() - i / 2; /* */ /* 6463 */ StringBuilder localStringBuilder = new StringBuilder(paramInt); /* 6464 */ localStringBuilder.append(paramString1.substring(0, j)); /* 6465 */ localStringBuilder.append(paramString2); /* 6466 */ localStringBuilder.append(paramString1.substring(k)); /* */ /* 6468 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String difference(String paramString1, String paramString2) /* */ { /* 6502 */ if (paramString1 == null) { /* 6503 */ return paramString2; /* */ } /* 6505 */ if (paramString2 == null) { /* 6506 */ return paramString1; /* */ } /* 6508 */ int i = indexOfDifference(paramString1, paramString2); /* 6509 */ if (i == -1) { /* 6510 */ return ""; /* */ } /* 6512 */ return paramString2.substring(i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfDifference(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 6541 */ if (paramCharSequence1 == paramCharSequence2) { /* 6542 */ return -1; /* */ } /* 6544 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 6545 */ return 0; /* */ } /* */ /* 6548 */ for (int i = 0; (i < paramCharSequence1.length()) && (i < paramCharSequence2.length()); i++) { /* 6549 */ if (paramCharSequence1.charAt(i) != paramCharSequence2.charAt(i)) { /* */ break; /* */ } /* */ } /* 6553 */ if ((i < paramCharSequence2.length()) || (i < paramCharSequence1.length())) { /* 6554 */ return i; /* */ } /* 6556 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfDifference(CharSequence... paramVarArgs) /* */ { /* 6592 */ if ((paramVarArgs == null) || (paramVarArgs.length <= 1)) { /* 6593 */ return -1; /* */ } /* 6595 */ int i = 0; /* 6596 */ int j = 1; /* 6597 */ int k = paramVarArgs.length; /* 6598 */ int m = Integer.MAX_VALUE; /* 6599 */ int n = 0; /* */ /* */ /* */ /* */ /* 6604 */ for (int i1 = 0; i1 < k; i1++) { /* 6605 */ if (paramVarArgs[i1] == null) { /* 6606 */ i = 1; /* 6607 */ m = 0; /* */ } else { /* 6609 */ j = 0; /* 6610 */ m = Math.min(paramVarArgs[i1].length(), m); /* 6611 */ n = Math.max(paramVarArgs[i1].length(), n); /* */ } /* */ } /* */ /* */ /* 6616 */ if ((j != 0) || ((n == 0) && (i == 0))) { /* 6617 */ return -1; /* */ } /* */ /* */ /* 6621 */ if (m == 0) { /* 6622 */ return 0; /* */ } /* */ /* */ /* 6626 */ i1 = -1; /* 6627 */ for (int i2 = 0; i2 < m; i2++) { /* 6628 */ int i3 = paramVarArgs[0].charAt(i2); /* 6629 */ for (int i4 = 1; i4 < k; i4++) { /* 6630 */ if (paramVarArgs[i4].charAt(i2) != i3) { /* 6631 */ i1 = i2; /* 6632 */ break; /* */ } /* */ } /* 6635 */ if (i1 != -1) { /* */ break; /* */ } /* */ } /* */ /* 6640 */ if ((i1 == -1) && (m != n)) /* */ { /* */ /* */ /* 6644 */ return m; /* */ } /* 6646 */ return i1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String getCommonPrefix(String... paramVarArgs) /* */ { /* 6683 */ if ((paramVarArgs == null) || (paramVarArgs.length == 0)) { /* 6684 */ return ""; /* */ } /* 6686 */ int i = indexOfDifference(paramVarArgs); /* 6687 */ if (i == -1) /* */ { /* 6689 */ if (paramVarArgs[0] == null) { /* 6690 */ return ""; /* */ } /* 6692 */ return paramVarArgs[0]; } /* 6693 */ if (i == 0) /* */ { /* 6695 */ return ""; /* */ } /* */ /* 6698 */ return paramVarArgs[0].substring(0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int getLevenshteinDistance(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 6741 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 6742 */ throw new IllegalArgumentException("Strings must not be null"); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 6762 */ int i = paramCharSequence1.length(); /* 6763 */ int j = paramCharSequence2.length(); /* */ /* 6765 */ if (i == 0) /* 6766 */ return j; /* 6767 */ if (j == 0) { /* 6768 */ return i; /* */ } /* */ /* 6771 */ if (i > j) /* */ { /* 6773 */ localObject1 = paramCharSequence1; /* 6774 */ paramCharSequence1 = paramCharSequence2; /* 6775 */ paramCharSequence2 = (CharSequence)localObject1; /* 6776 */ i = j; /* 6777 */ j = paramCharSequence2.length(); /* */ } /* */ /* 6780 */ Object localObject1 = new int[i + 1]; /* 6781 */ Object localObject2 = new int[i + 1]; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 6792 */ for (int k = 0; k <= i; k++) { /* 6793 */ localObject1[k] = k; /* */ } /* */ /* 6796 */ for (int m = 1; m <= j; m++) { /* 6797 */ int n = paramCharSequence2.charAt(m - 1); /* 6798 */ localObject2[0] = m; /* */ /* 6800 */ for (k = 1; k <= i; k++) { /* 6801 */ int i1 = paramCharSequence1.charAt(k - 1) == n ? 0 : 1; /* */ /* 6803 */ localObject2[k] = Math.min(Math.min(localObject2[(k - 1)] + 1, localObject1[k] + 1), localObject1[(k - 1)] + i1); /* */ } /* */ /* */ /* 6807 */ Object localObject3 = localObject1; /* 6808 */ localObject1 = localObject2; /* 6809 */ localObject2 = localObject3; /* */ } /* */ /* */ /* */ /* 6814 */ return localObject1[i]; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int getLevenshteinDistance(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 6850 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 6851 */ throw new IllegalArgumentException("Strings must not be null"); /* */ } /* 6853 */ if (paramInt < 0) { /* 6854 */ throw new IllegalArgumentException("Threshold must not be negative"); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 6901 */ int i = paramCharSequence1.length(); /* 6902 */ int j = paramCharSequence2.length(); /* */ /* */ /* 6905 */ if (i == 0) /* 6906 */ return j <= paramInt ? j : -1; /* 6907 */ if (j == 0) { /* 6908 */ return i <= paramInt ? i : -1; /* */ } /* */ /* 6911 */ if (i > j) /* */ { /* 6913 */ localObject1 = paramCharSequence1; /* 6914 */ paramCharSequence1 = paramCharSequence2; /* 6915 */ paramCharSequence2 = (CharSequence)localObject1; /* 6916 */ i = j; /* 6917 */ j = paramCharSequence2.length(); /* */ } /* */ /* 6920 */ Object localObject1 = new int[i + 1]; /* 6921 */ Object localObject2 = new int[i + 1]; /* */ /* */ /* */ /* 6925 */ int k = Math.min(i, paramInt) + 1; /* 6926 */ for (int m = 0; m < k; m++) { /* 6927 */ localObject1[m] = m; /* */ } /* */ /* */ /* 6931 */ Arrays.fill((int[])localObject1, k, localObject1.length, Integer.MAX_VALUE); /* 6932 */ Arrays.fill((int[])localObject2, Integer.MAX_VALUE); /* */ /* */ /* 6935 */ for (m = 1; m <= j; m++) { /* 6936 */ int n = paramCharSequence2.charAt(m - 1); /* 6937 */ localObject2[0] = m; /* */ /* */ /* 6940 */ int i1 = Math.max(1, m - paramInt); /* 6941 */ int i2 = m > Integer.MAX_VALUE - paramInt ? i : Math.min(i, m + paramInt); /* */ /* */ /* 6944 */ if (i1 > i2) { /* 6945 */ return -1; /* */ } /* */ /* */ /* 6949 */ if (i1 > 1) { /* 6950 */ localObject2[(i1 - 1)] = Integer.MAX_VALUE; /* */ } /* */ /* */ /* 6954 */ for (int i3 = i1; i3 <= i2; i3++) { /* 6955 */ if (paramCharSequence1.charAt(i3 - 1) == n) /* */ { /* 6957 */ localObject2[i3] = localObject1[(i3 - 1)]; /* */ } /* */ else { /* 6960 */ localObject2[i3] = (1 + Math.min(Math.min(localObject2[(i3 - 1)], localObject1[i3]), localObject1[(i3 - 1)])); /* */ } /* */ } /* */ /* */ /* 6965 */ Object localObject3 = localObject1; /* 6966 */ localObject1 = localObject2; /* 6967 */ localObject2 = localObject3; /* */ } /* */ /* */ /* */ /* 6972 */ if (localObject1[i] <= paramInt) { /* 6973 */ return localObject1[i]; /* */ } /* 6975 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static double getJaroWinklerDistance(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7011 */ double d1 = 0.1D; /* */ /* 7013 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 7014 */ throw new IllegalArgumentException("Strings must not be null"); /* */ } /* */ /* 7017 */ double d2 = score(paramCharSequence1, paramCharSequence2); /* 7018 */ int i = commonPrefixLength(paramCharSequence1, paramCharSequence2); /* 7019 */ double d3 = Math.round((d2 + 0.1D * i * (1.0D - d2)) * 100.0D) / 100.0D; /* */ /* 7021 */ return d3; /* */ } /* */ /* */ /* */ /* */ /* */ private static double score(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* */ String str1; /* */ /* */ /* */ String str2; /* */ /* */ /* 7035 */ if (paramCharSequence1.length() > paramCharSequence2.length()) { /* 7036 */ str1 = paramCharSequence1.toString().toLowerCase(); /* 7037 */ str2 = paramCharSequence2.toString().toLowerCase(); /* */ } else { /* 7039 */ str1 = paramCharSequence2.toString().toLowerCase(); /* 7040 */ str2 = paramCharSequence1.toString().toLowerCase(); /* */ } /* */ /* */ /* 7044 */ int i = str2.length() / 2 + 1; /* */ /* */ /* */ /* 7048 */ String str3 = getSetOfMatchingCharacterWithin(str2, str1, i); /* 7049 */ String str4 = getSetOfMatchingCharacterWithin(str1, str2, i); /* */ /* */ /* */ /* 7053 */ if ((str3.length() == 0) || (str4.length() == 0)) { /* 7054 */ return 0.0D; /* */ } /* */ /* */ /* */ /* 7059 */ if (str3.length() != str4.length()) { /* 7060 */ return 0.0D; /* */ } /* */ /* */ /* */ /* 7065 */ int j = transpositions(str3, str4); /* */ /* */ /* 7068 */ double d = (str3.length() / str2.length() + str4.length() / str1.length() + (str3.length() - j) / str3.length()) / 3.0D; /* */ /* */ /* */ /* 7072 */ return d; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String getSetOfMatchingCharacterWithin(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 7087 */ StringBuilder localStringBuilder1 = new StringBuilder(); /* 7088 */ StringBuilder localStringBuilder2 = new StringBuilder(paramCharSequence2); /* */ /* 7090 */ for (int i = 0; i < paramCharSequence1.length(); i++) { /* 7091 */ char c = paramCharSequence1.charAt(i); /* 7092 */ int j = 0; /* */ /* */ /* 7095 */ for (int k = Math.max(0, i - paramInt); (j == 0) && (k < Math.min(i + paramInt, paramCharSequence2.length())); k++) { /* 7096 */ if (localStringBuilder2.charAt(k) == c) { /* 7097 */ j = 1; /* 7098 */ localStringBuilder1.append(c); /* 7099 */ localStringBuilder2.setCharAt(k, '*'); /* */ } /* */ } /* */ } /* 7103 */ return localStringBuilder1.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static int transpositions(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7113 */ int i = 0; /* 7114 */ for (int j = 0; j < paramCharSequence1.length(); j++) { /* 7115 */ if (paramCharSequence1.charAt(j) != paramCharSequence2.charAt(j)) { /* 7116 */ i++; /* */ } /* */ } /* 7119 */ return i / 2; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static int commonPrefixLength(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7130 */ int i = getCommonPrefix(new String[] { paramCharSequence1.toString(), paramCharSequence2.toString() }).length(); /* */ /* */ /* 7133 */ return i > 4 ? 4 : i; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean startsWith(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7162 */ return startsWith(paramCharSequence1, paramCharSequence2, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean startsWithIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7188 */ return startsWith(paramCharSequence1, paramCharSequence2, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static boolean startsWith(CharSequence paramCharSequence1, CharSequence paramCharSequence2, boolean paramBoolean) /* */ { /* 7203 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 7204 */ return (paramCharSequence1 == null) && (paramCharSequence2 == null); /* */ } /* 7206 */ if (paramCharSequence2.length() > paramCharSequence1.length()) { /* 7207 */ return false; /* */ } /* 7209 */ return CharSequenceUtils.regionMatches(paramCharSequence1, paramBoolean, 0, paramCharSequence2, 0, paramCharSequence2.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean startsWithAny(CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7232 */ if ((isEmpty(paramCharSequence)) || (ArrayUtils.isEmpty(paramVarArgs))) { /* 7233 */ return false; /* */ } /* 7235 */ for (CharSequence localCharSequence : paramVarArgs) { /* 7236 */ if (startsWith(paramCharSequence, localCharSequence)) { /* 7237 */ return true; /* */ } /* */ } /* 7240 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean endsWith(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7270 */ return endsWith(paramCharSequence1, paramCharSequence2, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean endsWithIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7297 */ return endsWith(paramCharSequence1, paramCharSequence2, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static boolean endsWith(CharSequence paramCharSequence1, CharSequence paramCharSequence2, boolean paramBoolean) /* */ { /* 7312 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 7313 */ return (paramCharSequence1 == null) && (paramCharSequence2 == null); /* */ } /* 7315 */ if (paramCharSequence2.length() > paramCharSequence1.length()) { /* 7316 */ return false; /* */ } /* 7318 */ int i = paramCharSequence1.length() - paramCharSequence2.length(); /* 7319 */ return CharSequenceUtils.regionMatches(paramCharSequence1, paramBoolean, i, paramCharSequence2, 0, paramCharSequence2.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String normalizeSpace(String paramString) /* */ { /* 7364 */ if (paramString == null) { /* 7365 */ return null; /* */ } /* 7367 */ return WHITESPACE_PATTERN.matcher(trim(paramString)).replaceAll(" "); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean endsWithAny(CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7389 */ if ((isEmpty(paramCharSequence)) || (ArrayUtils.isEmpty(paramVarArgs))) { /* 7390 */ return false; /* */ } /* 7392 */ for (CharSequence localCharSequence : paramVarArgs) { /* 7393 */ if (endsWith(paramCharSequence, localCharSequence)) { /* 7394 */ return true; /* */ } /* */ } /* 7397 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String appendIfMissing(String paramString, CharSequence paramCharSequence, boolean paramBoolean, CharSequence... paramVarArgs) /* */ { /* 7412 */ if ((paramString == null) || (isEmpty(paramCharSequence)) || (endsWith(paramString, paramCharSequence, paramBoolean))) { /* 7413 */ return paramString; /* */ } /* 7415 */ if ((paramVarArgs != null) && (paramVarArgs.length > 0)) { /* 7416 */ for (CharSequence localCharSequence : paramVarArgs) { /* 7417 */ if (endsWith(paramString, localCharSequence, paramBoolean)) { /* 7418 */ return paramString; /* */ } /* */ } /* */ } /* 7422 */ return paramString + paramCharSequence.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String appendIfMissing(String paramString, CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7460 */ return appendIfMissing(paramString, paramCharSequence, false, paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String appendIfMissingIgnoreCase(String paramString, CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7498 */ return appendIfMissing(paramString, paramCharSequence, true, paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String prependIfMissing(String paramString, CharSequence paramCharSequence, boolean paramBoolean, CharSequence... paramVarArgs) /* */ { /* 7513 */ if ((paramString == null) || (isEmpty(paramCharSequence)) || (startsWith(paramString, paramCharSequence, paramBoolean))) { /* 7514 */ return paramString; /* */ } /* 7516 */ if ((paramVarArgs != null) && (paramVarArgs.length > 0)) { /* 7517 */ for (CharSequence localCharSequence : paramVarArgs) { /* 7518 */ if (startsWith(paramString, localCharSequence, paramBoolean)) { /* 7519 */ return paramString; /* */ } /* */ } /* */ } /* 7523 */ return paramCharSequence.toString() + paramString; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String prependIfMissing(String paramString, CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7561 */ return prependIfMissing(paramString, paramCharSequence, false, paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String prependIfMissingIgnoreCase(String paramString, CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7599 */ return prependIfMissing(paramString, paramCharSequence, true, paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public static String toString(byte[] paramArrayOfByte, String paramString) /* */ throws UnsupportedEncodingException /* */ { /* 7619 */ return paramString != null ? new String(paramArrayOfByte, paramString) : new String(paramArrayOfByte, Charset.defaultCharset()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String toEncodedString(byte[] paramArrayOfByte, Charset paramCharset) /* */ { /* 7636 */ return new String(paramArrayOfByte, paramCharset != null ? paramCharset : Charset.defaultCharset()); /* */ } /* */ } /* Location: C:\Users\USUARIO\Desktop\spigot-1.8.8-R0.1-SNAPSHOT-latest.jar!\org\apache\commons\lang3\StringUtils.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
170,000
java
StringUtils.java
Java
[]
null
[]
/* */ package org.apache.commons.lang3; /* */ /* */ import java.io.UnsupportedEncodingException; /* */ import java.nio.charset.Charset; /* */ import java.text.Normalizer; /* */ import java.text.Normalizer.Form; /* */ import java.util.ArrayList; /* */ import java.util.Arrays; /* */ import java.util.Iterator; /* */ import java.util.List; /* */ import java.util.Locale; /* */ import java.util.regex.Matcher; /* */ import java.util.regex.Pattern; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class StringUtils /* */ { /* */ public static final String SPACE = " "; /* */ public static final String EMPTY = ""; /* */ public static final String LF = "\n"; /* */ public static final String CR = "\r"; /* */ public static final int INDEX_NOT_FOUND = -1; /* */ private static final int PAD_LIMIT = 8192; /* 183 */ private static final Pattern WHITESPACE_PATTERN = Pattern.compile("(?: |\\u00A0|\\s|[\\s&&[^ ]])\\s*"); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isEmpty(CharSequence paramCharSequence) /* */ { /* 219 */ return (paramCharSequence == null) || (paramCharSequence.length() == 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNotEmpty(CharSequence paramCharSequence) /* */ { /* 238 */ return !isEmpty(paramCharSequence); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAnyEmpty(CharSequence... paramVarArgs) /* */ { /* 259 */ if (ArrayUtils.isEmpty(paramVarArgs)) { /* 260 */ return true; /* */ } /* 262 */ for (CharSequence localCharSequence : paramVarArgs) { /* 263 */ if (isEmpty(localCharSequence)) { /* 264 */ return true; /* */ } /* */ } /* 267 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNoneEmpty(CharSequence... paramVarArgs) /* */ { /* 288 */ return !isAnyEmpty(paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isBlank(CharSequence paramCharSequence) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 308 */ if ((paramCharSequence == null) || ((i = paramCharSequence.length()) == 0)) { /* 309 */ return true; /* */ } /* 311 */ for (int j = 0; j < i; j++) { /* 312 */ if (!Character.isWhitespace(paramCharSequence.charAt(j))) { /* 313 */ return false; /* */ } /* */ } /* 316 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNotBlank(CharSequence paramCharSequence) /* */ { /* 337 */ return !isBlank(paramCharSequence); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAnyBlank(CharSequence... paramVarArgs) /* */ { /* 359 */ if (ArrayUtils.isEmpty(paramVarArgs)) { /* 360 */ return true; /* */ } /* 362 */ for (CharSequence localCharSequence : paramVarArgs) { /* 363 */ if (isBlank(localCharSequence)) { /* 364 */ return true; /* */ } /* */ } /* 367 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNoneBlank(CharSequence... paramVarArgs) /* */ { /* 389 */ return !isAnyBlank(paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String trim(String paramString) /* */ { /* 418 */ return paramString == null ? null : paramString.trim(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String trimToNull(String paramString) /* */ { /* 444 */ String str = trim(paramString); /* 445 */ return isEmpty(str) ? null : str; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String trimToEmpty(String paramString) /* */ { /* 470 */ return paramString == null ? "" : paramString.trim(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String strip(String paramString) /* */ { /* 498 */ return strip(paramString, null); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String stripToNull(String paramString) /* */ { /* 525 */ if (paramString == null) { /* 526 */ return null; /* */ } /* 528 */ paramString = strip(paramString, null); /* 529 */ return paramString.isEmpty() ? null : paramString; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String stripToEmpty(String paramString) /* */ { /* 555 */ return paramString == null ? "" : strip(paramString, null); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String strip(String paramString1, String paramString2) /* */ { /* 585 */ if (isEmpty(paramString1)) { /* 586 */ return paramString1; /* */ } /* 588 */ paramString1 = stripStart(paramString1, paramString2); /* 589 */ return stripEnd(paramString1, paramString2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String stripStart(String paramString1, String paramString2) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 618 */ if ((paramString1 == null) || ((i = paramString1.length()) == 0)) { /* 619 */ return paramString1; /* */ } /* 621 */ int j = 0; /* 622 */ if (paramString2 == null) { /* 623 */ while ((j != i) && (Character.isWhitespace(paramString1.charAt(j)))) /* 624 */ j++; /* */ } /* 626 */ if (paramString2.isEmpty()) { /* 627 */ return paramString1; /* */ } /* 629 */ while ((j != i) && (paramString2.indexOf(paramString1.charAt(j)) != -1)) { /* 630 */ j++; /* */ } /* */ /* 633 */ return paramString1.substring(j); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String stripEnd(String paramString1, String paramString2) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 663 */ if ((paramString1 == null) || ((i = paramString1.length()) == 0)) { /* 664 */ return paramString1; /* */ } /* */ /* 667 */ if (paramString2 == null) { /* 668 */ while ((i != 0) && (Character.isWhitespace(paramString1.charAt(i - 1)))) /* 669 */ i--; /* */ } /* 671 */ if (paramString2.isEmpty()) { /* 672 */ return paramString1; /* */ } /* 674 */ while ((i != 0) && (paramString2.indexOf(paramString1.charAt(i - 1)) != -1)) { /* 675 */ i--; /* */ } /* */ /* 678 */ return paramString1.substring(0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] stripAll(String... paramVarArgs) /* */ { /* 703 */ return stripAll(paramVarArgs, null); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] stripAll(String[] paramArrayOfString, String paramString) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 733 */ if ((paramArrayOfString == null) || ((i = paramArrayOfString.length) == 0)) { /* 734 */ return paramArrayOfString; /* */ } /* 736 */ String[] arrayOfString = new String[i]; /* 737 */ for (int j = 0; j < i; j++) { /* 738 */ arrayOfString[j] = strip(paramArrayOfString[j], paramString); /* */ } /* 740 */ return arrayOfString; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String stripAccents(String paramString) /* */ { /* 762 */ if (paramString == null) { /* 763 */ return null; /* */ } /* 765 */ Pattern localPattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+"); /* 766 */ String str = Normalizer.normalize(paramString, Normalizer.Form.NFD); /* */ /* 768 */ return localPattern.matcher(str).replaceAll(""); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean equals(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 795 */ if (paramCharSequence1 == paramCharSequence2) { /* 796 */ return true; /* */ } /* 798 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 799 */ return false; /* */ } /* 801 */ if (((paramCharSequence1 instanceof String)) && ((paramCharSequence2 instanceof String))) { /* 802 */ return paramCharSequence1.equals(paramCharSequence2); /* */ } /* 804 */ return CharSequenceUtils.regionMatches(paramCharSequence1, false, 0, paramCharSequence2, 0, Math.max(paramCharSequence1.length(), paramCharSequence2.length())); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean equalsIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 829 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) /* 830 */ return paramCharSequence1 == paramCharSequence2; /* 831 */ if (paramCharSequence1 == paramCharSequence2) /* 832 */ return true; /* 833 */ if (paramCharSequence1.length() != paramCharSequence2.length()) { /* 834 */ return false; /* */ } /* 836 */ return CharSequenceUtils.regionMatches(paramCharSequence1, true, 0, paramCharSequence2, 0, paramCharSequence1.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOf(CharSequence paramCharSequence, int paramInt) /* */ { /* 863 */ if (isEmpty(paramCharSequence)) { /* 864 */ return -1; /* */ } /* 866 */ return CharSequenceUtils.indexOf(paramCharSequence, paramInt, 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOf(CharSequence paramCharSequence, int paramInt1, int paramInt2) /* */ { /* 896 */ if (isEmpty(paramCharSequence)) { /* 897 */ return -1; /* */ } /* 899 */ return CharSequenceUtils.indexOf(paramCharSequence, paramInt1, paramInt2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 927 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 928 */ return -1; /* */ } /* 930 */ return CharSequenceUtils.indexOf(paramCharSequence1, paramCharSequence2, 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 967 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 968 */ return -1; /* */ } /* 970 */ return CharSequenceUtils.indexOf(paramCharSequence1, paramCharSequence2, paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int ordinalIndexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 1008 */ return ordinalIndexOf(paramCharSequence1, paramCharSequence2, paramInt, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static int ordinalIndexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt, boolean paramBoolean) /* */ { /* 1026 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null) || (paramInt <= 0)) { /* 1027 */ return -1; /* */ } /* 1029 */ if (paramCharSequence2.length() == 0) { /* 1030 */ return paramBoolean ? paramCharSequence1.length() : 0; /* */ } /* 1032 */ int i = 0; /* 1033 */ int j = paramBoolean ? paramCharSequence1.length() : -1; /* */ do { /* 1035 */ if (paramBoolean) { /* 1036 */ j = CharSequenceUtils.lastIndexOf(paramCharSequence1, paramCharSequence2, j - 1); /* */ } else { /* 1038 */ j = CharSequenceUtils.indexOf(paramCharSequence1, paramCharSequence2, j + 1); /* */ } /* 1040 */ if (j < 0) { /* 1041 */ return j; /* */ } /* 1043 */ i++; /* 1044 */ } while (i < paramInt); /* 1045 */ return j; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1074 */ return indexOfIgnoreCase(paramCharSequence1, paramCharSequence2, 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 1110 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1111 */ return -1; /* */ } /* 1113 */ if (paramInt < 0) { /* 1114 */ paramInt = 0; /* */ } /* 1116 */ int i = paramCharSequence1.length() - paramCharSequence2.length() + 1; /* 1117 */ if (paramInt > i) { /* 1118 */ return -1; /* */ } /* 1120 */ if (paramCharSequence2.length() == 0) { /* 1121 */ return paramInt; /* */ } /* 1123 */ for (int j = paramInt; j < i; j++) { /* 1124 */ if (CharSequenceUtils.regionMatches(paramCharSequence1, true, j, paramCharSequence2, 0, paramCharSequence2.length())) { /* 1125 */ return j; /* */ } /* */ } /* 1128 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOf(CharSequence paramCharSequence, int paramInt) /* */ { /* 1154 */ if (isEmpty(paramCharSequence)) { /* 1155 */ return -1; /* */ } /* 1157 */ return CharSequenceUtils.lastIndexOf(paramCharSequence, paramInt, paramCharSequence.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOf(CharSequence paramCharSequence, int paramInt1, int paramInt2) /* */ { /* 1192 */ if (isEmpty(paramCharSequence)) { /* 1193 */ return -1; /* */ } /* 1195 */ return CharSequenceUtils.lastIndexOf(paramCharSequence, paramInt1, paramInt2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1222 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1223 */ return -1; /* */ } /* 1225 */ return CharSequenceUtils.lastIndexOf(paramCharSequence1, paramCharSequence2, paramCharSequence1.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastOrdinalIndexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 1263 */ return ordinalIndexOf(paramCharSequence1, paramCharSequence2, paramInt, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOf(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 1303 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1304 */ return -1; /* */ } /* 1306 */ return CharSequenceUtils.lastIndexOf(paramCharSequence1, paramCharSequence2, paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOfIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1333 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1334 */ return -1; /* */ } /* 1336 */ return lastIndexOfIgnoreCase(paramCharSequence1, paramCharSequence2, paramCharSequence1.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOfIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 1372 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1373 */ return -1; /* */ } /* 1375 */ if (paramInt > paramCharSequence1.length() - paramCharSequence2.length()) { /* 1376 */ paramInt = paramCharSequence1.length() - paramCharSequence2.length(); /* */ } /* 1378 */ if (paramInt < 0) { /* 1379 */ return -1; /* */ } /* 1381 */ if (paramCharSequence2.length() == 0) { /* 1382 */ return paramInt; /* */ } /* */ /* 1385 */ for (int i = paramInt; i >= 0; i--) { /* 1386 */ if (CharSequenceUtils.regionMatches(paramCharSequence1, true, i, paramCharSequence2, 0, paramCharSequence2.length())) { /* 1387 */ return i; /* */ } /* */ } /* 1390 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean contains(CharSequence paramCharSequence, int paramInt) /* */ { /* 1416 */ if (isEmpty(paramCharSequence)) { /* 1417 */ return false; /* */ } /* 1419 */ return CharSequenceUtils.indexOf(paramCharSequence, paramInt, 0) >= 0; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean contains(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1445 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1446 */ return false; /* */ } /* 1448 */ return CharSequenceUtils.indexOf(paramCharSequence1, paramCharSequence2, 0) >= 0; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1476 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 1477 */ return false; /* */ } /* 1479 */ int i = paramCharSequence2.length(); /* 1480 */ int j = paramCharSequence1.length() - i; /* 1481 */ for (int k = 0; k <= j; k++) { /* 1482 */ if (CharSequenceUtils.regionMatches(paramCharSequence1, true, k, paramCharSequence2, 0, i)) { /* 1483 */ return true; /* */ } /* */ } /* 1486 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsWhitespace(CharSequence paramCharSequence) /* */ { /* 1499 */ if (isEmpty(paramCharSequence)) { /* 1500 */ return false; /* */ } /* 1502 */ int i = paramCharSequence.length(); /* 1503 */ for (int j = 0; j < i; j++) { /* 1504 */ if (Character.isWhitespace(paramCharSequence.charAt(j))) { /* 1505 */ return true; /* */ } /* */ } /* 1508 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfAny(CharSequence paramCharSequence, char... paramVarArgs) /* */ { /* 1537 */ if ((isEmpty(paramCharSequence)) || (ArrayUtils.isEmpty(paramVarArgs))) { /* 1538 */ return -1; /* */ } /* 1540 */ int i = paramCharSequence.length(); /* 1541 */ int j = i - 1; /* 1542 */ int k = paramVarArgs.length; /* 1543 */ int m = k - 1; /* 1544 */ for (int n = 0; n < i; n++) { /* 1545 */ char c = paramCharSequence.charAt(n); /* 1546 */ for (int i1 = 0; i1 < k; i1++) { /* 1547 */ if (paramVarArgs[i1] == c) { /* 1548 */ if ((n < j) && (i1 < m) && (Character.isHighSurrogate(c))) /* */ { /* 1550 */ if (paramVarArgs[(i1 + 1)] == paramCharSequence.charAt(n + 1)) { /* 1551 */ return n; /* */ } /* */ } else { /* 1554 */ return n; /* */ } /* */ } /* */ } /* */ } /* 1559 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfAny(CharSequence paramCharSequence, String paramString) /* */ { /* 1586 */ if ((isEmpty(paramCharSequence)) || (isEmpty(paramString))) { /* 1587 */ return -1; /* */ } /* 1589 */ return indexOfAny(paramCharSequence, paramString.toCharArray()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsAny(CharSequence paramCharSequence, char... paramVarArgs) /* */ { /* 1619 */ if ((isEmpty(paramCharSequence)) || (ArrayUtils.isEmpty(paramVarArgs))) { /* 1620 */ return false; /* */ } /* 1622 */ int i = paramCharSequence.length(); /* 1623 */ int j = paramVarArgs.length; /* 1624 */ int k = i - 1; /* 1625 */ int m = j - 1; /* 1626 */ for (int n = 0; n < i; n++) { /* 1627 */ char c = paramCharSequence.charAt(n); /* 1628 */ for (int i1 = 0; i1 < j; i1++) { /* 1629 */ if (paramVarArgs[i1] == c) { /* 1630 */ if (Character.isHighSurrogate(c)) { /* 1631 */ if (i1 == m) /* */ { /* 1633 */ return true; /* */ } /* 1635 */ if ((n < k) && (paramVarArgs[(i1 + 1)] == paramCharSequence.charAt(n + 1))) { /* 1636 */ return true; /* */ } /* */ } /* */ else { /* 1640 */ return true; /* */ } /* */ } /* */ } /* */ } /* 1645 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsAny(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1677 */ if (paramCharSequence2 == null) { /* 1678 */ return false; /* */ } /* 1680 */ return containsAny(paramCharSequence1, CharSequenceUtils.toCharArray(paramCharSequence2)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfAnyBut(CharSequence paramCharSequence, char... paramVarArgs) /* */ { /* 1710 */ if ((isEmpty(paramCharSequence)) || (ArrayUtils.isEmpty(paramVarArgs))) { /* 1711 */ return -1; /* */ } /* 1713 */ int i = paramCharSequence.length(); /* 1714 */ int j = i - 1; /* 1715 */ int k = paramVarArgs.length; /* 1716 */ int m = k - 1; /* */ label127: /* 1718 */ for (int n = 0; n < i; n++) { /* 1719 */ char c = paramCharSequence.charAt(n); /* 1720 */ for (int i1 = 0; i1 < k; i1++) { /* 1721 */ if ((paramVarArgs[i1] == c) && ( /* 1722 */ (n >= j) || (i1 >= m) || (!Character.isHighSurrogate(c)) || /* 1723 */ (paramVarArgs[(i1 + 1)] == paramCharSequence.charAt(n + 1)))) { /* */ break label127; /* */ } /* */ } /* */ /* */ /* */ /* */ /* 1731 */ return n; /* */ } /* 1733 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfAnyBut(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 1760 */ if ((isEmpty(paramCharSequence1)) || (isEmpty(paramCharSequence2))) { /* 1761 */ return -1; /* */ } /* 1763 */ int i = paramCharSequence1.length(); /* 1764 */ for (int j = 0; j < i; j++) { /* 1765 */ char c = paramCharSequence1.charAt(j); /* 1766 */ int k = CharSequenceUtils.indexOf(paramCharSequence2, c, 0) >= 0 ? 1 : 0; /* 1767 */ if ((j + 1 < i) && (Character.isHighSurrogate(c))) { /* 1768 */ int m = paramCharSequence1.charAt(j + 1); /* 1769 */ if ((k != 0) && (CharSequenceUtils.indexOf(paramCharSequence2, m, 0) < 0)) { /* 1770 */ return j; /* */ } /* */ } /* 1773 */ else if (k == 0) { /* 1774 */ return j; /* */ } /* */ } /* */ /* 1778 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsOnly(CharSequence paramCharSequence, char... paramVarArgs) /* */ { /* 1807 */ if ((paramVarArgs == null) || (paramCharSequence == null)) { /* 1808 */ return false; /* */ } /* 1810 */ if (paramCharSequence.length() == 0) { /* 1811 */ return true; /* */ } /* 1813 */ if (paramVarArgs.length == 0) { /* 1814 */ return false; /* */ } /* 1816 */ return indexOfAnyBut(paramCharSequence, paramVarArgs) == -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsOnly(CharSequence paramCharSequence, String paramString) /* */ { /* 1843 */ if ((paramCharSequence == null) || (paramString == null)) { /* 1844 */ return false; /* */ } /* 1846 */ return containsOnly(paramCharSequence, paramString.toCharArray()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsNone(CharSequence paramCharSequence, char... paramVarArgs) /* */ { /* 1875 */ if ((paramCharSequence == null) || (paramVarArgs == null)) { /* 1876 */ return true; /* */ } /* 1878 */ int i = paramCharSequence.length(); /* 1879 */ int j = i - 1; /* 1880 */ int k = paramVarArgs.length; /* 1881 */ int m = k - 1; /* 1882 */ for (int n = 0; n < i; n++) { /* 1883 */ char c = paramCharSequence.charAt(n); /* 1884 */ for (int i1 = 0; i1 < k; i1++) { /* 1885 */ if (paramVarArgs[i1] == c) { /* 1886 */ if (Character.isHighSurrogate(c)) { /* 1887 */ if (i1 == m) /* */ { /* 1889 */ return false; /* */ } /* 1891 */ if ((n < j) && (paramVarArgs[(i1 + 1)] == paramCharSequence.charAt(n + 1))) { /* 1892 */ return false; /* */ } /* */ } /* */ else { /* 1896 */ return false; /* */ } /* */ } /* */ } /* */ } /* 1901 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean containsNone(CharSequence paramCharSequence, String paramString) /* */ { /* 1928 */ if ((paramCharSequence == null) || (paramString == null)) { /* 1929 */ return true; /* */ } /* 1931 */ return containsNone(paramCharSequence, paramString.toCharArray()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfAny(CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 1964 */ if ((paramCharSequence == null) || (paramVarArgs == null)) { /* 1965 */ return -1; /* */ } /* 1967 */ int i = paramVarArgs.length; /* */ /* */ /* 1970 */ int j = Integer.MAX_VALUE; /* */ /* 1972 */ int k = 0; /* 1973 */ for (int m = 0; m < i; m++) { /* 1974 */ CharSequence localCharSequence = paramVarArgs[m]; /* 1975 */ if (localCharSequence != null) /* */ { /* */ /* 1978 */ k = CharSequenceUtils.indexOf(paramCharSequence, localCharSequence, 0); /* 1979 */ if (k != -1) /* */ { /* */ /* */ /* 1983 */ if (k < j) /* 1984 */ j = k; /* */ } /* */ } /* */ } /* 1988 */ return j == Integer.MAX_VALUE ? -1 : j; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int lastIndexOfAny(CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 2018 */ if ((paramCharSequence == null) || (paramVarArgs == null)) { /* 2019 */ return -1; /* */ } /* 2021 */ int i = paramVarArgs.length; /* 2022 */ int j = -1; /* 2023 */ int k = 0; /* 2024 */ for (int m = 0; m < i; m++) { /* 2025 */ CharSequence localCharSequence = paramVarArgs[m]; /* 2026 */ if (localCharSequence != null) /* */ { /* */ /* 2029 */ k = CharSequenceUtils.lastIndexOf(paramCharSequence, localCharSequence, paramCharSequence.length()); /* 2030 */ if (k > j) /* 2031 */ j = k; /* */ } /* */ } /* 2034 */ return j; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substring(String paramString, int paramInt) /* */ { /* 2064 */ if (paramString == null) { /* 2065 */ return null; /* */ } /* */ /* */ /* 2069 */ if (paramInt < 0) { /* 2070 */ paramInt = paramString.length() + paramInt; /* */ } /* */ /* 2073 */ if (paramInt < 0) { /* 2074 */ paramInt = 0; /* */ } /* 2076 */ if (paramInt > paramString.length()) { /* 2077 */ return ""; /* */ } /* */ /* 2080 */ return paramString.substring(paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substring(String paramString, int paramInt1, int paramInt2) /* */ { /* 2119 */ if (paramString == null) { /* 2120 */ return null; /* */ } /* */ /* */ /* 2124 */ if (paramInt2 < 0) { /* 2125 */ paramInt2 = paramString.length() + paramInt2; /* */ } /* 2127 */ if (paramInt1 < 0) { /* 2128 */ paramInt1 = paramString.length() + paramInt1; /* */ } /* */ /* */ /* 2132 */ if (paramInt2 > paramString.length()) { /* 2133 */ paramInt2 = paramString.length(); /* */ } /* */ /* */ /* 2137 */ if (paramInt1 > paramInt2) { /* 2138 */ return ""; /* */ } /* */ /* 2141 */ if (paramInt1 < 0) { /* 2142 */ paramInt1 = 0; /* */ } /* 2144 */ if (paramInt2 < 0) { /* 2145 */ paramInt2 = 0; /* */ } /* */ /* 2148 */ return paramString.substring(paramInt1, paramInt2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String left(String paramString, int paramInt) /* */ { /* 2174 */ if (paramString == null) { /* 2175 */ return null; /* */ } /* 2177 */ if (paramInt < 0) { /* 2178 */ return ""; /* */ } /* 2180 */ if (paramString.length() <= paramInt) { /* 2181 */ return paramString; /* */ } /* 2183 */ return paramString.substring(0, paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String right(String paramString, int paramInt) /* */ { /* 2207 */ if (paramString == null) { /* 2208 */ return null; /* */ } /* 2210 */ if (paramInt < 0) { /* 2211 */ return ""; /* */ } /* 2213 */ if (paramString.length() <= paramInt) { /* 2214 */ return paramString; /* */ } /* 2216 */ return paramString.substring(paramString.length() - paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String mid(String paramString, int paramInt1, int paramInt2) /* */ { /* 2245 */ if (paramString == null) { /* 2246 */ return null; /* */ } /* 2248 */ if ((paramInt2 < 0) || (paramInt1 > paramString.length())) { /* 2249 */ return ""; /* */ } /* 2251 */ if (paramInt1 < 0) { /* 2252 */ paramInt1 = 0; /* */ } /* 2254 */ if (paramString.length() <= paramInt1 + paramInt2) { /* 2255 */ return paramString.substring(paramInt1); /* */ } /* 2257 */ return paramString.substring(paramInt1, paramInt1 + paramInt2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringBefore(String paramString1, String paramString2) /* */ { /* 2290 */ if ((isEmpty(paramString1)) || (paramString2 == null)) { /* 2291 */ return paramString1; /* */ } /* 2293 */ if (paramString2.isEmpty()) { /* 2294 */ return ""; /* */ } /* 2296 */ int i = paramString1.indexOf(paramString2); /* 2297 */ if (i == -1) { /* 2298 */ return paramString1; /* */ } /* 2300 */ return paramString1.substring(0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringAfter(String paramString1, String paramString2) /* */ { /* 2332 */ if (isEmpty(paramString1)) { /* 2333 */ return paramString1; /* */ } /* 2335 */ if (paramString2 == null) { /* 2336 */ return ""; /* */ } /* 2338 */ int i = paramString1.indexOf(paramString2); /* 2339 */ if (i == -1) { /* 2340 */ return ""; /* */ } /* 2342 */ return paramString1.substring(i + paramString2.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringBeforeLast(String paramString1, String paramString2) /* */ { /* 2373 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 2374 */ return paramString1; /* */ } /* 2376 */ int i = paramString1.lastIndexOf(paramString2); /* 2377 */ if (i == -1) { /* 2378 */ return paramString1; /* */ } /* 2380 */ return paramString1.substring(0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringAfterLast(String paramString1, String paramString2) /* */ { /* 2413 */ if (isEmpty(paramString1)) { /* 2414 */ return paramString1; /* */ } /* 2416 */ if (isEmpty(paramString2)) { /* 2417 */ return ""; /* */ } /* 2419 */ int i = paramString1.lastIndexOf(paramString2); /* 2420 */ if ((i == -1) || (i == paramString1.length() - paramString2.length())) { /* 2421 */ return ""; /* */ } /* 2423 */ return paramString1.substring(i + paramString2.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringBetween(String paramString1, String paramString2) /* */ { /* 2450 */ return substringBetween(paramString1, paramString2, paramString2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String substringBetween(String paramString1, String paramString2, String paramString3) /* */ { /* 2481 */ if ((paramString1 == null) || (paramString2 == null) || (paramString3 == null)) { /* 2482 */ return null; /* */ } /* 2484 */ int i = paramString1.indexOf(paramString2); /* 2485 */ if (i != -1) { /* 2486 */ int j = paramString1.indexOf(paramString3, i + paramString2.length()); /* 2487 */ if (j != -1) { /* 2488 */ return paramString1.substring(i + paramString2.length(), j); /* */ } /* */ } /* 2491 */ return null; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] substringsBetween(String paramString1, String paramString2, String paramString3) /* */ { /* 2517 */ if ((paramString1 == null) || (isEmpty(paramString2)) || (isEmpty(paramString3))) { /* 2518 */ return null; /* */ } /* 2520 */ int i = paramString1.length(); /* 2521 */ if (i == 0) { /* 2522 */ return ArrayUtils.EMPTY_STRING_ARRAY; /* */ } /* 2524 */ int j = paramString3.length(); /* 2525 */ int k = paramString2.length(); /* 2526 */ ArrayList localArrayList = new ArrayList(); /* 2527 */ int m = 0; /* 2528 */ while (m < i - j) { /* 2529 */ int n = paramString1.indexOf(paramString2, m); /* 2530 */ if (n < 0) { /* */ break; /* */ } /* 2533 */ n += k; /* 2534 */ int i1 = paramString1.indexOf(paramString3, n); /* 2535 */ if (i1 < 0) { /* */ break; /* */ } /* 2538 */ localArrayList.add(paramString1.substring(n, i1)); /* 2539 */ m = i1 + j; /* */ } /* 2541 */ if (localArrayList.isEmpty()) { /* 2542 */ return null; /* */ } /* 2544 */ return (String[])localArrayList.toArray(new String[localArrayList.size()]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] split(String paramString) /* */ { /* 2575 */ return split(paramString, null, -1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] split(String paramString, char paramChar) /* */ { /* 2603 */ return splitWorker(paramString, paramChar, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] split(String paramString1, String paramString2) /* */ { /* 2632 */ return splitWorker(paramString1, paramString2, -1, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] split(String paramString1, String paramString2, int paramInt) /* */ { /* 2666 */ return splitWorker(paramString1, paramString2, paramInt, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByWholeSeparator(String paramString1, String paramString2) /* */ { /* 2693 */ return splitByWholeSeparatorWorker(paramString1, paramString2, -1, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByWholeSeparator(String paramString1, String paramString2, int paramInt) /* */ { /* 2724 */ return splitByWholeSeparatorWorker(paramString1, paramString2, paramInt, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByWholeSeparatorPreserveAllTokens(String paramString1, String paramString2) /* */ { /* 2753 */ return splitByWholeSeparatorWorker(paramString1, paramString2, -1, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByWholeSeparatorPreserveAllTokens(String paramString1, String paramString2, int paramInt) /* */ { /* 2786 */ return splitByWholeSeparatorWorker(paramString1, paramString2, paramInt, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String[] splitByWholeSeparatorWorker(String paramString1, String paramString2, int paramInt, boolean paramBoolean) /* */ { /* 2805 */ if (paramString1 == null) { /* 2806 */ return null; /* */ } /* */ /* 2809 */ int i = paramString1.length(); /* */ /* 2811 */ if (i == 0) { /* 2812 */ return ArrayUtils.EMPTY_STRING_ARRAY; /* */ } /* */ /* 2815 */ if ((paramString2 == null) || ("".equals(paramString2))) /* */ { /* 2817 */ return splitWorker(paramString1, null, paramInt, paramBoolean); /* */ } /* */ /* 2820 */ int j = paramString2.length(); /* */ /* 2822 */ ArrayList localArrayList = new ArrayList(); /* 2823 */ int k = 0; /* 2824 */ int m = 0; /* 2825 */ int n = 0; /* 2826 */ while (n < i) { /* 2827 */ n = paramString1.indexOf(paramString2, m); /* */ /* 2829 */ if (n > -1) { /* 2830 */ if (n > m) { /* 2831 */ k++; /* */ /* 2833 */ if (k == paramInt) { /* 2834 */ n = i; /* 2835 */ localArrayList.add(paramString1.substring(m)); /* */ } /* */ else /* */ { /* 2839 */ localArrayList.add(paramString1.substring(m, n)); /* */ /* */ /* */ /* */ /* 2844 */ m = n + j; /* */ } /* */ } /* */ else { /* 2848 */ if (paramBoolean) { /* 2849 */ k++; /* 2850 */ if (k == paramInt) { /* 2851 */ n = i; /* 2852 */ localArrayList.add(paramString1.substring(m)); /* */ } else { /* 2854 */ localArrayList.add(""); /* */ } /* */ } /* 2857 */ m = n + j; /* */ } /* */ } /* */ else { /* 2861 */ localArrayList.add(paramString1.substring(m)); /* 2862 */ n = i; /* */ } /* */ } /* */ /* 2866 */ return (String[])localArrayList.toArray(new String[localArrayList.size()]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitPreserveAllTokens(String paramString) /* */ { /* 2895 */ return splitWorker(paramString, null, -1, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitPreserveAllTokens(String paramString, char paramChar) /* */ { /* 2931 */ return splitWorker(paramString, paramChar, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String[] splitWorker(String paramString, char paramChar, boolean paramBoolean) /* */ { /* 2949 */ if (paramString == null) { /* 2950 */ return null; /* */ } /* 2952 */ int i = paramString.length(); /* 2953 */ if (i == 0) { /* 2954 */ return ArrayUtils.EMPTY_STRING_ARRAY; /* */ } /* 2956 */ ArrayList localArrayList = new ArrayList(); /* 2957 */ int j = 0;int k = 0; /* 2958 */ int m = 0; /* 2959 */ int n = 0; /* 2960 */ while (j < i) /* 2961 */ if (paramString.charAt(j) == paramChar) { /* 2962 */ if ((m != 0) || (paramBoolean)) { /* 2963 */ localArrayList.add(paramString.substring(k, j)); /* 2964 */ m = 0; /* 2965 */ n = 1; /* */ } /* 2967 */ j++;k = j; /* */ } /* */ else { /* 2970 */ n = 0; /* 2971 */ m = 1; /* 2972 */ j++; /* */ } /* 2974 */ if ((m != 0) || ((paramBoolean) && (n != 0))) { /* 2975 */ localArrayList.add(paramString.substring(k, j)); /* */ } /* 2977 */ return (String[])localArrayList.toArray(new String[localArrayList.size()]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitPreserveAllTokens(String paramString1, String paramString2) /* */ { /* 3014 */ return splitWorker(paramString1, paramString2, -1, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitPreserveAllTokens(String paramString1, String paramString2, int paramInt) /* */ { /* 3054 */ return splitWorker(paramString1, paramString2, paramInt, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String[] splitWorker(String paramString1, String paramString2, int paramInt, boolean paramBoolean) /* */ { /* 3076 */ if (paramString1 == null) { /* 3077 */ return null; /* */ } /* 3079 */ int i = paramString1.length(); /* 3080 */ if (i == 0) { /* 3081 */ return ArrayUtils.EMPTY_STRING_ARRAY; /* */ } /* 3083 */ ArrayList localArrayList = new ArrayList(); /* 3084 */ int j = 1; /* 3085 */ int k = 0;int m = 0; /* 3086 */ int n = 0; /* 3087 */ int i1 = 0; /* 3088 */ if (paramString2 == null) /* */ { /* 3090 */ while (k < i) /* 3091 */ if (Character.isWhitespace(paramString1.charAt(k))) { /* 3092 */ if ((n != 0) || (paramBoolean)) { /* 3093 */ i1 = 1; /* 3094 */ if (j++ == paramInt) { /* 3095 */ k = i; /* 3096 */ i1 = 0; /* */ } /* 3098 */ localArrayList.add(paramString1.substring(m, k)); /* 3099 */ n = 0; /* */ } /* 3101 */ k++;m = k; /* */ } /* */ else { /* 3104 */ i1 = 0; /* 3105 */ n = 1; /* 3106 */ k++; /* */ } } /* 3108 */ if (paramString2.length() == 1) /* */ { /* 3110 */ int i2 = paramString2.charAt(0); /* 3111 */ while (k < i) { /* 3112 */ if (paramString1.charAt(k) == i2) { /* 3113 */ if ((n != 0) || (paramBoolean)) { /* 3114 */ i1 = 1; /* 3115 */ if (j++ == paramInt) { /* 3116 */ k = i; /* 3117 */ i1 = 0; /* */ } /* 3119 */ localArrayList.add(paramString1.substring(m, k)); /* 3120 */ n = 0; /* */ } /* 3122 */ k++;m = k; /* */ } /* */ else { /* 3125 */ i1 = 0; /* 3126 */ n = 1; /* 3127 */ k++; /* */ } /* */ } /* */ } else { /* 3131 */ while (k < i) /* 3132 */ if (paramString2.indexOf(paramString1.charAt(k)) >= 0) { /* 3133 */ if ((n != 0) || (paramBoolean)) { /* 3134 */ i1 = 1; /* 3135 */ if (j++ == paramInt) { /* 3136 */ k = i; /* 3137 */ i1 = 0; /* */ } /* 3139 */ localArrayList.add(paramString1.substring(m, k)); /* 3140 */ n = 0; /* */ } /* 3142 */ k++;m = k; /* */ } /* */ else { /* 3145 */ i1 = 0; /* 3146 */ n = 1; /* 3147 */ k++; /* */ } /* */ } /* 3150 */ if ((n != 0) || ((paramBoolean) && (i1 != 0))) { /* 3151 */ localArrayList.add(paramString1.substring(m, k)); /* */ } /* 3153 */ return (String[])localArrayList.toArray(new String[localArrayList.size()]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByCharacterType(String paramString) /* */ { /* 3176 */ return splitByCharacterType(paramString, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String[] splitByCharacterTypeCamelCase(String paramString) /* */ { /* 3204 */ return splitByCharacterType(paramString, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String[] splitByCharacterType(String paramString, boolean paramBoolean) /* */ { /* 3222 */ if (paramString == null) { /* 3223 */ return null; /* */ } /* 3225 */ if (paramString.isEmpty()) { /* 3226 */ return ArrayUtils.EMPTY_STRING_ARRAY; /* */ } /* 3228 */ char[] arrayOfChar = paramString.toCharArray(); /* 3229 */ ArrayList localArrayList = new ArrayList(); /* 3230 */ int i = 0; /* 3231 */ int j = Character.getType(arrayOfChar[i]); /* 3232 */ for (int k = i + 1; k < arrayOfChar.length; k++) { /* 3233 */ int m = Character.getType(arrayOfChar[k]); /* 3234 */ if (m != j) /* */ { /* */ /* 3237 */ if ((paramBoolean) && (m == 2) && (j == 1)) { /* 3238 */ int n = k - 1; /* 3239 */ if (n != i) { /* 3240 */ localArrayList.add(new String(arrayOfChar, i, n - i)); /* 3241 */ i = n; /* */ } /* */ } else { /* 3244 */ localArrayList.add(new String(arrayOfChar, i, k - i)); /* 3245 */ i = k; /* */ } /* 3247 */ j = m; /* */ } } /* 3249 */ localArrayList.add(new String(arrayOfChar, i, arrayOfChar.length - i)); /* 3250 */ return (String[])localArrayList.toArray(new String[localArrayList.size()]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static <T> String join(T... paramVarArgs) /* */ { /* 3278 */ return join(paramVarArgs, null); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Object[] paramArrayOfObject, char paramChar) /* */ { /* 3304 */ if (paramArrayOfObject == null) { /* 3305 */ return null; /* */ } /* 3307 */ return join(paramArrayOfObject, paramChar, 0, paramArrayOfObject.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(long[] paramArrayOfLong, char paramChar) /* */ { /* 3336 */ if (paramArrayOfLong == null) { /* 3337 */ return null; /* */ } /* 3339 */ return join(paramArrayOfLong, paramChar, 0, paramArrayOfLong.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(int[] paramArrayOfInt, char paramChar) /* */ { /* 3368 */ if (paramArrayOfInt == null) { /* 3369 */ return null; /* */ } /* 3371 */ return join(paramArrayOfInt, paramChar, 0, paramArrayOfInt.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(short[] paramArrayOfShort, char paramChar) /* */ { /* 3400 */ if (paramArrayOfShort == null) { /* 3401 */ return null; /* */ } /* 3403 */ return join(paramArrayOfShort, paramChar, 0, paramArrayOfShort.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(byte[] paramArrayOfByte, char paramChar) /* */ { /* 3432 */ if (paramArrayOfByte == null) { /* 3433 */ return null; /* */ } /* 3435 */ return join(paramArrayOfByte, paramChar, 0, paramArrayOfByte.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(char[] paramArrayOfChar, char paramChar) /* */ { /* 3464 */ if (paramArrayOfChar == null) { /* 3465 */ return null; /* */ } /* 3467 */ return join(paramArrayOfChar, paramChar, 0, paramArrayOfChar.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(float[] paramArrayOfFloat, char paramChar) /* */ { /* 3496 */ if (paramArrayOfFloat == null) { /* 3497 */ return null; /* */ } /* 3499 */ return join(paramArrayOfFloat, paramChar, 0, paramArrayOfFloat.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(double[] paramArrayOfDouble, char paramChar) /* */ { /* 3528 */ if (paramArrayOfDouble == null) { /* 3529 */ return null; /* */ } /* 3531 */ return join(paramArrayOfDouble, paramChar, 0, paramArrayOfDouble.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Object[] paramArrayOfObject, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3562 */ if (paramArrayOfObject == null) { /* 3563 */ return null; /* */ } /* 3565 */ int i = paramInt2 - paramInt1; /* 3566 */ if (i <= 0) { /* 3567 */ return ""; /* */ } /* 3569 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3570 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3571 */ if (j > paramInt1) { /* 3572 */ localStringBuilder.append(paramChar); /* */ } /* 3574 */ if (paramArrayOfObject[j] != null) { /* 3575 */ localStringBuilder.append(paramArrayOfObject[j]); /* */ } /* */ } /* 3578 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(long[] paramArrayOfLong, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3613 */ if (paramArrayOfLong == null) { /* 3614 */ return null; /* */ } /* 3616 */ int i = paramInt2 - paramInt1; /* 3617 */ if (i <= 0) { /* 3618 */ return ""; /* */ } /* 3620 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3621 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3622 */ if (j > paramInt1) { /* 3623 */ localStringBuilder.append(paramChar); /* */ } /* 3625 */ localStringBuilder.append(paramArrayOfLong[j]); /* */ } /* 3627 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(int[] paramArrayOfInt, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3662 */ if (paramArrayOfInt == null) { /* 3663 */ return null; /* */ } /* 3665 */ int i = paramInt2 - paramInt1; /* 3666 */ if (i <= 0) { /* 3667 */ return ""; /* */ } /* 3669 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3670 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3671 */ if (j > paramInt1) { /* 3672 */ localStringBuilder.append(paramChar); /* */ } /* 3674 */ localStringBuilder.append(paramArrayOfInt[j]); /* */ } /* 3676 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(byte[] paramArrayOfByte, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3711 */ if (paramArrayOfByte == null) { /* 3712 */ return null; /* */ } /* 3714 */ int i = paramInt2 - paramInt1; /* 3715 */ if (i <= 0) { /* 3716 */ return ""; /* */ } /* 3718 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3719 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3720 */ if (j > paramInt1) { /* 3721 */ localStringBuilder.append(paramChar); /* */ } /* 3723 */ localStringBuilder.append(paramArrayOfByte[j]); /* */ } /* 3725 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(short[] paramArrayOfShort, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3760 */ if (paramArrayOfShort == null) { /* 3761 */ return null; /* */ } /* 3763 */ int i = paramInt2 - paramInt1; /* 3764 */ if (i <= 0) { /* 3765 */ return ""; /* */ } /* 3767 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3768 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3769 */ if (j > paramInt1) { /* 3770 */ localStringBuilder.append(paramChar); /* */ } /* 3772 */ localStringBuilder.append(paramArrayOfShort[j]); /* */ } /* 3774 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(char[] paramArrayOfChar, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3809 */ if (paramArrayOfChar == null) { /* 3810 */ return null; /* */ } /* 3812 */ int i = paramInt2 - paramInt1; /* 3813 */ if (i <= 0) { /* 3814 */ return ""; /* */ } /* 3816 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3817 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3818 */ if (j > paramInt1) { /* 3819 */ localStringBuilder.append(paramChar); /* */ } /* 3821 */ localStringBuilder.append(paramArrayOfChar[j]); /* */ } /* 3823 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(double[] paramArrayOfDouble, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3858 */ if (paramArrayOfDouble == null) { /* 3859 */ return null; /* */ } /* 3861 */ int i = paramInt2 - paramInt1; /* 3862 */ if (i <= 0) { /* 3863 */ return ""; /* */ } /* 3865 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3866 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3867 */ if (j > paramInt1) { /* 3868 */ localStringBuilder.append(paramChar); /* */ } /* 3870 */ localStringBuilder.append(paramArrayOfDouble[j]); /* */ } /* 3872 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(float[] paramArrayOfFloat, char paramChar, int paramInt1, int paramInt2) /* */ { /* 3907 */ if (paramArrayOfFloat == null) { /* 3908 */ return null; /* */ } /* 3910 */ int i = paramInt2 - paramInt1; /* 3911 */ if (i <= 0) { /* 3912 */ return ""; /* */ } /* 3914 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* 3915 */ for (int j = paramInt1; j < paramInt2; j++) { /* 3916 */ if (j > paramInt1) { /* 3917 */ localStringBuilder.append(paramChar); /* */ } /* 3919 */ localStringBuilder.append(paramArrayOfFloat[j]); /* */ } /* 3921 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Object[] paramArrayOfObject, String paramString) /* */ { /* 3949 */ if (paramArrayOfObject == null) { /* 3950 */ return null; /* */ } /* 3952 */ return join(paramArrayOfObject, paramString, 0, paramArrayOfObject.length); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Object[] paramArrayOfObject, String paramString, int paramInt1, int paramInt2) /* */ { /* 3991 */ if (paramArrayOfObject == null) { /* 3992 */ return null; /* */ } /* 3994 */ if (paramString == null) { /* 3995 */ paramString = ""; /* */ } /* */ /* */ /* */ /* 4000 */ int i = paramInt2 - paramInt1; /* 4001 */ if (i <= 0) { /* 4002 */ return ""; /* */ } /* */ /* 4005 */ StringBuilder localStringBuilder = new StringBuilder(i * 16); /* */ /* 4007 */ for (int j = paramInt1; j < paramInt2; j++) { /* 4008 */ if (j > paramInt1) { /* 4009 */ localStringBuilder.append(paramString); /* */ } /* 4011 */ if (paramArrayOfObject[j] != null) { /* 4012 */ localStringBuilder.append(paramArrayOfObject[j]); /* */ } /* */ } /* 4015 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Iterator<?> paramIterator, char paramChar) /* */ { /* 4035 */ if (paramIterator == null) { /* 4036 */ return null; /* */ } /* 4038 */ if (!paramIterator.hasNext()) { /* 4039 */ return ""; /* */ } /* 4041 */ Object localObject1 = paramIterator.next(); /* 4042 */ if (!paramIterator.hasNext()) /* */ { /* 4044 */ localObject2 = ObjectUtils.toString(localObject1); /* 4045 */ return (String)localObject2; /* */ } /* */ /* */ /* 4049 */ Object localObject2 = new StringBuilder(256); /* 4050 */ if (localObject1 != null) { /* 4051 */ ((StringBuilder)localObject2).append(localObject1); /* */ } /* */ /* 4054 */ while (paramIterator.hasNext()) { /* 4055 */ ((StringBuilder)localObject2).append(paramChar); /* 4056 */ Object localObject3 = paramIterator.next(); /* 4057 */ if (localObject3 != null) { /* 4058 */ ((StringBuilder)localObject2).append(localObject3); /* */ } /* */ } /* */ /* 4062 */ return ((StringBuilder)localObject2).toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Iterator<?> paramIterator, String paramString) /* */ { /* 4081 */ if (paramIterator == null) { /* 4082 */ return null; /* */ } /* 4084 */ if (!paramIterator.hasNext()) { /* 4085 */ return ""; /* */ } /* 4087 */ Object localObject1 = paramIterator.next(); /* 4088 */ if (!paramIterator.hasNext()) /* */ { /* 4090 */ localObject2 = ObjectUtils.toString(localObject1); /* 4091 */ return (String)localObject2; /* */ } /* */ /* */ /* 4095 */ Object localObject2 = new StringBuilder(256); /* 4096 */ if (localObject1 != null) { /* 4097 */ ((StringBuilder)localObject2).append(localObject1); /* */ } /* */ /* 4100 */ while (paramIterator.hasNext()) { /* 4101 */ if (paramString != null) { /* 4102 */ ((StringBuilder)localObject2).append(paramString); /* */ } /* 4104 */ Object localObject3 = paramIterator.next(); /* 4105 */ if (localObject3 != null) { /* 4106 */ ((StringBuilder)localObject2).append(localObject3); /* */ } /* */ } /* 4109 */ return ((StringBuilder)localObject2).toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Iterable<?> paramIterable, char paramChar) /* */ { /* 4127 */ if (paramIterable == null) { /* 4128 */ return null; /* */ } /* 4130 */ return join(paramIterable.iterator(), paramChar); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String join(Iterable<?> paramIterable, String paramString) /* */ { /* 4148 */ if (paramIterable == null) { /* 4149 */ return null; /* */ } /* 4151 */ return join(paramIterable.iterator(), paramString); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String deleteWhitespace(String paramString) /* */ { /* 4171 */ if (isEmpty(paramString)) { /* 4172 */ return paramString; /* */ } /* 4174 */ int i = paramString.length(); /* 4175 */ char[] arrayOfChar = new char[i]; /* 4176 */ int j = 0; /* 4177 */ for (int k = 0; k < i; k++) { /* 4178 */ if (!Character.isWhitespace(paramString.charAt(k))) { /* 4179 */ arrayOfChar[(j++)] = paramString.charAt(k); /* */ } /* */ } /* 4182 */ if (j == i) { /* 4183 */ return paramString; /* */ } /* 4185 */ return new String(arrayOfChar, 0, j); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String removeStart(String paramString1, String paramString2) /* */ { /* 4215 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4216 */ return paramString1; /* */ } /* 4218 */ if (paramString1.startsWith(paramString2)) { /* 4219 */ return paramString1.substring(paramString2.length()); /* */ } /* 4221 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String removeStartIgnoreCase(String paramString1, String paramString2) /* */ { /* 4250 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4251 */ return paramString1; /* */ } /* 4253 */ if (startsWithIgnoreCase(paramString1, paramString2)) { /* 4254 */ return paramString1.substring(paramString2.length()); /* */ } /* 4256 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String removeEnd(String paramString1, String paramString2) /* */ { /* 4284 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4285 */ return paramString1; /* */ } /* 4287 */ if (paramString1.endsWith(paramString2)) { /* 4288 */ return paramString1.substring(0, paramString1.length() - paramString2.length()); /* */ } /* 4290 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String removeEndIgnoreCase(String paramString1, String paramString2) /* */ { /* 4320 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4321 */ return paramString1; /* */ } /* 4323 */ if (endsWithIgnoreCase(paramString1, paramString2)) { /* 4324 */ return paramString1.substring(0, paramString1.length() - paramString2.length()); /* */ } /* 4326 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String remove(String paramString1, String paramString2) /* */ { /* 4353 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4354 */ return paramString1; /* */ } /* 4356 */ return replace(paramString1, paramString2, "", -1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String remove(String paramString, char paramChar) /* */ { /* 4379 */ if ((isEmpty(paramString)) || (paramString.indexOf(paramChar) == -1)) { /* 4380 */ return paramString; /* */ } /* 4382 */ char[] arrayOfChar = paramString.toCharArray(); /* 4383 */ int i = 0; /* 4384 */ for (int j = 0; j < arrayOfChar.length; j++) { /* 4385 */ if (arrayOfChar[j] != paramChar) { /* 4386 */ arrayOfChar[(i++)] = arrayOfChar[j]; /* */ } /* */ } /* 4389 */ return new String(arrayOfChar, 0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replaceOnce(String paramString1, String paramString2, String paramString3) /* */ { /* 4418 */ return replace(paramString1, paramString2, paramString3, 1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replacePattern(String paramString1, String paramString2, String paramString3) /* */ { /* 4442 */ return Pattern.compile(paramString2, 32).matcher(paramString1).replaceAll(paramString3); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String removePattern(String paramString1, String paramString2) /* */ { /* 4458 */ return replacePattern(paramString1, paramString2, ""); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replace(String paramString1, String paramString2, String paramString3) /* */ { /* 4485 */ return replace(paramString1, paramString2, paramString3, -1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replace(String paramString1, String paramString2, String paramString3, int paramInt) /* */ { /* 4517 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2)) || (paramString3 == null) || (paramInt == 0)) { /* 4518 */ return paramString1; /* */ } /* 4520 */ int i = 0; /* 4521 */ int j = paramString1.indexOf(paramString2, i); /* 4522 */ if (j == -1) { /* 4523 */ return paramString1; /* */ } /* 4525 */ int k = paramString2.length(); /* 4526 */ int m = paramString3.length() - k; /* 4527 */ m = m < 0 ? 0 : m; /* 4528 */ m *= (paramInt > 64 ? 64 : paramInt < 0 ? 16 : paramInt); /* 4529 */ StringBuilder localStringBuilder = new StringBuilder(paramString1.length() + m); /* 4530 */ while (j != -1) { /* 4531 */ localStringBuilder.append(paramString1.substring(i, j)).append(paramString3); /* 4532 */ i = j + k; /* 4533 */ paramInt--; if (paramInt == 0) { /* */ break; /* */ } /* 4536 */ j = paramString1.indexOf(paramString2, i); /* */ } /* 4538 */ localStringBuilder.append(paramString1.substring(i)); /* 4539 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replaceEach(String paramString, String[] paramArrayOfString1, String[] paramArrayOfString2) /* */ { /* 4582 */ return replaceEach(paramString, paramArrayOfString1, paramArrayOfString2, false, 0); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replaceEachRepeatedly(String paramString, String[] paramArrayOfString1, String[] paramArrayOfString2) /* */ { /* 4632 */ int i = paramArrayOfString1 == null ? 0 : paramArrayOfString1.length; /* 4633 */ return replaceEach(paramString, paramArrayOfString1, paramArrayOfString2, true, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String replaceEach(String paramString, String[] paramArrayOfString1, String[] paramArrayOfString2, boolean paramBoolean, int paramInt) /* */ { /* 4690 */ if ((paramString == null) || (paramString.isEmpty()) || (paramArrayOfString1 == null) || (paramArrayOfString1.length == 0) || (paramArrayOfString2 == null) || (paramArrayOfString2.length == 0)) /* */ { /* 4692 */ return paramString; /* */ } /* */ /* */ /* 4696 */ if (paramInt < 0) { /* 4697 */ throw new IllegalStateException("Aborting to protect against StackOverflowError - output of one loop is the input of another"); /* */ } /* */ /* */ /* 4701 */ int i = paramArrayOfString1.length; /* 4702 */ int j = paramArrayOfString2.length; /* */ /* */ /* 4705 */ if (i != j) { /* 4706 */ throw new IllegalArgumentException("Search and Replace array lengths don't match: " + i + " vs " + j); /* */ } /* */ /* */ /* */ /* */ /* */ /* 4713 */ boolean[] arrayOfBoolean = new boolean[i]; /* */ /* */ /* 4716 */ int k = -1; /* 4717 */ int m = -1; /* 4718 */ int n = -1; /* */ /* */ /* */ /* 4722 */ for (int i1 = 0; i1 < i; i1++) { /* 4723 */ if ((arrayOfBoolean[i1] == 0) && (paramArrayOfString1[i1] != null) && (!paramArrayOfString1[i1].isEmpty()) && (paramArrayOfString2[i1] != null)) /* */ { /* */ /* */ /* 4727 */ n = paramString.indexOf(paramArrayOfString1[i1]); /* */ /* */ /* 4730 */ if (n == -1) { /* 4731 */ arrayOfBoolean[i1] = true; /* */ } /* 4733 */ else if ((k == -1) || (n < k)) { /* 4734 */ k = n; /* 4735 */ m = i1; /* */ } /* */ } /* */ } /* */ /* */ /* */ /* 4742 */ if (k == -1) { /* 4743 */ return paramString; /* */ } /* */ /* 4746 */ i1 = 0; /* */ /* */ /* 4749 */ int i2 = 0; /* */ /* */ /* 4752 */ for (int i3 = 0; i3 < paramArrayOfString1.length; i3++) { /* 4753 */ if ((paramArrayOfString1[i3] != null) && (paramArrayOfString2[i3] != null)) /* */ { /* */ /* 4756 */ i4 = paramArrayOfString2[i3].length() - paramArrayOfString1[i3].length(); /* 4757 */ if (i4 > 0) { /* 4758 */ i2 += 3 * i4; /* */ } /* */ } /* */ } /* 4762 */ i2 = Math.min(i2, paramString.length() / 5); /* */ /* 4764 */ StringBuilder localStringBuilder = new StringBuilder(paramString.length() + i2); /* */ /* 4766 */ while (k != -1) /* */ { /* 4768 */ for (i4 = i1; i4 < k; i4++) { /* 4769 */ localStringBuilder.append(paramString.charAt(i4)); /* */ } /* 4771 */ localStringBuilder.append(paramArrayOfString2[m]); /* */ /* 4773 */ i1 = k + paramArrayOfString1[m].length(); /* */ /* 4775 */ k = -1; /* 4776 */ m = -1; /* 4777 */ n = -1; /* */ /* */ /* 4780 */ for (i4 = 0; i4 < i; i4++) { /* 4781 */ if ((arrayOfBoolean[i4] == 0) && (paramArrayOfString1[i4] != null) && (!paramArrayOfString1[i4].isEmpty()) && (paramArrayOfString2[i4] != null)) /* */ { /* */ /* */ /* 4785 */ n = paramString.indexOf(paramArrayOfString1[i4], i1); /* */ /* */ /* 4788 */ if (n == -1) { /* 4789 */ arrayOfBoolean[i4] = true; /* */ } /* 4791 */ else if ((k == -1) || (n < k)) { /* 4792 */ k = n; /* 4793 */ m = i4; /* */ } /* */ } /* */ } /* */ } /* */ /* */ /* 4800 */ int i4 = paramString.length(); /* 4801 */ for (int i5 = i1; i5 < i4; i5++) { /* 4802 */ localStringBuilder.append(paramString.charAt(i5)); /* */ } /* 4804 */ String str = localStringBuilder.toString(); /* 4805 */ if (!paramBoolean) { /* 4806 */ return str; /* */ } /* */ /* 4809 */ return replaceEach(str, paramArrayOfString1, paramArrayOfString2, paramBoolean, paramInt - 1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replaceChars(String paramString, char paramChar1, char paramChar2) /* */ { /* 4835 */ if (paramString == null) { /* 4836 */ return null; /* */ } /* 4838 */ return paramString.replace(paramChar1, paramChar2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String replaceChars(String paramString1, String paramString2, String paramString3) /* */ { /* 4878 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 4879 */ return paramString1; /* */ } /* 4881 */ if (paramString3 == null) { /* 4882 */ paramString3 = ""; /* */ } /* 4884 */ int i = 0; /* 4885 */ int j = paramString3.length(); /* 4886 */ int k = paramString1.length(); /* 4887 */ StringBuilder localStringBuilder = new StringBuilder(k); /* 4888 */ for (int m = 0; m < k; m++) { /* 4889 */ char c = paramString1.charAt(m); /* 4890 */ int n = paramString2.indexOf(c); /* 4891 */ if (n >= 0) { /* 4892 */ i = 1; /* 4893 */ if (n < j) { /* 4894 */ localStringBuilder.append(paramString3.charAt(n)); /* */ } /* */ } else { /* 4897 */ localStringBuilder.append(c); /* */ } /* */ } /* 4900 */ if (i != 0) { /* 4901 */ return localStringBuilder.toString(); /* */ } /* 4903 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String overlay(String paramString1, String paramString2, int paramInt1, int paramInt2) /* */ { /* 4938 */ if (paramString1 == null) { /* 4939 */ return null; /* */ } /* 4941 */ if (paramString2 == null) { /* 4942 */ paramString2 = ""; /* */ } /* 4944 */ int i = paramString1.length(); /* 4945 */ if (paramInt1 < 0) { /* 4946 */ paramInt1 = 0; /* */ } /* 4948 */ if (paramInt1 > i) { /* 4949 */ paramInt1 = i; /* */ } /* 4951 */ if (paramInt2 < 0) { /* 4952 */ paramInt2 = 0; /* */ } /* 4954 */ if (paramInt2 > i) { /* 4955 */ paramInt2 = i; /* */ } /* 4957 */ if (paramInt1 > paramInt2) { /* 4958 */ int j = paramInt1; /* 4959 */ paramInt1 = paramInt2; /* 4960 */ paramInt2 = j; /* */ } /* 4962 */ return i + paramInt1 - paramInt2 + paramString2.length() + 1 + paramString1.substring(0, paramInt1) + paramString2 + paramString1.substring(paramInt2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String chomp(String paramString) /* */ { /* 4997 */ if (isEmpty(paramString)) { /* 4998 */ return paramString; /* */ } /* */ /* 5001 */ if (paramString.length() == 1) { /* 5002 */ i = paramString.charAt(0); /* 5003 */ if ((i == 13) || (i == 10)) { /* 5004 */ return ""; /* */ } /* 5006 */ return paramString; /* */ } /* */ /* 5009 */ int i = paramString.length() - 1; /* 5010 */ int j = paramString.charAt(i); /* */ /* 5012 */ if (j == 10) { /* 5013 */ if (paramString.charAt(i - 1) == '\r') { /* 5014 */ i--; /* */ } /* 5016 */ } else if (j != 13) { /* 5017 */ i++; /* */ } /* 5019 */ return paramString.substring(0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public static String chomp(String paramString1, String paramString2) /* */ { /* 5051 */ return removeEnd(paramString1, paramString2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String chop(String paramString) /* */ { /* 5080 */ if (paramString == null) { /* 5081 */ return null; /* */ } /* 5083 */ int i = paramString.length(); /* 5084 */ if (i < 2) { /* 5085 */ return ""; /* */ } /* 5087 */ int j = i - 1; /* 5088 */ String str = paramString.substring(0, j); /* 5089 */ int k = paramString.charAt(j); /* 5090 */ if ((k == 10) && (str.charAt(j - 1) == '\r')) { /* 5091 */ return str.substring(0, j - 1); /* */ } /* 5093 */ return str; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String repeat(String paramString, int paramInt) /* */ { /* 5122 */ if (paramString == null) { /* 5123 */ return null; /* */ } /* 5125 */ if (paramInt <= 0) { /* 5126 */ return ""; /* */ } /* 5128 */ int i = paramString.length(); /* 5129 */ if ((paramInt == 1) || (i == 0)) { /* 5130 */ return paramString; /* */ } /* 5132 */ if ((i == 1) && (paramInt <= 8192)) { /* 5133 */ return repeat(paramString.charAt(0), paramInt); /* */ } /* */ /* 5136 */ int j = i * paramInt; /* 5137 */ switch (i) { /* */ case 1: /* 5139 */ return repeat(paramString.charAt(0), paramInt); /* */ case 2: /* 5141 */ int k = paramString.charAt(0); /* 5142 */ int m = paramString.charAt(1); /* 5143 */ char[] arrayOfChar = new char[j]; /* 5144 */ for (int n = paramInt * 2 - 2; n >= 0; n--) { /* 5145 */ arrayOfChar[n] = k; /* 5146 */ arrayOfChar[(n + 1)] = m;n--; /* */ } /* */ /* 5148 */ return new String(arrayOfChar); /* */ } /* 5150 */ StringBuilder localStringBuilder = new StringBuilder(j); /* 5151 */ for (int i1 = 0; i1 < paramInt; i1++) { /* 5152 */ localStringBuilder.append(paramString); /* */ } /* 5154 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String repeat(String paramString1, String paramString2, int paramInt) /* */ { /* 5179 */ if ((paramString1 == null) || (paramString2 == null)) { /* 5180 */ return repeat(paramString1, paramInt); /* */ } /* */ /* 5183 */ String str = repeat(paramString1 + paramString2, paramInt); /* 5184 */ return removeEnd(str, paramString2); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String repeat(char paramChar, int paramInt) /* */ { /* 5210 */ char[] arrayOfChar = new char[paramInt]; /* 5211 */ for (int i = paramInt - 1; i >= 0; i--) { /* 5212 */ arrayOfChar[i] = paramChar; /* */ } /* 5214 */ return new String(arrayOfChar); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String rightPad(String paramString, int paramInt) /* */ { /* 5237 */ return rightPad(paramString, paramInt, ' '); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String rightPad(String paramString, int paramInt, char paramChar) /* */ { /* 5262 */ if (paramString == null) { /* 5263 */ return null; /* */ } /* 5265 */ int i = paramInt - paramString.length(); /* 5266 */ if (i <= 0) { /* 5267 */ return paramString; /* */ } /* 5269 */ if (i > 8192) { /* 5270 */ return rightPad(paramString, paramInt, String.valueOf(paramChar)); /* */ } /* 5272 */ return paramString.concat(repeat(paramChar, i)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String rightPad(String paramString1, int paramInt, String paramString2) /* */ { /* 5299 */ if (paramString1 == null) { /* 5300 */ return null; /* */ } /* 5302 */ if (isEmpty(paramString2)) { /* 5303 */ paramString2 = " "; /* */ } /* 5305 */ int i = paramString2.length(); /* 5306 */ int j = paramString1.length(); /* 5307 */ int k = paramInt - j; /* 5308 */ if (k <= 0) { /* 5309 */ return paramString1; /* */ } /* 5311 */ if ((i == 1) && (k <= 8192)) { /* 5312 */ return rightPad(paramString1, paramInt, paramString2.charAt(0)); /* */ } /* */ /* 5315 */ if (k == i) /* 5316 */ return paramString1.concat(paramString2); /* 5317 */ if (k < i) { /* 5318 */ return paramString1.concat(paramString2.substring(0, k)); /* */ } /* 5320 */ char[] arrayOfChar1 = new char[k]; /* 5321 */ char[] arrayOfChar2 = paramString2.toCharArray(); /* 5322 */ for (int m = 0; m < k; m++) { /* 5323 */ arrayOfChar1[m] = arrayOfChar2[(m % i)]; /* */ } /* 5325 */ return paramString1.concat(new String(arrayOfChar1)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String leftPad(String paramString, int paramInt) /* */ { /* 5349 */ return leftPad(paramString, paramInt, ' '); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String leftPad(String paramString, int paramInt, char paramChar) /* */ { /* 5374 */ if (paramString == null) { /* 5375 */ return null; /* */ } /* 5377 */ int i = paramInt - paramString.length(); /* 5378 */ if (i <= 0) { /* 5379 */ return paramString; /* */ } /* 5381 */ if (i > 8192) { /* 5382 */ return leftPad(paramString, paramInt, String.valueOf(paramChar)); /* */ } /* 5384 */ return repeat(paramChar, i).concat(paramString); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String leftPad(String paramString1, int paramInt, String paramString2) /* */ { /* 5411 */ if (paramString1 == null) { /* 5412 */ return null; /* */ } /* 5414 */ if (isEmpty(paramString2)) { /* 5415 */ paramString2 = " "; /* */ } /* 5417 */ int i = paramString2.length(); /* 5418 */ int j = paramString1.length(); /* 5419 */ int k = paramInt - j; /* 5420 */ if (k <= 0) { /* 5421 */ return paramString1; /* */ } /* 5423 */ if ((i == 1) && (k <= 8192)) { /* 5424 */ return leftPad(paramString1, paramInt, paramString2.charAt(0)); /* */ } /* */ /* 5427 */ if (k == i) /* 5428 */ return paramString2.concat(paramString1); /* 5429 */ if (k < i) { /* 5430 */ return paramString2.substring(0, k).concat(paramString1); /* */ } /* 5432 */ char[] arrayOfChar1 = new char[k]; /* 5433 */ char[] arrayOfChar2 = paramString2.toCharArray(); /* 5434 */ for (int m = 0; m < k; m++) { /* 5435 */ arrayOfChar1[m] = arrayOfChar2[(m % i)]; /* */ } /* 5437 */ return new String(arrayOfChar1).concat(paramString1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int length(CharSequence paramCharSequence) /* */ { /* 5453 */ return paramCharSequence == null ? 0 : paramCharSequence.length(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String center(String paramString, int paramInt) /* */ { /* 5482 */ return center(paramString, paramInt, ' '); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String center(String paramString, int paramInt, char paramChar) /* */ { /* 5510 */ if ((paramString == null) || (paramInt <= 0)) { /* 5511 */ return paramString; /* */ } /* 5513 */ int i = paramString.length(); /* 5514 */ int j = paramInt - i; /* 5515 */ if (j <= 0) { /* 5516 */ return paramString; /* */ } /* 5518 */ paramString = leftPad(paramString, i + j / 2, paramChar); /* 5519 */ paramString = rightPad(paramString, paramInt, paramChar); /* 5520 */ return paramString; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String center(String paramString1, int paramInt, String paramString2) /* */ { /* 5550 */ if ((paramString1 == null) || (paramInt <= 0)) { /* 5551 */ return paramString1; /* */ } /* 5553 */ if (isEmpty(paramString2)) { /* 5554 */ paramString2 = " "; /* */ } /* 5556 */ int i = paramString1.length(); /* 5557 */ int j = paramInt - i; /* 5558 */ if (j <= 0) { /* 5559 */ return paramString1; /* */ } /* 5561 */ paramString1 = leftPad(paramString1, i + j / 2, paramString2); /* 5562 */ paramString1 = rightPad(paramString1, paramInt, paramString2); /* 5563 */ return paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String upperCase(String paramString) /* */ { /* 5588 */ if (paramString == null) { /* 5589 */ return null; /* */ } /* 5591 */ return paramString.toUpperCase(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String upperCase(String paramString, Locale paramLocale) /* */ { /* 5611 */ if (paramString == null) { /* 5612 */ return null; /* */ } /* 5614 */ return paramString.toUpperCase(paramLocale); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String lowerCase(String paramString) /* */ { /* 5637 */ if (paramString == null) { /* 5638 */ return null; /* */ } /* 5640 */ return paramString.toLowerCase(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String lowerCase(String paramString, Locale paramLocale) /* */ { /* 5660 */ if (paramString == null) { /* 5661 */ return null; /* */ } /* 5663 */ return paramString.toLowerCase(paramLocale); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String capitalize(String paramString) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 5688 */ if ((paramString == null) || ((i = paramString.length()) == 0)) { /* 5689 */ return paramString; /* */ } /* */ /* 5692 */ char c = paramString.charAt(0); /* 5693 */ if (Character.isTitleCase(c)) /* */ { /* 5695 */ return paramString; /* */ } /* */ /* 5698 */ return i + Character.toTitleCase(c) + paramString.substring(1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String uncapitalize(String paramString) /* */ { /* */ int i; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 5726 */ if ((paramString == null) || ((i = paramString.length()) == 0)) { /* 5727 */ return paramString; /* */ } /* */ /* 5730 */ char c = paramString.charAt(0); /* 5731 */ if (Character.isLowerCase(c)) /* */ { /* 5733 */ return paramString; /* */ } /* */ /* 5736 */ return i + Character.toLowerCase(c) + paramString.substring(1); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String swapCase(String paramString) /* */ { /* 5770 */ if (isEmpty(paramString)) { /* 5771 */ return paramString; /* */ } /* */ /* 5774 */ char[] arrayOfChar = paramString.toCharArray(); /* */ /* 5776 */ for (int i = 0; i < arrayOfChar.length; i++) { /* 5777 */ char c = arrayOfChar[i]; /* 5778 */ if (Character.isUpperCase(c)) { /* 5779 */ arrayOfChar[i] = Character.toLowerCase(c); /* 5780 */ } else if (Character.isTitleCase(c)) { /* 5781 */ arrayOfChar[i] = Character.toLowerCase(c); /* 5782 */ } else if (Character.isLowerCase(c)) { /* 5783 */ arrayOfChar[i] = Character.toUpperCase(c); /* */ } /* */ } /* 5786 */ return new String(arrayOfChar); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int countMatches(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 5812 */ if ((isEmpty(paramCharSequence1)) || (isEmpty(paramCharSequence2))) { /* 5813 */ return 0; /* */ } /* 5815 */ int i = 0; /* 5816 */ int j = 0; /* 5817 */ while ((j = CharSequenceUtils.indexOf(paramCharSequence1, paramCharSequence2, j)) != -1) { /* 5818 */ i++; /* 5819 */ j += paramCharSequence2.length(); /* */ } /* 5821 */ return i; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAlpha(CharSequence paramCharSequence) /* */ { /* 5847 */ if (isEmpty(paramCharSequence)) { /* 5848 */ return false; /* */ } /* 5850 */ int i = paramCharSequence.length(); /* 5851 */ for (int j = 0; j < i; j++) { /* 5852 */ if (!Character.isLetter(paramCharSequence.charAt(j))) { /* 5853 */ return false; /* */ } /* */ } /* 5856 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAlphaSpace(CharSequence paramCharSequence) /* */ { /* 5882 */ if (paramCharSequence == null) { /* 5883 */ return false; /* */ } /* 5885 */ int i = paramCharSequence.length(); /* 5886 */ for (int j = 0; j < i; j++) { /* 5887 */ if ((!Character.isLetter(paramCharSequence.charAt(j))) && (paramCharSequence.charAt(j) != ' ')) { /* 5888 */ return false; /* */ } /* */ } /* 5891 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAlphanumeric(CharSequence paramCharSequence) /* */ { /* 5917 */ if (isEmpty(paramCharSequence)) { /* 5918 */ return false; /* */ } /* 5920 */ int i = paramCharSequence.length(); /* 5921 */ for (int j = 0; j < i; j++) { /* 5922 */ if (!Character.isLetterOrDigit(paramCharSequence.charAt(j))) { /* 5923 */ return false; /* */ } /* */ } /* 5926 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAlphanumericSpace(CharSequence paramCharSequence) /* */ { /* 5952 */ if (paramCharSequence == null) { /* 5953 */ return false; /* */ } /* 5955 */ int i = paramCharSequence.length(); /* 5956 */ for (int j = 0; j < i; j++) { /* 5957 */ if ((!Character.isLetterOrDigit(paramCharSequence.charAt(j))) && (paramCharSequence.charAt(j) != ' ')) { /* 5958 */ return false; /* */ } /* */ } /* 5961 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAsciiPrintable(CharSequence paramCharSequence) /* */ { /* 5991 */ if (paramCharSequence == null) { /* 5992 */ return false; /* */ } /* 5994 */ int i = paramCharSequence.length(); /* 5995 */ for (int j = 0; j < i; j++) { /* 5996 */ if (!CharUtils.isAsciiPrintable(paramCharSequence.charAt(j))) { /* 5997 */ return false; /* */ } /* */ } /* 6000 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNumeric(CharSequence paramCharSequence) /* */ { /* 6034 */ if (isEmpty(paramCharSequence)) { /* 6035 */ return false; /* */ } /* 6037 */ int i = paramCharSequence.length(); /* 6038 */ for (int j = 0; j < i; j++) { /* 6039 */ if (!Character.isDigit(paramCharSequence.charAt(j))) { /* 6040 */ return false; /* */ } /* */ } /* 6043 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isNumericSpace(CharSequence paramCharSequence) /* */ { /* 6071 */ if (paramCharSequence == null) { /* 6072 */ return false; /* */ } /* 6074 */ int i = paramCharSequence.length(); /* 6075 */ for (int j = 0; j < i; j++) { /* 6076 */ if ((!Character.isDigit(paramCharSequence.charAt(j))) && (paramCharSequence.charAt(j) != ' ')) { /* 6077 */ return false; /* */ } /* */ } /* 6080 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isWhitespace(CharSequence paramCharSequence) /* */ { /* 6104 */ if (paramCharSequence == null) { /* 6105 */ return false; /* */ } /* 6107 */ int i = paramCharSequence.length(); /* 6108 */ for (int j = 0; j < i; j++) { /* 6109 */ if (!Character.isWhitespace(paramCharSequence.charAt(j))) { /* 6110 */ return false; /* */ } /* */ } /* 6113 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAllLowerCase(CharSequence paramCharSequence) /* */ { /* 6136 */ if ((paramCharSequence == null) || (isEmpty(paramCharSequence))) { /* 6137 */ return false; /* */ } /* 6139 */ int i = paramCharSequence.length(); /* 6140 */ for (int j = 0; j < i; j++) { /* 6141 */ if (!Character.isLowerCase(paramCharSequence.charAt(j))) { /* 6142 */ return false; /* */ } /* */ } /* 6145 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean isAllUpperCase(CharSequence paramCharSequence) /* */ { /* 6168 */ if ((paramCharSequence == null) || (isEmpty(paramCharSequence))) { /* 6169 */ return false; /* */ } /* 6171 */ int i = paramCharSequence.length(); /* 6172 */ for (int j = 0; j < i; j++) { /* 6173 */ if (!Character.isUpperCase(paramCharSequence.charAt(j))) { /* 6174 */ return false; /* */ } /* */ } /* 6177 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String defaultString(String paramString) /* */ { /* 6199 */ return paramString == null ? "" : paramString; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String defaultString(String paramString1, String paramString2) /* */ { /* 6220 */ return paramString1 == null ? paramString2 : paramString1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static <T extends CharSequence> T defaultIfBlank(T paramT1, T paramT2) /* */ { /* 6242 */ return isBlank(paramT1) ? paramT2 : paramT1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static <T extends CharSequence> T defaultIfEmpty(T paramT1, T paramT2) /* */ { /* 6264 */ return isEmpty(paramT1) ? paramT2 : paramT1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String reverse(String paramString) /* */ { /* 6284 */ if (paramString == null) { /* 6285 */ return null; /* */ } /* 6287 */ return new StringBuilder(paramString).reverse().toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String reverseDelimited(String paramString, char paramChar) /* */ { /* 6310 */ if (paramString == null) { /* 6311 */ return null; /* */ } /* */ /* */ /* 6315 */ String[] arrayOfString = split(paramString, paramChar); /* 6316 */ ArrayUtils.reverse(arrayOfString); /* 6317 */ return join(arrayOfString, paramChar); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String abbreviate(String paramString, int paramInt) /* */ { /* 6354 */ return abbreviate(paramString, 0, paramInt); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String abbreviate(String paramString, int paramInt1, int paramInt2) /* */ { /* 6393 */ if (paramString == null) { /* 6394 */ return null; /* */ } /* 6396 */ if (paramInt2 < 4) { /* 6397 */ throw new IllegalArgumentException("Minimum abbreviation width is 4"); /* */ } /* 6399 */ if (paramString.length() <= paramInt2) { /* 6400 */ return paramString; /* */ } /* 6402 */ if (paramInt1 > paramString.length()) { /* 6403 */ paramInt1 = paramString.length(); /* */ } /* 6405 */ if (paramString.length() - paramInt1 < paramInt2 - 3) { /* 6406 */ paramInt1 = paramString.length() - (paramInt2 - 3); /* */ } /* 6408 */ String str = "..."; /* 6409 */ if (paramInt1 <= 4) { /* 6410 */ return paramString.substring(0, paramInt2 - 3) + "..."; /* */ } /* 6412 */ if (paramInt2 < 7) { /* 6413 */ throw new IllegalArgumentException("Minimum abbreviation width with offset is 7"); /* */ } /* 6415 */ if (paramInt1 + paramInt2 - 3 < paramString.length()) { /* 6416 */ return "..." + abbreviate(paramString.substring(paramInt1), paramInt2 - 3); /* */ } /* 6418 */ return "..." + paramString.substring(paramString.length() - (paramInt2 - 3)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String abbreviateMiddle(String paramString1, String paramString2, int paramInt) /* */ { /* 6451 */ if ((isEmpty(paramString1)) || (isEmpty(paramString2))) { /* 6452 */ return paramString1; /* */ } /* */ /* 6455 */ if ((paramInt >= paramString1.length()) || (paramInt < paramString2.length() + 2)) { /* 6456 */ return paramString1; /* */ } /* */ /* 6459 */ int i = paramInt - paramString2.length(); /* 6460 */ int j = i / 2 + i % 2; /* 6461 */ int k = paramString1.length() - i / 2; /* */ /* 6463 */ StringBuilder localStringBuilder = new StringBuilder(paramInt); /* 6464 */ localStringBuilder.append(paramString1.substring(0, j)); /* 6465 */ localStringBuilder.append(paramString2); /* 6466 */ localStringBuilder.append(paramString1.substring(k)); /* */ /* 6468 */ return localStringBuilder.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String difference(String paramString1, String paramString2) /* */ { /* 6502 */ if (paramString1 == null) { /* 6503 */ return paramString2; /* */ } /* 6505 */ if (paramString2 == null) { /* 6506 */ return paramString1; /* */ } /* 6508 */ int i = indexOfDifference(paramString1, paramString2); /* 6509 */ if (i == -1) { /* 6510 */ return ""; /* */ } /* 6512 */ return paramString2.substring(i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfDifference(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 6541 */ if (paramCharSequence1 == paramCharSequence2) { /* 6542 */ return -1; /* */ } /* 6544 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 6545 */ return 0; /* */ } /* */ /* 6548 */ for (int i = 0; (i < paramCharSequence1.length()) && (i < paramCharSequence2.length()); i++) { /* 6549 */ if (paramCharSequence1.charAt(i) != paramCharSequence2.charAt(i)) { /* */ break; /* */ } /* */ } /* 6553 */ if ((i < paramCharSequence2.length()) || (i < paramCharSequence1.length())) { /* 6554 */ return i; /* */ } /* 6556 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int indexOfDifference(CharSequence... paramVarArgs) /* */ { /* 6592 */ if ((paramVarArgs == null) || (paramVarArgs.length <= 1)) { /* 6593 */ return -1; /* */ } /* 6595 */ int i = 0; /* 6596 */ int j = 1; /* 6597 */ int k = paramVarArgs.length; /* 6598 */ int m = Integer.MAX_VALUE; /* 6599 */ int n = 0; /* */ /* */ /* */ /* */ /* 6604 */ for (int i1 = 0; i1 < k; i1++) { /* 6605 */ if (paramVarArgs[i1] == null) { /* 6606 */ i = 1; /* 6607 */ m = 0; /* */ } else { /* 6609 */ j = 0; /* 6610 */ m = Math.min(paramVarArgs[i1].length(), m); /* 6611 */ n = Math.max(paramVarArgs[i1].length(), n); /* */ } /* */ } /* */ /* */ /* 6616 */ if ((j != 0) || ((n == 0) && (i == 0))) { /* 6617 */ return -1; /* */ } /* */ /* */ /* 6621 */ if (m == 0) { /* 6622 */ return 0; /* */ } /* */ /* */ /* 6626 */ i1 = -1; /* 6627 */ for (int i2 = 0; i2 < m; i2++) { /* 6628 */ int i3 = paramVarArgs[0].charAt(i2); /* 6629 */ for (int i4 = 1; i4 < k; i4++) { /* 6630 */ if (paramVarArgs[i4].charAt(i2) != i3) { /* 6631 */ i1 = i2; /* 6632 */ break; /* */ } /* */ } /* 6635 */ if (i1 != -1) { /* */ break; /* */ } /* */ } /* */ /* 6640 */ if ((i1 == -1) && (m != n)) /* */ { /* */ /* */ /* 6644 */ return m; /* */ } /* 6646 */ return i1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String getCommonPrefix(String... paramVarArgs) /* */ { /* 6683 */ if ((paramVarArgs == null) || (paramVarArgs.length == 0)) { /* 6684 */ return ""; /* */ } /* 6686 */ int i = indexOfDifference(paramVarArgs); /* 6687 */ if (i == -1) /* */ { /* 6689 */ if (paramVarArgs[0] == null) { /* 6690 */ return ""; /* */ } /* 6692 */ return paramVarArgs[0]; } /* 6693 */ if (i == 0) /* */ { /* 6695 */ return ""; /* */ } /* */ /* 6698 */ return paramVarArgs[0].substring(0, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int getLevenshteinDistance(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 6741 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 6742 */ throw new IllegalArgumentException("Strings must not be null"); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 6762 */ int i = paramCharSequence1.length(); /* 6763 */ int j = paramCharSequence2.length(); /* */ /* 6765 */ if (i == 0) /* 6766 */ return j; /* 6767 */ if (j == 0) { /* 6768 */ return i; /* */ } /* */ /* 6771 */ if (i > j) /* */ { /* 6773 */ localObject1 = paramCharSequence1; /* 6774 */ paramCharSequence1 = paramCharSequence2; /* 6775 */ paramCharSequence2 = (CharSequence)localObject1; /* 6776 */ i = j; /* 6777 */ j = paramCharSequence2.length(); /* */ } /* */ /* 6780 */ Object localObject1 = new int[i + 1]; /* 6781 */ Object localObject2 = new int[i + 1]; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 6792 */ for (int k = 0; k <= i; k++) { /* 6793 */ localObject1[k] = k; /* */ } /* */ /* 6796 */ for (int m = 1; m <= j; m++) { /* 6797 */ int n = paramCharSequence2.charAt(m - 1); /* 6798 */ localObject2[0] = m; /* */ /* 6800 */ for (k = 1; k <= i; k++) { /* 6801 */ int i1 = paramCharSequence1.charAt(k - 1) == n ? 0 : 1; /* */ /* 6803 */ localObject2[k] = Math.min(Math.min(localObject2[(k - 1)] + 1, localObject1[k] + 1), localObject1[(k - 1)] + i1); /* */ } /* */ /* */ /* 6807 */ Object localObject3 = localObject1; /* 6808 */ localObject1 = localObject2; /* 6809 */ localObject2 = localObject3; /* */ } /* */ /* */ /* */ /* 6814 */ return localObject1[i]; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int getLevenshteinDistance(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 6850 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 6851 */ throw new IllegalArgumentException("Strings must not be null"); /* */ } /* 6853 */ if (paramInt < 0) { /* 6854 */ throw new IllegalArgumentException("Threshold must not be negative"); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 6901 */ int i = paramCharSequence1.length(); /* 6902 */ int j = paramCharSequence2.length(); /* */ /* */ /* 6905 */ if (i == 0) /* 6906 */ return j <= paramInt ? j : -1; /* 6907 */ if (j == 0) { /* 6908 */ return i <= paramInt ? i : -1; /* */ } /* */ /* 6911 */ if (i > j) /* */ { /* 6913 */ localObject1 = paramCharSequence1; /* 6914 */ paramCharSequence1 = paramCharSequence2; /* 6915 */ paramCharSequence2 = (CharSequence)localObject1; /* 6916 */ i = j; /* 6917 */ j = paramCharSequence2.length(); /* */ } /* */ /* 6920 */ Object localObject1 = new int[i + 1]; /* 6921 */ Object localObject2 = new int[i + 1]; /* */ /* */ /* */ /* 6925 */ int k = Math.min(i, paramInt) + 1; /* 6926 */ for (int m = 0; m < k; m++) { /* 6927 */ localObject1[m] = m; /* */ } /* */ /* */ /* 6931 */ Arrays.fill((int[])localObject1, k, localObject1.length, Integer.MAX_VALUE); /* 6932 */ Arrays.fill((int[])localObject2, Integer.MAX_VALUE); /* */ /* */ /* 6935 */ for (m = 1; m <= j; m++) { /* 6936 */ int n = paramCharSequence2.charAt(m - 1); /* 6937 */ localObject2[0] = m; /* */ /* */ /* 6940 */ int i1 = Math.max(1, m - paramInt); /* 6941 */ int i2 = m > Integer.MAX_VALUE - paramInt ? i : Math.min(i, m + paramInt); /* */ /* */ /* 6944 */ if (i1 > i2) { /* 6945 */ return -1; /* */ } /* */ /* */ /* 6949 */ if (i1 > 1) { /* 6950 */ localObject2[(i1 - 1)] = Integer.MAX_VALUE; /* */ } /* */ /* */ /* 6954 */ for (int i3 = i1; i3 <= i2; i3++) { /* 6955 */ if (paramCharSequence1.charAt(i3 - 1) == n) /* */ { /* 6957 */ localObject2[i3] = localObject1[(i3 - 1)]; /* */ } /* */ else { /* 6960 */ localObject2[i3] = (1 + Math.min(Math.min(localObject2[(i3 - 1)], localObject1[i3]), localObject1[(i3 - 1)])); /* */ } /* */ } /* */ /* */ /* 6965 */ Object localObject3 = localObject1; /* 6966 */ localObject1 = localObject2; /* 6967 */ localObject2 = localObject3; /* */ } /* */ /* */ /* */ /* 6972 */ if (localObject1[i] <= paramInt) { /* 6973 */ return localObject1[i]; /* */ } /* 6975 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static double getJaroWinklerDistance(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7011 */ double d1 = 0.1D; /* */ /* 7013 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 7014 */ throw new IllegalArgumentException("Strings must not be null"); /* */ } /* */ /* 7017 */ double d2 = score(paramCharSequence1, paramCharSequence2); /* 7018 */ int i = commonPrefixLength(paramCharSequence1, paramCharSequence2); /* 7019 */ double d3 = Math.round((d2 + 0.1D * i * (1.0D - d2)) * 100.0D) / 100.0D; /* */ /* 7021 */ return d3; /* */ } /* */ /* */ /* */ /* */ /* */ private static double score(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* */ String str1; /* */ /* */ /* */ String str2; /* */ /* */ /* 7035 */ if (paramCharSequence1.length() > paramCharSequence2.length()) { /* 7036 */ str1 = paramCharSequence1.toString().toLowerCase(); /* 7037 */ str2 = paramCharSequence2.toString().toLowerCase(); /* */ } else { /* 7039 */ str1 = paramCharSequence2.toString().toLowerCase(); /* 7040 */ str2 = paramCharSequence1.toString().toLowerCase(); /* */ } /* */ /* */ /* 7044 */ int i = str2.length() / 2 + 1; /* */ /* */ /* */ /* 7048 */ String str3 = getSetOfMatchingCharacterWithin(str2, str1, i); /* 7049 */ String str4 = getSetOfMatchingCharacterWithin(str1, str2, i); /* */ /* */ /* */ /* 7053 */ if ((str3.length() == 0) || (str4.length() == 0)) { /* 7054 */ return 0.0D; /* */ } /* */ /* */ /* */ /* 7059 */ if (str3.length() != str4.length()) { /* 7060 */ return 0.0D; /* */ } /* */ /* */ /* */ /* 7065 */ int j = transpositions(str3, str4); /* */ /* */ /* 7068 */ double d = (str3.length() / str2.length() + str4.length() / str1.length() + (str3.length() - j) / str3.length()) / 3.0D; /* */ /* */ /* */ /* 7072 */ return d; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String getSetOfMatchingCharacterWithin(CharSequence paramCharSequence1, CharSequence paramCharSequence2, int paramInt) /* */ { /* 7087 */ StringBuilder localStringBuilder1 = new StringBuilder(); /* 7088 */ StringBuilder localStringBuilder2 = new StringBuilder(paramCharSequence2); /* */ /* 7090 */ for (int i = 0; i < paramCharSequence1.length(); i++) { /* 7091 */ char c = paramCharSequence1.charAt(i); /* 7092 */ int j = 0; /* */ /* */ /* 7095 */ for (int k = Math.max(0, i - paramInt); (j == 0) && (k < Math.min(i + paramInt, paramCharSequence2.length())); k++) { /* 7096 */ if (localStringBuilder2.charAt(k) == c) { /* 7097 */ j = 1; /* 7098 */ localStringBuilder1.append(c); /* 7099 */ localStringBuilder2.setCharAt(k, '*'); /* */ } /* */ } /* */ } /* 7103 */ return localStringBuilder1.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static int transpositions(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7113 */ int i = 0; /* 7114 */ for (int j = 0; j < paramCharSequence1.length(); j++) { /* 7115 */ if (paramCharSequence1.charAt(j) != paramCharSequence2.charAt(j)) { /* 7116 */ i++; /* */ } /* */ } /* 7119 */ return i / 2; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static int commonPrefixLength(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7130 */ int i = getCommonPrefix(new String[] { paramCharSequence1.toString(), paramCharSequence2.toString() }).length(); /* */ /* */ /* 7133 */ return i > 4 ? 4 : i; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean startsWith(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7162 */ return startsWith(paramCharSequence1, paramCharSequence2, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean startsWithIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7188 */ return startsWith(paramCharSequence1, paramCharSequence2, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static boolean startsWith(CharSequence paramCharSequence1, CharSequence paramCharSequence2, boolean paramBoolean) /* */ { /* 7203 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 7204 */ return (paramCharSequence1 == null) && (paramCharSequence2 == null); /* */ } /* 7206 */ if (paramCharSequence2.length() > paramCharSequence1.length()) { /* 7207 */ return false; /* */ } /* 7209 */ return CharSequenceUtils.regionMatches(paramCharSequence1, paramBoolean, 0, paramCharSequence2, 0, paramCharSequence2.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean startsWithAny(CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7232 */ if ((isEmpty(paramCharSequence)) || (ArrayUtils.isEmpty(paramVarArgs))) { /* 7233 */ return false; /* */ } /* 7235 */ for (CharSequence localCharSequence : paramVarArgs) { /* 7236 */ if (startsWith(paramCharSequence, localCharSequence)) { /* 7237 */ return true; /* */ } /* */ } /* 7240 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean endsWith(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7270 */ return endsWith(paramCharSequence1, paramCharSequence2, false); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean endsWithIgnoreCase(CharSequence paramCharSequence1, CharSequence paramCharSequence2) /* */ { /* 7297 */ return endsWith(paramCharSequence1, paramCharSequence2, true); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static boolean endsWith(CharSequence paramCharSequence1, CharSequence paramCharSequence2, boolean paramBoolean) /* */ { /* 7312 */ if ((paramCharSequence1 == null) || (paramCharSequence2 == null)) { /* 7313 */ return (paramCharSequence1 == null) && (paramCharSequence2 == null); /* */ } /* 7315 */ if (paramCharSequence2.length() > paramCharSequence1.length()) { /* 7316 */ return false; /* */ } /* 7318 */ int i = paramCharSequence1.length() - paramCharSequence2.length(); /* 7319 */ return CharSequenceUtils.regionMatches(paramCharSequence1, paramBoolean, i, paramCharSequence2, 0, paramCharSequence2.length()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String normalizeSpace(String paramString) /* */ { /* 7364 */ if (paramString == null) { /* 7365 */ return null; /* */ } /* 7367 */ return WHITESPACE_PATTERN.matcher(trim(paramString)).replaceAll(" "); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static boolean endsWithAny(CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7389 */ if ((isEmpty(paramCharSequence)) || (ArrayUtils.isEmpty(paramVarArgs))) { /* 7390 */ return false; /* */ } /* 7392 */ for (CharSequence localCharSequence : paramVarArgs) { /* 7393 */ if (endsWith(paramCharSequence, localCharSequence)) { /* 7394 */ return true; /* */ } /* */ } /* 7397 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String appendIfMissing(String paramString, CharSequence paramCharSequence, boolean paramBoolean, CharSequence... paramVarArgs) /* */ { /* 7412 */ if ((paramString == null) || (isEmpty(paramCharSequence)) || (endsWith(paramString, paramCharSequence, paramBoolean))) { /* 7413 */ return paramString; /* */ } /* 7415 */ if ((paramVarArgs != null) && (paramVarArgs.length > 0)) { /* 7416 */ for (CharSequence localCharSequence : paramVarArgs) { /* 7417 */ if (endsWith(paramString, localCharSequence, paramBoolean)) { /* 7418 */ return paramString; /* */ } /* */ } /* */ } /* 7422 */ return paramString + paramCharSequence.toString(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String appendIfMissing(String paramString, CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7460 */ return appendIfMissing(paramString, paramCharSequence, false, paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String appendIfMissingIgnoreCase(String paramString, CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7498 */ return appendIfMissing(paramString, paramCharSequence, true, paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static String prependIfMissing(String paramString, CharSequence paramCharSequence, boolean paramBoolean, CharSequence... paramVarArgs) /* */ { /* 7513 */ if ((paramString == null) || (isEmpty(paramCharSequence)) || (startsWith(paramString, paramCharSequence, paramBoolean))) { /* 7514 */ return paramString; /* */ } /* 7516 */ if ((paramVarArgs != null) && (paramVarArgs.length > 0)) { /* 7517 */ for (CharSequence localCharSequence : paramVarArgs) { /* 7518 */ if (startsWith(paramString, localCharSequence, paramBoolean)) { /* 7519 */ return paramString; /* */ } /* */ } /* */ } /* 7523 */ return paramCharSequence.toString() + paramString; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String prependIfMissing(String paramString, CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7561 */ return prependIfMissing(paramString, paramCharSequence, false, paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String prependIfMissingIgnoreCase(String paramString, CharSequence paramCharSequence, CharSequence... paramVarArgs) /* */ { /* 7599 */ return prependIfMissing(paramString, paramCharSequence, true, paramVarArgs); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public static String toString(byte[] paramArrayOfByte, String paramString) /* */ throws UnsupportedEncodingException /* */ { /* 7619 */ return paramString != null ? new String(paramArrayOfByte, paramString) : new String(paramArrayOfByte, Charset.defaultCharset()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String toEncodedString(byte[] paramArrayOfByte, Charset paramCharset) /* */ { /* 7636 */ return new String(paramArrayOfByte, paramCharset != null ? paramCharset : Charset.defaultCharset()); /* */ } /* */ } /* Location: C:\Users\USUARIO\Desktop\spigot-1.8.8-R0.1-SNAPSHOT-latest.jar!\org\apache\commons\lang3\StringUtils.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
170,000
0.326424
0.2848
7,645
21.236887
22.137392
208
false
false
0
0
0
0
0
0
0.238718
false
false
3
1e73da59e58713e6435616c6bd02dd9a06805344
26,474,178,443,647
d520fb49027b6ffaef1ff23eb856bccec1dada2a
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/TeleOps/OutreachTeleOp.java
cc882923ff93f0eb72f02c99bc5d5740321bab4b
[ "BSD-3-Clause" ]
permissive
AdarshK1/ftc_app
https://github.com/AdarshK1/ftc_app
557dce8d13c6c15b4f7ae2eddd6327d177ee9da6
277cfcac4c4526b6ca4f6ec689a6012ebb6ddd5e
refs/heads/master
2021-01-24T18:59:50.632000
2017-02-10T23:13:03
2017-02-10T23:13:03
66,164,012
0
0
null
true
2016-08-20T19:19:12
2016-08-20T19:19:11
2016-08-20T01:16:20
2016-08-19T23:03:50
342,281
0
0
0
null
null
null
package org.firstinspires.ftc.teamcode.TeleOps; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.Servo; @Disabled @TeleOp(name="OutreachTeleOp", group="TeamCode") public class OutreachTeleOp extends OpMode{ DcMotor motor; // DcMotor fld; // DcMotor frd; // DcMotor bld; // DcMotor brd; // DcMotor spinnerRight; // DcMotor spinnerLeft; // DcMotor lift; // DcMotor shooter; // Servo tilt; // Servo push; int initialize = 0; int i = 0; double pos; /** * Constructor */ public OutreachTeleOp() { } /* * Code to run when the op mode is initialized goes here * * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#init() */ @Override public void init() { motor = hardwareMap.dcMotor.get("motor"); // brd = hardwareMap.dcMotor.get("brd"); // bld = hardwareMap.dcMotor.get("bld"); // bld.setDirection(DcMotor.Direction.REVERSE); // // frd = hardwareMap.dcMotor.get("frd"); // fld = hardwareMap.dcMotor.get("fld"); // fld.setDirection(DcMotor.Direction.REVERSE); // // spinnerRight = hardwareMap.dcMotor.get("rightSpinner"); // spinnerLeft = hardwareMap.dcMotor.get("leftSpinner"); // lift = hardwareMap.dcMotor.get("lift"); // tilt = hardwareMap.servo.get("tilt"); // shooter = hardwareMap.dcMotor.get("shooter"); // push = hardwareMap.servo.get("push"); } @Override public void loop() { // throttle: left_stick_y ranges from -1 to 1, where -1 is full up, and // 1 is full down // direction: left_stick_x ranges from -1 to 1, where -1 is full left // and 1 is full right float lefty = -gamepad1.left_stick_y; // write the values to the motors // if( gamepad1.left_stick_y != 0 || gamepad1.right_stick_y != 0) { // fld.setPower(gamepad1.left_stick_y); // bld.setPower(gamepad1.left_stick_y); // frd.setPower(gamepad1.right_stick_y); // brd.setPower(gamepad1.right_stick_y); // } // // else { // frd.setPower(0); // fld.setPower(0); // brd.setPower(0); // bld.setPower(0); // } if(gamepad1.left_stick_y !=0){ motor.setPower(gamepad1.left_stick_y); } else{ motor.setPower(0); } // if (gamepad1.x){ // lift.setPower(0.75); // } // else if (gamepad1.y){ // lift.setPower(-0.75); // } // else { // lift.setPower(0); // } // // if (gamepad1.a){ // shooter.setPower(1); // } // else{ // shooter.setPower(0); // } // // if (gamepad1.right_bumper){ // spinnerRight.setPower(-1); // spinnerLeft.setPower(1); // } // // else if (gamepad1.left_bumper){ // spinnerLeft.setPower(-1); // spinnerRight.setPower(1); // } // else { // spinnerLeft.setPower(0); // spinnerRight.setPower(0); // } // // if (gamepad1.dpad_up){ // if (tilt.getPosition() > 0.5) { // tilt.setPosition(tilt.getPosition() - 0.2); // } // } // else if (gamepad1.dpad_down){ // if (tilt.getPosition() < 0.95){ // tilt.setPosition(tilt.getPosition() + 0.2); // } // } // // if (gamepad1.dpad_left){ // push.setPosition(0.5); // } // // else if (gamepad1.dpad_right){ // push.setPosition(0.95); // } } /* * Code to run when the op mode is first disabled goes here * * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#stop() */ @Override public void stop() { // frd.setPower(0); // fld.setPower(0); // brd.setPower(0); // bld.setPower(0); motor.setPower(0); } /* * This method scales the joystick input so for low joystick values, the * scaled value is less than linear. This is to make it easier to drive * the robot more precisely at slower speeds. */ double scaleInput(double dVal) { double[] scaleArray = { 0.0, 0.05, 0.09, 0.10, 0.12, 0.15, 0.18, 0.24, 0.30, 0.36, 0.43, 0.50, 0.60, 0.72, 0.85, 0.85, 0.85 }; // get the corresponding index for the scaleInput array. int index = (int) (dVal * 16.0); if (index < 0) { index = -index; } else if (index > 16) { index = 16; } double dScale = 0.0; if (dVal < 0) { dScale = -scaleArray[index]; } else { dScale = scaleArray[index]; } return dScale; } }
UTF-8
Java
5,020
java
OutreachTeleOp.java
Java
[]
null
[]
package org.firstinspires.ftc.teamcode.TeleOps; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.Servo; @Disabled @TeleOp(name="OutreachTeleOp", group="TeamCode") public class OutreachTeleOp extends OpMode{ DcMotor motor; // DcMotor fld; // DcMotor frd; // DcMotor bld; // DcMotor brd; // DcMotor spinnerRight; // DcMotor spinnerLeft; // DcMotor lift; // DcMotor shooter; // Servo tilt; // Servo push; int initialize = 0; int i = 0; double pos; /** * Constructor */ public OutreachTeleOp() { } /* * Code to run when the op mode is initialized goes here * * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#init() */ @Override public void init() { motor = hardwareMap.dcMotor.get("motor"); // brd = hardwareMap.dcMotor.get("brd"); // bld = hardwareMap.dcMotor.get("bld"); // bld.setDirection(DcMotor.Direction.REVERSE); // // frd = hardwareMap.dcMotor.get("frd"); // fld = hardwareMap.dcMotor.get("fld"); // fld.setDirection(DcMotor.Direction.REVERSE); // // spinnerRight = hardwareMap.dcMotor.get("rightSpinner"); // spinnerLeft = hardwareMap.dcMotor.get("leftSpinner"); // lift = hardwareMap.dcMotor.get("lift"); // tilt = hardwareMap.servo.get("tilt"); // shooter = hardwareMap.dcMotor.get("shooter"); // push = hardwareMap.servo.get("push"); } @Override public void loop() { // throttle: left_stick_y ranges from -1 to 1, where -1 is full up, and // 1 is full down // direction: left_stick_x ranges from -1 to 1, where -1 is full left // and 1 is full right float lefty = -gamepad1.left_stick_y; // write the values to the motors // if( gamepad1.left_stick_y != 0 || gamepad1.right_stick_y != 0) { // fld.setPower(gamepad1.left_stick_y); // bld.setPower(gamepad1.left_stick_y); // frd.setPower(gamepad1.right_stick_y); // brd.setPower(gamepad1.right_stick_y); // } // // else { // frd.setPower(0); // fld.setPower(0); // brd.setPower(0); // bld.setPower(0); // } if(gamepad1.left_stick_y !=0){ motor.setPower(gamepad1.left_stick_y); } else{ motor.setPower(0); } // if (gamepad1.x){ // lift.setPower(0.75); // } // else if (gamepad1.y){ // lift.setPower(-0.75); // } // else { // lift.setPower(0); // } // // if (gamepad1.a){ // shooter.setPower(1); // } // else{ // shooter.setPower(0); // } // // if (gamepad1.right_bumper){ // spinnerRight.setPower(-1); // spinnerLeft.setPower(1); // } // // else if (gamepad1.left_bumper){ // spinnerLeft.setPower(-1); // spinnerRight.setPower(1); // } // else { // spinnerLeft.setPower(0); // spinnerRight.setPower(0); // } // // if (gamepad1.dpad_up){ // if (tilt.getPosition() > 0.5) { // tilt.setPosition(tilt.getPosition() - 0.2); // } // } // else if (gamepad1.dpad_down){ // if (tilt.getPosition() < 0.95){ // tilt.setPosition(tilt.getPosition() + 0.2); // } // } // // if (gamepad1.dpad_left){ // push.setPosition(0.5); // } // // else if (gamepad1.dpad_right){ // push.setPosition(0.95); // } } /* * Code to run when the op mode is first disabled goes here * * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#stop() */ @Override public void stop() { // frd.setPower(0); // fld.setPower(0); // brd.setPower(0); // bld.setPower(0); motor.setPower(0); } /* * This method scales the joystick input so for low joystick values, the * scaled value is less than linear. This is to make it easier to drive * the robot more precisely at slower speeds. */ double scaleInput(double dVal) { double[] scaleArray = { 0.0, 0.05, 0.09, 0.10, 0.12, 0.15, 0.18, 0.24, 0.30, 0.36, 0.43, 0.50, 0.60, 0.72, 0.85, 0.85, 0.85 }; // get the corresponding index for the scaleInput array. int index = (int) (dVal * 16.0); if (index < 0) { index = -index; } else if (index > 16) { index = 16; } double dScale = 0.0; if (dVal < 0) { dScale = -scaleArray[index]; } else { dScale = scaleArray[index]; } return dScale; } }
5,020
0.529084
0.502988
190
25.426315
21.010082
79
false
false
0
0
0
0
0
0
0.526316
false
false
3
491f095d1482ac2eb7f302f528ebde18797ebbc5
31,722,628,467,261
8e637f52160cd0eef44db930ab20c9d762cb4820
/study/src/main/java/com/study/sgl/androidstudy/FilePersistenceActivity.java
41ab75aadeedcd9daf81eac666eba4a540da0c9e
[]
no_license
review1/AndroidStudy
https://github.com/review1/AndroidStudy
90470b3c2afb64918095608b96f33509d7ba088e
3ba1c20fd0641836b6f75339d3b1a48e7e690511
refs/heads/master
2021-06-11T23:16:30.176000
2017-02-22T01:16:50
2017-02-22T01:16:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.study.sgl.androidstudy; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.EditText; import com.study.sgl.tools.base.BaseActivity; import com.study.sgl.tools.util.StringUtil; import com.study.sgl.tools.util.T; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class FilePersistenceActivity extends BaseActivity { private EditText name; private static final String FILE_NAME = "data"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_file_persistence); name = (EditText) findViewById(R.id.edit_name); String tempString = load(); if (!StringUtil.isEmpty(tempString)) { name.setText(tempString); name.setSelection(tempString.length()); T.s(this, "从文件中获取到了!"); } } /** * 从文件中读取 */ private String load() { FileInputStream fileInputStream; BufferedReader reader = null; StringBuilder stringBuilder = new StringBuilder(); try { fileInputStream = openFileInput(FILE_NAME); reader = new BufferedReader(new InputStreamReader(fileInputStream)); String line; while ((line = reader.readLine()) != null) { stringBuilder.append(line); } } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return stringBuilder.toString(); } /** * 保存到文件 */ public void save(View view) { FileOutputStream fileOutputStream; BufferedWriter writer = null; try { fileOutputStream = openFileOutput(FILE_NAME, MODE_PRIVATE); writer = new BufferedWriter(new OutputStreamWriter(fileOutputStream)); writer.write(name.getText().toString()); } catch (IOException e) { e.printStackTrace(); } finally { if (writer != null) { try { writer.close(); } catch (IOException e) { e.printStackTrace(); } } } } /** * 保存到 SharedPreferences */ public void saveToSP(View view) { SharedPreferences sp = getSharedPreferences(FILE_NAME, MODE_PRIVATE); sp.edit().putString("name", name.getText().toString()).apply(); } /** * 从 SharedPreferences 读取 */ public void readFromSP(View view) { SharedPreferences sp = getSharedPreferences(FILE_NAME, MODE_PRIVATE); T.s(this, sp.getString("name","null")); } }
UTF-8
Java
3,146
java
FilePersistenceActivity.java
Java
[]
null
[]
package com.study.sgl.androidstudy; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.EditText; import com.study.sgl.tools.base.BaseActivity; import com.study.sgl.tools.util.StringUtil; import com.study.sgl.tools.util.T; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class FilePersistenceActivity extends BaseActivity { private EditText name; private static final String FILE_NAME = "data"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_file_persistence); name = (EditText) findViewById(R.id.edit_name); String tempString = load(); if (!StringUtil.isEmpty(tempString)) { name.setText(tempString); name.setSelection(tempString.length()); T.s(this, "从文件中获取到了!"); } } /** * 从文件中读取 */ private String load() { FileInputStream fileInputStream; BufferedReader reader = null; StringBuilder stringBuilder = new StringBuilder(); try { fileInputStream = openFileInput(FILE_NAME); reader = new BufferedReader(new InputStreamReader(fileInputStream)); String line; while ((line = reader.readLine()) != null) { stringBuilder.append(line); } } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return stringBuilder.toString(); } /** * 保存到文件 */ public void save(View view) { FileOutputStream fileOutputStream; BufferedWriter writer = null; try { fileOutputStream = openFileOutput(FILE_NAME, MODE_PRIVATE); writer = new BufferedWriter(new OutputStreamWriter(fileOutputStream)); writer.write(name.getText().toString()); } catch (IOException e) { e.printStackTrace(); } finally { if (writer != null) { try { writer.close(); } catch (IOException e) { e.printStackTrace(); } } } } /** * 保存到 SharedPreferences */ public void saveToSP(View view) { SharedPreferences sp = getSharedPreferences(FILE_NAME, MODE_PRIVATE); sp.edit().putString("name", name.getText().toString()).apply(); } /** * 从 SharedPreferences 读取 */ public void readFromSP(View view) { SharedPreferences sp = getSharedPreferences(FILE_NAME, MODE_PRIVATE); T.s(this, sp.getString("name","null")); } }
3,146
0.586886
0.586886
111
26.891891
21.024803
82
false
false
0
0
0
0
0
0
0.486486
false
false
3
9b0edd9cc671a12bb8951d36cd8fd2b6ffd41380
5,119,601,052,753
d493ea81ba7eac08190e2daca69bc1e16db78945
/Unionpay/app/src/main/java/cn/basewin/unionpay/setting/CommuParmOtherAyt.java
a7dff3e52693429c7a593467ecdcc7224c8a8fae
[]
no_license
Innoverex/pos
https://github.com/Innoverex/pos
0a1ac9d26f179e92ea22ca7cca8dc29216b2c008
fbf5c4911dc45a8fcb874c6d0c01811e8a672134
refs/heads/master
2021-06-09T15:25:38.155000
2016-12-05T10:51:57
2016-12-05T10:51:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.basewin.unionpay.setting; import android.widget.CheckBox; import android.widget.EditText; import cn.basewin.unionpay.AppConfig; import cn.basewin.unionpay.R; import cn.basewin.unionpay.utils.SPTools; /** * 作者:lhc<br> * 创建时间:2016/7/26 17:35<br> * 描述:通讯参数设置-其他 */ public class CommuParmOtherAyt extends BaseSysSettingAty { private static final String TAG = CommuParmOtherAyt.class.getName(); /** * TPDU */ private static final String KEY_TPDU = TAG + "tpdu"; /** * 连接超时时间 */ private static final String KEY_CONNECT_TIME_OUT = TAG + "connect_time_out"; /** * 是否支持长链接 */ private static final String KEY_IF_SUPPORT_SOCKET = TAG + "if_support_socket"; /** * 是否支持长链接 */ private static final String KEY_IF_SUPPORT_SSL = TAG + "if_support_ssl"; /** * TPDU */ private EditText et_tpdu; /** * 连接超时时间 */ private EditText et_connect_time_out; /** * 是否支持长链接 */ private CheckBox cb_if_support_socket; /** * 是否支持SSL通讯 */ private CheckBox cb_if_support_ssl; private void initViews() { et_tpdu = (EditText) findViewById(R.id.et_tpdu); et_connect_time_out = (EditText) findViewById(R.id.et_connect_time_out); cb_if_support_socket = (CheckBox) findViewById(R.id.cb_if_support_socket); cb_if_support_ssl = (CheckBox) findViewById(R.id.cb_if_support_ssl); } private void initData() { et_tpdu.setText(getTPDU()); et_connect_time_out.setText(getTimeOut()); cb_if_support_socket.setChecked(getSupportSocket()); cb_if_support_ssl.setChecked(getSupportSSL()); } @Override public int getContentView() { return R.layout.activity_syssetting_commuparm_other; } @Override public String getAtyTitle() { return getString(R.string.tongxuncanshushezhi); } @Override public void afterSetContentView() { initViews(); initData(); } @Override public void save() { SPTools.set(KEY_TPDU, et_tpdu.getText().toString()); SPTools.set(KEY_CONNECT_TIME_OUT, et_connect_time_out.getText().toString()); SPTools.set(KEY_IF_SUPPORT_SOCKET, cb_if_support_socket.isChecked()); SPTools.set(KEY_IF_SUPPORT_SSL, cb_if_support_ssl.isChecked()); showModifyHint(); } public static String getTPDU() { return SPTools.get(KEY_TPDU, AppConfig.DEFAULT_VALUE_TPDU); } public static void setTPDU(String tpdu) { SPTools.set(KEY_TPDU, tpdu); } public static String getTimeOut() { return SPTools.get(KEY_CONNECT_TIME_OUT, AppConfig.DEFAULT_VALUE_CONNECT_TIME_OUT); } public static boolean getSupportSocket() { return SPTools.get(KEY_IF_SUPPORT_SOCKET, AppConfig.DEFAULT_VALUE_IF_SUPPORT_SOCKET); } public static boolean getSupportSSL() { return SPTools.get(KEY_IF_SUPPORT_SSL, AppConfig.DEFAULT_VALUE_IF_SUPPORT_SSL); } }
UTF-8
Java
3,127
java
CommuParmOtherAyt.java
Java
[ { "context": "ort cn.basewin.unionpay.utils.SPTools;\n\n/**\n * 作者:lhc<br>\n * 创建时间:2016/7/26 17:35<br>\n * 描述:通讯参数设置-其他\n ", "end": 227, "score": 0.9996562004089355, "start": 224, "tag": "USERNAME", "value": "lhc" } ]
null
[]
package cn.basewin.unionpay.setting; import android.widget.CheckBox; import android.widget.EditText; import cn.basewin.unionpay.AppConfig; import cn.basewin.unionpay.R; import cn.basewin.unionpay.utils.SPTools; /** * 作者:lhc<br> * 创建时间:2016/7/26 17:35<br> * 描述:通讯参数设置-其他 */ public class CommuParmOtherAyt extends BaseSysSettingAty { private static final String TAG = CommuParmOtherAyt.class.getName(); /** * TPDU */ private static final String KEY_TPDU = TAG + "tpdu"; /** * 连接超时时间 */ private static final String KEY_CONNECT_TIME_OUT = TAG + "connect_time_out"; /** * 是否支持长链接 */ private static final String KEY_IF_SUPPORT_SOCKET = TAG + "if_support_socket"; /** * 是否支持长链接 */ private static final String KEY_IF_SUPPORT_SSL = TAG + "if_support_ssl"; /** * TPDU */ private EditText et_tpdu; /** * 连接超时时间 */ private EditText et_connect_time_out; /** * 是否支持长链接 */ private CheckBox cb_if_support_socket; /** * 是否支持SSL通讯 */ private CheckBox cb_if_support_ssl; private void initViews() { et_tpdu = (EditText) findViewById(R.id.et_tpdu); et_connect_time_out = (EditText) findViewById(R.id.et_connect_time_out); cb_if_support_socket = (CheckBox) findViewById(R.id.cb_if_support_socket); cb_if_support_ssl = (CheckBox) findViewById(R.id.cb_if_support_ssl); } private void initData() { et_tpdu.setText(getTPDU()); et_connect_time_out.setText(getTimeOut()); cb_if_support_socket.setChecked(getSupportSocket()); cb_if_support_ssl.setChecked(getSupportSSL()); } @Override public int getContentView() { return R.layout.activity_syssetting_commuparm_other; } @Override public String getAtyTitle() { return getString(R.string.tongxuncanshushezhi); } @Override public void afterSetContentView() { initViews(); initData(); } @Override public void save() { SPTools.set(KEY_TPDU, et_tpdu.getText().toString()); SPTools.set(KEY_CONNECT_TIME_OUT, et_connect_time_out.getText().toString()); SPTools.set(KEY_IF_SUPPORT_SOCKET, cb_if_support_socket.isChecked()); SPTools.set(KEY_IF_SUPPORT_SSL, cb_if_support_ssl.isChecked()); showModifyHint(); } public static String getTPDU() { return SPTools.get(KEY_TPDU, AppConfig.DEFAULT_VALUE_TPDU); } public static void setTPDU(String tpdu) { SPTools.set(KEY_TPDU, tpdu); } public static String getTimeOut() { return SPTools.get(KEY_CONNECT_TIME_OUT, AppConfig.DEFAULT_VALUE_CONNECT_TIME_OUT); } public static boolean getSupportSocket() { return SPTools.get(KEY_IF_SUPPORT_SOCKET, AppConfig.DEFAULT_VALUE_IF_SUPPORT_SOCKET); } public static boolean getSupportSSL() { return SPTools.get(KEY_IF_SUPPORT_SSL, AppConfig.DEFAULT_VALUE_IF_SUPPORT_SSL); } }
3,127
0.637994
0.634341
109
26.623854
26.675003
93
false
false
0
0
0
0
0
0
0.422018
false
false
3
c78411f74a177de9b1d23c709941dda01c59a4ad
25,494,925,910,490
9683aa57873147e00c43f68db6fe7ab2b4db537d
/src/dao/StudentDao.java
7a22744a38fc8763c2a99892944a0cd074356658
[]
no_license
MobyusJava/StudentRegistrationDemo
https://github.com/MobyusJava/StudentRegistrationDemo
00f6bc9e61cc6254388f051727949c1b03ed157b
a3fbe4638af5cfa4fee57d2d5273b253883b55fb
refs/heads/master
2016-08-12T16:43:47.963000
2016-03-21T20:49:42
2016-03-21T20:49:42
53,351,079
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dao; import java.util.ArrayList; import java.util.List; import bean.StudentBean; /** * Simple Data Access Object containing the stored data * @author Stijn * */ public class StudentDao { private List<StudentBean> students; public StudentDao() { students = new ArrayList<StudentBean>(); } public List<StudentBean> getStudents() { return students; } public void setStudents(List<StudentBean> students) { this.students = students; } }
UTF-8
Java
490
java
StudentDao.java
Java
[ { "context": "cess Object containing the stored data\r\n * @author Stijn\r\n *\r\n */\r\npublic class StudentDao {\r\n\tprivate Lis", "end": 177, "score": 0.9973872900009155, "start": 172, "tag": "NAME", "value": "Stijn" } ]
null
[]
package dao; import java.util.ArrayList; import java.util.List; import bean.StudentBean; /** * Simple Data Access Object containing the stored data * @author Stijn * */ public class StudentDao { private List<StudentBean> students; public StudentDao() { students = new ArrayList<StudentBean>(); } public List<StudentBean> getStudents() { return students; } public void setStudents(List<StudentBean> students) { this.students = students; } }
490
0.685714
0.685714
27
16.148148
17.24272
55
false
false
0
0
0
0
0
0
0.777778
false
false
3
f7cce04418dced51f4d87ae92cee4180cb2a9fcf
4,483,945,889,943
a78cd3d549e259fcab39992642cb2052cb9fd15e
/app/src/main/java/com/example/mohamed/letschat/fragment/SplashFragment.java
b5498720d37ae22c8d100d06c138e9a9884e396a
[]
no_license
mohamedmabrouk582/LetsChat2
https://github.com/mohamedmabrouk582/LetsChat2
a4fb53d81dc3e65448c92d51f5709e9ebfa9c42d
4635bc8ddbbf3c97a95c553bead258969416fca2
refs/heads/master
2021-09-01T16:07:19.042000
2017-12-27T21:55:35
2017-12-27T21:55:35
111,341,822
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.mohamed.letschat.fragment; import android.os.Bundle; import android.os.Handler; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.mohamed.letschat.R; import com.example.mohamed.letschat.application.DataManger; import com.example.mohamed.letschat.application.MyApp; import com.example.mohamed.letschat.presenter.splash.SplashViewPresenter; import com.example.mohamed.letschat.view.SplashView; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DatabaseReference; /** * Created by mohamed mabrouk * 0201152644726 * on 19/11/2017. time :19:35 */ public class SplashFragment extends Fragment implements SplashView{ private View view; private FirebaseAuth mAuth; private SplashViewPresenter presenter; private DataManger dataManger; private DatabaseReference mDatabaseReference; public static SplashFragment newFragment(){ return new SplashFragment(); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view=inflater.inflate(R.layout.splash_frgment,container,false); ini(); new Handler().postDelayed(new Runnable() { @Override public void run() { selectActivity(); } },1000); return view; } private void ini(){ presenter=new SplashViewPresenter(getActivity()); presenter.attachView(this); mAuth=FirebaseAuth.getInstance(); dataManger=((MyApp) getActivity().getApplication()).getDataManger(); } @Override public void onStart() { super.onStart(); } @Override public void selectActivity() { FirebaseUser user=mAuth.getCurrentUser(); if (user!=null){ presenter.openHomeActivity(); }else { dataManger.clear(); presenter.openLoginActivity(); } getActivity().finish(); } }
UTF-8
Java
2,207
java
SplashFragment.java
Java
[ { "context": "ase.database.DatabaseReference;\n\n/**\n * Created by mohamed mabrouk\n * 0201152644726\n * on 19/11/2017. time :19:35\n ", "end": 741, "score": 0.9998517632484436, "start": 726, "tag": "NAME", "value": "mohamed mabrouk" } ]
null
[]
package com.example.mohamed.letschat.fragment; import android.os.Bundle; import android.os.Handler; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.mohamed.letschat.R; import com.example.mohamed.letschat.application.DataManger; import com.example.mohamed.letschat.application.MyApp; import com.example.mohamed.letschat.presenter.splash.SplashViewPresenter; import com.example.mohamed.letschat.view.SplashView; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DatabaseReference; /** * Created by <NAME> * 0201152644726 * on 19/11/2017. time :19:35 */ public class SplashFragment extends Fragment implements SplashView{ private View view; private FirebaseAuth mAuth; private SplashViewPresenter presenter; private DataManger dataManger; private DatabaseReference mDatabaseReference; public static SplashFragment newFragment(){ return new SplashFragment(); } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view=inflater.inflate(R.layout.splash_frgment,container,false); ini(); new Handler().postDelayed(new Runnable() { @Override public void run() { selectActivity(); } },1000); return view; } private void ini(){ presenter=new SplashViewPresenter(getActivity()); presenter.attachView(this); mAuth=FirebaseAuth.getInstance(); dataManger=((MyApp) getActivity().getApplication()).getDataManger(); } @Override public void onStart() { super.onStart(); } @Override public void selectActivity() { FirebaseUser user=mAuth.getCurrentUser(); if (user!=null){ presenter.openHomeActivity(); }else { dataManger.clear(); presenter.openLoginActivity(); } getActivity().finish(); } }
2,198
0.694155
0.680562
77
27.662338
23.064905
123
false
false
0
0
0
0
0
0
0.545455
false
false
3
e8261945234c8d7837f57cc274e630dd67569e3f
29,746,943,529,688
bf60b3bbac4f66eb4d54b5716310858f97e7967f
/mobile/src/main/java/me/calebjones/spacelaunchnow/common/BasePresenter.java
9183ba845b078fcbbe8f6aef5f879abc736da4d1
[ "MIT" ]
permissive
uusijani/SpaceLaunchNow-Android
https://github.com/uusijani/SpaceLaunchNow-Android
e03e691e40db24af7131f27c9f6565922a762395
c81077efeb2d66a4e80af03a3ef8a5679c0c4d5d
refs/heads/master
2020-04-02T14:32:20.835000
2018-10-20T20:35:00
2018-10-20T20:35:00
154,528,523
0
0
MIT
true
2018-10-24T15:53:03
2018-10-24T15:53:02
2018-10-20T20:35:08
2018-10-21T18:12:28
176,632
0
0
0
null
false
null
package me.calebjones.spacelaunchnow.common; public interface BasePresenter { void start(); }
UTF-8
Java
101
java
BasePresenter.java
Java
[ { "context": "package me.calebjones.spacelaunchnow.common;\n\npublic interface BasePres", "end": 21, "score": 0.9908914566040039, "start": 11, "tag": "USERNAME", "value": "calebjones" } ]
null
[]
package me.calebjones.spacelaunchnow.common; public interface BasePresenter { void start(); }
101
0.752475
0.752475
7
13.428572
16.851088
44
false
false
0
0
0
0
0
0
0.285714
false
false
3
623158519acf1da466b6844afb0e55b71cefffe8
8,478,265,482,108
ca030864a3a1c24be6b9d1802c2353da4ca0d441
/classes7.dex_source_from_JADX/com/facebook/livephotos/exoplayer/extractor/ogg/VorbisBitArray.java
6baaadb2cf9a5d66fabd01510fb7e70135e1fff9
[]
no_license
pxson001/facebook-app
https://github.com/pxson001/facebook-app
87aa51e29195eeaae69adeb30219547f83a5b7b1
640630f078980f9818049625ebc42569c67c69f7
refs/heads/master
2020-04-07T20:36:45.758000
2018-03-07T09:04:57
2018-03-07T09:04:57
124,208,458
4
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.facebook.livephotos.exoplayer.extractor.ogg; import com.facebook.livephotos.exoplayer.util.Assertions; /* compiled from: page_follow_success */ public final class VorbisBitArray { public final byte[] f7301a; private int f7302b; private int f7303c; private int f7304d; public VorbisBitArray(byte[] bArr) { this(bArr, bArr.length); } private VorbisBitArray(byte[] bArr, int i) { this.f7301a = bArr; this.f7302b = i * 8; } public final boolean m9073a() { return m9072a(1) == 1; } public final int m9072a(int i) { Assertions.m9297b(m9074b() + i <= this.f7302b); if (i == 0) { return 0; } long min; int i2; int i3; int i4; if (this.f7304d != 0) { min = Math.min(i, 8 - this.f7304d); i2 = (255 >>> (8 - min)) & (this.f7301a[this.f7303c] >>> this.f7304d); this.f7304d += min; if (this.f7304d == 8) { this.f7303c++; this.f7304d = 0; } } else { min = 0; i2 = 0; } if (i - min > 7) { int i5 = (i - min) / 8; i3 = i2; i2 = 0; while (i2 < i5) { long j = (long) i3; byte[] bArr = this.f7301a; int i6 = this.f7303c; this.f7303c = i6 + 1; min += 8; i2++; i3 = (int) (j | ((((long) bArr[i6]) & 255) << min)); } int i7 = min; i4 = i3; i3 = i7; } else { i3 = min; i4 = i2; } if (i > i3) { i2 = i - i3; i4 |= ((255 >>> (8 - i2)) & this.f7301a[this.f7303c]) << i3; this.f7304d += i2; } return i4; } public final void m9075b(int i) { Assertions.m9297b(m9074b() + i <= this.f7302b); this.f7303c += i / 8; this.f7304d += i % 8; if (this.f7304d > 7) { this.f7303c++; this.f7304d -= 8; } } public final int m9074b() { return (this.f7303c * 8) + this.f7304d; } }
UTF-8
Java
2,249
java
VorbisBitArray.java
Java
[]
null
[]
package com.facebook.livephotos.exoplayer.extractor.ogg; import com.facebook.livephotos.exoplayer.util.Assertions; /* compiled from: page_follow_success */ public final class VorbisBitArray { public final byte[] f7301a; private int f7302b; private int f7303c; private int f7304d; public VorbisBitArray(byte[] bArr) { this(bArr, bArr.length); } private VorbisBitArray(byte[] bArr, int i) { this.f7301a = bArr; this.f7302b = i * 8; } public final boolean m9073a() { return m9072a(1) == 1; } public final int m9072a(int i) { Assertions.m9297b(m9074b() + i <= this.f7302b); if (i == 0) { return 0; } long min; int i2; int i3; int i4; if (this.f7304d != 0) { min = Math.min(i, 8 - this.f7304d); i2 = (255 >>> (8 - min)) & (this.f7301a[this.f7303c] >>> this.f7304d); this.f7304d += min; if (this.f7304d == 8) { this.f7303c++; this.f7304d = 0; } } else { min = 0; i2 = 0; } if (i - min > 7) { int i5 = (i - min) / 8; i3 = i2; i2 = 0; while (i2 < i5) { long j = (long) i3; byte[] bArr = this.f7301a; int i6 = this.f7303c; this.f7303c = i6 + 1; min += 8; i2++; i3 = (int) (j | ((((long) bArr[i6]) & 255) << min)); } int i7 = min; i4 = i3; i3 = i7; } else { i3 = min; i4 = i2; } if (i > i3) { i2 = i - i3; i4 |= ((255 >>> (8 - i2)) & this.f7301a[this.f7303c]) << i3; this.f7304d += i2; } return i4; } public final void m9075b(int i) { Assertions.m9297b(m9074b() + i <= this.f7302b); this.f7303c += i / 8; this.f7304d += i % 8; if (this.f7304d > 7) { this.f7303c++; this.f7304d -= 8; } } public final int m9074b() { return (this.f7303c * 8) + this.f7304d; } }
2,249
0.427746
0.32948
87
24.850574
17.022318
82
false
false
0
0
0
0
0
0
0.609195
false
false
3
64f1799181d417ed4e86572bee023f252e641a9c
2,869,038,184,036
8b8180bfa5201a67b11426c236ddc4a406d0dce8
/site/components/src/main/java/scot/gov/www/beans/SpeechOrStatement.java
eebcce5a09c77428fa52a7dad4df7aba8bff0d75
[ "LicenseRef-scancode-proprietary-license", "MIT" ]
permissive
scottishgovernment/gov-scot
https://github.com/scottishgovernment/gov-scot
2aafbe4a43418bbc1590e74a68b77e85448a1981
cc4772a58980b4d8f58612fb6e063333c9ee51e6
refs/heads/master
2023-08-31T14:46:40.595000
2023-08-31T11:54:23
2023-08-31T11:54:23
127,297,372
6
8
MIT
false
2023-07-24T03:46:34
2018-03-29T13:42:22
2023-07-24T03:43:36
2023-07-24T03:46:33
19,214
4
6
9
Java
false
false
package scot.gov.www.beans; import org.hippoecm.hst.content.beans.Node; import org.onehippo.cms7.essentials.dashboard.annotations.HippoEssentialsGenerated; @HippoEssentialsGenerated(internalName = "govscot:SpeechOrStatement") @Node(jcrType = "govscot:SpeechOrStatement") public class SpeechOrStatement extends Publication { @HippoEssentialsGenerated(internalName = "govscot:location") public String getLocation() { return getSingleProperty("govscot:location"); } @HippoEssentialsGenerated(internalName = "govscot:speechDeliveredBy") public String getSpeechDeliveredBy() { return getSingleProperty("govscot:speechDeliveredBy"); } }
UTF-8
Java
674
java
SpeechOrStatement.java
Java
[]
null
[]
package scot.gov.www.beans; import org.hippoecm.hst.content.beans.Node; import org.onehippo.cms7.essentials.dashboard.annotations.HippoEssentialsGenerated; @HippoEssentialsGenerated(internalName = "govscot:SpeechOrStatement") @Node(jcrType = "govscot:SpeechOrStatement") public class SpeechOrStatement extends Publication { @HippoEssentialsGenerated(internalName = "govscot:location") public String getLocation() { return getSingleProperty("govscot:location"); } @HippoEssentialsGenerated(internalName = "govscot:speechDeliveredBy") public String getSpeechDeliveredBy() { return getSingleProperty("govscot:speechDeliveredBy"); } }
674
0.778932
0.777448
18
36.444443
27.831282
83
false
false
0
0
0
0
0
0
0.277778
false
false
3
2bef0876bdb4feefac3ad2f87c57d657b57ff9b9
20,255,065,801,741
c6a83b5bd25bcbd1a7dcb58cedabbba480698482
/src/com/example/Test/DisplayMessageActivity.java
191da8588d2d85e88158f2c4707ba22b1a1d7948
[]
no_license
tarassel/AndroidTest
https://github.com/tarassel/AndroidTest
567f9c0fa1c90724c5157b41469a774ac523aff6
757cf5b9fa2fe6a9148104d546d982d477c1bba3
refs/heads/master
2021-01-01T16:44:56.518000
2014-03-12T19:40:54
2014-03-12T19:40:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.Test; import android.app.Activity; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.MenuItem; import android.support.v4.app.NavUtils; import android.view.View; import android.widget.TextView; /** * Created by taras on 12.03.14. */ public class DisplayMessageActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.display_message); // Get the message from the intent Intent intent = getIntent(); String message = intent.getStringExtra(MyActivity.EXTRA_MESSAGE); View v = this.getCurrentFocus(); TextView textView = (TextView) findViewById(R.id.textView2); if (textView == null) { textView = new TextView(this); textView.setTextSize(40); textView.setText("Field not found"); setContentView(textView); } else { textView.setText(message); } // Make sure we're running on Honeycomb or higher to use ActionBar APIs if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // Show the Up button in the action bar. getActionBar().setDisplayHomeAsUpEnabled(true); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } }
UTF-8
Java
1,644
java
DisplayMessageActivity.java
Java
[ { "context": "import android.widget.TextView;\n\n/**\n * Created by taras on 12.03.14.\n */\npublic class DisplayMessageActiv", "end": 290, "score": 0.8761519193649292, "start": 285, "tag": "USERNAME", "value": "taras" } ]
null
[]
package com.example.Test; import android.app.Activity; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.MenuItem; import android.support.v4.app.NavUtils; import android.view.View; import android.widget.TextView; /** * Created by taras on 12.03.14. */ public class DisplayMessageActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.display_message); // Get the message from the intent Intent intent = getIntent(); String message = intent.getStringExtra(MyActivity.EXTRA_MESSAGE); View v = this.getCurrentFocus(); TextView textView = (TextView) findViewById(R.id.textView2); if (textView == null) { textView = new TextView(this); textView.setTextSize(40); textView.setText("Field not found"); setContentView(textView); } else { textView.setText(message); } // Make sure we're running on Honeycomb or higher to use ActionBar APIs if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // Show the Up button in the action bar. getActionBar().setDisplayHomeAsUpEnabled(true); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } }
1,644
0.636861
0.630779
55
28.90909
21.763416
79
false
false
0
0
0
0
0
0
0.436364
false
false
3
2ab6c1a15d4c16df8b885a253509f4dc80d5a13b
32,847,909,908,683
3d2e9b9b9c55a87b39f893a5b23ce8c2e94676c9
/src/Problem14.java
fce07db46325342b0d0c9fb414481b856d35bbc5
[]
no_license
jtfrank/ProjectEulerSolutions
https://github.com/jtfrank/ProjectEulerSolutions
54bd8a1caaf079d3b10c6a3b134397b4828a23d0
6ff0cb08f97c1da50f2b6a68f285b965111243c8
refs/heads/master
2021-01-10T19:01:44.166000
2017-06-23T05:00:26
2017-06-23T05:00:26
21,308,041
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; public class Problem14 { public static void main(String[] args) { long maxInt = 1000000; long longestLength = 1; long seedOfLongest = 1; ArrayList<Long> collatzMasterList = new ArrayList<Long>(); for(long i = 1; i < maxInt; i++){ long collatzLength = 0; long n = i; while(n >= i && n > 1){ if(n % 2 == 0){ n /= 2; collatzLength++; } else{ n = (3*n) + 1; collatzLength++; } } collatzLength += 1; if(n != 1) collatzLength += collatzMasterList.get((int)n-1) - 1; collatzMasterList.add(collatzLength); if(collatzLength > longestLength){ longestLength = collatzLength; seedOfLongest = i; } } System.out.println(seedOfLongest + " :: " + longestLength); } }
UTF-8
Java
790
java
Problem14.java
Java
[]
null
[]
import java.util.ArrayList; public class Problem14 { public static void main(String[] args) { long maxInt = 1000000; long longestLength = 1; long seedOfLongest = 1; ArrayList<Long> collatzMasterList = new ArrayList<Long>(); for(long i = 1; i < maxInt; i++){ long collatzLength = 0; long n = i; while(n >= i && n > 1){ if(n % 2 == 0){ n /= 2; collatzLength++; } else{ n = (3*n) + 1; collatzLength++; } } collatzLength += 1; if(n != 1) collatzLength += collatzMasterList.get((int)n-1) - 1; collatzMasterList.add(collatzLength); if(collatzLength > longestLength){ longestLength = collatzLength; seedOfLongest = i; } } System.out.println(seedOfLongest + " :: " + longestLength); } }
790
0.586076
0.556962
40
18.75
17.599361
67
false
false
0
0
0
0
0
0
3.025
false
false
3
c01ebb147cb56e09f1440addf62384b216a65135
27,006,754,380,518
1c4ccc889eaf05a4e40100b93a2bcd84462b4249
/mall/src/main/java/com/qingshop/mall/modules/mall/mapper/MallShipSetMapper.java
087e877370d578eb1910bf05150de9076e3f3679
[ "Apache-2.0" ]
permissive
deagle-z/bopufeng-mall
https://github.com/deagle-z/bopufeng-mall
4f025883895acc4ee047f239bde24c9a0a7a7547
6d22b44e5272be01d488ec4e43c4c53c42e1abc0
refs/heads/master
2023-08-04T19:31:23.051000
2021-09-23T12:43:46
2021-09-23T12:43:46
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.qingshop.mall.modules.mall.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.qingshop.mall.modules.mall.entity.MallShipSet; /** * 配送设置表 Mapper 接口 */ public interface MallShipSetMapper extends BaseMapper<MallShipSet> { }
UTF-8
Java
276
java
MallShipSetMapper.java
Java
[]
null
[]
package com.qingshop.mall.modules.mall.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.qingshop.mall.modules.mall.entity.MallShipSet; /** * 配送设置表 Mapper 接口 */ public interface MallShipSetMapper extends BaseMapper<MallShipSet> { }
276
0.79771
0.79771
11
22.818182
26.336349
68
false
false
0
0
0
0
0
0
0.272727
false
false
3
92df405e329090e2d52ee0816f117d55c48b53e7
2,448,131,389,130
4778e1bb475ad7f5a6761b4e56cf5cd964fc8ddc
/gameCenter/src/main/java/cn/lt/game/ui/app/jump/SpecialTopicListJumper.java
7f2f8e96a49a1b8525a1ee8ebf8ff3bba8116634
[]
no_license
bellmit/GameCenter
https://github.com/bellmit/GameCenter
7d766ca3435b1bc384f71eccd5d3601c83622f0b
fc59ff640f5324219bf7d9ec71c4433e5f2d09f8
refs/heads/master
2022-01-25T04:02:23.182000
2019-03-29T08:09:08
2019-03-29T08:09:08
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.lt.game.ui.app.jump; import android.content.Context; import android.util.Log; import cn.lt.game.lib.util.ActivityActionUtils; import cn.lt.game.ui.app.specialtopic.SpecialTopicActivity; /*** * Created by Administrator on 2015/12/14. */ public class SpecialTopicListJumper implements IJumper { @Override public void jump(Object o, Context context) { try { ActivityActionUtils.activity_jump(context, SpecialTopicActivity.class); } catch (Exception e) { Log.i("GOOD", "跳转异常-->" + this.getClass().getSimpleName()); e.printStackTrace(); } } }
UTF-8
Java
635
java
SpecialTopicListJumper.java
Java
[]
null
[]
package cn.lt.game.ui.app.jump; import android.content.Context; import android.util.Log; import cn.lt.game.lib.util.ActivityActionUtils; import cn.lt.game.ui.app.specialtopic.SpecialTopicActivity; /*** * Created by Administrator on 2015/12/14. */ public class SpecialTopicListJumper implements IJumper { @Override public void jump(Object o, Context context) { try { ActivityActionUtils.activity_jump(context, SpecialTopicActivity.class); } catch (Exception e) { Log.i("GOOD", "跳转异常-->" + this.getClass().getSimpleName()); e.printStackTrace(); } } }
635
0.671451
0.658692
23
26.26087
24.682713
83
false
false
0
0
0
0
0
0
0.478261
false
false
3
cc2657c09488642d9819ec53ce99fa08135dbf71
1,984,274,936,060
91398222b5e310959cb851d2279a3798c2a25155
/MailClient/filterDesign/src/filterdesign/Sender.java
47102b54b485106c0a00876dd437d90729dbc2e8
[]
no_license
lustigepepe/Public
https://github.com/lustigepepe/Public
e947a329901de79cac1116c1657d328fda22e880
57924ad56035ad1470c0fd3fd2a37f70e02577a8
refs/heads/master
2021-01-10T07:41:57.640000
2016-03-04T19:39:17
2016-03-04T19:39:17
53,133,989
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package filterdesign; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import common.filter.FilterOperator; import common.filter.StringCompareHelper; import common.mail.model.Message; public class Sender extends SimpleFilter { private final String toMatch; private final FilterOperator filterOperator; private final Collection<Message> messages; private Set<Message> sender; public Sender(String toMatch, FilterOperator filterOperator, Collection<Message> messages) { this.toMatch = toMatch; this.filterOperator = filterOperator; this.messages = messages; } @Override public String toString() { StringBuilder s = new StringBuilder(); for (Message i : filter(messages)) { s.append(i).append('\n'); } return this.getClass().getSimpleName() + ":\n" + s; } @Override public Set<Message> getSet() { return filter(messages); } @Override public Set<Message> filter(Iterable<Message> messagesToFilter) { sender = new HashSet<Message>(); try { for (Iterator<?> i = messagesToFilter.iterator(); i.hasNext();) { Message message = (Message) i.next(); String stringMessage = message.getSender().toString(); if (StringCompareHelper.matches(stringMessage, toMatch, filterOperator)) { sender.add(message); } } } catch (Exception e) { return null; } return sender; } }
UTF-8
Java
1,468
java
Sender.java
Java
[]
null
[]
package filterdesign; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import common.filter.FilterOperator; import common.filter.StringCompareHelper; import common.mail.model.Message; public class Sender extends SimpleFilter { private final String toMatch; private final FilterOperator filterOperator; private final Collection<Message> messages; private Set<Message> sender; public Sender(String toMatch, FilterOperator filterOperator, Collection<Message> messages) { this.toMatch = toMatch; this.filterOperator = filterOperator; this.messages = messages; } @Override public String toString() { StringBuilder s = new StringBuilder(); for (Message i : filter(messages)) { s.append(i).append('\n'); } return this.getClass().getSimpleName() + ":\n" + s; } @Override public Set<Message> getSet() { return filter(messages); } @Override public Set<Message> filter(Iterable<Message> messagesToFilter) { sender = new HashSet<Message>(); try { for (Iterator<?> i = messagesToFilter.iterator(); i.hasNext();) { Message message = (Message) i.next(); String stringMessage = message.getSender().toString(); if (StringCompareHelper.matches(stringMessage, toMatch, filterOperator)) { sender.add(message); } } } catch (Exception e) { return null; } return sender; } }
1,468
0.684605
0.684605
61
23.081966
22.37995
94
false
false
0
0
0
0
0
0
0.508197
false
false
3
0e64e7ee6b6b7e54b79fc12a00171636e65f9750
14,053,133,022,341
3e92c98ffe959a4b4c89c550e2f9640367110ded
/app/src/main/java/ie/wit/poland/fragments/AddFragment.java
5f3c3f438579192e16978173ed8bd1c889e9ea62
[]
no_license
kacper97/PlApp
https://github.com/kacper97/PlApp
e83df8753995313229820d25894e3c1252d65de8
b87f1bbe90f2d57ed2effb84b78507519f254d35
refs/heads/master
2020-04-20T19:44:01.036000
2019-04-29T23:10:34
2019-04-29T23:10:34
169,057,017
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ie.wit.poland.fragments; import android.content.Intent; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.RatingBar; import android.widget.Toast; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import com.shashank.sony.fancytoastlib.FancyToast; import java.io.IOException; import java.util.List; import ie.wit.poland.R; import ie.wit.poland.activities.Home; import ie.wit.poland.main.LandmarkApp; import ie.wit.poland.models.Landmark; public class AddFragment extends Fragment implements OnMapReadyCallback ,View.OnClickListener { private String landmarkName, landmarkDescription, location, dateVisited; private double price, ratingLandmark, ratingTransport, ratingFacility; private Button save; private EditText name, description, priceAdult, date, locate; private RatingBar rateLandmark, rateTransport, rateFacility; private LandmarkApp app = LandmarkApp.getInstance(); public AddFragment() { // Required empty public constructor } public static AddFragment newInstance() { AddFragment fragment = new AddFragment(); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_add, container, false); getActivity().setTitle(R.string.addALandmark); name = v.findViewById(R.id.addLandmarkName); description = v.findViewById(R.id.addDescription); priceAdult = v.findViewById(R.id.addLandmarkPrice); date = v.findViewById(R.id.addLandmarkDate); rateLandmark = v.findViewById(R.id.addRatingBarLandmark); rateTransport = v.findViewById(R.id.addRatingBarTransport); rateFacility = v.findViewById(R.id.addRatingBarFacilities); locate = v.findViewById(R.id.addLandmarkLocation); save = v.findViewById(R.id.addALandmarkBtn); save.setOnClickListener(this); return v; } public void onClick(View v) { landmarkName = name.getText().toString(); landmarkDescription = description.getText().toString(); try { price = Double.parseDouble(priceAdult.getText().toString()); } catch (NumberFormatException e) { price = 0.0; } location = locate.getText().toString(); ratingLandmark = rateLandmark.getRating(); ratingTransport = rateTransport.getRating(); ratingFacility = rateFacility.getRating(); dateVisited = date.getText().toString(); if ((landmarkName.length() > 0) && (landmarkDescription.length() > 0) && (priceAdult.length() > 0)) { Landmark l = new Landmark(app.FirebaseDB.mFBUserId,landmarkName, landmarkDescription, price, location, ratingLandmark, ratingTransport, ratingFacility, dateVisited, false,app.googlePhotoURL, app.googleToken,getAddressFromLocation(app.mCurrentLocation), app.mCurrentLocation.getLatitude(),app.mCurrentLocation.getLongitude()); app.FirebaseDB.addLandmark(l); FancyToast.makeText( this.getActivity(),"Added Successfully", Toast.LENGTH_LONG,FancyToast.INFO,true).show(); startActivity(new Intent(this.getActivity(), Home.class)); } else FancyToast.makeText( this.getActivity(), "You must Enter Something for " + "\'Name\', \'Description\', \'Price\', \'location\', \'dateVisited\'", Toast.LENGTH_SHORT,FancyToast.INFO,true).show(); } @Override public void onMapReady(GoogleMap googleMap) { googleMap.clear(); addLandmarks(app.landmarkList,googleMap); } public void addLandmarks(List<Landmark> list,GoogleMap mMap) { for(Landmark l : list) mMap.addMarker(new MarkerOptions() .position(new LatLng(l.marker.coords.latitude, l.marker.coords.longitude)) .title(l.landmarkName + " €" + l.price) .snippet(l.landmarkName + " " + l.location) .icon(BitmapDescriptorFactory.fromResource(R.drawable.logoapp))); } private String getAddressFromLocation( Location location ) { Geocoder geocoder = new Geocoder(getActivity()); String strAddress = ""; Address address; try { address = geocoder .getFromLocation(location.getLatitude(), location.getLongitude(), 1) .get(0); strAddress = address.getAddressLine(0) + " " + address.getAddressLine(1) + " " + address.getAddressLine(2); } catch (IOException e) { } return strAddress; } }
UTF-8
Java
5,557
java
AddFragment.java
Java
[ { "context": "oid.gms.maps.model.MarkerOptions;\nimport com.shashank.sony.fancytoastlib.FancyToast;\n\n\nimport java.io.I", "end": 800, "score": 0.5532989501953125, "start": 797, "tag": "USERNAME", "value": "ank" } ]
null
[]
package ie.wit.poland.fragments; import android.content.Intent; import android.location.Address; import android.location.Geocoder; import android.location.Location; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.RatingBar; import android.widget.Toast; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import com.shashank.sony.fancytoastlib.FancyToast; import java.io.IOException; import java.util.List; import ie.wit.poland.R; import ie.wit.poland.activities.Home; import ie.wit.poland.main.LandmarkApp; import ie.wit.poland.models.Landmark; public class AddFragment extends Fragment implements OnMapReadyCallback ,View.OnClickListener { private String landmarkName, landmarkDescription, location, dateVisited; private double price, ratingLandmark, ratingTransport, ratingFacility; private Button save; private EditText name, description, priceAdult, date, locate; private RatingBar rateLandmark, rateTransport, rateFacility; private LandmarkApp app = LandmarkApp.getInstance(); public AddFragment() { // Required empty public constructor } public static AddFragment newInstance() { AddFragment fragment = new AddFragment(); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_add, container, false); getActivity().setTitle(R.string.addALandmark); name = v.findViewById(R.id.addLandmarkName); description = v.findViewById(R.id.addDescription); priceAdult = v.findViewById(R.id.addLandmarkPrice); date = v.findViewById(R.id.addLandmarkDate); rateLandmark = v.findViewById(R.id.addRatingBarLandmark); rateTransport = v.findViewById(R.id.addRatingBarTransport); rateFacility = v.findViewById(R.id.addRatingBarFacilities); locate = v.findViewById(R.id.addLandmarkLocation); save = v.findViewById(R.id.addALandmarkBtn); save.setOnClickListener(this); return v; } public void onClick(View v) { landmarkName = name.getText().toString(); landmarkDescription = description.getText().toString(); try { price = Double.parseDouble(priceAdult.getText().toString()); } catch (NumberFormatException e) { price = 0.0; } location = locate.getText().toString(); ratingLandmark = rateLandmark.getRating(); ratingTransport = rateTransport.getRating(); ratingFacility = rateFacility.getRating(); dateVisited = date.getText().toString(); if ((landmarkName.length() > 0) && (landmarkDescription.length() > 0) && (priceAdult.length() > 0)) { Landmark l = new Landmark(app.FirebaseDB.mFBUserId,landmarkName, landmarkDescription, price, location, ratingLandmark, ratingTransport, ratingFacility, dateVisited, false,app.googlePhotoURL, app.googleToken,getAddressFromLocation(app.mCurrentLocation), app.mCurrentLocation.getLatitude(),app.mCurrentLocation.getLongitude()); app.FirebaseDB.addLandmark(l); FancyToast.makeText( this.getActivity(),"Added Successfully", Toast.LENGTH_LONG,FancyToast.INFO,true).show(); startActivity(new Intent(this.getActivity(), Home.class)); } else FancyToast.makeText( this.getActivity(), "You must Enter Something for " + "\'Name\', \'Description\', \'Price\', \'location\', \'dateVisited\'", Toast.LENGTH_SHORT,FancyToast.INFO,true).show(); } @Override public void onMapReady(GoogleMap googleMap) { googleMap.clear(); addLandmarks(app.landmarkList,googleMap); } public void addLandmarks(List<Landmark> list,GoogleMap mMap) { for(Landmark l : list) mMap.addMarker(new MarkerOptions() .position(new LatLng(l.marker.coords.latitude, l.marker.coords.longitude)) .title(l.landmarkName + " €" + l.price) .snippet(l.landmarkName + " " + l.location) .icon(BitmapDescriptorFactory.fromResource(R.drawable.logoapp))); } private String getAddressFromLocation( Location location ) { Geocoder geocoder = new Geocoder(getActivity()); String strAddress = ""; Address address; try { address = geocoder .getFromLocation(location.getLatitude(), location.getLongitude(), 1) .get(0); strAddress = address.getAddressLine(0) + " " + address.getAddressLine(1) + " " + address.getAddressLine(2); } catch (IOException e) { } return strAddress; } }
5,557
0.661206
0.659226
147
36.795918
27.926029
130
false
false
0
0
0
0
0
0
0.829932
false
false
3
a176a8a8198ca44b8048be14d96e22e84b5c0d1b
9,964,324,134,365
c00216fe86ab1a48425d861df244cc2c73b3ef73
/2019_09_20/src/Shape/Point.java
b8dde876f572c2aed1cff73d3fd630cbe3830a84
[]
no_license
yukudaa/University_Study
https://github.com/yukudaa/University_Study
c6a21f23d6e416499bf15c8d5914bca862aa4436
b12f2762221277d223f86849fc3dd500db762ad0
refs/heads/main
2023-07-03T07:47:58.643000
2021-08-08T03:09:47
2021-08-08T03:09:47
383,735,721
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Shape; public class Point { double x,y; }
UTF-8
Java
53
java
Point.java
Java
[]
null
[]
package Shape; public class Point { double x,y; }
53
0.679245
0.679245
6
7.833333
7.882823
20
false
false
0
0
0
0
0
0
0.666667
false
false
3
91646568f1f5c799275394c80221ba29f23054d6
24,094,766,571,573
4f457f0681d91b562e89879e34a8584bfd23b9f5
/kplike/src/main/java/com/kplike/library/util/ViewUtil.java
537607abc493a31e6c5897f4ec644abb13cad3da
[]
no_license
kaip121/kpframe
https://github.com/kaip121/kpframe
c8207393b35093f16bd6d4394d7dd5b616f1118d
4f86d9d9bb2a165834d9365ce563753b821f397d
refs/heads/master
2020-04-06T04:53:20.826000
2018-12-06T08:26:28
2018-12-06T08:26:28
73,798,344
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kplike.library.util; import android.app.Activity; import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.text.Spanned; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import java.io.IOException; import java.io.InputStream; public class ViewUtil { /** * 隐藏控件 * * @param activity * @param resourdIds */ public static void hide(Activity activity, int... resourdIds) { for (int id : resourdIds) { View view = activity.findViewById(id); if (view != null) { view.setVisibility(View.GONE); } } } /** * 隐藏控件 * @param parent * @param resourdIds */ public static void hide(View parent, int... resourdIds) { for (int id : resourdIds) { View view = parent.findViewById(id); if (view != null) { view.setVisibility(View.GONE); } } } /** * 显示控件 * @param activity * @param resourdIds */ public static void show(Activity activity, int... resourdIds) { for (int id : resourdIds) { View view = activity.findViewById(id); if (view != null) { view.setVisibility(View.VISIBLE); } } } /** * 显示控件 * @param parent * @param resourdIds */ public static void show(View parent, int... resourdIds) { for (int id : resourdIds) { View view = parent.findViewById(id); if (view != null) { view.setVisibility(View.VISIBLE); } } } /** * 设置TextView控件内容 * @param activity * @param textViewId * @param text */ public static void setText(Activity activity,int textViewId,String text){ TextView textView = (TextView)activity.findViewById(textViewId); if (textView!=null){ setText(textView,text); } } /** * 设置TextView控件内容 * @param activity * @param textViewId * @param text */ public static void setText(Activity activity,int textViewId,Spanned text){ TextView textView = (TextView)activity.findViewById(textViewId); if (textView!=null){ textView.setText(text); } } /** * 设置TextView控件内容 * @param v * @param textViewId * @param text */ public static void setText(View v,int textViewId,String text){ TextView textView = (TextView)v.findViewById(textViewId); if (textView!=null){ setText(textView,text); } } public static void setText(View v,int textViewId,Spanned text){ TextView textView = (TextView)v.findViewById(textViewId); if (textView!=null){ textView.setText(text); } } /** * 设置TextView控件内容 * @param textView * @param text */ public static void setText(TextView textView,String text){ textView.setText(text); } /** * 清空TextView * @param activity * @param resourdIds */ public static void clearText(Activity activity, int... resourdIds) { for (int id : resourdIds) { setText(activity, id, ""); } } /** * 获取TextView控件内容 * @param view * @return */ public static String getText(TextView view) { return view.getText().toString(); } /** * 获取TextView控件内容 * @param activity * @param viewId * @return */ public static String getText(Activity activity, int viewId) { return getText((TextView) activity.findViewById(viewId)); } /** * 获取TextView控件内容 * @param view * @param viewId * @return */ public static String getText(View view, int viewId) { return getText((TextView) view.findViewById(viewId)); } /** * 设置图片 * @param activity * @param resourdId * @param imgId */ public static void setImage(Activity activity, int resourdId, int imgId) { View view = activity.findViewById(resourdId); setImage(activity, view, imgId); } /** * 设置图片 * @param activity * @param view * @param imgId */ public static void setImage(Activity activity, View view, int imgId) { if (view != null) { view.setBackgroundResource(imgId); } } /** * 向TextView控件中追加内容 * @param activity * @param textViewId * @param value */ public static void append(Activity activity, int textViewId, String value) { TextView view = (TextView) activity.findViewById(textViewId); view.append(value); } /** * 向TextView控件中替换内容 * @param activity * @param textViewId * @param values */ public static void formatText(Activity activity, int textViewId, Object... values){ TextView view = (TextView) activity.findViewById(textViewId); String text = view.getText().toString(); view.setText(String.format(text, values)); } /** * 隐藏软键盘 * * @param activity */ public static void hideKeyboard(final Activity activity) { ((InputMethodManager) activity .getSystemService(Activity.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(activity.getWindow().getDecorView() .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } /** * 关闭输入法 * @param activity */ public static void hideInputMethod(final Activity activity){ ((InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow( activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } /** * 从Assets中读取图片 */ private static Bitmap getImageFromAssetsFile(Context context,String fileName) { Bitmap image = null; AssetManager am = context.getResources().getAssets(); try { InputStream is = am.open(fileName); image = BitmapFactory.decodeStream(is); is.close(); } catch (IOException e) { e.printStackTrace(); } return image; } /** * 切换控件的可见状态。 * @param activity * @param resoureId */ public static void toggle(Activity activity, int resoureId){ View v = activity.findViewById(resoureId); if (v.getVisibility() == View.VISIBLE){ v.setVisibility(View.GONE); } else { v.setVisibility(View.VISIBLE); } } /** * 切换控件的可见状态。 * @param parent * @param resoureId */ public static void toggle(View parent, int resoureId){ View v = parent.findViewById(resoureId); if (v.getVisibility() == View.VISIBLE){ v.setVisibility(View.GONE); } else { v.setVisibility(View.VISIBLE); } } /** * 隐藏控件 * @param views */ public static void hide(View... views) { for (View v : views) { v.setVisibility(View.GONE); } } /** * 显示控件 * @param views */ public static void show(View... views) { for (View v : views) { v.setVisibility(View.VISIBLE); } } /** * 切换控件的可见状态。 * @param views */ public static void toggle(View... views){ for (View v : views) { if (v.getVisibility() == View.VISIBLE){ v.setVisibility(View.GONE); } else { v.setVisibility(View.VISIBLE); } } } }
UTF-8
Java
6,994
java
ViewUtil.java
Java
[]
null
[]
package com.kplike.library.util; import android.app.Activity; import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.text.Spanned; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import java.io.IOException; import java.io.InputStream; public class ViewUtil { /** * 隐藏控件 * * @param activity * @param resourdIds */ public static void hide(Activity activity, int... resourdIds) { for (int id : resourdIds) { View view = activity.findViewById(id); if (view != null) { view.setVisibility(View.GONE); } } } /** * 隐藏控件 * @param parent * @param resourdIds */ public static void hide(View parent, int... resourdIds) { for (int id : resourdIds) { View view = parent.findViewById(id); if (view != null) { view.setVisibility(View.GONE); } } } /** * 显示控件 * @param activity * @param resourdIds */ public static void show(Activity activity, int... resourdIds) { for (int id : resourdIds) { View view = activity.findViewById(id); if (view != null) { view.setVisibility(View.VISIBLE); } } } /** * 显示控件 * @param parent * @param resourdIds */ public static void show(View parent, int... resourdIds) { for (int id : resourdIds) { View view = parent.findViewById(id); if (view != null) { view.setVisibility(View.VISIBLE); } } } /** * 设置TextView控件内容 * @param activity * @param textViewId * @param text */ public static void setText(Activity activity,int textViewId,String text){ TextView textView = (TextView)activity.findViewById(textViewId); if (textView!=null){ setText(textView,text); } } /** * 设置TextView控件内容 * @param activity * @param textViewId * @param text */ public static void setText(Activity activity,int textViewId,Spanned text){ TextView textView = (TextView)activity.findViewById(textViewId); if (textView!=null){ textView.setText(text); } } /** * 设置TextView控件内容 * @param v * @param textViewId * @param text */ public static void setText(View v,int textViewId,String text){ TextView textView = (TextView)v.findViewById(textViewId); if (textView!=null){ setText(textView,text); } } public static void setText(View v,int textViewId,Spanned text){ TextView textView = (TextView)v.findViewById(textViewId); if (textView!=null){ textView.setText(text); } } /** * 设置TextView控件内容 * @param textView * @param text */ public static void setText(TextView textView,String text){ textView.setText(text); } /** * 清空TextView * @param activity * @param resourdIds */ public static void clearText(Activity activity, int... resourdIds) { for (int id : resourdIds) { setText(activity, id, ""); } } /** * 获取TextView控件内容 * @param view * @return */ public static String getText(TextView view) { return view.getText().toString(); } /** * 获取TextView控件内容 * @param activity * @param viewId * @return */ public static String getText(Activity activity, int viewId) { return getText((TextView) activity.findViewById(viewId)); } /** * 获取TextView控件内容 * @param view * @param viewId * @return */ public static String getText(View view, int viewId) { return getText((TextView) view.findViewById(viewId)); } /** * 设置图片 * @param activity * @param resourdId * @param imgId */ public static void setImage(Activity activity, int resourdId, int imgId) { View view = activity.findViewById(resourdId); setImage(activity, view, imgId); } /** * 设置图片 * @param activity * @param view * @param imgId */ public static void setImage(Activity activity, View view, int imgId) { if (view != null) { view.setBackgroundResource(imgId); } } /** * 向TextView控件中追加内容 * @param activity * @param textViewId * @param value */ public static void append(Activity activity, int textViewId, String value) { TextView view = (TextView) activity.findViewById(textViewId); view.append(value); } /** * 向TextView控件中替换内容 * @param activity * @param textViewId * @param values */ public static void formatText(Activity activity, int textViewId, Object... values){ TextView view = (TextView) activity.findViewById(textViewId); String text = view.getText().toString(); view.setText(String.format(text, values)); } /** * 隐藏软键盘 * * @param activity */ public static void hideKeyboard(final Activity activity) { ((InputMethodManager) activity .getSystemService(Activity.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(activity.getWindow().getDecorView() .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } /** * 关闭输入法 * @param activity */ public static void hideInputMethod(final Activity activity){ ((InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow( activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } /** * 从Assets中读取图片 */ private static Bitmap getImageFromAssetsFile(Context context,String fileName) { Bitmap image = null; AssetManager am = context.getResources().getAssets(); try { InputStream is = am.open(fileName); image = BitmapFactory.decodeStream(is); is.close(); } catch (IOException e) { e.printStackTrace(); } return image; } /** * 切换控件的可见状态。 * @param activity * @param resoureId */ public static void toggle(Activity activity, int resoureId){ View v = activity.findViewById(resoureId); if (v.getVisibility() == View.VISIBLE){ v.setVisibility(View.GONE); } else { v.setVisibility(View.VISIBLE); } } /** * 切换控件的可见状态。 * @param parent * @param resoureId */ public static void toggle(View parent, int resoureId){ View v = parent.findViewById(resoureId); if (v.getVisibility() == View.VISIBLE){ v.setVisibility(View.GONE); } else { v.setVisibility(View.VISIBLE); } } /** * 隐藏控件 * @param views */ public static void hide(View... views) { for (View v : views) { v.setVisibility(View.GONE); } } /** * 显示控件 * @param views */ public static void show(View... views) { for (View v : views) { v.setVisibility(View.VISIBLE); } } /** * 切换控件的可见状态。 * @param views */ public static void toggle(View... views){ for (View v : views) { if (v.getVisibility() == View.VISIBLE){ v.setVisibility(View.GONE); } else { v.setVisibility(View.VISIBLE); } } } }
6,994
0.666419
0.666419
318
20.125786
20.388597
106
false
false
0
0
0
0
0
0
1.625786
false
false
3
f65a19c4f0ee1f1a53bf1c11814c63a649b9846a
24,094,766,573,475
1374eb0102b0bb17669819e17633f9bc14f197df
/src/main/java/net/sell17/easy/controller/response/TransactionDetailResp.java
98d6d568ad4e02ce95ddb49a895e8028ff507d48
[]
no_license
BroQi/easy
https://github.com/BroQi/easy
21d055c875fd0eb769afd3301e4ee666cf11df41
2c8f89092c9480692fd4ed1292ebe4e6a760b741
refs/heads/master
2018-09-19T21:19:34.395000
2017-07-26T09:22:39
2017-07-26T09:22:39
93,746,738
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.sell17.easy.controller.response; import net.sell17.easy.entity.TransactionDetail; import org.springframework.beans.BeanUtils; import java.math.BigDecimal; import java.util.Date; /** * Created by LiuQi on 2017/6/11. */ public class TransactionDetailResp { private BigDecimal amount; private Integer type; private Date createTime; private String orderNo; /** * 订单标题 */ private String productTitle; public TransactionDetailResp() { } public TransactionDetailResp(TransactionDetail detail) { BeanUtils.copyProperties(detail, this); } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getOrderNo() { return orderNo; } public void setOrderNo(String orderNo) { this.orderNo = orderNo; } public String getProductTitle() { return productTitle; } public void setProductTitle(String productTitle) { this.productTitle = productTitle; } }
UTF-8
Java
1,388
java
TransactionDetailResp.java
Java
[ { "context": "Decimal;\nimport java.util.Date;\n\n/**\n * Created by LiuQi on 2017/6/11.\n */\npublic class TransactionDetailR", "end": 216, "score": 0.9049007296562195, "start": 211, "tag": "NAME", "value": "LiuQi" } ]
null
[]
package net.sell17.easy.controller.response; import net.sell17.easy.entity.TransactionDetail; import org.springframework.beans.BeanUtils; import java.math.BigDecimal; import java.util.Date; /** * Created by LiuQi on 2017/6/11. */ public class TransactionDetailResp { private BigDecimal amount; private Integer type; private Date createTime; private String orderNo; /** * 订单标题 */ private String productTitle; public TransactionDetailResp() { } public TransactionDetailResp(TransactionDetail detail) { BeanUtils.copyProperties(detail, this); } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getOrderNo() { return orderNo; } public void setOrderNo(String orderNo) { this.orderNo = orderNo; } public String getProductTitle() { return productTitle; } public void setProductTitle(String productTitle) { this.productTitle = productTitle; } }
1,388
0.649275
0.641304
69
19
17.564787
60
false
false
0
0
0
0
0
0
0.318841
false
false
3
513ede66cac353950f461fa86c2507e515c905df
30,073,361,048,261
0f836a8f209eeb75013a78d76c7690d0904f4e52
/CmnObject/src/main/java/com/smartlib/cmnObject/util/AppUtil.java
6b49d3f3194aa89a8f291255cad5e0fe44482c45
[]
no_license
fengdejiyi/framework
https://github.com/fengdejiyi/framework
1b8f7ad92b0b3298373742791bbf4aa4469a8d11
e7492a4f805bf6f95b2f95bbdc98fdba2b51ad7b
HEAD
2017-04-23T08:31:28.086000
2016-09-20T09:34:23
2016-09-20T09:34:23
61,776,041
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.smartlib.cmnObject.util; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; /** * @author hewenwen * @description <app 的工具类> * @date 2016/4/24 */ public class AppUtil { /*** * 获取应用versionCode * * @param context * @return */ public static int getVersionCode(Context context) { try { PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return pi.versionCode; } catch (PackageManager.NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); return 0; } } /*** * 获取应用的VersionName * * @param context * @return */ public static String getVersionName(Context context) { try { PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return pi.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); return ""; } } }
UTF-8
Java
1,286
java
AppUtil.java
Java
[ { "context": "roid.content.pm.PackageManager;\r\n\r\n/**\r\n * @author hewenwen\r\n * @description <app 的工具类>\r\n * @date 2016/4/24\r\n", "end": 182, "score": 0.9996592402458191, "start": 174, "tag": "USERNAME", "value": "hewenwen" } ]
null
[]
package com.smartlib.cmnObject.util; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; /** * @author hewenwen * @description <app 的工具类> * @date 2016/4/24 */ public class AppUtil { /*** * 获取应用versionCode * * @param context * @return */ public static int getVersionCode(Context context) { try { PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return pi.versionCode; } catch (PackageManager.NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); return 0; } } /*** * 获取应用的VersionName * * @param context * @return */ public static String getVersionName(Context context) { try { PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); return pi.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); return ""; } } }
1,286
0.546032
0.538095
56
20.5
21.869743
101
false
false
0
0
0
0
0
0
0.25
false
false
3
87519569f8575d9605a7657bb47166f0dd59de6d
5,128,190,996,716
d71e60fc181515ba57f9e93377c19d7734947c10
/src/main/java/com/example/demo/config/AspectConfig.java
402901e2772390c513a9d62d57ec881e40cdd7f2
[ "Apache-2.0" ]
permissive
coderm520/jwtDemo
https://github.com/coderm520/jwtDemo
364576d0c0013fcbb0c44a2833258714a9049959
2f282877695300b918d3fd01a5a5fce06acc64c4
refs/heads/master
2022-11-21T05:11:17.246000
2019-12-17T06:36:11
2019-12-17T06:36:11
177,951,909
1
0
Apache-2.0
false
2022-11-16T11:37:33
2019-03-27T08:35:01
2019-12-17T06:38:35
2022-11-16T11:37:31
220
1
0
1
Java
false
false
package com.example.demo.config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; /** * @Description TODO * @Author m110266 * @Date 2019/4/11 17:54 **/ @Configuration @ComponentScan("com.example.demo.aspect") public class AspectConfig { }
UTF-8
Java
318
java
AspectConfig.java
Java
[ { "context": "onfiguration;\n\n/**\n * @Description TODO\n * @Author m110266\n * @Date 2019/4/11 17:54\n **/\n@Configuration\n@Com", "end": 200, "score": 0.9994698166847229, "start": 193, "tag": "USERNAME", "value": "m110266" } ]
null
[]
package com.example.demo.config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; /** * @Description TODO * @Author m110266 * @Date 2019/4/11 17:54 **/ @Configuration @ComponentScan("com.example.demo.aspect") public class AspectConfig { }
318
0.77673
0.72327
14
21.714285
19.919224
60
false
false
0
0
0
0
0
0
0.214286
false
false
3
6f76b626e788ddbe123adaa151c4b42ec1052508
11,398,843,210,702
5e270f39f541f354ae52cb6f3f26e2738b09c969
/mobilesafes/src/main/java/com/dashingqi/mobilesafe/broadcast/SmSBroadcast.java
0d56d6918d383539e69a44c88638815590357ead
[ "Apache-2.0" ]
permissive
dashingqi/mobilesafe
https://github.com/dashingqi/mobilesafe
7da6397166e8b78a63f8e443cca1cbc624c6259e
bcf3abf30bb7fadd8e23ce94b6e205a3034da148
refs/heads/master
2017-11-30T23:56:52.210000
2017-03-21T12:52:51
2017-03-21T12:52:51
81,910,116
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dashingqi.mobilesafe.broadcast; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.media.MediaPlayer; import android.telephony.SmsMessage; import com.dashingqi.mobilesafe.R; import com.dashingqi.mobilesafe.service.AlarmService; import com.dashingqi.mobilesafe.utils.SPUtils; import com.dashingqi.mobilesafe.view.ConstantValue; /** * Created by zhangqi on 2017/2/27. */ public class SmSBroadcast extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { //获取到手机防盗 是否开启的状态 boolean start_security = SPUtils.getBoolean(context, ConstantValue.START_SECURITY, false); //判断是否开启手机防盗功能 if (start_security) { //获取短信的内容 (一条短信可以分多条发送) Object[] pdus = (Object[]) intent.getExtras().get("pdus"); //将短信内容进行循环遍历 for (Object sms : pdus) { //获取短信对象 SmsMessage smsManage = SmsMessage.createFromPdu((byte[]) sms); //获取短信对象的基本信息 发送短信的地址 发送短信的内容 //短信的地址 String originatingAddress = smsManage.getOriginatingAddress(); //短信的内容 String messageBody = smsManage.getMessageBody(); //判断短信内容是否包含关键字 if (messageBody.contains("#*alarm*#")) { //播放音乐(准备音乐)h获取MediaPlayer对象 MediaPlayer mediaPlayer = MediaPlayer.create(context, R.raw.ylzs); //循环播放音乐 mediaPlayer.setLooping(true); //开启播放音乐 mediaPlayer.start(); } //判断短信是否包含关键字 if (messageBody.contains("#*location*#")) { //该功能 跟服务绑定 Intent intent1 = new Intent(context, AlarmService.class); context.startService(intent1); } //获取设备管理者的对象 DevicePolicyManager mDPM = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); if (messageBody.contains("#*lock*#")) { //一键锁屏 mDPM.lockNow(); } if (messageBody.contains("#*wipedata*#")){ //一鍵清除外部存储设备数据 mDPM.wipeData(DevicePolicyManager.WIPE_EXTERNAL_STORAGE); //一键清除手机内部存储数据 mDPM.wipeData(DevicePolicyManager.WIPE_RESET_PROTECTION_DATA); } } } } }
UTF-8
Java
2,998
java
SmSBroadcast.java
Java
[ { "context": ".mobilesafe.view.ConstantValue;\n\n/**\n * Created by zhangqi on 2017/2/27.\n */\n\npublic class SmSBroadcast exte", "end": 482, "score": 0.9993855357170105, "start": 475, "tag": "USERNAME", "value": "zhangqi" } ]
null
[]
package com.dashingqi.mobilesafe.broadcast; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.media.MediaPlayer; import android.telephony.SmsMessage; import com.dashingqi.mobilesafe.R; import com.dashingqi.mobilesafe.service.AlarmService; import com.dashingqi.mobilesafe.utils.SPUtils; import com.dashingqi.mobilesafe.view.ConstantValue; /** * Created by zhangqi on 2017/2/27. */ public class SmSBroadcast extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { //获取到手机防盗 是否开启的状态 boolean start_security = SPUtils.getBoolean(context, ConstantValue.START_SECURITY, false); //判断是否开启手机防盗功能 if (start_security) { //获取短信的内容 (一条短信可以分多条发送) Object[] pdus = (Object[]) intent.getExtras().get("pdus"); //将短信内容进行循环遍历 for (Object sms : pdus) { //获取短信对象 SmsMessage smsManage = SmsMessage.createFromPdu((byte[]) sms); //获取短信对象的基本信息 发送短信的地址 发送短信的内容 //短信的地址 String originatingAddress = smsManage.getOriginatingAddress(); //短信的内容 String messageBody = smsManage.getMessageBody(); //判断短信内容是否包含关键字 if (messageBody.contains("#*alarm*#")) { //播放音乐(准备音乐)h获取MediaPlayer对象 MediaPlayer mediaPlayer = MediaPlayer.create(context, R.raw.ylzs); //循环播放音乐 mediaPlayer.setLooping(true); //开启播放音乐 mediaPlayer.start(); } //判断短信是否包含关键字 if (messageBody.contains("#*location*#")) { //该功能 跟服务绑定 Intent intent1 = new Intent(context, AlarmService.class); context.startService(intent1); } //获取设备管理者的对象 DevicePolicyManager mDPM = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); if (messageBody.contains("#*lock*#")) { //一键锁屏 mDPM.lockNow(); } if (messageBody.contains("#*wipedata*#")){ //一鍵清除外部存储设备数据 mDPM.wipeData(DevicePolicyManager.WIPE_EXTERNAL_STORAGE); //一键清除手机内部存储数据 mDPM.wipeData(DevicePolicyManager.WIPE_RESET_PROTECTION_DATA); } } } } }
2,998
0.568913
0.565467
68
37.411766
25.404512
121
false
false
0
0
0
0
0
0
0.441176
false
false
10
06898999c9e8de65f18008fdf61a93658ba18e3b
7,438,883,365,938
aba53ff78917ee566914cfc985c70b8952f5fa27
/backend/src/main/java/pl/lodz/p/it/ssbd2021/ssbd01/mod/dto/request/EditPrescriptionRequestDto.java
1ecf52b1a2c3e0200518e31082e7e4b535a18580
[]
no_license
ZdrzalikPrzemyslaw/Dental-Clinic
https://github.com/ZdrzalikPrzemyslaw/Dental-Clinic
354eca2ae3e8355cf6155f677df7df06c1f96206
4d6c426ee2b0bde054bb8e1b07835bd6ff1e8500
refs/heads/master
2023-07-01T11:31:08.167000
2021-08-12T19:10:52
2021-08-12T19:10:52
393,636,748
1
1
null
true
2021-08-07T09:19:52
2021-08-07T09:19:52
2021-07-23T06:09:26
2021-07-20T15:45:19
2,857
0
0
0
null
false
false
package pl.lodz.p.it.ssbd2021.ssbd01.mod.dto.request; import pl.lodz.p.it.ssbd2021.ssbd01.common.I18n; import pl.lodz.p.it.ssbd2021.ssbd01.security.SignableEntity; import javax.json.bind.annotation.JsonbTransient; import javax.validation.constraints.NotNull; import java.util.LinkedHashMap; import java.util.Map; /** * Klasa dto dla edycji recepty. */ public class EditPrescriptionRequestDto implements SignableEntity { @NotNull(message = I18n.PRESCRIPTION_ID_NULL) private Long id; @NotNull(message = I18n.PRESCRIPTION_MEDICATIONS_NULL) private String medications; @NotNull(message = I18n.VERSION_NULL) private Long version; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getMedications() { return medications; } public void setMedications(String medications) { this.medications = medications; } public Long getVersion() { return version; } public void setVersion(Long version) { this.version = version; } @Override @JsonbTransient public Map<String, String> getPayload() { Map<String, String> map = new LinkedHashMap<>(); map.put("version", getVersion().toString()); map.put("id", getId().toString()); return map; } }
UTF-8
Java
1,350
java
EditPrescriptionRequestDto.java
Java
[]
null
[]
package pl.lodz.p.it.ssbd2021.ssbd01.mod.dto.request; import pl.lodz.p.it.ssbd2021.ssbd01.common.I18n; import pl.lodz.p.it.ssbd2021.ssbd01.security.SignableEntity; import javax.json.bind.annotation.JsonbTransient; import javax.validation.constraints.NotNull; import java.util.LinkedHashMap; import java.util.Map; /** * Klasa dto dla edycji recepty. */ public class EditPrescriptionRequestDto implements SignableEntity { @NotNull(message = I18n.PRESCRIPTION_ID_NULL) private Long id; @NotNull(message = I18n.PRESCRIPTION_MEDICATIONS_NULL) private String medications; @NotNull(message = I18n.VERSION_NULL) private Long version; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getMedications() { return medications; } public void setMedications(String medications) { this.medications = medications; } public Long getVersion() { return version; } public void setVersion(Long version) { this.version = version; } @Override @JsonbTransient public Map<String, String> getPayload() { Map<String, String> map = new LinkedHashMap<>(); map.put("version", getVersion().toString()); map.put("id", getId().toString()); return map; } }
1,350
0.667407
0.648148
57
22.68421
20.347126
67
false
false
0
0
0
0
0
0
0.421053
false
false
10
b12ff69feeb8feb5854160dfd8e47b88fcc3357d
18,356,690,292,402
1604603345d0dfccade236df9fd128990b61e42e
/jdk_study/src/main/java/simple/MapCopyTest.java
a0f1a8b7f4ed445b471fc3a4160fc1a399495c90
[]
no_license
Lowrry/my_study
https://github.com/Lowrry/my_study
60bafea8e227f4cc01f95101dba26c15b09c2892
74a46ece8366d8a79e9834165e2d4ea1e9642a95
refs/heads/master
2021-10-12T00:55:01.226000
2019-01-31T08:53:38
2019-01-31T08:53:38
115,987,763
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package simple; import java.util.HashMap; import java.util.Map; /** * User: luxiaochun<p/> * Date: 2017/8/16<p/> * Time: 20:35<p/> */ public class MapCopyTest { public static void main(String[] args) { Map<String,String> map = new HashMap<>(); map.put("1","2"); Map<String,String> map1 = new HashMap<>(map); map.clear(); System.out.println("map = " + map); System.out.println("map1 = " + map1); } }
UTF-8
Java
463
java
MapCopyTest.java
Java
[ { "context": ".util.HashMap;\nimport java.util.Map;\n\n/**\n * User: luxiaochun<p/>\n * Date: 2017/8/16<p/>\n * Time: 20:35<p/>\n */", "end": 89, "score": 0.9995951652526855, "start": 79, "tag": "USERNAME", "value": "luxiaochun" } ]
null
[]
package simple; import java.util.HashMap; import java.util.Map; /** * User: luxiaochun<p/> * Date: 2017/8/16<p/> * Time: 20:35<p/> */ public class MapCopyTest { public static void main(String[] args) { Map<String,String> map = new HashMap<>(); map.put("1","2"); Map<String,String> map1 = new HashMap<>(map); map.clear(); System.out.println("map = " + map); System.out.println("map1 = " + map1); } }
463
0.563715
0.529158
22
20.045454
17.258667
53
false
false
0
0
0
0
0
0
0.545455
false
false
10
124417c1ed29dffbe9c3bf4af13ad61b3468750d
16,123,307,290,672
020d217a305f547c759a2497652b890e094acc57
/outlier-detection-app/src/test/java/razvan/filip/outlierdetectionapp/outliers/OutlierServiceTest.java
09fc77e7e9177b8342a182a32ffc15d1faddf395
[]
no_license
razvandfilip/outlier-detection
https://github.com/razvandfilip/outlier-detection
a436a11aa8cf242c0df8745c9957aeb5111e4cff
584649b98972d0d22aefcefe390a56ecc04bd99c
refs/heads/master
2020-10-01T06:31:57.647000
2019-12-23T05:48:59
2019-12-23T05:48:59
227,479,128
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package razvan.filip.outlierdetectionapp.outliers; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.stubbing.Answer; import razvan.filip.outlierdetectionapp.entity.DataPoint; import razvan.filip.outlierdetectionapp.median.MedianCalculator; import razvan.filip.outlierdetectionapp.repository.DataPointRepository; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) public class OutlierServiceTest { @Mock private MedianCalculator medianCalculator; @Mock private DataPointRepository dataPointRepository; @InjectMocks private OutlierService outlierService; @Test public void testNoDataPoints() { String publisherId = "p1"; int windowSize = 10; when(dataPointRepository.getDataPointWindow(publisherId, windowSize)).thenReturn(Collections.emptyList()); List<DataPoint> outliers = outlierService.getOutliers(publisherId, windowSize); assertThat(outliers).isEmpty(); verify(dataPointRepository).getDataPointWindow(publisherId, windowSize); } @Test public void testFindOutliers() { String publisherId = "p1"; int windowSize = 10; List<DataPoint> dataPoints = generateDataPoints(publisherId, 3, 2, 1, 3, 10, 2); when(dataPointRepository.getDataPointWindow(publisherId, windowSize)).thenReturn(dataPoints); when(medianCalculator.median(any(), any())).thenAnswer(new Answer<Object>() { boolean firstCall = true; @Override public Object answer(InvocationOnMock invocation) throws Throwable { if (firstCall) { firstCall = false; return 2.5; } else { return 0.5; } } }); List<DataPoint> outliers = outlierService.getOutliers(publisherId, windowSize); verify(dataPointRepository).getDataPointWindow(publisherId, windowSize); verify(medianCalculator, times(2)).median(any(), any()); assertThat(outliers) .hasSize(1) .allMatch(dataPoint -> dataPoint.getDataValue() == 10.0); } private List<DataPoint> generateDataPoints(String publisherId, double... values) { return Arrays.stream(values) .mapToObj(value -> { DataPoint dataPoint = new DataPoint(); dataPoint.setPublisherId(publisherId); dataPoint.setDataValue(value); return dataPoint; }) .collect(Collectors.toList()); } }
UTF-8
Java
3,037
java
OutlierServiceTest.java
Java
[]
null
[]
package razvan.filip.outlierdetectionapp.outliers; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.stubbing.Answer; import razvan.filip.outlierdetectionapp.entity.DataPoint; import razvan.filip.outlierdetectionapp.median.MedianCalculator; import razvan.filip.outlierdetectionapp.repository.DataPointRepository; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) public class OutlierServiceTest { @Mock private MedianCalculator medianCalculator; @Mock private DataPointRepository dataPointRepository; @InjectMocks private OutlierService outlierService; @Test public void testNoDataPoints() { String publisherId = "p1"; int windowSize = 10; when(dataPointRepository.getDataPointWindow(publisherId, windowSize)).thenReturn(Collections.emptyList()); List<DataPoint> outliers = outlierService.getOutliers(publisherId, windowSize); assertThat(outliers).isEmpty(); verify(dataPointRepository).getDataPointWindow(publisherId, windowSize); } @Test public void testFindOutliers() { String publisherId = "p1"; int windowSize = 10; List<DataPoint> dataPoints = generateDataPoints(publisherId, 3, 2, 1, 3, 10, 2); when(dataPointRepository.getDataPointWindow(publisherId, windowSize)).thenReturn(dataPoints); when(medianCalculator.median(any(), any())).thenAnswer(new Answer<Object>() { boolean firstCall = true; @Override public Object answer(InvocationOnMock invocation) throws Throwable { if (firstCall) { firstCall = false; return 2.5; } else { return 0.5; } } }); List<DataPoint> outliers = outlierService.getOutliers(publisherId, windowSize); verify(dataPointRepository).getDataPointWindow(publisherId, windowSize); verify(medianCalculator, times(2)).median(any(), any()); assertThat(outliers) .hasSize(1) .allMatch(dataPoint -> dataPoint.getDataValue() == 10.0); } private List<DataPoint> generateDataPoints(String publisherId, double... values) { return Arrays.stream(values) .mapToObj(value -> { DataPoint dataPoint = new DataPoint(); dataPoint.setPublisherId(publisherId); dataPoint.setDataValue(value); return dataPoint; }) .collect(Collectors.toList()); } }
3,037
0.671386
0.664142
89
33.123596
27.967405
114
false
false
0
0
0
0
0
0
0.685393
false
false
10