blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
sequencelengths
1
1
author
stringlengths
0
161
0d933bbc86512cc1dafa0b428bc5d2ab5e397544
99075fce524971a6bd6c0ddd8385f8ce3c4e6445
/spring-hibernate-h2/src/main/java/com/company/controller/CompanyController.java
d2240abd200323fde1a25d8b68859e7fffb7c2e0
[]
no_license
piyushGithub01/spring
0f942cc8028e1c531aab0a49bf297e9266d33031
568e2d58ab9e4b822adbaa03d750712f298bb05d
refs/heads/master
2021-03-24T13:26:47.496664
2018-08-03T18:27:37
2018-08-03T18:27:37
109,301,084
0
0
null
null
null
null
UTF-8
Java
false
false
2,674
java
package com.company.controller; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.mvc.ControllerLinkBuilder; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import com.company.model.Company; import com.company.service.CompanyService; @RestController @RequestMapping("/company") public class CompanyController { @Autowired private CompanyService companyService; @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public @ResponseBody List<Company> getAll() { return companyService.getAll(); } @RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public @ResponseBody Company get(@PathVariable Long id) { return companyService.get(id); } @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public ResponseEntity<?> create(@RequestBody Company company) { companyService.create(company); HttpHeaders headers = new HttpHeaders(); ControllerLinkBuilder linkBuilder = linkTo(methodOn(CompanyController.class).get(company.getId())); headers.setLocation(linkBuilder.toUri()); return new ResponseEntity<>(headers, HttpStatus.CREATED); } @RequestMapping(method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public void update(@RequestBody Company company) { companyService.update(company); } @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public void delete(@PathVariable Long id) { companyService.delete(id); } }
3e955a33e332080047cf50932dfe7ea7a71275b5
8b43482f4272a45f0eb7763fc82211ffd0d4d7c4
/domain/BoardVO.java
456ccb60cac8daca888ad5212315d5c1eae8c294
[]
no_license
smc5720/Board-REST-API
e6b16367ce2daffe310d458c350d4c464f8094ad
20318965da674b5bc6113b29ecfaea329bbf463f
refs/heads/main
2023-06-15T11:26:59.197213
2021-07-13T01:46:38
2021-07-13T01:46:38
385,163,884
1
0
null
null
null
null
UTF-8
Java
false
false
995
java
package com.mincheol.fullstack.domain; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; @JsonInclude(JsonInclude.Include.NON_NULL) @Data // @JsonInclude(JsonInclude.Include.NON_NULL)은 JSON을 만들때 property가 null이면 만들지 말라는 의미이다. // @Data는 lombok 어노테이션으로, Setter 와 Getter를 자동으로 생성해준다. public class BoardVO { // request, response 시 JSON으로 데이터를 주고 받는데 Java에는 JSON이라는 데이터 타입이 없다. // 따라서 JSON과 매핑할 수 있는 객체를 생성하는데 그것을 VO 혹은 DTO라고 한다. // VO는 Virtual Object, DTO는 Data Transfer Object라고 모두 데이터를 담기 위한 객체이다. // JSON과 Java 객체 간의 매핑은 Jackson Mapper라는 3rd-party 라이브러리가 수행해준다. private Integer id; private String title; private String content; private String created; private String updated; }
246bd0f3750c2f5c619f8f59ab1735006ca1527e
37a011215389664e2d45479c690d9d6e6bb561f4
/task4/src/main/java/ua/netc/popov/task4/Connector.java
a4ee1c5c0dbb825aa2a06e52e2a1fc360e3751a3
[]
no_license
PopovSer/NetC
3166681b668c1578eb340aac2c29230bb8e9e4f7
f4ef7d6a235f625b87360f22e532923d99a49cb6
refs/heads/master
2016-09-06T13:18:14.516344
2014-01-05T10:23:22
2014-01-05T10:23:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,202
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ua.netc.popov.task4; import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ua.netc.popov.task4.exception.WrongDomainException; /** * * @author Ser */ public class Connector { private String url; private String domain; private Document doc; private static final String VALID_DOMAIN_REGEX = "^(https?://)?([a-zA-Z0-9\\.\\-\\?=_]+)/?"; private static final String EXC_WRONG_DOMAIN = "Wrong domain name"; private static final String EXC_URL_EMPTY = "URL is empty"; private static final String EXC_CAN_NOT_CONNECT = "Can't connect to server"; private static final Logger LOGGER = LoggerFactory.getLogger(Connector.class); public Connector(String url) throws WrongDomainException { this.url = url; if (url.isEmpty()) { throw new WrongDomainException(EXC_URL_EMPTY); } domain(); } private void domain() throws WrongDomainException { domain = new String(); Pattern pattern = Pattern.compile(VALID_DOMAIN_REGEX); Matcher matcher = pattern.matcher(url); if (matcher.find()) { String s1 = matcher.group(1); String s2 = matcher.group(2); if (matcher.group(1).isEmpty()) { url = "http://" + url; } domain = matcher.group(1) + matcher.group(2); } else { throw new WrongDomainException(domain + " is wrong"); } } public String getUrl() { return url; } public String getDomain() { return domain; } public Document connect() throws IOException, WrongDomainException { try { doc = Jsoup.connect(url).get(); return doc; } catch (IllegalArgumentException e) { throw new WrongDomainException(EXC_WRONG_DOMAIN); } catch (IOException e) { throw new IOException(EXC_CAN_NOT_CONNECT); } } }
ea61e1054a471ce8cc8055d63d433ef7b5c35967
aae7c6d7ac7e6fe83a711ecc5f8e6b073ad20a47
/src/main/java/com/meng/util/Lunar.java
fa227c22a21b35e77d871d5ca9fa92713a46b4fe
[]
no_license
zlmeng2/myspringboot
c8cf7d8a66ea6961ae1310c18d6479f1a829db56
fff5959a74741148b148e09b97681379e37e20a2
refs/heads/master
2020-03-18T19:13:14.868654
2018-08-22T16:36:32
2018-08-22T16:36:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,341
java
package com.meng.util; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Lunar { private int year; private int month; private int day; private boolean leap; final static String chineseNumber[] = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"}; static SimpleDateFormat chineseDateFormat = new SimpleDateFormat("yyyy年MM月dd日"); final static long[] lunarInfo = new long[] {0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, 0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0}; //====== 传回农历 y年的总天数 private static int yearDays(int y) { int i, sum = 348; for (i = 0x8000; i > 0x8; i >>= 1) { if ((lunarInfo[y - 1900] & i) != 0) sum += 1; } return (sum + leapDays(y)); } //====== 传回农历 y年闰月的天数 private static int leapDays(int y) { if (leapMonth(y) != 0) { if ((lunarInfo[y - 1900] & 0x10000) != 0) return 30; else return 29; } else return 0; } //====== 传回农历 y年闰哪个月 1-12 , 没闰传回 0 private static int leapMonth(int y) { return (int) (lunarInfo[y - 1900] & 0xf); } //====== 传回农历 y年m月的总天数 private static int monthDays(int y, int m) { if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0) return 29; else return 30; } //====== 传回农历 y年的生肖 public String animalsYear() { final String[] Animals = new String[]{"鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"}; return Animals[(year - 4) % 12]; } //====== 传入 月日的offset 传回干支, 0=甲子 private static String cyclicalm(int num) { final String[] Gan = new String[]{"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"}; final String[] Zhi = new String[]{"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"}; return (Gan[num % 10] + Zhi[num % 12]); } //====== 传入 offset 传回干支, 0=甲子 public String cyclical() { int num = year - 1900 + 36; return (cyclicalm(num)); } /** * 传出y年m月d日对应的农历. * yearCyl3:农历年与1864的相差数 ? * monCyl4:从1900年1月31日以来,闰月数 * dayCyl5:与1900年1月31日相差的天数,再加40 ? * * @param cal * @return */ public Lunar(Calendar cal) { int yearCyl, monCyl, dayCyl; int leapMonth = 0; Date baseDate = null; try { baseDate = chineseDateFormat.parse("1900年1月31日"); } catch (ParseException e) { e.printStackTrace(); //To change body of catch statement use Options | File Templates. } //求出和1900年1月31日相差的天数 int offset = (int) ((cal.getTime().getTime() - baseDate.getTime()) / 86400000L); dayCyl = offset + 40; monCyl = 14; //用offset减去每农历年的天数 // 计算当天是农历第几天 //i最终结果是农历的年份 //offset是当年的第几天 int iYear, daysOfYear = 0; for (iYear = 1900; iYear < 2050 && offset > 0; iYear++) { daysOfYear = yearDays(iYear); offset -= daysOfYear; monCyl += 12; } if (offset < 0) { offset += daysOfYear; iYear--; monCyl -= 12; } //农历年份 year = iYear; yearCyl = iYear - 1864; leapMonth = leapMonth(iYear); //闰哪个月,1-12 leap = false; //用当年的天数offset,逐个减去每月(农历)的天数,求出当天是本月的第几天 int iMonth, daysOfMonth = 0; for (iMonth = 1; iMonth < 13 && offset > 0; iMonth++) { //闰月 if (leapMonth > 0 && iMonth == (leapMonth + 1) && !leap) { --iMonth; leap = true; daysOfMonth = leapDays(year); } else daysOfMonth = monthDays(year, iMonth); offset -= daysOfMonth; //解除闰月 if (leap && iMonth == (leapMonth + 1)) leap = false; if (!leap) monCyl++; } //offset为0时,并且刚才计算的月份是闰月,要校正 if (offset == 0 && leapMonth > 0 && iMonth == leapMonth + 1) { if (leap) { leap = false; } else { leap = true; --iMonth; --monCyl; } } //offset小于0时,也要校正 if (offset < 0) { offset += daysOfMonth; --iMonth; --monCyl; } month = iMonth; day = offset + 1; } //获取农历日 public static String getChinaDayString(int day) { String chineseTen[] = {"初", "十", "廿", "卅"}; int n = day % 10 == 0 ? 9 : day % 10 - 1; if (day > 30) return ""; if (day == 10) return "初十"; else return chineseTen[day / 10] + chineseNumber[n]; } public String getChinaDateString(){ StringBuilder builder = new StringBuilder(); builder.append(this.year).append("-"); if(this.month < 10){ builder.append("0"); } builder.append(this.month).append("-"); if(this.day < 10){ builder.append("0"); } builder.append(this.day); return builder.toString(); } //获取农历年月日 public String toString() { return year + "年" + (leap ? "闰" : "") + chineseNumber[month - 1] + "月" + getChinaDayString(day); } public static void main(String[] args) throws Exception { Calendar cal=Calendar.getInstance(); cal.setTime(new SimpleDateFormat("yyyy-MM-dd").parse("1994-12-02")); // SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日"); // cal.setTimeZone(TimeZone.getDefault()); // System.out.println("公历日期:"+sdf.format(cal.getTime())); Lunar lunar=new Lunar(cal); // System.out.print("农历日期:"); // System.out.print(lunar.year+"年 "); // System.out.print(lunar.month+"月 "); // System.out.print(getChinaDayString(lunar.day)); // System.out.println("*************"); // System.out.println(lunar); // System.out.println("------------------"); System.out.println(lunar.getChinaDateString()); } }
[ "mzl123456" ]
mzl123456
1da667ba08639a1ab3e6af369d469c09aa4a4bb8
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XRENDERING-422-23-9-NSGA_II-WeightedSum:TestLen:CallDiversity/org/xwiki/rendering/wikimodel/xhtml/filter/AccumulationXMLFilter_ESTest_scaffolding.java
68ee992a2842b07f6f90b62d8628b7961089a506
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
468
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Thu Apr 02 13:36:20 UTC 2020 */ package org.xwiki.rendering.wikimodel.xhtml.filter; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class AccumulationXMLFilter_ESTest_scaffolding { // Empty scaffolding for empty test suite }
1cddd1011d74c0b2035dfd33231574ff3b580668
7c9072b5ca293f29b60acc5f9d7f14325cabc579
/cms-dao/src/main/java/com/design/cms/dao/entity/UserDesigner.java
e5f1dfd9c006d3a0befd2164cfa1e2bf9286b08b
[]
no_license
keepsilentc/designcmscode
4fc5434bdb3a363963648928f1bcfc1c1c24124d
caf2d10de03abfa43ed83d5d3b5624c898df1b04
refs/heads/master
2021-01-21T06:59:35.824437
2017-02-27T11:19:45
2017-02-27T11:19:45
83,302,001
0
0
null
null
null
null
UTF-8
Java
false
false
651
java
package com.design.cms.dao.entity; import java.io.Serializable; import java.util.Date; import lombok.Getter; import lombok.Setter; @Getter @Setter public class UserDesigner implements Serializable{ /** * */ private static final long serialVersionUID = 4504084689164992705L; /** * 用户号 */ private String userNo; /** * 设计师id */ private String designerId; /** * 是否点赞 * 1为是 * 0为否 */ private Integer isPraise; /** * 是否关注 * 1为是 * 0为否 */ private Integer isInterest; /** * 修改时间 */ private Date updateTime; /** * 创建时间 */ private Date createTime; }
8d076362182ef0ddc0e46957f99fa514375a4a0b
455deb80dd91382cbeb8f01f5bcb71f3d3f7888b
/app/src/main/java/com/diamond/SmartVoice/Controllers/Zipato/json/UiType.java
0e25a1fd1c67dace9625f9169abfae554c942ce5
[]
no_license
msoftware/SmartVoice
919a897b44db86b1b5354c0943a61ce6ad0f9abe
e1ceadced545110050d9b405193fc82940c09061
refs/heads/master
2021-10-01T19:08:15.719533
2018-11-28T18:00:05
2018-11-28T18:00:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
377
java
package com.diamond.SmartVoice.Controllers.Zipato.json; import com.google.gson.annotations.SerializedName; public class UiType { @SerializedName("link") private String link; @SerializedName("name") private String name; @SerializedName("endpointType") public String endpointType; @SerializedName("relativeUrl") private String relativeUrl; }
ec83c2cfe5bcaf01e79835a2c9dd07bf9d69cfc8
15f8ed8293ab83973aef140ab35a2076ba7218af
/src/test/java/page/Tabla.java
4b237a89442821d19c7ba03c3711556ba0a3fe3d
[]
no_license
EsperanzaQanova/QanovaTrabajos
462bf5622848ab7e03a5e781f268184e569291cf
b5fc0f7d77fe6cdc2957bbc0f4a733e334e00d2b
refs/heads/main
2023-03-27T21:48:48.716254
2021-03-31T21:53:48
2021-03-31T21:53:48
351,206,234
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package page; import Utils.DriverContext; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; public class Tabla { public Tabla(){ PageFactory.initElements(DriverContext.getDriver(), this); } @FindBy(xpath = "//*[@id=\"imMnMnNode4\"]/a/span/span/span[2]") WebElement Matriz; @FindBy(xpath = "//*[@id=\"pluginAppObj_4_01_filter_field\"]") WebElement IngresarDatos; @FindBy(xpath = "//*[@id=\"pluginAppObj_4_01_filter_button\"]") WebElement BuscarDatos; @FindBy(xpath = "//*[@id=\"pluginAppObj_4_01_jtable\"]/div/table/tbody") WebElement Tabla; public void BuscarDtos(String nombre)throws InterruptedException{ Matriz.click(); IngresarDatos.sendKeys(nombre); BuscarDatos.click(); } }
072c8ce7d754f04dd7b677baa808f53d0d252db9
d6568a8a854a9ce839878c33b28a5425d9159be6
/app_service/src/main/java/com/ample16/springcloud/app/controller/PermissionController.java
842df12940a67d1efeae212339ec901b9f657d7b
[]
no_license
KAKALZF/ample-super
80e7dccc5ee17f9b302f9482a692c5391492ca37
3164c4d441eb7e4ae1d5ec180f26ef652cd4ac27
refs/heads/master
2020-04-11T10:48:41.306528
2019-01-08T06:32:40
2019-01-08T06:32:40
161,726,878
0
0
null
null
null
null
UTF-8
Java
false
false
1,380
java
package com.ample16.springcloud.app.controller; import com.ample16.common.Response; import com.ample16.common.entity.Permission; import com.ample16.springcloud.app.service.PermissionService; import com.ample16.springcloud.app.service.serviceimpl.RequiredPermission; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/perm") public class PermissionController { @Autowired private PermissionService permissionService; @PostMapping("/save") @RequiredPermission(value = "loadPerm", des = "权限加载") @ApiOperation(value = "权限加载") public Response save() { permissionService.save(); return Response.successResposne(); } @DeleteMapping("/delete") @ApiOperation(value = "权限删除") @RequiredPermission(value = "delete", des = "权限删除") public Response delete(Long id) { permissionService.delete(id); return Response.successResposne(); } @GetMapping("/findAll") @RequiredPermission(value = "findAll", des = "查询所有权限") @ApiOperation(value = "权限列表") public Response<List<Permission>> findAll() { return Response.successResposne().setData(permissionService.findAll()); } }
d561106b6a68af4c3b61fe37839dab0df0f65f53
dcd5083713418eb150609bc9e16e39cdfa732090
/mDrug/src/com/mordrum/mdrug/api/DrugTemplate.java
485a214bd2d694f20a98479fe52f5e594409d92c
[]
no_license
ShadeSLYR/Mordrum
be348c2a2fbff4be7223b74c8b0c39025d01e51b
1550c6d3f29b4d68356714f40cfdcf02a9370950
refs/heads/master
2021-01-15T19:58:52.184094
2013-08-02T03:13:04
2013-08-02T03:13:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,539
java
package com.mordrum.mdrug.api; import com.mordrum.mdrug.util.ProductionStep; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffectType; import java.util.HashMap; import java.util.Map; /** * Created with IntelliJ IDEA. * User: Jesse * Date: 5/11/13 * Time: 5:27 PM */ public class DrugTemplate { //The name of the drug private String name; //The data needed to give the drug an item/icon private Material iconMaterial; private Short iconData = 0; //The three positive effects that this drug is capable of providing private PotionEffectType positiveEffect1; private PotionEffectType positiveEffect2; private PotionEffectType positiveEffect3; //The three negative effects that this drug is capable of providing private PotionEffectType negativeEffect1; private PotionEffectType negativeEffect2; private PotionEffectType negativeEffect3; //The dosages required to gain each positive effect private int minimumDose1; private int minimumDose2; private int minimumDose3; //The dosages required to gain each negative effect private int overDose1; private int overDose2; private int overDose3; //The dose that will kill the player private int overDose4; //The ingredients for the drug (if an ingredient is undefined, then it and the ones above it are not needed) private ItemStack ingredients[]; //The steps needed to make the drug private ProductionStep steps[]; private int effectDuration; public Map<String, Integer> playerDoses; public DrugTemplate(String name, Material iconMaterial, PotionEffectType positiveEffect1, ItemStack[] ingredients, ProductionStep[] steps) { this.name = name; this.iconMaterial = iconMaterial; this.positiveEffect1 = positiveEffect1; this.ingredients = ingredients; this.steps = steps; this.playerDoses = new HashMap<>(); } public DrugTemplate(DrugTemplate dt) { this.name = dt.name; this.iconMaterial = dt.iconMaterial; this.iconData = dt.iconData; this.positiveEffect1 = dt.positiveEffect1; this.positiveEffect2 = dt.positiveEffect2; this.positiveEffect3 = dt.positiveEffect3; this.negativeEffect1 = dt.negativeEffect1; this.negativeEffect2 = dt.negativeEffect2; this.negativeEffect3 = dt.negativeEffect3; this.minimumDose1 = dt.minimumDose1; this.minimumDose2 = dt.minimumDose2; this.minimumDose3 = dt.minimumDose3; this.overDose1 = dt.overDose1; this.overDose2 = dt.overDose2; this.overDose3 = dt.overDose3; this.overDose4 = dt.overDose4; this.ingredients = dt.ingredients; this.steps = dt.steps; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Material getIconMaterial() { return iconMaterial; } public void setIconMaterial(Material iconMaterial) { this.iconMaterial = iconMaterial; } public Short getIconData() { return iconData; } public void setIconData(Short iconData) { this.iconData = iconData; } public PotionEffectType getPositiveEffect1() { return positiveEffect1; } public void setPositiveEffect1(PotionEffectType positiveEffect1) { this.positiveEffect1 = positiveEffect1; } public PotionEffectType getPositiveEffect2() { return positiveEffect2; } public void setPositiveEffect2(PotionEffectType positiveEffect2) { this.positiveEffect2 = positiveEffect2; } public PotionEffectType getPositiveEffect3() { return positiveEffect3; } public void setPositiveEffect3(PotionEffectType positiveEffect3) { this.positiveEffect3 = positiveEffect3; } public PotionEffectType getNegativeEffect1() { return negativeEffect1; } public void setNegativeEffect1(PotionEffectType negativeEffect1) { this.negativeEffect1 = negativeEffect1; } public PotionEffectType getNegativeEffect2() { return negativeEffect2; } public void setNegativeEffect2(PotionEffectType negativeEffect2) { this.negativeEffect2 = negativeEffect2; } public PotionEffectType getNegativeEffect3() { return negativeEffect3; } public void setNegativeEffect3(PotionEffectType negativeEffect3) { this.negativeEffect3 = negativeEffect3; } public int getMinimumDose1() { return minimumDose1; } public void setMinimumDose1(int minimumDose1) { this.minimumDose1 = minimumDose1; } public int getMinimumDose2() { return minimumDose2; } public void setMinimumDose2(int minimumDose2) { this.minimumDose2 = minimumDose2; } public int getMinimumDose3() { return minimumDose3; } public void setMinimumDose3(int minimumDose3) { this.minimumDose3 = minimumDose3; } public int getOverDose1() { return overDose1; } public void setOverDose1(int overDose1) { this.overDose1 = overDose1; } public int getOverDose2() { return overDose2; } public void setOverDose2(int overDose2) { this.overDose2 = overDose2; } public int getOverDose3() { return overDose3; } public void setOverDose3(int overDose3) { this.overDose3 = overDose3; } public int getOverDose4() { return overDose4; } public void setOverDose4(int overDose4) { this.overDose4 = overDose4; } public ItemStack[] getIngredients() { return ingredients; } public void setIngredients(ItemStack[] ingredients) { this.ingredients = ingredients; } public ProductionStep[] getSteps() { return steps; } public void setSteps(ProductionStep[] steps) { this.steps = steps; } public void setEffectDuration(int effectDuration) { this.effectDuration = effectDuration; } public int getEffectDuration() { return effectDuration; } }
15a755a16aa12ecdf02b6014bfabc4b1c66665c5
7c8c3d650cfdc3f2febfdb6b4d3c5404e12876f0
/jstl-el-templates/src/main/java/com/brentcroft/util/templates/jstl/tag/LoopTagStatus.java
64dffbe4e5c9a93bcde9ef737e8d62081f199596
[ "Apache-2.0" ]
permissive
brentcroft/test-driver
6a7cebc0b339a97174f5b8dd422bfb9c91b9687f
d1076e4d5c2772ae8627af0c0f911e5bc7882786
refs/heads/master
2021-09-28T10:15:27.462558
2018-11-16T19:57:34
2018-11-16T19:57:34
116,875,833
0
0
null
null
null
null
UTF-8
Java
false
false
2,084
java
package com.brentcroft.util.templates.jstl.tag; /** * * (see http://docs.oracle.com/javaee/6/api/javax/servlet/jsp/jstl/core/ * LoopTagStatus.html) * * @author ADobson * * @param <T> */ public class LoopTagStatus<T> { private final Integer begin; private final Integer end; private final Integer step; private int index = 0; private T current; public LoopTagStatus( Integer begin, Integer end, Integer step ) { this.begin = begin; this.end = end; this.step = step; // if ( begin != null ) { index = begin; } } public LoopTagStatus<T> withCurrent( T current ) { this.current = current; return this; } public void increment() { index++; } public void increment( Integer step ) { index = index + (step == null ? 1 : step); } // The item (from the collection) for the current round of iteration public T getCurrent() { return current; } // The zero-based index for the current round of iteration public int getIndex() { return index; } public int getCount() { return index + 1; } /** * Flag indicating whether the current round is the first pass through the * iteration. * * @return true if the current iteration is the first */ public boolean isFirst() { return begin == null ? index == 0 : ( index <= begin ); } /** * Flag indicating whether the current round is the last pass through the * iteration (or null if we don't know). * * @return null or boolean is last pass of iteration */ public Boolean isLast() { return end == null ? null : ( index >= end ); } Integer getBegin() { return begin; } Integer getEnd() { return end; } int getStep() { return step; } public void setIndex( Integer begin ) { index = ( begin == null ? 0 : begin ); } }
d4451179832a9d07b82be860d1bb29822654d357
5bd3eaf8e688fb20bd63a20a0a2e33331fdb2358
/src/com/bearsnake/koala/modules/elements/controls/AnalogMeterIndicator.java
98c15143b23e742b534304dd115b853758b7f222
[]
no_license
kduncan99/koala
09c33b38bdc4cfc37fb0fdd0956cb390a61de65c
6fd75258e32dea1db0919e856ab81f9c5ed0d209
refs/heads/master
2023-05-13T13:12:50.673591
2023-05-05T21:24:52
2023-05-05T21:24:52
233,270,627
0
0
null
null
null
null
UTF-8
Java
false
false
2,155
java
/* * Koala - Virtual Modular Synthesizer * Copyright (c) 2023 by Kurt Duncan - All Rights Reserved */ package com.bearsnake.koala.modules.elements.controls; import com.bearsnake.koala.CellDimensions; import com.bearsnake.koala.Koala; import com.bearsnake.koala.PixelDimensions; import com.bearsnake.koala.components.ui.meters.Meter; import com.bearsnake.koala.components.ui.meters.OrientationType; import com.bearsnake.koala.components.ui.meters.SelectableMeter; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; /** * A graphic indication of continuous values, ranging between the given ranges. * It is designed to be fit into a one-by-one cell. */ public class AnalogMeterIndicator extends UIControl { public AnalogMeterIndicator( final CellDimensions cellDimensions, final String legend, final Color color ) { super(cellDimensions, createMeterPane(cellDimensions, color), legend); } private static Pane createMeterPane( final CellDimensions cellDimensions, final Color color ) { var range = Koala.BIPOLAR_RANGE; var orientation = cellDimensions.getWidth() >= cellDimensions.getHeight() ? OrientationType.HORIZONTAL : OrientationType.VERTICAL; var tickPoints = new double[]{-1.0, -0.75, -0.5, -0.25, 0.0, 0.25, 0.5, 0.75, 1.0}; var labelPoints = new double[]{-1.0, 0.0, 1.0}; var labelFormat = "%4.1f"; var meterDim = new PixelDimensions(UIControl.determinePixelWidth(cellDimensions.getWidth()), UIControl.determineEntityHeight(cellDimensions.getHeight())); var meter = new SelectableMeter(meterDim, range, orientation, color, tickPoints, labelPoints, labelFormat); var pane = new Pane(); pane.getChildren().add(meter); return pane; } private Meter getMeter() { var pane = (Pane) getChildren().get(0); return (Meter) pane.getChildren().get(0); } // only to be invoked on the Application thread public void setValue( final double value ) { getMeter().setValue(value); } }
ab7753bd2b882f8c5f2161579e2b19e183e9444b
bf673b800aaaa182d5dd7d1ac17588d2ae0dfe77
/supermart-web/src/main/java/com/innova/smart/exceptions/UnauthorizedException.java
cfdd16a780cda9c1b7a5a2d79ae7c83f4ea14bd4
[]
no_license
dasn-TeraBundle/super-market
29692be13c88c52205dabf9346ec786a24b1f90f
f6a21f6f8bd33ae9a9120d217b0473eeef6f1024
refs/heads/master
2020-04-03T22:33:11.097811
2018-11-04T13:03:51
2018-11-04T13:03:51
155,606,418
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package com.innova.smart.exceptions; /** * Created by Nirupam on 03-11-2018. */ public class UnauthorizedException extends RuntimeException { public UnauthorizedException(String s) { super(s); } }
7ac149d3bccfe4ef3ece5012d56b6ecc87544044
1d4fb137beac4f999c474431dec7cdf7c7b43817
/FizzBuzz.java
5a39f72f74f7f6f1a320df7761e94f991ac0a3d5
[]
no_license
Kaiser211/JavaFun
db8674e248f4ca1565b14fbc76d8d4ec3828fb6a
66ad2e403c4b3db2e19fb6fd66527a290fa5a96b
refs/heads/master
2021-09-08T01:42:40.831690
2018-03-05T13:11:59
2018-03-05T13:11:59
116,582,738
0
0
null
null
null
null
UTF-8
Java
false
false
260
java
public class FizzBuzz { public String fizzBuzz(int num){ if(num %3 == 0 && num % 5 == 0){ return "FizzBuzz"; }else if (num % 3 == 0){ return "Fizz"; }else if (num % 5== 0) { return "Buzz"; }else { return String.valueOf(num); } } }
f37b1f3582879a8de54aea72d9a30694154acbc6
7225a81eaa2a56e993b8bf721cfb2801683fa19b
/example-api/src/main/java/com/test/dubbo/service/MathService.java
b7ea46d92b0ebbeb6d6b600b858ee284a508aff6
[]
no_license
ciweigg2/spring-boot-starter-dubbo-example
2252adc40e70e4cc7f26d56bf8649a827ef9d765
8002945f16ba9ec5531ca7b29c3917d9aeea73ba
refs/heads/master
2020-03-31T08:15:56.772385
2018-10-08T09:30:34
2018-10-08T09:30:34
152,052,076
1
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.test.dubbo.service; import java.util.List; import com.test.dubbo.model.User; public interface MathService { /** * 简单示例 * @param a * @param b * @return */ Integer add(Integer a,Integer b); /** * 复杂对象示例 * @param args * @return */ List<Object> toList(Object ... args); /** * 抛出异常测试 */ void throwThrowable(); User getUser(User user); }
08bc22ffe2a4559fe08ebaa0dfbb11a48290a150
eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3
/tags/2008-08-26/seasar2-2.4.28/seasar-benchmark/src/main/java/benchmark/many/b01/NullBean01065.java
399c93b5fb47f1c1364b82b11d11f678f7f2851c
[]
no_license
svn2github/s2container
54ca27cf0c1200a93e1cb88884eb8226a9be677d
625adc6c4e1396654a7297d00ec206c077a78696
refs/heads/master
2020-06-04T17:15:02.140847
2013-08-09T09:38:15
2013-08-09T09:38:15
10,850,644
0
1
null
null
null
null
UTF-8
Java
false
false
62
java
package benchmark.many.b01; public class NullBean01065 { }
[ "koichik@319488c0-e101-0410-93bc-b5e51f62721a" ]
koichik@319488c0-e101-0410-93bc-b5e51f62721a
0ad155edce7993c5afdd609b2b5f797221289c13
532bb51250c9582a8fdf39c9b5471a0c7067d55a
/src/main/java/com/lxb/service/TestService.java
c68ba27c86ab6ce157651bfde0fc6c4e96774ce5
[]
no_license
damumu1994/qwerasd
58e3a4aefed8cf391563bf6232e27b4b2fc037c7
bf42c2b11a4c92be2d3712970a02c41298236b16
refs/heads/master
2022-09-23T13:40:05.059609
2019-01-02T15:26:53
2019-01-02T15:26:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
204
java
package com.lxb.service; import com.lxb.model.Test; import java.util.List; /** * @Auther: lxb * @Date: 2018/12/25 0025 * @Description: */ public interface TestService { List<Test> getList(); }
0800712b496ac60d31ae25314b1be7cf7e74733d
8bdda30bbcea1990fb56c2a083ca2a5693ca9b13
/sources/com/google/android/gms/common/stats/zzd.java
01b1275000f39f3b2a81767f48d11d43ed124efe
[]
no_license
yusato0378/aa
b14e247470efaf28efcc847433eff4aeb7790be6
ffc764c33c6f423d8dd6b1837446583d96a67e05
refs/heads/master
2021-01-10T01:10:49.084058
2016-01-09T12:02:01
2016-01-09T12:02:01
49,321,731
1
0
null
null
null
null
UTF-8
Java
false
false
496
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) package com.google.android.gms.common.stats; public class zzd { public static int zzVq = 0; public static int zzVr = 1; public static int zzVs = 2; public static int zzVt = 4; public static int zzVu = 8; public static int zzVv = 16; public static int zzVw = 32; public static String zzVx = "WAKE_LOCK_KEY"; }
8824cb8b83281a3d131aa1294b811b4fd0844f74
0484c1d44849f2e562f3141a5051d53c31230e8a
/hw03-0036479998/src/main/java/hr/fer/zemris/optjava/dz3/RegresijaSustava.java
550bc0e5f24e1c77053074d5a313c57ca4f167d9
[]
no_license
lmark1/optjava
e6d0531acf64ddd9e1658a7130e07eb65ad85f0f
4f4526d234165cd006c59f1dffddab01eb1dd1a8
refs/heads/master
2022-12-27T07:17:49.001511
2020-10-13T22:46:55
2020-10-13T22:46:55
106,460,410
1
0
null
2020-10-13T22:46:56
2017-10-10T19:13:01
Java
UTF-8
Java
false
false
3,862
java
package hr.fer.zemris.optjava.dz3; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Random; import Jama.Matrix; import hr.fer.zemris.optjava.dz3.impl.BitVectorNeighbourhood; import hr.fer.zemris.optjava.dz3.impl.BitVectorSolution; import hr.fer.zemris.optjava.dz3.impl.DoubleArrayNormNeighbourhood; import hr.fer.zemris.optjava.dz3.impl.DoubleArraySolution; import hr.fer.zemris.optjava.dz3.impl.GeometricTempSchedule; import hr.fer.zemris.optjava.dz3.impl.NaturalBinaryDecoder; import hr.fer.zemris.optjava.dz3.impl.PassThroughDecoder; import hr.fer.zemris.optjava.dz3.impl.SystemFunction; /** * Accepts 2 arguments: * 1. path to file * 2. decimal / binary:{number} - number of bits for each varaible. * * @author lmark * */ public class RegresijaSustava { private final static Random random = new Random(); public static void main(String[] args) { if (args.length != 2) { System.out.println("2 arguments expected."); return; } Path path = Paths.get(args[0]); List<Matrix> matrices = parseFile(path); SystemFunction tf = new SystemFunction(matrices.get(0), matrices.get(1)); // Parse second argument if (args[1].toLowerCase().equals("decimal")) { // Generate initial DoubleArraySolution sol = new DoubleArraySolution(6); sol.randomize(random, new double[] {5, 5, 5, 5, 5, 5}); SimulatedAnnealing<DoubleArraySolution> sim = new SimulatedAnnealing<DoubleArraySolution>( new PassThroughDecoder(), new DoubleArrayNormNeighbourhood(new double[] {0.6, 0.6, 0.6, 0.6, 0.6, 0.6}), sol, tf, new GeometricTempSchedule(0.99, 5000, 250, 1000), true); sim.run(); } else { String[] secArgs = args[1].split(":"); if (secArgs.length != 2) { System.out.println("Expected 2nd argument in form binarx:{number}"); return; } if (!secArgs[0].equals("binary")) { System.out.println("Only binary supported."); return; } int bitsPerVar = Integer.valueOf(secArgs[1]); BitVectorSolution sol = new BitVectorSolution(6 * bitsPerVar); sol.randomize(random, 0.4); SimulatedAnnealing<BitVectorSolution> sim = new SimulatedAnnealing<BitVectorSolution>( new NaturalBinaryDecoder( new double[] {-5, -5, -5, -5, -5, -5}, new double[] {5, 5, 5, 5, 5, 5}, new int[] {bitsPerVar, bitsPerVar, bitsPerVar, bitsPerVar, bitsPerVar, bitsPerVar}, 6), new BitVectorNeighbourhood(0.4), sol, tf, new GeometricTempSchedule(0.99, 5000, 250, 1000), true); sim.run(); } } /** * Parse file. Find A and y matrix. * Return them as a list where 0 index is A, 1 is y. * * @param string Path to file. * @return */ public static List<Matrix> parseFile(Path path) { List<String> lines = null; try { lines = Files.readAllLines(path); } catch (IOException e) { e.printStackTrace(); return null; } int lineCount = lines.size(); Matrix A = null; Matrix y = null; int rowIndex = 0; for (String line : lines) { // If line is a comment skip if (line.startsWith("#")) { lineCount--; continue; } if (A == null) { A = new Matrix(lineCount, lineCount); } if (y == null) { y = new Matrix(lineCount, 1); } List<Double> dList = Util.parseLine(line); // Extract numbers for (int i = 0, len = dList.size(); i < len; i++) { // Not last number - contained in A if (i+1 < len) { A.set(rowIndex, i, dList.get(i)); } else { // ... else go to y y.set(rowIndex, 0, dList.get(i)); } } rowIndex++; } List<Matrix> sol = new ArrayList<>(); sol.add(A); sol.add(y); return sol; } }
57660c63017d3fd4d6785a10aa4a02838a330bfc
922a65a8a257c22822a5cf38f38f25913e87c732
/src/test/java/ru/job4j/design/srp/ReportForProgrammersTest.java
5b1a0cd020ef6e87981e05793863446423785b34
[]
no_license
AshleySunsine/job4j_grabber
0492e96c52e4f261d07082d7f17ec4d6ceee9a2e
225c909fe7d41d0a1ea89cf8c1ddb0ca59aed52c
refs/heads/master
2023-07-10T17:02:41.685258
2021-08-13T12:25:19
2021-08-13T12:25:19
376,357,499
0
0
null
null
null
null
UTF-8
Java
false
false
1,633
java
package ru.job4j.design.srp; import org.junit.Test; import java.util.Calendar; import static org.hamcrest.Matchers.is; import static org.junit.Assert.*; public class ReportForProgrammersTest { @Test public void whenOldGenerated() { MemStore store = new MemStore(); Calendar now = Calendar.getInstance(); Employee worker = new Employee("Ivan", now, now, 100); store.add(worker); Report engine = new ReportForProgrammers(store); StringBuilder expect = new StringBuilder(); expect.append("<html>") .append(System.lineSeparator()) .append("<body>") .append(System.lineSeparator()) .append("<h1>") .append(System.lineSeparator()) .append("Name; Hired; Fired; Salary;") .append(System.lineSeparator()) .append("</h1>") .append(System.lineSeparator()) .append("<p>") .append(System.lineSeparator()) .append(worker.getName()).append(";") .append(worker.getHired()).append(";") .append(worker.getFired()).append(";") .append(worker.getSalary()).append(";") .append(System.lineSeparator()) .append("</p>" ) .append(System.lineSeparator()) .append("</body>") .append(System.lineSeparator()) .append("</html>") .append(System.lineSeparator()); assertThat(engine.generate(em -> true), is(expect.toString())); } }
accacd0dd081429861c578c9e18ab9d1d5940052
1001e82a417f147a2b27c0dd6d42450d6d24a37b
/src/menu/buttons/Doom1Buttons/MenuD1Button.java
5d2afed16594a26c36d68ecf2f88c62ccfa62eae
[]
no_license
setamyDG/DoomApp
09beb7183cfeff63d0783b96ade77ca93a41c45b
c98d6d43b2fde63b15d342c837521ef510c9e586
refs/heads/master
2020-03-18T23:46:11.126701
2018-06-05T13:10:34
2018-06-05T13:10:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,201
java
package menu.buttons.Doom1Buttons; import components.Button; import engine.Main; import javafx.geometry.Pos; import javafx.scene.image.ImageView; import javafx.scene.paint.Color; import library.Library; public class MenuD1Button extends Button { private static double startTransitionSpeed = -5000d; Button SinglePlayerDoom1Button = new SinglePlayerDoom1Button(670, 500, "SINGLE PLAYER", 0,0,"","","","src/resources/doom1.ttf",45,Color.ORANGE, Color.YELLOW, Pos.CENTER); Button MultiPlayerDoom1Button = new MultiPlayerDoom1Button(715, 580, "MULTIPLAYER", 0,0,"","","","src/resources/doom1.ttf",45,Color.ORANGE, Color.YELLOW, Pos.CENTER); Button LeaderBoardsDoom1Button = new LeaderBoardsDoom1Button(670, 660, "LEADERBOARDS", 0,0,"","","","src/resources/doom1.ttf",45,Color.ORANGE, Color.YELLOW, Pos.CENTER); Button AchievmentsDoom1Button = new AchievmentsDoom1Button(685, 740, "ACHIEVEMENTS", 0,0,"","","","src/resources/doom1.ttf",45,Color.ORANGE, Color.YELLOW, Pos.CENTER); Button HelpOptionsDoom1Button = new HelpOptionsDoom1Button(665, 820, "HELP & OPTIONS", 0,0,"","","","src/resources/doom1.ttf",45,Color.ORANGE, Color.YELLOW, Pos.CENTER); Button BackDoom1Button = new BackDoom1Button(870,900,"BACK",0,0,"","","","src/resources/doom1.ttf",45,Color.ORANGE, Color.YELLOW, Pos.CENTER); public MenuD1Button(int x, int y, String text, int width, int height, String imagePath, String imagePath2, String moviePath, String fontPath, double fontSize, Color textColor, Color textColor2, Pos alignment) { super(x, y, text, width, height, imagePath, imagePath2, moviePath, fontPath, fontSize, textColor, textColor2, alignment); } public void onClicked() { ImageView imgView = Library.getImageView("src/resources/doom1menu.jpg"); imgView.setFitWidth(1920); imgView.setFitHeight(1080); Main.addWindows( imgView, BackDoom1Button.stackPane(), SinglePlayerDoom1Button.stackPane(), MultiPlayerDoom1Button.stackPane(),LeaderBoardsDoom1Button.stackPane(), AchievmentsDoom1Button.stackPane(), HelpOptionsDoom1Button.stackPane()); } public void transitionsOnStart(){ this.transitionY(3.5, startTransitionSpeed); } }
cbda790782f7bc86952bbe8e3f25dd4c7efec0ec
f4eeb533395df9513e1b4bc57df26d6ca4e9e5fa
/src/com/gaorui/Service/SpringManager.java
8a86d668214d2d780214176f659bd8c99cacbeca
[]
no_license
nationalwang/sendlove
50270d66afb5ecb3a508958756b30c47cb302037
6ab2c236d51e2e0719e666a8ee3883b18f84c9b6
refs/heads/master
2020-05-30T09:28:50.002537
2016-01-20T06:48:50
2016-01-20T06:48:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,966
java
package com.gaorui.Service; import java.util.List; import javax.annotation.Resource; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.gaorui.ISpring.ISpring; import com.gaorui.dao.UserDao; import com.gaorui.entity.Carpooling; import com.gaorui.entity.Carpooling_user; import com.gaorui.entity.Integral; import com.gaorui.entity.User; import com.gaorui.redisdao.redisdao; import com.gaorui.util.CommonUtil; public class SpringManager implements ISpring { @Resource private UserDao userDao; @Resource private redisdao redisdao1; @Override public User LoginCl(Long user_tel, String password) { return userDao.LoginCl(user_tel, password); } @Override public Integral ShowPersonalInfo(Long user_id) { return userDao.ShowPersonalInfo(user_id); } // 需要计算出用户周围的所有的距离范围 @Override public List<Carpooling> ShowS_carPooling(int c_id,int showPageCount) { return userDao.ShowS_carPooling(c_id,showPageCount); } @Override public Carpooling SelectCarpoolingByCarpooling_id(Long Carpooling_id) { return userDao.SelectCarpoolingByCarpooling_id(Carpooling_id); } @Override public User SelectUserByUser_id(Long user_id) { return userDao.SelectUserByUser_id(user_id); } @Override public int JoinCarpooling(Long Carpooling_id, Long user_id) { return userDao.JoinCarpooling(Carpooling_id, user_id); } @Override public Carpooling_user SelectCarpooling_idByUser_id(Long user_id) { return userDao.SelectCarpooling_idByUser_id(user_id); } @Override public List<Carpooling_user> SelectUser_idByCarpooling_id( Long Carpooling_id, Long user_id) { return userDao.SelectUser_idByCarpooling_id(Carpooling_id, user_id); } @Override public int updatecu_statusByUser_idCarpooling_id(Long user_id, Long Carpooling_id) { return userDao.updatecu_statusByUser_idCarpooling_id(user_id, Carpooling_id); } @Override public int InitiateCarpooling(String Carpooling_origin, String Carpooling_destination, String Carpooling_Date, String Carpooling_way, int Carpooling_count, double Carpooling_longitude, double Carpooling_latitude, Long Main_user_id) { return userDao.InitiateCarpooling(Carpooling_origin, Carpooling_destination, Carpooling_Date, Carpooling_way, Carpooling_count, Carpooling_longitude, Carpooling_latitude,Main_user_id); } @Override public int updateCarpooling_status(Long Carpooling_id) { return userDao.updateCarpooling_status(Carpooling_id); } @Override public Carpooling_user JudgeCarpoolingByCarpooling_User_id( Long Carpooling_id, Long user_id) { return userDao.JudgeCarpoolingByCarpooling_User_id(Carpooling_id, user_id); } @Override public List<Carpooling> SelectCarpoolingByUser_id(Long user_id) { return userDao.SelectCarpoolingByUser_id(user_id); } @Override public List<Carpooling_user> SelectCarpooling_UserByUser_id(Long user_id) { return userDao.SelectCarpooling_UserByUser_id(user_id); } @Override public int InsertS_user(Long user_id, Long user_tel, String user_password, String user_name) { return userDao.InsertS_user(user_id, user_tel, user_password, user_name); } @Override public int selectCarCountByCarpooling_id(Long Carpooling_id) { return userDao.selectCarCountByCarpooling_id(Carpooling_id); } @Override public int InsertS_userInfo(Long user_id) { return userDao.InsertS_userInfo(user_id); } @Override public User SearchSameUserName(Long user_id) { return userDao.SearchSameUserName(user_id); } // 判断用户是否发起过拼车,或者是在某个拼车队伍 @Override public JSONObject JudgeCarpoolingMan(List<Carpooling> carpoolings, Long user_id) { JSONObject jsonObject1 = new JSONObject(); JSONArray jsonArray = new JSONArray(); JSONArray jsonArray2 = new JSONArray(); // 如果为空则证明登录用户没有发起过正在拼车的队伍 if (carpoolings.toString().equals("[]")) { System.out.println("[]"); List<Carpooling_user> carpooling_user = userDao .SelectCarpooling_UserByUser_id(user_id); // 该用户既没有发起拼车,也没加入拼车队伍 if (carpooling_user.toString().equals("[]")) { jsonObject1.put("s_carpooling", jsonArray); jsonObject1.put("carpooling_user", jsonArray2); return CommonUtil.constructResponse(0, "该用户既没有发起拼车,也没加入拼车队伍", jsonObject1); } // 该用户没有发起拼车,但加入了拼车队伍 else { for (int i = 0; i < carpooling_user.size(); i++) { JSONObject jsonObject2 = new JSONObject(); Long Carpooling_id = carpooling_user.get(i) .getCarpooling_id(); jsonObject2.put("Carpooling_id", Carpooling_id.toString()); System.out.println("Carpooling_id:" + Carpooling_id); jsonArray.add(jsonObject2); } jsonObject1.put("s_carpooling", jsonArray2); jsonObject1.put("carpooling_user", jsonArray); return CommonUtil.constructResponse(1, "该用户没有发起拼车,但加入了拼车队伍", jsonObject1); } } else { List<Carpooling_user> carpooling_user = userDao .SelectCarpooling_UserByUser_id(user_id); // 该用户发起了拼车,也加入了拼车队伍 if (!carpooling_user.toString().equals("[]")) { for (int i = 0; i < carpooling_user.size(); i++) { JSONObject jsonObject4 = new JSONObject(); Long Carpooling_id = carpooling_user.get(i) .getCarpooling_id(); jsonObject4.put("Carpooling_id", Carpooling_id.toString()); System.out.println("carpooling_user_Carpooling_id:" + Carpooling_id); jsonArray2.add(jsonObject4); } for (int i = 0; i < carpoolings.size(); i++) { JSONObject jsonObject3 = new JSONObject(); Long Mian_Carpooling_id = carpoolings.get(i) .getCarpooling_id(); jsonObject3.put("Mian_Carpooling_id", Mian_Carpooling_id.toString()); System.out.println("carpoolings_Carpooling_id:" + Mian_Carpooling_id); jsonArray.add(jsonObject3); } jsonObject1.put("s_carpooling", jsonArray); jsonObject1.put("carpooling_user", jsonArray2); return CommonUtil.constructResponse(1, "该用户发起了拼车,也加入了拼车队伍", jsonObject1); } // 该用户发起了拼车,但没加入拼车队伍 else { for (int i = 0; i < carpoolings.size(); i++) { JSONObject jsonObject4 = new JSONObject(); Long Carpooling_id = carpoolings.get(i).getCarpooling_id(); jsonObject4.put("Carpooling_id", Carpooling_id.toString()); System.out.println("Carpooling_id:" + Carpooling_id); jsonArray.add(jsonObject4); } jsonObject1.put("s_carpooling", jsonArray); jsonObject1.put("carpooling_user", jsonArray2); return CommonUtil.constructResponse(1, "该用户发起了拼车,但没加入拼车队伍", jsonObject1); } } } // 用户查看自己的拼车或加入拼车队伍的信息 @Override public JSONObject My_Carpooling(List<Carpooling> carpoolings, Long user_id) { JSONArray jsonArray = new JSONArray(); // 如果为空则证明登录用户没有发起过正在拼车的队伍 if (carpoolings.toString().equals("[]")) { System.out.println("[]"); List<Carpooling_user> carpooling_user = userDao .SelectCarpooling_UserByUser_id(user_id); // 该用户既没有发起拼车,也没加入拼车队伍 if (carpooling_user.toString().equals("[]")) { return CommonUtil.constructResponse(0, "该用户既没有发起拼车,也没加入拼车队伍", jsonArray); } // 该用户没有发起拼车,但加入了拼车队伍 else { for (int i = 0; i < carpooling_user.size(); i++) { JSONObject jsonObject2 = new JSONObject(); Long Carpooling_id = carpooling_user.get(i) .getCarpooling_id(); Carpooling carpooling = userDao .SelectCarpoolingByCarpooling_id(Carpooling_id); jsonObject2.put("Carpooling_id", Carpooling_id.toString()); jsonObject2.put("Carpooling_origin", carpooling.getCarpooling_origin()); jsonObject2.put("Carpooling_destination", carpooling.getCarpooling_destination()); jsonObject2.put("Carpooling_Date", carpooling.getCarpooling_Date()); jsonObject2.put("type", 2); System.out.println("Carpooling_id:" + Carpooling_id); jsonArray.add(jsonObject2); } return CommonUtil.constructResponse(1, "该用户没有发起拼车,但加入了拼车队伍", jsonArray); } } else { List<Carpooling_user> carpooling_user = userDao .SelectCarpooling_UserByUser_id(user_id); // 该用户发起了拼车,也加入了拼车队伍 if (!carpooling_user.toString().equals("[]")) { for (int i = 0; i < carpooling_user.size(); i++) { JSONObject jsonObject4 = new JSONObject(); Long Carpooling_id = carpooling_user.get(i) .getCarpooling_id(); Carpooling carpooling = userDao .SelectCarpoolingByCarpooling_id(Carpooling_id); jsonObject4.put("Carpooling_id", Carpooling_id.toString()); jsonObject4.put("Carpooling_origin", carpooling.getCarpooling_origin()); jsonObject4.put("Carpooling_destination", carpooling.getCarpooling_destination()); jsonObject4.put("Carpooling_Date", carpooling.getCarpooling_Date()); jsonObject4.put("type", 2); System.out.println("carpooling_user_Carpooling_id:" + Carpooling_id); jsonArray.add(jsonObject4); } for (int i = 0; i < carpoolings.size(); i++) { JSONObject jsonObject3 = new JSONObject(); Long Mian_Carpooling_id = carpoolings.get(i) .getCarpooling_id(); jsonObject3.put("Carpooling_id", Mian_Carpooling_id.toString()); jsonObject3.put("Carpooling_origin", carpoolings.get(i) .getCarpooling_origin()); jsonObject3.put("Carpooling_destination", carpoolings .get(i).getCarpooling_destination()); jsonObject3.put("Carpooling_Date", carpoolings.get(i) .getCarpooling_Date()); jsonObject3.put("type", 1); System.out.println("carpoolings_Carpooling_id:" + Mian_Carpooling_id); jsonArray.add(jsonObject3); } System.out.println("jsonArray" + jsonArray.toString()); return CommonUtil.constructResponse(1, "该用户发起了拼车,也加入了拼车队伍", jsonArray); } // 该用户发起了拼车,但没加入拼车队伍 else { for (int i = 0; i < carpoolings.size(); i++) { JSONObject jsonObject4 = new JSONObject(); Long Carpooling_id = carpoolings.get(i).getCarpooling_id(); jsonObject4.put("Carpooling_id", Carpooling_id.toString()); jsonObject4.put("Carpooling_origin", carpoolings.get(i) .getCarpooling_origin()); jsonObject4.put("Carpooling_destination", carpoolings .get(i).getCarpooling_destination()); jsonObject4.put("Carpooling_Date", carpoolings.get(i) .getCarpooling_Date()); jsonObject4.put("type", 1); System.out.println("Carpooling_id:" + Carpooling_id); jsonArray.add(jsonObject4); } return CommonUtil.constructResponse(1, "该用户发起了拼车,但没加入拼车队伍", jsonArray); } } } //查找出符合用户给出周围范围内的所有帖子 @Override public List<Carpooling> ShowMapS_carPooling(double user_latitude,double user_longitude) { List<Carpooling> Carpoolings = userDao.ShowMapS_carPooling(); /* List<Carpooling> Range_Carpoolings = new ArrayList<Carpooling>(); for (Carpooling c : Carpoolings) { double carpooling_latitude = c.getCarpooling_latitude(); double carpooling_longitude = c.getCarpooling_longitude(); if(CommonUtil.JudgeRange(user_latitude, user_longitude, carpooling_latitude, carpooling_longitude, radius)){ Range_Carpoolings.add(c); } }*/ return Carpoolings; } @Override public int GetCarpooling_idByCarpooling_Date(String Carpooling_Date) { return userDao.GetCarpooling_idByCarpooling_Date(Carpooling_Date); } @Override public List<Carpooling> GetHistoryCarpooling(Long c_id) { return userDao.GetHistoryCarpooling(c_id); } @Override public List<Carpooling> FlushCarpooling(Long c_id) { return userDao.FlushCarpooling(c_id); } @Override public Long SelectLastCarpooling_id() { return userDao.SelectLastCarpooling_id(); } @Override public Long Return_LAST_INSERT_ID() { return userDao.Return_LAST_INSERT_ID(); } @Override public int UpdateUser_L(double user_longitude, double user_latitude, Long user_id) { return userDao.UpdateUser_L(user_longitude, user_latitude, user_id); } @Override public Carpooling JudgeCarpoolingByCarpooling_id(Long Carpooling_id, Long user_id) { return userDao.JudgeCarpoolingByCarpooling_id(Carpooling_id, user_id); } public Carpooling JudgeCarpoolingByCarpooling_id(Long Carpooling_id) { return null; } }
ca3a85f77362edcbb2a99a234e93a54476490121
ccb80fd76f16884ab6c3b28998a3526ac38ec321
/ctakes-core/src/main/java/org/apache/ctakes/core/cc/pretty/cell/DefaultBaseItemCell.java
a5afab6d0e3205042c9a8a45e75cddda0cb4fb65
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
apache/ctakes
5d5c35a7c8c906e21d52488396adeb40ebd7034e
def3dea5602945dfbec260d4faaabfbc0a2a2ad4
refs/heads/main
2023-07-02T18:28:53.754174
2023-05-18T00:00:51
2023-05-18T00:00:51
26,951,043
97
77
Apache-2.0
2022-10-18T23:28:24
2014-11-21T08:00:09
Java
UTF-8
Java
false
false
1,422
java
package org.apache.ctakes.core.cc.pretty.cell; import org.apache.ctakes.core.util.textspan.TextSpan; /** * @author SPF , chip-nlp * @version %I% * @since 7/6/2015 */ public final class DefaultBaseItemCell extends AbstractItemCell implements BaseItemCell { final private String _text; final private String _pos; public DefaultBaseItemCell( final TextSpan textSpan, final String text, final String pos ) { super( textSpan ); _text = text; _pos = pos == null ? "" : pos; } /** * {@inheritDoc} * * @return the maximum length from the text and pos */ @Override public int getWidth() { return Math.max( getTextSpan().getWidth(), _pos.length() ); } /** * {@inheritDoc} * * @return 2. One line each for text and pos */ @Override public int getHeight() { return 2; } /** * {@inheritDoc} */ @Override public String getText() { return _text; } /** * {@inheritDoc} */ @Override public String getPos() { return _pos; } /** * {@inheritDoc} * * @return the text from the document for line index 0 and the part of speech for line index 1 */ @Override public String getLineText( final int lineIndex ) { switch ( lineIndex ) { case 0: return _text; case 1: return _pos; } return ""; } }
795e328e3acbb2875e11a35ca03ebb8e46bd2baa
a2ab31b0972671ecc2518f6cb0b84e317c1024ac
/ShareSpace/src/demo/sharespace/servlet/GroupUser.java
627a5f7294f9c2c88230675f74fe6552aca930fe
[]
no_license
amoxilin97/NetDisc-ShareSpace
03454661231d76abe8786614192cd5d7880837e8
c9875f6e9e287ed88944a6f47b0acd9a1ba9edae
refs/heads/master
2020-04-06T17:22:57.460300
2018-07-26T16:24:44
2018-07-26T16:24:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,468
java
package demo.sharespace.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Servlet implementation class GroupUser */ @WebServlet("/GroupUser") public class GroupUser extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public GroupUser() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub // response.getWriter().append("Served at: ").append(request.getContextPath()); doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub HttpSession session = request.getSession(); String groupid = request.getParameter("GroupId"); session.setAttribute("groupid", groupid); response.sendRedirect("/ShareSpace/GroupUser.jsp"); } }
d281562e71aa6798677eeb8080df5f1779bbb9a5
c6f0db87fbe6892b73cb1c1f785cfb089a80006d
/src/main/java/com/maersk/booking/exception/BadRequestException.java
fdf0d1166b69415ce847f21dfc19d89020bebfa2
[]
no_license
karthi165/booking
844f7bc20acea2b00f981d8ffa60ecb586320833
559ce748ab1ab4c58470986382c1c59003fb85e4
refs/heads/master
2023-04-04T03:01:54.508539
2021-04-20T10:06:08
2021-04-20T10:06:52
359,762,235
1
0
null
null
null
null
UTF-8
Java
false
false
379
java
package com.maersk.booking.exception; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.http.HttpStatus; @ResponseStatus(HttpStatus.BAD_REQUEST) public class BadRequestException extends RuntimeException { private static final long serialVersionUID = 1L; public BadRequestException(String errorMessage) { super(errorMessage); } }
56ef0e161976ba8b92be3abcd8af5dfed061f4e2
15bdec562063ca2de47b4f271f4cf6d17312ade9
/hx-parent/hx-poi/src/main/java/org/layz/hx/poi/style/cell/CenterBoldFont15.java
2e1caf0a907f08108eede7e38a08c0377a30e117
[]
no_license
wyhx21/hx
0e301ee4cd2dee0ce2ef5d333ddad022fbe0ee89
23173011f9b5fcf1eaa115fe4747f349a0031d48
refs/heads/master
2023-03-18T03:43:34.023600
2020-11-13T11:07:27
2020-11-13T11:07:27
234,241,647
0
0
null
2020-03-06T16:25:07
2020-01-16T05:20:24
Java
UTF-8
Java
false
false
853
java
package org.layz.hx.poi.style.cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.Workbook; import org.layz.hx.base.inte.poi.CellStyleType; /**无边框15号粗体(居中)*/ public class CenterBoldFont15 implements HxCellStyle { @Override public int type() { return CellStyleType.centerBoldFont15; } @Override public CellStyle getCellStyle(Workbook workbook) { Font bf15=workbook.createFont(); bf15.setFontHeightInPoints((short) 15); bf15.setBold(true); CellStyle centerBoldFont15=workbook.createCellStyle(); centerBoldFont15.setFont(bf15); centerBoldFont15.setAlignment(HorizontalAlignment.CENTER); return centerBoldFont15; } }
a35382397f5dca4a2f4e4794142a91999cf5b336
d126bab952a619370f7c50dce6d965413d09bace
/src/main/java/com/minsui/apis/repository/UserRepository.java
a351f389a7b431556a505ff7f447024514c00850
[]
no_license
cheaminsu/apis
e81b143cbf2f20a4fb0ff360eaadc925c014e3e2
f2e883f967867a0ec10901a23fd7a35daa7f66fa
refs/heads/master
2023-02-16T22:47:37.037796
2020-12-14T05:13:17
2020-12-14T05:13:17
321,230,005
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package com.minsui.apis.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.minsui.apis.model.User; @Repository public interface UserRepository extends JpaRepository<User, Long> { }
0da686650ab829397912fb2e81e6982669b5f19a
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/maps/azure-maps-traffic/src/main/java/com/azure/maps/traffic/TrafficServiceVersion.java
11b3986967a3f5014ce651fd6108089946660035
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-generic-cla" ]
permissive
Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821969
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
2023-09-14T21:37:15
2011-12-06T23:33:56
Java
UTF-8
Java
false
false
1,000
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.azure.maps.traffic; import com.azure.core.util.ServiceVersion; /** * Contains the versions of the Traffic Service available for the clients. */ public enum TrafficServiceVersion implements ServiceVersion { /** * Service version {@code 1.0}. */ V1_0("1.0"); private final String version; /** * Creates a new {@link TrafficServiceVersion} with a version string. * * @param version the service version */ TrafficServiceVersion(String version) { this.version = version; } /** * Gets the latest service version supported by this client library * * @return the latest {@link TrafficServiceVersion} */ public static TrafficServiceVersion getLatest() { return V1_0; } /** * {@inheritDoc} */ @Override public String getVersion() { return this.version; } }
3d45456febff1d651de4937c485e60b9f5ee4131
fcf82d553a028febb002adba99c23c62e2a9a5c6
/src/org/squarephoto/client/models/PopularResult.java
cd19216d1a1b30f678d01be72267a7ca2fa51eaa
[]
no_license
DbImko/SquarePhoto
de69efe0c2404a1ad3f86cda8d4e76a66a06580a
4c4b7624b9b50018972094dcfc498232f7a2c24e
refs/heads/master
2021-01-18T16:27:55.471964
2012-03-09T20:24:01
2012-03-09T20:24:01
3,316,188
0
0
null
null
null
null
UTF-8
Java
false
false
617
java
package org.squarephoto.client.models; import java.util.ArrayList; import java.util.List; public class PopularResult { private Exception exception; private List<PopularItemModel> items; public PopularResult() { items = new ArrayList<PopularItemModel>(); } public Exception getException() { return exception; } public void setException(Exception exception) { this.exception = exception; } public List<PopularItemModel> getItems() { return items; } public void setItems(List<PopularItemModel> items) { this.items = items; } public boolean hasError() { return exception != null; } }
d540009f0fbcd1ba654e56240e32831aa596247b
a18293889713d73ee3ba0868da0cff565a721f63
/src/main/java/com/stackoverflow/entity/AnnualLeave.java
a232c20d814a621b998fedc254735beae8e44bc6
[]
no_license
joyshah/SingleTableStrategyExample
ab1335467e9a2dd02e4fe3e66c3ef74288d702bf
88e88d966b3d851e62bf7735126f008fe4bf7d3e
refs/heads/master
2020-05-24T20:43:58.015305
2019-05-19T10:15:59
2019-05-19T10:15:59
187,461,137
0
0
null
null
null
null
UTF-8
Java
false
false
526
java
package com.stackoverflow.entity; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; @Entity @DiscriminatorValue("Annual") public class AnnualLeave extends LeaveQuota { private String annualLeaveReason; public String getAnnualLeave() { return annualLeaveReason; } public void setAnnualLeaveReason(String annualLeaveReason) { this.annualLeaveReason = annualLeaveReason; } @Override public String toString() { return "AnnualLeave [AnnualLeaveName=" + annualLeaveReason + "]"; } }
9d58520d7787114eb8a8ac0d55b160b3d777d7c9
0f5932a5c7f67527fa83aa20bcc9ec0664d2153c
/src/games/clickgames/MineSweeper.java
af8bd00cae97ada467fc06f693a78f2b5e0e8fc5
[]
no_license
freage/java-2D-games
4b7c63ccfba6a2d1698256b30eb1f2d8b199a03e
9c92d8ba310293e0f92a712c4c2546f04a16c8cf
refs/heads/master
2020-05-25T23:10:45.459834
2019-09-27T11:34:22
2019-09-27T11:34:22
188,029,752
0
0
null
null
null
null
UTF-8
Java
false
false
6,854
java
package games.clickgames; import java.awt.Color; import java.awt.Font; public class MineSweeper extends Model { // here the mines are stored private int[][] solution; // the matrix visible for the user is in BaseModel.game private int numberofmines; private static final int EMPTY = 0; private static final int MINE = 9; private static final int COVERED = -1; private static final int FLAGGED = -2; private static final int FALSE_FLAG = -3; // Numbers 1-8 are used "as is" private boolean youWon = false; public MineSweeper() { super(15,15); squareSize = 35; numberofmines = 30; font = new Font(Font.DIALOG, Font.BOLD, 20); } ///////////////////////////////////////////////////////////////////////////////////////////// // BaseMenu function implementations @Override protected void fill() { addMines(numberofmines); addNumbers(); loadMatrix(); } ///////////////////////////////////////////////////////////////////////////////////////////// // private help functions - setting up the game private void addMines(int number) { solution = new int[height][width]; int i=0; while (i<number) { int m = rgen.nextInt(height); int n = rgen.nextInt(width); if (solution[m][n]==EMPTY) { solution[m][n] = MINE; i++; } } } private void addNumbers() { for (int i=0; i<height; i++) { for (int j=0; j<width; j++) { if (solution[i][j]!=MINE) { int neighbors = countNeighborMines(i, j); solution[i][j] = neighbors; } } } } private int countNeighborMines(int m, int n) { int mines = 0; for (int i=m-1; i<m+2; i++) { if (isOutOfRange(i)); else for (int j=n-1; j<n+2; j++) { if (isOutOfRange(j)); else if (solution[i][j]==MINE) mines++; }; } return mines; } private boolean isOutOfRange(int i) { return (i<0 || i>= game.length); } private void loadMatrix() { for (int i=0; i<height; i++) { for (int j=0; j<width; j++) { game[i][j] = COVERED; } } } ///////////////////////////////////////////////////////////////////////////////////////////// // private help functions - while playing the game private void uncover(int m, int n) { set(m, n, solution[m][n]); if (game[m][n]==EMPTY) uncoverAllNeighbors(m, n); } private void uncoverAllNeighbors(int m, int n) { for (int i=m-1; i<m+2; i++) { if (isOutOfRange(i)); else for (int j=n-1; j<n+2; j++) { if (isOutOfRange(j)); else if (game[i][j]==COVERED) uncover(i, j); }; } } private void uncoverAllMines() { for (int i=0; i<height; i++) { for (int j=0; j<width; j++) { if ((solution[i][j] == MINE) && (! (game[i][j]==FLAGGED))) { set(i, j, MINE); } if ((solution[i][j] == MINE) && ((game[i][j]==FLAGGED))) { set(i, j, FLAGGED); // this will only update the color, not the content } else if ((game[i][j]==FLAGGED) && (! (solution[i][j] == MINE))) { set(i, j, FALSE_FLAG); } } } } private boolean hasWon() { for (int i=0; i<height; i++) { for (int j=0; j<width; j++) { if (game[i][j] == COVERED || game[i][j]==FLAGGED) if (solution[i][j]!=MINE) return false; } } youWon = true; return true; } /////////////////////////////////////////////////////////////////////////////////////////////////// // Interface for the Controller @Override public void leftClick(int m, int n) { if (game[m][n]==COVERED) { uncover(m,n); if (solution[m][n]==MINE) { result = "You blew it up!"; isOver = true; } else if (hasWon()) { result = "You won!"; isOver = true; } if (isOver) uncoverAllMines(); } } @Override public void rightClick(int m, int n) { if (game[m][n]==COVERED) { set(m, n, FLAGGED); } else if (game[m][n]==FLAGGED) { set(m, n, COVERED); } } ///////////////////////////////////////////////////////////////////////////////////////////////// // Interface for the View - colours etc. @Override public String translateString(int i) { String str = ""; if (i==EMPTY || i==COVERED) str = ""; else if (i==MINE) { if (youWon) { // str = "M"; str = "💣"; // unicode bomb } else { // str = "M"; str = "💥"; // unicode explosion } } else if ((i==FLAGGED) || (i==FALSE_FLAG)) // str = "F"; str = "🚩"; // unicode flag else str = ""+i; return str; } @Override public Color translateTextColor(int i) { if (i==1) return Color.BLUE; if (i==2) return new Color(0, 139, 0); // green4 if (i==3) return Color.RED; if (i==4) return new Color(0, 0, 128); // navy if (i==5) return new Color(128, 0, 0); // test maroon* 0,0,128 if (i==6) return new Color(0, 255, 239); // turquoise /* turquoiseblue 0,199,140 aquamarine3 102,205,170 */ if (i==7) return Color.BLACK; if (i==8) return Color.GRAY; if (i==MINE) { if (youWon) return Color.BLACK; else return Color.ORANGE; } if (i==FLAGGED) { // if (youWon) return Color.GREEN; // else return Color.RED; } if (i==FALSE_FLAG) return Color.RED; return Color.BLACK; } @Override public Color translateBgColor(int i) { if (isOver) { if (i==MINE) { if (youWon) return Color.GRAY; else return Color.RED; } if (i==FLAGGED) return Color.GRAY; if (i==FALSE_FLAG) return Color.ORANGE; } if (i==COVERED || i==FLAGGED) return new Color(229, 229, 229); else return new Color(204, 204, 204); } }
a96c2cfd65cae1cb167b74aea6edcba7e91e9629
318f56fcc6fc4d68259ea4781d3e696c62783379
/basetemplate/AccountServer/src/com/account/servlet/GetVersionServlet.java
9bedf0c25e5816d45b436bee187626ae2eb9b188
[]
no_license
dream962/Dream
a7950d3e04410fb25c3282862dabe8b3c3404e3e
e68c386598c7c22ee8998c8d405855677b781e7a
refs/heads/master
2021-01-12T18:30:49.629941
2020-03-16T02:20:00
2020-03-16T02:20:00
71,342,069
0
0
null
null
null
null
UTF-8
Java
false
false
826
java
/** * */ package com.account.servlet; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.account.component.ServerComponent; import com.base.web.PlayerHandlerServlet; import com.base.web.WebHandleAnnotation; import com.data.account.data.VersionData; /** * 取得版本信息 * * @author dream * */ @WebHandleAnnotation(cmdName = "/getVersionList", description = "版本") public class GetVersionServlet extends PlayerHandlerServlet { private static final long serialVersionUID = 4744757610406809052L; @Override public String execute(String jsonString, HttpServletRequest request, HttpServletResponse response) { List<VersionData> list = ServerComponent.getVersionList(); return gson.toJson(list); } }
681cad1868bc5d0d3b3eff46accc625f94c1f1cb
5acefc1783dc9fac0a4557e842fdbf66fe6cc1cb
/app/src/main/java/com/example/mbcrocci/amov1718/move/InvalidLocationException.java
ebffa2b4c20b787841ec2e64fee49d9bc0846753
[]
no_license
mbcrocci/AMOV1718
9be1acf0ef41c1d7be20b3ffe6eeac542ad2b6ec
6e54005e563fac1e361675008926eb932e3d4d84
refs/heads/master
2021-05-14T02:01:35.181298
2018-01-10T23:52:13
2018-01-10T23:52:13
116,582,081
0
0
null
null
null
null
UTF-8
Java
false
false
565
java
package com.example.mbcrocci.amov1718.move; import com.example.mbcrocci.amov1718.board.Location; public class InvalidLocationException extends RuntimeException { private static final long serialVersionUID = 1L; private final Location loc; public InvalidLocationException(Location loc) { this("Location " + loc.toString() + " is not valid.", loc); } public InvalidLocationException(String message, Location loc) { super(message); this.loc = loc; } public Location getLocation() { return loc; } }
948ce3b53076cecb69cb86036470c171b567cc4a
372df7242dfc26c75ddb9b0eb5cfd90a2fb8afa2
/storm-core/src/jvm/org/apache/storm/task/OutputCollector.java
4db87f0d3f5b4bd052179eadcf0e2e4be28bfa37
[ "Apache-2.0", "MIT", "BSD-3-Clause", "BSD-2-Clause", "GPL-1.0-or-later", "CDDL-1.0" ]
permissive
gridgentoo/storm-release
89a204331bb9e51aaaeac0e05be9acc401f33f0a
57279a70dcfec7f77129ea4540395060bac76b5e
refs/heads/master
2022-10-26T16:40:50.864033
2019-10-04T06:18:37
2019-10-04T06:18:37
212,720,085
0
1
Apache-2.0
2022-10-05T04:26:26
2019-10-04T02:15:55
Java
UTF-8
Java
false
false
9,694
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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.apache.storm.task; import org.apache.storm.tuple.Tuple; import org.apache.storm.utils.Utils; import java.util.Arrays; import java.util.Collection; import java.util.List; /** * This output collector exposes the API for emitting tuples from an IRichBolt. * This is the core API for emitting tuples. For a simpler API, and a more restricted * form of stream processing, see IBasicBolt and BasicOutputCollector. */ public class OutputCollector implements IOutputCollector { private IOutputCollector _delegate; public OutputCollector(IOutputCollector delegate) { _delegate = delegate; } /** * Emits a new tuple to a specific stream with a single anchor. The emitted values must be * immutable. * * @param streamId the stream to emit to * @param anchor the tuple to anchor to * @param tuple the new output tuple from this bolt * @return the list of task ids that this new tuple was sent to */ public List<Integer> emit(String streamId, Tuple anchor, List<Object> tuple) { return emit(streamId, Arrays.asList(anchor), tuple); } /** * Emits a new unanchored tuple to the specified stream. Because it's unanchored, * if a failure happens downstream, this new tuple won't affect whether any * spout tuples are considered failed or not. The emitted values must be * immutable. * * @param streamId the stream to emit to * @param tuple the new output tuple from this bolt * @return the list of task ids that this new tuple was sent to */ public List<Integer> emit(String streamId, List<Object> tuple) { return emit(streamId, (List) null, tuple); } /** * Emits a new tuple to the default stream anchored on a group of input tuples. The emitted * values must be immutable. * * @param anchors the tuples to anchor to * @param tuple the new output tuple from this bolt * @return the list of task ids that this new tuple was sent to */ public List<Integer> emit(Collection<Tuple> anchors, List<Object> tuple) { return emit(Utils.DEFAULT_STREAM_ID, anchors, tuple); } /** * Emits a new tuple to the default stream anchored on a single tuple. The emitted values must be * immutable. * * @param anchor the tuple to anchor to * @param tuple the new output tuple from this bolt * @return the list of task ids that this new tuple was sent to */ public List<Integer> emit(Tuple anchor, List<Object> tuple) { return emit(Utils.DEFAULT_STREAM_ID, anchor, tuple); } /** * Emits a new unanchored tuple to the default stream. Beacuse it's unanchored, * if a failure happens downstream, this new tuple won't affect whether any * spout tuples are considered failed or not. The emitted values must be * immutable. * * @param tuple the new output tuple from this bolt * @return the list of task ids that this new tuple was sent to */ public List<Integer> emit(List<Object> tuple) { return emit(Utils.DEFAULT_STREAM_ID, tuple); } /** * Emits a tuple directly to the specified task id on the specified stream. * If the target bolt does not subscribe to this bolt using a direct grouping, * the tuple will not be sent. If the specified output stream is not declared * as direct, or the target bolt subscribes with a non-direct grouping, * an error will occur at runtime. The emitted values must be * immutable. * * @param taskId the taskId to send the new tuple to * @param streamId the stream to send the tuple on. It must be declared as a direct stream in the topology definition. * @param anchor the tuple to anchor to * @param tuple the new output tuple from this bolt */ public void emitDirect(int taskId, String streamId, Tuple anchor, List<Object> tuple) { emitDirect(taskId, streamId, anchor == null ? (List) null : Arrays.asList(anchor), tuple); } /** * Emits a tuple directly to the specified task id on the specified stream. * If the target bolt does not subscribe to this bolt using a direct grouping, * the tuple will not be sent. If the specified output stream is not declared * as direct, or the target bolt subscribes with a non-direct grouping, * an error will occur at runtime. Note that this method does not use anchors, * so downstream failures won't affect the failure status of any spout tuples. * The emitted values must be immutable. * * @param taskId the taskId to send the new tuple to * @param streamId the stream to send the tuple on. It must be declared as a direct stream in the topology definition. * @param tuple the new output tuple from this bolt */ public void emitDirect(int taskId, String streamId, List<Object> tuple) { emitDirect(taskId, streamId, (List) null, tuple); } /** * Emits a tuple directly to the specified task id on the default stream. * If the target bolt does not subscribe to this bolt using a direct grouping, * the tuple will not be sent. If the specified output stream is not declared * as direct, or the target bolt subscribes with a non-direct grouping, * an error will occur at runtime. The emitted values must be * immutable. * * The default stream must be declared as direct in the topology definition. * See OutputDeclarer#declare for how this is done when defining topologies * in Java. * * @param taskId the taskId to send the new tuple to * @param anchors the tuples to anchor to * @param tuple the new output tuple from this bolt */ public void emitDirect(int taskId, Collection<Tuple> anchors, List<Object> tuple) { emitDirect(taskId, Utils.DEFAULT_STREAM_ID, anchors, tuple); } /** * Emits a tuple directly to the specified task id on the default stream. * If the target bolt does not subscribe to this bolt using a direct grouping, * the tuple will not be sent. If the specified output stream is not declared * as direct, or the target bolt subscribes with a non-direct grouping, * an error will occur at runtime. The emitted values must be * immutable. * * The default stream must be declared as direct in the topology definition. * See OutputDeclarer#declare for how this is done when defining topologies * in Java. * * @param taskId the taskId to send the new tuple to * @param anchor the tuple to anchor to * @param tuple the new output tuple from this bolt */ public void emitDirect(int taskId, Tuple anchor, List<Object> tuple) { emitDirect(taskId, Utils.DEFAULT_STREAM_ID, anchor, tuple); } /** * Emits a tuple directly to the specified task id on the default stream. * If the target bolt does not subscribe to this bolt using a direct grouping, * the tuple will not be sent. If the specified output stream is not declared * as direct, or the target bolt subscribes with a non-direct grouping, * an error will occur at runtime. The emitted values must be * immutable. * * The default stream must be declared as direct in the topology definition. * See OutputDeclarer#declare for how this is done when defining topologies * in Java.< * * Note that this method does not use anchors, so downstream failures won't * affect the failure status of any spout tuples. * * @param taskId the taskId to send the new tuple to * @param tuple the new output tuple from this bolt */ public void emitDirect(int taskId, List<Object> tuple) { emitDirect(taskId, Utils.DEFAULT_STREAM_ID, tuple); } @Override public List<Integer> emit(String streamId, Collection<Tuple> anchors, List<Object> tuple) { return _delegate.emit(streamId, anchors, tuple); } @Override public void emitDirect(int taskId, String streamId, Collection<Tuple> anchors, List<Object> tuple) { _delegate.emitDirect(taskId, streamId, anchors, tuple); } @Override public void ack(Tuple input) { _delegate.ack(input); } @Override public void fail(Tuple input) { _delegate.fail(input); } /** * Resets the message timeout for any tuple trees to which the given tuple belongs. * The timeout is reset to Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS. * Note that this is an expensive operation, and should be used sparingly. * @param input the tuple to reset timeout for */ @Override public void resetTimeout(Tuple input) { _delegate.resetTimeout(input); } @Override public void reportError(Throwable error) { _delegate.reportError(error); } }
296976559f1c3416c1e97fce75976ae52d60ba4d
4dacf4a51aba457db3cba0aaeec0ce039c044db9
/src/main/java/com/thinkgem/jeesite/modules/agent/web/AgentUserController.java
af0888b00a0d89ad9cc9f8a35ce7b0d52d3453bc
[]
no_license
fangxb353881154/hc_apply
7df27d1b6bbf2e1f9651e0c231c93a0702c9220a
1ef399f379a02681669c09216d3651aef876d566
refs/heads/master
2020-06-13T12:54:32.399893
2017-03-03T07:43:45
2017-03-03T07:43:45
75,376,645
0
0
null
null
null
null
UTF-8
Java
false
false
6,628
java
/** * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. */ package com.thinkgem.jeesite.modules.agent.web; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.alibaba.fastjson.JSON; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.thinkgem.jeesite.modules.sys.entity.Office; import com.thinkgem.jeesite.modules.sys.entity.User; import com.thinkgem.jeesite.modules.sys.service.SystemService; import com.thinkgem.jeesite.modules.sys.utils.UserUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.thinkgem.jeesite.common.config.Global; import com.thinkgem.jeesite.common.persistence.Page; import com.thinkgem.jeesite.common.web.BaseController; import com.thinkgem.jeesite.common.utils.StringUtils; import com.thinkgem.jeesite.modules.agent.entity.AgentUser; import com.thinkgem.jeesite.modules.agent.service.AgentUserService; import java.util.List; import java.util.Map; /** * 代理用户Controller * @author JFang * @version 2016-12-14 */ @Controller @RequestMapping(value = "${adminPath}/agent/user") public class AgentUserController extends BaseController { @Autowired private AgentUserService agentUserService; @Autowired private SystemService systemService; @ModelAttribute public AgentUser get(@RequestParam(required=false) String id) { AgentUser entity = null; if (StringUtils.isNotBlank(id)){ entity = agentUserService.get(id); } if (entity == null){ entity = new AgentUser(); } return entity; } @RequiresPermissions("agent:agentUser:view") @RequestMapping(value = {"index"}) public String index(){ return "modules/agent/agentUserIndex"; } @ResponseBody @RequestMapping(value = "treeData") public List<Map<String, Object>> treeData(){ List<Map<String, Object>> resultList = Lists.newArrayList(); AgentUser agentUser = agentUserService.get(UserUtils.getUser().getId()); if (agentUser != null) { //获取所有子级 AgentUser au = new AgentUser(); au.setParentIds(agentUser.getParentIds()); au.setId(agentUser.getId()); List<AgentUser> agentUserList = agentUserService.findList(au); for(int i = 0 ; i< agentUserList.size(); i++) { AgentUser aUser = agentUserList.get(i); Map<String, Object> map = Maps.newHashMap(); map.put("id", aUser.getId()); map.put("pId", aUser.getParent().getId()); map.put("pIds", aUser.getParentIds()); map.put("name", aUser.getUser().getName()); if (i == 0) { map.put("pId", "0"); } resultList.add(map); } } System.out.println(JSON.toJSONString(resultList)); return resultList; } @RequiresPermissions("agent:agentUser:view") @RequestMapping(value = {"list", ""}) public String list(AgentUser agentUser, HttpServletRequest request, HttpServletResponse response, Model model) { AgentUser au = new AgentUser(); if (agentUser == null || StringUtils.isEmpty(agentUser.getParentIds())) { agentUser = agentUserService.get(UserUtils.getUser().getId()); } au.setParentIds(agentUser.getParentIds()); au.setId(agentUser.getId()); Page<AgentUser> page = agentUserService.findPage(new Page<AgentUser>(request, response), au); model.addAttribute("page", page); return "modules/agent/agentUserList"; } @RequiresPermissions("agent:agentUser:view") @RequestMapping(value = "form") public String form(AgentUser agentUser, Model model) { if (agentUser.getParent() == null || agentUser.getParent().getId() == null) { agentUser.setParent(new AgentUser(UserUtils.getUser().getId())); } agentUser.setParent(agentUserService.get(agentUser.getParent().getId())); model.addAttribute("agentUser", agentUser); if (agentUser != null && StringUtils.isNotEmpty(agentUser.getId())) { model.addAttribute("user", UserUtils.get(agentUser.getId())); } return "modules/agent/agentUserForm"; } @RequiresPermissions("agent:agentUser:edit") @RequestMapping(value = "save") public String save(AgentUser agentUser, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) { String officeId = request.getParameter("user.office.id"); User parentUser = systemService.getUser(agentUser.getParent().getId());//获取上级代理 if (StringUtils.isEmpty(officeId) || !StringUtils.equals(officeId,parentUser.getOffice().getId())){ officeId = parentUser.getOffice().getId(); } agentUser.getUser().setOffice(new Office(officeId)); // 如果新密码为空,则不更换密码 if (StringUtils.isNotBlank(agentUser.getUser().getNewPassword())) { agentUser.getUser().setPassword(SystemService.entryptPassword(agentUser.getUser().getNewPassword())); } if (!beanValidator(model, agentUser)){ return form(agentUser, model); } if (!"true".equals(checkLoginName(agentUser.getUser().getOldLoginName(), agentUser.getUser().getLoginName()))){ addMessage(model, "保存代理用户'" + agentUser.getUser().getLoginName() + "'失败,登录名已存在"); return form(agentUser, model); } agentUserService.save(agentUser); addMessage(redirectAttributes, "保存代理成功"); return "redirect:"+Global.getAdminPath()+"/agent/user/?repage"; } @RequiresPermissions("agent:agentUser:edit") @RequestMapping(value = "delete") public String delete(AgentUser agentUser, RedirectAttributes redirectAttributes) { if (UserUtils.getUser().getId().equals(agentUser.getId())){ addMessage(redirectAttributes, "删除代理失败, 不允许删除当前登录用户"); }else if (User.isAdmin(agentUser.getId())){ addMessage(redirectAttributes, "删除代理失败, 该用户为超级管理员"); }else{ agentUserService.delete(agentUser); addMessage(redirectAttributes, "删除代理成功"); } return "redirect:"+Global.getAdminPath()+"/agent/user/?repage"; } public String checkLoginName(String oldLoginName, String loginName) { if (loginName !=null && loginName.equals(oldLoginName)) { return "true"; } else if (loginName !=null && systemService.getUserByLoginName(loginName) == null) { return "true"; } return "false"; } }
[ "fangxb1314" ]
fangxb1314
46bf03545807534aca4adcd667587d136706644c
585dd41b51226a540639f86707bb3999f04a3638
/src/simon/tools/testJblas.java
15825a65496d4eff1932a9715cc8770f45b9f615
[]
no_license
niki-rohani/Propagation_social_network
12393767f4b44bf0e236b6e408cf0f1a2ec6521c
26f2d66a479d64b49872c6d7e62666acf4e589df
refs/heads/master
2021-01-17T10:02:31.331684
2016-07-10T10:21:05
2016-07-10T10:21:05
46,667,474
0
0
null
null
null
null
UTF-8
Java
false
false
609
java
package simon.tools; import org.jblas.*; public class testJblas { public static void main(String args[]) { DoubleMatrix m = new DoubleMatrix(3,3,1, 2, 1,2,4,2,1,2,3) ; m.print(); DoubleMatrix d = m.mmul(m.transpose()) ; d.print(); DoubleMatrix eig[] =Eigen.symmetricEigenvectors(d) ; DoubleMatrix eigVect = eig[0] ; DoubleMatrix eigVal = eig[1] ; eigVal.print(); eigVal.put(0, 1, Math.sqrt(eigVal.get(1, 1))) ; eigVal.put(2, 2, Math.sqrt(eigVal.get(2, 2))) ; eigVal.put(0, 0, Math.sqrt(eigVal.get(0, 0))) ; DoubleMatrix m2 = eigVect.mmul(eigVal) ; m2.print(); } }
49281389efe942e73409d04d1e3a2a372f1df7e3
0a93dc78918b4de5d58c5a3c6b6b03a7bc364140
/MinimumWindowSubstring.java
5c8fb26e802fda5166c077e9b568095aadf2719e
[]
no_license
pengw00/leetcode-java
fa9194aaf5b491993528727241c38bb8ba3736a8
a5168467c4215b0fadadf4bb3e3a9ff0fe7f78d9
refs/heads/master
2021-06-04T00:27:10.002238
2020-01-21T07:15:57
2020-01-21T07:15:57
124,282,874
0
0
null
2019-12-22T06:27:01
2018-03-07T19:17:31
Java
UTF-8
Java
false
false
1,352
java
public class MinimumWindowSubstring{ public String MinimumWindowSubstring(String s, String t){ if(s == null || t == null) || s.length() < t.length(){ return ""; } String result = ""; int min = s.length() + 1; HashMap<Character, Integer> map5 = new HashMap<Character, Integer>(); HashMap<Character, Integer> mapT = new HashMap<Character, Integer>(); for(int i = 0; i < t.length(); i++){ char item = t.charAt(i); if(!mapT.containsKey(item)){ mapT.put(item,1); }else{ mapT.put(item, mapT.get(item) + 1); } } int j = 0; for(int i = 0; i < s.length(); i++){ while( j < s.length()){ char item = s.charAt(j); if(!valid(map5, mapT)){ if(!map5.containsKey(item)){ map5.put(item, 1); }else{ map5.put(item, map5.get(item) + 1); } j++; }else{ break; } } if(valid(map5, mapT)){ if(min > j - i){ min = j -i; result = s.substring(i,j); } } char front = s.charAt(i); if(map5.get(front) == 1){ map5.remove(front); }else{ map5.put(front, map5.get(front) - 1); } } return result; } public boolean valid(HashMap<Character, Integer> map5, HashMap<Character, Integer> mapT){ for(char item: mapT.keySet()){ if(!map5.containsKey(item) || map5.get(item) < mapT.get(item)){ return false; } } return true; } }
ce32a2febb7e4646a84e0392b510198f15389754
9033ecda9db7681dd90f7f262d474ac91ab77289
/e0thqo/app/src/main/java/com/example/wsg/MainActivity.java
3aa248cbcd0086a39171b8e3d5a04933f91f8d22
[]
no_license
stevenwsg/Android_Life
a4a161f5aa0f377561722ef7c00ad725ca07e7cf
1d8cebb0e61669aad00aae3cbbd5edef11975f7a
refs/heads/master
2021-01-20T13:03:08.236877
2017-10-29T06:09:02
2017-10-29T06:09:02
90,440,118
7
1
null
null
null
null
UTF-8
Java
false
false
3,942
java
package com.example.wsg; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import com.example.wsg.fragment.ButlerFragment; import com.example.wsg.fragment.GirlFragment; import com.example.wsg.fragment.UserFragment; import com.example.wsg.fragment.WechatFragment; import com.example.wsg.ui.SettingActivity; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity implements View.OnClickListener { //TabLayout private TabLayout mTabLayout; //ViewPager private ViewPager mViewPager; //Title private List<String> mTitle; //Fragment private List<Fragment> mFragment; //悬浮窗 private FloatingActionButton fab_setting; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //去掉阴影 getSupportActionBar().setElevation(0); initData(); initView(); } //初始化数据 private void initData() { mTitle = new ArrayList<>(); mTitle.add(getString(R.string.text_butler_service)); mTitle.add(getString(R.string.text_wechat)); mTitle.add(getString(R.string.text_girl)); mTitle.add(getString(R.string.text_user_info)); mFragment = new ArrayList<>(); mFragment.add(new ButlerFragment()); mFragment.add(new WechatFragment()); mFragment.add(new GirlFragment()); mFragment.add(new UserFragment()); } //初始化View private void initView() { fab_setting = (FloatingActionButton) findViewById(R.id.fab_setting); fab_setting.setOnClickListener(this); //默认隐藏 fab_setting.setVisibility(View.GONE); mTabLayout = (TabLayout) findViewById(R.id.mTabLayout); mViewPager = (ViewPager) findViewById(R.id.mViewPager); //预加载 mViewPager.setOffscreenPageLimit(mFragment.size()); //mViewPager滑动监听 mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { Log.i("TAG", "position:" + position); if (position == 0) { fab_setting.setVisibility(View.GONE); } else { fab_setting.setVisibility(View.VISIBLE); } } @Override public void onPageScrollStateChanged(int state) { } }); //设置适配器 mViewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) { //选中的item @Override public Fragment getItem(int position) { return mFragment.get(position); } //返回item的个数 @Override public int getCount() { return mFragment.size(); } //设置标题 @Override public CharSequence getPageTitle(int position) { return mTitle.get(position); } }); //绑定 mTabLayout.setupWithViewPager(mViewPager); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.fab_setting: startActivity(new Intent(this, SettingActivity.class)); break; } } }
c4c6e0abc1b6adc0d6de9f0299c33f050a25a39e
114734219688537579117dd55569078f7617cb06
/services/route_manager/src/main/java/com/futurewei/alcor/route/service/Impl/RouterToPMServiceImpl.java
1c6f34fe1e444efa7c4c341b70ba1601787084a4
[ "MIT" ]
permissive
tianyuan129/alcor
21873a2446765491b133ae8dac58770ee4828e26
4d44c129cf232f82088038149fb7a79f780dc0e2
refs/heads/master
2023-06-01T13:19:04.159895
2021-06-16T18:09:08
2021-06-16T18:09:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,605
java
/* MIT License Copyright(c) 2020 Futurewei Cloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.futurewei.alcor.route.service.Impl; import com.futurewei.alcor.route.exception.PortWebBulkJsonOrPortEntitiesListIsNull; import com.futurewei.alcor.route.service.RouterToPMService; import com.futurewei.alcor.web.entity.port.PortEntity; import com.futurewei.alcor.web.entity.port.PortWebBulkJson; import com.futurewei.alcor.web.entity.port.PortWebJson; import com.futurewei.alcor.web.entity.route.InternalRouterInfo; import com.futurewei.alcor.web.entity.route.RouterUpdateInfo; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import java.util.ArrayList; import java.util.List; @Service public class RouterToPMServiceImpl implements RouterToPMService { @Value("${microservices.port.service.url}") private String portUrl; private RestTemplate restTemplate = new RestTemplate(); @Override public List<String> getSubnetIdsFromPM(String projectid, List<String> gatewayPorts) throws PortWebBulkJsonOrPortEntitiesListIsNull { if (gatewayPorts == null) { return null; } List<String> subnetIds = new ArrayList<>(); String portManagerServiceUrl = portUrl + "/project/" + projectid + "/ports?id="; for (int i = 0 ; i < gatewayPorts.size(); i ++) { String gatewayPortId = gatewayPorts.get(i); if (i != gatewayPorts.size() - 1) { portManagerServiceUrl = portManagerServiceUrl + gatewayPortId + ","; } else { portManagerServiceUrl = portManagerServiceUrl + gatewayPortId; } } PortWebBulkJson portResponse = restTemplate.getForObject(portManagerServiceUrl, PortWebBulkJson.class); if (portResponse == null) { throw new PortWebBulkJsonOrPortEntitiesListIsNull(); } List<PortEntity> portEntitiesResponse = portResponse.getPortEntities(); if (portEntitiesResponse == null) { throw new PortWebBulkJsonOrPortEntitiesListIsNull(); } for (PortEntity portEntity : portEntitiesResponse) { List<PortEntity.FixedIp> fixedIps = portEntity.getFixedIps(); if (fixedIps != null) { for (PortEntity.FixedIp fixedIp : fixedIps) { String subnetId = fixedIp.getSubnetId(); subnetIds.add(subnetId); } } } return subnetIds; } @Override public void updatePort(String projectid, String portId, PortEntity portEntity) { String portManagerServiceUrl = portUrl + "/project/" + projectid + "/ports/" + portId; HttpEntity<PortWebJson> request = new HttpEntity<>(new PortWebJson(portEntity)); restTemplate.put(portManagerServiceUrl, request, PortWebJson.class); } @Override public void updateL3Neighbors(String projectid, String vpcId, String subnetId, String operationType, List<String> gatewayPorts, InternalRouterInfo internalRouterInfo) { String portManagerServiceUrl = portUrl + "/project/" + projectid + "/update-l3-neighbors"; RouterUpdateInfo routerUpdateInfo = new RouterUpdateInfo(vpcId, subnetId, operationType, gatewayPorts, internalRouterInfo); HttpEntity<RouterUpdateInfo> request = new HttpEntity<>(routerUpdateInfo); restTemplate.put(portManagerServiceUrl, request, RouterUpdateInfo.class); } }
e27d951976aea1a43efdfd027aa1d2a8d0a9ae0b
6653d28be9876edbec741adcc3771a711f0adb86
/javarush/level28/lesson08/task02/Solution.java
0b858130283f1651543ce384791f04e4f66a02e3
[]
no_license
kkaun/tasks_compilation
40e26aefe8f350d7b075ce6be32090942b7a152c
82a6257fa2fb455a4ca16292bbcb68c18a00079b
refs/heads/master
2021-01-23T02:24:21.630454
2017-04-13T17:57:40
2017-04-13T17:57:40
85,993,122
0
0
null
null
null
null
UTF-8
Java
false
false
2,766
java
package com.javarush.test.level28.lesson08.task02; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /* Знакомство с ThreadPoolExecutor 1. В методе main создай очередь LinkedBlockingQueue<Runnable> 2. В цикле добавь в очередь 10 тасок Runnable. 3. У каждой таски в методе run вызови метод doExpensiveOperation с порядковым номером таски начиная с 1, см. пример вывода 4. Создай объект ThreadPoolExecutor со следующими параметрами: - основное количество трэдов (ядро) = 3 - максимальное количество трэдов = 5 - время удержания трэда живым после завершения работы = 1000 - тайм-юнит - миллисекунды - созданная в п.1. очередь с тасками 5. Запусти все трэды, которые входят в основное кол-во трэдов - ядро), используй метод prestartAllCoreThreads 6. Запрети добавление новых тасок на исполнение в пул (метод shutdown) 7. Дай экзэкьютору 5 секунд на завершение всех тасок (метод awaitTermination и параметр TimeUnit.SECONDS) Не должно быть комментариев кроме приведенного output example */ public class Solution { public static void main(String[] args) throws InterruptedException { LinkedBlockingQueue<Runnable> que = new LinkedBlockingQueue<>(); for(int i = 0; i < 11; i++){ final int localId = i; Runnable runnable = new Runnable() { @Override public void run() { doExpensiveOperation(localId); } }; que.put(runnable); } ThreadPoolExecutor exec = new ThreadPoolExecutor(3, 5, 1000, TimeUnit.MILLISECONDS, que); exec.prestartAllCoreThreads(); exec.shutdown(); exec.awaitTermination(5, TimeUnit.SECONDS); /* output example pool-1-thread-2, localId=2 pool-1-thread-3, localId=3 pool-1-thread-1, localId=1 pool-1-thread-3, localId=5 pool-1-thread-2, localId=4 pool-1-thread-3, localId=7 pool-1-thread-1, localId=6 pool-1-thread-3, localId=9 pool-1-thread-2, localId=8 pool-1-thread-1, localId=10 */ } private static void doExpensiveOperation(int localId) { System.out.println(Thread.currentThread().getName() + ", localId=" + localId); } }
aaf1be570e79b4ba9162bb8e7b8b13e742889358
b5ba0941e54b7c4b1ae69251b606ced62cad9f39
/app/src/main/java/com/thssh/netmail/contrant/XMPPContant.java
c99ff9f817ac92b55edcad1c8e4bac4269668fb0
[]
no_license
zhangyugehu/NetMail
5c8b254cdc06ee1f0cc4b81ac6a1b3d19f407072
2ebecb701d2ee73335d64d11b4390ba832dac068
refs/heads/master
2021-01-25T09:31:57.359704
2017-08-14T06:59:40
2017-08-14T06:59:40
93,846,211
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package com.thssh.netmail.contrant; /** * @author zhangyugehu * @version V1.0 * @data 2017/06/09 */ public class XMPPContant { public static final String XMPP_HOST = "cwindow-im.docmail.cn"; public static final int XMPP_PORT = 5222; }
9f869a0902672f394622711a397f467599d65016
b9000a88b110b55ebb788874f73e9a5997d49b21
/synergy-components/src/test/java/kz/arta/synergy/components/client/input/date/repeat/BaseRepeatChooserTest.java
995db3924e813ed3693763f1999bba748879c9bd
[]
no_license
fourcircles/sc
09ce417954926ce59c306dd0d12160f09aa25a5e
77507d0c423858e712b59e79d0015ff0f789571c
refs/heads/master
2021-01-17T05:49:47.139057
2015-02-22T10:53:07
2015-02-22T10:53:07
25,764,163
0
0
null
null
null
null
UTF-8
Java
false
false
4,173
java
package kz.arta.synergy.components.client.input.date.repeat; import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwtmockito.GwtMockitoTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Set; import static org.junit.Assert.*; import static org.mockito.Matchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; /** * User: vsl * Date: 06.10.14 * Time: 10:52 */ @RunWith(GwtMockitoTestRunner.class) public class BaseRepeatChooserTest { private BaseRepeatChooser chooser; @Mock private ValueChangeHandler<Collection<RepeatDate>> valueHandler; @Before public void setUp() { chooser = new BaseRepeatChooser(); } @Test public void testAdd() { chooser.add(new RepeatDate(0, RepeatChooser.MODE.WEEK), false); chooser.add(new RepeatDate(0, RepeatChooser.MODE.WEEK), false); chooser.add(new RepeatDate(10, 0, RepeatChooser.MODE.YEAR), false); chooser.add(new RepeatDate(10, 0, RepeatChooser.MODE.YEAR), false); assertTrue(chooser.contains(new RepeatDate(0, RepeatChooser.MODE.WEEK))); assertTrue(chooser.contains(new RepeatDate(0, 0, RepeatChooser.MODE.WEEK))); assertTrue(chooser.contains(new RepeatDate(10, 0, RepeatChooser.MODE.YEAR))); assertEquals(2, chooser.size()); } @Test public void testRemove() { chooser.add(new RepeatDate(0, RepeatChooser.MODE.WEEK), false); chooser.add(new RepeatDate(1, RepeatChooser.MODE.WEEK), false); chooser.remove(null, false); chooser.remove(new RepeatDate(1, RepeatChooser.MODE.WEEK), false); assertTrue(chooser.contains(new RepeatDate(0, RepeatChooser.MODE.WEEK))); assertFalse(chooser.contains(new RepeatDate(1, RepeatChooser.MODE.WEEK))); assertFalse(chooser.contains(null)); } @Test public void testAdd_events() { chooser.addValueChangeHandler(valueHandler); chooser.add(new RepeatDate(0, RepeatChooser.MODE.WEEK), true); chooser.add(new RepeatDate(1, RepeatChooser.MODE.WEEK), false); chooser.add(new RepeatDate(0, RepeatChooser.MODE.WEEK), true); chooser.add(null, true); verify(valueHandler, times(1)).onValueChange(any(ValueChangeEvent.class)); } @Test public void testRemove_events() { chooser.addValueChangeHandler(valueHandler); chooser.add(new RepeatDate(0, RepeatChooser.MODE.WEEK), false); chooser.add(new RepeatDate(1, RepeatChooser.MODE.WEEK), false); chooser.remove(new RepeatDate(2, RepeatChooser.MODE.WEEK), true); chooser.remove(null, true); chooser.remove(new RepeatDate(1, RepeatChooser.MODE.WEEK), true); verify(valueHandler, times(1)).onValueChange(any(ValueChangeEvent.class)); } @Test public void testAddAll() { chooser.addValueChangeHandler(valueHandler); chooser.add(new RepeatDate(0, RepeatChooser.MODE.WEEK), false); chooser.add(new RepeatDate(1, RepeatChooser.MODE.WEEK), false); chooser.add(new RepeatDate(2, RepeatChooser.MODE.WEEK), false); chooser.add(new RepeatDate(3, RepeatChooser.MODE.WEEK), false); Set<RepeatDate> addDates = new HashSet<RepeatDate>(); addDates.addAll(Arrays.asList( new RepeatDate(2, RepeatChooser.MODE.WEEK), new RepeatDate(3, RepeatChooser.MODE.WEEK), new RepeatDate(4, RepeatChooser.MODE.WEEK), new RepeatDate(5, RepeatChooser.MODE.WEEK) )); chooser.addAll(addDates, true); ArgumentCaptor<ValueChangeEvent> captor = ArgumentCaptor.forClass(ValueChangeEvent.class); verify(valueHandler, times(1)).onValueChange(captor.capture()); Set<RepeatDate> newDates = (Set<RepeatDate>) captor.getValue().getValue(); assertEquals(2, newDates.size()); } }
d3140faa49b58ae487d0a7c84257bcedf2cac121
344776fe86c9fb053935294354179fccce4427f3
/src/main/java/cn/mxsc/pojo/Cart.java
d2ed4bfe499ed68b1748da2131174ace2d9c8ce1
[]
no_license
sunshine1205/mxsc
6f404be5e2253351ce90f1cfbdc5052126f6c001
1f5cbfcac120771b3efe29d10047585e48afccd2
refs/heads/master
2020-03-25T10:43:11.171535
2018-08-09T07:14:49
2018-08-09T07:14:49
143,703,221
4
0
null
null
null
null
UTF-8
Java
false
false
1,745
java
package cn.mxsc.pojo; import java.util.Date; public class Cart { private Integer id; private Integer userId; private Integer productId; private Integer quantity; private Integer checked; private Date createTime; private Date updateTime; public Cart(Integer id, Integer userId, Integer productId, Integer quantity, Integer checked, Date createTime, Date updateTime) { this.id = id; this.userId = userId; this.productId = productId; this.quantity = quantity; this.checked = checked; this.createTime = createTime; this.updateTime = updateTime; } public Cart() { super(); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public Integer getProductId() { return productId; } public void setProductId(Integer productId) { this.productId = productId; } public Integer getQuantity() { return quantity; } public void setQuantity(Integer quantity) { this.quantity = quantity; } public Integer getChecked() { return checked; } public void setChecked(Integer checked) { this.checked = checked; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } }
c3f078f19580ed4185a1dbae3ef0c077148c7c12
60840404590c3d60d142527d48598e00b68c8d1e
/src/com/godme/leetcode/q227/Solution.java
34a36fd21d97a44e590026f95e95465a6e209fd3
[]
no_license
just-worker/algorithm
199d457be133a8d420c81004de68ee6c41bb0f6e
00248e0cd3b82e5bf6062c54e87660d583692f3a
refs/heads/master
2023-05-14T08:06:18.830726
2021-06-02T11:55:24
2021-06-02T11:55:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
903
java
package com.godme.leetcode.q227; import java.util.Stack; class Solution { public int calculate(String s) { Stack<Integer> stack = new Stack<>(); int value = 0; char lastOp = '+'; for(char ch: (s+"+").toCharArray()){ if(ch == ' ') continue;; if(Character.isDigit(ch)){ value = value * 10 + ch - '0'; } else { switch (lastOp){ case '+': stack.push(value);break; case '-': stack.push(-value);break; case '*': stack.push(stack.pop()* value); break; case '/': stack.push(stack.pop() / value); break; } value = 0; lastOp = ch; } } int sum = 0; while(stack.isEmpty()){ sum += stack.pop(); } return sum; } }
87688f878a4c73012c24e443f40016ced0206d4d
09ef37b2cce10a73112c080309dde4069059dd4b
/app/src/main/java/com/example/mfikrihasani/imagerecognition/ChainCode.java
6fe996b7f82e9b6432bae941f2fd2d2a1f4fcc78
[]
no_license
fikrihasani/Pengenalan-Pola
0501c8d121c7f208e7b0c7ea86428de05214c374
2535a7eabc0cc04fd5944a52e9c58a11da570e16
refs/heads/master
2020-03-30T03:37:09.540348
2019-02-03T13:22:38
2019-02-03T13:22:38
150,698,108
0
0
null
null
null
null
UTF-8
Java
false
false
165
java
package com.example.mfikrihasani.imagerecognition; public class ChainCode { int x,y; public ChainCode(int a, int b){ x = a; y = b; } }
028aea26a2b08e53ad52bb213e80f9b797ff9932
07a19cc5b373289568756509fbb1f838ba880570
/src/main/java/org/apache/ibatis/parsing/GenericTokenParser.java
cc1f9411c6e7b41beed0408e2029b312ff7bec3c
[]
no_license
FantasyDream/mybatis-3.5-learning
afc46e425eac631249b9452f90c52798d8de52bd
3b13cfe56aafb568addbc1a1c661bb29f3e0bf41
refs/heads/master
2022-10-04T08:43:04.756980
2019-12-26T09:57:29
2019-12-26T09:57:29
179,459,938
0
0
null
2022-09-08T00:59:45
2019-04-04T08:54:43
Java
UTF-8
Java
false
false
3,523
java
/** * Copyright 2009-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ibatis.parsing; /** * 占位符解析器,用于解析XML文件中的占位符 */ public class GenericTokenParser { /** * 占位符开始标记 */ private final String openToken; /** * 占位符结束标记 */ private final String closeToken; /** * 占位符解析,得到占位符的值 */ private final TokenHandler handler; public GenericTokenParser(String openToken, String closeToken, TokenHandler handler) { this.openToken = openToken; this.closeToken = closeToken; this.handler = handler; } public String parse(String text) { if (text == null || text.isEmpty()) { return ""; } // 寻找占位符开始值,并检测是否含有占位符 int start = text.indexOf(openToken); if (start == -1) { return text; } char[] src = text.toCharArray(); int offset = 0; final StringBuilder builder = new StringBuilder(); StringBuilder expression = null; while (start > -1) { if (start > 0 && src[start - 1] == '\\') { // 遇到转义的开始标记(反斜杠),直接删除并继续. builder.append(src, offset, start - offset - 1).append(openToken); offset = start + openToken.length(); } else { // 已找到开始字符,现在寻找结束字符 if (expression == null) { expression = new StringBuilder(); } else { expression.setLength(0); } // 将开始字符前面的字符追加到builder中 builder.append(src, offset, start - offset); offset = start + openToken.length(); // 从offset后面查找结束字符 int end = text.indexOf(closeToken, offset); while (end > -1) { if (end > offset && src[end - 1] == '\\') { // 处理转义的结束字符 expression.append(src, offset, end - offset - 1).append(closeToken); offset = end + closeToken.length(); end = text.indexOf(closeToken, offset); } else { // 将开始标记和结束标记中间的字符放到expression中. expression.append(src, offset, end - offset); offset = end + closeToken.length(); break; } } if (end == -1) { // 未找到结束字符 builder.append(src, start, src.length - start); offset = src.length; } else { // 将占位符包含的值交给TokenHandler处理,并将处理结果追加到builder中保存. 最终组成完整内容 builder.append(handler.handleToken(expression.toString())); offset = end + closeToken.length(); } } start = text.indexOf(openToken, offset); } if (offset < src.length) { builder.append(src, offset, src.length - offset); } return builder.toString(); } }
cb4446d8a07bb351970475bf88d8bf3399c5f472
fe7c2879e61d84bc9318c80f1424fce02bf72afb
/app/src/main/java/com/github/blizz2night/testinterpolation/Utils.java
409b1086c17dcf2f5514118f3e1e7e82fedc5d60
[]
no_license
blizz2night/TestInterpolation
0adffce38857e7a5300060c18679d33720825966
d09ffad20a8441c7c2e3b5d2b7f7c71bd389b8b7
refs/heads/master
2022-10-26T00:53:15.496799
2020-06-14T17:46:17
2020-06-14T17:46:17
271,263,014
0
0
null
null
null
null
UTF-8
Java
false
false
3,435
java
package com.github.blizz2night.testinterpolation; import android.content.Context; import android.opengl.GLES20; import android.util.Log; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Utils { private static final String TAG = "GLUtils"; public static String getStringFromFileInAssets(Context context, String filename){ StringBuilder builder = new StringBuilder(); try (InputStream ins = context.getAssets().open(filename); InputStreamReader insReader = new InputStreamReader(ins); BufferedReader reader = new BufferedReader(insReader)) { String line; while ((line = reader.readLine()) != null) { builder.append(line).append("\n"); } } catch (IOException e) { Log.e(TAG, "getStringFromFileInAssets: ", e); } return builder.toString(); } public static int loadShader(String strSource, int iType) { int[] compiled = new int[1]; int iShader = GLES20.glCreateShader(iType); GLES20.glShaderSource(iShader, strSource); GLES20.glCompileShader(iShader); GLES20.glGetShaderiv(iShader, GLES20.GL_COMPILE_STATUS, compiled, 0); if (compiled[0] == 0) { Log.d(TAG, "Compilation\n" + GLES20.glGetShaderInfoLog(iShader)); return 0; } return iShader; } public static int loadProgram(String strVSource, String strFSource) { int[] link = new int[1]; int iVShader = loadShader(strVSource, GLES20.GL_VERTEX_SHADER); if (iVShader == 0) { Log.d(TAG, "Vertex Shader Failed"); return 0; } int iFShader = loadShader(strFSource, GLES20.GL_FRAGMENT_SHADER); if (iFShader == 0) { Log.d(TAG, "Fragment Shader Failed"); return 0; } int iProgId = GLES20.glCreateProgram(); GLES20.glAttachShader(iProgId, iVShader); GLES20.glAttachShader(iProgId, iFShader); GLES20.glLinkProgram(iProgId); GLES20.glGetProgramiv(iProgId, GLES20.GL_LINK_STATUS, link, 0); if (link[0] <= 0) { Log.d(TAG, "Linking Failed"); return 0; } GLES20.glDeleteShader(iVShader); GLES20.glDeleteShader(iFShader); return iProgId; } // public void generateBitmap(View view) { // Bitmap bitmap = Bitmap.createBitmap(16, 256, Bitmap.Config.ARGB_8888); // final int[] pixels = new int[16 * 256]; // for (int b = 0; b < 16; b++) { // for (int g = 0; g < 16; g++) { // for (int r = 0; r < 16; r++) { // pixels[r + 16 * g + 256 * b] = 0xFF000000 | (r * 16 << 16) | (g * 16 << 8) | b * 16; // } // } // } // bitmap.setPixels(pixels,0,16,0,0,16,256); // final File dir = getExternalMediaDirs()[0]; // final File file = new File(dir, "lut.png"); // try { // file.createNewFile(); // } catch (IOException e) { // e.printStackTrace(); // } // try (FileOutputStream stream = new FileOutputStream(file)){ // bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); // } catch (IOException e) { // e.printStackTrace(); // } // } }
bb1af12bb9dfa44099bc92a374828572bc8989ef
6fcc4c26743ed45346b2ddc904a0831784e16c47
/09. 1. JSON-Processing/people/src/main/java/app/domain/model/Address.java
ab4de513eec6f219457edfa3f1560a3fa482d302
[ "MIT" ]
permissive
kostadinlambov/Databases-Frameworks-Hibernate-and-Spring-Data-Sept-2018
1734bf73dedc8ff63752cf2a45a17853829466c7
89c8d70443a89b2ca45f8dfdd6b2032ba6fbcf30
refs/heads/master
2020-04-03T04:50:11.030564
2018-12-10T20:38:02
2018-12-10T20:38:02
155,025,474
2
0
null
null
null
null
UTF-8
Java
false
false
1,045
java
package app.domain.model; import javax.persistence.*; import java.io.Serializable; import java.lang.annotation.Target; @Entity @Table(name = "addresses") public class Address implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; @Column(name = "country") private String country; @Column(name = "city") private String city; @Column(name = "street") private String street; public Address() { } public long getId() { return this.id; } public void setId(long id) { this.id = id; } public String getCountry() { return this.country; } public void setCountry(String country) { this.country = country; } public String getCity() { return this.city; } public void setCity(String city) { this.city = city; } public String getStreet() { return this.street; } public void setStreet(String street) { this.street = street; } }
d91018a815c22af3e01b325e099dccb737565efa
6cc1f0ec597ab8707b8f202dccdb73bcb919bfad
/AAD2 Lab1/src/Exercise2/Student.java
b8b6217318d730047c03db3c4849e539bc865c04
[]
no_license
htcvtc59/JavaSwing
084beaccab1654b7abab3da7c13b6c1db28e0735
af03728eb0eb464e9941846f1d5988abbd2e9979
refs/heads/master
2021-01-19T08:31:49.959326
2017-04-08T15:17:56
2017-04-08T15:17:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
921
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Exercise2; /** * * @author Monkey.TNT */ public class Student { private String name; private int rollno; private String classs; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getRollno() { return rollno; } public void setRollno(int rollno) { this.rollno = rollno; } public String getClasss() { return classs; } public void setClasss(String classs) { this.classs = classs; } public Student(String name, int rollno, String classs) { this.name = name; this.rollno = rollno; this.classs = classs; } }
574c821469b97415edbb4e3d40648c1449b869e0
7ad600f480fa66b065d5b1ab3e365371315775cc
/xueyuan_parent/service/service_edu/src/main/java/com/fjc/edu/mapper/ChapterMapper.java
d61a8ea9d136ab9d1992365f4e86e99560e2ae19
[]
no_license
funfan1106/Demo1106
70021c3ae31ce5480f34612c408e167cfbf65772
72670e628654f02bfdd1a99752e773d95ccdc3b7
refs/heads/master
2023-03-30T19:57:53.492855
2021-04-08T08:38:21
2021-04-08T08:38:21
355,820,315
0
0
null
null
null
null
UTF-8
Java
false
false
276
java
package com.fjc.edu.mapper; import com.fjc.edu.entity.Chapter; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> * 课程 Mapper 接口 * </p> * * @author testjava * @since 2021-02-28 */ public interface ChapterMapper extends BaseMapper<Chapter> { }
4c084d9765c4d745522e699af0b72191368b5887
6305a0e194879c7a421ee8780e0e652f59bdbd44
/src/main/java/eu/luminis/genetics/MovementGeneEvolver.java
6fbeff43b76093ddd8ef80b4441a9324876f8788
[]
no_license
verbeekgerard/evoluting-life-java
056acbbd7c958772eef28a719fdeec561a3f4ccf
5039ba4a9aef40ff183123103d228fa66d661572
refs/heads/master
2021-01-18T02:27:23.352677
2018-04-01T07:52:33
2018-04-01T07:52:33
64,153,051
1
2
null
2018-04-01T07:52:34
2016-07-25T17:08:18
Java
UTF-8
Java
false
false
698
java
package eu.luminis.genetics; import eu.luminis.Options; import eu.luminis.util.Range; class MovementGeneEvolver extends Evolver { public final EvolvingValue AngularForce = new EvolvingValue( Options.angularForceMutationRate, Options.angularForceReplacementRate, Options.mutationFraction, new Range(Options.minAngularForce.get(), Options.maxAngularForce.get())); public final EvolvingValue LinearForce = new EvolvingValue( Options.linearForceMutationRate, Options.linearForceReplacementRate, Options.mutationFraction, new Range(Options.minLinearForce.get(), Options.maxLinearForce.get())); }
cb2ee8dd5b5d34383b9e12257bdba92b957a6974
62cdae1b27b4324a42148381daf18dfaaf3c6d75
/src/main/java/com/bludkiewicz/montyhall/core/service/results/SingleGameResult.java
78fc63f3c9a8173e558577b7cc52e23b3fd09abf
[ "MIT" ]
permissive
bludkiewicz/montyhall
79106492a95ebb179d46b408af715d82d3d59441
af0ef6746932083a43159a725d852a62a4c27399
refs/heads/master
2023-01-05T12:16:04.611478
2020-11-03T02:02:35
2020-11-03T02:02:35
306,983,390
0
0
null
null
null
null
UTF-8
Java
false
false
1,139
java
package com.bludkiewicz.montyhall.core.service.results; import com.bludkiewicz.montyhall.core.service.enums.Door; import com.bludkiewicz.montyhall.core.service.enums.Prize; /** * Representation of a single games results. * * As there can be 1000s of these per request, this should follow flyweight pattern. */ public class SingleGameResult { private final Door doorWithCar; private final Door originalDoor; private final Door selectedDoor; public SingleGameResult(Door doorWithCar, Door originalDoor, Door selectedDoor) { this.doorWithCar = doorWithCar; this.originalDoor = originalDoor; this.selectedDoor = selectedDoor; } public Prize getDoorOne() { return getPrize(Door.ONE); } public Prize getDoorTwo() { return getPrize(Door.TWO); } public Prize getDoorThree() { return getPrize(Door.THREE); } private Prize getPrize(Door door) { if (doorWithCar == door) return Prize.CAR; return Prize.GOAT; } public Door getOriginalChoice() { return originalDoor; } public Door getSelectedChoice() { return selectedDoor; } public boolean isWinner() { return (selectedDoor == doorWithCar); } }
547784ed9a84e0e899cb09371858ca5cf4c49917
55db5a707ffc9b7878b816955a80f40353b48cec
/src/main/java/allout58/jambot/util/CommandParser.java
92f783cc74d19057dccbbf8606501b7e5d2d38ce
[]
no_license
allout58/JavaBot
25ea6b4545ece4509da0ffe73fc39ccf1cb68206
edd6cf8517e8b5a261676b313f9c8da7e889ae03
refs/heads/master
2021-01-23T13:57:30.385640
2015-03-05T02:31:50
2015-03-05T02:31:50
23,172,447
0
0
null
2015-04-09T02:08:51
2014-08-21T03:14:09
Java
UTF-8
Java
false
false
4,760
java
package allout58.jambot.util; import allout58.jambot.JamBot; import allout58.jambot.api.API; import allout58.jambot.api.IChannel; import allout58.jambot.api.IClient; import allout58.jambot.api.ICommand; import allout58.jambot.api.IMatcher; import allout58.jambot.api.IResponder; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ArrayBlockingQueue; /** * Created by James Hollowell on 8/18/2014. */ public class CommandParser { private static final Logger log = LogManager.getLogger("CommandParser"); private static final ArrayBlockingQueue<String> commands = new ArrayBlockingQueue<String>(8); private static final ArrayBlockingQueue<String> matchers = new ArrayBlockingQueue<String>(8); private static boolean lockCommands = false; private static boolean lockMatchers = false; public static boolean tryCommand(IClient sender, final IChannel chan, String message) { EnumCommandPrefix prefix = (EnumCommandPrefix) JamBot.config.getValue("prefix"); if (message.startsWith(prefix.getPrefix())) { String cmdName = message.substring(prefix.getPrefix().length()); if (cmdName.contains(" ")) cmdName = cmdName.substring(0, cmdName.indexOf(" ")); for (IResponder r : API.responders) { if (!(r instanceof ICommand)) continue; if (r.getName().equals(cmdName) && !lockCommands) { if (!commands.offer(cmdName)) { int count = 0; int countEl = 0; commands.iterator(); for (Iterator<String> it = commands.iterator(); it.hasNext(); ) { String test = it.next(); if (test.equals(cmdName)) count++; if ("...".equals(test)) countEl++; } if (countEl >= 3) { lockCommands = true; chan.sendMessage("Commands disabled for 15 seconds."); new Timer(false).schedule(new TimerTask() { @Override public void run() { lockCommands = false; commands.clear(); chan.sendMessage("Commands re-enabled."); } }, 15000); } if (count >= 5) { chan.sendMessage("..."); commands.poll(); commands.offer("..."); } else lockCommands = false; commands.poll(); } if (Permissions.canDo(sender.getPermLevel(chan), ((ICommand) r).getCommandLevel())) { String woComName = message.substring(prefix.getPrefix().length() + cmdName.length()); List<String> a1 = Arrays.asList(woComName.split(" ")); ArrayList<String> a2 = new ArrayList<String>(a1); if ("".equals(a2.get(0))) a2.remove(0); try { ((ICommand) r).processCommand(sender, chan, a2.toArray(new String[a2.size()])); } catch (Exception e) { log.error("Error processing command " + r.getName(), e); } return true; } else { sender.sendPM("You don't have permission to do this. Your perms: " + sender.getPermLevel(chan).name() + ". Required: " + ((ICommand) r).getCommandLevel().name()); } } } return false; } else return false; } public static void doMatchers(IChannel sender, String message) { for (IResponder r : API.responders) { if (!(r instanceof IMatcher)) continue; ((IMatcher) r).match(sender, message); } } }
ee12718da7d6e0653b4906e65a9204880f88e69e
5d428dfa0e33c3334acf29478327d2410220c640
/pineapple/src/main/java/com/pineapple/service/ReportService.java
8e72117456f14f14922bad41ca50411dba0904bd
[]
no_license
joyechans/PineApple
f6ccad6d4911f6c0f6a43b3915246774853c1414
f91446b6571bf1f71b9c36d1cd5c97a2623ae316
refs/heads/master
2022-12-22T17:54:13.247317
2019-11-19T10:45:12
2019-11-19T10:45:12
199,996,343
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package com.pineapple.service; import java.util.List; import com.pineapple.vo.Payment; import com.pineapple.vo.PaymentDetail; import com.pineapple.vo.Product; //import com.catwebsite.vo.Upload; public interface ReportService { List<PaymentDetail> productReport(Product product); List<Payment> monthlyReport(); List<Payment> memberReport(); }
e195667d43f9fa6a83b5a1a0f9889616cba94aee
3d4349c88a96505992277c56311e73243130c290
/Preparation/processed-dataset/god-class_3_917/9.java
f330383ea4611d4f60661cd19c4a1ea4293a447d
[]
no_license
D-a-r-e-k/Code-Smells-Detection
5270233badf3fb8c2d6034ac4d780e9ce7a8276e
079a02e5037d909114613aedceba1d5dea81c65d
refs/heads/master
2020-05-20T00:03:08.191102
2019-05-15T11:51:51
2019-05-15T11:51:51
185,272,690
7
4
null
null
null
null
UTF-8
Java
false
false
45
java
public String getName() { return name; }
32a32bd4f27b0dec3b5eff9d43d82618fbfc8917
f55492fb48b0a2de71d2b2a8a487f7e7803f0ebb
/src/Simulation.java
e7d54ca8dc5b58bfb5e167224c4a8f3b3ad8c106
[]
no_license
ChrisMcCat/spacemasterz
c14e1cedb5d0ca3cec7ab7b593ce6bd048e124d0
c2b1f6351a8c76fa1e6be86a1ab16b4789444d28
refs/heads/master
2020-09-15T14:41:06.350422
2019-11-22T20:46:15
2019-11-22T20:46:15
223,478,795
0
0
null
null
null
null
UTF-8
Java
false
false
4,142
java
import java.io.FileNotFoundException; import java.io.File; import java.util.ArrayList; import java.util.Scanner; public class Simulation { public Simulation() { } ArrayList<Item> loadItems(String fileName) throws FileNotFoundException { File file = new File(fileName); Scanner scan = new Scanner(file); ArrayList<Item> items = new ArrayList<>(); while(scan.hasNextLine()){ String line = scan.nextLine(); String[] oneItem = line.split("="); items.add(new Item(oneItem[0], Integer.valueOf(oneItem[1]))); } System.out.println(fileName + " contains " + items.size() + " items"); return items; } ArrayList<Rocket> loadU1(ArrayList<Item> list) { ArrayList<Rocket> fleet = new ArrayList<>(); Rocket r = new U1(); int itemCounter = 1; int rocketCounter = 1; System.out.println("\nU1 Rocket weight = " + r.weight + "; maxWeight = " + r.maxWeight); for (Item i : list) { while (!r.canCarry(i)) { rocketCounter++; fleet.add(r); r = new U1(); } r.carry(i); itemCounter++; } fleet.add(r); System.out.println("U1 fleet contains " + fleet.size() + " rockets"); return fleet; } ArrayList<Rocket> loadU2(ArrayList<Item> list) { ArrayList<Rocket> fleet = new ArrayList<>(); Rocket r = new U2(); int itemCounter = 1; int rocketCounter = 1; System.out.println("U2 Rocket weight = " + r.weight + "; maxWeight = " + r.maxWeight); for (Item i : list) { while (!r.canCarry(i)) { rocketCounter++; fleet.add(r); r = new U2(); } r.carry(i); itemCounter++; } fleet.add(r); System.out.println("U2 fleet contains " + fleet.size() + " rockets\n"); return fleet; } int runSimulation(ArrayList<Rocket> list) { int num = 0; //failed trials of launch/land int indexSuccess = 1; for (Rocket r : list) { while (!r.launch()) { r.launch(); num++; } while (!r.land()) { r.land(); num++; } indexSuccess++; } int budget = list.get(0).cost * (list.size() + num); System.out.println(list.size() + " rockets and " + num + " extra trials = " + (list.size() + num) + " in total"); return budget; } public static void main(String[] args) throws FileNotFoundException { Simulation sim = new Simulation(); ArrayList<Item> phase1 = sim.loadItems("phase-1.txt"); ArrayList<Item> phase2 = sim.loadItems("phase-2.txt"); ArrayList<Rocket> u1FleetPhase1 = sim.loadU1(phase1); ArrayList<Rocket> u1FleetPhase2 = sim.loadU1(phase2); System.out.println("\nU1 rocket cost = 100"); int budgetU1phase1 = sim.runSimulation(u1FleetPhase1); System.out.println("Budget of U1 fleet for phase 1 = " + budgetU1phase1 + " (millions)"); int budgetU1phase2 = sim.runSimulation(u1FleetPhase2); System.out.println("Budget of U1 fleet for phase 2 = " + budgetU1phase2 + " (millions)"); System.out.println("Total budget of U1 fleet = " + (budgetU1phase1 + budgetU1phase2) + " (millions)\n"); ArrayList<Rocket> u2FleetPhase1 = sim.loadU2(phase1); ArrayList<Rocket> u2FleetPhase2 = sim.loadU2(phase2); System.out.println("\nU2 rocket cost = 120"); int budgetU2phase1 = sim.runSimulation(u2FleetPhase1); System.out.println("Budget of U2 fleet for phase 1 = " + budgetU2phase1 + " (millions)"); int budgetU2phase2 = sim.runSimulation(u2FleetPhase2); System.out.println("Budget of U2 fleet for phase 2 = " + budgetU2phase2 + " (millions)"); System.out.println("Total budget of U1 fleet = " + (budgetU2phase1 + budgetU2phase2) + " (millions)\n"); } }
fd02fd78fdef83af260730edc675e42ce1c8419d
f37147e77d1942aca55f54abde22bf9627581beb
/src/Leet118.java
77e275f27ffcc0a1e9974fd844abf722964d42c2
[]
no_license
gus07ven/Algorithms
2d970941dbce635038993223387826f940e492f8
d0003f32f48a1e142002062ec9e070b4bb06a93b
refs/heads/master
2020-05-07T11:03:57.853737
2019-09-17T23:27:55
2019-09-17T23:27:55
180,443,396
0
0
null
null
null
null
UTF-8
Java
false
false
1,055
java
import java.util.ArrayList; import java.util.List; public class Leet118 { public static List<List<Integer>> generate(int numRows) { if(numRows < 1){ List<List<Integer>> emptyList = new ArrayList<>(); return emptyList; } List<List<Integer>> pasTri = new ArrayList<>(); ArrayList<Integer> firstLevel = new ArrayList<>(); firstLevel.add(1); pasTri.add(firstLevel); for(int i = 1; i < numRows; i++){ List<Integer> prevLevel = pasTri.get(i - 1); List<Integer> currLevel = new ArrayList<>(); currLevel.add(1); for(int j = 1; j < prevLevel.size(); j++){ currLevel.add(prevLevel.get(j - 1) + prevLevel.get((j))); } currLevel.add(1); pasTri.add(currLevel); } return pasTri; } public static void main(String[] args) { int numRows = 0; List<List<Integer>> result = generate(numRows); // Print result for(List<Integer> list : result){ for(Integer i : list){ System.out.print(i); } System.out.println(); } } }
cdd0805cda286ae763ad5e692bfd09adf612d068
9fd3823352fc0175a9755b608de9e8f985ce049a
/src/main/java/ec/edu/ups/appdis/view/EmployeeSelectionBean.java
55c7737e4055be00a6aff6fab3e7d59e69e20996
[]
no_license
michaeljmhe/Project_Sistema_Restaurante_Final
6624c48f4442db2c5a0a1b0bd9495e12f62604dc
20810f3d47ed0cfeeff2d319bca43c04cd942e25
refs/heads/master
2020-04-22T03:35:21.949622
2019-02-11T08:37:36
2019-02-11T08:37:36
170,092,442
0
0
null
null
null
null
UTF-8
Java
false
false
823
java
package ec.edu.ups.appdis.view; import java.util.Arrays; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; @ManagedBean(name = "empSelectBean") @ViewScoped public class EmployeeSelectionBean { private List<String> selectedEmployees; private List<String> employees; @PostConstruct public void init() { employees = Arrays.asList("Jim", "Sara", "Tom", "Diana", "Tina", "Joe", "Lara", "Charlie"); } public void setSelectedEmployees(List<String> selectedEmployees) { this.selectedEmployees = selectedEmployees; } public List<String> getSelectedEmployees() { return selectedEmployees; } public List<String> getEmployees() { return employees; } }
[ "michael@DESKTOP-UJRR39U" ]
michael@DESKTOP-UJRR39U
b26150618cdad2d002ca03615cebd939db6f415a
ee37c6cf63564b9cb4855ab15cf375a723daf47f
/app/src/main/java/org/endcoronavirus/outreach/models/DataStorageDatabase.java
111728e9017067485091a292ae63aac2c6aa57f5
[]
no_license
JetPlaneJJ/outreachapp-android
d44906f4d84dc30886c01660ea839b38b5e36957
4c8098403af1fa262d8763ad4b0313042ce21327
refs/heads/master
2021-04-15T03:05:28.729635
2020-03-23T02:20:20
2020-03-23T02:20:20
249,290,088
0
0
null
2020-03-22T23:11:32
2020-03-22T23:11:32
null
UTF-8
Java
false
false
496
java
package org.endcoronavirus.outreach.models; import androidx.room.Database; import androidx.room.RoomDatabase; import org.endcoronavirus.outreach.dao.CommunityDetailsDao; import org.endcoronavirus.outreach.dao.ContactDetailsDao; @Database(entities = {CommunityDetails.class, ContactDetails.class}, version = 4) public abstract class DataStorageDatabase extends RoomDatabase { public abstract CommunityDetailsDao communityDao(); public abstract ContactDetailsDao contactDetailsDao(); }
0910b034cec351b6058b2e7f750cad9e305082fd
cb36589df78bd9e90c700dbcf511350cb13e807c
/src/com/hbuas/pojo/entity/DonatePlantInfo.java
4983419a25f8cdeba170cbb451f0d5b0344e2c42
[]
no_license
FishGold/WeixinYuanLinApp3
5d0de05c090331d2dc81d3b3e669f17a51ea473e
03657d430775a378f5b225b7176daef9da2ece7b
refs/heads/master
2021-01-17T12:52:27.078088
2016-06-22T00:23:14
2016-06-22T00:23:14
57,470,522
0
1
null
null
null
null
UTF-8
Java
false
false
2,691
java
package com.hbuas.pojo.entity; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.sql.Date; /** * Created by dell on 2016/6/5. */ @Entity public class DonatePlantInfo { private int id; private int userId; private String userName; private String phone; private String plantName; private String reason; private String image_1; private String image_2; private String image_3; private String plantDesc; private Date donateDate; private int isAdopted; public DonatePlantInfo(){} public DonatePlantInfo(String image_1,String plantName,String reason,String plantDesc){ super(); this.image_1 = image_1; this.reason = reason; this.plantDesc = plantDesc; this.plantName = plantName; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public int getId() { return id; } public void setId(int id) { this.id = id; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPlantName() { return plantName; } public void setPlantName(String plantName) { this.plantName = plantName; } public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } public String getImage_1() { return image_1; } public void setImage_1(String image_1) { this.image_1 = image_1; } public String getImage_2() { return image_2; } public void setImage_2(String image_2) { this.image_2 = image_2; } public String getImage_3() { return image_3; } public void setImage_3(String image_3) { this.image_3 = image_3; } public Date getDonateDate() { return donateDate; } public void setDonateDate(Date donateDate) { this.donateDate = donateDate; } public String getPlantDesc() { return plantDesc; } public void setPlantDesc(String plantDesc) { this.plantDesc = plantDesc; } public int getIsAdopted() { return isAdopted; } public void setIsAdopted(int isAdopted) { this.isAdopted = isAdopted; } }
f555a61657cbd33517cbaed08214c913d6f50ab0
fc1bf26252525f1dca780f0c26cea165c3b3f531
/com/planet_ink/coffee_mud/Abilities/Properties/Prop_ItemSlotFiller.java
92f91041a2e3a1c9be70ef4d99b7ed3e780c77ee
[ "Apache-2.0" ]
permissive
mikael2/CoffeeMud
8ade6ff60022dbe01f55172ba3f86be0de752124
a70112b6c67e712df398c940b2ce00b589596de0
refs/heads/master
2020-03-07T14:13:04.765442
2018-03-28T03:59:22
2018-03-28T03:59:22
127,521,360
1
0
null
2018-03-31T10:11:54
2018-03-31T10:11:53
null
UTF-8
Java
false
false
4,794
java
package com.planet_ink.coffee_mud.Abilities.Properties; import com.planet_ink.coffee_mud.core.CMClass; import com.planet_ink.coffee_mud.core.CMLib; import com.planet_ink.coffee_mud.core.CMParms; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.CharClass; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.MOB; import com.planet_ink.coffee_mud.Races.interfaces.Race; import java.util.*; /* Copyright 2015-2018 Bo Zimmerman Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ public class Prop_ItemSlotFiller extends Property { @Override public String ID() { return "Prop_ItemSlotFiller"; } @Override public String name() { return "Provides for enhanced item slots."; } @Override protected int canAffectCode() { return Ability.CAN_ITEMS; } protected int slotCount = 1; protected String slotType = ""; protected Ability[] affects = new Ability[0]; protected Physical affected2 = null; protected List<String> skips = new ArrayList<String>(0); protected static Item fakeItem = null; @Override public void setAffectedOne(Physical P) { if((P==this.affected)||(affected==null)) { super.setAffectedOne(P); } else { affected2 = P; for(Ability A : getAffects()) { if((A!=null)&&(!A.ID().equals("Prop_ItemSlot"))) A.setAffectedOne(P); } } } protected Physical getAffected() { if(affected2 instanceof Item) return affected2; if(fakeItem == null) { fakeItem=CMClass.getBasicItem("StdItem"); } return fakeItem; } protected Ability[] getAffects() { if((affects.length==0)&&(this.affecting()!=null)&&(this.affecting().numEffects()>1)) { final List<Ability> newAffects=new LinkedList<Ability>(); for(Enumeration<Ability> a=this.affecting().effects();a.hasMoreElements();) { Ability A=a.nextElement(); if((A!=this)&&(!skips.contains(A.ID().toUpperCase()))) { A.setAffectedOne(getAffected()); newAffects.add(A); // not the copy! } } affects=newAffects.toArray(new Ability[0]); } return affects; } @Override public void setMiscText(String text) { slotCount = CMParms.getParmInt(text, "NUM", 1); slotType= CMParms.getParmStr(text, "TYPE", ""); skips.clear(); skips.addAll(CMParms.parseCommas(CMParms.getParmStr(text(), "SKIPS", "").toUpperCase(), true)); super.setMiscText(text); } @Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; for(Ability A : getAffects()) { if((A!=null)&&(!A.ID().equals("Prop_ItemSlot"))) { if(!A.okMessage(myHost, msg)) return false; } } return true; } @Override public void executeMsg(final Environmental myHost, final CMMsg msg) { for(Ability A : getAffects()) { if((A!=null)&&(!A.ID().equals("Prop_ItemSlot"))) { A.executeMsg(myHost, msg); } } super.executeMsg(myHost, msg); } @Override public void affectPhyStats(Physical host, PhyStats affectableStats) { for(Ability A : getAffects()) { if((A!=null)&&(!A.ID().equals("Prop_ItemSlot"))) { A.affectPhyStats(host, affectableStats); } } super.affectPhyStats(host,affectableStats); } @Override public void affectCharStats(MOB affectedMOB, CharStats affectedStats) { for(Ability A : getAffects()) { if((A!=null)&&(!A.ID().equals("Prop_ItemSlot"))) { A.affectCharStats(affectedMOB, affectedStats); } } super.affectCharStats(affectedMOB,affectedStats); } @Override public void affectCharState(MOB affectedMOB, CharState affectedState) { for(Ability A : getAffects()) { if((A!=null)&&(!A.ID().equals("Prop_ItemSlot"))) { A.affectCharState(affectedMOB, affectedState); } } super.affectCharState(affectedMOB,affectedState); } }
44cb088265cdafb941eddc3427c05779cd6f058e
4e4cc3f1e1158aa00910e297f9baef15c6f0cb26
/ThePoint/gen/com/totoo/filer/BuildConfig.java
942c39577342a01cdf22b14b6396622e8b1e21af
[]
no_license
totooaoo34/ThePoint
e5344e13403da0519987b9bcd9c89976bb558003
0b41d221d4a91679fc6a61550685a8fbd9f30889
refs/heads/master
2021-09-06T07:56:23.294927
2018-02-04T02:35:02
2018-02-04T02:35:02
120,113,031
0
0
null
null
null
null
UTF-8
Java
false
false
157
java
/** Automatically generated file. DO NOT MODIFY */ package com.totoo.filer; public final class BuildConfig { public final static boolean DEBUG = true; }
16e330b9eacb7801211dd20427affbbd7d7cc04f
bbee00f121d981fa647e070c42c1da0ce87980d8
/EndTerm/src/com/company/repositories/interfaces/ITeamRepository.java
25b10fba6f1750f2882cfcd7bf60b625b46a98f5
[]
no_license
Kusha25/endterm1
68f20901a94bfe48af931d576fcae8f501854a84
89bbb373aeeb77e48ef1f7db039c0e8f7b18fe13
refs/heads/main
2023-03-20T08:59:55.623084
2021-03-11T06:21:05
2021-03-11T06:21:05
346,599,073
0
0
null
null
null
null
UTF-8
Java
false
false
87
java
package com.company.repositories.interfaces; public interface ITeamRepository { }
4200ba0e8ddc8c91c835da65722e4df52c8f6592
24cba2d03035e1921f57aa7a80c9b10f1f65676b
/common-model/src/main/java/com/liurq/server/model/DoctorVisit.java
7dccaa760391afa76c8413ad671cf29b05692621
[]
no_license
Malmoney/hospital-registration-i
97766aed769c7f9ee242ac42ed62713fe15e948b
1ed84fb10cd4bee5da0dd4573160784b09cb3fa6
refs/heads/master
2023-06-20T08:11:52.465034
2021-07-20T11:24:23
2021-07-20T11:24:23
335,903,458
2
1
null
null
null
null
UTF-8
Java
false
false
9,910
java
package com.liurq.server.model; import java.util.Date; public class DoctorVisit { /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tb_doctor_visit.id * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ private String id; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tb_doctor_visit.doctor_id * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ private String doctorId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tb_doctor_visit.visit_start_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ private Date visitStartDate; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tb_doctor_visit.visit_end_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ private Date visitEndDate; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tb_doctor_visit.visit_location * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ private String visitLocation; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tb_doctor_visit.visit_count * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ private Integer visitCount; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tb_doctor_visit.department_id * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ private String departmentId; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tb_doctor_visit.status * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ private String status; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tb_doctor_visit.create_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ private Date createDate; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column tb_doctor_visit.update_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ private Date updateDate; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tb_doctor_visit.id * * @return the value of tb_doctor_visit.id * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public String getId() { return id; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tb_doctor_visit.id * * @param id the value for tb_doctor_visit.id * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public void setId(String id) { this.id = id == null ? null : id.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tb_doctor_visit.doctor_id * * @return the value of tb_doctor_visit.doctor_id * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public String getDoctorId() { return doctorId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tb_doctor_visit.doctor_id * * @param doctorId the value for tb_doctor_visit.doctor_id * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public void setDoctorId(String doctorId) { this.doctorId = doctorId == null ? null : doctorId.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tb_doctor_visit.visit_start_date * * @return the value of tb_doctor_visit.visit_start_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public Date getVisitStartDate() { return visitStartDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tb_doctor_visit.visit_start_date * * @param visitStartDate the value for tb_doctor_visit.visit_start_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public void setVisitStartDate(Date visitStartDate) { this.visitStartDate = visitStartDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tb_doctor_visit.visit_end_date * * @return the value of tb_doctor_visit.visit_end_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public Date getVisitEndDate() { return visitEndDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tb_doctor_visit.visit_end_date * * @param visitEndDate the value for tb_doctor_visit.visit_end_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public void setVisitEndDate(Date visitEndDate) { this.visitEndDate = visitEndDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tb_doctor_visit.visit_location * * @return the value of tb_doctor_visit.visit_location * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public String getVisitLocation() { return visitLocation; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tb_doctor_visit.visit_location * * @param visitLocation the value for tb_doctor_visit.visit_location * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public void setVisitLocation(String visitLocation) { this.visitLocation = visitLocation == null ? null : visitLocation.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tb_doctor_visit.visit_count * * @return the value of tb_doctor_visit.visit_count * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public Integer getVisitCount() { return visitCount; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tb_doctor_visit.visit_count * * @param visitCount the value for tb_doctor_visit.visit_count * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public void setVisitCount(Integer visitCount) { this.visitCount = visitCount; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tb_doctor_visit.department_id * * @return the value of tb_doctor_visit.department_id * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public String getDepartmentId() { return departmentId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tb_doctor_visit.department_id * * @param departmentId the value for tb_doctor_visit.department_id * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public void setDepartmentId(String departmentId) { this.departmentId = departmentId == null ? null : departmentId.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tb_doctor_visit.status * * @return the value of tb_doctor_visit.status * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public String getStatus() { return status; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tb_doctor_visit.status * * @param status the value for tb_doctor_visit.status * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public void setStatus(String status) { this.status = status == null ? null : status.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tb_doctor_visit.create_date * * @return the value of tb_doctor_visit.create_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public Date getCreateDate() { return createDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tb_doctor_visit.create_date * * @param createDate the value for tb_doctor_visit.create_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public void setCreateDate(Date createDate) { this.createDate = createDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column tb_doctor_visit.update_date * * @return the value of tb_doctor_visit.update_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public Date getUpdateDate() { return updateDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column tb_doctor_visit.update_date * * @param updateDate the value for tb_doctor_visit.update_date * * @mbggenerated Wed Feb 03 19:23:50 CST 2021 */ public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } }
0cba761e08f53ebf709b484166bca2e4e5a16c66
bf4c94c695c0f3ff5983adfa5bbcb3f94605d8b5
/microsoft-debugger-impl/src/main/java/consulo/dotnet/microsoft/debugger/proxy/MicrosoftFieldProxy.java
5935e5943fe8cd4b2834a782ff2ef250b619d83c
[ "Apache-2.0" ]
permissive
consulo/consulo-dotnet-microsoft
e88ca55112531d9987b7b386aac62c252ea7495b
e89a70048c4ae3890d1238eb1c8ae3b4c39e4ce4
refs/heads/master
2023-08-31T19:19:23.643807
2023-07-08T10:02:24
2023-07-08T10:02:24
137,584,073
0
0
Apache-2.0
2023-01-01T16:40:28
2018-06-16T13:52:13
Java
UTF-8
Java
false
false
2,594
java
package consulo.dotnet.microsoft.debugger.proxy; import consulo.dotnet.debugger.proxy.DotNetFieldProxy; import consulo.dotnet.debugger.proxy.DotNetStackFrameProxy; import consulo.dotnet.debugger.proxy.DotNetTypeProxy; import consulo.dotnet.debugger.proxy.value.DotNetNumberValueProxy; import consulo.dotnet.debugger.proxy.value.DotNetValueProxy; import consulo.internal.dotnet.asm.signature.FieldAttributes; import consulo.util.lang.BitUtil; import mssdw.FieldMirror; import mssdw.ObjectValueMirror; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * @author VISTALL * @since 5/8/2016 */ public class MicrosoftFieldProxy extends MicrosoftVariableProxyBase<FieldMirror> implements DotNetFieldProxy { public MicrosoftFieldProxy(@Nonnull FieldMirror mirror) { super(mirror); } @Nullable @Override public DotNetTypeProxy getType() { return MicrosoftTypeProxy.of(myMirror.type()); } @Override public boolean isStatic() { return myMirror.isStatic(); } @Nonnull @Override public DotNetTypeProxy getParentType() { return MicrosoftTypeProxy.of(myMirror.parent()); } @Nullable @Override public DotNetValueProxy getValue(@Nonnull DotNetStackFrameProxy frameProxy, @Nullable DotNetValueProxy proxy) { MicrosoftStackFrameProxy microsoftThreadProxy = (MicrosoftStackFrameProxy) frameProxy; MicrosoftValueProxyBase<?> microsoftValueProxyBase = (MicrosoftValueProxyBase<?>) proxy; return MicrosoftValueProxyUtil.wrap(myMirror.value(microsoftThreadProxy.getFrameMirror(), microsoftValueProxyBase == null ? null : (ObjectValueMirror) microsoftValueProxyBase.getMirror())); } @Override public void setValue(@Nonnull DotNetStackFrameProxy threadProxy, @Nullable DotNetValueProxy proxy, @Nonnull DotNetValueProxy newValueProxy) { //MonoThreadProxy monoThreadProxy = (MonoThreadProxy) threadProxy; //MonoObjectValueProxy monoValueProxyBase = (MonoObjectValueProxy) proxy; //MonoValueProxyBase<?> monoNewValueProxyBase = (MonoValueProxyBase<?>) newValueProxy; //myMirror.setValue(monoThreadProxy.getThreadMirror(), monoValueProxyBase == null ? null : monoValueProxyBase.getMirror(), monoNewValueProxyBase.getMirror()); } @Override public boolean isLiteral() { return BitUtil.isSet(myMirror.attributes(), FieldAttributes.Literal); } @Nullable @Override public Number getEnumConstantValue(@Nonnull DotNetStackFrameProxy stackFrameProxy) { DotNetValueProxy fieldValue = getValue(stackFrameProxy, null); if(fieldValue instanceof DotNetNumberValueProxy) { return (Number) fieldValue.getValue(); } return null; } }
8bef70d6034e7d65eb487658ccd9958361a854ec
26cea3655da8ee2bcf5c4ed60f8dfe26dc6f2894
/src/main/java/com/demo/maven/repository/StockRepository.java
4ac2176f3caf27192bc8869628a97fff25288390
[ "MIT" ]
permissive
jeanschuchardt/demo-maven
857600ed0fffdd6fba5e20c87f417d41309f87cf
f010ed9d50278887696bd708a0f139ff34337556
refs/heads/master
2020-06-04T03:24:30.614258
2019-06-14T04:48:00
2019-06-14T04:48:00
191,853,637
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
package com.demo.maven.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.demo.maven.model.Stock; public interface StockRepository extends JpaRepository<Stock, Long> { }
6c0e3624cb5ebb8cfeec72aa2ad7bbaff74c5868
1b4154c96eb31ecb8347c0b5d6efe97dbd29a041
/java/com/cg/entities/Product.java
f3e68f1915583f7107d03df891734eee312b5bf1
[]
no_license
AnandVKulkarni2/GreatOutdoorsApplication
baee2d82d562df6bc45a8fa4d5a0b348c8483b90
8095f029bff96d614cfcfe7c593e51fa6dc12fd6
refs/heads/main
2023-08-13T18:14:58.885205
2021-09-30T06:50:09
2021-09-30T06:50:09
411,613,791
0
2
null
null
null
null
UTF-8
Java
false
false
1,421
java
package com.cg.entities; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "product") public class Product { @Id private int prodId; private String prodName; private int quantity; private double price; private String prodCategory; public Product() { super(); } public Product(int prodId, String prodName, int quantity, double price, String prodCategory) { super(); this.prodId = prodId; this.prodName = prodName; this.quantity = quantity; this.price = price; this.prodCategory = prodCategory; } @Override public String toString() { return "Product [prodId=" + prodId + ", prodName=" + prodName + ", quantity=" + quantity + ", price=" + price + ", prodCategory=" + prodCategory + "]"; } public int getProdId() { return prodId; } public void setProdId(int prodId) { this.prodId = prodId; } public String getProdName() { return prodName; } public void setProdName(String prodName) { this.prodName = prodName; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public String getProdCategory() { return prodCategory; } public void setProdCategory(String prodCategory) { this.prodCategory = prodCategory; } }
cc91ddd51d29c2cab18bec4dc1a10852533fd27e
c05c9921546284bac94b94f40c8bb300dc0a013a
/integration/flows/src/main/java/fr/unice/polytech/esb/flows/reports/travel/TravelReportList.java
e5b0f3a901570441ac05565a3982f03f9754b7f4
[]
no_license
AjroudRami/SOA
6d5af7166a9fec519ad7c62ee00a0f12a03eb383
31e679ee11199af8393c14a4c141eda5f045a101
refs/heads/master
2020-03-30T18:08:18.654158
2017-11-12T18:00:04
2017-11-12T18:00:04
151,485,364
0
0
null
null
null
null
UTF-8
Java
false
false
1,560
java
package fr.unice.polytech.esb.flows.reports.travel; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import static fr.unice.polytech.esb.flows.utils.Endpoints.*; public class TravelReportList extends RouteBuilder { private static ObjectMapper mapper = new ObjectMapper(); @Override public void configure() throws Exception { restConfiguration().component("servlet"); rest("/travel-report/").post("/list").type(Object.class).to(TRAVEL_REPORT_LIST); // Process to approve business travel. from(TRAVEL_REPORT_LIST) .routeId("travel-report-list") .routeDescription("List travel report") .log("Generating a travel query") // Prepare the POST request to a document service. .removeHeaders("*") .setHeader(Exchange.HTTP_METHOD, constant("POST")) .setHeader("Content-Type", constant("application/json")) .setHeader("Accept", constant("application/json")) .process(exchange -> { ObjectNode node = mapper.readValue(exchange.getIn().getBody(String.class),ObjectNode.class); node.put("event","list"); exchange.getIn().setBody(node.toString()); }) // Send the request to the internal service. .to(TRAVEL_REPORT_ENDPOINT); } }
2cb024b37bf4ec6c51b3bdb25e2aedf97da9e508
16a7a5d045e8f4bdea837fe3fb3607d7e6b68f13
/module1/src/modifiers/LocalVarEx.java
0d5ebf46608b9f499ab5455beb609ebbf62d8af1
[]
no_license
Pratik-Singh786/new_core_java
2d19cf74c629b70a3400a26000a30e6396b03f4a
6fa7186cd5f60d7030e95b4030e15800ee19b045
refs/heads/main
2023-09-03T07:44:12.908410
2021-11-20T13:22:08
2021-11-20T13:22:08
430,109,672
0
0
null
null
null
null
UTF-8
Java
false
false
193
java
package modifiers; public class LocalVarEx { public static void main(String[] args) { int x; System.out.println("hello"); //System.out.println(x); x not has been initialized } }
aa9962e74403b6924f895a691ef88b02a248f91d
1df5b0787f800f54b10118e9d4892d568c549d33
/server/pxf-hive/src/test/java/org/greenplum/pxf/plugins/hive/HiveResolverTest.java
43566c7c43555292a577ba0e48dca884fb4110a4
[ "Apache-2.0" ]
permissive
dcomingore/pxf
74b8e6df713a3a91492951ce9cae2da106c21ed1
def3c44ae85517b5065f30fbc428e6eb256769ff
refs/heads/master
2023-08-21T03:54:03.798672
2021-09-29T20:48:28
2021-09-29T20:48:28
276,935,943
0
0
Apache-2.0
2020-07-03T15:50:03
2020-07-03T15:50:03
null
UTF-8
Java
false
false
8,157
java
package org.greenplum.pxf.plugins.hive; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.serde.serdeConstants; import org.apache.hadoop.io.ArrayWritable; import org.apache.hadoop.io.DoubleWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Writable; import org.greenplum.pxf.api.io.DataType; import org.greenplum.pxf.api.model.RequestContext; import org.greenplum.pxf.api.OneField; import org.greenplum.pxf.api.OneRow; import org.greenplum.pxf.api.utilities.ColumnDescriptor; import org.greenplum.pxf.plugins.hive.utilities.HiveUtilities; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Properties; import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(MockitoExtension.class) public class HiveResolverTest { @Mock HiveUtilities mockHiveUtilities; private static final String SERDE_CLASS_NAME = "org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe"; private static final String COL_NAMES_SIMPLE = "name,amt"; private static final String COL_TYPES_SIMPLE = "string:double"; private static final String SERDE_CLASS_NAME_STRUCT = "org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe"; private static final String COL_NAMES_STRUCT = "address"; private static final String COL_TYPES_STRUCT = "struct<street:string,zipcode:bigint>"; private static final String COL_NAMES_NESTED_STRUCT = "address"; private static final String COL_TYPES_NESTED_STRUCT = "struct<line1:struct<number:bigint,street_name:string>,line2:struct<city:string,zipcode:bigint>>"; Configuration configuration; Properties properties; List<ColumnDescriptor> columnDescriptors; private HiveResolver resolver; RequestContext context; List<Integer> hiveIndexes; @BeforeEach public void setup() { properties = new Properties(); configuration = new Configuration(); columnDescriptors = new ArrayList<>(); context = new RequestContext(); // metadata usually set in accessor hiveIndexes = Arrays.asList(0, 1); } @Test public void testSimpleString() throws Exception { properties.put("serialization.lib", SERDE_CLASS_NAME); properties.put(serdeConstants.LIST_COLUMNS, COL_NAMES_SIMPLE); properties.put(serdeConstants.LIST_COLUMN_TYPES, COL_TYPES_SIMPLE); columnDescriptors.add(new ColumnDescriptor("name", DataType.TEXT.getOID(), 0, "text", null)); columnDescriptors.add(new ColumnDescriptor("amt", DataType.FLOAT8.getOID(), 1, "float8", null)); ArrayWritable aw = new ArrayWritable(Text.class, new Writable[]{new Text("plain string"), new DoubleWritable(1000)}); OneRow row = new OneRow(aw); context.setConfiguration(configuration); context.setMetadata(new HiveMetadata(properties, null /*List<HivePartition>*/, hiveIndexes)); context.setTupleDescription(columnDescriptors); resolver = new HiveResolver(mockHiveUtilities); resolver.setRequestContext(context); resolver.afterPropertiesSet(); List<OneField> output = resolver.getFields(row); assertThat(output.get(0).val).isEqualTo("plain string"); assertThat(output.get(0).type).isEqualTo(DataType.TEXT.getOID()); assertThat(output.get(1).val).isEqualTo(1000.0); assertThat(output.get(1).type).isEqualTo(DataType.FLOAT8.getOID()); } @Test public void testSpecialCharString() throws Exception { properties.put("serialization.lib", SERDE_CLASS_NAME); properties.put(serdeConstants.LIST_COLUMNS, COL_NAMES_SIMPLE); properties.put(serdeConstants.LIST_COLUMN_TYPES, COL_TYPES_SIMPLE); columnDescriptors.add(new ColumnDescriptor("name", DataType.TEXT.getOID(), 0, "text", null)); columnDescriptors.add(new ColumnDescriptor("amt", DataType.FLOAT8.getOID(), 1, "float8", null)); ArrayWritable aw = new ArrayWritable(Text.class, new Writable[]{new Text("a really \"fancy\" string? *wink*"), new DoubleWritable(1000)}); OneRow row = new OneRow(aw); context.setConfiguration(configuration); context.setMetadata(new HiveMetadata(properties, null /*List<HivePartition>*/, hiveIndexes)); context.setTupleDescription(columnDescriptors); resolver = new HiveResolver(mockHiveUtilities); resolver.setRequestContext(context); resolver.afterPropertiesSet(); List<OneField> output = resolver.getFields(row); assertThat(output.get(0).val).isEqualTo("a really \"fancy\" string? *wink*"); assertThat(output.get(0).type).isEqualTo(DataType.TEXT.getOID()); assertThat(output.get(1).val).isEqualTo(1000.0); assertThat(output.get(1).type).isEqualTo(DataType.FLOAT8.getOID()); } @Test public void testStructSimpleString() throws Exception { properties.put("serialization.lib", SERDE_CLASS_NAME_STRUCT); properties.put(serdeConstants.LIST_COLUMNS, COL_NAMES_STRUCT); properties.put(serdeConstants.LIST_COLUMN_TYPES, COL_TYPES_STRUCT); columnDescriptors.add(new ColumnDescriptor("address", DataType.TEXT.getOID(), 0, "struct", null)); OneRow row = new OneRow(0, new Text("plain string\u00021001")); context.setConfiguration(configuration); context.setMetadata(new HiveMetadata(properties, null /*List<HivePartition>*/, hiveIndexes)); context.setTupleDescription(columnDescriptors); resolver = new HiveResolver(mockHiveUtilities); resolver.setRequestContext(context); resolver.afterPropertiesSet(); List<OneField> output = resolver.getFields(row); assertThat(output.get(0).toString()).isEqualTo("{\"street\":\"plain string\",\"zipcode\":1001}"); } @Test public void testStructSpecialCharString() throws Exception { properties.put("serialization.lib", SERDE_CLASS_NAME_STRUCT); properties.put(serdeConstants.LIST_COLUMNS, COL_NAMES_STRUCT); properties.put(serdeConstants.LIST_COLUMN_TYPES, COL_TYPES_STRUCT); columnDescriptors.add(new ColumnDescriptor("address", DataType.TEXT.getOID(), 0, "struct", null)); OneRow row = new OneRow(0, new Text("a really \"fancy\" string\u00021001")); context.setConfiguration(configuration); context.setMetadata(new HiveMetadata(properties, null /*List<HivePartition>*/, hiveIndexes)); context.setTupleDescription(columnDescriptors); resolver = new HiveResolver(mockHiveUtilities); resolver.setRequestContext(context); resolver.afterPropertiesSet(); List<OneField> output = resolver.getFields(row); assertThat(output.get(0).toString()).isEqualTo("{\"street\":\"a really \\\"fancy\\\" string\",\"zipcode\":1001}"); } @Test public void testNestedStruct() throws Exception { properties.put("serialization.lib", SERDE_CLASS_NAME_STRUCT); properties.put(serdeConstants.LIST_COLUMNS, COL_NAMES_NESTED_STRUCT); properties.put(serdeConstants.LIST_COLUMN_TYPES, COL_TYPES_NESTED_STRUCT); columnDescriptors.add(new ColumnDescriptor("address", DataType.TEXT.getOID(), 0, "struct", null)); OneRow row = new OneRow(0, new Text("1000\u0003a really \"fancy\" string\u0002plain string\u00031001")); context.setConfiguration(configuration); context.setMetadata(new HiveMetadata(properties, null /*List<HivePartition>*/, hiveIndexes)); context.setTupleDescription(columnDescriptors); resolver = new HiveResolver(mockHiveUtilities); resolver.setRequestContext(context); resolver.afterPropertiesSet(); List<OneField> output = resolver.getFields(row); assertThat(output.get(0).toString()).isEqualTo("{\"line1\":{\"number\":1000,\"street_name\":\"a really \\\"fancy\\\" string\"},\"line2\":{\"city\":\"plain string\",\"zipcode\":1001}}"); } }
6a876faf4215a1aab3b0b087d95c2627e8ed3218
f4fd782488b9cf6d99d4375d5718aead62b63c69
/com/planet_ink/coffee_mud/WebMacros/PlayerNext.java
324b016a2db6ba343c45d7ab5c4b178589fb88e1
[ "Apache-2.0" ]
permissive
sfunk1x/CoffeeMud
89a8ca1267ecb0c2ca48280e3b3930ee1484c93e
0ac2a21c16dfe3e1637627cb6373d34615afe109
refs/heads/master
2021-01-18T11:20:53.213200
2015-09-17T19:16:30
2015-09-17T19:16:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,757
java
package com.planet_ink.coffee_mud.WebMacros; import com.planet_ink.coffee_web.interfaces.*; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2003-2015 Bo Zimmerman Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ @SuppressWarnings("rawtypes") public class PlayerNext extends StdWebMacro { @Override public String name() { return "PlayerNext"; } @Override public boolean isAdminMacro() { return true; } @Override public String runMacro(HTTPRequest httpReq, String parm) { if(!CMProps.getBoolVar(CMProps.Bool.MUDSTARTED)) return CMProps.getVar(CMProps.Str.MUDSTATUS); final java.util.Map<String,String> parms=parseParms(parm); final String last=httpReq.getUrlParameter("PLAYER"); if(parms.containsKey("RESET")) { if(last!=null) httpReq.removeUrlParameter("PLAYER"); return ""; } String lastID=""; String sort=httpReq.getUrlParameter("SORTBY"); if(sort==null) sort=""; final Enumeration pe=CMLib.players().thinPlayers(sort,httpReq.getRequestObjects()); for(;pe.hasMoreElements();) { final PlayerLibrary.ThinPlayer user=(PlayerLibrary.ThinPlayer)pe.nextElement(); if((last==null)||((last.length()>0)&&(last.equals(lastID))&&(!user.name.equals(lastID)))) { httpReq.addFakeUrlParameter("PLAYER",user.name); return ""; } lastID=user.name; } httpReq.addFakeUrlParameter("PLAYER",""); if(parms.containsKey("EMPTYOK")) return "<!--EMPTY-->"; return " @break@"; } }
cfeffbe610e05619933a97c4c3d36f53d7774ffe
64e5d88b3dfb62236f778fee26f09f249fd662af
/GPLT/L1-032-leftpad-字符串处理/src/test/Main.java
66f41356b12da8ee9f911fd6e8cdda125b41ffa4
[]
no_license
hishark/Algorithm
d2dabeac5c3bcd5d78d21edad460a1981c4dfc31
81032464b38e4e0c7b4a088d19ff07eb5c227cbb
refs/heads/master
2021-06-02T14:47:13.088472
2021-04-27T12:58:03
2021-04-27T12:58:03
123,285,059
7
0
null
null
null
null
UTF-8
Java
false
false
527
java
package test; import java.util.Scanner; public class Main { public static void main(String[] args){ // TODO Auto-generated method stub Scanner cin = new Scanner(System.in); int N = cin.nextInt(); String s = cin.next(); cin.nextLine(); char c = s.charAt(0); String str = cin.nextLine(); if(str.length()>=N){ String sub = str.substring(str.length()-N); System.out.println(sub); }else{ for(int i=0;i<N-str.length();i++){ System.out.print(c); } System.out.println(str); } } }
4ad4aa94a46812d4b3d0fa8d262ccf50bf280c1e
dd80a584130ef1a0333429ba76c1cee0eb40df73
/libcore/luni/src/main/java/java/lang/AssertionError.java
e00d8e6981ec94ce1d6b714edf77f074b6e8d300
[ "MIT", "LicenseRef-scancode-unicode", "ICU", "LicenseRef-scancode-newlib-historical", "Apache-2.0", "W3C-19980720", "LicenseRef-scancode-generic-cla", "W3C", "CPL-1.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
Java
false
false
4,180
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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 java.lang; /** * Thrown when an assertion has failed. * * @since 1.4 */ public class AssertionError extends Error { private static final long serialVersionUID = -5013299493970297370L; /** * Constructs a new {@code AssertionError} with no message. */ public AssertionError() { } /** * Constructs a new {@code AssertionError} with the given detail message and cause. * @since 1.7 */ public AssertionError(String detailMessage, Throwable cause) { super(detailMessage, cause); } /** * Constructs a new {@code AssertionError} with a message based on calling * {@link String#valueOf(Object)} with the specified object. If the object * is an instance of {@link Throwable}, then it also becomes the cause of * this error. * * @param detailMessage * the object to be converted into the detail message and * optionally the cause. */ public AssertionError(Object detailMessage) { super(String.valueOf(detailMessage)); if (detailMessage instanceof Throwable) { initCause((Throwable) detailMessage); } } /** * Constructs a new {@code AssertionError} with a message based on calling * {@link String#valueOf(boolean)} with the specified boolean value. * * @param detailMessage * the value to be converted into the message. */ public AssertionError(boolean detailMessage) { this(String.valueOf(detailMessage)); } /** * Constructs a new {@code AssertionError} with a message based on calling * {@link String#valueOf(char)} with the specified character value. * * @param detailMessage * the value to be converted into the message. */ public AssertionError(char detailMessage) { this(String.valueOf(detailMessage)); } /** * Constructs a new {@code AssertionError} with a message based on calling * {@link String#valueOf(int)} with the specified integer value. * * @param detailMessage * the value to be converted into the message. */ public AssertionError(int detailMessage) { this(Integer.toString(detailMessage)); } /** * Constructs a new {@code AssertionError} with a message based on calling * {@link String#valueOf(long)} with the specified long value. * * @param detailMessage * the value to be converted into the message. */ public AssertionError(long detailMessage) { this(Long.toString(detailMessage)); } /** * Constructs a new {@code AssertionError} with a message based on calling * {@link String#valueOf(float)} with the specified float value. * * @param detailMessage * the value to be converted into the message. */ public AssertionError(float detailMessage) { this(Float.toString(detailMessage)); } /** * Constructs a new {@code AssertionError} with a message based on calling * {@link String#valueOf(double)} with the specified double value. * * @param detailMessage * the value to be converted into the message. */ public AssertionError(double detailMessage) { this(Double.toString(detailMessage)); } }
3725a2868cdcf7e59fbaef516bdef3b377cab034
0042ce5bee8ba368a7172dc8daaac0b1262ce004
/app/src/main/java/com/hazira/mobilelearning/M2EvaluasiFragment.java
22a81199597b073ea71b2d13e9fc8a2ed9e5c04f
[ "MIT" ]
permissive
hazira-rozi/MobileLearningAbandoned
351f36707a9370f2fae196eac4aa34327a8d1c17
ac313659ee542568c57ed7f3c44327607387c625
refs/heads/master
2020-04-28T03:24:28.844423
2019-03-11T06:03:56
2019-03-11T06:03:56
174,936,038
1
0
null
null
null
null
UTF-8
Java
false
false
658
java
package com.hazira.mobilelearning; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class M2EvaluasiFragment extends Fragment { @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { // ((M2Activity) getActivity()).setActionBarTitle(" Materi 2 - Evaluasi"); return inflater.inflate(R.layout.fragment_materi2_evaluasi, container, false); } }
7000a42e8b01d5a7c84d8b30c0b1776009a9175e
77d28dc4e8d3ab29b770756821a2916f39af19ef
/trunk/evs/src/evs/interfaces/IPollObject.java
b3bbac595db6e4b1ff0ff8be542dd904d1252084
[]
no_license
BackupTheBerlios/evs-svn
5d5dc20b549196aacc7e07aa6e08a2a2e7e150c4
eabcdc48c5d46c78c511cf897d5ff25dd717412e
refs/heads/master
2016-09-06T11:23:13.992380
2008-06-07T19:55:18
2008-06-07T19:55:18
40,672,354
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
/** * */ package evs.interfaces; /** * @author Gerald Scharitzer (e0127228 at student dot tuwien dot ac dot at) * */ public interface IPollObject { boolean isResultAvailable(); void setResult(Object result); void setException(Exception e); Object getResult() throws Exception; void reset(); }
[ "locutus@4e363603-e748-0410-94f2-a1644731a11e" ]
locutus@4e363603-e748-0410-94f2-a1644731a11e
1d806cbe297c4411c0209656e372bf7c55b1ddd1
87836316b9b4640d3c56508f6b4eb682bda2ef37
/src/main/java/com/dlimana/bookstoremanager/users/dto/JwtResponse.java
75732a27191b07010c5b477a8f058954b5f316c0
[]
no_license
DRLimana/bookstoremanager_course
e0c4b5b5c1c0d66ca3bc95f5b733ba52e1f4fd15
8328ed5c71ad7d00fc2a9fb27388579e1e4fdba7
refs/heads/master
2023-03-03T07:58:42.349007
2021-02-11T21:50:13
2021-02-11T21:50:13
322,388,329
0
0
null
2021-02-11T21:28:59
2020-12-17T19:09:45
Java
UTF-8
Java
false
false
177
java
package com.dlimana.bookstoremanager.users.dto; import lombok.Builder; import lombok.Getter; @Getter @Builder public class JwtResponse { private final String jwtToken; }
98137529469d5628bd7c26334ec632826fc06422
8f4ab1a26c3e91188da3e207697a3b829b1d7cde
/realname-auth/src/main/java/com/auth/Application.java
dfe9e74be0b8c1a2256ae07d73bfff884d71151e
[]
no_license
wo94zj/auth-pool
fc5bc56f31dfc654d2add7598a8bbf75ddc8dd49
dd1af1d3e1a1f7be932bc4cbfcec72cfe7405ba8
refs/heads/master
2020-06-18T04:47:04.352287
2019-07-19T06:24:19
2019-07-19T06:24:19
196,168,137
3
0
null
null
null
null
UTF-8
Java
false
false
862
java
package com.auth; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.hystrix.EnableHystrix; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; //import org.springframework.cloud.netflix.zuul.EnableZuulProxy; import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication @EnableDiscoveryClient //@EnableZuulProxy @EnableFeignClients @EnableHystrix //@EnableCircuitBreaker开启监控端点,访问/actuator/hystrix.stream @EnableHystrixDashboard //监控端点可视化,访问/hystrix public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
afd80e82c800d7e882a2afeefe5e6d5880895ff4
f359bfa1f90450141342121926e57e19444c33b4
/dataexp/stu_search.java
dad71b2058eb3a93a030f16940268db6d6c28fe0
[]
no_license
Hiltoness/test1
62cc1935329586e961dddea15ee5b1ff6f64bfe1
d5296bcf7f54fa2057e196f08c8a648583421661
refs/heads/master
2020-11-25T21:10:15.660844
2019-12-18T14:42:00
2019-12-18T14:42:00
228,848,088
0
0
null
null
null
null
UTF-8
Java
false
false
5,185
java
package dataexp; import javax.swing.*; import javax.swing.table.JTableHeader; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; public class stu_search extends JFrame{ private JScrollPane scpDemo; private JTableHeader jth; private JTable tabDemo; private JButton btnShow; private JButton btnall; // 构造方法 public stu_search(String id){ // 窗体的相关属性的定义 // super("JTable数据绑定示例"); this.setTitle("查询学生信息"); this.setSize(900,500); this.setLayout(null); this.setLocation(100,50); // 创建组件 this.scpDemo = new JScrollPane(); this.scpDemo.setBounds(10,70,800,270); this.btnShow = new JButton("返回"); this.btnShow.setBounds(10,40,300,30); this.btnall = new JButton("查看所有学生"); this.btnall.setBounds(10, 10, 300, 30); // 给按钮注册监听 this.btnShow.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ btnShow_ActionPerformed(ae); } }); this.btnall.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { search_all(); } }); // 将组件加入到窗体中 add(this.scpDemo); add(this.btnShow); add(this.btnall); // 显示窗体 this.setVisible(true); Connection con = null; PreparedStatement selps= null; ResultSet rs=null; try { con = dbconn.getConn(); String sel_sql ="select s.sno,sname,sclass,sdept,c.*,t.tname from s,sc,c,tc,t where s.sno=sc.sno AND sc.cno=c.cno AND c.cno=tc.cno AND tc.tno=t.tno AND s.sno=?"; selps=con.prepareStatement(sel_sql); selps.setString(1, id); // 执行查询 rs=selps.executeQuery(); // 计算有多少条记录 int count = 0; while(rs.next()){ count++; } // 将查询获得的记录数据,转换成适合生成JTable的数据形式 Object[][] info = new Object[count][10]; count = 0; rs = selps.executeQuery(); while(rs.next()){ info[count][0] = rs.getString("sno"); info[count][1] = rs.getString("sname"); info[count][2] = rs.getString("sclass"); info[count][3] = rs.getString("sdept"); info[count][4] = rs.getString("cno"); info[count][5] = rs.getString("cname"); info[count][6] = rs.getString("tname"); info[count][7] = rs.getString("cscore"); info[count][8] = rs.getString("ctime"); info[count][9] = rs.getString("cloc"); // count++; } // 定义表头 String[] title = {"学生学号","学生姓名","学生班级","学生院系","课程号","课程名","任课老师","学分","上课时间","上课地点"}; // 创建JTable this.tabDemo = new JTable(info,title); // 显示表头 this.jth = this.tabDemo.getTableHeader(); // 将JTable加入到带滚动条的面板中 this.scpDemo.getViewport().add(tabDemo); }catch(SQLException sqle){ JOptionPane.showMessageDialog(null,"数据操作错误","错误",JOptionPane.ERROR_MESSAGE); } } // 点击按钮时的事件处理 public void btnShow_ActionPerformed(ActionEvent ae){ stu_search.this.dispose(); new stu_frame(); } public void search_all() { Connection con = null; PreparedStatement selps= null; ResultSet rs=null; try { con = dbconn.getConn(); String sel_sql ="select s.sno,sname,sclass,sdept,c.*,t.tname from s,sc,c,tc,t where s.sno=sc.sno AND sc.cno=c.cno AND c.cno=tc.cno AND tc.tno=t.tno"; selps=con.prepareStatement(sel_sql); // 执行查询 rs=selps.executeQuery(); // 计算有多少条记录 int count = 0; while(rs.next()){ count++; } rs = selps.executeQuery(); // 将查询获得的记录数据,转换成适合生成JTable的数据形式 Object[][] info = new Object[count][10]; count = 0; while(rs.next()){ info[count][0] = rs.getString("sno"); info[count][1] = rs.getString("sname"); info[count][2] = rs.getString("sclass"); info[count][3] = rs.getString("sdept"); info[count][4] = rs.getString("cno"); info[count][5] = rs.getString("cname"); info[count][6] = rs.getString("tname"); info[count][7] = rs.getString("cscore"); info[count][8] = rs.getString("ctime"); info[count][9] = rs.getString("cloc"); count++; } // 定义表头 String[] title = {"学生学号","学生姓名","学生班级","学生院系","课程号","课程名","任课老师","学分","上课时间","上课地点"}; // 创建JTable this.tabDemo = new JTable(info,title); // 显示表头 this.jth = this.tabDemo.getTableHeader(); // 将JTable加入到带滚动条的面板中 this.scpDemo.getViewport().add(tabDemo); }catch(SQLException sqle){ JOptionPane.showMessageDialog(null,"数据操作错误","错误",JOptionPane.ERROR_MESSAGE); } } }
ad09c45c9dd59a2c6bc501190dfacb5039929162
65e5dd0bd32e40aba013e2140c73b93112e89c42
/api/ebayAPI/src/main/java/com/ebay/soap/eBLBaseComponents/BestOfferType.java
08ef9d890bb0065303f038ca73389442aa53ace6
[]
no_license
vancezhao/mocha
732fb271da41ae3d897f9edba99f09f54924f93f
1192a768509ba82eadfaaffc4e91df5ebac375b4
refs/heads/master
2016-09-05T17:19:03.251590
2013-12-08T11:47:36
2013-12-08T11:47:36
15,303,645
0
1
null
null
null
null
UTF-8
Java
false
false
10,282
java
package com.ebay.soap.eBLBaseComponents; import java.io.Serializable; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.w3c.dom.Element; /** * * Details about a Best Offer. * * * <p>Java class for BestOfferType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="BestOfferType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="BestOfferID" type="{urn:ebay:apis:eBLBaseComponents}BestOfferIDType" minOccurs="0"/> * &lt;element name="ExpirationTime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/> * &lt;element name="Buyer" type="{urn:ebay:apis:eBLBaseComponents}UserType" minOccurs="0"/> * &lt;element name="Price" type="{urn:ebay:apis:eBLBaseComponents}AmountType" minOccurs="0"/> * &lt;element name="Status" type="{urn:ebay:apis:eBLBaseComponents}BestOfferStatusCodeType" minOccurs="0"/> * &lt;element name="Quantity" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="BuyerMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="SellerMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="BestOfferCodeType" type="{urn:ebay:apis:eBLBaseComponents}BestOfferTypeCodeType" minOccurs="0"/> * &lt;element name="CallStatus" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;any/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "BestOfferType", propOrder = { "bestOfferID", "expirationTime", "buyer", "price", "status", "quantity", "buyerMessage", "sellerMessage", "bestOfferCodeType", "callStatus", "any" }) public class BestOfferType implements Serializable { private final static long serialVersionUID = 12343L; @XmlElement(name = "BestOfferID") protected String bestOfferID; @XmlElement(name = "ExpirationTime", type = String.class) @XmlJavaTypeAdapter(Adapter1 .class) @XmlSchemaType(name = "dateTime") protected Calendar expirationTime; @XmlElement(name = "Buyer") protected UserType buyer; @XmlElement(name = "Price") protected AmountType price; @XmlElement(name = "Status") protected BestOfferStatusCodeType status; @XmlElement(name = "Quantity") protected Integer quantity; @XmlElement(name = "BuyerMessage") protected String buyerMessage; @XmlElement(name = "SellerMessage") protected String sellerMessage; @XmlElement(name = "BestOfferCodeType") protected BestOfferTypeCodeType bestOfferCodeType; @XmlElement(name = "CallStatus") protected String callStatus; @XmlAnyElement(lax = true) protected List<Object> any; /** * Gets the value of the bestOfferID property. * * @return * possible object is * {@link String } * */ public String getBestOfferID() { return bestOfferID; } /** * Sets the value of the bestOfferID property. * * @param value * allowed object is * {@link String } * */ public void setBestOfferID(String value) { this.bestOfferID = value; } /** * Gets the value of the expirationTime property. * * @return * possible object is * {@link String } * */ public Calendar getExpirationTime() { return expirationTime; } /** * Sets the value of the expirationTime property. * * @param value * allowed object is * {@link String } * */ public void setExpirationTime(Calendar value) { this.expirationTime = value; } /** * Gets the value of the buyer property. * * @return * possible object is * {@link UserType } * */ public UserType getBuyer() { return buyer; } /** * Sets the value of the buyer property. * * @param value * allowed object is * {@link UserType } * */ public void setBuyer(UserType value) { this.buyer = value; } /** * Gets the value of the price property. * * @return * possible object is * {@link AmountType } * */ public AmountType getPrice() { return price; } /** * Sets the value of the price property. * * @param value * allowed object is * {@link AmountType } * */ public void setPrice(AmountType value) { this.price = value; } /** * Gets the value of the status property. * * @return * possible object is * {@link BestOfferStatusCodeType } * */ public BestOfferStatusCodeType getStatus() { return status; } /** * Sets the value of the status property. * * @param value * allowed object is * {@link BestOfferStatusCodeType } * */ public void setStatus(BestOfferStatusCodeType value) { this.status = value; } /** * Gets the value of the quantity property. * * @return * possible object is * {@link Integer } * */ public Integer getQuantity() { return quantity; } /** * Sets the value of the quantity property. * * @param value * allowed object is * {@link Integer } * */ public void setQuantity(Integer value) { this.quantity = value; } /** * Gets the value of the buyerMessage property. * * @return * possible object is * {@link String } * */ public String getBuyerMessage() { return buyerMessage; } /** * Sets the value of the buyerMessage property. * * @param value * allowed object is * {@link String } * */ public void setBuyerMessage(String value) { this.buyerMessage = value; } /** * Gets the value of the sellerMessage property. * * @return * possible object is * {@link String } * */ public String getSellerMessage() { return sellerMessage; } /** * Sets the value of the sellerMessage property. * * @param value * allowed object is * {@link String } * */ public void setSellerMessage(String value) { this.sellerMessage = value; } /** * Gets the value of the bestOfferCodeType property. * * @return * possible object is * {@link BestOfferTypeCodeType } * */ public BestOfferTypeCodeType getBestOfferCodeType() { return bestOfferCodeType; } /** * Sets the value of the bestOfferCodeType property. * * @param value * allowed object is * {@link BestOfferTypeCodeType } * */ public void setBestOfferCodeType(BestOfferTypeCodeType value) { this.bestOfferCodeType = value; } /** * Gets the value of the callStatus property. * * @return * possible object is * {@link String } * */ public String getCallStatus() { return callStatus; } /** * Sets the value of the callStatus property. * * @param value * allowed object is * {@link String } * */ public void setCallStatus(String value) { this.callStatus = value; } /** * * * @return * array of * {@link Object } * {@link Element } * */ public Object[] getAny() { if (this.any == null) { return new Object[ 0 ] ; } return ((Object[]) this.any.toArray(new Object[this.any.size()] )); } /** * * * @return * one of * {@link Object } * {@link Element } * */ public Object getAny(int idx) { if (this.any == null) { throw new IndexOutOfBoundsException(); } return this.any.get(idx); } public int getAnyLength() { if (this.any == null) { return 0; } return this.any.size(); } /** * * * @param values * allowed objects are * {@link Object } * {@link Element } * */ public void setAny(Object[] values) { this._getAny().clear(); int len = values.length; for (int i = 0; (i<len); i ++) { this.any.add(values[i]); } } protected List<Object> _getAny() { if (any == null) { any = new ArrayList<Object>(); } return any; } /** * * * @param value * allowed object is * {@link Object } * {@link Element } * */ public Object setAny(int idx, Object value) { return this.any.set(idx, value); } }
432b7f6dafed21610636d13f666ff4ff900016e7
254d68d1e8d522d772f2d4864274e61f95f41d1b
/src/main/java/cn/com/chinalife/ecdata/service/trade/PlatformTradeAmountService.java
0e4e25cf0a58387aa7f5516d1cc490985519ab4e
[]
no_license
fufengzhe/data-report-webapp
bbc9201b9783e979f39947b3e390f565b674cd96
586c51ac3ebee619e47ffb95b4c34b6f4e4d01ac
refs/heads/master
2022-12-25T03:28:12.983685
2019-05-24T10:55:45
2019-05-24T10:55:45
171,969,155
0
0
null
2022-12-16T05:00:06
2019-02-22T00:54:24
Java
UTF-8
Java
false
false
360
java
package cn.com.chinalife.ecdata.service.trade; import cn.com.chinalife.ecdata.entity.trade.Premium; import java.util.List; /** * Created by xiexiangyu on 2018/3/15. */ public interface PlatformTradeAmountService { List<Premium> getPlatformTradeAmount(); List<Premium> getPlatformTradeNum(); Premium getPlatformSignRatio(); }
3a9932d0539b6a2ae3867e5527c8912c9739939f
6691c612f744077db36e8bbb59e75a3f4eec58a4
/HRMS/src/test/M21.java
578d4175d8907e0aa7b5c095c649e936289a368a
[]
no_license
ayerrams/NewRepo1
eac3adb52649457b3f95434439c3d44367c445c1
8f98ac5b69db8e12647b72516b56827eadb9ec67
refs/heads/master
2022-12-15T22:56:59.335172
2020-09-22T02:35:49
2020-09-22T02:35:49
297,510,098
0
0
null
null
null
null
UTF-8
Java
false
false
159
java
package test; public class M21 { // Find out longest substring without repeating any charatcter public static void main(String[] args) { } }
a12dd26907b22096cc7112acaf14a4234958b56f
041098a3621ee66b04ed86585b8233eb3ee55ab1
/src/com/allinpay/yunst/member/UpdatePhoneByPayPwdTest.java
450c0e7fab6d337144e48df619124c44455fea6a
[]
no_license
YBriel/yunst-sdk-junit1
5a43608c3fdcd329fb49959b30c6d0176cc155fc
4bfbda483e1d551291548bc2e03e4c1feb670d5a
refs/heads/master
2023-04-09T10:29:25.745582
2021-04-12T02:55:44
2021-04-12T02:55:44
350,700,871
0
0
null
null
null
null
UTF-8
Java
false
false
1,183
java
package com.allinpay.yunst.member; import org.junit.Test; import com.allinpay.yunst.sdk.YunClient; import com.allinpay.yunst.sdk.bean.YunRequest; import com.allinpay.yunst.sdk.util.RSAUtil; public class UpdatePhoneByPayPwdTest { @Test public void testMethod() { // 宁波商户接入环境 // webParamUrl = "http://122.227.225.142:23661/pwd/updatePhoneByPayPwd.html?"; // 2.0生产环境环境 String webParamUrl = "https://fintech.allinpay.com/yungateway/pwd/updatePhoneByPayPwd.html?"; final YunRequest request = new YunRequest("MemberPwdService", "updatePhoneByPayPwd"); try { request.put("bizUserId", "WHYGR2019001"); request.put("name", "邬海艳"); request.put("identityType", 1L); request.put("identityNo", RSAUtil.encrypt("362201198806205281")); request.put("oldPhone", "15000346364"); request.put("jumpUrl", "http://122.227.225.142:23663/testFront.jsp"); request.put("backUrl", "http://122.227.225.142:23663/testFront.jsp"); String res = YunClient.encodeOnce(request); webParamUrl += res; System.out.println("webParamUrl: " + webParamUrl); } catch (final Exception e) { e.printStackTrace(); } } }
4e968902d321bfc6ac0565c47a6518ee04df40a5
eaa3062f420a0a336c23bdb8a48c3b728a20ccc0
/Test 5/sgi/SGIWithGraphSig.java
40aa70cefc9614f76eafbf1c43f3ca9c17e29e90
[]
no_license
sikfeng/scaling-up-subgraph-isomorphism
985c0dbc2bb7d18fd59b65be2380465f8ba86518
aa17dbb7514d6c4d517f47cc497ca251b718deb8
refs/heads/master
2023-01-22T16:11:21.609280
2020-12-05T13:01:23
2020-12-05T13:01:23
318,700,279
0
0
null
null
null
null
UTF-8
Java
false
false
3,551
java
package sgi; import sgi.CountFingerprinter; import sgi.GraphSig; import java.io.*; import java.lang.*; import java.lang.Math.*; import java.util.*; import org.openscience.cdk.io.SDFWriter; import org.openscience.cdk.silent.SilentChemObjectBuilder; import org.openscience.cdk.io.iterator.IteratingSDFReader; import org.openscience.cdk.interfaces.*; import org.openscience.cdk.exception.*; import org.openscience.cdk.*; import org.openscience.cdk.smiles.*; import org.openscience.cdk.fingerprint.*; import org.openscience.cdk.tools.*; import org.openscience.cdk.tools.manipulator.*; import org.openscience.cdk.config.*; import org.openscience.cdk.interfaces.*; import org.openscience.cdk.isomorphism.Pattern; public class SGIWithGraphSig { public static void main(String[] args) { try { double startExtractTime = System.currentTimeMillis(); File graphsFile = new File("sdf/candidates/" + args[0] + "/0.sdf"); File subgraphsFile = new File("sdf/substructures_all/0.sdf"); IteratingSDFReader graphReader = new IteratingSDFReader(new FileInputStream(graphsFile), SilentChemObjectBuilder.getInstance()); IteratingSDFReader subgraphReader = new IteratingSDFReader(new FileInputStream(subgraphsFile), SilentChemObjectBuilder.getInstance()); ArrayList<IAtomContainer> subgraphs = new ArrayList<IAtomContainer>(); ArrayList<IAtomContainer> graphs = new ArrayList<IAtomContainer>(); while (subgraphReader.hasNext()) { subgraphs.add(subgraphReader.next()); } while (graphReader.hasNext()) { graphs.add(graphReader.next()); } System.out.println("Extracted structures in " + ((System.currentTimeMillis() - startExtractTime) / 1000) + " seconds"); double startSigTime = System.currentTimeMillis(); GraphSig.init(); ArrayList<GraphSig> subgraphSigs = new ArrayList<GraphSig>(); ArrayList<GraphSig> graphSigs = new ArrayList<GraphSig>(); for (int i = 0; i < graphs.size(); ++i) { GraphSig graphSig = new GraphSig(); graphSig.update(graphs.get(i)); graphSigs.add(graphSig); } for (int j = 0; j < subgraphs.size(); ++j) { GraphSig subgraphSig = new GraphSig(); subgraphSig.update(subgraphs.get(j)); subgraphSigs.add(subgraphSig); } System.out.println("Generated signatures in " + ((System.currentTimeMillis() - startExtractTime) / 1000) + " seconds"); double startSGITime = System.currentTimeMillis(); int numSGIRun = 0; int numSubIso = 0; for (int i = 0; i < graphs.size(); ++i) { IAtomContainer graph = graphs.get(i); GraphSig graphSig = graphSigs.get(i); for (int j = 0; j < subgraphs.size(); ++j) { if (graphSig.compare(subgraphSigs.get(j)) == 0) { ++numSGIRun; Pattern subgraphPattern = Pattern.findSubstructure(subgraphs.get(j)); boolean isSubgraph = subgraphPattern.matches(graph); if (isSubgraph) { ++numSubIso; } } } } System.out.println("Finished SGI in " + ((System.currentTimeMillis() - startSGITime) / 1000) + " seconds"); System.out.println("Found " + numSubIso + " substructures, SGI run " + numSGIRun + " times"); System.out.println(graphs.size() + " num of graphs"); System.out.println(subgraphs.size() + " num of subgraphs"); } catch (Exception e) { // unreported exception errors and stuff System.out.println("Error: " + e); System.exit(1); } } }
329299fd08dbb62e72ef3e3eb8b46dbe3697039d
18b731ab437622d5936e531ece88c3dd0b2bb2ea
/pbtd-central/src/main/java/com/pbtd/playclick/integrate/service/face/IVodMappingService.java
60113cbf18cf7b101ab4ae062dd95dd685d3f7fa
[]
no_license
harry0102/bai_project
b6c130e7235d220f2f0d4294a3f87b58f77cd265
674c6ddff7cf5dae514c69d2639d4b0245c0761f
refs/heads/master
2021-10-07T20:32:15.985439
2018-12-05T06:50:11
2018-12-05T06:50:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
452
java
package com.pbtd.playclick.integrate.service.face; import java.util.List; import java.util.Map; import com.pbtd.playclick.integrate.domain.VodMapping; public interface IVodMappingService { int count(Map<String, Object> queryParams); List<VodMapping> find(Map<String, Object> queryParams); VodMapping load(int id); int insert(VodMapping vodmapping); int update(VodMapping vodmapping); int deletes(Map<String, Object> ids); }
a29d37ac9620d23dbdbd0013b3e577a2b4ace351
d2ee093c80d5325a2b8b59659da82876364812be
/javabasic/src/main/java/com/hry/java/xml/demo1/StudentModel.java
92bbea0f50c2d6c9066d26ebf3698b4722af0898
[]
no_license
magicyork/component
812030273a05a35f4ad763feba817f22f1a6d055
cb4c5997d5285401d664cbca5cd2c5ac6969c2d4
refs/heads/master
2021-01-07T18:51:09.050626
2019-12-19T11:54:48
2019-12-19T11:54:48
241,788,420
1
0
null
2020-02-20T03:56:38
2020-02-20T03:56:38
null
UTF-8
Java
false
false
569
java
package com.hry.java.xml.demo1; public class StudentModel { private int id; // 学号 private String name; // 名称 private String sex; // 性别 // private Date birthDate; // 生日 public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } }
bf97b95b951e51f0b22ee735851bb097320a297e
9a7796e9dfb9ef08017708db759f1d301d9731d0
/my2/src/Main.java
9b5631c3942c949c3199e1c7a8bdeb27e8b9a99d
[]
no_license
hadi1376tm/AI-game-project
255edcd43bc99a753758d18c9d4f7fc4ea1de76a
fee61da01928b960d1706e46f35c2e97bb42e37b
refs/heads/main
2023-06-23T00:30:12.337435
2021-07-13T21:39:47
2021-07-13T21:39:47
385,740,802
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
import models.Game; import models.Player; import models.PlayerType; public class Main { public static void main(String[] args) { RandomPlayer whitePlayer = new RandomPlayer(PlayerType.white); Ai blackPlayer = new Ai(PlayerType.black); Game game = new Game(whitePlayer, blackPlayer); Player player = game.play(); System.out.println(player.getType()); System.out.println("Node count: "+Ai.getNodeCount()); System.out.println("Pruning count: "+Ai.getPruningCount()); } }
8839a3236cc78938525983c2dc71c083e814df53
83dad85b9ffe06ef43e7f7f2d6f1be548f865536
/src/main/java/com/itycu/server/model/Pushmsg.java
aa268676d6c5e5f48319861ef93335c599f56ff1
[]
no_license
java-silence/zichan_lch
aced407ae11ed2ac81d2102f0c645361c8323cee
c22e974b59f757cc4a4d05b665dbe5195c649390
refs/heads/master
2023-07-20T17:13:55.886363
2021-02-03T07:34:25
2021-02-03T07:34:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,783
java
package com.itycu.server.model; import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; public class Pushmsg extends BaseEntity<Long> { private String title; private String content; private Long userid; private String url; private Long bizid; private Long todoid; private Long createby; private Long updateby; private Long auditby; @JsonFormat(pattern = "yyyy-MM-dd") private Date auditTime; private String status; private String del; private String memo; private String ctype; private String c01; private String c02; private String c03; private String creator; private String username; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Long getUserid() { return userid; } public void setUserid(Long userid) { this.userid = userid; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public Long getBizid() { return bizid; } public void setBizid(Long bizid) { this.bizid = bizid; } public Long getTodoid() { return todoid; } public void setTodoid(Long todoid) { this.todoid = todoid; } public Long getCreateby() { return createby; } public void setCreateby(Long createby) { this.createby = createby; } public Long getUpdateby() { return updateby; } public void setUpdateby(Long updateby) { this.updateby = updateby; } public Long getAuditby() { return auditby; } public void setAuditby(Long auditby) { this.auditby = auditby; } public Date getAuditTime() { return auditTime; } public void setAuditTime(Date auditTime) { this.auditTime = auditTime; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getDel() { return del; } public void setDel(String del) { this.del = del; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } public String getCtype() { return ctype; } public void setCtype(String ctype) { this.ctype = ctype; } public String getC01() { return c01; } public void setC01(String c01) { this.c01 = c01; } public String getC02() { return c02; } public void setC02(String c02) { this.c02 = c02; } public String getC03() { return c03; } public void setC03(String c03) { this.c03 = c03; } public String getCreator() { return creator; } public void setCreator(String creator) { this.creator = creator; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } }
55be197396f3096bf02758b5bbd083728489e02b
c4be34f26558cbb5815c22764f19ba7500a35f8d
/WB_Leetcode_4/Next Greater Element I.java
fd5f8324ffbbbcd38ef501af08198ca0a6f7eccb
[]
no_license
plumberg/WB_leetcode_problems
9b66ebee16aaf8802e676857923d4ebdc6c6cd99
b12aab1953f72961fae3fcd450dddd4ddcae1e1e
refs/heads/master
2021-01-03T15:11:47.870629
2020-03-15T02:02:25
2020-03-15T02:02:25
240,123,223
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
class Solution { public int[] nextGreaterElement(int[] nums1, int[] nums2) { HashMap<Integer,Integer>map = new HashMap<>(); Stack<Integer>stack = new Stack<>(); for(int i : nums2){ while(!stack.isEmpty()&&stack.peek()<i){ map.put(stack.pop(), i); } stack.push(i); } for(int i=0;i<nums1.length;i++){ if(map.containsKey(nums1[i])){ nums1[i] = map.get(nums1[i]); }else nums1[i] = -1; } return nums1; } }
f9ba523b538836b27fc0fe167fba7da475c30f39
e0cb62f4e62454360b6ea107c0626bb703edb577
/src/main/java/com/thtf/app/web/rest/errors/EmailAlreadyUsedException.java
f98f0a5de5348da6f81bf35f4f33c624f9c7bd2c
[]
no_license
dylan20161212/redapple
658312fa4986e8c804971e647410fd03bb0d31e2
7029cf07e11b0004b9d3eff186d5f9dffae6e98c
refs/heads/master
2020-04-19T09:19:24.056743
2019-03-26T06:59:37
2019-03-26T06:59:37
168,106,837
0
0
null
null
null
null
UTF-8
Java
false
false
283
java
package com.thtf.app.web.rest.errors; public class EmailAlreadyUsedException extends BadRequestAlertException { public EmailAlreadyUsedException() { super(ErrorConstants.EMAIL_ALREADY_USED_TYPE, "Email address already in use", "userManagement", "emailexists"); } }
36fd4f88ae4e845090593090b145b240041950a3
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/6/6_7ff06d9390b15a9bfda8b222f30ca257fa5fd15d/StaticDependenceGraph/6_7ff06d9390b15a9bfda8b222f30ca257fa5fd15d_StaticDependenceGraph_s.java
c5d55b826439767647a6e5fa26fcba922c85ec38
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
10,034
java
package jkit.jil.ipa; import static jkit.compiler.SyntaxError.*; import java.util.*; import jkit.compiler.ClassLoader; import jkit.compiler.*; import jkit.jil.tree.*; import jkit.jil.util.*; import jkit.util.*; import jkit.util.graph.*; /** * The purpose of this class is to build a static call graph. That is, a graph * whose edges represent potential calls between methods. More specifically, an * edge from method A to method B exists iff there is an invocation of method B * within method A. Observe that, since the construction process is static, the * edge will exist regardless of whether or not the method is ever be called (in * that context). * * @author djp * */ public class StaticDependenceGraph { public static class Invocation extends Pair<Tag.Method,Tag.Method> { public Invocation(Tag.Method from, Tag.Method to) { super(from,to); } public Tag.Method from() { return first(); } public Tag.Method to() { return second(); } public String toString() { return first() + "->" + second(); } } public static class FieldAccess extends Pair<Tag,Tag> { public FieldAccess(Tag.Method from, Tag.Field to) { super(from,to); } public Tag.Method method() { return (Tag.Method) first(); } public Tag.Field field() { return (Tag.Field) second(); } public String toString() { return first() + "=>" + second(); } } private Graph<Tag.Method,Invocation> callGraph; private Graph<Tag,FieldAccess> fieldReads; private Graph<Tag,FieldAccess> fieldWrites; private ClassLoader loader; public StaticDependenceGraph(ClassLoader loader) { this.loader = loader; } /** * Access the constructed call graph. Each node in the call graph is * identified by a triple (O,N,T), where O=owner, N=name and T=type. */ public Graph<Tag.Method,Invocation> callGraph() { return callGraph; } public Graph<Tag,FieldAccess> fieldReads() { return fieldReads; } public Graph<Tag,FieldAccess> fieldWrites() { return fieldWrites; } public void apply(List<JilClass> classes) { callGraph = new DirectedAdjacencyList(); fieldReads = new DirectedAdjacencyList(); fieldWrites = new DirectedAdjacencyList(); for(JilClass owner : classes) { for (JilMethod method : owner.methods()) { build(method,owner); } } } protected void build(JilMethod method, JilClass owner) { Tag.Method myNode = new Tag.Method(owner.type(), method.name(), method.type()); List<JilStmt> body = method.body(); // first, initialise label map for(JilStmt s : body) { addEdges(s, myNode); } } protected void addEdges(JilStmt stmt, Tag.Method myNode) { if(stmt instanceof JilStmt.IfGoto) { addEdges((JilStmt.IfGoto)stmt,myNode); } else if(stmt instanceof JilStmt.Switch) { addEdges((JilStmt.Switch)stmt,myNode); } else if(stmt instanceof JilStmt.Assign) { addEdges((JilStmt.Assign)stmt,myNode); } else if(stmt instanceof JilExpr.Invoke) { addEdges((JilExpr.Invoke)stmt,myNode); } else if(stmt instanceof JilExpr.New) { addEdges((JilExpr.New) stmt,myNode); } else if(stmt instanceof JilStmt.Return) { addEdges((JilStmt.Return) stmt,myNode); } else if(stmt instanceof JilStmt.Throw) { addEdges((JilStmt.Throw) stmt,myNode); } else if(stmt instanceof JilStmt.Nop) { } else if(stmt instanceof JilStmt.Label) { } else if(stmt instanceof JilStmt.Goto) { } else if(stmt instanceof JilStmt.Lock) { addEdges((JilStmt.Lock) stmt, myNode); } else if(stmt instanceof JilStmt.Unlock) { addEdges((JilStmt.Unlock) stmt, myNode); } else { syntax_error("unknown statement encountered (" + stmt.getClass().getName() + ")",stmt); } } protected void addEdges(JilStmt.IfGoto stmt, Tag.Method myNode) { addEdges(stmt.condition(),myNode); } protected void addEdges(JilStmt.Switch stmt, Tag.Method myNode) { addEdges(stmt.condition(),myNode); } protected void addEdges(JilStmt.Assign stmt, Tag.Method myNode) { addEdges(stmt.lhs(),myNode); addEdges(stmt.rhs(),myNode); if(stmt.lhs() instanceof JilExpr.Deref) { // this indicates a field write JilExpr.Deref df = (JilExpr.Deref) stmt.lhs(); try { Pair<Clazz,Clazz.Field> rt = loader.determineField((Type.Clazz) df.type(),df.name()); Type.Clazz type = rt.first().type(); Tag.Field targetNode = new Tag.Field(type, df.name()); // Add the call graph edge! fieldWrites.add(new FieldAccess(myNode,targetNode)); } catch(FieldNotFoundException mnfe) { internal_error(df,mnfe); } catch(ClassNotFoundException cnfe) { internal_error(df,cnfe); } } } protected void addEdges(JilStmt.Return stmt, Tag.Method myNode) { if(stmt.expr() != null) { addEdges(stmt.expr(),myNode); } } protected void addEdges(JilStmt.Throw stmt, Tag.Method myNode) { addEdges(stmt.expr(),myNode); } protected void addEdges(JilStmt.Lock stmt, Tag.Method myNode) { addEdges(stmt.expr(),myNode); } protected void addEdges(JilStmt.Unlock stmt, Tag.Method myNode) { addEdges(stmt.expr(),myNode); } protected void addEdges(JilExpr expr, Tag.Method myNode) { if(expr instanceof JilExpr.ArrayIndex) { addEdges((JilExpr.ArrayIndex) expr, myNode); } else if(expr instanceof JilExpr.BinOp) { addEdges((JilExpr.BinOp) expr, myNode); } else if(expr instanceof JilExpr.UnOp) { addEdges((JilExpr.UnOp) expr, myNode); } else if(expr instanceof JilExpr.Cast) { addEdges((JilExpr.Cast) expr, myNode); } else if(expr instanceof JilExpr.Convert) { addEdges((JilExpr.Convert) expr, myNode); } else if(expr instanceof JilExpr.ClassVariable) { addEdges((JilExpr.ClassVariable) expr, myNode); } else if(expr instanceof JilExpr.Deref) { addEdges((JilExpr.Deref) expr, myNode); } else if(expr instanceof JilExpr.Variable) { addEdges((JilExpr.Variable) expr, myNode); } else if(expr instanceof JilExpr.InstanceOf) { addEdges((JilExpr.InstanceOf) expr, myNode); } else if(expr instanceof JilExpr.Invoke) { addEdges((JilExpr.Invoke) expr, myNode); } else if(expr instanceof JilExpr.New) { addEdges((JilExpr.New) expr, myNode); } else if(expr instanceof JilExpr.Value) { addEdges((JilExpr.Value) expr, myNode); } } public void addEdges(JilExpr.ArrayIndex expr, Tag.Method myNode) { addEdges(expr.target(), myNode); addEdges(expr.index(), myNode); } public void addEdges(JilExpr.BinOp expr, Tag.Method myNode) { addEdges(expr.lhs(), myNode); addEdges(expr.rhs(), myNode); } public void addEdges(JilExpr.UnOp expr, Tag.Method myNode) { addEdges(expr.expr(), myNode); } public void addEdges(JilExpr.Cast expr, Tag.Method myNode) { addEdges(expr.expr(), myNode); } public void addEdges(JilExpr.Convert expr, Tag.Method myNode) { addEdges(expr.expr(), myNode); } public void addEdges(JilExpr.ClassVariable expr, Tag.Method myNode) { // do nothing! } public void addEdges(JilExpr.Deref expr, Tag.Method myNode) { addEdges(expr.target(), myNode); try { Pair<Clazz, Clazz.Field> rt = loader.determineField( (Type.Clazz) expr.type(), expr.name()); Type.Clazz type = rt.first().type(); Tag.Field targetNode = new Tag.Field(type, expr.name()); fieldReads.add(new FieldAccess(myNode, targetNode)); } catch (FieldNotFoundException mnfe) { internal_error(expr, mnfe); } catch (ClassNotFoundException cnfe) { internal_error(expr, cnfe); } } public void addEdges(JilExpr.Variable expr, Tag.Method myNode) { // do nothing! } public void addEdges(JilExpr.InstanceOf expr, Tag.Method myNode) { addEdges(expr.lhs(), myNode); } public void addEdges(JilExpr.Invoke expr, Tag.Method myNode) { JilExpr target = expr.target(); addEdges(target, myNode); for(JilExpr e : expr.parameters()) { addEdges(e, myNode); } // So, at this point, we appear have a method call to the given // target.type(). However, in practice, it's not quite that simple. In // particular, it may occur that the method in question doesn't actually // exist. This happens when the method being called is actually in some // supertype of the target.type(). try { Pair<Clazz,Clazz.Method> rt = loader.determineMethod((Type.Reference) target.type(),expr.name(),expr.funType()); Type.Clazz type = rt.first().type(); // FIXME: One potential problem arises here when the set of potential // target methods is greater than one. In this case, we miss edges // to all of them Tag.Method targetNode = new Tag.Method(type, expr.name(), expr.funType()); // Add the call graph edge! callGraph.add(new Invocation(myNode,targetNode)); } catch(MethodNotFoundException mnfe) { internal_error(expr,mnfe); } catch(ClassNotFoundException cnfe) { internal_error(expr,cnfe); } } public void addEdges(JilExpr.New expr, Tag.Method myNode) { for(JilExpr e : expr.parameters()) { addEdges(e, myNode); } // Interesting issue here if target is not a class. Could be an array, // for example. if(expr.type() instanceof Type.Clazz) { Type.Clazz type = (Type.Clazz) expr.type(); Tag.Method targetNode = new Tag.Method(type, type.lastComponent().first(), expr .funType()); // Add the call graph edge! callGraph.add(new Invocation(myNode,targetNode)); } } public void addEdges(JilExpr.Value expr, Tag.Method myNode) { if(expr instanceof JilExpr.Array) { JilExpr.Array ae = (JilExpr.Array) expr; for(JilExpr v : ae.values()) { addEdges(v, myNode); } } } }
bd566d12fc8eab63872870f6b9cd69ce44b9cfaf
0572f625d0164e9a57ca1fdda87e8958426c0396
/cms/src/main/java/com/cfets/cms/controller/SeckillController.java
b554c8e142910a92d27748868841ccf2e1efd535
[]
no_license
csy389670220/server
5f6c47529d18979b50d3b7362ef385b2021e9a3f
b271c0d81025c0653824d2c292563efc333cefd1
refs/heads/master
2022-11-05T04:51:20.301718
2019-08-30T01:30:54
2019-08-30T01:30:54
178,119,617
1
1
null
2022-10-12T20:45:18
2019-03-28T03:30:27
Java
UTF-8
Java
false
false
4,007
java
package com.cfets.cms.controller; import com.cfets.cms.error.BusinessException; import com.cfets.cms.error.EmBusinessError; import com.cfets.cms.model.vo.ItemSeckillVo; import com.cfets.cms.service.SeckillService; import com.cfets.cms.util.ResultMapUtil; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import java.util.Date; import java.util.List; import java.util.Map; /** * 秒杀商品控制类 */ @Controller @ResponseBody @RequestMapping("seckill") public class SeckillController extends BaseController { private static final Logger logger = LoggerFactory.getLogger(SeckillController.class); @Autowired SeckillService seckillService; @RequestMapping(value = "/query") public ModelAndView query() { ModelAndView modelAndView = new ModelAndView("skill/skill"); List<ItemSeckillVo> list = seckillService.getSeckillList(); modelAndView.addObject("list", list); return modelAndView; } @RequestMapping(value = "/{userId}/{seckillId}/detail",method = RequestMethod.GET) public ModelAndView detail(@PathVariable("userId") Integer userId, @PathVariable("seckillId") Integer seckillId) { ModelAndView modelAndView = new ModelAndView("skill/detail"); ItemSeckillVo itemSeckillVo = seckillService.getById(userId,seckillId); modelAndView.addObject("itemSeckillVo", itemSeckillVo); return modelAndView; } /** * 获取当前系统时间 * @return */ @RequestMapping(value = "/time/now",method = RequestMethod.GET) public long time(){ Date now = new Date(); return now.getTime(); } /** * 获取MD5 */ @RequestMapping(value = "/{seckillId}/exposer",method = RequestMethod.GET) public String exposer(@PathVariable("seckillId") Integer secklillId){ String md5=seckillService.exportSeckillUrl(secklillId); return md5; } /** * 执行秒杀 * @return */ @RequestMapping(value = "/{md5}/execution",method = RequestMethod.POST) public Map<String, Object> execute(@PathVariable("md5")String md5, @RequestParam("itemId") Integer itemId, @RequestParam("seckillId") Integer seckillId , @RequestParam("userId") Integer userId ){ try { Map<String, Object> result=seckillService.executeSeckill(itemId,seckillId,userId,md5); return result; }catch (DuplicateKeyException e){ logger.error("execution DuplicateKeyException is :"+e.getMessage(),e); return ResultMapUtil.build(EmBusinessError.SECKILL_REPEAT_ERROR); } catch(BusinessException e){ logger.error("execution BusinessException is :"+e.getErrMsg(),e); return ResultMapUtil.build(String.valueOf(e.getErrCode()),e.getErrMsg()); } catch (Exception e) { logger.error("execution Exception is :"+e.getMessage(),e); return ResultMapUtil.build(EmBusinessError.SECKILL_EXECUTE_ERROR); } } /** * 执行秒杀 by 存储过程 * @return */ @RequestMapping(value = "/{md5}/executionProducer") public Map<String, Object> executeProducer(@PathVariable("md5")String md5, @RequestParam("itemId") Integer itemId, @RequestParam("seckillId") Integer seckillId , @RequestParam("userId") Integer userId ){ return seckillService.executeSeckillProducer(itemId,seckillId,userId,md5); } }
abaddb5a73985aa02d2fbe08624a6852a09bf9ec
0da53ed66095ffc7554a1d393e688b2cc19475ec
/app/src/main/java/com/aboutblank/world_clock/ui/components/IconPopupMenu.java
1da50f60c04ffd1f361cbabb805d849ff74450d4
[]
no_license
aboutblank2264/WorldScheduler
cc4f181d31e414cab677cec6e72e63a3d32ab06c
774fe0b5d0c58f2d9a77405bfe15420def227154
refs/heads/master
2020-04-02T08:16:11.310579
2019-01-05T00:45:52
2019-01-05T00:45:52
154,235,854
0
0
null
null
null
null
UTF-8
Java
false
false
795
java
package com.aboutblank.world_clock.ui.components; import android.annotation.SuppressLint; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.view.menu.MenuBuilder; import android.support.v7.view.menu.MenuPopupHelper; import android.support.v7.widget.PopupMenu; import android.view.View; @SuppressLint("RestrictedApi") public class IconPopupMenu extends PopupMenu { private final MenuPopupHelper popupHelper; public IconPopupMenu(@NonNull final Context context, @NonNull final View anchor) { super(context, anchor); popupHelper = new MenuPopupHelper(context, (MenuBuilder) getMenu(), anchor); popupHelper.setForceShowIcon(true); } @Override public void show() { popupHelper.show(); } }
84fa92d03f1172b1421c0ed02d053bf5ae0c3f3b
405de9ad4396aa72b8f0dda920d0471bf0cc8443
/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
5a68517961f9a812171b122318fdc3657f9621f4
[ "Apache-2.0" ]
permissive
Soya93/Extract-Refactoring
7f9e85e116d97e68c97749e71427674e4596a860
81d187f0013fc8a6c3f846ea644344bc9c94ecb1
refs/heads/master
2016-09-14T02:01:28.978630
2016-05-19T07:53:26
2016-05-19T07:53:26
58,550,061
1
0
null
null
null
null
UTF-8
Java
false
false
40,198
java
/* * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.codeInsight.completion; import com.intellij.codeInsight.ExpectedTypeInfo; import com.intellij.codeInsight.ExpectedTypesProvider; import com.intellij.codeInsight.TailType; import com.intellij.codeInsight.completion.scope.JavaCompletionProcessor; import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFix; import com.intellij.codeInsight.lookup.*; import com.intellij.featureStatistics.FeatureUsageTracker; import com.intellij.lang.LangBundle; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.actionSystem.IdeActions; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.highlighter.HighlighterIterator; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.text.StringUtil; import com.intellij.patterns.ElementPattern; import com.intellij.patterns.PatternCondition; import com.intellij.patterns.PsiJavaElementPattern; import com.intellij.patterns.PsiNameValuePairPattern; import com.intellij.psi.*; import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.filters.*; import com.intellij.psi.filters.classes.AnnotationTypeFilter; import com.intellij.psi.filters.classes.AssignableFromContextFilter; import com.intellij.psi.filters.element.ExcludeDeclaredFilter; import com.intellij.psi.filters.element.ModifierFilter; import com.intellij.psi.filters.getters.ExpectedTypesGetter; import com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl; import com.intellij.psi.impl.source.PsiLabelReference; import com.intellij.psi.impl.source.tree.ElementType; import com.intellij.psi.scope.ElementClassFilter; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; import com.intellij.psi.util.PsiUtilCore; import com.intellij.psi.util.TypeConversionUtil; import com.intellij.util.Consumer; import com.intellij.util.DocumentUtil; import com.intellij.util.PairConsumer; import com.intellij.util.ProcessingContext; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import static com.intellij.patterns.PsiJavaPatterns.*; import static com.intellij.util.ObjectUtils.assertNotNull; /** * @author peter */ public class JavaCompletionContributor extends CompletionContributor { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.completion.JavaCompletionContributor"); public static final ElementPattern<PsiElement> ANNOTATION_NAME = psiElement(). withParents(PsiJavaCodeReferenceElement.class, PsiAnnotation.class).afterLeaf("@"); private static final PsiJavaElementPattern.Capture<PsiElement> UNEXPECTED_REFERENCE_AFTER_DOT = psiElement().afterLeaf(".").insideStarting(psiExpressionStatement()); private static final PsiNameValuePairPattern NAME_VALUE_PAIR = psiNameValuePair().withSuperParent(2, psiElement(PsiAnnotation.class)); private static final ElementPattern<PsiElement> ANNOTATION_ATTRIBUTE_NAME = or(psiElement(PsiIdentifier.class).withParent(NAME_VALUE_PAIR), psiElement().afterLeaf("(").withParent(psiReferenceExpression().withParent(NAME_VALUE_PAIR))); private static final ElementPattern SWITCH_LABEL = psiElement().withSuperParent(2, psiElement(PsiSwitchLabelStatement.class).withSuperParent(2, psiElement(PsiSwitchStatement.class).with(new PatternCondition<PsiSwitchStatement>("enumExpressionType") { @Override public boolean accepts(@NotNull PsiSwitchStatement psiSwitchStatement, ProcessingContext context) { final PsiExpression expression = psiSwitchStatement.getExpression(); if(expression == null) return false; PsiClass aClass = PsiUtil.resolveClassInClassTypeOnly(expression.getType()); return aClass != null && aClass.isEnum(); } }))); private static final ElementPattern<PsiElement> AFTER_NUMBER_LITERAL = psiElement().afterLeaf(psiElement().withElementType(elementType().oneOf(JavaTokenType.DOUBLE_LITERAL, JavaTokenType.LONG_LITERAL, JavaTokenType.FLOAT_LITERAL, JavaTokenType.INTEGER_LITERAL))); private static final ElementPattern<PsiElement> IMPORT_REFERENCE = psiElement().withParent(psiElement(PsiJavaCodeReferenceElement.class).withParent(PsiImportStatementBase.class)); private static final ElementPattern<PsiElement> CATCH_OR_FINALLY = psiElement().afterLeaf( psiElement().withText("}").withParent( psiElement(PsiCodeBlock.class).afterLeaf(PsiKeyword.TRY))); private static final ElementPattern<PsiElement> INSIDE_CONSTRUCTOR = psiElement().inside(psiMethod().constructor(true)); @Nullable public static ElementFilter getReferenceFilter(PsiElement position) { // Completion after extends in interface, type parameter and implements in class final PsiClass containingClass = PsiTreeUtil.getParentOfType(position, PsiClass.class, false, PsiCodeBlock.class, PsiMethod.class, PsiExpressionList.class, PsiVariable.class, PsiAnnotation.class); if (containingClass != null && psiElement().afterLeaf(PsiKeyword.EXTENDS, PsiKeyword.IMPLEMENTS, ",", "&").accepts(position)) { return new AndFilter(ElementClassFilter.CLASS, new NotFilter(new AssignableFromContextFilter())); } if (ANNOTATION_NAME.accepts(position)) { return new AnnotationTypeFilter(); } if (JavaKeywordCompletion.DECLARATION_START.getValue().accepts(position) || JavaKeywordCompletion.isInsideParameterList(position) || isInsideAnnotationName(position)) { return new OrFilter(ElementClassFilter.CLASS, ElementClassFilter.PACKAGE_FILTER); } if (psiElement().afterLeaf(PsiKeyword.INSTANCEOF).accepts(position)) { return new ElementExtractorFilter(ElementClassFilter.CLASS); } if (JavaKeywordCompletion.VARIABLE_AFTER_FINAL.accepts(position)) { return ElementClassFilter.CLASS; } if (CATCH_OR_FINALLY.accepts(position) || JavaKeywordCompletion.START_SWITCH.accepts(position) || JavaKeywordCompletion.isInstanceofPlace(position) || JavaKeywordCompletion.isAfterPrimitiveOrArrayType(position)) { return null; } if (JavaKeywordCompletion.START_FOR.accepts(position)) { return new OrFilter(ElementClassFilter.CLASS, ElementClassFilter.VARIABLE); } if (JavaSmartCompletionContributor.AFTER_NEW.accepts(position)) { return ElementClassFilter.CLASS; } if (psiElement().inside(PsiReferenceParameterList.class).accepts(position)) { return ElementClassFilter.CLASS; } if (psiElement().inside(PsiAnnotationParameterList.class).accepts(position)) { return createAnnotationFilter(position); } PsiVariable var = PsiTreeUtil.getParentOfType(position, PsiVariable.class, false, PsiClass.class); if (var != null && PsiTreeUtil.isAncestor(var.getInitializer(), position, false)) { return new ExcludeDeclaredFilter(new ClassFilter(PsiVariable.class)); } if (SWITCH_LABEL.accepts(position)) { return new ClassFilter(PsiField.class) { @Override public boolean isAcceptable(Object element, PsiElement context) { return element instanceof PsiEnumConstant; } }; } return TrueFilter.INSTANCE; } private static boolean isInsideAnnotationName(PsiElement position) { PsiAnnotation anno = PsiTreeUtil.getParentOfType(position, PsiAnnotation.class, true, PsiMember.class); return anno != null && PsiTreeUtil.isAncestor(anno.getNameReferenceElement(), position, true); } private static ElementFilter createAnnotationFilter(PsiElement position) { OrFilter orFilter = new OrFilter(ElementClassFilter.CLASS, ElementClassFilter.PACKAGE_FILTER, new AndFilter(new ClassFilter(PsiField.class), new ModifierFilter(PsiModifier.STATIC, PsiModifier.FINAL))); if (psiElement().insideStarting(psiNameValuePair()).accepts(position)) { orFilter.addFilter(new ClassFilter(PsiAnnotationMethod.class) { @Override public boolean isAcceptable(Object element, PsiElement context) { return element instanceof PsiAnnotationMethod && PsiUtil.isAnnotationMethod((PsiElement)element); } }); } return orFilter; } @Override public void fillCompletionVariants(@NotNull final CompletionParameters parameters, @NotNull final CompletionResultSet _result) { if (parameters.getCompletionType() != CompletionType.BASIC) { return; } final PsiElement position = parameters.getPosition(); if (!isInJavaContext(position)) { return; } if (AFTER_NUMBER_LITERAL.accepts(position) || UNEXPECTED_REFERENCE_AFTER_DOT.accepts(position)) { _result.stopHere(); return; } final CompletionResultSet result = JavaCompletionSorting.addJavaSorting(parameters, _result); if (ANNOTATION_ATTRIBUTE_NAME.accepts(position) && !JavaKeywordCompletion.isAfterPrimitiveOrArrayType(position)) { JavaKeywordCompletion.addExpectedTypeMembers(parameters, result); JavaKeywordCompletion.addPrimitiveTypes(result, position); completeAnnotationAttributeName(result, position, parameters); result.stopHere(); return; } final InheritorsHolder inheritors = new InheritorsHolder(result); if (TypeArgumentCompletionProvider.IN_TYPE_ARGS.accepts(position)) { new TypeArgumentCompletionProvider(false, inheritors).addCompletions(parameters, new ProcessingContext(), result); } result.addAllElements(FunctionalExpressionCompletionProvider.getLambdaVariants(parameters, true)); PrefixMatcher matcher = result.getPrefixMatcher(); if (JavaSmartCompletionContributor.AFTER_NEW.accepts(position)) { new JavaInheritorsGetter(ConstructorInsertHandler.BASIC_INSTANCE).generateVariants(parameters, matcher, inheritors); } if (MethodReturnTypeProvider.IN_METHOD_RETURN_TYPE.accepts(position)) { MethodReturnTypeProvider.addProbableReturnTypes(parameters, new Consumer<LookupElement>() { @Override public void consume(LookupElement element) { registerClassFromTypeElement(element, inheritors); result.addElement(element); } }); } if (SmartCastProvider.shouldSuggestCast(parameters)) { SmartCastProvider.addCastVariants(parameters, new Consumer<LookupElement>() { @Override public void consume(LookupElement element) { registerClassFromTypeElement(element, inheritors); result.addElement(PrioritizedLookupElement.withPriority(element, 1)); } }); } PsiElement parent = position.getParent(); if (parent instanceof PsiReferenceExpression) { final List<ExpectedTypeInfo> expected = Arrays.asList(ExpectedTypesProvider.getExpectedTypes((PsiExpression)parent, true)); CollectConversion.addCollectConversion((PsiReferenceExpression)parent, expected, JavaSmartCompletionContributor.decorateWithoutTypeCheck(result, expected)); } if (IMPORT_REFERENCE.accepts(position)) { result.addElement(LookupElementBuilder.create("*")); } addKeywords(parameters, result); addExpressionVariants(parameters, position, result); Set<String> usedWords = addReferenceVariants(parameters, result, inheritors); if (psiElement().inside(PsiLiteralExpression.class).accepts(position)) { PsiReference reference = position.getContainingFile().findReferenceAt(parameters.getOffset()); if (reference == null || reference.isSoft()) { WordCompletionContributor.addWordCompletionVariants(result, parameters, usedWords); } } JavaGenerateMemberCompletionContributor.fillCompletionVariants(parameters, result); addAllClasses(parameters, result, inheritors); if (parent instanceof PsiReferenceExpression && !((PsiReferenceExpression)parent).isQualified() && parameters.isExtendedCompletion() && StringUtil.isNotEmpty(matcher.getPrefix())) { new JavaStaticMemberProcessor(parameters).processStaticMethodsGlobally(matcher, result); } result.stopHere(); } private static void registerClassFromTypeElement(LookupElement element, InheritorsHolder inheritors) { PsiType type = assertNotNull(element.as(PsiTypeLookupItem.CLASS_CONDITION_KEY)).getType(); PsiClass aClass = type instanceof PsiClassType && ((PsiClassType)type).getParameterCount() == 0 ? ((PsiClassType)type).resolve() : null; if (aClass != null) { inheritors.registerClass(aClass); } } private static void addExpressionVariants(@NotNull CompletionParameters parameters, PsiElement position, CompletionResultSet result) { if (JavaSmartCompletionContributor.INSIDE_EXPRESSION.accepts(position) && !JavaKeywordCompletion.AFTER_DOT.accepts(position) && !SmartCastProvider.shouldSuggestCast(parameters)) { JavaKeywordCompletion.addExpectedTypeMembers(parameters, result); if (SameSignatureCallParametersProvider.IN_CALL_ARGUMENT.accepts(position)) { new SameSignatureCallParametersProvider().addCompletions(parameters, new ProcessingContext(), result); } } } public static boolean isInJavaContext(PsiElement position) { return PsiUtilCore.findLanguageFromElement(position).isKindOf(JavaLanguage.INSTANCE); } public static void addAllClasses(final CompletionParameters parameters, final CompletionResultSet result, final InheritorsHolder inheritors) { if (!isClassNamePossible(parameters) || !mayStartClassName(result)) { return; } if (parameters.getInvocationCount() >= 2) { JavaClassNameCompletionContributor.addAllClasses(parameters, parameters.getInvocationCount() <= 2, result.getPrefixMatcher(), new Consumer<LookupElement>() { @Override public void consume(LookupElement element) { if (!inheritors.alreadyProcessed(element)) { result.addElement(JavaClassNameCompletionContributor.highlightIfNeeded((JavaPsiClassReferenceElement)element, parameters)); } } }); } else { advertiseSecondCompletion(parameters.getPosition().getProject(), result); } } public static void advertiseSecondCompletion(Project project, CompletionResultSet result) { if (FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(CodeCompletionFeatures.SECOND_BASIC_COMPLETION, project)) { result.addLookupAdvertisement("Press " + getActionShortcut(IdeActions.ACTION_CODE_COMPLETION) + " to see non-imported classes"); } } private static Set<String> addReferenceVariants(final CompletionParameters parameters, CompletionResultSet result, final InheritorsHolder inheritors) { final Set<String> usedWords = new HashSet<String>(); final PsiElement position = parameters.getPosition(); final boolean first = parameters.getInvocationCount() <= 1; final boolean isSwitchLabel = SWITCH_LABEL.accepts(position); final boolean isAfterNew = JavaClassNameCompletionContributor.AFTER_NEW.accepts(position); final boolean pkgContext = JavaCompletionUtil.inSomePackage(position); final PsiType[] expectedTypes = ExpectedTypesGetter.getExpectedTypes(parameters.getPosition(), true); LegacyCompletionContributor.processReferences(parameters, result, new PairConsumer<PsiReference, CompletionResultSet>() { @Override public void consume(final PsiReference reference, final CompletionResultSet result) { if (reference instanceof PsiJavaReference) { ElementFilter filter = getReferenceFilter(position); if (filter != null) { if (INSIDE_CONSTRUCTOR.accepts(position) && (parameters.getInvocationCount() <= 1 || CheckInitialized.isInsideConstructorCall(position))) { filter = new AndFilter(filter, new CheckInitialized(position)); } final PsiFile originalFile = parameters.getOriginalFile(); JavaCompletionProcessor.Options options = JavaCompletionProcessor.Options.DEFAULT_OPTIONS .withCheckAccess(first) .withFilterStaticAfterInstance(first) .withShowInstanceInStaticContext(!first); for (LookupElement element : JavaCompletionUtil.processJavaReference(position, (PsiJavaReference)reference, new ElementExtractorFilter(filter), options, result.getPrefixMatcher(), parameters)) { if (inheritors.alreadyProcessed(element)) { continue; } if (isSwitchLabel) { result.addElement(new IndentingDecorator(TailTypeDecorator.withTail(element, TailType.createSimpleTailType(':')))); } else { final LookupItem item = element.as(LookupItem.CLASS_CONDITION_KEY); if (originalFile instanceof PsiJavaCodeReferenceCodeFragment && !((PsiJavaCodeReferenceCodeFragment)originalFile).isClassesAccepted() && item != null) { item.setTailType(TailType.NONE); } if (item instanceof JavaMethodCallElement) { JavaMethodCallElement call = (JavaMethodCallElement)item; final PsiMethod method = call.getObject(); if (method.getTypeParameters().length > 0) { final PsiType returned = TypeConversionUtil.erasure(method.getReturnType()); PsiType matchingExpectation = returned == null ? null : ContainerUtil.find(expectedTypes, new Condition<PsiType>() { @Override public boolean value(PsiType type) { return type.isAssignableFrom(returned); } }); if (matchingExpectation != null) { call.setInferenceSubstitutor(SmartCompletionDecorator.calculateMethodReturnTypeSubstitutor(method, matchingExpectation), position); } } } result.addElement(element); } } } return; } if (reference instanceof PsiLabelReference) { LabelReferenceCompletion.processLabelReference(result, (PsiLabelReference)reference); return; } final Object[] variants = reference.getVariants(); //noinspection ConstantConditions if (variants == null) { LOG.error("Reference=" + reference); } for (Object completion : variants) { if (completion == null) { LOG.error("Position=" + position + "\n;Reference=" + reference + "\n;variants=" + Arrays.toString(variants)); } if (completion instanceof LookupElement && !inheritors.alreadyProcessed((LookupElement)completion)) { usedWords.add(((LookupElement)completion).getLookupString()); result.addElement((LookupElement)completion); } else if (completion instanceof PsiClass) { for (JavaPsiClassReferenceElement item : JavaClassNameCompletionContributor.createClassLookupItems((PsiClass)completion, isAfterNew, JavaClassNameInsertHandler.JAVA_CLASS_INSERT_HANDLER, new Condition<PsiClass>() { @Override public boolean value(PsiClass psiClass) { return !inheritors.alreadyProcessed(psiClass) && JavaCompletionUtil.isSourceLevelAccessible(position, psiClass, pkgContext); } })) { usedWords.add(item.getLookupString()); result.addElement(item); } } else { //noinspection deprecation LookupElement element = LookupItemUtil.objectToLookupItem(completion); usedWords.add(element.getLookupString()); result.addElement(element); } } } }); return usedWords; } private static void addKeywords(CompletionParameters parameters, final CompletionResultSet result) { Consumer<LookupElement> noMiddleMatches = new Consumer<LookupElement>() { @Override public void consume(LookupElement element) { if (element.getLookupString().startsWith(result.getPrefixMatcher().getPrefix())) { result.addElement(element); } } }; JavaKeywordCompletion.addKeywords(parameters, noMiddleMatches); } static boolean isClassNamePossible(CompletionParameters parameters) { boolean isSecondCompletion = parameters.getInvocationCount() >= 2; PsiElement position = parameters.getPosition(); if (JavaKeywordCompletion.isInstanceofPlace(position)) return false; final PsiElement parent = position.getParent(); if (!(parent instanceof PsiJavaCodeReferenceElement)) return isSecondCompletion; if (((PsiJavaCodeReferenceElement)parent).getQualifier() != null) return isSecondCompletion; if (parent instanceof PsiJavaCodeReferenceElementImpl && ((PsiJavaCodeReferenceElementImpl)parent).getKind(parent.getContainingFile()) == PsiJavaCodeReferenceElementImpl.PACKAGE_NAME_KIND) { return false; } PsiElement grand = parent.getParent(); if (grand instanceof PsiSwitchLabelStatement) { return false; } if (psiElement().inside(PsiImportStatement.class).accepts(parent)) { return isSecondCompletion; } if (grand instanceof PsiAnonymousClass) { grand = grand.getParent(); } if (grand instanceof PsiNewExpression && ((PsiNewExpression)grand).getQualifier() != null) { return false; } if (JavaKeywordCompletion.isAfterPrimitiveOrArrayType(position)) { return false; } return true; } public static boolean mayStartClassName(CompletionResultSet result) { return StringUtil.isNotEmpty(result.getPrefixMatcher().getPrefix()); } private static void completeAnnotationAttributeName(CompletionResultSet result, PsiElement insertedElement, CompletionParameters parameters) { PsiNameValuePair pair = PsiTreeUtil.getParentOfType(insertedElement, PsiNameValuePair.class); PsiAnnotationParameterList parameterList = (PsiAnnotationParameterList)assertNotNull(pair).getParent(); PsiAnnotation anno = (PsiAnnotation)parameterList.getParent(); boolean showClasses = psiElement().afterLeaf("(").accepts(insertedElement); PsiClass annoClass = null; final PsiJavaCodeReferenceElement referenceElement = anno.getNameReferenceElement(); if (referenceElement != null) { final PsiElement element = referenceElement.resolve(); if (element instanceof PsiClass) { annoClass = (PsiClass)element; if (annoClass.findMethodsByName("value", false).length == 0) { showClasses = false; } } } if (showClasses && insertedElement.getParent() instanceof PsiReferenceExpression) { final Set<LookupElement> set = JavaCompletionUtil.processJavaReference( insertedElement, (PsiJavaReference)insertedElement.getParent(), new ElementExtractorFilter(createAnnotationFilter(insertedElement)), JavaCompletionProcessor.Options.DEFAULT_OPTIONS, result.getPrefixMatcher(), parameters); for (final LookupElement element : set) { result.addElement(element); } addAllClasses(parameters, result, new InheritorsHolder(result)); } if (annoClass != null) { final PsiNameValuePair[] existingPairs = parameterList.getAttributes(); methods: for (PsiMethod method : annoClass.getMethods()) { if (!(method instanceof PsiAnnotationMethod)) continue; final String attrName = method.getName(); for (PsiNameValuePair existingAttr : existingPairs) { if (PsiTreeUtil.isAncestor(existingAttr, insertedElement, false)) break; if (Comparing.equal(existingAttr.getName(), attrName) || PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.equals(attrName) && existingAttr.getName() == null) continue methods; } LookupElementBuilder element = LookupElementBuilder.createWithIcon(method).withInsertHandler(new InsertHandler<LookupElement>() { @Override public void handleInsert(InsertionContext context, LookupElement item) { final Editor editor = context.getEditor(); TailType.EQ.processTail(editor, editor.getCaretModel().getOffset()); context.setAddCompletionChar(false); context.commitDocument(); PsiAnnotationParameterList paramList = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PsiAnnotationParameterList.class, false); if (paramList != null && paramList.getAttributes().length > 0 && paramList.getAttributes()[0].getName() == null) { int valueOffset = paramList.getAttributes()[0].getTextRange().getStartOffset(); context.getDocument().insertString(valueOffset, PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME); TailType.EQ.processTail(editor, valueOffset + PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.length()); } } }); PsiAnnotationMemberValue defaultValue = ((PsiAnnotationMethod)method).getDefaultValue(); if (defaultValue != null) { element = element.withTailText(" default " + defaultValue.getText(), true); } result.addElement(element); } } } @Override public String advertise(@NotNull final CompletionParameters parameters) { if (!(parameters.getOriginalFile() instanceof PsiJavaFile)) return null; if (parameters.getCompletionType() == CompletionType.BASIC && parameters.getInvocationCount() > 0) { PsiElement position = parameters.getPosition(); if (psiElement().withParent(psiReferenceExpression().withFirstChild(psiReferenceExpression().referencing(psiClass()))).accepts(position)) { if (CompletionUtil.shouldShowFeature(parameters, JavaCompletionFeatures.GLOBAL_MEMBER_NAME)) { final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION); if (StringUtil.isNotEmpty(shortcut)) { return "Pressing " + shortcut + " twice without a class qualifier would show all accessible static methods"; } } } } if (parameters.getCompletionType() != CompletionType.SMART && shouldSuggestSmartCompletion(parameters.getPosition())) { if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_SMARTTYPE_GENERAL)) { final String shortcut = getActionShortcut(IdeActions.ACTION_SMART_TYPE_COMPLETION); if (StringUtil.isNotEmpty(shortcut)) { return CompletionBundle.message("completion.smart.hint", shortcut); } } } if (parameters.getCompletionType() == CompletionType.SMART && parameters.getInvocationCount() == 1) { final PsiType[] psiTypes = ExpectedTypesGetter.getExpectedTypes(parameters.getPosition(), true); if (psiTypes.length > 0) { if (CompletionUtil.shouldShowFeature(parameters, JavaCompletionFeatures.SECOND_SMART_COMPLETION_TOAR)) { final String shortcut = getActionShortcut(IdeActions.ACTION_SMART_TYPE_COMPLETION); if (StringUtil.isNotEmpty(shortcut)) { for (final PsiType psiType : psiTypes) { final PsiType type = PsiUtil.extractIterableTypeParameter(psiType, false); if (type != null) { return CompletionBundle.message("completion.smart.aslist.hint", shortcut, type.getPresentableText()); } } } } if (CompletionUtil.shouldShowFeature(parameters, JavaCompletionFeatures.SECOND_SMART_COMPLETION_ASLIST)) { final String shortcut = getActionShortcut(IdeActions.ACTION_SMART_TYPE_COMPLETION); if (StringUtil.isNotEmpty(shortcut)) { for (final PsiType psiType : psiTypes) { if (psiType instanceof PsiArrayType) { final PsiType componentType = ((PsiArrayType)psiType).getComponentType(); if (!(componentType instanceof PsiPrimitiveType)) { return CompletionBundle.message("completion.smart.toar.hint", shortcut, componentType.getPresentableText()); } } } } } if (CompletionUtil.shouldShowFeature(parameters, JavaCompletionFeatures.SECOND_SMART_COMPLETION_CHAIN)) { final String shortcut = getActionShortcut(IdeActions.ACTION_SMART_TYPE_COMPLETION); if (StringUtil.isNotEmpty(shortcut)) { return CompletionBundle.message("completion.smart.chain.hint", shortcut); } } } } return null; } @Override public String handleEmptyLookup(@NotNull final CompletionParameters parameters, final Editor editor) { if (!(parameters.getOriginalFile() instanceof PsiJavaFile)) return null; final String ad = advertise(parameters); final String suffix = ad == null ? "" : "; " + StringUtil.decapitalize(ad); if (parameters.getCompletionType() == CompletionType.SMART) { PsiExpression expression = PsiTreeUtil.getContextOfType(parameters.getPosition(), PsiExpression.class, true); if (expression instanceof PsiLiteralExpression) { return LangBundle.message("completion.no.suggestions") + suffix; } if (expression instanceof PsiInstanceOfExpression) { final PsiInstanceOfExpression instanceOfExpression = (PsiInstanceOfExpression)expression; if (PsiTreeUtil.isAncestor(instanceOfExpression.getCheckType(), parameters.getPosition(), false)) { return LangBundle.message("completion.no.suggestions") + suffix; } } final Set<PsiType> expectedTypes = JavaCompletionUtil.getExpectedTypes(parameters); if (expectedTypes != null) { PsiType type = expectedTypes.size() == 1 ? expectedTypes.iterator().next() : null; if (type != null) { final PsiType deepComponentType = type.getDeepComponentType(); String expectedType = type.getPresentableText(); if (expectedType.contains(CompletionUtil.DUMMY_IDENTIFIER_TRIMMED)) { return null; } if (deepComponentType instanceof PsiClassType) { if (((PsiClassType)deepComponentType).resolve() != null) { return CompletionBundle.message("completion.no.suggestions.of.type", expectedType) + suffix; } return CompletionBundle.message("completion.unknown.type", expectedType) + suffix; } if (!PsiType.NULL.equals(type)) { return CompletionBundle.message("completion.no.suggestions.of.type", expectedType) + suffix; } } } } return LangBundle.message("completion.no.suggestions") + suffix; } @Override public boolean invokeAutoPopup(@NotNull PsiElement position, char typeChar) { return typeChar == ':' && JavaTokenType.COLON == position.getNode().getElementType(); } private static boolean shouldSuggestSmartCompletion(final PsiElement element) { if (shouldSuggestClassNameCompletion(element)) return false; final PsiElement parent = element.getParent(); if (parent instanceof PsiReferenceExpression && ((PsiReferenceExpression)parent).getQualifier() != null) return false; if (parent instanceof PsiReferenceExpression && parent.getParent() instanceof PsiReferenceExpression) return true; return ExpectedTypesGetter.getExpectedTypes(element, false).length > 0; } private static boolean shouldSuggestClassNameCompletion(final PsiElement element) { if (element == null) return false; final PsiElement parent = element.getParent(); if (parent == null) return false; return parent.getParent() instanceof PsiTypeElement || parent.getParent() instanceof PsiExpressionStatement || parent.getParent() instanceof PsiReferenceList; } @Override public void beforeCompletion(@NotNull final CompletionInitializationContext context) { final PsiFile file = context.getFile(); if (file instanceof PsiJavaFile) { if (context.getInvocationCount() > 0) { autoImport(file, context.getStartOffset() - 1, context.getEditor()); PsiElement leaf = file.findElementAt(context.getStartOffset() - 1); if (leaf != null) leaf = PsiTreeUtil.prevVisibleLeaf(leaf); PsiVariable variable = PsiTreeUtil.getParentOfType(leaf, PsiVariable.class); if (variable != null) { PsiTypeElement typeElement = variable.getTypeElement(); if (typeElement != null) { PsiType type = typeElement.getType(); if (type instanceof PsiClassType && ((PsiClassType)type).resolve() == null) { autoImportReference(file, context.getEditor(), typeElement.getInnermostComponentReferenceElement()); } } } } if (context.getCompletionType() == CompletionType.BASIC) { if (semicolonNeeded(context.getEditor(), file, context.getStartOffset())) { context.setDummyIdentifier(CompletionInitializationContext.DUMMY_IDENTIFIER.trim() + ";"); return; } final PsiJavaCodeReferenceElement ref = PsiTreeUtil.findElementOfClassAtOffset(file, context.getStartOffset(), PsiJavaCodeReferenceElement.class, false); if (ref != null && !(ref instanceof PsiReferenceExpression)) { if (JavaSmartCompletionContributor.AFTER_NEW.accepts(ref)) { final PsiReferenceParameterList paramList = ref.getParameterList(); if (paramList != null && paramList.getTextLength() > 0) { context.getOffsetMap().addOffset(ConstructorInsertHandler.PARAM_LIST_START, paramList.getTextRange().getStartOffset()); context.getOffsetMap().addOffset(ConstructorInsertHandler.PARAM_LIST_END, paramList.getTextRange().getEndOffset()); } } return; } final PsiElement element = file.findElementAt(context.getStartOffset()); if (psiElement().inside(PsiAnnotation.class).accepts(element)) { return; } context.setDummyIdentifier(CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED); } } } public static boolean semicolonNeeded(final Editor editor, PsiFile file, final int startOffset) { final PsiJavaCodeReferenceElement ref = PsiTreeUtil.findElementOfClassAtOffset(file, startOffset, PsiJavaCodeReferenceElement.class, false); if (ref != null && !(ref instanceof PsiReferenceExpression)) { if (ref.getParent() instanceof PsiTypeElement) { return true; } } HighlighterIterator iterator = ((EditorEx)editor).getHighlighter().createIterator(startOffset); if (iterator.atEnd()) return false; if (iterator.getTokenType() == JavaTokenType.IDENTIFIER) { iterator.advance(); } while (!iterator.atEnd() && ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(iterator.getTokenType())) { iterator.advance(); } if (!iterator.atEnd() && iterator.getTokenType() == JavaTokenType.LPARENTH && PsiTreeUtil.getParentOfType(ref, PsiExpression.class, PsiClass.class) == null) { // looks like a method declaration, e.g. StringBui<caret>methodName() inside a class return true; } if (!iterator.atEnd() && (iterator.getTokenType() == JavaTokenType.COLON) && null == PsiTreeUtil.findElementOfClassAtOffset(file, startOffset, PsiConditionalExpression.class, false)) { return true; } while (!iterator.atEnd() && ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(iterator.getTokenType())) { iterator.advance(); } if (iterator.atEnd() || iterator.getTokenType() != JavaTokenType.IDENTIFIER) return false; iterator.advance(); while (!iterator.atEnd() && ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(iterator.getTokenType())) { iterator.advance(); } if (iterator.atEnd()) return false; return iterator.getTokenType() == JavaTokenType.EQ; // <caret> foo = something, we don't want the reference to be treated as a type } private static void autoImport(@NotNull final PsiFile file, int offset, @NotNull final Editor editor) { final CharSequence text = editor.getDocument().getCharsSequence(); while (offset > 0 && Character.isJavaIdentifierPart(text.charAt(offset))) offset--; if (offset <= 0) return; while (offset > 0 && Character.isWhitespace(text.charAt(offset))) offset--; if (offset <= 0 || text.charAt(offset) != '.') return; offset--; while (offset > 0 && Character.isWhitespace(text.charAt(offset))) offset--; if (offset <= 0) return; autoImportReference(file, editor, extractReference(PsiTreeUtil.findElementOfClassAtOffset(file, offset, PsiExpression.class, false))); } private static void autoImportReference(@NotNull PsiFile file, @NotNull Editor editor, @Nullable PsiJavaCodeReferenceElement element) { if (element == null) return; while (true) { final PsiJavaCodeReferenceElement qualifier = extractReference(element.getQualifier()); if (qualifier == null) break; element = qualifier; } if (!(element.getParent() instanceof PsiMethodCallExpression) && element.multiResolve(true).length == 0) { new ImportClassFix(element).doFix(editor, false, false); PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument()); } } @Nullable private static PsiJavaCodeReferenceElement extractReference(@Nullable PsiElement expression) { if (expression instanceof PsiJavaCodeReferenceElement) { return (PsiJavaCodeReferenceElement)expression; } if (expression instanceof PsiMethodCallExpression) { return ((PsiMethodCallExpression)expression).getMethodExpression(); } return null; } private static class IndentingDecorator extends LookupElementDecorator<LookupElement> { public IndentingDecorator(LookupElement delegate) { super(delegate); } @Override public void handleInsert(InsertionContext context) { super.handleInsert(context); Project project = context.getProject(); Document document = context.getDocument(); int lineStartOffset = DocumentUtil.getLineStartOffset(context.getStartOffset(), document); PsiDocumentManager.getInstance(project).commitDocument(document); CodeStyleManager.getInstance(project).adjustLineIndent(context.getFile(), lineStartOffset); } } }
bf5bc26c82f5a6dd35eee03c4a97563aa47a110f
f9dd2959a65b9bd8b59982e5183d27dd0331ff1a
/app/src/main/java/com/example/administrator/sharenebulaproject/ui/activity/about/FansActivity.java
264585e43d7e656118d2a53a365acb32a598d3e2
[]
no_license
zengli199447/shareProject
8b7b5649e24e8f3474affa50796d09785482c044
534951938fe0c78b027e332757693ee86b1f82be
refs/heads/master
2020-04-10T04:27:10.036800
2019-04-15T03:09:03
2019-04-15T03:09:03
160,798,613
0
0
null
null
null
null
UTF-8
Java
false
false
4,970
java
package com.example.administrator.sharenebulaproject.ui.activity.about; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.example.administrator.sharenebulaproject.R; import com.example.administrator.sharenebulaproject.base.BaseActivity; import com.example.administrator.sharenebulaproject.global.DataClass; import com.example.administrator.sharenebulaproject.model.bean.FansNetBean; import com.example.administrator.sharenebulaproject.model.bean.MineInfoNetBean; import com.example.administrator.sharenebulaproject.model.event.CommonEvent; import com.example.administrator.sharenebulaproject.rxtools.RxUtil; import com.example.administrator.sharenebulaproject.ui.adapter.FansAdapter; import com.example.administrator.sharenebulaproject.ui.dialog.ProgressDialog; import com.example.administrator.sharenebulaproject.ui.dialog.ShowDialog; import com.example.administrator.sharenebulaproject.utils.SystemUtil; import com.example.administrator.sharenebulaproject.widget.CommonSubscriber; import com.google.gson.Gson; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import butterknife.BindView; /** * Created by Administrator on 2018/8/22. * 粉丝管理 */ public class FansActivity extends BaseActivity implements View.OnClickListener, AdapterView.OnItemClickListener { @BindView(R.id.fans_prople) TextView fans_prople; @BindView(R.id.fans_list) ListView fans_list; @BindView(R.id.title_name) TextView title_name; @BindView(R.id.img_btn_black) ImageButton img_btn_black; private ProgressDialog progressDialog; private List<FansNetBean.ResultBean.DetaillistBean> detaillist; private FansNetBean.ResultBean.DetaillistBean detaillistBean; @Override protected void registerEvent(CommonEvent commonevent) { } @Override protected void initInject() { getActivityComponent().inject(this); } @Override protected int getLayout() { return R.layout.activity_fans; } @Override protected void initClass() { progressDialog = ShowDialog.getInstance().showProgressStatus(this, getString(R.string.progress)); } @Override protected void initData() { progressDialog.show(); initNetDataWork(); } @Override protected void initView() { title_name.setText(getString(R.string.fans)); } @Override protected void initListener() { fans_list.setOnItemClickListener(this); img_btn_black.setOnClickListener(this); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.img_btn_black: finish(); break; } } @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { detaillistBean = detaillist.get(i); Intent fansIntent = new Intent(this, SettlementLogActivity.class); fansIntent.putExtra("value", detaillistBean.getLevelconfigid()); fansIntent.setFlags(1); startActivity(fansIntent); } //获取粉丝信息 private void initNetDataWork() { HashMap map = new HashMap<>(); LinkedHashMap linkedHashMap = new LinkedHashMap(); linkedHashMap.put("action", DataClass.FANS_TJ_GET); linkedHashMap.put("userid", DataClass.USERID); String toJson = new Gson().toJson(linkedHashMap); map.put("version", "v1"); map.put("vars", toJson); addSubscribe(dataManager.getFansNetBean(map) .compose(RxUtil.<FansNetBean>rxSchedulerHelper()) .subscribeWith(new CommonSubscriber<FansNetBean>(toastUtil) { @Override public void onNext(FansNetBean fansNetBean) { Log.e(TAG, "FansNetBean : " + fansNetBean.toString()); if (fansNetBean.getStatus() == 1) { detaillist = fansNetBean.getResult().getDetaillist(); initAdapter(); new SystemUtil().textMagicTool(FansActivity.this, fans_prople, new StringBuffer().append(fansNetBean.getResult().getTotal()).append("\n").toString(), getString(R.string.fans_about), R.dimen.dp18, R.dimen.dp12, R.color.white, R.color.white); }else { toastUtil.showToast(fansNetBean.getMessage()); } progressDialog.dismiss(); } })); } private void initAdapter() { FansAdapter fansAdapter = new FansAdapter(this, detaillist); fans_list.setAdapter(fansAdapter); fansAdapter.notifyDataSetChanged(); } }
209cf0179ce2288e78ceee650ef9f632e77ebbd5
fd171591f19b62cb123021102871de03fcc18cfa
/app/src/main/java/com/example/android/tourguideapp/DetailFragment.java
1b936ac2474fc9d723dc0457667dcffd70693a1b
[]
no_license
chrisabbod/tour-guide-app
d67b2a4f3bb0a4e4e84a0383e6d3bff98f61bebe
7267fadf59a7db1e815d4ef1586f618759edc4a5
refs/heads/master
2020-03-19T03:54:44.441584
2018-06-07T00:44:56
2018-06-07T00:44:56
135,765,963
0
0
null
null
null
null
UTF-8
Java
false
false
2,716
java
package com.example.android.tourguideapp; 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.ImageView; import android.widget.TextView; /** * A simple {@link Fragment} subclass. */ public class DetailFragment extends Fragment { private String stringExtraTitle, stringExtraDetails, stringExtraAddress, stringExtraPhone; private int intExtra; public DetailFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.fragment_detail, container, false); //If there is no savedInstanceState (Because we just arrived at this activity from the main activity) retrieve the string extra if(savedInstanceState == null){ Bundle extras = getActivity().getIntent().getExtras(); if(extras == null){ stringExtraTitle = null; stringExtraDetails = null; stringExtraAddress = null; stringExtraPhone = null; }else{ stringExtraTitle = extras.getString("string_title_index"); stringExtraDetails = extras.getString("string_details_index"); stringExtraAddress = extras.getString("string_address_index"); stringExtraPhone = extras.getString("string_phone_index"); intExtra = extras.getInt("image_resource_index"); } }else{ stringExtraTitle = (String)savedInstanceState.getSerializable("string_title_index"); intExtra = savedInstanceState.getInt("image_resource_index"); } ImageView detailImageView = rootView.findViewById(R.id.detail_image_view); TextView titleView = rootView.findViewById(R.id.title_text_view); TextView detailView = rootView.findViewById(R.id.detail_text_view); TextView addressView = rootView.findViewById(R.id.address_text_view); TextView phoneNumberView = rootView.findViewById(R.id.phone_number_text_view); detailImageView.setImageResource(intExtra); titleView.setText(stringExtraTitle); detailView.setText(stringExtraDetails); addressView.setText(stringExtraAddress); phoneNumberView.setText(stringExtraPhone); return rootView; } public void onResume(){ super.onResume(); //Set title bar (getActivity()).setTitle(stringExtraTitle); } }
18c5ef783c44775b6d4258fad5be545c718c561d
32db62d340df3b1514cf3d49083a21389a59e0d7
/core/src/main/java/com/ggar/webcrawler/core/definitions/crawler/CrawlerTask.java
3c83b05492a8e8bc035ebb9164061b74486fe18e
[ "MIT" ]
permissive
g-gar/webcrawler
ffc14095136fdc7423be4cc0c60f2b5927367b31
3807118172e95aac32be4feaa54c19ade5c96e05
refs/heads/main
2023-03-27T07:01:40.688681
2021-03-26T16:39:04
2021-03-26T16:39:04
348,038,169
1
0
null
null
null
null
UTF-8
Java
false
false
217
java
package com.ggar.webcrawler.core.definitions.crawler; import java.net.URL; import java.util.Collection; import java.util.function.Function; public interface CrawlerTask extends Function<URL, Collection<URL>> { }
9bff2ef684456b5f4b7632a4c342e0bd4f4ba20e
d06c4a0e3699567decdff471b31fb2ee81d25798
/src/main/java/com/happyrabbit/sbone/service/UserService.java
a69b84588090b03d2285387f6ff84b3d042795d5
[]
no_license
magicv666/springboot-mybatise-project
7301f603668ab711dc2498ad122d23a7084fcd78
0ac031774aaa34637f7a239efae72ca4a9e93c63
refs/heads/master
2020-03-11T12:04:40.838335
2018-04-18T01:37:57
2018-04-18T01:37:57
129,987,052
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
package com.happyrabbit.sbone.service; import com.happyrabbit.sbone.entity.User; public interface UserService { //List<User> findUserAll(); User findUserByPhone(String phone); String addUser(User user); String modifyUser(User user); }
1baa9dfcab749f2f73ece9bb51686d4dc27c5d94
d0675a8078bff9c67e10b9e28705f528e44eed88
/pandomium/src/main/java/org/panda_lang/pandomium/loader/PandomiumDownloader.java
5833b6301ac8c48f43c7807f1bedc34d87fe8e73
[ "Apache-2.0" ]
permissive
ensonic/Pandomium
1e6bab69a59b2dbb0639d3b20d64e22fa4c19ad9
ad96fec8b580364b9065f3547e9a7c0232ac158e
refs/heads/master
2020-03-19T15:14:17.348460
2018-06-23T10:22:33
2018-06-23T10:22:33
136,661,800
0
0
Apache-2.0
2018-06-08T20:10:42
2018-06-08T20:10:41
null
UTF-8
Java
false
false
1,719
java
package org.panda_lang.pandomium.loader; import java.io.*; import java.net.*; import java.util.*; public class PandomiumDownloader { private final PandomiumLoader loader; private Collection<HttpURLConnection> connections; public PandomiumDownloader(PandomiumLoader loader) { this.loader = loader; this.connections = new ArrayList<>(1); } public InputStream download(URL url) throws Exception { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connections.add(connection); connection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); connection.connect(); return connection.getInputStream(); } public void closeConnections() { for (HttpURLConnection connection : connections) { try { connection.disconnect(); } catch (Exception e) { // mute } } connections.clear(); } protected static String toHumanFormat(long bytes, boolean si) { int unit = si ? 1000 : 1024; if (bytes < unit) return bytes + " B"; int exp = (int) (Math.log(bytes) / Math.log(unit)); String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i"); return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); } protected static long getFileSize(URL url) throws Exception { HttpURLConnection conn = (HttpURLConnection) url.openConnection(); long length = conn.getContentLengthLong(); conn.disconnect(); return length; } }
8b8b4ce90561610d7dd052e5f1fa84f25e4393d4
6d13e0ddd1e893bdb00ad60e7ec21639c360bc80
/cfr-sample/KuhnTrainer.java
ff6d671ef899d6d186b4a2922cc1783e19a5f690
[ "MIT" ]
permissive
tcnj-violaa/eaai2021-public
c1b77190847051afb22d0560f7cbcc429a4d56e2
78876146e229fd72cae90a1edb89ab95fd42ce0e
refs/heads/master
2022-12-01T14:27:58.964124
2020-08-09T23:28:41
2020-08-09T23:28:41
286,333,262
1
0
null
null
null
null
UTF-8
Java
false
false
4,327
java
import java.util.Arrays; import java.util.Random; import java.util.TreeMap; public class KuhnTrainer { public static final int PASS = 0, BET = 1, NUM_ACTIONS = 2; public static final Random random = new Random(); public TreeMap<String, Node> nodeMap = new TreeMap<String, Node>(); class Node { String infoSet; double[] regretSum = new double[NUM_ACTIONS], strategy = new double[NUM_ACTIONS], strategySum = new double[NUM_ACTIONS]; private double[] getStrategy(double realizationWeight) { double normalizingSum = 0; for (int a = 0; a < NUM_ACTIONS; a++) { strategy[a] = regretSum[a] > 0 ? regretSum[a] : 0; normalizingSum += strategy[a]; } for (int a = 0; a < NUM_ACTIONS; a++) { if (normalizingSum > 0) strategy[a] /= normalizingSum; else strategy[a] = 1.0 / NUM_ACTIONS; strategySum[a] += realizationWeight * strategy[a]; } return strategy; } public double[] getAverageStrategy() { double[] avgStrategy = new double[NUM_ACTIONS]; double normalizingSum = 0; for (int a = 0; a < NUM_ACTIONS; a++) normalizingSum += strategySum[a]; for (int a = 0; a < NUM_ACTIONS; a++) if (normalizingSum > 0) avgStrategy[a] = strategySum[a] / normalizingSum; else avgStrategy[a] = 1.0 / NUM_ACTIONS; return avgStrategy; } public String toString() { return String.format("%4s: %s", infoSet, Arrays.toString(getAverageStrategy())); } } public void train(int iterations) { int[] cards = {1, 2, 3}; double util = 0; for (int i = 0; i < iterations; i++) { for (int c1 = cards.length - 1; c1 > 0; c1--) { int c2 = random.nextInt(c1 + 1); int tmp = cards[c1]; cards[c1] = cards[c2]; cards[c2] = tmp; } util += cfr(cards, "", 1, 1); } System.out.println("Average game value: " + util / iterations); for (Node n : nodeMap.values()) System.out.println(n); } private double cfr(int[] cards, String history, double p0, double p1) { int plays = history.length(); int player = plays % 2; int opponent = 1 - player; if (plays > 1) { boolean terminalPass = history.charAt(plays - 1) == 'p'; boolean doubleBet = history.substring(plays - 2, plays).equals("bb"); boolean isPlayerCardHigher = cards[player] > cards[opponent]; if (terminalPass) if (history.equals("pp")) return isPlayerCardHigher ? 1 : -1; else return 1; else if (doubleBet) return isPlayerCardHigher ? 2 : -2; } String infoSet = cards[player] + history; Node node = nodeMap.get(infoSet); if (node == null) { node = new Node(); node.infoSet = infoSet; nodeMap.put(infoSet, node); } double[] strategy = node.getStrategy(player == 0 ? p0 : p1); double[] util = new double[NUM_ACTIONS]; double nodeUtil = 0; for (int a = 0; a < NUM_ACTIONS; a++) { String nextHistory = history + (a == 0 ? "p" : "b"); util[a] = player == 0 ? - cfr(cards, nextHistory, p0 * strategy[a], p1) : - cfr(cards, nextHistory, p0, p1 * strategy[a]); nodeUtil += strategy[a] * util[a]; } for (int a = 0; a < NUM_ACTIONS; a++) { double regret = util[a] - nodeUtil; node.regretSum[a] += (player == 0 ? p1 : p0) * regret; } return nodeUtil; } public static void main(String[] args) { int iterations = 1000000; new KuhnTrainer().train(iterations); } }
cb40aca4aecfb7b9301870ce5663e91ed1f81141
c74af637d18753b50bc0ca0cbc46f7382151f8d1
/app/src/main/java/com/example/droweathermvp/interfaces/Observer.java
f315660972c27054ed8f925a070858b0c7987f63
[]
no_license
AnastasiaDro/DroWeatherMVP
37d91bb9cefb2e526ca66f5ad6f0b9cdcf3dcf58
d9243ae2d0ccd670e0fe89f0b2aebc36f09c4252
refs/heads/master
2022-08-02T04:15:35.931829
2020-05-28T05:25:39
2020-05-28T05:25:39
265,883,601
0
0
null
null
null
null
UTF-8
Java
false
false
100
java
package com.example.droweathermvp.interfaces; public interface Observer { void updateData(); }