blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
87de654a61b24221864c440761366b32ccaf41b8 | 8e965efad5cf053defe84c706759efa33ce9245a | /src/main/java/com/lx/algorithm/leetcode/Solution344.java | 57e5c79c833a25a304f932e63c0c0df014174b6b | [] | no_license | byrlx/AllAboutJava | 85fdddbee7aaaa717f5dc995dbe609fe4ebe464a | c6ec058a5d822a09158928674515c412282117a3 | refs/heads/master | 2020-04-12T09:02:22.368497 | 2017-03-15T11:48:03 | 2017-03-15T11:48:03 | 54,188,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package com.lx.algorithm.leetcode;
import com.lx.Log;
/**
* Created by douhua on 5/26/16.
*/
public class Solution344 {
public String reverseString(String s) {
char[] result = new char[s.length()];
int i = 0, j = s.length() - 1;
while(i<j) {
char a = s.charAt(i);
char b = s.charAt(j);
result[j] = a;
result[i] = b;
i++; j--;
}
if(i==j) {
result[i] = s.charAt(i);
}
return String.valueOf(result);
}
public static void test(){
Log.e((new Solution344()).reverseString("hello"));
}
}
| [
"xuzhengchaojob@gmail.com"
] | xuzhengchaojob@gmail.com |
656990be173cc144f416fc7df7ffe962689382bd | 97b8f7a58f8b577fa5b29f8c628bc96811756a20 | /BankingApp/src/test/java/com/nida/BankingAppApplicationTests.java | 843bf592f2ad5eaa5c50d2879a307cab2491ea8a | [] | no_license | nidasafiasyed/BankingApp | 3fed3ac490b832db3790668cc8db7a99b4ed8ded | b69f4dca24763b24f43e9c0c7218382c6581908a | refs/heads/master | 2022-11-13T12:25:49.556566 | 2020-07-01T13:29:38 | 2020-07-01T13:29:38 | 275,876,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package com.nida;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class BankingAppApplicationTests {
@Test
void contextLoads() {
}
}
| [
"nidasafia@hotmail.com"
] | nidasafia@hotmail.com |
af55fb4823ed86aab6eebb34a2ecd83b11da9227 | c15a8f88205697b7380226c6a8ade52bccaa88b5 | /src/main/java/biweekly/property/RequestStatus.java | fef463064bc96af64a80d39e21d30802a9481bfc | [
"BSD-2-Clause",
"BSD-2-Clause-Views"
] | permissive | drtobster/biweekly | 8fe65539bfb017d4bfef8d894943fc6606a50dcf | ef4ca3c595cac964aaf7d169c5c1bc8c62386b81 | refs/heads/master | 2020-12-26T04:55:40.083363 | 2016-07-11T02:47:49 | 2016-07-11T02:47:49 | 56,721,263 | 0 | 0 | null | 2016-04-20T21:11:33 | 2016-04-20T21:11:33 | null | UTF-8 | Java | false | false | 7,053 | java | package biweekly.property;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import biweekly.ICalVersion;
import biweekly.Warning;
import biweekly.component.ICalComponent;
/*
Copyright (c) 2013-2016, Michael Angstadt
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. 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 OWNER 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.
*/
/**
* <p>
* Represents a response to a scheduling request.
* </p>
* <p>
* This property must have a status code defined. The iCalendar specification
* defines the following status code families. However, these can have different
* meanings depending upon the type of scheduling request system being used
* (such as <a href="http://tools.ietf.org/html/rfc5546">iTIP</a>).
* </p>
* <ul>
* <li><b>1.x</b> - The request has been received, but is still being processed.
* </li>
* <li><b>2.x</b> - The request was processed successfully.</li>
* <li><b>3.x</b> - There is a client-side problem with the request (such as
* some incorrect syntax).</li>
* <li><b>4.x</b> - A scheduling error occurred on the server that prevented the
* request from being processed.</li>
* </ul>
* <p>
* <b>Code sample:</b>
* </p>
*
* <pre class="brush:java">
* VEvent event = new VEvent();
*
* RequestStatus requestStatus = new RequestStatus("2.0");
* requestStatus.setDescription("Success");
* event.setRequestStatus(requestStatus);
* </pre>
* @author Michael Angstadt
* @see <a href="http://tools.ietf.org/html/rfc5546#section-3.6">RFC 5546
* Section 3.6</a>
* @see <a href="http://tools.ietf.org/html/rfc5545#page-141">RFC 5545
* p.141-3</a>
* @see <a href="http://tools.ietf.org/html/rfc2445#page-134">RFC 2445
* p.134-6</a>
*/
public class RequestStatus extends ICalProperty {
private String statusCode, description, exceptionText;
/**
* Creates a request status property.
* @param statusCode the status code (e.g. "1.1.3")
*/
public RequestStatus(String statusCode) {
setStatusCode(statusCode);
}
/**
* Copy constructor.
* @param original the property to make a copy of
*/
public RequestStatus(RequestStatus original) {
super(original);
statusCode = original.statusCode;
description = original.description;
exceptionText = original.exceptionText;
}
/**
* Gets the status code. The following status code families are defined:
* <ul>
* <li><b>1.x</b> - The request has been received, but is still being
* processed.</li>
* <li><b>2.x</b> - The request was processed successfully.</li>
* <li><b>3.x</b> - There is a client-side problem with the request (such as
* some incorrect syntax).</li>
* <li><b>4.x</b> - A server-side error occurred.</li>
* </ul>
* @return the status code (e.g. "1.1.3")
*/
public String getStatusCode() {
return statusCode;
}
/**
* Sets a status code. The following status code families are defined:
* <ul>
* <li><b>1.x</b> - The request has been received, but is still being
* processed.</li>
* <li><b>2.x</b> - The request was processed successfully.</li>
* <li><b>3.x</b> - There is a client-side problem with the request (such as
* some incorrect syntax).</li>
* <li><b>4.x</b> - A server-side error occurred.</li>
* </ul>
* @param statusCode the status code (e.g. "1.1.3")
*/
public void setStatusCode(String statusCode) {
this.statusCode = statusCode;
}
/**
* Gets the human-readable description of the status.
* @return the description (e.g. "Success") or null if not set
*/
public String getDescription() {
return description;
}
/**
* Sets a human-readable description of the status.
* @param description the description (e.g. "Success") or null to remove
*/
public void setDescription(String description) {
this.description = description;
}
/**
* Gets any additional data related to the response.
* @return the additional data or null if not set
*/
public String getExceptionText() {
return exceptionText;
}
/**
* Sets any additional data related to the response.
* @param exceptionText the additional data or null to remove
*/
public void setExceptionText(String exceptionText) {
this.exceptionText = exceptionText;
}
@Override
public String getLanguage() {
return super.getLanguage();
}
@Override
public void setLanguage(String language) {
super.setLanguage(language);
}
@Override
protected void validate(List<ICalComponent> components, ICalVersion version, List<Warning> warnings) {
if (statusCode == null) {
warnings.add(Warning.validate(36));
}
}
@Override
protected Map<String, Object> toStringValues() {
Map<String, Object> values = new LinkedHashMap<String, Object>();
values.put("statusCode", statusCode);
values.put("description", description);
values.put("exceptionText", exceptionText);
return values;
}
@Override
public RequestStatus copy() {
return new RequestStatus(this);
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((exceptionText == null) ? 0 : exceptionText.hashCode());
result = prime * result + ((statusCode == null) ? 0 : statusCode.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (!super.equals(obj)) return false;
RequestStatus other = (RequestStatus) obj;
if (description == null) {
if (other.description != null) return false;
} else if (!description.equals(other.description)) return false;
if (exceptionText == null) {
if (other.exceptionText != null) return false;
} else if (!exceptionText.equals(other.exceptionText)) return false;
if (statusCode == null) {
if (other.statusCode != null) return false;
} else if (!statusCode.equals(other.statusCode)) return false;
return true;
}
}
| [
"mike.angstadt@gmail.com"
] | mike.angstadt@gmail.com |
9474f81958d57199ca4549123ba4bfc289645a45 | 7f52ec74ee5072a36d12eda94777a96fb6b3dd2d | /src/holamundo1/HolaMundo1.java | 9179e662dd4ecba27c2e2418d31df1ae2f66a8b0 | [] | no_license | creiden100/GithubHolaMundo1 | 8b872a48656099231ea4e09b2e0e307358404312 | 3c5d8a174770ef886e51c28761e7d68179c2abb4 | refs/heads/master | 2021-01-01T17:55:44.941843 | 2017-07-24T15:19:54 | 2017-07-24T15:19:54 | 98,203,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | 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 holamundo1;
/**
*
* @author LabingXEON
*/
public class HolaMundo1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.err.println("Hola mundo");
}
}
| [
"LabingXEON@LabingXEON-PC"
] | LabingXEON@LabingXEON-PC |
88dd61a65916bb12ec1d37e0dbe82aa84753555d | bc6aba53d4d36477058ee76b49b5639fbaf72e09 | /src/main/java/com/bruno/course/entities/pk/OrderItemPK.java | b5ca9ff73a3c61046c57c5fc856ae9402386b043 | [] | no_license | BrunoRodriguesN/courseSpring | fe8b570b201660793050446e2ee62f68028b8fba | fba1bfacb1f243938f2a0551b1a34998f4f03a7d | refs/heads/master | 2023-05-06T21:34:32.235191 | 2021-05-28T15:48:36 | 2021-05-28T15:48:36 | 371,041,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,501 | java | package com.bruno.course.entities.pk;
import java.io.Serializable;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import com.bruno.course.entities.Order;
import com.bruno.course.entities.Product;
@Embeddable
public class OrderItemPK implements Serializable {
private static final long serialVersionUID = 1L;
@ManyToOne
@JoinColumn(name = "order_id")
private Order order;
@ManyToOne
@JoinColumn(name = "product_id")
private Product product;
public Order getOrder() {
return order;
}
public void setOrder(Order order) {
this.order = order;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((order == null) ? 0 : order.hashCode());
result = prime * result + ((product == null) ? 0 : product.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OrderItemPK other = (OrderItemPK) obj;
if (order == null) {
if (other.order != null)
return false;
} else if (!order.equals(other.order))
return false;
if (product == null) {
if (other.product != null)
return false;
} else if (!product.equals(other.product))
return false;
return true;
}
}
| [
"bruno_adeira@hotmail.com"
] | bruno_adeira@hotmail.com |
8f9becaed6d07385dfea091530d488796a2ec5a3 | 3393c3ea7ff42d0a6cab615ce2fa83878531f088 | /sliding/app/src/main/java/org/androidtown/palette_sliding/NetworkSender.java | 67d770d5a0a5ce7403829fe7ce057336769b8da8 | [] | no_license | jinwook1240/Obj_Termproject | 58259e3953e3d377a427c15f15087816ebe5fcea | 64dfd3ba67d38f3c7e74ba4749ef53baf10e80e0 | refs/heads/master | 2021-09-26T21:43:35.215872 | 2017-12-09T08:38:20 | 2017-12-09T08:38:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package org.androidtown.palette_sliding;
/**
* Created by chm31 on 2017-11-26.
*/
public class NetworkSender extends Thread implements BackgroundSender {
@Override
public void run() {
}
@Override
public void send(String s) {
// TODO Auto-generated method stub
}
}
| [
"clplanet26@gmail.com"
] | clplanet26@gmail.com |
844ab732132282149a97d46084f2f20c5a573087 | a38346de8c093dabf3490b8dbd76f70846b4c7c6 | /.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/DBproject/org/apache/jsp/v2/List_jsp.java | 50291307cba99b98560d32a58efbbd1a6ffa96a8 | [] | no_license | lty516/jspwork | 317d96036a59014fa1ab9dea10d2c9358f023db2 | 8118666d35157c3b15b9f67495015ed9d27ef275 | refs/heads/master | 2022-12-14T05:58:51.206078 | 2020-09-03T13:39:24 | 2020-09-03T13:39:24 | 292,570,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,487 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/9.0.37
* Generated at: 2020-08-19 05:50:54 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.v2;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import dbcp.DBConnectionMgr;
public final class List_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("java.sql");
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = new java.util.HashSet<>();
_jspx_imports_classes.add("dbcp.DBConnectionMgr");
}
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
if (!javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
final java.lang.String _jspx_method = request.getMethod();
if ("OPTIONS".equals(_jspx_method)) {
response.setHeader("Allow","GET, HEAD, POST, OPTIONS");
return;
}
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method)) {
response.setHeader("Allow","GET, HEAD, POST, OPTIONS");
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSP들은 오직 GET, POST 또는 HEAD 메소드만을 허용합니다. Jasper는 OPTIONS 메소드 또한 허용합니다.");
return;
}
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=euc-kr");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("<HTML>\r\n");
out.write("<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
out.write("<script>\r\n");
out.write(" function check(){\r\n");
out.write(" if(document.search.keyWord.value == \"\"){\r\n");
out.write(" alert(\"검색어를 입력하세요.\");\r\n");
out.write(" document.search.keyWord.focus();\r\n");
out.write(" return;\r\n");
out.write(" }\r\n");
out.write(" document.search.submit();\r\n");
out.write(" }\r\n");
out.write("</script>\r\n");
out.write("<BODY>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("<center><br>\r\n");
out.write("<h2>JSP Board</h2>\r\n");
out.write("\r\n");
out.write("<table align=center border=0 width=80%>\r\n");
out.write("<tr>\r\n");
out.write(" <td align=left>Total : Articles(\r\n");
out.write(" <font color=red> 1 / 10 Pages </font>)\r\n");
out.write(" </td>\r\n");
out.write("</tr>\r\n");
out.write("</table>\r\n");
out.write("\r\n");
out.write("<table align=center width=80% border=0 cellspacing=0 cellpadding=3>\r\n");
out.write("<tr>\r\n");
out.write(" <td align=center colspan=2>\r\n");
out.write(" <table border=0 width=100% cellpadding=2 cellspacing=0>\r\n");
out.write(" <tr align=center bgcolor=#D0D0D0 height=120%>\r\n");
out.write(" <td> 번호 </td>\r\n");
out.write(" <td> 제목 </td>\r\n");
out.write(" <td> 이름 </td>\r\n");
out.write(" <td> 날짜 </td>\r\n");
out.write(" <td> 조회수 </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <!-- 글 목록 출력 -->\r\n");
out.write(" ");
request.setCharacterEncoding("euc-kr");
String keyField = request.getParameter("keyField");
String keyWord = request.getParameter("keyWord");
String sql = null;
DBConnectionMgr pool = null;
Connection con = null;
Statement stmt=null;
ResultSet rs = null;
try{
pool = DBConnectionMgr.getInstance();
con = pool.getConnection();
if(keyWord == null || keyWord.equals("") || keyWord.isEmpty()){
sql = "select * from tblboard";
}
else{
sql="select * from tblboard where " + keyField + " like '%" + keyWord + "%'";
}
stmt = con.createStatement();
rs= stmt.executeQuery(sql);
while(rs.next()){
out.write("\r\n");
out.write("\r\n");
out.write(" <tr>\r\n");
out.write(" <td>");
out.print(rs.getInt("b_num") );
out.write("</td>\r\n");
out.write(" <td><a href ='Read.jsp?b_num=");
out.print(rs.getInt("b_num"));
out.write('\'');
out.write('>');
out.print(rs.getString("b_subject") );
out.write("</a></td>\r\n");
out.write(" <td>");
out.print(rs.getString("b_name") );
out.write("</td>\r\n");
out.write(" <td>");
out.print(rs.getString("b_regdate") );
out.write("</td>\r\n");
out.write(" <td>");
out.print(rs.getInt("b_count") );
out.write("</td>\r\n");
out.write(" </tr> \r\n");
}
}
catch(Exception err){
err.printStackTrace();
}
finally{
pool.freeConnection(con,stmt,rs);
}
out.write(" \r\n");
out.write(" \r\n");
out.write(" \r\n");
out.write(" \r\n");
out.write(" </table>\r\n");
out.write(" </td>\r\n");
out.write("</tr>\r\n");
out.write("<tr>\r\n");
out.write(" <td><BR><BR></td>\r\n");
out.write("</tr>\r\n");
out.write("<tr>\r\n");
out.write(" <td align=\"left\">Go to Page </td>\r\n");
out.write(" <td align=right>\r\n");
out.write(" <a href=\"Post.jsp\">[글쓰기]</a>\r\n");
out.write(" <a href=\"javascript:list()\">[처음으로]</a>\r\n");
out.write(" </td>\r\n");
out.write("</tr>\r\n");
out.write("</table>\r\n");
out.write("<BR>\r\n");
out.write("<form action=\"List.jsp\" name=\"search\" method=\"post\">\r\n");
out.write(" <table border=0 width=527 align=center cellpadding=4 cellspacing=0>\r\n");
out.write(" <tr>\r\n");
out.write(" <td align=center valign=bottom>\r\n");
out.write(" <select name=\"keyField\" size=\"1\">\r\n");
out.write(" <option value=\"b_name\"> 이름\r\n");
out.write(" <option value=\"b_subject\"> 제목\r\n");
out.write(" <option value=\"b_content\"> 내용\r\n");
out.write(" </select>\r\n");
out.write("\r\n");
out.write(" <input type=\"text\" size=\"16\" name=\"keyWord\" >\r\n");
out.write(" <input type=\"button\" value=\"찾기\" onClick=\"check()\">\r\n");
out.write(" <input type=\"hidden\" name=\"page\" value= \"0\">\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write("</form>\r\n");
out.write("</center> \r\n");
out.write("</BODY>\r\n");
out.write("</HTML>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"song159951@naver.com"
] | song159951@naver.com |
22a91d0c4330fac6a654f6176a4712461f725715 | f4359c7455f2305b4d6395ae242f0f54f3bf3990 | /src/main/java/com/example/demo/config/security/ResourceServerConfig.java | bda47bf91b3b11a86edbed27e540c08ed170a2e4 | [] | no_license | 1InfinityDoesExist/KulizaAssignment1 | 04b216fdd3752acffef90667cff1cc2ad4a60ef6 | d8d5a9314d0b0319c291677ec02cb04abc617a86 | refs/heads/master | 2022-10-20T17:40:19.305550 | 2021-05-15T16:08:22 | 2021-05-15T16:08:22 | 227,674,842 | 0 | 2 | null | 2022-10-05T18:23:11 | 2019-12-12T18:50:03 | Java | UTF-8 | Java | false | false | 358 | java | package com.example.demo.config.security;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
}
| [
"patelavinash508@gmail.com"
] | patelavinash508@gmail.com |
697fb12bdb6c3ca8d33b899abf8b4428336b01ed | df88a6d13a0a58ddfdea420f7aa63e476ba05053 | /code/app/src/test/java/com/example/xiaohanhan/concentration/ExampleUnitTest.java | e962025dfc7c9fef7708d018b7e9b60c2a06c8ae | [] | no_license | SSPU-SCZSW/Concentration | c7c8316ba4506969047a958253d34dd1244ae6ec | f101cb7c9bab8ddde928a2ea1704072c497c4b81 | refs/heads/master | 2020-04-02T12:57:42.754918 | 2019-01-08T12:22:07 | 2019-01-08T12:22:07 | 154,460,196 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package com.example.xiaohanhan.concentration;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"chuxubank@qq.com"
] | chuxubank@qq.com |
7ed9bb6a67059760bd2413ddc3496354e216ddf6 | d7b4a81affd0f2563792a37d4dd74ff83a32a6f3 | /src/main/java/com/dataexo/zblog/controller/MainController.java | c0f92e6cabf8368b18673b9bceb0fae0b8ecae79 | [] | no_license | dinhdev/Datastore | d8138e3e56f993527ae0fbefa453b0731bfefd31 | d616f7b930b8a359a08bcdfd279a3d37f0943128 | refs/heads/master | 2022-11-23T04:07:43.435381 | 2020-01-28T05:23:08 | 2020-01-28T05:23:08 | 236,583,387 | 0 | 0 | null | 2022-11-16T04:37:02 | 2020-01-27T20:08:59 | JavaScript | UTF-8 | Java | false | false | 24,456 | java | package com.dataexo.zblog.controller;
import com.dataexo.zblog.service.*;
import com.dataexo.zblog.util.Md5Util;
import com.dataexo.zblog.util.ResultInfoFactory;
import com.dataexo.zblog.util.UtilClass;
import com.dataexo.zblog.util.VerifyCaptcha;
import com.dataexo.zblog.vo.*;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.crypto.Data;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
@Controller
public class MainController extends AbstractController {
private static final Logger logger = Logger.getLogger(MainController.class);
@Value("${captcha.secretkey}")
public String captcha_secretkey;
@Value("${ssoauth.auth_url}")
public String ssoAuthUrl;
@Value("${ssoauth.logout}")
public String logout;
@Value("${ssoauth.jforum_url}")
public String jforum_url;
@Value("${ssoauth.login_url}")
public String login_url;
@Value("${address.domain}")
public String domain;
@Value("${address.domain}")
public String baseDomain;
@Value("${address.email}")
public String support_email;
@Value("${token.auth.timeout}")
public int tokenAuthTimeout;
@Value("${ssoauth.permit_url}")
public String ssoPermitUrl;
@Value("${paypal.mode}")
public String paypalMode;
@Value("${paypal.client.app}")
public String paypalClientId;
@Value("${server.mode}")
public String serverMode;
@Resource
private Data_categoryService data_categoryService;
@Resource
private ThirdPartyService thirdPartyService;
@Resource
private Price_modelService price_modelService; //price_model
@Resource
private Asset_classService asset_classService; //asset_class
@Resource
private Data_typeService data_typeService; //data_type
@Resource
private RegionService regionService; //region
@Resource
private PublisherService publisherService; //publisher
@Resource
private BucketService bucketService; //publisher
@Resource
private UserService userService;
@Resource
private TokenService tokenService;
@Resource
private Pay_orderService pay_orderService;
@Resource
private Data_setsService data_setsService;
@Resource
private VendorService vendorService;
@Resource
private Pay_SourceService pay_sourceService;
/**
* This is landing page for dataexo.
*
* @param model
* @param request
* @param response
* @param session
* @return
*/
@RequestMapping("/")
public String index(Model model
, HttpServletRequest request
, HttpServletResponse response
, HttpSession session){
/////// Check SSO Authentication//////////
String token = request.getParameter("token");
String apikey = request.getParameter("apikey");
String redirect_from = request.getParameter("redirect");
User userinfo = (User) session.getAttribute("user");
if(userinfo == null) {
if (token == null) {
try {
String new_token = UUID.randomUUID().toString().toLowerCase();
String redirect = URLEncoder.encode(domain + request.getServletPath(), "UTF-8");
return "redirect:" + ssoAuthUrl + "?redirect=" + redirect + "&token=" + new_token;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
logger.error( "encoding isssue:" , e);
return "error/500.html";
}
}
if (apikey != null) {
User user = userService.loadUserByApiKey(apikey);
if(user != null){
session.setAttribute("user", user);
}
if(redirect_from != null) {
if (!redirect_from.equals("")) {
return "redirect:" + redirect_from;
}
}
}
}
/////////////////////
baseRequest(session, model);
List<Data_category> list = data_categoryService.findAll();
List<Data_category> showList = new ArrayList<Data_category>();
int len = 4;
if(list.size() < len){
len = list.size();
}
for(int i = 0 ; i < len ; i ++){
showList.add(list.get(i));
}
model.addAttribute("subdata_categoryList" , showList);
Pager pager = new Pager();
pager.setSearch_str("");
pager.setStart(0);
pager.setLimit(6);
List<Data_sets> data_setsList = data_setsService.loadData_sets(pager , null);
if(data_setsList.size() < 6 && data_setsList.size() != 0){
len = 6 - data_setsList.size();
for(int i = 0 ; i < len ; i ++ ){
data_setsList.add(data_setsList.get(i));
}
}
model.addAttribute("dataSetFeatureList" , data_setsList);
pager.setLimit(4);
data_setsList = data_setsService.loadData_sets(pager , null);
if(data_setsList.size() < 4 && data_setsList.size() != 0){
len = 4 - data_setsList.size();
for(int i = 0 ; i < len ; i ++ ){
data_setsList.add(data_setsList.get(i));
}
}
model.addAttribute("dataSetTopSellList" , data_setsList);
return "index";
}
/**
* This is about us page.
* In this page , we can show about company information
* @param model
* @param request
* @param response
* @param session
* @return
*/
@RequestMapping("/aboutus")
public String aboutus(Model model
, HttpServletRequest request
, HttpServletResponse response
, HttpSession session){
logger.debug("aboutus");
baseRequest(session,model);
return "aboutus";
}
@RequestMapping("/privacy")
public String privacy(Model model
, HttpServletRequest request
, HttpServletResponse response
, HttpSession session){
baseRequest(session,model);
return "privacy_policy";
}
/**
* This is waht we do page.
* @param model
* @param request
* @param response
* @param session
* @return
*/
@RequestMapping("/whatwedo")
public String whatwedo(Model model
, HttpServletRequest request
, HttpServletResponse response
, HttpSession session){
logger.debug("whatwedo");
baseRequest(session,model);
return "what_we_do";
}
//todo
@RequestMapping("/cateid/{cateid}")
public String catelist(@PathVariable String cateid, Model model, HttpServletRequest request , HttpServletResponse response, HttpSession session){
baseRequest(session,model);
logger.debug("data browser page by cateid");
List<Price_model> price_modelsList = (List<Price_model>) session.getAttribute("price_modelsList");
if(price_modelsList == null){
price_modelsList = price_modelService.findAll();
session.setAttribute("price_modelsList", price_modelsList);
}
List<Asset_class> assetClassList = (List<Asset_class>) session.getAttribute("assetClassList");
if(assetClassList == null){
assetClassList = asset_classService.findAll();
session.setAttribute("assetClassList", assetClassList);
}
List<Data_type> dataTypeList = (List<Data_type>) session.getAttribute("dataTypeList");
if(dataTypeList == null){
dataTypeList = data_typeService.findAll();
session.setAttribute("dataTypeList", dataTypeList);
}
List<Region> regionList = (List<Region>) session.getAttribute("regionList");
if(regionList == null){
regionList = regionService.findAll();
session.setAttribute("regionList", regionList);
}
List<Publisher> publisherList = (List<Publisher>) session.getAttribute("publisherList");
if(publisherList == null){
publisherList = publisherService.findAll();
session.setAttribute("publisherList", publisherList);
}
List<Vendors> vendorsList = (List<Vendors>) session.getAttribute("vendorsList");
if(vendorsList == null){
vendorsList = vendorService.getAvailableVendors();
session.setAttribute("vendorList", vendorsList);
}
model.addAttribute("cateid",cateid);
model.addAttribute("price_modelsList",price_modelsList);
model.addAttribute("asset_classList",assetClassList);
model.addAttribute("data_typeList",dataTypeList);
model.addAttribute("regionList",regionList);
model.addAttribute("publisherList",publisherList);
model.addAttribute("vendorList",vendorsList);
return "dataset/data_browser";
}
@RequestMapping("/sso_login/redirect")
public String sso_login(HttpServletRequest request
, Model model
, HttpSession session){
String redirect = "";
String new_token = UUID.randomUUID().toString().toLowerCase();
try {
Token token_model = new Token();
token_model.setToken(new_token);
token_model.setExpire((System.currentTimeMillis() + 1000 * 60 * 10) + "");
tokenService.insertToken(token_model);
redirect = URLEncoder.encode(domain,"UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
logger.error( "encoding isssue:" , e);
return "error/500";
}
String session_id = session.getId();
return "redirect:" + login_url + "?redirect=" + redirect + "&token=" + new_token + "&session_id=" + session_id;
}
@RequestMapping("/login/sso")
public String login_sso(Model model
, HttpServletRequest request
, HttpServletResponse response
, HttpSession session) throws UnsupportedEncodingException {
String apiKey = request.getParameter("apikey");
String token = request.getParameter("token");
String redirect = request.getParameter("redirect");
if(token == null || apiKey == null){
return "error/permission";
}
Token current_token = tokenService.getByToken(token);
if (current_token == null) {
return "error/permission";
}
long current_time = System.currentTimeMillis();
long diff = current_time - Long.parseLong(current_token.getExpire());
if (diff > 0) {
return "error/permission";
}
if(redirect == null){
return "error/permission";
}
User user = userService.loadUserByApiKey(apiKey);
Bucket bucket = new Bucket();
bucket.setSession_id(session.getId());
bucket.setUserid(Integer.parseInt(""+user.getId()));
bucketService.updateBucketInfo(bucket);
bucketService.updateBucketInfoById(bucket);
session.setAttribute("user", user);
return "redirect:" + URLDecoder.decode(redirect, "UTF-8");
}
@RequestMapping("/cateid")
public String home1(Model model){
return "redirect:/cateid/1";
}
/**
* 跳转到登录页面
* @return
*/
@RequestMapping("/login")
public String loginPage(HttpSession session,Model model, HttpServletRequest request){
User adminuser = (User) session.getAttribute("adminuser");
if(adminuser != null){
return "redirect:/admin/user/list";
}
////////
// admin
// F3270B464E2742776A723472B71D9A0E: abc123
// dex-admin
// B06EBCB2AB58D8A05A36261DC0EDF927: dex-p8d$
model.addAttribute("sitekey",captcha_sitekey);
return "login";
}
@RequestMapping("/adminlogin")
public String adminloginPage(@RequestParam("g-recaptcha-response") String captcha,
@RequestParam("username") String username,
@RequestParam("password") String password ,
HttpServletRequest request,
HttpSession session, Model model){
model.addAttribute("sitekey",captcha_sitekey);
Boolean captcha_result = false;
String userAgent = request.getHeader("User-Agent");
try {
captcha_result = VerifyCaptcha.verify(captcha, userAgent,captcha_secretkey);
} catch (IOException e) {
e.printStackTrace();
logger.error( "Captcha error:" , e);
captcha_result =false;
}
if(!captcha_result){
return "login";
}
else {
User adminuser = userService.loadUserByUsername(username);
if(adminuser == null){
return "login";
}
String pass = Md5Util.pwdDigest(password);
if(!adminuser.getPassword().equals(pass)){
return "login";
}
if(adminuser.getId() != 1){
return "login";
}
session.setAttribute("adminuser",adminuser);
}
return "redirect:/admin/user/list";
}
@RequestMapping("/admin")
public String adminPage(){
return "redirect:/login";
}
/**
* Reset password page
* @param userid : the user id when user sent forgotten password request
* @param token : the user token when user sent forgotten password request
* @param model
* @param session
* @return String
*/
@RequestMapping(value = "/ForgotPassword/newPassword/{userid}/{token}", method = RequestMethod.GET)
public String setNewPassword(@PathVariable String userid
, @PathVariable String token,Model model, HttpSession session){
logger.debug("Forgot password for user");
Token tokenModel = tokenService.getByToken(token);
if(tokenModel == null){
return "error/permission";
}
long cur = System.currentTimeMillis();
if(cur > Long.parseLong(tokenModel.getExpire())){
return "error/token_expire";
}
baseRequest(session,model);
User userinfo = userService.loadUserById(Long.parseLong(userid));
if(userinfo == null){
return "error/permission";
}
List<Price_model> price_modelsList = price_modelService.findAll();
List<Asset_class> assetClassList= asset_classService.findAll();
List<Data_type> dataTypeList= data_typeService.findAll();
List<Region> regionList= regionService.findAll();
List<Publisher> publisherList= publisherService.findAll();
String ssotoken = UUID.randomUUID().toString().toUpperCase() + System.currentTimeMillis();
long expire = System.currentTimeMillis() + 1000 * 60 * tokenAuthTimeout;
com.dataexo.zblog.vo.Token token_class = new com.dataexo.zblog.vo.Token();
token_class.setExpire("" + expire);
token_class.setToken(ssotoken);
tokenService.insertToken(token_class);
String redirect = "";
try {
redirect = URLEncoder.encode(baseDomain, java.nio.charset.StandardCharsets.UTF_8.toString());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String requestUrl = ssoPermitUrl + "?token=" + token + "&redirect=" + redirect + "&apiKey="+userinfo.getApiKey();
// return "redirect:"+requestUrl;
model.addAttribute("forgetSSOPermit",requestUrl);
model.addAttribute("cateid",1);
model.addAttribute("price_modelsList",price_modelsList);
model.addAttribute("asset_classList",assetClassList);
model.addAttribute("data_typeList",dataTypeList);
model.addAttribute("regionList",regionList);
model.addAttribute("publisherList",publisherList);
model.addAttribute("resetPassword","1");
model.addAttribute("user_email",userinfo.getEmail());
model.addAttribute("token",token);
return "index";
}
@RequestMapping("/error_download")
public String error_download(){
return "error/download";
}
@RequestMapping("/contactus")
public String contactus(HttpSession session, Model model){
baseRequest(session,model);
return "contactus";
}
@RequestMapping("/documentation/main")
public String DocHelp(HttpSession session, Model model){
baseRequest(session,model);
model.addAttribute("jforum_url" , jforum_url);
model.addAttribute("support_email" , support_email);
return "documentation/main";
}
/**
* This function is for user logout.
* @param session
* @return
*/
@RequestMapping(value = "/user/logout", method = RequestMethod.GET)
public String logout(HttpServletRequest request , HttpSession session) {
logger.debug("logout for user");
boolean flag = true;
try {
String link = jforum_url + "/jforum.page?module=ajax&action=ssologout";
UtilClass.sendGet(link, serverMode);
} catch (Exception e) {
e.printStackTrace();
logger.error( "jforum connection error:" , e);
}
String redirect = "";
try {
redirect = URLEncoder.encode(domain , "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
logger.error( e);
}
session.removeAttribute("user");
return "redirect:" + logout + "?redirect=" + redirect;
}
@RequestMapping("/user/insert/api")
public String addNewUser(HttpServletRequest request
, HttpServletResponse response
, HttpSession session
, Model model){
String username = request.getParameter("username");
String upassword = request.getParameter("password");
upassword = upassword.replaceAll("%10","#");
String email = request.getParameter("email");
String token = request.getParameter("token");
Token token_model = tokenService.getByToken(token);
if(token_model == null){
return "error/permission";
}
User userInfo = userService.loadUserByUsername(username);
if (userInfo == null) {
userInfo = userService.loadUserByEmail(email);
if (userInfo == null) {
String password = Md5Util.pwdDigest(upassword);
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
User user = new User();
user.setUsername(username);
user.setEmail(email);
user.setCreateTime(dateFormat.format(date));
user.setPassword(password);
token = UUID.randomUUID().toString().toLowerCase();
user.setToken(token);
user.setApiKey(UtilClass.generateAPIKey());
userService.insertUserInfo(user);
String url = jforum_url + "/jforum.page?module=ajax&action=ssoinsert";
String key_data = UUID.randomUUID().toString().toLowerCase();
String enc_data = null;
try {
enc_data = Md5Util.pwdDigest(key_data);
String param = "&username="+user.getUsername() + "&email="+user.getEmail();
param += "&enc_data="+enc_data + "&key_data="+key_data + "&password=" + user.getPassword() ;
UtilClass.sendGet(url + param, serverMode);
} catch (Exception e) {
e.printStackTrace();
logger.error( e);
}
// session.setAttribute("user",user);
} else {
return "error/permission";
}
} else {
return "error/permission";
}
return "redirect:/";
}
@RequestMapping("/payment/{order_id}")
public String payment(@PathVariable Integer order_id
, HttpServletResponse response
, HttpSession session
, Model model){
logger.debug("payment page");
if(!baseRequest(session,model)){
return "redirect:/";
}
if(order_id == 0){
return "redirect:/";
}
////////// get pay sources ///////////
User user = (User) session.getAttribute("user");
Pager pager = new Pager();
pager.setUser_id(Integer.parseInt("" + user.getId()));
List<Pay_sources> sourceList = pay_sourceService.loadPay_Source(pager);
model.addAttribute("sourceList" , sourceList);
///////////////////
Pay_order pay_order = pay_orderService.getPayOrder(order_id);
Token tokenModel = tokenService.getByToken(pay_order.getToken());
long current_time = System.currentTimeMillis();
long diff = current_time - Long.parseLong(tokenModel.getExpire());
if (diff > 0) {
return "error/token_expire";
}
if(pay_order.getDataset_ids().equals("-1")){
model.addAttribute("mode" , "membership");
}
Double discount = 0.0;
Double finalAmount = (double)pay_order.getAmount();
Double amount = finalAmount;
if(pay_order.getMembership_id().equals("-1")){
amount = 0.0;
model.addAttribute("mode" , "checkout");
String [] datasets_id = pay_order.getDataset_ids().split(",");
if(datasets_id != null) {
for (String dataset_id : datasets_id) {
amount += data_setsService.getData_setsById(Integer.parseInt(dataset_id)).getOnetime_price();
}
}
discount = amount - finalAmount;
}
DecimalFormat formatter = new DecimalFormat("#0.00");
model.addAttribute("discount_amount", formatter.format(discount));
model.addAttribute("amount" , formatter.format(amount));
model.addAttribute("final_amount", formatter.format(finalAmount));
model.addAttribute("order_id" , pay_order.getId());
model.addAttribute("paypalMode", paypalMode);
model.addAttribute("paypalClientId", paypalClientId);
return "payment";
}
@RequestMapping("/sendmail")
public String sendmail(HttpServletResponse response
, HttpSession session1
, Model model) throws Exception{
// Create a Properties object to contain connection configuration information.
String body = "<h1>Amazon SES SMTP Email Test</h1><p>This email was sent with Amazon SES using the <a href='https://github.com/javaee/javamail'>Javamail Package</a>for <a href='https://www.java.com'>Java</a>.";
thirdPartyService.sendAwsSes("wangyi_1986@hotmail.com", "service@dataexo.com" , "Testing" , body);
return "ok";
}
@RequestMapping("/documentation/dataexo")
public String doc_dataexo(HttpSession session, Model model){
baseRequest(session,model);
return "documentation/dataexo";
}
@RequestMapping("/documentation/analyze")
public String doc_analyze(HttpSession session, Model model){
baseRequest(session,model);
return "documentation/zeppelin";
}
}
| [
"dinhdotechdev@gmail.com"
] | dinhdotechdev@gmail.com |
2d4998178a87701c9c84f7b7e54387493d484f2d | a710c75fa94d4a29d708bc0f4f07fe4417caa481 | /Bola.java | ef41f7e055b96a862d0ecdff2fb707236e288bf7 | [] | no_license | muhammadfauzanfadhlulbarr/PBO10K-10119176-Latihan-61-Bangun-Ruang | 629b1afb6b6c84a97e5b03fbaf5de3029b507d8a | 26e34a8a058dcb2ad644eebb797a49df1aeea822 | refs/heads/master | 2023-01-14T05:39:13.578117 | 2020-11-22T03:18:08 | 2020-11-22T03:18:08 | 314,948,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | /**
* Latihan61
* Nama : Muhammad Fauzan Fadhlulbarr
* Kelas : PBO10K
* NIM : 10119176
* Program : Bangun Ruang
*/
public class Bola extends BangunRuang{
public double hitungVolume(double jari2, double tinggi){
return 4/(float)3 * Math.PI * Math.pow(jari2, 3);
}
}
| [
"muhammadfauzanfadhlulbarr@gmail.com"
] | muhammadfauzanfadhlulbarr@gmail.com |
8c48876ddb1bae57a8a0ef125ca9dea32c1be07d | d1c9c2add3335191fb8e82c7db6892526c5ae57e | /guli-common/src/main/java/com/guli/common/handle/GlobalExceptionHandler.java | ce4cd6ff0da1da2249bbf3361fdb109a5496c552 | [] | no_license | IceChen8/atguigu_guli | d32466a6f2104d85ec4905f4c671c1577a9bb53a | 001e8961fd99257a53b4f0d9a7dc7e1f24640f84 | refs/heads/master | 2022-06-30T17:12:02.301599 | 2020-01-14T07:19:05 | 2020-01-14T07:19:05 | 233,780,706 | 0 | 0 | null | 2022-06-29T17:54:31 | 2020-01-14T07:18:22 | Java | UTF-8 | Java | false | false | 1,620 | java | package com.guli.common.handle;
import com.guli.common.exception.GuliException;
import com.guli.common.util.ExceptionUtil;
import com.guli.common.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 统一异常处理类
*/
@Slf4j
@ControllerAdvice //它是一个Controller增强器,可对controller中被 @RequestMapping注解的方法加一些逻辑处理。最常用的就是异常处理
public class GlobalExceptionHandler {
/**
* 进行捕获异常方法
* @param e
* @return
*/
@ExceptionHandler(Exception.class)
@ResponseBody
public Result error(Exception e){
e.printStackTrace();
log.error(e.getMessage());
return Result.error().message("Exception异常处理");
}
/**
* 对特殊异常进行处理
* @param e
* @return
*/
@ExceptionHandler(ArithmeticException.class)
@ResponseBody
public Result error(ArithmeticException e){
e.printStackTrace();
log.error(e.getMessage());
return Result.error().message("ArithmeticException异常处理");
}
/**
* 对自定义异常进行处理
* @param e
* @return
*/
@ExceptionHandler(GuliException.class)
@ResponseBody
public Result error(GuliException e){
e.printStackTrace();
log.error(ExceptionUtil.getMessage(e));
return Result.error().code(e.getCode()).message(e.getMessage());
}
}
| [
"858431153@qq.com"
] | 858431153@qq.com |
07473f7383e8460387463a6d59ff22f55f1a9190 | 693f7b1e553c926f865d591bfedc391982dbf280 | /PogamutUT2004/src/test/java/cz/cuni/amis/pogamut/ut2004/bot/navigation2/UT2004Test227_CTFColossus_JumpDown.java | a5746800ec4ce090d050ed3a809c340f2da53e9f | [] | no_license | bogo777/navigation-evaluation | 56888f40e411561617cc3cab497934b128da17b4 | f3ab1fee146fa0b3bf408684ee308566c0157742 | refs/heads/master | 2020-05-17T05:16:43.662531 | 2014-05-30T12:23:41 | 2014-05-30T12:23:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,332 | java | package cz.cuni.amis.pogamut.ut2004.bot.navigation2;
import cz.cuni.amis.pogamut.ut2004.bot.UT2004BotTest;
import org.junit.Test;
/**
*
* @author Peta Michalik
*/
public class UT2004Test227_CTFColossus_JumpDown extends UT2004BotTest {
@Override
protected String getMapName() {
return "CTF-Colossus";
}
@Override
protected String getGameType() {
return "BotDeathMatch";
}
@Test
public void test227_jumpdown_1_time() {
startTest(
// use NavigationTestBot for the test
Navigation2TestBot.class,
// timeout: 1 minute
1,
// test movement between start: CTF-Colossus.PlayerStart0, end: CTF-Colossus.PathNode576 number of repetitions both ways
new Navigation2TestBotParameters("CTF-Colossus.PlayerStart0", "CTF-Colossus.PathNode576", 1, false)
);
}
@Test
public void test227_jumpdown_20_time() {
startTest(
// use NavigationTestBot for the test
Navigation2TestBot.class,
// timeout: 4 minutes
4,
// test movement between start: CTF-Colossus.PlayerStart0, end: CTF-Colossus.PathNode576 number of repetitions both ways
new Navigation2TestBotParameters("CTF-Colossus.PlayerStart0", "CTF-Colossus.PathNode576", 20, false)
);
}
}
| [
"bmachac@2cdb6f53-bab2-4d57-a78b-cc29d6e59011"
] | bmachac@2cdb6f53-bab2-4d57-a78b-cc29d6e59011 |
88ff1f5b4ccce7341853ca99aa79f11fc40176d3 | 4195f102e9d8dc38fb2fea4042a4df6cc0a9c3f2 | /osid/code/src/com/tle/osidimpl/repository/equella/Type.java | 03902f82a2c7c26c8f398a4e8b21c9f470b24634 | [] | no_license | DFFlanders/jisc-source | fb48f3030f1bcc3731601fa0f78629f8ab30ec30 | fc584a4003eaf89526769f7046a7cdf74498d7e8 | refs/heads/master | 2021-01-21T23:04:28.423769 | 2009-04-26T21:47:36 | 2009-04-26T21:47:36 | 34,694,401 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 4,217 | java | package com.tle.osidimpl.repository.equella;
public class Type
extends org.osid.shared.Type
{
public Type(String authority
, String domain
, String keyword
, String description)
{
super(authority,domain,keyword,description);
}
public Type(String authority
, String domain
, String keyword)
{
super(authority,domain,keyword);
}
/**
<p>MIT O.K.I. SID Implementation License.
<p> <b>Copyright and license statement:</b>
</p> <p> Copyright © 2003 Massachusetts Institute of
Technology <or copyright holder>
</p> <p> This work is being provided by the copyright holder(s)
subject to the terms of the O.K.I. SID Implementation
License. By obtaining, using and/or copying this Work,
you agree that you have read, understand, and will comply
with the O.K.I. SID Implementation License.
</p> <p> THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
MASSACHUSETTS INSTITUTE OF TECHNOLOGY, THE AUTHORS, OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
THE WORK OR THE USE OR OTHER DEALINGS IN THE WORK.
</p> <p> <b>O.K.I. SID Implementation License</b>
</p> <p> This work (the “Work”), including software,
documents, or other items related to O.K.I. SID
implementations, is being provided by the copyright
holder(s) subject to the terms of the O.K.I. SID
Implementation License. By obtaining, using and/or
copying this Work, you agree that you have read,
understand, and will comply with the following terms and
conditions of the O.K.I. SID Implementation License:
</p> <p> Permission to use, copy, modify, and distribute this Work
and its documentation, with or without modification, for
any purpose and without fee or royalty is hereby granted,
provided that you include the following on ALL copies of
the Work or portions thereof, including modifications or
derivatives, that you make:
</p> <ul> <li> The full text of the O.K.I. SID Implementation
License in a location viewable to users of the
redistributed or derivative work.
</li> </ul> <ul> <li> Any pre-existing intellectual property disclaimers,
notices, or terms and conditions. If none exist, a
short notice similar to the following should be used
within the body of any redistributed or derivative
Work: “Copyright © 2003 Massachusetts
Institute of Technology. All Rights Reserved.”
</li> </ul> <ul> <li> Notice of any changes or modifications to the
O.K.I. Work, including the date the changes were
made. Any modified software must be distributed in such
as manner as to avoid any confusion with the original
O.K.I. Work.
</li> </ul> <p> THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
MASSACHUSETTS INSTITUTE OF TECHNOLOGY, THE AUTHORS, OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
THE WORK OR THE USE OR OTHER DEALINGS IN THE WORK.
</p> <p> The name and trademarks of copyright holder(s) and/or
O.K.I. may NOT be used in advertising or publicity
pertaining to the Work without specific, written prior
permission. Title to copyright in the Work and any
associated documentation will at all times remain with
the copyright holders.
</p> <p> The export of software employing encryption technology
may require a specific license from the United States
Government. It is the responsibility of any person or
organization contemplating export to obtain such a
license before exporting this Work.
</p>*/
}
| [
"verbenaconsulting@comcast.net@fc7dd628-0e2a-11de-a021-8b77bb4f2096"
] | verbenaconsulting@comcast.net@fc7dd628-0e2a-11de-a021-8b77bb4f2096 |
0b9ff2e5851c695523228510e9445aac3ca81207 | 412d2ef5989e3f6a2c07e4d820594aa6a6203974 | /Uwunit14/src/MatrixCount1.java | 74351db63610b7968074237871060c42cd55f9d4 | [] | no_license | schoiii/Choi_Shiun_apcsa-p3 | 97afdf14228ce27ecf240e1a7a0f469548157957 | cb93ca19985c4c1ccbc1b711669c7931f607dd45 | refs/heads/master | 2020-12-23T06:59:19.603491 | 2020-04-20T03:29:55 | 2020-04-20T03:29:55 | 237,076,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | //(c) A+ Computer Science
//www.apluscompsci.com
//Name -
import java.util.*;
import java.io.*;
public class MatrixCount1
{
private static int[][] m = {{ 1, 2, 3, 4, 5},
{ 6, 7, 8, 9, 0},
{ 6, 7, 1, 2, 5},
{ 6, 7, 8, 9, 0},
{ 5, 4, 3, 2, 1}};
public static int count( int val )
{
int num=0;
for(int[] i : m) {
for(int j : i) {
if(j==val)
num++;
System.out.print(j+" ");
}
System.out.println();
}
//add code
return num;
}
}
| [
"60448328+schoiii@users.noreply.github.com"
] | 60448328+schoiii@users.noreply.github.com |
588582e258d45cbaed133e7e6e0f95b7c11dc704 | 364a38d8b9231529a6d177893f11e54103f12c5f | /edu/aplus/gui/EmployeePanel.java | e7f4822a88bca92e13e786f876c0561c7a9aebf0 | [] | no_license | aPlusProject/applus | 49ed443ec2344188c0d3950284d868b1f705b440 | 5f0aa3a1f0f0441da7779c53c2977b986bacb497 | refs/heads/master | 2021-01-21T04:40:02.704926 | 2016-06-23T23:08:10 | 2016-06-23T23:08:10 | 47,273,786 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,830 | java | package edu.aplus.gui;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import edu.aplus.db.DBConnector;
import javax.swing.JLabel;
import javax.sql.DataSource;
import javax.swing.JButton;
public class EmployeePanel extends JFrame {
private DataSource ds;
private JPanel contentPane;
private Connection co;
private int amount = 10000;
Statement ps;
ResultSet rs;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
EmployeePanel frame = new EmployeePanel();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public EmployeePanel() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblEmployee = new JLabel("Employee");
lblEmployee.setBounds(10, 11, 46, 14);
contentPane.add(lblEmployee);
JLabel lblFirstName = new JLabel("First name");
lblFirstName.setBounds(101, 11, 113, 14);
contentPane.add(lblFirstName);
JLabel lblLastName = new JLabel("Last name");
lblLastName.setBounds(258, 11, 138, 14);
contentPane.add(lblLastName);
JLabel lblAdresse = new JLabel("Adresse");
lblAdresse.setBounds(10, 47, 296, 14);
contentPane.add(lblAdresse);
JLabel lblMenu = new JLabel("Menu");
lblMenu.setBounds(10, 85, 46, 14);
contentPane.add(lblMenu);
JButton btnSimulate = new JButton("Simulate");
btnSimulate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("envoi de la simulation");
try {
ds = DBConnector.createDataSource();
co = ds.getConnection();
System.out.println("connexion");
String query = "INSERT INTO LOAN VALUES ('',1,1,1,null,20000,SYSDATE,0)";
ps = co.createStatement();
System.out.println("query prepared");
rs = ps.executeQuery(query);
System.out.println("query executed");
co.close();
System.out.println("co closed");
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
btnSimulate.setBounds(71, 116, 89, 23);
contentPane.add(btnSimulate);
}
}
| [
"sellathurai.vyach@yahoo.fr"
] | sellathurai.vyach@yahoo.fr |
eaa887b31c80fd33f672fff789b5312cda39a609 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/JetBrains--intellij-community/72c1e5cbebe45b1152e9cf93876620eed082be04/before/SoftWrapModelImpl.java | 58c5fc0b77d1c29d327883becf5deb6b86ad6437 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29,149 | java | /*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.editor.impl;
import com.intellij.diagnostic.Dumpable;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.colors.FontPreferences;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.ex.*;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.editor.impl.softwrap.*;
import com.intellij.openapi.editor.impl.softwrap.mapping.CachingSoftWrapDataMapper;
import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapApplianceManager;
import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapAwareDocumentParsingListenerAdapter;
import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapAwareVisualSizeManager;
import com.intellij.openapi.util.TextRange;
import com.intellij.reference.SoftReference;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Default {@link SoftWrapModelEx} implementation.
* <p/>
* Works as a mix of <code>GoF Facade and Bridge</code>, i.e. delegates the processing to the target sub-components and provides
* utility methods built on top of sub-components API.
* <p/>
* Not thread-safe.
*
* @author Denis Zhdanov
* @since Jun 8, 2010 12:47:32 PM
*/
public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentListener, FoldingListener,
PropertyChangeListener, Dumpable, Disposable
{
/**
* Holds name of JVM property which presence should trigger debug-aware soft wraps processing.
*/
private static final String DEBUG_PROPERTY_NAME = "idea.editor.wrap.soft.debug";
private static final Logger LOG = Logger.getInstance("#" + SoftWrapModelImpl.class.getName());
private final LogicalPositionToOffsetTask myLogicalToOffsetTask = new LogicalPositionToOffsetTask();
private final OffsetToLogicalTask myOffsetToLogicalTask = new OffsetToLogicalTask();
private final VisualToLogicalTask myVisualToLogicalTask = new VisualToLogicalTask();
private final LogicalToVisualTask myLogicalToVisualTask = new LogicalToVisualTask();
private final FoldProcessingEndTask myFoldProcessingEndTask = new FoldProcessingEndTask();
private final List<SoftWrapChangeListener> mySoftWrapListeners = new ArrayList<SoftWrapChangeListener>();
/**
* There is a possible case that particular activity performs batch fold regions operations (addition, removal etc).
* We don't want to process them at the same time we get notifications about that because there is a big chance that
* we see inconsistent state (e.g. there was a problem with {@link FoldingModel#getCollapsedRegionAtOffset(int)} because that
* method uses caching internally and cached data becomes inconsistent if, for example, the top region is removed).
* <p/>
* So, our strategy is to collect information about changed fold regions and process it only when batch folding processing ends.
*/
private final List<TextRange> myDeferredFoldRegions = new ArrayList<TextRange>();
private final CachingSoftWrapDataMapper myDataMapper;
private final SoftWrapsStorage myStorage;
private SoftWrapPainter myPainter;
private final SoftWrapApplianceManager myApplianceManager;
private final SoftWrapAwareVisualSizeManager myVisualSizeManager;
private EditorTextRepresentationHelper myEditorTextRepresentationHelper;
@NotNull
private final EditorImpl myEditor;
/**
* We don't want to use soft wraps-aware processing from non-EDT and profiling shows that 'is EDT' check that is called too
* often is rather expensive. Hence, we use caching here for performance improvement.
*/
private SoftReference<Thread> myLastEdt = new SoftReference<Thread>(null);
/** Holds number of 'active' calls, i.e. number of methods calls of the current object within the current call stack. */
private int myActive;
private boolean myUseSoftWraps;
private int myTabWidth = -1;
private final FontPreferences myFontPreferences = new FontPreferences();
/**
* Soft wraps need to be kept up-to-date on all editor modification (changing text, adding/removing/expanding/collapsing fold
* regions etc). Hence, we need to react to all types of target changes. However, soft wraps processing uses various information
* provided by editor and there is a possible case that that information is inconsistent during update time (e.g. fold model
* advances fold region offsets when end-user types before it, hence, fold regions data is inconsistent between the moment
* when text changes are applied to the document and fold data is actually updated).
* <p/>
* Current field serves as a flag that indicates if all preliminary actions necessary for successful soft wraps processing is done.
*/
private boolean myUpdateInProgress;
private boolean myBulkUpdateInProgress;
/**
* There is a possible case that target document is changed while its editor is inactive (e.g. user opens two editors for classes
* <code>'Part'</code> and <code>'Whole'</code>; activates editor for the class <code>'Whole'</code> and performs 'rename class'
* for <code>'Part'</code> from it). Soft wraps cache is not recalculated during that because corresponding editor is not shown
* and we lack information about visible area width. Hence, we will need to recalculate the whole soft wraps cache as soon
* as target editor becomes visible.
* <p/>
* Current field serves as a flag for that <code>'dirty document, need complete soft wraps cache recalculation'</code> state.
*/
private boolean myDirty;
private boolean myForceAdditionalColumns;
public SoftWrapModelImpl(@NotNull EditorImpl editor) {
myEditor = editor;
myStorage = new SoftWrapsStorage();
myPainter = new CompositeSoftWrapPainter(editor);
myEditorTextRepresentationHelper = new DefaultEditorTextRepresentationHelper(editor);
myDataMapper = new CachingSoftWrapDataMapper(editor, myStorage);
myApplianceManager = new SoftWrapApplianceManager(myStorage, editor, myPainter, myDataMapper);
myVisualSizeManager = new SoftWrapAwareVisualSizeManager(myPainter);
myApplianceManager.addListener(myVisualSizeManager);
myApplianceManager.addListener(new SoftWrapAwareDocumentParsingListenerAdapter() {
@Override
public void recalculationEnds() {
for (SoftWrapChangeListener listener : mySoftWrapListeners) {
listener.recalculationEnds();
}
}
});
myUseSoftWraps = areSoftWrapsEnabledInEditor();
myEditor.getColorsScheme().getFontPreferences().copyTo(myFontPreferences);
editor.addPropertyChangeListener(this, this);
myApplianceManager.addListener(myDataMapper);
}
private boolean areSoftWrapsEnabledInEditor() {
return myEditor.getSettings().isUseSoftWraps() && !myEditor.myUseNewRendering
&& (!(myEditor.getDocument() instanceof DocumentImpl) || !((DocumentImpl)myEditor.getDocument()).acceptsSlashR());
}
/**
* Called on editor settings change. Current model is expected to drop all cached information about the settings if any.
*/
public void reinitSettings() {
boolean softWrapsUsedBefore = myUseSoftWraps;
myUseSoftWraps = areSoftWrapsEnabledInEditor();
int tabWidthBefore = myTabWidth;
myTabWidth = EditorUtil.getTabSize(myEditor);
boolean fontsChanged = false;
if (!myFontPreferences.equals(myEditor.getColorsScheme().getFontPreferences())
&& myEditorTextRepresentationHelper instanceof DefaultEditorTextRepresentationHelper) {
fontsChanged = true;
myEditor.getColorsScheme().getFontPreferences().copyTo(myFontPreferences);
((DefaultEditorTextRepresentationHelper)myEditorTextRepresentationHelper).clearSymbolWidthCache();
myPainter.reinit();
}
if ((myUseSoftWraps ^ softWrapsUsedBefore) || (tabWidthBefore >= 0 && myTabWidth != tabWidthBefore) || fontsChanged) {
myApplianceManager.reset();
myDeferredFoldRegions.clear();
myStorage.removeAll();
myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
}
}
@Override
public boolean isRespectAdditionalColumns() {
return myForceAdditionalColumns;
}
@Override
public void forceAdditionalColumnsUsage() {
myForceAdditionalColumns = true;
}
@Override
public boolean isSoftWrappingEnabled() {
if (!myUseSoftWraps || myEditor.isOneLineMode() || myEditor.isPurePaintingMode()) {
return false;
}
// We check that current thread is EDT because attempt to retrieve information about visible area width may fail otherwise
Application application = ApplicationManager.getApplication();
Thread lastEdt = myLastEdt.get();
Thread currentThread = Thread.currentThread();
if (lastEdt != currentThread) {
if (application.isDispatchThread()) {
myLastEdt = new SoftReference<Thread>(currentThread);
}
else {
myLastEdt = new SoftReference<Thread>(null);
return false;
}
}
if (application.isUnitTestMode()) return true;
Rectangle visibleArea = myEditor.getScrollingModel().getVisibleArea();
return visibleArea.width > 0 && visibleArea.height > 0;
}
@Override
@Nullable
public SoftWrap getSoftWrap(int offset) {
if (!isSoftWrappingEnabled()) {
return null;
}
return myStorage.getSoftWrap(offset);
}
@Override
public int getSoftWrapIndex(int offset) {
return myStorage.getSoftWrapIndex(offset);
}
@NotNull
@Override
public List<? extends SoftWrap> getSoftWrapsForRange(int start, int end) {
if (!isSoftWrappingEnabled() || end < start) {
return Collections.emptyList();
}
List<? extends SoftWrap> softWraps = myStorage.getSoftWraps();
int startIndex = myStorage.getSoftWrapIndex(start);
if (startIndex < 0) {
startIndex = -startIndex - 1;
if (startIndex >= softWraps.size() || softWraps.get(startIndex).getStart() > end) {
return Collections.emptyList();
}
}
int endIndex = myStorage.getSoftWrapIndex(end);
if (endIndex >= 0) {
return softWraps.subList(startIndex, endIndex + 1);
}
else {
endIndex = -endIndex - 1;
return softWraps.subList(startIndex, endIndex);
}
}
@Override
@NotNull
public List<? extends SoftWrap> getSoftWrapsForLine(int documentLine) {
if (!isSoftWrappingEnabled() || documentLine < 0) {
return Collections.emptyList();
}
Document document = myEditor.getDocument();
if (documentLine >= document.getLineCount()) {
return Collections.emptyList();
}
int start = document.getLineStartOffset(documentLine);
int end = document.getLineEndOffset(documentLine);
return getSoftWrapsForRange(start, end + 1/* it's theoretically possible that soft wrap is registered just before the line feed,
* hence, we add '1' here assuming that end line offset points to line feed symbol */
);
}
/**
* @return total number of soft wrap-introduced new visual lines
*/
public int getSoftWrapsIntroducedLinesNumber() {
return myStorage.getSoftWraps().size(); // Assuming that soft wrap has single line feed all the time
}
/**
* Callback method that is expected to be invoked before editor painting.
* <p/>
* It's primary purpose is to recalculate soft wraps at least for the painted area if necessary.
*/
public void registerSoftWrapsIfNecessary() {
if (!isSoftWrappingEnabled()) {
return;
}
myActive++;
try {
myApplianceManager.registerSoftWrapIfNecessary();
}
finally {
myActive--;
}
}
@Override
public List<? extends SoftWrap> getRegisteredSoftWraps() {
if (!isSoftWrappingEnabled()) {
return Collections.emptyList();
}
return myStorage.getSoftWraps();
}
@Override
public boolean isVisible(SoftWrap softWrap) {
FoldingModel foldingModel = myEditor.getFoldingModel();
int start = softWrap.getStart();
if (foldingModel.isOffsetCollapsed(start)) {
return false;
}
// There is a possible case that soft wrap and collapsed folding region share the same offset, i.e. soft wrap is represented
// before the folding. We need to return 'true' in such situation. Hence, we check if offset just before the soft wrap
// is collapsed as well.
return start <= 0 || !foldingModel.isOffsetCollapsed(start - 1);
}
@Override
public int paint(@NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) {
if (!isSoftWrappingEnabled()) {
return 0;
}
return myPainter.paint(g, drawingType, x, y, lineHeight);
}
@Override
public int getMinDrawingWidthInPixels(@NotNull SoftWrapDrawingType drawingType) {
return myPainter.getMinDrawingWidth(drawingType);
}
@NotNull
@Override
public LogicalPosition visualToLogicalPosition(@NotNull VisualPosition visual) {
if (myBulkUpdateInProgress || myUpdateInProgress || !prepareToMapping()) {
return myEditor.visualToLogicalPosition(visual, false);
}
myActive++;
try {
myVisualToLogicalTask.input = visual;
executeSafely(myVisualToLogicalTask);
return myVisualToLogicalTask.output;
} finally {
myActive--;
}
}
@NotNull
@Override
public LogicalPosition offsetToLogicalPosition(int offset) {
if (myBulkUpdateInProgress || myUpdateInProgress || !prepareToMapping()) {
return myEditor.offsetToLogicalPosition(offset, false);
}
myActive++;
try {
myOffsetToLogicalTask.input = offset;
executeSafely(myOffsetToLogicalTask);
return myOffsetToLogicalTask.output;
} finally {
myActive--;
}
}
@Override
public int logicalPositionToOffset(@NotNull LogicalPosition logicalPosition) {
if (myBulkUpdateInProgress || myUpdateInProgress || !prepareToMapping()) {
return myEditor.logicalPositionToOffset(logicalPosition, false);
}
myActive++;
try {
myLogicalToOffsetTask.input = logicalPosition;
executeSafely(myLogicalToOffsetTask);
return myLogicalToOffsetTask.output;
} finally {
myActive--;
}
}
@NotNull
public LogicalPosition adjustLogicalPosition(LogicalPosition defaultLogical, int offset) {
if (myBulkUpdateInProgress || myUpdateInProgress || !prepareToMapping()) {
return defaultLogical;
}
myActive++;
try {
myOffsetToLogicalTask.input = offset;
executeSafely(myOffsetToLogicalTask);
return myOffsetToLogicalTask.output;
} finally {
myActive--;
}
}
@Override
@NotNull
public VisualPosition adjustVisualPosition(@NotNull LogicalPosition logical, @NotNull VisualPosition defaultVisual) {
if (myBulkUpdateInProgress || myUpdateInProgress || !prepareToMapping()) {
return defaultVisual;
}
myActive++;
try {
myLogicalToVisualTask.input = logical;
myLogicalToVisualTask.defaultOutput = defaultVisual;
executeSafely(myLogicalToVisualTask);
return myLogicalToVisualTask.output;
}
finally {
myActive--;
}
}
/**
* Encapsulates preparations for performing document dimension mapping (e.g. visual to logical position) and answers
* if soft wraps-aware processing should be used (e.g. there is no need to consider soft wraps if user configured them
* not to be used).
*
* @return <code>true</code> if soft wraps-aware processing should be used; <code>false</code> otherwise
*/
private boolean prepareToMapping() {
boolean useSoftWraps = myActive <= 0 && isSoftWrappingEnabled() && myEditor.getDocument().getTextLength() > 0;
if (!useSoftWraps) {
return false;
}
if (myDirty) {
myApplianceManager.reset();
myDeferredFoldRegions.clear();
myDirty = false;
}
return myApplianceManager.recalculateIfNecessary();
}
/**
* Allows to answer if given visual position points to soft wrap-introduced virtual space.
*
* @param visual target visual position to check
* @return <code>true</code> if given visual position points to soft wrap-introduced virtual space;
* <code>false</code> otherwise
*/
@Override
public boolean isInsideSoftWrap(@NotNull VisualPosition visual) {
return isInsideSoftWrap(visual, false);
}
/**
* Allows to answer if given visual position points to soft wrap-introduced virtual space or points just before soft wrap.
*
* @param visual target visual position to check
* @return <code>true</code> if given visual position points to soft wrap-introduced virtual space;
* <code>false</code> otherwise
*/
@Override
public boolean isInsideOrBeforeSoftWrap(@NotNull VisualPosition visual) {
return isInsideSoftWrap(visual, true);
}
private boolean isInsideSoftWrap(@NotNull VisualPosition visual, boolean countBeforeSoftWrap) {
if (!isSoftWrappingEnabled()) {
return false;
}
SoftWrapModel model = myEditor.getSoftWrapModel();
if (!model.isSoftWrappingEnabled()) {
return false;
}
LogicalPosition logical = myEditor.visualToLogicalPosition(visual);
int offset = myEditor.logicalPositionToOffset(logical);
if (offset <= 0) {
// Never expect to be here, just a defensive programming.
return false;
}
SoftWrap softWrap = model.getSoftWrap(offset);
if (softWrap == null) {
return false;
}
// We consider visual positions that point after the last symbol before soft wrap and the first symbol after soft wrap to not
// belong to soft wrap-introduced virtual space.
VisualPosition visualAfterSoftWrap = myEditor.offsetToVisualPosition(offset);
if (visualAfterSoftWrap.line == visual.line && visualAfterSoftWrap.column <= visual.column) {
return false;
}
VisualPosition visualBeforeSoftWrap = myEditor.offsetToVisualPosition(offset - 1);
int x = 0;
LogicalPosition logLineStart = myEditor.visualToLogicalPosition(new VisualPosition(visualBeforeSoftWrap.line, 0));
if (logLineStart.softWrapLinesOnCurrentLogicalLine > 0) {
int offsetLineStart = myEditor.logicalPositionToOffset(logLineStart);
softWrap = model.getSoftWrap(offsetLineStart);
if (softWrap != null) {
x = softWrap.getIndentInPixels();
}
}
int width = EditorUtil.textWidthInColumns(myEditor, myEditor.getDocument().getCharsSequence(), offset - 1, offset, x);
int softWrapStartColumn = visualBeforeSoftWrap.column + width;
if (visual.line > visualBeforeSoftWrap.line) {
return true;
}
return countBeforeSoftWrap ? visual.column >= softWrapStartColumn : visual.column > softWrapStartColumn;
}
@Override
public void beforeDocumentChangeAtCaret() {
CaretModel caretModel = myEditor.getCaretModel();
VisualPosition visualCaretPosition = caretModel.getVisualPosition();
if (!isInsideSoftWrap(visualCaretPosition)) {
return;
}
SoftWrap softWrap = myStorage.getSoftWrap(caretModel.getOffset());
if (softWrap == null) {
return;
}
myEditor.getDocument().replaceString(softWrap.getStart(), softWrap.getEnd(), softWrap.getText());
caretModel.moveToVisualPosition(visualCaretPosition);
}
@Override
public boolean addSoftWrapChangeListener(@NotNull SoftWrapChangeListener listener) {
mySoftWrapListeners.add(listener);
return myStorage.addSoftWrapChangeListener(listener);
}
public boolean addVisualSizeChangeListener(@NotNull VisualSizeChangeListener listener) {
return myVisualSizeManager.addVisualSizeChangeListener(listener);
}
@Override
public int getPriority() {
return EditorDocumentPriorities.SOFT_WRAP_MODEL;
}
@Override
public void beforeDocumentChange(DocumentEvent event) {
if (myBulkUpdateInProgress) {
return;
}
myUpdateInProgress = true;
if (!isSoftWrappingEnabled()) {
myDirty = true;
return;
}
myApplianceManager.beforeDocumentChange(event);
}
@Override
public void documentChanged(DocumentEvent event) {
if (myBulkUpdateInProgress) {
return;
}
myUpdateInProgress = false;
if (!isSoftWrappingEnabled()) {
return;
}
myApplianceManager.documentChanged(event);
}
void onBulkDocumentUpdateStarted() {
myBulkUpdateInProgress = true;
}
void onBulkDocumentUpdateFinished() {
myBulkUpdateInProgress = false;
if (!isSoftWrappingEnabled()) {
return;
}
recalculate();
}
@Override
public void onFoldRegionStateChange(@NotNull FoldRegion region) {
myUpdateInProgress = true;
if (!isSoftWrappingEnabled() || !region.isValid()) {
myDirty = true;
return;
}
// We delay processing of changed fold regions till the invocation of onFoldProcessingEnd(), as
// FoldingModel can return inconsistent data before that moment.
myDeferredFoldRegions.add(new TextRange(region.getStartOffset(), region.getEndOffset()));
}
@Override
public void onFoldProcessingEnd() {
myUpdateInProgress = false;
if (!isSoftWrappingEnabled()) {
return;
}
executeSafely(myFoldProcessingEndTask);
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (EditorEx.PROP_FONT_SIZE.equals(evt.getPropertyName())) {
myDirty = true;
}
}
@NotNull
public CachingSoftWrapDataMapper getDataMapper() {
return myDataMapper;
}
@Override
public void dispose() {
release();
}
@Override
public void release() {
myDataMapper.release();
myApplianceManager.release();
myStorage.removeAll();
myDeferredFoldRegions.clear();
}
public void recalculate() {
myApplianceManager.reset();
myStorage.removeAll();
myDeferredFoldRegions.clear();
myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
myApplianceManager.recalculateIfNecessary();
}
public SoftWrapApplianceManager getApplianceManager() {
return myApplianceManager;
}
/**
* We know that there are problems with incremental soft wraps cache update at the moment. Hence, we may implement full cache
* reconstruction when the problem is encountered in order to avoid customer annoyance.
* <p/>
* However, the problems still should be fixed, hence, we report them only if dedicated flag is set.
* <p/>
* Current method encapsulates the logic mentioned above.
*
* @param task command object that which execution may trigger incremental update of update soft wraps cache
*/
@SuppressWarnings({"UseOfArchaicSystemPropertyAccessors"})
private void executeSafely(SoftWrapAwareTask task) {
try {
task.run(true);
} catch (Throwable e) {
if (Boolean.getBoolean(DEBUG_PROPERTY_NAME) || ApplicationManager.getApplication().isUnitTestMode()) {
String info = myEditor.dumpState();
LOG.error(String.format("Unexpected exception occurred during performing '%s'", task), e, info);
}
myEditor.getFoldingModel().rebuild();
myDataMapper.release();
myApplianceManager.reset();
myStorage.removeAll();
myApplianceManager.recalculateIfNecessary();
try {
task.run(true);
}
catch (Throwable e1) {
String info = myEditor.dumpState();
LOG.error(String.format("Can't perform %s even with complete soft wraps cache re-parsing", task), e1, info);
myEditor.getSettings().setUseSoftWraps(false);
task.run(false);
}
}
}
@TestOnly
public void setSoftWrapPainter(SoftWrapPainter painter) {
myPainter = painter;
myApplianceManager.setSoftWrapPainter(painter);
myVisualSizeManager.setSoftWrapPainter(painter);
}
public static EditorTextRepresentationHelper getEditorTextRepresentationHelper(@NotNull Editor editor) {
return ((SoftWrapModelEx)editor.getSoftWrapModel()).getEditorTextRepresentationHelper();
}
public EditorTextRepresentationHelper getEditorTextRepresentationHelper() {
return myEditorTextRepresentationHelper;
}
@TestOnly
public void setEditorTextRepresentationHelper(EditorTextRepresentationHelper editorTextRepresentationHelper) {
myEditorTextRepresentationHelper = editorTextRepresentationHelper;
myApplianceManager.reset();
}
@NotNull
@Override
public String dumpState() {
return String.format("appliance manager state: %s; soft wraps mapping info: %s",
myApplianceManager.dumpState(), myDataMapper.dumpState());
}
@Override
public String toString() {
return dumpState();
}
/**
* Defines generic interface for the command that may be proceeded in both <code>'soft wraps aware'</code> and
* <code>'soft wraps unaware'</code> modes.
*/
private interface SoftWrapAwareTask {
/**
* Asks current task to do the job.
* <p/>
* It's assumed that input data (if any) is already stored at the task object. Processing result (if any) is assumed
* to be stored there as well for further retrieval in implementation-specific manner.
*
* @param softWrapAware flag that indicates if soft wraps-aware processing should be performed
* @throws IllegalStateException in case of inability to do the job
*/
void run(boolean softWrapAware) throws IllegalStateException;
}
private class OffsetToLogicalTask implements SoftWrapAwareTask {
public int input;
public LogicalPosition output;
@Override
public void run(boolean softWrapAware) throws IllegalStateException {
if (softWrapAware) {
output = myDataMapper.offsetToLogicalPosition(input);
}
else {
output = myEditor.offsetToLogicalPosition(input, false);
}
}
@Override
public String toString() {
return "mapping from offset (" + input + ") to logical position";
}
}
private class VisualToLogicalTask implements SoftWrapAwareTask {
public VisualPosition input;
public LogicalPosition output;
@Override
public void run(boolean softWrapAware) throws IllegalStateException {
if (softWrapAware) {
output = myDataMapper.visualToLogical(input);
}
else {
output = myEditor.visualToLogicalPosition(input, false);
}
}
@Override
public String toString() {
return "mapping from visual position (" + input + ") to logical position";
}
}
private class LogicalToVisualTask implements SoftWrapAwareTask {
public LogicalPosition input;
private VisualPosition defaultOutput;
public VisualPosition output;
@Override
public void run(boolean softWrapAware) throws IllegalStateException {
output = softWrapAware ? myDataMapper.logicalToVisualPosition(input, defaultOutput) : defaultOutput;
}
@Override
public String toString() {
return "mapping from logical position (" + input + ") to visual position";
}
}
private class LogicalPositionToOffsetTask implements SoftWrapAwareTask {
public LogicalPosition input;
public int output;
@Override
public void run(boolean softWrapAware) throws IllegalStateException {
output = softWrapAware ? myDataMapper.logicalPositionToOffset(input) : myEditor.logicalPositionToOffset(input, false);
}
@Override
public String toString() {
return "mapping from logical position (" + input + ") to offset";
}
}
private class FoldProcessingEndTask implements SoftWrapAwareTask {
@Override
public void run(boolean softWrapAware) {
if (!softWrapAware) {
return;
}
try {
if (!myDirty) { // no need to recalculate specific areas if the whole document will be reprocessed
myApplianceManager.recalculate(myDeferredFoldRegions);
}
}
finally {
myDeferredFoldRegions.clear();
}
}
@Override
public String toString() {
return "fold regions state change processing";
}
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
2139726c3b951d1b6e2b3413cd9e7ebbb436cbea | 2620225013b9236a13b98110f4bfe07eb00fb40a | /src/main/java/openmods/network/Dispatcher.java | e04797c910dc2376306b3a55f2aa163a78a91500 | [
"MIT"
] | permissive | Searge-DP/OpenModsLib | 2004080b0a53699f35cee460e19a908ece46c6f1 | 30ecdbe78e0cf342a4fd59c1ec9f228aa0b6965f | refs/heads/master | 2020-04-30T02:11:35.083570 | 2016-02-07T14:06:43 | 2016-02-07T14:06:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,963 | java | package openmods.network;
import io.netty.channel.embedded.EmbeddedChannel;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import openmods.network.senders.*;
import com.google.common.collect.ImmutableList;
import cpw.mods.fml.common.network.FMLOutboundHandler.OutboundTarget;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
public abstract class Dispatcher {
protected abstract EmbeddedChannel getChannel(Side side);
protected EmbeddedChannel serverChannel() {
return getChannel(Side.SERVER);
}
protected EmbeddedChannel clientChannel() {
return getChannel(Side.CLIENT);
}
public class Senders {
public final IPacketSender client = FmlPacketSenderFactory.createSender(clientChannel(), OutboundTarget.TOSERVER);
public final IPacketSender global = FmlPacketSenderFactory.createSender(serverChannel(), OutboundTarget.ALL);
public final IPacketSender nowhere = FmlPacketSenderFactory.createSender(serverChannel(), OutboundTarget.NOWHERE);
public final ITargetedPacketSender<EntityPlayer> player = FmlPacketSenderFactory.createPlayerSender(serverChannel());
public final ITargetedPacketSender<Integer> dimension = FmlPacketSenderFactory.createDimensionSender(serverChannel());
public final ITargetedPacketSender<TargetPoint> point = FmlPacketSenderFactory.createPointSender(serverChannel());
public final ITargetedPacketSender<DimCoord> block = ExtPacketSenderFactory.createBlockSender(serverChannel());
public final ITargetedPacketSender<Entity> entity = ExtPacketSenderFactory.createEntitySender(serverChannel());
public List<Object> serialize(Object msg) {
nowhere.sendMessage(msg);
ImmutableList.Builder<Object> result = ImmutableList.builder();
Object packet;
while ((packet = serverChannel().outboundMessages().poll()) != null)
result.add(packet);
return result.build();
}
}
}
| [
"bartek.bok@gmail.com"
] | bartek.bok@gmail.com |
0e44514dd2dadfe74b3a8bb00243edd47ba4b525 | f5c3c76446b0e20acef3cfafb9cf322e3f2ecbf3 | /jaf-examples-j2se/src/main/java/com/jaf/examples/j2se/java/jvm/classloading/ConstClass.java | 156292e3ca7b3fff04746927220f6e15e34c7dcc | [
"MIT"
] | permissive | walle-liao/jaf-examples | 05df8673623eb92547952598abe9b215b4e6c3ab | bb6e2222bf5d89fe134843159e78fc2c7cb82c02 | refs/heads/master | 2021-10-12T01:38:08.786458 | 2021-10-05T07:54:09 | 2021-10-05T07:54:09 | 60,753,330 | 4 | 5 | null | null | null | null | UTF-8 | Java | false | false | 123 | java | package com.jaf.examples.j2se.java.jvm.classloading;
/**
* @author liaozhicheng.cn@163.com
*/
public class Constant {
}
| [
"liaozhicheng.cn@163.com"
] | liaozhicheng.cn@163.com |
fca066942b3078f5c97c93b8d13fc32186ba51e3 | 868bc4ab0c8a9210302e0f010af411c3b769120f | /src/com/feup/jhotsketch/controller/DiagramController.java | 17a6e3fc2b6ed984b4903e8d2b82520262a0287e | [] | no_license | arestivo/JHotSketch | bf8b59e53bb02adb094d8bfe28691b27edfe6f03 | a30fd5fffc80be265cbe41f9a5fc08eea7ceb5f6 | refs/heads/master | 2021-01-01T05:30:29.647160 | 2011-04-21T20:02:49 | 2011-04-21T20:02:49 | 574,949 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,192 | java | package com.feup.jhotsketch.controller;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import com.feup.contribution.aida.annotations.PackageName;
import com.feup.jhotsketch.connector.Connector;
import com.feup.jhotsketch.connector.Connector.ENDTYPE;
import com.feup.jhotsketch.diagram.Diagram;
import com.feup.jhotsketch.diagram.DiagramObserver;
import com.feup.jhotsketch.handle.Handle;
import com.feup.jhotsketch.handle.HandlerFactory;
import com.feup.jhotsketch.shape.Shape;
@PackageName("Controller")
public class DiagramController implements MouseListener, MouseMoveListener, DiagramObserver {
private final Diagram diagram;
private List<ControllerObserver> observers = new LinkedList<ControllerObserver>();
private Set<Shape> selectedShapes = new HashSet<Shape>();
private Set<Connector> selectedConnectors = new HashSet<Connector>();
private ShapeController controller;
public DiagramController(Diagram diagram) {
this.diagram = diagram;
diagram.addDiagramObserver(this);
}
@Override
public void mouseDoubleClick(MouseEvent e) {
for(Connector connector : getSelectedConnectors()) {
List<Handle> handles = HandlerFactory.getHandlesFor(connector);
for (Handle handle : handles) {
if (handle.contains(e.x, e.y))
new HandleController(handle, this).doubleClick(e.x, e.y);
}
}
Set<Shape> selectedShapes = getSelectedShapes();
for (Shape shape : selectedShapes) {
final Text editor = new Text((Composite)e.getSource(), SWT.SINGLE);
int width = Math.max(shape.getBounds().width, 100);
editor.setSize(width, 20);
editor.setLocation(shape.getBounds().x + shape.getBounds().width / 2 - width / 2, shape.getBounds().y + shape.getBounds().height / 2 - 10);
editor.setData(shape);
editor.setText(shape.getText());
editor.setFocus();
editor.addKeyListener(new KeyListener() {
@Override
public void keyReleased(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (e.keyCode == 13) {
Shape shape = (Shape) editor.getData();
shape.setText(editor.getText());
editor.dispose();
}
}
});
}
}
public boolean startMoveSelected(int x, int y) {
List<Shape> foundShapes = diagram.getShapesAt(x, y);
for (Shape shape : selectedShapes) {
if (foundShapes.contains(shape)) {
controller = new MoveController(selectedShapes, diagram);
controller.mouseDown(x, y);
return true;
}
}
return false;
}
@Override
public void mouseDown(MouseEvent e) {
for(Connector connector : getSelectedConnectors()) {
List<Handle> handles = HandlerFactory.getHandlesFor(connector);
for (Handle handle : handles) {
if (handle.contains(e.x, e.y)) {
controller = new HandleController(handle, this);
controller.mouseDown(e.x, e.y);
}
}
}
for (Shape shape : selectedShapes) {
List<Handle> handles = HandlerFactory.getHandlesFor(shape);
for (Handle handle : handles) {
if (handle.contains(e.x, e.y)) {
controller = new HandleController(handle, this);
controller.mouseDown(e.x, e.y);
return;
}
}
}
List<Shape> foundShapes = diagram.getShapesAt(e.x, e.y);
if (foundShapes.size() == 0) {
List<Connector> foundConnectors = diagram.getConnectorsAt(e.x, e.y);
if (foundConnectors.size() == 0) {
controller = new SelectionController();
controller.mouseDown(e.x, e.y);
} else {
if ((e.stateMask & SWT.CONTROL) == 0) clearSelection();
selectedConnectors.add(foundConnectors.get(0));
}
} else {
// MOVE SELECTED
if (startMoveSelected(e.x, e.y)) return;
// SELECT
Shape next = getNextSelection(foundShapes);
if ((e.stateMask & SWT.CONTROL) == 0) clearSelection();
selectedShapes.add(next);
controller = new MoveController(selectedShapes, diagram);
controller.mouseDown(e.x, e.y);
}
controllerChanged();
}
private Shape getNextSelection(List<Shape> shapes) {
Shape found = null;
for (Shape shape : shapes) {
if (selectedShapes.contains(shape)) found = null;
else found = shape;
}
if (found == null) found = shapes.get(0);
return found;
}
public void selectShape(Shape shape) {
selectedShapes.add(shape);
controllerChanged();
}
@Override
public void mouseMove(MouseEvent e) {
mouseMove(e.x, e.y);
}
public void mouseMove(int x, int y) {
if (controller != null) {
controller.mouseMove(x, y);
controllerChanged();
}
}
@Override
public void mouseUp(MouseEvent e) {
mouseUp(e.x, e.y, e.stateMask);
}
public void clearSelection() {
selectedConnectors.clear();
selectedShapes.clear();
controllerChanged();
}
public void mouseUp(int x, int y, int stateMask) {
if (controller instanceof SelectionController) {
if ((stateMask & SWT.SHIFT) == 0) clearSelection();
selectedShapes.addAll(diagram.getShapesIn(((SelectionController)controller).getSelectionRectangle()));
selectedConnectors.addAll(diagram.getConnectorsIn(((SelectionController)controller).getSelectionRectangle()));
}
if (controller instanceof MoveController) {
if (!((MoveController)controller).moved()) {
List<Shape> found = diagram.getShapesAt(x, y);
Shape next = getNextSelection(found);
if ((stateMask & SWT.CONTROL) == 0) clearSelection();
selectedShapes.add(next);
}
}
if (controller instanceof HandleController) {
controller.mouseUp(x, y);
}
controllerChanged();
controller = null;
}
public void controllerChanged() {
for (ControllerObserver observer : observers ) {
observer.controllerChanged(this);
}
}
public void addControllerObserver(ControllerObserver observer) {
observers.add(observer);
}
public void removeControllerObserver(ControllerObserver observer) {
observers.remove(observer);
}
public void paint(GC gc) {
for (Shape shape : selectedShapes) {
List<Handle> handles = HandlerFactory.getHandlesFor(shape);
for (Handle handle : handles) {
handle.paint(gc);
}
}
for (Connector connector : selectedConnectors) {
List<Handle> handles = HandlerFactory.getHandlesFor(connector);
for (Handle handle : handles) {
handle.paint(gc);
}
}
if (controller != null) controller.paint(gc);
}
public Set<Shape> getSelectedShapes() {
return selectedShapes;
}
public void setSelectedLineStyle(int style) {
for (Shape shape : selectedShapes) shape.setLineStyle(style);
for (Connector connector : selectedConnectors) connector.setLineStyle(style);
}
public void setSelectedLineWidth(int width) {
for (Shape shape : selectedShapes) shape.setLineWidth(width);
for (Connector connector : selectedConnectors) connector.setLineWidth(width);
}
public void setSelectedLineColor(Color color) {
for (Shape shape : selectedShapes) shape.setLineColor(color);
for (Connector connector : selectedConnectors) connector.setLineColor(color);
}
public void setSelectedFillColor(Color color) {
for (Shape shape : selectedShapes) shape.setFillColor(color);
}
public Set<Connector> getSelectedConnectors() {
return selectedConnectors;
}
public Set<Color> getSelectedLineColors() {
Set<Color> lineColors = new HashSet<Color>();
for (Shape shape : selectedShapes) lineColors.add(shape.getLineColor());
for (Connector connector : selectedConnectors) lineColors.add(connector.getLineColor());
return lineColors;
}
public Set<Color> getSelectedFillColors() {
Set<Color> fillColors = new HashSet<Color>();
for (Shape shape : selectedShapes) fillColors.add(shape.getFillColor());
return fillColors;
}
public Set<Integer> getSelectedLineWidths() {
Set<Integer> lineWidths = new HashSet<Integer>();
for (Shape shape : selectedShapes) lineWidths.add(new Integer(shape.getLineWidth()));
for (Connector connector : selectedConnectors) lineWidths.add(new Integer(connector.getLineWidth()));
return lineWidths;
}
public Set<Integer> getSelectedLineStyles() {
Set<Integer> lineStyles = new HashSet<Integer>();
for (Shape shape : selectedShapes) lineStyles.add(new Integer(shape.getLineStyle()));
for (Connector connector : selectedConnectors) lineStyles.add(new Integer(connector.getLineStyle()));
return lineStyles;
}
@Override
public void diagramChanged(Diagram diagram) {
controllerChanged();
}
public void selectAll() {
selectedConnectors.addAll(diagram.getConnectors());
selectedShapes.addAll(diagram.getShapes());
controllerChanged();
}
public void removeSelected() {
diagram.removeShapes(selectedShapes);
diagram.removeConnectors(selectedConnectors);
selectedConnectors.clear();
selectedShapes.clear();
removeOrphanConnectors();
}
private void removeOrphanConnectors() {
Set<Connector> toRemove = new HashSet<Connector>();
for (Connector connector : diagram.getConnectors()) {
if (diagram.getShapes().contains(connector.getSource()) && diagram.getShapes().contains(connector.getTarget())) continue;
toRemove.add(connector);
}
diagram.removeConnectors(toRemove);
}
public void setSelectedTargetEndSize(int size) {
for (Connector connector : selectedConnectors) connector.setTargetEndSize(size);
}
public void setSelectedSourceEndSize(int size) {
for (Connector connector : selectedConnectors) connector.setSourceEndSize(size);
}
public Set<Integer> getSelectedTargetEndSizes() {
Set<Integer> sizes = new HashSet<Integer>();
for (Connector connector : selectedConnectors) sizes.add(new Integer(connector.getTargetEndSize()));
return sizes;
}
public Set<Integer> getSelectedAlphas() {
Set<Integer> alphas = new HashSet<Integer>();
for (Shape shape : selectedShapes) alphas.add(new Integer(shape.getAlpha()));
return alphas;
}
public Set<Integer> getSelectedSourceEndSizes() {
Set<Integer> sizes = new HashSet<Integer>();
for (Connector connector : selectedConnectors) sizes.add(new Integer(connector.getSourceEndSize()));
return sizes;
}
public void setSelectedTargetEndType(ENDTYPE endType) {
for (Connector connector : selectedConnectors) connector.setTargetEndType(endType);
}
public void setSelectedSourceEndType(ENDTYPE endType) {
for (Connector connector : selectedConnectors) connector.setSourceEndType(endType);
}
public Set<ENDTYPE> getSelectedSourceEndTypes() {
Set<ENDTYPE> types = new HashSet<ENDTYPE>();
for (Connector connector : selectedConnectors) types.add(connector.getSourceEndType());
return types;
}
public Set<ENDTYPE> getSelectedTargetEndTypes() {
Set<ENDTYPE> types = new HashSet<ENDTYPE>();
for (Connector connector : selectedConnectors) types.add(connector.getTargetEndType());
return types;
}
public void addShape(Shape shape) {
diagram.addShape(shape);
selectedShapes.clear();
selectedConnectors.clear();
selectedShapes.add(shape);
}
public Diagram getDiagram() {
return diagram;
}
public void addConnector(Connector connector) {
diagram.addConnector(connector);
selectedShapes.clear();
selectedConnectors.clear();
selectedConnectors.add(connector);
}
public void moveSelected(int dx, int dy) {
for (Shape shape : selectedShapes)
shape.move(dx, dy);
}
public ShapeController getCurrentController() {
return controller;
}
public void setSelectedAlpha(int alpha) {
for (Shape shape : selectedShapes) shape.setAlpha(alpha);
}
public void selectMany(Collection<Shape> shapes, Collection<Connector> controllers) {
selectedConnectors.addAll(controllers);
selectedShapes.addAll(shapes);
controllerChanged();
}
public void selectConnector(Connector connector) {
selectedConnectors.add(connector);
controllerChanged();
}
public void setSelectedFont(Font font) {
for (Shape shape : selectedShapes) shape.setFont(font);
}
} | [
"arestivo@arestivo-laptop.(none)"
] | arestivo@arestivo-laptop.(none) |
0297bab3b3e151e4eb0c62a1d7a6ec1d772dbcda | f74a099f5cabae00255263a10348b811e240ecf3 | /src/main/java/com/cooksys/ftd/assignments/day/two/objects/IRational.java | 89fecfebb74b4d538fa9e6e3bfdf8e4abfa7479e | [] | no_license | resisttheurge/day-two-objects | 2ca2c0a6b135e18107e89e59f5b965cf6cbc8f06 | 686ddc4c7dab50b08d0522de72c3be028d12b0cc | refs/heads/master | 2021-05-03T11:26:42.244666 | 2016-10-04T21:28:32 | 2016-10-04T21:28:32 | 69,960,836 | 0 | 16 | null | 2016-10-05T15:17:16 | 2016-10-04T12:01:37 | Java | UTF-8 | Java | false | false | 3,331 | java | package com.cooksys.ftd.assignments.day.two.objects;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
interface IRational {
/**
* @return the numerator of this rational number
*/
int getNumerator();
/**
* @return the denominator of this rational number
*/
int getDenominator();
/**
* Specializable constructor to take advantage of shared code between Rational and SimplifiedRational
* <p>
* Essentially, this method allows us to implement most of IRational methods directly in the interface while
* preserving the underlying type
*
* @param numerator the numerator of the rational value to construct
* @param denominator the denominator of the rational value to construct
* @return the constructed rational value
* @throws IllegalArgumentException if the given denominator is 0
*/
IRational construct(int numerator, int denominator) throws IllegalArgumentException;
/**
* negation of rational values
* <p>
* definition:
* `negate(n / d) = -n / d`
*
* @return the negation of this
*/
default IRational negate() {
throw new NotImplementedException();
}
/**
* inversion of rational values
* <p>
* definition:
* `invert(n / d) = d / n`
*
* @return the inversion of this
* @throws IllegalStateException if the numerator of this rational value is 0
*/
default IRational invert() throws IllegalStateException {
throw new NotImplementedException();
}
/**
* addition of rational values
* <p>
* definition:
* `(n1 / d1) + (n2 / d2) = ((n1 * d2) + (n2 * d1)) / (d1 * d2)`
*
* @param that the value to add to this
* @return the sum of this and that
* @throws IllegalArgumentException if that is null
*/
default IRational add(IRational that) throws IllegalArgumentException {
throw new NotImplementedException();
}
/**
* subtraction of rational values
* <p>
* definition:
* `(n1 / d1) - (n2 / d2) = ((n1 * d2) - (n2 * d1)) / (d1 * d2)`
*
* @param that the value to subtract from this
* @return the difference between this and that
* @throws IllegalArgumentException if that is null
*/
default IRational sub(IRational that) throws IllegalArgumentException {
throw new NotImplementedException();
}
/**
* multiplication of rational values
* <p>
* definition:
* `(n1 / d1) * (n2 / d2) = (n1 * n2) / (d1 * d2)`
*
* @param that the value to multiply this by
* @return the product of this and that
* @throws IllegalArgumentException if that is null
*/
default IRational mul(IRational that) throws IllegalArgumentException {
throw new NotImplementedException();
}
/**
* division of rational values
* <p>
* definition:
* `(n1 / d1) / (n2 / d2) = (n1 * d2) / (d1 * n2)`
*
* @param that the value to divide this by
* @return the ratio of this to that
* @throws IllegalArgumentException if that is null or if the numerator of that is 0
*/
default IRational div(IRational that) throws IllegalArgumentException {
throw new NotImplementedException();
}
}
| [
"peterzastoupil@gmail.com"
] | peterzastoupil@gmail.com |
59da9f19eb6dc8b2e4a88a867c2affd4f7b4c3da | becb4421725c52acce390913589577190e174ccf | /src/main/java/cookbook/hadoop/chapter2/WeblogMapper.java | 4f5d0ec01e8d9bc1ddb82ecc7876fb8bc61fa63b | [] | no_license | sivasg8k/HadoopCase-chapter2 | 06758146478b16da875008c92e6b9ad62e384ea9 | e8c379a4efe36694a48ecc6fe5cfbabb544aefc3 | refs/heads/master | 2020-05-31T03:45:33.287379 | 2014-06-13T07:15:19 | 2014-06-13T07:15:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,390 | java | package cookbook.hadoop.chapter2;
import java.io.IOException;
import org.apache.avro.mapred.AvroKey;
import org.apache.avro.mapred.AvroValue;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;
//public class WeblogMapper extends MapReduceBase implements Mapper<LongWritable,Text,AvroKey<Long>,AvroValue<Utf8>> {
public class WeblogMapper extends MapReduceBase implements Mapper<LongWritable,Text,AvroKey<Long>,AvroValue<WeblogEntry>> {
//public void map(LongWritable key, Text value,OutputCollector<AvroKey<Long>,AvroValue<Utf8>> out,Reporter reporter) throws IOException {
//out.collect(new AvroKey<Long>(key.get()),new AvroValue<Utf8>(new Utf8(value.toString())));
public void map(LongWritable key, Text value,OutputCollector<AvroKey<Long>,AvroValue<WeblogEntry>> out,Reporter reporter) throws IOException {
String[] valSpl = value.toString().split(",");
WeblogEntry wlEntry = new WeblogEntry();
wlEntry.setCookie(valSpl[0]);
wlEntry.setPage(valSpl[1]);
wlEntry.setDate(valSpl[2]);
wlEntry.setTime(valSpl[3]);
wlEntry.setIp(valSpl[4]);
out.collect(new AvroKey<Long>(key.get()),new AvroValue<WeblogEntry>(wlEntry));
}
} | [
"sivashankar.g@8kmiles.com"
] | sivashankar.g@8kmiles.com |
3fe696c68014bb78f9895fbf57f4673feb0feaa4 | 3bafc9fa5f932689071affd947eedcc3a681583c | /IOT-Guide-DB/src/main/java/com/sanshengshui/dao/sql/JpaAbstractDao.java | 37ee13934bd9068f530c592ee251a9b3c50a4f39 | [
"Apache-2.0"
] | permissive | KunYi/IOT-Technical-Guide | 916b4cf7a3d1533a37a17b22a9de491bfd98bb27 | f9aa88fe172fa58bf39d827c6e26bfbe19da27cd | refs/heads/master | 2020-07-26T06:31:43.757610 | 2019-09-12T15:38:44 | 2019-09-12T15:38:44 | 208,564,609 | 1 | 0 | Apache-2.0 | 2019-09-15T08:34:15 | 2019-09-15T08:34:15 | null | UTF-8 | Java | false | false | 1,468 | java | package com.sanshengshui.dao.sql;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import com.sanshengshui.dao.Dao;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public abstract class JpaAbstractDao<E> extends JpaAbstractDaoListeningExecutorService implements Dao<E> {
protected abstract Class<E> getEntityClass();
protected abstract CrudRepository<E,String> getCrudRepository();
@Override
public List<E> find() {
List<E> entities = Lists.newArrayList(getCrudRepository().findAll());
return entities;
}
@Override
public E findById(Integer id) {
E entity = getCrudRepository().findById(id.toString()).get();
return entity;
}
@Override
public ListenableFuture<E> findByIdAsync(Integer id) {
return service.submit(() -> getCrudRepository().findById(id.toString()).get());
}
@Override
public E save(E e) {
try {
getEntityClass().getConstructor(e.getClass()).newInstance(e);
}catch (Exception ex) {
throw new IllegalArgumentException("Can't create entity for domain object {" + e +"}", ex);
}
return getCrudRepository().save(e);
}
@Override
public boolean removeById(Integer id) {
getCrudRepository().deleteById(id.toString());
return getCrudRepository().findById(id.toString()).isPresent();
}
}
| [
"lovewsic@gmail.com"
] | lovewsic@gmail.com |
98f59b9ebbdbe8f6ba201fc2ac50dfe887c8bcad | f682ce75faa07ecbaa839ec31cc899c2545bae2f | /src/main/java/ru/netology/domain/attachment/Link.java | 03b332f96c6e9f6af10179f14dd7216188975467 | [] | no_license | MarinaOliynyk/3.2.VkPost | 3a0e9d3a6d9239c411c71d20f02eff720f061e40 | eec32fe4c38557f96e42000f9cfe58d7da802686 | refs/heads/master | 2023-03-28T13:16:42.636656 | 2021-04-04T07:52:06 | 2021-04-04T07:52:06 | 354,339,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,312 | java | package ru.netology.domain.attachment;
public class Link {
private String url;
private String title;
private String caption;
private String description;
private Photo photo;
private String previewPage;
private String previewUrl;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Photo getPhoto() {
return photo;
}
public void setPhoto(Photo photo) {
this.photo = photo;
}
public String getPreviewPage() {
return previewPage;
}
public void setPreviewPage(String previewPage) {
this.previewPage = previewPage;
}
public String getPreviewUrl() {
return previewUrl;
}
public void setPreviewUrl(String previewUrl) {
this.previewUrl = previewUrl;
}
}
| [
"marina.shpak@gmail.com"
] | marina.shpak@gmail.com |
2cbbd5f716aadfbaad89ea8e330498f753b11b21 | d0e7623f4ca46a8f9ba0d0714b0976bc659abae2 | /ch.obermuhlner.jhuge.example/src/ch/obermuhlner/jhuge/example/MeasureHeap.java | 1017e0461ee69d67f11b71aecc47c5b61257be5f | [
"MIT"
] | permissive | eobermuhlner/jhuge | 570f11da4d10e091faeacbfc952d4ad81631db42 | 561d5a5ba83eebed5f93a20d9f5e36cfe373d599 | refs/heads/master | 2023-08-01T18:38:59.664558 | 2017-03-04T13:11:03 | 2017-03-04T13:11:03 | 7,729,658 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,793 | java | package ch.obermuhlner.jhuge.example;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import ch.obermuhlner.jhuge.collection.HugeArrayList;
import ch.obermuhlner.jhuge.collection.HugeHashMap;
import ch.obermuhlner.jhuge.collection.HugeHashSet;
import ch.obermuhlner.jhuge.collection.ImmutableHugeHashMap;
import ch.obermuhlner.jhuge.collection.ImmutableHugeHashSet;
/**
* Application to measure the Java heap of several {@link Collection} and {@link Map} implementations.
*
* <p>Use jconsole or jvisualvm to take a heap dump of the running application and analyze it with MAT.</p>
*/
public class MeasureHeap {
/**
* Starts the heap measurement application.
*
* @param args the arguments
*/
public static void main(String[] args) {
measureHeapMemory();
}
@SuppressWarnings("unused")
private static ArrayList<String> staticArrayList;
@SuppressWarnings("unused")
private static HashSet<String> staticHashSet;
@SuppressWarnings("unused")
private static HashMap<String, String> staticHashMap;
@SuppressWarnings("unused")
private static HugeArrayList<String> staticHugeArrayList;
@SuppressWarnings("unused")
private static HugeArrayList<String> staticFastHugeArrayList;
@SuppressWarnings("unused")
private static HugeHashSet<String> staticHugeHashSet;
@SuppressWarnings("unused")
private static HugeHashSet<String> staticFastHugeHashSet;
@SuppressWarnings("unused")
private static ImmutableHugeHashSet<String> staticImmutableHugeHashSet;
@SuppressWarnings("unused")
private static ImmutableHugeHashSet<String> staticFastImmutableHugeHashSet;
@SuppressWarnings("unused")
private static HugeHashMap<String, String> staticHugeHashMap;
@SuppressWarnings("unused")
private static HugeHashMap<String, String> staticFastHugeHashMap;
@SuppressWarnings("unused")
private static ImmutableHugeHashMap<String, String> staticImmutableHugeHashMap;
@SuppressWarnings("unused")
private static ImmutableHugeHashMap<String, String> staticFastImmutableHugeHashMap;
private static void measureHeapMemory() {
int count = 10000;
final int bufferSize = 10 * 1024 * 1024;
staticArrayList = fillCollection(new ArrayList<String>(), count);
staticHashSet = fillCollection(new HashSet<String>(), count);
staticHashMap = fillMap(new HashMap<String, String>(), count);
staticHugeArrayList = fillCollection(new HugeArrayList.Builder<String>().bufferSize(bufferSize).build(), count);
staticFastHugeArrayList = fillCollection(new HugeArrayList.Builder<String>().bufferSize(bufferSize).faster().build(), count);
staticHugeHashSet = new HugeHashSet.Builder<String>().bufferSize(bufferSize).addAll(fillCollection(new ArrayList<String>(), count)).build();
staticFastHugeHashSet = new HugeHashSet.Builder<String>().bufferSize(bufferSize).faster().addAll(fillCollection(new ArrayList<String>(), count)).build();
staticImmutableHugeHashSet = new ImmutableHugeHashSet.Builder<String>().bufferSize(bufferSize).addAll(fillCollection(new ArrayList<String>(), count)).build();
staticFastImmutableHugeHashSet = new ImmutableHugeHashSet.Builder<String>().bufferSize(bufferSize).faster().addAll(fillCollection(new ArrayList<String>(), count)).build();
staticHugeHashMap = fillMap(new HugeHashMap.Builder<String, String>().bufferSize(bufferSize).build(), count);
staticFastHugeHashMap = fillMap(new HugeHashMap.Builder<String, String>().bufferSize(bufferSize).faster().build(), count);
staticImmutableHugeHashMap = new ImmutableHugeHashMap.Builder<String, String>().bufferSize(bufferSize).putAll(fillMap(new HashMap<String, String>(), count)).build();
staticFastImmutableHugeHashMap = new ImmutableHugeHashMap.Builder<String, String>().bufferSize(bufferSize).faster().putAll(fillMap(new HashMap<String, String>(), count)).build();
System.out.println("Ready to take heapdump.");
System.out.println("Open the heapdump in MemoryAnalyzer and look for the static fields of MeasureHeap.");
try {
Thread.sleep(100 * 1000);
} catch (InterruptedException e) {
Thread.interrupted();
}
System.out.println("Goodbye.");
}
private static <T extends Collection<String>> T fillCollection(T collection, int count) {
for (int i = 0; i < count; i++) {
collection.add(valueString(i));
}
return collection;
}
private static <T extends Map<String, String>> T fillMap(T map, int count) {
for (int i = 0; i < count; i++) {
map.put(keyString(i), valueString(i));
}
return map;
}
private static String keyString(int i) {
return "key" + i;
}
private static String valueString(int value) {
return "X" + value;
}
}
| [
"eobermuhlner@gmail.com"
] | eobermuhlner@gmail.com |
7c708e15a574db0d14dd67674a2f24698399e8cb | 8b4f9f1d3c37350c2a78f2e9fb2b9f3526d2b847 | /src/java/products_management/invoice_delete.java | f75ac24045e8a87790a55e9f420d4f37a207c338 | [] | no_license | Charith1994/ToyShop | a9f1d816846c511e418d5f4bb970f2acd12b4c8f | 336572fd7c955a7e5e8b1a1ff23c2faa47208e52 | refs/heads/master | 2021-09-24T08:43:40.912818 | 2018-10-06T06:52:40 | 2018-10-06T06:52:40 | 151,812,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,520 | 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 products_management;
import DB.ActiveState;
import DB.Invoice;
import java.io.IOException;
import java.io.PrintWriter;
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 org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;
/**
*
* @author ZEE
*/
@WebServlet(name = "invoice_delete", urlPatterns = {"/invoice_delete"})
public class invoice_delete extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
int invid=Integer.parseInt(request.getParameter("invid"));
Session hbs=Connection.conn.getSessionFactory().openSession();
Invoice i = (Invoice) hbs.createCriteria(Invoice.class).add(Restrictions.eq("idinvoice", invid)).uniqueResult();
int a=8;
ActiveState act=(ActiveState) hbs.load(ActiveState.class, a);
Transaction tr=hbs.beginTransaction();
i.setActiveState(act);
hbs.update(i);
tr.commit();
String url=request.getParameter("url");
response.sendRedirect(url+"&invid="+invid);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"wcharith@outlook.com"
] | wcharith@outlook.com |
0971a498e325ce1fca132a813d2c28654380045c | bb36adfcbc2fb0a10920d61c7f021782b141fc6c | /experimental/src/main/java/org/jboss/bacon/experimental/impl/config/DependencyResolutionConfig.java | 1b07fcb4f3d39c946efab6bd1b62315700ace977 | [
"Apache-2.0"
] | permissive | jomrazek/bacon | e78a7cd3a357cff96e4a498f3253cc2bc7d8fd6d | e2dc6b754907629972526c7e1ba954fcb6476647 | refs/heads/main | 2023-08-23T05:21:04.985554 | 2023-02-23T19:22:24 | 2023-02-27T19:41:01 | 238,177,390 | 0 | 0 | Apache-2.0 | 2022-03-30T17:16:52 | 2020-02-04T10:16:14 | Java | UTF-8 | Java | false | false | 573 | java | package org.jboss.bacon.experimental.impl.config;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Set;
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class DependencyResolutionConfig {
@NotNull
private Set<String> excludeArtifacts = Set.of();
@NotNull
private Set<String> includeArtifacts = Set.of();
@NotNull
private Set<String> analyzeArtifacts = Set.of();
private String analyzeBOM;
private boolean includeOptionalDependencies = true;
}
| [
"jbrazdil@redhat.com"
] | jbrazdil@redhat.com |
189905d37507b5bc6a81557aae412333afc23632 | 6a30b748f29d0336e756089ddfb434fe41c76bf5 | /test-security-oauth2-master-jwt/service-hi/src/main/java/com/service/hi/servicehi/entity/SysRole.java | eba273552c022b049e1b6037d5f5afd33b4b1951 | [] | no_license | 2578197547/security-Oauth2.0 | 2f96578d9a298ab16e01275c907fe5abfca913dd | 20cd8c2e8c02f23096493cd82ba7ede7fdd0a05e | refs/heads/master | 2022-06-22T14:28:03.399458 | 2019-12-05T09:06:48 | 2019-12-05T09:06:48 | 218,678,223 | 0 | 2 | null | 2022-06-17T02:34:41 | 2019-10-31T03:36:44 | Java | UTF-8 | Java | false | false | 557 | java | package com.service.hi.servicehi.entity;
import javax.persistence.*;
//系统角色
@Entity
@Table(name="sys_role")
public class SysRole {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "name")
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"764682881@qq.com"
] | 764682881@qq.com |
ca2570b64ec427153142f80e4c744070071afc6c | c1af190bec020c3e752fc1e51db86269cb13460b | /src/main/java/com/bootdoplus/system/config/Swagger2Config.java | 8b3ff987205d22e4c3c58218b812f489fc5afd71 | [
"Apache-2.0"
] | permissive | 1471914707/bootdoplus | da65b2410da6bce1717606bb987372468b4a571c | 2a8b8ded611f88d9d53c2b017b926a06cd48c235 | refs/heads/master | 2020-05-21T21:30:30.035280 | 2019-05-14T03:53:55 | 2019-05-14T03:53:55 | 186,154,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,519 | java | package com.bootdoplus.system.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* ${DESCRIPTION}
*
* @author edison
* @create 2017-01-02 23:53
*/
@EnableSwagger2
@Configuration
public class Swagger2Config {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
//为当前包路径
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
//构建 api文档的详细信息函数
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
//页面标题
.title("功能测试")
//创建人
.contact(new Contact("Edison", "xxx@qq.com", "xxx@qq.com"))
//版本号
.version("1.0")
//描述
.description("API 描述")
.build();
}
} | [
"1471914707@qq.com"
] | 1471914707@qq.com |
900b60912f28d908efb4038902a0a633cfcaee46 | 7fb9ca48e43d1b31d5ddbf21233a950a063db166 | /book_ws/src/com/learning/ws/jaxws/EmployeeServiceImpl.java | c9cc97e241bb43d7098c41cd8fb52dde2ff4ff3d | [] | no_license | mudunuri1234/webservices | d896ed8c99efc49d720ef6e9da24a7680919af0d | 9efedbbadb42801e861ac39ca7d3c840e0da51ce | refs/heads/master | 2020-12-24T14:56:23.467979 | 2015-03-10T17:34:49 | 2015-03-10T17:34:49 | 31,968,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,810 | java | package com.learning.ws.jaxws;
import javax.jws.*;
import javax.xml.ws.*;
import javax.annotation.PostConstruct;
@WebService(name="EmployeeService",
//targetNamespace="http://jaxws.ws.learning.com/",
serviceName="employeeService",
portName="EmployeeServicePort",
//wsdlLocation="",
endpointInterface="com.learning.ws.jaxws.EmployeeService")
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING)
public class EmployeeServiceImpl implements EmployeeService {
// @Resource
// private WebServiceContext context;
//
// public EmployeeServiceImpl() {
// System.out.println("---------Constructor called --------");
// }
//
// @PostConstruct
// private void init() {
// System.out.println("--------- Init Perform required initialization --------");
// }
//
// @PostConstruct
// private void start() {
// System.out.println("--------- Start Perform required initialization --------");
// }
public Employee getEmployee(String employeeId) throws EmployeeFault {
System.out.println("--------- employeeId --------" + employeeId);
// if(context != null) {
// System.out.println(" ----- UserPrincipal -----" + context.getUserPrincipal());
// System.out.println(" ----- isUserInRole -----" + context.isUserInRole("admin"));
// MessageContext messageContext = context.getMessageContext();
// System.out.println(" ----- SERVLET_REQUEST ---- " + messageContext.SERVLET_REQUEST);
// }
if(employeeId == null) {
throw new EmployeeFault("Invalid input received");
}
Employee emp = new Employee();
emp.setEmployeeId(employeeId);
if("99999".equalsIgnoreCase(employeeId)) {
emp.setFirstName("XXXXX");
emp.setLastName("XXXXX");
} else {
emp.setFirstName("John");
emp.setLastName("Smith");
}
return emp;
}
public String getEmployeeAddressInfo(String employeeId) throws Exception {
System.out.println("--------- Address employeeId --------" + employeeId);
String address = "3943 Roundabout CIR, Chandler, Arizona, 85226";
return address;
}
public void deleteEmployee(String employeeId) {
System.out.println("--------- Delete Employee --------" + employeeId);
//Implement your logic here to delete an employee
}
public String getEmployerInformation(String employeeId, String state) throws Exception {
String employer = "Bank of Chandler , Chandler, Arizona, 85226";
return employer;
}
// @PreDestroy
// private void doCleanUp() {
// System.out.println("--------- Perform clean-up after you are done with it --------");
// }
}
| [
"Achyutha.Mudunuri@pearson.com"
] | Achyutha.Mudunuri@pearson.com |
e9217e9cf4a7debe9d4df26fbd493e7e52de354b | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /api-vs-impl-small/domain/src/main/java/org/gradle/testdomain/performancenull_14/Productionnull_1335.java | 12c6db00a8935e0be4b5e210322bc32c015775ee | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 591 | java | package org.gradle.testdomain.performancenull_14;
public class Productionnull_1335 {
private final String property;
public Productionnull_1335(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
b453c88df55c4b566c9f938b31aed680359a28aa | 7e077598bd08b3e16ec03872702b4f70683c7061 | /src/pbo2/pkg10118078/latihan61/bangunruang/pkg1/Bola.java | 2b423f76e38f1d8275f55aaeeae7a3767f8f5bc0 | [] | no_license | StevenDanesswaralay/PBO2-10118078-Latihan61-BangunRuang | 5e5f7b7f5b1100561770e0de487e21e0e7fb2759 | a05c12b1cd1caa48c1e6cc0b36e6adddbce8c475 | refs/heads/master | 2020-08-27T00:09:54.957403 | 2019-10-24T02:02:19 | 2019-10-24T02:02:19 | 217,190,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | 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 pbo2.pkg10118078.latihan61.bangunruang.pkg1;
/**
*
* @author
* Nama : Steven Danesswaralay
* Kelas : PBO2
* Nim : 10118078
* Deskripsi Tugas : Bangun Ruang
*/
public class Bola implements BangunRuang{
private int jari;
public int getJari() {
return jari;
}
public void setJari(int jari) {
this.jari = jari;
}
@Override
public double hitungVolume(){
return 4.0/3.0 * 22.0/7.0 * Math.pow(jari, 3);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
6760081db282d8a80ef7aaf0a4a464418126c2ca | 13fe4da27c4c5c61874ff1d0439beaa89376f62e | /src/gui/MyPopupMenu.java | 341bfd94fd8608d41e98c08e2df694c42d8f78d6 | [] | no_license | htl-vil-3BHIF-17-18/Eder_Hohenwarter_Salcher_Zerza_TASKPLANER | 4ba29cf0f53a1aafa631c5ce2c4e9435b247bce6 | 0c032df76fd5e3b4627a211229ab244d75f326b0 | refs/heads/master | 2020-03-11T07:59:00.013988 | 2018-05-09T12:46:12 | 2018-05-09T12:46:12 | 129,871,585 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,254 | java | package gui;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
public class MyPopupMenu extends JPopupMenu {
JMenuItem menuItemLoeschen = null;
JMenuItem menuItemAendern = null;
ActionListener listener = null;
public MyPopupMenu(ActionListener listener) {
this.listener = listener;
menuItemLoeschen = new JMenuItem("Löschen");
menuItemLoeschen.setActionCommand("ContexteMenuLoeschen");
menuItemLoeschen.addActionListener(this.listener);
menuItemAendern = new JMenuItem("Ändern");
menuItemAendern.setActionCommand("ContexteMenuAendern");
menuItemAendern.addActionListener(this.listener);
this.add(menuItemLoeschen);
this.add(menuItemAendern);
}
}
class PopupListener extends MouseAdapter {
JPopupMenu popup;
PopupListener(JPopupMenu popupMenu) {
popup = popupMenu;
}
public void mousePressed(MouseEvent e) {
maybeShowPopup(e);
}
public void mouseReleased(MouseEvent e) {
maybeShowPopup(e);
}
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
popup.show(e.getComponent(), e.getX(), e.getY());
}
}
} | [
"edere@Rene-Laptop"
] | edere@Rene-Laptop |
b54473021dededea2b862cc1aae6e7ec74a59bc5 | da1cb3cb23262a9134cf1e49d1932b769087213f | /05-oauth2/oauth2-library-server/src/main/java/com/example/library/server/config/WebSecurityConfiguration.java | d029d97c8b019725cf728ba25a064cd9770fd591 | [
"MIT"
] | permissive | taqeem/reactive-spring-security-5-workshop | d44aaa0cb34402704c79233b0933b757967928aa | 05928e223b1fd78bd374044f4ab5f1303bee60b0 | refs/heads/master | 2020-04-02T01:41:05.698341 | 2018-10-19T07:44:58 | 2018-10-19T07:44:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,767 | java | package com.example.library.server.config;
import com.example.library.server.common.Role;
import org.springframework.boot.actuate.autoconfigure.security.reactive.EndpointRequest;
import org.springframework.boot.autoconfigure.security.reactive.PathRequest;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.method.configuration.EnableReactiveMethodSecurity;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;
@EnableWebFluxSecurity
@EnableReactiveMethodSecurity
public class WebSecurityConfiguration {
@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http
.csrf().disable()
.authorizeExchange()
.matchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
.matchers(EndpointRequest.to("health")).permitAll()
.matchers(EndpointRequest.to("info")).permitAll()
.matchers(EndpointRequest.toAnyEndpoint()).hasRole(Role.ADMIN.name())
.pathMatchers(HttpMethod.POST, "/books").hasAuthority("SCOPE_curator")
.pathMatchers(HttpMethod.DELETE, "/books").hasAuthority("SCOPE_curator")
.pathMatchers("/users/**").hasAuthority("SCOPE_admin")
.pathMatchers("/books/**").hasAuthority("SCOPE_user")
.anyExchange().authenticated()
.and()
.oauth2ResourceServer()
.jwt();
return http.build();
}
} | [
"andreas.falk@novatec-gmbh.de"
] | andreas.falk@novatec-gmbh.de |
48016eba42c667b92b7485a1852ae7b5195e4e64 | 8863d4d6ec20339661872fa9726fbc4c36e9418c | /src/main/java/com/reginaldoleobino/bookstoremanager/entity/Book.java | 01f7825add9ba6b00ace088587150e4db281651f | [] | no_license | leobinoreginaldo/bookstore_manager_course | 3baff73dd91c6ffd04704892bdf1ad96c688b050 | 50d474ec4ec5d847f74f6ba8a00d3731c5914059 | refs/heads/master | 2023-01-30T23:43:00.500116 | 2020-12-05T20:22:40 | 2020-12-05T20:22:40 | 318,851,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 886 | java | package com.reginaldoleobino.bookstoremanager.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Book {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true)
private String name;
@Column(nullable = false)
private Integer pages;
@Column(nullable = false)
private Integer Chapters;
@Column(nullable = false)
private String isbn;
@Column(name = "publisher_name", nullable = false, unique = true)
private String publisherName;
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
@JoinColumn(name = "author_id")
private Author author;
}
| [
"leobinoreginaldo@gmail.com"
] | leobinoreginaldo@gmail.com |
c60cff99b7d62e17c2bada6eddc229c229fa591b | 13cbb329807224bd736ff0ac38fd731eb6739389 | /com/sun/xml/internal/ws/wsdl/writer/document/xsd/package-info.java | 2f07618f5713c27d5007ddfcfb3d70f7fe68167a | [] | no_license | ZhipingLi/rt-source | 5e2537ed5f25d9ba9a0f8009ff8eeca33930564c | 1a70a036a07b2c6b8a2aac6f71964192c89aae3c | refs/heads/master | 2023-07-14T15:00:33.100256 | 2021-09-01T04:49:04 | 2021-09-01T04:49:04 | 401,933,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.sun.xml.internal.ws.wsdl.writer.document.xsd;
import com.sun.xml.internal.txw2.annotation.XmlNamespace;
/* Location: D:\software\jd-gui\jd-gui-windows-1.6.3\rt.jar!\com\sun\xml\internal\ws\wsdl\writer\document\xsd\package-info.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.0.7
*/ | [
"michael__lee@yeah.net"
] | michael__lee@yeah.net |
822af76c2d79873d81304c68a2217ebad89284ff | 35a7a7147153c8a2a39d381e3b790a699a47eb0b | /app/src/main/java/edu/floridapoly/mobiledeviceapp/fall19/toptiertabletop/data/LoginRepository.java | a593256b7e34ee622f08e4f12e79bf134a5c14df | [] | no_license | christiancrossbaugh/TopTierTabletop | e21991117a6f0b97c43d19ccff0cf1124332e5c1 | 230395191c9b9c5b668ee1ca1448e05588802832 | refs/heads/master | 2020-09-11T06:20:35.500354 | 2019-11-22T04:53:24 | 2019-11-22T04:53:24 | 221,969,080 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,779 | java | package edu.floridapoly.mobiledeviceapp.fall19.toptiertabletop.data;
import edu.floridapoly.mobiledeviceapp.fall19.toptiertabletop.data.model.LoggedInUser;
/**
* Class that requests authentication and user information from the remote data source and
* maintains an in-memory cache of login status and user credentials information.
*/
public class LoginRepository {
private static volatile LoginRepository instance;
private LoginDataSource dataSource;
// If user credentials will be cached in local storage, it is recommended it be encrypted
// @see https://developer.android.com/training/articles/keystore
private LoggedInUser user = null;
// private constructor : singleton access
private LoginRepository(LoginDataSource dataSource) {
this.dataSource = dataSource;
}
public static LoginRepository getInstance(LoginDataSource dataSource) {
if (instance == null) {
instance = new LoginRepository(dataSource);
}
return instance;
}
public boolean isLoggedIn() {
return user != null;
}
public void logout() {
user = null;
dataSource.logout();
}
private void setLoggedInUser(LoggedInUser user) {
this.user = user;
// If user credentials will be cached in local storage, it is recommended it be encrypted
// @see https://developer.android.com/training/articles/keystore
}
public Result<LoggedInUser> login(String username, String password) {
// handle login
Result<LoggedInUser> result = dataSource.login(username, password);
if (result instanceof Result.Success) {
setLoggedInUser(((Result.Success<LoggedInUser>) result).getData());
}
return result;
}
}
| [
"christiancrosser@live.com"
] | christiancrosser@live.com |
4a09e2a84aa1caa2e3f43485e5bce9a5a96039c6 | 78fae32aab3900572d7ece09b2d50dd645999344 | /src/main/java/com/vipin/Test.java | a0a213d6ef71d22fd5b2e3364490a4bae3471195 | [] | no_license | vipendrapal/v123 | eff29a5403d286d9b7050468a787a77e3725b7a0 | 912c370938a29d62d4bff6af792e2f907311e6c1 | refs/heads/master | 2021-01-13T14:48:39.046147 | 2019-02-21T20:11:58 | 2019-02-21T20:11:58 | 76,533,756 | 0 | 0 | null | 2019-02-21T20:36:48 | 2016-12-15T07:14:30 | Java | UTF-8 | Java | false | false | 43 | java | package com.vipin;
public class Test {
}
| [
"vipinnpa199031@gmail.com"
] | vipinnpa199031@gmail.com |
795633e3c63857d9e7a414f6f18f7732d9944b46 | 9e1a3a3d4a9d87a9b0b1aae33f518f54a6889009 | /src/main/java/com/expedia/hackathon/project101/domain/Hotel.java | d7917cc627c0af21b608fdcb6dd6119803623c84 | [] | no_license | Yashswarnkar/hackathon | e239658c2f309d0006d3ba284b93291ae1cce9b3 | a70d2be77b362e97df657bfe8bdb0f500693a87d | refs/heads/master | 2020-03-24T05:38:44.698080 | 2018-07-27T04:59:15 | 2018-07-27T04:59:15 | 142,496,161 | 0 | 0 | null | 2018-07-26T21:33:12 | 2018-07-26T21:33:12 | null | UTF-8 | Java | false | false | 1,125 | java | package com.expedia.hackathon.project101.domain;
public class Hotel {
String name;
String address;
Integer price;
Float rating;
Float distance;
public Hotel(String name, String address, Integer price, Float rating, Float distance) {
this.name = name;
this.address = address;
this.price = price;
this.rating = rating;
this.distance = distance;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Float getRating() {
return rating;
}
public void setRating(Float rating) {
this.rating = rating;
}
public Float getDistance() {
return distance;
}
public void setDistance(Float distance) {
this.distance = distance;
}
}
| [
"akainth@expedia.com"
] | akainth@expedia.com |
3550acdeb2f53b91d63670072c867a1dc71add1e | 08814b0270d20f280c0e20c67e7591f712a2d2aa | /codebase-master/src/test/java/com/codebase/AhungTestClass.java | 321417eac480b36d06f088c135ddcdc5c46f0ac3 | [] | no_license | Waqasihs/ihsAutomation | ec175ff57772747ca9bfb9e1ad753b819ddf4ca5 | f18283ba1625a4cec8ab9bfeaf1399478e19fef2 | refs/heads/master | 2023-01-23T17:35:17.698222 | 2019-10-30T08:48:06 | 2019-10-30T08:48:06 | 203,348,871 | 0 | 0 | null | 2023-01-05T23:44:13 | 2019-08-20T09:57:18 | HTML | UTF-8 | Java | false | false | 1,525 | java | package com.codebase;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.baseClass.BaseUi;
import com.resources.DSLLibDesktop;
public class AhungTestClass {
DSLLibDesktop dsl;
//public String xPath = "D:/Excels/MyExcel.xls";
//public String xPath = "D:/Excels/MyFirstExcel.xlsx";
//public String xlPath_Res = "D:/Excels/userStatuses.xlsx";
//public static String XData[][];
//public String xlData[][];
@BeforeClass
public void beforeClass() throws Exception {
dsl = new DSLLibDesktop();
//dsl.launchCubixCo();
//dsl.launchGoogle();
//dsl.xlRead(xPath);
dsl.launchAhung();
}
@Test
public void Test01_Verify_Ahung_Title() {
dsl.ahungtestclass.CompareAgahiTitle();
}
@Test
public void Test02_Verify_Ahung_Logo() {
dsl.ahungtestclass.CheckAhungLogo();
}
@Test
public void Test03_Enter_User_Id() {
dsl.ahungtestclass.EnterUserId();
}
@Test
public void Test04_Enter_Password() {
dsl.ahungtestclass.EnterPassword();
}
@Test
public void Test05_Perform_Login() {
dsl.ahungtestclass.PerformLogin();
}
/*
* @Test public void Test03_Verify_Country_Name() {
* dsl.googletestclass.CheckFooterCountryName(); }
*/
@AfterClass
public void afterClass() throws Exception {
dsl.closeBrowser();
//xlwrite(xlPath_Res, XData);//Writes the results
//BaseUi.xlwrite(xlPath_Res, XData);
}
}
| [
"waqas.ahmed@ihsinformatics.com"
] | waqas.ahmed@ihsinformatics.com |
e7787305d4d343ceda6d57f14350205eee0313e6 | 7330286847e63809d87c319ef33d04d038f1bbad | /eletro-tec-motor/eletro-tec-motor/src/main/java/br/com/eletrotecmotor/modelo/Status.java | 9b1782500c8b9bfc9fd1ffcc5dfe57051dd38b9f | [] | no_license | ArthurFerreira13/Projeto-Final | 90cb48a697ca9edda91fceaa4890cc365988828a | f9e8362635010032ab1a4c6766ff9e3bb9755e17 | refs/heads/main | 2023-06-04T10:05:24.037921 | 2021-06-28T12:45:59 | 2021-06-28T12:45:59 | 377,825,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 274 | java | package br.com.eletrotecmotor.modelo;
public enum Status {
Fechado, //pedido cancelado
Concluido, // entregue ao cliente
Em_Andamento, // sendo executado
Em_Espera, //esperando peças
Retirada, // retirado pelo cliente
Aberto, // abertura do pedido
}
| [
"noreply@github.com"
] | noreply@github.com |
570485dd0aa81cd28b62d949f6001ab12c741154 | 2e5f2b6e2f97dde3cf9b3f96686c95236f9de527 | /app/src/test/java/com/iqmsoft/selenium/DemoServiceIT.java | 38575287401edec4374a4db981e668590dd5ed5f | [] | no_license | Murugar/SpringBootSeleniumCucumber | 8eeb69fdbad7a7ed8f8ab1579158190201722bf4 | 8b3cd09081fff8a6a74e117488ed588ffd608bf2 | refs/heads/master | 2021-08-31T13:20:50.976154 | 2017-12-21T12:44:20 | 2017-12-21T12:44:20 | 115,004,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,442 | java | package com.iqmsoft.selenium;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.StringUtils;
@RunWith(SpringRunner.class)
public class DemoServiceIT {
private static final Logger LOG = LoggerFactory.getLogger(DemoServiceIT.class);
private String springAppUrl;
@Before
public void setup() {
springAppUrl = System.getProperty("spring.app.url");
LOG.info("spring.app.url={}", springAppUrl);
if (StringUtils.isEmpty(springAppUrl)) {
throw new IllegalArgumentException("System property spring.app.url is not defined!");
}
}
@Test
public void testLog() throws Exception {
TestRestTemplate restTemplate = new TestRestTemplate();
ResponseEntity<String> response = restTemplate.getForEntity(springAppUrl, String.class);
assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
assertTrue(response.getBody().contains("Hello Selenium Cucumber There!"));
}
}
| [
"davanon2014@gmail.com"
] | davanon2014@gmail.com |
f7dfe45c131a210283953f820dce638689b4dad4 | 17c9d0b0f761fabff4e82e93c9e78c3204077d81 | /java_day04/src/com/itheima/_myArray01/MyArrayTest7.java | 5b6fdb1adcae31c4b9e0646b8283b4217082efb9 | [] | no_license | AMCNL/JAVASE_HM | 1864749f2a978d49a7df1970627e1820feb9d997 | f6dae36e38db7f552d2afcdbba559c630883d8c1 | refs/heads/master | 2023-03-24T04:25:13.474733 | 2021-03-18T18:18:31 | 2021-03-18T18:18:31 | 349,175,790 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 929 | java | package com.itheima._myArray01;
import java.util.Scanner;
/*
需求:评委打分案例:
键盘录入 6个分数,去掉一个最高分和最低分,得出最后平均分数。
*/
public class MyArrayTest7 {
public static void main(String[] args) {
//定义一个int类型,长度为6的数组
int[] arr = new int[6];
Scanner sc = new Scanner(System.in);
int max = arr[0];
int min = arr[0];
//定义一个求和变量
int sum=0;
//定义一个平均值变量
int avg=0;
for(int i=0;i<arr.length;i++){
System.out.print("请输入第个"+(i+1)+"分数:");
arr[i] = sc.nextInt();
//求出最高分
if(arr[i]>max){
max = arr[i];
}
//求出最高低分
if(arr[i]<min){
min = arr[i];
}
sum += arr[i];
}
avg = (sum-max-min)/(arr.length-2);
System.out.println("去掉一个最低分,去掉一个最高分,评委平局分为:"+avg);
}
}
| [
"am_cnl@163.com"
] | am_cnl@163.com |
67aa3439eac3ab3cdc1a67aa3e21a3f9b4926caf | 1a8c83b941e9ff1bd28f2cd7c8d3d6c96d595217 | /src/b32900_Exp017_ChainOfResponsibilityPattern/Test.java | f6fddcbd014f6a2ac87af7bcb065b9002a67bc85 | [] | no_license | billydevInGitHub/32900 | 2eed5a69ed7c795d4884c7f15b714dfd0e964903 | 1e83ef2649bc9569aad1db20a369fa2e50bf280d | refs/heads/master | 2020-12-19T06:22:56.583500 | 2020-03-23T20:19:12 | 2020-03-23T20:19:12 | 235,646,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,093 | java | package b32900_Exp017_ChainOfResponsibilityPattern;
interface Handler {
public void operator();
}
abstract class AbstractHandler {
private Handler handler;
public Handler getHandler() {
return handler;
}
public void setHandler(Handler handler) {
this.handler = handler;
}
}
class MyHandler extends AbstractHandler implements Handler {
private String name;
public MyHandler(String name) {
this.name = name;
}
@Override
public void operator() {
System.out.println(name+"deal!");
if(getHandler()!=null){
getHandler().operator();
}
}
}
public class Test {
public static void main(String[] args) {
MyHandler h1 = new MyHandler("h1");
MyHandler h2 = new MyHandler("h2");
MyHandler h3 = new MyHandler("h3");
h1.setHandler(h2);
h2.setHandler(h3);
h1.operator();
}
}
| [
"billydev@gmail.com"
] | billydev@gmail.com |
97d4f97f737df59c11b506c81b1a5f52121c28dc | 19f6a03d7b485d6ec03b1ed6121008b305ba2b6d | /src/com/song/crm/utils/NavigationTag.java | 773a8ec73fbe0973910ee645d507a9c2967b70e9 | [] | no_license | songjipo/crm | 7314e2833139d572ef414b3191b7c86e1422ff25 | 26d355fbf66527e8fa1d083ed375e669b7c190ea | refs/heads/master | 2020-03-23T19:34:51.360936 | 2018-07-23T09:01:48 | 2018-07-23T09:01:48 | 141,988,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,118 | java | package com.song.crm.utils;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
/**
* 显示格式 上一页 1 2 3 4 5 下一页
*/
public class NavigationTag extends TagSupport {
static final long serialVersionUID = 2372405317744358833L;
/**
* request 中用于保存Page<E> 对象的变量名,默认为“page”
*/
private String bean = "page";
/**
* 分页跳转的url地址,此属性必须
*/
private String url = null;
/**
* 显示页码数量
*/
private int number = 5;
@Override
public int doStartTag() throws JspException {
JspWriter writer = pageContext.getOut();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
Page page = (Page) request.getAttribute(bean);
if (page == null)
return SKIP_BODY;
url = resolveUrl(url, pageContext);
try {
// 计算总页数
int pageCount = page.getTotal() / page.getSize();
if (page.getTotal() % page.getSize() > 0) {
pageCount++;
}
//writer.print("共" + page.getTotal() + "条");
writer.print("<nav><ul class=\"pagination\">" + "<li>共" + page.getTotal() + "条</li>");
// 显示“上一页”按钮
if (page.getPage() > 1) {
String preUrl = append(url, "page", page.getPage() - 1);
preUrl = append(preUrl, "rows", page.getSize());
writer.print("<li><a href=\"" + preUrl + "\">上一页</a></li>");
} else {
writer.print("<li class=\"disabled\"><a href=\"#\">上一页</a></li>");
}
// 显示当前页码的前2页码和后两页码
// 若1 则 1 2 3 4 5, 若2 则 1 2 3 4 5, 若3 则1 2 3 4 5,
// 若4 则 2 3 4 5 6 ,若10 则 8 9 10 11 12
int indexPage = (page.getPage() - 2 > 0) ? page.getPage() - 2 : 1;
for (int i = 1; i <= number && indexPage <= pageCount; indexPage++, i++) {
if (indexPage == page.getPage()) {
writer.print("<li class=\"active\"><a href=\"#\">" + indexPage
+ "<span class=\"sr-only\">(current)</span></a></li>");
continue;
}
String pageUrl = append(url, "page", indexPage);
pageUrl = append(pageUrl, "rows", page.getSize());
writer.print("<li><a href=\"" + pageUrl + "\">" + indexPage + "</a></li>");
}
// 显示“下一页”按钮
if (page.getPage() < pageCount) {
String nextUrl = append(url, "page", page.getPage() + 1);
nextUrl = append(nextUrl, "rows", page.getSize());
writer.print("<li><a href=\"" + nextUrl + "\">下一页</a></li>");
} else {
writer.print("<li class=\"disabled\"><a href=\"#\">下一页</a></li>");
}
writer.print("</nav>");
} catch (IOException e) {
e.printStackTrace();
}
return SKIP_BODY;
}
private String append(String url, String key, int value) {
return append(url, key, String.valueOf(value));
}
/**
* 为url 参加参数对儿
*
* @param url
* @param key
* @param value
* @return
*/
private String append(String url, String key, String value) {
if (url == null || url.trim().length() == 0) {
return "";
}
if (url.indexOf("?") == -1) {
url = url + "?" + key + "=" + value;
} else {
if (url.endsWith("?")) {
url = url + key + "=" + value;
} else {
url = url + "&" + key + "=" + value;
}
}
return url;
}
/**
* 为url 添加翻页请求参数
*
* @param url
* @param pageContext
* @return
* @throws javax.servlet.jsp.JspException
*/
private String resolveUrl(String url, javax.servlet.jsp.PageContext pageContext) throws JspException {
// UrlSupport.resolveUrl(url, context, pageContext)
Map params = pageContext.getRequest().getParameterMap();
for (Object key : params.keySet()) {
if ("page".equals(key) || "rows".equals(key))
continue;
Object value = params.get(key);
if (value == null)
continue;
try {
if (value.getClass().isArray()) {
// 解决GET乱码问题
// value = new String(((String[])
// value)[0].getBytes("ISO-8859-1"), "UTF-8");
value = ((String[]) value)[0];
url = append(url, key.toString(), value.toString());
} else if (value instanceof String) {
// 解决GET乱码问题
// value = new String(((String)
// value).getBytes("ISO-8859-1"), "UTF-8");
value = (String) value;
url = append(url, key.toString(), value.toString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
return url;
}
/**
* @return the bean
*/
public String getBean() {
return bean;
}
/**
* @param bean
* the bean to set
*/
public void setBean(String bean) {
this.bean = bean;
}
/**
* @return the url
*/
public String getUrl() {
return url;
}
/**
* @param url
* the url to set
*/
public void setUrl(String url) {
this.url = url;
}
public void setNumber(int number) {
this.number = number;
}
}
| [
"songjipo@foxmail.com"
] | songjipo@foxmail.com |
13cfbd027bf020566cfc296c619ebd5c4cf0fa32 | c537179bde7979a4219eac0ca2fa177f5be6d651 | /unit6/part1/Inheritance103.java | 08006ec47bd085ec94f32f2e1340a428ef2672df | [] | no_license | SHamzaN/gradeninejava | 81068429750d2f68f95fd255248566fa45801a71 | 1739ba31b64b42f1d91524a088149ecc4461c462 | refs/heads/main | 2023-08-17T00:59:05.140286 | 2021-07-09T00:06:51 | 2021-07-09T00:06:51 | 380,394,494 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | package ghar.javawork.virtual.unit6.part1;
import java.util.Scanner;
public class Inheritance103
{
public static void main(String[] args)
{
//Scanner s = new Scanner(System.in);
//System.out.println("Enter grade level: ");
//int g1 = s.nextInt();
//Student3 stu = new Student3(g1);
//Student3 stu = new Student3(9);
//How do we handle multiple parameters with different inheritance levels?
Student3 stu = new Student3(14,9);
System.out.println("The student's GradeLevel is: " + stu.getGradeLevel());
System.out.println("The student's age is: " + stu.getAge());
}
} | [
"noreply@github.com"
] | noreply@github.com |
734c0704360243605626ccbf569240fe08265c4a | a5f27dc2edff723cbad320d832b56050ec93cb82 | /src/main/java/com/restx/data/datatabs/RegularOrderDetails.java | c563b097c1be0eecf89d08e02d8224e2f350f16d | [] | no_license | wailyousif/BetaRestaurant | 01eb9c2ab9bc7b65d76d9788ef7859e0644c62a2 | bff166784f92688958af333e3fe92821dea631c1 | refs/heads/master | 2019-07-16T06:23:40.204986 | 2017-06-30T16:29:04 | 2017-06-30T16:29:04 | 93,104,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 813 | java | package com.restx.data.datatabs;
import javax.persistence.*;
import java.util.Date;
/**
* Created by wailm.yousif on 6/2/17.
*/
@Entity
public class RegularOrderDetails
{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "regular_order_details_seq")
@SequenceGenerator(name="regular_order_details_seq", sequenceName = "regular_order_details_seq", allocationSize = 1, initialValue = 1)
private long id;
@ManyToOne
private RestaurantBranch restaurantBranch;
@ManyToOne
private RegularOrder regularOrder;
@ManyToOne
private SalesItem salesItem;
private int quantity;
private double unitPrice;
private double totalPrice;
private Date creationTime;
@ManyToOne
private AppUser appUser;
public RegularOrderDetails() { }
}
| [
"wailm.yousif@Wails-MacBook-Pro.local"
] | wailm.yousif@Wails-MacBook-Pro.local |
348d6d7506902ea2e3edb4cae8d09d9339fff4d1 | 61402a647b6dedf9225eedef8849ca7e0cb88af4 | /src/main/java/com/ig/web/exception/InvalidResponseException.java | 7845f9bbf34e5c7fcd2bd76f096ea0f1a66f2e45 | [] | no_license | amanbansalnz/ig-file-sender | 544f15297f930d5f75955e49d070592b47ba022c | a7b9a8c3cac1c3403c01d17e50e9f7d55d959910 | refs/heads/master | 2023-08-23T17:46:38.043699 | 2020-08-17T11:02:37 | 2020-08-17T11:02:37 | 124,373,295 | 0 | 0 | null | 2023-07-17T20:41:54 | 2018-03-08T10:07:38 | Java | UTF-8 | Java | false | false | 507 | java | package com.ig.web.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
import java.rmi.RemoteException;
@ResponseStatus(
code = HttpStatus.BAD_GATEWAY
)
public class InvalidResponseException extends RemoteException {
public InvalidResponseException(String message) {
this(message, (Throwable) null);
}
public InvalidResponseException(String message, Throwable cause) {
super(message, cause);
}
}
| [
"amanbansalnz@github.com"
] | amanbansalnz@github.com |
642db20f263972952e5a316871d5e364c450bca6 | 403c61783aee403911fb39fee856fca36bec6bb8 | /src/hoover/IHoover.java | d23484318840f1ddbb6ee148abb782f7b70f46e9 | [] | no_license | JeridiOmar/IHoover | 1babe9bfba2b7c8efc1cdc94840ee41b0968c812 | 4df1771dac7886d3890018d3fb2017c28540992e | refs/heads/master | 2023-09-02T16:54:49.230170 | 2021-11-14T20:22:11 | 2021-11-14T20:22:11 | 428,030,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package hoover;
public interface IHoover {
public void rotateToLeft();
public void rotateToRight();
public void advance();
public int getCurrentX();
public int getCurrentY();
public void showCurrentPosition();
}
| [
"50057549+JeridiOmar@users.noreply.github.com"
] | 50057549+JeridiOmar@users.noreply.github.com |
aeecf5311bd4a3e2c0213f2a82626f31d0be5b38 | 2048cdc60e433955c01a5ec0ab89e5b24a3ccc78 | /src/game1/Car.java | 7375f46d9a50896113e3e7f46cab95571edc4518 | [] | no_license | Margo63/gameNet4Syti | 21055a4f8beddea2cc25545fe32460dae03bd4a4 | 099e8be9c4baa69a8b5c6b8491a2f7b8ce2b9e8f | refs/heads/master | 2022-12-26T01:21:23.843239 | 2020-10-04T11:33:56 | 2020-10-04T11:33:56 | 280,910,233 | 0 | 0 | null | null | null | null | WINDOWS-1251 | Java | false | false | 10,680 | java | package game1;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import game.Button;
import game3.Office;
import main.MainBut;
import main.Time_Police;
import main.variables;
import player.Player;
public class Car {
public static ImageIcon image;
public static Image im1,im2,im3,iim1,iim2,iim3;
JButton button1,button2,button3,bbutton1,bbutton2,bbutton3;
public static JPanel p,p2;
public static JFrame f=null,f2=null;
int h;
public int x,y,type;
public Image img;
public int x1=5,x2=5,x3=5;
public boolean but1=false,but2=false,but3=false;
public int xx1=5,xx2=5,xx3=5;
public boolean bbut1=false,bbut2=false,bbut3=false;
public boolean e_car=false;
public Car(Image im,int x,int y,int type_car,boolean e_car){
this.e_car=e_car;
this.img=im;
this.x=x;
this.y=y;
this.type=type_car; //1-машина с бензином, 2-машина с собакой
}
public void car_coll() {
if(Panel.player.x-Panel.player.directionX*5+Panel.player.pers.getWidth(null)>=x &&
Panel.player.x-Panel.player.directionX*5<=x+img.getWidth(null) &&
Panel.player.y+Panel.player.directionY*5<y+img.getHeight(null) &&
Panel.player.y+Panel.player.directionY*5+Panel.player.pers.getHeight(null)>=y) {
e_car=true;
switch (type) {
case 1:
if(Player.ee){
frame();
}
break;
case 2:
if(Player.ee){
frame_2();
}
break;
}
}
else {
e_car=false;
}
}
public void car_move() {
x-=Panel.player.directionX/5;
y-=Panel.player.directionY/5;
}
public void frame() {
Player.ee=false;
variables.car_panel=variables.null_image;
if(f==null){
f= new JFrame();
f.setUndecorated(true);
f.setBounds(variables.width/2-variables.width/6,variables.height/2-variables.height/6,variables.width/3,variables.height/3);
}
f.setVisible(true);
p =new JPanel() {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(variables.white_fon, 0,0, variables.width,variables.height, null);
g.drawImage(variables.car_panel, 0,0,variables.width/3,variables.height/3, null);
g.drawImage(variables.line2, f.getWidth()-2, 0, 2,variables.height, null);
g.drawImage(variables.line2, 0, 0, 2,variables.height, null);
g.drawImage(variables.line1, 0, 0, variables.width,2, null);
g.drawImage(variables.line1, 0, f.getHeight()-2, variables.width,2, null);
}
};
p.setLayout(null);
if (!but1){
button1 = new JButton(){
protected void paintComponent(Graphics g){
super.paintComponent(g);
im1= new ImageIcon("image/1/c3.png").getImage();//багет
if(!but1){
g.drawImage(im1,0,0,null);
}
//g.drawImage(new ImageIcon("image/game3/task/task1.png").getImage(),0,0,null);
}
};
button1.setBounds(x1, 5, 300, 50);
button1.setOpaque(false);
button1.setContentAreaFilled(false);
button1.setBorderPainted(false);
button1.setVisible(true);
button1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
x1=1000;
button1.setVisible(false);
but1=true;
im1=variables.null_image;
x2=1000;
button2.setVisible(false);
but2=true;
im2=variables.null_image;
x3=1000;
button3.setVisible(false);
but3=true;
im3=variables.null_image;
variables.car_panel=variables.mol;
p.repaint();
}
});
p.add(button1);
}
if (!but2){
button2 = new JButton(){
protected void paintComponent(Graphics g){
super.paintComponent(g);
im2= new ImageIcon("image/1/c2.png").getImage();//багет
if(!but2){
g.drawImage(im2,0,0,null);
}
//g.drawImage(new ImageIcon("image/game3/task/task1.png").getImage(),0,0,null);
}
};
button2.setBounds(x2, 65, 300, 50);
button2.setOpaque(false);
button2.setContentAreaFilled(false);
button2.setBorderPainted(false);
button2.setVisible(true);
button2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
x1=1000;
button1.setVisible(false);
but1=true;
im1=variables.null_image;
x2=1000;
button2.setVisible(false);
but2=true;
im2=variables.null_image;
x3=1000;
button3.setVisible(false);
but3=true;
im3=variables.null_image;
variables.car_panel=variables.ok;
p.repaint();
}
});
p.add(button2);
}
if (!but3){
button3 = new JButton(){
protected void paintComponent(Graphics g){
super.paintComponent(g);
im3= new ImageIcon("image/1/c1.png").getImage();//багет
if(!but3){
g.drawImage(im3,0,0,null);
}
//g.drawImage(new ImageIcon("image/game3/task/task1.png").getImage(),0,0,null);
}
};
button3.setBounds(x3, 125, 300, 50);
button3.setOpaque(false);
button3.setContentAreaFilled(false);
button3.setBorderPainted(false);
button3.setVisible(true);
button3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
x1=1000;
button1.setVisible(false);
but1=true;
im1=variables.null_image;
x2=1000;
button2.setVisible(false);
but2=true;
im2=variables.null_image;
x3=1000;
button3.setVisible(false);
but3=true;
im3=variables.null_image;
variables.car_panel=variables.net;
p.repaint();
}
});
p.add(button3);
}
f.add(p);
Button.but_close(p,f);
}
public void frame_2() {
Player.ee=false;
variables.car_panel=variables.null_image;
if(f2==null){
f2= new JFrame();
f2.setUndecorated(true);
f2.setBounds(variables.width/2-variables.width/6,variables.height/2-variables.height/6,variables.width/3,variables.height/3);
}
f2.setVisible(true);
p2 =new JPanel() {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(variables.white_fon, 0,0, variables.width,variables.height, null);
g.drawImage(variables.car_panel, 0,0,variables.width/3,variables.height/3, null);
g.drawImage(variables.line2, f2.getWidth()-2, 0, 2,variables.height, null);
g.drawImage(variables.line2, 0, 0, 2,variables.height, null);
g.drawImage(variables.line1, 0, 0, variables.width,2, null);
g.drawImage(variables.line1, 0, f2.getHeight()-2, variables.width,2, null);
}
};
p2.setLayout(null);
//if(h==1) {
if (!bbut1){
bbutton1 = new JButton(){
protected void paintComponent(Graphics g){
super.paintComponent(g);
iim1= new ImageIcon("image/1/cc1.png").getImage();//багет
if(!bbut1){
g.drawImage(iim1,0,0,null);
}
//g.drawImage(new ImageIcon("image/game3/task/task1.png").getImage(),0,0,null);
}
};
bbutton1.setBounds(xx1, 5, 350, 50);
bbutton1.setOpaque(false);
bbutton1.setContentAreaFilled(false);
bbutton1.setBorderPainted(false);
bbutton1.setVisible(true);
bbutton1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
xx1=1000;
bbutton1.setVisible(false);
bbut1=true;
iim1=variables.null_image;
xx2=1000;
bbutton2.setVisible(false);
bbut2=true;
iim2=variables.null_image;
xx3=1000;
bbutton3.setVisible(false);
bbut3=true;
iim3=variables.null_image;
variables.car_panel=variables.mol;
p2.repaint();
}
});
p2.add(bbutton1);
}
if (!bbut2){
bbutton2 = new JButton(){
protected void paintComponent(Graphics g){
super.paintComponent(g);
iim2= new ImageIcon("image/1/cc2.png").getImage();//багет
if(!bbut2){
g.drawImage(iim2,0,0,null);
}
//g.drawImage(new ImageIcon("image/game3/task/task1.png").getImage(),0,0,null);
}
};
bbutton2.setBounds(xx2, 65, 350, 100);
bbutton2.setOpaque(false);
bbutton2.setContentAreaFilled(false);
bbutton2.setBorderPainted(false);
bbutton2.setVisible(true);
bbutton2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
time.stop();
Instance.car2.img=variables.carr;
xx1=1000;
bbutton1.setVisible(false);
bbut1=true;
iim1=variables.null_image;
xx2=1000;
bbutton2.setVisible(false);
bbut2=true;
iim2=variables.null_image;
xx3=1000;
bbutton3.setVisible(false);
bbut3=true;
iim3=variables.null_image;
variables.car_panel=variables.police;
new Time_Police();
p2.repaint();
variables.MainPanel.repaint();
}
});
p2.add(bbutton2);
}
if (!bbut3){
bbutton3 = new JButton(){
protected void paintComponent(Graphics g){
super.paintComponent(g);
iim3= new ImageIcon("image/1/c2.png").getImage();//багет
if(!bbut3){
g.drawImage(iim3,0,0,null);
}
//g.drawImage(new ImageIcon("image/game3/task/task1.png").getImage(),0,0,null);
}
};
bbutton3.setBounds(xx3, 185, 350, 50);
bbutton3.setOpaque(false);
bbutton3.setContentAreaFilled(false);
bbutton3.setBorderPainted(false);
bbutton3.setVisible(true);
bbutton3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
xx1=1000;
bbutton1.setVisible(false);
bbut1=true;
iim1=variables.null_image;
xx2=1000;
bbutton2.setVisible(false);
bbut2=true;
iim2=variables.null_image;
xx3=1000;
bbutton3.setVisible(false);
bbut3=true;
iim3=variables.null_image;
variables.car_panel=variables.ok;
p2.repaint();
}
});
p2.add(bbutton3);
}
f2.add(p2);
Button.but_close(p2,f2);
}
int i ;
Timer time;
Image [] images = new Image [7];
void animation() {
time= new Timer(300, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (i<5) {
i++;
}
else {
i = 0;
}
img = images[i];
variables.MainPanel.repaint();
}
});
time.start();
}
}
| [
"margo-vinograd@mail.ru"
] | margo-vinograd@mail.ru |
2c697cbccc03b033cc9032acecd4af1c697dcd4d | 681c87f95539b97bb866428dd9b1459708f87ee9 | /src/main/java/cn/jing/concurrency/annotations/ThreadSafe.java | 9da8b105deef6fe8305c226a5fb4fd9bd8b8c609 | [] | no_license | liangjingdev/concurrency | 7fbe118637f1f3c99bc12c1b3b30aa7755fad40e | c7a3b54e2e19ae0b1cb8ae96eb38b912edb6d579 | refs/heads/master | 2020-03-19T03:28:51.233479 | 2018-07-04T14:44:18 | 2018-07-04T14:44:18 | 135,731,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package cn.jing.concurrency.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* function:为了更好的更方便的理解项目中的代码,可以定义一些自己的注解。
*
* @author liangjing
*
*/
// 用来标记线程安全的类或者写法
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE)
public @interface ThreadSafe {
String value() default "";
}
| [
"1184106223@qq.com"
] | 1184106223@qq.com |
6901210372c91ed9235593619e220002ecb8bb50 | 32b0e43c4427c847aff066aabb203b321fa7ac77 | /processor/src/test/resources/io/t28/auto/truth/test/type/AbstractClassSubject.java | aa13a220ab18ba03dab1101ed344ecfb452b6458 | [
"Apache-2.0"
] | permissive | t28hub/auto-truth | 04de099430a3c8383e77ff485f701e9d4c738233 | e8300b3b9937c44f6cba26867b9e6e7d4f3db360 | refs/heads/master | 2023-08-18T01:07:45.789245 | 2020-08-21T10:05:21 | 2020-08-21T10:05:21 | 227,858,744 | 0 | 1 | Apache-2.0 | 2023-09-04T14:47:52 | 2019-12-13T14:35:32 | Kotlin | UTF-8 | Java | false | false | 965 | java | /*
* Copyright 2020 Tatsuya Maki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.t28.auto.truth.test.type;
import com.google.common.truth.FailureMetadata;
import io.t28.auto.truth.AutoSubject;
@AutoSubject(AbstractClass.class)
public class AbstractClassSubject extends AutoAbstractClassSubject {
protected AbstractClassSubject(FailureMetadata failureMetadata, AbstractClass actual) {
super(failureMetadata, actual);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
73d57123574d050d81cd6be83d08302de36db1e8 | 9218a73f43ab3b7e3ef10cdb10f237e368711854 | /src/listner/ML.java | e8881c7c608f6af7a4d02d890de9e15f1d57958a | [] | no_license | leo13200006/Pong-Game | c623f4604591075eb7dbc1d2c9b40477f5bfae66 | d0c728dbb310198bae0206d29a36477b579acc81 | refs/heads/main | 2023-03-06T23:42:06.155215 | 2021-02-27T07:20:35 | 2021-02-27T07:21:56 | 342,796,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package listner;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
public class ML extends MouseAdapter implements MouseMotionListener {
public boolean isPressed = false;
public double x = 0.0, y = 0.0;
@Override
public void mousePressed(MouseEvent e) {
isPressed = true;
}
@Override
public void mouseReleased(MouseEvent e) {
isPressed = false;
}
@Override
public void mouseMoved(MouseEvent e) {
x = e.getX();
y = e.getY();
}
public double getX() {
return this.x;
}
public double getY() {
return this.y;
}
}
| [
"laukikchavan101@gmail.com"
] | laukikchavan101@gmail.com |
49a307c03c51f28f6c44d33152be8d82735f0e18 | 83aaa3300c46cdc2fb1c9df923f4f0a43eb97f03 | /Webchat/tests/webchat/tests/message/networking/client/MessageClientTest.java | 9b4ab2e6e235a8e20519beb8d7e7249db5725627 | [] | no_license | Denton-L/Java-Webchat | d22053c9a9b0f6072e249b915fbbef64ebc61166 | e9a2e0d24909ac6c2b828fc68c53efe734f37411 | refs/heads/master | 2021-01-15T15:05:47.787574 | 2016-01-16T23:39:38 | 2016-01-16T23:39:38 | 35,890,574 | 2 | 2 | null | 2015-12-29T02:35:41 | 2015-05-19T15:22:11 | Java | UTF-8 | Java | false | false | 212 | java | package webchat.tests.message.networking.client;
import junit.framework.TestCase;
public class MessageClientTest extends TestCase {
protected void setUp() throws Exception {
super.setUp();
}
}
| [
"f.francet@hotmail.com"
] | f.francet@hotmail.com |
cff90e4ddf9bd029c6a621884d810b1db6ea5617 | 992308f24ede2aa8b3a82fd97e275707f030f641 | /src/com/xiaolianhust/thinkinginjava/chapter20/Testable.java | 880172a1b25fe991471a6d04622628dbe6fb8feb | [] | no_license | hustxiaolian/ThinkingInJava | 011a2ffab8f7c1f27dd9dd800c6091ded70d55d6 | 3019fa64c8ff94e2510e7e7b518d4ef077b18430 | refs/heads/master | 2020-03-20T18:19:21.556916 | 2018-07-24T13:21:52 | 2018-07-24T13:21:52 | 137,582,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package com.xiaolianhust.thinkinginjava.chapter20;
public class Testable {
public void excute() {
System.out.println("Executing.. ");
}
@Test
void testExcute() {
excute();
}
}
| [
"2504033134@qq.com"
] | 2504033134@qq.com |
4fdfd40a18df18e2525a02558ba5c0310c0c233d | 1a32edefd0d0f86ca28e8cb1a4bec3a159f46ad1 | /app/src/main/java/nanorstudios/ie/listbuddy/PagerAdapter.java | 9bc052bcb8e2f059fa5db224131f168972cd381b | [] | no_license | ronandoyle/ListBuddy | 773a751e9e7113817817807f093d6cae2a14cd6e | e2aef9feb64cd97e35da070f23510bbd4c547728 | refs/heads/master | 2021-01-19T02:40:21.831233 | 2016-06-27T12:51:20 | 2016-06-27T12:51:20 | 61,546,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 815 | java | package nanorstudios.ie.listbuddy;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
/**
* TODO Update this line
*
* @author Ronan Doyle
*/
public class PagerAdapter extends FragmentStatePagerAdapter {
int mNumOfTabs;
public PagerAdapter(FragmentManager fm, int NumOfTabs) {
super(fm);
this.mNumOfTabs = NumOfTabs;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return new PrivateListFragment();
case 1:
return new GroupListFragment();
default:
return null;
}
}
@Override
public int getCount() {
return mNumOfTabs;
}
} | [
"ronandoyle91@gmail.com"
] | ronandoyle91@gmail.com |
4f83c14ed9a006b03b42ab492a849861bcaf2a9b | 68c248da242e01afa3a0c4f3f505745168a143cd | /app/src/main/java/com/phoenix/codeutsava/maa/home_page_vaccines_1/HomeCallBack.java | 0a4f375bb7467e49be998896b489a4e1a1c374d7 | [] | no_license | AmanAg513/maa | ea8def04b82779507a3c90a0589134ce82ceb33d | c0f7747e63ddb7dcba55df3a6bc79f30ece1c56e | refs/heads/master | 2021-01-09T05:36:37.187646 | 2017-02-05T07:27:38 | 2017-02-05T07:27:38 | 80,803,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | package com.phoenix.codeutsava.maa.home_page_vaccines_1;
import com.phoenix.codeutsava.maa.home_page_vaccines_1.model.data.HomeData;
/**
* Created by aman on 4/2/17.
*/
public interface HomeCallBack {
void onSuccess(HomeData homeData);
void onFailure();
}
| [
"amanjain.1596@gmail.com"
] | amanjain.1596@gmail.com |
b8de031cb1252081d84a604fdf7da1b60d87c9cd | e1b6c8b5411831b9a715a398d1be6846d554abe2 | /src/test/java/hantczak/studentDataStorage/utils/StudentBuilder.java | fa25fffbd7a0e5f29902616cb45a329c81da4e57 | [] | no_license | hantczak/StudentDataStorage | 303626ce1a97075963e8c1885f7f98c89d8d695a | e6308a69b5fe6630e9a59f0af41ecd74a047cc22 | refs/heads/master | 2023-08-16T13:58:11.707380 | 2021-10-10T23:13:02 | 2021-10-10T23:13:02 | 333,171,176 | 1 | 0 | null | 2021-10-10T23:13:02 | 2021-01-26T18:02:02 | Java | UTF-8 | Java | false | false | 1,582 | java | package hantczak.studentDataStorage.utils;
import hantczak.studentDataStorage.student.domain.Gender;
import hantczak.studentDataStorage.student.domain.Student;
import java.time.LocalDate;
public class StudentBuilder {
private Long id = null;
private String name = "abc";
private String email = "abc@gmail.com";
private LocalDate dateOfBirth = LocalDate.of(2009, 06, 05);
private Integer age = 12;
private Gender gender = Gender.MALE;
public StudentBuilder() {
}
public static StudentBuilder create() {
return new StudentBuilder();
}
public StudentBuilder setId(Long id) {
this.id = id;
return this;
}
public StudentBuilder setName(String name) {
this.name = name;
return this;
}
public StudentBuilder setEmail(String email) {
this.email = email;
return this;
}
public StudentBuilder setDateOfBirth(LocalDate dateOfBirth) {
this.dateOfBirth = dateOfBirth;
return this;
}
public StudentBuilder setAge(Integer age) {
this.age = age;
return this;
}
public StudentBuilder setGender(Gender gender) {
this.gender = gender;
return this;
}
public Student build() {
Student student = new Student();
if (this.id != null) {
student.setId(id);
}
student.setName(name);
student.setEmail(email);
student.setDateOfBirth(dateOfBirth);
student.setAge(age);
student.setGender(gender);
return student;
}
}
| [
"hantczak8@gmail.com"
] | hantczak8@gmail.com |
b252ddf04327b74401827cdef64784655ea227b2 | 929789b6a4bae4edb6f85e57883e48c2d3fa3cb1 | /mongo-hb-mapping/src/model/HikeSection.java | fa150834646fe108e7ea7a0a61b0c0d3727765b5 | [] | no_license | ashish-panicker/deloitte-collection-sort | 4f10cd66360908b7ea3a364644f721e47c75fe73 | e03a7c20d5986ac3a9c656ade9a3c2422939443c | refs/heads/master | 2023-05-11T23:52:43.519739 | 2023-05-01T12:24:16 | 2023-05-01T12:24:16 | 230,854,216 | 0 | 0 | null | 2023-05-01T12:24:18 | 2019-12-30T05:35:25 | JavaScript | UTF-8 | Java | false | false | 496 | java | package model;
import javax.persistence.Embeddable;
@Embeddable
public class HikeSection {
private String start;
private String end;
public HikeSection() {
super();
}
public HikeSection(String start, String end) {
super();
this.start = start;
this.end = end;
}
public String getStart() {
return start;
}
public void setStart(String start) {
this.start = start;
}
public String getEnd() {
return end;
}
public void setEnd(String end) {
this.end = end;
}
}
| [
"ashish.s.panicker@gmail.com"
] | ashish.s.panicker@gmail.com |
c7ecb974fa13dec908878c96af98516fcee5dfb9 | 4b246c21b51578ceef245f4429b1cbd2cc00d4a7 | /src/main/java/com/google/devtools/build/lib/unix/LocalSocket.java | d51f2bad366852ee1e13a472bd8ee80289ab890f | [
"Apache-2.0"
] | permissive | pubref/bazel | 74bee90f521b95c2e38f0a4dee9bc4c1058aa52b | 7b5e1af31f8aeb0e0264035ab6ff4e1cb955c509 | refs/heads/master | 2020-12-28T19:47:45.385795 | 2016-08-24T16:36:45 | 2016-08-24T20:01:37 | 66,587,609 | 0 | 0 | Apache-2.0 | 2022-10-22T00:57:25 | 2016-08-25T19:39:49 | Java | UTF-8 | Java | false | false | 6,527 | java | // Copyright 2014 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.unix;
import com.google.devtools.build.lib.UnixJniLoader;
import java.io.Closeable;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
/**
* Abstract superclass for client and server local sockets.
*/
abstract class LocalSocket implements Closeable {
protected enum State {
NEW,
BOUND, // server only
LISTENING, // server only
CONNECTED, // client only
CLOSED,
}
protected LocalSocketAddress address = null;
protected FileDescriptor fd = new FileDescriptor();
protected State state;
protected boolean inputShutdown = false;
protected boolean outputShutdown = false;
/**
* Constructs an unconnected local socket.
*/
protected LocalSocket() throws IOException {
socket(fd);
if (!fd.valid()) {
throw new IOException("Couldn't create socket!");
}
this.state = State.NEW;
}
/**
* Returns the address of the endpoint this socket is bound to.
*
* @return a <code>SocketAddress</code> representing the local endpoint of
* this socket.
*/
public LocalSocketAddress getLocalSocketAddress() {
return address;
}
/**
* Closes this socket. This operation is idempotent.
*
* To be consistent with Java Socket, the shutdown states of the socket are
* not changed. This makes it easier to port applications between Socket and
* LocalSocket.
*
* @throws IOException if an I/O error occurred when closing the socket.
*/
@Override
public synchronized void close() throws IOException {
if (state == State.CLOSED) {
return;
}
// Closes the file descriptor if it has not been closed by the
// input/output streams.
if (!fd.valid()) {
throw new IllegalStateException("LocalSocket.close(-1)");
}
close(fd);
if (fd.valid()) {
throw new IllegalStateException("LocalSocket.close() did not set fd to -1");
}
this.state = State.CLOSED;
}
/**
* Returns the closed state of the ServerSocket.
*
* @return true if the socket has been closed
*/
public synchronized boolean isClosed() {
// If the file descriptor has been closed by the input/output
// streams, marks the socket as closed too.
return state == State.CLOSED;
}
/**
* Returns the connected state of the ClientSocket.
*
* @return true if the socket is currently connected.
*/
public synchronized boolean isConnected() {
return state == State.CONNECTED;
}
protected synchronized void checkConnected() throws SocketException {
if (!isConnected()) {
throw new SocketException("Transport endpoint is not connected");
}
}
protected synchronized void checkNotClosed() throws SocketException {
if (isClosed()) {
throw new SocketException("socket is closed");
}
}
/**
* Returns the shutdown state of the input channel.
*
* @return true is the input channel of the socket is shutdown.
*/
public synchronized boolean isInputShutdown() {
return inputShutdown;
}
/**
* Returns the shutdown state of the output channel.
*
* @return true is the input channel of the socket is shutdown.
*/
public synchronized boolean isOutputShutdown() {
return outputShutdown;
}
protected synchronized void checkInputNotShutdown() throws SocketException {
if (isInputShutdown()) {
throw new SocketException("Socket input is shutdown");
}
}
protected synchronized void checkOutputNotShutdown() throws SocketException {
if (isOutputShutdown()) {
throw new SocketException("Socket output is shutdown");
}
}
static final int SHUT_RD = 0; // Mapped to BSD SHUT_RD in JNI.
static final int SHUT_WR = 1; // Mapped to BSD SHUT_WR in JNI.
public synchronized void shutdownInput() throws IOException {
checkNotClosed();
checkConnected();
checkInputNotShutdown();
inputShutdown = true;
shutdown(fd, SHUT_RD);
}
public synchronized void shutdownOutput() throws IOException {
checkNotClosed();
checkConnected();
checkOutputNotShutdown();
outputShutdown = true;
shutdown(fd, SHUT_WR);
}
////////////////////////////////////////////////////////////////////////
// JNI:
static {
UnixJniLoader.loadJni();
}
// The native calls below are thin wrappers around linux system calls. The
// semantics remains the same except for poll(). See the comments for the
// method.
//
// Note: FileDescriptor is a box for a mutable integer that is visible only
// to native code.
// Generic operations:
protected static native void socket(FileDescriptor server)
throws IOException;
static native void close(FileDescriptor server)
throws IOException;
/**
* Shut down part of a full-duplex connection
* @param code Must be either SHUT_RD or SHUT_WR
*/
static native void shutdown(FileDescriptor fd, int code)
throws IOException;
/**
* This method checks waits for the given file descriptor to become available for read.
* If timeoutMillis passed and there is no activity, a SocketTimeoutException will be thrown.
*/
protected static native void poll(FileDescriptor read, long timeoutMillis)
throws IOException, SocketTimeoutException, InterruptedIOException;
// Server operations:
protected static native void bind(FileDescriptor server, String filename)
throws IOException;
protected static native void listen(FileDescriptor server, int backlog)
throws IOException;
protected static native void accept(FileDescriptor server,
FileDescriptor client)
throws IOException;
// Client operations:
protected static native void connect(FileDescriptor client, String filename)
throws IOException;
}
| [
"yueg@google.com"
] | yueg@google.com |
d17f3772159bef92f5d22a48fc2b7bdb3dc6d9c2 | 84a52f524a92323a3a0bdf295e219935541201c9 | /src/edu/rice/jz52/player/request/GameBoardRequest.java | 6f557e1650c136d9bef33792a1a8453c5f720f87 | [] | no_license | JieZhu/Comp405_finalProject | d300047d5d7999cd3baaee288e3308dbfff8944d | 1a8056bb84925da5d1b358de715f0eb94763228e | refs/heads/master | 2020-05-02T20:22:27.648266 | 2015-04-16T04:25:48 | 2015-04-16T04:25:48 | 34,019,737 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | /**
*
*/
package edu.rice.jz52.player.request;
import com.google.web.bindery.requestfactory.shared.InstanceRequest;
import com.google.web.bindery.requestfactory.shared.Request;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import com.google.web.bindery.requestfactory.shared.Service;
import edu.rice.jz52.player.stub.GameBoardProxy;
import edu.rice.jz52.server.domain.GameBoard;
/**
* @author jz52@rice.edu
*
*/
@Service(GameBoard.class)
public interface GameBoardRequest extends RequestContext {
Request<GameBoardProxy> findGameBoard(Long id);
InstanceRequest<GameBoardProxy, Void> persist();
InstanceRequest<GameBoardProxy, Void> remove();
}
| [
"jiezhu@Jies-MacBook-Pro.local"
] | jiezhu@Jies-MacBook-Pro.local |
2f2d0da848c3943676c189e27bc7a8390f7f190d | 8fad1c51b037873fd8b5c90c981cec250b0736e3 | /game/AttackControl.java | bb2c02575de5de8ab7f55c736f312bb2858e1812 | [] | no_license | BrentGammon/8BitWarriors | b1aef635339caebd9d05fae71593b5943dd77bb0 | a373cdf8aaff20f78b36452e1992073124d19e2b | refs/heads/master | 2020-03-25T19:10:28.891934 | 2016-04-05T18:38:38 | 2016-04-05T19:43:15 | 62,824,791 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,177 | java | import greenfoot.*;
import javax.swing.*;
/**
* This is used to allow the player to set the key binding for attack
*
* @author Brent Gammon
* @version v0.1
*/
public class AttackControl extends KeyBindings
{
/**
* Construtor for AttackControl
* Will set the image of the object
*/
public AttackControl()
{
setImage("/Settings/Sword.png");
}
/**
* When the object has been clicked it will ask the player to input a string value this value will be stored as a keybinding for attack
*/
public void act()
{
if(Greenfoot.mouseClicked(this))
{
String x= Greenfoot.ask("Attack Key");
if(validKey(x)){
if(!(keyInUse(x))){
Player.keyAttack = x;
}else{
JOptionPane.showMessageDialog(null, "Key already in use", "Input a key that is not in use",
JOptionPane.ERROR_MESSAGE);
}
}else{
JOptionPane.showMessageDialog(null, "Not a Valid Key", "Input a valid key",
JOptionPane.ERROR_MESSAGE);
}
}
}
}
| [
"bg240@kent.ac.uk"
] | bg240@kent.ac.uk |
70312982d5d2899ecf1df731f2aeb10387403fbf | a27a3e07d13e7b1955a8f9f77e9203c18502ae22 | /Android Projelerim/app/src/main/java/com/example/emir/siparisistemi/VeriErisim.java | e0a579c2c9a9e6eeece5b5bdc9753b3dbb1a7b10 | [] | no_license | emirkocabey/SiparisSistemi | 1b431671024728f9f92f25ddb30e44d4e9ab0687 | 5802d44c3c8cbb78d903d7c7f9be14b3a59dd6fc | refs/heads/master | 2021-08-29T17:31:17.508307 | 2017-12-14T13:18:13 | 2017-12-14T13:18:13 | 114,252,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,359 | java | package com.example.emir.siparisistemi;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import static java.lang.String.valueOf;
public class VeriErisim {
private SQLiteDatabase db;
private final Context context;
private final DBHelper dbYardimcisi;
public VeriErisim(Context c) {
context=c;
dbYardimcisi=new DBHelper(context);
}
public void veritabaniniKapat(){
db.close();
}
public void veritabaninaBaglan() throws SQLiteException {
try{
db= dbYardimcisi.getWritableDatabase();
}catch (SQLiteException ex){
db=dbYardimcisi.getReadableDatabase();
}
}
public long KullaniciEkle(int id,String kulAdi,String sifre){
try{
ContentValues yeniContentValue = new ContentValues();
yeniContentValue.put("_id",id);
yeniContentValue.put("kulAdi",kulAdi);
yeniContentValue.put("sifre",sifre);
return db.insert("Kullanici",null,yeniContentValue);
}catch (SQLiteException ex){
return -1;
}
}
public long SehirEkle(int id,String adi,Double enlem,Double boylam){
try{
ContentValues yeniContentValue = new ContentValues();
yeniContentValue.put("_id",id);
yeniContentValue.put("adi",adi);
yeniContentValue.put("enlem",enlem);
yeniContentValue.put("boylam",boylam);
return db.insert("Sehirler",null,yeniContentValue);
}catch (SQLiteException ex){
return -1;
}
}
public Cursor SehirleriCek() {
String sql="SELECT * FROM Sehirler";
Cursor cursor=db.rawQuery(sql,null);
return cursor;
}
public Cursor KullaniciyiCek() {
String sql="SELECT * FROM Kullanici";
Cursor cursor=db.rawQuery(sql,null);
return cursor;
}
public long veritabaniniBosalt() {
return db.delete("Kullanici",null,null);
}
public long SehirleriBosalt() {
return db.delete("Sehirler",null,null);
}
public long TempSehirleriBosalt() {
return db.delete("Temp_Sehirler",null,null);
}
public Cursor SehiriGetir(int i) {
String sql="SELECT * FROM Sehirler WHERE _id="+i;
Cursor cursor=db.rawQuery(sql,null);
return cursor;
}
public long Temp_SehirEkle(int i, String string, Double a) {
try{
ContentValues yeniContentValue = new ContentValues();
yeniContentValue.put("_id",i);
yeniContentValue.put("adi",string);
yeniContentValue.put("uzaklik",a);
return db.insert("Temp_Sehirler",null,yeniContentValue);
}catch (SQLiteException e){
e.printStackTrace();
return -1;
}
}
public Cursor TempSehirleriGetir() {
Cursor cursor = null;
try {
String sql = "SELECT _id,adi,uzaklik FROM Temp_Sehirler ORDER BY uzaklik ASC";
cursor = db.rawQuery(sql, null);
} catch (Exception e) {
e.printStackTrace();
}
return cursor;
}
void deneme(){
//Depo.dialog.show();
Cursor csSehir = null,tmpSehirler;
Double a;
for (int i = 0; i < 81; i++) {
csSehir = SehiriGetir(i + 1);
//startManagingCursor(csSehir);
csSehir.moveToFirst();
/*a = ((Depo.konum.latitude - csSehir.getDouble(2))*(Depo.konum.latitude - csSehir.getDouble(2)))+((Depo.konum.longitude-csSehir.getDouble(3))*(Depo.konum.longitude-csSehir.getDouble(3)));
*/
a = (Math.pow((csSehir.getDouble(2) - Depo.konum.latitude), 2)) + Math.pow((csSehir.getDouble(3) - Depo.konum.longitude), 2);
a = Math.sqrt(a);
Temp_SehirEkle(i + 1, csSehir.getString(1), a);
}
csSehir.close();
//en yakına karar verip döndürme
tmpSehirler = TempSehirleriGetir();
//startManagingCursor(tmpSehirler);
tmpSehirler.moveToFirst();
Depo.sehirKodu = tmpSehirler.getInt(0);
tmpSehirler.close();
TempSehirleriBosalt();
}
}
| [
"kocabeyemir12@gmail.com"
] | kocabeyemir12@gmail.com |
5297555b1be1b35903ca306606352784c48de985 | 08d1f80f0aeb1cd8bddfacbce63501ce0d4c989f | /fish-api/src/main/java/com/ff/shop/model/GoodsCate.java | 8bb1e2e0304bbde26755335b5a275f8e31f3a581 | [] | no_license | id-jinxiaoming/gongchengpingtai | 02d4490705d55b95d8e76478cb1f4d804dd9bd18 | ba00c7e1dc1f9e3834f39c08fe0f5283c1d6c08d | refs/heads/master | 2023-02-05T22:15:36.023487 | 2020-12-28T02:38:53 | 2020-12-28T02:38:53 | 324,893,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,982 | java | package com.ff.shop.model;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import com.ff.common.base.BaseModel;
/**
* <p>
*
* </p>
*
* @author Yuzhongxin
* @since 2017-07-24
*/
@TableName("tb_goods_cate")
public class GoodsCate extends BaseModel implements Comparable<GoodsCate> {
private static final long serialVersionUID = 1L;
@TableId(value="cate_id", type= IdType.AUTO)
private Integer cateId;
@TableField("parent_id")
private Integer parentId;
@TableField("cate_name")
private String cateName;
@TableField("meta_keywords")
private String metaKeywords;
@TableField("meta_description")
private String metaDescription;
@TableField("img_url")
private String imgUrl;
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
private Integer seq;
public Integer getCateId() {
return cateId;
}
public void setCateId(Integer cateId) {
this.cateId = cateId;
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getCateName() {
return cateName;
}
public void setCateName(String cateName) {
this.cateName = cateName;
}
public String getMetaKeywords() {
return metaKeywords;
}
public void setMetaKeywords(String metaKeywords) {
this.metaKeywords = metaKeywords;
}
public String getMetaDescription() {
return metaDescription;
}
public void setMetaDescription(String metaDescription) {
this.metaDescription = metaDescription;
}
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public int compareTo(GoodsCate o) {
int i = this.getSeq() - o.getSeq();//先按照年龄排序
return i;
}
}
| [
"1031257666@qq.com"
] | 1031257666@qq.com |
ddb8a208aed6e982432bf61df3e3ae5d560db6ab | b5ed5e4bd15595bc2b56deeaa87c3f1f8d245bc2 | /app/src/main/java/com/sanok/rdred/ImageAdapter.java | 4c19a610bec4b801d7ef9342c216837aec8dd55f | [] | no_license | SanoKhan22/SOT-tipsandTricks | 2535dba25eddb7f2219020d3adccb167bf36ebef | 43a9e7ca5bc3f476548e1d043faf03cbb12b6cda | refs/heads/master | 2022-11-10T05:22:14.909327 | 2020-06-23T08:40:33 | 2020-06-23T08:40:33 | 271,312,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,285 | java | package com.sanok.rdred;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;
public class ImageAdapter extends PagerAdapter {
private Context mContext;
private int[] mimgids = new int[]{R.drawable.red1,R.drawable.red2,R.drawable.red3,R.drawable.red5,R.drawable.red6,R.drawable.red7,R.color.colorPrimaryDark};
ImageAdapter(Context context){
mContext = context;
}
@Override
public int getCount() {
return mimgids.length;
}
@Override
public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
return view == object;
}
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
ImageView imageView = new ImageView(mContext);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageResource(mimgids[position]);
container.addView(imageView,0);
return imageView;
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
container.removeView((ImageView) object);
}
}
| [
"ehsanokhan90@gmail.com"
] | ehsanokhan90@gmail.com |
75e1dc0ece7699e3c7c24013605e35b618fbfba8 | 643dfad4437195ad08a40c9ade2bd410b90e311d | /src/main/java/model/RealCustomer.java | 647d65da04e8f727baca6e912cc9b22a063bfe55 | [] | no_license | sedigheMohebbi/LoanManegement | af53cebbc6b67dd28cecc7f4c187e6422ae8a0ca | be03d3b4853189913b7825f64970f6acd32811b0 | refs/heads/master | 2021-01-10T21:49:51.450152 | 2015-09-14T05:50:22 | 2015-09-14T05:50:22 | 42,032,936 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,451 | java | package model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
@Entity
@Table(name = "realcustomer")
@PrimaryKeyJoinColumn(name = "id")
public class RealCustomer extends Customer {
@Column(name = "nationalCode")
private String nationalCode;
@Column(name = "birthDate")
private String birthDate;
@Column(name = "fatherName")
private String fatherName;
@Column(name = "lastName")
private String lastName;
@Column(name = "firstName")
private String firstName;
public String getNationalCode() {
return nationalCode;
}
public void setNationalCode(String nationalCode) {
this.nationalCode = nationalCode.trim();
}
public String getBirthDate() {
return birthDate;
}
public void setBirthDate(String birthDate) {
this.birthDate = birthDate.trim();
}
public String getFatherName() {
return fatherName;
}
public void setFatherName(String fatherName) {
this.fatherName = fatherName.trim();
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName.trim();
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName.trim();
}
}
| [
"bit.mohebbi@gmail.com"
] | bit.mohebbi@gmail.com |
2ee0c8200d776442a115dbdd666f0b309f6b2a04 | 25df6627aa12e39bbf19617606d18c90a30172cf | /Java/src/test/_Emloyee.java | 219f3fcd7c5b474bebebe36948c68923d0d6792a | [] | no_license | dlwo01/github50 | ae527df99d2cba60236aaeb6c74691b146edf4c6 | 93254809d3385729013b745dddbefae87169906a | refs/heads/master | 2020-06-26T23:33:27.299173 | 2019-07-31T06:03:35 | 2019-07-31T06:03:35 | 199,788,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 901 | java | package test;
public class _Emloyee {int sabun;
String name;
String deptName;
int basicSalary; // 기본급
public _Emloyee () {
this.deptName = "인사";
this.basicSalary = 10000;
}
public void setSabun(int sabun){
this.sabun = sabun;
}
public int getSabun() {
return sabun;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setDeptName(String Name) {
this.deptName = deptName;
}
public String getDeptName() {
return deptName;
}
public void setBasicSalary(int basicsalary) {
this.basicSalary = basicSalary;
}
public int getBasicSalary() {
return basicSalary;
}
public void printInfo() {
System.out.println("사번 :" + sabun +" 이름 : " + name + " 부서명" + deptName + " 기본급:" + basicSalary + " 수당 :");
}
}
| [
"kosmo26@DESKTOP-TP6RN64"
] | kosmo26@DESKTOP-TP6RN64 |
8c7ee147c59469bfcebb498ff1c01ba5d32ffd3d | 2189811c683848e46d69ed2e50fdc6c187241dd0 | /src/service/domain/Student.java | e2c8be19647c04b6dae00411c5971dd2ad08928e | [] | no_license | fabverto/SENG300Project | 9f145530d55ca8760848015726e70cf6b559e83a | 35fe6037e71011fff5f07335b711fcd66446d2ce | refs/heads/master | 2022-07-02T13:12:35.560012 | 2020-05-10T01:21:36 | 2020-05-10T01:21:36 | 262,689,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,769 | java | package service.domain;
public class Student extends User {
private static final long serialVersionUID = 1L;
private boolean hasScholarship = false;
private double amountReceived = 0;
private double gpa;
public Student() { } //used for persistence Object-Relational Mappers (ORMs)
//constructor for student
public Student(String name, String schoolId, String email, String password) {
super(name, schoolId, email, password);
this.setSchoolId(schoolId);
this.gpa = 0.0;
setIsStudent();
}
public double getGpa( ) { return this.gpa; }
public void setGpa(double gpa) {this.gpa = gpa; }
//setter for amount received
public void setAmountRecieved(double amount_received) {
this.amountReceived = amount_received;
}
//getter for amount received
public double getAmountRecieved() {
return this.amountReceived;
}
//getter for hasScholarship
public boolean hasScholarship () {
return hasScholarship;
}
//Setter for hasScholarship
public void setHasScholarship(Boolean hasScholarship) {
this.hasScholarship = hasScholarship;
}
//overrides parent method, returns true for is student
@Override
public boolean isStudent() { return true; }
@Override
public String toString() {
return "Name: " + getName() +
" ID: " + getSchoolId() +
" Gpa: " + Double.toString(getGpa()) ;
}
@Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (!(obj instanceof Student))
return false;
Student other = (Student)obj;
return this.getId() == other.getId();
}
public void grant(Scholarship scholarship) {
this.hasScholarship = true;
this.setAmountRecieved(scholarship.getAmountAwarded());
}
}
| [
"verto95@gmil.com"
] | verto95@gmil.com |
ef83c4fc12a736f104c817abfc3fa8c077d9bd29 | ed7d128a8ceca0d92ff5e04f47520603efacbcae | /Test/src/test/java/edc/test/ExampleUnitTest.java | 768d2d8284e02b1a8b859f5587ae64f4d6752b2b | [] | no_license | zkshen/EDC | c14e3b49096e9251a9a51dd8a2a33739b757a133 | 38a379f57dce49f61fe944bb652068f179573092 | refs/heads/master | 2021-01-21T04:55:18.688575 | 2016-06-04T01:28:34 | 2016-06-04T01:28:34 | 55,285,081 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package edc.test;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"497189556@qq.com"
] | 497189556@qq.com |
1876b84601f0ae75f2136fd0f045fb93461a0eb1 | 075c2331b5d44f256f2e51f43242ecdff94008e6 | /src/main/java/garou/aos/project/model/request/LoginRequest.java | 37c12b515e79f3ae321b513ba505d411720556a9 | [] | no_license | yjaaevry/AOS_BACK | 5fb6dd0e475e8a86394a3be5ca54636fe1086815 | dd96c255b13c997dc059f6acf22a49aa821122ac | refs/heads/master | 2023-01-22T15:20:10.312514 | 2020-11-30T10:48:06 | 2020-11-30T10:48:06 | 316,814,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | package garou.aos.project.model.request;
import lombok.ToString;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
@ToString
public class LoginRequest {
@NotBlank
@Email
private String email;
@NotBlank
private String password;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"yassine.leoburnett@gmail.com"
] | yassine.leoburnett@gmail.com |
22c22afba987fc29d88964a9cff0ac8ed202ad8e | 7a6b5b53885ed7ee1e7c254c9cce8f4223e76fd0 | /intellij/org.eclipse.xtext.core.idea.tests/src-gen/org/eclipse/xtext/resource/idea/lang/LiveContainerBuilderIntegerationTestLanguageLanguage.java | 05fcc8fcf5debb307eda63bd7c2eae67d49d934d | [
"LicenseRef-scancode-generic-cla"
] | no_license | oreon/xtext | ac8909896e6ce08a0bf5e128c9c7164e17dbb35f | 097794d14f0ccd033d7bfb871e25dbf7d734c7da | refs/heads/master | 2023-06-24T12:31:23.535025 | 2015-05-26T05:51:06 | 2015-05-26T05:51:06 | 36,278,379 | 1 | 0 | null | 2023-06-19T17:19:31 | 2015-05-26T07:07:22 | Java | UTF-8 | Java | false | false | 808 | java | package org.eclipse.xtext.resource.idea.lang;
import org.eclipse.xtext.idea.lang.AbstractXtextLanguage;
import com.google.inject.Injector;
public final class LiveContainerBuilderIntegerationTestLanguageLanguage extends AbstractXtextLanguage {
public static final LiveContainerBuilderIntegerationTestLanguageLanguage INSTANCE = new LiveContainerBuilderIntegerationTestLanguageLanguage();
private Injector injector;
private LiveContainerBuilderIntegerationTestLanguageLanguage() {
super("org.eclipse.xtext.resource.LiveContainerBuilderIntegerationTestLanguage");
this.injector = new org.eclipse.xtext.resource.idea.LiveContainerBuilderIntegerationTestLanguageStandaloneSetupIdea().createInjectorAndDoEMFRegistration();
}
@Override
protected Injector getInjector() {
return injector;
}
}
| [
"anton.kosyakov@itemis.de"
] | anton.kosyakov@itemis.de |
d22f9881e0c9177d49cd3618afecbbdc9470a33c | e8d4ada47fc3022f3248ee785b37e6f8ce5c8bde | /app/src/main/java/com/wlf/testnetwork/contact/App.java | 88f48705b5895b04ea9cab5f51b7a03968e16a50 | [] | no_license | wlingf/TestNetWork | b42868ea32fd8188d1b60e95c61a22fc9cb52ff7 | 6ae3bf26cd62cf8458d35744a88148a4896183fc | refs/heads/master | 2020-04-19T16:03:12.080781 | 2019-01-30T06:41:03 | 2019-01-30T06:41:03 | 168,292,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,837 | java | package com.wlf.testnetwork.contact;
import android.app.Application;
import com.yanzhenjie.kalle.Kalle;
import com.yanzhenjie.kalle.KalleConfig;
import com.yanzhenjie.kalle.OkHttpConnectFactory;
import com.yanzhenjie.kalle.connect.BroadcastNetwork;
import com.yanzhenjie.kalle.connect.http.LoggerInterceptor;
import com.yanzhenjie.kalle.simple.cache.CacheStore;
import com.yanzhenjie.kalle.simple.cache.DiskCacheStore;
import java.util.concurrent.TimeUnit;
/**
* =============================================
*
* @author: wlf
* @date: 2019/1/30
* @eamil: 845107244@qq.com
* 描述:
* 备注:
* =============================================
*/
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
initKalle();
}
void initKalle () {
CacheStore cacheStore = DiskCacheStore.newBuilder("/sdcard/db")
.password("jipai")
.build();
KalleConfig config = KalleConfig.newBuilder()
//全局的连接超时时间
.connectionTimeout(60000, TimeUnit.MILLISECONDS)
//全局的写入超时时间
.readTimeout(60000, TimeUnit.MILLISECONDS)
//全局统一缓存模式
.cacheStore(cacheStore)
//全局网络监测
.network(new BroadcastNetwork(this))
//全局网络请求底层框架
.connectFactory(OkHttpConnectFactory.newBuilder().build())
//全局cookie
// .cookieStore()
//全局拦截器
.addInterceptor(new LoggerInterceptor("kalle", true))
//全局转换器
// .converter(new HttpConverter())
.build();
Kalle.setConfig(config);
}
}
| [
"266932823.@qq.com"
] | 266932823.@qq.com |
9f4d9250f2b088b62266d90f637995faaf1aee1f | cbe934449f13cc92395fd0a93e811c2f35c67cb3 | /src/TankGame/Tile/FastLeft.java | f7b976072cd18604f0c8168bbc127b6872145718 | [
"MIT"
] | permissive | aramirez23/Action-RPG-CSC-413- | 98d4f72b07a9f4a84fc9ed14ebea9610c9f56cd5 | 5b3fffbac641844d5bb63aaf4d1b72a20100a96b | refs/heads/main | 2023-06-24T16:30:04.172165 | 2021-07-28T20:49:19 | 2021-07-28T20:49:19 | 390,498,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | package TankGame.Tile;
import java.awt.*;
import java.io.IOException;
import static javax.imageio.ImageIO.read;
/**
* The FastLeft class creates a tile that will push the
* tank on it left.
*
* @author Alicia Ramirez
*/
public class FastLeft extends Tile{
private Image img;
private int x;
private int y;
private Rectangle hitbox;
public void init(String imageFile, int row, int column, int tileType) {
try {
img = read(getClass().getClassLoader().getResourceAsStream(imageFile));
} catch (IOException e) {
}
x = (column) * 64;
y = (row) * 64;
hitbox = new Rectangle(x, y+20, 64, 64);
}
public String toString() {
return "Fast Left";
}
public Image getImg() {
return img;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public Rectangle getHitbox() {
return hitbox;
}
} | [
"noreply@github.com"
] | noreply@github.com |
f9dfb22e9a72934c34df59729b442ee05d5bf027 | 01a28d304ab45e2ace3a91e85a60ac51d2363e51 | /demospring-boot-web/src/main/java/com/bolsadeideas/springboot/web/app/controllers/EjemploVariablesRutaController.java | 5e147db3445f462ea965c8e2e87925ab954c97df | [] | no_license | johensantos/SpringBootSamples | 11556009ef6f54af5e83fb2742721437708c05b3 | 9134b1419b343426d878963f2c39b85d184e8853 | refs/heads/master | 2020-05-29T19:01:31.492447 | 2019-06-19T19:59:31 | 2019-06-19T19:59:31 | 189,318,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,463 | java | package com.bolsadeideas.springboot.web.app.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/variables")
public class EjemploVariablesRutaController {
@GetMapping("/")
public String index(Model model) {
model.addAttribute("titulo","Enviar parametros de la ruta (@PathVariable)");
return "variables/index";
}
@GetMapping("/string/{texto}")//el nombre de la variables tiene que ser igual al de la ruta o se le tiene que indicar con name
public String variables(@PathVariable(name="texto") String texto,Model model ) {
model.addAttribute("titulo","Recibir parametros de la ruta (@PathVariable)");
model.addAttribute("resultado","El texto enviado es: "+ texto);
return "variables/ver";
}
@GetMapping("/string/{texto}/{numero}")//el nombre de la variables tiene que ser igual al de la ruta o se le tiene que indicar con name
public String variables(@PathVariable(name="texto") String texto,@PathVariable Integer numero, Model model ) {
model.addAttribute("titulo","Recibir parametros de la ruta (@PathVariable)");
model.addAttribute("resultado","El texto enviado es: "+ texto + "y el numero enviado en la ruta es: "+numero);
return "variables/ver";
}
}
| [
"maurojohen@gmail.com"
] | maurojohen@gmail.com |
2247c44384904c19f548451c4d5161e006674dc0 | ce06d5850a89006df34003fe7a02553ee090e5d9 | /server/service/player-service/src/test/java/com/cubeia/poker/playerservice/impl/PlayerServiceImplTest.java | 7b51d57ae86b8b2b2a10e10df89e450f09310f25 | [] | no_license | DONTEAM/poker-project | 8b849fa8baae122385d1fa2bc38bcb1977ddda1f | b901114e52afb68009b28dbf21a0f7f176f9c823 | refs/heads/master | 2020-03-31T17:13:54.511335 | 2018-10-10T11:38:00 | 2018-10-10T11:38:00 | 152,413,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,034 | java | package com.cubeia.poker.playerservice.impl;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import com.cubeia.firebase.api.action.service.ClientServiceAction;
import com.cubeia.firebase.api.action.service.ServiceAction;
import com.cubeia.firebase.api.common.AttributeValue;
import com.cubeia.firebase.api.service.ServiceRouter;
import com.cubeia.firebase.api.service.sysstate.PublicSystemStateService;
import com.cubeia.firebase.io.ProtocolObject;
import com.cubeia.firebase.io.StyxSerializer;
import com.cubeia.games.poker.io.protocol.Enums;
import com.cubeia.games.poker.routing.service.io.protocol.ProtocolObjectFactory;
import com.cubeia.games.poker.routing.service.io.protocol.TournamentIdRequest;
import com.cubeia.games.poker.routing.service.io.protocol.TournamentIdResponse;
public class PlayerServiceImplTest {
@Mock PublicSystemStateService systemState;
@Mock ServiceRouter router;
PlayerServiceImpl service = new PlayerServiceImpl();
StyxSerializer styx = new StyxSerializer(new ProtocolObjectFactory());
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
service.systemState = systemState;
service.router = router;
Set<String> level_1 = new HashSet<String>(Arrays.asList(new String[]{"1"}));
Set<String> level_2 = new HashSet<String>(Arrays.asList(new String[]{"scheduled", "sitandgo"}));
Set<String> level_2_sitandgo = new HashSet<String>(Arrays.asList(new String[]{"10"}));
Set<String> level_2_scheduled = new HashSet<String>(Arrays.asList(new String[]{"1", "7", "8", "11"}));
String root = "/tournament";
when(systemState.getChildren(root)).thenReturn(level_1);
when(systemState.getChildren(root+"/1")).thenReturn(level_2);
when(systemState.getChildren(root+"/1/scheduled")).thenReturn(level_2_scheduled);
when(systemState.getChildren(root+"/1/sitandgo")).thenReturn(level_2_sitandgo);
// when(systemState.getAttribute(Mockito.anyString(), Mockito.anyString())).thenReturn(AttributeValue.wrap(-1));
when(systemState.getAttribute("/tournament/1/scheduled/1", "_ID")).thenReturn(AttributeValue.wrap(1));
when(systemState.getAttribute("/tournament/1/scheduled/1", "NAME")).thenReturn(AttributeValue.wrap("Test Tournament"));
when(systemState.getAttribute("/tournament/1/scheduled/1", "STATUS")).thenReturn(AttributeValue.wrap(Enums.TournamentStatus.REGISTERING.name()));
when(systemState.getAttribute("/tournament/1/scheduled/8", "_ID")).thenReturn(AttributeValue.wrap(8));
when(systemState.getAttribute("/tournament/1/scheduled/8", "NAME")).thenReturn(AttributeValue.wrap("Tournament Eight"));
when(systemState.getAttribute("/tournament/1/scheduled/8", "STATUS")).thenReturn(AttributeValue.wrap(Enums.TournamentStatus.CANCELLED.name()));
when(systemState.getAttribute("/tournament/1/scheduled/11", "_ID")).thenReturn(AttributeValue.wrap(11));
when(systemState.getAttribute("/tournament/1/scheduled/11", "NAME")).thenReturn(AttributeValue.wrap("Tournament Eleven"));
when(systemState.getAttribute("/tournament/1/scheduled/11", "STATUS")).thenReturn(AttributeValue.wrap(Enums.TournamentStatus.REGISTERING.name()));
when(systemState.getAttribute("/tournament/1/sitandgo/10", "_ID")).thenReturn(AttributeValue.wrap(10));
when(systemState.getAttribute("/tournament/1/sitandgo/10", "NAME")).thenReturn(AttributeValue.wrap("Heads Up PM 100"));
when(systemState.getAttribute("/tournament/1/sitandgo/10", "STATUS")).thenReturn(AttributeValue.wrap(Enums.TournamentStatus.REGISTERING.name()));
}
@Test
public void testFindTournament() {
TournamentIdRequest request = new TournamentIdRequest("Test Tournament", new String[0]);
int id = service.findTournamentId(request);
assertThat(id, is(1));
}
@Test
public void testFindTournament11() {
TournamentIdRequest request = new TournamentIdRequest("Tournament Eleven", new String[0]);
int id = service.findTournamentId(request);
assertThat(id, is(11));
}
@Test
public void testFindTournamentNoSpaces() {
TournamentIdRequest request = new TournamentIdRequest("TestTournament", new String[0]);
int id = service.findTournamentId(request);
assertThat(id, is(1));
}
@Test
public void testFindSitAndGoTournament() {
TournamentIdRequest request = new TournamentIdRequest("headsuppm100", new String[0]);
int id = service.findTournamentId(request);
assertThat(id, is(10));
}
@Test
public void testFindTournament11NoSpaceSmallChars() {
TournamentIdRequest request = new TournamentIdRequest("tournamenteleven", new String[0]);
int id = service.findTournamentId(request);
assertThat(id, is(11));
}
@Test
public void testFindCancelledTournament() {
TournamentIdRequest request = new TournamentIdRequest("Tournament Eight", new String[0]);
int id = service.findTournamentId(request);
assertThat(id, is(-1));
}
@Test
public void testOnAction() {
TournamentIdRequest request = new TournamentIdRequest("Test Tournament", new String[0]);
ByteBuffer bytes = styx.pack(request);
ServiceAction action = new ClientServiceAction(1, 2, bytes.array());
service.onAction(action);
ArgumentCaptor<ServiceAction> argument = ArgumentCaptor.forClass(ServiceAction.class);
Mockito.verify(router).dispatchToPlayer(Mockito.eq(1), argument.capture());
ByteBuffer buffer = ByteBuffer.wrap(argument.getValue().getData());
ProtocolObject protocol = styx.unpack(buffer);
if (protocol instanceof TournamentIdResponse) {
TournamentIdResponse response = (TournamentIdResponse) protocol;
assertThat(response.id, is(1));
}
}
}
| [
"nidhikulkarni82@gmail.com"
] | nidhikulkarni82@gmail.com |
a6e30d7b1d3336b4f05687e6197fcdb0ff9114f9 | fa2c551ad6db59cf19aeed17a76e82d9a8d3e8d9 | /src/co/angelazhang/touch/MainActivity.java | ce1b8d40ec35f163b722d4fd0218abdd989a995a | [] | no_license | zhangela/touch | e63853c3d97fa59fade2e8e4081b26b55217201e | 05e120b552dfb34b8738a61440842fc387f52d3c | refs/heads/master | 2018-12-28T09:13:52.126696 | 2013-08-13T00:51:34 | 2013-08-13T00:51:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package co.angelazhang.touch;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
| [
"sstubailo@palantir.com"
] | sstubailo@palantir.com |
efb02aeb377893dae323c81b77609ccb7d210c05 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.socialplatform-base/sources/X/AnonymousClass05d.java | a7408e345c6d5adb4d855a8bbbbe1986441b4152 | [] | no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 1,101 | java | package X;
import android.content.Context;
import java.io.File;
import java.io.IOException;
/* renamed from: X.05d reason: invalid class name */
public final class AnonymousClass05d extends AnonymousClass0HZ {
public final int A00;
public AnonymousClass05d(Context context, File file, String str, int i) {
super(context, str, file, "^lib/([^/]+)/([^/]+\\.so)$");
this.A00 = i;
}
@Override // X.AnonymousClass0HZ, X.AnonymousClass0T3
public final AnonymousClass0lB A08() throws IOException {
return new AnonymousClass0TD(this, this);
}
/* JADX WARNING: Removed duplicated region for block: B:10:0x003a */
/* JADX WARNING: Removed duplicated region for block: B:11:0x0042 */
@Override // X.AnonymousClass0T3
/* Code decompiled incorrectly, please refer to instructions dump. */
public final byte[] A09() throws java.io.IOException {
/*
// Method dump skipped, instructions count: 135
*/
throw new UnsupportedOperationException("Method not decompiled: X.AnonymousClass05d.A09():byte[]");
}
}
| [
"cyuubiapps@gmail.com"
] | cyuubiapps@gmail.com |
ebb5dff72a8855d1b5839810e576e696daf42241 | 3d1f749fe051d61c68266ba20cbef3b60fa6b0c2 | /src/domains/Operand.java | a087712b84b74bfafe4366598fe9c3b4ebc6de7d | [] | no_license | ajshres/evaluationPractice | 870762672220e8d7482345b2a83e59554b879d0b | d18868f615e48f547b41f97a89d2bb1047db525a | refs/heads/master | 2020-04-09T03:38:10.529524 | 2015-03-22T02:08:20 | 2015-03-22T02:08:20 | 32,658,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 91 | java | package domains;
public interface Operand {
float evaluate(float value1,float value2);
}
| [
"ajay.gopal.shrestha@hotmail.com"
] | ajay.gopal.shrestha@hotmail.com |
9794cdba0f91485a23f963dd2920b135b7f7730e | 06c806f70f637e1b91c275c99b89fcc72f8d30bd | /Modul1/m1app/src/main/java/com/ip/m1app/web/rest/vm/LoggerVM.java | 2fcad75fd34a32da2d24430653590aab323ba83d | [] | no_license | cristian-mihaitactin/CQRS_A5 | d2a02010f04afc3e13e10eb3ab90df8cf5906ba3 | 92ee8a3246c74417549165591e90ccccb4b3d5d5 | refs/heads/master | 2020-03-09T09:54:34.841510 | 2018-05-29T03:03:25 | 2018-05-29T03:03:25 | 128,723,987 | 1 | 1 | null | 2018-05-29T03:03:26 | 2018-04-09T06:20:41 | Java | UTF-8 | Java | false | false | 880 | java | package com.ip.m1app.web.rest.vm;
import ch.qos.logback.classic.Logger;
/**
* View Model object for storing a Logback logger.
*/
public class LoggerVM {
private String name;
private String level;
public LoggerVM(Logger logger) {
this.name = logger.getName();
this.level = logger.getEffectiveLevel().toString();
}
public LoggerVM() {
// Empty public constructor used by Jackson.
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
@Override
public String toString() {
return "LoggerVM{" +
"name='" + name + '\'' +
", level='" + level + '\'' +
'}';
}
}
| [
"gabriel_schitcu@yahoo.com"
] | gabriel_schitcu@yahoo.com |
0cc483ac6b195f071b4bcc3d1e5c305f315cd737 | 16e1fc49f9c6778711f4eb41ef2617c594cda63b | /mihabitat-web/src/main/java/com/bstmexico/mihabitat/web/controllers/contacto/MiDirectorioController.java | 1d0a9706c132be70c11c966e8b02bafdb046bcd4 | [] | no_license | njmube/MiHabitatPortal | 4c1db88058bf626fd67fac1c8834c91eb4b3ae05 | 937ea12f1e6f882ec9e35a240b501cb2cc8c9d35 | refs/heads/master | 2022-01-15T11:00:20.121336 | 2018-04-02T20:58:21 | 2018-04-02T20:58:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,539 | java | package com.bstmexico.mihabitat.web.controllers.contacto;
import com.bstmexico.mihabitat.comunes.catalogos.factory.CatalogoFactory;
import com.bstmexico.mihabitat.comunes.catalogos.model.Catalogo;
import com.bstmexico.mihabitat.comunes.catalogos.service.CatalogoService;
import com.bstmexico.mihabitat.comunes.direcciones.factory.DireccionFactory;
import com.bstmexico.mihabitat.comunes.personas.model.Email;
import com.bstmexico.mihabitat.comunes.personas.model.Telefono;
import com.bstmexico.mihabitat.comunes.usuarios.model.Usuario;
import com.bstmexico.mihabitat.comunicacion.directorio.factory.DirectorioRegistroFactory;
import com.bstmexico.mihabitat.comunicacion.directorio.model.CatalogoTipoDirectorio;
import com.bstmexico.mihabitat.comunicacion.directorio.model.DirectorioRegistro;
import com.bstmexico.mihabitat.comunicacion.directorio.service.DirectorioRegistroService;
import com.bstmexico.mihabitat.condominios.model.Condominio;
import com.bstmexico.mihabitat.configuration.ConfigurationServiceImpl;
import com.bstmexico.mihabitat.web.controllers.administrador.BlogController;
import com.bstmexico.mihabitat.web.util.HibernateAwareObjectMapper;
import com.bstmexico.mihabitat.web.util.SessionEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpSession;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
/**
* Created by Zoe on 25/01/2016.
*/
@Controller
@RequestMapping(value = "contacto/directorio")
public class MiDirectorioController {
private static final Logger LOG = LoggerFactory
.getLogger(MiDirectorioController.class);
@Autowired
private HibernateAwareObjectMapper mapper;
@Autowired
private DirectorioRegistroService directorioRegistroService;
@Autowired
private CatalogoService catalogoService;
@Autowired
private ConfigurationServiceImpl configurationService;
@SuppressWarnings({ "unchecked", "rawtypes" })
@RequestMapping(method = RequestMethod.GET, value = "lista")
public String listaBlogs(Model model, HttpSession session) {
Condominio condominio = (Condominio) session.getAttribute(SessionEnum.CONDOMINIO
.getValue());
Collection<DirectorioRegistro> directorios =
directorioRegistroService.getList(condominio);
Collection<Catalogo> catalogosTipoDirectorio = catalogoService.getList(CatalogoTipoDirectorio.class);
for(Usuario usuario : condominio.getAdministradores()){
DirectorioRegistro dir = DirectorioRegistroFactory.newInstance();
dir.setTitulo(usuario.getPersona().getNombre() + " " +
usuario.getPersona().getApellidoPaterno() + " " + usuario.getPersona().getApellidoMaterno());
if(!CollectionUtils.isEmpty(usuario.getPersona().getEmails())) {
StringBuilder sb = new StringBuilder();
for(Email email : usuario.getPersona().getEmails()){
sb.append(email.getDireccion() + ", ");
}
sb.delete(sb.lastIndexOf(", "), sb.length());
dir.setEmail(sb.toString());
}
if(!CollectionUtils.isEmpty(usuario.getPersona().getTelefonos())) {
StringBuilder sb = new StringBuilder();
for(Telefono telefono : usuario.getPersona().getTelefonos()){
sb.append(telefono.getNumero() + ", ");
}
sb.delete(sb.lastIndexOf(", "), sb.length());
dir.setTelefono(sb.toString());
}
dir.setTipo((CatalogoTipoDirectorio) CatalogoFactory.newInstance(CatalogoTipoDirectorio.class, 0L));
dir.getTipo().setDescripcion("Administrador");
directorios.add(dir);
}
model.addAttribute("tiposDirectorio", mapper.writeValueAsString(catalogoService.getList(CatalogoTipoDirectorio.class)));
model.addAttribute("registrosDirectorio",
mapper.writeValueAsString(directorios));
return "directorio/lista";
}
}
| [
"julioanom@hotmail.com"
] | julioanom@hotmail.com |
d3882f2dcb5f120a3cad4c9e0f0ea20c23a6a98d | 56bb0341acf8f9adeb61ce05bfdc46361aafc88c | /PROVA INTERFICIES/src/controlador/Controlador.java | dddbf16b0962dae552d04c006545849b97f995a4 | [] | no_license | joantiscar/faenaJava | b976f65d630a57b16a447e6f4cb0ce35f91446ad | dbe1b3591fb7216911d4a1dcf37f097838c10790 | refs/heads/master | 2022-01-05T12:51:02.809742 | 2019-05-22T18:32:21 | 2019-05-22T18:32:21 | 152,280,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | 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 controlador;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import model.Model;
import vista.Vista;
/**
*
* @author dios
*/
public class Controlador {
private Vista v;
private Model m;
public Controlador(Vista v, Model m) {
this.v = v;
this.m = m;
controller();
}
public void controller(){
ActionListener al= (ActionEvent e) -> {
if(e.getSource().equals(v.getBotoCalcular())){
m.calcularPosicio(v.getFraseTextField().getText().trim(), v.getParaulaTextFied().getText().trim());
v.getPosicioLabel().setText("Posicio: " +m.getPosicio());
}
};
// Associo l'ActionListener en els components que m'interesse
v.getBotoCalcular().addActionListener(al);
}
}
| [
"joantiscar@gmail.com"
] | joantiscar@gmail.com |
bf7ea66176d70a3a894bacc3bc53c7d207c878b9 | 52d0e2d3a488f5d742c201664199a43a7ed309e5 | /demo/demo/src/main/java/com/shrenik/repository/StudentRepository.java | a57b1667f1ff9055bc637f1ac07e0aba2f610334 | [] | no_license | shrenik1077/studentadministration | 2510e9f3f024e92690cd7199f12ef8a10741ed1c | 275c1fa33fe95748718a8f1bf26e79a7b804e16b | refs/heads/master | 2022-06-21T02:36:44.660985 | 2020-05-03T10:36:06 | 2020-05-03T10:36:06 | 260,868,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.shrenik.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import com.shrenik.entity.Student;
@RepositoryRestResource(collectionResourceRel = "student",path="student-rec")
public interface StudentRepository extends JpaRepository<Student, Long>{
}
| [
"Shrenik@ExamServer"
] | Shrenik@ExamServer |
01558df48867265c8f5b8d055881118d3f607019 | d08c13f25fd5d01cff7a78dd8bc904cc2b4dc546 | /src/com/sample/common/icecreams/IceCream.java | 56fbd4888af143bbbf4d55c97565993ac984bc0d | [] | no_license | jaypalsodha/DesignPatterns | e47c9036fb6a931103715a3e87c10b59f6e7e4b7 | 3ec2f8a5261156bf582688225ae02d02c148bf79 | refs/heads/master | 2020-03-30T08:12:21.133129 | 2019-06-21T19:14:14 | 2019-06-21T19:14:14 | 150,997,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | package com.sample.common.icecreams;
public interface IceCream {
public String getIceCreamName();
public Long getPrice();
public Integer getCalories();
}
| [
"jaypal@jaypals-MacBook-Air.local"
] | jaypal@jaypals-MacBook-Air.local |
12fc3d42efa3c7bbd35f70e609ecba649b02d35c | 60d8750d8dc45552ad27fadc680d1140d51f6d16 | /src/rallye/entities/Inscripcion.java | f23ec5276bdb5dcac873e0fb791c3b785a5d191c | [] | no_license | Chofle/Rallye | 5a731403a4a2f86f784e14c94e78c392828c8204 | d7d425697c1a774f3ab25625d08bc0405328e095 | refs/heads/master | 2016-09-06T05:37:53.121845 | 2014-05-23T12:27:33 | 2014-05-23T12:27:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,637 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rallye.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author usuario
*/
@Entity
@Table(name = "inscripcion")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Inscripcion.findAll", query = "SELECT i FROM Inscripcion i"),
@NamedQuery(name = "Inscripcion.findById", query = "SELECT i FROM Inscripcion i WHERE i.id = :id"),
@NamedQuery(name = "Inscripcion.findByEscuderia", query = "SELECT i FROM Inscripcion i WHERE i.escuderia = :escuderia"),
@NamedQuery(name = "Inscripcion.findByPiloto", query = "SELECT i FROM Inscripcion i WHERE i.piloto = :piloto"),
@NamedQuery(name = "Inscripcion.findByVehiculo", query = "SELECT i FROM Inscripcion i WHERE i.vehiculo = :vehiculo"),
@NamedQuery(name = "Inscripcion.findByTiempo", query = "SELECT i FROM Inscripcion i WHERE i.tiempo = :tiempo"),
@NamedQuery(name = "Inscripcion.findByFecha", query = "SELECT i FROM Inscripcion i WHERE i.fecha = :fecha"),
@NamedQuery(name = "Inscripcion.findByAutorizado", query = "SELECT i FROM Inscripcion i WHERE i.autorizado = :autorizado")})
public class Inscripcion implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Column(name = "escuderia")
private String escuderia;
@Column(name = "piloto")
private String piloto;
@Column(name = "vehiculo")
private String vehiculo;
@Column(name = "tiempo")
@Temporal(TemporalType.TIME)
private Date tiempo;
@Column(name = "fecha")
@Temporal(TemporalType.DATE)
private Date fecha;
@Column(name = "autorizado")
private Boolean autorizado;
@JoinColumn(name = "categoria", referencedColumnName = "codCategoria")
@ManyToOne
private Categoria categoria;
public Inscripcion() {
}
public Inscripcion(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getEscuderia() {
return escuderia;
}
public void setEscuderia(String escuderia) {
this.escuderia = escuderia;
}
public String getPiloto() {
return piloto;
}
public void setPiloto(String piloto) {
this.piloto = piloto;
}
public String getVehiculo() {
return vehiculo;
}
public void setVehiculo(String vehiculo) {
this.vehiculo = vehiculo;
}
public Date getTiempo() {
return tiempo;
}
public void setTiempo(Date tiempo) {
this.tiempo = tiempo;
}
public Date getFecha() {
return fecha;
}
public void setFecha(Date fecha) {
this.fecha = fecha;
}
public Boolean getAutorizado() {
return autorizado;
}
public void setAutorizado(Boolean autorizado) {
this.autorizado = autorizado;
}
public String getCategoria() {
return categoria.getNombre();
}
public void setCategoria(Categoria categoria) {
this.categoria = categoria;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Inscripcion)) {
return false;
}
Inscripcion other = (Inscripcion) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "rallye.Inscripcion[ id=" + id + " ]";
}
}
| [
"usuario@smr1-pc18"
] | usuario@smr1-pc18 |
5362248db8c9e3355dbcebff7b924b3252e619b5 | 8487a8ea928d4e2f933ef2ae158fd7c20f38df2a | /modules/citrus-admin/src/main/java/com/consol/citrus/admin/converter/spring/SchemaRepositorySpringBeanConverter.java | 88b50e97a09d83219b020b6aab5d90e30dd5696f | [
"Apache-2.0"
] | permissive | wanghy6503/citrus | 97a1ff49cafa56a84bad68096d77536ee948c04e | 1637c186e5c3ba44eb35bec896f78bac3c7ad52c | refs/heads/master | 2022-12-06T18:38:27.441133 | 2014-08-01T11:51:58 | 2014-08-01T11:51:58 | 22,563,504 | 0 | 0 | Apache-2.0 | 2022-11-25T16:23:48 | 2014-08-03T01:23:23 | null | UTF-8 | Java | false | false | 3,550 | java | /*
* Copyright 2006-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.consol.citrus.admin.converter.spring;
import com.consol.citrus.admin.spring.model.*;
import com.consol.citrus.model.config.core.ObjectFactory;
import com.consol.citrus.model.config.core.*;
import com.consol.citrus.xml.schema.WsdlXsdSchema;
import org.springframework.util.StringUtils;
import org.springframework.xml.xsd.SimpleXsdSchema;
/**
* Converter capable to create proper schema repository from legacy spring bean definition.
*
* @author Christoph Deppisch
* @since 1.3.1
*/
public class SchemaRepositorySpringBeanConverter implements SpringBeanConverter<SchemaRepository> {
@Override
public SchemaRepository convert(SpringBean springBean) {
SchemaRepository repository = new ObjectFactory().createSchemaRepository();
repository.setId(springBean.getId());
repository.setSchemas(new SchemaRepository.Schemas());
for (Property property : springBean.getProperties()) {
if (property.getName().equals("schemas")) {
for (Object item : property.getList().getListItems()) {
if (item instanceof SpringBean) {
SpringBean bean = (SpringBean)item;
Schema schema = new Schema();
if (StringUtils.hasText(bean.getId())) {
schema.setId(bean.getId());
} else {
schema.setId(String.valueOf(System.currentTimeMillis()));
}
if (bean.getClazz().equals(SimpleXsdSchema.class.getName())) {
for (Property beanProperty : bean.getProperties()) {
if (beanProperty.getName().equals("xsd")) {
schema.setLocation(beanProperty.getValue());
}
}
} else if (bean.getClazz().equals(WsdlXsdSchema.class.getName())) {
for (Property beanProperty : bean.getProperties()) {
if (beanProperty.getName().equals("wsdl")) {
schema.setLocation(beanProperty.getValue());
}
}
}
repository.getSchemas().getRevesAndSchemas().add(schema);
} else if (item instanceof Ref) {
Ref ref = (Ref) item;
SchemaRepository.Schemas.Ref schema = new SchemaRepository.Schemas.Ref();
schema.setSchema(ref.getBean());
repository.getSchemas().getRevesAndSchemas().add(schema);
}
}
}
}
return repository;
}
@Override
public Class<SpringBean> getModelClass() {
return SpringBean.class;
}
}
| [
"deppisch@consol.de"
] | deppisch@consol.de |
f272d41f64375d389e9b0e6b0374d597bd22eba6 | 4dc834a830c3e9deeacb62ae2d2f6a777c63ab69 | /src/main/groovy/org/arquillian/spacelift/gradle/configuration/ConversionException.java | b9e65eb7bb59f5a4c72cf434b9b3a104cbb8e203 | [] | no_license | arquillian/arquillian-spacelift-gradle | 491bce4c449413e6560dff1d73888d6661c2dbb9 | dfa161409d56d1e970aacbd458e41249867d1e72 | refs/heads/master | 2021-07-11T03:58:27.887912 | 2016-10-26T13:15:03 | 2016-10-26T13:15:03 | 25,342,533 | 4 | 3 | null | 2021-04-29T19:20:13 | 2014-10-17T06:36:39 | Groovy | UTF-8 | Java | false | false | 903 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2011, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.arquillian.spacelift.gradle.configuration;
public class ConversionException extends RuntimeException {
}
| [
"kpiwko@redhat.com"
] | kpiwko@redhat.com |
00fc13475274035223f4b66c6ba5940cde605da5 | 70aa8a1a5fc9ecc683b8526fedfcf20fcc2d77a5 | /src/main/java/pl/edu/agh/cs/kraksimcitydesigner/Configuration.java | 28e9a7f7239b0fe00f8ed04f40ed29440a9d3d87 | [] | no_license | Pysiokot/kraksim | cd837453b80bf1625da331e60385a6e3a7f1bcf3 | 398082b6ab6d43114bd331e73a6f0925c45202ea | refs/heads/master | 2022-12-20T04:21:19.862986 | 2020-09-29T16:32:30 | 2020-09-29T16:32:30 | 237,761,884 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | package pl.edu.agh.cs.kraksimcitydesigner;
// TODO: Auto-generated Javadoc
public class Configuration {
private final int DEFAULT_NODEWIDTH = 20;
private final int DEFAULT_NODEHEIGHT = 20;
private int nodeWidth = DEFAULT_NODEHEIGHT;
private int nodeHeight = DEFAULT_NODEWIDTH;
/**
* Instantiates a new configuration.
*/
public Configuration() {
}
/**
* Gets the node width.
*
* @return the node width
*/
public int getNodeWidth() {
return nodeWidth;
}
/**
* Sets the node width.
*
* @param nodeWidth the new node width
*/
public void setNodeWidth(int nodeWidth) {
this.nodeWidth = nodeWidth;
}
/**
* Gets the node height.
*
* @return the node height
*/
public int getNodeHeight() {
return nodeHeight;
}
/**
* Sets the node height.
*
* @param nodeHeight the new node height
*/
public void setNodeHeight(int nodeHeight) {
this.nodeHeight = nodeHeight;
}
}
| [
"szcz.bart@gmail.com"
] | szcz.bart@gmail.com |
db27614e15c9a1f2980a2620a9bdc44448bb8e6d | 2557f3899fa940d941427fb3bde2e59d2714d8dc | /graduation/src/utils/PathRecord.java | c92280ac8556474284c2b66401e506203c9f2fbe | [
"Apache-2.0"
] | permissive | lidehe/graduationMS | 03c914a88ca191cad0debb9056563b1e38eade67 | 2195f8b547193fa1e9577822ace7cee19d198b13 | refs/heads/master | 2020-04-02T06:23:38.502060 | 2018-10-22T13:31:35 | 2018-10-22T13:31:35 | 154,146,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package utils;
/**
* 系统常用的路径在这里配置
* @author DaMoTou
*
*/
public class PathRecord {
public static String DocFilePath="D:\\Develop\\niitDeploy\\graduation";
public static String getDocFilePath() {
return DocFilePath;
}
}
| [
"15295532517@163.com"
] | 15295532517@163.com |
b7644c5c8f45cc10b4d681fdfe51f790e9f98be6 | cdd216eaf83cdf94bc71a99115138b9d804356d8 | /src/Wxzt/servlet/Log/LogSql.java | ca25c794f0a416e9e832b45e4c4feb0a4ef14445 | [] | no_license | yinlice/XES | 03c2c562c16fcdb077d15b56dbe328842efda9b7 | a2cfe67091362b7fadda7ff78f776b83e9add197 | refs/heads/master | 2021-01-25T11:27:44.208674 | 2017-06-10T08:42:34 | 2017-06-10T08:42:34 | 93,926,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,222 | java | package Wxzt.servlet.Log;
import Wxzt.servlet.Common.Query;
import Wxzt.tool.JDBC;
import javax.servlet.http.HttpServletRequest;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
/**
* Created by yin on 2017/4/25.
*/
public class LogSql extends Query{
//获取第一级节点
public List<LogBean> getFirstNode(HttpServletRequest request){
int groupid = Integer.parseInt(request.getParameter("groupid"));
String sql = "select id,pid,content from px_crm_log where pid = 0 and groupid = "+groupid+" order by id ";
List<LogBean> list = new ArrayList<>();
try{
JDBC jdbc = new JDBC();
ResultSet rs = jdbc.executeQuery(sql);
while (rs.next()){
LogBean bean = new LogBean();
String id = rs.getString("id");
String pid = rs.getString("pid");
String content = rs.getString("content");
bean.setId(id);
bean.setPid(pid);
bean.setContent(content);
list.add(bean);
}
}catch (Exception e){
e.printStackTrace();
}
return list;
}
public List<LogBean> getNodeByPid(HttpServletRequest request){
List<LogBean> list = new ArrayList<>();
int pid = Integer.parseInt(request.getParameter("pid"));
String sql = "select id,pid,content from px_crm_log where pid = "+pid;
try{
JDBC jdbc = new JDBC();
ResultSet rs = jdbc.executeQuery(sql);
while(rs.next()){
LogBean bean = new LogBean();
String id = rs.getString("id");
String pid2 = rs.getString("pid");
String content = rs.getString("content");
bean.setId(id);
bean.setPid(pid2);
bean.setContent(content);
list.add(bean);
}
}catch (Exception e){
e.printStackTrace();;
}
return list;
}
//添加第一级菜单
public List addFirstMenu(HttpServletRequest request){
List list = new ArrayList();
int groupid = Integer.parseInt(request.getParameter("groupid"));
String content = request.getParameter("content");
String sql = "insert into px_crm_log (pid,content,groupid) values (0,'"+content+"',"+groupid+")";
String sql2 = "select last_insert_id()";
try{
JDBC jdbc = new JDBC();
jdbc.executeUpdate(sql);
ResultSet rs = jdbc.executeQuery(sql2);
int id = -1;
while(rs.next()){
id = rs.getInt(1);
}
list.add(id);
jdbc.closeConnection();
}catch (Exception e){
e.printStackTrace();
}
return list;
}
//添加2,3,4级菜单
public List addMenu(HttpServletRequest request){
List list = new ArrayList();
String content = request.getParameter("content");
int pid = Integer.parseInt(request.getParameter("pid"));
String sql = "insert into px_crm_log (pid,content) values ("+pid+",'"+content+"')";
String sql2 = "select last_insert_id()";
try{
JDBC jdbc = new JDBC();
jdbc.executeUpdate(sql);
ResultSet rs = jdbc.executeQuery(sql2);
int id = -1;
while(rs.next()){
id = rs.getInt(1);
}
list.add(id);
jdbc.closeConnection();
}catch (Exception e){
e.printStackTrace();
}
return list;
}
//节点的编辑
public boolean ModifyLog(HttpServletRequest request){
String content = request.getParameter("content");
int id = Integer.parseInt(request.getParameter("id"));
String sql = "update px_crm_log set content = '"+content+"' where id = "+id;
return updataSql(sql);
}
//节点的删除
public boolean RemoveLog(HttpServletRequest request){
int id = Integer.parseInt(request.getParameter("id"));
String sql = "delete from px_crm_log where id = "+id;
return updataSql(sql);
}
}
| [
"yinlice@126.com"
] | yinlice@126.com |
f95ad2875013e3b7f0e0ad2b734619dcdd976175 | 05cebe72c44360f09604faa6e19a5e248334bbc9 | /OMS/src/main/java/com/hiaward/cl/oms/service/UserService.java | 5b1c6d9f1f146c43f348ac08f5d45cbbdd527792 | [] | no_license | cl1515652/cl_git_OMS | e130cdec6ff35e88b2f1443900bd6ad07886e8f4 | c29df5027e2eb6f508fde86d4d14581d5bf590cd | refs/heads/master | 2020-08-30T13:54:20.062759 | 2016-08-23T03:05:50 | 2016-08-23T03:05:50 | 66,329,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,084 | java | /**
* @Title: LoginService.java
* @Package com.hiaward.cl.oms.service
*
* @author cl
* @date 2016年7月14日 下午3:46:28
* @version [版本号, 2016年7月14日]
* @see [相关类/方法]
* @since [产品/模块版本]
*
* @Description: TODO(用一句话描述该文件做什么)
*
* @company Copyright (c) Hiaward Coperation.
*/
package com.hiaward.cl.oms.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hiaward.cl.oms.client.UserInfoMapper;
import com.hiaward.cl.oms.entity.UserInfo;
import com.hiaward.cl.oms.entity.UserInfoExample;
@Service
public class UserService {
@Autowired
private UserInfoMapper userInfoMapper;
public List<UserInfo> toList(UserInfo userinfo) {
//获取查询条件
//构建查询条件
UserInfoExample uie = new UserInfoExample();
uie.createCriteria()
.andStateEqualTo("1");
//开始查询
List<UserInfo> list = userInfoMapper.selectByExample(uie);
//判断查询结果
return list;
}
}
| [
"cl_bb_1992@163.com"
] | cl_bb_1992@163.com |
0ab880ba0d9694fe20da3a7c92e10bf084d1732a | 6f43ff34ea701d9b2e86ed1e901d536d9f7c778b | /src/test/java/xyz/guqing/creek/identity/authentication/verifyer/DefaultBearerTokenResolverTest.java | ab4ef85a0b5d10cd5a6ec456fc4ea662dbb642d1 | [] | no_license | guqing/creek | eadfa2a37c38aebb9c1834870952d49998d14080 | 76e813bdf570a63ba6e435058cf12f79a0eb6680 | refs/heads/master | 2022-06-24T01:59:30.986069 | 2022-06-04T17:12:30 | 2022-06-04T17:12:30 | 229,532,885 | 15 | 0 | null | 2021-04-01T02:46:01 | 2019-12-22T07:23:58 | Java | UTF-8 | Java | false | false | 8,986 | java | package xyz.guqing.creek.identity.authentication.verifyer;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.util.Base64;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
import xyz.guqing.creek.identity.authentication.verifier.DefaultBearerTokenResolver;
/**
* Tests for {@link DefaultBearerTokenResolver}.
*
* @author guqing
* @since 2.0.0
*/
public class DefaultBearerTokenResolverTest {
private static final String CUSTOM_HEADER = "custom-header";
private static final String TEST_TOKEN = "test-token";
private DefaultBearerTokenResolver resolver;
@BeforeEach
public void setUp() {
this.resolver = new DefaultBearerTokenResolver();
}
@Test
public void resolveWhenValidHeaderIsPresentThenTokenIsResolved() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("Authorization", "Bearer " + TEST_TOKEN);
assertThat(this.resolver.resolve(request)).isEqualTo(TEST_TOKEN);
}
@Test
public void resolveWhenHeaderEndsWithPaddingIndicatorThenTokenIsResolved() {
String token = TEST_TOKEN + "==";
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("Authorization", "Bearer " + token);
assertThat(this.resolver.resolve(request)).isEqualTo(token);
}
@Test
public void resolveWhenCustomDefinedHeaderIsValidAndPresentThenTokenIsResolved() {
this.resolver.setBearerTokenHeaderName(CUSTOM_HEADER);
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader(CUSTOM_HEADER, "Bearer " + TEST_TOKEN);
assertThat(this.resolver.resolve(request)).isEqualTo(TEST_TOKEN);
}
@Test
public void resolveWhenLowercaseHeaderIsPresentThenTokenIsResolved() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("authorization", "bearer " + TEST_TOKEN);
assertThat(this.resolver.resolve(request)).isEqualTo(TEST_TOKEN);
}
@Test
public void resolveWhenNoHeaderIsPresentThenTokenIsNotResolved() {
MockHttpServletRequest request = new MockHttpServletRequest();
assertThat(this.resolver.resolve(request)).isNull();
}
@Test
public void resolveWhenHeaderWithWrongSchemeIsPresentThenTokenIsNotResolved() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("Authorization",
"Basic " + Base64.getEncoder().encodeToString("test:test".getBytes()));
assertThat(this.resolver.resolve(request)).isNull();
}
@Test
@DisplayName("resolveWhenHeaderWithMissingTokenIsPresentThenAuthenticationExceptionIsThrown")
public void resolveThenAuthenticationExceptionIsThrown() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("Authorization", "Bearer ");
assertThatExceptionOfType(OAuth2AuthenticationException.class).isThrownBy(
() -> this.resolver.resolve(request))
.withMessageContaining(("Bearer token is malformed"));
}
@Test
@DisplayName(
"resolveWhenHeaderWithInvalidCharactersIsPresentThenAuthenticationExceptionIsThrown")
public void resolveThenAuthenticationExceptionIsThrown2() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("Authorization", "Bearer an\"invalid\"token");
assertThatExceptionOfType(OAuth2AuthenticationException.class).isThrownBy(
() -> this.resolver.resolve(request))
.withMessageContaining(("Bearer token is malformed"));
}
@Test
@DisplayName("resolve when valid header is present together with "
+ "form parameter then AuthenticationException is thrown")
public void resolveThenAuthenticationExceptionIsThrown3() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("Authorization", "Bearer " + TEST_TOKEN);
request.setMethod("POST");
request.setContentType("application/x-www-form-urlencoded");
request.addParameter("access_token", TEST_TOKEN);
assertThatExceptionOfType(OAuth2AuthenticationException.class).isThrownBy(
() -> this.resolver.resolve(request))
.withMessageContaining("Found multiple bearer tokens in the request");
}
@Test
@DisplayName("resolve when valid header is present together with query"
+ " parameter then AuthenticationException is thrown")
public void resolveThenAuthenticationExceptionIsThrown4() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("Authorization", "Bearer " + TEST_TOKEN);
request.setMethod("GET");
request.addParameter("access_token", TEST_TOKEN);
assertThatExceptionOfType(OAuth2AuthenticationException.class).isThrownBy(
() -> this.resolver.resolve(request))
.withMessageContaining("Found multiple bearer tokens in the request");
}
@Test
@DisplayName("resolve when request contains two access token query"
+ " parameters then AuthenticationException is thrown")
public void resolveThenAuthenticationExceptionIsThrown5() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setMethod("GET");
request.addParameter("access_token", "token1", "token2");
assertThatExceptionOfType(OAuth2AuthenticationException.class).isThrownBy(
() -> this.resolver.resolve(request))
.withMessageContaining("Found multiple bearer tokens in the request");
}
@Test
@DisplayName("resolve when request contains two access token form parameters"
+ " then AuthenticationException is thrown")
public void resolveThenAuthenticationExceptionIsThrown6() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setMethod("POST");
request.setContentType("application/x-www-form-urlencoded");
request.addParameter("access_token", "token1", "token2");
assertThatExceptionOfType(OAuth2AuthenticationException.class).isThrownBy(
() -> this.resolver.resolve(request))
.withMessageContaining("Found multiple bearer tokens in the request");
}
@Test
@DisplayName("resolve when parameter is present in multipart request"
+ " and form parameter supported then token is not resolved")
public void resolveThenTokenIsNotResolved() {
this.resolver.setAllowFormEncodedBodyParameter(true);
MockHttpServletRequest request = new MockHttpServletRequest();
request.setMethod("POST");
request.setContentType("multipart/form-data");
request.addParameter("access_token", TEST_TOKEN);
assertThat(this.resolver.resolve(request)).isNull();
}
@Test
@DisplayName("resolveWhenFormParameterIsPresentAndSupportedThenTokenIsResolved")
public void resolveThenTokenIsResolved() {
this.resolver.setAllowFormEncodedBodyParameter(true);
MockHttpServletRequest request = new MockHttpServletRequest();
request.setMethod("POST");
request.setContentType("application/x-www-form-urlencoded");
request.addParameter("access_token", TEST_TOKEN);
assertThat(this.resolver.resolve(request)).isEqualTo(TEST_TOKEN);
}
@Test
@DisplayName("resolveWhenFormParameterIsPresentAndNotSupportedThenTokenIsNotResolved")
public void resolveThenTokenIsNotResolved2() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setMethod("POST");
request.setContentType("application/x-www-form-urlencoded");
request.addParameter("access_token", TEST_TOKEN);
assertThat(this.resolver.resolve(request)).isNull();
}
@Test
@DisplayName("resolveWhenQueryParameterIsPresentAndSupportedThenTokenIsResolved")
public void resolveThenTokenIsResolved2() {
this.resolver.setAllowUriQueryParameter(true);
MockHttpServletRequest request = new MockHttpServletRequest();
request.setMethod("GET");
request.addParameter("access_token", TEST_TOKEN);
assertThat(this.resolver.resolve(request)).isEqualTo(TEST_TOKEN);
}
@Test
@DisplayName("resolveWhenQueryParameterIsPresentAndNotSupportedThenTokenIsNotResolved")
public void resolveThenTokenIsNotResolved3() {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setMethod("GET");
request.addParameter("access_token", TEST_TOKEN);
assertThat(this.resolver.resolve(request)).isNull();
}
}
| [
"1484563614@qq.com"
] | 1484563614@qq.com |
c842c2dd5f4d20320389058a24add168ee5f6938 | 040ecedb1ba0f195ada3a0801c412d5535f814ef | /1st_Year/AED/DataTypes/src/TiposDeDados/DLIPriorityQueue.java | 0bdaa367ca5dda957f823efef3b06be7d5a5ce65 | [] | no_license | jtaca/BSc-Computer-Engineering-Projects | a936e500ff6ce07945e2592080866bfd8e5b1e22 | 662ac6bbb6f011d7888d38927d7d80f333c533f8 | refs/heads/master | 2022-03-23T16:20:50.824667 | 2019-11-15T11:22:02 | 2019-11-15T11:22:02 | 97,099,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 939 | java | package TiposDeDados;
public class DLIPriorityQueue {
private static class Node {
private Comparable item;
private Node next;
}
private Node first;
public void clear() {
first = null;
}
public boolean isEmpty() {
return first == null;
}
public void insert(Comparable item) {
Node previous = null;
Node aux = first;
while(aux != null && item.compareTo(aux.item) >= 0) {
previous = aux;
aux = aux.next;
}
Node newNode = new Node();
newNode.item = item;
newNode.next = aux;
if(previous == null) {
first = newNode;
} else {
previous.next = newNode;
}
}
public Comparable peek() {
if(isEmpty())
throw new IllegalStateException("Fila prioritária vazia!");
return first.item;
}
public void poll() {
if(isEmpty())
throw new IllegalStateException("Fila prioritária vazia!");
first = first.next;
}
} | [
"joaotiagoaparicio@gmail.com"
] | joaotiagoaparicio@gmail.com |
b683e71d0254b043fb481e3bbe63a9a838810a69 | 7f246963c9486a7dcc6c34927167f4b56bc75509 | /observer_pattern/FiguresOO-Observer-pattern/src/figures/Display.java | 52c925b8e3938b48a67805f879c358c577881efc | [
"MIT"
] | permissive | JoaoGFarias/aspectJ_sandbox | c6c6605ae658b061e926b2dbda95c1ebb9cd72da | 3e35ca7f5443bb1edfe4d0e3cd4d2f2e75e1a001 | refs/heads/master | 2021-01-19T09:13:03.676953 | 2017-05-01T20:19:56 | 2017-05-01T20:19:56 | 87,741,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java |
package figures;
import java.util.ArrayList;
import java.util.List;
public class Display implements Observer{
private Subject subject;
private List<Subject> subjects;
public Display(Subject subject){
this.subject = subject;
this.subject.registerObserver(this);
}
public Display(){
this.subjects = new ArrayList<>();
}
public void addSubject(Subject subject){
subject.registerObserver(this);
this.subjects.add(subject);
}
public void update(Shape s) {
System.out.println("Figure "+s+" updated!!");
}
@Override
public void update(Object obs) {
this.update((Shape)obs);
}
}
| [
"jgfd@cin.ufpe.br"
] | jgfd@cin.ufpe.br |
51c3b2c0698bfef9a081d9ddc449c1a300783e31 | f321db1ace514d08219cc9ba5089ebcfff13c87a | /generated-tests/dynamosa/tests/s1003/25_okio/evosuite-tests/okio/Utf8_ESTest.java | 422aa1672ced3f3f63f3cc445f7cb7988f6cd242 | [] | no_license | sealuzh/dynamic-performance-replication | 01bd512bde9d591ea9afa326968b35123aec6d78 | f89b4dd1143de282cd590311f0315f59c9c7143a | refs/heads/master | 2021-07-12T06:09:46.990436 | 2020-06-05T09:44:56 | 2020-06-05T09:44:56 | 146,285,168 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,107 | java | /*
* This file was automatically generated by EvoSuite
* Wed Jul 03 01:01:45 GMT 2019
*/
package okio;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import okio.Utf8;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class Utf8_ESTest extends Utf8_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
// Undeclared exception!
try {
Utf8.size("", 1, 2871);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// endIndex > string.length: 2871 > 0
//
verifyException("okio.Utf8", e);
}
}
@Test(timeout = 4000)
public void test1() throws Throwable {
// Undeclared exception!
try {
Utf8.size("", (-1), 0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// beginIndex < 0: -1
//
verifyException("okio.Utf8", e);
}
}
@Test(timeout = 4000)
public void test2() throws Throwable {
long long0 = Utf8.size("kqn[4)2WHo+#xGp!|:", 0, 0);
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test3() throws Throwable {
long long0 = Utf8.size("");
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test4() throws Throwable {
// Undeclared exception!
try {
Utf8.size((String) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("okio.Utf8", e);
}
}
@Test(timeout = 4000)
public void test5() throws Throwable {
long long0 = Utf8.size("X7p(zc$_%~ZmjSR*:", 0, 1);
assertEquals(1L, long0);
}
@Test(timeout = 4000)
public void test6() throws Throwable {
// Undeclared exception!
try {
Utf8.size("", 469, (-882));
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// endIndex < beginIndex: -882 < 469
//
verifyException("okio.Utf8", e);
}
}
@Test(timeout = 4000)
public void test7() throws Throwable {
// Undeclared exception!
try {
Utf8.size((String) null, 0, 0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// string == null
//
verifyException("okio.Utf8", e);
}
}
@Test(timeout = 4000)
public void test8() throws Throwable {
long long0 = Utf8.size("W75;B\"58%uGe4");
assertEquals(13L, long0);
}
}
| [
"granogiovanni90@gmail.com"
] | granogiovanni90@gmail.com |
997cdc1f80ee1a7cf6015aa90f8fbc50e408acb1 | 8a8a516786dbfc30aa7fb14c853838f39b94711d | /app/src/androidTest/java/br/com/dynara/ichat_alura/ExampleInstrumentedTest.java | 83a407097eb6b79542b69f4b83613d03deb16ea8 | [] | no_license | dynaraoliveira/Ichat-alura | bf3fc53a9fd6d056adba8d5ecb4b09ed6f49d318 | 34104a23835febe594e81b423f3e1aaedb20881b | refs/heads/master | 2021-01-15T17:46:56.978419 | 2017-08-15T23:44:25 | 2017-08-15T23:44:25 | 99,758,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package br.com.dynara.ichat_alura;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("br.com.dynara.ichat_alura", appContext.getPackageName());
}
}
| [
"dynara.oliveira@gmail.com"
] | dynara.oliveira@gmail.com |
d86e616b9b9a3f69580f96561d8a1460ffb84d5d | 80acd3ab484d915d480962bc878b9682f671cd9c | /shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/test/java/org/apache/shardingsphere/cluster/heartbeat/task/HeartbeatTaskManagerTest.java | c289874e138b40fd084250118f7afd7fdf60c5fb | [
"Apache-2.0"
] | permissive | xiaosTyy/shardingsphere | 52a4041563d3f77e281c04eb7ab31119cdfa7564 | 47f68db6e8109d55c4317eeb0156d374951252dd | refs/heads/master | 2022-12-03T04:14:28.308725 | 2020-08-18T03:32:49 | 2020-08-18T03:32:49 | 288,369,399 | 1 | 0 | Apache-2.0 | 2020-08-18T06:04:23 | 2020-08-18T06:04:22 | null | UTF-8 | Java | false | false | 2,627 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.cluster.heartbeat.task;
import lombok.SneakyThrows;
import org.apache.shardingsphere.cluster.heartbeat.event.HeartbeatDetectNoticeEvent;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.internal.util.reflection.FieldSetter;
import org.mockito.junit.MockitoJUnitRunner;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.verify;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@RunWith(MockitoJUnitRunner.class)
public final class HeartbeatTaskManagerTest {
@Mock
private ScheduledExecutorService executorService;
private HeartbeatTaskManager heartbeatTaskManager;
@Before
@SneakyThrows({NoSuchFieldException.class, SecurityException.class})
public void init() {
heartbeatTaskManager = new HeartbeatTaskManager(60);
FieldSetter.setField(heartbeatTaskManager, heartbeatTaskManager.getClass().getDeclaredField("executorService"), executorService);
}
@Test
public void start() {
HeartbeatTask heartbeatTask = new HeartbeatTask(new HeartbeatDetectNoticeEvent());
doAnswer(invocationOnMock -> {
heartbeatTask.run();
return null;
}).when(executorService).scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class));
heartbeatTaskManager.start(heartbeatTask);
verify(executorService).scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class));
}
@After
public void close() {
heartbeatTaskManager.close();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
9c3f73f370e9cd974cc2db557443c2a117a9f1a9 | d2bf5320aaac1832a9b6e304e202730ded3bffe4 | /sud/src/main/java/dependency/sud/test.java | 50a59859d72577f5c8efaf7af9db717c33e67294 | [] | no_license | joinmestudio/SpringTest | c050f360c1c68672d87333131e9cf06baa8d5569 | a2038b4f257291fa896fe71557d69bed65dc4189 | refs/heads/master | 2022-05-26T04:22:43.330961 | 2020-02-23T21:05:26 | 2020-02-23T21:05:26 | 241,453,034 | 0 | 0 | null | 2022-05-25T06:57:10 | 2020-02-18T19:49:48 | Java | UTF-8 | Java | false | false | 861 | java | package dependency.sud;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class test {
public static void main(String[] args) {
// change scope ofbean using (scope="prototype") in config file
///......to enable all annotation using config file (use RequiredAnnotationBeanPostProcessor )
/*
AbstractApplicationContext context = new ClassPathXmlApplicationContext("dependency.xml");
Engine engine = (Engine)context.getBean("engine1");
System.out.println(engine);
context.registerShutdownHook();
*/
AbstractApplicationContext context1 = new ClassPathXmlApplicationContext("dependency.xml");
Car car = (Car)context1.getBean("car");
System.out.println(car);
context1.registerShutdownHook();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
fb44dc256ec71fa9d4fb5479da35579daf9805a5 | 1c499e03cfaf53d16116b6f36a7b1b1a59ef83b0 | /src/main/java/com/udemy/eMusicStore/controller/CartController.java | 149b50dc674457108e9ebbc8e0df43c1c00784dc | [] | no_license | ChauhanSandeep/eCommerce | a38a62d6f34d6f548b3104926f017328ab5c5f12 | cb9a980e2ba60060d98a34edd4bb0f5de02b3b60 | refs/heads/master | 2021-05-11T02:38:39.937851 | 2018-04-24T19:00:13 | 2018-04-24T19:00:13 | 115,228,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,704 | java | package com.udemy.eMusicStore.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.web.bind.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.udemy.eMusicStore.model.Customer;
import com.udemy.eMusicStore.service.CustomerService;
/**
* @author sandeep.chauhan
*
*/
@Controller
@RequestMapping("/customer/cart")
public class CartController {
@Autowired
CustomerService customerService;
/*
* AuthenticationPrincipal is used to get the data about the logged in user.
* We need to use spring security version 3.2.5 in pom.xml and give proper argument resolver in dispatcher servlet
* under mvc:annotation driven.
* I also needed to change the spring version from 3 to 4.1.4 release.
*/
@RequestMapping
public String getCart(@AuthenticationPrincipal User activeUser){
System.out.println("trying to get customer");
Customer customer = customerService.getCustomerByUsername(activeUser.getUsername());
System.out.println("the name of the customer is " + customer.getCustomerName());
int cartId = customer.getCart().getCartId();
System.out.println("the cart id is "+ cartId);
return "redirect:/customer/cart/"+cartId;
}
@RequestMapping("/{cartId}")
public String getCartRedirect(@PathVariable("cartId") int cartId, Model model){
model.addAttribute("cartId", cartId);
return "cart";
}
}
| [
"schauhan346@gmail.com"
] | schauhan346@gmail.com |
ceb6ee24958ba15845e2830987b0754926fe3b4f | d5f09c7b0e954cd20dd613af600afd91b039c48a | /sources/net/lingala/zip4j/model/CentralDirectory.java | 0540876e2028594325d46218044ca88a27fa2899 | [] | no_license | t0HiiBwn/CoolapkRelease | af5e00c701bf82c4e90b1033f5c5f9dc8526f4b3 | a6a2b03e32cde0e5163016e0078391271a8d33ab | refs/heads/main | 2022-07-29T23:28:35.867734 | 2021-03-26T11:41:18 | 2021-03-26T11:41:18 | 345,290,891 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package net.lingala.zip4j.model;
import java.util.ArrayList;
import java.util.List;
public class CentralDirectory {
private DigitalSignature digitalSignature = new DigitalSignature();
private List<FileHeader> fileHeaders = new ArrayList();
public List<FileHeader> getFileHeaders() {
return this.fileHeaders;
}
public void setFileHeaders(List<FileHeader> list) {
this.fileHeaders = list;
}
public DigitalSignature getDigitalSignature() {
return this.digitalSignature;
}
public void setDigitalSignature(DigitalSignature digitalSignature2) {
this.digitalSignature = digitalSignature2;
}
}
| [
"test@gmail.com"
] | test@gmail.com |
bca402086fe7892ec0a1d9c4d137f53a2151099d | e4ae32b049e3796b41bc03a0cbee58ff12d5d586 | /me/zeroeightsix/kami/mixin/client/MixinGuiScreen.java | c39bb7f6a62c0c8c43147df1cd4b2df4f6920a91 | [] | no_license | XeonLyfe/Sn0w | 6bd0f09ee7ceea20ee52748ef8c7300f58d0fd83 | 81fb831ad4fc8b6b9eb3a8b801db213f321d4b1a | refs/heads/main | 2023-04-12T04:40:40.960478 | 2021-05-17T22:29:40 | 2021-05-17T22:29:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,304 | java | //Deobfuscated with https://github.com/PetoPetko/Minecraft-Deobfuscator3000 using mappings "1.12 stable mappings"!
/*
* Decompiled with CFR 0.151.
*
* Could not load the following classes:
* net.minecraft.client.Minecraft
* net.minecraft.client.gui.FontRenderer
* net.minecraft.client.gui.GuiScreen
* net.minecraft.client.renderer.BufferBuilder
* net.minecraft.client.renderer.GlStateManager
* net.minecraft.client.renderer.GlStateManager$DestFactor
* net.minecraft.client.renderer.GlStateManager$SourceFactor
* net.minecraft.client.renderer.RenderHelper
* net.minecraft.client.renderer.RenderItem
* net.minecraft.client.renderer.Tessellator
* net.minecraft.client.renderer.vertex.DefaultVertexFormats
* net.minecraft.inventory.ItemStackHelper
* net.minecraft.item.ItemShulkerBox
* net.minecraft.item.ItemStack
* net.minecraft.nbt.NBTTagCompound
* net.minecraft.util.NonNullList
*/
package me.zeroeightsix.kami.mixin.client;
import me.zeroeightsix.kami.module.ModuleManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.inventory.ItemStackHelper;
import net.minecraft.item.ItemShulkerBox;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value={GuiScreen.class})
public class MixinGuiScreen {
RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
FontRenderer fontRenderer;
public MixinGuiScreen() {
this.fontRenderer = Minecraft.getMinecraft().fontRenderer;
}
@Inject(method={"renderToolTip"}, at={@At(value="HEAD")}, cancellable=true)
public void renderToolTip(ItemStack stack, int x, int y, CallbackInfo info) {
NBTTagCompound blockEntityTag;
NBTTagCompound tagCompound;
if (ModuleManager.isModuleEnabled("ShulkerPreview") && stack.getItem() instanceof ItemShulkerBox && (tagCompound = stack.getTagCompound()) != null && tagCompound.hasKey("BlockEntityTag", 10) && (blockEntityTag = tagCompound.getCompoundTag("BlockEntityTag")).hasKey("Items", 9)) {
info.cancel();
NonNullList nonnulllist = NonNullList.withSize((int)27, (Object)ItemStack.EMPTY);
ItemStackHelper.loadAllItems((NBTTagCompound)blockEntityTag, (NonNullList)nonnulllist);
GlStateManager.enableBlend();
GlStateManager.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableDepth();
int width = Math.max(144, this.fontRenderer.getStringWidth(stack.getDisplayName()) + 3);
int x1 = x + 12;
int y1 = y - 12;
int height = 57;
this.itemRender.zLevel = 300.0f;
this.drawGradientRectP(x1 - 3, y1 - 4, x1 + width + 3, y1 - 3, -267386864, -267386864);
this.drawGradientRectP(x1 - 3, y1 + height + 3, x1 + width + 3, y1 + height + 4, -267386864, -267386864);
this.drawGradientRectP(x1 - 3, y1 - 3, x1 + width + 3, y1 + height + 3, -267386864, -267386864);
this.drawGradientRectP(x1 - 4, y1 - 3, x1 - 3, y1 + height + 3, -267386864, -267386864);
this.drawGradientRectP(x1 + width + 3, y1 - 3, x1 + width + 4, y1 + height + 3, -267386864, -267386864);
this.drawGradientRectP(x1 - 3, y1 - 3 + 1, x1 - 3 + 1, y1 + height + 3 - 1, 0x505000FF, 1344798847);
this.drawGradientRectP(x1 + width + 2, y1 - 3 + 1, x1 + width + 3, y1 + height + 3 - 1, 0x505000FF, 1344798847);
this.drawGradientRectP(x1 - 3, y1 - 3, x1 + width + 3, y1 - 3 + 1, 0x505000FF, 0x505000FF);
this.drawGradientRectP(x1 - 3, y1 + height + 2, x1 + width + 3, y1 + height + 3, 1344798847, 1344798847);
this.fontRenderer.drawString(stack.getDisplayName(), x + 12, y - 12, 0xFFFFFF);
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
RenderHelper.enableGUIStandardItemLighting();
for (int i = 0; i < nonnulllist.size(); ++i) {
int iX = x + i % 9 * 16 + 11;
int iY = y + i / 9 * 16 - 11 + 8;
ItemStack itemStack = (ItemStack)nonnulllist.get(i);
this.itemRender.renderItemAndEffectIntoGUI(itemStack, iX, iY);
this.itemRender.renderItemOverlayIntoGUI(this.fontRenderer, itemStack, iX, iY, null);
}
RenderHelper.disableStandardItemLighting();
this.itemRender.zLevel = 0.0f;
GlStateManager.enableLighting();
GlStateManager.enableDepth();
RenderHelper.enableStandardItemLighting();
GlStateManager.enableRescaleNormal();
}
}
private void drawGradientRectP(int left, int top, int right, int bottom, int startColor, int endColor) {
float f = (float)(startColor >> 24 & 0xFF) / 255.0f;
float f1 = (float)(startColor >> 16 & 0xFF) / 255.0f;
float f2 = (float)(startColor >> 8 & 0xFF) / 255.0f;
float f3 = (float)(startColor & 0xFF) / 255.0f;
float f4 = (float)(endColor >> 24 & 0xFF) / 255.0f;
float f5 = (float)(endColor >> 16 & 0xFF) / 255.0f;
float f6 = (float)(endColor >> 8 & 0xFF) / 255.0f;
float f7 = (float)(endColor & 0xFF) / 255.0f;
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
GlStateManager.disableAlpha();
GlStateManager.tryBlendFuncSeparate((GlStateManager.SourceFactor)GlStateManager.SourceFactor.SRC_ALPHA, (GlStateManager.DestFactor)GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, (GlStateManager.SourceFactor)GlStateManager.SourceFactor.ONE, (GlStateManager.DestFactor)GlStateManager.DestFactor.ZERO);
GlStateManager.shadeModel((int)7425);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
bufferbuilder.pos((double)right, (double)top, 300.0).color(f1, f2, f3, f).endVertex();
bufferbuilder.pos((double)left, (double)top, 300.0).color(f1, f2, f3, f).endVertex();
bufferbuilder.pos((double)left, (double)bottom, 300.0).color(f5, f6, f7, f4).endVertex();
bufferbuilder.pos((double)right, (double)bottom, 300.0).color(f5, f6, f7, f4).endVertex();
tessellator.draw();
GlStateManager.shadeModel((int)7424);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
}
}
| [
"hqrion@gmail.com"
] | hqrion@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.