blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
โŒ€
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
85479c306345d0910449fd38a703dd57518240d3
44580d08585ed2ce77fe9ec8545535f298bedfaa
/src/subjectAndObserver/Observer.java
3a37461030c59ede1438c05ab0b5f6a0ee4f5c80
[]
no_license
cyrilnoah1/ObserverPattern
2bf3b33443032db7a8408fb70d1cf81cfe3149f0
96bfa4df27607b51bb16877b926ab961caf92c11
refs/heads/master
2021-01-11T20:24:41.328592
2017-01-16T11:29:07
2017-01-16T11:29:07
79,111,944
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
package subjectAndObserver; /** * Observer interface to notify all the observers. */ public interface Observer { void grantCoins(int coins); }
[ "cyril.noah1@gmail.com" ]
cyril.noah1@gmail.com
383e99a948c5fb3b293f598add5d719760765baa
d27016431e4cf0c5837a2d7ccf70bfae3225d302
/SampleRestAssured/src/test/java/TestRuuner/Runner.java
f72207403001384cec592122bd14050a0df7d21c
[]
no_license
Nidhi031/Webservices
ea360746613166e286181cd17e7eeb46d334ccaf
84d63ebb824d79775fe832623ad8fc738cc78567
refs/heads/master
2020-04-04T10:06:54.606725
2018-11-02T09:28:02
2018-11-02T09:28:02
155,843,165
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package TestRuuner; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import cucumber.api.testng.AbstractTestNGCucumberTests; @RunWith(Cucumber.class) @CucumberOptions( features = "src/test/java/Feature Files/hcsc.feature",glue = {"stepDefinitions"} ,plugin= {"pretty","json:target/Cucumber-report/cucumber.json"} ) public class Runner{ }
[ "nidhipal83@gmail.com" ]
nidhipal83@gmail.com
06a6508023eff6c43ce2c9071c778a248139a3e0
92a5d0e9f91a85bdeace182e2af425b46178e39a
/oh-my-scheduler-worker/src/main/java/com/github/kfcfans/oms/worker/persistence/ConnectionFactory.java
ec89fa4eab88a9398ec018ccd63db38d69d66770
[ "Apache-2.0" ]
permissive
ColaFans/OhMyScheduler
fd0f1efe9f9f2f1386ef34728fe53ea609e1ec6d
53cbe060b65df78730b2f576c27b6f143de78ffb
refs/heads/master
2022-10-13T14:22:03.678873
2020-06-09T03:00:23
2020-06-09T03:00:23
270,890,471
2
1
Apache-2.0
2020-06-09T03:06:58
2020-06-09T03:06:58
null
UTF-8
Java
false
false
1,657
java
package com.github.kfcfans.oms.worker.persistence; import com.github.kfcfans.oms.worker.OhMyWorker; import com.github.kfcfans.oms.worker.common.constants.StoreStrategy; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; /** * ๆ•ฐๆฎๅบ“่ฟžๆŽฅ็ฎก็† * * @author tjq * @since 2020/3/17 */ public class ConnectionFactory { private static volatile DataSource dataSource; private static final String DISK_JDBC_URL = "jdbc:h2:file:~/oms/h2/oms_worker_db"; private static final String MEMORY_JDBC_URL = "jdbc:h2:mem:~/oms/h2/oms_worker_db"; public static Connection getConnection() throws SQLException { return getDataSource().getConnection(); } private static DataSource getDataSource() { if (dataSource != null) { return dataSource; } synchronized (ConnectionFactory.class) { if (dataSource == null) { StoreStrategy strategy = OhMyWorker.getConfig().getStoreStrategy(); HikariConfig config = new HikariConfig(); config.setDriverClassName("org.h2.Driver"); config.setJdbcUrl(strategy == StoreStrategy.DISK ? DISK_JDBC_URL : MEMORY_JDBC_URL); config.setAutoCommit(true); // ๆฑ ไธญๆœ€ๅฐ็ฉบ้—ฒ่ฟžๆŽฅๆ•ฐ้‡ config.setMinimumIdle(2); // ๆฑ ไธญๆœ€ๅคง่ฟžๆŽฅๆ•ฐ้‡ config.setMaximumPoolSize(32); dataSource = new HikariDataSource(config); } } return dataSource; } }
[ "tengjiqi@gmail.com" ]
tengjiqi@gmail.com
99f9ac6664053f262cec23598dd5761b9d0fa7aa
d90c4d4789c35d33793fed59a2d1a953197256bc
/src/main/java/com/srikanthdev/rest/webservices/controller/UserResource.java
8a180a72714a4a8a05e30ce03723a651c097ef6e
[]
no_license
srikanth-kanakaboina/spring-boot-resful-web-services
f2a037cdd0533b7d1e762330f8a16d0b4409d6c3
d802022fb8cc464823100728e7f9b7a6b30e4753
refs/heads/master
2021-06-30T00:11:09.863486
2017-09-18T16:50:09
2017-09-18T16:50:09
103,965,452
0
0
null
null
null
null
UTF-8
Java
false
false
2,125
java
package com.srikanthdev.rest.webservices.controller; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.*; import com.srikanthdev.rest.webservices.exception.UserNotFoundException; import com.srikanthdev.rest.webservices.model.User; import com.srikanthdev.rest.webservices.service.UserDaoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.Resource; import org.springframework.hateoas.mvc.ControllerLinkBuilder; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import javax.validation.Valid; import java.net.URI; import java.util.List; @RestController public class UserResource { //retrive all users @Autowired private UserDaoService userDaoService; @GetMapping("/users") public List<User> retriveAllUsers() { return userDaoService.findAll(); } @GetMapping("/user/{id}") public Resource<User> getUser(@PathVariable int id) { User user=userDaoService.findOne(id); if(user==null) throw new UserNotFoundException("id-"+id); Resource<User> resource=new Resource<>(user); ControllerLinkBuilder linkTo=linkTo(methodOn(this.getClass()).retriveAllUsers()); resource.add(linkTo.withRel("all-users")); return resource; } @DeleteMapping("/user/{id}") public void deleteUser(@PathVariable int id) { User user=userDaoService.deleteById(id); if(user==null) throw new UserNotFoundException("id-"+id); } @PostMapping("/user") public ResponseEntity createUser( @Valid @RequestBody User user) { User savedUser = userDaoService.save(user); //Status of created URI location=ServletUriComponentsBuilder.fromCurrentRequest() .path("/{id}") .buildAndExpand(savedUser.getId()) .toUri(); return ResponseEntity.created(location).build(); } }
[ "srikanth.kanakaboina@gmail.com" ]
srikanth.kanakaboina@gmail.com
b8dae743c28f7e1f44ca48b1576aa75dfb7adadb
493ecb3fe0333e4ff36a37add2d886ce722c8670
/src/main/java/com/ems/dto/ems/EmployeeDesignationSetupDTO.java
f36fb1e2e809877716e8970a2c2209af17c8ac5c
[]
no_license
ApurboRahman/EmployeeManagementSystem
5dc705f255ff3034f0bac1983e225b6204086cbd
081a0247d42f1f75f6019b06b35c254686dc22ed
refs/heads/master
2020-03-30T09:47:37.292614
2018-10-01T13:38:57
2018-10-01T13:38:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,305
java
package com.ems.dto.ems; import java.util.Date; /** * Created by Apurbo on 11/22/2016. */ public class EmployeeDesignationSetupDTO { Integer employeeDesignationType; String shortName; String fullName; String userName; Date setDate; String approvedBy; public Integer getEmployeeDesignationType() { return employeeDesignationType; } public void setEmployeeDesignationType(Integer employeeDesignationType) { this.employeeDesignationType = employeeDesignationType; } public String getShortName() { return shortName; } public void setShortName(String shortName) { this.shortName = shortName; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public Date getSetDate() { return setDate; } public void setSetDate(Date setDate) { this.setDate = setDate; } public String getApprovedBy() { return approvedBy; } public void setApprovedBy(String approvedBy) { this.approvedBy = approvedBy; } }
[ "jsr143rahman@gmail.com" ]
jsr143rahman@gmail.com
8f05168467d3d3fe6ad9979f89e5592446b8d40a
d4f894bdeeea7caf9daddb2e9930d894ce1b0c6d
/gomall-product/src/main/java/online/icode/gomall/product/dao/SpuImagesDao.java
f41997fe2ca462ba062f2e1257d037e70a8adad1
[]
no_license
AnonyStar/gomall
29c3a42310c3526fffadaef393d4897d2b76fd43
036ba0199c80a792adfed0035806e44e44163d0a
refs/heads/master
2023-02-19T04:19:52.118830
2021-01-14T08:21:11
2021-01-14T08:21:11
311,891,565
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package online.icode.gomall.product.dao; import online.icode.gomall.product.entity.SpuImagesEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** * spuๅ›พ็‰‡ * * @author AnonyStar * @email AnonyStarCode@gmail.com * @date 2020-12-03 17:04:18 */ @Mapper public interface SpuImagesDao extends BaseMapper<SpuImagesEntity> { }
[ "zcx950216" ]
zcx950216
a9dd06a87514ab3731b6cb464c5a61bf090fbe45
b6298b6427aa127dc0195e8532bcc1595b5d2634
/web/retail-web/src/main/java/com/iwhalecloud/retail/web/controller/b2b/warehouse/ResourceReqDetailB2BController.java
2c5fbc3520fd457712a7c979826b1a9dfbcf9cc0
[]
no_license
chenmget/spring-cloud-demo
2ecbdeeb5102dc7523ef9fc59a405fc5c77bf6ad
0b4100973d2f6525883e0e73f000ac6e9c0b9060
refs/heads/release
2022-07-17T13:41:20.595393
2020-04-02T07:40:19
2020-04-02T07:40:19
249,857,665
1
3
null
2022-06-29T18:02:22
2020-03-25T01:23:07
Java
UTF-8
Java
false
false
4,612
java
package com.iwhalecloud.retail.web.controller.b2b.warehouse; import com.alibaba.dubbo.config.annotation.Reference; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.iwhalecloud.retail.dto.ResultVO; import com.iwhalecloud.retail.warehouse.dto.request.ResourceReqDetailPageReq; import com.iwhalecloud.retail.warehouse.dto.response.ResourceReqDetailPageResp; import com.iwhalecloud.retail.warehouse.service.ResourceReqDetailService; import com.iwhalecloud.retail.web.controller.b2b.order.dto.ExcelTitleName; import com.iwhalecloud.retail.web.controller.b2b.warehouse.utils.ExcelToNbrUtils; import com.iwhalecloud.retail.web.controller.b2b.warehouse.utils.ResourceInstColum; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.OutputStream; import java.util.List; /** * @Author My * @Date 2019/04/18 **/ @RestController @RequestMapping("/api/b2b/resourceReqDetail") @Slf4j public class ResourceReqDetailB2BController { @Reference private ResourceReqDetailService resourceReqDetailService; @ApiOperation(value = "ๆŸฅ่ฏข็”ณ่ฏทๅ•่ฏฆๆƒ…ไธฒ็ ๅˆ†้กตๅˆ—่กจ", notes = "ๆŸฅ่ฏข็”ณ่ฏทๅ•่ฏฆๆƒ…ไธฒ็ ๅˆ†้กตๅˆ—่กจ") @ApiImplicitParams({ @ApiImplicitParam(name = "mktResReqId", value = "mktResReqId", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "mktResInstNbr", value = "mktResInstNbr", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "isInspection", value = "isInspection", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "pageNo", value = "pageNo", paramType = "query", required = false, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "pageSize", paramType = "query", required = false, dataType = "Integer") }) @ApiResponses({ @ApiResponse(code=400,message="่ฏทๆฑ‚ๅ‚ๆ•ฐๆฒกๅกซๅฅฝ"), @ApiResponse(code=404,message="่ฏทๆฑ‚่ทฏๅพ„ๆฒกๆœ‰ๆˆ–้กต้ข่ทณ่ฝฌ่ทฏๅพ„ไธๅฏน") }) @GetMapping(value="resourceRequestPage") public ResultVO<Page<ResourceReqDetailPageResp>> resourceRequestPage(String mktResReqId, String mktResInstNbr, String isInspection, Integer pageNo, Integer pageSize) { ResourceReqDetailPageReq req = new ResourceReqDetailPageReq(); req.setMktResReqId(mktResReqId); req.setMktResInstNbr(mktResInstNbr); req.setPageNo(pageNo); req.setPageSize(pageSize); req.setIsInspection(isInspection); return resourceReqDetailService.resourceRequestPage(req); } @ApiOperation(value = "ๅฏผๅ‡บ", notes = "ๅฏผๅ‡บไธฒ็ ๆ•ฐๆฎ") @ApiResponses({ @ApiResponse(code=400,message="่ฏทๆฑ‚ๅ‚ๆ•ฐๆฒกๅกซๅฅฝ"), @ApiResponse(code=404,message="่ฏทๆฑ‚่ทฏๅพ„ๆฒกๆœ‰ๆˆ–้กต้ข่ทณ่ฝฌ่ทฏๅพ„ไธๅฏน") }) @PostMapping(value="nbrExport") public void nbrExport(@RequestBody ResourceReqDetailPageReq req, HttpServletResponse response) { ResultVO<List<ResourceReqDetailPageResp>> resultVO = resourceReqDetailService.resourceRequestList(req); List<ResourceReqDetailPageResp> list = resultVO.getResultData(); log.info("ResourceReqDetailB2BController.nbrExport resourceReqDetailService.resourceRequestPage req={}, resp={}", JSON.toJSONString(req),JSON.toJSONString(list)); List<ExcelTitleName> excelTitleNames = ResourceInstColum.reqDetailColumn(); OutputStream output = null; try{ //ๅˆ›ๅปบExcel Workbook workbook = new HSSFWorkbook(); ExcelToNbrUtils.builderOrderExcel(workbook, list, excelTitleNames, true); output = response.getOutputStream(); response.reset(); response.setHeader("Content-disposition", "attachment; filename="); response.setContentType("application/msexcel;charset=UTF-8"); response.setCharacterEncoding("UTF-8"); workbook.write(output); }catch (Exception e){ log.error("็”ณ่ฏทๅ•่ฏฆๆƒ…ๅฏผๅ‡บๅคฑ่ดฅ",e); } finally { try { if (null != output) { output.close(); } } catch (Exception e) { log.error("error:", e); } } } }
[ "he.shaowu01@iwhalecloud.com" ]
he.shaowu01@iwhalecloud.com
6237ba7d4f78d6c055f31e9628840b491eb92e75
f7b737b80a2e7407732f9ced0b6d8c21f8bcb9ef
/raw.githubusercontent.com/fixteam/fixflow/master/modules/fixflow-core/src/main/java/com/founder/fix/fixflow/core/impl/runtime/IdentityLinkQueryImpl.java
f09b8ad9d4818eea9290b04f2711854fd24c4341
[]
no_license
uetestina/ml1
7f6f9e932efb87231cd2d29f217ca8b09dc25f6f
ccb13a4ac6030b91915ff5a6c1a82f46ca824d4a
refs/heads/main
2023-08-14T00:09:00.148704
2021-10-01T16:02:21
2021-10-01T16:02:21
412,149,108
0
0
null
null
null
null
UTF-8
Java
false
false
3,966
java
/** * Copyright 1996-2013 Founder International Co.,Ltd. * * 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. * * @author kenshin */ package com.founder.fix.fixflow.core.impl.runtime; import java.util.List; import com.founder.fix.fixflow.core.impl.AbstractQuery; import com.founder.fix.fixflow.core.impl.Page; import com.founder.fix.fixflow.core.impl.interceptor.CommandContext; import com.founder.fix.fixflow.core.impl.interceptor.CommandExecutor; import com.founder.fix.fixflow.core.runtime.IdentityLinkQuery; import com.founder.fix.fixflow.core.runtime.QueryLocation; import com.founder.fix.fixflow.core.task.IdentityLink; import com.founder.fix.fixflow.core.task.IdentityLinkType; import com.founder.fix.fixflow.core.task.IncludeExclusion; public class IdentityLinkQueryImpl extends AbstractQuery<IdentityLinkQuery, IdentityLink> implements IdentityLinkQuery{ protected String id; protected IdentityLinkType type; protected String userId; protected String groupId; protected String groupType; protected QueryLocation queryLocation = null; protected IncludeExclusion includeExclusion; protected String taskId; public IdentityLinkQueryImpl() { } public IdentityLinkQueryImpl(CommandContext commandContext) { super(commandContext); } public IdentityLinkQueryImpl(CommandExecutor commandExecutor) { super(commandExecutor); } public IdentityLinkQuery id(String id) { this.id=id; return this; } public IdentityLinkQuery taskId(String taskId) { this.taskId=taskId; return this; } public IdentityLinkQuery userId(String userId) { this.userId=userId; return this; } public IdentityLinkQuery groupId(String groupId) { this.groupId=groupId; return this; } public IdentityLinkQuery groupType(String groupType) { this.groupType=groupType; return this; } //containAndExclude public IdentityLinkQuery includeExclusion(IncludeExclusion includeExclusion) { this.includeExclusion=includeExclusion; return this; } public IdentityLinkQuery type(IdentityLinkType type) { this.type=type; return this; } public IdentityLinkQuery his() { if(this.queryLocation != null){ this.queryLocation = QueryLocation.RUN_HIS; }else{ this.queryLocation = QueryLocation.HIS; } return this; } public IdentityLinkQuery run() { if(this.queryLocation != null){ this.queryLocation = QueryLocation.RUN_HIS; }else{ this.queryLocation = QueryLocation.RUN; } return this; } public long executeCount(CommandContext commandContext) { checkQueryOk(); // ensureVariablesInitialized(); return commandContext.getIdentityLinkManager().findIdentityLinkCountByQueryCriteria(this); } @SuppressWarnings({ "unchecked", "rawtypes" }) public List<IdentityLink> executeList(CommandContext commandContext, Page page) { checkQueryOk(); // ensureVariablesInitialized(); return (List)commandContext.getIdentityLinkManager().findIdentityLinkByQueryCriteria(this, page); } public String getId() { return id; } public IdentityLinkType getType() { return type; } public String getUserId() { return userId; } public String getGroupId() { return groupId; } public String getGroupType() { return groupType; } public IncludeExclusion getIncludeExclusion() { return includeExclusion; } public String getTaskId() { return taskId; } public QueryLocation getQueryLocation() { return queryLocation; } }
[ "80405879+maurielloelollo@users.noreply.github.com" ]
80405879+maurielloelollo@users.noreply.github.com
7045b06ae9b85b68200a334cedbc3fad7fd1f405
c7080f170e9a61b4a3052a54120d2c5ef3878acf
/domi-common/src/main/java/com/domi/common/utils/JsonUtils.java
b09ed066568fd581c935b595437a341f2e5d7fce
[]
no_license
kakajing/domi2.0
8f5757d9e784c982c3f21ed3287447cf2f541b76
10b6c253220a6dfdd5b4bee74180db9f5976dcab
refs/heads/master
2021-01-04T02:41:40.303848
2017-02-17T16:23:07
2017-02-17T16:23:07
76,050,418
0
0
null
null
null
null
UTF-8
Java
false
false
1,695
java
package com.domi.common.utils; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.List; /** * ๅ˜Ÿ็ฑณๅ•†ๅŸŽ่‡ชๅฎšไน‰ๅ“ๅบ”็ป“ๆž„ */ public class JsonUtils { // ๅฎšไน‰jacksonๅฏน่ฑก private static final ObjectMapper MAPPER = new ObjectMapper(); /** * ๅฐ†ๅฏน่ฑก่ฝฌๆขๆˆjsonๅญ—็ฌฆไธฒใ€‚ * <p>Title: pojoToJson</p> * <p>Description: </p> * @param data * @return */ public static String objectToJson(Object data) { try { String string = MAPPER.writeValueAsString(data); return string; } catch (JsonProcessingException e) { e.printStackTrace(); } return null; } /** * ๅฐ†json็ป“ๆžœ้›†่ฝฌๅŒ–ไธบๅฏน่ฑก * * @param jsonData jsonๆ•ฐๆฎ * @param * @return */ public static <T> T jsonToPojo(String jsonData, Class<T> beanType) { try { T t = MAPPER.readValue(jsonData, beanType); return t; } catch (Exception e) { e.printStackTrace(); } return null; } /** * ๅฐ†jsonๆ•ฐๆฎ่ฝฌๆขๆˆpojoๅฏน่ฑกlist * <p>Title: jsonToList</p> * <p>Description: </p> * @param jsonData * @param beanType * @return */ public static <T>List<T> jsonToList(String jsonData, Class<T> beanType) { JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType); try { List<T> list = MAPPER.readValue(jsonData, javaType); return list; } catch (Exception e) { e.printStackTrace(); } return null; } }
[ "985812572@qq.com" ]
985812572@qq.com
1cdfb3e17412b0dff7cf26415467cac59ffa1012
f08296fd4f0ab0d51a670c0fa26ead486d2cf4d9
/app/src/test/java/br/com/pedrohsantos/pokemonbattle/ExampleUnitTest.java
2a77469ac89fa3c56e0770a4e74e61495b84e62a
[]
no_license
phsantosti/PokemonBattles
4c97c50dad0933791141ef9f58ecb33f7ad61dea
704650e68b3288486e743f4e3c7586fe17fdb2e2
refs/heads/master
2020-11-25T12:30:23.411559
2019-12-17T16:54:11
2019-12-17T16:54:11
228,661,909
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package br.com.pedrohsantos.pokemonbattle; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "phsantosti@gmail.com" ]
phsantosti@gmail.com
5eb7dd969ade1426600be7cf899941195cd13e0c
e7e497b20442a4220296dea1550091a457df5a38
/java_workplace/renren_web_framework/commons/xiaonei-core/trunk/src/main/java/com/xiaonei/platform/core/utility/photo/gif/AnimatedGifEncoder.java
31d680054493c1115e89dbb3f17129935076a338
[]
no_license
gunner14/old_rr_code
cf17a2dedf8dfcdcf441d49139adaadc770c0eea
bb047dc88fa7243ded61d840af0f8bad22d68dee
refs/heads/master
2021-01-17T18:23:28.154228
2013-12-02T23:45:33
2013-12-02T23:45:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,665
java
package com.xiaonei.platform.core.utility.photo.gif; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.awt.image.DataBufferByte; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; /** * Class AnimatedGifEncoder - Encodes a GIF file consisting of one or * more frames. * <pre> * Example: * AnimatedGifEncoder e = new AnimatedGifEncoder(); * e.start(outputFileName); * e.setDelay(1000); // 1 frame per sec * e.addFrame(image1); * e.addFrame(image2); * e.finish(); * </pre> * No copyright asserted on the source code of this class. May be used * for any purpose, however, refer to the Unisys LZW patent for restrictions * on use of the associated LZWEncoder class. Please forward any corrections * to kweiner@fmsware.com. * * @author Kevin Weiner, FM Software * @version 1.03 November 2003 * */ public class AnimatedGifEncoder { protected int width; // image size protected int height; protected Color transparent = null; // transparent color if given protected int transIndex; // transparent index in color table protected int repeat = -1; // no repeat protected int delay = 0; // frame delay (hundredths) protected boolean started = false; // ready to output frames protected OutputStream out; protected BufferedImage image; // current frame protected byte[] pixels; // BGR byte array from frame protected byte[] indexedPixels; // converted frame indexed to palette protected int colorDepth; // number of bit planes protected byte[] colorTab; // RGB palette protected boolean[] usedEntry = new boolean[256]; // active palette entries protected int palSize = 7; // color table size (bits-1) protected int dispose = -1; // disposal code (-1 = use default) protected boolean closeStream = false; // close stream when finished protected boolean firstFrame = true; protected boolean sizeSet = false; // if false, get size from first frame protected int sample = 10; // default sample interval for quantizer protected byte[] comment; /** * comment * @param comment */ public void setComment(byte[] comment) { this.comment = comment; } /** * Sets the delay time between each frame, or changes it * for subsequent frames (applies to last frame added). * * @param ms int delay time in milliseconds */ public void setDelay(int ms) { delay = Math.round(ms / 10.0f); } /** * Sets the GIF frame disposal code for the last added frame * and any subsequent frames. Default is 0 if no transparent * color has been set, otherwise 2. * @param code int disposal code. */ public void setDispose(int code) { if (code >= 0) { dispose = code; } } /** * Sets the number of times the set of GIF frames * should be played. Default is 1; 0 means play * indefinitely. Must be invoked before the first * image is added. * * @param iter int number of iterations. * @return */ public void setRepeat(int iter) { if (iter >= 0) { repeat = iter; } } /** * Sets the transparent color for the last added frame * and any subsequent frames. * Since all colors are subject to modification * in the quantization process, the color in the final * palette for each frame closest to the given color * becomes the transparent color for that frame. * May be set to null to indicate no transparent color. * * @param c Color to be treated as transparent on display. */ public void setTransparent(Color c) { transparent = c; } /** * Adds next GIF frame. The frame is not written immediately, but is * actually deferred until the next frame is received so that timing * data can be inserted. Invoking <code>finish()</code> flushes all * frames. If <code>setSize</code> was not invoked, the size of the * first image is used for all subsequent frames. * * @param im BufferedImage containing frame to write. * @return true if successful. */ public boolean addFrame(BufferedImage im) { if ((im == null) || !started) { return false; } boolean ok = true; try { if (!sizeSet) { // use first frame's size setSize(im.getWidth(), im.getHeight()); } image = im; getImagePixels(); // convert to correct format if necessary analyzePixels(); // build color table & map pixels if (firstFrame) { writeLSD(); // logical screen descriptior writePalette(); // global color table if (repeat >= 0) { // use NS app extension to indicate reps writeNetscapeExt(); } } writeGraphicCtrlExt(); // write graphic control extension writeImageDesc(); // image descriptor if (!firstFrame) { writePalette(); // local color table } writePixels(); // encode and write pixel data firstFrame = false; } catch (IOException e) { ok = false; } return ok; } /** * Flushes any pending data and closes output file. * If writing to an OutputStream, the stream is not * closed. */ public boolean finish() { if (!started) return false; boolean ok = true; started = false; try { // comment if (comment != null && comment.length > 0) { out.write(0x21); out.write(0xfe); if (comment.length > 255) { out.write(255); for (int i = 0; i < 255; i++) { out.write(comment[i]); } } else { out.write(comment.length); out.write(comment); } out.write(0x00); } // end out.write(0x3b); // gif trailer out.flush(); if (closeStream) { out.close(); } } catch (IOException e) { ok = false; } // reset for subsequent use transIndex = 0; out = null; image = null; pixels = null; indexedPixels = null; colorTab = null; closeStream = false; firstFrame = true; return ok; } /** * Sets frame rate in frames per second. Equivalent to * <code>setDelay(1000/fps)</code>. * * @param fps float frame rate (frames per second) */ public void setFrameRate(float fps) { if (fps != 0f) { delay = Math.round(100f / fps); } } /** * Sets quality of color quantization (conversion of images * to the maximum 256 colors allowed by the GIF specification). * Lower values (minimum = 1) produce better colors, but slow * processing significantly. 10 is the default, and produces * good color mapping at reasonable speeds. Values greater * than 20 do not yield significant improvements in speed. * * @param quality int greater than 0. * @return */ public void setQuality(int quality) { if (quality < 1) quality = 1; sample = quality; } /** * Sets the GIF frame size. The default size is the * size of the first frame added if this method is * not invoked. * * @param w int frame width. * @param h int frame width. */ public void setSize(int w, int h) { if (started && !firstFrame) return; width = w; height = h; if (width < 1) width = 320; if (height < 1) height = 240; sizeSet = true; } /** * Initiates GIF file creation on the given stream. The stream * is not closed automatically. * * @param os OutputStream on which GIF images are written. * @return false if initial write failed. */ public boolean start(OutputStream os) { if (os == null) return false; boolean ok = true; closeStream = false; out = os; try { writeString("GIF89a"); // header } catch (IOException e) { ok = false; } return started = ok; } /** * Initiates writing of a GIF file with the specified name. * * @param file String containing output file name. * @return false if open or initial write failed. */ public boolean start(String file) { boolean ok = true; try { out = new BufferedOutputStream(new FileOutputStream(file)); ok = start(out); closeStream = true; } catch (IOException e) { ok = false; } return started = ok; } /** * Analyzes image colors and creates color map. */ protected void analyzePixels() { int len = pixels.length; int nPix = len / 3; indexedPixels = new byte[nPix]; NeuQuant nq = new NeuQuant(pixels, len, sample); // initialize quantizer colorTab = nq.process(); // create reduced palette // convert map from BGR to RGB for (int i = 0; i < colorTab.length; i += 3) { byte temp = colorTab[i]; colorTab[i] = colorTab[i + 2]; colorTab[i + 2] = temp; usedEntry[i / 3] = false; } // map image pixels to new palette int k = 0; for (int i = 0; i < nPix; i++) { int index = nq.map(pixels[k++] & 0xff, pixels[k++] & 0xff, pixels[k++] & 0xff); usedEntry[index] = true; indexedPixels[i] = (byte) index; } pixels = null; colorDepth = 8; palSize = 7; // get closest match to transparent color if specified if (transparent != null) { transIndex = findClosest(transparent); } } /** * Returns index of palette color closest to c * */ protected int findClosest(Color c) { if (colorTab == null) return -1; int r = c.getRed(); int g = c.getGreen(); int b = c.getBlue(); int minpos = 0; int dmin = 256 * 256 * 256; int len = colorTab.length; for (int i = 0; i < len;) { int dr = r - (colorTab[i++] & 0xff); int dg = g - (colorTab[i++] & 0xff); int db = b - (colorTab[i] & 0xff); int d = dr * dr + dg * dg + db * db; int index = i / 3; if (usedEntry[index] && (d < dmin)) { dmin = d; minpos = index; } i++; } return minpos; } /** * Extracts image pixels into byte array "pixels" */ protected void getImagePixels() { int w = image.getWidth(); int h = image.getHeight(); int type = image.getType(); if ((w != width) || (h != height) || (type != BufferedImage.TYPE_3BYTE_BGR)) { // create new image with right size/format BufferedImage temp = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); Graphics2D g = temp.createGraphics(); g.drawImage(image, 0, 0, null); image = temp; } pixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData(); } /** * Writes Graphic Control Extension */ protected void writeGraphicCtrlExt() throws IOException { out.write(0x21); // extension introducer out.write(0xf9); // GCE label out.write(4); // data block size int transp, disp; if (transparent == null) { transp = 0; disp = 0; // dispose = no action } else { transp = 1; disp = 2; // force clear if using transparent color } if (dispose >= 0) { disp = dispose & 7; // user override } disp <<= 2; // packed fields out.write(0 | // 1:3 reserved disp | // 4:6 disposal 0 | // 7 user input - 0 = none transp); // 8 transparency flag writeShort(delay); // delay x 1/100 sec out.write(transIndex); // transparent color index out.write(0); // block terminator } /** * Writes Image Descriptor */ protected void writeImageDesc() throws IOException { out.write(0x2c); // image separator writeShort(0); // image position x,y = 0,0 writeShort(0); writeShort(width); // image size writeShort(height); // packed fields if (firstFrame) { // no LCT - GCT is used for first (or only) frame out.write(0); } else { // specify normal LCT out.write(0x80 | // 1 local color table 1=yes 0 | // 2 interlace - 0=no 0 | // 3 sorted - 0=no 0 | // 4-5 reserved palSize); // 6-8 size of color table } } /** * Writes Logical Screen Descriptor */ protected void writeLSD() throws IOException { // logical screen size writeShort(width); writeShort(height); // packed fields out.write((0x80 | // 1 : global color table flag = 1 (gct used) 0x70 | // 2-4 : color resolution = 7 0x00 | // 5 : gct sort flag = 0 palSize)); // 6-8 : gct size out.write(0); // background color index out.write(0); // pixel aspect ratio - assume 1:1 } /** * Writes Netscape application extension to define * repeat count. */ protected void writeNetscapeExt() throws IOException { out.write(0x21); // extension introducer out.write(0xff); // app extension label out.write(11); // block size writeString("NETSCAPE" + "2.0"); // app id + auth code out.write(3); // sub-block size out.write(1); // loop sub-block id writeShort(repeat); // loop count (extra iterations, 0=repeat forever) out.write(0); // block terminator } /** * Writes color table */ protected void writePalette() throws IOException { out.write(colorTab, 0, colorTab.length); int n = (3 * 256) - colorTab.length; for (int i = 0; i < n; i++) { out.write(0); } } /** * Encodes and writes pixel data */ protected void writePixels() throws IOException { LZWEncoder encoder = new LZWEncoder(width, height, indexedPixels, colorDepth); encoder.encode(out); } /** * Write 16-bit value to output stream, LSB first */ protected void writeShort(int value) throws IOException { out.write(value & 0xff); out.write((value >> 8) & 0xff); } /** * Writes string to output stream */ protected void writeString(String s) throws IOException { for (int i = 0; i < s.length(); i++) { out.write((byte) s.charAt(i)); } } }
[ "liyong19861014@gmail.com" ]
liyong19861014@gmail.com
7f2d84d7a700ab21202263a8a83087d380be4a38
311018a637bd1db50e3e6f15ef3ca254b6bb3ccc
/wearable/src/main/java/com/example/android/sunshine/wearable/Constants.java
8483b4b9ec0b9f62b3d2645b881acd91b9e0412f
[ "Apache-2.0" ]
permissive
fabiocasado/GoUbiquitous
be4afa9994b1e6dc3bd72a434b643d38c7542e1d
c2d990197adab780a539e5cca58049e83d23cbe3
refs/heads/master
2021-01-01T05:09:51.098199
2016-05-10T12:55:25
2016-05-10T12:55:25
57,136,600
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package com.example.android.sunshine.wearable; /** * Created by fcasado on 5/10/16. */ public class Constants { public static final String WEATHER_PREF = "weather"; public static final String PREF_KEY_WEATHER_ID = "weatherID"; public static final String PREF_KEY_MIN_TEMP = "minTemp"; public static final String PREF_KEY_MAX_TEMP = "maxTemp"; }
[ "fabio.casado@booking.com" ]
fabio.casado@booking.com
dfc22b5efe58cd8dbe748c2fd44142ae27e3755f
3ecd55638413a4baa4c60f59476a32ad042e0ee3
/userManagement/src/com/github/exahexa/user/UserNullReferenceException.java
d711fd991b4edcab1fa76a5adadac0f49a27cacd
[]
no_license
ExaHexa/fh-oos
65f23b49c11701ba200196b18d149b144da65703
20befddce14a49edd44d080ac3175599734e0506
refs/heads/master
2021-09-03T10:47:52.290864
2018-01-08T12:27:26
2018-01-08T12:27:26
108,765,269
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
/** * */ package com.github.exahexa.user; /** * @author exahexa * @verion 1.0 */ public class UserNullReferenceException extends RuntimeException { /** * */ private static final long serialVersionUID = 4510715743111829923L; /** * Constructs a new exception with null as its message */ public UserNullReferenceException() { super(); } /** * Constructs a new exception with the specified message s * @param s the specified message */ public UserNullReferenceException(String s) { super(s); } }
[ "block.lukas@gmx.de" ]
block.lukas@gmx.de
aa2a4e7c0ac85407af1ac84a3df0377e9caab1c7
0b260cfc4feff284874edc8c0767982a5ec1d3dc
/DepthFirstSearch/298_BinaryTreeLongestConsecutiveSequence.java
8a5c368bb5fe41feb635a68b8cdc7637ac251678
[]
no_license
Xu-Guo/GQQLeetCode
9b3bac2ed76c8204e24674ff0e1b4c335ef14ea3
174277225dffa23b2bb712d2bd41bf6d77abc04e
refs/heads/master
2021-01-19T15:25:30.876905
2017-04-10T23:08:36
2017-04-10T23:08:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,314
java
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public int longestConsecutive(TreeNode root) { if (root == null) return 0; LinkedList<TreeNode> queue = new LinkedList<>(); queue.offer(root); Map<TreeNode, Integer> cache = new HashMap<>(); int longest = 1; while (!queue.isEmpty()) { LinkedList<TreeNode> node = queue.poll(); longest = Math.max(longest, getLength(node, cache)); if (node.left != null) queue.offer(node.left); if (node.right != null) queue.offer(node.right); } return longest; } public int getLength(TreeNode node, Map<TreeNode, Integer> cache) { if (node == null) return 0; if (cache.containsKey(node)) return cache.get(node); int maxDeep = 1; if (node.left != null && node.left.val == node.val + 1) { maxDeep = Math.max(maxDeep, getLength(node.left) + 1); } if (node.right != null && node.right.val == node.val + 1) { maxDeep = Math.max(maxDeep, getLength(node.right) + 1); } cache.put(node, maxDeep); return maxDeep; } }
[ "qiqiang.guan@outlook.com" ]
qiqiang.guan@outlook.com
b157316461897996850806b4b80d56e3c30d4d42
2faa2598943a3ad9e8a75681889136c511ccf42e
/src/Day15_Scanner_StringClass/Task01.java
498f6a978ddad2f0014eebd0bddeb0a074b35d3b
[]
no_license
CoderforTest/Summer2019_Java
de927ee50f666f8cdfc604251b74a273b4cbf37a
74b9884116b1d48ef6e01dfe2ba785307731c3e8
refs/heads/master
2020-07-22T11:40:08.183224
2019-10-28T03:41:50
2019-10-28T03:41:50
207,188,737
0
0
null
null
null
null
UTF-8
Java
false
false
490
java
package Day15_Scanner_StringClass; import java.util.Scanner; public class Task01 { public static void main(String[] args) { // TODO Auto-generated method stub /* * write a program that can calculate sum of two numbers. */ Scanner scan = new Scanner(System.in); System.out.println("Enter first value: "); int a = scan.nextInt(); System.out.println("Enter second value: "); int b = scan.nextInt(); System.out.println("Sum of two numbers is: " + (a+b)); } }
[ "cyclist582@gmail.com" ]
cyclist582@gmail.com
5ba1c5ceb87f28cc217c26bff3a350cd1fa201ed
b41900599b5d2a54fae9664af240e8d98be51ce8
/src/array/MaximumPointsObtainFromCards.java
fdecee1bf0f8ddb82e21447301fc48ef014e0e4b
[]
no_license
sarthak7g/Java-Programming
8cc07872cfb8729b7ae47adfefdd8659b9170d17
0dd60675b0b0ebee192eac4297db4ac2a9055376
refs/heads/master
2023-04-06T03:37:51.052629
2023-03-20T18:25:19
2023-03-20T18:25:19
151,115,749
0
0
null
null
null
null
UTF-8
Java
false
false
1,312
java
package array; /** * <h3>Level: Medium </h3> * <body> * refer to: <a href="https://leetcode.com/problems/maximum-points-you-can-obtain-from-cards/">Maximum Points You Can Obtain from Cards</a> * <br/> * <br/> * <b>Approach:</b> * <ul> * <li>Find forward and backward sum.</li> * <li>For each x in [0, k], find left sum i.e., sum in [0, x] and right sum i.e., sum in [n-(k-x),...n] and update the answer accordingly.</li> * <li>Time complexity: O(n)</li> * <li>Space complexity: O(n)</li> * </ul> */ public class MaximumPointsObtainFromCards { public static void main(String[] args) { System.out.println(maxScore(new int[]{1,4,3,2,3,4,5,1,6}, 3)); System.out.println(maxScore(new int[]{4,3,2,3,4,5,1,6}, 3)); System.out.println(maxScore(new int[]{1,4,3,2,3,4,5,1,6}, 8)); } public static int maxScore(int[] arr, int k) { int[] back = new int[arr.length]; int sum=0, temp, ans=0; for(int i=arr.length-1; i>=0; i--) { sum += arr[i]; back[i] = sum; } sum=0; for(int i=0; i<k; i++) { temp = k-i; ans = Math.max(ans, sum + back[arr.length-temp]); sum += arr[i]; } ans = Math.max(ans, sum); return ans; } }
[ "gishu80@gmail.com" ]
gishu80@gmail.com
403d82f5d9a5a06b95c32944bfde02d8a7b37650
e448bef423c920fc165281288ae3d431b1cb186c
/ttk-fx-application-layer/ttk-fx-application/src/main/java/org/ihtsdo/ttk/fx/app/IsaacApp.java
310ef630be62b88437644516deb9e2a0ac994905
[]
no_license
jefron-ap/TTK
98ee994a1557be2768bd11f2d4225f20310a9566
9b6858752dec575b88e128b3bbf3e6e7753574b6
refs/heads/master
2021-01-02T09:02:03.705356
2013-11-25T22:06:05
2013-11-25T22:06:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,093
java
/* * Copyright 2013 VA Office of Informatics and Analytics. * * 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.ihtsdo.ttk.fx.app; //~--- non-JDK imports -------------------------------------------------------- import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.layout.Pane; import javafx.stage.Stage; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.config.IniSecurityManagerFactory; import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.session.Session; import org.apache.shiro.subject.Subject; import org.apache.shiro.util.Factory; import org.ihtsdo.otf.tcc.lookup.Looker; import org.ihtsdo.otf.tcc.lookup.TtkEnvironment; import org.ihtsdo.ttk.services.aa.SessionAttributeKeys; //~--- JDK imports ------------------------------------------------------------ import java.io.IOException; import org.ihtsdo.otf.tcc.api.metadata.binding.Snomed; import org.ihtsdo.otf.tcc.api.metadata.binding.TermAux; import org.ihtsdo.ttk.services.aa.SessionAttributes; import org.ihtsdo.ttk.services.action.ActionService; /** * * @author kec */ public class IsaacApp extends Application { /** * Method description * * * @param primaryStage * * @throws IOException */ private void setupStage(Stage primaryStage) throws IOException { Pane isaacPane = (Pane) FXMLLoader.load(getClass().getResource("/fxml/Isaac.fxml")); // ScenicView.show(isaacPane); primaryStage.setScene(new Scene(isaacPane)); } /** * Method description * * * @param args */ public static void main(String[] args) { Factory<SecurityManager> factory = new IniSecurityManagerFactory("classpath:shiro.ini"); SecurityUtils.setSecurityManager(factory.getInstance()); Subject currentUser = SecurityUtils.getSubject(); Session session = currentUser.getSession(); if (!currentUser.isAuthenticated()) { // collect user principals and credentials in a gui specific manner // such as username/password html form, X509 certificate, OpenID, etc. // We'll use the username/password example here since it is the most common. UsernamePasswordToken token = new UsernamePasswordToken("root", "secret"); // this is all you have to do to support 'remember me' (no config - built in!): token.setRememberMe(true); currentUser.login(token); } if (currentUser.isAuthenticated()) { // TODO somehow associate the user UUID with the subject SessionAttributes.get().put(SessionAttributeKeys.USER_UUID_ARRAY, TermAux.USER.getUuids()); SessionAttributes.get().put(SessionAttributeKeys.EDIT_MODULE_UUID_ARRAY, Snomed.CORE_MODULE.getUuids()); } else { System.out.println("User is not authenticated"); System.exit(0); } launch(args); } @Override public void init() throws Exception { ActionService.start(); Looker.lookup(TtkEnvironment.class).setUseFxWorkers(true); } /** * Method description * * * @param primaryStage * * @throws Exception */ @Override public void start(Stage primaryStage) throws Exception { setupStage(primaryStage); primaryStage.show(); } /** * Method description * * * @throws Exception */ @Override public void stop() throws Exception { System.exit(0); } }
[ "jefron@apelon.com" ]
jefron@apelon.com
b45c60f60c16b9281c6ed90c19fcb3d5ae0c1277
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/31/31_2c102a323fa8e90e4cbde51bfbd300e0f7fdbc23/C3_UI/31_2c102a323fa8e90e4cbde51bfbd300e0f7fdbc23_C3_UI_t.java
cbb2a16f12c6aeb1ecb820889b4e67e11ff5a680
[]
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
79,548
java
import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.StringWriter; //import java.util.Iterator; //import java.util.Set; import javax.swing.JFileChooser; //import javax.swing.JList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.semanticweb.HermiT.Reasoner; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.model.IRI; import org.semanticweb.owlapi.model.OWLClass; import org.semanticweb.owlapi.model.OWLDataFactory; import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.OWLOntologyCreationException; import org.semanticweb.owlapi.model.OWLOntologyManager; import org.semanticweb.owlapi.reasoner.NodeSet; import org.semanticweb.owlapi.reasoner.OWLReasoner; import org.semanticweb.owlapi.reasoner.OWLReasonerConfiguration; import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; import org.semanticweb.owlapi.reasoner.SimpleConfiguration; import org.semanticweb.owlapi.util.DefaultPrefixManager; import org.w3c.dom.*; import com.amazonaws.AmazonServiceException; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.PropertiesCredentials; import com.amazonaws.services.ec2.AmazonEC2; import com.amazonaws.services.ec2.AmazonEC2Client; import com.amazonaws.services.ec2.model.DescribeAvailabilityZonesResult; import com.amazonaws.services.ec2.model.DescribeInstancesResult; import com.amazonaws.services.ec2.model.Instance; import com.amazonaws.services.ec2.model.Reservation; import java.util.HashSet; import java.util.List; import java.util.Set; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * C3_UI.java * * Created on Apr 4, 2011, 11:06:31 PM */ /** * * @author Sam */ public class C3_UI extends javax.swing.JFrame { /** Creates new form C3_UI */ public C3_UI() { try { testAmazon(); } catch (Exception e) { System.out.println("Couldn't start Amazon AWS services, Issue is probably Security Credentials"); System.out.println("Exception "+e.getClass().toString()+": " + e.getMessage()); } System.out.println("Done testing Amazon"); System.out.println("Setting up OWL ontology & Reasoner"); setupOWL(); System.out.println("Done setting up OWL ontology & Reasoner"); System.out.println("Starting up GUI..."); initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel14 = new javax.swing.JLabel(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel6 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); compsetList = new javax.swing.JList(); jPanel4 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); jList2 = new javax.swing.JList(); jScrollPane4 = new javax.swing.JScrollPane(); jList4 = new javax.swing.JList(); jScrollPane5 = new javax.swing.JScrollPane(); compsetTypeList = new javax.swing.JList(); jLabel24 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jLabel25 = new javax.swing.JLabel(); jComboBox2 = new javax.swing.JComboBox(); jLabel26 = new javax.swing.JLabel(); jLabel27 = new javax.swing.JLabel(); jComboBox3 = new javax.swing.JComboBox(); jComboBox4 = new javax.swing.JComboBox(); jPanel9 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel11 = new javax.swing.JPanel(); jScrollPane8 = new javax.swing.JScrollPane(); jList8 = new javax.swing.JList(); jLabel12 = new javax.swing.JLabel(); jLabel19 = new javax.swing.JLabel(); jScrollPane10 = new javax.swing.JScrollPane(); jList9 = new javax.swing.JList(); jPanel12 = new javax.swing.JPanel(); jScrollPane11 = new javax.swing.JScrollPane(); jList10 = new javax.swing.JList(); jLabel20 = new javax.swing.JLabel(); jLabel21 = new javax.swing.JLabel(); jScrollPane12 = new javax.swing.JScrollPane(); jList11 = new javax.swing.JList(); jPanel13 = new javax.swing.JPanel(); jScrollPane13 = new javax.swing.JScrollPane(); jList12 = new javax.swing.JList(); jLabel22 = new javax.swing.JLabel(); jLabel23 = new javax.swing.JLabel(); jScrollPane14 = new javax.swing.JScrollPane(); jList13 = new javax.swing.JList(); jPanel15 = new javax.swing.JPanel(); jScrollPane17 = new javax.swing.JScrollPane(); jList16 = new javax.swing.JList(); jLabel30 = new javax.swing.JLabel(); jLabel31 = new javax.swing.JLabel(); jScrollPane18 = new javax.swing.JScrollPane(); jList17 = new javax.swing.JList(); jLabel3 = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); gridList = new javax.swing.JList(); jButton13 = new javax.swing.JButton(); jPanel7 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jTextField4 = new javax.swing.JTextField(); jButton5 = new javax.swing.JButton(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); jButton10 = new javax.swing.JButton(); jLabel13 = new javax.swing.JLabel(); startInstanceButton = new javax.swing.JButton(); jButton11 = new javax.swing.JButton(); jScrollPane9 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jLabel15 = new javax.swing.JLabel(); jPanel8 = new javax.swing.JPanel(); jLabel16 = new javax.swing.JLabel(); compsetField = new javax.swing.JTextField(); jLabel17 = new javax.swing.JLabel(); gridField = new javax.swing.JTextField(); jLabel18 = new javax.swing.JLabel(); casenameField = new javax.swing.JTextField(); jButton12 = new javax.swing.JButton(); saveConfigButton = new javax.swing.JButton(); ExitButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Cloud Climate Configurator v2"); setForeground(java.awt.Color.white); setName("C3_mainframe"); // NOI18N jLabel14.setText("To Create a new Configuration, choose an available Component Set and Grid (narrow down with Specific Features), then go to the Cloud tab"); jButton1.setText("Save Current Configuration to XML"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Load Previous Configuration XML"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jLabel1.setText("Available Compsets"); compsetList.setModel(new javax.swing.AbstractListModel() { String[] strings = getOWLCompset("NamedCompSets");//{ "Not Selected", "A_PRESENT_DAY", "A_GLC", "B_2000", "B_2000_CN", "B_1850_CAM5", "B_1850", "B_1850_CN", "B_2000_CN_CHEM", "B_1850_CN_CHEM", "B_1850_RAMPCO2_CN", "B_18502000", "B_18502000_CN", "B_18502000_CN_CHEM", "B_18502000_CAM5", "B_2000_GLC", "B_2000_TROP_MOZART", "B_1850_WACCM", "B_1850_WACCM_CN", "B_18502000_WACCM_CN", "B_1850_BGCBPRP", "B_1850_BGCBDRD", "B_18502000_BGCBPRP", "B_18502000_BGCBDRD", "C_NORMAL_YEAR_ECOSYS", "C_NORMAL_YEAR", "D_NORMAL_YEAR", "E_2000", "E_2000_GLC", "E_1850_CN", "E_1850_CAM5", "F_AMIP_CN", "F_AMIP_CAM5", "F_1850", "F_1850_CAM5", "F_2000", "F_2000_CAM5", "F_2000_CN", "F_18502000_CN", "F_2000_GLC", "F_1850_CN_CHEM", "F_1850_WACCM", "F_1850_WACCM", "F_2000_WACCM", "G_1850_ECOSYS", "G_NORMAL_YEAR", "H_PRESENT_DAY", "I_2000", "I_1850", "I_2000_GLC", "I_19482004", "I_18502000", "I_2000_CN", "I_1850_CN", "I_19482004_CN", "I_18502000_CN", "S_PRESENT_DAY", "X_PRESENT_DAY", "XG_PRESENT_DAY" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); compsetList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { compsetListValueChanged(evt); } }); jScrollPane1.setViewportView(compsetList); jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Specific Features")); jLabel2.setText("Type"); jLabel9.setText("Date"); jLabel10.setText("Extras"); jList2.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "LC", "CN", "CHEM", "RAMPCO2", "WACCM" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane2.setViewportView(jList2); jList4.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "1850", "2000", "PRESENT_DAY" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane4.setViewportView(jList4); compsetTypeList.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "A - All DATA components with stub glc (used primarily for testing)", "B - FULLY ACTIVE components with stub glc", "C - POP active with data atm, lnd(runoff), and ice plus stub glc", "D - CICE active with data atm and ocean plus stub land and glc", "E - CAM, CLM, and CICE active with data ocean (som mode) plus stub glc", "F - CAM, CLM, and CICE(prescribed mode) active with data ocean (sstdata mode) plus stub glc", "G - POP and CICE active with data atm and lnd(runoff) plus stub glc", "H - POP and CICE active with data atm and stub land and glc", "I - CLM active with data atm and stub ice, ocean, and glc", "S - All STUB components (used for testing only)", "X - All DEAD components except for stub glc (used for testing only)" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); compsetTypeList.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { compsetTypeListMouseClicked(evt); } }); compsetTypeList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { compsetTypeListValueChanged(evt); } }); compsetTypeList.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { compsetTypeListPropertyChange(evt); } }); jScrollPane5.setViewportView(compsetTypeList); jLabel24.setText("Atmosphere"); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Alive", "Data", "Stub", "Dead" })); jLabel25.setText("Land"); jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Alive", "Data", "Stub", "Dead" })); jLabel26.setText("Ocean"); jLabel27.setText("Ice"); jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Alive", "Data", "Stub", "Dead" })); jComboBox4.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Alive", "Data", "Stub", "Dead" })); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2))) .addGroup(jPanel4Layout.createSequentialGroup() .addGap(95, 95, 95) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel24) .addComponent(jLabel25) .addComponent(jLabel26) .addComponent(jLabel27)) .addGap(19, 19, 19) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(18, 18, 18) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel9) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel10) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE) .addComponent(jScrollPane4))) .addGap(46, 46, 46)) ); jPanel4Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jComboBox1, jComboBox2, jComboBox3, jComboBox4}); jPanel4Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel24, jLabel25, jLabel26, jLabel27}); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jLabel9)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(11, 11, 11) .addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel24)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(30, Short.MAX_VALUE)) ); jPanel4Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jComboBox1, jComboBox2, jComboBox3, jComboBox4, jLabel24, jLabel25, jLabel26, jLabel27}); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 560, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1)) .addGap(18, 18, 18) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton2)) .addContainerGap(24, Short.MAX_VALUE)) ); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel6Layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1)) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 415, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2)) .addContainerGap()) ); jTabbedPane1.addTab("Components", jPanel6); jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Specific Features")); jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("Atmosphere")); jList8.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "pt1", "0.23x0.31", "0.47x0.63", "0.9x1.25", "1.9x2.5", "96x192", "48x96", "64x128", "10x15", "ne30np4", "128x256" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane8.setViewportView(jList8); jLabel12.setText("Resolution"); jLabel19.setText("Type"); jList9.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "Finite Volume", "Displaced Pole", "Point", "Spectral", "Triple Pole" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane10.setViewportView(jList9); javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11); jPanel11.setLayout(jPanel11Layout); jPanel11Layout.setHorizontalGroup( jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel11Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel19)) .addGap(18, 18, 18) .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel11Layout.setVerticalGroup( jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel11Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel11Layout.createSequentialGroup() .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel11Layout.createSequentialGroup() .addComponent(jLabel19) .addGap(8, 8, 8) .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))) ); jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder("Atmosphere")); jList10.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "pt1", "0.23x0.31", "0.47x0.63", "0.9x1.25", "1.9x2.5", "96x192", "48x96", "64x128", "10x15", "ne30np4", "128x256" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane11.setViewportView(jList10); jLabel20.setText("Resolution"); jLabel21.setText("Type"); jList11.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "Finite Volume", "Displaced Pole", "Point", "Spectral", "Triple Pole" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane12.setViewportView(jList11); javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12); jPanel12.setLayout(jPanel12Layout); jPanel12Layout.setHorizontalGroup( jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel21)) .addGap(18, 18, 18) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel20)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel12Layout.setVerticalGroup( jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel12Layout.createSequentialGroup() .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel12Layout.createSequentialGroup() .addComponent(jLabel21) .addGap(8, 8, 8) .addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))) ); jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder("Atmosphere")); jList12.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "pt1", "0.23x0.31", "0.47x0.63", "0.9x1.25", "1.9x2.5", "96x192", "48x96", "64x128", "10x15", "ne30np4", "128x256" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane13.setViewportView(jList12); jLabel22.setText("Resolution"); jLabel23.setText("Type"); jList13.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "Finite Volume", "Displaced Pole", "Point", "Spectral", "Triple Pole" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane14.setViewportView(jList13); javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13); jPanel13.setLayout(jPanel13Layout); jPanel13Layout.setHorizontalGroup( jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel23)) .addGap(18, 18, 18) .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel22)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel13Layout.setVerticalGroup( jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel13Layout.createSequentialGroup() .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel13Layout.createSequentialGroup() .addComponent(jLabel23) .addGap(8, 8, 8) .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))) ); jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder("Atmosphere")); jList16.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "pt1", "0.23x0.31", "0.47x0.63", "0.9x1.25", "1.9x2.5", "96x192", "48x96", "64x128", "10x15", "ne30np4", "128x256" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane17.setViewportView(jList16); jLabel30.setText("Resolution"); jLabel31.setText("Type"); jList17.setModel(new javax.swing.AbstractListModel() { String[] strings = { "any", "Finite Volume", "Displaced Pole", "Point", "Spectral", "Triple Pole" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane18.setViewportView(jList17); javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15); jPanel15.setLayout(jPanel15Layout); jPanel15Layout.setHorizontalGroup( jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jScrollPane18, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel31)) .addGap(18, 18, 18) .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jScrollPane17, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel30)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel15Layout.setVerticalGroup( jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel15Layout.createSequentialGroup() .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane17, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel15Layout.createSequentialGroup() .addComponent(jLabel31) .addGap(8, 8, 8) .addComponent(jScrollPane18, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))) ); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel5Layout.createSequentialGroup() .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel5Layout.createSequentialGroup() .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(86, Short.MAX_VALUE)) ); jLabel3.setText("Available Grids"); gridList.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Not Selected", "pt1_pt1", "f02_f02", "f02_g16", "f02_t12", "f05_f05", "f05_g16", "f05_t12", "f09_f09", "f09_g16", "f19_f19", "f19_g16", "f45_f45", "f45_g37", "T62_g37", "T62_t12", "T62_g16", "T31_T31", "T31_g37", "T42_T42", "f10_f10", "ne30_f19_g16", "ne240_f02_g16", "T85_T85" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane3.setViewportView(gridList); jButton13.setText("Create Custom Grid"); javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); jPanel9.setLayout(jPanel9Layout); jPanel9Layout.setHorizontalGroup( jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel9Layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addGroup(jPanel9Layout.createSequentialGroup() .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton13))) .addGap(159, 159, 159)) ); jPanel9Layout.setVerticalGroup( jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton13) .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel9Layout.createSequentialGroup() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 398, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(38, 38, 38)) ); jTabbedPane1.addTab("Grids", jPanel9); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Amazon EC2 Information")); jLabel4.setText("Keypair Name"); jLabel5.setText("Keypair"); jLabel6.setText("Private Key"); jLabel7.setText("Certificate"); jTextField1.setText("<keypair name>"); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jTextField2.setText("$HOME/<where your keypair is>/pk-XX.pem"); jTextField3.setText("$HOME/<where your private key is>/pk-XX.pem"); jTextField4.setText("$HOME/<where your certificate is>/cert-XX.pem"); jButton5.setText("Browse"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jButton6.setText("Browse"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jButton7.setText("Browse"); jButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton7ActionPerformed(evt); } }); jButton9.setText("Update EC2 Security on PC"); jButton10.setText("Create New Keypair"); jLabel13.setText("or"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel4) .addComponent(jLabel6) .addComponent(jLabel5) .addComponent(jLabel7)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(jLabel13) .addGap(18, 18, 18) .addComponent(jButton10)) .addComponent(jTextField4, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE) .addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE) .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton7) .addComponent(jButton6) .addComponent(jButton5))) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jButton9))) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton10) .addComponent(jLabel13)) .addGap(17, 17, 17) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton6)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton7)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE) .addComponent(jButton9) .addContainerGap()) ); startInstanceButton.setText("Start up Instance with Current Configuration"); jButton11.setText("Load Configuration XML"); jButton11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton11ActionPerformed(evt); } }); jTextArea1.setColumns(20); jTextArea1.setRows(5); jTextArea1.setText("#!/bin/bash\n\ncd ~/ccsm4/scripts/\n\necho \"Creating new case...\"\n./create_newcase -case <casename> -res <grid> -compset <compset> -mach <machine>\ncd ~/ccsm4/scripts/<casename>/\n\n\necho \"Configuring case...\"\n./configure -case\n\n\necho \"Building case...\"\n./<casename>.<machine>.clean_build\n./<casename>.<machine>.build\n\necho \"Running simulation...\"\n./<casename>.<machine>.run\n\necho \"Run complete.\""); jScrollPane9.setViewportView(jTextArea1); jLabel15.setText("Current Configuration Script"); jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Current Configuration")); jLabel16.setText("CompSet"); compsetField.setText("<compset>"); compsetField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { compsetFieldActionPerformed(evt); } }); jLabel17.setText("Grid"); gridField.setText("<grid>"); gridField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { gridFieldActionPerformed(evt); } }); jLabel18.setText("Case Name"); casenameField.setText("<casename>"); casenameField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { casenameFieldActionPerformed(evt); } }); jButton12.setText("Update"); javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout.setHorizontalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel16) .addComponent(compsetField, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel17) .addComponent(gridField, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel18) .addComponent(casenameField, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton12)) .addContainerGap(119, Short.MAX_VALUE)) ); jPanel8Layout.setVerticalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addComponent(jLabel18) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(casenameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel16) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(compsetField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel17) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(gridField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton12) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); saveConfigButton.setText("Save Configuration Script"); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 881, Short.MAX_VALUE) .addGroup(jPanel7Layout.createSequentialGroup() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton11) .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel15) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup() .addComponent(saveConfigButton) .addGap(18, 18, 18) .addComponent(startInstanceButton))) .addContainerGap()) ); jPanel7Layout.setVerticalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel7Layout.createSequentialGroup() .addComponent(jButton11) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)) .addGap(11, 11, 11) .addComponent(jLabel15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(startInstanceButton) .addComponent(saveConfigButton)) .addContainerGap(28, Short.MAX_VALUE)) ); jTabbedPane1.addTab("Cloud", jPanel7); ExitButton.setText("Exit"); ExitButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ExitButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 906, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 795, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ExitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel14) .addComponent(ExitButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 518, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed // Load an XML file from here // Take the compset and grid value and replace fields with it int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); System.out.println("Loading from: " + file.getName()); String[] comp_grid = readXML(file); compsetField.setText(comp_grid[0]); gridField.setText(comp_grid[1]); } }//GEN-LAST:event_jButton11ActionPerformed private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton7ActionPerformed private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton6ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton5ActionPerformed private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton2ActionPerformed private void compsetFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_compsetFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_compsetFieldActionPerformed private void gridFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gridFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_gridFieldActionPerformed private void compsetListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_compsetListValueChanged // TODO add your handling code here: }//GEN-LAST:event_compsetListValueChanged private void casenameFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_casenameFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_casenameFieldActionPerformed private void ExitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitButtonActionPerformed // TODO add your handling code here: System.exit(0); }//GEN-LAST:event_ExitButtonActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // Take chosen options from available compset & grid // and create an XML config file from it int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); System.out.println("Saving to: " + file.getName()); makeXML(file, compsetList.getSelectedValue().toString() , gridList.getSelectedValue().toString() ); } }//GEN-LAST:event_jButton1ActionPerformed private void compsetTypeListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_compsetTypeListValueChanged // TODO add your handling code here: String c = compsetTypeList.getSelectedValue().toString(); String[] newcompsetList = { "None Selected", "A_PRESENT_DAY", "A_GLC", "B_2000", "B_2000_CN", "B_1850_CAM5", "B_1850", "B_1850_CN", "B_2000_CN_CHEM", "B_1850_CN_CHEM", "B_1850_RAMPCO2_CN", "B_18502000", "B_18502000_CN", "B_18502000_CN_CHEM", "B_18502000_CAM5", "B_2000_GLC", "B_2000_TROP_MOZART", "B_1850_WACCM", "B_1850_WACCM_CN", "B_18502000_WACCM_CN", "B_1850_BGCBPRP", "B_1850_BGCBDRD", "B_18502000_BGCBPRP", "B_18502000_BGCBDRD", "C_NORMAL_YEAR_ECOSYS", "C_NORMAL_YEAR", "D_NORMAL_YEAR", "E_2000", "E_2000_GLC", "E_1850_CN", "E_1850_CAM5", "F_AMIP_CN", "F_AMIP_CAM5", "F_1850", "F_1850_CAM5", "F_2000", "F_2000_CAM5", "F_2000_CN", "F_18502000_CN", "F_2000_GLC", "F_1850_CN_CHEM", "F_1850_WACCM", "F_1850_WACCM", "F_2000_WACCM", "G_1850_ECOSYS", "G_NORMAL_YEAR", "H_PRESENT_DAY", "I_2000", "I_1850", "I_2000_GLC", "I_19482004", "I_18502000", "I_2000_CN", "I_1850_CN", "I_19482004_CN", "I_18502000_CN", "S_PRESENT_DAY", "X_PRESENT_DAY", "XG_PRESENT_DAY" }; if (!lastCompsetType.equals(c)) { System.out.println("Getting OWL Compset subset '"+c+"' from ontology");//getOWLCompset(); if (c.equals("any")) { getOWLCompset("NamedCompSets"); } else { newcompsetList = getOWLCompset(c.substring(0,1)); // This can be abused since it's direct connection to list, replace in the future } /*else if (c.substring(0, 1).equals("A")){ newcompsetList = getOWLCompset("A"); } else if (c.substring(0, 1).equals("B")){ newcompsetList = getOWLCompset("B"); }*/ lastCompsetType = compsetTypeList.getSelectedValue().toString(); compsetList.setListData(newcompsetList); } }//GEN-LAST:event_compsetTypeListValueChanged private void compsetTypeListPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_compsetTypeListPropertyChange // TODO add your handling code here: }//GEN-LAST:event_compsetTypeListPropertyChange private void compsetTypeListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_compsetTypeListMouseClicked // TODO add your handling code here: }//GEN-LAST:event_compsetTypeListMouseClicked private void makeXML(File f, String compset, String grid) { try { ///////////////////////////// //Creating an empty XML Document //We need a Document DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbfac.newDocumentBuilder(); Document doc = docBuilder.newDocument(); //////////////////////// //Creating the XML tree //create the root element and add it to the document Element root = doc.createElement("case"); doc.appendChild(root); //create a comment and put it in the root element Comment comment = doc.createComment("Contains Compset & Grid"); root.appendChild(comment); //create compset element, add an attribute, and add to root Element c = doc.createElement("compset"); c.setAttribute("name", compset); root.appendChild(c); //create compset element, add an attribute, and add to root Element g = doc.createElement("grid"); g.setAttribute("name", grid); root.appendChild(g); //add a text element to the child //Text text = doc.createTextNode("Not needed...yet"); //child.appendChild(text); ///////////////// //Output the XML //set up a transformer TransformerFactory transfac = TransformerFactory.newInstance(); Transformer trans = transfac.newTransformer(); trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); trans.setOutputProperty(OutputKeys.INDENT, "yes"); //create string from xml tree StringWriter sw = new StringWriter(); StreamResult result = new StreamResult(sw); DOMSource source = new DOMSource(doc); trans.transform(source, result); String xmlString = sw.toString(); //print xml System.out.println("Saving following to XML:\n" + xmlString); // Save to File //DataOutputStream dos=new DataOutputStream(new FileOutputStream(f)); //dos.writeUTF(xmlString); //dos.close(); BufferedWriter out = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(f))); out.append(xmlString); out.flush(); out.close(); System.out.println("File saved successfully!"); } catch (Exception e) { System.out.println(e); } } private String[] readXML(File f) { //String compset, grid; String[] comp_grid = new String[2]; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(f); doc.getDocumentElement().normalize(); NodeList nodeLst = doc.getDocumentElement().getChildNodes(); for (int s=0; s < nodeLst.getLength(); s++) { Node fstNode = nodeLst.item(s); if (fstNode.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap atbs = fstNode.getAttributes(); //System.out.println(">"+fstNode.getNodeName()+""); for (int k=0; k < atbs.getLength(); k++) { Node v = atbs.item(k); System.out.println("\t"+fstNode.getNodeName()+" "+ v.getNodeName()+ " = "+ v.getTextContent()); if (fstNode.getNodeName().equals("compset")) comp_grid[0]=v.getTextContent(); else if (fstNode.getNodeName().equals("grid")) comp_grid[1]=v.getTextContent(); } } } } catch (Exception e) { //e.printStackTrace(); comp_grid[0] = "null"; comp_grid[1] = "null"; } return comp_grid; } public static void setupOWL() { try { // Instantiate an ontology manager OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); // LOAD FILE // Create a file object that points to the local copy File file = new File(fileInLoc); // Now load the local copy OWLOntology ontology = manager.loadOntologyFromOntologyDocument(file); System.out.println("Loaded ontology: " + ontology); // We can always obtain the location where an ontology was loaded from IRI documentIRI = manager.getOntologyDocumentIRI(ontology); System.out.println(" from: " + documentIRI); // END LOAD FILE // REASONER CREATION // We need to create an instance of OWLReasoner. An OWLReasoner provides the basic // query functionality that we need, for example the ability obtain the subclasses // of a class etc. To do this we use a reasoner factory. // Instantiate the HermiT reasoner factory: OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory(); OWLReasonerConfiguration config = new SimpleConfiguration(); // Create a reasoner that will reason over our ontology and its imports closure. Pass in the configuration. reasoner = reasonerFactory.createReasoner(ontology, config); // END REASONER CREATION // Ask the reasoner to do all the necessary work now reasoner.precomputeInferences(); // We can determine if the ontology is actually consistent (in this case, it should be). boolean consistent = reasoner.isConsistent(); System.out.println("Reasoner Consistent: " + consistent); System.out.println("\n"); // factory used for queries fac = manager.getOWLDataFactory(); } catch(UnsupportedOperationException exception) { System.out.println("Unsupported reasoner operation."); } catch (OWLOntologyCreationException e) { System.out.println("Could not load the ontology: " + e.getMessage()); } /*catch (OWLException e) { e.printStackTrace(); }*/ } static AmazonEC2 ec2; //static AmazonS3 s3; //static AmazonSimpleDB sdb; /** * The only information needed to create a client are security credentials * consisting of the AWS Access Key ID and Secret Access Key. All other * configuration, such as the service endpoints, are performed * automatically. Client parameters, such as proxies, can be specified in an * optional ClientConfiguration object when constructing a client. * * @see com.amazonaws.auth.BasicAWSCredentials * @see com.amazonaws.auth.PropertiesCredentials * @see com.amazonaws.ClientConfiguration */ private static void initAmazon() throws Exception { AWSCredentials credentials = new PropertiesCredentials( C3_UI.class.getResourceAsStream("AwsCredentials.properties")); ec2 = new AmazonEC2Client(credentials); //s3 = new AmazonS3Client(credentials); //sdb = new AmazonSimpleDBClient(credentials); } public static void testAmazon() throws Exception { System.out.println("==========================================="); System.out.println("Testing AWS Java SDK!"); System.out.println("==========================================="); initAmazon(); /* * Amazon EC2 * * The AWS EC2 client allows you to create, delete, and administer * instances programmatically. * * In this sample, we use an EC2 client to get a list of all the * availability zones, and all instances sorted by reservation id. */ try { DescribeAvailabilityZonesResult availabilityZonesResult = ec2.describeAvailabilityZones(); System.out.println("You have access to " + availabilityZonesResult.getAvailabilityZones().size() + " Availability Zones."); DescribeInstancesResult describeInstancesRequest = ec2.describeInstances(); List<Reservation> reservations = describeInstancesRequest.getReservations(); Set<Instance> instances = new HashSet<Instance>(); for (Reservation reservation : reservations) { instances.addAll(reservation.getInstances()); } System.out.println("You have " + instances.size() + " Amazon EC2 instance(s) running."); } catch (AmazonServiceException ase) { System.out.println("Caught Exception: " + ase.getMessage()); System.out.println("Reponse Status Code: " + ase.getStatusCode()); System.out.println("Error Code: " + ase.getErrorCode()); System.out.println("Request ID: " + ase.getRequestId()); } /* * Amazon EC2 * * The AWS EC2 client allows you to create, delete, and administer * instances programmatically. * * In this sample, we use an EC2 client to get a list of all the * availability zones, and all instances sorted by reservation id. */ } /** * Takes in a Compset Type, Date & Extras string value from selected values, * and creates a new partial compset in the ontology. * The class is added as a subclass of NamedCompSets * It then adds the 3 axioms defined by type/date/extras to the class * @param type * @param date * @param features * @return */ public static OWLClass createOWLCompset(String type, String date, String features) { //OWLClass compset = new OWLClass(); return null; } /** * * @return checks OWL ontology for compset based on current partial config */ public static String[] getOWLCompset(String name) { // Get All CompSets as list String[] csets = new String[50]; OWLClass compsetClass = fac.getOWLClass(IRI.create(prefix+name)); // name = "NamedCompSets" for example NodeSet<OWLClass> allCompsets = reasoner.getSubClasses(compsetClass, true); Set<OWLClass> clses = allCompsets.getFlattened(); System.out.println("Subset "+name+" of Compsets: "); int i=0; for(OWLClass cls : clses) { csets[i++] = pm.getShortForm(cls).substring(1); System.out.println(" " + pm.getShortForm(cls).substring(1) ); } System.out.println("\n"); return csets; } /* private static void printNode( org.semanticweb.owlapi.reasoner.Node<OWLClass> node) { // Print out a node as a list of class names in curly brackets System.out.print("{"); for(Iterator<OWLClass> it = node.getEntities().iterator(); it.hasNext(); ) { OWLClass cls = it.next(); // User a prefix manager to provide a slightly nicer shorter name System.out.print(pm.getShortForm(cls)); if (it.hasNext()) { System.out.print(" "); } } System.out.println("}"); } */ /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new C3_UI().setVisible(true); } }); } //Create a file chooser for use by all buttons final JFileChooser fc = new JFileChooser(); /* IRI prefix for ontology used */ public static final String prefix = "http://www.c3.com/ontologies/c3InputSpecs#"; public static final String fileInLoc = "CESM_ontology.owl"; public static final String fileOutLoc = "CESM_ontology_modified.owl"; public static OWLReasoner reasoner; public static OWLDataFactory fac; private static DefaultPrefixManager pm = new DefaultPrefixManager(prefix); private static String lastCompsetType=""; // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton ExitButton; private javax.swing.JTextField casenameField; private javax.swing.JTextField compsetField; private javax.swing.JList compsetList; private javax.swing.JList compsetTypeList; private javax.swing.JTextField gridField; private javax.swing.JList gridList; private javax.swing.JButton jButton1; private javax.swing.JButton jButton10; private javax.swing.JButton jButton11; private javax.swing.JButton jButton12; private javax.swing.JButton jButton13; private javax.swing.JButton jButton2; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JButton jButton7; private javax.swing.JButton jButton9; private javax.swing.JComboBox jComboBox1; private javax.swing.JComboBox jComboBox2; private javax.swing.JComboBox jComboBox3; private javax.swing.JComboBox jComboBox4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel22; private javax.swing.JLabel jLabel23; private javax.swing.JLabel jLabel24; private javax.swing.JLabel jLabel25; private javax.swing.JLabel jLabel26; private javax.swing.JLabel jLabel27; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel30; private javax.swing.JLabel jLabel31; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel9; private javax.swing.JList jList10; private javax.swing.JList jList11; private javax.swing.JList jList12; private javax.swing.JList jList13; private javax.swing.JList jList16; private javax.swing.JList jList17; private javax.swing.JList jList2; private javax.swing.JList jList4; private javax.swing.JList jList8; private javax.swing.JList jList9; private javax.swing.JPanel jPanel11; private javax.swing.JPanel jPanel12; private javax.swing.JPanel jPanel13; private javax.swing.JPanel jPanel15; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JPanel jPanel8; private javax.swing.JPanel jPanel9; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane10; private javax.swing.JScrollPane jScrollPane11; private javax.swing.JScrollPane jScrollPane12; private javax.swing.JScrollPane jScrollPane13; private javax.swing.JScrollPane jScrollPane14; private javax.swing.JScrollPane jScrollPane17; private javax.swing.JScrollPane jScrollPane18; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JScrollPane jScrollPane4; private javax.swing.JScrollPane jScrollPane5; private javax.swing.JScrollPane jScrollPane8; private javax.swing.JScrollPane jScrollPane9; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JTextArea jTextArea1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JButton saveConfigButton; private javax.swing.JButton startInstanceButton; // End of variables declaration//GEN-END:variables }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
aaaca172dce768e6c5314dafc9c2192d399e46d9
91204153aaa359f0db7706ac0b3ba5b607f6f0aa
/CandyCrush/HorizontalCandy.java
09d9c1a12028bd4247817a96042caadb97d36808
[]
no_license
mamo88/Candy-Crush
d5612ee4d09692071d280485ec0b2c84b656e9aa
7df1ffc54a807e9c25914c396e811d39b099b6ab
refs/heads/master
2021-01-10T07:50:55.485879
2016-01-03T22:08:47
2016-01-03T22:08:47
48,962,425
0
0
null
null
null
null
UTF-8
Java
false
false
4,773
java
package CandyCrush; public class HorizontalCandy extends Candy { public HorizontalCandy(int color, Board board,int row,int column) { super(color, board,row,column); } @Override public void crush() { //crush horizontal - crush all the row if (!wasCrushed){ wasCrushed=true; for (int j=0; j<9; j=j+1) if (this.board.getCandies()[row][j]!=null && j!=column) this.board.getCandies()[row][j].crush(); this.board.getCandies()[row][column]=null; this.getBoard().getGame().setScoreInt(this.getBoard().getGame().getScoreInt()+this.getBoard().getPointFactor()); } } @Override public void Visit(RegularCandy regular) { // TODO Auto-generated method stub } @Override public void Visit(HorizontalCandy horizontal) { //special combine with horizontal - crush all the row and all the column this.board.getCandies()[row][column]=null; this.getBoard().getGame().setScoreInt(this.getBoard().getGame().getScoreInt()+this.getBoard().getPointFactor()); this.board.getCandies()[horizontal.row][horizontal.column]=null; horizontal=null; this.getBoard().getGame().setScoreInt(this.getBoard().getGame().getScoreInt()+this.getBoard().getPointFactor()); for (int i=0; i<9; i=i+1){ //crush column if (this.board.getCandies()[i][column]!=null && i!=row) this.board.getCandies()[i][column].crush(); } for (int j=0; j<9; j=j+1){ //crush row if (this.board.getCandies()[row][j]!=null && j!=column) this.board.getCandies()[row][j].crush(); } } @Override public void Visit(VerticalCandy vertical) { //special combine with vertical - the same as horizontal this.board.getCandies()[row][column]=null; this.getBoard().getGame().setScoreInt(this.getBoard().getGame().getScoreInt()+this.getBoard().getPointFactor()); this.board.getCandies()[vertical.row][vertical.column]=null; vertical=null; this.getBoard().getGame().setScoreInt(this.getBoard().getGame().getScoreInt()+this.getBoard().getPointFactor()); for (int i=0; i<9; i=i+1){ if (this.board.getCandies()[i][column]!=null && i!=row) this.board.getCandies()[i][column].crush(); } for (int j=0; j<9; j=j+1){ if (this.board.getCandies()[row][j]!=null && j!=column) this.board.getCandies()[row][j].crush(); } } @Override public void Visit(WrappedCandy wrapped) { //special combine with wrapped - crush 3 rows and 3 columns this.board.getCandies()[row][column]=null; this.getBoard().getGame().setScoreInt(this.getBoard().getGame().getScoreInt()+this.getBoard().getPointFactor()); this.board.getCandies()[wrapped.row][wrapped.column]=null; wrapped=null; this.getBoard().getGame().setScoreInt(this.getBoard().getGame().getScoreInt()+this.getBoard().getPointFactor()); for (int i=0; i<9; i=i+1){ if (this.board.getCandies()[i][column]!=null && i!=row) this.board.getCandies()[i][column].crush(); if (column<8 && this.board.getCandies()[i][column+1]!=null) this.board.getCandies()[i][column+1].crush(); if (column>0 && this.board.getCandies()[i][column-1]!=null) this.board.getCandies()[i][column-1].crush(); } for (int j=0; j<9; j=j+1){ if (this.board.getCandies()[row][j]!=null && j!=column) this.board.getCandies()[row][j].crush(); if (row<8 && this.board.getCandies()[row+1][j]!=null) this.board.getCandies()[row+1][j].crush(); if (row>0 && this.board.getCandies()[row-1][j]!=null) this.board.getCandies()[row-1][j].crush(); } } @Override public void Visit(ChocolateCandy chocolate) { //special combine with chocolate int savedColor=this.getColor(); this.board.getCandies()[row][column]=null; this.getBoard().getGame().setScoreInt(this.getBoard().getGame().getScoreInt()+this.getBoard().getPointFactor()); this.board.getCandies()[chocolate.row][chocolate.column]=null; chocolate=null; this.getBoard().getGame().setScoreInt(this.getBoard().getGame().getScoreInt()+this.getBoard().getPointFactor()); for (int i=0; i<9; i=i+1){ //turn all of the same color to horizontal/vertical randomly for (int j=0; j<9; j=j+1){ if(this.board.getCandies()[i][j]!=null && this.board.getCandies()[i][j].getColor()==savedColor){ if ((int)(Math.random()*2)==1) this.board.getCandies()[i][j]=new VerticalCandy(savedColor,board,i,j); else this.board.getCandies()[i][j]=new HorizontalCandy(savedColor,board,i,j); } } } for (int i=0; i<9; i=i+1){ //crush all of that color (vertical/horizontal due to previous loops) for (int j=0; j<9; j=j+1){ if(this.board.getCandies()[i][j]!=null && this.board.getCandies()[i][j].getColor()==savedColor){ this.board.getCandies()[i][j].crush(); } } } } @Override public void accept(Visitor visitor) { //part of the visitor visited pattern visitor.Visit(this); } }
[ "eladmaymon1812@gmail.com" ]
eladmaymon1812@gmail.com
25225bd928946604ea875c7f7d8c183a5d47f3d0
dd45a41ba456210221da886c27a154355ffd2d6e
/lemon-common/lemon-common-gateway/src/main/java/org/lemon/common/gateway/properties/ReplayAttackProperties.java
1ed641cb86138c07cd3f1a5fc8c686bbd402a34c
[]
no_license
wangwencheng/lemon
8ade8eb6a25b45978af3f4798d99ed4688dd6a6b
9758fde48718de1c30ecfb7e9c34da31f8ac4cad
refs/heads/master
2023-02-09T02:02:15.498538
2020-12-31T10:03:36
2020-12-31T10:03:36
292,013,777
1
1
null
null
null
null
UTF-8
Java
false
false
220
java
package org.lemon.common.gateway.properties; import lombok.Data; /** * ้˜ฒ้‡ๆ”พๆ”ปๅ‡ป้…็ฝฎ * @author wwc */ @Data public class ReplayAttackProperties { private boolean enable = true; private int timeout = 60; }
[ "960075207@qq.com" ]
960075207@qq.com
868c9af715984daa15437abd5bd4437f454af640
374ad03287670140e4a716aa211cdaf60f50c944
/ztr-common/ztravel-reuse/src/main/java/com/ztravel/reuse/order/converter/Convert2OrderPayBean.java
2dd6e5bead64312e4b4a65df4a03f6ce0454e401
[]
no_license
xxxJppp/firstproj
ca541f8cbe004a557faff577698c0424f1bbd1aa
00dcfbe731644eda62bd2d34d55144a3fb627181
refs/heads/master
2020-07-12T17:00:00.549410
2017-04-17T08:29:58
2017-04-17T08:29:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,540
java
package com.ztravel.reuse.order.converter; import java.util.Enumeration; import javax.servlet.http.HttpServletRequest; import com.ztravel.common.enums.PaymentType; import com.ztravel.common.enums.ProductType; import com.ztravel.common.payment.OrderPayBean; import com.ztravel.common.util.SSOUtil; import com.ztravel.common.util.WebEnv; import com.ztravel.reuse.order.entity.OrderPayFormBean; import com.ztravel.reuse.order.entity.OrderPayVo; public class Convert2OrderPayBean { public static OrderPayBean convert2OrderPayBean(OrderPayFormBean s, HttpServletRequest request) throws Exception{ OrderPayBean t = new OrderPayBean(); String orderId = ""; if(s.getOrderNo() != null){ orderId = s.getOrderNo(); } t.setOrderId(orderId); t.setFgNotifyUrl(s.getFgNotifyUrl()); String memberId = ""; if(SSOUtil.getMemberId() != null){ memberId = SSOUtil.getMemberId(); } t.setMemberId(memberId); PaymentType paymentType = PaymentType.Alipay; if(s.getPaymentType() != null){ paymentType = s.getPaymentType(); } t.setPaymentType(paymentType); t.setComment(s.getComment()); boolean isMobile = isMoblile(request); t.setMobile(isMobile); String fgNotifyUrl = getFgNotifyUrl(); t.setFgNotifyUrl(fgNotifyUrl); t.setPayAmount(s.getPayAmount()); String couponItemId = ""; if(s.getCouponItemId() != null ){ couponItemId = s.getCouponItemId(); } t.setCouponItemId(couponItemId); t.setUseCoupon(s.getUseCoupon()); t.setOrderAmount(s.getOrderAmount()); t.setUseRewardPoint(s.getUseRewardPoint()); t.setProductType(s.getProductType()); return t; } private static boolean isMoblile(HttpServletRequest request) { @SuppressWarnings("rawtypes") Enumeration headerNames = request.getHeaderNames(); //ๅ…ˆ่Žทๅ–ๅคดไฟกๆฏ while(headerNames.hasMoreElements()) { //ๅฆ‚ๆžœๆœ‰ๅคด็š„่ฏ String headerName = (String)headerNames.nextElement();//่Žทๅ–้ฆ–ไธชๅคดๅ…ƒ็ด  if (headerName.equals("x-up-calling-line-id")) {//ๅฆ‚ๆžœๅคดไฟกๆฏๆ˜ฏx-up-calling-line-id้‚ฃๅŸบๆœฌไธŠๅฏไปฅ็กฎๅฎšๆ˜ฏๆ‰‹ๆœบไบ† String temvit=request.getHeader(headerName);//ๅ†่ฟ›ไธ€ๆญฅ็กฎ่ฎค if (temvit.substring(0,3).trim().equals("861") || temvit.substring(0,2).trim().equals("13")) { return true; } } } return false; } private static String getFgNotifyUrl() { String fgNotifyUrl = WebEnv.get("server.path.memberServer", "") //ๆœๅŠกๅ™จๅœฐๅ€ + "/orderPay/payResult" ; //่ฏทๆฑ‚้กต้ขๆˆ–ๅ…ถไป–ๅœฐๅ€ return fgNotifyUrl; } public static OrderPayBean buildOrderPayBeanByOrderPayVo(OrderPayVo orderPayVo) throws Exception{ OrderPayBean orderPayBean = new OrderPayBean(); String memberId = ""; orderPayBean.setOrderId(orderPayVo.getOrderCode()); if(SSOUtil.getMemberId() !=null){ memberId = SSOUtil.getMemberId(); } orderPayBean.setMemberId(memberId); orderPayBean.setUseCoupon(orderPayVo.getDiscountCoupon() == null ? 0l : orderPayVo.getDiscountCoupon()); orderPayBean.setPayAmount(orderPayVo.getPayAmount() ==null ? 0l : orderPayVo.getPayAmount()); String couponItemId = ""; if(orderPayVo.getCouponItemId() != null){ couponItemId = orderPayVo.getCouponItemId(); } orderPayBean.setCouponItemId(couponItemId); orderPayBean.setUseRewardPoint(orderPayVo.getUseRewardPoint() ==null ? 0l :orderPayVo.getUseRewardPoint()); orderPayBean.setOrderAmount(orderPayVo.getTotalPrice() == null ? 0l : orderPayVo.getTotalPrice()); orderPayBean.setProductType(ProductType.valueOf(orderPayVo.getProductType())); return orderPayBean; } }
[ "yining.ni@travelzen.com" ]
yining.ni@travelzen.com
0f3b461fc50b289c9e47ff4cb202d3b21c0aa7df
4490b06d5303e5d6e821a98f66085a5b0f3ca7b8
/src/main/java/com/converter/currencyconverter/entity/ExchRate.java
756fc845e53bb02ffa1eab16d39f53672c17703f
[]
no_license
AlexBorkin/ConverterORM
0497dbc9e0e5d203fb5c1a932de1147095b65bae
ece7c57a9723190f7bd5a3c63a858164a31a7f7e
refs/heads/master
2022-12-30T17:39:31.437713
2020-09-15T15:10:09
2020-09-15T15:10:09
286,958,077
0
0
null
2020-09-15T15:10:10
2020-08-12T08:22:06
Java
UTF-8
Java
false
false
2,916
java
package com.converter.currencyconverter.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; import java.util.Date; //@Data //@AllArgsConstructor //@NoArgsConstructor @Entity @Table(name = "exchrate", uniqueConstraints = {@UniqueConstraint(name = "UK_DATE_CURRENCY", columnNames = {"date_rate", "currency_code"})}) public class ExchRate { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; // @Column(name="currency_id") // private Long currencyId; @Column(name = "date_rate") private Date dateRate; private Double currencyRate; private String currencyDescription; // @Transient private String fullDescription; @Column(name="currency_code") private String currencyCode; @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name="currency_id", foreignKey = @ForeignKey(name = "FK_Currency")) private Currency currency; public ExchRate() { } public ExchRate(Date dateRate, Double currencyRate, String currencyDescription, String currencyCode, Currency currency) { this.dateRate = dateRate; this.currencyRate = currencyRate; this.currencyDescription = currencyDescription; this.currencyCode = currencyCode; this.currency = currency; } public ExchRate(Date dateRate, Double currencyRate, String currencyDescription, String currencyCode) { this.dateRate = dateRate; this.currencyRate = currencyRate; this.currencyDescription = currencyDescription; this.currencyCode = currencyCode; } public ExchRate(Long id, Date dateRate, Double currencyRate, String currencyDescription, String fullDescription) { this.id = id; this.dateRate = dateRate; this.currencyRate = currencyRate; this.currencyDescription = currencyDescription; this.fullDescription = fullDescription; } public Currency getCurrency() { return currency; } public void setCurrency(Currency currency) { this.currency = currency; } public Date getDateRate() { return dateRate; } public void setDateRate(Date dateRate) { this.dateRate = dateRate; } public Double getCurrencyRate() { return currencyRate; } public void setCurrencyRate(Double currencyRate) { this.currencyRate = currencyRate; } public String getCurrencyDescription() { return currencyDescription; } public void setCurrencyDescription(String currencyDescription) { this.currencyDescription = currencyDescription; } public String getFullDescription() { return fullDescription; } public void setFullDescription(String fullDescription) { this.fullDescription = fullDescription; } }
[ "redhot@inbox.ru" ]
redhot@inbox.ru
fd112d0c1501b48fa4812cd4be35261974260505
69d2bb7ee946652a851d0723e36c079432fb4f82
/src/main/java/com/qiushui/snowlotuschat/utils/RedisUtil.java
006601231ea5ee40c27658f363da9ab135cd83db
[]
no_license
syanfox/snowlotus-chat
d1ef03b2b70cbfd8d52f3b0c2bbb89d236488d91
274926d4041d1643a2d48266fcd29f2d71970598
refs/heads/master
2022-06-28T02:19:42.177366
2019-07-18T13:00:21
2019-07-18T13:00:21
196,704,930
0
0
null
2022-06-17T02:19:37
2019-07-13T09:43:54
Java
UTF-8
Java
false
false
14,681
java
package com.qiushui.snowlotuschat.utils; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; import javax.annotation.Resource; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @Component public class RedisUtil { @Resource private RedisTemplate<String, Object> redisTemplate; public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) { this.redisTemplate = redisTemplate; } //=============================common============================ /** * ๆŒ‡ๅฎš็ผ“ๅญ˜ๅคฑๆ•ˆๆ—ถ้—ด * @param key ้”ฎ * @param time ๆ—ถ้—ด(็ง’) * @return */ public boolean expire(String key,long time){ try { if(time>0){ redisTemplate.expire(key, time, TimeUnit.SECONDS); } return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๆ นๆฎkey ่Žทๅ–่ฟ‡ๆœŸๆ—ถ้—ด * @param key ้”ฎ ไธ่ƒฝไธบnull * @return ๆ—ถ้—ด(็ง’) ่ฟ”ๅ›ž0ไปฃ่กจไธบๆฐธไน…ๆœ‰ๆ•ˆ */ public long getExpire(String key){ return redisTemplate.getExpire(key,TimeUnit.SECONDS); } /** * ๅˆคๆ–ญkeyๆ˜ฏๅฆๅญ˜ๅœจ * @param key ้”ฎ * @return true ๅญ˜ๅœจ falseไธๅญ˜ๅœจ */ public boolean hasKey(String key){ try { return redisTemplate.hasKey(key); } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๅˆ ้™ค็ผ“ๅญ˜ * @param key ๅฏไปฅไผ ไธ€ไธชๅ€ผ ๆˆ–ๅคšไธช */ @SuppressWarnings("unchecked") public void del(String ... key){ if(key!=null&&key.length>0){ if(key.length==1){ redisTemplate.delete(key[0]); }else{ redisTemplate.delete(CollectionUtils.arrayToList(key)); } } } //============================String============================= /** * ๆ™ฎ้€š็ผ“ๅญ˜่Žทๅ– * @param key ้”ฎ * @return ๅ€ผ */ public Object get(String key){ return key==null?null:redisTemplate.opsForValue().get(key); } /** * ๆ™ฎ้€š็ผ“ๅญ˜ๆ”พๅ…ฅ * @param key ้”ฎ * @param value ๅ€ผ * @return trueๆˆๅŠŸ falseๅคฑ่ดฅ */ public boolean set(String key,Object value) { try { redisTemplate.opsForValue().set(key, value); return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๆ™ฎ้€š็ผ“ๅญ˜ๆ”พๅ…ฅๅนถ่ฎพ็ฝฎๆ—ถ้—ด * @param key ้”ฎ * @param value ๅ€ผ * @param time ๆ—ถ้—ด(็ง’) time่ฆๅคงไบŽ0 ๅฆ‚ๆžœtimeๅฐไบŽ็ญ‰ไบŽ0 ๅฐ†่ฎพ็ฝฎๆ— ้™ๆœŸ * @return trueๆˆๅŠŸ false ๅคฑ่ดฅ */ public boolean set(String key,Object value,long time){ try { if(time>0){ redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); }else{ set(key, value); } return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ้€’ๅขž * @param key ้”ฎ * @param by ่ฆๅขžๅŠ ๅ‡ (ๅคงไบŽ0) * @return */ public long incr(String key, long delta){ if(delta<0){ throw new RuntimeException("้€’ๅขžๅ› ๅญๅฟ…้กปๅคงไบŽ0"); } return redisTemplate.opsForValue().increment(key, delta); } /** * ้€’ๅ‡ * @param key ้”ฎ * @param by ่ฆๅ‡ๅฐ‘ๅ‡ (ๅฐไบŽ0) * @return */ public long decr(String key, long delta){ if(delta<0){ throw new RuntimeException("้€’ๅ‡ๅ› ๅญๅฟ…้กปๅคงไบŽ0"); } return redisTemplate.opsForValue().increment(key, -delta); } //================================Map================================= /** * HashGet * @param key ้”ฎ ไธ่ƒฝไธบnull * @param item ้กน ไธ่ƒฝไธบnull * @return ๅ€ผ */ public Object hget(String key,String item){ return redisTemplate.opsForHash().get(key, item); } /** * ่Žทๅ–hashKeyๅฏนๅบ”็š„ๆ‰€ๆœ‰้”ฎๅ€ผ * @param key ้”ฎ * @return ๅฏนๅบ”็š„ๅคšไธช้”ฎๅ€ผ */ public Map<Object,Object> hmget(String key){ return redisTemplate.opsForHash().entries(key); } /** * HashSet * @param key ้”ฎ * @param map ๅฏนๅบ”ๅคšไธช้”ฎๅ€ผ * @return true ๆˆๅŠŸ false ๅคฑ่ดฅ */ public boolean hmset(String key, Map<String,Object> map){ try { redisTemplate.opsForHash().putAll(key, map); return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * HashSet ๅนถ่ฎพ็ฝฎๆ—ถ้—ด * @param key ้”ฎ * @param map ๅฏนๅบ”ๅคšไธช้”ฎๅ€ผ * @param time ๆ—ถ้—ด(็ง’) * @return trueๆˆๅŠŸ falseๅคฑ่ดฅ */ public boolean hmset(String key, Map<String,Object> map, long time){ try { redisTemplate.opsForHash().putAll(key, map); if(time>0){ expire(key, time); } return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๅ‘ไธ€ๅผ hash่กจไธญๆ”พๅ…ฅๆ•ฐๆฎ,ๅฆ‚ๆžœไธๅญ˜ๅœจๅฐ†ๅˆ›ๅปบ * @param key ้”ฎ * @param item ้กน * @param value ๅ€ผ * @return true ๆˆๅŠŸ falseๅคฑ่ดฅ */ public boolean hset(String key,String item,Object value) { try { redisTemplate.opsForHash().put(key, item, value); return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๅ‘ไธ€ๅผ hash่กจไธญๆ”พๅ…ฅๆ•ฐๆฎ,ๅฆ‚ๆžœไธๅญ˜ๅœจๅฐ†ๅˆ›ๅปบ * @param key ้”ฎ * @param item ้กน * @param value ๅ€ผ * @param time ๆ—ถ้—ด(็ง’) ๆณจๆ„:ๅฆ‚ๆžœๅทฒๅญ˜ๅœจ็š„hash่กจๆœ‰ๆ—ถ้—ด,่ฟ™้‡Œๅฐ†ไผšๆ›ฟๆขๅŽŸๆœ‰็š„ๆ—ถ้—ด * @return true ๆˆๅŠŸ falseๅคฑ่ดฅ */ public boolean hset(String key,String item,Object value,long time) { try { redisTemplate.opsForHash().put(key, item, value); if(time>0){ expire(key, time); } return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๅˆ ้™คhash่กจไธญ็š„ๅ€ผ * @param key ้”ฎ ไธ่ƒฝไธบnull * @param item ้กน ๅฏไปฅไฝฟๅคšไธช ไธ่ƒฝไธบnull */ public void hdel(String key, Object... item){ redisTemplate.opsForHash().delete(key,item); } /** * ๅˆคๆ–ญhash่กจไธญๆ˜ฏๅฆๆœ‰่ฏฅ้กน็š„ๅ€ผ * @param key ้”ฎ ไธ่ƒฝไธบnull * @param item ้กน ไธ่ƒฝไธบnull * @return true ๅญ˜ๅœจ falseไธๅญ˜ๅœจ */ public boolean hHasKey(String key, String item){ return redisTemplate.opsForHash().hasKey(key, item); } /** * hash้€’ๅขž ๅฆ‚ๆžœไธๅญ˜ๅœจ,ๅฐฑไผšๅˆ›ๅปบไธ€ไธช ๅนถๆŠŠๆ–ฐๅขžๅŽ็š„ๅ€ผ่ฟ”ๅ›ž * @param key ้”ฎ * @param item ้กน * @param by ่ฆๅขžๅŠ ๅ‡ (ๅคงไบŽ0) * @return */ public double hincr(String key, String item,double by){ return redisTemplate.opsForHash().increment(key, item, by); } /** * hash้€’ๅ‡ * @param key ้”ฎ * @param item ้กน * @param by ่ฆๅ‡ๅฐ‘่ฎฐ(ๅฐไบŽ0) * @return */ public double hdecr(String key, String item,double by){ return redisTemplate.opsForHash().increment(key, item,-by); } //============================set============================= /** * ๆ นๆฎkey่Žทๅ–Setไธญ็š„ๆ‰€ๆœ‰ๅ€ผ * @param key ้”ฎ * @return */ public Set<Object> sGet(String key){ try { return redisTemplate.opsForSet().members(key); } catch (Exception e) { e.printStackTrace(); return null; } } /** * ๆ นๆฎvalueไปŽไธ€ไธชsetไธญๆŸฅ่ฏข,ๆ˜ฏๅฆๅญ˜ๅœจ * @param key ้”ฎ * @param value ๅ€ผ * @return true ๅญ˜ๅœจ falseไธๅญ˜ๅœจ */ public boolean sHasKey(String key,Object value){ try { return redisTemplate.opsForSet().isMember(key, value); } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๅฐ†ๆ•ฐๆฎๆ”พๅ…ฅset็ผ“ๅญ˜ * @param key ้”ฎ * @param values ๅ€ผ ๅฏไปฅๆ˜ฏๅคšไธช * @return ๆˆๅŠŸไธชๆ•ฐ */ public long sSet(String key, Object...values) { try { return redisTemplate.opsForSet().add(key, values); } catch (Exception e) { e.printStackTrace(); return 0; } } /** * ๅฐ†setๆ•ฐๆฎๆ”พๅ…ฅ็ผ“ๅญ˜ * @param key ้”ฎ * @param time ๆ—ถ้—ด(็ง’) * @param values ๅ€ผ ๅฏไปฅๆ˜ฏๅคšไธช * @return ๆˆๅŠŸไธชๆ•ฐ */ public long sSetAndTime(String key,long time,Object...values) { try { Long count = redisTemplate.opsForSet().add(key, values); if(time>0) expire(key, time); return count; } catch (Exception e) { e.printStackTrace(); return 0; } } /** * ่Žทๅ–set็ผ“ๅญ˜็š„้•ฟๅบฆ * @param key ้”ฎ * @return */ public long sGetSetSize(String key){ try { return redisTemplate.opsForSet().size(key); } catch (Exception e) { e.printStackTrace(); return 0; } } /** * ็งป้™คๅ€ผไธบvalue็š„ * @param key ้”ฎ * @param values ๅ€ผ ๅฏไปฅๆ˜ฏๅคšไธช * @return ็งป้™ค็š„ไธชๆ•ฐ */ public long setRemove(String key, Object ...values) { try { Long count = redisTemplate.opsForSet().remove(key, values); return count; } catch (Exception e) { e.printStackTrace(); return 0; } } //===============================list================================= /** * ่Žทๅ–list็ผ“ๅญ˜็š„ๅ†…ๅฎน * @param key ้”ฎ * @param start ๅผ€ๅง‹ * @param end ็ป“ๆŸ 0 ๅˆฐ -1ไปฃ่กจๆ‰€ๆœ‰ๅ€ผ * @return */ public List<Object> lGet(String key,long start, long end){ try { return redisTemplate.opsForList().range(key, start, end); } catch (Exception e) { e.printStackTrace(); return null; } } /** * ่Žทๅ–list็ผ“ๅญ˜็š„้•ฟๅบฆ * @param key ้”ฎ * @return */ public long lGetListSize(String key){ try { return redisTemplate.opsForList().size(key); } catch (Exception e) { e.printStackTrace(); return 0; } } /** * ้€š่ฟ‡็ดขๅผ• ่Žทๅ–listไธญ็š„ๅ€ผ * @param key ้”ฎ * @param index ็ดขๅผ• index>=0ๆ—ถ๏ผŒ 0 ่กจๅคด๏ผŒ1 ็ฌฌไบŒไธชๅ…ƒ็ด ๏ผŒไพๆฌก็ฑปๆŽจ๏ผ›index<0ๆ—ถ๏ผŒ-1๏ผŒ่กจๅฐพ๏ผŒ-2ๅ€’ๆ•ฐ็ฌฌไบŒไธชๅ…ƒ็ด ๏ผŒไพๆฌก็ฑปๆŽจ * @return */ public Object lGetIndex(String key,long index){ try { return redisTemplate.opsForList().index(key, index); } catch (Exception e) { e.printStackTrace(); return null; } } /** * ๅฐ†listๆ”พๅ…ฅ็ผ“ๅญ˜ * @param key ้”ฎ * @param value ๅ€ผ * @param time ๆ—ถ้—ด(็ง’) * @return */ public boolean lSet(String key, Object value) { try { redisTemplate.opsForList().rightPush(key, value); return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๅฐ†listๆ”พๅ…ฅ็ผ“ๅญ˜ * @param key ้”ฎ * @param value ๅ€ผ * @param time ๆ—ถ้—ด(็ง’) * @return */ public boolean lSet(String key, Object value, long time) { try { redisTemplate.opsForList().rightPush(key, value); if (time > 0) expire(key, time); return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๅฐ†listๆ”พๅ…ฅ็ผ“ๅญ˜ * @param key ้”ฎ * @param value ๅ€ผ * @param time ๆ—ถ้—ด(็ง’) * @return */ public boolean lSet(String key, List<Object> value) { try { redisTemplate.opsForList().rightPushAll(key, value); return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๅฐ†listๆ”พๅ…ฅ็ผ“ๅญ˜ * @param key ้”ฎ * @param value ๅ€ผ * @param time ๆ—ถ้—ด(็ง’) * @return */ public boolean lSet(String key, List<Object> value, long time) { try { redisTemplate.opsForList().rightPushAll(key, value); if (time > 0) expire(key, time); return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ๆ นๆฎ็ดขๅผ•ไฟฎๆ”นlistไธญ็š„ๆŸๆกๆ•ฐๆฎ * @param key ้”ฎ * @param index ็ดขๅผ• * @param value ๅ€ผ * @return */ public boolean lUpdateIndex(String key, long index,Object value) { try { redisTemplate.opsForList().set(key, index, value); return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * ็งป้™คNไธชๅ€ผไธบvalue * @param key ้”ฎ * @param count ็งป้™คๅคšๅฐ‘ไธช * @param value ๅ€ผ * @return ็งป้™ค็š„ไธชๆ•ฐ */ public long lRemove(String key,long count,Object value) { try { Long remove = redisTemplate.opsForList().remove(key, count, value); return remove; } catch (Exception e) { e.printStackTrace(); return 0; } } }
[ "if_guo@163.com" ]
if_guo@163.com
84450c9eba4099c207d1dcf1247d188d1f6a68b2
b961d8b8cefded7615357ce9355d7a2719107fe4
/src/main/java/it/example/spring/batch/demo/listener/JobCompletionListener.java
269a4d3bda810a91bac420061b557ad6c84a8f8b
[]
no_license
giocos/springbatch
40b866643dfc67bd06f88850a78e6baa681db1fc
d9c8115fbca6dc3a36f6761c6675d6e388e9a943
refs/heads/master
2023-02-08T10:09:04.526400
2021-01-02T19:21:40
2021-01-02T19:21:40
326,254,850
0
0
null
null
null
null
UTF-8
Java
false
false
876
java
package it.example.spring.batch.demo.listener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.listener.JobExecutionListenerSupport; public class JobCompletionListener extends JobExecutionListenerSupport { private final static Logger LOGGER = LoggerFactory.getLogger(JobCompletionListener.class); @Override public void beforeJob(JobExecution jobExecution) { if (jobExecution.isRunning()) { LOGGER.info("BATCH JOB BEING STARTING..."); } } @Override public void afterJob(JobExecution jobExecution) { if (jobExecution.getStatus() == BatchStatus.COMPLETED) { LOGGER.info("BATCH JOB COMPLETED SUCCESSFULLY!"); } } }
[ "giovannicosentino1994@gmail.com" ]
giovannicosentino1994@gmail.com
af0bc5593d98e452db5593f1591125cf5d0927f8
fff8d45864fdca7f43e6d65acbe4c1f469531877
/erp_desktop_all/src_seguridad/com/bydan/erp/seguridad/presentation/web/jsf/sessionbean/ParametroGeneralSgSessionBean.java
b46221471d70186c02a189b0f98e9a1982e43a00
[ "Apache-2.0" ]
permissive
jarocho105/pre2
26b04cc91ff1dd645a6ac83966a74768f040f418
f032fc63741b6deecdfee490e23dfa9ef1f42b4f
refs/heads/master
2020-09-27T16:16:52.921372
2016-09-01T04:34:56
2016-09-01T04:34:56
67,095,806
1
0
null
null
null
null
UTF-8
Java
false
false
11,865
java
/* *AVISO LEGAL ยฉ Copyright *Este programa esta protegido por la ley de derechos de autor. *La reproduccion o distribucion ilicita de este programa o de cualquiera de *sus partes esta penado por la ley con severas sanciones civiles y penales, *y seran objeto de todas las sanciones legales que correspondan. *Su contenido no puede copiarse para fines comerciales o de otras, *ni puede mostrarse, incluso en una version modificada, en otros sitios Web. Solo esta permitido colocar hipervinculos al sitio web. */ package com.bydan.erp.seguridad.presentation.web.jsf.sessionbean; import java.util.Set; import java.util.HashSet; import java.util.ArrayList; import java.util.Date; import java.io.Serializable; import com.bydan.framework.erp.util.Constantes; import com.bydan.erp.seguridad.business.entity.*; @SuppressWarnings("unused") public class ParametroGeneralSgSessionBean extends ParametroGeneralSgSessionBeanAdditional { private static final long serialVersionUID = 1L; protected Boolean isPermiteNavegacionHaciaForeignKeyDesdeParametroGeneralSg; protected Boolean isPermiteRecargarInformacion; protected String sNombrePaginaNavegacionHaciaForeignKeyDesdeParametroGeneralSg; protected Boolean isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSg; protected Long lIdParametroGeneralSgActualForeignKey; protected Long lIdParametroGeneralSgActualForeignKeyParaPosibleAtras; protected Boolean isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSgParaPosibleAtras; protected String sUltimaBusquedaParametroGeneralSg; protected String sServletGenerarHtmlReporte; protected Integer iNumeroPaginacion; protected Integer iNumeroPaginacionPagina; protected String sPathNavegacionActual=""; protected Boolean isPaginaPopup=false; protected String sStyleDivArbol=""; protected String sStyleDivContent=""; protected String sStyleDivOpcionesBanner=""; protected String sStyleDivExpandirColapsar=""; protected String sFuncionBusquedaRapida=""; private Long id; protected Boolean conGuardarRelaciones=false; protected Boolean estaModoGuardarRelaciones=false; protected Boolean esGuardarRelacionado=false; protected Boolean estaModoBusqueda=false; protected Boolean noMantenimiento=false; protected ParametroGeneralSgSessionBeanAdditional parametrogeneralsgSessionBeanAdditional=null; public ParametroGeneralSgSessionBeanAdditional getParametroGeneralSgSessionBeanAdditional() { return this.parametrogeneralsgSessionBeanAdditional; } public void setParametroGeneralSgSessionBeanAdditional(ParametroGeneralSgSessionBeanAdditional parametrogeneralsgSessionBeanAdditional) { try { this.parametrogeneralsgSessionBeanAdditional=parametrogeneralsgSessionBeanAdditional; } catch(Exception e) { ; } } public ParametroGeneralSgSessionBean () { this.inicializarParametroGeneralSgSessionBean(); } public void inicializarParametroGeneralSgSessionBean () { this.isPermiteNavegacionHaciaForeignKeyDesdeParametroGeneralSg=false; this.isPermiteRecargarInformacion=false; this.sNombrePaginaNavegacionHaciaForeignKeyDesdeParametroGeneralSg=""; this.isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSg=false; this.lIdParametroGeneralSgActualForeignKey=0L; this.lIdParametroGeneralSgActualForeignKeyParaPosibleAtras=0L; this.isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSgParaPosibleAtras=false; this.sUltimaBusquedaParametroGeneralSg =""; this.sServletGenerarHtmlReporte=""; this.iNumeroPaginacion=10; this.iNumeroPaginacionPagina=0; this.sPathNavegacionActual=""; this.sFuncionBusquedaRapida=""; this.sStyleDivArbol="display:table-row;width:20%;height:800px;visibility:visible"; this.sStyleDivContent="height:600px;width:80%"; this.sStyleDivOpcionesBanner="display:table-row"; this.sStyleDivExpandirColapsar="display:table-row"; this.isPaginaPopup=false; this.estaModoGuardarRelaciones=true; this.conGuardarRelaciones=false; this.esGuardarRelacionado=false; this.estaModoBusqueda=false; this.noMantenimiento=false; } public void setPaginaPopupVariables(Boolean isPopupVariables) { if(isPopupVariables) { if(!this.isPaginaPopup) { this.sStyleDivArbol="display:none;width:0px;height:0px;visibility:hidden"; this.sStyleDivContent="height:800px;width:100%";; this.sStyleDivOpcionesBanner="display:none"; this.sStyleDivExpandirColapsar="display:none"; this.isPaginaPopup=true; } } else { if(this.isPaginaPopup) { this.sStyleDivArbol="display:table-row;width:15%;height:600px;visibility:visible;overflow:auto;"; this.sStyleDivContent="height:600px;width:80%"; this.sStyleDivOpcionesBanner="display:table-row"; this.sStyleDivExpandirColapsar="display:table-row"; this.isPaginaPopup=false; } } } public Boolean getisPermiteNavegacionHaciaForeignKeyDesdeParametroGeneralSg() { return this.isPermiteNavegacionHaciaForeignKeyDesdeParametroGeneralSg; } public void setisPermiteNavegacionHaciaForeignKeyDesdeParametroGeneralSg( Boolean isPermiteNavegacionHaciaForeignKeyDesdeParametroGeneralSg) { this.isPermiteNavegacionHaciaForeignKeyDesdeParametroGeneralSg= isPermiteNavegacionHaciaForeignKeyDesdeParametroGeneralSg; } public Boolean getisPermiteRecargarInformacion() { return this.isPermiteRecargarInformacion; } public void setisPermiteRecargarInformacion( Boolean isPermiteRecargarInformacion) { this.isPermiteRecargarInformacion=isPermiteRecargarInformacion; } public String getsNombrePaginaNavegacionHaciaForeignKeyDesdeParametroGeneralSg() { return this.sNombrePaginaNavegacionHaciaForeignKeyDesdeParametroGeneralSg; } public void setsNombrePaginaNavegacionHaciaForeignKeyDesdeParametroGeneralSg(String sNombrePaginaNavegacionHaciaForeignKeyDesdeParametroGeneralSg) { this.sNombrePaginaNavegacionHaciaForeignKeyDesdeParametroGeneralSg = sNombrePaginaNavegacionHaciaForeignKeyDesdeParametroGeneralSg; } public Boolean getisBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSg() { return isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSg; } public void setisBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSg( Boolean isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSg) { this.isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSg= isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSg; } public Long getlIdParametroGeneralSgActualForeignKey() { return lIdParametroGeneralSgActualForeignKey; } public void setlIdParametroGeneralSgActualForeignKey( Long lIdParametroGeneralSgActualForeignKey) { this.lIdParametroGeneralSgActualForeignKey = lIdParametroGeneralSgActualForeignKey; } public Long getlIdParametroGeneralSgActualForeignKeyParaPosibleAtras() { return lIdParametroGeneralSgActualForeignKeyParaPosibleAtras; } public void setlIdParametroGeneralSgActualForeignKeyParaPosibleAtras( Long lIdParametroGeneralSgActualForeignKeyParaPosibleAtras) { this.lIdParametroGeneralSgActualForeignKeyParaPosibleAtras = lIdParametroGeneralSgActualForeignKeyParaPosibleAtras; } public Boolean getisBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSgParaPosibleAtras() { return isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSgParaPosibleAtras; } public void setisBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSgParaPosibleAtras( Boolean isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSgParaPosibleAtras) { this.isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSgParaPosibleAtras = isBusquedaDesdeForeignKeySesionForeignKeyParametroGeneralSgParaPosibleAtras; } public String getsUltimaBusquedaParametroGeneralSg() { return sUltimaBusquedaParametroGeneralSg; } public void setsUltimaBusquedaParametroGeneralSg(String sUltimaBusquedaParametroGeneralSg) { this.sUltimaBusquedaParametroGeneralSg = sUltimaBusquedaParametroGeneralSg; } public String getsServletGenerarHtmlReporte() { return sServletGenerarHtmlReporte; } public void setsServletGenerarHtmlReporte(String sServletGenerarHtmlReporte) { this.sServletGenerarHtmlReporte = sServletGenerarHtmlReporte; } public Integer getiNumeroPaginacion() { return iNumeroPaginacion; } public void setiNumeroPaginacion(Integer iNumeroPaginacion) { this.iNumeroPaginacion= iNumeroPaginacion; } public Integer getiNumeroPaginacionPagina() { return iNumeroPaginacionPagina; } public void setiNumeroPaginacionPagina(Integer iNumeroPaginacionPagina) { this.iNumeroPaginacionPagina= iNumeroPaginacionPagina; } public String getsPathNavegacionActual() { return this.sPathNavegacionActual; } public void setsPathNavegacionActual(String sPathNavegacionActual) { this.sPathNavegacionActual = sPathNavegacionActual; } public Boolean getisPaginaPopup() { return this.isPaginaPopup; } public void setisPaginaPopup(Boolean isPaginaPopup) { this.isPaginaPopup = isPaginaPopup; } public String getsStyleDivArbol() { return this.sStyleDivArbol; } public void setsStyleDivArbol(String sStyleDivArbol) { this.sStyleDivArbol = sStyleDivArbol; } public String getsStyleDivContent() { return this.sStyleDivContent; } public void setsStyleDivContent(String sStyleDivContent) { this.sStyleDivContent = sStyleDivContent; } public String getsStyleDivOpcionesBanner() { return this.sStyleDivOpcionesBanner; } public void setsStyleDivOpcionesBanner(String sStyleDivOpcionesBanner) { this.sStyleDivOpcionesBanner = sStyleDivOpcionesBanner; } public String getsStyleDivExpandirColapsar() { return this.sStyleDivExpandirColapsar; } public void setsStyleDivExpandirColapsar(String sStyleDivExpandirColapsar) { this.sStyleDivExpandirColapsar = sStyleDivExpandirColapsar; } public String getsFuncionBusquedaRapida() { return this.sFuncionBusquedaRapida; } public void setsFuncionBusquedaRapida(String sFuncionBusquedaRapida) { this.sFuncionBusquedaRapida = sFuncionBusquedaRapida; } public Boolean getConGuardarRelaciones() { return this.conGuardarRelaciones; } public void setConGuardarRelaciones(Boolean conGuardarRelaciones) { this.conGuardarRelaciones = conGuardarRelaciones; } public Boolean getEstaModoGuardarRelaciones() { return this.estaModoGuardarRelaciones; } public void setEstaModoGuardarRelaciones(Boolean estaModoGuardarRelaciones) { this.estaModoGuardarRelaciones = estaModoGuardarRelaciones; } public Boolean getEsGuardarRelacionado() { return this.esGuardarRelacionado; } public void setEsGuardarRelacionado(Boolean esGuardarRelacionado) { this.esGuardarRelacionado = esGuardarRelacionado; } public Boolean getEstaModoBusqueda() { return this.estaModoBusqueda; } public void setEstaModoBusqueda(Boolean estaModoBusqueda) { this.estaModoBusqueda = estaModoBusqueda; } public Boolean getNoMantenimiento() { return this.noMantenimiento; } public void setNoMantenimiento(Boolean noMantenimiento) { this.noMantenimiento = noMantenimiento; } public Long getid() { return this.id; } public void setid(Long newid)throws Exception { try { if(this.id!=newid) { if(newid==null) { //newid=0L; if(Constantes.ISDEVELOPING) { System.out.println("ParametroGeneralSg:Valor nulo no permitido en columna id"); } } this.id=newid; } } catch(Exception e) { throw e; } } }
[ "byrondanilo10@hotmail.com" ]
byrondanilo10@hotmail.com
0db32dc5dea66f287a14a4f7abd3655455c4e6a5
cc0493278fa6b856b943dfa349c87bb620d2a8e0
/src/main/java/com/example/HajibootApplication.java
d17217515a4f716035f4ca697a218094495677fd
[]
no_license
shupopo/hajiboot
b5b274ca54272ea75999a0462eb35df7a54cba9f
ba75c9fbad365dc3b2cd9d314c084ed97cc23558
refs/heads/master
2021-08-15T18:25:45.315675
2017-11-10T05:41:26
2017-11-10T05:41:26
109,230,128
0
0
null
null
null
null
UTF-8
Java
false
false
683
java
package com.example; import com.example.app.Frontend; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; @SpringBootApplication public class HajibootApplication { public static void main(String[] args) { ApplicationContext context = SpringApplication.run(HajibootApplication.class, args); Frontend frontend = context.getBean(Frontend.class); frontend.run(); } }
[ "โ€˜hiroshimashuhei@me.comโ€™" ]
โ€˜hiroshimashuhei@me.comโ€™
758c541bce250637f32ecb63da11b46f3bc2e9ed
fb3b28755af5dec34c541001cad923d18ca9468f
/src/com/example/dd/schoolnet.java
4e32b7299258675067a3366c2cf921841cde7cdc
[]
no_license
Ivorfason/School-In-Hand
f75a5c3f35a2ffffdfb6d2c9b9c344937d9cf26d
018b9e74f66699b5434027be4ea45ebe40fceb9a
refs/heads/master
2021-01-10T16:26:54.620638
2015-11-24T04:00:22
2015-11-24T04:00:22
46,765,651
1
0
null
null
null
null
UTF-8
Java
false
false
2,026
java
package com.example.dd; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class schoolnet extends Activity { Button b1,b2,b3,b4; int request_Code=1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.schoolnet); b1=(Button)findViewById(R.id.neduweb1); b1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent i=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://jwc.nedu.edu.cn/")); startActivity(i); } }); b2=(Button)findViewById(R.id.neduweb2); b2.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent i=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://54shine.nedu.edu.cn/")); startActivity(i); } }); b3=(Button)findViewById(R.id.neduweb3); b3.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent i=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://lib.nedu.edu.cn/")); startActivity(i); } }); b4=(Button)findViewById(R.id.neduweb4); b4.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent i=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://59.72.212.6/luntan/portal.php")); startActivity(i); } }); } @Override public void onActivityResult(int requestCode,int resultCode,Intent data) { if(requestCode==request_Code) { if(resultCode==RESULT_OK) { Toast.makeText(this,data.getData().toString(),Toast.LENGTH_SHORT).show(); Intent i=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse(data.getData().toString())); startActivity(i); } } } }
[ "845407259@qq.com" ]
845407259@qq.com
0abeaf2f362aa95a939d91dda274d5d81d2fb4d8
7b5765509b4248e54849d6e31f184d2958591db7
/src/main/java/com/teste/cursomc/filters/HeaderExposureFilter.java
cb1508a67ae6b80e8f2469108e4768eb21353cf0
[]
no_license
vitor-menezes-dev/cursomc
f9f6f740f15d6720841780d6b0756444859a4eec
8e1c277766f833776240e9c5bd14ab6b6b62cac3
refs/heads/master
2022-12-01T07:01:47.469975
2020-08-03T12:07:16
2020-08-03T12:07:16
287,623,441
0
0
null
null
null
null
UTF-8
Java
false
false
719
java
package com.teste.cursomc.filters; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Component; @Component public class HeaderExposureFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletResponse res = (HttpServletResponse) response; res.addHeader("access-control-expose-headers", "location"); chain.doFilter(request, response); } }
[ "vitor.menezes@capgemini.com" ]
vitor.menezes@capgemini.com
18fc386fd04d13434046389eadee9ada036fb116
3cb6cca32eab27cf507bd3937a903676b3cea6c5
/third_party/java/htmlparser/src/nu/validator/saxtree/ParentNode.java
2539c54c026b1d174a44fe6fe84eed1325015cf9
[ "BSD-3-Clause", "MIT", "Apache-2.0" ]
permissive
rahulchaurasiazx55/caja
1982461b68924915c09564370459d7784ff92c10
719b0d03c68461bc6bde8e7ad370e36471209846
refs/heads/master
2022-12-23T02:34:31.261651
2020-09-30T18:31:49
2020-09-30T18:31:49
300,015,001
1
0
Apache-2.0
2020-09-30T18:25:42
2020-09-30T18:25:41
null
UTF-8
Java
false
false
6,251
java
/* * Copyright (c) 2007 Henri Sivonen * Copyright (c) 2008 Mozilla Foundation * * 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 nu.validator.saxtree; import org.xml.sax.Locator; /** * Common superclass for parent nodes. * @version $Id: ParentNode.java 499 2009-02-24 11:51:51Z hsivonen $ * @author hsivonen */ public abstract class ParentNode extends Node { /** * The end locator. */ protected Locator endLocator; /** * The first child. */ private Node firstChild = null; /** * The last child (for efficiency). */ private Node lastChild = null; /** * The constuctor. * @param locator the locator */ ParentNode(Locator locator) { super(locator); } /** * Sets the endLocator. * * @param endLocator the endLocator to set */ public void setEndLocator(Locator endLocator) { this.endLocator = new LocatorImpl(endLocator); } /** * Copies the endLocator from another node. * * @param another the another node */ public void copyEndLocator(ParentNode another) { this.endLocator = another.endLocator; } /** * Returns the firstChild. * * @return the firstChild */ public final Node getFirstChild() { return firstChild; } /** * Returns the lastChild. * * @return the lastChild */ public final Node getLastChild() { return lastChild; } /** * Insert a new child before a pre-existing child and return the newly inserted child. * @param child the new child * @param sibling the existing child before which to insert (must be a child of this node) or <code>null</code> to append * @return <code>child</code> */ public Node insertBefore(Node child, Node sibling) { assert sibling == null || this == sibling.getParentNode(); if (sibling == null) { return appendChild(child); } child.detach(); child.setParentNode(this); if (firstChild == sibling) { child.setNextSibling(sibling); firstChild = child; } else { Node prev = firstChild; Node next = firstChild.getNextSibling(); while (next != sibling) { prev = next; next = next.getNextSibling(); } prev.setNextSibling(child); child.setNextSibling(next); } return child; } public Node insertBetween(Node child, Node prev, Node next) { assert prev == null || this == prev.getParentNode(); assert next == null || this == next.getParentNode(); assert prev != null || next == firstChild; assert next != null || prev == lastChild; assert prev == null || next == null || prev.getNextSibling() == next; if (next == null) { return appendChild(child); } child.detach(); child.setParentNode(this); child.setNextSibling(next); if (prev == null) { firstChild = child; } else { prev.setNextSibling(child); } return child; } /** * Append a child to this node and return the child. * * @param child the child to append. * @return <code>child</code> */ public Node appendChild(Node child) { child.detach(); child.setParentNode(this); if (firstChild == null) { firstChild = child; } else { lastChild.setNextSibling(child); } lastChild = child; return child; } /** * Append the children of another node to this node removing them from the other node . * @param parent the other node whose children to append to this one */ public void appendChildren(Node parent) { Node child = parent.getFirstChild(); if (child == null) { return; } ParentNode another = (ParentNode) parent; if (firstChild == null) { firstChild = child; } else { lastChild.setNextSibling(child); } lastChild = another.lastChild; do { child.setParentNode(this); } while ((child = child.getNextSibling()) != null); another.firstChild = null; another.lastChild = null; } /** * Remove a child from this node. * @param node the child to remove */ void removeChild(Node node) { assert this == node.getParentNode(); if (firstChild == node) { firstChild = node.getNextSibling(); if (lastChild == node) { lastChild = null; } } else { Node prev = firstChild; Node next = firstChild.getNextSibling(); while (next != node) { prev = next; next = next.getNextSibling(); } prev.setNextSibling(node.getNextSibling()); if (lastChild == node) { lastChild = prev; } } } }
[ "mikesamuel@gmail.com" ]
mikesamuel@gmail.com
a4781f8182d92b904a794c306cbcc97f9a0794dd
37d044a16db17b463b21c05bd7a252bd889d8d56
/CoreJava/CodeMagnet/codemagnet-app/src/headfirst/chapter04/Puzzle4.java
cc2b70dc6fb0cfb250f6046bbeb7aee1ff192e14
[]
no_license
vinodwalkunde/Swabhav
2db1ac6ee002cba2a4b6dbec75d0560b3a1391dc
8dce9aabf3d348886b6003c6c8d20f79d01d5aa7
refs/heads/master
2023-01-11T08:53:49.574444
2021-04-24T04:14:29
2021-04-24T04:14:29
164,393,705
0
1
null
2022-12-30T06:29:11
2019-01-07T07:22:11
Java
UTF-8
Java
false
false
405
java
package headfirst.chapter04; public class Puzzle4 { public static void main(String[] args) { Puzzle4b[] obs = new Puzzle4b[6]; int y = 1; int x = 0; int result = 0; while (x < 6) { obs[x] = new Puzzle4b(); obs[x].ivar = y; y = y * 10; x = x + 1; } x = 6; while (x > 0) { x = x - 1; result = result + obs[x].doStuff(x); } System.out.println("result " + result); } }
[ "vinodwalkunde@gmail.com" ]
vinodwalkunde@gmail.com
15dd5155255f4f4a61b73069c368309bfe0e8398
eb3707aca229ee832a4302dc3bc7486b33876d16
/pay/JavaSource/org/jfantasy/pay/rest/form/RefundForm.java
bf5de33b3d733fb50a92ecf7ffaf9328ce271115
[ "MIT" ]
permissive
limaofeng/jfantasy
2f3a3f7e529c454bb3a982809f0cfeaef8ffafc4
847f789175bfe3f251c497b9926db0db04c7cf4f
refs/heads/master
2021-01-19T04:50:14.451725
2017-07-08T03:44:56
2017-07-08T03:44:56
44,217,781
12
12
null
2016-01-06T08:36:45
2015-10-14T02:00:07
Java
UTF-8
Java
false
false
683
java
package org.jfantasy.pay.rest.form; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; @ApiModel("้€€ๆฌพ่กจๅ•") public class RefundForm { @ApiModelProperty(value = "้€€ๆฌพ้‡‘้ข", required = true) private BigDecimal amount; @ApiModelProperty(value = "ๅค‡ๆณจ", required = false) private String remark; public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } }
[ "limaofeng@msn.com" ]
limaofeng@msn.com
822a4c859020df3f01386157ad50dd2c28318e13
b19b9254f809cf62f6bd004d776a6a3981d3630f
/parent/src/main/java/com/xptschool/parent/model/ContactTeacherDao.java
5d1533076a1d95b99f9a21949b0125665845619d
[]
no_license
kongdexing/XPTSchool
c1d2db0aaf4330040ad3ffa6e9a245999bfe8e44
a10ad66785727c59c76e25138f04abd1118a6ec7
refs/heads/master
2021-01-20T14:53:15.229582
2018-01-13T05:29:54
2018-01-13T05:29:54
82,781,357
1
2
null
null
null
null
UTF-8
Java
false
false
11,062
java
package com.xptschool.parent.model; import android.database.Cursor; import android.database.sqlite.SQLiteStatement; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; import org.greenrobot.greendao.internal.DaoConfig; import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.database.DatabaseStatement; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table "CONTACT_TEACHER". */ public class ContactTeacherDao extends AbstractDao<ContactTeacher, Void> { public static final String TABLENAME = "CONTACT_TEACHER"; /** * Properties of entity ContactTeacher.<br/> * Can be used for QueryBuilder and for referencing column names. */ public static class Properties { public final static Property T_id = new Property(0, String.class, "t_id", false, "T_ID"); public final static Property U_id = new Property(1, String.class, "u_id", false, "U_ID"); public final static Property Name = new Property(2, String.class, "name", false, "NAME"); public final static Property Phone = new Property(3, String.class, "phone", false, "PHONE"); public final static Property S_id = new Property(4, String.class, "s_id", false, "S_ID"); public final static Property S_name = new Property(5, String.class, "s_name", false, "S_NAME"); public final static Property A_id = new Property(6, String.class, "a_id", false, "A_ID"); public final static Property A_name = new Property(7, String.class, "a_name", false, "A_NAME"); public final static Property D_name = new Property(8, String.class, "d_name", false, "D_NAME"); public final static Property Education = new Property(9, String.class, "education", false, "EDUCATION"); public final static Property Sex = new Property(10, String.class, "sex", false, "SEX"); public final static Property Email = new Property(11, String.class, "email", false, "EMAIL"); public final static Property Charge = new Property(12, String.class, "charge", false, "CHARGE"); public final static Property G_id = new Property(13, String.class, "g_id", false, "G_ID"); public final static Property C_id = new Property(14, String.class, "c_id", false, "C_ID"); }; public ContactTeacherDao(DaoConfig config) { super(config); } public ContactTeacherDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } /** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"CONTACT_TEACHER\" (" + // "\"T_ID\" TEXT," + // 0: t_id "\"U_ID\" TEXT," + // 1: u_id "\"NAME\" TEXT," + // 2: name "\"PHONE\" TEXT," + // 3: phone "\"S_ID\" TEXT," + // 4: s_id "\"S_NAME\" TEXT," + // 5: s_name "\"A_ID\" TEXT," + // 6: a_id "\"A_NAME\" TEXT," + // 7: a_name "\"D_NAME\" TEXT," + // 8: d_name "\"EDUCATION\" TEXT," + // 9: education "\"SEX\" TEXT," + // 10: sex "\"EMAIL\" TEXT," + // 11: email "\"CHARGE\" TEXT," + // 12: charge "\"G_ID\" TEXT," + // 13: g_id "\"C_ID\" TEXT);"); // 14: c_id } /** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"CONTACT_TEACHER\""; db.execSQL(sql); } @Override protected final void bindValues(DatabaseStatement stmt, ContactTeacher entity) { stmt.clearBindings(); String t_id = entity.getT_id(); if (t_id != null) { stmt.bindString(1, t_id); } String u_id = entity.getU_id(); if (u_id != null) { stmt.bindString(2, u_id); } String name = entity.getName(); if (name != null) { stmt.bindString(3, name); } String phone = entity.getPhone(); if (phone != null) { stmt.bindString(4, phone); } String s_id = entity.getS_id(); if (s_id != null) { stmt.bindString(5, s_id); } String s_name = entity.getS_name(); if (s_name != null) { stmt.bindString(6, s_name); } String a_id = entity.getA_id(); if (a_id != null) { stmt.bindString(7, a_id); } String a_name = entity.getA_name(); if (a_name != null) { stmt.bindString(8, a_name); } String d_name = entity.getD_name(); if (d_name != null) { stmt.bindString(9, d_name); } String education = entity.getEducation(); if (education != null) { stmt.bindString(10, education); } String sex = entity.getSex(); if (sex != null) { stmt.bindString(11, sex); } String email = entity.getEmail(); if (email != null) { stmt.bindString(12, email); } String charge = entity.getCharge(); if (charge != null) { stmt.bindString(13, charge); } String g_id = entity.getG_id(); if (g_id != null) { stmt.bindString(14, g_id); } String c_id = entity.getC_id(); if (c_id != null) { stmt.bindString(15, c_id); } } @Override protected final void bindValues(SQLiteStatement stmt, ContactTeacher entity) { stmt.clearBindings(); String t_id = entity.getT_id(); if (t_id != null) { stmt.bindString(1, t_id); } String u_id = entity.getU_id(); if (u_id != null) { stmt.bindString(2, u_id); } String name = entity.getName(); if (name != null) { stmt.bindString(3, name); } String phone = entity.getPhone(); if (phone != null) { stmt.bindString(4, phone); } String s_id = entity.getS_id(); if (s_id != null) { stmt.bindString(5, s_id); } String s_name = entity.getS_name(); if (s_name != null) { stmt.bindString(6, s_name); } String a_id = entity.getA_id(); if (a_id != null) { stmt.bindString(7, a_id); } String a_name = entity.getA_name(); if (a_name != null) { stmt.bindString(8, a_name); } String d_name = entity.getD_name(); if (d_name != null) { stmt.bindString(9, d_name); } String education = entity.getEducation(); if (education != null) { stmt.bindString(10, education); } String sex = entity.getSex(); if (sex != null) { stmt.bindString(11, sex); } String email = entity.getEmail(); if (email != null) { stmt.bindString(12, email); } String charge = entity.getCharge(); if (charge != null) { stmt.bindString(13, charge); } String g_id = entity.getG_id(); if (g_id != null) { stmt.bindString(14, g_id); } String c_id = entity.getC_id(); if (c_id != null) { stmt.bindString(15, c_id); } } @Override public Void readKey(Cursor cursor, int offset) { return null; } @Override public ContactTeacher readEntity(Cursor cursor, int offset) { ContactTeacher entity = new ContactTeacher( // cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // t_id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // u_id cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // name cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // phone cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // s_id cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // s_name cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // a_id cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // a_name cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // d_name cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // education cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // sex cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // email cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // charge cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // g_id cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14) // c_id ); return entity; } @Override public void readEntity(Cursor cursor, ContactTeacher entity, int offset) { entity.setT_id(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0)); entity.setU_id(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); entity.setPhone(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); entity.setS_id(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); entity.setS_name(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); entity.setA_id(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); entity.setA_name(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); entity.setD_name(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); entity.setEducation(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); entity.setSex(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); entity.setEmail(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); entity.setCharge(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); entity.setG_id(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); entity.setC_id(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); } @Override protected final Void updateKeyAfterInsert(ContactTeacher entity, long rowId) { // Unsupported or missing PK type return null; } @Override public Void getKey(ContactTeacher entity) { return null; } @Override protected final boolean isEntityUpdateable() { return true; } }
[ "il" ]
il
4c4e022969f1283e15668c6775da88de5b94dc96
f501ddd7bb95f1356d0b671246159cea96e48cb4
/btc/src/main/java/cn/xy/okex/vo/Response.java
03533dcfd208e4919755490cf98ba2d781bd31c1
[]
no_license
xuyao/btc
7d234b7ff5df3ea4039ee22af53bd05f4ae3e07c
8cc03afcf6aadc77120809ceaf74df376dfdcb52
refs/heads/master
2018-10-22T10:50:54.416961
2018-07-21T03:02:57
2018-07-21T03:02:57
113,962,335
1
0
null
null
null
null
UTF-8
Java
false
false
370
java
package cn.xy.okex.vo; public class Response { private String result; private Order[] orders; public String getResult() { return result; } public void setResult(String result) { this.result = result; } public Order[] getOrders() { return orders; } public void setOrders(Order[] orders) { this.orders = orders; } }
[ "xuyao@Haier-PC" ]
xuyao@Haier-PC
c9e2607bd49b9f06e351444e01bb30d400355117
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-12667-4-24-NSGA_II-LineCoverage:ExceptionType:StackTraceSimilarity/com/xpn/xwiki/doc/XWikiAttachment_ESTest.java
88debe5ee9403b69e23bd5f6767b297034afa650
[]
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
1,175
java
/* * This file was automatically generated by EvoSuite * Sun Apr 05 15:12:38 UTC 2020 */ package com.xpn.xwiki.doc; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import static org.evosuite.runtime.EvoAssertions.*; import com.xpn.xwiki.doc.XWikiAttachment; import com.xpn.xwiki.doc.XWikiDocument; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.junit.runner.RunWith; import org.xwiki.model.reference.DocumentReference; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class XWikiAttachment_ESTest extends XWikiAttachment_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { XWikiDocument xWikiDocument0 = mock(XWikiDocument.class, new ViolatedAssumptionAnswer()); doReturn((DocumentReference) null).when(xWikiDocument0).getDocumentReference(); XWikiAttachment xWikiAttachment0 = new XWikiAttachment(xWikiDocument0, (String) null); // Undeclared exception! xWikiAttachment0.getReference(); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
8607ccf7745e6362eddac6b6d9e2cf98398f834b
a4d3835284805c46e594d3829f699c265cd5e66d
/Java Functional/src/com/anand/java/functional/streams/MyStream.java
a577988e9b3126a4d0cc9e05ab7ab41ee1141d80
[]
no_license
a-anand-91119/Functional-Java
65a1d56f4afa1a5c8e52c531ba9ad12316fc755d
4ebac8d54eccdc78e443e2974fca9191f27b31b6
refs/heads/master
2021-05-22T02:54:08.676091
2020-04-08T15:55:22
2020-04-08T15:55:22
252,939,552
0
0
null
null
null
null
UTF-8
Java
false
false
2,249
java
package com.anand.java.functional.streams; import java.util.Arrays; import java.util.List; import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; public class MyStream { public static void main(String[] args) { List<Person> people = Arrays.asList(new Person[] { new Person("Anand", Gender.MALE), new Person("Alice", Gender.FEMALE), new Person("Bob", Gender.MALE), new Person("Bobby", Gender.PREFER_NOT_TO_SAY), new Person("Alexa", Gender.FEMALE) }); System.out.println("Collected Output"); Set<Gender> genders = people.stream() .map(person -> person.gender) .collect(Collectors.toSet()); System.out.println(genders); System.out.println("For Each and ::"); people.stream() .map(person -> person.gender) .collect(Collectors.toSet()) .forEach(System.out::println); System.out.println("For Each and Consumer Lamda"); people.stream() .map(person -> person.gender) .collect(Collectors.toSet()) .forEach(gender -> System.out.println(gender)); Predicate<? super Person> femalesPredicate = person -> Gender.FEMALE.equals(person.gender); boolean containsOnlyFemales = people.stream() .allMatch(femalesPredicate); boolean containsAnyFemales = people.stream() .anyMatch(femalesPredicate); Predicate<? super Person> preferNotToSayPredicate = person -> Gender.PREFER_NOT_TO_SAY.equals(person.gender); boolean doNotContainPreferNotToSay = people.stream() .noneMatch(preferNotToSayPredicate ); System.out.println("Contains Only Females: " + containsOnlyFemales); System.out.println("Contains Any Females: " + containsAnyFemales); System.out.println("Do Not Contain Prefer Not To Say: " + doNotContainPreferNotToSay); } static class Person { private final String name; private final Gender gender; public Person(String name, Gender gender) { super(); this.name = name; this.gender = gender; } @Override public String toString() { return "Person [name=" + name + ", gender=" + gender + "]"; } } enum Gender { MALE, FEMALE, PREFER_NOT_TO_SAY; } }
[ "33590033+a-anand-91119@users.noreply.github.com" ]
33590033+a-anand-91119@users.noreply.github.com
440a4129d427d2f49df7a20369c5810d411c5b4b
2bdedcda705f6dcf45a1e9a090377f892bcb58bb
/src/main/output/history_state/end/reason_teacher/country/result/problem_job/research_job_issue/fact.java
cf055f2c2d7e6cbac9cadbc4f9d1a278b69fe625
[]
no_license
matkosoric/GenericNameTesting
860a22af1098dda9ea9e24a1fc681bb728aa2d69
03f4a38229c28bc6d83258e5a84fce4b189d5f00
refs/heads/master
2021-01-08T22:35:20.022350
2020-02-21T11:28:21
2020-02-21T11:28:21
242,123,053
1
0
null
null
null
null
UTF-8
Java
false
false
4,026
java
using System; using System.Collections.Generic; using System.Net.Http; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; // Install Newtonsoft.Json with NuGet using Newtonsoft.Json; namespace TranslationService.Controllers { public class Translate { public async Task<TranslationModels.TranslationResult[]> HandleTranslations(string textToTranslate) { // This is our main function. // Output languages are defined in the route. // For a complete list of options, see API reference. // https://docs.microsoft.com/azure/cognitive-services/translator/reference/v3-0-translate string host = "https://api.cognitive.microsofttranslator.com"; // Set the languages to translate to in the route string route = "/translate?api-version=3.0&to=de&to=it&to=ca&to=da&to=de&to=is"; string subscriptionKey = "d68849e490538549bad2835821238e85"; return await TranslateTextRequest(subscriptionKey, host, route, textToTranslate); } public async Task<TranslationModels.TranslationResult[]> HandleTranslationsWithListOfIdentifiers( List<TranslationModels.LanguageIdentifierToTranslateTo> languageList, string textToTranslate) { // https://docs.microsoft.com/azure/cognitive-services/translator/reference/v3-0-translate string host = "https://api.cognitive.microsofttranslator.com"; string route = SetRouteStringWithListOfLanguages(languageList); string subscriptionKey = ___subscriptionKeyFromAzureTranslationGoesInHere___; return await TranslateTextRequest(subscriptionKey, host, route, textToTranslate); } public string SetRouteStringWithListOfLanguages(List<TranslationModels.LanguageIdentifierToTranslateTo> languageList) { var returnString = "/translate?api-version=3.0"; for (var i = 0; i < languageList.Count; i++) { returnString = returnString + "&to=" + languageList[i].Identifier; } return returnString; } // This function requires C# 7.1 or later for async/await. // Async call to the Translator Text API static public async Task<TranslationModels.TranslationResult[]> TranslateTextRequest(string subscriptionKey, string host, string route, string inputText) { /* * The code for your call to the translation service will be added to this * function in the next few sections. */ object[] body = new object[] { new { Text = inputText } }; var requestBody = JsonConvert.SerializeObject(body); using (var client = new HttpClient()) using (var request = new HttpRequestMessage()) { // In the next few sections you'll add code to construct the request. // Build the request. // Set the method to Post. request.Method = HttpMethod.Post; // Construct the URI and add headers. request.RequestUri = new Uri(host + route); request.Content = new StringContent(requestBody, Encoding.UTF8, "application/json"); request.Headers.Add("77a3cc9c5d8783ccbc00c6d2e110e3e8", subscriptionKey); // Send the request and get response. HttpResponseMessage response = await client.SendAsync(request).ConfigureAwait(false); // Read response as a string. string result = await response.Content.ReadAsStringAsync(); // Deserialize the response using the classes created earlier. TranslationModels.TranslationResult[] deserializedOutput = JsonConvert.DeserializeObject<TranslationModels.TranslationResult[]>(result); return deserializedOutput; } } } }
[ "soric.matko@gmail.com" ]
soric.matko@gmail.com
e3026f03cd3604c3ba562d16ae31c0d2d728dca4
5c86bd8056bf5424700c57acf8ac14c19c13667f
/src/main/java/ds/Node.java
beaba029e5805d0ee61a9e56c4063b4b80f0f1c9
[ "Apache-2.0" ]
permissive
flare505/potato-punch
944e4ef726f4e99c996d27506c4fc91597911e8e
6f2e18a16d3e015d8245665d4467490d53a0a333
refs/heads/master
2023-05-29T05:53:35.513545
2021-06-14T18:43:53
2021-06-14T18:43:53
372,435,109
0
0
null
null
null
null
UTF-8
Java
false
false
260
java
package ds; public class Node<T> implements Visitable{ Node<T> left, right; T data; public Node(T data) { this.data = data; left = right = null; } public void accept(Visitor visitor) { visitor.visit(this); } }
[ "poddar.satyam@gmail.com" ]
poddar.satyam@gmail.com
f81806b7fb72602f7a3415012d3f1527d99c0998
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/16/16_67eadbc9fcb442548a160ff2814dd82611186acc/Relation/16_67eadbc9fcb442548a160ff2814dd82611186acc_Relation_s.java
786d8e241bd27e7ce75360ccc6a7ef313bbb09c5
[]
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,331
java
package org.openstreetmap.josm.data.osm; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; import org.openstreetmap.josm.data.osm.visitor.Visitor; import org.openstreetmap.josm.tools.CopyList; /** * An relation, having a set of tags and any number (0...n) of members. * * @author Frederik Ramm <frederik@remote.org> */ public final class Relation extends OsmPrimitive { /** * All members of this relation. Note that after changing this, * makeBackReferences and/or removeBackReferences should be called. * */ private final List<RelationMember> members = new ArrayList<RelationMember>(); /** * @return Members of the relation. Changes made in returned list are not mapped * back to the primitive, use setMembers() to modify the members * @since 1925 */ public List<RelationMember> getMembers() { return new CopyList<RelationMember>(members.toArray(new RelationMember[members.size()])); } /** * * @param members Can be null, in that case all members are removed * @since 1925 */ public void setMembers(List<RelationMember> members) { for (RelationMember rm:this.members) { rm.getMember().removeReferrer(this); } this.members.clear(); if (members != null) { this.members.addAll(members); } for (RelationMember rm:this.members) { rm.getMember().addReferrer(this); } fireMembersChanged(); } /** * * @since 1926 */ public int getMembersCount() { return members.size(); } /** * * @param index * @return * @since 1926 */ public RelationMember getMember(int index) { return members.get(index); } /** * * @param member * @since 1951 */ public void addMember(RelationMember member) { members.add(member); member.getMember().addReferrer(this); fireMembersChanged(); } /** * * @param index * @param member * @since 1951 */ public void addMember(int index, RelationMember member) { members.add(index, member); member.getMember().addReferrer(this); fireMembersChanged(); } /** * Replace member at position specified by index. * @param index * @param member * @return Member that was at the position * @since 1951 */ public RelationMember setMember(int index, RelationMember member) { RelationMember result = members.set(index, member); if (result.getMember() != member.getMember()) { member.getMember().addReferrer(this); result.getMember().removeReferrer(this); fireMembersChanged(); } return result; } /** * Removes member at specified position. * @param index * @return Member that was at the position * @since 1951 */ public RelationMember removeMember(int index) { RelationMember result = members.remove(index); for (RelationMember rm:members) { // Do not remove referrer if this primitive is used in relation twice if (rm.getMember() == result.getMember()) return result; } result.getMember().removeReferrer(this); fireMembersChanged(); return result; } @Override public void visit(Visitor visitor) { visitor.visit(this); } protected Relation(long id, boolean allowNegative) { super(id, allowNegative); } /** * Create a new relation with id 0 */ public Relation() { super(0, false); } public Relation(Relation clone, boolean clearId) { super(clone.getUniqueId(), true); cloneFrom(clone); if (clearId) { clearOsmId(); } } /** * Create an identical clone of the argument (including the id) */ public Relation(Relation clone) { this(clone, false); } /** * Creates a new relation for the given id. If the id > 0, the way is marked * as incomplete. * * @param id the id. > 0 required * @throws IllegalArgumentException thrown if id < 0 */ public Relation(long id) throws IllegalArgumentException { super(id, false); } @Override public void cloneFrom(OsmPrimitive osm) { super.cloneFrom(osm); // It's not necessary to clone members as RelationMember class is immutable setMembers(((Relation)osm).getMembers()); } @Override public void load(PrimitiveData data) { super.load(data); RelationData relationData = (RelationData) data; List<RelationMember> newMembers = new ArrayList<RelationMember>(); for (RelationMemberData member : relationData.getMembers()) { OsmPrimitive primitive = getDataSet().getPrimitiveById(member); if (primitive == null) throw new AssertionError("Data consistency problem - relation with missing member detected"); newMembers.add(new RelationMember(member.getRole(), primitive)); } setMembers(newMembers); } @Override public RelationData save() { RelationData data = new RelationData(); saveCommonAttributes(data); for (RelationMember member:getMembers()) { data.getMembers().add(new RelationMemberData(member.getRole(), member.getMember())); } return data; } @Override public String toString() { StringBuilder result = new StringBuilder(); result.append("{Relation id="); result.append(getUniqueId()); result.append(" version="); result.append(getVersion()); result.append(" ["); for (RelationMember rm:getMembers()) { result.append(OsmPrimitiveType.from(rm.getMember())); result.append(" "); result.append(rm.getMember().getUniqueId()); result.append(", "); } result.delete(result.length()-2, result.length()); result.append("]"); result.append("}"); return result.toString(); } @Override public boolean hasEqualSemanticAttributes(OsmPrimitive other) { if (other == null || ! (other instanceof Relation) ) return false; if (! super.hasEqualSemanticAttributes(other)) return false; Relation r = (Relation)other; return members.equals(r.members); } public int compareTo(OsmPrimitive o) { return o instanceof Relation ? Long.valueOf(getId()).compareTo(o.getId()) : -1; } // seems to be different from member "incomplete" - FIXME public boolean isIncomplete() { for (RelationMember m : members) if (m.getMember() == null) return true; return false; } public RelationMember firstMember() { if (incomplete) return null; return (members.size() == 0) ? null : members.get(0); } public RelationMember lastMember() { if (incomplete) return null; return (members.size() == 0) ? null : members.get(members.size() -1); } /** * removes all members with member.member == primitive * * @param primitive the primitive to check for */ public void removeMembersFor(OsmPrimitive primitive) { if (primitive == null) return; ArrayList<RelationMember> todelete = new ArrayList<RelationMember>(); for (RelationMember member: members) { if (member.getMember() == primitive) { todelete.add(member); } } primitive.removeReferrer(this); members.removeAll(todelete); fireMembersChanged(); } @Override public void setDeleted(boolean deleted) { for (RelationMember rm:members) { if (deleted) { rm.getMember().removeReferrer(this); } else { rm.getMember().addReferrer(this); } } super.setDeleted(deleted); } /** * removes all members with member.member == primitive * * @param primitives the primitives to check for */ public void removeMembersFor(Collection<OsmPrimitive> primitives) { if (primitives == null || primitives.isEmpty()) return; ArrayList<RelationMember> todelete = new ArrayList<RelationMember>(); for (RelationMember member: members) { if (primitives.contains(member.getMember())) { todelete.add(member); } } members.removeAll(todelete); for (OsmPrimitive primitive:primitives) { primitive.removeReferrer(this); } fireMembersChanged(); } @Override public String getDisplayName(NameFormatter formatter) { return formatter.format(this); } /** * Replies the set of {@see OsmPrimitive}s referred to by at least one * member of this relation * * @return the set of {@see OsmPrimitive}s referred to by at least one * member of this relation */ public Set<OsmPrimitive> getMemberPrimitives() { HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>(); for (RelationMember m: members) { if (m.getMember() != null) { ret.add(m.getMember()); } } return ret; } public OsmPrimitiveType getType() { return OsmPrimitiveType.RELATION; } @Override public BBox getBBox() { return new BBox(0, 0, 0, 0); } @Override public void updatePosition() { // Do nothing for now } private void fireMembersChanged() { if (getDataSet() != null) { getDataSet().fireRelationMembersChanged(this); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
0cb4235ce932f2079632e40166dc7f59e6c2bf1b
d780ab556719bc0778203b33786fdb3ac1906043
/util/encoding/src/main/java/com/github/wenj91/util/encoding/Md5Util.java
376e151d41279db65ee77abce8839ed59f99d799
[]
no_license
wenj91/spring-boot
015327b62bb4ec8ed9eb203d9458cbf56cd927d1
adbc1bf279cf57b8ebf6dee397aff0133804c5dd
refs/heads/master
2022-05-03T12:54:00.271703
2018-07-05T14:23:31
2018-07-05T14:23:31
89,489,769
0
0
null
2022-03-22T03:12:34
2017-04-26T14:21:38
Java
UTF-8
Java
false
false
67
java
package com.github.wenj91.util.encoding; public class Md5Util { }
[ "1541683150@qq.com" ]
1541683150@qq.com
b1ce4fc5df89d5c1d930eb4e842d63d19317a3d1
ebe3e9007317ce623efcfdd6f4cf19018ba314e6
/assign-api/src/main/java/com/robvangastel/assign/domain/Post.java
e532800cd4bb3ac3b263b591424512003ee47f11
[]
no_license
RobvanGastel/Assign
072b39d05e02bab9c40127b26eea59a2d5062db0
539956b9b66e1c3602d8dbaa6ac73efe4069f47b
refs/heads/master
2021-03-30T18:23:22.781223
2018-12-13T13:52:26
2018-12-13T13:52:26
77,690,581
0
0
null
null
null
null
UTF-8
Java
false
false
2,939
java
package com.robvangastel.assign.domain; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.robvangastel.assign.domain.serializers.PostSerializer; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import javax.persistence.*; import java.io.Serializable; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author Rob van Gastel */ @Entity @Data @EqualsAndHashCode @NoArgsConstructor @JsonSerialize(using = PostSerializer.class) public class Post implements Serializable { private static final long serialVersionUID = 1L; /** * Hashtag parse regex */ private static final String HASHTAG_REGEX = "^#\\w+([.]?\\w+)*|\\s#\\w+([.]?\\w+)*"; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) private Long id; @OneToOne(cascade = CascadeType.ALL) private User user; @OneToMany(mappedBy = "post", cascade = CascadeType.ALL, orphanRemoval = true) @LazyCollection(LazyCollectionOption.FALSE) private List<Reply> replies = new ArrayList<>(); @ElementCollection @LazyCollection(LazyCollectionOption.FALSE) private List<String> tags = new ArrayList<>(); @Column(nullable = false) private String title; @Column(nullable = false) private String description; @Column(nullable = false) private String url; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm") private Timestamp dateCreated; private boolean done; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm") private Timestamp dateDone; /*** * * @param user * @param title * @param description */ public Post(User user, String title, String description) { this.user = user; this.title = title; this.description = description; this.done = false; List<String> hashtags = new ArrayList<>(); Pattern HASHTAG_PATTERN = Pattern.compile(HASHTAG_REGEX); Matcher matcher = HASHTAG_PATTERN.matcher(description); while (matcher.find()) { hashtags.add(matcher.group().replace(" ", "").replace("#", "")); } this.tags = hashtags; } @PrePersist public void beforePersist() { this.dateCreated = new java.sql.Timestamp(Calendar.getInstance().getTimeInMillis()); } public void setDone(boolean done) { if (done) { this.done = true; this.dateDone = new java.sql.Timestamp(Calendar.getInstance().getTimeInMillis()); } else { this.done = false; this.dateDone = null; } } }
[ "robvangastel@hotmail.com" ]
robvangastel@hotmail.com
f8ff3bf1980fcc97790a48a0f641c542cc95e0a7
c921f4decb8ce2e1e4fd63552ad4c1628eb3544e
/src/MyCommentGenerator.java
d94cb36da0b64d30327bd8af5b1197f04f6ac18b
[]
no_license
uu04418/mybatisCustomer
c5a7d144a3dcd553707f63db86c770d8d5d10767
eec58f6a7cfecca20bc2b6fc32c8b470cb4638c6
refs/heads/master
2020-04-17T16:49:42.684542
2019-01-21T06:10:50
2019-01-21T06:10:50
166,757,625
0
0
null
null
null
null
UTF-8
Java
false
false
2,306
java
import java.util.Properties; import org.mybatis.generator.api.CommentGenerator; import org.mybatis.generator.api.IntrospectedColumn; import org.mybatis.generator.api.IntrospectedTable; import org.mybatis.generator.api.dom.java.CompilationUnit; import org.mybatis.generator.api.dom.java.Field; import org.mybatis.generator.api.dom.java.InnerClass; import org.mybatis.generator.api.dom.java.InnerEnum; import org.mybatis.generator.api.dom.java.Method; import org.mybatis.generator.api.dom.xml.XmlElement; public class MyCommentGenerator implements CommentGenerator{ @Override public void addClassComment(InnerClass arg0, IntrospectedTable arg1) { // TODO Auto-generated method stub } @Override public void addClassComment(InnerClass arg0, IntrospectedTable arg1, boolean arg2) { // TODO Auto-generated method stub } @Override public void addComment(XmlElement arg0) { // TODO Auto-generated method stub } @Override public void addConfigurationProperties(Properties arg0) { // TODO Auto-generated method stub } @Override public void addEnumComment(InnerEnum arg0, IntrospectedTable arg1) { // TODO Auto-generated method stub } @Override public void addFieldComment(Field arg0, IntrospectedTable arg1) { // TODO Auto-generated method stub } @Override public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) { if(introspectedColumn.getRemarks() != null) { field.addJavaDocLine("/** " + introspectedColumn.getRemarks() + "*/"); } } @Override public void addGeneralMethodComment(Method arg0, IntrospectedTable arg1) { // TODO Auto-generated method stub } @Override public void addGetterComment(Method arg0, IntrospectedTable arg1, IntrospectedColumn arg2) { // TODO Auto-generated method stub } @Override public void addJavaFileComment(CompilationUnit arg0) { // TODO Auto-generated method stub } @Override public void addRootComment(XmlElement arg0) { // TODO Auto-generated method stub } @Override public void addSetterComment(Method arg0, IntrospectedTable arg1, IntrospectedColumn arg2) { // TODO Auto-generated method stub } }
[ "lucy" ]
lucy
d7223f074f2d1b05387772a61d8a00aeb95fdb46
0849ddead5794f6774e2f63f5f8664702660dd0a
/app/src/androidTest/java/com/example/proyectoprotectora/ExampleInstrumentedTest.java
3336c80af4d966709c3cabcc2b387d4bafbfe386
[]
no_license
Murdistino/ProyectoProtectora
b70c8e8809b235bdcf3203b6e48922a31f4f1e6f
7ce7aa2ca29cbcf9d91c5e33c2979513250d6fd3
refs/heads/master
2021-02-26T22:34:26.273923
2020-03-07T03:02:43
2020-03-07T03:02:43
244,316,809
0
0
null
null
null
null
UTF-8
Java
false
false
776
java
package com.example.proyectoprotectora; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.proyectoprotectora", appContext.getPackageName()); } }
[ "andreamaria.roca10@gmail.com" ]
andreamaria.roca10@gmail.com
56ba7173f666d99e7de313da8b94e07174483209
61a0772cdd94160470f536ff9bce8e111f1e8e1d
/greenback-kit-core/src/main/java/com/greenback/kit/model/Contact.java
2ce614510cca6c83827f89f6e1d3c15ef9abb5ed
[ "Apache-2.0" ]
permissive
PR0CUR8T0R/greenback-java
e0fa4bc216e02cd1d0ffc1705c1b532ee930830b
b4945c76abc8218ffaffc7e0a7f6ab6dbc99b4a3
refs/heads/master
2023-04-02T06:54:44.945463
2021-04-07T23:36:56
2021-04-07T23:36:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
864
java
package com.greenback.kit.model; public class Contact { private String id; private String domain; private String name; private String email; private String logoUrl; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDomain() { return domain; } public void setDomain(String domain) { this.domain = domain; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getLogoUrl() { return logoUrl; } public void setLogoUrl(String logoUrl) { this.logoUrl = logoUrl; } }
[ "joe@lauer.bz" ]
joe@lauer.bz
a57bf5d3ae53a053e84bfbd97479530a2462d30b
3df1650e4fc16043b3fcb5d358ed5991a9b94228
/SpringTDL/src/test/java/com/qa/SpringTDL/persistance/domain/TaskDomainTest.java
d429bb2bfa69ac4e3c1c8a8e604950794d88107e
[]
no_license
awatahirqa/TDL-Project
07f2a7882fcfccd7f48553286ad83c5aac26feca
c8112dff676aa4b7408119d3ef49ced6b388fd4c
refs/heads/main
2023-03-07T18:16:46.602987
2021-02-16T17:37:22
2021-02-16T17:37:22
335,984,126
0
0
null
2021-02-16T17:36:26
2021-02-04T14:45:18
Java
UTF-8
Java
false
false
975
java
package com.qa.springtdl.persistance.domain; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import com.qa.springtdl.persistance.domain.TasksDomain; @SpringBootTest public class TaskDomainTest { private TasksDomain task; @Test public void setterGetterTest() { task = new TasksDomain(1L, "Simple task to test my domain", 2, "01-01-2021", null, "Ongoing"); Assertions.assertNotNull(task); task.setTaskId(1L); task.setSummary("Simple task to test my domain"); task.setPriority(2); task.setDeadline("01-01-2021"); task.setMyList(null); task.setStatus("ongoing"); Assertions.assertNotNull(task.getTaskId()); Assertions.assertNotNull(task.getSummary()); Assertions.assertNotNull(task.getPriority()); Assertions.assertNotNull(task.getDeadline()); Assertions.assertNull(task.getMyList()); Assertions.assertNotNull(task.getStatus()); } }
[ "WTahir@qa.com" ]
WTahir@qa.com
754d71f4322cf8cbe6564408b69ce7f219d0c1c4
b4eeb08f2dae9b78296c06b119a62454bcb4f167
/src/main/java/com/kwery/dao/JobExecutionDao.java
da46a15ac595fd930ba7766cc53836f1c1063f12
[]
no_license
waifei/kwery
9af04b9cca2c35790fe45c38b15e022ed428b10c
c4098e5372998012a3c83b58bd44085bf52f6d14
refs/heads/master
2020-03-19T20:28:10.522643
2018-05-21T17:46:40
2018-05-21T17:46:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,073
java
package com.kwery.dao; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.persist.Transactional; import com.kwery.models.JobExecutionModel; import com.kwery.services.job.JobExecutionSearchFilter; import javax.persistence.EntityManager; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; import java.util.LinkedList; import java.util.List; import static com.kwery.models.JobExecutionModel.Status.SUCCESS; public class JobExecutionDao { @Inject private Provider<EntityManager> entityManagerProvider; @Transactional public JobExecutionModel save(JobExecutionModel e) { EntityManager m = entityManagerProvider.get(); if (e.getId() != null && e.getId() > 0) { e = m.merge(e); } else { m.persist(e); } m.flush(); return e; } @Transactional public JobExecutionModel getById(Integer id) { return entityManagerProvider.get().find(JobExecutionModel.class, id); } @SuppressWarnings("unchecked") @Transactional public JobExecutionModel getByExecutionId(String executionId) { JobExecutionSearchFilter filter = new JobExecutionSearchFilter(); filter.setExecutionId(executionId); List<JobExecutionModel> executions = filter(filter); if (executions.size() == 0) { return null; } return executions.get(0); } @Transactional public List<JobExecutionModel> filter(JobExecutionSearchFilter filter) { if (filter.getPageNumber() > 0) { Preconditions.checkArgument(filter.getResultCount() > 0, "Result count cannot be zero if page number is set"); } EntityManager m = entityManagerProvider.get(); CriteriaBuilder c = m.getCriteriaBuilder(); CriteriaQuery<JobExecutionModel> q = c.createQuery(JobExecutionModel.class); Root<JobExecutionModel> root = q.from(JobExecutionModel.class); List<Predicate> predicates = new LinkedList<>(); if (filter.getJobId() != 0) { predicates.add(c.equal(root.get("jobModel").get("id"), filter.getJobId())); } if (filter.getExecutionStartStart() != 0) { predicates.add(c.greaterThan(root.get("executionStart"), filter.getExecutionStartStart())); } if (filter.getExecutionStartEnd() != 0) { predicates.add(c.lessThan(root.get("executionStart"), filter.getExecutionStartEnd())); } if (filter.getExecutionEndStart() != 0) { predicates.add(c.greaterThan(root.get("executionEnd"), filter.getExecutionEndStart())); } if (filter.getExecutionEndEnd() != 0) { predicates.add(c.lessThan(root.get("executionEnd"), filter.getExecutionEndEnd())); } if (filter.getStatuses() != null && !filter.getStatuses().isEmpty()) { predicates.add(root.get("status").in(filter.getStatuses())); } if (!"".equals(Strings.nullToEmpty(filter.getExecutionId()))) { predicates.add(c.equal(root.get("executionId"), filter.getExecutionId())); } q.where(predicates.toArray(new Predicate[]{})); q.orderBy(c.desc(root.get("executionStart"))); if (filter.getResultCount() == 0) { return m.createQuery(q).getResultList(); } else { return m.createQuery(q) .setMaxResults(filter.getResultCount()) .setFirstResult(filter.getPageNumber() * filter.getResultCount()) .getResultList(); } } @Transactional public long count(JobExecutionSearchFilter filter) { EntityManager m = entityManagerProvider.get(); CriteriaBuilder c = m.getCriteriaBuilder(); CriteriaQuery<Long> q = c.createQuery(Long.class); Root<JobExecutionModel> root = q.from(JobExecutionModel.class); q.select(c.count(root)); List<Predicate> predicates = new LinkedList<>(); if (filter.getJobId() != 0) { predicates.add(c.equal(root.get("jobModel").get("id"), filter.getJobId())); } if (filter.getExecutionStartStart() != 0) { predicates.add(c.greaterThan(root.get("executionStart"), filter.getExecutionStartStart())); } if (filter.getExecutionStartEnd() != 0) { predicates.add(c.lessThan(root.get("executionStart"), filter.getExecutionStartEnd())); } if (filter.getExecutionEndStart() != 0) { predicates.add(c.greaterThan(root.get("executionEnd"), filter.getExecutionEndStart())); } if (filter.getExecutionEndEnd() != 0) { predicates.add(c.lessThan(root.get("executionEnd"), filter.getExecutionEndEnd())); } if (filter.getStatuses() != null && !filter.getStatuses().isEmpty()) { predicates.add(root.get("status").in(filter.getStatuses())); } if (!"".equals(Strings.nullToEmpty(filter.getExecutionId()))) { predicates.add(c.equal(root.get("executionId"), filter.getExecutionId())); } q.where(predicates.toArray(new Predicate[]{})); return m.createQuery(q).getSingleResult(); } @Transactional public void deleteByJobId(int jobId) { EntityManager m = entityManagerProvider.get(); JobExecutionSearchFilter filter = new JobExecutionSearchFilter(); filter.setJobId(jobId); List<JobExecutionModel> jobExecutionModels = filter(filter); for (JobExecutionModel jobExecutionModel : jobExecutionModels) { m.remove(jobExecutionModel); } } @Transactional public List<JobExecutionModel> lastSuccessfulExecution(List<Integer> jobIds) { //TODO - Simplify EntityManager m = entityManagerProvider.get(); List<JobExecutionModel> jobExecutions = new LinkedList<>(); for (Integer jobId : jobIds) { JobExecutionModel jobExecutionModel = m.createQuery( "select e from JobExecutionModel e where e.status = :status and e.jobModel.id = :jobModelId and e.executionEnd is not null order by e.executionEnd desc", JobExecutionModel.class ).setParameter("jobModelId", jobId) .setParameter("status", SUCCESS) .setMaxResults(1) .getSingleResult(); if (jobExecutionModel != null) { jobExecutions.add(jobExecutionModel); } } return jobExecutions; } @Transactional public void deleteJobExecutions(List<Integer> jobExecutionIds) { EntityManager m = entityManagerProvider.get(); for (Integer jobExecutionId : jobExecutionIds) { m.remove(m.find(JobExecutionModel.class, jobExecutionId)); } } }
[ "abhyrama@gmail.com" ]
abhyrama@gmail.com
97dc998ca3baf4389afeec739dadde7e73b5e63a
26da0aea2ab0a2266bbee962d94a96d98a770e5f
/nam/nam-view/src/main/java/nam/model/domain/DomainInfoManager.java
27c3ff3825f0836c971da7436a2b8daaf3bf6abb
[ "Apache-2.0" ]
permissive
tfisher1226/ARIES
1de2bc076cf83488703cf18f7e3f6e3c5ef1b40b
814e3a4b4b48396bcd6d082e78f6519679ccaa01
refs/heads/master
2021-01-10T02:28:07.807313
2015-12-10T20:30:00
2015-12-10T20:30:00
44,076,313
2
0
null
null
null
null
UTF-8
Java
false
false
6,014
java
package nam.model.domain; import java.io.Serializable; import java.util.List; import javax.enterprise.context.SessionScoped; import javax.enterprise.event.Observes; import javax.inject.Inject; import javax.inject.Named; import org.aries.runtime.BeanContext; import org.aries.ui.Display; import org.aries.ui.event.Add; import org.aries.ui.event.Remove; import org.aries.util.Validator; import nam.model.Domain; import nam.model.Project; import nam.model.util.DomainUtil; import nam.model.util.ProjectUtil; import nam.ui.design.AbstractNamRecordManager; import nam.ui.design.SelectionContext; import nam.ui.design.WorkspaceEventManager; @SessionScoped @Named("domainInfoManager") public class DomainInfoManager extends AbstractNamRecordManager<Domain> implements Serializable { @Inject private DomainWizard domainWizard; @Inject private DomainDataManager domainDataManager; @Inject private DomainPageManager domainPageManager; @Inject private DomainEventManager domainEventManager; @Inject private WorkspaceEventManager workspaceEventManager; @Inject private DomainHelper domainHelper; @Inject private SelectionContext selectionContext; public DomainInfoManager() { setInstanceName("domain"); } public Domain getDomain() { return getRecord(); } public Domain getSelectedDomain() { return selectionContext.getSelection("domain"); } @Override public Class<Domain> getRecordClass() { return Domain.class; } @Override public boolean isEmpty(Domain domain) { return domainHelper.isEmpty(domain); } @Override public String toString(Domain domain) { return domainHelper.toString(domain); } @Override public void initialize() { Domain domain = selectionContext.getSelection("domain"); if (domain != null) initialize(domain); } protected void initialize(Domain domain) { domainWizard.initialize(domain); setContext("domain", domain); } @Override public String newRecord() { return newDomain(); } public String newDomain() { try { Domain domain = create(); selectionContext.resetOrigin(); selectionContext.setSelection("domain", domain); String url = domainPageManager.initializeDomainCreationPage(domain); domainPageManager.pushContext(domainWizard); initialize(domain); return url; } catch (Exception e) { handleException(e); return null; } } @Override public Domain create() { Domain domain = DomainUtil.create(); return domain; } @Override public Domain clone(Domain domain) { domain = DomainUtil.clone(domain); return domain; } @Override public String viewRecord() { return viewDomain(); } public String viewDomain() { Domain domain = selectionContext.getSelection("domain"); String url = viewDomain(domain); return url; } public String viewDomain(Domain domain) { try { String url = domainPageManager.initializeDomainSummaryView(domain); domainPageManager.pushContext(domainWizard); initialize(domain); return url; } catch (Exception e) { handleException(e); return null; } } @Override public String editRecord() { return editDomain(); } public String editDomain() { Domain domain = selectionContext.getSelection("domain"); String url = editDomain(domain); return url; } public String editDomain(Domain domain) { try { //domain = clone(domain); selectionContext.resetOrigin(); selectionContext.setSelection("domain", domain); String url = domainPageManager.initializeDomainUpdatePage(domain); domainPageManager.pushContext(domainWizard); initialize(domain); return url; } catch (Exception e) { handleException(e); return null; } } public void saveDomain() { Domain domain = getDomain(); if (validateDomain(domain)) { if (isImmediate()) persistDomain(domain); outject("domain", domain); } } public void persistDomain(Domain domain) { saveDomain(domain); } public void saveDomain(Domain domain) { try { saveDomainToSystem(domain); domainEventManager.fireAddedEvent(domain); } catch (Exception e) { handleException(e); } } protected void saveDomainToSystem(Domain domain) { domainDataManager.saveDomain(domain); } public void handleSaveDomain(@Observes @Add Domain domain) { saveDomain(domain); } public void addDomain(Domain domain) { try { //TODO } catch (Exception e) { handleException(e); } } public void enrichDomain(Domain domain) { //nothing for now } @Override public boolean validate(Domain domain) { return validateDomain(domain); } public boolean validateDomain(Domain domain) { Validator validator = getValidator(); boolean isValid = DomainUtil.validate(domain); Display display = getFromSession("display"); display.setModule("domainInfo"); display.addErrors(validator.getMessages()); //FacesContext.getCurrentInstance().isValidationFailed() setValidated(isValid); return isValid; } public void promptRemoveDomain() { display = getFromSession("display"); display.setModule("domainInfo"); Domain domain = selectionContext.getSelection("domain"); if (domain == null) { display.error("Domain record must be selected."); } } public String handleRemoveDomain(@Observes @Remove Domain domain) { display = getFromSession("display"); display.setModule("domainInfo"); try { display.info("Removing Domain "+DomainUtil.getLabel(domain)+" from the system."); removeDomainFromSystem(domain); selectionContext.clearSelection("domain"); domainEventManager.fireClearSelectionEvent(); domainEventManager.fireRemovedEvent(domain); workspaceEventManager.fireRefreshEvent(); return null; } catch (Exception e) { handleException(e); return null; } } protected void removeDomainFromSystem(Domain domain) { if (domainDataManager.removeDomain(domain)) setRecord(null); } public void cancelDomain() { BeanContext.removeFromSession("domain"); domainPageManager.removeContext(domainWizard); } }
[ "tfisher@kattare.com" ]
tfisher@kattare.com
984b7436df066e6945680228ed3027bf3dc11051
937bfd7b540567864bf2dbea3253b41fe39ca535
/lab-jdbc/src/test/java/DepartamentoDAOTest.java
85809fb9158a6cd56d73a0cc4cc9bbc6d5a65e8d
[]
no_license
vanborges/lbd-prog-jdbc
4eb784b26c7f6f940736f82ae82e7b9134638569
3fda3d56da0c73aadedbfd19aea98de31aec3c85
refs/heads/master
2022-12-06T01:46:51.930643
2021-11-04T01:32:19
2021-11-04T01:32:19
215,858,503
0
0
null
2022-11-23T22:18:00
2019-10-17T18:21:00
Java
UTF-8
Java
false
false
1,070
java
import model.bean.Departamento; import model.dao.DepartamentoDAO; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.List; class DepartamentoDAOTest { @BeforeEach void setUp() { } @AfterEach void tearDown() { } @Test public void testInsert() { System.out.println("insert"); Departamento d = new Departamento("Computaรงรฃo", 2); DepartamentoDAO dao = new DepartamentoDAO(); if(dao.insert(d)){ System.out.println("Salvo com sucesso "+d.toString()); } else { Assertions.fail("Erro ao salvar"); } } @Test void selectbyid() { System.out.println("selecionar"); DepartamentoDAO dao = new DepartamentoDAO(); List<Departamento> ld = dao.selectbyid(2); if (ld.isEmpty()) { Assertions.fail("Erro ao salvar"); } else { System.out.println(ld.toString()); } } }
[ "va.borges@gmail.com" ]
va.borges@gmail.com
1ce9d82a514d1e891abaf13cbf9406e4505879d7
202ddc6a9a167efbb99cfc487455e0987ffa272a
/src/test/java/filrouge/test/SpringTest.java
748d68bb53a4c5fa2dd5b278cb1ce944f560680f
[]
no_license
MickaelClosier/ProjetFilRouge
d141b01454008e7c7b1643c3c7f38c34dc161719
bd3501966ca98a921f4cd960ab5c6d8c35993423
refs/heads/master
2022-07-31T17:32:35.262016
2019-08-28T10:05:00
2019-08-28T10:05:00
203,324,299
0
0
null
2022-07-06T20:28:48
2019-08-20T07:35:26
Java
UTF-8
Java
false
false
2,758
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 filrouge.test; import filrouge.dao.ArticleDAOCrud; import filrouge.dao.CommentaireDAOCrud; import filrouge.dao.UtilisateurDAOCrud; import filrouge.entity.Article; import filrouge.entity.Comment; import filrouge.entity.Utilisateur; import filrouge.spring.SpringConfig; import org.junit.Test; import static org.junit.Assert.*; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; /** * * @author pauld */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = SpringConfig.class) @Rollback(false) public class SpringTest { @Autowired private UtilisateurDAOCrud daoU; @Autowired private CommentaireDAOCrud daoC; @Autowired private ArticleDAOCrud daoA; @Test @Transactional public void creerUtilisateurOK() { Utilisateur u = new Utilisateur(); u.setUserName("Paul"); u.setUserMail("paul@paul.mail"); u.setUserPassword("1234"); daoU.save(u); } @Test @Transactional public void creerCommentaireOK() { Utilisateur u = new Utilisateur(); u.setUserName("UComment"); u.setUserMail("comment@comment.mail"); u.setUserPassword("1234"); daoU.save(u); Article a = new Article(); a.setArticleTags("COMENNTAIRE tag, tag, tag"); a.setArticleMainPhoto("COMENNTAIRE urlmainphoto.png"); a.setArticleMainTitle("COMENNTAIRE titre principal article"); a.setArticleTitle1("COMENNTAIRE titre paragraphe 1"); a.setArticleParagraph1("COMENNTAIRE contenu paragraphe 1"); daoA.save(a); Comment c = new Comment(); c.setUtilisateur(u); c.setArticle(a); c.setCommentContain("contenu commenaire"); daoC.save(c); } @Test @Transactional public void creerArticleOK() { Article a = new Article(); a.setArticleTags("tag, tag, tag"); a.setArticleMainPhoto("urlmainphoto.png"); a.setArticleMainTitle("titre principal article"); a.setArticleTitle1("titre paragraphe 1"); a.setArticleParagraph1("contenu paragraphe 1"); daoA.save(a); } }
[ "pauld@DESKTOP-MJO85IH" ]
pauld@DESKTOP-MJO85IH
7349dbf0e14addf4e408b4651ba95313ed4ab604
36e5d2a178580da987ca6ce6cfb910033d2d381a
/src/medium/SumRootToLeafNumbers.java
831294c3b815c44877fd42952818ab22a851c482
[]
no_license
frogfrogfrog/LeetCode
649e84706d9c9ca43b4e92e98f411b16b1aabb23
728e9db9e0aa7660232aa7951fcb77f5bdf09c97
refs/heads/master
2020-05-21T04:39:35.398561
2017-12-19T06:50:05
2017-12-19T06:50:05
52,369,186
1
0
null
null
null
null
UTF-8
Java
false
false
511
java
package medium; /** * Created by 42160 on 2016/12/25. */ public class SumRootToLeafNumbers { public int sumNumbers(TreeNode root) { return sumRootToLeaf(root, 0); } public int sumRootToLeaf(TreeNode node, int pathSum) { if (node == null) return 0; pathSum = pathSum * 10 + node.val; if (node.left == null && node.right == null) return pathSum; return sumRootToLeaf(node.left, pathSum) + sumRootToLeaf(node.right, pathSum); } }
[ "421604505@qq.com" ]
421604505@qq.com
bdaeafd1bb3a2fe8e340fb1f4d5732206f45dc1c
bc423abe83af278f7ac441d141e528676c94945e
/src/main/java/com/ad/MVCPractice/config/MvcConfiguration.java
d005d7ff88fa13d5b927e8e03e5e53d187084aa6
[]
no_license
bhisma-adhikari/MVCPractice
604616370422e8d96d17bc9f30fbb6cfc712df7a
58e75f856b4db6d3a5b414ba0aba5cb9e0e35afe
refs/heads/master
2023-06-13T06:15:39.849149
2021-07-08T05:01:57
2021-07-08T05:01:57
381,448,835
0
0
null
null
null
null
UTF-8
Java
false
false
1,108
java
package com.ad.MVCPractice.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @ComponentScan(basePackages="com.ad.MVCPractice") @EnableWebMvc public class MvcConfiguration extends WebMvcConfigurerAdapter{ @Bean public ViewResolver getViewResolver(){ InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); return resolver; } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); } }
[ "adhikab@miamioh.edu" ]
adhikab@miamioh.edu
33446d66c3822aefeba39d0665da94b4cbf01992
178c6718975e10c930e5e4584a47c5c716f7732b
/src/com/syntax/class013/SmartPhone.java
f0e4079c47c384bdfd807925a9f55a3dab074b1a
[]
no_license
ergunjon/JavaBatch8
86afb8bc8d4c328b3d48e4c9f94c47044e8afd32
ed3a7c35865a859dde40e05e5cff54913c1c3a61
refs/heads/main
2023-01-04T06:01:26.193430
2020-11-02T00:05:55
2020-11-02T00:05:55
304,907,896
0
0
null
null
null
null
UTF-8
Java
false
false
671
java
package com.syntax.class013; public class SmartPhone { String brand; String color; String model; void text(String text) { System.out.println(brand + " can text"); } void pics(String camera) { System.out.println(brand + " can take a picture very "+camera); } void call(String phoneNumber){ System.out.println("Calling "+phoneNumber); } public static void main(String[] args) { SmartPhone phone=new SmartPhone(); phone.brand="iPhone"; phone.color="Black"; phone.model="11 Pro"; phone.text("Hi"); phone.pics("Clear"); phone.call("123456789"); } }
[ "ergunjon@gmail.com" ]
ergunjon@gmail.com
13ee71dc6a52d9235cf813398cbf1bacf274adb5
6b7ca135fa29731ce5d93b6b685b5cfdd5e08015
/src/linkedlist/_379_DesignPhoneDirectory.java
6061973a9561fcdd70a6f152c581c9a46a9d4d64
[]
no_license
ShengweiWang/Coding-Training
777f73a5bd23d30749e21e889f1eac6f6ac913bd
a6369cd44bfb028c12dc61ef2a70964dbe49d668
refs/heads/master
2020-12-24T06:46:33.797829
2017-01-03T04:12:31
2017-01-03T04:12:31
57,247,060
0
1
null
null
null
null
UTF-8
Java
false
false
1,181
java
package linkedlist; import java.util.LinkedList; import java.util.Queue; /** * Created by Shengwei_Wang on 9/27/16. */ public class _379_DesignPhoneDirectory { boolean[] available; Queue<Integer> q; /** Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. */ public _379_DesignPhoneDirectory(int maxNumbers) { q = new LinkedList<Integer>(); available = new boolean[maxNumbers]; for(int i = 0; i < maxNumbers; ++i) q.offer(i); } /** Provide a number which is not assigned to anyone. @return - Return an available number. Return -1 if none is available. */ public int get() { if(q.size() == 0) return -1; int res = q.poll(); available[res] = true; return res; } /** Check if a number is available or not. */ public boolean check(int number) { return !available[number]; } /** Recycle or release a number. */ public void release(int number) { if(available[number]){ available[number] = false; q.offer(number); } } }
[ "wave4721@gmail.com" ]
wave4721@gmail.com
84f7f5b489f5eb3e5dcf9b1ceeb3813740fe198f
62d8eedc9a1066ba779cd47f97b530e05155920d
/src/main/java/br/com/tddspring/cursotddspringudemy/api/dto/LoanFilterDTO.java
c4b4e6e9850739fac60cdea85f4c626b85e8ed4d
[]
no_license
RobertoSouzaSilva/tddudemy
99a960831f82c227bd3fbc866637668c5d9fcacb
d0d3b9b4c65550a58e0ab77180f435b7622378e1
refs/heads/master
2022-04-27T00:08:13.779096
2020-05-01T22:35:15
2020-05-01T22:35:15
260,567,734
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
package br.com.tddspring.cursotddspringudemy.api.dto; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor @Builder public class LoanFilterDTO { private String isbn; private String customer; }
[ "robertosouza57@yahoo.com.br" ]
robertosouza57@yahoo.com.br
5f32b1b694504a693438e7182b6d65315a279be1
63fbdc2728be87b0da9a0398b7f692ef4cc1cfed
/src/main/java/edu/ksu/cis/macr/ipds/primary/plans/forecast_neighborhood/package-info.java
c22d2dadfc3d590351033fecf73a4c854811d763
[]
no_license
m-engels/ksucase-ipds
542e57c7cb118648622425da2715a33ea95c9918
b5cfcf8c1f138a8eae8ff57b30474ebd93f6d27e
refs/heads/master
2020-03-13T02:58:04.307822
2018-04-25T02:50:48
2018-04-25T02:50:48
130,934,964
0
0
null
null
null
null
UTF-8
Java
false
false
156
java
/** * Provides the plan classes to provide forecasts for neighborhood-level agents. */ package edu.ksu.cis.macr.ipds.primary.plans.forecast_neighborhood;
[ "mjengels@ksu.edu" ]
mjengels@ksu.edu
327f481ec20d7dec38095e001856e63a42b05ae3
b8edd9e887333a214da8fdbceb19e0718f0ccf78
/core/src/main/java/com/mcintyret/jvm/core/opcode/math/add/FAdd.java
093fa5c4908f3cc5da27df6f637aff4bdee70bd7
[]
no_license
mcintyret/jvm
19714d1a3b968a761bd28c6b6ce68af912799dc1
21750ff0685d0335daf87498725c7f1f5bb6c69c
refs/heads/master
2016-09-10T15:00:56.022990
2016-02-04T14:09:07
2016-02-04T14:09:07
19,899,253
18
2
null
null
null
null
UTF-8
Java
false
false
302
java
package com.mcintyret.jvm.core.opcode.math.add; import com.mcintyret.jvm.core.opcode.BinaryFloatOp; class FAdd extends BinaryFloatOp { @Override protected float binaryOp(float a, float b) { return a + b; } @Override public byte getByte() { return 0x62; } }
[ "tom.mcintyre5@gmail.com" ]
tom.mcintyre5@gmail.com
9d89a5341c3c38209273d1c953fc011217cfa6e3
3f76bd050baf173983c4ad948393c3f17c0b9304
/M_13_Hibernate/src/test/java/com/kodilla/hibernate/invoice/dao_1303/InvoiceDaoTestSuite.java
ae02ff956aaaca4ab325826326c30f0346eead20
[]
no_license
ISKRAA777/Aleksander-Iskra-kodilla-java
72410ebfa597bfdb1c46195c703dd6f1a04678c9
0701b0529f1d99b679e1cc92836cf47a152a91bf
refs/heads/master
2020-11-24T07:42:49.000286
2020-04-22T15:30:24
2020-04-22T15:30:24
228,034,149
0
0
null
null
null
null
UTF-8
Java
false
false
1,740
java
package com.kodilla.hibernate.invoice.dao_1303; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.transaction.Transactional; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @Transactional @RunWith(SpringRunner.class) @SpringBootTest public class InvoiceDaoTestSuite { @Autowired InvoiceDao invoiceDao; @Test public void testInvoiceDaoSave() { //Given Invoice invoice = new Invoice("26/02/2020"); Product cocaCola = new Product("coca-cola"); Product fanta = new Product("fanta"); Product snikers = new Product("snikers"); Item itemcocaCola = new Item(cocaCola, new BigDecimal(3), 2); Item itemFanta = new Item(fanta, new BigDecimal(2), 1); Item itemSnikers = new Item(snikers, new BigDecimal(4), 1); itemcocaCola.setInvoice(invoice); itemFanta.setInvoice(invoice); itemSnikers.setInvoice(invoice); List<Item> items = new ArrayList<>(); items.add(itemcocaCola); items.add(itemFanta); items.add(itemSnikers); invoice.setItems(items); //When invoiceDao.save(invoice); int invoiceId = invoice.getId(); int itemSize = invoice.getItems().size(); Invoice invoiceReadFromDB = invoiceDao.findById(invoiceId); //Then Assert.assertEquals(invoiceId, invoiceReadFromDB.getId()); Assert.assertEquals(3, itemSize); Assert.assertEquals(itemSize, invoiceReadFromDB.getItems().size()); } }
[ "ia007@interia.pl" ]
ia007@interia.pl
1b48ef23d7045a32decd830ba0099a53bda37cb3
4bfb15b513883e5e80a3e859c5cf807932bfb8e4
/sdk/src/com/sharethis/loopy/sdk/ShareDialogFragment.java
14118273de7244972568a466573216ac272343c0
[ "Apache-2.0" ]
permissive
socialize/loopy-sdk-android
3fa8cfaf811f26afaf84da831c7ef4af8bcfc956
a1decd803adf94770e581b315010eee8e32ed9a1
refs/heads/master
2021-01-17T05:24:28.998558
2016-03-06T14:17:11
2016-03-06T14:17:11
13,255,671
4
2
null
2014-03-24T16:31:28
2013-10-01T21:04:34
Java
UTF-8
Java
false
false
167
java
package com.sharethis.loopy.sdk; import android.app.DialogFragment; /** * @author Jason Polites */ public class ShareDialogFragment extends DialogFragment { }
[ "jason.polites@gmail.com" ]
jason.polites@gmail.com
cf7df131539ebe8db2840de501bcc412462c8e9b
2aea7587718d5eebae2689933d089815d70b0628
/src/test/java/com/github/grishberg/tests/TestUtils.java
db07386a107bbd59e11ea8a614cb8fd67342cf90
[ "Apache-2.0" ]
permissive
Grigory-Rylov/android-instrumental-test-runner
a481c2a253ac5fa0f92ba4e254b16a5cfd4e04bc
65f15836d7b3e0588901bd25608a11d3376fa92f
refs/heads/master
2023-04-28T02:50:51.357997
2020-10-16T13:43:07
2020-10-16T13:43:07
108,509,396
7
2
null
null
null
null
UTF-8
Java
false
false
711
java
package com.github.grishberg.tests; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; /** * Created by grishberg on 28.04.18. */ public class TestUtils { public static List<String> readFile(String fileName) throws Exception{ ArrayList<String> lines = new ArrayList<>(); try (BufferedReader br = new BufferedReader( new InputStreamReader( new FileInputStream(fileName), "UTF-8"))) { String line; while ((line = br.readLine()) != null) { lines.add(line); } } return lines; } }
[ "grishberg@gmail.com" ]
grishberg@gmail.com
f41a0b7b2d416dd7e627da36cc49696b5d0578af
aa68ad3c5e18e8aad00c00741f562c9d03590e98
/src/main/java/com/github/zmzhoustar/webshell/WebShellApplication.java
7bba2d49366a35e64db89a5605bd98a91b3043e1
[ "Apache-2.0" ]
permissive
snowlavenderlove/web-shell
c4a18d128679e4b39a9b298230bc479d5596eeab
7898bc4c7cea7642fc25b17f53b8d4889869c5cc
refs/heads/main
2023-04-25T22:14:34.004950
2021-05-13T07:23:07
2021-05-13T07:23:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
993
java
package com.github.zmzhoustar.webshell; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import com.github.zmzhoustar.webshell.utils.ThreadPoolUtils; /** * ็จ‹ๅบๅ…ฅๅฃ * @title WebShellApplication * @author zmzhou * @version 1.0 * @date 2021/1/30 23:00 */ @SpringBootApplication @EnableCaching public class WebShellApplication { public static void main(String[] args) { // log4j2ๅ…จๅฑ€ๅผ‚ๆญฅๆ—ฅๅฟ—้…็ฝฎ http://logging.apache.org/log4j/2.x/manual/async.html#AllAsync System.setProperty("Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"); SpringApplication.run(WebShellApplication.class, args); // ๅœๆญขๅบ”็”จๆ—ถ๏ผŒๅ…ณ้—ญ็บฟ็จ‹ๆฑ ้’ฉๅญ๏ผŒๆˆ–่€…ไฝฟ็”จ @PreDestroy ๆณจ่งฃๆ‰ง่กŒไธ€็ณปๅˆ—ๆ“ไฝœ Runtime.getRuntime().addShutdownHook(new Thread(ThreadPoolUtils::shutdown, "ShutdownThreadPoolHook")); } }
[ "zmzhou8@qq.com" ]
zmzhou8@qq.com
7dfdc4be4d875793490439b9a1330f6e5543e96a
c5051a7c967cebc9c8d0633487309a239061212d
/src-gen/org/worklang/serializer/WorkSyntacticSequencer.java
fe740f8902e5d9625a89269a790998c0e16f70aa
[ "Apache-2.0" ]
permissive
aianta/WorkLang
0107b1cb7e2b536060c6549ff986314cd3026d5e
fe6604c50150bb26aead01f7d1a9d886ad6965e2
refs/heads/master
2020-03-16T04:29:04.735490
2018-07-03T19:28:26
2018-07-03T19:28:26
132,512,055
1
0
null
null
null
null
UTF-8
Java
false
false
1,958
java
/* Copyright 2018 Alexandru Ianta 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.worklang.serializer; import com.google.inject.Inject; import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.IGrammarAccess; import org.eclipse.xtext.RuleCall; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias; import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition; import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer; import org.worklang.services.WorkGrammarAccess; @SuppressWarnings("all") public class WorkSyntacticSequencer extends AbstractSyntacticSequencer { protected WorkGrammarAccess grammarAccess; @Inject protected void init(IGrammarAccess access) { grammarAccess = (WorkGrammarAccess) access; } @Override protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) { return ""; } @Override protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) { if (transition.getAmbiguousSyntaxes().isEmpty()) return; List<INode> transitionNodes = collectNodes(fromNode, toNode); for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) { List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax); acceptNodes(getLastNavigableState(), syntaxNodes); } } }
[ "aianta03@gmail.com" ]
aianta03@gmail.com
3fb30c61c5e876cf9d9c68114650a77f95fc6660
6b5a5a16a5760b7d4603da7227a643fcc295068e
/framework-module/bms-common/src/main/java/com/limaila/bms/common/exception/CommonException.java
b93eedf104d2a057470bacb4b195089edd497936
[]
no_license
HusenHuang/BMS
9e0e0c093fa5802af2ba31d7739accbb8570eefc
cffc12b39cda27121b688e66d877f7fc1a5ad6d3
refs/heads/master
2023-03-20T07:42:11.207886
2021-03-23T07:16:28
2021-03-23T07:16:28
291,017,965
0
1
null
null
null
null
UTF-8
Java
false
false
2,411
java
package com.limaila.bms.common.exception; /*** ่ฏดๆ˜Ž: @author MrHuang @date 2020/9/11 15:10 @desc ้€š็”จๅผ‚ๅธธ ***/ public class CommonException extends RuntimeException { /** * Constructs a new runtime exception with {@code null} as its * detail message. The cause is not initialized, and may subsequently be * initialized by a call to {@link #initCause}. */ public CommonException() { super(); } /** * Constructs a new runtime exception with the specified detail message. * The cause is not initialized, and may subsequently be initialized by a * call to {@link #initCause}. * * @param message the detail message. The detail message is saved for * later retrieval by the {@link #getMessage()} method. */ public CommonException(String message) { super(message); } /** * Constructs a new runtime exception with the specified detail message and * cause. <p>Note that the detail message associated with * {@code cause} is <i>not</i> automatically incorporated in * this runtime exception's detail message. * * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A <tt>null</tt> value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @since 1.4 */ public CommonException(String message, Throwable cause) { super(message, cause); } /** * Constructs a new runtime exception with the specified cause and a * detail message of <tt>(cause==null ? null : cause.toString())</tt> * (which typically contains the class and detail message of * <tt>cause</tt>). This constructor is useful for runtime exceptions * that are little more than wrappers for other throwables. * * @param cause the cause (which is saved for later retrieval by the * {@link #getCause()} method). (A <tt>null</tt> value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @since 1.4 */ public CommonException(Throwable cause) { super(cause); } }
[ "husenhuang@can-dao.com" ]
husenhuang@can-dao.com
fef94d2744c1d17301b2c6bbcdddde84d0333c84
1c6eae4b5ebbddce35a2fad77b69189e5290ea2a
/src/design/prototype/work/w5/ConcretePrototypeB.java
c23eb8aa4c0c48cdb1ffb1c349235d93649809ed
[]
no_license
GitHubFeiLong/design
b4d2a07fc4675c469bf40aa5a05ae3c66d2a9382
377b5b08771a7257d9b9a9aa9578ed98f59c8697
refs/heads/master
2023-02-05T01:08:47.905972
2023-01-30T12:51:13
2023-01-30T12:51:13
187,624,865
0
0
null
null
null
null
UTF-8
Java
false
false
1,791
java
package design.prototype.work.w5; import java.util.Objects; /** * ็ฑปๆ่ฟฐ๏ผš * ๅ…ทไฝ“ๅŽŸๅž‹็ฑป * @author cfl * @version 1.0 * @date 2022/12/12 21:43 */ public class ConcretePrototypeB extends Prototype{ //~fields //================================================================================================================== private String classesName; private String size; //~methods //================================================================================================================== public ConcretePrototypeB(String classesName, String size) { this.classesName = classesName; this.size = size; } /** * ๅ…‹้š†ๆŽฅๅฃ * @return */ @Override public Prototype copy() { return new ConcretePrototypeB(this.getClassesName(), this.getSize()); } @Override public String toString() { return "ConcretePrototypeB{" + "classesName='" + classesName + '\'' + ", size='" + size + '\'' + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ConcretePrototypeB that = (ConcretePrototypeB) o; return Objects.equals(classesName, that.classesName) && Objects.equals(size, that.size); } @Override public int hashCode() { return Objects.hash(classesName, size); } public String getClassesName() { return classesName; } public void setClassesName(String classesName) { this.classesName = classesName; } public String getSize() { return size; } public void setSize(String size) { this.size = size; } }
[ "1696741038@qq.com" ]
1696741038@qq.com
2aff014b56d6d7420285e79a55fbfa22edb09443
600df3590cce1fe49b9a96e9ca5b5242884a2a70
/content/public/android/java/src/org/chromium/content/browser/PepperPluginManager.java
231cb725f5b0af16cde9d13848c8e556ed87e566
[ "BSD-3-Clause" ]
permissive
metux/chromium-suckless
efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a
72a05af97787001756bae2511b7985e61498c965
refs/heads/orig
2022-12-04T23:53:58.681218
2017-04-30T10:59:06
2017-04-30T23:35:58
89,884,931
5
3
BSD-3-Clause
2022-11-23T20:52:53
2017-05-01T00:09:08
null
UTF-8
Java
false
false
5,218
java
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.content.browser; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.os.Bundle; import org.chromium.base.Log; import java.util.List; /** * {@link PepperPluginManager} collects meta data about plugins from preloaded android apps * that reply to PEPPERPLUGIN intent query. */ public class PepperPluginManager { private static final String TAG = "cr.PepperPluginManager"; /** * Service Action: A plugin wishes to be loaded in the ContentView must * provide {@link android.content.IntentFilter IntentFilter} that accepts * this action in its AndroidManifest.xml. */ public static final String PEPPER_PLUGIN_ACTION = "org.chromium.intent.PEPPERPLUGIN"; public static final String PEPPER_PLUGIN_ROOT = "/system/lib/pepperplugin/"; // A plugin will specify the following fields in its AndroidManifest.xml. private static final String FILENAME = "filename"; private static final String MIMETYPE = "mimetype"; private static final String NAME = "name"; private static final String DESCRIPTION = "description"; private static final String VERSION = "version"; private static String getPluginDescription(Bundle metaData) { // Find the name of the plugin's shared library. String filename = metaData.getString(FILENAME); if (filename == null || filename.isEmpty()) { return null; } // Find the mimetype of the plugin. Flash is handled in getFlashPath. String mimetype = metaData.getString(MIMETYPE); if (mimetype == null || mimetype.isEmpty()) { return null; } // Assemble the plugin info, according to the format described in // pepper_plugin_list.cc. // (eg. path<#name><#description><#version>;mimetype) StringBuilder plugin = new StringBuilder(PEPPER_PLUGIN_ROOT); plugin.append(filename); // Find the (optional) name/description/version of the plugin. String name = metaData.getString(NAME); String description = metaData.getString(DESCRIPTION); String version = metaData.getString(VERSION); if (name != null && !name.isEmpty()) { plugin.append("#"); plugin.append(name); if (description != null && !description.isEmpty()) { plugin.append("#"); plugin.append(description); if (version != null && !version.isEmpty()) { plugin.append("#"); plugin.append(version); } } } plugin.append(';'); plugin.append(mimetype); return plugin.toString(); } /** * Collects information about installed plugins and returns a plugin description * string, which will be appended to for command line to load plugins. * * @param context Android context * @return Description string for plugins */ // TODO(crbug.com/635567): Fix this properly. @SuppressLint("WrongConstant") public static String getPlugins(final Context context) { StringBuilder ret = new StringBuilder(); PackageManager pm = context.getPackageManager(); List<ResolveInfo> plugins = pm.queryIntentServices( new Intent(PEPPER_PLUGIN_ACTION), PackageManager.GET_SERVICES | PackageManager.GET_META_DATA); for (ResolveInfo info : plugins) { // Retrieve the plugin's service information. ServiceInfo serviceInfo = info.serviceInfo; if (serviceInfo == null || serviceInfo.metaData == null || serviceInfo.packageName == null) { Log.e(TAG, "Can't get service information from %s", info); continue; } // Retrieve the plugin's package information. PackageInfo pkgInfo; try { pkgInfo = pm.getPackageInfo(serviceInfo.packageName, 0); } catch (NameNotFoundException e) { Log.e(TAG, "Can't find plugin: %s", serviceInfo.packageName); continue; } if (pkgInfo == null || (pkgInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) { continue; } Log.i(TAG, "The given plugin package is preloaded: %s", serviceInfo.packageName); String plugin = getPluginDescription(serviceInfo.metaData); if (plugin == null) { continue; } if (ret.length() > 0) { ret.append(','); } ret.append(plugin); } return ret.toString(); } }
[ "enrico.weigelt@gr13.net" ]
enrico.weigelt@gr13.net
9406b05bd6ab86b654fe4b81ef37b814f24522f5
a383b8cf6b63c2075d651c8ed7cd475af149a850
/bitcamp-java-application2-client/src/main/java/com/eomcs/lms/client/MemberDaoProxy.java
3ba3b9e717ca2188ed16c59bbb4d87a55ff169f1
[]
no_license
icewaterdrop/bitcamp-java-20190527
93c0f8189dc7165c924e7575029b215c4497e8f5
fc707617332a1e211a9c16026506fc194c9b91be
refs/heads/master
2020-06-13T20:16:32.503371
2019-11-07T02:49:53
2019-11-07T02:49:53
194,775,343
0
0
null
null
null
null
UTF-8
Java
false
false
2,790
java
package com.eomcs.lms.client; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; import java.sql.Date; import java.util.List; import com.eomcs.lms.dao.MemberDao; import com.eomcs.lms.domain.Board; import com.eomcs.lms.domain.Member; public class MemberDaoProxy implements MemberDao { String host; int port; public MemberDaoProxy(String host, int port) { this.host = host; this.port = port; } @Override public int insert(Member member) throws Exception { try(Socket socket = new Socket(host, port); ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream in = new ObjectInputStream(socket.getInputStream())) { out.writeUTF("/member/add"); out.writeObject(member); out.flush(); if (!in.readUTF().equals("ok")) throw new Exception(in.readUTF()); return 1; } } @SuppressWarnings("unchecked") @Override public List<Member> findAll() throws Exception { try(Socket socket = new Socket(host, port); ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream in = new ObjectInputStream(socket.getInputStream())) { out.writeUTF("/member/list"); out.flush(); if (!in.readUTF().equals("ok")) throw new Exception(in.readUTF()); return (List<Member>)in.readObject(); } } @Override public Member findBy(int no) throws Exception { try(Socket socket = new Socket(host, port); ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream in = new ObjectInputStream(socket.getInputStream())) { out.writeUTF("/member/detail"); out.writeInt(no); out.flush(); if (!in.readUTF().equals("ok")) throw new Exception(in.readUTF()); return (Member)in.readObject(); } } @Override public int update(Member member) throws Exception { try(Socket socket = new Socket(host, port); ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream in = new ObjectInputStream(socket.getInputStream())) { out.writeUTF("/member/update"); out.writeObject(member); out.flush(); if (!in.readUTF().equals("ok")) throw new Exception(in.readUTF()); return 1; } } @Override public int delete(int no) throws Exception { try(Socket socket = new Socket(host, port); ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream in = new ObjectInputStream(socket.getInputStream())) { out.writeUTF("/member/delete"); out.writeInt(no); out.flush(); if (!in.readUTF().equals("ok")) throw new Exception(in.readUTF()); return 1; } } }
[ "ozzang1991@gmail.com" ]
ozzang1991@gmail.com
c0a749f4b4d55d25cd4b2d1d2214621f40a2f8b5
5a03f3610ca6210b62d1e3fba0aae8ff50ed797a
/src/main/java/com/aimprosoft/controller/InternalController.java
e39f3e4d32eb7ec7c7ba635f63ad327caddfa9ce
[]
no_license
WorldInnovation/Department
52a7604addb0462b1a801f462619f86c0ec790a5
de4529b63aef7de699d8ba8e22b5bea1477bfc96
refs/heads/master
2021-01-22T23:05:54.017429
2017-04-10T12:31:02
2017-04-10T12:31:02
85,604,430
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
package com.aimprosoft.controller; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.sql.SQLException; public interface InternalController { void execute(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, SQLException; }
[ "v.varankin@aimprosoft.com" ]
v.varankin@aimprosoft.com
9c39cc94b1d8f74162b7f4f87f5256ff916cf4fb
284401a84b53a0c9f12d4168ecc5af4910ed1612
/TeeDict/jDictExtraDicts/com/teesoft/javadict/kdic/kdicIndex.java
ec7c31290b9b841c7bbb74f5faa413e15cb85b55
[]
no_license
rzel/olunx-com
d59f0b41e33c1835b79a44e054849ac88c5f9f83
911745c417e90c53cf18e99d520bce53eaafdff8
refs/heads/master
2020-05-28T01:09:51.262945
2012-03-20T09:26:41
2012-03-20T09:26:41
40,686,257
0
0
null
null
null
null
UTF-8
Java
false
false
1,899
java
/* * kdicIndex.java * * Created on Aug 5, 2007, 5:34:34 PM * Copyright (C) 2007 Yong Li. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package com.teesoft.javadict.kdic; import com.teesoft.javadict.ByteArrayString; import com.teesoft.javadict.DictItem; import com.teesoft.javadict.ItemList; import com.teesoft.javadict.bucketBase; import com.teesoft.javadict.bucketLet; import java.util.Vector; /** * * @author wind */ public class kdicIndex extends bucketBase{ Vector /*<kdicIndexItem>*/ indexes = new Vector(); public kdicIndex(kdicDict dict,int count) { super(dict); this.dict = dict; indexes.ensureCapacity(count); } public void addIndexItem(kdicIndexItem item) { indexes.addElement(item); } public kdicIndexItem getIndexItem(int index) { return (kdicIndexItem) indexes.elementAt(index); } public int size() { return indexes.size(); } protected bucketLet get(int pos) { if (pos<0 || pos>=indexes.size()) return null; return (bucketLet) indexes.elementAt(pos); } protected Vector getIndexes() { return indexes; } private kdicDict dict; }
[ "olunx@localhost" ]
olunx@localhost
62d5b1a47e2a9a23ce68142df0102ac7e379b69a
600733a146389f023b08d2b6d2a87d4fcdb908ec
/springmvc-rest/src/main/java/com/nehaspring/springmvcrest/services/CustomerService.java
16360f51eccf99d4eaa2db6180f05949b4f4c679
[]
no_license
NehaSpring/springmvc-rest
4a72b1bbbe99d25e4992d07474c6fbbbed5f35d6
50c616bed9e1a00dc07fdbed2db91372341d80e0
refs/heads/master
2023-04-04T19:58:52.113811
2021-04-20T14:59:30
2021-04-20T14:59:30
359,856,207
0
0
null
null
null
null
UTF-8
Java
false
false
515
java
package com.nehaspring.springmvcrest.services; import java.util.List; import com.nehaspring.springmvcrest.api.v1.model.CustomerDTO; public interface CustomerService { List<CustomerDTO> getAllCustomers(); CustomerDTO getCustomerByName(String firstname); CustomerDTO getCustomerById(Long id); CustomerDTO createNewCustomer(CustomerDTO customerDTO); CustomerDTO updateCustomer(Long id, CustomerDTO customerDTO); CustomerDTO patchCustomer(Long id, CustomerDTO customerDTO); void deleteCustomerId(Long id); }
[ "nehapatel.190083@gmail.com" ]
nehapatel.190083@gmail.com
c66a16fac0ca518d609a2a781f3ec08b97e85525
51b299957d2347d7f353481eff1458edfd6f9931
/app/src/main/java/com/lida/cloud/bean/OrderEvaluateBean.java
ae1d8c1573c7c013f457866c727a38720a61554b
[]
no_license
StormFeng/YunZhongLi
adee3a54f6bd7527c83a6c8a52d2d606c4f40f4f
eea5ad46a676cfa5d89659a9c11abac275b5fa19
refs/heads/master
2021-07-04T00:59:35.272986
2017-09-26T02:13:10
2017-09-26T02:13:10
104,295,721
1
2
null
null
null
null
UTF-8
Java
false
false
2,642
java
package com.lida.cloud.bean; import com.google.gson.JsonSyntaxException; import com.midian.base.app.AppException; import com.midian.base.bean.NetResult; import java.util.ArrayList; import java.util.List; /** * ่ฏ„ไปทๅ•†ๅ“ไฟกๆฏ * Created by WeiQingFeng on 2017/8/23. */ public class OrderEvaluateBean extends NetResult { private List<DataBean> data; public static OrderEvaluateBean parse(String json) throws AppException { OrderEvaluateBean res = new OrderEvaluateBean(); try { res = gson.fromJson(json, OrderEvaluateBean.class); } catch (JsonSyntaxException e) { e.printStackTrace(); throw AppException.json(e); } return res; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class DataBean { /** * order_id : 106 * goods_id : 392 * spec_id : 0 * spec_name : ๆ— ่ง„ๆ ผ * goods_name : ๅŽไธบ */ private int order_id; private int goods_id; private int spec_id; private String spec_name; private String goods_name; private String con; private List<String> pics; public String getCon() { return con; } public void setCon(String con) { this.con = con; } public List<String> getPics() { if(pics==null){ pics = new ArrayList<>(); pics.add(""); return pics; } return pics; } public void setPics(List<String> pics) { this.pics = pics; } public int getOrder_id() { return order_id; } public void setOrder_id(int order_id) { this.order_id = order_id; } public int getGoods_id() { return goods_id; } public void setGoods_id(int goods_id) { this.goods_id = goods_id; } public int getSpec_id() { return spec_id; } public void setSpec_id(int spec_id) { this.spec_id = spec_id; } public String getSpec_name() { return spec_name; } public void setSpec_name(String spec_name) { this.spec_name = spec_name; } public String getGoods_name() { return goods_name; } public void setGoods_name(String goods_name) { this.goods_name = goods_name; } } }
[ "1170017470@qq.com" ]
1170017470@qq.com
770fbea02bf48d9c9f52ee9f596e407b3c5a4d4a
782ae9d462e8d3eb4b764952782b5ff2b172aa8e
/app/src/main/java/com/gilat/proyectogilat/MainActivity.java
ebbf2ff5221322a550c351a953e90f6ae207bdeb
[]
no_license
ejcrfrz/ProyectoGilat
ca64e534b6f382f37840d79495fe2038a70beacf
b3726fbebb6461fb47593452e3b85ded9f647316
refs/heads/master
2022-11-20T12:08:50.452359
2020-07-23T22:44:05
2020-07-23T22:44:05
272,250,251
0
0
null
null
null
null
UTF-8
Java
false
false
15,079
java
package com.gilat.proyectogilat; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.Manifest; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Color; import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.text.Editable; import android.text.SpannableString; import android.text.TextUtils; import android.text.TextWatcher; import android.text.style.TextAppearanceSpan; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.SearchView; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.gilat.proyectogilat.Entidades.ConfAntena; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.common.GoogleSignatureVerifier; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.material.navigation.NavigationView; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import org.w3c.dom.Text; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { //RECIBE DEL LOGIN String flag = "NO"; GoogleSignInAccount signInAccount; //VALORES FIREBASE FirebaseAuth mAuth; DatabaseReference mDatabase; String Name_DB; String Email_DB; private final int MY_PERMISSIONS = 1; //VALORES DIALOG Button button_dialog; Button button_close; Button button_logout; TextView editText_name; TextView editText_email; //VALORES NAVIEW DrawerLayout drawerLayout; NavigationView navigationView; Toolbar toolbar; //VALORES BUSCADOR SearchView search; ListaConfAntenaAdapter listaConfAntenaAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); Intent intent2 = getIntent(); flag = intent2.getStringExtra("flag"); //---------------------------------------------------------------------------------------------------------------------- mAuth = FirebaseAuth.getInstance(); mDatabase = FirebaseDatabase.getInstance().getReference(); //---------------------------------------------------------------------------------------------------------------------- SearchView et = (SearchView) findViewById(R.id.buscador); //et.setHintTextColor(Color.GRAY); drawerLayout = findViewById(R.id.drawer_layout); navigationView = findViewById(R.id.nav_view1); toolbar = findViewById(R.id.toolbar1); navigationView.bringToFront(); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawerLayout.addDrawerListener(toggle); toggle.syncState(); //navigationView.setNavigationItemSelectedListener((NavigationView.OnNavigationItemSelectedListener) this); navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.nav_mapa: Intent i = new Intent(MainActivity.this, MapaUserActivity.class); startActivity(i); break; case R.id.nav_lista: break; case R.id.nav_face: Intent inte = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/")); startActivity(inte); break; case R.id.nav_twi: Intent inte2 = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.twitter.com/")); startActivity(inte2); break; } return true; } }); navigationView.setCheckedItem(R.id.nav_lista); //---------------------------------------------------------------------------------------------------------------------- if (flag.equals("SI")) { getUserinfo(); } else { signInAccount = GoogleSignIn.getLastSignedInAccount(this); } readData(new MyCallback() { @Override public void onCallback(List<ConfAntena> list) { Log.d("TAG", String.valueOf(list.size())); List<ConfAntena> listanueva = new ArrayList<>(); listanueva = list; listaConfAntenaAdapter = new ListaConfAntenaAdapter(listanueva, MainActivity.this); RecyclerView recyclerView = findViewById(R.id.recyclerView); recyclerView.setAdapter(listaConfAntenaAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(MainActivity.this)); } }); //--------------------------------------------------------------------------------------------- search = findViewById(R.id.buscador); //ImageView searchViewIcon = (ImageView)search.findViewById(androidx.appcompat.R.id.search_mag_icon); //searchViewIcon.setVisibility(View.GONE); search.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { listaConfAntenaAdapter.getFilter().filter(newText); return false; } }); //--------------------------------------------------------------------------------------------- Spinner spinner = (Spinner) findViewById(R.id.spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.planets_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position == 0) { } else if (position == 1) { String nada = ""; listaConfAntenaAdapter.getFilter().filter(nada); } else if (position == 2) { listaConfAntenaAdapter.getFilter().filter("Huancavelica"); } else if (position == 3) { listaConfAntenaAdapter.getFilter().filter("Ayacucho"); }else if (position == 4) { listaConfAntenaAdapter.getFilter().filter("Apurimac"); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); } public interface MyCallback { void onCallback(List<ConfAntena> list); } private void readData(final MyCallback myCallback) { FirebaseDatabase database = FirebaseDatabase.getInstance(); database.getReference().child("ConfAntena").addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { List<ConfAntena> lista = new ArrayList<>(); for (DataSnapshot child : dataSnapshot.getChildren()) { ConfAntena c1 = child.getValue(ConfAntena.class); lista.add(c1); } //String size = String.valueOf(lista.length); //Log.d("size", size); myCallback.onCallback(lista); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } public void Sitio(View view) { Intent i = new Intent(MainActivity.this, MapsActivity1.class); startActivity(i); } public void Agregar(View view) { ConfAntena c = new ConfAntena(); c.setId("asd"); c.setFrecuencia("3500"); c.setNombre("ANT1"); c.setPolarizacion("Lineal"); c.setPotenciaRx("20"); c.setPotenciaRt("18"); c.setLatitud(-11.910905985970672); c.setLongitud(-77.05563256573937); c.setFlag(flag); ConfAntena c1 = new ConfAntena(); c1.setId("dsa"); c1.setFrecuencia("3700"); c1.setNombre("ANT2"); c1.setPolarizacion("Lineal"); c1.setPotenciaRx("29"); c1.setPotenciaRt("18"); c1.setLatitud(-11.915172275575415); c1.setLongitud(-77.05563256573937); c1.setFlag(flag); ConfAntena c2 = new ConfAntena(); c2.setId("qwe"); c2.setFrecuencia("3900"); c2.setNombre("ANT3"); c2.setPolarizacion("Circular"); c2.setPotenciaRx("29"); c2.setPotenciaRt("18"); c2.setLatitud(-11.901004177887586); c2.setLongitud(-77.04014009802113); c2.setFlag(flag); DatabaseReference dbRef = mDatabase.child("ConfAntena").push(); String id = dbRef.getKey(); Log.d("infoAppKey", id); dbRef.setValue(c1) .addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { Log.d("infoApp", "guardado exitosamente"); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.e("infoApp", "onFailure", e.getCause()); } }); } public void showDialog(View view) { AlertDialog.Builder alertDialog2 = new AlertDialog.Builder( MainActivity.this); LayoutInflater inflater = getLayoutInflater(); view = inflater.inflate(R.layout.dialog_sesion, null); editText_name = view.findViewById(R.id.dialog_name); editText_email = view.findViewById(R.id.dialog_email); button_logout = view.findViewById(R.id.dialog_logout); button_close = view.findViewById(R.id.dialog_close); final AlertDialog alert = alertDialog2.create(); if (flag.equals("SI")) { editText_name.setText(Name_DB); editText_email.setText(Email_DB); } else { editText_name.setText(signInAccount.getDisplayName()); editText_email.setText(signInAccount.getEmail()); } button_close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alert.cancel(); } }); button_logout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mAuth.signOut(); startActivity(new Intent(MainActivity.this, LoginActivity.class)); finish(); } }); alert.setView(view); alert.show(); } private void getUserinfo() { String id = mAuth.getCurrentUser().getUid(); mDatabase.child("Users").child(id).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if (dataSnapshot.exists()) { Name_DB = dataSnapshot.child("name").getValue().toString(); Email_DB = dataSnapshot.child("email").getValue().toString(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } public boolean isInternetAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivityManager == null) return false; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Network networks = connectivityManager.getActiveNetwork(); if (networks == null) return false; NetworkCapabilities networkCapabilities = connectivityManager.getNetworkCapabilities(networks); if (networkCapabilities == null) return false; if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) return true; if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) return true; if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)) return true; return false; } else { NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); if (activeNetworkInfo == null) return false; if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI) return true; if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE) return true; if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_ETHERNET) return true; return false; } } }
[ "eduardo.requena@pucp.pe" ]
eduardo.requena@pucp.pe
ec680ea5a4484a835aebef7a15f97ba59b36d914
0bb62eb769db53ee0eb3d87189b7232444ab83d9
/app/src/main/java/flaychat/cn/flychat/chat/xlistview/IphoneTreeView.java
7b992aacee8a0adb8188798199e772e5d181065a
[]
no_license
GMpjOZ/FlyChat-android
cd7480727574a87d4efedc679b21e67d840f020f
5c9300f5f81aceeee9cf7628cf1c31a662408560
refs/heads/master
2021-01-12T13:37:58.536337
2015-05-13T11:03:47
2015-05-13T11:03:47
34,446,143
0
0
null
null
null
null
UTF-8
Java
false
false
8,521
java
package flaychat.cn.flychat.chat.xlistview; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.AbsListView.OnScrollListener; import android.widget.ExpandableListAdapter; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnGroupClickListener; public class IphoneTreeView extends ExpandableListView implements OnScrollListener, OnGroupClickListener { public IphoneTreeView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); registerListener(); } public IphoneTreeView(Context context, AttributeSet attrs) { super(context, attrs); registerListener(); } public IphoneTreeView(Context context) { super(context); registerListener(); } /** * Adapter ๆŽฅๅฃ . ๅˆ—่กจๅฟ…้กปๅฎž็ŽฐๆญคๆŽฅ๏ฟฝ?. */ public interface IphoneTreeHeaderAdapter { public static final int PINNED_HEADER_GONE = 0; public static final int PINNED_HEADER_VISIBLE = 1; public static final int PINNED_HEADER_PUSHED_UP = 2; /** * ่Žทๅ– Header ็š„็Šถ๏ฟฝ? * * @param groupPosition * @param childPosition * @return * PINNED_HEADER_GONE,PINNED_HEADER_VISIBLE,PINNED_HEADER_PUSHED_UP * ๅ…ถไธญไน‹ไธ€ */ int getTreeHeaderState(int groupPosition, int childPosition); /** * ้…็ฝฎ QQHeader, ๏ฟฝ?QQHeader ็Ÿฅ้“ๆ˜พ็คบ็š„ๅ†…๏ฟฝ? * * @param header * @param groupPosition * @param childPosition * @param alpha */ void configureTreeHeader(View header, int groupPosition, int childPosition, int alpha); /** * ่ฎพ็ฝฎ็ป„ๆŒ‰ไธ‹็š„็Šถ๏ฟฝ? * * @param groupPosition * @param status */ void onHeadViewClick(int groupPosition, int status); /** * ่Žทๅ–็ป„ๆŒ‰ไธ‹็š„็Šถ๏ฟฝ? * * @param groupPosition * @return */ int getHeadViewClickStatus(int groupPosition); } private static final int MAX_ALPHA = 255; private IphoneTreeHeaderAdapter mAdapter; /** * ็”จไบŽๅœจๅˆ—่กจๅคดๆ˜พ็คบ๏ฟฝ?View,mHeaderViewVisible ๏ฟฝ?true ๆ‰ๅฏ๏ฟฝ? */ private View mHeaderView; /** * ๅˆ—่กจๅคดๆ˜ฏๅฆๅฏ๏ฟฝ? */ private boolean mHeaderViewVisible; private int mHeaderViewWidth; private int mHeaderViewHeight; public void setHeaderView(View view) { mHeaderView = view; LayoutParams lp = new LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); view.setLayoutParams(lp); if (mHeaderView != null) { setFadingEdgeLength(0); } requestLayout(); } private void registerListener() { setOnScrollListener(this); setOnGroupClickListener(this); } /** * ็‚นๅ‡ป HeaderView ่งฆๅ‘็š„ไบ‹๏ฟฝ? */ private void headerViewClick() { long packedPosition = getExpandableListPosition(this .getFirstVisiblePosition()); int groupPosition = ExpandableListView .getPackedPositionGroup(packedPosition); if (mAdapter.getHeadViewClickStatus(groupPosition) == 1) { this.collapseGroup(groupPosition); mAdapter.onHeadViewClick(groupPosition, 0); } else { this.expandGroup(groupPosition); mAdapter.onHeadViewClick(groupPosition, 1); } this.setSelectedGroup(groupPosition); } private float mDownX; private float mDownY; /** * ๅฆ‚ๆžœ HeaderView ๆ˜ฏๅฏ่ง็š„ , ๆญคๅ‡ฝๆ•ฐ็”จไบŽๅˆคๆ–ญๆ˜ฏๅฆ็‚นๅ‡ปไบ† HeaderView, ๅนถๅฏนๅš็›ธๅบ”็š„ๅค„็† , ๅ› ไธบ HeaderView * ๆ˜ฏ็”ปไธŠๅŽป๏ฟฝ?, ๏ฟฝ?๏ฟฝ๏ฟฝ่ฎพ็ฝฎไบ‹ไปถ็›‘ๅฌๆ˜ฏๆ— ๆ•ˆ็š„ , ๅชๆœ‰่‡ช่กŒๆŽงๅˆถ . */ @Override public boolean onTouchEvent(MotionEvent ev) { if (mHeaderViewVisible) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: mDownX = ev.getX(); mDownY = ev.getY(); if (mDownX <= mHeaderViewWidth && mDownY <= mHeaderViewHeight) { return true; } break; case MotionEvent.ACTION_UP: float x = ev.getX(); float y = ev.getY(); float offsetX = Math.abs(x - mDownX); float offsetY = Math.abs(y - mDownY); // ๅฆ‚ๆžœ HeaderView ๆ˜ฏๅฏ่ง็š„ , ็‚นๅ‡ป๏ฟฝ?HeaderView ๏ฟฝ?, ้‚ฃไนˆ๏ฟฝ? // ๏ฟฝ?headerClick() if (x <= mHeaderViewWidth && y <= mHeaderViewHeight && offsetX <= mHeaderViewWidth && offsetY <= mHeaderViewHeight) { if (mHeaderView != null) { headerViewClick(); } return true; } break; default: break; } } return super.onTouchEvent(ev); } @Override public void setAdapter(ExpandableListAdapter adapter) { super.setAdapter(adapter); mAdapter = (IphoneTreeHeaderAdapter) adapter; } /** * * ็‚นๅ‡ป๏ฟฝ?Group ่งฆๅ‘็š„ไบ‹๏ฟฝ?, ่ฆๆ นๆฎๆ นๆฎๅฝ“ๅ‰็‚น๏ฟฝ?Group ็š„็Šถๆ€ๆฅ */ @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { if (mAdapter.getHeadViewClickStatus(groupPosition) == 0) { mAdapter.onHeadViewClick(groupPosition, 1); parent.expandGroup(groupPosition); parent.setSelectedGroup(groupPosition); } else if (mAdapter.getHeadViewClickStatus(groupPosition) == 1) { mAdapter.onHeadViewClick(groupPosition, 0); parent.collapseGroup(groupPosition); } // ่ฟ”ๅ›ž true ๆ‰ๅฏไปฅๅผนๅ›ž็ฌฌ๏ฟฝ?๏ฟฝ๏ฟฝ , ไธ็Ÿฅ้“ไธบ๏ฟฝ?๏ฟฝ๏ฟฝ return true; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if (mHeaderView != null) { measureChild(mHeaderView, widthMeasureSpec, heightMeasureSpec); mHeaderViewWidth = mHeaderView.getMeasuredWidth(); mHeaderViewHeight = mHeaderView.getMeasuredHeight(); } } private int mOldState = -1; @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); final long flatPostion = getExpandableListPosition(getFirstVisiblePosition()); final int groupPos = ExpandableListView .getPackedPositionGroup(flatPostion); final int childPos = ExpandableListView .getPackedPositionChild(flatPostion); int state = mAdapter.getTreeHeaderState(groupPos, childPos); if (mHeaderView != null && mAdapter != null && state != mOldState) { mOldState = state; mHeaderView.layout(0, 0, mHeaderViewWidth, mHeaderViewHeight); } configureHeaderView(groupPos, childPos); } public void configureHeaderView(int groupPosition, int childPosition) { if (mHeaderView == null || mAdapter == null || ((ExpandableListAdapter) mAdapter).getGroupCount() == 0) { return; } int state = mAdapter.getTreeHeaderState(groupPosition, childPosition); switch (state) { case IphoneTreeHeaderAdapter.PINNED_HEADER_GONE: { mHeaderViewVisible = false; break; } case IphoneTreeHeaderAdapter.PINNED_HEADER_VISIBLE: { mAdapter.configureTreeHeader(mHeaderView, groupPosition, childPosition, MAX_ALPHA); if (mHeaderView.getTop() != 0) { mHeaderView.layout(0, 0, mHeaderViewWidth, mHeaderViewHeight); } mHeaderViewVisible = true; break; } case IphoneTreeHeaderAdapter.PINNED_HEADER_PUSHED_UP: { View firstView = getChildAt(0); int bottom = firstView.getBottom(); // intitemHeight = firstView.getHeight(); int headerHeight = mHeaderView.getHeight(); int y; int alpha; if (bottom < headerHeight) { y = (bottom - headerHeight); alpha = MAX_ALPHA * (headerHeight + y) / headerHeight; } else { y = 0; alpha = MAX_ALPHA; } mAdapter.configureTreeHeader(mHeaderView, groupPosition, childPosition, alpha); if (mHeaderView.getTop() != y) { mHeaderView.layout(0, y, mHeaderViewWidth, mHeaderViewHeight + y); } mHeaderViewVisible = true; break; } } } @Override /** * ๅˆ—่กจ็•Œ้ขๆ›ดๆ–ฐๆ—ถ่ฐƒ็”จ่ฏฅๆ–นๆณ•(ๅฆ‚ๆปšๅŠจๆ—ถ) */ protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (mHeaderViewVisible) { // ๅˆ†็ป„ๆ ๆ˜ฏ็›ดๆŽฅ็ป˜ๅˆถๅˆฐ็•Œ้ขไธญ๏ผŒ๏ฟฝ?ไธๆ˜ฏๅŠ ๅ…ฅๅˆฐViewGroup๏ฟฝ? drawChild(canvas, mHeaderView, getDrawingTime()); } } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { final long flatPos = getExpandableListPosition(firstVisibleItem); int groupPosition = ExpandableListView.getPackedPositionGroup(flatPos); int childPosition = ExpandableListView.getPackedPositionChild(flatPos); configureHeaderView(groupPosition, childPosition); } @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } }
[ "zaoerck@163.com" ]
zaoerck@163.com
404d0ada5eb4bd8f75c032dfaa8f3cb916943462
f5dfa1a31269f2e016509a4184848e7e04fd99f7
/eureka-server/src/main/java/br/com/musiclimate/eureka/server/EurekaServerApplication.java
4910cee7e60146a0458ade5125db81f7c709f960
[]
no_license
arroyoht/Musiclimate
ceb8783864f561470df574dba0be617c6c737a4d
4ca35853e5adc2808360a1a8bf320989b659c7d3
refs/heads/master
2020-06-12T22:00:06.849081
2019-07-05T12:48:23
2019-07-05T12:48:23
194,439,574
2
0
null
null
null
null
UTF-8
Java
false
false
429
java
package br.com.musiclimate.eureka.server; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @EnableEurekaServer @SpringBootApplication public class EurekaServerApplication { public static void main(String[] args) { SpringApplication.run(EurekaServerApplication.class, args); } }
[ "vnthete@Henrique-Macbook-pro.local" ]
vnthete@Henrique-Macbook-pro.local
18709d0fb90c4f579fdd8c1926356d87f50d0b0d
30acfd3f0a117458324c8f7ebfcfd198c43089ab
/pokemonTutorial/src/human/Me.java
ba425e41977c72d53e9e592e2761c911493241f9
[]
no_license
kadotaoru/pokemonTutorial
261d6601fa8086e99214fda0cd6555fd3b57fedc
48fb8fc43272b3e22d5b10ca3340fb4544bba434
refs/heads/master
2022-12-24T23:21:01.655552
2020-10-11T13:00:39
2020-10-11T13:00:39
284,255,430
0
0
null
null
null
null
UTF-8
Java
false
false
2,539
java
package human; import pokemon.Pokemon; public class Me extends Human { Pokemon[] myPokemon; public Me(){ myPokemon = new Pokemon[6]; } public void decideMyName() { System.out.println("ใ€ใ‚ใชใŸใฎๅๅ‰ใฏ๏ผŸใ€‘"); String enterMyName = new java.util.Scanner(System.in).nextLine(); name = enterMyName; } public int selectPokemon(Pokemon[] p) { System.out.println("ใ€ๅฅฝใใชใƒใ‚ฑใƒขใƒณใฎ็•ชๅทใ‚’ๅ…ฅๅŠ›ใ—ใฆใญใ€‘\n" + "1: ใƒ•ใ‚ทใ‚ฎใƒ€ใƒ\n" + "2: ใ‚ผใƒ‹ใ‚ฌใƒก\n" + "3: ใƒ’ใƒˆใ‚ซใ‚ฒ"); int selectFirstPokemon = new java.util.Scanner(System.in).nextInt(); switch (selectFirstPokemon) { case 1: myPokemon[0] = p[1]; System.out.println(this.name + "ใฏ" + myPokemon[0].name + "ใซๆฑบใ‚ใŸ๏ผ"); break; case 2: myPokemon[0] = p[2]; System.out.println(this.name + "ใฏ" + myPokemon[0].name + "ใซๆฑบใ‚ใŸ๏ผ"); break; case 3: myPokemon[0] = p[0]; System.out.println(this.name + "ใฏ" + myPokemon[0].name + "ใซๆฑบใ‚ใŸ๏ผ"); break; default: System.out.println("ใ‚ชใƒผใ‚ญใƒ‰ๅšๅฃซ:\n" + "ใ€Œ" + this.name + "ใ‚ˆใ€ใ•ใ‚‰ใฐใ ...ใ€\n" + "GAME OVER"); break; } return selectFirstPokemon; } public void tosakinto() { System.out.println("\n\n\n"); System.out.println(" ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€, ใ‚คยด๏ฟฃ๏ฝ€ใƒฝ\r\n" + "ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ ใ€€ ใ€€ ๏ผใ€€ | ใ€€ ใ€€ _j\r\n" + "ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€fโ€ฒใ€€ใ€€|ใ€€ใ€€,๏ผˆ_{\r\n" + "ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ ใ€€ _ใ€€ใ€€ ๏ฝใ€€ใ€€......ใ€€jโ€ฒ๏ฝ€ใƒฝ\r\n" + "ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ ๏ผฟ,r'ยด ๏ฝ€ใƒฝ L, .::::/::::::.ใ€€ใ€€ใ€€j\r\n" + "ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€fยดใ€€, - ๏ฝค_ใƒŽ๏ฟฃ๏ฝ€ใƒฝ:|:::::::::::ใ€€,f'ยด\r\n" + "ใ€€ใ€€ ใ€€ _ใ€€ใ€€๏ผฌ.l ใ€€,.-::โ€::::โ€::::๏ฝค!::;/::::;r_'_rโ”€ ใ€\r\n" + "ใ€€ใ€€๏ฝคใ€€ | ๏ผผ,๏ฝฃ _,fยด:::::::::::::::::ใ€€ ๏ฝ€ใƒฝ:::ยด::::::._,rใ€€ยด๏ผผ\r\n" + "ใ€€ | ๏ผผ'๏ฝคใ€€ ๏ผผ:::::::::: ใ€€ใ€€ใ€€ใ€€ใ€€ ใ€€l:โ”€:-:๏ฝค::::..ใ€€ ๏ฝ€ใƒฝ\r\n" + " ๏ผใ€€ใ€€/|ใƒฝใ€€ ๏พ‰ ใ€€ , -- ใ€ใ€€ใ€€ใ€€ใ€€ใƒˆ ๏ฝค::::::๏ฝ€ใƒฝ::.ใ€€ ๏ฝ›\r\n" + "๏ฝ›ใ€€ ใ€€ {. l! ๏ฝ€\"โ€ฒใ€€๏ผฌ.ใ‚ฃ๏ผพlใ€€ใ€€๏ฝค..ใƒŽ......ไบŒ๏ฝ€ใƒฝ._ใ€€ใ€€ ๏ฝ\r\n" + "ใ€€๏ฝ€ใƒˆใ€€ ใ‚žใ€ใ€€๏ผฟใ€€ ใƒฝไบŒ.ใƒŽใ€€ _::::::::ใ€€ ใ€ใ€€๏ฝ€ใƒฝ ๏ฝ€๏ฝฐ โ€ฒ\r\n" + "ใ€€ โ”” ยด๏ฟฃYยด๏ผฟ๏ฝ€ใƒฝใ€€ใ€€ใ€€ใ€€_,๏ฝจ๏ผพใƒฝใ€ใ€€,ใ‚ใ€€f~\r\n" + "ใ€€ใ€€ใ€€ใ€€ใ€€ ๏ฝ€ ๏ฝฐโ”€โ”ดไธ€ใ€€ยดใ€€๏ผฌ._ใ€€ Y_ใƒผ ยด\r\n" + " ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€ใ€€๏ฝ€ใƒผ โ€ฒ\r\n" + ""); } }
[ "kadotaoru@DESKTOP-3EF734L" ]
kadotaoru@DESKTOP-3EF734L
835784cac4101416a3fc53dd38bae5a987f08513
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/MATH-40b-2-9-FEMO-WeightedSum:TestLen:CallDiversity/org/apache/commons/math/analysis/solvers/BaseAbstractUnivariateRealSolver_ESTest.java
7fc1f15202add83ccf38d3d5030b42ca1af5d340
[]
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
1,305
java
/* * This file was automatically generated by EvoSuite * Mon Jan 20 14:12:09 UTC 2020 */ package org.apache.commons.math.analysis.solvers; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import org.apache.commons.math.analysis.solvers.BracketingNthOrderBrentSolver; import org.apache.commons.math.exception.TooManyEvaluationsException; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class BaseAbstractUnivariateRealSolver_ESTest extends BaseAbstractUnivariateRealSolver_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { BracketingNthOrderBrentSolver bracketingNthOrderBrentSolver0 = new BracketingNthOrderBrentSolver(); try { bracketingNthOrderBrentSolver0.computeObjectiveValue((-1.0)); fail("Expecting exception: TooManyEvaluationsException"); } catch(TooManyEvaluationsException e) { // // illegal state: maximal count (0) exceeded: evaluations // verifyException("org.apache.commons.math.analysis.solvers.BaseAbstractUnivariateRealSolver", e); } } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
521b840ecafaa7f10414b7304bff4dba964593ab
2ec70a1b1bd94d0a9bc905425f97b58cfe209808
/src/test/java/br/com/fiap/cloud/ArchTest.java
b9428a98387d68e67708d05068cff870dfa029bd
[]
no_license
guimbm1993/cloud
c1fe6a1ba96660938e0ec7996868d09caab2f285
943f85f12ba9c3d3aca4331438d3c477704cb4e4
refs/heads/main
2023-04-25T00:01:58.149070
2021-05-03T23:57:29
2021-05-03T23:57:29
364,080,930
0
0
null
null
null
null
UTF-8
Java
false
false
1,022
java
package br.com.fiap.cloud; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; import com.tngtech.archunit.core.domain.JavaClasses; import com.tngtech.archunit.core.importer.ClassFileImporter; import com.tngtech.archunit.core.importer.ImportOption; import org.junit.jupiter.api.Test; class ArchTest { @Test void servicesAndRepositoriesShouldNotDependOnWebLayer() { JavaClasses importedClasses = new ClassFileImporter() .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS) .importPackages("br.com.fiap.cloud"); noClasses() .that() .resideInAnyPackage("br.com.fiap.cloud.service..") .or() .resideInAnyPackage("br.com.fiap.cloud.repository..") .should() .dependOnClassesThat() .resideInAnyPackage("..br.com.fiap.cloud.web..") .because("Services and repositories should not depend on web layer") .check(importedClasses); } }
[ "ubuntu@ip-172-31-67-243.ec2.internal" ]
ubuntu@ip-172-31-67-243.ec2.internal
bb5506846942a8b3faeafe66ca073df9df18d740
354dd01622bf7a928fb007d38992e8f457192898
/MergeSortAlgo/src/MergeSort.java
0c88d50ae0a6e8079b098089b229e37d49464e43
[]
no_license
chenyf0328/SJU_AlgorithmCourseProject
c3fdeecebc6c18f1daea2e9ba842c38d46263c2e
d37340727eb49f30526263bf00da460d8c85e8c0
refs/heads/master
2020-03-23T15:55:12.252642
2018-07-21T05:02:02
2018-07-21T05:02:02
141,782,689
0
0
null
null
null
null
UTF-8
Java
false
false
1,151
java
public class MergeSort { public static void mergeSort(int[] data, int left, int right){ if (left<right){ int half=(left+right)/2; mergeSort(data,left,half); mergeSort(data,half+1,right); merge(data,left,right); } } public static void merge(int[] data, int left, int right){ int mid=(left+right)/2; int i=left; int j=mid+1; int count=0; int[] temp=new int[right-left+1]; while(i<=mid && j<=right){ if (data[i]<data[j]) temp[count++]=data[i++]; else temp[count++]=data[j++]; } while (i<=mid){ temp[count++]=data[i++]; } while (j<=right){ temp[count++]=data[j++]; } count=0; while (left<=right){ data[left++]=temp[count++]; } } public static void main(String args[]){ int[] data=new int[]{2,4,12,2,8,3,5,10}; mergeSort(data,0,data.length-1); for (int i=0;i<data.length;i++){ System.out.print(data[i]+" "); } } }
[ "826787530@qq.com" ]
826787530@qq.com
92704589851a151cc03b2ebd26beed4bb0452b8d
57ffc7d2ed1d5ce213689cc4516488352ff91afb
/wepbase/src/main/java/com/wep/common/app/views/WepEditText.java
474d6ecdb2829c93549cd4e31561734de20f0793
[]
no_license
richawep/EasyBill-V2.9
0bec805a927d54f1cc97e249d5552e7a89d1c09f
3e1476b45911c54431e74ae5f602a7e3e6a49081
refs/heads/master
2021-05-06T20:32:03.664427
2017-11-17T08:59:05
2017-11-17T08:59:05
112,326,852
1
0
null
null
null
null
UTF-8
Java
false
false
1,060
java
package com.wep.common.app.views; import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.util.AttributeSet; import android.view.KeyEvent; import android.widget.EditText; /** * Created by PriyabratP on 30-03-2017. */ public class WepEditText extends EditText { public WepEditText(Context context) { super(context); } public WepEditText(Context context, AttributeSet attrs) { super(context, attrs); } public WepEditText(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) public WepEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } @Override public boolean onKeyPreIme(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK) { clearFocus(); } return super.onKeyPreIme(keyCode, event); } }
[ "ppadhybam@gmail.com" ]
ppadhybam@gmail.com
2475a3cd1cb00e17adbfd3f1f0f731c0f95a82de
afacbafb94bdcffa61ebaef948cab3f758b8ae39
/src/main/java/edu/northwestern/at/utils/math/matrix/MatrixProperty.java
5736a181a126391f5bdc0a83dc333d8bc303b4b0
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
slide-lig/TopPI
84694e907be72bf394f0c56c2cfd3e2813b6284f
d1a9dad5f16658c9c48e5fd9e72a07dd588f305b
refs/heads/master
2020-09-22T01:00:59.244388
2016-08-26T14:20:58
2016-08-26T14:20:58
66,268,013
4
2
null
null
null
null
UTF-8
Java
false
false
13,962
java
package edu.northwestern.at.utils.math.matrix; /* Please see the license information at the end of this file. */ import edu.northwestern.at.utils.math.ArithUtils; /** MatrixProperty returns a boolean value for a property of a matrix. */ public class MatrixProperty { /** Return bandwidth for matrix. * * @param matrix The matrix. * @param tolerance Tolerance for checking for zero. * * @return Integer array with three entries. * [0] = lower bandwidth * [1] = upper bandwidth * [2] = total bandwidth */ public static int[] bandwidth( Matrix matrix , double tolerance ) { int lowerBandWidth = 0; int upperBandWidth = 0; int diagNotZero = 0; int rows = matrix.rows(); int columns = matrix.columns(); int minDimension = Math.min( rows , columns ); for ( int i = 1 ; i <= rows ; i++ ) { for ( int j = ( i + 1 ) ; j <= columns ; j++ ) { if ( !ArithUtils.areEqual( matrix.get( i , j ) , 0.0D , tolerance ) ) { upperBandWidth = Math.max( Math.abs( i - j ) , upperBandWidth ); } } if ( ( i <= minDimension ) && ( !ArithUtils.areEqual( matrix.get( i , i ) , 0.0D , tolerance ) ) ) { diagNotZero++; } for ( int j = 1 ; j < i ; j++ ) { if ( !ArithUtils.areEqual( matrix.get( i , j ) , 0.0D , tolerance ) ) { lowerBandWidth = Math.max( Math.abs( i - j ) , lowerBandWidth ); } } } int bandWidth = lowerBandWidth + upperBandWidth + ( ( diagNotZero > 0 ) ? 1 : 0 ); int[] result = new int[ 3 ]; result[ 0 ] = lowerBandWidth; result[ 1 ] = upperBandWidth; result[ 2 ] = bandWidth; return result; } /** Return bandwidth for matrix. * * @param matrix The matrix. * * @return Integer array with three entries. * [0] = lower bandwidth * [1] = upper bandwidth * [2] = total bandwidth */ public static int[] bandwidth( Matrix matrix ) { return bandwidth( matrix , 0.0D ); } /** * Determines whether or not a matrix is a Column Vector * * @param matrix The matrix. * * @return true if m has only one column. */ public static boolean isColumnVector( Matrix matrix ) { return ( matrix.columns() == 1 ); } /** Is square matrix diagonal. * * @param matrix Matrix. * @param tolerance Tolerance for checking for zero. * * @return True if all elements other than those on the * main diagonal are zero to within the specified * tolerance, e.g., an element is considered zero * if |matrix(i,j)| <= tolerance. */ public static boolean isDiagonal( Matrix matrix , double tolerance ) { if ( isSquare( matrix ) ) { for ( int row = 1 ; row <= matrix.rows() ; row++ ) { for ( int col = 1 ; col <= matrix.columns() ; col++ ) { if ( ( row != col ) && ( !ArithUtils.areEqual( matrix.get( row , col ) , 0.0D, tolerance ) ) ) { return false; } } } return true; } else { return false; } } /** Is square matrix diagonal. * * @param matrix Matrix. * * @return True if all elements other than those on the * main diagonal are zero. */ public static boolean isDiagonal( Matrix matrix ) { return isDiagonal( matrix , 0.0D ); } /** Is matrix high. * * @param matrix The matrix. * * @return True if the matrix has more rows than * columns. */ public static boolean isHigh( Matrix matrix ) { return ( matrix.rows() > matrix.columns() ); } /** Is matrix idempotent. * * @param matrix Matrix. * @param tolerance Tolerance for checking for zero. * * @return True if matrix is equal to its element-wise * product within the specified tolerance. */ public static boolean isIdempotent( Matrix matrix , double tolerance ) { return MatricesMeasure.areEqual ( matrix , MatrixTransformer.pow( matrix , 2 ) , tolerance ); } /** Is matrix idempotent. * * @param matrix Matrix. * * @return True if matrix is equal to its element-wise * product. */ public static boolean isIdempotent( Matrix matrix ) { return MatricesMeasure.areEqual ( matrix , MatrixTransformer.pow( matrix , 2 ) , 0.0D ); } /** Is matrix an identity matrix. * * @param matrix Matrix. Must be square. * @param tolerance Tolerance for checking for zero. * * @return True if matrix is square, all off-diagonal * elements are zero to within tolerance, * and all the diagonal elements are 1 within * tolerance. */ public static boolean isIdentity( Matrix matrix , double tolerance ) { return isSquare( matrix ) && MatricesMeasure.areEqual ( matrix , MatrixFactory.createIdentityMatrix( matrix.rows() ) , tolerance ); } /** Is matrix an identity matrix. * * @param matrix Matrix. Must be square. * * @return True if matrix is square, all off-diagonal * elements are zero, and all the diagonal elements * are 1. */ public static boolean isIdentity( Matrix matrix ) { return isSquare( matrix ) && MatricesMeasure.areEqual ( matrix , MatrixFactory.createIdentityMatrix( matrix.rows() ) ); } /** Is matrix lower-triangular. * * @param matrix Matrix. * @param tolerance Tolerance for checking for zero. * * @return True if matrix is lower triangular. */ public static boolean isLowerTriangular( Matrix matrix , double tolerance ) { return MatricesMeasure.areEqual ( MatrixTransformer.extractLowerTriangle( matrix , 0 ) , matrix , tolerance ); } /** Is matrix lower-triangular. * * @param matrix Matrix. * * @return True if matrix is lower triangular. */ public static boolean isLowerTriangular( Matrix matrix ) { return MatricesMeasure.areEqual ( MatrixTransformer.extractLowerTriangle( matrix , 0 ) , matrix ); } /** Is matrix positive-definite. * * @param matrix Matrix. * * @return True if matrix is positive definite. * * <p> * A matrix is positive definite if all its eigenvalues * are real and greater than zero. * </p> */ public static boolean isPositiveDefinite( Matrix matrix ) { boolean result = true; if ( isSquare( matrix ) ) { EigenvalueDecomposition eigDecomp = new EigenvalueDecomposition( matrix ); double[] realEigenValues = eigDecomp.getRealEigenvalues(); double[] imaginaryEigenValues = eigDecomp.getImagEigenvalues(); for ( int i = 0 ; i < realEigenValues.length ; i++ ) { result = result && ( realEigenValues[ i ] > 0.0D ) && ( imaginaryEigenValues[ i ] == 0.0D ); } } else { result = false; } return result; } /** Determines if matrix is a row vector. * * @param matrix The matrix. * * @return True if matrix has only one row. */ public static boolean isRowVector( Matrix matrix ) { return ( matrix.rows() == 1 ); } /** Determines if square matrix is a scalar matrix. * * @param matrix The matrix. * @param tolerance Tolerance for equality checking. * * @return True if matrix is square and diagonal with * all diagonal elements equal. */ public static boolean isScalar( Matrix matrix , double tolerance ) { double diagValue = matrix.get( 1 , 1 ); if ( isSquare( matrix ) ) { for ( int row = 1 ; row <= matrix.rows() ; row++ ) { for ( int column = 1 ; column <= matrix.columns() ; column++ ) { if ( row == column ) { if ( !ArithUtils.areEqual( diagValue , matrix.get( row , column ) , tolerance ) ) { return false; } } else if ( matrix.get( row , column ) != 0 ) { return false; } } } return true; } else { return false; } } /** Is matrix semipositive definite. * * @param matrix Matrix. * * @return True if matrix is semipositive definite. * * <p> * A matrix is semi-positive definition if all of its eigenvalues * are >= 0. * </p> */ public static boolean isSemiPositiveDefinite( Matrix matrix ) { boolean result = true; if ( isSquare( matrix ) ) { EigenvalueDecomposition eigDecomp = new EigenvalueDecomposition( matrix ); double[] realEigenValues = eigDecomp.getRealEigenvalues(); double[] imaginaryEigenValues = eigDecomp.getImagEigenvalues(); for ( int i = 0 ; i < realEigenValues.length ; i++ ) { result = result && ( realEigenValues[ i ] >= 0.0D ) && ( imaginaryEigenValues[ i ] == 0.0D ); } } else { result = false; } return result; } /** Determines if a square matrix is singular. * * @param matrix The matrix. * * @return True is matrix is singular. * * <p> * We use an LU decomposition to determine if the matrix is singular. * </p> */ public static boolean isSingular( Matrix matrix ) { return new LUDecomposition( matrix ).isSingular(); } /** Is matrix skew symnmetric. * * @param matrix Matrix. * * @param tolerance Tolerance for checking equality of matrix values. * * @return True iff A' = -A . */ public static boolean isSkewSymmetric( Matrix matrix , double tolerance ) { return MatricesMeasure.areEqual ( MatrixTransformer.transpose( matrix ) , MatrixTransformer.negate( matrix ) , tolerance ); } /** Is matrix skew symnmetric. * * @param matrix Matrix. * * @return True iff A' = -A . */ public static boolean isSkewSymmetric( Matrix matrix ) { return MatricesMeasure.areEqual ( MatrixTransformer.transpose( matrix ) , MatrixTransformer.negate( matrix ) ); } /** Determine if matrix is square. * * @param matrix The matrix. * * @return True if the matrix has the same number of rows as * columns. */ public static boolean isSquare( Matrix matrix ) { return ( matrix.rows() == matrix.columns() ); } /** Is matrix symmetric. * * @param matrix Matrix. * * @param tolerance Tolerance for checking equality of matrix values. * * @return True iff A' = A . */ public static boolean isSymmetric( Matrix matrix , double tolerance ) { return MatricesMeasure.areEqual ( matrix , MatrixTransformer.transpose( matrix ) , tolerance ); } /** Is matrix symmetric. * * @param matrix Matrix. * * @return True iff A' = A . */ public static boolean isSymmetric( Matrix matrix ) { return MatricesMeasure.areEqual ( matrix, MatrixTransformer.transpose( matrix ) ); } /** Determine if matrix is symmetric positive definite. * * @param matrix The matrix. * * @return True if matrix is symmetric positive definite. * * <p> * A Cholesky decomposition is used to determine if the matrix * is positive semidefinite. * </p> */ public static boolean isSymmetricPositiveDefinite( Matrix matrix ) { return new CholeskyDecomposition( matrix ).isSPD(); } /** Determine if a diagonal matrix is an identity matrix. * * @param matrix The matrix. * @param tolerance Tolerance for zero check. * * @return True if matrix is unit (identity) matrix. */ public static boolean isUnit( Matrix matrix , double tolerance ) { return isIdentity( matrix , tolerance ); } /** Determine if a diagonal matrix is an identity matrix. * * @param matrix The matrix. * * @return True if matrix is identity matrix. */ public static boolean isUnit( Matrix matrix ) { return isIdentity( matrix ); } /** Determines if matrix is upper triangular. * * @param matrix The matrix. * * @return True if matrix is upper triangular. */ public static boolean isUpperTriangular( Matrix matrix ) { return MatricesMeasure.areEqual( MatrixTransformer.extractUpperTriangle( matrix , 0 ) , matrix ); } /** Determine if matrix is a vector. * * @param matrix The matrix. * * @return True if matrix had only one row or column. */ public static boolean isVector( Matrix matrix ) { return ( ( matrix.columns() == 1 ) || ( matrix.rows() == 1 ) ); } /** Determine if matrix is wide. * * @param matrix The matrix. * * @return True if the matrix has more coluns than * rows. */ public static boolean isWide( Matrix matrix ) { return ( matrix.rows() < matrix.columns() ); } /** Don't allow instantiation but do allow overrides. */ protected MatrixProperty() { } } /* * <p> * JMatrices is copyright &copy; 2001-2004 by Piyush Purang. * </p> * <p> * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * </p> * <p> * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * </p> * <p> * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * </p> * <p> * Modifications 2004-2006 by Northwestern University. * </p> */
[ "martin.kirch@gmail.com" ]
martin.kirch@gmail.com
c84f21580c316b9d65704466421fd76db613aa7a
418aae46356cdd084fdf40555066152d466c5098
/src/main/java/dev/gaellerauffet/lesamisdelescalade/services/impl/SpotServiceImpl.java
53712327c70cc8a683898ce949609c7863db1ad1
[]
no_license
gaelle8278/OC-les-amis-de-lescalade
06800419b05b32194d562d1aa1592608b6201a82
fde6a72636ffe226a3581e73011c63a86d285329
refs/heads/master
2020-09-23T11:06:21.995485
2019-12-20T16:20:56
2019-12-20T16:20:56
225,481,969
0
0
null
null
null
null
UTF-8
Java
false
false
6,709
java
package dev.gaellerauffet.lesamisdelescalade.services.impl; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.persistence.EntityManager; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; import dev.gaellerauffet.lesamisdelescalade.model.Area; import dev.gaellerauffet.lesamisdelescalade.model.Comment; import dev.gaellerauffet.lesamisdelescalade.model.Spot; import dev.gaellerauffet.lesamisdelescalade.model.User; import dev.gaellerauffet.lesamisdelescalade.model.form.SpotSearchForm; import dev.gaellerauffet.lesamisdelescalade.persistance.SpotRepository; import dev.gaellerauffet.lesamisdelescalade.services.SpotService; import dev.gaellerauffet.lesamisdelescalade.services.UserService; import dev.gaellerauffet.lesamisdelescalade.utils.Constants; import dev.gaellerauffet.lesamisdelescalade.utils.Helpers; @Service public class SpotServiceImpl implements SpotService { @Autowired SpotRepository spotRepository; @Autowired UserService userService; @Autowired EntityManager em; @Override public Spot getSpot(int id) { Spot spot = spotRepository.findById(id); return spot; } @Override public List<Spot> getAllSpots() { List<Spot> spots = spotRepository.findAll(); return spots; } @Override public Page<Spot> findAllPaginated(Pageable pageable) { Page<Spot> page = spotRepository.findAll(pageable); return page; } @Override public List<Spot> getSpotsByName(String name) { List<Spot> list = spotRepository.findByNameContains(name); return list; } @Override public List<String> getListRegionsForForm() { List<Spot> spots = spotRepository.findAll(); List<String> regions = new ArrayList<String>(); regions.add(" "); if(! spots.isEmpty()) { for(Spot spot : spots) { if(spot.getRegion() != null && ! spot.getRegion().isEmpty() && ! regions.contains(spot.getRegion())) { regions.add(spot.getRegion()); } } //List<String> listUniqueRegions = regions.stream().distinct().collect(Collectors.toList()); Collections.sort(regions); } return regions; } @Override public List<Spot> getSpotsByRegion(String region) { List<Spot> list = spotRepository.findByRegionContains(region); return list; } @Override public List<Spot> getSpotsForSearchCriteria(SpotSearchForm spotsearchform) { List<Spot> foundedSpots = new ArrayList<Spot>(); if(! spotsearchform.getRegion().isEmpty() && ! spotsearchform.getName().isEmpty()) { foundedSpots = spotRepository.findByRegionContainsAndNameContains(spotsearchform.getRegion(), spotsearchform.getName()); } else if (! spotsearchform.getRegion().isEmpty()) { foundedSpots = spotRepository.findByRegionContains(spotsearchform.getRegion()); } if ( ! spotsearchform.getName().isEmpty() ) { foundedSpots = spotRepository.findByNameContains(spotsearchform.getName()); } return foundedSpots; } @Override public Page<Spot> getSpotsForSearchCriteria(SpotSearchForm spotsearchform, Pageable pageable) { Page<Spot> foundedSpots = null; if ( ! StringUtils.isBlank(spotsearchform.getName()) ) { foundedSpots = spotRepository.findByNameContains(spotsearchform.getName(), pageable); } else if (! StringUtils.isBlank(spotsearchform.getRegion())) { foundedSpots = spotRepository.findByRegionContains(spotsearchform.getRegion(), pageable); } else if ( ! spotsearchform.getGrade().isEmpty() ) { foundedSpots = spotRepository.findByMinGrade(spotsearchform.getGrade(), pageable); } else if ( ! Helpers.isIntEmpty(spotsearchform.getNbAreas() ) ) { foundedSpots = spotRepository.findByNbAreasGreaterThan(spotsearchform.getNbAreas(), pageable); } else if ( ! Helpers.isIntEmpty(spotsearchform.getNbRoutes() ) ) { foundedSpots = spotRepository.findByNbRoutesGreaterThan(spotsearchform.getNbRoutes(), pageable); } else if ( ! Helpers.isIntEmpty(spotsearchform.getNbPitches()) ) { foundedSpots = spotRepository.findByNbPitchesGreaterThan(spotsearchform.getNbPitches(), pageable); } else if ( ! Helpers.isIntEmpty(spotsearchform.getMinHeight()) ) { foundedSpots = spotRepository.findByMinHeightGreaterThan(spotsearchform.getMinHeight(), pageable); } else if ( ! Helpers.isIntEmpty(spotsearchform.getMaxHeight()) ) { foundedSpots = spotRepository.findByMaxHeightGreaterThan(spotsearchform.getMaxHeight(), pageable); } //@TODO crรฉer des combinaisons => queryDSL , JPA API Criteria ? return foundedSpots; } @Override public int add(Spot spot) { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); User user = userService.findUserByEmail(auth.getName()); spot.setUser(user); Spot savedSpot = spotRepository.save(spot); return savedSpot.getId(); } @Override public List<String> getListTypesForForm() { List<String> types = new ArrayList<String>(); //@TODO in v2 add management of types in admin types.add(Constants.SPOT_TYPE_CLIFF); types.add(Constants.SPOT_TYPE_BLOCK); types.add(Constants.SPOT_TYPE_CLIFF_AND_BLOCK); return types; } @Override public void deleteSpot(int id) { //@TODO supprimmer les secteurs fils avant de supprimer le site spotRepository.deleteById(id); } @Override public List<Area> getListAreas(int id) { Spot spot = spotRepository.findById(id); List<Area> listAreas = spot.getListArea(); return listAreas; } @Override public void update(Spot spotForm) { Spot spot = em.getReference(Spot.class, spotForm.getId()); spotForm.setUser(spot.getUser()); spotRepository.save(spotForm); } @Override public List<Comment> getListComment(Spot spot) { List<Comment>listComments = spot.getListComment(); return listComments; } @Override public Page<Spot> getUserSpots( Pageable pageable) { //User user = em.getReference(User.class, userId); Authentication auth = SecurityContextHolder.getContext().getAuthentication(); User user = userService.findUserByEmail(auth.getName()); Page<Spot> listSpots = spotRepository.findAllByUser(user, pageable); return listSpots; } @Override public void addTagSpot(int spotId) { Spot spot = em.getReference(Spot.class, spotId); spot.setTag(true); spotRepository.save(spot); } @Override public void deleteTagSpot(int spotId) { Spot spot = em.getReference(Spot.class, spotId); spot.setTag(false); spotRepository.save(spot); } }
[ "gaelle.rauffet@kiwiscan.net" ]
gaelle.rauffet@kiwiscan.net
2a07fa013f7acbe8c36030fce33c8022088c6315
049c5046350c434399b49f78677eb490d296e292
/distributeme-registry/src/main/java/org/distributeme/registry/ui/action/package-info.java
e1b489cfd08f3c91014fb6abbd150e8670233946
[ "MIT" ]
permissive
anotheria/distributeme
69298b3ac7e39d9b4be1ca2396eaf3ebcb6ecb73
74d11893eb077c90074360197328fe0105af6b7a
refs/heads/master
2023-08-30T02:22:52.203187
2023-02-10T14:24:04
2023-02-10T14:24:04
12,647,908
2
11
null
2023-02-10T13:57:16
2013-09-06T15:47:47
Java
UTF-8
Java
false
false
105
java
/** * Package with actions for registry functionality. */ package org.distributeme.registry.ui.action;
[ "leon.rosenberg@anotheria.net" ]
leon.rosenberg@anotheria.net
b5c36b94085eac0fadec3425267b144d6f879668
582db76b59f9b51d7f215f66006c439b99f91cb6
/src/main/java/whattodraw/characters/Character.java
010f8af841d097ef12c8e5b4b1a19ba77309429c
[]
no_license
cheshirrrr/whattodraw
33a2ff9dbdebf88b75b4c847f0ed5a80d53366e2
2dfd277255bf1cf66115d052a73e821a6717be3c
refs/heads/master
2020-07-30T21:55:00.525031
2016-11-26T08:14:32
2016-11-26T08:14:32
73,618,569
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package whattodraw.characters; public class Character{ private String trait; private String setting; private String name; public Character(){} public Character(String trait, String setting, String name) { this.trait = trait; this.setting = setting; this.name = name; } public String getTrait() { return trait; } public String getSetting() { return setting; } public String getName() { return name; } @Override public String toString() { return String.join(" ",trait,setting,name); } }
[ "jmnmnck@gmail.com" ]
jmnmnck@gmail.com
bca113310d7cbb80b732cba6ff7ec05aafa5ffae
e1ff68f08f2ba745819d99e9634b0f068c41d7da
/SunDaemon/src/com/ssl/support/utils/ListenableAsyncTask.java
3436c90c05fe6357f8eb8b53e3b692a440384a0f
[]
no_license
SunshineLibrary/SunApps
ec9b7665e08f1f7f23fcb0c17d7d4523b7affe8b
8d06283ddbd8c20dad127a73a4309ba9cc3a8dea
refs/heads/master
2021-01-10T19:05:48.213541
2013-01-06T01:45:13
2013-01-06T01:45:13
7,017,217
1
0
null
null
null
null
UTF-8
Java
false
false
766
java
package com.ssl.support.utils; import android.os.AsyncTask; import java.util.List; import java.util.Vector; public abstract class ListenableAsyncTask<Param, Progress, Result> extends AsyncTask<Param, Progress, Result> { private List<Listener<Result>> listeners; @Override protected void onPostExecute(Result result) { super.onPostExecute(result); for (Listener listener : getListeners()) { listener.onResult(result); } } public void addListener(Listener<Result> listener) { getListeners().add(listener); } private List<Listener<Result>> getListeners() { if (listeners == null) { listeners = new Vector<Listener<Result>>(); } return listeners; } }
[ "ukisami@gmail.com" ]
ukisami@gmail.com
a8a9017df04c425770c34335cca48fbc5b4da94c
b97a62b9f72f24775f70741b22e11cf8b164ad34
/src/seref/GetValueExecutor.java
cfbfaec12ed7bb881efdb68e547c2df44ae53581
[]
no_license
serafett/panopticon
dd3bb9edd3436c0e88d7a79deaef55f79646f293
b4fc70d16e0b8b82c6c6b21a6add6f7c34bfff6d
refs/heads/master
2021-01-20T11:06:07.853648
2014-12-31T04:09:45
2014-12-31T04:09:45
28,459,294
0
1
null
null
null
null
UTF-8
Java
false
false
1,056
java
package seref; import java.io.Serializable; import java.util.concurrent.Callable; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.HazelcastInstanceAware; import com.hazelcast.core.IMap; public class GetValueExecutor implements Callable<Double>, Serializable, HazelcastInstanceAware { private static final long serialVersionUID = 1L; private HazelcastInstance hz; private Integer key; private double elapsedTime; private long t1, t2; public GetValueExecutor() { } public GetValueExecutor(Integer key) { this.key = key; } public Double call() { IMap<Integer, Vertex> vertexMap = hz.getMap("vertex"); // t1 = System.nanoTime(); double val = vertexMap.get(key).getValue(); // t2 = System.nanoTime(); // elapsedTime = (t2 - t1)/(Math.pow(10, 6)); // System.out.println("Single IMap.get in getValueExecutor takes: "+elapsedTime); return val; } @Override public void setHazelcastInstance(HazelcastInstance hazelcastInstance) { this.hz = hazelcastInstance; } }
[ "serafettintasci@yahoo.com" ]
serafettintasci@yahoo.com
e76df6b9c26960b82dce514782fd784363f53349
0b53cd2e407d13ffa95354ca8f0867d56b471b74
/bin/custom/bookstore/bookstorecore/src/my/bookstore/core/search/solrfacetsearch/provider/impl/VolumeAwareProductPriceValueProvider.java
668d44038283a96b385808218da48f71168c4261
[]
no_license
mocavada/hybrisSAP
8480f07a78acd081bfb6d9f0c4713dc808a5a9bb
25f92e06daa02d195ba1f89a244ec6cc3fd75f0c
refs/heads/master
2021-01-15T01:34:24.698036
2020-02-27T18:21:50
2020-02-27T18:21:50
242,172,883
0
0
null
null
null
null
UTF-8
Java
false
false
8,771
java
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package my.bookstore.core.search.solrfacetsearch.provider.impl; import de.hybris.platform.catalog.CatalogVersionService; import de.hybris.platform.catalog.model.CatalogVersionModel; import de.hybris.platform.catalog.model.classification.ClassificationSystemVersionModel; import de.hybris.platform.cms2.model.contents.ContentCatalogModel; import de.hybris.platform.core.model.c2l.CurrencyModel; import de.hybris.platform.core.model.product.ProductModel; import de.hybris.platform.jalo.order.price.PriceInformation; import de.hybris.platform.product.PriceService; import de.hybris.platform.servicelayer.i18n.CommonI18NService; import de.hybris.platform.servicelayer.session.SessionExecutionBody; import de.hybris.platform.servicelayer.session.SessionService; import de.hybris.platform.servicelayer.user.UserService; import de.hybris.platform.solrfacetsearch.config.IndexConfig; import de.hybris.platform.solrfacetsearch.config.IndexedProperty; import de.hybris.platform.solrfacetsearch.config.exceptions.FieldValueProviderException; import de.hybris.platform.solrfacetsearch.provider.FieldNameProvider; import de.hybris.platform.solrfacetsearch.provider.FieldValue; import de.hybris.platform.solrfacetsearch.provider.FieldValueProvider; import de.hybris.platform.solrfacetsearch.provider.impl.AbstractPropertyFieldValueProvider; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.List; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Required; /** * {@link FieldValueProvider} for prices. Supports multi-currencies.<br> * The list of prices is loaded for the anonymous user and current catalog version. <br> */ public class VolumeAwareProductPriceValueProvider extends AbstractPropertyFieldValueProvider implements FieldValueProvider { private static final Logger LOG = Logger.getLogger(FieldValueProvider.class.getName()); private FieldNameProvider fieldNameProvider; private PriceService priceService; private UserService userService; private SessionService sessionService; private CommonI18NService commonI18NService; private Comparator<PriceInformation> priceComparator; private CatalogVersionService catalogVersionService; @Override public Collection<FieldValue> getFieldValues(final IndexConfig indexConfig, final IndexedProperty indexedProperty, final Object model) throws FieldValueProviderException { final Collection<FieldValue> fieldValues = new ArrayList<FieldValue>(); try { checkModel(model); final Collection<CatalogVersionModel> filteredCatalogVersions = filterCatalogVersions( getCatalogVersionService().getSessionCatalogVersions()); if (indexConfig.getCurrencies().isEmpty()) { final List<PriceInformation> prices = new ArrayList<PriceInformation>(); sessionService.executeInLocalView(new SessionExecutionBody() { @Override public void executeWithoutResult() { getCatalogVersionService().setSessionCatalogVersions(filteredCatalogVersions); prices.addAll(priceService.getPriceInformationsForProduct((ProductModel) model)); } }, userService.getAnonymousUser()); processPricesWithEmptyCurrencies(indexedProperty, fieldValues, prices); } else { for (final CurrencyModel currency : indexConfig.getCurrencies()) { final List<PriceInformation> prices = new ArrayList<PriceInformation>(); sessionService.executeInLocalView(new SessionExecutionBody() { @Override public void executeWithoutResult() { getCatalogVersionService().setSessionCatalogVersions(filteredCatalogVersions); commonI18NService.setCurrentCurrency(currency); prices.addAll(priceService.getPriceInformationsForProduct((ProductModel) model)); } }, userService.getAnonymousUser()); processPricesForCurrency(indexedProperty, fieldValues, currency, prices); } } } catch (final Exception e) { LOG.error("Failed to generate volume price", e); throw new FieldValueProviderException( "Cannot evaluate " + indexedProperty.getName() + " using " + this.getClass().getName(), e); } return fieldValues; } protected void checkModel(final Object model) throws FieldValueProviderException { if (!(model instanceof ProductModel)) { throw new FieldValueProviderException("Cannot evaluate price of non-product item"); } } protected void processPricesForCurrency(final IndexedProperty indexedProperty, final Collection<FieldValue> fieldValues, final CurrencyModel currency, final List<PriceInformation> prices) throws FieldValueProviderException { if (!prices.isEmpty()) { List<String> rangeNameList; Collections.sort(prices, priceComparator); final Double value = Double.valueOf(prices.get(0).getPriceValue().getValue()); rangeNameList = getRangeNameList(indexedProperty, value, currency.getIsocode()); final Collection<String> fieldNames = fieldNameProvider.getFieldNames(indexedProperty, currency.getIsocode().toLowerCase()); addFieldValues(fieldValues, rangeNameList, value, fieldNames); } } protected void processPricesWithEmptyCurrencies(final IndexedProperty indexedProperty, final Collection<FieldValue> fieldValues, final List<PriceInformation> prices) throws FieldValueProviderException { if (!prices.isEmpty()) { List<String> rangeNameList; Collections.sort(prices, priceComparator); final PriceInformation price = prices.get(0); final Double value = Double.valueOf(price.getPriceValue().getValue()); rangeNameList = getRangeNameList(indexedProperty, value); final Collection<String> fieldNames = fieldNameProvider.getFieldNames(indexedProperty, price.getPriceValue().getCurrencyIso()); addFieldValues(fieldValues, rangeNameList, value, fieldNames); } } protected void addFieldValues(final Collection<FieldValue> fieldValues, final List<String> rangeNameList, final Double value, final Collection<String> fieldNames) { for (final String fieldName : fieldNames) { if (rangeNameList.isEmpty()) { fieldValues.add(new FieldValue(fieldName, value)); } else { for (final String rangeName : rangeNameList) { fieldValues.add(new FieldValue(fieldName, rangeName == null ? value : rangeName)); } } } } protected Collection<CatalogVersionModel> filterCatalogVersions(final Collection<CatalogVersionModel> sessionCatalogVersions) { final List<CatalogVersionModel> result = new ArrayList<CatalogVersionModel>(sessionCatalogVersions.size()); for (final CatalogVersionModel catalogVersion : sessionCatalogVersions) { if (!(catalogVersion instanceof ClassificationSystemVersionModel) && !(catalogVersion.getCatalog() instanceof ContentCatalogModel)) { result.add(catalogVersion); } } return result; } protected FieldNameProvider getFieldNameProvider() { return fieldNameProvider; } @Required public void setFieldNameProvider(final FieldNameProvider fieldNameProvider) { this.fieldNameProvider = fieldNameProvider; } protected PriceService getPriceService() { return priceService; } @Required public void setPriceService(final PriceService priceService) { this.priceService = priceService; } protected UserService getUserService() { return userService; } @Required public void setUserService(final UserService userService) { this.userService = userService; } protected SessionService getSessionService() { return sessionService; } @Required public void setSessionService(final SessionService sessionService) { this.sessionService = sessionService; } protected CommonI18NService getCommonI18NService() { return commonI18NService; } @Required public void setCommonI18NService(final CommonI18NService commonI18NService) { this.commonI18NService = commonI18NService; } protected Comparator<PriceInformation> getPriceComparator() { return priceComparator; } @Required public void setPriceComparator(final Comparator<PriceInformation> priceComparator) { this.priceComparator = priceComparator; } protected CatalogVersionService getCatalogVersionService() { return catalogVersionService; } @Required public void setCatalogVersionService(final CatalogVersionService catalogVersionService) { this.catalogVersionService = catalogVersionService; } }
[ "marc@awesomewebsite.ca" ]
marc@awesomewebsite.ca
050605720e0caa10d0dfd0cedffc18d6fc8058e1
b09eca5398c725bd831bc77d3eeef2fe547ccd7f
/src/main/java/org/mybatis/generator/internal/util/JavaBeansUtil.java
073992a575905d1a57daf5d00e01a020caa5b935
[]
no_license
weijunjie715/mypro
49e1768444d4629409279938ca521d257ff9de66
1cc0095f2ae4f72a138275f094235ed2af70d9e0
refs/heads/master
2023-04-09T21:09:26.494383
2021-04-17T05:02:12
2021-04-17T05:02:12
341,493,987
0
0
null
null
null
null
UTF-8
Java
false
false
9,949
java
/** * Copyright 2006-2018 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.mybatis.generator.internal.util; import org.mybatis.generator.api.IntrospectedColumn; import org.mybatis.generator.api.IntrospectedTable; import org.mybatis.generator.api.dom.java.*; import org.mybatis.generator.config.Context; import org.mybatis.generator.config.PropertyRegistry; import org.mybatis.generator.config.TableConfiguration; import java.util.Locale; import java.util.Properties; import static org.mybatis.generator.internal.util.StringUtility.isTrue; /** * @author Jeff Butler */ public class JavaBeansUtil { private JavaBeansUtil() { super(); } /** * Computes a getter method name. Warning - does not check to see that the property is a valid * property. Call getValidPropertyName first. * * @param property * the property * @param fullyQualifiedJavaType * the fully qualified java type * @return the getter method name */ public static String getGetterMethodName(String property, FullyQualifiedJavaType fullyQualifiedJavaType) { StringBuilder sb = new StringBuilder(); sb.append(property); if (Character.isLowerCase(sb.charAt(0))) { if (sb.length() == 1 || !Character.isUpperCase(sb.charAt(1))) { sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); } } if (fullyQualifiedJavaType.equals(FullyQualifiedJavaType .getBooleanPrimitiveInstance())) { sb.insert(0, "is"); //$NON-NLS-1$ } else { sb.insert(0, "get"); //$NON-NLS-1$ } return sb.toString(); } /** * Computes a setter method name. Warning - does not check to see that the property is a valid * property. Call getValidPropertyName first. * * @param property * the property * @return the setter method name */ public static String getSetterMethodName(String property) { StringBuilder sb = new StringBuilder(); sb.append(property); if (Character.isLowerCase(sb.charAt(0))) { if (sb.length() == 1 || !Character.isUpperCase(sb.charAt(1))) { sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); } } sb.insert(0, "set"); //$NON-NLS-1$ return sb.toString(); } public static String getFirstCharacterUppercase(String inputString) { StringBuilder sb = new StringBuilder(inputString); sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); return sb.toString(); } public static String getCamelCaseString(String inputString, boolean firstCharacterUppercase) { StringBuilder sb = new StringBuilder(); boolean nextUpperCase = false; for (int i = 0; i < inputString.length(); i++) { char c = inputString.charAt(i); switch (c) { case '_': case '-': case '@': case '$': case '#': case ' ': case '/': case '&': if (sb.length() > 0) { nextUpperCase = true; } break; default: if (nextUpperCase) { sb.append(Character.toUpperCase(c)); nextUpperCase = false; } else { sb.append(Character.toLowerCase(c)); } break; } } if (firstCharacterUppercase) { sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); } return sb.toString(); } /** * This method ensures that the specified input string is a valid Java property name. * * <p>The rules are as follows: * * <ol> * <li>If the first character is lower case, then OK</li> * <li>If the first two characters are upper case, then OK</li> * <li>If the first character is upper case, and the second character is lower case, then the first character should be made * lower case</li> * </ol> * * <p>For example: * * <ul> * <li>eMail &gt; eMail</li> * <li>firstName &gt; firstName</li> * <li>URL &gt; URL</li> * <li>XAxis &gt; XAxis</li> * <li>a &gt; a</li> * <li>B &gt; b</li> * <li>Yaxis &gt; yaxis</li> * </ul> * * @param inputString * the input string * @return the valid property name */ public static String getValidPropertyName(String inputString) { String answer; if (inputString == null) { answer = null; } else if (inputString.length() < 2) { answer = inputString.toLowerCase(Locale.US); } else { if (Character.isUpperCase(inputString.charAt(0)) && !Character.isUpperCase(inputString.charAt(1))) { answer = inputString.substring(0, 1).toLowerCase(Locale.US) + inputString.substring(1); } else { answer = inputString; } } return answer; } public static Method getJavaBeansGetter(IntrospectedColumn introspectedColumn, Context context, IntrospectedTable introspectedTable) { FullyQualifiedJavaType fqjt = introspectedColumn .getFullyQualifiedJavaType(); String property = introspectedColumn.getJavaProperty(); Method method = new Method(getGetterMethodName(property, fqjt)); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(fqjt); context.getCommentGenerator().addGetterComment(method, introspectedTable, introspectedColumn); StringBuilder sb = new StringBuilder(); sb.append("return "); //$NON-NLS-1$ sb.append(property); sb.append(';'); method.addBodyLine(sb.toString()); return method; } public static Field getJavaBeansField(IntrospectedColumn introspectedColumn, Context context, IntrospectedTable introspectedTable) { FullyQualifiedJavaType fqjt = introspectedColumn .getFullyQualifiedJavaType(); String property = introspectedColumn.getJavaProperty(); Field field = new Field(property, fqjt); field.setVisibility(JavaVisibility.PRIVATE); context.getCommentGenerator().addFieldComment(field, introspectedTable, introspectedColumn); return field; } public static Method getJavaBeansSetter(IntrospectedColumn introspectedColumn, Context context, IntrospectedTable introspectedTable) { FullyQualifiedJavaType fqjt = introspectedColumn .getFullyQualifiedJavaType(); String property = introspectedColumn.getJavaProperty(); Method method = new Method(getSetterMethodName(property)); method.setVisibility(JavaVisibility.PUBLIC); method.addParameter(new Parameter(fqjt, property)); context.getCommentGenerator().addSetterComment(method, introspectedTable, introspectedColumn); StringBuilder sb = new StringBuilder(); if (introspectedColumn.isStringColumn() && isTrimStringsEnabled(introspectedColumn)) { sb.append("this."); //$NON-NLS-1$ sb.append(property); sb.append(" = "); //$NON-NLS-1$ sb.append(property); sb.append(" == null ? null : "); //$NON-NLS-1$ sb.append(property); sb.append(".trim();"); //$NON-NLS-1$ method.addBodyLine(sb.toString()); } else { sb.append("this."); //$NON-NLS-1$ sb.append(property); sb.append(" = "); //$NON-NLS-1$ sb.append(property); sb.append(';'); method.addBodyLine(sb.toString()); } return method; } private static boolean isTrimStringsEnabled(Context context) { Properties properties = context .getJavaModelGeneratorConfiguration().getProperties(); boolean rc = isTrue(properties .getProperty(PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS)); return rc; } private static boolean isTrimStringsEnabled(IntrospectedTable table) { TableConfiguration tableConfiguration = table.getTableConfiguration(); String trimSpaces = tableConfiguration.getProperties().getProperty(PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS); if (trimSpaces != null) { return isTrue(trimSpaces); } return isTrimStringsEnabled(table.getContext()); } private static boolean isTrimStringsEnabled(IntrospectedColumn column) { String trimSpaces = column.getProperties().getProperty(PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS); if (trimSpaces != null) { return isTrue(trimSpaces); } return isTrimStringsEnabled(column.getIntrospectedTable()); } }
[ "weijunjie715@163.com" ]
weijunjie715@163.com
4e6c75063d620f1e602dfc97ae04d051888e081b
501b936076ae329da0d4cbfb3d08838eba742ab2
/src/main/java/info/InfoConverter.java
4fcb02509e53409216a37e83f1d8ee693fb8c96f
[]
no_license
grisu/examples
7227f7115928c830a2c56f1a994d8a70da316912
e79653405b0d796cd61dc44472c129e873913e01
refs/heads/master
2021-01-19T13:52:57.714150
2012-06-28T01:45:44
2012-06-28T01:45:44
1,548,387
2
0
null
null
null
null
UTF-8
Java
false
false
345
java
package info; import grisu.control.info.SqlInfoManager; import grisu.jcommons.model.info.IDirectory; public class InfoConverter { public static void main(String[] args) throws Exception { SqlInfoManager im = new SqlInfoManager(); for (IDirectory d : im.getDirectoriesForVO("/nz/nesi")) { System.out.println(d.getUrl()); } } }
[ "m.binsteiner@auckland.ac.nz" ]
m.binsteiner@auckland.ac.nz
5bb8b908bc9d2ae20dd158b4c11a44c0abfc89bf
d04d1e491bbb63611896262697fb9ba5f5a5c361
/src/main/java/com/ssafy/safefood/model/chart/ChartController.java
97310480a1eb8c754f616642bc73490468906132
[]
no_license
ohjuntaek/safe-food
4684d10f17b641b0361e8b360661cc0acb7112ce
c6699e1b5904051020693d820d6f4491ee1416fe
refs/heads/master
2020-05-21T15:41:54.402404
2019-07-12T08:30:15
2019-07-12T08:30:15
186,097,490
0
0
null
null
null
null
UTF-8
Java
false
false
1,423
java
package com.ssafy.safefood.model.chart; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.google.gson.Gson; import com.ssafy.safefood.model.service.IngestService; @Controller public class ChartController { @Autowired IngestService ingestService; @GetMapping("/getchartdata") public @ResponseBody String getChartData(HttpSession session) { System.out.println("getchartdata"); Gson gson = new Gson(); String json = gson.toJson(ingestService.selectCaloryGroupByMonth((String) session.getAttribute("id"))); System.out.println(json); return json; } @GetMapping("/chart") public String showChart() { return "chart/chart"; } @GetMapping("/chart2") public String showChart2() { return "chart/chart2"; } @GetMapping("/getsum") public @ResponseBody String getSumGroupByNutrient(HttpSession session) { Gson gson = new Gson(); String json; json = gson.toJson(ingestService.getSumGroupByNutrient((String) session.getAttribute("id"))); return json; } @GetMapping("/getallsum") public @ResponseBody String getAllSumGroupByNutrient() { Gson gson = new Gson(); String json; json = gson.toJson(ingestService.getSumGroupByNutrient("")); return json; } }
[ "dimes12@naver.com" ]
dimes12@naver.com
5ecf8919a019761e8d421c402e935c0c05d23633
7f6c9df125bf4a46a8ce5d78c9a2cbf4618f044d
/src/main/java/pl/edu/agh/cs/kraksim/iface/sim/TravelEndHandler.java
1e09ee9e20e187a1e2b342ffaab9be7d092c507e
[]
no_license
Pysiokot/Kraksim_drivers
e2d91faf6952142fcd962e11f32539f6c7cd2a62
acda939a1fe77da64a95d714b3b742c3f95cbf4f
refs/heads/master
2022-12-10T07:09:03.233071
2020-09-11T14:33:41
2020-09-11T14:33:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
118
java
package pl.edu.agh.cs.kraksim.iface.sim; public interface TravelEndHandler { void handleTravelEnd(Object driver); }
[ "piotrek628@gmail.com" ]
piotrek628@gmail.com
3b3ef6b6fc05e2f8301221cffb4298d8a6dee6bf
adc305b1b614253e693021ea0dd09f236f553205
/src/main/java/net/hycrafthd/corelib/core/ModMetadataFetcherCoreLib.java
a4f5738c41c971652738c24c5c6533d4c8005401
[ "Apache-2.0" ]
permissive
MrTroble/ModLibary
f89b886c96ed2971888c079ad916973e5d1bc2e3
c9758bd3853a69ab6a6182b92099d2a22bdb74d5
refs/heads/master
2021-01-18T19:11:27.132473
2016-06-26T09:32:50
2016-06-26T09:32:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
522
java
package net.hycrafthd.corelib.core; import net.hycrafthd.corelib.CoreLib; import net.hycrafthd.corelib.util.BaseModMetadataFetcher; import net.minecraftforge.fml.common.ModMetadata; public class ModMetadataFetcherCoreLib extends BaseModMetadataFetcher { public ModMetadataFetcherCoreLib() { super("/corelib.info", CoreLib.MODID); } @Override public ModMetadata getModmeta() { ModMetadata modmeta = super.getModmeta(); modmeta.name = CoreLib.NAME; modmeta.version = CoreLib.VERSION; return modmeta; } }
[ "hycrafthd@live.de" ]
hycrafthd@live.de
4ef3089e130c333d6b55e5998de188b81c0fa991
e836b6a4c1337ddf377e9a90fe232e9f7442e60f
/plastecno-service/src/br/com/svr/service/UsuarioService.java
d2934a2a7134f518794d9e331970512730bfaae0
[]
no_license
viniciusfernandes/plastecno
f456a45ccd8831fc9aef2c54a8c0a4cd3b50deb3
0058b44e47228fc1b3125edf0e9eb328770ee835
refs/heads/master
2021-01-23T17:31:44.369258
2019-02-25T18:42:48
2019-02-25T18:42:48
22,238,656
1
0
null
null
null
null
UTF-8
Java
false
false
3,038
java
package br.com.svr.service; import java.util.List; import javax.ejb.Local; import br.com.svr.service.constante.TipoAcesso; import br.com.svr.service.entity.ContatoUsuario; import br.com.svr.service.entity.LogradouroUsuario; import br.com.svr.service.entity.PerfilAcesso; import br.com.svr.service.entity.Usuario; import br.com.svr.service.exception.BusinessException; import br.com.svr.service.wrapper.PaginacaoWrapper; @Local public interface UsuarioService { void alterarComissaoSimples(Integer iUsuario, boolean isComissaoSimples); void associarCliente(Integer idVendedor, Integer idCliente) throws BusinessException; @Deprecated void associarCliente(Integer idVendedor, List<Integer> listaIdClienteAssociado) throws BusinessException; void associarCliente(Integer idVendedor, List<Integer> listaIdClienteAssociado, List<Integer> listaIdClienteDesassociado) throws BusinessException; int desabilitar(Integer id) throws BusinessException; void desassociarCliente(Integer idVendedor, List<Integer> listaIdClienteDesassociado) throws BusinessException; Integer inserir(Usuario usuario, boolean isAlteracaoSenha) throws BusinessException; boolean isAcessoPermitido(Integer idUsuario, TipoAcesso... tipos); boolean isClienteAssociadoVendedor(Integer idCliente, Integer idVendedor); boolean isComissionadoSimples(Integer idUsuario); boolean isCompraPermitida(Integer idUsuario); boolean isCPF(Integer id, String cpf); boolean isEmailExistente(Integer id, String email); boolean isVendaPermitida(Integer idCliente, Integer idVendedor); boolean isVendedorAtivo(Integer idVendedor); PaginacaoWrapper<Usuario> paginarUsuario(Usuario filtro, boolean isVendedor, Boolean apenasAtivos, Integer indiceRegistroInicial, Integer numeroMaximoRegistros); PaginacaoWrapper<Usuario> paginarVendedor(Usuario filtro, Boolean apenasAtivos, Integer indiceRegistroInicial, Integer numeroMaximoRegistros); List<Usuario> pesquisarBy(Usuario filtro); List<Usuario> pesquisarBy(Usuario filtro, Boolean apenasAtivos, Integer indiceRegistroInicial, Integer numeroMaximoRegistros); Usuario pesquisarById(Integer id); List<Usuario> pesquisarByNome(String nome); List<ContatoUsuario> pesquisarContatos(Integer id); LogradouroUsuario pesquisarLogradouro(Integer id); List<PerfilAcesso> pesquisarPerfisAssociados(Integer id); List<PerfilAcesso> pesquisarPerfisNaoAssociados(Integer id); String pesquisarSenhaByEmail(String email); Long pesquisarTotalRegistros(Usuario filtro, Boolean apenasAtivos, boolean isVendedor); Usuario pesquisarUsuarioResumidoById(Integer idUsuario); Usuario pesquisarVendedorById(Integer idVendedor); Usuario pesquisarVendedorByIdCliente(Integer idCliente); List<Usuario> pesquisarVendedorByNome(String nome); List<Usuario> pesquisarVendedores(Usuario filtro, Boolean apenasAtivos, Integer indiceRegistroInicial, Integer numeroMaximoRegistros); Usuario pesquisarVendedorResumidoByIdCliente(Integer idCliente); void removerLogradouro(Integer idLogradouro); }
[ "viniciussf@hotmail.com" ]
viniciussf@hotmail.com
70395f38c30a8095e56097ff2931da20d5ba4e7c
32522c2fc711492a828b6fc9fe8e1764e91b0b8d
/src/api-gateway/src/test/java/com/bus/apigateway/ApiGatewayApplicationTests.java
7234cc4e1949d7a46f74e7c842eda7b91cb472d9
[]
no_license
AdvancedServicesEngineeringFudan2018/Bus-schedule
f13d4566bdcd1e1b5c6d8c7ea083ab4f6dceeceb
aaa08df9cac96ed79c49c766d02ff7d659918c26
refs/heads/master
2020-03-22T21:09:24.689474
2018-07-18T07:09:01
2018-07-18T07:09:01
140,661,709
0
1
null
null
null
null
UTF-8
Java
false
false
339
java
package com.bus.apigateway; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ApiGatewayApplicationTests { @Test public void contextLoads() { } }
[ "32250535+Guosiying@users.noreply.github.com" ]
32250535+Guosiying@users.noreply.github.com
36bc2d383fe54d858555c9a6999c712a1c5820ac
c2306b644a0aaf38c85a651142bb6276674cb937
/net.certware.intent/src-gen/net/certware/intent/intentSpecification/impl/ModelTypeImpl.java
c475c71b1b2fb8cb6e39eeae9f2b7ecad3156adf
[ "Apache-2.0" ]
permissive
iensen/CertWare
61ba4caae6ef4bf2106aa84b53b03ae1d5f0b969
b397d85512d8f1d5cc696bd44d0ff1c6de59b85d
refs/heads/master
2021-01-15T12:15:41.627232
2016-03-14T23:26:26
2016-03-14T23:26:26
53,889,401
0
0
null
2016-03-14T20:25:23
2016-03-14T20:25:22
null
UTF-8
Java
false
false
3,964
java
/** */ package net.certware.intent.intentSpecification.impl; import net.certware.intent.intentSpecification.IntentSpecificationPackage; import net.certware.intent.intentSpecification.ModelType; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Model Type</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link net.certware.intent.intentSpecification.impl.ModelTypeImpl#getTypeName <em>Type Name</em>}</li> * </ul> * </p> * * @generated */ public class ModelTypeImpl extends MinimalEObjectImpl.Container implements ModelType { /** * The default value of the '{@link #getTypeName() <em>Type Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTypeName() * @generated * @ordered */ protected static final String TYPE_NAME_EDEFAULT = null; /** * The cached value of the '{@link #getTypeName() <em>Type Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getTypeName() * @generated * @ordered */ protected String typeName = TYPE_NAME_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ModelTypeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return IntentSpecificationPackage.Literals.MODEL_TYPE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getTypeName() { return typeName; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setTypeName(String newTypeName) { String oldTypeName = typeName; typeName = newTypeName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, IntentSpecificationPackage.MODEL_TYPE__TYPE_NAME, oldTypeName, typeName)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case IntentSpecificationPackage.MODEL_TYPE__TYPE_NAME: return getTypeName(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case IntentSpecificationPackage.MODEL_TYPE__TYPE_NAME: setTypeName((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case IntentSpecificationPackage.MODEL_TYPE__TYPE_NAME: setTypeName(TYPE_NAME_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case IntentSpecificationPackage.MODEL_TYPE__TYPE_NAME: return TYPE_NAME_EDEFAULT == null ? typeName != null : !TYPE_NAME_EDEFAULT.equals(typeName); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (typeName: "); result.append(typeName); result.append(')'); return result.toString(); } } //ModelTypeImpl
[ "mrb@certware.net" ]
mrb@certware.net
fdd9b23fbc32ade3464cd52fc5a69ebe286e5f2a
841a74c1052439f242092c4d1a761670df3d8e6e
/newz-step4-boilerplate/NewsSourceService/src/main/java/com/stackroute/newz/controller/NewsSourceController.java
f2ba1dacf612229aa2e233c275393ea93386ec4a
[]
no_license
realabdul786/stackroute-challlenges
60bd47fd690a6d7e4b50f062d10a63b9fa12b3f9
22b5dbf2e976c8b5cf16b8ccc9a1301e8dd7ed65
refs/heads/master
2023-03-17T21:37:35.013199
2021-02-03T02:22:54
2021-02-03T02:22:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,841
java
package com.stackroute.newz.controller; import com.stackroute.newz.model.NewsSource; import com.stackroute.newz.service.NewsSourceService; import com.stackroute.newz.util.exception.NewsSourceNotFoundException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; /* * As in this assignment, we are working with creating RESTful web service, hence annotate * the class with @RestController annotation.A class annotated with @Controller annotation * has handler methods which returns a view. However, if we use @ResponseBody annotation along * with @Controller annotation, it will return the data directly in a serialized * format. Starting from Spring 4 and above, we can use @RestController annotation which * is equivalent to using @Controller and @ResposeBody annotation */ @RestController @RequestMapping("/api/v1/newssource") public class NewsSourceController { private NewsSourceService newsSourceService; /* * Autowiring should be implemented for the NewsService. (Use Constructor-based * autowiring) Please note that we should not create any object using the new * keyword */ @Autowired public NewsSourceController(NewsSourceService newsSourceService) { this.newsSourceService = newsSourceService; } /* * Define a handler method which will create a specific newssource by reading the * Serialized object from request body and save the newssource details in the * database.This handler method should return any one of the status messages * basis on different situations: * 1. 201(CREATED) - If the newssource created successfully. * 2. 409(CONFLICT) - If the newssourceId conflicts with any existing user. * * This handler method should map to the URL "/api/v1/newssource" using HTTP POST method */ @PostMapping public ResponseEntity<?> createNewsSource(@RequestBody NewsSource newNewsSource) { final boolean createNewsSourceResponse = newsSourceService.addNewsSource(newNewsSource); if (createNewsSourceResponse) return new ResponseEntity<>(createNewsSourceResponse, HttpStatus.CREATED); else { return new ResponseEntity<>(HttpStatus.CONFLICT); } } /* * Define a handler method which will delete a newssource from a database. * This handler method should return any one of the status messages basis * on different situations: * 1. 200(OK) - If the newssource deleted successfully from database. * 2. 404(NOT FOUND) - If the newssource with specified newsId is not found. * * This handler method should map to the URL "/api/v1/newssource/{newssourceId}" * using HTTP Delete method where "userId" should be replaced by a valid userId * without {} and "newssourceId" should be replaced by a valid newsId * without {}. * */ @DeleteMapping("/{newsSourceId}") public ResponseEntity<?> deleteNewsBySourceId(@PathVariable int newsSourceId) { final boolean response = newsSourceService.deleteNewsSource(newsSourceId); if (response) return new ResponseEntity<>(response, HttpStatus.OK); else return new ResponseEntity<>(HttpStatus.NOT_FOUND); } /* * Define a handler method which will update a specific newssource by reading the * Serialized object from request body and save the updated newssource details in a * database. This handler method should return any one of the status messages * basis on different situations: * 1. 200(OK) - If the newssource updated successfully. * 2. 404(NOT FOUND) - If the newssource with specified newssourceId is not found. * * This handler method should map to the URL "/api/v1/newssource/{newssourceId}" using * HTTP PUT method where "newssourceId" should be replaced by a valid newssourceId * without {}. * */ @PutMapping("/{newsSourceId}") public ResponseEntity<?> updateNewsSource(@PathVariable int newsSourceId, @RequestBody NewsSource updatedNewsSource) throws NewsSourceNotFoundException { return new ResponseEntity<>(newsSourceService.updateNewsSource(updatedNewsSource, newsSourceId), HttpStatus.OK); } /* * Define a handler method which will get us the specific newssource by a userId. * This handler method should return any one of the status messages basis on * different situations: * 1. 200(OK) - If the newssource found successfully. * 2. 404(NOT FOUND) - If the newssource with specified newsId is not found. * * This handler method should map to the URL "/api/v1/newssource/{userId}/{newssourceId}" * using HTTP GET method where "userId" should be replaced by a valid userId * without {} and "newssourceId" should be replaced by a valid newsId without {}. * */ @GetMapping("/{userId}/{newsSourceId}") public ResponseEntity<?> getNewsBySourceId(@PathVariable("userId") String userId, @PathVariable("newsSourceId") int newsSourceId) throws NewsSourceNotFoundException { return new ResponseEntity<>(newsSourceService.getNewsSourceById(userId, newsSourceId), HttpStatus.OK); } /* * Define a handler method which will show details of all newssource created by specific * user. This handler method should return any one of the status messages basis on * different situations: * 1. 200(OK) - If the newssource found successfully. * 2. 404(NOT FOUND) - If the newssource with specified newsId is not found. * This handler method should map to the URL "/api/v1/newssource/{userId}" using HTTP GET method * where "userId" should be replaced by a valid userId without {}. * */ @GetMapping("/{userId}") public ResponseEntity<?> getNewsByUserId(@PathVariable("userId") String userId) throws NewsSourceNotFoundException { return new ResponseEntity<>(newsSourceService.getAllNewsSourceByUserId(userId), HttpStatus.OK); } }
[ "mehersupreeth@gmail.com" ]
mehersupreeth@gmail.com
9e361b68f174fadd36b1304841525312831b5b4b
53167799c1c1ffd71d765476911902a041d7a089
/src/main/java/com/gavin/community/mapper/QuestionMapper.java
60cfb6ca3e63e5e5a7aea26f699a26be4ce82059
[]
no_license
Gavin6581/community
27f354a5c33cc644c0bc5afee716b8e5db62d459
aced042bda9116250360909e90fbf910ca6896ef
refs/heads/main
2023-02-21T13:49:11.133683
2021-01-28T05:26:44
2021-01-28T05:26:44
331,500,985
0
0
null
null
null
null
UTF-8
Java
false
false
422
java
package com.gavin.community.mapper; import com.gavin.community.model.Question; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; @Mapper public interface QuestionMapper { @Insert("insert into question (title,description,gmt_create,gmt_modified,creator,tag) values(#{title},#{description},#{gmtCreate},#{gmtModified},#{creator},#{tag})") void create(Question question); }
[ "3122655867@qq.com" ]
3122655867@qq.com
640485232089118b963103c9eea58365b2fc0ded
ed12509324a7ab2c275646b54903fb1b0e9c4e33
/src/br/com/sp/gov/matriz/Ex04Mat.java
f672c20eba8d716a5b9e77108a184b28faeabef1
[ "Apache-2.0" ]
permissive
EdersonSouza02/WorkspaceEtec
0da2c932402f7d2ad171bfd61c98b99a3ecea943
5bcce77c5cb40270a29bd9e51d8055d7fec5bdcc
refs/heads/master
2020-03-21T19:38:19.890881
2018-06-28T03:25:29
2018-06-28T03:25:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
938
java
package br.com.sp.gov.matriz; import javax.swing.JOptionPane; public class Ex04Mat { public static void metodo() { String mat[][] = new String[10][3]; for (int linha = 0; linha < 10; linha++) { mat[linha][0] = JOptionPane.showInputDialog("Informe o " + (linha + 1) + (0 + 1) + "nome: "); mat[linha][1] = JOptionPane.showInputDialog("Informe o " + (linha + 1) + (1 + 1) + "telefone:"); mat[linha][2] = JOptionPane.showInputDialog("Informe o " + (linha + 1) + + (2 + 1) + "Endereco:"); } String PesquisaNome = JOptionPane.showInputDialog("Informe o nome para pesquisa"); for (int linha = 0; linha < 10; linha++) { if (mat[linha][0].equals(PesquisaNome)) { JOptionPane.showMessageDialog(null, "Nome: " + mat[linha][0] + "Endereco: " + mat[linha][1] + "Telefone: " + mat[linha][2]); } } } }
[ "you@example.com" ]
you@example.com
82467d34c79ad28d8993a74b482d4e6b515808e2
36073e09d6a12a275cc85901317159e7fffa909e
/nuxeo_nuxeo/modifiedFiles/2/fix/AnnotationFeature.java
0a51e07b9849d9b9c4b6d761e583656e697d67f1
[]
no_license
monperrus/bug-fixes-saner16
a867810451ddf45e2aaea7734d6d0c25db12904f
9ce6e057763db3ed048561e954f7aedec43d4f1a
refs/heads/master
2020-03-28T16:00:18.017068
2018-11-14T13:48:57
2018-11-14T13:48:57
148,648,848
3
0
null
null
null
null
UTF-8
Java
false
false
1,132
java
package org.nuxeo.ecm.platform.annotations.repository.service; import org.nuxeo.ecm.platform.test.PlatformFeature; import org.nuxeo.runtime.api.Framework; import org.nuxeo.runtime.test.runner.Deploy; import org.nuxeo.runtime.test.runner.Features; import org.nuxeo.runtime.test.runner.FeaturesRunner; import org.nuxeo.runtime.test.runner.LocalDeploy; import org.nuxeo.runtime.test.runner.SimpleFeature; @Features(PlatformFeature.class) @Deploy({ "org.nuxeo.ecm.platform.url.core", "org.nuxeo.ecm.relations.api", "org.nuxeo.ecm.relations", "org.nuxeo.ecm.relations.jena", "org.nuxeo.ecm.platform.types.api", "org.nuxeo.ecm.platform.types.core", "org.nuxeo.ecm.annotations", "org.nuxeo.ecm.annotations.contrib", "org.nuxeo.ecm.annotations.repository", "org.nuxeo.ecm.annotations.repository.test", "org.nuxeo.runtime.jtajca", "org.nuxeo.runtime.datasource" }) @LocalDeploy({ "org.nuxeo.runtime.datasource:anno-ds.xml" }) public class AnnotationFeature extends SimpleFeature { @Override public void initialize(FeaturesRunner runner) { Framework.addListener(new AnnotationsJenaSetup()); } }
[ "martin.monperrus@gnieh.org" ]
martin.monperrus@gnieh.org
1b7e05e1eb1f4c0998e52df3bbcbedfcf7bdb154
e5b193babffd9501adb9de6d079127ece94d06b3
/hotdog-after-end-master/hotdog-trade/src/main/java/com/pmzhongguo/ex/datalab/manager/AccountFeeReductionManager.java
9ebe250930ca14478b3924bc4babd10ee78dd473
[]
no_license
wh0amis/caex
8ff4ffd5aacd4f04f9ab936eb24943e291d2ddd4
701cac06f7f2894c7a6dd02ea90a36459643ae63
refs/heads/main
2023-05-11T11:47:46.954443
2021-06-06T17:35:18
2021-06-06T17:35:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,403
java
package com.pmzhongguo.ex.datalab.manager; import com.pmzhongguo.ex.core.web.ErrorInfoEnum; import com.pmzhongguo.ex.core.web.resp.ObjResp; import com.pmzhongguo.ex.core.web.resp.Resp; import com.pmzhongguo.ex.datalab.entity.AccountFee; import com.pmzhongguo.ex.datalab.entity.AccountFeeDetail; import com.pmzhongguo.ex.datalab.enums.AccountFeeDetailEnum; import com.pmzhongguo.ex.datalab.service.AccountFeeService; import com.qiniu.util.DateStyleEnum; import com.qiniu.util.DateUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.util.Date; /** * ๆ‰‹็ปญ่ดน่ต„ไบง่ฟ˜ๅŽŸ * * @author jary * @creatTime 2019/12/6 10:00 AM */ @Component public class AccountFeeReductionManager implements AccountFeeChangeService { @Autowired private AccountFeeService accountFeeService; @Override public ObjResp executeAccountFeeChange(AccountFee accountFeeChane, AccountFee accountFeeDB) { if (accountFeeDB.getId() == null){ return new ObjResp(Resp.FAIL,ErrorInfoEnum.SYMBOL_FEE_ACCOUNT_NOT_EXIST.getErrorENMsg(),null); } BigDecimal subtract = accountFeeDB.getForzenAmount().add(accountFeeChane.getForzenAmount()); if (subtract.compareTo(BigDecimal.ZERO) < 0) { return compareAccountFeeAmount(); } accountFeeDB.setForzenAmount(subtract); accountFeeDB.setTotalAmount(accountFeeDB.getTotalAmount().add(accountFeeChane.getForzenAmount().abs())); accountFeeService.accountFeeFrozen(accountFeeDB,executeAccountFeeChange(accountFeeDB,accountFeeChane.getForzenAmount())); return new ObjResp(Resp.SUCCESS, Resp.SUCCESS_MSG, null); } @Override public AccountFeeDetail executeAccountFeeChange(AccountFee accountFeeDB, BigDecimal floatAmount) { return new AccountFeeDetail( accountFeeDB.getMemberId(), accountFeeDB.getFeeCurrency(), AccountFeeDetailEnum.REDUCTION.getType(), accountFeeDB.getTotalAmount(), floatAmount.abs().negate(), DateUtil.dateToString(new Date(), DateStyleEnum.YYYY_MM_DD_HH_MM_SS), null); } @Override public ObjResp compareAccountFeeAmount() { return new ObjResp(Resp.FAIL, ErrorInfoEnum.NOT_SUFFICIENT_FROZEN_FUNDS.getErrorENMsg(), null); } }
[ "ph_lantian@163.com" ]
ph_lantian@163.com
122a9bae8253044a043078d6cb1c5142e23f4afe
280a9cdbc08ad5d4999ba4e528eec9432058383e
/orders-and-customers/src/main/java/io/eventuate/examples/tram/sagas/ordersandcustomers/orders/domain/Order.java
f53980857072d437c16fac2c31d1692e14e13a12
[ "Apache-2.0" ]
permissive
shyding/eventuate-tram-sagas
b0c09490c5cdcc265b7884f89f6e209219d90e00
b41a0558a14cafc1074a4bf88acdcda1ef987510
refs/heads/master
2020-05-28T02:13:27.756339
2019-05-22T17:51:07
2019-05-22T17:51:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,282
java
package io.eventuate.examples.tram.sagas.ordersandcustomers.orders.domain; import io.eventuate.examples.tram.sagas.ordersandcustomers.orders.service.OrderDetails; import io.eventuate.tram.events.ResultWithEvents; import javax.persistence.Access; import javax.persistence.AccessType; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import java.util.Collections; @Entity @Table(name="orders") @Access(AccessType.FIELD) public class Order { @Id @GeneratedValue private Long id; private OrderState state; @Embedded private OrderDetails orderDetails; public Order() { } public Order(OrderDetails orderDetails) { this.orderDetails = orderDetails; this.state = OrderState.PENDING; } public static ResultWithEvents<Order> createOrder(OrderDetails orderDetails) { return new ResultWithEvents<Order>(new Order(orderDetails), Collections.emptyList()); } public Long getId() { return id; } public void noteCreditReserved() { this.state = OrderState.APPROVED; } public void noteCreditReservationFailed() { this.state = OrderState.REJECTED; } public OrderState getState() { return state; } }
[ "chris@chrisrichardson.net" ]
chris@chrisrichardson.net
d69b16576adef2574008b1b98d9debda8af4cb65
97d028b49b6b660fe0c5f6ad9ac2bc9580580b3a
/MyApplication2/app/src/main/java/com/example/asusnb/myapplication/MainActivity.java
9f206b82f99f2338d2e4176091339ddf23406f3e
[]
no_license
garyhsu123/android_final_project
79d98e76b33eadde24b9577a9cbba44a1073113c
9cf83c8bcd4cbfeecd9396acfd97aa7f5461ff2b
refs/heads/master
2021-06-26T20:18:14.453079
2020-09-13T11:09:27
2020-09-13T11:09:27
95,203,415
0
0
null
null
null
null
UTF-8
Java
false
false
969
java
package com.example.asusnb.myapplication; import android.content.Intent; import android.media.Image; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends AppCompatActivity { ImageView logo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); logo=(ImageView)findViewById(R.id.imageLogo) ; logo.setOnClickListener(btnClock); } private Button.OnClickListener btnClock = new Button.OnClickListener(){ @Override public void onClick(View v) { Intent intent = new Intent(); intent.setClass(MainActivity.this,Main2Activity.class); startActivity(intent); } }; }
[ "i_always_smile123@yahoo.com.tw" ]
i_always_smile123@yahoo.com.tw
31d3956f3a2349a415170f6a3d3a4f0b798f192d
80caa2b5432f7d562f1d7a7dcb0fb4053fd93afc
/4kforge_linux/src/a.java
f6aaa8369fbd26371f00eedc894b307d99b4628c
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
Zarkonnen/4kforge
209b84dca5fb57f42491ab221f75c54d16bc178f
e8e44e61bb533b0a1555562b9f1c0623f6ee326f
refs/heads/master
2021-01-16T18:29:38.734212
2014-04-28T08:23:27
2014-04-28T08:23:27
13,564,390
1
0
null
null
null
null
UTF-8
Java
false
false
1,895
java
import java.awt.Canvas; import java.awt.Color; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.image.BufferStrategy; import javax.swing.JApplet; public class a extends JApplet implements Runnable, KeyListener, MouseListener, MouseMotionListener { @Override public void keyTyped(KeyEvent e) {} @Override public void mouseClicked(MouseEvent e) {} @Override public void mouseReleased(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} @Override public void mouseDragged(MouseEvent me) {} @Override public void mouseMoved(MouseEvent me) { my = me.getY(); mx = me.getX(); } @Override public void mousePressed(MouseEvent e) { click = true; } @Override public void keyPressed(KeyEvent e) { key[((KeyEvent) e).getKeyCode()] = true; } @Override public void keyReleased(KeyEvent e) { key[((KeyEvent) e).getKeyCode()] = false; } boolean key[] = new boolean[65535]; boolean click = false; int my, mx; BufferStrategy strategy; @Override public void init() { setIgnoreRepaint(true); Canvas canvas = new Canvas(); add(canvas); canvas.setBounds(0, 0, 800, 600); canvas.createBufferStrategy(2); strategy = canvas.getBufferStrategy(); canvas.addKeyListener(this); canvas.addMouseListener(this); canvas.addMouseMotionListener(this); new Thread(this).start(); } @Override public void run() { int tick = 0; while(true) { tick++; Graphics2D g = (Graphics2D) strategy.getDrawGraphics(); g.setColor(Color.BLACK); g.fillRect(0, 0, 800, 600); g.setColor(Color.RED); g.fillOval(tick % 800, 200, 50, 50); strategy.show(); try { Thread.sleep(25); } catch (Exception e) {} } } }
[ "david.stark@zarkonnen.com" ]
david.stark@zarkonnen.com
0b0e00fef654fa14810043c6548331470ac74693
dba54235b4da9c1ef71020fb79eda385f8af03ad
/src/main/java/egovframework/com/cmm/service/impl/FileManageDAO.java
ba498263811b619b5ca057bfe7309091ddd92f55
[]
no_license
ktyuzz/egov3.7_mybatis_jpa_springdatarest
a6f2227f897d598fa58baf990a9f7fc94d45777b
52bcb3f6ffcdce2e99250470a947fee2d993dd44
refs/heads/master
2020-03-08T02:16:10.501891
2018-04-10T02:39:50
2018-04-10T02:39:50
127,854,527
10
4
null
null
null
null
UTF-8
Java
false
false
4,204
java
package egovframework.com.cmm.service.impl; import java.util.Iterator; import java.util.List; import egovframework.com.cmm.service.FileVO; import org.springframework.stereotype.Repository; /** * @Class Name : EgovFileMngDAO.java * @Description : ํŒŒ์ผ์ •๋ณด ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•œ ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ ํด๋ž˜์Šค * @Modification Information * * ์ˆ˜์ •์ผ ์ˆ˜์ •์ž ์ˆ˜์ •๋‚ด์šฉ * ------- ------- ------------------- * 2009. 3. 25. ์ด์‚ผ์„ญ ์ตœ์ดˆ์ƒ์„ฑ * * @author ๊ณตํ†ต ์„œ๋น„์Šค ๊ฐœ๋ฐœํŒ€ ์ด์‚ผ์„ญ * @since 2009. 3. 25. * @version * @see * */ @Repository("FileManageDAO") public class FileManageDAO extends EgovComAbstractDAO { /** * ์—ฌ๋Ÿฌ ๊ฐœ์˜ ํŒŒ์ผ์— ๋Œ€ํ•œ ์ •๋ณด(์†์„ฑ ๋ฐ ์ƒ์„ธ)๋ฅผ ๋“ฑ๋กํ•œ๋‹ค. * * @param fileList * @return * @throws Exception */ public String insertFileInfs(List<?> fileList) throws Exception { FileVO vo = (FileVO) fileList.get(0); String atchFileId = vo.getAtchFileId(); insert("FileManageDAO.insertFileMaster", vo); Iterator<?> iter = fileList.iterator(); while (iter.hasNext()) { vo = (FileVO) iter.next(); insert("FileManageDAO.insertFileDetail", vo); } return atchFileId; } /** * ํ•˜๋‚˜์˜ ํŒŒ์ผ์— ๋Œ€ํ•œ ์ •๋ณด(์†์„ฑ ๋ฐ ์ƒ์„ธ)๋ฅผ ๋“ฑ๋กํ•œ๋‹ค. * * @param vo * @throws Exception */ public void insertFileInf(FileVO vo) throws Exception { insert("FileManageDAO.insertFileMaster", vo); insert("FileManageDAO.insertFileDetail", vo); } /** * ์—ฌ๋Ÿฌ ๊ฐœ์˜ ํŒŒ์ผ์— ๋Œ€ํ•œ ์ •๋ณด(์†์„ฑ ๋ฐ ์ƒ์„ธ)๋ฅผ ์ˆ˜์ •ํ•œ๋‹ค. * * @param fileList * @throws Exception */ public void updateFileInfs(List<?> fileList) throws Exception { FileVO vo; Iterator<?> iter = fileList.iterator(); while (iter.hasNext()) { vo = (FileVO) iter.next(); insert("FileManageDAO.insertFileDetail", vo); } } /** * ์—ฌ๋Ÿฌ ๊ฐœ์˜ ํŒŒ์ผ์„ ์‚ญ์ œํ•œ๋‹ค. * * @param fileList * @throws Exception */ public void deleteFileInfs(List<?> fileList) throws Exception { Iterator<?> iter = fileList.iterator(); FileVO vo; while (iter.hasNext()) { vo = (FileVO) iter.next(); delete("FileManageDAO.deleteFileDetail", vo); } } /** * ํ•˜๋‚˜์˜ ํŒŒ์ผ์„ ์‚ญ์ œํ•œ๋‹ค. * * @param fvo * @throws Exception */ public void deleteFileInf(FileVO fvo) throws Exception { delete("FileManageDAO.deleteFileDetail", fvo); } /** * ํŒŒ์ผ์— ๋Œ€ํ•œ ๋ชฉ๋ก์„ ์กฐํšŒํ•œ๋‹ค. * * @param vo * @return * @throws Exception */ @SuppressWarnings("unchecked") public List<FileVO> selectFileInfs(FileVO vo) throws Exception { return selectList("FileManageDAO.selectFileList", vo); } /** * ํŒŒ์ผ ๊ตฌ๋ถ„์ž์— ๋Œ€ํ•œ ์ตœ๋Œ€๊ฐ’์„ ๊ตฌํ•œ๋‹ค. * * @param fvo * @return * @throws Exception */ public int getMaxFileSN(FileVO fvo) throws Exception { return (Integer) selectOne("FileManageDAO.getMaxFileSN", fvo); } /** * ํŒŒ์ผ์— ๋Œ€ํ•œ ์ƒ์„ธ์ •๋ณด๋ฅผ ์กฐํšŒํ•œ๋‹ค. * * @param fvo * @return * @throws Exception */ public FileVO selectFileInf(FileVO fvo) throws Exception { return (FileVO) selectOne("FileManageDAO.selectFileInf", fvo); } /** * ์ „์ฒด ํŒŒ์ผ์„ ์‚ญ์ œํ•œ๋‹ค. * * @param fvo * @throws Exception */ public void deleteAllFileInf(FileVO fvo) throws Exception { update("FileManageDAO.deleteCOMTNFILE", fvo); } /** * ํŒŒ์ผ๋ช… ๊ฒ€์ƒ‰์— ๋Œ€ํ•œ ๋ชฉ๋ก์„ ์กฐํšŒํ•œ๋‹ค. * * @param vo * @return * @throws Exception */ @SuppressWarnings("unchecked") public List<FileVO> selectFileListByFileNm(FileVO fvo) throws Exception { return selectList("FileManageDAO.selectFileListByFileNm", fvo); } /** * ํŒŒ์ผ๋ช… ๊ฒ€์ƒ‰์— ๋Œ€ํ•œ ๋ชฉ๋ก ์ „์ฒด ๊ฑด์ˆ˜๋ฅผ ์กฐํšŒํ•œ๋‹ค. * * @param fvo * @return * @throws Exception */ public int selectFileListCntByFileNm(FileVO fvo) throws Exception { return (Integer) selectOne("FileManageDAO.selectFileListCntByFileNm", fvo); } /** * ์ด๋ฏธ์ง€ ํŒŒ์ผ์— ๋Œ€ํ•œ ๋ชฉ๋ก์„ ์กฐํšŒํ•œ๋‹ค. * * @param vo * @return * @throws Exception */ @SuppressWarnings("unchecked") public List<FileVO> selectImageFileList(FileVO vo) throws Exception { return selectList("FileManageDAO.selectImageFileList", vo); } }
[ "ktyuzz@ecis.co.kr" ]
ktyuzz@ecis.co.kr