blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
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
689M
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
131 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
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
b98e39c281886218ea52e136f2bdf59475bf0799
7e5f790fb8af040cbec89c38063c43c7958c0786
/restful-api/src/main/java/com/bokal/restfulapi/payroll/employeeComponent/EmployeeRepository.java
323b20bda926b13ab0188d7a70d0d8ccadf2c01e
[]
no_license
naushad0625/spring-boot-rest-service
4fd37c5475a4a4f0bbb1aff6118ce9c1743e8e50
f4924e71678729ee49bdee40d362ca6d3335df55
refs/heads/master
2022-12-13T18:13:38.440743
2020-08-29T05:53:25
2020-08-29T05:53:25
288,726,608
0
0
null
null
null
null
UTF-8
Java
false
false
199
java
package com.bokal.restfulapi.payroll.employeeComponent; import org.springframework.data.jpa.repository.JpaRepository; public interface EmployeeRepository extends JpaRepository<Employee, Long> { }
[ "naushad.hossain@leads-bd.com" ]
naushad.hossain@leads-bd.com
b74944aa20df52abea9438900262414298072114
059e8e578c49b1ef3337e1b6a16e0f8b01c12a88
/open-falcon4j-common/src/main/java/com/lingchaomin/falcon/common/dao/IDao.java
943917061ff892a1d2f038b7fbeae608a24a9277
[ "Apache-2.0" ]
permissive
yudingchu/open-falcon4j
266fa84f20dc7810760daeceda8ae67862efbfb1
65a0e6476c2d91e070abb32a0e209a1338904543
refs/heads/master
2021-05-04T16:51:44.312356
2017-04-23T07:56:48
2017-04-23T07:56:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
397
java
package com.lingchaomin.falcon.common.dao; import java.util.List; /** * IDao * * @author : lizhong.chen * @version : 1.0 * @since : 16-3-29.下午7:57 */ public interface IDao<T> { Long countAll(); T selectById(Long id); Long insert(T t); Long insertBatch(List<T> list); Long updateById(T t); Long updateBatch(List<T> list); Long deleteById(Long id); }
[ "738509878@qq.com" ]
738509878@qq.com
f0a6cb96b9edf49e893e5794017eb3323f6d3501
329990bebabb23ab9e982362b49fac26fb292b61
/gateway/src/main/java/com/mygglo/jhipster/gateway/service/dto/package-info.java
d2da21d8c01ce4a1bb9b13b1ff1c9fdc2c159544
[]
no_license
wassimz/jhipster-labs
44c00b83177f6041ce982233afc454e8ea906e01
fbc1141a66dca32fbbf5c246b7695fcb50546658
refs/heads/master
2021-06-27T12:52:40.419832
2017-08-29T12:21:29
2017-08-29T12:21:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
83
java
/** * Data Transfer Objects. */ package com.mygglo.jhipster.gateway.service.dto;
[ "jgaglo@peopleinput.com" ]
jgaglo@peopleinput.com
5542f6da668e4eb37ad49f29d4ddd9280058cf6f
89a05a8991b13080c84a719a7bb28ce714060530
/SpringBoot-Redis/src/main/java/com/adonai/controller/TestRedisSessionController.java
2c7351c8697ca1353b1062f0bf74a108677698c0
[]
no_license
androidbestis/springbootpro
6d1164176bb6839d4c90ab4ae883ef27390b5248
9de6f55f3709a26da3fe60d98280274a23431a77
refs/heads/master
2020-03-28T20:20:38.878126
2018-09-17T03:03:38
2018-09-17T03:03:38
149,061,409
0
0
null
null
null
null
UTF-8
Java
false
false
1,242
java
package com.adonai.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpSession; import java.util.UUID; /** * 测试Redis Session */ @RestController public class TestRedisSessionController { @RequestMapping("/uid") public String uid(HttpSession session){ UUID uid = (UUID)session.getAttribute("uid"); if(uid == null){ uid = UUID.randomUUID(); } session.setAttribute("uid",uid); return session.getId(); } /** * 登录redis 输入 keys '*sessions*' t<spring:session:sessions:db031986-8ecc-48d6-b471-b137a3ed6bc4 t(spring:session:expirations:1472976480000 其中 1472976480000为失效时间,意思是这个时间后session失效,db031986-8ecc-48d6-b471-b137a3ed6bc4 为sessionId, 登录http://localhost:8080/uid 发现会一致,就说明session 已经在redis里面进行有效的管理了。 */ /** * 如何在两台或者多台中共享session 其实就是按照上面的步骤在另一个项目中再次配置一次,启动后自动就进行了session共享。 */ }
[ "m15871692767@163.com" ]
m15871692767@163.com
0c2d6dd76dd2f65aa02cb192fa92ce4fd51423f5
5b3168a38c718017773df479ece0f8bb4617a823
/JUDDI_TEST/src/Publish.java
d26223f7fc98e86ef3a63b2f959a5a9c2ec738fb
[]
no_license
juyingnan/Java_Workspace
88ded7cfbc3e8071976e2cdde7b98d9c78a203ca
b6e1d82c1b562977689d838057f8230bef8dc62a
refs/heads/master
2020-04-16T07:14:21.210183
2013-05-04T14:30:54
2013-05-04T14:30:54
9,855,114
0
0
null
null
null
null
GB18030
Java
false
false
5,324
java
import java.io.IOException; import junit.framework.Assert; import org.apache.juddi.v3.client.config.UDDIClerkManager; import org.apache.juddi.v3.client.transport.Transport; import org.uddi.api_v3.AccessPoint; import org.uddi.api_v3.AuthToken; import org.uddi.api_v3.BindingTemplate; import org.uddi.api_v3.BindingTemplates; import org.uddi.api_v3.BusinessEntity; import org.uddi.api_v3.BusinessService; import org.uddi.api_v3.BusinessServices; import org.uddi.api_v3.Description; import org.uddi.api_v3.GetAuthToken; import org.uddi.api_v3.Name; import org.uddi.api_v3.OverviewDoc; import org.uddi.api_v3.OverviewURL; import org.uddi.api_v3.SaveBusiness; import org.uddi.api_v3.SaveTModel; import org.uddi.api_v3.TModel; import org.uddi.api_v3.TModelDetail; import org.uddi.api_v3.TModelInstanceDetails; import org.uddi.api_v3.TModelInstanceInfo; import org.uddi.v3_service.UDDIPublicationPortType; import org.uddi.v3_service.UDDISecurityPortType; public class Publish { public void publish(String businessname, String bdescription, String wsdladdress) throws IOException { String clazz; String authinfo; String information = null; try { clazz = UDDIClerkManager.getClientConfig().getUDDINode("default").getProxyTransport(); Class<?> transportClass = Class.forName(clazz, true, Thread.currentThread().getContextClassLoader()); if (transportClass != null) { AnalyWsdl ana = new AnalyWsdl(); information = ana.readWsdl(wsdladdress); String[] section = information.split("\\|"); // 将AnalyWsdl返回的结果进行分割,从而分离出需要注册到uddi上的信息 Transport transport = (Transport) transportClass.newInstance(); UDDISecurityPortType securityService = transport.getUDDISecurityService(); GetAuthToken getauthToken = new GetAuthToken(); getauthToken.setUserID("root"); getauthToken.setCred("root"); AuthToken authtoken = securityService.getAuthToken(getauthToken); authinfo = authtoken.getAuthInfo(); System.out.println("获得AuthToken"); System.out.println(authinfo); UDDIPublicationPortType publication = transport.getUDDIPublishService(); // 添加BusinessEntity SaveBusiness sb = new SaveBusiness(); BusinessEntity be = new BusinessEntity(); Name name = new Name(); name.setValue(businessname); be.getName().add(name); Description description = new Description(); description.setValue(bdescription); be.getDescription().add(description); // 添加tModel SaveTModel ST = new SaveTModel(); ST.setAuthInfo(authinfo); TModel tm = new TModel(); Name name1 = new Name(); System.out.println("tmodel name:" + section[0]); name1.setValue(section[0]); tm.setName(name1); if (!(section[1].equals("null"))) { Description description1 = new Description(); description1.setValue(section[1]); System.out.println("tmodel description:" + section[1]); tm.getDescription().add(description1); } OverviewDoc od = new OverviewDoc(); OverviewURL ou = new OverviewURL(); ou.setValue(section[2]); System.out.println("overviewURL:" + section[2]); od.setOverviewURL(ou); tm.getOverviewDoc().add(od); ST.getTModel().add(tm); TModelDetail Tt = publication.saveTModel(ST); // 添加BusinessService BusinessServices bss = new BusinessServices(); BusinessService bs = new BusinessService(); Name name2 = new Name(); name2.setValue(section[3]); System.out.println("service name:" + section[3]); bs.getName().add(name2); if (!(section[4].equals("null"))) { Description description2 = new Description(); description2.setValue(section[4]); System.out.println("service description:" + section[4]); bs.getDescription().add(description2); } BindingTemplate bt = new BindingTemplate(); BindingTemplates bts = new BindingTemplates(); AccessPoint ap = new AccessPoint(); ap.setUseType("wsdlDeployment"); ap.setValue(section[5]); System.out.println("accesspoint:" + section[5]); bt.setAccessPoint(ap); if (!(section[6].equals("null"))) { Description description3 = new Description(); description3.setValue(section[6]); System.out.println("binding description:" + section[6]); bt.getDescription().add(description3); } TModelInstanceDetails TD = new TModelInstanceDetails(); TModelInstanceInfo TI = new TModelInstanceInfo(); TI.setTModelKey(Tt.getTModel().get(0).getTModelKey()); TD.getTModelInstanceInfo().add(TI); bt.setTModelInstanceDetails(TD); bts.getBindingTemplate().add(bt); bs.setBindingTemplates(bts); bss.getBusinessService().add(bs); be.setBusinessServices(bss); sb.setAuthInfo(authinfo); sb.getBusinessEntity().add(be); publication.saveBusiness(sb); System.out.println("服务注册成功!!"); } else { Assert.fail(); } } catch (Exception e) { e.printStackTrace(); Assert.fail("Could not obtain authInfo token."); } // out.println("</HTML></BODY>"); } public static void main(String[] args) throws IOException { Publish pub = new Publish(); pub.publish("WebServicesTest_AXIS2", "This is a Web Services Test and the server is AXIS2", "http://192.168.213.172/StuInfoWebService.asmx?WSDL"); } }
[ "bunny_gg@hotmail.com" ]
bunny_gg@hotmail.com
684c685361ad7c59dbe9f75dab91cb2aad427bbe
c32657606d799f6d69862de5bea9d3adc094b9ae
/LintCode/TwoDArrayIterator.java
7f1337371abeaf0f04ad388daffbc0ac0349bed5
[]
no_license
SeanQinSolver/X
f2ccb91e11376ce5eab431378cf1cb775de09074
1ab008a3c680ac1866f993e50064cd65d9da2e6b
refs/heads/master
2021-10-25T07:30:59.105949
2019-04-02T16:38:18
2019-04-02T16:38:18
49,651,873
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
public class TwoDArrayIterator { int[][] array; final int[] dx = {1, 0, 0, -1}; final int[] dy = {0, 1, -1, 0}; public TwoDArrayIterator(int[][] array) { this.array = array; } public boolean hasNext() { } public static void main(String[] args) { } }
[ "xiaotiaq@amazon.com" ]
xiaotiaq@amazon.com
0c74eaeeed32955844f6ccfac8226bb62ff4e861
8c234cbd090479e6bde0d1b122f04ca95d067550
/playground/src/main/java/com/huawei/nlz/snippets/playground/trywithresources/package-info.java
2abab23fd244a8aeab883112fcebfdf5f8b9596d
[]
no_license
nju-Nicko/Snippets
04e83078b96a7821cb02eec75570c78383957a33
80082a69459bdd5ae0e90c3b55fda3cdfc3fa529
refs/heads/master
2022-12-22T02:50:38.294885
2020-05-26T07:29:48
2020-05-26T07:29:48
167,773,673
0
0
null
2022-12-16T04:37:18
2019-01-27T05:31:12
Java
UTF-8
Java
false
false
98
java
/** * Java 7 try-with-resources */ package com.huawei.nlz.snippets.playground.trywithresources;
[ "1585288467@qq.com" ]
1585288467@qq.com
e9d9704ab76c9ca7f819eb87a9258d785ab686e2
affb9f880b48504292c8c2785f9ccecb817ca109
/ni/ni.java
9371db8b784dae281d075ff6f9d2cc91df1c68ef
[]
no_license
apribadi/practicum
84c5f2ca023f720e0570155f912774ed814925da
73e7ce4ed565f05aaa9aea3d14a3fe30731912f0
refs/heads/master
2021-01-25T08:43:26.839772
2011-04-04T13:27:25
2011-04-04T13:27:25
496,053
0
0
null
null
null
null
UTF-8
Java
false
false
54
java
class Ni { static void main(String args[]) { } }
[ "apribadi@knuth.cs.hmc.edu" ]
apribadi@knuth.cs.hmc.edu
3f812e1e5aa76e159f4038b89bc428b057ec8016
2d2ef0bd12cdaecb73b261ab69aa50e5d02d0c9b
/src/main/java/th/co/appman/product/dto/ProductDetail.java
14869e92d01695fc91869674bb61bdafd243022c
[ "MIT" ]
permissive
jayz-chaiwat/product-service
aae61d47d6cf1a87f4c3a8fb981ba9fc85e2cbd3
92a5061500fa478eee1576627fe157fc1ea9381e
refs/heads/master
2023-02-20T01:34:07.386109
2020-08-23T05:54:32
2020-08-23T05:54:32
288,622,163
0
0
MIT
2020-09-08T06:54:45
2020-08-19T03:17:29
Java
UTF-8
Java
false
false
297
java
package th.co.appman.product.dto; import lombok.Data; import java.io.Serializable; import java.util.List; @Data public class ProductDetail implements Serializable { private Long id; private String productName; private String productDesc; private List<DetailResponse> details; }
[ "chaiwat.k@appman.co.th" ]
chaiwat.k@appman.co.th
467f1e66a6092198365f969abb2778e1d8f82b9a
4f43015f6949fa1401dd14616e92d8d6dcf0653f
/pet-clinic-data/src/main/java/com/jafton/sfgpetclinic/services/map/VisitMapService.java
1bd8d4ce4ca6088b458f6bbc6846c5bcd4ea7a0e
[]
no_license
Farrukhbek00/sfg-pet-clinic
cb8e08c35f24ad42d84a2a3ab41c43248a8e268f
7ab0e3619136b34123811f5b9946c0c8b92d9718
refs/heads/master
2021-01-03T22:15:48.241568
2020-02-27T10:46:29
2020-02-27T10:46:29
240,256,662
0
0
null
null
null
null
UTF-8
Java
false
false
1,095
java
package com.jafton.sfgpetclinic.services.map; import com.jafton.sfgpetclinic.model.Visit; import com.jafton.sfgpetclinic.services.VisitService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import java.util.Set; @Service @Profile({"default", "map"}) public class VisitMapService extends AbstractMapService<Visit, Long> implements VisitService { @Override public Set<Visit> findAll() { return super.findAll(); } @Override public Visit findById(Long id) { return super.findById(id); } @Override public Visit save(Visit visit) { if(visit.getPet() == null || visit.getPet().getOwner() == null || visit.getPet().getId() == null || visit.getPet().getOwner().getId() == null) { throw new RuntimeException("Invalid visit"); } return super.save(visit); } @Override public void delete(Visit object) { super.delete(object); } @Override public void deleteById(Long id) { super.deleteById(id); } }
[ "farruhzokirov00@gmail.com" ]
farruhzokirov00@gmail.com
104a2a5ddace67f874f4b9f05803221616eaaa89
60268810236cfd5fd2257679610fab227b1289ee
/src/main/java/com/atos/customer/service/CustomerService.java
92f53003a64804f1a6ea2856e449ee3e5574e764
[]
no_license
Vlucrecia/Customer
da54f5ea684450e5e710fe841bd5d9a9e4dbe823
5fb75768ffaa03be15cc931e5b900aef8dd3837e
refs/heads/master
2020-03-29T01:41:47.131180
2018-09-19T08:13:03
2018-09-19T08:13:03
149,401,582
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.atos.customer.service; import java.util.List; import com.atos.customer.model.Customer; public interface CustomerService { public Customer addCustomer(Customer customer); public List<Customer> listCustomer(); public void deleteCustomerById(long customerId); public Customer getCustomerById(long customerId); public boolean isValidCustomer(Customer customer); }
[ "vino.arumai@gmail.com" ]
vino.arumai@gmail.com
bc27a5f3e5e3024d5ad772414d9ebc5f47c64dfe
679a751d8b200e71db15d17f47ce82565d72c89b
/proj_HDP/src/main/java/com/toptal/blog/dao/PartsDao.java
4e2a1fdf54ace62b351f3d08ee842321bf2e6919
[]
no_license
ankitbarfa/DropWizardTest
cb45a05a0e6a785d3a20b1db6459db2a7d5f7762
43d788851c0f8a95b008e44d70fb57a7f9684037
refs/heads/master
2023-01-11T18:22:22.776523
2020-11-10T08:52:44
2020-11-10T08:52:44
311,573,932
0
0
null
null
null
null
UTF-8
Java
false
false
1,061
java
package com.toptal.blog.dao; import java.util.List; import org.skife.jdbi.v2.sqlobject.Bind; import org.skife.jdbi.v2.sqlobject.BindBean; import org.skife.jdbi.v2.sqlobject.SqlQuery; import org.skife.jdbi.v2.sqlobject.SqlUpdate; import org.skife.jdbi.v2.sqlobject.customizers.RegisterMapper; import com.toptal.blog.mapper.PartsMapper; import com.toptal.blog.model.Part; @RegisterMapper(PartsMapper.class) public interface PartsDao { @SqlQuery("select * from parts;") public List<Part> getParts(); @SqlQuery("select * from parts where id = :id") public Part getPart(@Bind("id") final int id); @SqlUpdate("insert into parts(name, code) values(:name, :code)") void createPart(@BindBean final Part part); @SqlUpdate("update parts set name = coalesce(:name, name), code = coalesce(:code, code) where id = :id") void editPart(@BindBean final Part part); @SqlUpdate("delete from parts where id = :id") int deletePart(@Bind("id") final int id); @SqlQuery("select last_insert_id();") public int lastInsertId(); }
[ "ankit.barfa26@gmail.com" ]
ankit.barfa26@gmail.com
3edc2c5e9990bc23cbeb46345d8d54adeef11d78
c11afc8d75306cdf29f766f03c7a001608922685
/src/main/java/com/brewconsulting/masters/FeedSchedules.java
27696044c51b29e269d8f69b74b44ac1f31f285d
[]
no_license
Nazima-Mansuri/clapi
fbd08952a880de6cc09495f4b8f8de754a7eb5d8
692b3934b616ae41f181962586e4733fa7ff42b7
refs/heads/master
2021-08-08T01:42:10.695538
2017-11-09T09:32:08
2017-11-09T09:32:08
110,096,218
0
0
null
null
null
null
UTF-8
Java
false
false
12,728
java
package com.brewconsulting.masters; import com.brewconsulting.DB.masters.Feed; import com.brewconsulting.DB.masters.FeedSchedule; import com.brewconsulting.DB.masters.LoggedInUser; import com.brewconsulting.DB.masters.UserViews; import com.brewconsulting.login.Secured; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import org.postgresql.util.PSQLException; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPubSub; import javax.ws.rs.*; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.IOException; import java.io.InputStream; import java.sql.SQLException; import java.util.Properties; /** * Created by lcom62_one on 1/16/2017. */ @Path("feedschedules") @Secured public class FeedSchedules { ObjectMapper mapper = new ObjectMapper(); static final Logger logger = Logger.getLogger(FeedSchedules.class); Properties properties = new Properties(); InputStream inp = getClass().getClassLoader().getResourceAsStream("log4j.properties"); /*** * * @param feedId * @param crc * @return */ @GET @Produces("application/json") @Secured @Path("{feedId}") public Response getAllFeedSchedule(@PathParam("feedId") int feedId, @Context ContainerRequestContext crc) { Response resp = null; try { properties.load(inp); PropertyConfigurator.configure(properties); resp = Response.ok( mapper.writerWithView(UserViews.feedScheduleView.class).writeValueAsString(FeedSchedule .getAllFeedSchedule(feedId, (LoggedInUser) crc .getProperty("userObject")))).build(); } catch (NotAuthorizedException na) { logger.error("NotAuthorizedException", na); resp = Response.status(Response.Status.FORBIDDEN) .entity("{\"Message\":" + "\"You are not authorized to get Feeds \"}") .type(MediaType.APPLICATION_JSON) .build(); } catch (Exception e) { logger.error("Exception ", e); resp = Response.serverError().entity("{\"Message\":" + "\"" + e.getMessage() + "\"}").build(); e.printStackTrace(); } return resp; } /*** * * * @param feedScheduleId * @param crc * @return */ @GET @Produces("application/json") @Secured @Path("{feedScheduleId}/{status}") public Response getAllDeliveredPills(@PathParam("feedScheduleId") int feedScheduleId, @PathParam("status") String status, @Context ContainerRequestContext crc) { Response resp = null; try { properties.load(inp); PropertyConfigurator.configure(properties); resp = Response.ok( mapper.writerWithView(UserViews.deliveredFeedsView.class).writeValueAsString(FeedSchedule .getDeliveredData(feedScheduleId, status, (LoggedInUser) crc .getProperty("userObject")))).build(); } catch (NotAuthorizedException na) { logger.error("NotAuthorizedException", na); resp = Response.status(Response.Status.FORBIDDEN) .entity("{\"Message\":" + "\"You are not authorized to get Feeds \"}") .type(MediaType.APPLICATION_JSON) .build(); } catch (Exception e) { logger.error("Exception ", e); resp = Response.serverError().entity("{\"Message\":" + "\"" + e.getMessage() + "\"}").build(); e.printStackTrace(); } return resp; } /*** * * * @param crc * @return */ @GET @Produces("application/json") @Secured @Path("deliveredPills/{divId}") public Response getDeliveredPills(@PathParam("divId") int divId, @Context ContainerRequestContext crc) { Response resp = null; try { properties.load(inp); PropertyConfigurator.configure(properties); resp = Response.ok( mapper.writerWithView(UserViews.feedDeliveryView.class).writeValueAsString(FeedSchedule .recentlyDeliveredPills(divId, (LoggedInUser) crc .getProperty("userObject")))).build(); } catch (NotAuthorizedException na) { logger.error("NotAuthorizedException", na); resp = Response.status(Response.Status.FORBIDDEN) .entity("{\"Message\":" + "\"You are not authorized to get Feeds \"}") .type(MediaType.APPLICATION_JSON) .build(); } catch (Exception e) { logger.error("Exception ", e); resp = Response.serverError().entity("{\"Message\":" + "\"" + e.getMessage() + "\"}").build(); e.printStackTrace(); } return resp; } /*** * * @param input * @param crc * @return */ @POST @Produces("application/json") @Secured @Consumes("application/json") public Response createFeedSchedule(InputStream input, @Context ContainerRequestContext crc) { Response resp = null; try { properties.load(inp); PropertyConfigurator.configure(properties); JsonNode node = mapper.readTree(input); int feedScheduleId = FeedSchedule.addFeedSchedule(node, (LoggedInUser) crc.getProperty("userObject")); resp = Response.ok("{\"id\":" + feedScheduleId + "}").build(); } catch (NotAuthorizedException na) { logger.error("NotAuthorizedException", na); resp = Response.status(Response.Status.FORBIDDEN) .entity("{\"Message\":" + "\"You are not authorized to create Feed Schedule\"}") .type(MediaType.APPLICATION_JSON) .build(); } catch (BadRequestException b) { logger.error("BadRequestException", b); resp = Response.status(Response.Status.BAD_REQUEST) .entity("{\"Message\":" + "\"No pills are available for feed.\"}") .type(MediaType.APPLICATION_JSON) .build(); } catch (SQLException s) { logger.error("SQLException", s); resp = Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity("{\"Message\":" + "\"" + s.getMessage() + "\"}") .type(MediaType.APPLICATION_JSON) .build(); } catch (IOException e) { logger.error("IOException", e); if (resp == null) { resp = Response.serverError().entity("{\"Message\":" + "\"" + e.getMessage() + "\"}").build(); e.printStackTrace(); } } catch (Exception e) { logger.error("Exception ", e); resp = Response.serverError().entity("{\"Message\":" + "\"" + e.getMessage() + "\"}").build(); e.printStackTrace(); } return resp; } /*** * * * @param input * @param crc * @return */ @PUT @Produces("application/json") @Secured @Consumes("application/json") public Response updateFeedSchedule(InputStream input, @Context ContainerRequestContext crc) { Response resp = null; try { properties.load(inp); PropertyConfigurator.configure(properties); JsonNode node = mapper.readTree(input); int affectedRows = FeedSchedule.updateFeedSchedule(node, (LoggedInUser) crc.getProperty("userObject")); resp = Response.ok("{\"affectedRows\":" + affectedRows + "}").build(); } catch (NotAuthorizedException na) { logger.error("NotAuthorizedException", na); resp = Response.status(Response.Status.FORBIDDEN) .entity("{\"Message\":" + "\"You are not authorized to update Feed Schedule.\"}") .type(MediaType.APPLICATION_JSON) .build(); } catch (IOException e) { logger.error("IOException", e); if (resp == null) resp = Response.serverError().entity("{\"Message\":" + "\"" + e.getMessage() + "\"}").build(); e.printStackTrace(); } catch (Exception e) { logger.error("Exception", e); // TODO Auto-generated catch block resp = Response.serverError().entity("{\"Message\":" + "\"" + e.getMessage() + "\"}").build(); e.printStackTrace(); } return resp; } /*** * * * @param input * @param crc * @return */ @PUT @Produces("application/json") @Secured @Consumes("application/json") @Path("pillanswertime") public Response updatePillAnswerTime(InputStream input, @Context ContainerRequestContext crc) { Response resp = null; try { properties.load(inp); PropertyConfigurator.configure(properties); JsonNode node = mapper.readTree(input); int affectedRows = FeedSchedule.updatePillReadTime(node, (LoggedInUser) crc.getProperty("userObject")); resp = Response.ok("{\"affectedRows\":" + affectedRows + "}").build(); } catch (NotAuthorizedException na) { logger.error("NotAuthorizedException", na); resp = Response.status(Response.Status.FORBIDDEN) .entity("{\"Message\":" + "\"You are not authorized to update Pill Answer time.\"}") .type(MediaType.APPLICATION_JSON) .build(); } catch (IOException e) { logger.error("IOException", e); if (resp == null) resp = Response.serverError().entity("{\"Message\":" + "\"" + e.getMessage() + "\"}").build(); e.printStackTrace(); } catch (Exception e) { logger.error("Exception", e); // TODO Auto-generated catch block resp = Response.serverError().entity("{\"Message\":" + "\"" + e.getMessage() + "\"}").build(); e.printStackTrace(); } return resp; } /*** * * @param id * @param crc * @return */ @DELETE @Produces("application/json") @Secured @Path("{id}") public Response deleteFeedSchedule(@PathParam("id") Integer id, @Context ContainerRequestContext crc) { Response resp = null; try { properties.load(inp); PropertyConfigurator.configure(properties); // affectedRow given how many rows deleted from database. int affectedRow = FeedSchedule.deleteFeedSchedule(id, (LoggedInUser) crc.getProperty("userObject")); if (affectedRow > 0) resp = Response.ok().build(); else // If no rows affected in database. It gives server status // 204(NO_CONTENT). resp = Response.status(204).entity("{\"Message\":\" + \"\"Feed Schedule is not deleted.\"}").build(); } catch (NotAuthorizedException na) { logger.error("NotAuthorizedException", na); resp = Response.status(Response.Status.FORBIDDEN) .entity("{\"Message\":" + "\"You are not authorized to Delete Feed Schedule.\"}") .type(MediaType.APPLICATION_JSON) .build(); } catch (PSQLException ex) { logger.error("PSQLException ", ex); resp = Response .status(Response.Status.CONFLICT) .entity("{\"Message\":" + "\"This id is already Use in another table as foreign key\"}") .type(MediaType.APPLICATION_JSON).build(); ex.printStackTrace(); } catch (Exception e) { logger.error("Exception", e); if (resp == null) resp = Response.serverError().entity("{\"Message\":" + "\"" + e.getMessage() + "\"}").build(); e.printStackTrace(); } return resp; } }
[ "ldeveloperl1985@gmail.com" ]
ldeveloperl1985@gmail.com
7599dfba30811fe92239d7d805bca7e7ac2b4558
409889a352248d143b879d6f8078d6ea32f11dc7
/src/main/java/com/haui/demo/models/requests/AdminRq.java
2ea049c2d8aa511f157f55dd513f36ad3f9333e8
[]
no_license
PoGreen/Haui-2021-Dao-A
ecd41ee7def7c73ad9fde814bb467ed42a7175b1
054a39c0a7aaf21811ed91e8c31cba8620f5d6ff
refs/heads/master
2023-03-19T14:56:03.065460
2021-03-08T16:02:12
2021-03-08T16:02:12
345,596,535
0
0
null
2021-03-08T16:04:49
2021-03-08T09:16:02
Java
UTF-8
Java
false
false
1,623
java
package com.haui.demo.models.requests; import com.haui.demo.annotations.PhoneNumber; import javax.validation.constraints.NotBlank; public class AdminRq { @NotBlank private String userName; @NotBlank private String password; @NotBlank private String fullName; @PhoneNumber private String phone; @NotBlank private String email; @NotBlank private String address; @NotBlank private Integer ward; private String role; public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public Integer getWard() { return ward; } public void setWard(Integer ward) { this.ward = ward; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } }
[ "trandaogrey@gmail.com" ]
trandaogrey@gmail.com
1b686ff5600d81783d99f0caab8d174595a81954
bb2c908667eaaa48916f2fb3d754905adcd6f66c
/src/main/java/com/accenture/abts/spring/controllers/GraderController.java
da7ef094a519e28530dbc8922161c39cc7b2cce3
[]
no_license
xottabi4/accenture-bootcamp-test-system
d5d382645f64b95d8e5b4613e697d1be9f8ca49f
cb55bad6b926223ad5e0b618cfa899a46de296b4
refs/heads/master
2020-12-24T11:17:10.965238
2016-07-11T13:50:10
2016-07-11T13:50:10
62,226,225
1
1
null
null
null
null
UTF-8
Java
false
false
1,372
java
package com.accenture.abts.spring.controllers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.accenture.abts.spring.exceptions.IncorectTestTypeException; import com.accenture.abts.spring.messages.Error; import com.accenture.abts.spring.messages.Response; import com.accenture.abts.spring.messages.TestAnswerJson; import com.accenture.abts.spring.services.GraderService; @RestController @RequestMapping(value = "/grader") public class GraderController { @Autowired GraderService graderService; @RequestMapping(value = "/view-test", method = RequestMethod.GET) public @ResponseBody TestAnswerJson viewTest(@RequestParam(value = "testType") String testType) throws IncorectTestTypeException { return graderService.viewTest(testType); } @ExceptionHandler(value = IncorectTestTypeException.class) public @ResponseBody Response ittHandler(IncorectTestTypeException e) { return new Response(400, null, new Error("incorect parameter", e.getMessage())); } }
[ "arturs.anohins@gmail.com" ]
arturs.anohins@gmail.com
5addaa00fe4f10ff4123f878259897dfe1a0d081
ad0f1fdab63041e791a5eab5cc9734ebe0c86d5d
/src/main/java/com/imooc/sell/handle/ExceptionHandle.java
1357dbf2d1e77a7278faa34c819b8409e8bf7503
[]
no_license
Grayson-liuz/sell
fef9fa294796789bba955dcb83737aaa73f93e5b
5067f41e19a65e2a808e1b0d2aee8a3d92a3c0de
refs/heads/master
2021-08-15T04:00:12.007099
2017-11-17T09:30:10
2017-11-17T09:30:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
831
java
package com.imooc.sell.handle; import com.imooc.sell.dataobject.Result; import com.imooc.sell.exception.SellException; import com.imooc.sell.utils.ResultUtil; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; /** * Created by liuzhang on 2017/8/16. */ @ControllerAdvice public class ExceptionHandle { @ExceptionHandler(value = Exception.class) @ResponseBody public Result handle(Exception e){ if(e instanceof SellException){ SellException sellException = (SellException) e; return ResultUtil.error(sellException.getCode(),sellException.getMessage()); }else { return ResultUtil.error(-1,"未知错误"); } } }
[ "strive_xz@163.com" ]
strive_xz@163.com
72d4312f82b08ce1382bf78d3dfa9ef6dfdfb1a3
2e76ff4c030c796e17740484f3badf573ae1397b
/chpl/chpl-service/src/test/java/gov/healthit/chpl/TestingUsers.java
8e92c85709ec1563029a2805bba9d8755f5fd9f1
[ "BSD-3-Clause", "BSD-2-Clause-Views" ]
permissive
drbgfc/chpl-api
3cb1e7d2af0aa54ee0ee8905d5fd2f7f9ffe4ce9
01a6c2efccb4f7eb180c8b92209d168158c30b9f
refs/heads/master
2021-07-22T04:57:42.778692
2020-06-15T17:14:37
2020-06-15T17:14:37
200,303,146
0
0
NOASSERTION
2020-04-17T13:14:02
2019-08-02T22:06:44
Java
UTF-8
Java
false
false
4,049
java
package gov.healthit.chpl; import org.mockito.Mockito; import org.springframework.security.core.context.SecurityContextHolder; import gov.healthit.chpl.auth.permission.GrantedPermission; import gov.healthit.chpl.auth.user.JWTAuthenticatedUser; import gov.healthit.chpl.permissions.ResourcePermissions; public class TestingUsers { public void setupForAdminUser(ResourcePermissions resourcePermissions) { SecurityContextHolder.getContext().setAuthentication(getAdminUser()); Mockito.when(resourcePermissions.isUserRoleAdmin()).thenReturn(true); } private JWTAuthenticatedUser getAdminUser() { JWTAuthenticatedUser adminUser = new JWTAuthenticatedUser(); adminUser.setFullName("Administrator"); adminUser.setId(-2L); adminUser.setFriendlyName("Administrator"); adminUser.setSubjectName("admin"); adminUser.getPermissions().add(new GrantedPermission("ROLE_ADMIN")); return adminUser; } public void setupForAcbUser(ResourcePermissions resourcePermissions) { SecurityContextHolder.getContext().setAuthentication(getAcbUser()); Mockito.when(resourcePermissions.isUserRoleAcbAdmin()).thenReturn(true); } private JWTAuthenticatedUser getAcbUser() { JWTAuthenticatedUser acbUser = new JWTAuthenticatedUser(); acbUser.setFullName("Test"); acbUser.setId(3L); acbUser.setFriendlyName("User3"); acbUser.setSubjectName("testUser3"); acbUser.getPermissions().add(new GrantedPermission("ROLE_ACB")); return acbUser; } public void setupForAtlUser(ResourcePermissions resourcePermissions) { SecurityContextHolder.getContext().setAuthentication(getAtlUser()); Mockito.when(resourcePermissions.isUserRoleAtlAdmin()).thenReturn(true); } private JWTAuthenticatedUser getAtlUser() { JWTAuthenticatedUser atlUser = new JWTAuthenticatedUser(); atlUser.setFullName("ATL"); atlUser.setId(3L); atlUser.setFriendlyName("User"); atlUser.setSubjectName("atlUser"); atlUser.getPermissions().add(new GrantedPermission("ROLE_ATL")); return atlUser; } public void setupForCmsUser(ResourcePermissions resourcePermissions) { SecurityContextHolder.getContext().setAuthentication(getCmsUser()); Mockito.when(resourcePermissions.isUserRoleCmsStaff()).thenReturn(true); } private JWTAuthenticatedUser getCmsUser() { JWTAuthenticatedUser cmsUser = new JWTAuthenticatedUser(); cmsUser.setFullName("CMS"); cmsUser.setId(3L); cmsUser.setFriendlyName("User"); cmsUser.setSubjectName("cmsUser"); cmsUser.getPermissions().add(new GrantedPermission("ROLE_CMS_STAFF")); return cmsUser; } public void setupForOncUser(ResourcePermissions resourcePermissions) { SecurityContextHolder.getContext().setAuthentication(getOncUser()); Mockito.when(resourcePermissions.isUserRoleOnc()).thenReturn(true); } private JWTAuthenticatedUser getOncUser() { JWTAuthenticatedUser oncUser = new JWTAuthenticatedUser(); oncUser.setFullName("ONC"); oncUser.setId(3L); oncUser.setFriendlyName("User"); oncUser.setSubjectName("oncUser"); oncUser.getPermissions().add(new GrantedPermission("ROLE_ONC")); return oncUser; } public void setupForDeveloperUser(ResourcePermissions resourcePermissions) { SecurityContextHolder.getContext().setAuthentication(getDeveloperUser()); Mockito.when(resourcePermissions.isUserRoleDeveloperAdmin()).thenReturn(true); } private JWTAuthenticatedUser getDeveloperUser() { JWTAuthenticatedUser oncUser = new JWTAuthenticatedUser(); oncUser.setFullName("Developer"); oncUser.setId(3L); oncUser.setFriendlyName("User"); oncUser.setSubjectName("developerUser"); oncUser.getPermissions().add(new GrantedPermission("ROLE_DEVELOPER")); return oncUser; } }
[ "noreply@github.com" ]
drbgfc.noreply@github.com
205423dab4633729715890cffb2e6ca19e017005
030d15ce96a72a4915ccf7f26e94cf310c7ec05b
/app/build/generated/source/r/debug/com/google/android/gms/appstate/R.java
1e6a091b7643c314c2f7a506218b71365e357c04
[]
no_license
sushiliu/AugmentedMap
96a62a6136528deabea079fdb7d9033e8d809d60
7f5ce1fc477bf6d10f6341811c3d1733465dacf4
refs/heads/master
2021-01-22T05:15:17.397291
2015-04-17T09:48:09
2015-04-17T09:48:09
34,106,379
0
0
null
null
null
null
UTF-8
Java
false
false
15,078
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.google.android.gms.appstate; public final class R { public static final class attr { public static final int adSize = 0x7f010059; public static final int adSizes = 0x7f01005a; public static final int adUnitId = 0x7f01005b; public static final int appTheme = 0x7f01008f; public static final int buyButtonAppearance = 0x7f010096; public static final int buyButtonHeight = 0x7f010093; public static final int buyButtonText = 0x7f010095; public static final int buyButtonWidth = 0x7f010094; public static final int cameraBearing = 0x7f010064; public static final int cameraTargetLat = 0x7f010065; public static final int cameraTargetLng = 0x7f010066; public static final int cameraTilt = 0x7f010067; public static final int cameraZoom = 0x7f010068; public static final int circleCrop = 0x7f010062; public static final int environment = 0x7f010090; public static final int fragmentMode = 0x7f010092; public static final int fragmentStyle = 0x7f010091; public static final int imageAspectRatio = 0x7f010061; public static final int imageAspectRatioAdjust = 0x7f010060; public static final int liteMode = 0x7f010069; public static final int mapType = 0x7f010063; public static final int maskedWalletDetailsBackground = 0x7f010099; public static final int maskedWalletDetailsButtonBackground = 0x7f01009b; public static final int maskedWalletDetailsButtonTextAppearance = 0x7f01009a; public static final int maskedWalletDetailsHeaderTextAppearance = 0x7f010098; public static final int maskedWalletDetailsLogoImageType = 0x7f01009d; public static final int maskedWalletDetailsLogoTextColor = 0x7f01009c; public static final int maskedWalletDetailsTextAppearance = 0x7f010097; public static final int uiCompass = 0x7f01006a; public static final int uiMapToolbar = 0x7f010072; public static final int uiRotateGestures = 0x7f01006b; public static final int uiScrollGestures = 0x7f01006c; public static final int uiTiltGestures = 0x7f01006d; public static final int uiZoomControls = 0x7f01006e; public static final int uiZoomGestures = 0x7f01006f; public static final int useViewLifecycle = 0x7f010070; public static final int windowTransitionStyle = 0x7f01005d; public static final int zOrderOnTop = 0x7f010071; } public static final class color { public static final int common_action_bar_splitter = 0x7f080007; public static final int common_signin_btn_dark_text_default = 0x7f080008; public static final int common_signin_btn_dark_text_disabled = 0x7f080009; public static final int common_signin_btn_dark_text_focused = 0x7f08000a; public static final int common_signin_btn_dark_text_pressed = 0x7f08000b; public static final int common_signin_btn_default_background = 0x7f08000c; public static final int common_signin_btn_light_text_default = 0x7f08000d; public static final int common_signin_btn_light_text_disabled = 0x7f08000e; public static final int common_signin_btn_light_text_focused = 0x7f08000f; public static final int common_signin_btn_light_text_pressed = 0x7f080010; public static final int common_signin_btn_text_dark = 0x7f08002b; public static final int common_signin_btn_text_light = 0x7f08002c; public static final int wallet_bright_foreground_disabled_holo_light = 0x7f08001b; public static final int wallet_bright_foreground_holo_dark = 0x7f08001c; public static final int wallet_bright_foreground_holo_light = 0x7f08001d; public static final int wallet_dim_foreground_disabled_holo_dark = 0x7f08001e; public static final int wallet_dim_foreground_holo_dark = 0x7f08001f; public static final int wallet_dim_foreground_inverse_disabled_holo_dark = 0x7f080020; public static final int wallet_dim_foreground_inverse_holo_dark = 0x7f080021; public static final int wallet_highlighted_text_holo_dark = 0x7f080022; public static final int wallet_highlighted_text_holo_light = 0x7f080023; public static final int wallet_hint_foreground_holo_dark = 0x7f080024; public static final int wallet_hint_foreground_holo_light = 0x7f080025; public static final int wallet_holo_blue_light = 0x7f080026; public static final int wallet_link_text_light = 0x7f080027; public static final int wallet_primary_text_holo_light = 0x7f08002d; public static final int wallet_secondary_text_holo_dark = 0x7f08002e; } public static final class drawable { public static final int common_full_open_on_phone = 0x7f020065; public static final int common_ic_googleplayservices = 0x7f020066; public static final int common_signin_btn_icon_dark = 0x7f020067; public static final int common_signin_btn_icon_disabled_dark = 0x7f020068; public static final int common_signin_btn_icon_disabled_focus_dark = 0x7f020069; public static final int common_signin_btn_icon_disabled_focus_light = 0x7f02006a; public static final int common_signin_btn_icon_disabled_light = 0x7f02006b; public static final int common_signin_btn_icon_focus_dark = 0x7f02006c; public static final int common_signin_btn_icon_focus_light = 0x7f02006d; public static final int common_signin_btn_icon_light = 0x7f02006e; public static final int common_signin_btn_icon_normal_dark = 0x7f02006f; public static final int common_signin_btn_icon_normal_light = 0x7f020070; public static final int common_signin_btn_icon_pressed_dark = 0x7f020071; public static final int common_signin_btn_icon_pressed_light = 0x7f020072; public static final int common_signin_btn_text_dark = 0x7f020073; public static final int common_signin_btn_text_disabled_dark = 0x7f020074; public static final int common_signin_btn_text_disabled_focus_dark = 0x7f020075; public static final int common_signin_btn_text_disabled_focus_light = 0x7f020076; public static final int common_signin_btn_text_disabled_light = 0x7f020077; public static final int common_signin_btn_text_focus_dark = 0x7f020078; public static final int common_signin_btn_text_focus_light = 0x7f020079; public static final int common_signin_btn_text_light = 0x7f02007a; public static final int common_signin_btn_text_normal_dark = 0x7f02007b; public static final int common_signin_btn_text_normal_light = 0x7f02007c; public static final int common_signin_btn_text_pressed_dark = 0x7f02007d; public static final int common_signin_btn_text_pressed_light = 0x7f02007e; public static final int ic_plusone_medium_off_client = 0x7f020086; public static final int ic_plusone_small_off_client = 0x7f020087; public static final int ic_plusone_standard_off_client = 0x7f020088; public static final int ic_plusone_tall_off_client = 0x7f020089; public static final int powered_by_google_dark = 0x7f020095; public static final int powered_by_google_light = 0x7f020096; } public static final class id { public static final int adjust_height = 0x7f0a001a; public static final int adjust_width = 0x7f0a001b; public static final int book_now = 0x7f0a0033; public static final int buyButton = 0x7f0a002f; public static final int buy_now = 0x7f0a0034; public static final int buy_with_google = 0x7f0a0035; public static final int classic = 0x7f0a0037; public static final int donate_with_google = 0x7f0a0036; public static final int grayscale = 0x7f0a0038; public static final int holo_dark = 0x7f0a002a; public static final int holo_light = 0x7f0a002b; public static final int hybrid = 0x7f0a001c; public static final int match_parent = 0x7f0a0031; public static final int monochrome = 0x7f0a0039; public static final int none = 0x7f0a0015; public static final int normal = 0x7f0a000d; public static final int production = 0x7f0a002c; public static final int sandbox = 0x7f0a002d; public static final int satellite = 0x7f0a001d; public static final int selectionDetails = 0x7f0a0030; public static final int slide = 0x7f0a0016; public static final int strict_sandbox = 0x7f0a002e; public static final int terrain = 0x7f0a001e; public static final int wrap_content = 0x7f0a0032; } public static final class integer { public static final int google_play_services_version = 0x7f0b0001; } public static final class raw { public static final int gtm_analytics = 0x7f050001; } public static final class string { public static final int accept = 0x7f0c000e; public static final int common_android_wear_notification_needs_update_text = 0x7f0c0015; public static final int common_android_wear_update_text = 0x7f0c0016; public static final int common_android_wear_update_title = 0x7f0c0017; public static final int common_google_play_services_enable_button = 0x7f0c0018; public static final int common_google_play_services_enable_text = 0x7f0c0019; public static final int common_google_play_services_enable_title = 0x7f0c001a; public static final int common_google_play_services_error_notification_requested_by_msg = 0x7f0c001b; public static final int common_google_play_services_install_button = 0x7f0c001c; public static final int common_google_play_services_install_text_phone = 0x7f0c001d; public static final int common_google_play_services_install_text_tablet = 0x7f0c001e; public static final int common_google_play_services_install_title = 0x7f0c001f; public static final int common_google_play_services_invalid_account_text = 0x7f0c0020; public static final int common_google_play_services_invalid_account_title = 0x7f0c0021; public static final int common_google_play_services_needs_enabling_title = 0x7f0c0022; public static final int common_google_play_services_network_error_text = 0x7f0c0023; public static final int common_google_play_services_network_error_title = 0x7f0c0024; public static final int common_google_play_services_notification_needs_installation_title = 0x7f0c0025; public static final int common_google_play_services_notification_needs_update_title = 0x7f0c0026; public static final int common_google_play_services_notification_ticker = 0x7f0c0027; public static final int common_google_play_services_sign_in_failed_text = 0x7f0c0028; public static final int common_google_play_services_sign_in_failed_title = 0x7f0c0029; public static final int common_google_play_services_unknown_issue = 0x7f0c002a; public static final int common_google_play_services_unsupported_text = 0x7f0c002b; public static final int common_google_play_services_unsupported_title = 0x7f0c002c; public static final int common_google_play_services_update_button = 0x7f0c002d; public static final int common_google_play_services_update_text = 0x7f0c002e; public static final int common_google_play_services_update_title = 0x7f0c002f; public static final int common_open_on_phone = 0x7f0c0030; public static final int common_signin_button_text = 0x7f0c0031; public static final int common_signin_button_text_long = 0x7f0c0032; public static final int commono_google_play_services_api_unavailable_text = 0x7f0c0033; public static final int create_calendar_message = 0x7f0c0034; public static final int create_calendar_title = 0x7f0c0035; public static final int decline = 0x7f0c0036; public static final int store_picture_message = 0x7f0c0057; public static final int store_picture_title = 0x7f0c0058; public static final int wallet_buy_button_place_holder = 0x7f0c006d; } public static final class style { public static final int Theme_IAPTheme = 0x7f0d003e; public static final int WalletFragmentDefaultButtonTextAppearance = 0x7f0d003f; public static final int WalletFragmentDefaultDetailsHeaderTextAppearance = 0x7f0d0040; public static final int WalletFragmentDefaultDetailsTextAppearance = 0x7f0d0041; public static final int WalletFragmentDefaultStyle = 0x7f0d0042; } public static final class styleable { public static final int[] AdsAttrs = { 0x7f010059, 0x7f01005a, 0x7f01005b }; public static final int AdsAttrs_adSize = 0; public static final int AdsAttrs_adSizes = 1; public static final int AdsAttrs_adUnitId = 2; public static final int[] CustomWalletTheme = { 0x7f01005d }; public static final int CustomWalletTheme_windowTransitionStyle = 0; public static final int[] LoadingImageView = { 0x7f010060, 0x7f010061, 0x7f010062 }; public static final int LoadingImageView_circleCrop = 2; public static final int LoadingImageView_imageAspectRatio = 1; public static final int LoadingImageView_imageAspectRatioAdjust = 0; public static final int[] MapAttrs = { 0x7f010063, 0x7f010064, 0x7f010065, 0x7f010066, 0x7f010067, 0x7f010068, 0x7f010069, 0x7f01006a, 0x7f01006b, 0x7f01006c, 0x7f01006d, 0x7f01006e, 0x7f01006f, 0x7f010070, 0x7f010071, 0x7f010072 }; public static final int MapAttrs_cameraBearing = 1; public static final int MapAttrs_cameraTargetLat = 2; public static final int MapAttrs_cameraTargetLng = 3; public static final int MapAttrs_cameraTilt = 4; public static final int MapAttrs_cameraZoom = 5; public static final int MapAttrs_liteMode = 6; public static final int MapAttrs_mapType = 0; public static final int MapAttrs_uiCompass = 7; public static final int MapAttrs_uiMapToolbar = 15; public static final int MapAttrs_uiRotateGestures = 8; public static final int MapAttrs_uiScrollGestures = 9; public static final int MapAttrs_uiTiltGestures = 10; public static final int MapAttrs_uiZoomControls = 11; public static final int MapAttrs_uiZoomGestures = 12; public static final int MapAttrs_useViewLifecycle = 13; public static final int MapAttrs_zOrderOnTop = 14; public static final int[] WalletFragmentOptions = { 0x7f01008f, 0x7f010090, 0x7f010091, 0x7f010092 }; public static final int WalletFragmentOptions_appTheme = 0; public static final int WalletFragmentOptions_environment = 1; public static final int WalletFragmentOptions_fragmentMode = 3; public static final int WalletFragmentOptions_fragmentStyle = 2; public static final int[] WalletFragmentStyle = { 0x7f010093, 0x7f010094, 0x7f010095, 0x7f010096, 0x7f010097, 0x7f010098, 0x7f010099, 0x7f01009a, 0x7f01009b, 0x7f01009c, 0x7f01009d }; public static final int WalletFragmentStyle_buyButtonAppearance = 3; public static final int WalletFragmentStyle_buyButtonHeight = 0; public static final int WalletFragmentStyle_buyButtonText = 2; public static final int WalletFragmentStyle_buyButtonWidth = 1; public static final int WalletFragmentStyle_maskedWalletDetailsBackground = 6; public static final int WalletFragmentStyle_maskedWalletDetailsButtonBackground = 8; public static final int WalletFragmentStyle_maskedWalletDetailsButtonTextAppearance = 7; public static final int WalletFragmentStyle_maskedWalletDetailsHeaderTextAppearance = 5; public static final int WalletFragmentStyle_maskedWalletDetailsLogoImageType = 10; public static final int WalletFragmentStyle_maskedWalletDetailsLogoTextColor = 9; public static final int WalletFragmentStyle_maskedWalletDetailsTextAppearance = 4; } }
[ "sushi@ZiqiLIUs-MacBook-Pro.local" ]
sushi@ZiqiLIUs-MacBook-Pro.local
ca119e9c4773d58a517ef85f2a457509032c1009
58d9997a806407a09c14aa0b567e57d486b282d4
/com/planet_ink/coffee_mud/Commands/AutoInvoke.java
c8a75957d1be6361e7b2663c0a8c677c00c523dc
[ "Apache-2.0" ]
permissive
kudos72/DBZCoffeeMud
553bc8619a3542fce710ba43bac01144148fe2ed
19a3a7439fcb0e06e25490e19e795394da1df490
refs/heads/master
2021-01-10T07:57:01.862867
2016-03-17T23:04:25
2016-03-17T23:04:25
39,215,834
0
0
null
null
null
null
UTF-8
Java
false
false
6,557
java
package com.planet_ink.coffee_mud.Commands; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.Session.InputCallback; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2000-2014 Bo Zimmerman Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ @SuppressWarnings("rawtypes") public class AutoInvoke extends StdCommand { public AutoInvoke(){} private final String[] access=I(new String[]{"AUTOINVOKE"}); @Override public String[] getAccessWords(){return access;} protected enum AutoInvokeCommand { TOGGLE, INVOKE, UNINVOKE } protected void autoInvoke(MOB mob, Ability foundA, String s, Set<String> effects, AutoInvokeCommand cmd) { if(foundA==null) mob.tell(L("'@x1' is invalid.",s)); else if(effects.contains(foundA.ID())) { if((cmd == AutoInvokeCommand.UNINVOKE) || (cmd == AutoInvokeCommand.TOGGLE)) { foundA=mob.fetchEffect(foundA.ID()); if(foundA!=null) { mob.delEffect(foundA); if(mob.fetchEffect(foundA.ID())!=null) mob.tell(L("@x1 failed to successfully deactivate.",foundA.name())); else mob.tell(L("@x1 successfully deactivated.",foundA.name())); } } } else { if((cmd == AutoInvokeCommand.INVOKE) || (cmd == AutoInvokeCommand.TOGGLE)) { foundA.autoInvocation(mob, true); if(mob.fetchEffect(foundA.ID())!=null) mob.tell(L("@x1 successfully invoked.",foundA.name())); else mob.tell(L("@x1 failed to successfully invoke.",foundA.name())); } } } @Override public boolean execute(final MOB mob, Vector commands, int metaFlags) throws java.io.IOException { final List<Ability> abilities=new Vector<Ability>(); final Set<String> abilityids=new TreeSet<String>(); for(int a=0;a<mob.numAbilities();a++) { final Ability A=mob.fetchAbility(a); if((A!=null) &&(A.isAutoInvoked()) &&((A.classificationCode()&Ability.ALL_ACODES)!=Ability.ACODE_LANGUAGE) &&((A.classificationCode()&Ability.ALL_ACODES)!=Ability.ACODE_PROPERTY)) { abilities.add(A); abilityids.add(A.ID()); } } final Set<String> effects=new TreeSet<String>(); for(int a=0;a<mob.numEffects();a++) { final Ability A=mob.fetchEffect(a); if((A!=null) &&(abilityids.contains(A.ID())) &&(!A.isSavable())) effects.add(A.ID()); } abilityids.clear(); Collections.sort(abilities,new Comparator<Ability>(){ @Override public int compare(Ability o1, Ability o2) { if(o1==null) { if(o2==null) return 0; return -1; } else if(o2==null) return 1; else return o1.name().compareToIgnoreCase(o2.name()); } }); final StringBuffer str=new StringBuffer(L("^xAuto-invoking abilities:^?^.\n\r^N")); int col=0; for(Ability A : abilities) { if(A!=null) { if(effects.contains(A.ID())) str.append(L("@x1.^xACTIVE^?^.^N ",CMStrings.padRightWith(A.Name(),'.',29))); else str.append(L("@x1^xINACTIVE^?^.^N",CMStrings.padRightWith(A.Name(),'.',29))); if(++col==2) { col=0; str.append("\n\r"); } else str.append(" "); } } if(col==1) str.append("\n\r"); mob.tell(str.toString()); final Session session=mob.session(); if(session!=null) { final AutoInvoke me=this; session.prompt(new InputCallback(InputCallback.Type.PROMPT,"",0) { @Override public void showPrompt() { session.promptPrint(L("Enter one to toggle or RETURN: "));} @Override public void timedOut() { } @Override public void callBack() { String s=this.input; AutoInvokeCommand cmd=AutoInvokeCommand.TOGGLE; if(s.toUpperCase().startsWith("INVOKE ")) { s=s.substring(7).trim(); cmd=AutoInvokeCommand.INVOKE; } else if(s.toUpperCase().startsWith("UNINVOKE ")) { s=s.substring(9).trim(); cmd=AutoInvokeCommand.UNINVOKE; } boolean startsWith=s.endsWith("*"); if(startsWith) s=s.substring(0,s.length()-1).toLowerCase(); boolean endsWith=s.startsWith("*"); if(endsWith) s=s.substring(1).toLowerCase(); if(startsWith || endsWith) { for(Ability A : abilities) { if((A!=null) &&(A.name().equalsIgnoreCase(s) || (startsWith && A.name().toLowerCase().startsWith(s)) || (endsWith && A.name().toLowerCase().endsWith(s)))) { me.autoInvoke(mob, A, s, effects, cmd); } } } else if(s.length()>0) { Ability foundA=null; for(Ability A : abilities) { if((A!=null) &&(A.name().equalsIgnoreCase(s) || (startsWith && A.name().toLowerCase().startsWith(s)) || (endsWith && A.name().toLowerCase().endsWith(s)))) { foundA=A; break;} } if(foundA==null) for(Ability A : abilities) { if((A!=null)&&(CMLib.english().containsString(A.name(),s))) { foundA=A; break;} } me.autoInvoke(mob, foundA, s, effects, cmd); } mob.recoverCharStats(); mob.recoverPhyStats(); mob.recoverMaxState(); if(mob.location()!=null) mob.location().recoverRoomStats(); mob.recoverCharStats(); mob.recoverPhyStats(); mob.recoverMaxState(); } }); } return false; } @Override public boolean canBeOrdered(){return true;} }
[ "kirk.narey@gmail.com" ]
kirk.narey@gmail.com
09e1d5a299b79aa430cd572044c72bfcb43a63ad
b46163a750c39c88944c20365ea9c7ef7c0d2b05
/src/main/java/org/verzhbitski/ui/MainWindowController.java
70b34ae2ee16bcfae6c392e629bbf0c6039546a0
[]
no_license
verzhbitski/notes
bfc5a3c8373d2b82fc05be29aa06e08f29945d2c
8df658d6c09178c35a39090d2a165bf1c4c6cbbf
refs/heads/master
2021-09-06T22:24:49.897861
2018-02-12T14:45:50
2018-02-12T14:45:50
121,258,071
0
0
null
null
null
null
UTF-8
Java
false
false
1,463
java
package org.verzhbitski.ui; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.stage.Stage; import org.verzhbitski.database.DataRetriever; import org.verzhbitski.data.Data; import org.verzhbitski.data.Note; import java.io.IOException; public class MainWindowController { @FXML private TableColumn tcDate; @FXML private TableColumn tcTime; @FXML private TableColumn tcNote; @FXML private TableView<Note> table; public void initialize() { tcNote.prefWidthProperty().bind( table.widthProperty() .subtract(tcTime.widthProperty()) .subtract(tcDate.widthProperty()) .subtract(2) ); table.setItems(Data.data); new DataRetriever().run(); } public void newNote() { try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/NewNote.fxml")); Parent root = loader.load(); Stage stage = new Stage(); stage.setTitle("New note"); stage.setResizable(false); stage.setScene(new Scene(root, 500, 275)); stage.show(); } catch (IOException e) { e.printStackTrace(); } } }
[ "verzhbitski@gmail.com" ]
verzhbitski@gmail.com
f743692369da82581e668a3865de61e181b4a6f1
19614a3d3a1c8296a24de252c501b58f0540b528
/src/test/java/SampleGradle/AppTest.java
c034e28bb5e25b081725a530a72de825b79f363d
[]
no_license
DavidLopezIBM/BasicGradle
47d97b28e2df97e6369fc2b56f50fa42a4ee1c15
e84d0dbccbaf923dcf8d5fc895c2577c86e376b6
refs/heads/main
2023-06-13T00:55:24.856088
2021-04-13T18:25:07
2021-04-13T18:25:07
357,651,044
0
1
null
2021-07-15T18:08:07
2021-04-13T18:24:22
Java
UTF-8
Java
false
false
354
java
/* * This Java source file was generated by the Gradle 'init' task. */ package SampleGradle; import org.junit.Test; import static org.junit.Assert.*; public class AppTest { @Test public void testAppHasAGreeting() { App classUnderTest = new App(); assertNotNull("app should have a greeting", classUnderTest.getGreeting()); } }
[ "david.lopez@ibm.com" ]
david.lopez@ibm.com
675ecb774d77ca59775d3b796f023c92df34d867
d1935324cee4af9672f6bcfe6147e61f6baa0af3
/src/main/java/com/example/demo/vo/KlinePic.java
2401ee483629cb27ec4c838de1bfc29a8e08962b
[]
no_license
382185606/demo
dea1bc279ce5569e7123efd42064cafcb2b9cffb
5fc50ae6fc4834921f6afe24a7947132c2f42e44
refs/heads/master
2022-06-21T20:39:26.253238
2020-04-27T02:49:14
2020-04-27T02:49:14
259,186,861
0
0
null
2022-06-17T03:06:45
2020-04-27T02:44:23
Java
UTF-8
Java
false
false
1,290
java
package com.example.demo.vo; import com.alibaba.fastjson.annotation.JSONField; /** * @author Askyi */ public class KlinePic { private String minute; @JSONField(ordinal = 1) private String open; @JSONField(ordinal = 2) private String close; @JSONField(ordinal = 3) private String min; @JSONField(ordinal = 4) private String max; public KlinePic() { } public KlinePic(String minute, String open, String close, String min, String max) { this.minute = minute; this.open = open; this.close = close; this.min = min; this.max = max; } public String getMinute() { return minute; } public void setMinute(String minute) { this.minute = minute; } public String getOpen() { return open; } public void setOpen(String open) { this.open = open; } public String getClose() { return close; } public void setClose(String close) { this.close = close; } public String getMin() { return min; } public void setMin(String min) { this.min = min; } public String getMax() { return max; } public void setMax(String max) { this.max = max; } }
[ "382185606@qq.com" ]
382185606@qq.com
84898566a2c804544b85ac3341a4f348af5fc13c
a0b313b6066b1cdbee54000b483c717b77cf25aa
/Starbuzz/app/src/main/java/com/hfad/starbuzz/DrinkActivity.java
2e9dbbaee6b441697614947a5cb54797f1c36ad8
[]
no_license
miller7777777/HeadFirst_Android
8c10cf6ed63ab374a79c4163971c0b65e55b85fb
039397eb6d5d963976fe47890d192c1154dd504c
refs/heads/master
2021-01-20T19:40:16.150133
2016-08-18T01:30:37
2016-08-18T01:30:37
64,707,730
0
0
null
null
null
null
UTF-8
Java
false
false
4,480
java
package com.hfad.starbuzz; import android.app.Activity; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; public class DrinkActivity extends Activity { public static final String EXTRA_DRINKNO = "drinkNo"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_drink); int drinkNo = (int) getIntent().getExtras().get(EXTRA_DRINKNO); //Создание курсора try { SQLiteOpenHelper starbuzzDatabaseHelper = new StarbuzzDatabaseHelper(this); SQLiteDatabase db = starbuzzDatabaseHelper.getWritableDatabase(); Cursor cursor = db.query("DRINK", new String[]{"NAME", "DESCRIPTION", "IMAGE_RESOURCE_ID", "FAVORITE"}, "_id=?", new String[]{Integer.toString(drinkNo)}, null, null, null); //Переход к первой записи в курсоре if (cursor.moveToFirst()) { //получение напитка из курсора String nameText = cursor.getString(0); String descriptionText = cursor.getString(1); int photoId = cursor.getInt(2); boolean isFavorite = (cursor.getInt(3) == 1); TextView name = (TextView) findViewById(R.id.name); if (name != null) { name.setText(nameText); } TextView description = (TextView) findViewById(R.id.description); if (description != null) { description.setText(descriptionText); } ImageView photo = (ImageView) findViewById(R.id.photo); if (photo != null) { photo.setImageResource(photoId); photo.setContentDescription(nameText); } //Заполнение флажка любимого напитка CheckBox favorite = (CheckBox) findViewById(R.id.favorite); if (favorite != null) { favorite.setChecked(isFavorite); } } cursor.close(); db.close(); } catch (SQLiteException e) { Toast toast = Toast.makeText(this, "Database unavalable", Toast.LENGTH_LONG); toast.show(); } } //обновление базы данных по щелчку на флажке public void onFavoriteClicked(View view) { int drinkNo = (int) getIntent().getExtras().get("drinkNo"); new UpdateDrinkTask().execute(drinkNo); } //Внутренний класс для обновления напитка. private class UpdateDrinkTask extends AsyncTask<Integer, Void, Boolean> { ContentValues drinkValues; @Override protected void onPreExecute() { CheckBox favorite = (CheckBox) findViewById(R.id.favorite); drinkValues = new ContentValues(); drinkValues.put("FAVORITE", favorite.isChecked()); } @Override protected Boolean doInBackground(Integer... drinks) { int drinkNo = drinks[0]; SQLiteOpenHelper starbuzzDatabaseHelper = new StarbuzzDatabaseHelper(DrinkActivity.this); try { SQLiteDatabase db = starbuzzDatabaseHelper.getWritableDatabase(); db.update("DRINK", drinkValues, "_id = ?", new String[]{Integer.toString(drinkNo)}); db.close(); return true; } catch (SQLiteException e) { return false; } } @Override protected void onPostExecute(Boolean success) { if (!success) { Toast toast = Toast.makeText(DrinkActivity.this, "Database unavailable", Toast.LENGTH_SHORT); toast.show(); } } } }
[ "miller777@mail.ru" ]
miller777@mail.ru
7bd39e96a37e0626426cc40e97410ed5950f6da8
1bfc8dbf7957a4c507123f049eafb76ac1cc254c
/src/main/java/hello/core/HelloLombok.java
9778698920f2e9324dea4508f3d012f3dbeaf52d
[]
no_license
seokjinjeong-cod/Spring-Core-Principles
c124b0703eb61eeecc103a920b8c3fc809f0e706
a0d20aac5e9393779f8d2a88e83e358395b0d543
refs/heads/main
2023-06-16T16:37:16.088689
2021-07-17T09:02:35
2021-07-17T09:02:35
385,124,597
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
package hello.core; import lombok.Getter; import lombok.Setter; import lombok.ToString; @Getter @Setter @ToString public class HelloLombok { private String name; private int age; public static void main(String[] args) { HelloLombok helloLombok = new HelloLombok(); helloLombok.setName("asdfe"); System.out.println("helloLombok = " + helloLombok); } }
[ "jsj961@naver.com" ]
jsj961@naver.com
db0c76d451e8ae8977f70ccd776957e2b8de106b
24efde845bb5362ea83b6cfa87bf796c559942d1
/AlgoritmoOrdenamientoBurbuja/src/AlgoritmoOrdenamientoBurbuja.java
1d3b09b9cbfef705bdf9aa14fcf952d01ad0f929
[]
no_license
carminalizbeth98/AlgoritmoBurbuja
1805cde75cdfe7bff460c79f06736726c9fe21de
1f9af09f26abea54d96e01e617c9948d3223d371
refs/heads/master
2021-08-22T11:36:21.102122
2017-11-30T04:37:22
2017-11-30T04:37:22
112,564,957
0
2
null
null
null
null
UTF-8
Java
false
false
1,459
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. */ /** * * @author Carmina Lizbeth Flores Solano */ public class AlgoritmoOrdenamientoBurbuja { int i, j, temporal; public AlgoritmoOrdenamientoBurbuja() { this.i = 0; this.j = 0; this.temporal = 0; } public void burbuja(int[] arreglo) { for (i = 0; i < arreglo.length; i++) { for (j = i + 1; j < arreglo.length; j++) { if (arreglo[i] > arreglo[j]) { temporal = arreglo[i]; arreglo[i] = arreglo[j]; arreglo[j] = temporal; } } } } public void burbuja2(int[] arreglo) { for (i = 0; i < arreglo.length; i++) { for (j = i + 1; j < arreglo.length - 1; j++) { if (arreglo[j] > arreglo[j + 1]) { temporal = arreglo[j]; arreglo[j] = arreglo[j + 1]; arreglo[j + 1] = temporal; } } } } public void mostrarArreglo(int[] arreglo) { int k; for (k = 0; k < arreglo.length; k++) { System.out.println("[" + arreglo[k] + "]"); } System.out.println(); } }
[ "noreply@github.com" ]
carminalizbeth98.noreply@github.com
3f519c39be96cff2f28469faa435f524ec15f2a1
6cc2abf99b21998fb45cb04fef5e1f83faed59f9
/serviceport/src/main/java/com/wxf/serviceport/service/UserService.java
5e0ceac5181c91e97e0884dbc7257251f00e012e
[]
no_license
fengdian/accountbook
f7af4c4f70ae45af52220cbfb0d2fe3d9557406e
4bb337c63b461d36ccc701f17b66d31e5f951f4d
refs/heads/master
2021-09-21T01:57:12.897821
2018-08-19T02:23:43
2018-08-19T02:23:43
115,069,859
5
0
null
null
null
null
UTF-8
Java
false
false
2,612
java
package com.wxf.serviceport.service; import android.text.TextUtils; import android.util.Log; import com.wxf.serviceport.dao.UserDao; import com.wxf.serviceport.entry.Password; import com.wxf.serviceport.util.DateFormat; import com.wxf.serviceport.util.UUIDUtil; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by 怎么着也得有个马甲 on 2017/12/7. * * @fileName UserService * @date on 2017/12/7 20:06 */ public class UserService { /** * 登录 * @param deviceId * @param password * @return */ public static Map<String,Object> login(String deviceId,String password)throws Exception{ Map<String,Object> map = new HashMap<>() ; int result =0; if(TextUtils.isEmpty(deviceId)||TextUtils.isEmpty(password)){ result =3; map.put("result",result); return map; } List<Password> passwordList = UserDao.getPasswordByDeviceId(deviceId); if (passwordList==null||passwordList.size()==0){ result =1; map.put("result",result); return map; } Password pwd = passwordList.get(0); Log.i("wxf", "login:查出: "+pwd.getPassword()); Log.i("wxf" ,"login: 输入:"+password); if(!password.equals(pwd.getPassword())){ result =2; map.put("result",result); return map; } map.put("result",result); return map; } /** * 注册 * @param deviceId * @param password * @return * @throws Exception */ public static Map<String,Object>register(String deviceId,String password)throws Exception{ Map<String,Object> map = new HashMap<>() ; int result =0; if(TextUtils.isEmpty(deviceId)||TextUtils.isEmpty(password)){ result =1; map.put("result",result); return map; } List<Password> passwordList = UserDao.getPasswordByDeviceId(deviceId); if (passwordList!=null&&passwordList.size()>0){ result =2; map.put("result",result); return map; } Password pwd = new Password(); pwd.setId(UUIDUtil.getUUID()); pwd.setDeviceId(deviceId); pwd.setPassword(password); pwd.setCreatetime(DateFormat.simdhm.format(new Date())); pwd.setUpdatetime(DateFormat.simdhm.format(new Date())); pwd.setIsdelete(0); UserDao.register(pwd); map.put("result",result); return map; } }
[ "29147001@qq.com" ]
29147001@qq.com
0646c979952cebdc7a9e239dd311d84fe71e3208
f908d61ec94bcb273498e3590a5412219b724676
/Assignment8.2/src/main/java/com/bookclub/service/impl/RestBookDao.java
9cdfe75cdc802b2df7551efccd6aafbd38c07a11
[]
no_license
twbennet-bellevue/CIS530
98ba9eb64f5d2342e3ffdbcdb47050de4ded5401
083555f9c3437395ffc2fbd7420a68d8c83b7765
refs/heads/main
2023-09-04T17:40:29.092261
2021-11-18T10:05:31
2021-11-18T10:05:31
403,201,629
0
0
null
null
null
null
UTF-8
Java
false
false
3,093
java
package com.bookclub.service.impl; import java.util.ArrayList; import java.util.List; import com.bookclub.model.Book; import com.bookclub.service.dao.BookDao; import com.jayway.jsonpath.Configuration; import com.jayway.jsonpath.JsonPath; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponentsBuilder; public class RestBookDao implements BookDao { public RestBookDao() { } public Object getBooksDoc(String isbnString) { String openLibraryUrl = "https://openlibrary.org/api/books"; RestTemplate rest = new RestTemplate(); // call the RestTemplate object to invoke a third-party API call. HttpHeaders headers = new HttpHeaders(); headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openLibraryUrl) .queryParam("bibkeys", isbnString) .queryParam("format", "json") .queryParam("jscmd", "details"); HttpEntity<?> entity = new HttpEntity<>(headers); HttpEntity<String> response = rest.exchange( builder.toUriString(), HttpMethod.GET, entity, String.class); String jsonBooklist = response.getBody(); return Configuration.defaultConfiguration().jsonProvider().parse(jsonBooklist); } @Override public List<Book> list() { String isbnString = "ISBN:9780593099322,9780261102361,9780261102378,9780590302715,9780316769532,9780385365925"; Object doc = getBooksDoc(isbnString); List<Book> books = new ArrayList<Book>(); List<String> titles = JsonPath.read(doc, "$..title"); List<String> isbns = JsonPath.read(doc, "$..bib_key"); List<String> infoUrls = JsonPath.read(doc, "$..info_url"); for (int index = 0; index < titles.size(); index++) { books.add(new Book(isbns.get(index), titles.get(index), infoUrls.get(index))); } return books; } @Override public Book find(String key) { Object doc = getBooksDoc(key); List<String> isbns = JsonPath.read(doc, "$..bib_key"); List<String> titles = JsonPath.read(doc, "$..title"); List<String> subtitle = JsonPath.read(doc, "$..details.subtitle"); List<String> infoUrls = JsonPath.read(doc, "$..info_url"); List<Integer> pages = JsonPath.read(doc, "$..details.number_of_pages"); String isbn = isbns.size() > 0 ? isbns.get(0) : "N/A"; String title = titles.size() > 0 ? titles.get(0) : "N/A"; String desc = subtitle.size() > 0 ? subtitle.get(0) : "N/A"; String infoUrl = infoUrls.size() > 0 ? infoUrls.get(0) : "N/A"; int numOfPages = pages.size() > 0 ? pages.get(0) : 0; Book book = new Book(isbn, title, desc, infoUrl, numOfPages); return book; } }
[ "twbennet@my.bellevue.edu" ]
twbennet@my.bellevue.edu
9a7875979b9486e51257405e356107c004e06efd
263b9556d76279459ab9942b0005a911e2b085c5
/src/main/java/com/alipay/api/response/SsdataDataserviceRiskDeviceidentityQueryResponse.java
73a58305851b7b7eb236a527db1f1538c3cdd2ea
[ "Apache-2.0" ]
permissive
getsgock/alipay-sdk-java-all
1c98ffe7cb5601c715b4f4b956e6c2b41a067647
1ee16a85df59c08fb9a9b06755743711d5cd9814
refs/heads/master
2020-03-30T05:42:59.554699
2018-09-19T06:17:22
2018-09-19T06:17:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,883
java
package com.alipay.api.response; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.AlipayResponse; /** * ALIPAY API: ssdata.dataservice.risk.deviceidentity.query response. * * @author auto create * @since 1.0, 2017-12-14 10:15:49 */ public class SsdataDataserviceRiskDeviceidentityQueryResponse extends AlipayResponse { private static final long serialVersionUID = 7411114497277413953L; /** * 盗卡盗账户概率,用于识别账号被盗的风险,数值越大风险概率越大,范围0~1,小数点后保留6有效数 */ @ApiField("ato_score") private String atoScore; /** * 身份被冒用概率,用于识别账号被冒用风险,数值越大风险概率越大,范围0~1,小数点后保留6有效数 */ @ApiField("fake_score") private String fakeScore; /** * 垃圾账户概率,用于识别垃圾账户的风险,数值越大风险概率越大,范围0~1,小数点后保留6有效数 */ @ApiField("rub_score") private String rubScore; /** * 设备ID,设备的唯一识别号 */ @ApiField("umid") private String umid; /** * 调用订单号,服务端唯一个识别号 */ @ApiField("unique_id") private String uniqueId; public void setAtoScore(String atoScore) { this.atoScore = atoScore; } public String getAtoScore( ) { return this.atoScore; } public void setFakeScore(String fakeScore) { this.fakeScore = fakeScore; } public String getFakeScore( ) { return this.fakeScore; } public void setRubScore(String rubScore) { this.rubScore = rubScore; } public String getRubScore( ) { return this.rubScore; } public void setUmid(String umid) { this.umid = umid; } public String getUmid( ) { return this.umid; } public void setUniqueId(String uniqueId) { this.uniqueId = uniqueId; } public String getUniqueId( ) { return this.uniqueId; } }
[ "liuqun.lq@alibaba-inc.com" ]
liuqun.lq@alibaba-inc.com
17af706e969e14aadf8f378697b57099f124c9c4
dc801a8180c889f95b750ef27b5d959d33106a4a
/src/org/concordiacraft/redrealms/advancements/RedAdvancementManager.java
eeec1ccb4ec8c9aaeea490cd057696f4def3f46b
[]
no_license
Theorenter/RedRealms
abc669c64604c156f268ce19cae336c6e2a1bedd
a44771c50d50d2d3e5d56aecdf3db1c5c8fc594c
refs/heads/master
2023-06-04T18:06:07.170473
2021-06-17T07:41:26
2021-06-17T07:41:26
284,438,397
0
1
null
null
null
null
UTF-8
Java
false
false
986
java
package org.concordiacraft.redrealms.advancements; import eu.endercentral.crazy_advancements.manager.AdvancementManager; import org.bukkit.Bukkit; import org.bukkit.GameRule; import org.bukkit.World; import org.concordiacraft.redrealms.main.RedRealms; /** * @author Theorenter * Advancements Manager */ public final class RedAdvancementManager { private static AdvancementManager advancementManager; public static void init() { if (!RedRealms.getDefaultConfig().hasCustomAdvancements()) { for (World w : Bukkit.getServer().getWorlds()) { w.setGameRule(GameRule.DO_LIMITED_CRAFTING, false); } return; } advancementManager = new AdvancementManager(); for (World w : Bukkit.getServer().getWorlds()) { w.setGameRule(GameRule.DO_LIMITED_CRAFTING, true); } } public static AdvancementManager getAdvancementManager() { return advancementManager; } }
[ "tovarishodmen@gmail.com" ]
tovarishodmen@gmail.com
7d172b6afcb6235b51218c5632ebd23ee04f5dc4
763f7cc4cb4a9b6c444fe0263119acbb82dafc97
/src/main/java/com/generic/hibdao/dao/EmployeeDao.java
bd52a9b6af043ede7b740f9d72f6d52502c1285b
[]
no_license
amal2004/Spring-Hibernate-GenericDAO
c85d9a4bbf666a1530978f8d045918d819c8dacb
b879789c00d86277c807ac9a29042cc2e5a16039
refs/heads/master
2021-05-04T19:23:55.716081
2017-10-13T04:58:55
2017-10-13T04:58:55
106,779,795
0
0
null
null
null
null
UTF-8
Java
false
false
170
java
package com.generic.hibdao.dao; import com.generic.hibdao.model.Employee; public interface EmployeeDao extends GenericDao<Employee> { Integer getMaxSalary(); }
[ "Amal@Amal-PC" ]
Amal@Amal-PC
b893ee4b4f54bc85a18eaf0e525bfaec7fe86293
e4d5fb2ad0ea69e8ad71f7649a90d389e94a2fe8
/src/main/java/com/eltosheva/sporthouse/jobs/JobRestController.java
66670daa7ab390d850544878e756ba108a32aba1
[]
no_license
Eltosheva/SportHouse-SpringAdvancedFinalProject
a0542c9b4748c477acde40753487c9a9d73c89e2
b2fbae9850eb1da938c01420a99b52c95bf90dab
refs/heads/master
2023-04-05T01:56:05.893210
2021-04-18T06:50:07
2021-04-18T06:50:07
354,052,168
0
0
null
null
null
null
UTF-8
Java
false
false
1,469
java
package com.eltosheva.sporthouse.jobs; import com.eltosheva.sporthouse.jobs.Info.ScheduleJob; import com.eltosheva.sporthouse.utils.ResponseMsg; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @RestController() @RequestMapping(path = "/api/schedule") public class JobRestController { private final SchedulerService schedulerService; public JobRestController(SchedulerService schedulerService) { this.schedulerService = schedulerService; } @RequestMapping(path = "/addOrEdit", method = {RequestMethod.GET, RequestMethod.POST}) public ResponseEntity<?> addOrEdit(ScheduleJob job) { try { schedulerService.addOrEditJob(job); } catch (Exception e) { } return ResponseEntity.ok().body(new ResponseMsg(true)); } @RequestMapping(path = "/delete", method = {RequestMethod.GET, RequestMethod.POST}) public ResponseEntity<?> deleteJob(ScheduleJob job) { try { schedulerService.deleteJob(job); } catch (Exception e) { } return ResponseEntity.ok().body(new ResponseMsg(true)); } @RequestMapping(path = "/run", method = {RequestMethod.GET, RequestMethod.POST}) public ResponseEntity<?> runJob(ScheduleJob job) { try { schedulerService.runJob(job); } catch (Exception e) { } return ResponseEntity.ok().body(new ResponseMsg(true)); } }
[ "elisaveta.tosheva@gmail.com" ]
elisaveta.tosheva@gmail.com
eda139cbb3f5f3b5d55c0501bbfb82951d3bb35d
99a9d063175d24b6c7a29c5419e8078057327f8b
/spring-boot-springbatch/src/main/java/com/sl/conditional/Conditional.java
264e67271e7b12ab9e9eccd8df11bd2f6abb6196
[]
no_license
FadeHub/spring-boot-learn
4fce4f17229434583526a8aa903abb29b5c5ecaa
5df5333e9c6e0c5721d9389bcc98b5669b8f92fb
refs/heads/master
2022-10-13T14:18:52.842687
2022-10-04T09:09:53
2022-10-04T09:09:53
196,712,086
33
48
null
2022-10-04T09:10:48
2019-07-13T11:06:26
Java
UTF-8
Java
false
false
517
java
package com.sl.conditional; /** * @author shuliangzhao * @Title: Test * @ProjectName spring-boot-learn * @Description: TODO * @date 2020/12/16 20:18 */ public class Conditional { private String user; private Boolean enable; public void setUser(String user) { this.user = user; } public String getUser() { return user; } public Boolean getEnable() { return enable; } public void setEnable(Boolean enable) { this.enable = enable; } }
[ "809894780@qq.com" ]
809894780@qq.com
e058b9fefd2972e485b15e197949ab61acdd10c7
59cce7b0ab9b92cc76185fdf8efd985bf3206eed
/src/main/java/com/interview/library/config/WebConfigurer.java
84b2fa647a0f6ba399ccec430f15b8c6599920d6
[]
no_license
davidtabadi/Docker-Project
e77b5af8beb96b7d515026a28945e05f420b796e
58e8468b61d521bab8b553e5740ad29bf82dd6bc
refs/heads/master
2021-06-28T12:59:36.954871
2018-10-21T09:12:07
2018-10-21T09:12:07
153,990,348
0
1
null
2020-09-18T07:31:18
2018-10-21T09:04:30
Java
UTF-8
Java
false
false
7,321
java
package com.interview.library.config; import io.github.jhipster.config.JHipsterConstants; import io.github.jhipster.config.JHipsterProperties; import io.github.jhipster.web.filter.CachingHttpHeadersFilter; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.servlet.InstrumentedFilter; import com.codahale.metrics.servlets.MetricsServlet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.embedded.*; import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; import io.undertow.UndertowOptions; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; import org.springframework.http.MediaType; import java.io.File; import java.nio.file.Paths; import java.util.*; import javax.servlet.*; /** * Configuration of web application with Servlet 3.0 APIs. */ @Configuration public class WebConfigurer implements ServletContextInitializer, EmbeddedServletContainerCustomizer { private final Logger log = LoggerFactory.getLogger(WebConfigurer.class); private final Environment env; private final JHipsterProperties jHipsterProperties; private MetricRegistry metricRegistry; public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) { this.env = env; this.jHipsterProperties = jHipsterProperties; } @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); } EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC); initMetrics(servletContext, disps); if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) { initCachingHttpHeadersFilter(servletContext, disps); } log.info("Web application fully configured"); } /** * Customize the Servlet engine: Mime types, the document root, the cache. */ @Override public void customize(ConfigurableEmbeddedServletContainer container) { MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT); // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711 mappings.add("html", MediaType.TEXT_HTML_VALUE + ";charset=utf-8"); // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64 mappings.add("json", MediaType.TEXT_HTML_VALUE + ";charset=utf-8"); container.setMimeMappings(mappings); // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets. setLocationForStaticAssets(container); /* * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288 * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1. * See the JHipsterProperties class and your application-*.yml configuration files * for more information. */ if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && container instanceof UndertowEmbeddedServletContainerFactory) { ((UndertowEmbeddedServletContainerFactory) container) .addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); } } private void setLocationForStaticAssets(ConfigurableEmbeddedServletContainer container) { File root; String prefixPath = resolvePathPrefix(); root = new File(prefixPath + "target/www/"); if (root.exists() && root.isDirectory()) { container.setDocumentRoot(root); } } /** * Resolve path prefix to static resources. */ private String resolvePathPrefix() { String fullExecutablePath = this.getClass().getResource("").getPath(); String rootPath = Paths.get(".").toUri().normalize().getPath(); String extractedPath = fullExecutablePath.replace(rootPath, ""); int extractionEndIndex = extractedPath.indexOf("target/"); if (extractionEndIndex <= 0) { return ""; } return extractedPath.substring(0, extractionEndIndex); } /** * Initializes the caching HTTP Headers Filter. */ private void initCachingHttpHeadersFilter(ServletContext servletContext, EnumSet<DispatcherType> disps) { log.debug("Registering Caching HTTP Headers Filter"); FilterRegistration.Dynamic cachingHttpHeadersFilter = servletContext.addFilter("cachingHttpHeadersFilter", new CachingHttpHeadersFilter(jHipsterProperties)); cachingHttpHeadersFilter.addMappingForUrlPatterns(disps, true, "/content/*"); cachingHttpHeadersFilter.addMappingForUrlPatterns(disps, true, "/app/*"); cachingHttpHeadersFilter.setAsyncSupported(true); } /** * Initializes Metrics. */ private void initMetrics(ServletContext servletContext, EnumSet<DispatcherType> disps) { log.debug("Initializing Metrics registries"); servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, metricRegistry); servletContext.setAttribute(MetricsServlet.METRICS_REGISTRY, metricRegistry); log.debug("Registering Metrics Filter"); FilterRegistration.Dynamic metricsFilter = servletContext.addFilter("webappMetricsFilter", new InstrumentedFilter()); metricsFilter.addMappingForUrlPatterns(disps, true, "/*"); metricsFilter.setAsyncSupported(true); log.debug("Registering Metrics Servlet"); ServletRegistration.Dynamic metricsAdminServlet = servletContext.addServlet("metricsServlet", new MetricsServlet()); metricsAdminServlet.addMapping("/management/metrics/*"); metricsAdminServlet.setAsyncSupported(true); metricsAdminServlet.setLoadOnStartup(2); } @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/api/**", config); source.registerCorsConfiguration("/management/**", config); source.registerCorsConfiguration("/v2/api-docs", config); } return new CorsFilter(source); } @Autowired(required = false) public void setMetricRegistry(MetricRegistry metricRegistry) { this.metricRegistry = metricRegistry; } }
[ "davidtabadi@outlook.com" ]
davidtabadi@outlook.com
6be38a879630f1a4c6d7cd46764dbfbd826c7753
44092ff931dfb9bea6d5209de90c9f4ddcbef9e7
/Sem07/EurekaLib/src/pe/egcc/app/service/CuentaService.java
cc138a12f75519a7a49b75228c8a31f72f9a8c79
[]
no_license
gcoronelc/UCH_ING-SOFT-III_2016-2
ebcf4e41876373318693e7cd0c1821df89226a5e
bd1c02867e94d290599a74f48a9368cd991525b3
refs/heads/master
2020-05-22T01:34:09.215832
2016-11-17T01:37:27
2016-11-17T01:37:27
65,856,185
0
1
null
null
null
null
UTF-8
Java
false
false
5,382
java
package pe.egcc.app.service; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import pe.egcc.app.db.AccesoDB; public class CuentaService { public void registrarRetiro(String cuenta, double importe, String clave, String codEmp) { Connection cn = null; try { cn = AccesoDB.getConnection(); cn.setAutoCommit(false); // Paso 1: Leer datos de la cuenta String sql = "select dec_cuensaldo, int_cuencontmov " + "from cuenta where chr_cuencodigo=? " + "and chr_cuenclave = ? "; PreparedStatement pstm = cn.prepareStatement(sql); pstm.setString(1, cuenta); pstm.setString(2, clave); ResultSet rs = pstm.executeQuery(); if (!rs.next()) { throw new Exception("Datos de la cuenta no son correctos."); } double saldo = rs.getDouble("dec_cuensaldo"); int cont = rs.getInt("int_cuencontmov"); rs.close(); pstm.close(); // Paso 2: Verificar saldo if (importe > saldo) { throw new Exception("No existe saldo suficiente."); } // Paso 3: Actualizar cuenta saldo -= importe; cont++; sql = "update cuenta set dec_cuensaldo = ?, " + "int_cuencontmov = ? " + "where chr_cuencodigo = ?"; pstm = cn.prepareStatement(sql); pstm.setDouble(1, saldo); pstm.setInt(2, cont); pstm.setString(3, cuenta); int filas = pstm.executeUpdate(); pstm.close(); if (filas == 0) { throw new Exception("No es posible actualizar la cuenta."); } // Paso 4: Insertar el movimiento sql = "insert into movimiento(chr_cuencodigo,int_movinumero," + "dtt_movifecha,chr_emplcodigo,chr_tipocodigo," + "dec_moviimporte) values(?,?,SYSDATE(),?,'004',?)"; pstm = cn.prepareStatement(sql); pstm.setString(1, cuenta); pstm.setInt(2, cont); pstm.setString(3, codEmp); pstm.setDouble(4, importe); pstm.executeUpdate(); pstm.close(); // Confirmar Tx cn.commit(); } catch (Exception e) { try { cn.rollback(); } catch (Exception e1) { } String texto = "Error en el proceso. "; texto += e.getMessage(); throw new RuntimeException(texto); } finally { try { cn.close(); } catch (Exception e) { } } } public Map<String, Object> getCuentaPract2(String cuenta) { Map<String, Object> rec = null; Connection cn = null; try { cn = AccesoDB.getConnection(); String sql = "select " + " c.chr_cuencodigo cuenta, " + " c.dec_cuensaldo saldo, " + " c.vch_cuenestado estado, " + " c.chr_monecodigo codMoneda, " + " m.vch_monedescripcion moneda, " + " c.chr_cliecodigo codCliente, " + " concat(vch_cliepaterno,' ', " + " vch_cliematerno,', ',vch_clienombre) cliente " + "from moneda m join cuenta c " + "on m.chr_monecodigo = c.chr_monecodigo " + "join cliente cl " + "on c.chr_cliecodigo = cl.chr_cliecodigo " + "where c.chr_cuencodigo = ? "; PreparedStatement pstm = cn.prepareStatement(sql); pstm.setString(1, cuenta); ResultSet rs = pstm.executeQuery(); if (rs.next()) { rec = new HashMap<>(); rec.put("cuenta", rs.getString("cuenta")); rec.put("saldo", rs.getDouble("saldo")); rec.put("estado", rs.getString("estado")); rec.put("codMoneda", rs.getString("codMoneda")); rec.put("moneda", rs.getString("moneda")); rec.put("codCliente", rs.getString("codCliente")); rec.put("cliente", rs.getString("cliente")); } rs.close(); pstm.close(); if (rec == null) { throw new Exception("Cuenta " + cuenta + " no existe."); } } catch (Exception e) { throw new RuntimeException(e.getMessage()); } finally { try { cn.close(); } catch (Exception e) { } } return rec; } public List<Map<String, Object>> getMovimientosPract2(String cuenta) { List<Map<String, Object>> lista = new ArrayList<>(); Connection cn = null; try { cn = AccesoDB.getConnection(); String sql = "select movinumero, movifecha, tiponombre, tipoaccion, moviimporte " + "from v_movimiento where cuencodigo = ? "; PreparedStatement pstm = cn.prepareStatement(sql); pstm.setString(1, cuenta); ResultSet rs = pstm.executeQuery(); while (rs.next()) { Map<String, Object> rec = new HashMap<>(); rec.put("movinumero", rs.getInt("movinumero")); rec.put("movifecha", rs.getDate("movifecha")); rec.put("tiponombre", rs.getString("tiponombre")); rec.put("tipoaccion", rs.getString("tipoaccion")); rec.put("moviimporte", rs.getDouble("moviimporte")); lista.add(rec); } rs.close(); pstm.close(); } catch (Exception e) { throw new RuntimeException(e.getMessage()); } finally { try { cn.close(); } catch (Exception e) { } } return lista; } }
[ "docente@soporteuch.pe" ]
docente@soporteuch.pe
8766980d66c4e8aba4d03fac5c9ead2072a690c1
c94fd9ab9a6873ed97764d50801d27ebc7057e0b
/mybatis-02/src/com/company/test/Main.java
7da2ea5b2ab93b499de954db3f2564c1d96bab9d
[]
no_license
purple910/SSH
9c540a8134ba05cae72b269fae542db932d88afc
cd0c264f6854de845ae7460105d607af1c59f9ca
refs/heads/master
2021-06-27T20:39:10.983470
2020-10-12T08:35:02
2020-10-12T08:35:02
196,489,494
0
0
null
2020-01-24T00:42:18
2019-07-12T01:46:12
Java
UTF-8
Java
false
false
4,939
java
package com.company.test; import com.company.entity.Student; import com.company.mapper.StudentMapper; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.ExecutorType; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import java.io.IOException; import java.io.Reader; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; public class Main { public static SqlSessionFactory sessionFactory = null; static { try { Reader reader = Resources.getResourceAsReader("config.xml"); sessionFactory = new SqlSessionFactoryBuilder().build(reader); } catch (IOException e) { e.printStackTrace(); } } public static SqlSession getSession(){ SqlSession session = null; // session = sessionFactory.openSession(); //手动 // session = sessionFactory.openSession(true); //自动 session = sessionFactory.openSession(ExecutorType.BATCH); //批量插入 return session; } public static void main(String[] args) { // write your code here SqlSession session = getSession(); StudentMapper mapper = session.getMapper(StudentMapper.class); // Student student = mapper.queryStudentById(1); // System.out.println(student); // // List<Student> list = mapper.queryStudentAll(); // System.out.println(list); /** * 自增 * id 不要int 用Interger */ // Student student = new Student("aa",5); // mapper.addStudentWithEcho(student); //// session.commit(); // Integer id = student.getId(); // System.out.println(student); // System.out.println(id); /** * 传递多参 */ // Integer lsls = mapper.addStudentWithParametes(null, "lsls", 12); // Integer lsls = mapper.addStudentWithParametes2(null, "zs", 15); // Student student = new Student(null, "as", 10); // Integer lsls = mapper.addStudentWithParametes3(null, student); // System.out.println(lsls); /** * hashmap */ // HashMap<String, Object> hashMap = mapper.queryStudentWithMap(2); // System.out.println(hashMap); // HashMap<String, Student> studentHashMap = mapper.queryStudentWithMap1(); // System.out.println(studentHashMap); /** * discriminator---case */ // List<Student> student = mapper.queryStudentsWithCase(); // System.out.println(student); // List<Student> list = mapper.queryStudentsWithONGL(new Student("s", 18, "a")); // System.out.println(list); // Student student = new Student(); // student.setAge(18); // List<Student> list = mapper.queryStudentWith(student); // System.out.println(list); // List<Student> list = mapper.queryStudentWithSee(new Student("%s%",10)); // List<Student> list = mapper.queryStudentWithSee2(new Student("s",10)); // System.out.println(list); // List<Student> list = mapper.queryStudentsWithInterceptor(2); // System.out.println("list = " + list); // List<Student> list = new ArrayList<>(); // long start = System.currentTimeMillis(); // for(int i=1;i<10;i++){ // Student student = new Student(i,"ll"+i,i,"X"+i); // list.add(student); // } // mapper.addStudentWithMany(list); // session.commit(); // long end = System.currentTimeMillis(); // System.out.println(end-start); /** * page */ //第二种,Mapper接口方式的调用,推荐这种使用方式。pageNum:第几页,pageSize:页数大小 // PageHelper.startPage(2, 3); //第三种,Mapper接口方式的调用,推荐这种使用方式。offset:偏移量,limit:数量 // PageHelper.offsetPage(2, 3); // List<Student> list = mapper.queryStudentWithPage(); // System.out.println("list = " + list); //jdk8 lambda用法 // Page<Student> page = PageHelper.startPage(1, 3).doSelectPage(()-> mapper.queryStudentWithPage()); // List<Student> list = page.getResult(); //对应的lambda用法 // PageInfo<Student> pageInfo = PageHelper.startPage(2, 3).doSelectPageInfo(() -> mapper.queryStudentWithPage()); // System.out.println("pageInfo.getList() = " + pageInfo.getList()); // System.out.println("pageInfo.getPageNum() = " + pageInfo.getPageNum()); // System.out.println("pageInfo.getNavigatepageNums() = " + Arrays.toString(pageInfo.getNavigatepageNums())); } }
[ "2018077362@qq.com" ]
2018077362@qq.com
3fc21641b5cfd7ba9cc0ad323524cb2149d3ed40
d55ffa952a639ed68b9fb4ba634bd5fe7ab2d503
/app/src/main/java/com/aabv78/happyweather/WeatherDataModel.java
cb051981d493b615e599a0ed1cefd0422995c189
[]
no_license
aabv78/HappyWeather
d74a41fcaf8b3eff93ebbe64e5f61a8f9fb1ca1a
9a4cbb874e3e467f43214ce6e67c07d3296865bf
refs/heads/master
2020-04-07T05:48:06.848040
2018-11-18T17:47:18
2018-11-18T17:47:18
158,110,601
0
0
null
null
null
null
UTF-8
Java
false
false
2,459
java
package com.aabv78.happyweather; import org.json.JSONException; import org.json.JSONObject; public class WeatherDataModel { private String weatherTemperature; private String weatherCity; private String weatherIcon; private int weatherCondition; public static WeatherDataModel fromJson(JSONObject jsonObject) { // creating the data model from a json object try { WeatherDataModel weatherData = new WeatherDataModel(); weatherData.weatherCity = jsonObject.getString("name"); weatherData.weatherCondition = jsonObject.getJSONArray("weather").getJSONObject(0).getInt("id"); weatherData.weatherIcon = updateWeatherIcon(weatherData.weatherCondition); double tempResult = jsonObject.getJSONObject("main").getDouble("temp") - 273.15; int roundedValue = (int) Math.rint(tempResult); weatherData.weatherTemperature = Integer.toString(roundedValue); return weatherData; } catch (JSONException e) { e.printStackTrace(); return null; } } private static String updateWeatherIcon(int condition) { if (condition >= 0 && condition < 300) { return "tstorm1"; } else if (condition >= 300 && condition < 500) { return "light_rain"; } else if (condition >= 500 && condition < 600) { return "shower3"; } else if (condition >= 600 && condition <= 700) { return "snow4"; } else if (condition >= 701 && condition <= 771) { return "fog"; } else if (condition >= 772 && condition < 800) { return "tstorm3"; } else if (condition == 800) { return "sunny"; } else if (condition >= 801 && condition <= 804) { return "cloudy2"; } else if (condition >= 900 && condition <= 902) { return "tstorm3"; } else if (condition == 903) { return "snow5"; } else if (condition == 904) { return "sunny"; } else if (condition >= 905 && condition <= 1000) { return "tstorm3"; } return "no"; } // getters public String getWeatherTemperature() { return weatherTemperature + "°"; } public String getWeatherCity() { return weatherCity; } public String getWeatherIcon() { return weatherIcon; } }
[ "42255299+aabv78@users.noreply.github.com" ]
42255299+aabv78@users.noreply.github.com
cd07570c73aabf04dc7f9fce1b26da615d19b58d
489b9ac15a2447f710c641dd021c89a28468abbf
/2ejaar(2019-2020)/2e semester/Webontwikkeling 3/Dennis/proefExamen2/src/ui/controller/Controller.java
6360fdc9fffd3592675dd588877b609ed9d771ad
[]
no_license
pietergmail/school
d2fa47f897079c498956cd982f79730dfa750542
fda4ce328b5d0d79018188ba6a385778e8addfe9
refs/heads/master
2022-11-18T18:00:36.561022
2021-08-13T14:00:07
2021-08-13T14:00:07
182,574,979
1
2
null
2022-11-16T12:19:42
2019-04-21T19:37:56
HTML
UTF-8
Java
false
false
2,610
java
package ui.controller; import domain.model.ProductService; import domain.model.Role; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.NotActiveException; import java.util.Enumeration; import java.util.Properties; @WebServlet("/Controller") public class Controller extends HttpServlet { private static final long serialVersionUID = 1L; private ProductService productService; private ControllerFactory controllerFactory = new ControllerFactory(); public Controller() { super(); } public void init() throws ServletException { super.init(); ServletContext context = getServletContext(); Properties properties = new Properties(); Enumeration<String> parameterNames = context.getInitParameterNames(); while (parameterNames.hasMoreElements()) { String propertyName = parameterNames.nextElement(); properties.setProperty(propertyName, context.getInitParameter(propertyName)); } productService = new ProductService(properties); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action = request.getParameter("action"); String destination = "index.jsp"; if (request.getSession().getAttribute("user") != null) { Role role = (Role) request.getSession().getAttribute("user"); request.setAttribute("userRole", role.name()); request.setAttribute("username", role.getStringValue()); } try { controllerFactory.getController(action, productService).handleRequest(request, response); } catch (NotAuthorizedException e) { request.setAttribute("error", e.getMessage()); controllerFactory.getController("Home", productService).handleRequest(request, response); } } }
[ "33780619+pietergmail@users.noreply.github.com" ]
33780619+pietergmail@users.noreply.github.com
659214ecf057c9a7dd10fcbc386515775386cf05
e9fc1a86a5396cb936a402013a9f9a1e07b3580d
/src/main/java/dev/dreameh/backend/rest/ApiController.java
0cde814c8747645190e5e49a4cf5342b8495ce39
[]
no_license
Dreameh/backend-test
487ec835bafef148159696ed0468c7791e800e90
3fd0415bd1e1bd0568f4f874b34261c22db77eef
refs/heads/main
2023-05-09T19:08:24.667473
2021-05-02T20:52:35
2021-05-02T20:52:35
349,446,372
0
0
null
null
null
null
UTF-8
Java
false
false
1,123
java
package dev.dreameh.backend.rest; import dev.dreameh.backend.rest.converter.ProjectConverter; import dev.dreameh.backend.rest.v1.api.ProjectsApi; import dev.dreameh.backend.rest.v1.api.dto.Project; import dev.dreameh.backend.service.ProjectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.scheduling.annotation.Async; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RestController; import java.sql.Array; import java.util.List; @CrossOrigin(origins = "*") @RestController public class ApiController implements ProjectsApi { @Autowired private ProjectService service; @Async @Override public ResponseEntity<List<Project>> getProjects() { List<Project> projects = ProjectConverter.toProjectList(service.getProjects()); if(projects == null || projects.isEmpty()) { throw new IllegalStateException("This cannot be the case"); } return new ResponseEntity<>(projects, HttpStatus.OK); } }
[ "kyusaki1@gmail.com" ]
kyusaki1@gmail.com
f55866705260eb5dd2c1712e86fccdbc1e855a7a
9839a4e72fe9455a24fe8a7606b957ace7ced1b9
/src/main/java/com/gzdx/test/spring/springboot/SpringbootApplication.java
1b649ce34a8ee6d6b3ad93369e5c934968fe8e7e
[]
no_license
leijiangnan/springboot
0553dac4c60f0811d2c1b18030d3071a65896ee5
0bd59f21ebb42a8e61ebae1f681dd0462e58ff9a
refs/heads/master
2020-03-25T03:45:51.717529
2018-08-03T00:51:53
2018-08-03T00:51:53
143,359,096
0
0
null
null
null
null
UTF-8
Java
false
false
547
java
package com.gzdx.test.spring.springboot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.context.annotation.PropertySource; @SpringBootApplication @ServletComponentScan @PropertySource(value="classpath:my.properties",encoding="utf-8") public class SpringbootApplication { public static void main(String[] args) { SpringApplication.run(SpringbootApplication.class, args); } }
[ "leijiang@jd.com" ]
leijiang@jd.com
d90802d7d2a9f1064af281470ecc8b10953b09e3
fb3f91fb6c18bb93c5d51b58d13e201203833994
/Trabajos/Sernanp/sources/SernanpApp/SernanpAppDao/src/main/java/sernanp/app/dao/query/mapper/RpPadronTrabajadoresQueryMapper.java
b0f1909c9204046a8efbf4faaa541cac47f52f7e
[]
no_license
cgb-extjs-gwt/avgust-extjs-generator
d24241e594078eb8af8e33e99be64e56113a1c0c
30677d1fef4da73e2c72b6c6dfca85d492e1a385
refs/heads/master
2023-07-20T04:39:13.928605
2018-01-16T18:17:23
2018-01-16T18:17:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
897
java
package sernanp.app.dao.query.mapper; import java.util.List; import java.util.Map; import org.apache.ibatis.session.RowBounds; import sernanp.app.dao.query.domain.RpPadronTrabajadoresQuery; import sernanp.app.dao.query.domain.RpPadronTrabajadoresQueryCriteria; public interface RpPadronTrabajadoresQueryMapper { List<RpPadronTrabajadoresQuery> getListQueryByCriteria(RpPadronTrabajadoresQueryCriteria criteria); List<RpPadronTrabajadoresQuery> getListQueryByMap(Map<String, Object> paramMap); List<RpPadronTrabajadoresQuery> getListQueryPaginationByCriteria(RpPadronTrabajadoresQueryCriteria criteria, RowBounds rowBounds); List<RpPadronTrabajadoresQuery> getListQueryPaginationByMap(Map<String, Object> paramMap, RowBounds rowBounds); int getCountRowsByCriteria(RpPadronTrabajadoresQueryCriteria criteria); int getCountRowsByMap(Map<String, Object> paramMap); }
[ "raffo8924@gmail.com" ]
raffo8924@gmail.com
ad23b71dfb654defc6d546905a3a793051af57fd
67e1c3063d2f0e68a59f28e451d2c35da62de03c
/HTML-day05-login/src/com/heima/service/impl/UserServiceImpl.java
ecc47c275eb036affccad558cf0fdeaf7a47c8c5
[]
no_license
layaBegin/JavaBase
79cfd0e0f603fc54c47f031eba9d8e656999a16f
bc544ca3d0c92b2258fc8c36fc3e7ba6690c9049
refs/heads/main
2023-08-29T12:40:47.939924
2021-10-26T09:24:44
2021-10-26T09:24:44
378,316,522
0
0
null
null
null
null
UTF-8
Java
false
false
542
java
package com.heima.service.impl; import com.heima.dao.UserDao; import com.heima.dao.impl.UserDaoImpl; import com.heima.entity.User; import com.heima.service.UserServie; //业务层 public class UserServiceImpl implements UserServie { UserDao userDao = new UserDaoImpl(); /** * 登录的功能 * * @param username * @param password * @return */ @Override public User login(String username, String password) { User user = userDao.findUser(username, password); return user; } }
[ "maweiphilippines@gmail.com" ]
maweiphilippines@gmail.com
7743a6c5bf3ba0359ee56aae1ec2597c91958ffe
3a3971a3932d8bf33e969997e873338c546facf0
/src/com/j2/abstractFactory/ThickCrustDough.java
7815808c179980b3416d2782f9c219b32eeb1c37
[]
no_license
yeslhh13/j2
c0640a97e0fb53ed7bf05b21af33911288810f43
02a7764f83e4675df651b790f41939c92a701bdf
refs/heads/master
2021-01-01T05:35:18.409734
2015-12-04T10:16:17
2015-12-04T10:16:17
41,779,784
0
0
null
null
null
null
UTF-8
Java
false
false
178
java
package com.j2.abstractFactory; public class ThickCrustDough implements Dough { public String toString() { return "ThickCrust style extra thick crust dough"; } }
[ "gowonkid@naver.com" ]
gowonkid@naver.com
bd2f9df13a8bc7ec824c321e2476fab7c8748188
4b2f7848959ac64b9be08fcc0334d4b96736b5ce
/src/main/java/core/impl/UserImpl.java
be010740484a34e57330dc452926b388c7c6f9b5
[]
no_license
AlexGrey/webApp
ac9e7e3f37049049886c5fb5bedbac38ab7ccf33
78c05f6585c58cc9912e09ebd57b410551d11ff4
refs/heads/master
2016-09-01T14:49:18.236959
2015-11-28T19:50:17
2015-11-28T19:50:17
46,750,030
0
0
null
null
null
null
UTF-8
Java
false
false
1,671
java
package core.impl; import core.base.Pet; import core.base.User; /** * Created by Zver on 24.11.2015. */ public class UserImpl implements User { private int id; private String name; private Pet pet; /** * @param name имя клиента * @param petName имя питомца */ public UserImpl(String name, String petName) { this.name = name; this.pet = new PetImpl(petName, this); } /** * Конструктор без добавления питомца * @param name имя клиента */ public UserImpl(String name) { this.name = name; this.pet = new PetImpl("Безымянный питомец", this); } /** * {@inheritDoc} */ public Integer getId() { return this.id; } /** * {@inheritDoc} */ public String getName() { return this.name; } /** * {@inheritDoc} */ public void setName(String name) { this.name = name; } /** * {@inheritDoc} */ public Pet getPet() { return this.pet; } /** * {@inheritDoc} */ public void addPet(Pet pet) { this.pet = pet; } /** * {@inheritDoc} */ public void removePet() { this.pet = null; } /** * {@inheritDoc} */ public void showInfo() { System.out.println("id: " + this.id + ", имя: " + this.name + ", имя питомца: " + this.pet.getName()); } /** * {@inheritDoc} */ public void setId(Integer id) { if (this.id == 0) { this.id = id; } } }
[ "ilyareznik91@gmail.com" ]
ilyareznik91@gmail.com
9df3a819057af9deb9400442ab019ba9222fe7d6
457a9231385f3dc7a466c9988d537dc5fee37d9d
/src/main/java/com/eludika/app/ws/exceptions/ImpossivelDeletarRegistroExceptionMapper.java
c990c28efa034df58382a601871b75d6d9972563
[]
no_license
lohanmamede/eludika_webservices
59b5411ae0cd80952e4af766940dffce7c653921
0378afce95ac32635bc1ec75c2a8bf64b0c7d02f
refs/heads/master
2020-04-27T12:41:12.195517
2019-03-08T08:02:43
2019-03-08T08:02:43
174,340,497
0
0
null
null
null
null
UTF-8
Java
false
false
852
java
package com.eludika.app.ws.exceptions; import com.eludika.app.ws.ui.models.response.MensagemDeErroResponseModel; import com.eludika.app.ws.ui.models.response.MensagensDeErro; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; /** * * @author eres */ public class ImpossivelDeletarRegistroExceptionMapper implements ExceptionMapper<ImpossivelDeletarRegistroException> { public Response toResponse(ImpossivelDeletarRegistroException exception) { MensagemDeErroResponseModel mensagemDeErro = new MensagemDeErroResponseModel( exception.getMessage(), MensagensDeErro.IMPOSSIVEL_DELETAR_REGISTRO.name(), "Sem documentação"); return Response.status(Response.Status.BAD_REQUEST) .entity(mensagemDeErro).build(); } }
[ "lohanmamede@gmail.com" ]
lohanmamede@gmail.com
447b320b36aab54ccea6552e1c1d5435d7302485
ba26f82166035f26e23079944a018fff9ccd9ea5
/src/homeworks/HW/plain/CountryDeparture.java
07ea7a202ff713f0e9ce21c855ce993cec0cb711
[]
no_license
tantmut/Java
7f27fb628b70d7fb304488351297ff25dce4ba12
e81e7373329476cf38d75bbab8cdbc51320bd10d
refs/heads/master
2020-03-27T21:13:03.481101
2018-11-19T21:08:45
2018-11-19T21:08:45
147,125,339
0
0
null
null
null
null
UTF-8
Java
false
false
172
java
package homeworks.HW.plain; /** * Created by nazar on 3/20/2017. */ public enum CountryDeparture { UKRAINE, POLAND, MOLDOVA, HUNGURY, SPAIN, FRANCE, ITALY }
[ "ynazar123@gmail.com" ]
ynazar123@gmail.com
28e13eb6bbdef183c49f6d9030d7d2bb32178dd2
a0ffccf237a01d5fe866d614177eae29f35f2770
/src/ty/TreeNode.java
4bed393132e9f5df5377a48d191129fdcc09c0b2
[]
no_license
chiguozi666/primerschool
fab4559d6f5b9aa26daeb7d2192069c4ed1f1f98
e57072d900fcca80283f86be3a0559b0bf8f885e
refs/heads/master
2022-12-26T01:17:45.641491
2020-10-12T08:57:31
2020-10-12T08:57:31
303,168,009
0
0
null
null
null
null
GB18030
Java
false
false
4,122
java
package ty; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; public class TreeNode { TreeNode left; TreeNode right; String str; static boolean isSwitch = false; public TreeNode(String str) { this.str = str; } public void printAll() { if (left != null) left.printAll(); if (right != null) right.printAll(); System.out.println(str); } //层序遍历 public static void levelOrder(TreeNode Node) { if (Node == null) { return; } TreeNode treeNode; Queue<TreeNode> queue = new LinkedList<>(); queue.add(Node); //使用队列实现层序的输出 while (queue.size() != 0) { treeNode = queue.poll(); System.out.print(treeNode.str + " "); if (treeNode.left != null) { queue.offer(treeNode.left); } if (treeNode.right != null) { queue.offer(treeNode.right); } System.out.println(); } } /** * 判断两个树是否相等 * 左右枝交换 * @param a * @param b * @return */ public static boolean superCompair(TreeNode a, TreeNode b) { //同样是空就是相等,其中一个是空必然不相等; if (a == null && b == null) return true; else if (a == null || b == null) return false; if (a.str.equals(b.str)) { //直接比照左右节点,或者一次换枝叶比较是否相等; boolean switchResult = true;//控制是否已经交换 //左右枝的交换 //isSwitch是个静态变量,单标志上锁负责检查是否变换的,多线程要对这个上锁- - if ((a.str.equals("+")||a.str.equals("*"))&&!isSwitch) { isSwitch = true; switchResult = superCompair(a.right, b.left) && superCompair(a.left, b.right); isSwitch = false; } return (superCompair(a.left, b.left) && superCompair(a.right, b.right)) || switchResult; } else return false; } public static boolean isOp(String str) { if (str.equals("+") || str.equals("-") || str.equals("*") || str.equals("/")) { return true; } return false; } /** * 通过后缀表达式生成一颗二叉树 * @param suffixStr 后缀表达式 * @return 一颗二叉树 */ public static TreeNode buildTreeBysuffix(String suffixStr) { if (isEmpty(suffixStr)) return null; //System.out.println(suffixStr); String chs[] = suffixStr.split("( )+"); //System.out.println(Arrays.toString(chs)); // 用于临时存储节点的栈 Stack<TreeNode> stack = new Stack<TreeNode>(); // 遍历所有字符,不是运算符的入栈,是运算符的,将栈中两个节点取出,合成一颗树然后入栈 for (int i = 0; i < chs.length; i++) { if (isOperator(chs[i])) { if (stack.isEmpty() || stack.size() < 2) { System.err.println("输入的后缀表达式不正确"); return null; } TreeNode root = new TreeNode(chs[i]); root.left = stack.pop(); root.right = stack.pop(); stack.push(root); } else { stack.push(new TreeNode(chs[i])); } } if (stack.isEmpty() || stack.size() > 1) { System.err.println("输入的后缀表达式不正确"); return null; } return stack.pop(); //TreeNode.levelOrder(stack.pop()); } public static boolean isEmpty(String s) { if (s == null && s.equals("")) return true; return false; } public static boolean isOperator(String s) { if (s.equals("+") || s.equals("-") || s.equals("*") || s.equals("/")) { return true; } return false; } }
[ "1060020877@qq.com" ]
1060020877@qq.com
3fe7d5d9fa4091bee4a08e812a41acf3891766f7
c1114e6161f98b20e161851cd219c06f6d7d9fe5
/TP7_8_ChasseAuxPokemons/src/tp7/Jouet.java
893edc9f4dea85520417d91959b4b818a8557a00
[]
no_license
NunesClement/TP7-8Chasse_Aux_Pokemons
0f26ac9429bd737412bee65f4ac27baae50f8de0
825fe764548892d48d64ff799a647c89f834fc15
refs/heads/master
2020-03-08T04:12:04.709565
2018-04-03T15:08:36
2018-04-03T15:08:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package tp7; import AncienTP.Joueur; public class Jouet extends Item implements Utilisable, Modifiable{ private int apportAppetit; private int apportSatisfaction; private int apportLoyaute; @Override public void modifier() { } public Jouet(String nom, int frequence, int utilisations, int apportAppetit, int apportSatisfaction, int apportLoyaute) { super(nom, frequence, utilisations); this.apportAppetit = apportAppetit; this.apportSatisfaction = apportSatisfaction; this.apportLoyaute = apportLoyaute; } @Override public void utiliser(Joueur j, int indexPokemon) { } @Override public Item genAlea() { return null; } @Override public String toString() { return null; } }
[ "noreply@github.com" ]
NunesClement.noreply@github.com
b0b1bad5bd8f5d0868a023892785344f8e88d8d9
1a142b6850228d44fa3d80cca61f43a39ce06862
/src/com/javaex/ex19_1/ShapeApp.java
d06a046d8bd33ec64e9487b97a8931efe00b5ade
[]
no_license
younghotkim/chapter02
c2b0ef77a491366795c5bd97d6b56f2641299273
af8e6d0764d30f705f91802a55a60c7404bb0113
refs/heads/master
2023-05-31T12:57:49.336979
2021-06-11T08:45:21
2021-06-11T08:45:21
374,384,532
0
0
null
null
null
null
UTF-8
Java
false
false
1,030
java
package com.javaex.ex19_1; public class ShapeApp { public static void main(String[] args) { //배열을 만든다. Shape[] sArray = new Shape[3]; //도형을 만든다 Shape sr01 = new Rectangle("빨강", "검정", 10, 10); Shape sc01 = new Circle("주황", "검정", 5); Shape st01 = new Triangle("노랑", "검정", 30, 30); //배열<--도형 sArray[0] = sr01; sArray[1] = sc01; sArray[2] = st01; //배열을 이용해서 그리기 for(int i=0; i<sArray.length; i++) { sArray[i].draw(); //오버라이딩을 이용해서 구현할 수 있다 System.out.println("넓이:" + sArray[i].area()); } //오버라이딩 부작용-->추상클래스, 추상메소드 해결 //Shape ss01 = new Shape("검정", "검정"); //System.out.println("Shape 넓이:" + ss01.area()); //캐스팅 //Rectangle sr01 = new Rectangle("빨강", "검정", 10, 10); System.out.println(((Rectangle)sr01).getWidth()); } }
[ "younghotkim@gmail.com" ]
younghotkim@gmail.com
328d673856c2f56abf3f5950d0309e01a50f414e
d794a805fe316a38468dd7e0861ab533ef35c2b2
/src/main/java/com/pipi/Interview/RandomSetTest.java
73872fd2d77d69c1314e25b2921b83e40b04b2a5
[]
no_license
gongpipi/javabase
b2c0cee3b85d92f4cdae5c30e2dc7c5393a9dff5
d885fd2365322182cd3e03c8644e67913f5545ad
refs/heads/master
2021-01-20T05:25:26.249579
2018-08-15T02:41:07
2018-08-15T02:41:07
89,777,072
0
0
null
null
null
null
UTF-8
Java
false
false
815
java
package com.pipi.Interview; import java.util.HashMap; import java.util.Map; import java.util.Random; /** * Created by pipi on 2017/7/5. */ public class RandomSetTest { public static void main(String args[]){ int key = 0; Map<Integer,String> map = new HashMap<Integer, String>(); map.put(key,"a"); key ++; map.put(key,"b"); key ++; map.put(key,"c"); key ++; map.put(key,"d"); key ++; map.put(key,"e"); key ++; Random random = new Random(); int n2 = Math.abs(random.nextInt() % map.size()); System.out.println(map.get(n2)); String aa = new String("123"); String ab = "123"; System.out.println(aa.hashCode()); System.out.println(ab.hashCode()); } }
[ "1446560082@qq.com" ]
1446560082@qq.com
8065444fdfe5571749c46ff0caa5b43b73b60fc5
574afb819e32be88d299835d42c067d923f177b0
/src/net/minecraft/client/gui/inventory/GuiBrewingStand.java
4f8372ed10008df4702bd1e2c28d1f09f400ac0f
[]
no_license
SleepyKolosLolya/WintWare-Before-Zamorozka
7a474afff4d72be355e7a46a38eb32376c79ee76
43bff58176ec7422e826eeaf3ab8e868a0552c56
refs/heads/master
2022-07-30T04:20:18.063917
2021-04-25T18:16:01
2021-04-25T18:16:01
361,502,972
6
0
null
null
null
null
UTF-8
Java
false
false
2,575
java
package net.minecraft.client.gui.inventory; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ContainerBrewingStand; import net.minecraft.inventory.IInventory; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; public class GuiBrewingStand extends GuiContainer { private static final ResourceLocation BREWING_STAND_GUI_TEXTURES = new ResourceLocation("textures/gui/container/brewing_stand.png"); private static final int[] BUBBLELENGTHS = new int[]{29, 24, 20, 16, 11, 6, 0}; private final InventoryPlayer playerInventory; private final IInventory tileBrewingStand; public GuiBrewingStand(InventoryPlayer playerInv, IInventory p_i45506_2_) { super(new ContainerBrewingStand(playerInv, p_i45506_2_)); this.playerInventory = playerInv; this.tileBrewingStand = p_i45506_2_; } public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); super.drawScreen(mouseX, mouseY, partialTicks); this.func_191948_b(mouseX, mouseY); } protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { String s = this.tileBrewingStand.getDisplayName().getUnformattedText(); this.fontRendererObj.drawString(s, (float)(this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2), 6.0F, 4210752); this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8.0F, (float)(this.ySize - 96 + 2), 4210752); } protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(BREWING_STAND_GUI_TEXTURES); int i = (width - this.xSize) / 2; int j = (height - this.ySize) / 2; this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); int k = this.tileBrewingStand.getField(1); int l = MathHelper.clamp((18 * k + 20 - 1) / 20, 0, 18); if (l > 0) { this.drawTexturedModalRect(i + 60, j + 44, 176, 29, l, 4); } int i1 = this.tileBrewingStand.getField(0); if (i1 > 0) { int j1 = (int)(28.0F * (1.0F - (float)i1 / 400.0F)); if (j1 > 0) { this.drawTexturedModalRect(i + 97, j + 16, 176, 0, 9, j1); } j1 = BUBBLELENGTHS[i1 / 2 % 7]; if (j1 > 0) { this.drawTexturedModalRect(i + 63, j + 14 + 29 - j1, 185, 29 - j1, 12, j1); } } } }
[ "ask.neverhide@gmail.com" ]
ask.neverhide@gmail.com
2c07c34d8dc0f28ba4c26e6adb965e4273c63602
b08eda35d93924881f6c64b0ea0e5450e969d3b8
/src/main/java/com/example/Valorant/components/DataLoader.java
f1172b2fae368e368cefcdba082953b728cd76ff
[]
no_license
StefanieVW/Valorant-API
2388e0c02a669d52043bf9fc542d04334435ca11
167c6bc37afcf5a981185821a649d860dd01fb16
refs/heads/master
2023-05-18T11:43:29.943506
2021-04-24T12:41:50
2021-04-24T12:41:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,396
java
package com.example.Valorant.components; import com.example.Valorant.models.Agent; import com.example.Valorant.models.Arsenal; import com.example.Valorant.models.Map; import com.example.Valorant.repository.AgentRepository; import com.example.Valorant.repository.ArsenalRepository; import com.example.Valorant.repository.MapRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; @Component public class DataLoader implements ApplicationRunner { @Autowired AgentRepository agentRepository; @Autowired MapRepository mapRepository; @Autowired ArsenalRepository arsenalRepository; public DataLoader() { } public void run(ApplicationArguments args) { Agent jett = new Agent("Jett", "Duelist", "Updraft", "Tailwind", "Cloudburst", "Blade Storm"); agentRepository.save(jett); Agent raze = new Agent("Raze", "Duelist", "Blast Pack", "Paint Shells", "Boom Bot", "Showstopper"); agentRepository.save(raze); Agent breach = new Agent("Breach", "Initiator", "Flashpoint", "Fault Line", "Aftershock", "Rolling Thunder"); agentRepository.save(breach); Agent omen = new Agent("Omen", "Controller", "Paranoia", "Dark Cover", "Shrouded Step", "From The Shadows"); agentRepository.save(omen); Agent brimstone = new Agent("Brimstone", "Controller", "Incendiary", "Sky Smoke", "Stim Beacon", "Orbital Strike"); agentRepository.save(brimstone); Agent phoenix = new Agent("Phoenix", "Duelist", "Curveball", "Hot Hands", "Blaze", "Run It Back"); agentRepository.save(phoenix); Agent sage = new Agent("Sage", "Sentinel", "Slow Orb", "Healing Orb", "Barrier Orb", "Resurrection"); agentRepository.save(sage); Agent sova = new Agent("Sova", "Initiator", "Shock Bolt", "Recon Bolt", "Owl Drone", "Hunter's Fury"); agentRepository.save(sova); Agent viper = new Agent("Viper", "Controller", "Poison Cloud", "Toxic Screen", "Snake Bite", "Viper's Pit"); agentRepository.save(viper); Agent cypher = new Agent("Cypher", "Sentinel", "Cyber Cage", "Spycam", "Trapwire", "Neural Theft"); agentRepository.save(cypher); Agent reyna = new Agent("Reyna", "Duelist", "Devour", "Dismiss", "Leer", "Empress"); agentRepository.save(reyna); Agent killjoy = new Agent("Killjoy", "Initiator", "Turret", "Nanoswarm", "Alarmbot", "Lockdown"); agentRepository.save(killjoy); Agent skye = new Agent("Skye", "Controller", "Regrowth", "Trailblazer", "Guiding Light", "Seekers"); agentRepository.save(skye); Agent yoru = new Agent("Yoru", "Duelist", "Fakeout", "Gatecrash", "Blindside", "Dimensional Shift"); agentRepository.save(yoru); Agent astra = new Agent("Astra", "Controller", "Nova Pulse", "Nebula", "Gravity Well", "Astral Form/Cosmic Divide"); agentRepository.save(astra); Map bind = new Map("Bind"); mapRepository.save(bind); Map haven = new Map("Haven"); mapRepository.save(haven); Map split = new Map("Split"); mapRepository.save(split); Map ascent = new Map("Ascent"); mapRepository.save(ascent); Map icebox = new Map("Icebox"); mapRepository.save(icebox); Map breeze = new Map("Breeze"); mapRepository.save(breeze); Arsenal classic = new Arsenal("Classic", "Sidearms"); arsenalRepository.save(classic); Arsenal shorty = new Arsenal("Shorty", "Sidearms"); arsenalRepository.save(shorty); Arsenal frenzy = new Arsenal("Frenzy", "Sidearms"); arsenalRepository.save(frenzy); Arsenal ghost = new Arsenal("Ghost", "Sidearms"); arsenalRepository.save(ghost); Arsenal sheriff = new Arsenal("Sheriff", "Sidearms"); arsenalRepository.save(sheriff); Arsenal stinger = new Arsenal("Stinger", "SMGS"); arsenalRepository.save(stinger); Arsenal spectre = new Arsenal("Spectre", "SMGS"); arsenalRepository.save(spectre); Arsenal bucky = new Arsenal("Bucky", "Shotguns"); arsenalRepository.save(bucky); Arsenal judge = new Arsenal("Judge", "Shotguns"); arsenalRepository.save(judge); Arsenal bulldog = new Arsenal("Bulldog", "Rifles"); arsenalRepository.save(bulldog); Arsenal guardian = new Arsenal("Guardian", "Rifles"); arsenalRepository.save(guardian); Arsenal phantom = new Arsenal("Phantom", "Rifles"); arsenalRepository.save(phantom); Arsenal vandal = new Arsenal("Vandal", "Rifles"); arsenalRepository.save(vandal); Arsenal marshal = new Arsenal("Marshal", "Snipers"); arsenalRepository.save(marshal); Arsenal operator = new Arsenal("Operator", "Rifles"); arsenalRepository.save(operator); Arsenal ares = new Arsenal("Ares", "Heavies"); arsenalRepository.save(ares); Arsenal odin = new Arsenal("Odin", "Heavies"); arsenalRepository.save(odin); Arsenal tacticalKnife = new Arsenal("Tactical Knife", "Melee"); arsenalRepository.save(tacticalKnife); } }
[ "cpearson3140@gmail.com" ]
cpearson3140@gmail.com
459413d745569d11647325e682506132d1415d18
2ba4d3ad99cf83e6b07615168bd242112d9ed2b5
/src/main/java/main/Pair.java
2cb62d556054fa62aa206c1396dc543f5696974a
[]
no_license
michelmenega/developerSort
d98e2ec310193170bc79298c778655be747a08c4
dbd0805ecf8c584eb19e74990f077920886a9d4d
refs/heads/master
2021-01-13T01:31:12.618738
2011-08-01T00:55:51
2011-08-01T00:55:51
2,064,101
0
0
null
null
null
null
UTF-8
Java
false
false
717
java
package main; public class Pair{ Developer developerA; Developer developerB; public Pair(Developer developer, Developer developer2) { setDeveloperA(developer); setDeveloperB(developer2); } public Developer getEligibleToMove() { if(getDeveloperA().getLastTimeMoved().toLocalDate().compareTo(getDeveloperB().getLastTimeMoved().toLocalDate()) >= 0) return getDeveloperA(); return getDeveloperB(); } public Developer getDeveloperA() { return developerA; } public void setDeveloperA(Developer developerA) { this.developerA = developerA; } public Developer getDeveloperB() { return developerB; } public void setDeveloperB(Developer developerB) { this.developerB = developerB; } }
[ "nathanferracini@gmail.com" ]
nathanferracini@gmail.com
5a91b845c9636febfe336a9d4f75653fdc2ac908
1d133144c0a68ce053965acf083c7a0eaba7cd59
/Chapter06/src/main/java/com/jay/chapter06/persistence/MemberRepository.java
e5cae7e29fa9c3ae73149976c6d14149d449fc99
[]
no_license
2jerry/springboot
1cf372ea52bfcf4bcc0b6d055d50bd0a34c179ce
592f0b90288bae3c36456f90d98261b2b924a44f
refs/heads/master
2023-01-10T09:23:39.007345
2019-09-02T08:16:04
2019-09-02T08:16:04
198,931,796
0
0
null
2023-01-04T08:45:39
2019-07-26T02:25:54
Java
UTF-8
Java
false
false
216
java
package com.jay.chapter06.persistence; import com.jay.chapter06.domain.Member; import org.springframework.data.repository.CrudRepository; public interface MemberRepository extends CrudRepository<Member,String> { }
[ "user@AD01467367.local" ]
user@AD01467367.local
9d615a4d5a754292bada6d427bc67ec3b522fcbe
1dec13cd52ae5976826ac69f494151788980ccf9
/src/test/java/guru/springframework/converters/UnitOfMeasureCommandToUnitOfMeasureTest.java
fca87e308abdc20211f141bccb2bb8f7d4ed6caa
[]
no_license
LetTheFreedomRing/spring5-recipe-app
7d6b61aa65927236fdfdcf7c64aa180647aea6c8
4d37df79522d7ecd06a8aa936cec711ef32bc9dc
refs/heads/master
2020-09-10T08:10:38.201336
2019-12-19T09:05:52
2019-12-19T09:05:52
221,696,369
0
0
null
2019-11-14T12:48:27
2019-11-14T12:48:26
null
UTF-8
Java
false
false
1,033
java
package guru.springframework.converters; import guru.springframework.commands.UnitOfMeasureCommand; import guru.springframework.model.UnitOfMeasure; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class UnitOfMeasureCommandToUnitOfMeasureTest { UnitOfMeasureCommandToUnitOfMeasure converter; static final Long uomId = 1L; static final String uomDescription = "dummy uom description"; @Before public void setUp() throws Exception { converter = new UnitOfMeasureCommandToUnitOfMeasure(); } @Test public void convert() { UnitOfMeasureCommand command = new UnitOfMeasureCommand(); command.setId(uomId); command.setUom(uomDescription); UnitOfMeasure uom = converter.convert(command); assertNotNull(uom); assertEquals(command.getId(), uom.getId()); assertEquals(command.getUom(), uom.getUom()); } @Test public void convertNull() { assertNull(converter.convert(null)); } }
[ "pavlo.kolesnichenko@gmail.com" ]
pavlo.kolesnichenko@gmail.com
c5c02f3d1b90649763e3f32a44b8cac84ec52df5
0cca6536fdeb7d531a38c6af37bd3213b58a9494
/src/main/java/com/orbitz/consul/SessionClient.java
3ee406f8203780b8cc7630634e1cc0c23b55824b
[ "Apache-2.0" ]
permissive
happymap/consul-client
2e91e759609e104ee22c3a57e1458dba2a658b22
0ee07825123c6e65e1a67a26c2e945b3be8ddd31
refs/heads/master
2021-01-14T14:34:58.408451
2015-05-20T22:53:26
2015-05-20T22:53:26
34,532,934
0
0
null
2015-05-14T00:33:57
2015-04-24T17:46:31
Java
UTF-8
Java
false
false
4,166
java
package com.orbitz.consul; import com.google.common.base.Optional; import com.orbitz.consul.model.session.SessionInfo; import com.orbitz.consul.option.QueryOptions; import com.orbitz.consul.util.ClientUtil; import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.MediaType; import java.util.Arrays; import java.util.List; import java.util.Map; public class SessionClient { private WebTarget webTarget; /** * Constructs an instance of this class. * * @param webTarget The {@link WebTarget} to base requests from. */ SessionClient(WebTarget webTarget) { this.webTarget = webTarget; } /** * Retrieves the host/port of the Consul leader. * * GET /v1/status/leader * * @return The host/port of the leader. */ public String getLeader() { return webTarget.path("leader").request().get(String.class) .replace("\"", "").trim(); } /** * Create Session. * * PUT /v1/session/create * * @param value empty string or JSON containing one or more SessionInfo parameters (see {@link SessionInfo}) * * @return ID of the newly created session . */ public Optional<String> createSession(final String value) { return createSession(value, null); } /** * Create Session. * * PUT /v1/session/create * * @param value empty string or JSON containing one or more SessionInfo parameters (see {@link SessionInfo}) * @param dc Data center * * @return ID of the newly created session . */ public Optional<String> createSession(final String value, final String dc) { Map<String, String> session = null; WebTarget target = webTarget; if(dc != null) { target = webTarget.queryParam("dc", dc); } session = target.path("create").request().put(Entity.entity(value, MediaType.APPLICATION_JSON_TYPE), new GenericType<Map<String, String>>() { }); return session != null ? Optional.of(session.get("ID")) : Optional.<String>absent(); } /** * Destroy session. * * PUT /v1/session/destroy/<sessionId> * * @param sessionId * * @return ID of the newly created session . */ public boolean destroySession(final String sessionId) { return destroySession(sessionId, null); } /** * Destroy session. * * PUT /v1/session/destroy/<sessionId> * * @param sessionId * @param dc Data center * * @return ID of the newly created session . */ public boolean destroySession(final String sessionId, final String dc) { WebTarget target = webTarget; if(dc != null) { target = webTarget.queryParam("dc", dc); } return target.path("destroy").path(sessionId).request().put(Entity.entity("", MediaType.TEXT_PLAIN_TYPE), Boolean.class); } /** * Retrieves session info. * * GET /v1/session/info/<sessionId> * * @param sessionId * * @return {@link SessionInfo}. */ public Optional<SessionInfo> getSessionInfo(final String sessionId) { return getSessionInfo(sessionId, null); } /** * Retrieves session info. * * GET /v1/session/info/<sessionId> * * @param sessionId * @param dc Data center * * @return {@link SessionInfo}. */ public Optional<SessionInfo> getSessionInfo(final String sessionId, final String dc) { WebTarget target = webTarget; if(dc != null) { target = webTarget.queryParam("dc", dc); } target = ClientUtil.queryConfig(target.path("info").path(sessionId), QueryOptions.BLANK); List<SessionInfo> sessionInfo = Arrays.asList(target .request().accept(MediaType.APPLICATION_JSON_TYPE).get(SessionInfo[].class)); return sessionInfo != null && sessionInfo.size() != 0 ? Optional.of(sessionInfo.get(0)) : Optional.<SessionInfo>absent(); } }
[ "vasco@vas.io" ]
vasco@vas.io
57de4d848b9c39ccc1dbe5cb185e0ed2bb26e812
b16ecc80a3a84439d92ef55ec68882f06396a1c4
/src/Formula1/Main.java
1172526e6787077ad344eaf8316ef7db20360d2f
[]
no_license
inspire95/formulaapp
abc47b76af0d9c83bf864aa85e14c62d33cd4353
558de05597d0bcd48dacd892bde79010aaab80de
refs/heads/master
2020-03-17T14:03:51.137161
2018-05-16T11:37:10
2018-05-16T11:37:10
133,656,359
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
package Formula1; import java.io.File; import java.util.Optional; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; /** * * @author Dawid */ public class Main extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene scene = new Scene(root); stage.setScene(scene); stage.setOnCloseRequest(e -> { Optional<File> optional = Optional.ofNullable(OntologyDataBase.fileToReload); optional.ifPresent(f -> OntologyDataBase.fileToReload.delete()); System.exit(0); }); stage.show(); } public static void main(String[] args) { launch(args); } }
[ "noreply@github.com" ]
inspire95.noreply@github.com
356e3bba029522cafc71631f9cacb03ec25f1481
d905012ce89e14611434a2ac5069c3abcd5d67b9
/2dFightFormer/src/player/PlayerHandler.java
214889e7d63206d7c6aa10ba5bd98a09b80d9b03
[]
no_license
Astrinaar/2dPlatformer
adf44313ef663d3775bd316b35a20d9bb30b37a2
68c4c7ef0287f2d49b4c9e334e635d92836fdbac
refs/heads/master
2021-01-19T14:57:07.838333
2015-09-11T06:32:23
2015-09-11T06:32:23
23,242,485
0
0
null
null
null
null
UTF-8
Java
false
false
3,304
java
package player; import extendables.SlickClass; import helpers.ImgArchive; import helpers.MathTool; import org.newdawn.slick.Animation; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.StateBasedGame; /** * * @author PK */ public class PlayerHandler implements SlickClass { private static Player player; private boolean dead = false; private Image[] defaultAni; private Image[] stabAni; public PlayerHandler() { } @Override public void init(GameContainer container, StateBasedGame game) throws SlickException { initAnimations(); player = new Player(defaultAni); player.init(container, game); MathTool.setPlayer(player); } @Override public void render(GameContainer container, StateBasedGame game, Graphics g) { player.render(container, game, g); } @Override public void update(GameContainer container, StateBasedGame game, int delta) { if (player.getLife() <= 0) { dead = true; } player.update(container, game, delta); } private void initAnimations() { defaultAni = new Image[1]; defaultAni[0] = ImgArchive.getPlayer(); stabAni = new Image[4]; stabAni[0] = ImgArchive.getPlayerStab(); stabAni[1] = ImgArchive.getPlayerStab2(); stabAni[2] = ImgArchive.getPlayerStab(); stabAni[3] = ImgArchive.getPlayer(); } public void attack(int id) { switch (id) { case 0: setAnimationLock(19); setCurrentAnimation(stabAni, 50); } } public void jump() { player.jump(); } public void doubleJump() { player.doubleJump(); } public void changeHorizontalMomentum(float momentum) { player.changeHorizontalMomentum(momentum); } public void changeVerticalMomentum(float momentum) { player.changeVerticalMomentum(momentum); } public void setHorizontalMomentum(float momentum) { player.setHorizontalMomentum(momentum); } public void setVerticalMomentum(float momentum) { player.setVerticalMomentum(momentum); } public boolean isOnGround() { return player.isOnGround(); } public float getSpeed() { return player.getSpeed(); } public float getAirborneSpeed() { return player.getAirborneSpeed(); } public boolean isJumping() { return player.isJumping(); } public boolean isDead() { return dead; } public void setDead(boolean dead) { this.dead = dead; } public static Player getPlayer() { return player; } public float getAnimationLock() { return player.getAnimationLock(); } public void setAnimationLock(float duration) { player.setAnimationLock(duration); } public void setCurrentAnimation(Image[] animation, int duration) { player.setCurrentAni(animation, duration); } public boolean canDoubleJump() { if (player.isCanDoubleJump() && player.getDoubleJumpTimer() <= 0) { return true; } return false; } }
[ "7h380x@gmail.com" ]
7h380x@gmail.com
ba06f8b9274ec4e6d826b32b020c7dc7ec9922a8
36e8edb79e67a23c8266924ce984972079a4ca8c
/src/java/com/ropr/modelCo/MsgPack.java
61c4f4417b35806403147d01fdc583d79dbf746c
[]
no_license
lazik16/Server-application
7c783b9e5827e1c19ec0b4602aa3baa8a33ebe91
3f3038aabe227c9e7d277468ef8e5a440e53996e
refs/heads/master
2020-04-09T21:22:38.293470
2015-02-24T18:05:51
2015-02-24T18:05:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,185
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 com.ropr.modelCo; import com.google.gson.annotations.Expose; /** * * @author Dominik */ public class MsgPack<T> { @Expose private ActionType action; @Expose private ObjectType objectType; @Expose private T object; @Expose private int hash; public static enum ActionType { NEW, REP, DEL } public static enum ObjectType { DEV, CON, MES } public T getObject() { return object; } public void setObject(T object) { this.object = object; } public int getHash() { return hash; } public void setHash(int hash) { this.hash = hash; } public ActionType getAction() { return action; } public void setAction(ActionType action) { this.action = action; } public ObjectType getObjectType() { return objectType; } public void setObjectType(ObjectType objectType) { this.objectType = objectType; } }
[ "xransomx@gmail.com" ]
xransomx@gmail.com
cae49deebc7a6b6049320e520b9808a81323eb9e
d6757d64dbddd11d6e34485ac6ccd57141a54006
/src/main/java/com/xxx/application/util/FileTypeHelp.java
53199c42edc0f727cec945d536c883dbdae4d8d4
[]
no_license
chrnyuan/springboot-imgVerify
cbd3da81b49f1fd337ef1e2743a134bad6e5b836
69227ce5d2222759f3205adb2e86ba02f9a8fc15
refs/heads/master
2022-11-05T15:22:52.125334
2019-08-16T08:08:01
2019-08-16T08:08:01
199,790,362
0
0
null
2022-10-12T20:30:22
2019-07-31T06:07:10
TSQL
UTF-8
Java
false
false
6,193
java
package com.xxx.application.util; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream; /** * 文件帮助类 * * @author Joey * @Email 2434387555@qq.com * */ public class FileTypeHelp { public final static Map<String, String> FILE_TYPE_MAP = new HashMap<String, String>(); private FileTypeHelp() { } static { getAllFileType(); // 初始化文件类型信息 } /** * Created on 2010-7-1 * <p> * Discription:[getAllFileType,常见文件头信息] * </p> * * @author:[shixing_11@sina.com] */ private static void getAllFileType() { FILE_TYPE_MAP.put("jpg", "FFD8FF"); // JPEG (jpg) FILE_TYPE_MAP.put("png", "89504E47"); // PNG (png) FILE_TYPE_MAP.put("gif", "47494638"); // GIF (gif) FILE_TYPE_MAP.put("tif", "49492A00"); // TIFF (tif) FILE_TYPE_MAP.put("bmp", "424D"); // Windows Bitmap (bmp) FILE_TYPE_MAP.put("dwg", "41433130"); // CAD (dwg) FILE_TYPE_MAP.put("html", "68746D6C3E"); // HTML (html) FILE_TYPE_MAP.put("rtf", "7B5C727466"); // Rich Text Format (rtf) FILE_TYPE_MAP.put("xml", "3C3F786D6C"); FILE_TYPE_MAP.put("zip", "504B0304"); FILE_TYPE_MAP.put("rar", "52617221"); FILE_TYPE_MAP.put("psd", "38425053"); // Photoshop (psd) FILE_TYPE_MAP.put("eml", "44656C69766572792D646174653A"); // Email // [thorough // only] // (eml) FILE_TYPE_MAP.put("dbx", "CFAD12FEC5FD746F"); // Outlook Express (dbx) FILE_TYPE_MAP.put("pst", "2142444E"); // Outlook (pst) FILE_TYPE_MAP.put("xls", "D0CF11E0"); // MS Word FILE_TYPE_MAP.put("doc", "D0CF11E0"); // MS Excel 注意:word 和 excel的文件头一样 FILE_TYPE_MAP.put("mdb", "5374616E64617264204A"); // MS Access (mdb) FILE_TYPE_MAP.put("wpd", "FF575043"); // WordPerfect (wpd) FILE_TYPE_MAP.put("eps", "252150532D41646F6265"); FILE_TYPE_MAP.put("ps", "252150532D41646F6265"); FILE_TYPE_MAP.put("pdf", "255044462D312E"); // Adobe Acrobat (pdf) FILE_TYPE_MAP.put("qdf", "AC9EBD8F"); // Quicken (qdf) FILE_TYPE_MAP.put("pwl", "E3828596"); // Windows Password (pwl) FILE_TYPE_MAP.put("wav", "57415645"); // Wave (wav) FILE_TYPE_MAP.put("avi", "41564920"); FILE_TYPE_MAP.put("ram", "2E7261FD"); // Real Audio (ram) FILE_TYPE_MAP.put("rm", "2E524D46"); // Real Media (rm) FILE_TYPE_MAP.put("mpg", "000001BA"); // FILE_TYPE_MAP.put("mov", "6D6F6F76"); // Quicktime (mov) FILE_TYPE_MAP.put("asf", "3026B2758E66CF11"); // Windows Media (asf) FILE_TYPE_MAP.put("mid", "4D546864"); // MIDI (mid) } public static void main(String[] args) throws Exception { File f = new File("c://aaa.gif"); if (f.exists()) { String filetype1 = getImageFileType(f); System.out.println(filetype1); String filetype2 = getFileByFile(f); System.out.println(filetype2); } } /** * Created on 2010-7-1 * <p> * Discription:[getImageFileType,获取图片文件实际类型,若不是图片则返回null] * </p> * * @param File * @return fileType * @author:[shixing_11@sina.com] */ public final static String getImageFileType(File f) { if (isImage(f)) { try { ImageInputStream iis = ImageIO.createImageInputStream(f); Iterator<ImageReader> iter = ImageIO.getImageReaders(iis); if (!iter.hasNext()) { return null; } ImageReader reader = iter.next(); iis.close(); return reader.getFormatName(); } catch (IOException e) { return null; } catch (Exception e) { return null; } } return null; } /** * Created on 2010-7-1 * <p> * Discription:[getFileByFile,获取文件类型,包括图片,若格式不是已配置的,则返回null] * </p> * * @param file * @return fileType * @author:[shixing_11@sina.com] */ public final static String getFileByFile(File file) { String filetype = null; byte[] b = new byte[50]; try { InputStream is = new FileInputStream(file); is.read(b); filetype = getFileTypeByStream(b); is.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return filetype; } /** * Created on 2010-7-1 * <p> * Discription:[getFileTypeByStream] * </p> * * @param b * @return fileType * @author:[shixing_11@sina.com] */ public final static String getFileTypeByStream(byte[] b) { String filetypeHex = String.valueOf(getFileHexString(b)); Iterator<Entry<String, String>> entryiterator = FILE_TYPE_MAP.entrySet().iterator(); while (entryiterator.hasNext()) { Entry<String, String> entry = entryiterator.next(); String fileTypeHexValue = entry.getValue(); if (filetypeHex.toUpperCase().startsWith(fileTypeHexValue)) { return entry.getKey(); } } return null; } /** * Created on 2010-7-2 * <p> * Discription:[isImage,判断文件是否为图片] * </p> * * @param file * @return true 是 | false 否 * @author:[shixing_11@sina.com] */ public static final boolean isImage(File file) { boolean flag = false; try { BufferedImage bufreader = ImageIO.read(file); int width = bufreader.getWidth(); int height = bufreader.getHeight(); if (width == 0 || height == 0) { flag = false; } else { flag = true; } } catch (IOException e) { flag = false; } catch (Exception e) { flag = false; } return flag; } /** * Created on 2010-7-1 * <p> * Discription:[getFileHexString] * </p> * * @param b * @return fileTypeHex * @author:[shixing_11@sina.com] */ public final static String getFileHexString(byte[] b) { StringBuilder stringBuilder = new StringBuilder(); if (b == null || b.length <= 0) { return null; } for (int i = 0; i < b.length; i++) { int v = b[i] & 0xFF; String hv = Integer.toHexString(v); if (hv.length() < 2) { stringBuilder.append(0); } stringBuilder.append(hv); } return stringBuilder.toString(); } }
[ "1367085661@qq.com" ]
1367085661@qq.com
e806ee12fbb628f51231053d10f0185331667f09
bfaac0c12e6833d0ad163c24ab3db9ae05d84cf9
/app/src/main/java/com/codermonkeys/sampleapp/adapters/CartAdapter.java
5f60bbf227d23fe6ff1c96c3c3e64906377661e6
[]
no_license
gajendrapandeya/SampleApp
331f87450cf2b4de79d4c89fd40a818408254bd3
5916899371060481afacbe538c84a05bfd47d429
refs/heads/master
2022-09-10T02:40:53.284113
2020-05-29T14:56:33
2020-05-29T14:56:33
263,603,593
0
0
null
null
null
null
UTF-8
Java
false
false
8,683
java
package com.codermonkeys.sampleapp.adapters; import android.annotation.SuppressLint; import android.app.Dialog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.codermonkeys.sampleapp.R; import com.codermonkeys.sampleapp.models.CartItemModel; import java.util.List; import java.util.Objects; public class CartAdapter extends RecyclerView.Adapter { private List<CartItemModel> cartItemModelList; public CartAdapter(List<CartItemModel> cartItemModelList) { this.cartItemModelList = cartItemModelList; } @Override public int getItemViewType(int position) { switch (cartItemModelList.get(position).getType()) { case 0: return CartItemModel.CART_ITEM; case 1: return CartItemModel.TOTAL_AMOUNT; default: return -1; } } @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { switch (viewType) { case CartItemModel.CART_ITEM: View cartItemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.cart_item_layout, parent, false); return new CartItemViewHolder(cartItemView); case CartItemModel.TOTAL_AMOUNT: View cartTotalView = LayoutInflater.from(parent.getContext()).inflate(R.layout.cart_total_amount_layout, parent, false); return new CartTotalAmountViewHolder(cartTotalView); default: return null; } } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { switch (cartItemModelList.get(position).getType()) { case CartItemModel.CART_ITEM: int resource = cartItemModelList.get(position).getProductImage(); String title = cartItemModelList.get(position).getProductTitle(); int freeCoupens = cartItemModelList.get(position).getFreeCoupens(); String productPrice = cartItemModelList.get(position).getProductPrice(); String cuttedPrice = cartItemModelList.get(position).getCuttedPrice(); int offersApplied = cartItemModelList.get(position).getOffersApplied(); ((CartItemViewHolder)holder).setItemDetails(resource, title, freeCoupens, productPrice, cuttedPrice, offersApplied); break; case CartItemModel.TOTAL_AMOUNT: String totalItems = cartItemModelList.get(position).getTotalItems(); String totalItemPrice = cartItemModelList.get(position).getTotalItemPrice(); String deliveryPrice = cartItemModelList.get(position).getDeliveryPrice(); String totalAmount = cartItemModelList.get(position).getTotalAmount(); String savedAmount = cartItemModelList.get(position).getSavedAmount(); ((CartTotalAmountViewHolder)holder).setTotalAmount(totalItems, totalItemPrice, deliveryPrice, totalAmount, savedAmount); break; default: } } @Override public int getItemCount() { return cartItemModelList.size(); } public static class CartItemViewHolder extends RecyclerView.ViewHolder { private ImageView productImage; private ImageView freeCoupenIcon; private TextView productTitle; private TextView freeCoupens; private TextView productPrice; private TextView cuttedPrice; private TextView offersApplied; private TextView coupensApplied; private TextView productQuantity; public CartItemViewHolder(@NonNull View itemView) { super(itemView); productImage = itemView.findViewById(R.id.product_image); freeCoupenIcon = itemView.findViewById(R.id.free_coupen_icon); productTitle = itemView.findViewById(R.id.product_title); freeCoupens = itemView.findViewById(R.id.tv_free_coupen); productPrice = itemView.findViewById(R.id.product_price); cuttedPrice = itemView.findViewById(R.id.cutted_price); offersApplied = itemView.findViewById(R.id.offers_applied); coupensApplied = itemView.findViewById(R.id.coupens_applied); productQuantity = itemView.findViewById(R.id.product_quantity); } @SuppressLint("SetTextI18n") private void setItemDetails(int resource, String title, int freeCoupensNo, String productPriceText, String cuttedPriceText, int offersAppliedNo) { productImage.setImageResource(resource); productTitle.setText(title); if(freeCoupensNo > 0) { freeCoupenIcon.setVisibility(View.VISIBLE); freeCoupens.setVisibility(View.VISIBLE); if(freeCoupensNo == 1) { freeCoupens.setText("free " + freeCoupensNo + " Coupen"); } else { freeCoupens.setText("free " + freeCoupensNo + " Coupens"); } } else { freeCoupenIcon.setVisibility(View.INVISIBLE); freeCoupens.setVisibility(View.INVISIBLE); } productPrice.setText(productPriceText); cuttedPrice.setText(cuttedPriceText); if(offersAppliedNo > 0) { offersApplied.setVisibility(View.VISIBLE); offersApplied.setText(offersAppliedNo + " Offers Applied"); } else { offersApplied.setVisibility(View.INVISIBLE); } productQuantity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog quantityDialog = new Dialog(itemView.getContext()); quantityDialog.setContentView(R.layout.quantity_dialog); Objects.requireNonNull(quantityDialog.getWindow()).setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); quantityDialog.setCancelable(false); final EditText quantityNo = quantityDialog.findViewById(R.id.quantity_number); Button cancelBtn = quantityDialog.findViewById(R.id.cancel_btn); Button okBtn = quantityDialog.findViewById(R.id.ok_btn); cancelBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { quantityDialog.dismiss(); } }); okBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { productQuantity.setText("Qty: " + quantityNo.getText()); quantityDialog.dismiss(); } }); quantityDialog.show(); } }); } } public static class CartTotalAmountViewHolder extends RecyclerView.ViewHolder { private TextView totalItems; private TextView totalItemsPrice; private TextView deliveryPrice; private TextView totalAmount; private TextView savedAmount; public CartTotalAmountViewHolder(@NonNull View itemView) { super(itemView); totalItems = itemView.findViewById(R.id.total_items); totalItemsPrice = itemView.findViewById(R.id.total_items_price); deliveryPrice = itemView.findViewById(R.id.delivery_price); totalAmount = itemView.findViewById(R.id.total_price); savedAmount = itemView.findViewById(R.id.saved_amount); } @SuppressLint("SetTextI18n") private void setTotalAmount(String totalItemText, String totalItemsPriceText, String deliveryPriceText, String totalAmountText, String savedAmountText) { totalItems.setText(totalItemText); totalItemsPrice.setText(totalItemsPriceText); deliveryPrice.setText(deliveryPriceText); totalAmount.setText(totalAmountText); savedAmount.setText("You will save " + savedAmountText + "on this order"); } } }
[ "gajendrapandeya6@gmail.com" ]
gajendrapandeya6@gmail.com
f985fb5d119b0d78cf4713f465b15e1b4a7c1a88
56852a3692b9190c1e70b66312a0330a3693d3a0
/src/main/java/net/dries007/ccmv/cmd/CommandPos.java
6d4ec8006cf624cc880e1aa6cb00f5461e881fff
[]
no_license
dries007/ccmv
f111d08f68b600d5af5b8ce6e3120f50cbfdbc0d
7ee10f5b020f91eef22da7e45657ebe042c74f8c
refs/heads/master
2020-04-23T08:34:44.705373
2019-02-16T19:16:10
2019-02-16T19:16:10
171,041,865
0
0
null
null
null
null
UTF-8
Java
false
false
3,050
java
/* * Copyright (c) 2014-2016, Dries007 & DoubleDoorDevelopment * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package net.dries007.ccmv.cmd; import net.dries007.ccmv.BlockPosDim; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import javax.annotation.Nullable; import java.util.List; public class CommandPos extends CommandBase { @Override public String getName() { return "pos"; } @Override public String getUsage(ICommandSender icommandsender) { return "/pos <username>"; } @Override public boolean isUsernameIndex(final String[] args, final int userIndex) { return userIndex == 0; } @Override public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) { if (args.length == 1) return getListOfStringsMatchingLastWord(args, server.getOnlinePlayerNames()); return super.getTabCompletions(server, sender, args, pos); } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length == 0) throw new WrongUsageException(getUsage(sender)); EntityPlayerMP target = getPlayer(server, sender, args[0]); sender.sendMessage(target.getDisplayName().appendSibling(new TextComponentString(" is at ").appendSibling(new BlockPosDim(target).toClickableChatString()))); } }
[ "admin@dries007.net" ]
admin@dries007.net
9174efabfbf10cd85fce0c8a13cdc1864a4cb99c
8988c615731e17d042c2962aa9396da195e99a5f
/src/com/aba/service/area/AreaDao.java
14b0e93fb9ba4fc5072cbe7356d3fcc7214eedd1
[]
no_license
dyjava/MyAndroid
6f1fbd7602588c538212a6f46769505be0779008
709fce382fd0f9af59eba5ee421de040dac45282
refs/heads/master
2020-06-04T15:08:21.645558
2015-03-05T06:34:41
2015-03-05T06:34:41
30,061,186
0
0
null
null
null
null
UTF-8
Java
false
false
275
java
package com.aba.service.area; import com.aba.service.area.domain.AreaRequest; import com.aba.service.area.domain.AreaResult; public interface AreaDao { public AreaResult findAreaById(AreaRequest request) ; public AreaResult findAreaByParentId(AreaRequest request) ; }
[ "dyong525@163.com" ]
dyong525@163.com
d844b372bf88027acd601212aae0933faddf795f
0a8b3605f6daa32d781f84e9b29bbac6bbf3fb9a
/src/test/java/com/oracle/peoplesoft/bass2/qe/testcase/ParameterTest.java
1e188202eb7062c8ff22bac4f8c8c0601cb48d5d
[]
no_license
gushisong/BASS2Demo
6e77dd42ba9c5068ac9e1a0de83cd5ea600e8046
014ff19459ef2e403d89c1effa5a499d1c97e0f4
refs/heads/master
2020-03-22T07:17:52.783465
2018-07-12T06:29:31
2018-07-12T06:29:31
139,691,892
0
0
null
null
null
null
GB18030
Java
false
false
1,075
java
package com.oracle.peoplesoft.bass2.qe.testcase; import static org.junit.Assert.*; import java.util.Arrays; import java.util.Collection; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class ParameterTest { /** * 1.更改默认的运行器@RunWith(Parameterized.class) * 2.声明变量用来存储预期值 * 3.声明一个 */ int expected=0; int input1=0; int input2=0; @Parameters public static Collection<Object []>t(){ return Arrays.asList(new Object[][]{ {3,1,2},{4,2,2} }); } public ParameterTest(int expected,int input1,int input2) { this.expected=expected; this.input1=input1; this.input2=input2; // TODO Auto-generated constructor stub } @Test public void testAdd() { assertEquals(expected, new Calculate().add(input1, input2)); } }
[ "xiaolei.song@oracle.com" ]
xiaolei.song@oracle.com
522e11d5885f90772933e9ad35f65069b59bfe61
fc997d353efe85c04f64e1b28dfc8830332568de
/jasmine-ui/src/main/java/jasmine/imaging/core/Jasmine.java
4db940f34a46e3d77dd3dea68929e72f6de19b8a
[]
no_license
ollyoechsle/jasmine
e28f3a5b0bad37abed1d54c8bf2fa29134824c2f
b7bae48cf322e0c31014e40e60fda0633deac725
refs/heads/master
2020-03-30T01:01:04.690625
2012-06-14T18:36:36
2012-06-14T18:36:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
70,661
java
package jasmine.imaging.core; import jasmine.classify.ICSListener; import jasmine.classify.ICSListenerGraphical; import jasmine.classify.classifier.Classifier; import jasmine.gp.Evolve; import jasmine.gp.Individual; import jasmine.gp.interfaces.GraphicalListener; import jasmine.gp.multiclass.ClassResult; import jasmine.gp.tree.Terminal; import jasmine.gp.util.GPStartDialog; import jasmine.imaging.commons.AccuracyStatistics; import jasmine.imaging.commons.PixelLoader; import jasmine.imaging.commons.Segmenter; import jasmine.imaging.commons.WebcamGrabber; import jasmine.imaging.commons.util.ProgressDialog; import jasmine.imaging.core.classification.JasmineGP; import jasmine.imaging.core.classification.JasmineGPObject; import jasmine.imaging.core.classification.JasmineICS; import jasmine.imaging.core.classification.JasmineICSObject; import jasmine.imaging.core.segmentation.JasmineSegmentationProblem; import jasmine.imaging.core.util.AddImage; import jasmine.imaging.core.util.AddTestingImage; import jasmine.imaging.core.util.EvolvedGPObjectClassifier; import jasmine.imaging.core.util.EvolvedGPSubObjectClassifier; import jasmine.imaging.core.util.EvolvedICSObjectClassifier; import jasmine.imaging.core.util.EvolvedICSSubObjectClassifier; import jasmine.imaging.core.util.JasmineDeployer; import jasmine.imaging.core.util.JasmineTab; import jasmine.imaging.core.util.ModeMenuItem; import jasmine.imaging.core.util.RecentProjects; import jasmine.imaging.core.util.TrainingObject; import jasmine.imaging.core.visionsystem.VisionSystem; import jasmine.imaging.core.visionsystem.VisionSystemGUI; import jasmine.imaging.core.visionsystem.VisionSystemGUITesting; import jasmine.imaging.core.visionsystem.VisionSystemGUITestingAll; import jasmine.imaging.core.visionsystem.VisionSystemListener; import jasmine.imaging.gp.problems.SubGenerationalProblem; import jasmine.imaging.shapes.SegmentedObject; import jasmine.imaging.shapes.SubObjectClassifier; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Vector; import java.util.Random; /** * Jasmine - A - SegMented - Image - Notation - Environment * J - A - S - M - I - N - E * <p/> * Jasmine is a GUI to load a series of images and notate them graphically with classes that you choose. * Jasmine allows you to notate different kinds of information; you may "draw" classes onto images for * segmentation problems, and then do further work with the results. * Jasmine is a test interface only and suffers from a number of bugs and is missing many features, some * of which are summarised below. * <p/> * BUG LIST * 1. FIXED --- Can't load one project after another * 2. FIXED --- Shape and pixel classes are confused * 3. FIXED --- Closing toolbox doesn't change the menu's ticked state * 4. FIXED --- Unique class counter doesn't work when adding shape classes * 5. FIXED --- If no pixel classes on project load, class window appears as a square * 6. FIXED --- When saving project, extension is .jpg, when it should be .jasmine * 7. FIXED --- Switching to shape mode doesn't update the classbox * 8. FIXED --- Can't click on shapes to set their class in shape mode * 9. FIXED --- Save overlay makes overlay disappear. * 10.FIXED --- Shape Selection doesn't work in zoom mode. * 11.FIXED --- Remove all images causes NPE * 13.FIXED --- Cursor goes odd on large sizes (and doesn't work on Windows) * <p/> * <p/> * DESIRABLE ADDITIONAL FEATURES * 1. DONE --- Class window should be a JList, not a series of buttons. * 2. DONE --- Delete selected shape * 3. DONE --- Modify class * 5. DONE --- Remove all classes works only for pixel classes * 6. DONE --- No remove single class option. * 7. DONE --- Save shapes with project for GP * 8. DONE --- Compile and run java code automatically. * 9. DONE --- Add overlay from existing file * 10. DONE --- Choose how many generations should the GP run for (and other GP settings) * 11. DONE --- Add multiple images at once * 12. DONE --- If overlay exists for an image, add it automatically. * 13. DONE --- Edit project settings - namely change directory * 14. DONE --- New project ensures that directory exists first. * 16. DONE --- Test on webcam capture, add images direct from webcam * 17. DONE --- Scroll bars on large images * 18. DONE --- Full export and import functions * 19. DONE - Right click for erase in paint mode * 20. DONE - Can now draw lines as well as freehand painting. * * @author Olly Oechsle, University of Essex, Date: 11-Dec-2006 - 24-March-2009 * @version 0.99.4 */ public class Jasmine extends JFrame implements ItemListener, VisionSystemListener { public static final String APP_NAME = "Jasmine Vision System Builder"; public static final String VERSION = "1.3.41"; public static String DEFAULT_PROJECT_LOCATION = System.getProperty("user.home") + System.getProperty("file.separator") + "Desktop" + System.getProperty("file.separator") + "JasmineProjects"; public static final File DEFAULT_PROJECT_LOCATION_FILE = new File(DEFAULT_PROJECT_LOCATION); public static final String ONLINE_JAR_FILE_LOCATION = "http://vase.essex.ac.uk/software/jasmine/lib/"; public static final String SETTING_RECENT_PROJECTS = "setting_recent_projects"; public static final String SETTING_DEFAULT_PROJECT_LOCATION = "setting_project_location"; protected boolean displayImage = true; // the modes of operation public static final int PIXEL_SEGMENTATION = 0; public static final int OBJECT_CLASSIFICATION = 1; public static final int FEATURE_EXTRACTION = 2; public static final int VISION_SYSTEM = 3; public static final int OTHER = 4; public static Random getRandom() { return new Random(2357); } /** * What general mode are we in - pixel segmentation or shape classification */ public int mode = PIXEL_SEGMENTATION; /** * Within pixel classification we may be painting, erasing or viewing histograms. */ public JButton segmentationMode = null; public JButton classificationMode = null; public JButton PAINT, LINE, ERASE, TARGET, HISTOGRAM; // DIALOGS AND FRAMES public JasmineSegmentationPanel segmentationPanel; public JasmineClassificationPanel classificationPanel; public JasmineAbstractEditorPanel currentPanel; public JasmineClassBox classbox; public JasmineToolBox toolbox; public JasmineImageBrowser imageBrowser; //POEY public JasmineTestingImageBrowser testingImageBrowser; public DialogDisplayStats displayStats; public DialogShapeStats shapeStats; public WebcamGrabber webcam; // saves settings protected JasmineSettings settings; // OTHER SWING ITEMS: public JLabel mousePosition, status; //public JComboBox classList; public JButton next, prev, addclass, zoomIn, zoomOut, capture; private JProgressBar progressBar; public static JFileChooser fc; // THE IMAGE WE ARE USING AT THE MOMENT public JasmineImage currentImage; //POEY public JasmineTestingImage currentTestingImage; // THE PROJECT WE ARE WORKING ON public JasmineProject project = null; public ModeMenuItem currentlySelected = null; protected JTabbedPane tabs; protected JasmineMenus menus; public JasmineVisionSystemPanel visionSystemPanel; //public JasmineFeatureSelectionPanel featureSelectionPanel; public static Jasmine currentInstance; /** * Loads the GUI and initialises the Jasmine program. */ public Jasmine(String[] args) { // set the title and general size of the frame super(APP_NAME); this.setSize(800, 600); //this.setLocation(50, 50); currentInstance = this; settings = JasmineSettings.load(); updateDefaultProjectLocation(null); try { setIconImage(new ImageIcon(getClass().getResource("/vase16.png")).getImage()); } catch (Exception e) { } System.out.println("Loaded Jasmine OK"); // use the system look and feel where possible try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { System.out.println("Unable to load native look and feel"); } // initialise the file chooser fc = new JFileChooser(DEFAULT_PROJECT_LOCATION_FILE); // create the dialogs and position them imageBrowser = new JasmineImageBrowser(this); imageBrowser.setSize(220, 240); //POEY testingImageBrowser = new JasmineTestingImageBrowser(this); testingImageBrowser.setSize(220, 240); classbox = new JasmineClassBox(this); classbox.setSize(220, 240); // set up the main panel segmentationPanel = new JasmineSegmentationPanel(this); //featureSelectionPanel = new JasmineFeatureSelectionPanel(this); classificationPanel = new JasmineClassificationPanel(this); visionSystemPanel = new JasmineVisionSystemPanel(this); status = new JLabel(); status.setPreferredSize(new Dimension(400, 20)); setStatusText(null); mousePosition = new JLabel(); mousePosition.setPreferredSize(new Dimension(100, 20)); progressBar = new JProgressBar(); progressBar.setPreferredSize(new Dimension(200, 20)); progressBar.setVisible(false); JPanel statusBar = new JPanel(); statusBar.setLayout(new BoxLayout(statusBar, BoxLayout.LINE_AXIS)); statusBar.add(Box.createHorizontalStrut(5)); statusBar.add(status); statusBar.add(mousePosition); statusBar.add(Box.createHorizontalGlue()); statusBar.add(progressBar); statusBar.add(Box.createHorizontalStrut(5)); statusBar.setPreferredSize(new Dimension(800, 20)); tabs = new JTabbedPane(); ImageIcon sicon = new ImageIcon(getClass().getResource("/pencil16.png")); ImageIcon cicon = new ImageIcon(getClass().getResource("/classify16.png")); ImageIcon vicon = new ImageIcon(getClass().getResource("/settings16.png")); tabs.addTab("Segmentation", sicon, new JScrollPane(segmentationPanel.getPanel())); //tabs.addTab("Feature Selection", new JScrollPane(featureSelectionPanel)); tabs.addTab("Classification", cicon, new JScrollPane(classificationPanel.getPanel())); tabs.addTab("Vision System", vicon, visionSystemPanel); tabs.setEnabled(false); tabs.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { Component tab = tabs.getSelectedComponent(); if (tab instanceof JScrollPane) { tab = ((JScrollPane) tab).getViewport().getView(); } if (tab instanceof JasmineTab) { setMode(((JasmineTab) tab).getMode()); } } }); toolbox = new JasmineToolBox(this); Container c = getContentPane(); c.add(toolbox, BorderLayout.NORTH); c.add(tabs, BorderLayout.CENTER); c.add(statusBar, BorderLayout.SOUTH); // CREATE THE MENUS HERE menus = new JasmineMenus(this); setJMenuBar(menus); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { exit(); } }); menus.enableMenus(); this.setVisible(true); arrangeWindows(); // parse through the args for (int i = 0; i < args.length; i++) { String arg = args[i]; if (arg.equals("-p")) { System.out.println("\nOpening project: " + args[i + 1]); openProject(new File(DEFAULT_PROJECT_LOCATION_FILE, args[i + 1])); i++; } if (arg.equals("-s")) { System.out.println("Setting random seed: " + args[i + 1]); Evolve.seed = Integer.parseInt(args[i + 1]); i++; } } } int gap = 15; public void arrangeWindows() { int x = (int) this.getLocation().getX() + this.getWidth() + gap; int y = (int) this.getLocation().getY(); imageBrowser.setLocation(x, y); //POEY int xx = x + imageBrowser.getWidth() + gap; testingImageBrowser.setLocation(xx, y); y += imageBrowser.getHeight() + gap; classbox.setLocation(x, y); } /** * Sets the mode, either classification or segmentation * * @param mode */ public void setMode(int mode) { this.mode = mode; if (mode == PIXEL_SEGMENTATION) { this.currentPanel = this.segmentationPanel; this.segmentationPanel.setCursorSize(toolbox.size.getValue()); } else { this.currentPanel = this.classificationPanel; } if (mode > OBJECT_CLASSIFICATION) { mousePosition.setVisible(false); } else { mousePosition.setVisible(true); } /*if (mode == FEATURE_EXTRACTION) { featureSelectionPanel.update(project); }*/ this.currentPanel.repaint(); this.classbox.refresh(); this.toolbox.showButtons(mode); } /** * Sets the status text * * @param message A message to put, or null to automatically set the message. */ public void setStatusText(final String message) { if (message != null) System.out.println(message); SwingUtilities.invokeLater(new Thread() { public void run() { if (message == null) { if (project == null) { status.setText(" Please create or open a project"); } else { if (project.getImages().size() == 0) { status.setText(" Click File > Add Images... to add images to the project"); } else { if (mode == PIXEL_SEGMENTATION) { if (project.getPixelClasses(segmentationPanel.mode).size() == 0) { status.setText(" Click Classes > Add Class to add pixel classes"); } } if (mode == OBJECT_CLASSIFICATION) { if (project.getObjectClasses().size() == 0) { status.setText(" Click Classes > Add Class to add shape classes"); } } } } } else { status.setText(" " + message); } } }); } public void hideProgressBar() { progressBar.setValue(0); progressBar.setVisible(false); } public void showProgressBar(final int max) { SwingUtilities.invokeLater(new Thread() { public void run() { progressBar.setVisible(true); progressBar.setMaximum(max); } }); } public void setProgressBarValue(final int n) { progressBar.setValue(n); } public void captureFromWebcam() { if (webcam != null) { PixelLoader p = webcam.grab(); int i = 1; while (true) { File f = new File(project.getImageLocation(), "webcam" + i + ".png"); if (!f.exists()) { try { p.saveAs(f); JasmineImage image = new JasmineImage(f.getName(), -1, TrainingObject.TRAINING); project.addImage(image); loadJasmineImage(image); imageBrowser.refresh(); } catch (Exception err) { alert("Could not save captured image: " + err.toString()); err.printStackTrace(); } break; } i++; } } else { alert("No cameras in use.\nSelect View > Camera to start using one."); } } public void addImage() { new AddImage(this, project.getImageLocation()); } //POEY public void addTestingImage() { new AddTestingImage(this, project.getTestingImageLocation()); } public void addImage(File[] files) { for (File file1 : files) { try { JasmineImage image = new JasmineImage(file1.getName(), -1, TrainingObject.TRAINING); if (project.getImages().contains(image)) { // TODO: Add equals and hashcode to Jasmine Image class. return; } // check if there's a material overlay File overlay = new File(project.getImageLocation(), OverlayData.getOverlayFilename(image, JasmineClass.MATERIAL)); if (overlay.exists()) { image.materialOverlayFilename = overlay.getAbsolutePath(); } // check if there's a mask overlay overlay = new File(project.getImageLocation(), OverlayData.getOverlayFilename(image, JasmineClass.MASK)); if (overlay.exists()) { image.maskOverlayFilename = overlay.getAbsolutePath(); } project.addImage(image); loadJasmineImage(image); } catch (Exception e) { alert("Could not add image " + file1.getName() + "\n" + e.getMessage()); e.printStackTrace(); } } menus.enableMenus(); imageBrowser.refresh(); } //POEY public void addTestingImage(File[] files) { for (File file1 : files) { try { //POEY? JasmineTestingImage image = new JasmineTestingImage(file1.getName(), -1, TrainingObject.TESTING); if (project.getTestingImages().contains(image)) { // TODO: Add equals and hashcode to Jasmine Image class. return; } /* // check if there's a material overlay File overlay = new File(project.getTestingImageLocation(), OverlayData.getOverlayFilename(image, JasmineClass.MATERIAL)); if (overlay.exists()) { image.materialOverlayFilename = overlay.getAbsolutePath(); } // check if there's a mask overlay overlay = new File(project.getTestingImageLocation(), OverlayData.getOverlayFilename(image, JasmineClass.MASK)); if (overlay.exists()) { image.maskOverlayFilename = overlay.getAbsolutePath(); } */ project.addTestingImage(image); loadJasmineTestingImage(image); } catch (Exception e) { alert("Could not add image " + file1.getName() + "\n" + e.getMessage()); e.printStackTrace(); } } menus.enableMenus(); testingImageBrowser.refresh(); } public void viewShapeStats() { if (shapeStats == null) { shapeStats = new DialogShapeStats(this); if (getClassMode() == JasmineClass.OBJECT) { shapeStats.displayStats(classificationPanel.selectedObject); } else { shapeStats.displayStats(classificationPanel.selectedSubObject); } } else { shapeStats.setVisible(!this.shapeStats.isVisible()); } } public void showWebcam() { if (webcam == null) { try { webcam = new WebcamGrabber(); Point p = this.getLocation(); int x = (int) p.getX() + gap + getWidth(); int y = (int) p.getY() + gap + getHeight(); webcam.window.setLocation(x, y); menus.view_webcam.setSelected(true); menus.file_add_images_from_camera.setEnabled(true); } catch (Exception err) { err.printStackTrace(); alert(err.toString()); } } else { webcam.window.setVisible(true); webcam.window.requestFocus(); } } public void hideWebcam() { webcam.window.dispose(); menus.file_add_images_from_camera.setEnabled(false); webcam = null; menus.view_webcam.setSelected(false); } public void loadOverlay() { if (currentImage != null) { if (segmentationPanel.mode == JasmineClass.MATERIAL) { if (project.getMaterialClasses().size() == 0) { alert("Can't import material overlay - you haven't specified any material classes yet"); } else { fc.setCurrentDirectory(project.getImageLocation()); fc.setFileFilter(JasmineFilters.getOverlayFilter()); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { currentImage.materialOverlayFilename = fc.getSelectedFile().getName(); project.setChanged(true, "New overlay loaded."); imageBrowser.refresh(); loadJasmineImage(currentImage); } } } else { if (project.getMaskClasses().size() == 0) { alert("Can't import mask overlay - you haven't specified any classes yet"); } else { fc.setCurrentDirectory(project.getImageLocation()); fc.setFileFilter(JasmineFilters.getMaskFilter()); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { currentImage.maskOverlayFilename = fc.getSelectedFile().getName(); project.setChanged(true, "New mask loaded."); imageBrowser.refresh(); loadJasmineImage(currentImage); } } } } else { alert("Can't load overlay - no image selected"); } } public void saveOverlay() { segmentationPanel.saveOverlay(project.currentImage()); } public void importClasses() { File file = getImportFilename("Import Classes"); if (file == null) return; try { String message = Importer.importClasses(project, file); classbox.init(project.getMaterialClasses(), true); imageBrowser.refresh(); // update the information on the current image if (currentPanel.getImage() != null) setImageInfo(project.currentImage()); if (message != null) { alert(message); } } catch (IOException e1) { alert("Cannot load file: " + e1.getMessage()); } catch (RuntimeException e2) { alert("Unexpected field in CSV file - did you load the right one? " + e2.getMessage()); } } public void importImages() { File file = getImportFilename("Import Images"); if (file == null) return; try { int importCount = Importer.importImages(project, file); menus.enableMenus(); imageBrowser.refresh(); loadJasmineImage(project.currentImage()); alert("Imported " + importCount + " images."); setStatusText("Imported " + importCount + " images."); } catch (IOException e1) { alert("Cannot load file: " + e1.getMessage()); } catch (RuntimeException e2) { alert("Unexpected field in CSV file - did you load the right one? " + e2.getMessage()); } } public void importShapes() { File file = getImportFilename("Import Shapes"); if (file == null) return; try { int importCount = Importer.importShapes(project, file); imageBrowser.refresh(); loadJasmineImage(project.currentImage()); alert("Imported " + importCount + " shapes."); setStatusText("Imported " + importCount + " shapes."); } catch (IOException e1) { alert("Cannot load file: " + e1.getMessage()); } catch (Exception e2) { alert("Unexpected field in CSV file - did you load the right one? " + e2.getMessage()); } } public void exportClasses() { File file = getExportFilename("Export Classes", project.getName() + "_classes.csv", ".csv"); if (file == null) return; try { Exporter.exportClasses(project, file); setStatusText("Exported classes to " + file.getName()); } catch (IOException e1) { alert("Cannot save file: " + e1.getMessage()); } } public void exportImages() { File file = getExportFilename("Export Images", project.getName() + "_images.csv", ".csv"); if (file == null) return; try { Exporter.exportImages(project, file); setStatusText("Exported images to " + file.getName()); } catch (IOException e1) { alert("Cannot save file: " + e1.getMessage()); } } public void exportShapes() { File file = getExportFilename("Export Shapes", project.getName() + "_shapes.csv", ".csv"); if (file == null) return; try { Exporter.exportShapes(project, file); setStatusText("Exported shapes to " + file.getName()); } catch (IOException e1) { alert("Cannot save file: " + e1.getMessage()); } } public void exportShapesAsImages() { File file = getExportDirectory("Export Shapes as Images"); if (file == null) return; try { Exporter.exportShapesAsImages(project, file); setStatusText("Exported shape images to " + file.getName() + "/"); } catch (IOException e1) { alert("Cannot save files: " + e1.getMessage()); } } public void exportShapeFeatures(Vector<Terminal> terminals) { File file = getExportFilename("Export Sub-Object Features", project.getName() + "_sub_objects.csv", ".csv"); if (file == null) return; try { Exporter.exportShapeFeatures(this, project, file, terminals); setStatusText("Exported shape features to " + file.getName()); } catch (IOException e1) { alert("Cannot save file: " + e1.getMessage()); } } public void exportObjectFeatures(Vector<Terminal> terminals) { File file = getExportFilename("Export Object Features", project.getName() + "_objects.csv", ".csv"); if (file == null) return; try { Exporter.exportObjectFeatures(this, project, file, terminals); setStatusText("Exported shape features to " + file.getName()); } catch (IOException e1) { alert("Cannot save file: " + e1.getMessage()); } } //POEY public void exportTestingObjectFeatures(Vector<Terminal> terminals) { File file = getExportFilename("Export Testing Object Features", project.getName() + "_testingobjects.csv", ".csv"); if (file == null) return; try { Exporter.exportTestingObjectFeatures(this, project, file, terminals); setStatusText("Exported shape features of the testing set to " + file.getName()); } catch (IOException e1) { alert("Cannot save file: " + e1.getMessage()); } } public void exportNormalisationCoefficients() { File file = getExportFilename("Export Normalisation Coefficients", project.getName() + "_norms.csv", ".csv"); if (file == null) return; try { Exporter.exportNormalisationCoefficients(project, file); setStatusText("Exported normalisation coefficients to " + file.getName()); } catch (IOException e1) { alert("Cannot save file: " + e1.getMessage()); } } public void exportPixels() { exportPixels(null); } public void exportPixels(Vector<Terminal> terminals) { //File file = getExportFilename("Export Pixel Features", project.getName() + "_pixel_features.csv", ".csv"); //if (file == null) return; try { //boolean testing = !confirm("Do you want this to be training data (uses approximately 5% of all the data)"); Exporter.exportPixelFeatures(this, project, terminals, JasmineClass.MATERIAL); } catch (IOException err) { alert("Cannot export pixels: " + err.getMessage()); err.printStackTrace(); } } public void clear() { currentPanel.clear(); currentPanel.repaint(); } private File getImportFilename(String title) { fc.setDialogTitle(title); fc.setFileFilter(JasmineFilters.getCSVFilter()); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { return fc.getSelectedFile(); } return null; } // changes the file chooser directory to the project directory, but only // once, in case the user needs to work on another directory a lot. private boolean setSelectedFile = false; public File getExportFilename(String title, String suggestedFilename, String extension) { fc.setDialogTitle(title); fc.setFileFilter(JasmineFilters.getCSVFilter()); if (!setSelectedFile) { fc.setSelectedFile(new File(DEFAULT_PROJECT_LOCATION_FILE, suggestedFilename)); setSelectedFile = true; } int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { if (!fc.getSelectedFile().getName().endsWith(extension)) { return new File(fc.getSelectedFile().getParentFile(), fc.getSelectedFile().getName() + extension); } return fc.getSelectedFile(); } return null; } private File getExportDirectory(String title) { fc.setDialogTitle(title); fc.setFileFilter(null); fc.setSelectedFile(DEFAULT_PROJECT_LOCATION_FILE); int savedMode = fc.getFileSelectionMode(); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fc.showSaveDialog(this); fc.setFileSelectionMode(savedMode); if (returnVal == JFileChooser.APPROVE_OPTION) { return fc.getSelectedFile(); } return null; } public int getClassMode() { switch (mode) { case PIXEL_SEGMENTATION: return segmentationPanel.mode; case OBJECT_CLASSIFICATION: return classificationPanel.mode; } return -1; } public void addClass() { new DialogClassEntry(this, null, getClassMode()); } public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (mode == PIXEL_SEGMENTATION) { JasmineClass c = (JasmineClass) e.getItem(); currentImage.setClassID(c.classID); alert("Class of " + currentImage.filename + " is now " + c.name); imageBrowser.refresh(); setImageInfo(currentImage); } else { JasmineClass c = (JasmineClass) e.getItem(); currentImage.setClassID(c.classID); alert("Class of selected shape is now " + c.name); } } } public void editClass() { if (classbox.getCurrentClass() == null) { alert("No class selected"); } else { new DialogClassEntry(this, classbox.getCurrentClass(), -1); } } public void clearAllShapes() { if (confirm("Are you sure you want to clear all shapes?")) { for (int i = 0; i < project.getImages().size(); i++) { JasmineImage jasmineImage = project.getImages().elementAt(i); jasmineImage.clearObjects(); imageBrowser.refresh(); loadJasmineImage(jasmineImage); } } } public void clearAllClasses() { if (confirm("Are you sure you want to clear all " + JasmineClass.getTypeName(getClassMode()) + " classes?")) { int mode = getClassMode(); Vector<JasmineClass> toRemove = new Vector<JasmineClass>(10); for (int i = 0; i < project.classes.size(); i++) { JasmineClass jasmineClass = project.classes.elementAt(i); if (jasmineClass.type == mode) toRemove.add(jasmineClass); } project.classes.removeAll(toRemove); project.setChanged(true, "Removed " + toRemove.size() + " classes"); classbox.refresh(); imageBrowser.refresh(); // update the information on the current image if (currentPanel.getImage() != null) setImageInfo(project.currentImage()); } } public void displayClassStats() { if (displayStats == null) { displayStats = new DialogDisplayStats(this, project, getClassMode()); } else { if (displayStats.mode != mode) { displayStats.dispose(); displayStats = new DialogDisplayStats(this, project, getClassMode()); } else { displayStats.setVisible(true); displayStats.requestFocus(); } } } public void nextImage() { if (ensureOverlaySavedOK()) { project.moveNext(); loadJasmineImage(project.currentImage()); menus.enableMenus(); } } public void prevImage() { if (ensureOverlaySavedOK()) { project.movePrev(); loadJasmineImage(project.currentImage()); menus.enableMenus(); } } //POEY public void nextTestingImage() { project.moveNextTesting(); loadJasmineTestingImage(project.currentTestingImage()); } //POEY public boolean firstTestingImage() { return project.checkFirstTestingImage(); } //POEY public boolean firstImage() { return project.checkFirstImage(); } public void deleteImage(Object[] selected) { if (currentImage == null) { alert("No image selected"); } else { String message; if (selected.length == 1) { message = "Are you sure you want to remove this image from the project?"; } else { message = "Are you sure you want to remove these " + selected.length + " images from the project?"; } if (confirm(message)) { for (Object selectedImage : selected) { if (selectedImage instanceof JasmineImage) { project.getImages().remove(selectedImage); } } //project.getImages().remove(currentImage); loadJasmineImage(project.currentImage()); imageBrowser.refresh(); menus.enableMenus(); } } } //POEY public void deleteTestingImage(Object[] selected) { if (currentTestingImage == null) { alert("No image selected"); } else { String message; if (selected.length == 1) { message = "Are you sure you want to remove this image from the project?"; } else { message = "Are you sure you want to remove these " + selected.length + " images from the project?"; } if (confirm(message)) { for (Object selectedImage : selected) { if (selectedImage instanceof JasmineTestingImage) { project.getTestingImages().remove(selectedImage); } } //project.getImages().remove(currentImage); loadJasmineTestingImage(project.currentTestingImage()); testingImageBrowser.refresh(); menus.enableMenus(); } } } public void clearAllImages() { if (confirm("Are you sure you want to clear all images?")) { project.getImages().clear(); loadJasmineImage(null); imageBrowser.refresh(); menus.enableMenus(); } } //POEY public void clearAllTestingImages() { if (confirm("Are you sure you want to clear all testing images?")) { project.getTestingImages().clear(); loadJasmineTestingImage(null); testingImageBrowser.refresh(); menus.enableMenus(); } } public void clearImageOverlays() { if (confirm("Are you sure you want to clear all image overlays?")) { Vector<JasmineImage> images = project.getImages(); for (int i = 0; i < images.size(); i++) { JasmineImage jasmineImage = images.elementAt(i); jasmineImage.materialOverlayFilename = null; } imageBrowser.refresh(); } } public void runGPSegmentation(final JasmineSegmentationProblem problem, boolean startDialog, final int mode) { ensureOverlaySavedOK(); GraphicalListener g = new GraphicalListener() { JFileChooser chooser; public void saveIndividual(Individual ind) { if (chooser == null) { chooser = new JFileChooser(DEFAULT_PROJECT_LOCATION); } try { chooser.setDialogTitle("Save Segmenter"); chooser.setFileFilter(JasmineFilters.getClassAndFileFileFilter()); String filename; if (mode == JasmineClass.MATERIAL) { filename = project.getName() + "-segmenter.solution"; } else { filename = project.getName() + "-background-subtracter.solution"; } if (project.getFilename() != null) { chooser.setSelectedFile(new File(project.getFilename().getParent(), filename)); } else { chooser.setSelectedFile(new File(DEFAULT_PROJECT_LOCATION, filename)); } } catch (Exception e) { e.printStackTrace(); } int r = chooser.showSaveDialog(window); if (r == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); if (f != null) { //POEY comment: save a segmentation solution file problem.saveSegmenter(Jasmine.this, e, f); } } } }; if (startDialog) { //POEY comment: go to this case when a user chooses a listbox Advanced Settings //POEY comment: GP parameter setting new GPStartDialog(this, problem, g).setLocation(50, 50); } else { new Evolve(problem, g).start(); } } public void runICSClassification(final JasmineICS p, boolean startDialog) { ICSListener l = new ICSListenerGraphical() { JFileChooser chooser; public void saveIndividual() { if (getBestIndividual() == null) return; if (chooser == null) { chooser = new JFileChooser(DEFAULT_PROJECT_LOCATION); } try { chooser.setFileFilter(JasmineFilters.getClassAndFileFileFilter()); String filename; if (p instanceof JasmineICSObject) { chooser.setDialogTitle("Save Object Classifier"); filename = project.getName() + "-object-classifier.solution"; } else { chooser.setDialogTitle("Save Sub-Object Classifier"); filename = project.getName() + "-subobject-classifier.solution"; } if (project.getFilename() != null) { chooser.setSelectedFile(new File(project.getFilename().getParentFile(), filename)); } else { chooser.setSelectedFile(new File(DEFAULT_PROJECT_LOCATION, filename)); } } catch (Exception e) { e.printStackTrace(); } int r = chooser.showSaveDialog(window); if (r == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); if (f != null) { Classifier c = getBestIndividual(); p.ensureTerminalMetaDataKnowsTerminals(c); if (p instanceof JasmineICSObject) { new EvolvedICSObjectClassifier(c).save(f); } else { new EvolvedICSSubObjectClassifier(c).save(f); } } } } }; p.addListener(l); new Thread() { public void run() { p.run(); } }.start(); } public void runGPClassification(JasmineGP p, boolean startDialog) { GraphicalListener g = new GraphicalListener() { JFileChooser chooser; public void saveIndividual() { if (getBestIndividual() == null) return; if (chooser == null) { chooser = new JFileChooser(DEFAULT_PROJECT_LOCATION); } try { chooser.setFileFilter(JasmineFilters.getClassAndFileFileFilter()); chooser.setDialogTitle("Save Sub-Object Classifier"); String filename; if (p instanceof JasmineGPObject) { filename = project.getName() + "-object-classifier.solution"; } else { filename = project.getName() + "-subobject-classifier.solution"; } if (project.getFilename() != null) { chooser.setSelectedFile(new File(project.getFilename().getParent(), filename)); } else { chooser.setSelectedFile(new File(DEFAULT_PROJECT_LOCATION, filename)); } } catch (Exception e) { e.printStackTrace(); } int r = chooser.showSaveDialog(window); if (r == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); if (f != null) { if (p instanceof JasmineGPObject) { new EvolvedGPObjectClassifier(getBestIndividual()).save(f); } else { new EvolvedGPSubObjectClassifier(getBestIndividual()).save(f); } } } } }; if (startDialog) { new GPStartDialog(this, p, g).setLocation(50, 50); } else { new Evolve(p, g).start(); } } public void runSGGPShapeClassification() { SubGenerationalProblem p = new SubGenerationalProblem(project, null, false); new GPStartDialog(this, p, new GraphicalListener()); } public void testClassificationOnImage() { if (currentImage != null) { //new DialogRun(this, project, currentImage, DialogRun.MODE_SEGMENT_AND_CLASSIFY); try { VisionSystemGUI g = new VisionSystemGUI(this, VisionSystem.load(project)); g.processImage(getCurrentImage()); } catch (Exception e) { alert(e.toString()); e.printStackTrace(); } } else { alert("No image selected. You'll need to add at least one to your project first."); } } //POEY public void testClassificationOnTestingImage() { if(project.getTestingImages().size()!=0) { try { VisionSystemGUITesting g = new VisionSystemGUITesting(this, VisionSystem.load(project)); g.processImage(getCurrentTestingImage()); } catch (Exception e) { alert(e.toString()); e.printStackTrace(); } } else { alert("No testing images. You'll need to add at least one to your project first."); } } //POEY write testing results to a file public void testClassificationOnTestingImageAll() { if(project.getTestingImages().size()==0){ alert("No testing images. You'll need to add at least one to your project first."); } else { try { if(!firstTestingImage()) project.setCursorTesting(0); //save results to a file File file = getExportFilename("Export Testing Results", project.getName() + "_testing_result.csv", ".csv"); if (file == null) return; try { //Exporter.exportObjectFeatures(this, project, file, terminals); BufferedWriter bw = new BufferedWriter(new FileWriter(file)); setStatusText("Exported testing results to " + file.getName()); //Show a progress bar ProgressDialog d = new ProgressDialog("Classification Progress", "Please wait...", project.getTestingImages().size()); int[] total = new int[1], correct = new int[1]; for(int i=0;i<project.getTestingImages().size();i++,nextTestingImage()) { try { VisionSystemGUITestingAll g = new VisionSystemGUITestingAll(this, VisionSystem.load(project)); System.out.print(project.currentTestingImage().getFilename()); bw.write(project.currentTestingImage().getFilename()); g.processImageWrite(getCurrentTestingImage(),bw,total,correct); //Show a progress bar : but doesn't work now d.setValue(i + 1); } catch (Exception e) { alert(e.toString()); e.printStackTrace(); } } System.out.println("Total="+total[0]+" Correct="+correct[0]+" Accuracy result="+((float)correct[0]/total[0]*100)+"%"); bw.write("\nTotal,"+total[0]+",Correct,"+correct[0]+"\nAccuracy result,"+((float)correct[0]/total[0]*100)+"%\n"); bw.close(); //Dispose the progress bar d.dispose(); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } catch (IOException e1) { alert("Cannot save file: " + e1.getMessage()); } } } public void testSegmenterOnImage() { if (currentImage != null) { new DialogRun(this, project, currentImage, DialogRun.MODE_SEGMENT_ONLY, VisionSystem.SEGMENTER_HANDLE); } else { alert("No image selected. You'll need to add at least one to your project first."); } } public void testBackgroundSegmenterOnImage() { if (currentImage != null) { new DialogRun(this, project, currentImage, DialogRun.MODE_SEGMENT_ONLY, VisionSystem.BACKGROUND_SUBTRACTER_HANDLE); } else { alert("No image selected. You'll need to add at least one to your project first."); } } public void evaluateClassifier() { if (project != null) { // tests the classifier on all SHAPE instances in the project new DialogClassifierEvaluator(this); } else { alert("Please create or open a project first"); } } public void showWindows() { classbox.setVisible(true); toolbox.setVisible(true); imageBrowser.setVisible(true); //POEY testingImageBrowser.setVisible(true); arrangeWindows(); menus.updateViewMenus(); } public void newProject() { if (ensureProjectSavedOK()) { new NewProject(this, null); } } public void editProjectSettings() { new NewProject(this, project); } public void toggleDisplayImage() { currentPanel.toggleDisplayImage(); } public JasmineAbstractEditorPanel getCurrentPanel() { return currentPanel; } public void setTitle() { if (project == null) { setTitle(APP_NAME); } else { setTitle(project.getName() + " - " + APP_NAME); } } //public void newProject(String projectName, File imageLocation) { public void newProject(String projectName, File imageLocation, File testingImageLocation) { //project = new JasmineProject(projectName, imageLocation); //POEY project = new JasmineProject(projectName, imageLocation, testingImageLocation); project.setImageLocation(imageLocation); //POEY project.setTestingImageLocation(testingImageLocation); menus.enableMenus(); setTitle(); showWindows(); setStatusText(null); visionSystemPanel.onProjectChanged(project); classbox.refresh(); segmentationPanel.setMode(JasmineClass.MASK); } public void editProject(String projectName, File imageLocation, File testingImageLocation) { project.setName(projectName); project.setImageLocation(imageLocation); //POEY project.setTestingImageLocation(testingImageLocation); setTitle(); setStatusText(null); } public void closeProject() { if (ensureOverlaySavedOK()) { if (ensureProjectSavedOK()) { project = null; currentImage = null; //POEY currentTestingImage = null; classbox.setVisible(false); toolbox.setEnabled(false); imageBrowser.setVisible(false); //POEY testingImageBrowser.setVisible(false); if (shapeStats != null) shapeStats.setVisible(false); loadJasmineImage(null); //POEY loadJasmineTestingImage(null); setTitle(); setStatusText(null); visionSystemPanel.onProjectChanged(project); tabs.setEnabled(false); } } } public void openProject() { if (project != null) { if (!ensureProjectSavedOK()) return; closeProject(); } project = null; currentImage = null; //POEY currentTestingImage = null; fc.setDialogTitle("Open Project"); fc.setFileFilter(JasmineFilters.getJasmineFilter()); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); //POEY comment: file is a path of the project openProject(file); } } public void addRecentProject(File file) { RecentProjects projects = (RecentProjects) settings.getProperty(SETTING_RECENT_PROJECTS); if (projects == null) { projects = new RecentProjects(); settings.addProperty(SETTING_RECENT_PROJECTS, projects); } projects.add(file); settings.save(); } public void openProject(File file) { setStatusText("Please wait, loading project..."); tabs.setEnabled(true); try { JasmineProject p = JasmineProject.load(file); // save to recent projects addRecentProject(file); updateDefaultProjectLocation(file); // check that the directory where the images should be still exists File f = p.getImageLocation(); if (!f.exists()) { alert("The image location for this project does not exist.\nThis may be because you've loaded this project on a different computer.\nPress OK to select a new folder."); while (true) { fc.setDialogTitle("Choose Image Location"); fc.setFileFilter(JasmineFilters.getImageFilter()); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION && fc.getSelectedFile().isDirectory()) { p.setImageLocation(fc.getSelectedFile()); } else { // don't load project. setStatusText("Could not load the project."); return; } // check that all the images exist Vector<JasmineImage> failures = new Vector<JasmineImage>(); for (int i = 0; i < p.getImages().size(); i++) { JasmineImage jasmineImage = p.getImages().elementAt(i); File image = new File(p.getImageLocation(), jasmineImage.filename); if (!image.exists()) { failures.add(jasmineImage); } } if (failures.size() > 0) { if (confirm(failures.size() + " ( of " + p.getImages().size() + " ) images could not be found in this folder. Proceed?\nClick Yes to open the project without these files, or click No to choose another folder.")) { // remove images p.getImages().removeAll(failures); break; } } else { alert("Success! All training images found."); break; } } } //POEY not be solved File ft = p.getTestingImageLocation(); if (!ft.exists()) { alert("The testing image location for this project does not exist.\nThis may be because you've loaded this project on a different computer.\nPress OK to select a new folder."); while (true) { fc.setDialogTitle("Choose Testing Image Location"); fc.setFileFilter(JasmineFilters.getImageFilter()); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION && fc.getSelectedFile().isDirectory()) { p.setTestingImageLocation(fc.getSelectedFile()); } else { // don't load project. setStatusText("Could not load the project."); return; } // check that all the images exist Vector<JasmineTestingImage> failurest = new Vector<JasmineTestingImage>(); for (int i = 0; i < p.getTestingImages().size(); i++) { JasmineTestingImage jasmineTestingImage = p.getTestingImages().elementAt(i); File image = new File(p.getTestingImageLocation(), jasmineTestingImage.filenameTesting); if (!image.exists()) { failurest.add(jasmineTestingImage); } } if (failurest.size() > 0) { if (confirm(failurest.size() + " ( of " + p.getTestingImages().size() + " ) testing images could not be found in this folder. Proceed?\nClick Yes to open the project without these files, or click No to choose another folder.")) { // remove images p.getTestingImages().removeAll(failurest); break; } } else { alert("Success! All testing images found. "+ft); break; } } } // everything is OK project = p; toolbox.setEnabled(true); imageBrowser.refresh(); //POEY testingImageBrowser.refresh(); loadJasmineImage(project.currentImage()); //POEY loadJasmineTestingImage(project.currentTestingImage()); classbox.refresh(); menus.enableMenus(); setTitle(); showWindows(); setStatusText(null); visionSystemPanel.onProjectChanged(project); //if (featureSelectionDialog != null) featureSelectionDialog.update(project); setStatusText("Loaded project."); } catch (IOException e1) { JOptionPane.showMessageDialog(this, "Cannot open project.\nThe file may be from an older version of Jasmine\n" + e1.toString(), "Open Project", JOptionPane.ERROR_MESSAGE); //e1.printStackTrace(); } catch (ClassNotFoundException e2) { JOptionPane.showMessageDialog(this, "Cannot open project.\nClass Not Found", "Open Project", JOptionPane.ERROR_MESSAGE); e2.printStackTrace(); } } public void openFeatureSelectionDialog() { openFeatureSelectionDialog(getClassMode(), false); } public void openFeatureSelectionDialog(int mode, boolean backgroundSub) { new JasmineFeatureSelectionDialog(this, mode, backgroundSub); } public void saveProject() { try { File existing = project.getFilename(); if (existing != null) { long start = System.currentTimeMillis(); project.save(project.getFilename()); long time = System.currentTimeMillis() - start; setStatusText("Saved project OK, " + time + "ms"); } else { saveProjectAs(); } } catch (IOException e1) { JOptionPane.showMessageDialog(this, "Cannot save project: " + e1.getMessage(), "Save Project", JOptionPane.ERROR_MESSAGE); } } public void saveProjectAs() { fc.setDialogTitle("Save Project As"); fc.setFileFilter(JasmineFilters.getJasmineFilter()); if (project.getFilename() != null) { fc.setSelectedFile(project.getFilename()); } else { fc.setSelectedFile(new File(DEFAULT_PROJECT_LOCATION_FILE, project.getName() + ".jasmine")); } int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); try { if (!file.getName().endsWith(".jasmine")) { file = new File(file.getParent(), file.getName() + ".jasmine"); } long start = System.currentTimeMillis(); if (project != null) project.save(file); long time = System.currentTimeMillis() - start; menus.updateSaveMenu(); setStatusText("Saved project as " + file.getName() + "," + time + "ms"); addRecentProject(file); updateDefaultProjectLocation(file); } catch (IOException e1) { JOptionPane.showMessageDialog(this, "Cannot save project: " + e1.getMessage(), "Save Project", JOptionPane.ERROR_MESSAGE); } } } public void updateDefaultProjectLocation(File file) { if (file != null) { settings.addProperty(SETTING_DEFAULT_PROJECT_LOCATION, file.getParentFile().getAbsolutePath()); DEFAULT_PROJECT_LOCATION = file.getParentFile().getAbsolutePath(); } else { DEFAULT_PROJECT_LOCATION = (String) settings.getProperty(SETTING_DEFAULT_PROJECT_LOCATION); } //alert("DEFAult PROJECT LOCATIOn: " + DEFAULT_PROJECT_LOCATION); } public boolean ensureOverlaySavedOK() { if (project == null) return true; if (segmentationPanel.eitherOverlayChanged()) { int response = JOptionPane.showConfirmDialog(this, "Save segmentation overlay on " + currentImage.filename + " first?", "Save Overlay", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (response == JOptionPane.OK_OPTION) { segmentationPanel.saveOverlays(project.currentImage()); return true; } if (response == JOptionPane.CANCEL_OPTION) { return false; } } return true; } public boolean ensureProjectSavedOK() { if (!ensureOverlaySavedOK()) return false; if (project != null && (project.isChanged() || project.getFilename() == null)) { int response; if (project.getFilename() == null) { response = JOptionPane.showConfirmDialog(this, "Project has not been saved yet. Save Project?", "Save Project", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); } else { response = JOptionPane.showConfirmDialog(this, "Project has changed. Save changes?", "Save Project", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); } if (response == JOptionPane.OK_OPTION) { File existing = project.getFilename(); if (existing == null) { saveProjectAs(); } else { saveProject(); } } if (response == JOptionPane.CANCEL_OPTION) return false; } return true; } public void exit() { if (ensureProjectSavedOK()) { System.exit(0); } } public void alert(String message) { JOptionPane.showMessageDialog(this, message); } public boolean confirm(String message) { int retVal = JOptionPane.showConfirmDialog(this, message, APP_NAME, JOptionPane.YES_NO_OPTION); return retVal == JOptionPane.YES_OPTION; } /** * @param image */ public void loadJasmineImage(JasmineImage image) { setImageInfo(image); if (currentPanel == null) { // initialise the panel currentPanel = segmentationPanel; } // share the buffered image (saves memory) if (image != null) { BufferedImage img = image.getBufferedImage(); segmentationPanel.loadJasmineImage(image, img); classificationPanel.loadJasmineImage(image, img); } else { segmentationPanel.setImageNull(); classificationPanel.setImageNull(); currentPanel.repaint(); } currentImage = image; } //POEY public void loadJasmineTestingImage(JasmineTestingImage image) { // share the buffered image (saves memory) if (image != null) { image.getBufferedTestingImage(); } currentTestingImage = image; } public void setImageInfo(JasmineImage image) { if (image == null) { status.setText("No Image Selected"); } else { status.setText(image.toString()); } } public PixelLoader getCurrentImage() { PixelLoader pl = new PixelLoader(currentImage.getBufferedImage(), null); pl.setFile(new File(project.getImageLocation(), currentImage.filename)); return pl; } //POEY public PixelLoader getCurrentTestingImage() { PixelLoader pl = new PixelLoader(currentTestingImage.getBufferedTestingImage(), null); pl.setFile(new File(project.getTestingImageLocation(), currentTestingImage.filenameTesting)); return pl; } public void segmentCurrentImage(final JButton b) { try { final VisionSystem vs = VisionSystem.load(project); vs.addVisionSystemListener(this); Thread t = new Thread() { public void run() { try { classificationPanel.clear(); b.setEnabled(false); if (currentImage != null) { currentImage.clearObjects(); currentImage.setObjects(vs.getObjects(getCurrentImage())); classificationPanel.objects = currentImage.getObjects(); classificationPanel.repaint(); imageBrowser.refresh(); } else { alert("No image selected"); } } catch (Exception err) { alert(err.getMessage()); err.printStackTrace(); } finally { b.setEnabled(true); } } }; t.start(); } catch (Exception e) { alert("Cannot load the vision system: " + e.toString()); } } public void preprocess() { final ProgressDialog d = new ProgressDialog("Processing Images", "Please wait while the images are processed", project.getImages().size()); new Thread() { public void run() { try { JasmineImagePreprocessor p = new JasmineImagePreprocessor(project); for (int i = 0; i < project.getImages().size(); i++) { JasmineImage jasmineImage = project.getImages().elementAt(i); p.process(Jasmine.this, jasmineImage, new File(project.getImageLocation(), jasmineImage.filename)); d.setValue(i); } } catch (Exception e) { e.printStackTrace(); alert("Cannot preprocess: " + e); } segmentationPanel.repaint(); d.dispose(); loadJasmineImage(project.currentImage()); } }.start(); } public void restore() { final ProgressDialog d = new ProgressDialog("Restoring Images", "Please wait while the images are restored", project.getImages().size()); new Thread() { public void run() { try { JasmineImagePreprocessor p = new JasmineImagePreprocessor(project); for (int i = 0; i < project.getImages().size(); i++) { JasmineImage jasmineImage = project.getImages().elementAt(i); p.restore(new File(project.getImageLocation(), jasmineImage.filename)); d.setValue(i); } } catch (Exception e) { e.printStackTrace(); alert("Cannot restore: " + e); } d.dispose(); loadJasmineImage(project.currentImage()); } }.start(); } public void displayCorrelation() { new JasmineCorrelationGraph(this, segmentationPanel.mode); } public void displayFeatureSimilarity() { new JasmineFeatureSimilarity(this, segmentationPanel.mode); } public void displayFeatureDistributions() { new JasmineFeatureDistributions(this); } public void showAbout() { new JasmineAboutDialog(this); } public SubObjectClassifier getShapeClassifier() { try { return JasmineDeployer.getShapeClassifier(project); } catch (Exception e) { alert("Cannot instantiate shape classifier: " + e.toString()); return null; } } public Segmenter getSegmenter(String handle) { try { return JasmineDeployer.getSegmenter(project, handle); } catch (Exception e) { alert("Cannot instantiate segmenter" + e.toString()); return null; } } private ProgressDialog d; public void onStart() { d = new ProgressDialog("Segmenting", "Please wait...", 100); } //POEY public void onProcess() { d = new ProgressDialog("Processing", "Please wait...", 100); } public void onSegmentationProgress(int progress) { if (d != null) { d.setValue(progress); } } public void onFinishedSegmentation(Vector<SegmentedObject> objects) { if (d != null) { d.dispose(); } } public void onFinished(Vector<SegmentedObject> objects) { } public static void main(String[] args){ new Jasmine(args); } }
[ "owksley@gmail.com" ]
owksley@gmail.com
b3a48264ab1ec79d2a9a2150be63a45ba6d558b9
f0d3fe0ac281c8e4c35fc9f52a17174e47999288
/lion-api/src/main/java/com/lancq/lion/api/event/UserOnlineEvent.java
eb8b2b2cc399b5b07d6677ddc1c3d450b5fbcff2
[]
no_license
lanchunqiu/lion
fc03f6dfa956ff7d2def069ea8a3a854dabbc5c1
69e24657fd64a0048ce864f3856765ad440cae9c
refs/heads/master
2020-04-18T18:59:45.322672
2019-01-28T01:25:02
2019-01-28T01:25:02
167,700,804
2
4
null
null
null
null
UTF-8
Java
false
false
555
java
package com.lancq.lion.api.event; import com.lancq.lion.api.connection.Connection; /** * @Author lancq * @Description * @Date 2019/1/26 **/ public final class UserOnlineEvent implements Event { private final Connection connection; private final String userId; public UserOnlineEvent(Connection connection, String userId) { this.connection = connection; this.userId = userId; } public Connection getConnection() { return connection; } public String getUserId() { return userId; } }
[ "1046582540@qq.com" ]
1046582540@qq.com
952983795a7072102c3d09836fefe2b3b6b66541
68a19507f18acff18aa4fa67d6611f5b8ac8913c
/slfx/slfx-jp/slfx-jp-domain/src/main/java/slfx/jp/domain/model/policy/JPPlatformPolicy.java
9f6dce533a94cb136ce9332e6dc507650b433b25
[]
no_license
ksksks2222/pl-workspace
cf0d0be2dfeaa62c0d4d5437f85401f60be0eadd
6146e3e3c2384c91cac459d25b27ffeb4f970dcd
refs/heads/master
2021-09-13T08:59:17.177105
2018-04-27T09:46:42
2018-04-27T09:46:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,355
java
package slfx.jp.domain.model.policy; import hg.common.component.BaseModel; import hg.common.util.UUIDGenerator; import java.text.SimpleDateFormat; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; import slfx.jp.command.admin.policy.PolicyCommand; import slfx.jp.domain.model.J; import slfx.jp.domain.model.dealer.Dealer; import slfx.jp.domain.model.supplier.Supplier; import slfx.jp.pojo.system.PolicyConstants; /** * * @类功能说明:平台价格政策 * @类修改者: * @修改日期: * @修改说明: * @公司名称:浙江汇购科技有限公司 * @部门:技术部 * @作者:qiuxianxiang * @创建时间:2014年8月5日上午9:36:36 * @版本:V1.0 * */ @Entity @Table(name = J.TABLE_PREFIX + "POLICY") public class JPPlatformPolicy extends BaseModel{ private static final long serialVersionUID = 2115168437070L; /** 政策编号*/ @Column(name="POLICY_NO", length=64) private String no; /** 政策名称*/ @Column(name="POLICY_NAME", length=64) private String name; /** 供应商ID*/ @Column(name="SUPP_ID", length=64) private String suppId; /** 经销商ID*/ @Column(name="DEALER_ID", length=64) private String dealerId; /** 开始生效时间*/ @Column(name="BEGIN_TIME", columnDefinition = J.DATE_COLUM) private Date beginTime; /** 结束生效时间*/ @Column(name="END_TIME", columnDefinition = J.DATE_COLUM) private Date endTime; /** 价格政策*/ @Column(name="PRICE_POLICY", columnDefinition = J.MONEY_COLUM) private Double pricePolicy; /** 价格百分比政策:以0.23的形式存在,即23% */ @Column(name="PERCENT_POLICY", columnDefinition = J.MONEY_COLUM) private Double percentPolicy; /** 状态 * 未发布、 已发布 、 已开始、 已下架、 已取消 0 1 2 3 4 * */ @Column(name="STATUS", columnDefinition = J.CHAR_COLUM) private String status; /** 创建人 */ @Column(name="CREATE_PERSION", length=64) private String createPersion; /** 创建时间*/ @Column(name="CREATE_TIME", columnDefinition = J.DATE_COLUM) private Date createTime; /** 备注*/ @Column(name="REMARK", length=4000) private String remark; /** 取消原因*/ @Column(name="CANCLE_REASON", length=4000) private String cancleReason; @OneToOne(fetch = FetchType.EAGER) @JoinColumn(name = "SUPP_ID_FOR") private Supplier supplier; @OneToOne(fetch = FetchType.EAGER) @JoinColumn(name = "DEALER_ID_FOR") private Dealer dealer; public JPPlatformPolicy() { super(); // TODO Auto-generated constructor stub } public JPPlatformPolicy(PolicyCommand command) { setId(UUIDGenerator.getUUID()); Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); //使用时间作为政策编号 setNo(sdf.format(date)); setName(command.getName()); setBeginTime(command.getBeginTime()); setEndTime(command.getEndTime()); setPricePolicy(command.getPricePolicy()); setPercentPolicy(command.getPercentPolicy()); setStatus(PolicyConstants.PRE_PUBLISH); setCreatePersion(command.getCreatePersion()); setCreateTime(new Date()); setRemark(command.getRemark()); } public JPPlatformPolicy(PolicyCommand command,Supplier supplier,Dealer dealer) { setId(UUIDGenerator.getUUID()); Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); //使用时间作为政策编号 setNo(sdf.format(date)); setName(command.getName()); setBeginTime(command.getBeginTime()); setEndTime(command.getEndTime()); setPricePolicy(command.getPricePolicy()); setPercentPolicy(command.getPercentPolicy()); setStatus(PolicyConstants.PRE_PUBLISH); setCreatePersion(command.getCreatePersion()); setCreateTime(new Date()); setRemark(command.getRemark()); setSupplier(supplier); setSuppId(supplier.getCode()); setDealer(dealer); setDealerId(dealer.getCode()); } public String getNo() { return no; } public void setNo(String no) { this.no = no; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSuppId() { return suppId; } public void setSuppId(String suppId) { this.suppId = suppId; } public String getDealerId() { return dealerId; } public void setDealerId(String dealerId) { this.dealerId = dealerId; } public Date getBeginTime() { return beginTime; } public void setBeginTime(Date beginTime) { this.beginTime = beginTime; } public Date getEndTime() { return endTime; } public void setEndTime(Date endTime) { this.endTime = endTime; } public Double getPricePolicy() { return pricePolicy; } public void setPricePolicy(Double pricePolicy) { this.pricePolicy = pricePolicy; } public Double getPercentPolicy() { return percentPolicy; } public void setPercentPolicy(Double percentPolicy) { this.percentPolicy = percentPolicy; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getCreatePersion() { return createPersion; } public void setCreatePersion(String createPersion) { this.createPersion = createPersion; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getCancleReason() { return cancleReason; } public void setCancleReason(String cancleReason) { this.cancleReason = cancleReason; } public Supplier getSupplier() { return supplier; } public void setSupplier(Supplier supplier) { this.supplier = supplier; } public Dealer getDealer() { return dealer; } public void setDealer(Dealer dealer) { this.dealer = dealer; } }
[ "cangsong6908@gmail.com" ]
cangsong6908@gmail.com
71f7d287ee83316255e60acac6b2f66a2de95ede
16262f288323b62327fe93baf4ffeae8f279d109
/src/main/java/petshop/ssm/service/PetService.java
d64f210a92ba86869ee51370001e9012a75d2557
[]
no_license
setfre/pet
04991412c8b15758cf2e86bed937c613bf18cd2e
02bd3b1a844f2149b1373f96318a1a2cee70593a
refs/heads/master
2022-12-21T13:47:23.357387
2019-09-30T03:59:53
2019-09-30T03:59:53
211,770,578
0
0
null
2022-12-16T05:05:55
2019-09-30T03:49:38
Java
UTF-8
Java
false
false
665
java
package petshop.ssm.service; import org.springframework.web.servlet.ModelAndView; import petshop.ssm.pojo.Pagination; import petshop.ssm.pojo.Pet; import petshop.ssm.pojo.PetType; public interface PetService { Pagination<Pet> retrievePetPage(Integer currentIndex,Integer recordShowSize); void updatePet(Pet pet); void deletePet(Pet pet); void createPet(Pet pet); Pet retrieveByPetId(Pet pet); ModelAndView retrieveByPetTypeId(PetType petType); ModelAndView retrievePetByPetType(Integer petypeId, Integer adoptStatus); ModelAndView adoptPet(Integer masterId, Integer petId); ModelAndView retrievePet(); void createPetType(PetType petType); }
[ "18243145291@163.com" ]
18243145291@163.com
ffa4e3cc14f74a08174ebce9aafa2e6a74fe7706
8a1769ecbe4d678b3b38cf40c83235273dc0fcd3
/src/main/java/com/aci/jd2015/model/New.java
cd285a10130c92e59ef10d5cf9531e924a214f18
[]
no_license
ZAlbina/LogParserACI
d82fedb5c5c9ea3a90645c5f7774a7113abaa31f
e38924ca4c56744038ad770788cd0c45d60b6268
refs/heads/master
2021-01-11T00:37:37.128181
2016-10-10T17:13:08
2016-10-10T17:13:08
70,508,570
0
0
null
2016-10-10T16:48:32
2016-10-10T16:48:31
null
UTF-8
Java
false
false
137
java
package com.aci.jd2015.model; public class New { public static void main(String[] args) { // TODO Auto-generated method stub } }
[ "dfsfdgrrrrrreghth@mail" ]
dfsfdgrrrrrreghth@mail
98f80b3852cf216407d337639c5055a040c7df12
95e4bdaf5d168bacb44c20951d89716417f672a6
/Principal.java
6ca3e2a4efc63fa329f203853d2deb619f249f52
[]
no_license
vapjunior/perceptronJava
a3af6fe3b285c4039feca940df00b1de5a181eab
1000f3cd94c434e91a86557bd2b20762ec6e54b0
refs/heads/master
2023-06-10T16:29:32.842120
2017-04-18T00:39:06
2017-04-18T00:39:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,801
java
import java.util.Scanner; public class Principal { public static void main(String args[]) { Scanner reader = new Scanner(System.in); int opProblem = 0; System.out.println("Qual problema deseja treinar?\n1 - AND\n2 - Letras"); opProblem = reader.nextInt(); System.out.println(opProblem); if(opProblem == 1) { //cria um Perceptron com 2 entradas Perceptron p = new Perceptron(2); int padroes[][] = { {0,0}, {0,1}, {1,0}, {1,1}, }; int dj[] = {0, 0, 0, 1};// para perceptron multicamada, os desejaveis são diferentes para cada perceptron, desmembrar o problema. //treinar usando eta=0.2 p.treinar(padroes,dj,0.2); System.out.printf("0, 0 = %d\n", p.Y(new int[]{0,0})); System.out.printf("0, 1 = %d\n", p.Y(new int[]{0,1})); System.out.printf("1, 0 = %d\n", p.Y(new int[]{1,0})); System.out.printf("1, 1 = %d\n", p.Y(new int[]{1,1})); } else if(opProblem == 2) { //cria um Perceptron com 25 entradas Perceptron p = new Perceptron(25); int padroes[][] = { {1,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1,1,1,1,0,0,0,1}, {1,1,1,1,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0} }; int dj[] = {0,1}; //treinar usando eta=0.2 p.treinar(padroes,dj,0.2); System.out.printf("1,1,1,1,1\n1,0,0,0,1\n1,0,0,0,1\n1,1,1,1,1\n1,0,0,0,1 = %d\n\n", p.Y(new int[]{ 1,1,1,1,1, 1,0,0,0,1, 1,0,0,0,1, 1,1,1,1,1, 1,0,0,0,1})); System.out.printf("1,1,1,1,1\n0,0,1,0,0\n0,0,1,0,0\n0,0,1,0,0\n0,0,1,0,0 = %d\n\n", p.Y(new int[]{ 1,1,1,1,1, 0,0,1,0,0, 0,0,1,0,0, 0,0,1,0,0, 0,0,1,0,0})); } } }
[ "valdir.a.junior@gmail.com" ]
valdir.a.junior@gmail.com
3ba80ca74da621c7345f2d1a5a0017018358c93b
cc2124ee54550674e9ffebc92544997e4c9bea1a
/tsm/src/main/java/com/trkj/tsm/controller/AttendanceController.java
9b2f71f39e0a25773830b8874d01bf181821a37e
[]
no_license
Jiang-LiWen/Tsm
24cae27e238b8e902b86c3dfb6d0bd77ed706567
75fbe20fbf5f396d7167fc887226088008ba578c
refs/heads/main
2023-06-06T07:50:30.010580
2021-07-01T00:57:19
2021-07-01T00:57:19
372,496,125
0
0
null
null
null
null
UTF-8
Java
false
false
2,879
java
package com.trkj.tsm.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.trkj.tsm.service.AttendanceService; import com.trkj.tsm.vo.AjaxResponse; import com.trkj.tsm.vo.AttendanceVo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.Date; import java.util.List; @RestController @Slf4j public class AttendanceController { @Autowired private AttendanceService attendanceService; @GetMapping("/selectAllsAttend") public PageInfo<AttendanceVo> selectAllsAttend(@RequestParam("currentPage") int currentPage, @RequestParam("pagesize") int pagesize, @RequestParam("flag") String flag){ PageHelper.startPage(currentPage,pagesize); log.debug("--------------------"); List<AttendanceVo> entityPage=attendanceService.selectAllsAttend(flag); PageInfo<AttendanceVo> BookVoPageInfo=new PageInfo<>(entityPage); return BookVoPageInfo; } @PostMapping("/insertsddsas") public AjaxResponse insertsddsas(@RequestBody @Valid AttendanceVo attendanceVo) { log.debug(attendanceVo.toString()+"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2"); attendanceService.insertsddsas(attendanceVo); return AjaxResponse.success(attendanceVo); } @PutMapping("/updateAttendanTimeliness") public AjaxResponse updateAttendanTimeliness(@RequestBody @Valid AttendanceVo attendanceVo){ attendanceVo.setDeletetime(new Date()); log.debug("删除"); attendanceService.updateAttendanTimeliness(attendanceVo); return AjaxResponse.success(attendanceVo); } @PutMapping("/updateByPrimaryKeySelectivegwesd") public AjaxResponse updateByPrimaryKeySelectivegwesd(@RequestBody @Valid AttendanceVo attendanceVo) { log.debug("修改企业档案信息"); attendanceVo.setUpdatetime(new Date()); //获取当前时间 attendanceService.updateByPrimaryKeySelectivegwesd(attendanceVo); return AjaxResponse.success(attendanceVo); } //高级查询 @GetMapping("cdcsdvdtfdfeg") public PageInfo<AttendanceVo> cdcsdvdtfdfeg(@RequestParam("currentPage") int currentPage, @RequestParam("pagesize") int pagesize, @RequestParam(value ="Starttime",required = false) String Starttime, @RequestParam(value ="Endtime",required = false) String Endtime){ List<AttendanceVo> entityPage =attendanceService.cdcsdvdtfdfeg(Starttime,Endtime); PageHelper.startPage(currentPage,pagesize); PageInfo<AttendanceVo> classtypeVoPageInfo = new PageInfo<>(entityPage); return classtypeVoPageInfo; } }
[ "85155916+xxxx999@users.noreply.github.com" ]
85155916+xxxx999@users.noreply.github.com
0e4062b270bbe7939062bcb121ce578f9547a2e0
8a12437d5c4ef36b71242de55dbd6a218c3afa8b
/src/main/java/com/carlospavao/github/personapi/dto/request/PhoneDTO.java
05325f7fe87fe739ee301470a68f13dd4806eb8b
[ "MIT" ]
permissive
CarlosPavao/personapi
43b951e23cbc752a7d6a434e2265f844187278cb
c069d7e249f3d3e3af431bf69bb4586736cb5ca1
refs/heads/main
2023-07-25T20:20:13.568025
2021-08-29T23:29:26
2021-08-29T23:29:26
400,545,128
0
0
null
null
null
null
UTF-8
Java
false
false
620
java
package com.carlospavao.github.personapi.dto.request; import com.carlospavao.github.personapi.enums.PhoneType; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Size; @Data @Builder @AllArgsConstructor @NoArgsConstructor public class PhoneDTO { private Long id; @Enumerated(EnumType.STRING) private PhoneType type; @NotEmpty @Size(min = 13, max = 14) private String number; }
[ "carlos.henrique93@msn.com" ]
carlos.henrique93@msn.com
bafc4f3f11ffb5e917cfdae1b3ee6c0d77bcad49
7fc179608a7421096b450ba749b745d3161a093e
/src/main/java/com/org/woody/woodylibrary/view/photoview/Compat.java
13310f028252740bb78e96915488115f89c2848a
[]
no_license
woodygithub/woodylibrary
dc067239cce9cbad1351a2de213605d274175f3d
9df6b4cbd89ad6e2acbd03458cb0cb3891d67a76
refs/heads/master
2021-01-10T21:04:41.019364
2014-11-07T07:52:53
2014-11-07T07:52:53
26,309,409
1
0
null
null
null
null
UTF-8
Java
false
false
470
java
package com.org.woody.woodylibrary.view.photoview; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.view.View; public class Compat { private static final int SIXTY_FPS_INTERVAL = 1000 / 60; public static void postOnAnimation(View view, Runnable runnable) { if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) { SDK16.postOnAnimation(view, runnable); } else { view.postDelayed(runnable, SIXTY_FPS_INTERVAL); } } }
[ "woody.fire@aliyun.con" ]
woody.fire@aliyun.con
860877e88dc0407ee37eb00f43bfb301f05269b9
76e2ca6220ec44d186c117856224b526c24f7b46
/day0928/DecimalOctalHexaBinary.java
70bdba6428e624ca6dafd88df7b9d6ec0c1537f3
[]
no_license
JUNGJAYOUNG/javaStudy
a9a2c66b67ffb0b34ae4f18fd160e586f678c266
326211726295f34299b96c2dee1a688dc9b7928d
refs/heads/main
2023-08-23T16:21:33.794441
2021-10-17T03:42:46
2021-10-17T03:42:46
411,869,931
0
0
null
null
null
null
UHC
Java
false
false
706
java
class DecimalOctalHexaBinary { public static void main(String[] args) { int a = 12; int b = 014; //10진수 앞에 0붙이면 8진수 int c = 0xC; //표시하려는숫자 앞에 0x 붙이면 16진수 int d = 0b1100; //2진수로 표현하려면 앞에 0b 붙이기 System.out.println(a); System.out.println(b); System.out.println(c); System.out.println(); } } /* 8진수 10진수 16진수 2진수 ----------------------------------------------------------- 0 0 0 0 1 1 1 1 2 2 2 10 3 3 3 11 4 4 4 100 5 5 5 101 6 6 6 110 7 7 7 111 10 8 8 1000 11 9 9 1001 12 10 A 1010 13 11 B 1011 14 12 C 1100 13 D 14 E 15 F 16 10 17 11 */
[ "jayoung1222@naver.com" ]
jayoung1222@naver.com
49419417176b043272f40d46b8390a16603b81d0
15a80e058ac6e24d854bed60d04b2710d5489a93
/EDD_Drive/src/EDD/NodoArchivo.java
a0754a9c8f0bf698cc84934320f3a9d2b0801993
[]
no_license
Angcelo/EDD_2S2019_PY2_201701020
bea21e7400befe662ce7b30673db10775dc38fef
e63b49f19fca7781c059b0636a104698197f6bd8
refs/heads/master
2020-08-28T06:01:19.179359
2019-11-18T04:59:08
2019-11-18T04:59:08
217,615,989
0
0
null
null
null
null
UTF-8
Java
false
false
680
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 EDD; /** * * @author angel */ public class NodoArchivo { public String nombre,extension,contenido,fecha; public int pesoizq,pesoder; public NodoArchivo izq,der; public NodoArchivo(String nombre,String extension,String contenido,String fecha){ this.nombre=nombre; this.extension=extension; this.contenido=contenido; this.fecha=fecha; this.pesoizq=0; this.pesoder=0; this.izq=null; this.der=null; } }
[ "43527563+Angcelo@users.noreply.github.com" ]
43527563+Angcelo@users.noreply.github.com
f530feba6ba6591623747ed576129acc86f95d10
b3c22d2b26180e9fa5b535e02a12108c28df549e
/ttms3.0/src/main/java/cn/tedu/ttms/common/exception/BaseExceptionHandler.java
853a4ad3cd577469b3f54feb6056fee803774e60
[]
no_license
kenyim001/Eclipse
bef78193911a34d023da62dcf7ef0b5d39475eaa
0df890550d3e7a639cc8f9e8fa55e1f856abd0ab
refs/heads/master
2020-03-14T11:17:47.693826
2018-04-30T10:36:49
2018-04-30T10:36:49
131,587,793
0
0
null
null
null
null
UTF-8
Java
false
false
514
java
package cn.tedu.ttms.common.exception; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import cn.tedu.ttms.util.JsonResult; @ControllerAdvice public class BaseExceptionHandler { @ExceptionHandler(RuntimeException.class) @ResponseBody public JsonResult handleRuntimeException(Exception e){ System.err.println(e.getMessage()); return new JsonResult(e); } }
[ "38854212+kenyim001@users.noreply.github.com" ]
38854212+kenyim001@users.noreply.github.com
67b8243fd2341b911f1814a00e156d0a5e902714
d9ecff17a5bb51d49963e0bd6f0135c86e067dcb
/ReactImport/src/blurock/core/Hierarchy.java
87466b97a8c2496b46cb88d7d09011988f507319
[]
no_license
blurock/webReaction
edcd5e28d0f42e0afa949b32f1a0b3abd0083b66
7a443d30ba48d343da3ee2a30bb011c30b9dbbe8
refs/heads/master
2020-05-17T08:49:41.755387
2019-04-30T20:13:05
2019-04-30T20:13:05
183,616,837
0
0
null
null
null
null
UTF-8
Java
false
false
6,323
java
/* * Hierarchy.java * * Created on May 8, 2001, 2:48 PM */ package blurock.core; import blurock.coreobjects.*; import java.util.*; import javax.swing.*; import javax.swing.tree.*; import java.awt.event.*; import javax.swing.event.*; /** * * @author reaction * @version */ public class Hierarchy extends javax.swing.JPanel { ObjectAsTreeNode topNode = new ObjectAsTreeNode("Build Structure"); DefaultTreeModel treeModel; Hashtable nodeSet = new Hashtable(); public ObjectAsTreeNode selectedNode = null; public boolean isLeafNode = false; public boolean nodeSelected = false; DataObjectClass nodeNameClass; ObjectDisplayManager dispManager; /** Creates new form Hierarchy */ public Hierarchy() { treeModel = new DefaultTreeModel(topNode); treeModel.addTreeModelListener(new MyTreeModelListener()); 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 FormEditor. */ private void initComponents() {//GEN-BEGIN:initComponents scrollPanel = new javax.swing.JScrollPane(); hierarchy = new JTree(treeModel); setLayout(new java.awt.BorderLayout()); hierarchy.setPreferredSize(new java.awt.Dimension(300, 500)); hierarchy.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { hierarchyMouseClicked(evt); } } ); scrollPanel.setViewportView(hierarchy); add(scrollPanel, java.awt.BorderLayout.CENTER); }//GEN-END:initComponents public void setup(DataObjectClass cls, ObjectDisplayManager man) { nodeNameClass = cls; dispManager = man; } private void hierarchyMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_hierarchyMouseClicked // Add your handling code here: nodeSelected = setNode(evt); if(nodeSelected) { System.out.println("Hierarchy Mouse Clicked: " + selectedNode.toString()); if(isLeafNode) System.out.println("Leaf Node"); } else { System.out.println("Hierarchy Mouse Clicked: failure"); } }//GEN-LAST:event_hierarchyMouseClicked public boolean setNode(MouseEvent e) { boolean success = true; TreePath path = hierarchy.getPathForLocation(e.getX(),e.getY()); if(path != null) { selectedNode = (ObjectAsTreeNode) path.getLastPathComponent(); nodeSelected = true; success = setLeafStatus(e); } else { success = false; } return success; } public boolean setLeafStatus(MouseEvent e) { boolean success = true; int selRow = hierarchy.getRowForLocation(e.getX(),e.getY()); if(selRow != -1) { isLeafNode = hierarchy.getModel().isLeaf(selectedNode); } else { success = false; } return success; } public void setTopNode(ObjectAsTreeNode top) { topNode = top; scrollPanel.remove(hierarchy); treeModel = new DefaultTreeModel(topNode); treeModel.addTreeModelListener(new MyTreeModelListener()); hierarchy = new JTree(treeModel); hierarchy.setEditable(true); hierarchy.getSelectionModel().setSelectionMode (TreeSelectionModel.SINGLE_TREE_SELECTION); hierarchy.setShowsRootHandles(true); scrollPanel.setViewportView(hierarchy); scrollPanel.updateUI(); hierarchy.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { hierarchyMouseClicked(evt); }}); nodeSet.put((Object) top.toString(), (Object) top); } public void addNodeToSet(ObjectAsTreeNode node, ObjectAsTreeNode parent) { nodeSet.put((Object) node.toString(), (Object) node); addObject(parent,node,true); updateUI(); } public void addObject(DefaultMutableTreeNode parent, DefaultMutableTreeNode childNode, boolean shouldBeVisible) { System.out.println("Adding: '" + childNode + "' to '" + parent + "'"); System.out.println("Parent Child Count: " + parent.getChildCount()); treeModel.insertNodeInto(childNode, parent, parent.getChildCount()); // Make sure the user can see the lovely new node. if (shouldBeVisible) { hierarchy.scrollPathToVisible(new TreePath(childNode.getPath())); } } class MyTreeModelListener implements TreeModelListener { public void treeNodesChanged(TreeModelEvent e) { DefaultMutableTreeNode node; node = (DefaultMutableTreeNode) (e.getTreePath().getLastPathComponent()); /* * If the event lists children, then the changed * node is the child of the node we've already * gotten. Otherwise, the changed node and the * specified node are the same. */ try { int index = e.getChildIndices()[0]; node = (DefaultMutableTreeNode) (node.getChildAt(index)); } catch (NullPointerException exc) {} System.out.println("The user has finished editing the node."); System.out.println("New value: " + node.getUserObject()); String name = (String) node.getUserObject(); node.setUserObject(name); } public void treeNodesInserted(TreeModelEvent e) { } public void treeNodesRemoved(TreeModelEvent e) { } public void treeStructureChanged(TreeModelEvent e) { } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JScrollPane scrollPanel; private javax.swing.JTree hierarchy; // End of variables declaration//GEN-END:variables }
[ "edward.blurock@gmail.com" ]
edward.blurock@gmail.com
bca2a6291edf19202d0b6256e7c553886ca8165c
f37dee64053c4967c0b893045637ae68e3670807
/E-Commerce [J2SE]/Application Files/src/com/myntra/user/UsernameException.java
9d945bd410d33a30519439dab1ecf27312e6c30c
[]
no_license
theShaibaz/cool-projects
ff320b0857c9ffab350feb2881cbd324a5b46450
92cf5736e3cf6cb146bcaafa615ed984fb4e0467
refs/heads/master
2020-09-04T02:12:57.365361
2020-06-09T09:14:32
2020-06-09T09:14:32
260,655,657
1
0
null
null
null
null
UTF-8
Java
false
false
165
java
package com.myntra.user; public class UsernameException extends Exception{ @Override public String getMessage() { return "\nINCORRECT USERNAME FORMAT\n"; } }
[ "57229589+theShaibaz@users.noreply.github.com" ]
57229589+theShaibaz@users.noreply.github.com
ccd16d77eec05b516a53d861cabf6d36be6e219c
dcdb8fd99781263d9f8c2d967d35ccd705839b8b
/src/main/java/com/example/demo/Utils/ImageUtils.java
c66439150a1947c5c6abaf4b1260170b9dc9e22b
[]
no_license
villegasda/test-service
ccb5e34748ef84d6397837a5af7cbf24a6e9dc74
6c5fe8e03af2f4732c5cd9a3cbefe627c81e048f
refs/heads/master
2021-02-13T22:29:57.351847
2020-03-28T01:12:21
2020-03-28T01:12:21
244,739,822
0
0
null
null
null
null
UTF-8
Java
false
false
492
java
package com.example.demo.Utils; import org.springframework.util.StreamUtils; import java.io.IOException; import java.io.InputStream; public class ImageUtils { public static Byte[] inputStreamToByteArray(InputStream file) throws IOException { byte[] fileBytes = StreamUtils.copyToByteArray(file); Byte[] bytes = new Byte[fileBytes.length]; int i = 0; for (Byte aByte : fileBytes) { bytes[i++] = aByte; } return bytes; } }
[ "danpinch@gmail.com" ]
danpinch@gmail.com
24f33d82979d5c3d1fc959d0fd5c3cba4b6a4b79
136b2a3d1e9e5a57906bfdc2167c96ee05b8764c
/项目后台/服务器端/Turings/src/org/turings/index/school/service/SchoolService.java
dae7113404d40ae9bf617f4edfb868ea0676a976
[]
no_license
Wangshuang11/AndroidTraining
726809b62cda33679c2a06a1006df5f83c111a75
a00c973ca573c78c9415e9fc676e2e09862ee6ab
refs/heads/master
2021-07-03T10:36:11.732587
2021-01-21T02:46:43
2021-01-21T02:46:43
217,285,868
3
3
null
2019-11-07T01:30:42
2019-10-24T11:46:24
null
UTF-8
Java
false
false
1,038
java
package org.turings.index.school.service; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.turings.index.entity.School; import org.turings.index.school.dao.SchoolMapper; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @Service @Transactional(readOnly=true) public class SchoolService { @Resource private SchoolMapper schoolMapper; public List<School> findSchoolByFlag(String flag){ return this.schoolMapper.findSchoolByFlag(flag); } public String toJsonArray(List<School> list) { JSONArray array = new JSONArray(); for (int i = 0; i < list.size(); i++) { JSONObject obj = new JSONObject(); obj.put("name", list.get(i).getName()); obj.put("img", list.get(i).getImg()); obj.put("url", list.get(i).getUrl()); obj.put("src", list.get(i).getSrc()); array.add(obj); } JSONObject objt = new JSONObject(); objt.put("list", array); return objt.toString(); } }
[ "2960095374@qq.com" ]
2960095374@qq.com
d4c8ef1118856ed65ab772ce3032089c08e84a2b
ca49f8f06cec590c5b58e70bfc10287c554a1d56
/src/naum/asafov/com/PathSumII113/Main.java
d8454f2bee8f0ef99b1a00ef6c608688d423cbba
[]
no_license
naum43312016/LeetCodeProblems
20ccb83dcafd7e4b612874dd32e9d2b852fb7621
0361606a4b88db989969b9cf60f2730f375f5d38
refs/heads/master
2020-09-16T03:26:40.468090
2019-11-23T18:40:47
2019-11-23T18:40:47
223,636,330
1
0
null
null
null
null
UTF-8
Java
false
false
2,100
java
package naum.asafov.com.PathSumII113; import java.util.ArrayList; import java.util.List; /* Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 2 5 1 Return: [ [5,4,11,2], [5,8,4,5] ] */ public class Main { public static void main(String[] args) { TreeNode t = new TreeNode(5); t.left = new TreeNode(4); t.right = new TreeNode(8); t.right.left = new TreeNode(13); t.right.right = new TreeNode(4); t.right.right.right = new TreeNode(1); t.right.right.left = new TreeNode(5); t.left.left = new TreeNode(11); t.left.left.left = new TreeNode(7); t.left.left.right = new TreeNode(2); List<List<Integer>> a = new Solution().pathSum(t,22); System.out.println("Answer:"+a.toString()); } } class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } class Solution { List<List<Integer>> lists = new ArrayList<>(); public List<List<Integer>> pathSum(TreeNode root, int sum) { if (root==null){ return lists; } helper(root,sum,0,new ArrayList<>()); return lists; } void helper(TreeNode root,int sum,int i,List<Integer> list){ if (root.left==null && root.right==null){ i+=root.val; if (i==sum){ list.add(root.val); lists.add(new ArrayList<>(list)); list.remove(list.size()-1); }else { return; } } if (root.left!=null) { list.add(root.val); helper(root.left, sum, i + root.val, list); list.remove(list.size()-1); } if (root.right!=null){ list.add(root.val); helper(root.right,sum,i+root.val,list); list.remove(list.size()-1); } } }
[ "naum43312016@gmail.com" ]
naum43312016@gmail.com
651b62f085afe8cbf1f75baa4b1b564df8991011
339f7a7b7e3a27a9da05f7a269c2b5b78549b97a
/yours-dev-jenkins/mvp-ms-web/src/main/java/com/hsb/mvpmsweb/model/payload/SendSMSResponseData.java
7a2037996dc869e73613e0ecf80dab49fb8d8a66
[]
no_license
tangchaolibai/mvp
131f84784fc533b31e5f4e5220536a9dbe13c774
56a83e409a4477655e131008ebc806d51dcdb3d0
refs/heads/master
2023-04-15T03:57:12.190617
2021-04-21T13:50:38
2021-04-21T13:50:38
360,185,381
0
0
null
null
null
null
UTF-8
Java
false
false
568
java
package com.hsb.mvpmsweb.model.payload; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.ToString; import lombok.experimental.Accessors; @ApiModel(description = "This entity is used to send SMS for invitation response data.") @Data @Accessors(fluent = true) @ToString public class SendSMSResponseData { @JsonProperty("phoneNumber") private String phoneNumber = null; @JsonProperty("inviter") private String inviter = null; @JsonProperty("SMS") private String SMS = null; }
[ "heweiqing@formssi.com" ]
heweiqing@formssi.com
d0b3217f9b91ab7b553ba47f6e36767b911748ae
00e8c7329b29623402ad7ca5857f29fc5bb86842
/src/main/java/pl/camoleo/videoapp/DAO/VideoCassetteRepo.java
f1be4b3d408b7502bb0f7b86588bae28e2438c04
[]
no_license
camoleo/videoCassetteAppSpring
2b9549a64e2066da74c4c33759315901cb500bd5
b1ca3c04068a63f2d716761391d744e97fc93660
refs/heads/master
2023-01-19T06:55:03.525585
2020-12-02T08:45:45
2020-12-02T08:45:45
317,798,264
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package pl.camoleo.videoapp.DAO; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import pl.camoleo.videoapp.DAO.entity.VideoCassette; @Repository public interface VideoCassetteRepo extends CrudRepository<VideoCassette, Long>{ }
[ "kamilagraczyk@onet.eu" ]
kamilagraczyk@onet.eu
2b96246d3973ffedb2e33c3fd8525f11af8dd0cb
ca0ef043e026e1816f405ca3f1b5bb32f48e8dfb
/lizhihao--cms/src/main/java/com/lizhihao/cms/service/impl/UserServiceImpl.java
850d26e9e4b6de15c35e1ebd80aa76b93c998171
[]
no_license
lizhihao414/1710f-lizhihao-cms
854cf5a93ba5cff8429b4b2a988358dba3357dee
67cf3262da8c2f6e73a5aac95bed03885036cbf3
refs/heads/master
2022-12-22T19:04:11.228761
2020-01-12T08:05:26
2020-01-12T08:05:26
233,358,124
0
0
null
2022-12-16T04:54:26
2020-01-12T08:02:07
JavaScript
UTF-8
Java
false
false
1,833
java
package com.lizhihao.cms.service.impl; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.lizhihao.cms.common.CmsMd5Util; import com.lizhihao.cms.dao.UserDao; import com.lizhihao.cms.pojo.User; import com.lizhihao.cms.service.UserService; @Service public class UserServiceImpl implements UserService{ @Autowired private UserDao userDao; @Override public boolean register(User user) { /** 设置密码 **/ user.setPassword(CmsMd5Util.md5(user.getPassword())); user.setLocked(0); user.setScore(0); user.setRole("0"); user.setCreate_time(new Date()); user.setUpdate_time(new Date()); return userDao.insert(user)>0; } @Override public User getByUsername(String userName) { return userDao.selectByUsername(userName); } @Override public boolean locked(String userName) { User userInfo = userDao.selectByUsername(userName); return userInfo.getLocked()==1; } @Override public boolean set(User user) { User userInfo = userDao.selectById(user.getId()); userInfo.setHeadimg(user.getHeadimg()); userInfo.setNickname(user.getNickname()); return userDao.update(userInfo)>0; } @Override public User getById(Integer id) { return userDao.selectById(id); } @Override public PageInfo<User> getPageInfo(User user, Integer pageNum, Integer pageSize) { PageHelper.startPage(pageNum, pageSize); List<User> userList = userDao.select(user); return new PageInfo<>(userList); } @Override public boolean updateLocked(Integer id) { User user = userDao.selectById(id); if(user.getLocked()==0) { user.setLocked(1); }else { user.setLocked(0); } return userDao.update(user)>0; } }
[ "2565733762@qq.com" ]
2565733762@qq.com
93b80aaa33c909f7700dd8ff62e79155ed8cbf5c
d97a98fb55e2675094e19d93d1744362ef8dd428
/gsm0348/gsm0348-api/src/main/java/ru/tapublog/lib/gsm0348/api/model/PoRProtocol.java
df729d48cca3dfee738acf38381c076ebd3318b8
[]
no_license
gangbanlau/gsm0348
3fee54940bfb6d1012b3f756ef517b0374322366
413540da60aa4ef1786559bd8e451ed26dc16384
refs/heads/master
2021-01-21T18:11:34.035974
2017-07-10T07:14:42
2017-07-10T07:14:42
92,023,124
1
0
null
2017-05-22T07:15:33
2017-05-22T07:15:33
null
UTF-8
Java
false
false
1,200
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2011.09.09 at 04:14:20 PM MSD // package ru.tapublog.lib.gsm0348.api.model; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for PoRProtocol. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="PoRProtocol"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="SMS_DELIVER_REPORT"/> * &lt;enumeration value="SMS_SUBMIT"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "PoRProtocol") @XmlEnum public enum PoRProtocol { SMS_DELIVER_REPORT, SMS_SUBMIT; public String value() { return name(); } public static PoRProtocol fromValue(String v) { return valueOf(v); } }
[ "tapumail@ea7530ee-56cc-4271-9235-8ac10e78199d" ]
tapumail@ea7530ee-56cc-4271-9235-8ac10e78199d
7a01a1e60f1acbe71cdc18171b2a879bba4baaa7
9490430bcf21d615cce1a186a4227c6427db1394
/libam/src/main/java/com/hades/libam/updata/StorageUtils.java
75d0fef052335619f69fa046e9a1839cebdc74f8
[]
no_license
coolhades/CloudProject
6b74a8787da9841ee0ec71824a87013441803fe6
2fddff73fbfd92980325cfd98505e32d5869fb9d
refs/heads/master
2020-06-19T03:04:42.738501
2016-10-31T06:00:27
2016-10-31T06:00:27
74,925,003
0
0
null
2016-11-28T01:56:04
2016-11-28T01:10:15
Java
UTF-8
Java
false
false
3,250
java
/******************************************************************************* * Copyright 2011-2013 Sergey Tarasevich * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ package com.hades.libam.updata; import android.content.Context; import android.content.pm.PackageManager; import android.os.Environment; import android.util.Log; import java.io.File; import java.io.IOException; import static android.os.Environment.MEDIA_MOUNTED; /** * Provides application storage paths * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @since 1.0.0 */ final class StorageUtils { private static final String EXTERNAL_STORAGE_PERMISSION = "android.permission.WRITE_EXTERNAL_STORAGE"; private StorageUtils() { } /** * Returns application cache directory. Cache directory will be created on SD card * <i>("/Android/data/[app_package_name]/cache")</i> if card is mounted and app has appropriate permission. Else - * Android defines cache directory on device's file system. * * @param context Application context * @return Cache {@link File directory} */ public static File getCacheDirectory(Context context) { File appCacheDir = null; if (MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) && hasExternalStoragePermission(context)) { appCacheDir = getExternalCacheDir(context); } if (appCacheDir == null) { appCacheDir = context.getCacheDir(); } if (appCacheDir == null) { Log.w(Constants.TAG, "Can't define system cache directory! The app should be re-installed."); } return appCacheDir; } private static File getExternalCacheDir(Context context) { File dataDir = new File(new File(Environment.getExternalStorageDirectory(), "Android"), "data"); File appCacheDir = new File(new File(dataDir, context.getPackageName()), "cache"); if (!appCacheDir.exists()) { if (!appCacheDir.mkdirs()) { Log.w(Constants.TAG, "Unable to create external cache directory"); return null; } try { new File(appCacheDir, ".nomedia").createNewFile(); } catch (IOException e) { Log.i(Constants.TAG, "Can't create \".nomedia\" file in application external cache directory"); } } return appCacheDir; } private static boolean hasExternalStoragePermission(Context context) { int perm = context.checkCallingOrSelfPermission(EXTERNAL_STORAGE_PERMISSION); return perm == PackageManager.PERMISSION_GRANTED; } }
[ "723760950@qq.com" ]
723760950@qq.com
c6f2a25554966bdbcd86addbd27cc1274d6f1bb6
8cd6ded4696820e7a79fe91efcee72e8ac0bb7ae
/Ejercicios4POO/src/IESVBBank/IESVBBank.java
fb9da0c28f16d43e9ff81451b0dc04cdfd433e14
[]
no_license
gitDGM/ejercicios-clase
00dec0ee62a327cf10780e349f7716482ba0a5f7
f05f7b01be8ffeadb9da009b217459179849eec1
refs/heads/master
2023-05-05T11:54:49.122657
2021-06-01T18:36:34
2021-06-01T18:36:34
331,340,396
0
0
null
null
null
null
UTF-8
Java
false
false
4,406
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 IESVBBank; import java.util.ArrayList; import java.util.regex.Pattern; /** * * @author alumno */ public class IESVBBank { private static final double MAX_INGRESO_SIN_AVISO = 3000; private static final double MIN_SALDO_NEGATIVO = -50; private static final int MAX_MOVIMIENTOS_MOSTRAR = 100; private final String iban; private final String titular; private double saldo; private ArrayList<Double> movimientos; public IESVBBank(String iban, String titular) throws Exception { if (verificarIBAN(iban) && verificarTitular(titular)) { this.iban = iban.toUpperCase(); this.titular = titular.toUpperCase(); this.saldo = 0; this.movimientos = new ArrayList(); } else { if (verificarIBAN(iban)) { throw new Exception("Objeto no creado - IBAN inválido."); } else { throw new Exception("Objeto no creado - Titular inválido."); } } } public String getIBAN() { return this.iban; } public String getIban() { return iban; } public double getSaldo() { return saldo; } public String getTitular() { return titular; } public void getMovimientos() { for (int i = 0; i < this.movimientos.size() && i < MAX_MOVIMIENTOS_MOSTRAR; i++) { if (this.movimientos.get(i) < 0) { System.out.println("RETIRADA: " + this.movimientos.get(i)); } else { System.out.println("INGRESO: " + this.movimientos.get(i)); } } } public void mostarDatosCuenta() { System.out.println("IBAN: " + this.iban); System.out.println("Titular: " + this.titular); System.out.println("Saldo: " + this.saldo); } public boolean ingresar(double saldoMovimiento) { boolean transaccionEstado = true; if (esPosibleIngresar(saldoMovimiento)) { double saldoAnterior = this.saldo; this.saldo += saldoMovimiento; nuevoMovimiento(saldoAnterior); mostrarPosiblesAvisos(saldoMovimiento); } else { transaccionEstado = false; } return transaccionEstado; } public boolean retirar(double saldoMovimiento) { boolean transaccionEstado = true; if (esPosibleRetirar(saldoMovimiento)) { double saldoAnterior = this.saldo; this.saldo -= saldoMovimiento; nuevoMovimiento(saldoAnterior); mostrarPosiblesAvisos(saldoMovimiento); } else { System.err.println("ERROR: No se ha realizado la retirada por falta de saldo."); transaccionEstado = false; } return transaccionEstado; } private void nuevoMovimiento(double saldoAnterior) { this.movimientos.add(this.saldo - saldoAnterior); } private boolean esPosibleIngresar(double saldo) { return saldo > 0; } private boolean esPosibleRetirar(double saldo) { return this.saldo - saldo > MIN_SALDO_NEGATIVO && saldo > 0; } private void mostrarPosiblesAvisos(double saldoMovimiento) { if (saldoMovimiento >= MAX_INGRESO_SIN_AVISO) { System.err.println("AVISO: Notificar a hacienda."); } else if (this.saldo < 0) { System.err.println("AVISO: Saldo negativo."); } } private boolean verificarIBAN(String iban) { String regex = "[A-Z]{2}[0-9]{22}"; return Pattern.matches(regex, iban.toUpperCase()); } private boolean verificarTitular(String titular) { String[] nombreApellidos = titular.split(" "); boolean result = true; for (int i = 0; i < nombreApellidos.length && result; i++) { String regex = "[A-Z]{" + nombreApellidos[i].split("").length + "}"; if (!Pattern.matches(regex, nombreApellidos[i].toUpperCase())) { result = false; } } return result && titular.split(" ").length > 1; } }
[ "dgomezmo99@gmail.com" ]
dgomezmo99@gmail.com
2420bb7b2d8d42db4d164eb4712243298045ce2e
cb90f4e57eef1bdebbafd201382f28a10375f26f
/Fiches et Rendues/Fiche 4/Module 2 _ Graphique/ProjetJava/src/jeu/Carte.java
7f6e237ad5515692e1c4e841d7dfb28a8b90c26c
[]
no_license
Managarmre/Projet-java-The-Caterpillar-Quest
2df7250a63cd32487cc088a5d4206cd9bf5bf59f
c6d4460d0ce21b4deaaa4f86218d2e604ff574b7
refs/heads/master
2020-05-26T03:56:28.633196
2015-06-12T15:54:52
2015-06-12T15:54:52
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
11,242
java
package jeu; import java.util.ArrayList; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; import elementsGraphiques.Cerise; import elementsGraphiques.Element; import elementsGraphiques.ElementFixe; import elementsGraphiques.ElementRamassable; import elementsGraphiques.Ennemi; import elementsGraphiques.Guepe; import elementsGraphiques.Personnage; import elementsGraphiques.Plateforme; import elementsGraphiques.Porte; /** * Classe représantant la carte du jeu. * Cette classe contient tout les éléments graphique. Ces éléments graphiques se trouvent dans le package 'elementsGraphiques'. * Celle-ci doit être chargée à partir d'un fichier .map, se chargement est effectuer à l'aide de la classe Parser. * * @author Maxime Pineau * @see elementsGraphiques */ public class Carte { private Personnage personnage; private ArrayList<Porte> portes; private ArrayList<ElementRamassable> elementsRamassables; private ArrayList<Ennemi> ennemis; private ArrayList<ElementFixe> elementsFixes; /** * Crée une nouvelle carte. */ public Carte() { this.elementsRamassables = new ArrayList<ElementRamassable>(); this.ennemis = new ArrayList<Ennemi>(); this.elementsFixes = new ArrayList<ElementFixe>(); this.portes = new ArrayList<Porte>(); this.personnage = new Personnage( 10, 32 * 10 ); this.testerCarte(); // ----------------------------------------------------------- à remplacer par l'appel du parseur } private void testerCarte() { Plateforme plateforme; for( int i = 0; i < 33; i++ ) { plateforme = new Plateforme( 32*i, 32*19 ); this.elementsFixes.add(plateforme); } for( int i = 10; i < 28; i++ ) { plateforme = new Plateforme( 32*i, 32*15 ); this.elementsFixes.add(plateforme); } this.portes.add( new Porte(32*30, 32*17) ); // déplacements horizontale this.ennemis.add( new Guepe( 400, 100, 600, 100, true ) ); // gauche -> droite this.ennemis.add( new Guepe( 600, 150, 400, 150, true ) ); // droite -> gauche this.ennemis.add( new Guepe(600, 300, 300, 300, true) ); // déplacement verticale this.ennemis.add( new Guepe( 100, 500, 100, 1000, false ) ); // haut -> bas this.ennemis.add( new Guepe( 200, 400, 200, 100, false ) ); // bas -> haut // déplacement diagonale this.ennemis.add( new Guepe( 400, 400, 500, 800, true ) ); this.ennemis.add( new Guepe( 400, 400, 1000, 400, true ) ); Cerise cerise = new Cerise( 32*12, 32*18 ); this.elementsRamassables.add(cerise); } /** * Initialise la carte et ses éléments graphiques (ajout des images, sprites...). * Cette méthode est à appeler dans la fonction Jeu.init(). * @param conteneur Le conteneur du jeu * @throws SlickException Lancée lorsqu'une erreur est détectée par la librairie Slick2D (image non trouvée...). */ public void initialiser(GameContainer conteneur) throws SlickException { for( ElementFixe fixe : this.elementsFixes ) { fixe.initialiser(); } for( ElementRamassable ramassable : this.elementsRamassables ) { ramassable.initialiser(); } for( Ennemi ennemi : this.ennemis ) { ennemi.initialiser(); } for( Porte porte : this.portes ) { porte.initialiser(); } this.personnage.initialiser(); } /** * Met à jours les données de la cartes (positions des éléments...). * @param conteneur Le conteneur du jeu. * @param delta Le temps qui s'est passé depuis la dernière mise à jour en millisecondes. * @throws SlickException Lancée lorsqu'une erreur est détectée par la librairie Slick2D. * @throws PartieException Indique que la partie a été gagnée ou perdue. */ public void update( GameContainer conteneur, int delta ) throws SlickException, PartieException { for( Ennemi ennemi : this.ennemis ) { ennemi.update( conteneur, delta, this ); } this.personnage.update( conteneur, delta, this ); } /** * Affiche les éléments de la carte dans la fenêtre graphique. * @param conteneur Le conteneur du jeu. * @param graphique Le graphique du jeu. * @throws SlickException Lancée lorsqu'une erreur est détectée par la librairie Slick2D. */ public void afficher( GameContainer conteneur, Graphics graphique ) throws SlickException { for( ElementFixe fixe : this.elementsFixes ) { fixe.afficher( conteneur, graphique ); } for( ElementRamassable ramassable : this.elementsRamassables ) { ramassable.afficher( conteneur, graphique ); } for( Ennemi ennemi : this.ennemis ) { ennemi.afficher( conteneur, graphique ); } for( Porte porte : this.portes ) { porte.afficher( conteneur, graphique ); } this.personnage.afficher( conteneur, graphique ); } /** * Retourne le personnage du joueur présent sur la carte. * @return Le personnage du joueur. */ public Personnage getPersonnage() { return personnage; } /* public ArrayList<Porte> getPortes() { return this.portes; } public ArrayList<ElementRamassable> getElementsRamassables() { return elementsRamassables; } public ArrayList<Ennemi> getEnnemis() { return ennemis; } public ArrayList<ElementFixe> getElementsFixes() { return elementsFixes; } */ /** * Supprime un élément ramassable de la carte. * @param ramassable L'élément ramassable à supprimer. * @return Vrai si l'élément a bien été supprimé, faux sinon */ public boolean supprimerElementRamassable( ElementRamassable ramassable ) { return this.elementsRamassables.remove(ramassable); } /** * Supprime un ennemi de la carte. * @param ennemi L'ennemi à supprimer. * @return Vrai si l'ennemi a bien été supprimé, faux sinon */ public boolean supprimerEnnemi( Ennemi ennemi ) { return this.ennemis.remove(ennemi); } /** * Supprime un élément fixe de la carte. * @param fixe L'élément fixe à supprimer. * @return Vrai si l'élément fixe a bien été supprimé, faux sinon. */ public boolean supprimerElementFixe( ElementFixe fixe ) { return this.elementsFixes.remove(fixe); } /** * Supprime une porte de sortie de la carte. * @param porte La porte à supprimer. * @return Vrai si la porte a bien été supprimé, faux sinon. */ public boolean supprimerPorte( Porte porte ) { return this.portes.remove(porte); } /** * Retourne l'élément de la liste avec lequel l'élément à vérifier est en collision. * On vérifiera tout les éléments de la liste passé en paramètre. * Si il y en a un qui est en collision avec l'élément à vérifier, on le retourne. * Si aucun éléments n'est en collision avec l'émément à vérifier, on retourne null. * @param listeElements La liste de tous les éléments poossiblement en collision avec l'élément à vérifier. * @param elementAVerifier L'élément à vérifier * @return L'élément de la liste qui est en collision avec l'élément à vérifier passé en paramètre, null si aucun élément de la liste n'est en collision avec l'élément à vérifier. */ private <E extends Element> E elemenEnCollisionAvecUnElementListe( ArrayList<E> listeElements, Element elementAVerifier ) { for( E element : listeElements ) { if( element.estEnCollisionAvec(elementAVerifier) ) return element; } return null; } /** * Retourne le premier élément fixe de la carte qui est en collision avec l'élément à vérifier, null s'il n'y en a aucun. * @param elementAVerifier L'élément à vérifier. * @return Le premier élément fixe de la carte qui est en collision avec l'élément à vérifier, null s'il n'y en a aucun. */ public ElementFixe getElementFixeEnCollisionAvecElement( Element elementAVerifier ) { return this.elemenEnCollisionAvecUnElementListe( this.elementsFixes, elementAVerifier ); } /** * Retourne le premier ennemi de la carte qui est en collision avec l'élément à vérifier, null s'il n'y en a aucun. * @param elementAVerifier L'élément à vérifier. * @return Le premier ennemi de la carte qui est en collision avec l'élément à vérifier, null s'il n'y en a aucun. */ public Ennemi getEnnemiEnCollisionAvecElement( Element elementAVerifier ) { return this.elemenEnCollisionAvecUnElementListe( this.ennemis, elementAVerifier ); } /** * Retourne la première porte de sortie de la carte qui est en collision avec l'élément à vérifier, null s'il n'y en a aucun. * @param elementAVerifier L'élément à vérifier. * @return La première porte de la carte qui est en collision avec l'élément à vérifier, null s'il n'y en a aucun. */ public Porte getPorteEnCollisionAvecElement( Element elementAVerifier ) { return this.elemenEnCollisionAvecUnElementListe( this.portes, elementAVerifier ); } /** * Retourne le premier élément rammassable de la carte qui est en collision avec l'élément à vérifier, null s'il n'y en a aucun. * @param elementAVerifier L'élément à vérifier. * @return Le premier élément ramassable de la carte qui est en collision avec l'élément à vérifier, null s'il n'y en a aucun. */ public ElementRamassable getElementRamassableEnCollisionAvecElement( Element elementAVerifier ) { return this.elemenEnCollisionAvecUnElementListe( this.elementsRamassables, elementAVerifier ); } /** * Retourne vrai si un élément fixe est en collision avec l'élément à vérifier, faux s'il n'y en a pas. * @param elementAVerifier L'élément à vérifier. * @return Vrai si un élément fixe est en collision avec l'élément à vérifier, faux s'il n'y en a pas. */ public boolean elementEnCollisionAvecUnElementFixe( Element elementAVerifier ) { return this.getElementFixeEnCollisionAvecElement(elementAVerifier) != null; } /** * Retourne vrai si un ennemi est en collision avec l'élément à vérifier, faux s'il n'y en a pas. * @param elementAVerifier L'élément à vérifier. * @return Vrai si un ennemi est en collision avec l'élément à vérifier, faux s'il n'y en a pas. */ public boolean elementEnCollisionAvecUnEnnemi( Element elementAVerifier ) { return this.getEnnemiEnCollisionAvecElement(elementAVerifier) != null; } /** * Retourne vrai si une porte est en collision avec l'élément à vérifier, faux s'il n'y en a pas. * @param elementAVerifier L'élément à vérifier. * @return Vrai si une porte est en collision avec l'élément à vérifier, faux s'il n'y en a pas. */ public boolean elementEnCollisionAvecUnePorte( Element elementAVerifier ) { return this.getPorteEnCollisionAvecElement(elementAVerifier) != null; } /** * Retourne vrai si un élément ramassable est en collision avec l'élément à vérifier, faux s'il n'y en a pas. * @param elementAVerifier L'élément à vérifier. * @return Vrai si un élément ramassable est en collision avec l'élément à vérifier, faux s'il n'y en a pas. */ public boolean elementEnCollisionAvecUnElementRamassable( Element elementAVerifier ) { return this.getElementRamassableEnCollisionAvecElement(elementAVerifier) != null; } public ArrayList<ElementFixe> getElementsFixes() { return this.elementsFixes; } }
[ "maxime.nicolas2@hotmail.fr" ]
maxime.nicolas2@hotmail.fr
c36804162a4e31a14f27bf50eac1350eff92a51a
20775483f4b6aabce24abf9305752997ced58ada
/register/src/main/java/com/lti/controller/EMIController.java
c04dd8c38d55663389f72b1fd2641ffcd8ea49a1
[]
no_license
gautamelectronicschaitanya/Finance-Management-System
584d4112351378059e133850a157f0ac0d91500a
10f26dc9f941e3c821c0e376d0eca70a80e429a9
refs/heads/master
2022-12-24T05:50:56.677188
2019-11-26T12:42:51
2019-11-26T12:42:51
222,249,335
0
1
null
2022-12-16T04:47:24
2019-11-17T13:06:28
Rich Text Format
UTF-8
Java
false
false
462
java
//package com.lti.controller; // //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.stereotype.Controller; // //@Controller //public class EMIController { // // @Autowired // private EMIService emiservice; // // @RequestMapping(path="emiDetails.lti", method=RequestMethod.POST){ // public String display(EMIDetails emidetails){ // emiservice.displayemi(emidetails); // return ""; // } // } //}
[ "noreply@github.com" ]
gautamelectronicschaitanya.noreply@github.com
094655f24f2c1ca047e73866f1b8c954dc28f4fd
497c837840f89ea72d1bd65e3637c779831aadb1
/baselibrary/src/main/java/com/android/module/baselibrary/http/progress/body/ProgressRequestBody.java
cedd25db0f453d72d52cd0699f5479c628ac5fac
[]
no_license
shangchunfa/BaseLibrary
4bf82328d4c8d7eed8ef6692bdc10c50be9b68c1
b592720af88080063b55c2724d531027389b8042
refs/heads/master
2021-05-18T12:24:56.244855
2020-03-30T14:12:19
2020-03-30T14:12:19
251,242,410
0
0
null
null
null
null
UTF-8
Java
false
false
4,780
java
/** * Copyright 2015 ZhangQu Li * <p/> * 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 * <p/> * http://www.apache.org/licenses/LICENSE-2.0 * <p/> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.module.baselibrary.http.progress.body; import android.content.Context; import android.support.annotation.NonNull; import com.android.module.baselibrary.http.callback.EngineCallback; import com.android.module.baselibrary.http.progress.entity.Progress; import java.io.IOException; import okhttp3.MediaType; import okhttp3.RequestBody; import okio.Buffer; import okio.BufferedSink; import okio.ForwardingSink; import okio.Okio; import okio.Sink; /** * 包装的请求体,处理进度 */ public class ProgressRequestBody extends RequestBody { // private Context mContext; //实际的待包装请求体 private final RequestBody requestBody; //进度回调接口 private final EngineCallback mCallBack; //包装完成的BufferedSink private BufferedSink bufferedSink; // 进度实体 private Progress mProgress; /** * 构造函数,赋值 * * @param requestBody 待包装的请求体 * @param callBack 回调接口 */ public ProgressRequestBody(Context context, RequestBody requestBody, EngineCallback callBack) { this.mContext = context; this.requestBody = requestBody; this.mCallBack = callBack; mProgress = new Progress(); } /** * 重写调用实际的响应体的contentType * * @return MediaType */ @Override public MediaType contentType() { return requestBody.contentType(); } /** * 重写调用实际的响应体的contentLength * * @return contentLength * @throws IOException 异常 */ @Override public long contentLength() throws IOException { return requestBody.contentLength(); } /** * 重写进行写入 * * @param sink BufferedSink * @throws IOException 异常 */ @Override public void writeTo(BufferedSink sink) throws IOException { if (bufferedSink == null) { //包装 bufferedSink = Okio.buffer(sink(sink)); } //写入 requestBody.writeTo(bufferedSink); //必须调用flush,否则最后一部分数据可能不会被写入 bufferedSink.flush(); } /** * 写入,回调进度接口 * * @param sink Sink * @return Sink */ private Sink sink(Sink sink) { return new ForwardingSink(sink) { //当前写入字节数 long bytesWritten = 0L; //总字节长度,避免多次调用contentLength()方法 long contentLength = 0L; // // // int progress = 0; @Override public void write(@NonNull Buffer source, long byteCount) throws IOException { super.write(source, byteCount); if (contentLength == 0) { //获得contentLength的值,后续不再调用 contentLength = contentLength(); } //增加当前写入的字节数 bytesWritten += byteCount; // if (contentLength != -1) { // float temp = (float) bytesWritten / contentLength * 100; // progress = new BigDecimal(temp).setScale(2, BigDecimal.ROUND_HALF_UP).intValue(); // } //回调 if (mCallBack != null) { mProgress.setComplete(contentLength == 100); mProgress.setContentLength(contentLength); mProgress.setReadLength(bytesWritten); mProgress.setProgress(); // 回调回去 mCallBack.onProgressInThread(mContext, mProgress); // mCallBack.onProgressInThread(mContext, bytesWritten, contentLength, contentLength == 100); } } }; } // /** // * 获取进度 // */ // private int getProgress(long readLength, long contentLength) { // // 计算当前进度 // float temp = readLength / contentLength * 100; // return new BigDecimal(temp).setScale(2, BigDecimal.ROUND_HALF_UP).intValue(); // } }
[ "shangchunfa@cchaintech.com" ]
shangchunfa@cchaintech.com
7a5fa3f02ca0121f2c28f9bbac3a411af8b22686
a0e3b8106dcbfd58d9070454b91655f36ed378c0
/src/main/java/domain/Receipt.java
1371e7dad34fa44b0a03df17cf1e73792052fd7c
[]
no_license
fredySanabria/CoffeeShopChallenge
70aacaecbc0a9023ddcf73c637e054595f335596
a389eb8c339ab70acde0ba7b406dacb0271086db
refs/heads/main
2023-03-21T03:34:40.398479
2021-03-13T21:29:17
2021-03-13T21:29:17
345,856,228
0
0
null
null
null
null
UTF-8
Java
false
false
1,929
java
package domain; import application.DiscountFactory; import java.util.List; public class Receipt { private int clientDNI; private List<Product> productList; private static final int FREE_BEVERAGE_COUNT = 5; public Receipt(List<Product> productList) { this.productList = productList; } public Double getTotal() { applyExtraDiscount(); applyFreeBeverageBonus(); productList.forEach(System.out::println); System.out.println("\n"); return productList.stream() .mapToDouble(Product::getPrice) .sum(); } private void applyExtraDiscount() { if (containProductType(ProductType.SNACK) && containProductType(ProductType.BEVERAGE) && containProductType(ProductType.EXTRA)) { Product productWithDiscount = this.productList.stream() .filter(item -> item.type == ProductType.EXTRA) .findAny() .get(); productList.add(DiscountFactory.createDiscount("Free Extra for combo", productWithDiscount.price)); } } private boolean containProductType(ProductType type) { return this.productList.stream() .filter(item -> item.type == type) .findAny() .isPresent(); } private void applyFreeBeverageBonus() { long beverageCount = this.productList.stream() .filter(product -> product.type == ProductType.BEVERAGE) .count(); if (beverageCount >= FREE_BEVERAGE_COUNT) { Product freeProduct = this.productList.stream() .filter(item -> item.type == ProductType.BEVERAGE) .findFirst() .get(); productList.add(DiscountFactory.createDiscount("Free 5 beverage discount", freeProduct.price)); } } }
[ "sanabria.fredy@gmail.com" ]
sanabria.fredy@gmail.com
f4e1c03276ab6f43bb5b565646a4aa35cc3a0779
6899ac75ed4bd1794e4a142af73a739c2254d389
/web-crawler-selenium/src/main/java/saaadel/linkedin/crawler/web/selenium/CrawlerWorker.java
cfc874aa42fdf627b5861927979c4a57f1789a17
[ "MIT" ]
permissive
saaadel/linkedin-crawler
936c415689112c626d22d8c3a088e59e0185d1df
2c3e5652090b7e0d563f8c15d91e6e3d795ebe6f
refs/heads/master
2021-01-23T01:01:49.169020
2017-03-29T23:42:45
2017-03-29T23:42:45
85,865,307
0
0
null
null
null
null
UTF-8
Java
false
false
2,216
java
package saaadel.linkedin.crawler.web.selenium; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.openqa.selenium.WebDriver; import saaadel.linkedin.crawler.model.dao.CompanyDao; import saaadel.linkedin.crawler.model.dao.EmployeeDao; import saaadel.linkedin.crawler.model.entity.Company; import saaadel.linkedin.crawler.web.selenium.strategy.EmployeesCrawlingStrategy; import javax.persistence.EntityManager; import javax.persistence.FlushModeType; public class CrawlerWorker implements Runnable { private final Logger logger = LogManager.getLogger(this); private final EntityManager em; private final WebDriver webDriver; private final EmployeesCrawlingStrategy employeesCrawlingStrategy; private final CompanyDao companyDao; private final EmployeeDao employeeDao; public CrawlerWorker(final EntityManager em, final WebDriver webDriver) { this.em = em; this.webDriver = webDriver; this.employeesCrawlingStrategy = new EmployeesCrawlingStrategy(webDriver); this.companyDao = new CompanyDao(em); this.employeeDao = new EmployeeDao(em); } @Override public void run() { Company company; logger.warn("Process companies - started"); final FlushModeType previousFlushModeType = employeeDao.unwrapEntityManager().getFlushMode(); employeeDao.unwrapEntityManager().setFlushMode(FlushModeType.AUTO); while ((company = companyDao.findNotProcessed()) != null) { employeeDao.unwrapEntityManager().getTransaction().begin(); try { employeesCrawlingStrategy.fetch(company, employeeDao::persist, employeeDao::flush); companyDao.markAsProcessed(company.getId()); companyDao.flush(); employeeDao.unwrapEntityManager().getTransaction().commit(); } catch (Exception ex) { employeeDao.unwrapEntityManager().getTransaction().rollback(); throw new IllegalStateException(ex); } } employeeDao.unwrapEntityManager().setFlushMode(previousFlushModeType); logger.warn("Process companies - finished"); } }
[ "saaadel@gmail.com" ]
saaadel@gmail.com
fcba706ce01e06d1d8aa4e24682a6094449a439a
47fa1c7e8367f1900a5e161d35467287bdf222dd
/tableItineraire/TableItineraires.java
7d9cb208303d4d0cb1471bb8889c28c0c7c8108b
[]
no_license
Antho95/BE_ROBOT_IA_2018
1f78602bf37c22d241ed6d58b8d303700848305f
947f846cfd7e691f205401c4bd808de77ccf137c
refs/heads/master
2020-03-09T13:32:08.616809
2018-06-04T14:22:30
2018-06-04T14:22:30
128,813,625
0
0
null
null
null
null
UTF-8
Java
false
false
1,032
java
package tableItineraire; import terrain.GrapheTerrain; public class TableItineraires { private Itineraire[][] tableItineraire; public TableItineraires(GrapheTerrain gt){ int nbSommet = gt.getNbSommet(); tableItineraire = new Itineraire[nbSommet][nbSommet]; for (int i = 0; i < nbSommet; ++i){ for (int j = 0; j < nbSommet; ++j){ if (i != j){ tableItineraire[i][j] = new Itineraire(gt, i, j); } } } } public Itineraire getItineraire(int depart, int arrivee, int derIntersection){ return tableItineraire[depart][arrivee].getItineraire(derIntersection); } public void afficherTable(){ System.out.println("\nTable Itineraire :"); for (int d = 0; d<tableItineraire.length; ++d){ System.out.println("\n*Source "+d+" :"); for (int a = 0; a<tableItineraire.length; ++a){ if (a!=d){ System.out.println("\n**Destination "+a+" :"); System.out.println("***Instructions : "+tableItineraire[d][a].getInstructions()); } } } } }
[ "noreply@github.com" ]
Antho95.noreply@github.com
c7f59de2a4a8a5df3bd7f63477b1b36d46a106f1
a8430a5c6ed3792ff21f980e20a9403defa7e85a
/hero-common/src/main/java/com/hero/common/utils/number/NumberUtil.java
352e74d20502c5678114a88b8d081791ae7d65a7
[]
no_license
hevze/hero
c496c5222b50951fad1300fd19c047d8f488324a
74b9d559513d728efa22c9bc035ab7b8570acf8a
refs/heads/master
2020-05-23T13:07:55.768201
2019-05-16T06:36:51
2019-05-16T06:36:51
186,769,701
0
0
null
null
null
null
UTF-8
Java
false
false
6,004
java
package com.hero.common.utils.number; import org.apache.commons.lang3.math.NumberUtils; import java.math.BigDecimal; /** * * @描述: Object值转为不同类型的数值. * @作者: WuShuicheng. * @创建: 2014-9-29,下午4:31:41 * @版本: V1.0 * */ public class NumberUtil { /*** 舍 */ public final static int SCALETYPE = BigDecimal.ROUND_DOWN; /*** 2位小数 */ public final static int SCALENUMBER2 = 2; /*** 3位小数 */ public final static int SCALENUMBER3 = 3; /*** 4位小数 */ public final static int SCALENUMBER4 = 4; /*** 5位小数 */ public final static int SCALENUMBER5 = 5; /*** 6位小数 */ public final static int SCALENUMBER6 = 6; /*** 2位小数 */ public final static BigDecimal SCALEFORMART2 = new BigDecimal(0.001); /*** 3位小数 */ public final static BigDecimal SCALEFORMART3 = new BigDecimal(0.0001); /*** 4位小数 */ public final static BigDecimal SCALEFORMART4 = new BigDecimal(0.00001); /*** 5位小数 */ public final static BigDecimal SCALEFORMART5 = new BigDecimal(0.000001); /*** 6位小数 */ public final static BigDecimal SCALEFORMART6 = new BigDecimal(0.0000001); /*** * 数字精确值 * @param decimal * @param scale * @return */ public static BigDecimal scale(BigDecimal decimal,int scale){ switch (scale){ case NumberUtil.SCALENUMBER2: return decimal.add(SCALEFORMART2).setScale(NumberUtil.SCALENUMBER2,NumberUtil.SCALETYPE); case NumberUtil.SCALENUMBER3: return decimal.add(SCALEFORMART3).setScale(NumberUtil.SCALENUMBER3,NumberUtil.SCALETYPE); case NumberUtil.SCALENUMBER4: return decimal.add(SCALEFORMART4).setScale(NumberUtil.SCALENUMBER4,NumberUtil.SCALETYPE); case NumberUtil.SCALENUMBER5: return decimal.add(SCALEFORMART5).setScale(NumberUtil.SCALENUMBER4,NumberUtil.SCALETYPE); case NumberUtil.SCALENUMBER6: return decimal.add(SCALEFORMART6).setScale(NumberUtil.SCALENUMBER4,NumberUtil.SCALETYPE); default:return BigDecimal.ZERO; } } /*** * 数字精确值 * @param decimal * @param scale * @return */ public static BigDecimal scaleFormart(BigDecimal decimal,int scale){ switch (scale){ case NumberUtil.SCALENUMBER2: return decimal.setScale(NumberUtil.SCALENUMBER2,NumberUtil.SCALETYPE); case NumberUtil.SCALENUMBER3: return decimal.setScale(NumberUtil.SCALENUMBER3,NumberUtil.SCALETYPE); case NumberUtil.SCALENUMBER4: return decimal.setScale(NumberUtil.SCALENUMBER4,NumberUtil.SCALETYPE); default:return BigDecimal.ZERO; } } /*** * 数字精确值 * @param decimal * @param scale * @return */ public static BigDecimal scaleFormart4S5R(BigDecimal decimal,int scale){ switch (scale){ case NumberUtil.SCALENUMBER2: return decimal.setScale(NumberUtil.SCALENUMBER2,BigDecimal.ROUND_HALF_UP); case NumberUtil.SCALENUMBER3: return decimal.setScale(NumberUtil.SCALENUMBER3,BigDecimal.ROUND_HALF_UP); case NumberUtil.SCALENUMBER4: return decimal.setScale(NumberUtil.SCALENUMBER4,BigDecimal.ROUND_HALF_UP); default:return BigDecimal.ZERO; } } /** * 判断对象值是否为纯数字组成(如:001234,7899),只有纯数字的值才能转Long或Integer. * @param obj 要判断的值. * @return true or false. */ public static boolean isDigits(Object obj) { if (obj == null){ return false; } return NumberUtils.isDigits(obj.toString()); } /** * 判断对象值是否为数字,包含整数和小数(如:001234,7899,7.99,99.00) * @param obj 要判断的值. * @return true or false. */ public static boolean isNumber(Object obj) { if (obj == null){ return false; } return NumberUtils.isNumber(obj.toString()); } /** * Object对象转BigDecimal <br/> * 1、如果Object为空或Object不是数值型对象:抛数字格式化异常 <br/> * 2、Object为数值型对象:转为BigDecimal类型并返回 <br/> * @param obj 要转换的Object对象 <br/> * @return BigDecimal */ public static BigDecimal toBigDecimal(Object obj) { if (obj == null || !NumberUtils.isNumber(obj.toString())){ throw new NumberFormatException("数字格式化异常"); } else { return new BigDecimal(obj.toString()); } } /** * Object对象转Double <br/> * 1、如果Object为空或Object不是数值型对象:抛数字格式化异常 <br/> * 2、Object为数值型对象:转为Double类型并返回 <br/> * @param obj 要转换的Object对象 <br/> * @return Double */ public static Double toDouble(Object obj) { if (obj == null || !NumberUtils.isNumber(obj.toString())){ throw new NumberFormatException("数字格式化异常"); } else { return Double.valueOf(obj.toString()); } } /** * Object对象转Long <br/> * 1、如果Object为空或Object不是整数型对象:抛数字格式化异常 <br/> * 2、Object为整数型对象:转为Long类型并返回 <br/> * @param obj 要转换的Object对象 <br/> * @return Long */ public static Long toLong(Object obj) { if (obj == null || !NumberUtils.isDigits(obj.toString())){ throw new NumberFormatException("数字格式化异常"); } else { return Long.valueOf(obj.toString()); } } /** * Object对象转Integer <br/> * 1、如果Object为空或Object不是整数型对象:抛数字格式化异常 <br/> * 2、Object为整数型对象:转为Integer类型并返回 <br/> * @param obj 要转换的Object对象 <br/> * @return Integer */ public static Integer toInteger(Object obj) { if (obj == null || !NumberUtils.isDigits(obj.toString())){ throw new NumberFormatException("数字格式化异常"); } else { return Integer.valueOf(obj.toString()); } } // public static void main(String[] args) { // BigDecimal bdcm4 = toBigDecimal("9999"); // System.out.println("bdcm4:" + bdcm4); // } }
[ "“wendonghuiaimeng@163.com" ]
“wendonghuiaimeng@163.com
b3de98d54cc6d162182364d614d1974ac827e3d1
e308fb3a7c49a9fda6e43cc0c2cf33738eaa912a
/app/src/main/java/cloud/antelope/lingmou/mvp/contract/DevicesContract.java
0ce2ce0d33a8d325396e4df360d9f3b88b3a224c
[ "Apache-2.0" ]
permissive
allenzhangfan/Lingmou2
1d37cbe5484ea15438c73037558343f96ee97223
c22d5f1b6ea5e325f1c2b5d8836dcba0ce53e325
refs/heads/master
2020-04-26T01:58:57.205750
2019-01-23T01:40:32
2019-01-23T01:40:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,828
java
package cloud.antelope.lingmou.mvp.contract; import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IView; import java.util.List; import cloud.antelope.lingmou.mvp.model.entity.CameraNewStreamEntity; import cloud.antelope.lingmou.mvp.model.entity.GetKeyStoreBaseEntity; import cloud.antelope.lingmou.mvp.model.entity.OrgCameraEntity; import cloud.antelope.lingmou.mvp.model.entity.OrgCameraParentEntity; import cloud.antelope.lingmou.mvp.model.entity.OrgMainEntity; import cloud.antelope.lingmou.mvp.model.entity.SetKeyStoreRequest; import io.reactivex.Observable; public interface DevicesContract { //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 interface View extends IView { void getMainOrgsSuccess(List<OrgMainEntity> entityList); void getMainOrgsFail(); void getMainOrgCamerasSuccess(List<OrgCameraEntity> entityList); void getMainOrgCameraFail(); void getOrgNoPermission(); void getCameraNoPermission(); void onCameraLikeSuccess(GetKeyStoreBaseEntity entity,boolean like); void getCollectionsSuccess(GetKeyStoreBaseEntity entity); void getCoversSuccess(CameraNewStreamEntity entity); } //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 interface Model extends IModel { Observable<List<OrgMainEntity>> getMainOrgs(); Observable<OrgCameraParentEntity> getMainOrgCameras(int page, int pageSize, String[] orgIds); Observable<GetKeyStoreBaseEntity> getCollections(String userId); Observable<GetKeyStoreBaseEntity> cameraLike(String storeKey, SetKeyStoreRequest keyStoreRequest); Observable<CameraNewStreamEntity> getCameraCovers(Long[] cids); } }
[ "yeguoqiang6@outlook.com" ]
yeguoqiang6@outlook.com
a121dc34ac361d6815f75826fffb6ad5a3bee0bb
ed55dd654101daed09276d8f50866ba0e72bfc97
/BBDD_JBDC/src/pruebaBBDD/PrimerIntentoContectaEmpleJavi.java
f2e12ce41ae55a9159b6ed3677fbd367d4bdf889
[]
no_license
javierbarbe/bbddPRogramacion
052e8415d21954c2cb3edd2797871bc9257bcb49
c1c6bd6cb55b385c5ff065cce0618b2e2681c98b
refs/heads/master
2022-11-11T19:27:45.951221
2020-06-29T19:46:19
2020-06-29T19:46:19
264,747,561
0
0
null
null
null
null
UTF-8
Java
false
false
2,066
java
package pruebaBBDD; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class PrimerIntentoContectaEmpleJavi { public static void main(String[] args) { // TODO Auto-generated method stub try { Class.forName("com.mysql.jdbc.Driver"); String connection= "jdbc:mysql://localhost/javi?"+"user=root&password="; Connection con= DriverManager.getConnection(connection); Object n; Statement s = con.createStatement(); int i=1; s.executeUpdate("CREATE TABLE notas ( DNI varchar(10) NOT NULL, Sistemas int(11) NOT NULL, "+ " Programacion int(11) NOT NULL, LenguajeMarcas int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1"); // s.executeUpdate("insert into emple(cod_emp,nombre,oficio, jefe, salario, cod_dep, fecha_alta) " // + " values (11,'javi','bailarin',1,5000, 32, 12/12/1222) "); // s.executeUpdate("delete from emple where nombre like 'javi'"); ResultSet rs = s.executeQuery("select * from datospersonales"); while (rs.next()) { i=1; while (i<=4) { System.out.printf("%15s", rs.getString(i)); System.out.println("\n"+rs.getDate(5)); if(i==3) { if(rs.getString(i).equals("freak")) { System.out.println("\nle oficio es "+ rs.getString(i)); System.out.println(rs.getDate(5)); } } i++; }; System.out.println(); System.out.println(); } // hay que cerrar tanto las consultas , como los resultados, como las conexiones a la bbdd para liberar //recursos rs.close(); s.close(); con.close(); }catch (SQLException e) { System.out.println("sql exception "+ e.toString()); System.out.println("codigo "+e.getErrorCode()); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block System.out.println("Excepcion "+e.toString()); System.out.println("codigo "+e.getMessage()); } } }
[ "Javi@Javi-PC" ]
Javi@Javi-PC
2b4b5117f7f794a266b842a954f258cf04d1b29f
0d177ef4070381f5bcd5c7aa455439e3bbd98ff1
/analytics/src/main/java/com/wadpam/open/analytics/google/GoogleAnalyticsTrackerBuilder.java
b8d03afaff40c0339a38c5eabc98b814a3d02e84
[]
no_license
sosandstrom/open-server
e0801baac115ffad9de1590c789ebae04f560ce7
d14e8c348b373d15f6ea03e96adc189a97660ca4
refs/heads/master
2016-09-07T23:13:52.114649
2014-02-05T17:52:45
2014-02-05T17:52:45
5,378,785
2
1
null
2014-01-21T14:52:23
2012-08-11T09:43:31
Java
UTF-8
Java
false
false
7,084
java
package com.wadpam.open.analytics.google; import com.wadpam.open.analytics.google.config.Application; import com.wadpam.open.analytics.google.config.Device; import com.wadpam.open.analytics.google.config.Property; import com.wadpam.open.analytics.google.config.Visitor; import com.wadpam.open.analytics.google.dispatcher.SynchDispatcher; import com.wadpam.open.analytics.google.dispatcher.TrackingInfoDispatcher; import com.wadpam.open.analytics.google.protocol.GoogleAnalyticsProtocol; import com.wadpam.open.analytics.google.protocol.LegacyProtocol_v5_3_8; import com.wadpam.open.analytics.google.protocol.MeasurementProtocol_v1; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpMethod; import javax.servlet.http.HttpServletRequest; /** * A builder class that help build a Google Analytics tracker using a fluent builder API and * default values when possible. * * @author mattiaslevin */ public class GoogleAnalyticsTrackerBuilder { static final Logger LOG = LoggerFactory.getLogger(GoogleAnalyticsTrackerBuilder.class); private Property property; private Device device; private Application app; private Visitor visitor; private GoogleAnalyticsProtocol protocol; private TrackingInfoDispatcher trackerDispatcher; // Default constructor public GoogleAnalyticsTrackerBuilder() { } /** * Create a tracker with as little input variables as possible. * The device will be created from the request, measurement protocol and POST will be used * @param trackingCode the tracking code * @param visitorId visitor id * @param request request * @return tracker builder */ public GoogleAnalyticsTrackerBuilder defaultTracker(String trackingCode, String visitorId, HttpServletRequest request) { trackerConfiguration(trackingCode).visitor(visitorId).deviceFromRequest(request).measurementProtocol(); return this; } /** * Set tracker configuration. * @param property tracking configuration * @return tracker builder */ public GoogleAnalyticsTrackerBuilder trackerConfiguration(Property property) { this.property = property; return this; } /** * Create a tracker configuration with a name and tracking code. * @param name name * @param trackingCode tracking code * @return tracker builder */ public GoogleAnalyticsTrackerBuilder trackerConfiguration(String name, String trackingCode) { property = new Property(name, trackingCode); return this; } /** * Create a tracker configuration from a tracking code. * @param trackingCode tracking code * @return tracker builder */ public GoogleAnalyticsTrackerBuilder trackerConfiguration(String trackingCode) { property = new Property(trackingCode, trackingCode); return this; } /** * Set device. * @param device device * @return tracker builder */ public GoogleAnalyticsTrackerBuilder device(Device device) { this.device = device; return this; } /** * Create a device with iPhone (iOS5) characteristics. * @return tracker builder */ public GoogleAnalyticsTrackerBuilder iPhoneDevice() { device = Device.defaultiPhoneDevice(); return this; } /** * Create a device with iPad (iOS5) characteristics. * @return tracker builder */ public GoogleAnalyticsTrackerBuilder iPadDevice() { device = Device.defaultiPadDevice(); return this; } /** * Create a device from the incoming request. * @param request incoming request * @return tracker builder */ public GoogleAnalyticsTrackerBuilder deviceFromRequest(HttpServletRequest request) { device = Device.defaultDevice(request); return this; } /** * Set visitor. * @param visitor visitor * @return tracker builder */ public GoogleAnalyticsTrackerBuilder visitor(Visitor visitor) { this.visitor = visitor; return this; } /** * Create a visitor with first and previous visit set to now and number of visits set to 1. * @param visitorId visitor id * @return tracker builder */ public GoogleAnalyticsTrackerBuilder visitor(String visitorId) { long now = System.currentTimeMillis() / 1000L; visitor = new Visitor(visitorId, now, now, 1); return this; } /** * Create app information. * @param name app name * @param version app version * @return tracker builder */ public GoogleAnalyticsTrackerBuilder app(String name, String version) { app = new Application(name, version); return this; } /** * Create a url protocol based on the measurement protocol. * The dispatcher will be set to synch and POST. * @return tracker builder */ public GoogleAnalyticsTrackerBuilder measurementProtocol() { protocol = new MeasurementProtocol_v1(); trackerDispatcher = new SynchDispatcher(HttpMethod.POST); return this; } /** * Create a protocol based on the legacy protocol. * The dispatcher will be set to synch and GET. * @return tracker builder */ public GoogleAnalyticsTrackerBuilder legacyProtocol() { protocol = new LegacyProtocol_v5_3_8(); trackerDispatcher = new SynchDispatcher(HttpMethod.GET); return this; } /** * Sets the protocol. * If the URL builder is not set explicitly Google Analytics v5.3.8 legacy protocol will be used. * @param protocol the protocol * @return tracker builder */ public GoogleAnalyticsTrackerBuilder protocol(GoogleAnalyticsProtocol protocol) { this.protocol = protocol; return this; } /** * Set the tracking info dispatcher. * If the dispatcher is not set explicitly a synchronous dispatcher based on * Spring RestTemplate will be used. * @param dispatcher the tracking info dispatcher * @return tracker builder */ public GoogleAnalyticsTrackerBuilder dispatcher(TrackingInfoDispatcher dispatcher) { this.trackerDispatcher = dispatcher; return this; } /** * Build the tracker. * @return tracker */ public GoogleAnalyticsTracker build() { // Check mandatory data // Check input params if (null == property || null == visitor || null == device) { LOG.error("Configuration, visitor, device must be provided"); throw new IllegalArgumentException(); } // Set default values if (null == protocol) { protocol = new LegacyProtocol_v5_3_8(); } if (null == trackerDispatcher) { trackerDispatcher = new SynchDispatcher(HttpMethod.GET); } // Create the tracker return new GoogleAnalyticsTracker(property, visitor, device, app, protocol, trackerDispatcher); } }
[ "mattias.levin@gmail.com" ]
mattias.levin@gmail.com
4920df22334421350a88af8ea6da7dc6df14fdbb
fee80e730c0a9d2ede2721d4441970bafaaaa646
/web/org/ace/insurance/web/common/Validator.java
56eaced2285aceba63ba892b5de092080d4379ca
[]
no_license
LifeTeam-TAT/GGLI-Core
242360ba9a6dd7cb3841fa495f9124a327df8450
d000f3068b863a581775f5cd7b78b2bfd06b378f
refs/heads/master
2023-03-29T06:26:44.456523
2021-04-02T15:03:18
2021-04-02T15:03:18
354,049,682
0
0
null
null
null
null
UTF-8
Java
false
false
116
java
package org.ace.insurance.web.common; public interface Validator<T> { public ValidationResult validate(T dto); }
[ "lifeteam.tat@gmail.com" ]
lifeteam.tat@gmail.com
8a4ec348e6a9374ab679a366a6dd1d9c40043778
718fbb688172f2a0f1d817448cdb1c32760abf8a
/src/receivers/DisplayLevel.java
810391cc54974828668cceb7e6a373d0076e9a77
[]
no_license
reemfu/soko-reem
d675f226ce2d8413883fea9f3a70625ebe35e186
2633219d3f7a74495a28f27e19ed8052c09ec72d
refs/heads/master
2020-05-23T10:22:27.922183
2017-01-30T14:43:09
2017-01-30T14:43:09
80,428,628
0
0
null
null
null
null
UTF-8
Java
false
false
377
java
package receivers; import java.util.ArrayList; import elements.*; import levels.*; public class DisplayLevel { Level level = null; public DisplayLevel(Level level) { this.level = level; } public void display() { for (ArrayList<Element> a : level.getBoard()) { for (Element el : a) System.out.print(el.getObjChar()); System.out.println(); } } }
[ "reemfu@gmail.com" ]
reemfu@gmail.com
ffd1aec1d81f06781c5bc0876dc4c18dea668e39
ca3b2bf6ecd9f5b8ecab4013d57c646406eed4f2
/metodos en java/src/metodos/en/java/SumarDosNumeros.java
c43d7f96d61eaac33ba549702a39c3b825064bda
[]
no_license
CristianCaviggia/himno
2701791f6771a0b049b259ca473a8ec9c4b15bb9
e108a2d9c06474a99792ca9ed20bc83cdde0c7ca
refs/heads/master
2020-09-09T21:27:49.481301
2019-11-14T00:33:05
2019-11-14T00:33:05
221,575,666
0
0
null
null
null
null
UTF-8
Java
false
false
508
java
// package SumarDosNumeros.java; import java.util.Scanner; public class SumarDosNumeros { public static void main(String[] args) { Scanner teclado = new Scanner (System.in); int numero1= teclado.nextInt(); int numero2=teclado.nextInt(); int resultado= sumar(numero1,numero2); System.out.println("LA SUMA ES: " +resultado); } public static int sumar(int a,int b) { int c; c=a+b; return c ; } }
[ "cristiancaviggia11@gmail.com" ]
cristiancaviggia11@gmail.com
308162c7c0a1f9cbefbd1517dce0666fa870d0b3
c602edfcdbf32122a07706b1e1788fbf62b8d57d
/arch-design/src/main/java/com/github/opensharing/archdesign/pattern/observer/CryEvent.java
a0dab0abb6297236ff604fee32f76e5623865300
[ "Apache-2.0" ]
permissive
w304807481/learning-plan
f00e49eac859f75e09d7dcb0d6b366ff869c98f6
baefddfd72ea822d282bf2e022d9133d9c2a56fa
refs/heads/master
2023-06-23T00:59:16.808883
2020-11-15T06:10:29
2020-11-15T06:10:29
245,796,546
2
0
Apache-2.0
2023-06-14T22:29:54
2020-03-08T10:46:58
Java
UTF-8
Java
false
false
121
java
package com.github.opensharing.archdesign.pattern.observer; /** * 小孩哭事件 */ class CryEvent extends Event { }
[ "304807481@qq.com" ]
304807481@qq.com