blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6f9c677bca37ec3d31e8c3661ced93abdb6696e2 | 5efc9a74aa9c0cf0041c9cee889af026d61b84b2 | /samples/modern-java/src/com/waylau/java/net/AsyncEchoServer.java | 9076e4a498e2e10d7e15bb88ee78cb23f0eb5f78 | [] | no_license | waylau/modern-java-demos | f096c46ad79fe8f923265d1f06ac1f9b7b3c9965 | f55563bca7cd8d0b36bbca9714ccebfb450abcee | refs/heads/master | 2022-10-18T13:57:43.231936 | 2022-10-03T07:20:46 | 2022-10-03T07:20:46 | 163,201,354 | 118 | 25 | null | 2020-03-22T08:19:41 | 2018-12-26T17:11:01 | null | UTF-8 | Java | false | false | 2,887 | java | package com.waylau.java.net;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.StandardSocketOptions;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousServerSocketChannel;
import java.nio.channels.AsynchronousSocketChannel;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
* Asynchronous Echo Server(Asynchronous IO Model)
*
* @since 1.0.0 2019年4月17日
* @author <a href="https://waylau.com">Way Lau</a>
*/
class AsyncEchoServer {
public static int DEFAULT_PORT = 7;
public static void main(String[] args) throws IOException {
int port;
try {
port = Integer.parseInt(args[0]);
} catch (RuntimeException ex) {
port = DEFAULT_PORT;
}
ExecutorService taskExecutor = Executors.newCachedThreadPool(Executors.defaultThreadFactory());
try (AsynchronousServerSocketChannel asynchronousServerSocketChannel = AsynchronousServerSocketChannel.open()) {
if (asynchronousServerSocketChannel.isOpen()) {
asynchronousServerSocketChannel.setOption(StandardSocketOptions.SO_RCVBUF, 4 * 1024);
asynchronousServerSocketChannel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
asynchronousServerSocketChannel.bind(new InetSocketAddress(port));
System.out.println("等待连接 ...");
while (true) {
Future<AsynchronousSocketChannel> asynchronousSocketChannelFuture = asynchronousServerSocketChannel
.accept();
try {
final AsynchronousSocketChannel asynchronousSocketChannel = asynchronousSocketChannelFuture
.get();
Callable<String> worker = new Callable<String>() {
@Override
public String call() throws Exception {
String host = asynchronousSocketChannel.getRemoteAddress().toString();
System.out.println("进来的连接来自: " + host);
final ByteBuffer buffer = ByteBuffer.allocateDirect(1024);
while (asynchronousSocketChannel.read(buffer).get() != -1) {
buffer.flip();
asynchronousSocketChannel.write(buffer).get();
if (buffer.hasRemaining()) {
buffer.compact();
} else {
buffer.clear();
}
}
asynchronousSocketChannel.close();
System.out.println(host + " 成功启动!");
return host;
}
};
taskExecutor.submit(worker);
} catch (InterruptedException | ExecutionException ex) {
System.err.println(ex);
System.err.println("\n 服务器正在关闭...");
taskExecutor.shutdown();
while (!taskExecutor.isTerminated()) {
}
break;
}
}
} else {
System.out.println("异步服务器Socket管道不能打开!");
}
} catch (IOException ex) {
System.err.println(ex);
}
}
} | [
"waylau521@gmail.com"
] | waylau521@gmail.com |
9a869c65eb70b7e809f6119cb86f9de11b2ae71a | fc493d0c0fc3cd96afc231dcffa56a49b6da403c | /AttendanceWebService/src/moz/connectDb/ConnectDbImpl.java | 84435a8eee7612de0062df113839ebb07ed0617c | [] | no_license | zhuyueming/Attendance | 469072da954e528a0ea59fa8dc8f958d6e624fe7 | 9dae98ad37bd4eabd0665f4f73e609e711ecfc0e | refs/heads/master | 2020-12-24T06:05:34.137866 | 2016-05-31T06:52:19 | 2016-05-31T06:52:19 | 60,065,072 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,384 | java | package moz.connectDb;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class ConnectDbImpl implements ConnectDb {
PreparedStatement preparedStatement;
private static Connection connection = null;
private static Statement statement = null;
private static ResultSet resultSet = null;
final static String url = "jdbc:mysql://127.0.0.1:3306/attendance";
final static String user = "root";
final static String password = "admin";
final static int Identity = 1;
final static String selectStudents = "select * from students";
final static String selectTeachers = "select * from teachers";
final static String selectSession = "select * from onlineusers";
final static String selectTeacherQRCode ="select * from qrcode";
final static String updateSession = "update onlineusers set sessionId=? where Id=?";
final static String insertSession = "insert into onlineusers (Id,sessionId) values (?,?)";
final static String updateQRCode = "update qrcode set qrCode=? where classId=?";
final static String insertQRCode = "insert into qrcode (classId,qrCode) values (?,?)";
public ConnectDbImpl() {
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(url, user, password);
statement = connection.createStatement();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
// 利用身份返回结果集
public ResultSet switchIdentity(int Identity) throws Exception {
switch (Identity) {
case 1:
return statement.executeQuery(selectStudents);
case 2:
return statement.executeQuery(selectTeachers);
}
return null;
}
// 登陆
@Override
public boolean LoginConnectDb(String LoginId, String LoginPwd, int Identity)
throws Exception {
resultSet = switchIdentity(Identity);
// 5. 输出结果集的数据
while (resultSet.next()) {
String userId = resultSet.getString("Id");
String userPwd = resultSet.getString("Password");
System.out.println(resultSet.getString("Id") + ":"
+ resultSet.getString("Password"));
if (userId.equals(LoginId) && userPwd.equals(LoginPwd)) {
return true;
}
}
// 6. 关闭连接,命令对象,结果集
return false;
}
@Override
public boolean ModPwdConnectDb(String LoginId, String OldPwd,
String NewPwd, int Identity) throws Exception {
resultSet = switchIdentity(Identity);
// 5. 输出结果集的数据
while (resultSet.next()) {
String userName = resultSet.getString("Id");
String userPwd = resultSet.getString("Password");
System.out.println(resultSet.getString("Id") + ":"
+ resultSet.getString("Password"));
if (userName.equals(LoginId) && userPwd.equals(OldPwd)) {
switch (Identity) {
case 1:
preparedStatement = connection
.prepareStatement("update students set Password=? where Id=?");
break;
case 2:
preparedStatement = connection
.prepareStatement("update teachers set Password=? where Id=?");
break;
}
preparedStatement.setString(1, NewPwd);
preparedStatement.setString(2, LoginId);
preparedStatement.executeUpdate();
return true;
}
}
return false;
}
@Override
public boolean SignInConnectDb(String scanResult, String userId)
throws Exception {
resultSet = statement.executeQuery(selectTeacherQRCode);
while (resultSet.next()) {
String classId1 = resultSet.getString("classId");
String qrCode = resultSet.getString("qrCode");
String classId2 = userId.substring(0, 7);
if(classId1.equals(classId2)){
if (scanResult.equals(qrCode)) {
PreparedStatement preparedStatement = connection
.prepareStatement("update students set flag=? where Id=?");
preparedStatement.setString(1, "1");
preparedStatement.setString(2, userId);
preparedStatement.executeUpdate();
return true;
}
}
}
return false;
}
@Override
public boolean saveTeacherQRCode(String ClassId,String QRCode) throws Exception {
String classId = ClassId;
String qrCode = QRCode;
final String selectTeacherQRCode = "select qrCode from qrcode where classId="+classId;
resultSet = statement.executeQuery(selectTeacherQRCode);
System.out.println(classId + ".............." + qrCode);
boolean result =resultSet.first();
if(result){//当前表中存在此classId
//String Id = resultSet.getString("classId");
preparedStatement = connection.prepareStatement(updateQRCode);
preparedStatement.setString(1, qrCode);
preparedStatement.setString(2, classId);
preparedStatement.executeUpdate();//更新qrCode
return true;
}else{
//当前表中不存在此classId
preparedStatement = connection.prepareStatement(insertQRCode);
preparedStatement.setString(1, classId);
preparedStatement.setString(2, qrCode);
preparedStatement.executeUpdate();//插入classId,qrCode
return true;
}
}
@Override
public String getNameConnectDb(String LoginId, int Identity)
throws Exception {
resultSet = switchIdentity(Identity);
while (resultSet.next()) {
String userId = resultSet.getString("Id");
String Name = resultSet.getString("Name");
if (userId.equals(LoginId))
return Name;
}
return null;
}
@Override
public boolean SaveSession(String UserId, String SessionId)
throws Exception {
resultSet = statement.executeQuery(selectSession);
String userId = UserId;
String sessionId = SessionId;
while (resultSet.next()) {
String Id = resultSet.getString("Id");
if (UserId.equals(Id)) {
preparedStatement = connection.prepareStatement(updateSession);
preparedStatement.setString(1, sessionId);
preparedStatement.setString(2, userId);
preparedStatement.executeUpdate();
return true;
} else {
preparedStatement = connection.prepareStatement(insertSession);
preparedStatement.setString(1, userId);
preparedStatement.setString(2, sessionId);
preparedStatement.executeUpdate();
return true;
}
}
return false;
}
}
| [
"ZhuYueMing@192.168.1.123"
] | ZhuYueMing@192.168.1.123 |
5130369a8b275d41265099426e26daab0f9cc21f | e62e0ddb1a593eb082f62b159c96449e5845e6c4 | /entities/src/main/java/com/ofss/fcubs/service/fcubsaccservice/QUERYACCSUMMIOFSRES.java | 4c3b4a8aefd9de6b8697e3c2f317afd96c50a272 | [] | no_license | pwcfstech/CustomerOnboarding_WhiteLabel_Backend | 68adb8b4640b0b468bd02e8fb8a6fa699c78dfa8 | 2265801768d4f68e3e92a3ceb624aa179e6f60f6 | refs/heads/master | 2021-08-11T07:41:18.970465 | 2017-11-13T09:52:19 | 2017-11-13T09:52:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,485 | java |
package com.ofss.fcubs.service.fcubsaccservice;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="FCUBS_HEADER" type="{http://fcubs.ofss.com/service/FCUBSAccService}FCUBS_HEADERType"/>
* <element name="FCUBS_BODY">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Stvw-Account-Sumary-IO" type="{http://fcubs.ofss.com/service/FCUBSAccService}QueryAccSumm-Query-IO-Type" minOccurs="0"/>
* <element name="Stvw-Account-Sumary-Full" type="{http://fcubs.ofss.com/service/FCUBSAccService}QueryAccSumm-Full-Type" minOccurs="0"/>
* <element name="FCUBS_ERROR_RESP" type="{http://fcubs.ofss.com/service/FCUBSAccService}ERRORType" maxOccurs="unbounded" minOccurs="0"/>
* <element name="FCUBS_WARNING_RESP" type="{http://fcubs.ofss.com/service/FCUBSAccService}WARNINGType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"fcubsheader",
"fcubsbody"
})
@XmlRootElement(name = "QUERYACCSUMM_IOFS_RES")
public class QUERYACCSUMMIOFSRES {
@XmlElement(name = "FCUBS_HEADER", required = true)
protected FCUBSHEADERType fcubsheader;
@XmlElement(name = "FCUBS_BODY", required = true)
protected QUERYACCSUMMIOFSRES.FCUBSBODY fcubsbody;
/**
* Gets the value of the fcubsheader property.
*
* @return
* possible object is
* {@link FCUBSHEADERType }
*
*/
public FCUBSHEADERType getFCUBSHEADER() {
return fcubsheader;
}
/**
* Sets the value of the fcubsheader property.
*
* @param value
* allowed object is
* {@link FCUBSHEADERType }
*
*/
public void setFCUBSHEADER(FCUBSHEADERType value) {
this.fcubsheader = value;
}
/**
* Gets the value of the fcubsbody property.
*
* @return
* possible object is
* {@link QUERYACCSUMMIOFSRES.FCUBSBODY }
*
*/
public QUERYACCSUMMIOFSRES.FCUBSBODY getFCUBSBODY() {
return fcubsbody;
}
/**
* Sets the value of the fcubsbody property.
*
* @param value
* allowed object is
* {@link QUERYACCSUMMIOFSRES.FCUBSBODY }
*
*/
public void setFCUBSBODY(QUERYACCSUMMIOFSRES.FCUBSBODY value) {
this.fcubsbody = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Stvw-Account-Sumary-IO" type="{http://fcubs.ofss.com/service/FCUBSAccService}QueryAccSumm-Query-IO-Type" minOccurs="0"/>
* <element name="Stvw-Account-Sumary-Full" type="{http://fcubs.ofss.com/service/FCUBSAccService}QueryAccSumm-Full-Type" minOccurs="0"/>
* <element name="FCUBS_ERROR_RESP" type="{http://fcubs.ofss.com/service/FCUBSAccService}ERRORType" maxOccurs="unbounded" minOccurs="0"/>
* <element name="FCUBS_WARNING_RESP" type="{http://fcubs.ofss.com/service/FCUBSAccService}WARNINGType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"stvwAccountSumaryIO",
"stvwAccountSumaryFull",
"fcubserrorresp",
"fcubswarningresp"
})
public static class FCUBSBODY {
@XmlElement(name = "Stvw-Account-Sumary-IO")
protected QueryAccSummQueryIOType stvwAccountSumaryIO;
@XmlElement(name = "Stvw-Account-Sumary-Full")
protected QueryAccSummFullType stvwAccountSumaryFull;
@XmlElement(name = "FCUBS_ERROR_RESP")
protected List<ERRORType> fcubserrorresp;
@XmlElement(name = "FCUBS_WARNING_RESP")
protected List<WARNINGType> fcubswarningresp;
/**
* Gets the value of the stvwAccountSumaryIO property.
*
* @return
* possible object is
* {@link QueryAccSummQueryIOType }
*
*/
public QueryAccSummQueryIOType getStvwAccountSumaryIO() {
return stvwAccountSumaryIO;
}
/**
* Sets the value of the stvwAccountSumaryIO property.
*
* @param value
* allowed object is
* {@link QueryAccSummQueryIOType }
*
*/
public void setStvwAccountSumaryIO(QueryAccSummQueryIOType value) {
this.stvwAccountSumaryIO = value;
}
/**
* Gets the value of the stvwAccountSumaryFull property.
*
* @return
* possible object is
* {@link QueryAccSummFullType }
*
*/
public QueryAccSummFullType getStvwAccountSumaryFull() {
return stvwAccountSumaryFull;
}
/**
* Sets the value of the stvwAccountSumaryFull property.
*
* @param value
* allowed object is
* {@link QueryAccSummFullType }
*
*/
public void setStvwAccountSumaryFull(QueryAccSummFullType value) {
this.stvwAccountSumaryFull = value;
}
/**
* Gets the value of the fcubserrorresp property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the fcubserrorresp property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getFCUBSERRORRESP().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ERRORType }
*
*
*/
public List<ERRORType> getFCUBSERRORRESP() {
if (fcubserrorresp == null) {
fcubserrorresp = new ArrayList<ERRORType>();
}
return this.fcubserrorresp;
}
/**
* Gets the value of the fcubswarningresp property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the fcubswarningresp property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getFCUBSWARNINGRESP().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link WARNINGType }
*
*
*/
public List<WARNINGType> getFCUBSWARNINGRESP() {
if (fcubswarningresp == null) {
fcubswarningresp = new ArrayList<WARNINGType>();
}
return this.fcubswarningresp;
}
}
}
| [
"kousik70@gmail.com"
] | kousik70@gmail.com |
536cd968091306f5b74af6eacd027e74f0956bf5 | b0a954dd83866e9bf54d190556ab273d4d8d725e | /src/main/java/rollmoredice/config/WebMvcConfig.java | e5e670140cee8e6a967f57386482a5dba97638f8 | [
"Apache-2.0"
] | permissive | FErlenbusch/RollMoreDice | 0a04bdbf28c8c9ce67b9de58867981ce3b81944d | c85501a63f23c4d430c41aac388cced2544561ad | refs/heads/master | 2020-05-23T21:25:20.700355 | 2019-05-16T04:57:13 | 2019-05-16T04:57:13 | 186,954,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,070 | java | package rollmoredice.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
private final long MAX_AGE_SECS = 3600;
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("HEAD", "OPTIONS", "GET", "POST", "PUT", "PATCH", "DELETE")
.maxAge(MAX_AGE_SECS);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
} | [
"FErlenbusch@gmail.com"
] | FErlenbusch@gmail.com |
e2f0280e2d33d97024c3005b52f0d1209afef110 | cfa7d9ef4015cbab56388835842d8e27ba9aeb45 | /modules/com/ail/commercial.jar/com/ail/financial/CardIssuer.java | e72ff783be0fa6092051106870575ea845e09055 | [] | no_license | sangnguyensoftware/openunderwriter | 678ff8cfe83f781a03b9cd62313e3d6594e74556 | 380cfa83e135084d29cd0b29d1ed4780cdb62408 | refs/heads/master | 2020-03-21T09:24:40.328042 | 2018-06-26T00:13:27 | 2018-06-26T00:13:27 | 138,398,507 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,118 | java | /* Copyright Applied Industrial Logic Limited 2002. All rights Reserved */
/*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.ail.financial;
import com.ail.core.Functions;
import com.ail.core.TypeEnum;
/**
* Type safe enumeration representing constant values for FinancialFrequency.
*/
public enum CardIssuer implements TypeEnum {
/** Undefined */
UNDEFINED("?"),
DELTA("Delta"),
MASTERCARD("Master card"),
SWITCH("Switch"),
VISA("Visa");
private final String longName;
CardIssuer() {
this.longName=name();
}
CardIssuer(String longName) {
this.longName=longName;
}
public String getLongName() {
return longName;
}
public String valuesAsCsv() {
return Functions.arrayAsCsv(values());
}
public String longName() {
return longName;
}
/**
* This method is similar to the valueOf() method offered by Java's Enum type, but
* in this case it will match either the Enum's name or the longName.
* @param name The name to lookup
* @return The matching Enum, or IllegalArgumentException if there isn't a match.
*/
public static CardIssuer forName(String name) {
return (CardIssuer)Functions.enumForName(name, values());
}
public String getName() {
return name();
}
public int getOrdinal() {
return ordinal();
}
}
| [
"40519615+sangnguyensoftware@users.noreply.github.com"
] | 40519615+sangnguyensoftware@users.noreply.github.com |
a72279b48c4ed8e0ab13d67e76660b3ab4783daf | 5cb96237841e4aa531ac4914c189eb22bace152e | /Star Wars/src/starwars/entities/actors/Player.java | 40a0acf3cbd18cf6f40e65075e6c4db13f26d9ba | [] | no_license | julioandre/OOP-Project | 576d9e5b898d2cd16c9a4de7516ea257a6ebd1c8 | 979d49b35ac36bcb4f68e0800f0b394df7444462 | refs/heads/master | 2020-06-30T07:39:59.087429 | 2019-08-06T03:26:29 | 2019-08-06T03:26:29 | 200,768,494 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,839 | java | package starwars.entities.actors;
import java.util.List;
import edu.monash.fit2099.simulator.userInterface.MessageRenderer;
import starwars.SWActor;
import starwars.SWEntityInterface;
import starwars.SWLocation;
import starwars.SWWorld;
import starwars.Team;
import starwars.swinterfaces.SWGridController;
/**
* A very minimal <code>SWActor</code> that the user can control. Its <code>act()</code> method
* prompts the user to select a command.
*
* @author ram
*/
/*
* Change log
* 2017/02/22 Schedule actions in the act method instead of tick.
* A controller used to get user input rather than the UI directly (Asel)
*/
public class Player extends SWActor {
/**
* Constructor for the <code>Player</code> class. This constructor will,
* <ul>
* <li>Initialize the message renderer for the <code>Player</code></li>
* <li>Initialize the world for this <code>Player</code></li>
* <li>Initialize the <code>Team</code> for this <code>Player</code></li>
* <li>Initialize the hit points for this <code>Player</code></li>
* <li>Set this <code>Player</code> as a human controlled <code>SWActor</code></li>
* </ul>
*
* @param team the <code>Team</code> to which the this <code>Player</code> belongs to
* @param hitpoints the hit points of this <code>Player</code> to get started with
* @param m <code>MessageRenderer</code> to display messages.
* @param world the <code>SWWorld</code> world to which this <code>Player</code> belongs to
*
*/
public Player(Team team, int hitpoints, MessageRenderer m, SWWorld world) {
super(team, hitpoints, m, world);
humanControlled = true; // this feels like a hack. Surely this should be dynamic
}
/**
* This method will describe this <code>Player</code>'s scene and prompt for user input through the controller
* to schedule the command.
* <p>
* This method will only be called if this <code>Player</code> is alive and is not waiting.
*
* @see {@link #describeScene()}
* @see {@link starwars.swinterfaces.SWGridController}
*/
@Override
public void act() {
describeScene();
scheduler.schedule(SWGridController.getUserDecision(this), this, 1);
}
/**
* This method will describe,
* <ul>
* <li>the this <code>Player</code>'s location</li>
* <li>items carried (if this <code>Player</code> is carrying any)</li>
* <li>the contents of this <code>Player</code> location (what this <code>Player</code> can see) other than itself</li>
* <ul>
* <p>
* The output from this method would be through the <code>MessageRenderer</code>.
*
* @see {@link edu.monash.fit2099.simulator.userInterface.MessageRenderer}
*/
public void describeScene() {
//get the location of the player and describe it
SWLocation location = this.world.getEntityManager().whereIs(this);
say(this.getShortDescription() + " [" + this.getHitpoints() + "] is at " + location.getShortDescription());
//get the items carried for the player
SWEntityInterface itemCarried = this.getItemCarried();
if (itemCarried != null) {
//and describe the item carried if the player is actually carrying an item
say(this.getShortDescription()
+ " is holding " + itemCarried.getShortDescription() + " [" + itemCarried.getHitpoints() + "]");
}
//get the contents of the location
List<SWEntityInterface> contents = this.world.getEntityManager().contents(location);
//and describe the contents
if (contents.size() > 1) { // if it is equal to one, the only thing here is this Player, so there is nothing to report
say(this.getShortDescription() + " can see:");
for (SWEntityInterface entity : contents) {
if (entity != this) { // don't include self in scene description
say("\t " + entity.getSymbol() + " - " + entity.getLongDescription() + " [" + entity.getHitpoints() + "]");
}
}
}
}
}
| [
"noreply@github.com"
] | julioandre.noreply@github.com |
8a610a9bb37e4c9e857f056b8ed85b51d37dccd0 | 5f2bb6e06f78a2204db2d41933298cb84d4607f8 | /ttd/taj.java | 0d648488e06341a9e7f48a9792ba394bbf313026 | [] | no_license | sunnykashyapsk/MapDestinations | 7d72b7d38aeb0c4232120e475432453580aed4a1 | 7044e4c0554aff977ff10febb86373bdd102b910 | refs/heads/master | 2022-11-24T08:31:19.200664 | 2020-07-11T09:37:13 | 2020-07-11T09:37:13 | 278,829,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,069 | java | package com.example.lenovo.ttd;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class taj extends AppCompatActivity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_taj);
webView = findViewById(R.id.webviewtj);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://www.google.com/maps/place/Taj+Mahal/@27.1751496,78.0399535,17z/data=!3m1!4b1!4m5!3m4!1s0x39747121d702ff6d:0xdd2ae4803f767dde!8m2!3d27.1751448!4d78.0421422");
WebSettings webSettings=webView.getSettings();
webSettings.setJavaScriptEnabled(true);
}
@Override
public void onBackPressed() {
if (webView.canGoBack()){
webView.goBack();
}else {
super.onBackPressed();
}
}
}
| [
"noreply@github.com"
] | sunnykashyapsk.noreply@github.com |
b37d43976d734632204c99d53b9e2aa78125736a | 5712edebcfaaf96fb131cc5b29d0e86d1fb5986d | /WebShop/src/main/java/ru/itis/services/BasketService.java | 6c8fa86dc3fda6952c3fb69555c2adbb0c751678 | [] | no_license | AlmazKh/Khamedzhanov_11_702 | a65625cdf8ec52157139cd4977861224e2226e25 | 60fb9b466f53a10cad3f55e50ab107bfd060e9a2 | refs/heads/master | 2022-02-22T07:33:59.101376 | 2019-10-12T20:00:20 | 2019-10-12T20:00:20 | 104,873,621 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package ru.itis.services;
import ru.itis.forms.BasketForm;
import ru.itis.forms.ProductForm;
import ru.itis.models.Basket;
import ru.itis.models.Product;
import java.util.List;
public interface BasketService {
void addBasket(Long userId, Long productId);
void addProduct(Long userId, Long productId);
void deleteProduct(Long userId, Long productId);
List<Product> getProductsByUserId(Long userId);
}
| [
"32297268+AlmazKh@users.noreply.github.com"
] | 32297268+AlmazKh@users.noreply.github.com |
032ace9a77b1bb9b727bcfa3981926a8b70824ee | bd6f651e469099718089f2fb294f3ee163986789 | /app/src/main/java/com/cjs/drv/recyclerview/darghelpercallback/GridSortHelperCallBack.java | 48e9237be8a78d13e3b1849426f768ce8c1d24ba | [] | no_license | Ashleeey1224/DragRecyclerView2021 | ad651734dbbb85e32ecfad421c389dc653229d1c | abfbefc5e35c8033251410c6283a29db388e3567 | refs/heads/master | 2023-03-21T23:07:46.474703 | 2021-02-19T07:44:32 | 2021-02-19T07:44:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 914 | java | package com.cjs.drv.recyclerview.darghelpercallback;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.cjs.drv.recyclerview.model.RecyclerItem;
import java.util.List;
/**
* 网格拖拽排序Helper
*
* @author JasonChen
* @email chenjunsen@outlook.com
* @createTime 2021/2/10 15:01
*/
public class GridSortHelperCallBack extends VerticalDragSortHelperCallBack {
public GridSortHelperCallBack(List<RecyclerItem> recyclerItemList) {
super(recyclerItemList);
}
@Override
public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
int dragFlag = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
return makeMovementFlags(dragFlag, ItemTouchHelper.ACTION_STATE_IDLE);
}
}
| [
"chenjunsen@csii.com.cn"
] | chenjunsen@csii.com.cn |
46b2ce21c985a3f76a431afc3db586b938ba4186 | c44e900166895a40880d49eea18848f50b3a2220 | /src/main/java/com/projects/service/UserServiceImpl.java | c54ee7ae9b3e3756ae1b87ff3b42e74a2660be06 | [] | no_license | okubanjoe/SpringBootRegistrationLoginPage | 32a5f821610009267d147b1be0fef7e7cb4ed645 | 1f85bcc1313284d64a5dd3fb9b6f8b823aa9a4b1 | refs/heads/master | 2023-02-04T14:43:42.762018 | 2020-12-21T05:30:05 | 2020-12-21T05:30:05 | 323,521,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,139 | java | package com.projects.service;
import com.projects.repository.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import com.projects.model.Role;
import com.projects.model.User;
import com.projects.repository.UserRepository;
import java.util.Arrays;
import java.util.HashSet;
@Service("userService")
public class UserServiceImpl implements UserService {
@Autowired
private UserRepository userRepository;
@Autowired
private RoleRepository roleRepository;
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Override
public User findUserByEmail(String email) {
return userRepository.findByEmail(email);
}
@Override
public void saveUser(User user) {
user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
user.setActive(1);
Role userRole = roleRepository.findByRole("ADMIN");
user.setRoles(new HashSet<Role>(Arrays.asList(userRole)));
userRepository.save(user);
}
} | [
"ayodeji@Ayodejis-MacBook-Pro.local"
] | ayodeji@Ayodejis-MacBook-Pro.local |
27b49a58520f0e276b241d9affcf3d0e39357b12 | cf03856ffa9c98305527a4b0e10b28601791ecb2 | /app/src/main/java/com/wxdroid/simplediary/ui/login/fragment/post/picselect/bean/ImageInfo.java | 16297ab7006206f68cf4193687d0871303dbb34f | [] | no_license | microcodor/simplediary_android | 564ef6aa9d01bba38b9a269e6ad721c843702f1e | 558385fd91a3e5cf5dac7df46871e1ba22b9f94e | refs/heads/master | 2021-01-23T03:48:09.408896 | 2017-03-25T01:52:19 | 2017-03-25T01:52:19 | 86,124,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,747 | java | package com.wxdroid.simplediary.ui.login.fragment.post.picselect.bean;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* 图片信息
* <p/>
* Created by Clock on 2016/1/26.
*/
public class ImageInfo implements Parcelable {
private static final long serialVersionUID = -3753345306395582567L;
/**
* 图片文件
*/
private File imageFile;
/**
* 是否被选中
*/
private boolean isSelected = false;
public File getImageFile() {
return imageFile;
}
public void setImageFile(File imageFile) {
this.imageFile = imageFile;
}
public boolean isSelected() {
return isSelected;
}
public void setIsSelected(boolean isSelected) {
this.isSelected = isSelected;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImageInfo imageInfo = (ImageInfo) o;
if (isSelected() != imageInfo.isSelected()) return false;
return getImageFile().equals(imageInfo.getImageFile());
}
@Override
public int hashCode() {
int result = getImageFile().hashCode();
result = 31 * result + (isSelected() ? 1 : 0);
return result;
}
/**
* @param imageFileList
* @return
*/
public static List<ImageInfo> buildFromFileList(List<File> imageFileList) {
if (imageFileList != null) {
List<ImageInfo> imageInfoArrayList = new ArrayList<>();
for (File imageFile : imageFileList) {
ImageInfo imageInfo = new ImageInfo();
imageInfo.imageFile = imageFile;
imageInfo.isSelected = false;
imageInfoArrayList.add(imageInfo);
}
return imageInfoArrayList;
} else {
return null;
}
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeSerializable(this.imageFile);
dest.writeByte(isSelected ? (byte) 1 : (byte) 0);
}
public ImageInfo() {
}
protected ImageInfo(Parcel in) {
this.imageFile = (File) in.readSerializable();
this.isSelected = in.readByte() != 0;
}
public static final Creator<ImageInfo> CREATOR = new Creator<ImageInfo>() {
@Override
public ImageInfo createFromParcel(Parcel source) {
return new ImageInfo(source);
}
@Override
public ImageInfo[] newArray(int size) {
return new ImageInfo[size];
}
};
}
| [
"920379777@qq.com"
] | 920379777@qq.com |
15eb8e08695eab014afae7f1193e81a84ff3f082 | 55aca439e180a9bcf0a36f60320013979905d1e5 | /efreight-afbase/src/main/java/com/efreight/afbase/controller/VAfCategoryController.java | d5059051add9c6624055983a72f15563e4bf8fcc | [] | no_license | zhoudy-github/efreight-cloud | 1a8f791f350a37c1f2828985ebc20287199a8027 | fc669facfdc909b51779a88575ab4351e275bd25 | refs/heads/master | 2023-03-18T07:24:18.001404 | 2021-03-23T06:55:54 | 2021-03-23T06:55:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,955 | java | package com.efreight.afbase.controller;
import com.efreight.afbase.entity.view.VAfCategory;
import com.efreight.afbase.service.VAfCategoryService;
import com.efreight.common.security.util.MessageInfo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* <p>
* VIEW 前端控制器
* </p>
*
* @author xiaobo
* @since 2020-02-28
*/
@RestController
@RequestMapping("/vAfCategory")
@AllArgsConstructor
@Slf4j
public class VAfCategoryController {
private final VAfCategoryService vAfCategoryService;
/**
* 查询参数列表
* @param categoryName
* @return
*/
@GetMapping("/{categoryName}")
public MessageInfo list(@PathVariable("categoryName") String categoryName){
try {
List<VAfCategory> list = vAfCategoryService.getList(categoryName);
return MessageInfo.ok(list);
}catch (Exception e){
log.info(e.getMessage());
return MessageInfo.failed(e.getMessage());
}
}
@GetMapping("sc/{categoryName}")
public MessageInfo sclist(@PathVariable("categoryName") String categoryName){
try {
List<VAfCategory> list = vAfCategoryService.getscList(categoryName);
return MessageInfo.ok(list);
}catch (Exception e){
log.info(e.getMessage());
return MessageInfo.failed(e.getMessage());
}
}
@GetMapping("/invoiceType")
public MessageInfo invoiceType(){
try {
List<Map> list = vAfCategoryService.invoiceType();
return MessageInfo.ok(list);
}catch (Exception e){
log.info(e.getMessage());
return MessageInfo.failed(e.getMessage());
}
}
}
| [
"yeliang_sun@163.com"
] | yeliang_sun@163.com |
0238c1fd842176c06374dc485b2ba4e5bf9996b3 | 1f8b1dad2bea76b58f75cce12b4ca94e86087be4 | /app/src/main/java/com/hussam/matricball/public_profile/social_icons.java | 4e150e1aea6c1e449bf74c5d4f42da2e7c17dd7d | [] | no_license | hussamalkurd/Ad-Forest | 1c63b039b9642ce7b2c6bc6e49aaa203fc447f2a | 5859f9109777dd511b80429ed16147f8a8db28eb | refs/heads/master | 2023-08-03T01:03:27.064131 | 2021-09-30T16:07:58 | 2021-09-30T16:07:58 | 412,134,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,192 | java | package com.hussam.matricball.public_profile;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.hussam.matricball.R;
/**
* Created by apple on 12/29/17.
*/
public class social_icons {
public static void adforest_setViewsForCustom(JSONObject jsonObjec, LinearLayout linearLayout, final Context context) {
try {
Log.d("info Custom data ===== ", jsonObjec.getJSONArray("social_icons").toString());
JSONArray customOptnList = jsonObjec.getJSONArray("social_icons");
for (int noOfCustomOpt = 0; noOfCustomOpt < customOptnList.length(); noOfCustomOpt++) {
LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(40, 40);
params1.setMarginStart(20);
final JSONObject eachData = customOptnList.getJSONObject(noOfCustomOpt);
if (!eachData.getString("value").equals("")) {
linearLayout.setVisibility(View.VISIBLE);
ImageView et = new ImageView(context);
et.setLayoutParams(params1);
if (eachData.getString("key").equals("Facebook")) {
adforest_loadSocialIcons(R.drawable.ic_facebook, et, context);
}
if (eachData.getString("key").equals("Twitter")) {
adforest_loadSocialIcons(R.drawable.ic_twitter, et, context);
}
if (eachData.getString("key").equals("Linkedin")) {
adforest_loadSocialIcons(R.drawable.ic_linkedin, et, context);
}
if (eachData.getString("key").equals("Google+")) {
adforest_loadSocialIcons(R.drawable.ic_google_plus, et, context);
}
et.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
try {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(eachData.getString("value")));
context.startActivity(i);
} catch (JSONException e) {
e.printStackTrace();
}
}
return true;
}
});
linearLayout.addView(et);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
private static void adforest_loadSocialIcons(int icon, ImageView imageView, Context context) {
imageView.setBackgroundResource(icon);
}
}
| [
"hussam-kurd@hotmail.com"
] | hussam-kurd@hotmail.com |
dee9dd1f911e3368d54d473ba94069cb4effed7e | 9ae525199d0585d630a0f4f18281339da8d0eee7 | /4week03/src/ListStack.java | 387459a34ca6ae2e6f6d36a83bdfb1e3dbc46824 | [] | no_license | ckacldla12/DataStructure | 922c83e25a96a51695a5cecff5e2ac8c42c460a6 | f3706fad0afa122709fc8a0a5541ebcfa61b6a43 | refs/heads/main | 2023-05-08T01:44:41.401791 | 2021-05-26T16:35:10 | 2021-05-26T16:35:10 | 344,014,745 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 849 | java | import java.util.EmptyStackException;
public class ListStack<E> {
private stackNode<E> top;
private int size;
public ListStack() {
top = null;
size = 0;
}
public int size() {return size;}
public boolean isEmpty() {return size == 0;}
public void push(E newItem) {
stackNode newNode = new stackNode(newItem, top);
top = newNode;
size++;
}
public E peek() {
if(isEmpty()) throw new EmptyStackException();
return top.getItem();
}
public E pop() {
if(isEmpty()) throw new EmptyStackException();
E topItem = top.getItem();
top = top.getNext();
size--;
return topItem;
}
public void print() {
if(isEmpty()) System.out.print("스택이 비어있음");
else
for(stackNode p = top; p != null; p = p.getNext())
System.out.println(p.getItem()+"\t");
System.out.println();
}
}
| [
"noreply@github.com"
] | ckacldla12.noreply@github.com |
22efcacf5168a19cdf9604b9c215da5146a3728d | 6cd8f7aad5f9edf75fd457050f31c403b964a9cc | /micro-service/authorization-service/src/main/java/com/midea/meicloud/auth/MidAuthorizationServiceApp.java | 1974c31674c8bcc284eb6423af22ab42d961ac84 | [] | no_license | DeepLn/j2ee-business | 2fa8eb589d3d6334ec4edc5002675b8986037478 | f661fdf405c1acc3178aeac34f035244153f9738 | refs/heads/master | 2021-07-11T07:47:46.172026 | 2017-10-11T01:55:28 | 2017-10-11T01:55:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 965 | java | package com.midea.meicloud.auth;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
@EnableDiscoveryClient
@EnableRedisHttpSession
@EnableCircuitBreaker
public class MidAuthorizationServiceApp extends AppBaseSwagger {
public static void main(String[] args) {
SpringApplication.run(MidAuthorizationServiceApp.class, args);
}
@Bean
@LoadBalanced
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
| [
"jiapan.chen@meicloud.com"
] | jiapan.chen@meicloud.com |
adce5eb3eafb2c81b46b9a3185e533e352f8da5d | ed6f068752021c856dbb8599744b9a04f21a7a33 | /Assignment02-MazeSolver/src/cs2114/mazesolver/Maze.java | f7d2bca2dc80c81cd2c9e677575c052de6627471 | [] | no_license | 7e11/CSE017 | 7202f81a6316ccb4152757f24aa60fc428ffb19c | 6c1e7133da65ba3a2b42aebf2fd21ae0a61517dd | refs/heads/master | 2021-09-11T23:19:31.967894 | 2018-04-12T22:16:21 | 2018-04-12T22:16:21 | 125,919,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,952 | java | /**
*
*/
package cs2114.mazesolver;
import java.util.Stack;
/**
* @author Evan Hruskar
* @version 2018.04.05
*
*/
public class Maze implements IMaze {
//I was going to use an arraylist but an array should be fine.
private MazeCell[][] board;
private int size;
private Location startLocation;
private Location goalLocation;
/**
* @param size one dimension size of the array
*
*/
public Maze(int size) {
this.size = size;
startLocation = new Location(0, 0);
goalLocation = new Location(size - 1, size - 1);
board = new MazeCell[size][size];
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
board[i][j] = MazeCell.UNEXPLORED;
}
}
}
/**
* Gets the size of the board. Since boards are square
* is the number of cells in either dimension (width or height).
*
* @return the size of the board
*/
public int size() {
return size;
}
// ----------------------------------------------------------
/**
* Gets the starting location of the board.
*
* @return the starting location in the board
*/
public ILocation getStartLocation() {
return startLocation;
}
// ----------------------------------------------------------
/**
* <p>
* Sets the starting location in the board.
* </p><p>
* This method must check to see if there is a wall at the desired new
* location for the starting point. If there is, you must destroy the wall.
* </p>
*
* @param location the new starting location in the board
*/
public void setStartLocation(ILocation location) {
if (getCell(location) == MazeCell.INVALID_CELL) {
return;
}
if (getCell(location) == MazeCell.WALL) {
setCell(location, MazeCell.UNEXPLORED);
//destroying the wall
}
startLocation = (Location) location;
}
// ----------------------------------------------------------
/**
* Gets the location of the goal in the board.
*
* @return the location of the goal in the board
*/
public ILocation getGoalLocation() {
return goalLocation;
}
// ----------------------------------------------------------
/**
* <p>
* Sets the location of the goal in the board.
* </p><p>
* This method must check to see if there is a wall at the desired new
* location for the goal. If there is, you must destroy the wall.
* </p>
*
* @param location the new location of the goal in the board
*/
public void setGoalLocation(ILocation location) {
if (getCell(location) == MazeCell.INVALID_CELL) {
return;
}
if (getCell(location) == MazeCell.WALL) {
setCell(location, MazeCell.UNEXPLORED);
//destroying the wall
//again, cannot use locCell, it's a copy not a ref.
}
goalLocation = (Location) location;
}
// ----------------------------------------------------------
/**
* Gets the type of cell at the specified location in the board. If the
* location is outside the bounds of the board, then you must return
* {@link MazeCell#INVALID_CELL}. Under no circumstances should this method
* ever throw an exception.
*
* @param location the location to check
* @return a value from the {@link MazeCell} enumerated type that indicates
* the type of cell at that location
*/
public MazeCell getCell(ILocation location) {
if (location.x() < 0 || location.x() >= size ||
location.y() < 0 || location.y() >= size) {
return MazeCell.INVALID_CELL;
}
//think column then row, so x then y
return board[location.x()][location.y()];
}
// ----------------------------------------------------------
/**
* <p>
* Sets a location in the board to be the specified cell type.
* </p><p>
* There is one special condition that this method must check for: if the
* cell type is {@link MazeCell#WALL} and the location is either the
* starting location or the goal location, then this method must
* <strong>ignore the request and change nothing.</strong>
* </p><p>
* Under no circumstances should this method throw an exception,
* {@code IndexOutOfBounds} or otherwise. If the location given is outside
* the bounds of the board, then do nothing.
* </p>
*
* @param location the location where the wall should be placed
* @param cell the cell in question
*/
public void setCell(ILocation location, MazeCell cell) {
MazeCell locCell = getCell(location);
if (locCell == MazeCell.INVALID_CELL) {
return;
}
if (cell == MazeCell.WALL &&
(startLocation.equals(location) ||
goalLocation.equals(location))) {
//fixed an operator precedence issue
return;
}
board[location.x()][location.y()] = cell;
//fixed. remeber, locCell is a copy of the value
}
// ----------------------------------------------------------
/**
* <p>
* Tries to find a solution to the board. If a solution is found, it should
* be returned as a string that contains the coordinates of each cell in a
* path that starts at the board's starting point and leads to the goal,
* formatted like this (spacing doesn't matter):
* </p>
* <pre>(0, 0) (0, 1) (1, 1) (2, 1) (2, 2)</pre>
* <p>
* If the board has no solution, this method should return null.
* </p><p>
* (If the board has more than one possible solution, you may return any of
* them.)
* </p>
*
* @return a string representing a solution path if one exists, or null if
* there is no solution
*/
public String solve() {
//A* is too hard. I don't understand the theory yet...
//We'll just do the recommended algorithm
Stack<Location> stack = new Stack<Location>();
stack.push(startLocation);
while (!stack.isEmpty()) {
//System.out.println(stack.toString());
Location loc = stack.peek();
setCell(loc, MazeCell.CURRENT_PATH);
if (loc.equals(goalLocation)) {
String solution = "";
//stack.size is a dynamic field...
//set to a constant
int finalSize = stack.size();
for (int i = 0; i < finalSize; i++) {
//System.out.println(solution);
//System.out.println(stack.toString());
solution = stack.pop().toString() + solution;
//seems obvious but this took me 10 minutes to think of
}
return solution;
}
else if (getCell(loc.south()) == MazeCell.UNEXPLORED) {
stack.push((Location)loc.south());
}
else if (getCell(loc.east()) == MazeCell.UNEXPLORED) {
stack.push((Location)loc.east());
}
else if (getCell(loc.north()) == MazeCell.UNEXPLORED) {
stack.push((Location)loc.north());
}
else if (getCell(loc.west()) == MazeCell.UNEXPLORED) {
stack.push((Location)loc.west());
}
else {
setCell(loc, MazeCell.FAILED_PATH);
stack.pop();
}
}
return null;
}
}
| [
"hruskar.evan@gmail.com"
] | hruskar.evan@gmail.com |
c1c4aef9b672fd02594981309c1e052b657b849e | c3eaac04f8c9ed71f0b78f72addbc24227c9c38a | /addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/lessons_38/tests/GroupModificationTests.java | 05168a4677f885833490ca2a7a8efa0ebe0a51dc | [
"Apache-2.0"
] | permissive | freeitgroupe/qa_crm | cf4695ae9f59ba472ab484c4be4a68d9f883c0bf | 8c83f8cea3cf0f3bbc2970019838bf4f66ac97a4 | refs/heads/main | 2023-04-19T22:40:51.911379 | 2021-04-27T20:45:31 | 2021-04-27T20:45:31 | 311,136,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,125 | java | package ru.stqa.pft.addressbook.lessons_38.tests;
import org.testng.annotations.Test;
import ru.stqa.pft.addressbook.lessons_38.model.GroupData;
public class GroupModificationTests extends TestBase {
@Test
public void testGroupModification() throws Exception{
app.getNavigationHelper().gotoGroupPage();//переход на страницу группы
//Проверка на наличие группы
if(!app.getGroupHelper().isThereAGroup()){
app.getGroupHelper().createGroup(new GroupData("test4", null, "test4"));
}
app.getGroupHelper().selectGroup();//Выбор группы
app.getGroupHelper().initGroupModification();//переход на страницу редактирования группы
app.getGroupHelper().fillGroupForm(new GroupData("testModifName", "testModifHeader", "testModifTester"));//указываем еобходимые поля группы
app.getGroupHelper().submitGroupModification();//отправка сохранений
app.getGroupHelper().returnToGroupPage();// возвращаемся на страницу группы
}
}
| [
"freeitgroupe@gmail.com"
] | freeitgroupe@gmail.com |
fe3b2f89203a3fc0fe35d1fc9376087e569ef941 | 0fe59b1dfb5cf2454cef805da2804b2d3e52f742 | /bee-platform-system/platform-sidatadriver-api/src/main/java/com/bee/platform/datadriver/dto/RepoReceiptDetailDTO.java | 40b15bfa934e2ea0a10bb7d66cb7cab97fa9c06f | [] | no_license | wensheng930729/platform | f75026113a841e8541017c364d30b80e94d6ad5c | 49c57f1f59b1e2e2bcc2529fdf6cb515d38ab55c | refs/heads/master | 2020-12-11T13:58:59.772611 | 2019-12-16T06:02:40 | 2019-12-16T06:02:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,484 | java | package com.bee.platform.datadriver.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Classname RepoReceiptDetailDto
* @Description 货单明细返回信息
* @Date 2019/5/29 16:49
* @Author xin.huang
*/
@Getter
@Setter
@ToString
@Accessors(chain = true)
@ApiModel(value = "货单明细返回信息")
public class RepoReceiptDetailDTO implements Serializable {
private static final long serialVersionUID = 7431811736446596609L;
@ApiModelProperty("待发货")
private Integer id;
@ApiModelProperty("关联的仓库单据id")
private Integer receiptId;
@ApiModelProperty("产品id")
private Integer productId;
@ApiModelProperty("产品名称")
private String productName;
@ApiModelProperty("提单号")
private String voucherNo;
@ApiModelProperty("湿重")
private BigDecimal wetWeight;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("仓库id")
private Integer repositoryId;
@ApiModelProperty("化验单id")
private Integer testId;
@ApiModelProperty("化验单号")
private String testCode;
@ApiModelProperty("料批id")
private Integer batchId;
@ApiModelProperty("水分率")
private String waterRate;
@ApiModelProperty("数量")
private BigDecimal num;
@ApiModelProperty("采购批次号")
private String purchaseBatch;
@ApiModelProperty("车牌号")
private String plateNo;
@ApiModelProperty("毛重")
private BigDecimal roughWeight;
@ApiModelProperty("皮重")
private BigDecimal weight;
@ApiModelProperty("品位")
private BigDecimal grade;
@ApiModelProperty("仓库名称")
private String repositoryName;
@ApiModelProperty("创建人")
private Integer createUser;
@ApiModelProperty("记录日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date recordTime;
@ApiModelProperty("是否删除:1是 0否")
private Integer deleted;
@ApiModelProperty("产品批次名称")
private String batchName;
@ApiModelProperty("产品批次id")
private Integer productBatchId;
@ApiModelProperty("合同重量")
private BigDecimal orderNum;
}
| [
"414608036@qq.com"
] | 414608036@qq.com |
859b33d90cd980195f513a72260443603bb0aec4 | 9750d8bd08dfebcee1b0954da673838851b5b841 | /admin/src/main/java/com/xinlian/ServletInitializer.java | 3401d451f57be98e9ca923abe48dcfcca143622c | [] | no_license | wangxiang22/wallet | 7f030eba292c12b6f5561b949b95d298aa7a7114 | 1a3909d115d8713c067659fee8b7e098fa07673e | refs/heads/main | 2023-02-11T04:55:32.623925 | 2021-01-12T06:40:36 | 2021-01-12T06:40:36 | 328,890,500 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 553 | java | package com.xinlian;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(AdminApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(ServletInitializer.class, args);
}
}
| [
"2356807033@qq.com"
] | 2356807033@qq.com |
0f1955b41595ee66294ec1ca85097dc7258db213 | 17c473dbacf690a3549cfdf0faf955dd4c7cd58b | /day23/src/cn/itcast/web/functions/MyFunction.java | 0ca61e946bbbed3b1d9bbdc44aaa0abe91962b95 | [] | no_license | lichao0817/Online-BookStore | 0ccaa326adf219a0c0fefaf9de099ecd919153ff | acdfc43b1d9590d08e44b8c863279278c7ccb056 | refs/heads/master | 2020-12-30T09:38:12.158386 | 2014-10-10T12:16:37 | 2014-10-10T12:16:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 412 | java | package cn.itcast.web.functions;
import cn.itcast.domain.Category;
import cn.itcast.service.BusinessService;
import cn.itcast.service.impl.BusinessServiceImpl;
public class MyFunction {
public static String getCategoryName(String categoryId){
BusinessService s = new BusinessServiceImpl();
Category c = s.findCatetoryById(categoryId);
if(c!=null)
return c.getName();
return "";
}
}
| [
"cli94@wisc.edu"
] | cli94@wisc.edu |
a446253928d51afec75c046cc6224d090f5895b3 | 6ff259c741e9ff0a27511692f41f571b15edcadc | /batik/src/main/java/org/w3c/css/sac/DescendantSelector.java | a535a2038b9c5fd40d7996d3483e07a12dcc628c | [
"Apache-2.0"
] | permissive | zhangdan660/jgdraw | 20da489f4f962d4bd5ce98e8574ed89ff106faa5 | 7762908477af1c4bb56f73a6789342bbea810a6a | refs/heads/master | 2021-01-09T21:55:51.552952 | 2016-03-09T02:01:27 | 2016-03-09T02:02:12 | 53,459,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 753 | java | /*
* (c) COPYRIGHT 1999 World Wide Web Consortium
* (Massachusetts Institute of Technology, Institut National de Recherche
* en Informatique et en Automatique, Keio University).
* All Rights Reserved. http://www.w3.org/Consortium/Legal/
*
* $Id: DescendantSelector.java,v 1.1 2005/11/21 09:51:23 dev Exp $
*/
package org.w3c.css.sac;
/**
* @version $Revision: 1.1 $
* @author Philippe Le Hegaret
* @see Selector#SAC_DESCENDANT_SELECTOR
* @see Selector#SAC_CHILD_SELECTOR
*/
public interface DescendantSelector extends Selector {
/**
* Returns the parent selector.
*/
public Selector getAncestorSelector();
/*
* Returns the simple selector.
*/
public SimpleSelector getSimpleSelector();
}
| [
"zhangdan_660@163.com"
] | zhangdan_660@163.com |
729267e8fb0ae40e396993d0e18ec9f40588468a | 3fa902b6efff0ef0bf534b7e7fcbbc534d802d7a | /src/main/java/mascotapp_desktop/models/Mascota.java | 95eb930ea6a22346c9710610799047461bba8cf4 | [] | no_license | AlejandroRC10/Mascotapp_desktop | f6cf9930871010b2256c8811a863166ef832421b | c3b146fade0b3e57f6622131236051016dea2a50 | refs/heads/master | 2023-05-27T03:14:20.744487 | 2021-06-03T21:08:19 | 2021-06-03T21:08:19 | 368,962,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,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 mascotapp_desktop.models;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Calendar;
/**
*
* @author alex_
*/
@JsonIgnoreProperties
public class Mascota {
private Long id;
@JsonProperty("nombre")
private String nombre;
@JsonProperty("raza")
private String raza;
@JsonProperty("num_chip")
private String num_chip;
@JsonProperty("especie")
private String especie;
@JsonProperty("fecha_nac")
private Calendar fecha_nac;
@JsonProperty("peso")
private double peso;
@JsonProperty("sexo")
private String sexo;
//@JsonProperty("propietario")
private Propietario propietario;
public Mascota() {
}
public Mascota(String nombre, String raza, String num_chip, String animal, Calendar fecha_nac, double peso, String sexo, Propietario propietario) {
this.nombre = nombre;
this.raza = raza;
this.num_chip = num_chip;
this.especie = animal;
this.fecha_nac = fecha_nac;
this.peso = peso;
this.sexo = sexo;
this.propietario = propietario;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getRaza() {
return raza;
}
public void setRaza(String raza) {
this.raza = raza;
}
public String getNum_chip() {
return num_chip;
}
public void setNum_chip(String num_chip) {
this.num_chip = num_chip;
}
public String getEspecie() {
return especie;
}
public void setEspecie(String animal) {
this.especie = animal;
}
public Calendar getFecha_nac() {
return fecha_nac;
}
public void setFecha_nac(Calendar fecha_nac) {
this.fecha_nac = fecha_nac;
}
public double getPeso() {
return peso;
}
public void setPeso(double peso) {
this.peso = peso;
}
public String getSexo() {
return sexo;
}
public void setSexo(String sexo) {
this.sexo = sexo;
}
public Propietario getPropietario() {
return propietario;
}
public void setPropietario(Propietario propietario) {
this.propietario = propietario;
}
@Override
public String toString() {
return "Mascota{" + "id=" + id + ", nombre=" + nombre + ", raza=" + raza + ", num_chip=" + num_chip + ", especie=" + especie + ", fecha_nac=" + fecha_nac + ", peso=" + peso + ", sexo=" + sexo + ", propietario=" + propietario + '}';
}
}
| [
"arodriguezc21@iesalbarregas.es"
] | arodriguezc21@iesalbarregas.es |
05df348248993f196654cc096bd532984dc55947 | df1bfa245fc1b7195649acccee9b385dd379bc91 | /langramming-server/src/main/java/dev/nickrobson/langramming/util/StreamUtil.java | ca9233d4d273ea5c49ba59c9446134a0c1354af5 | [] | no_license | langramming/langramming | 607c30994dfa3885cd1a1ed9177d49efabc52e10 | d675183f025381fa82e9bbec986ece53e7d56339 | refs/heads/master | 2022-06-01T13:52:01.590850 | 2022-01-23T08:23:39 | 2022-01-23T08:23:39 | 253,184,334 | 5 | 0 | null | 2022-03-26T16:57:26 | 2020-04-05T08:02:27 | Java | UTF-8 | Java | false | false | 614 | java | package dev.nickrobson.langramming.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class StreamUtil {
public static void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
copy(8192, inputStream, outputStream);
}
public static void copy(int bufferSize, InputStream inputStream, OutputStream outputStream)
throws IOException {
byte[] buffer = new byte[bufferSize];
int c;
while ((c = inputStream.read(buffer)) >= 0) {
outputStream.write(buffer, 0, c);
}
}
}
| [
"robson.nicholas1@gmail.com"
] | robson.nicholas1@gmail.com |
ee0a539f09f2c8a65409e51aefc6b4d5b5f67fcc | 6d0ffbee5011340945867e3ac007e5046b86110b | /SpringBootApiDemo/SpringBootApiDemo/src/main/java/vn/com/fpt/clt/enums/FlagEnum.java | 5756930f4e6fb7b13ca2ce67f9087fda30fa240e | [] | no_license | Trongphamsr/githug-springboot | 5eca4837d75787849e4f655de5ea8d8726e67097 | 48bbb922116193ccd55688e1b7c0bbca8c4db86a | refs/heads/master | 2020-05-24T16:14:44.579438 | 2019-05-18T11:53:27 | 2019-05-18T11:53:27 | 187,350,439 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | package vn.com.fpt.clt.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum FlagEnum {
OFF("0", "OFF", "false"),
ON("1", "ON", "true");
private final String value;
private final String display;
private final String name;
}
| [
"anhhop200193@gmail.com"
] | anhhop200193@gmail.com |
15329e5ef96d7f32ef334027c0054f0dc8021538 | acff7a398205b615c2a73176cd65833d0e7a76e7 | /talleres/taller09/Test.java | 5303a6f749c076765b2051ad24b76482a1e51853 | [] | no_license | lmvasquezg/Data-structures-and-algorithms-2 | 338c18cceafd955334dcbe123577473a5be68a66 | 9466cafafc738857349f2003c9d51ece0c38d030 | refs/heads/master | 2021-09-12T13:09:36.025107 | 2018-04-17T02:41:18 | 2018-04-17T02:41:18 | 119,445,875 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,237 | java |
/**
* Prueba la implementacion de los metodos en la clase Taller9.
*
* Ejecute esta clase para hacerse una idea de si su implementacion de los
* ejercicios propuestos en el Taller de Clase #9 son correctos.
*
* @author Mateo Agudelo
*/
public class Test {
public static void main(String[] args) {
System.out.println("Levenshtein -> " + convert(testLevenshtein()));
}
static boolean testLevenshtein() {
String[] wordlist = { "hash", "quantum", "fever", "bench", "long", "blade", "object", "orphanage", "flophouse",
"fathead" };
int[][] answers = { { 0, 6, 5, 4, 4, 4, 6, 7, 7, 5 }, { 6, 0, 7, 6, 6, 6, 7, 7, 8, 7 },
{ 5, 7, 0, 4, 5, 5, 5, 9, 8, 5 }, { 4, 6, 4, 0, 4, 4, 4, 8, 8, 7 }, { 4, 6, 5, 4, 0, 4, 6, 7, 7, 7 },
{ 4, 6, 5, 4, 4, 0, 5, 7, 7, 6 }, { 6, 7, 5, 4, 6, 5, 0, 8, 8, 6 }, { 7, 7, 9, 8, 7, 7, 8, 0, 7, 7 },
{ 7, 8, 8, 8, 7, 7, 8, 7, 0, 7 }, { 5, 7, 5, 7, 7, 6, 6, 7, 7, 0 } };
int n = wordlist.length;
for (int i = 0; i < n; ++i)
for (int j = 1; j < n; ++j)
if (Taller9.levenshtein(wordlist[i], wordlist[j]) != answers[i][j])
return false;
return true;
}
static String convert(boolean b) {
return b ? "correcta" : "incorrecta";
}
} | [
"noreply@github.com"
] | lmvasquezg.noreply@github.com |
7a0ace9dc38893ac7883597af2057dd6ec48f127 | 9a7ec216a1deeab63e5bf293381d06cf25419251 | /batch13022014/core/new/IDRef/src/com/ir/beans/Car.java | 8d9eb00a4073e30983cff17858f82ac62601ab30 | [] | no_license | Mallikarjun0535/Spring | 63b2fb705af3477402639557dbda1378fe20b538 | 041f538c7ae2eca113df7cb9277e438ec6221c08 | refs/heads/master | 2020-06-04T00:22:21.910592 | 2019-06-20T19:18:09 | 2019-06-20T19:18:09 | 191,792,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | package com.ir.beans;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
public class Car {
private IEngine engine;
private String engineId;
public void run() {
BeanFactory factory = new XmlBeanFactory(new ClassPathResource(
"com/ir/common/application-context.xml"));
engine = factory.getBean(engineId, IEngine.class);
engine.start();
System.out.println("running....");
}
public void setEngineId(String engineId) {
this.engineId = engineId;
}
}
| [
"mallik.mitta@outlook.com"
] | mallik.mitta@outlook.com |
691139fa59c97487fc5faa69046a48f5232be70a | 5985fab5dfcb11a561173e7e41970ae7a3ccb843 | /DnDPartes/src/main/java/com/dnd/project/gallery/point/service/CmPointService.java | c85397c4f04978df263b7661fb6631a759a649c3 | [] | no_license | kalraid/VRChatAINpc | b3a9f6c4e3e394aec03b72d7a7a4565b1b99b4d0 | 025405da10ec6313cec477ff8d2b6c9fdd65d937 | refs/heads/master | 2022-12-14T21:03:30.623757 | 2021-02-05T08:38:43 | 2021-02-05T08:38:43 | 251,243,187 | 6 | 1 | null | 2022-12-08T07:27:57 | 2020-03-30T08:19:05 | Python | UTF-8 | Java | false | false | 138 | java | package com.dnd.project.gallery.point.service;
import org.springframework.stereotype.Service;
@Service
public class CmPointService {
}
| [
"chpark@in-soft.co.kr"
] | chpark@in-soft.co.kr |
f343abb8dd38bc8a7df0efa7c0f899c2fae9fe58 | c48a4f190b481904e0a4b94099364e802da1e1b6 | /app/src/main/java/com/example/wangyang/tinnerwangyang/Http/Internet/ApiFactory.java | 92e5102c86d98ff2c9eb7bc20d088f18dbaec99b | [] | no_license | woerte197/Tinnerwangyang | 3b9c9fd2401dd1ae4a53ba314113aa4f7539d7c1 | ca14a95c8798f980a01594d5a9388145d1caf663 | refs/heads/master | 2018-10-04T16:38:37.888151 | 2018-06-28T01:18:42 | 2018-06-28T01:18:42 | 119,765,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,289 | java | package com.example.wangyang.tinnerwangyang.Http.Internet;
import com.example.wangyang.tinnerwangyang.URLSetting;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by wangyang on 28/12/17.
*/
public class ApiFactory {
private static final String TAG="ApiFactory";
private static HashMap<Class,ApiService> serviceMap =new HashMap<>();
public static ApiService ins(){
ApiService service=serviceMap.get(ApiService.class);
if (service==null){
// OkHttpClient.Builder okBuilder =new OkHttpClient.Builder();
// okBuilder.readTimeout(30, TimeUnit.SECONDS);
// okBuilder.writeTimeout(30,TimeUnit.SECONDS);
// okBuilder.connectTimeout(30,TimeUnit.SECONDS);
// okBuilder.addInterceptor(chain -> {
// boolean isConnected =NetworkUtil.verifyNetwork();
// if (isConnected){
// Response proceed = chain.proceed(chain.request());
// return proceed;
// }else {
// throw new RuntimeException("请连接网络");
// }
// });
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.addInterceptor(interceptor)
.retryOnConnectionFailure(true)
.connectTimeout(15, TimeUnit.SECONDS)
.addNetworkInterceptor(interceptor)
.build();
Retrofit retrofit=new Retrofit.Builder().baseUrl(URLSetting.URL_Recommend)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.build();
service=retrofit.create(ApiService.class);
serviceMap.put(ApiService.class,service);
}
return service;
}
}
| [
"wangyang@jiemo.net"
] | wangyang@jiemo.net |
dc5af273a1902e9d67cf5a3f358f8d505aa549ca | e26188a15fa27ee4db1eb47006c25e0150c158af | /src/hu/pethical/mavkep/adapters/TimeTableAdapter.java | 2a8e696ade7f60e5a37690984567e05536853109 | [] | no_license | Pethical/MAVKep | ff5086146e6d70f45c86974f1e00d8ef8ed20228 | 273a8eb81b058f4a041d9c73d77a4a01675a77b1 | refs/heads/master | 2021-01-17T19:21:18.302633 | 2016-06-10T16:44:44 | 2016-06-10T16:44:44 | 60,862,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,927 | java | package hu.pethical.mavkep.adapters;
import hu.pethical.mavkep.R;
import hu.pethical.mavkep.entities.Changes;
import hu.pethical.mavkep.entities.TimeTableDataSource;
import hu.pethical.mavkep.entities.Timetable;
import java.io.IOException;
import android.app.Activity;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
public class TimeTableAdapter extends BaseExpandableListAdapter {
private final Activity context;
private final TimeTableDataSource datasource;
public TimeTableAdapter(Activity context, String menetrend) throws JsonParseException,
JsonMappingException, IOException {
super();
this.context = context;
datasource = TimeTableDataSource.createFromString(menetrend);
}
public TimeTableAdapter(Activity context, TimeTableDataSource menetrend) {
super();
this.context = context;
datasource = menetrend;
}
@Override
public Changes getChild(int group, int child) {
Timetable Group = datasource.getTimetable().get(group);
return Group.getChanges().get(child);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return 0;
}
public View GetView(Changes item, View convertView, ViewGroup parent, boolean canhide) {
if (item.getNumber() != null && !item.getNumber().contains("h") || !canhide) {
View view = convertView;
if ((view != null) && (view.findViewById(R.id.When) == null)) {
view = null;
}
if (view == null) view = context.getLayoutInflater().inflate(R.layout.item, null);
view.findViewById(R.id.fw).setVisibility(ImageView.GONE);
if (view.findViewById(R.id.When) == null) {
view = null;
}
((TextView) view.findViewById(R.id.When)).setText(item.getWhen());
String type = "";
type = item.getType();
((TextView) view.findViewById(R.id.Info)).setText(type);
((TextView) view.findViewById(R.id.From)).setText(item.getFrom());
((TextView) view.findViewById(R.id.To)).setText(item.getTo());
((TextView) view.findViewById(R.id.Platform)).setText(item.getPlatform());
if (item.getChange() > 0) {
view.findViewById(R.id.csik).setBackgroundColor(Color.parseColor("#0099CC"));
}
else {
view.findViewById(R.id.csik).setBackgroundColor(Color.TRANSPARENT);
}
int delay = item.getDelay();
view.findViewById(R.id.kesescsik).setVisibility(RelativeLayout.VISIBLE);
String keses = item.getWhen_real();
((TextView) view.findViewById(R.id.RealTime)).setText(keses);
view.findViewById(R.id.imageView1).setVisibility(ImageView.VISIBLE);
if (delay < 1) {
((TextView) view.findViewById(R.id.Keses)).setText(R.string.nincs_keses);
}
else {
((TextView) view.findViewById(R.id.Keses)).setText(String.format(
context.getString(R.string.keses_d_perc), delay));
}
if (delay > 10) {
((ImageView) view.findViewById(R.id.imageView1)).setImageResource(R.drawable.snail);
}
else if (delay >= 5) {
((ImageView) view.findViewById(R.id.imageView1)).setImageResource(R.drawable.dot2);
}
else {
((ImageView) view.findViewById(R.id.imageView1)).setImageResource(R.drawable.dot);
}
return view;
}
else {
View view = context.getLayoutInflater().inflate(R.layout.local, null);
((TextView) view.findViewById(R.id.helyi1)).setText(item.getFrom() + " - "
+ item.getTo());
return view;
}
}
@Override
public View getChildView(int group, int child, boolean isLast, View convertView,
ViewGroup parent) {
Changes g = getGroup(group);
if (g.getChange() == 0) {
// return null;
}
Changes c = getChild(group, child);
View view = GetView(c, convertView, parent, true);
if (c.getNumber().contains("h")) return view;
view.setPadding(2, 0, 0, 0);
view.findViewById(R.id.fw).setVisibility(ImageView.VISIBLE);
return view;
}
@Override
public int getChildrenCount(int groupPosition) {
int c = getGroup(groupPosition).getChange();
if (c == 0) return c;
return getGroup(groupPosition).getChanges().size();
}
@Override
public Timetable getGroup(int groupPosition) {
return datasource.getTimetable().get(groupPosition);
}
@Override
public int getGroupCount() {
return datasource.getTimetable().size();
}
@Override
public long getGroupId(int groupPosition) {
return 0; // Long.parseLong(getGroup(groupPosition).getNumber());
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
ViewGroup viewGroup) {
return GetView(getGroup(groupPosition), convertView, viewGroup, false);
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int group, int child) {
return true;
}
}
| [
"sokkis@gmail.com"
] | sokkis@gmail.com |
eb290e71b6ae27dfeb1318aaeacbd0627229a0ff | 385e2313dc9f8a4c83b99be4ae197d9032a7d863 | /TYSS/src/test/java/shoppingCart/TS_08Test.java | aafae2bf3ef1da25726bbf87d55cda4b49e90b11 | [] | no_license | harshith195/DemoWebShop | 080c336f421af97c7a24a55b0c2ad6fcbe67f80c | 9efd6cfbac669f7e6b57e6ad8183b7061cdb7e10 | refs/heads/master | 2023-08-25T06:53:01.916868 | 2021-09-13T11:29:34 | 2021-09-13T11:29:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,344 | java | package shoppingCart;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import genericLibrary.BaseTest;
import pom.HomePage;
import pom.ShoppingCartPage;
public class TS_08Test extends BaseTest {
@Test
public void removing_Multiple_Product_To_Cart_and_Validating() throws InterruptedException, AWTException {
HomePage homepage=new HomePage(driver);
ShoppingCartPage Shoppingcartpage=new ShoppingCartPage(driver);
homepage.getBookLink().click();
homepage.getComputingAndInternetaddToCartButton().click();
Thread.sleep(2000);
homepage.getFictionAddToCart().click();
Thread.sleep(2000);
homepage.getHealthbookaddToCartButton().click();
Thread.sleep(2000);
JavascriptExecutor js=(JavascriptExecutor) driver;
js.executeScript("window.scrollTo(1000,30)");
Thread.sleep(2000);
homepage.getShoppingCartLink().click();
for(int i=0;i<3;i++) {
Shoppingcartpage.getRemoveFromCartCheckBox().click();
Thread.sleep(2000);
Robot robot=new Robot();
Thread.sleep(2000);
robot.keyPress(KeyEvent.VK_ENTER);
}
}
}
| [
"Mamatha@LAPTOP-I51FBD39"
] | Mamatha@LAPTOP-I51FBD39 |
e94094dace316712a17e62b81e763f675fc7b6fa | 2e79fe5679b1e805a3c779a934c163e1a26dce7a | /addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/model/GroupData.java | b8f2daceb163abafe6aea339db848838d51120e3 | [
"Apache-2.0"
] | permissive | IvanQL/java_pft | e10edaa23892bae1e4390a10be2d608332173a1d | 2b76fcd8c53fa964a87e2c40c9a466207e724b4d | refs/heads/master | 2021-01-11T19:26:22.262156 | 2017-11-20T08:21:03 | 2017-11-20T08:21:03 | 79,366,078 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,498 | java | package ru.stqa.pft.addressbook.model;
import com.google.gson.annotations.Expose;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@XStreamAlias("group")
@Entity
@Table (name = "group_list")
public class GroupData {
@XStreamOmitField
@Id
@Column (name = "group_id")
private int id = Integer.MAX_VALUE;
@Expose
@Column (name = "group_name")
private String name;
@Expose
@Column (name = "group_header")
@Type ( type = "text")
private String header;
@Expose
@Column (name = "group_footer")
@Type ( type = "text")
private String footer;
public Contacts getContacts() {
return new Contacts ( contacts );
}
@ManyToMany (mappedBy = "groups")
private Set<ContactData> contacts = new HashSet<ContactData> ( );
public GroupData withId(int id) {
this.id = id;
return this;
}
public GroupData withName(String name) {
this.name = name;
return this;
}
public GroupData withHeader(String header) {
this.header = header;
return this;
}
public GroupData withFooter(String footer) {
this.footer = footer;
return this;
}
public String getName() {
return name;
}
public String getHeader() {
return header;
}
public String getFooter() {
return footer;
}
public int getId() {
return id;
}
@Override
public String toString() {
return "GroupData{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass () != o.getClass ()) return false;
GroupData groupData = (GroupData) o;
if (id != groupData.id) return false;
if (name != null ? !name.equals ( groupData.name ) : groupData.name != null) return false;
if (header != null ? !header.equals ( groupData.header ) : groupData.header != null) return false;
return footer != null ? footer.equals ( groupData.footer ) : groupData.footer == null;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (name != null ? name.hashCode () : 0);
result = 31 * result + (header != null ? header.hashCode () : 0);
result = 31 * result + (footer != null ? footer.hashCode () : 0);
return result;
}
}
| [
"bondar@quality-lab.ru"
] | bondar@quality-lab.ru |
ee4da26c71d75b388739ffdca1f827460b4a64e9 | 0b1a4b58ea415aee576d78a2802c63fb6e3347a3 | /Navigation/app/src/main/java/com/example/navigation/TextFileManager.java | a4ed863c5b0b53819270ca769d9087c341ba66c1 | [] | no_license | JoSunJoo/MobileProgramming | dc84a9bf8cc3b691170b49018bb592424fc53061 | d0f79ce6fb7ebd143e0e2daee6668828c261e5c3 | refs/heads/master | 2020-09-11T13:27:10.317522 | 2019-12-05T16:37:17 | 2019-12-05T16:37:17 | 222,080,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.example.navigation;
import android.content.Context;
import java.io.File;
public class TextFileManager {//파일 관리를 돕는 객체 정의
private Context mContext;//context관리
public TextFileManager(Context _context){
mContext = _context;
} //생성자
public String[] showAllFiles() { //저장된 모든 파일의 파일명을 반환하는 함수
File f = mContext.getFilesDir();//해당 context내의 경로 받아오기
String[] s = f.list();//해당 폴더 내의 모든 파일의 파일명을 string[]타입으로 저장
return s;//파일명 반환
}
public void delete(String name){
mContext.deleteFile(name);
}//원하는 파일을 삭제하는 함수
}
| [
"wtw102929@gmail.com"
] | wtw102929@gmail.com |
7bd5ae484e900672b4f03d8ff86c9ccca98303db | cd875a8b1ef9040aacfbcc7f18d11ed5f087c1f6 | /src/main/java/yb/ecp/fast/user/web/ProfileController.java | ae8822ee2dff6c71b09b517399e8dae975259955 | [] | no_license | daweifly1/auth-server-bj | e52fb2894229fa3e7bec1bea668a5ee797186222 | 433558d7aa8b467d21a4e69f62169690003d7101 | refs/heads/master | 2022-07-20T05:22:10.584178 | 2019-11-13T01:17:15 | 2019-11-13T01:17:15 | 218,920,269 | 0 | 0 | null | 2022-06-29T17:44:59 | 2019-11-01T05:39:56 | Java | UTF-8 | Java | false | false | 7,247 | java | package yb.ecp.fast.user.web;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import yb.ecp.fast.infra.annotation.FastMappingInfo;
import yb.ecp.fast.infra.infra.ActionResult;
import yb.ecp.fast.infra.infra.SearchCommonVO;
import yb.ecp.fast.infra.util.Ref;
import yb.ecp.fast.infra.util.StringUtil;
import yb.ecp.fast.user.infra.BasicController;
import yb.ecp.fast.user.infra.ErrorCode;
import yb.ecp.fast.user.service.ProfileService;
import yb.ecp.fast.user.service.VO.AccountPwdVO;
import yb.ecp.fast.user.service.VO.LockVO;
import yb.ecp.fast.user.service.VO.ProfileVO;
@RestController
@RequestMapping({"/profile"})
public class ProfileController extends BasicController {
@Autowired
private ProfileService profileService;
@RequestMapping(
value = {"/userInfo"},
method = {RequestMethod.GET}
)
@FastMappingInfo(
needLogin = true
)
@ApiOperation("查询个人信息")
public ActionResult queryUserInfo(@RequestHeader("x-user-id") String userId) throws Exception {
return this.actionResult(this.profileService.queryLoginUser(userId));
}
@RequestMapping(
value = {"/addUserWithAccount"},
method = {RequestMethod.POST}
)
@ApiOperation("添加用户账号和密码(生成用户信息)")
public ActionResult addUserWithAccount(@RequestBody AccountPwdVO accountPwdVO) throws Exception {
Ref ref = new Ref("");
return this.actionResult(this.profileService.addUserWithAccount(accountPwdVO, ref), ref.get());
}
@RequestMapping(
value = {"/updateLock"},
method = {RequestMethod.POST}
)
@FastMappingInfo(
needLogin = true,
code = 1310L
)
@ApiOperation("用户禁用与启用")
public ActionResult lock(@RequestBody LockVO lockVO) {
return this.actionResult(this.profileService.updateLock(lockVO));
}
@RequestMapping(
value = {"/update"},
method = {RequestMethod.POST}
)
@FastMappingInfo(
needLogin = true
)
@ApiOperation("修改个人信息(个人中心)")
public ActionResult update(@RequestBody ProfileVO profileVO, @RequestHeader("x-user-id") String userId) throws Exception {
profileVO.setUserId(userId);
return this.actionResult(this.profileService.update(profileVO));
}
@RequestMapping(
value = {"/getLogin"},
method = {RequestMethod.GET}
)
@FastMappingInfo(
needLogin = true
)
@ApiOperation("查询登录用户信息")
public ActionResult getLoginUser(@RequestHeader("x-user-id") String userId) throws Exception {
return this.actionResult(this.profileService.queryLoginUser(userId));
}
@RequestMapping(
value = {"/listAll"},
method = {RequestMethod.POST}
)
@FastMappingInfo(
needLogin = true
)
@ApiOperation("查询系统所有用户")
public ActionResult listAll(@RequestBody SearchCommonVO condition, @RequestHeader("x-user-id") String userId) {
return this.actionResult(this.profileService.listAll(condition, userId).getPageInfo());
}
@RequestMapping(
value = {"/getUserInfo"},
method = {RequestMethod.GET}
)
@FastMappingInfo(
needLogin = true,
actionLevel = 2
)
@ApiOperation("查询Oauth2个人信息")
public ActionResult getUserInfo(@RequestHeader("x-app-id") String appId, @RequestHeader("x-user-id") String userId) throws Exception {
return this.actionResult(this.profileService.getUserInfo(appId, userId));
}
@RequestMapping(
value = {"/userDetail"},
method = {RequestMethod.GET}
)
@ApiOperation("获取用户缓存信息")
public ActionResult getUserDetail(@RequestParam("userId") String userId) {
return this.actionResult(this.profileService.getUserCache(userId));
}
@RequestMapping(
value = {"/updateUserByAccount"},
method = {RequestMethod.POST}
)
@FastMappingInfo(
actionLevel = 3
)
@ApiOperation("根据登录名修改用户信息")
public ActionResult updateUserByAccount(@RequestBody ProfileVO profileVO) throws Exception {
return this.actionResult(this.profileService.updateByAccount(profileVO));
}
@RequestMapping(
value = {"/updateUserInfo"},
method = {RequestMethod.POST}
)
@FastMappingInfo(
needLogin = true,
code = 1308L
)
@ApiOperation("修改用户信息(用户管理)")
public ActionResult updateUserInfo(@RequestBody ProfileVO profileVO) throws Exception {
return StringUtil.isNullOrEmpty(profileVO.getUserId())?this.actionResult(ErrorCode.IllegalArument):this.actionResult(this.profileService.update(profileVO));
}
@RequestMapping(
value = {"/detail"},
method = {RequestMethod.GET}
)
@FastMappingInfo(
needLogin = true
)
@ApiOperation("查询用户列表详细信息")
public ActionResult detail(@RequestParam("userId") String userId) throws Exception {
return this.actionResult(this.profileService.item(userId));
}
@RequestMapping(
value = {"/listByWorkspace"},
method = {RequestMethod.POST}
)
@FastMappingInfo(
needLogin = true
)
@ApiOperation("查询工作空间下用户集合")
public ActionResult listByWorkspace(@RequestBody SearchCommonVO condition) {
return this.actionResult(this.profileService.listByWorkspace(condition).getPageInfo());
}
@RequestMapping(
value = {"/list"},
method = {RequestMethod.POST}
)
@FastMappingInfo(
needLogin = true
)
@ApiOperation("查询用户列表")
public ActionResult list(@RequestBody SearchCommonVO condition, @RequestHeader("x-user-id") String userId) {
return this.actionResult(this.profileService.list(condition, userId).getPageInfo());
}
@RequestMapping(
method = {RequestMethod.POST}
)
@FastMappingInfo(
needLogin = true,
code = 1301L
)
@ApiOperation("添加用户")
public ActionResult add(@RequestBody ProfileVO profileVO, @RequestHeader("x-user-id") String userId) throws Exception {
Ref ref = new Ref("");
if(StringUtil.isNullOrSpace(profileVO.getSpaceId())) {
String a1 = this.profileService.item(userId).getSpaceId();
profileVO.setSpaceId(a1);
}
return this.actionResult(this.profileService.insert(profileVO, ref), ref.get());
}
@RequestMapping(
value = {"/remove"},
method = {RequestMethod.POST}
)
@FastMappingInfo(
needLogin = true,
code = 1306L
)
@ApiOperation("批量删除用户")
public ActionResult removeUsers(@RequestBody List userIds, @RequestHeader("x-user-id") String userId) throws Exception {
return userIds.contains(userId)?this.actionResult(ErrorCode.CannotRemoveYouself):this.actionResult(this.profileService.removeByIds(userIds));
}
}
| [
"chendawei"
] | chendawei |
02cfd6437c3ab24c6241f74ae3121f237ff1caad | 9b96882796cf39af327756100a9d2f787e87decb | /Equipment Management System/src/com/cicada/entity/Menu.java | c1afd36d7ad16c44f4b70cdaf745552f96ea7d3c | [] | no_license | oldcicada/demo04 | 8e1b8591625084cfcb2d25ad6261abc92092653f | 065cc976f906e79378090960ec736d6644e5bba1 | refs/heads/newbranch | 2021-04-15T04:03:11.100501 | 2018-04-16T13:34:02 | 2018-04-16T13:34:02 | 126,184,269 | 0 | 0 | null | 2018-04-04T07:41:31 | 2018-03-21T13:37:50 | Java | UTF-8 | Java | false | false | 3,192 | java | package com.cicada.entity;
import java.util.Date;
import java.util.List;
import com.cicada.common.BaseEntity;
public class Menu extends BaseEntity {
private String parent_menu;
private String parent_menu_ids;
private String name;
private Double sort;
private String link_address;
private String aim_window;
private String icon;
private String view;
private String code;
private String founder;
private Date creation_time;
private String updater;
private Date update_time;
private String description;
private String deleted;
private List<Menu> menus;
public List<Menu> getMenus() {
return menus;
}
public void setMenus(List<Menu> menus) {
this.menus = menus;
}
public Menu() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getSort() {
return sort;
}
public void setSort(Double sort) {
this.sort = sort;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getView() {
return view;
}
public void setView(String view) {
this.view = view;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getFounder() {
return founder;
}
public void setFounder(String founder) {
this.founder = founder;
}
public String getUpdater() {
return updater;
}
public void setUpdater(String updater) {
this.updater = updater;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getDeleted() {
return deleted;
}
public void setDeleted(String deleted) {
this.deleted = deleted;
}
public String getParent_menu() {
return parent_menu;
}
public void setParent_menu(String parent_menu) {
this.parent_menu = parent_menu;
}
public String getParent_menu_ids() {
return parent_menu_ids;
}
public void setParent_menu_ids(String parent_menu_ids) {
this.parent_menu_ids = parent_menu_ids;
}
public String getLink_address() {
return link_address;
}
public void setLink_address(String link_address) {
this.link_address = link_address;
}
public String getAim_window() {
return aim_window;
}
public void setAim_window(String aim_window) {
this.aim_window = aim_window;
}
public Date getCreation_time() {
return creation_time;
}
public void setCreation_time(Date creation_time) {
this.creation_time = creation_time;
}
public Date getUpdate_time() {
return update_time;
}
public void setUpdate_time(Date update_time) {
this.update_time = update_time;
}
@Override
public String toString() {
return "Menu [parent_menu=" + parent_menu + ", parent_menu_ids=" + parent_menu_ids + ", name=" + name
+ ", sort=" + sort + ", link_address=" + link_address + ", aim_window=" + aim_window + ", icon=" + icon
+ ", view=" + view + ", code=" + code + ", founder=" + founder + ", creation_time=" + creation_time
+ ", updater=" + updater + ", update_time=" + update_time + ", description=" + description
+ ", deleted=" + deleted + ", menus=" + menus + "]";
}
}
| [
"1915741019@qq.com"
] | 1915741019@qq.com |
9f67f0b57b1e949da977b9cd3f26eb1d74eafefb | ca97a7318b16c29dfbe81ab621afd1718fa48ad1 | /netty-rpc-demo/rpc-liyue/rpc-netty/src/main/java/cn/v5cn/liyue/rpc/netty/server/RpcRequestHandler.java | aef108665236259262e3f1d7b25014c38155a38d | [] | no_license | zyw/springcloud-common | 61994a9a91d0403098f4118ceaedf093afdc06e2 | 3c5dbe33844c1009e7ed625a93199effd21f1f20 | refs/heads/master | 2022-05-20T21:41:50.984381 | 2022-05-19T01:16:18 | 2022-05-19T01:16:18 | 200,951,573 | 1 | 2 | null | 2020-07-02T00:09:19 | 2019-08-07T01:47:37 | Java | UTF-8 | Java | false | false | 3,375 | java | package cn.v5cn.liyue.rpc.netty.server;
import cn.v5cn.liyue.rpc.api.spi.Singleton;
import cn.v5cn.liyue.rpc.netty.client.ServiceTypes;
import cn.v5cn.liyue.rpc.netty.client.stubs.RpcRequest;
import cn.v5cn.liyue.rpc.netty.serialize.SerializeSupport;
import cn.v5cn.liyue.rpc.netty.transport.RequestHandler;
import cn.v5cn.liyue.rpc.netty.transport.command.Code;
import cn.v5cn.liyue.rpc.netty.transport.command.Command;
import cn.v5cn.liyue.rpc.netty.transport.command.Header;
import cn.v5cn.liyue.rpc.netty.transport.command.ResponseHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
/**
* 注册服务提供者和处理服务请求
* @author LiYue
* Date: 2019/9/23
*/
@Singleton
public class RpcRequestHandler implements RequestHandler, ServiceProviderRegistry {
private static final Logger logger = LoggerFactory.getLogger(RpcRequestHandler.class);
// 服务名称和服务提供者这映射Map
private Map<String/*service name*/, Object/*service provider*/> serviceProviders = new HashMap<>();
@Override
public <T> void addServiceProvider(Class<? extends T> serviceClass, T serviceProvider) {
serviceProviders.put(serviceClass.getCanonicalName(), serviceProvider);
logger.info("Add service: {}, provider: {}.",
serviceClass.getCanonicalName(),
serviceProvider.getClass().getCanonicalName());
}
@Override
public Command handle(Command request) {
Header header = request.getHeader();
// 从payload中反序列化RpcRequest
RpcRequest rpcRequest = SerializeSupport.parse(request.getPayload());
try {
logger.info("service provider: {}",rpcRequest.getInterfaceName());
// 查找所有已注册的服务提供方,寻找rpcRequest中需要的服务
Object serviceProvider = serviceProviders.get(rpcRequest.getInterfaceName());
if(serviceProvider != null) {
// 找到服务提供者,利用Java反射机制调用服务的对应方法
String arg = SerializeSupport.parse(rpcRequest.getSerializedArguments());
Method method = serviceProvider.getClass().getMethod(rpcRequest.getMethodName(), String.class);
String result = (String) method.invoke(serviceProvider, arg);
// 把结果封装成响应命令并返回
return new Command(new ResponseHeader(type(),header.getVersion(),header.getRequestId()),SerializeSupport.serialize(result));
}
// 如果没找到,返回NO_PROVIDER错误响应。
logger.warn("No service Provider of {}#{}(String)!", rpcRequest.getInterfaceName(), rpcRequest.getMethodName());
return new Command(new ResponseHeader(type(), header.getVersion(), header.getRequestId(), Code.NO_PROVIDER.getCode(), "No provider!"), new byte[0]);
} catch (Throwable e) {
// 发生异常,返回UNKNOWN_ERROR错误响应。
logger.warn("Exception: ", e);
return new Command(new ResponseHeader(type(), header.getVersion(), header.getRequestId(), Code.UNKNOWN_ERROR.getCode(), e.getMessage()), new byte[0]);
}
}
@Override
public int type() {
return ServiceTypes.TYPE_RPC_REQUEST;
}
}
| [
"zyw090111@163.com"
] | zyw090111@163.com |
a92a410455363fadce06dc068b0ea5933b5e2b70 | 908e5b6c39979483a4a1d3675b456146a28db2b4 | /gpsLocation/android/app/src/main/java/com/gpslocation/MainApplication.java | 7cf8b8f6bcc42effe456a83ddf069de33861cff6 | [] | no_license | Harvinder5/reactnative | 58102ddb255255e6ad34886237bd2c3f8f678beb | 853ecb341a834e4af588f63517fa094b282c5f1a | refs/heads/master | 2022-11-26T19:10:29.969709 | 2020-07-27T11:13:30 | 2020-07-27T11:13:30 | 282,873,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,078 | java | package com.gpslocation;
import android.app.Application;
import com.gpslocation.CustomToastPackage;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.gpslocation.generated.BasePackageList;
import com.swmansion.reanimated.ReanimatedPackage;
import com.swmansion.rnscreens.RNScreensPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import org.unimodules.adapters.react.ReactAdapterPackage;
import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.Package;
import org.unimodules.core.interfaces.SingletonModule;
import expo.modules.constants.ConstantsPackage;
import expo.modules.permissions.PermissionsPackage;
import expo.modules.filesystem.FileSystemPackage;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
new BasePackageList().getPackageList(), Arrays.<SingletonModule>asList());
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(new MainReactPackage(), new ReanimatedPackage(), new RNGestureHandlerPackage(),
new RNScreensPackage(), new ModuleRegistryAdapter(mModuleRegistryProvider), new CustomToastPackage());
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"harvinder.singh@crownstack.com"
] | harvinder.singh@crownstack.com |
bfc9d76ce071d65937fc6d0aa26002a99e31e4f6 | 6992cef1d8dec175490d554f3a1d8cb86cd44830 | /Java/JEE/WebServiceComplexSchema/src/java/com/soacookbook/ch03/validate/CreditService.java | 0c185507dbc83db2201ba376b6aa8fa46df4ca73 | [] | no_license | hamaenpaa/own_code_examples | efd49b62bfc96d1dec15914a529661d3ebbe448d | 202eea76a37f305dcbc5a792c9b613fc43ca8477 | refs/heads/master | 2021-01-17T14:51:03.861478 | 2019-05-06T09:28:23 | 2019-05-06T09:28:23 | 44,305,640 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,627 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.soacookbook.ch03.validate;
import com.soacookbook.ns.credit.*;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.datatype.XMLGregorianCalendar;
/**
*
* @author hamaenpaa
*/
/**
* Demonstrates a service that uses JAXB-generated types as
* parameters for a start-from-schema-and-java method.
* Uses Credit.wsdl and Credit.xsd.
*/
@WebService(
name="CreditAuthorizer",
serviceName="CreditService",
targetNamespace="http://ns.soacookbook.com/credit",
wsdlLocation="WEB-INF/wsdl/ch03/Credit.wsdl")
public class CreditService {
/** Creates an instance of CreditService.
*/
public CreditService() {
}
//business method
@WebMethod(operationName="authorize")
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT,
use=SOAPBinding.Use.LITERAL,
parameterStyle=SOAPBinding.ParameterStyle.BARE)
public @WebResult(name="authorization",
targetNamespace="http://ns.soacookbook.com/credit")
Authorization
authorize(
@WebParam(name="creditCard",
mode=WebParam.Mode.IN,
targetNamespace="http://ns.soacookbook.com/credit")
CreditCard creditCard) {
System.out.println("Authorizing.");
System.out.println("Card Number: " + creditCard.getCardNumber());
//get data from compound type
String cardNumber = creditCard.getCardNumber();
Name name = creditCard.getName();
System.out.println("First name " + name.getFirstName());
System.out.println("Middle name " + name.getMiddleInitial());
System.out.println("Last name " + name.getLastName());
XMLGregorianCalendar expDate = creditCard.getExpirationDate();
System.out.println(expDate.toString());
//create custom type for return
Authorization auth = new Authorization();
//business logic here
if (cardNumber.startsWith("4")) {
auth.setAmount(2500.0);
} else {
auth.setAmount(0.0);
}
System.out.println("Returning auth for amt: " + auth.getAmount());
return auth;
}
}
| [
"harri.maenpaa@gmail.com"
] | harri.maenpaa@gmail.com |
57d081749ad3110e4ec043d394b6cd99ea8044ae | 5220ec44bd018f12c32da698cacf8a4ee5108ecf | /Compiler1/lab/Lab4/21/AST.java | 0d408ff9474e4c0c6c99bb9f23f96efaa252ccba | [] | no_license | ace0625/school-work | bf994f96a0821aaf6aa73194189a98c8feb96b07 | bf41322ec812924e1d60a26d9378afd28555298d | refs/heads/master | 2021-01-01T03:34:55.865381 | 2016-05-25T21:23:14 | 2016-05-25T21:23:14 | 59,698,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,525 | java | import java.io.PrintStream;
/** Abstract syntax (base class) for expressions.
*/
abstract class Expr {
// Indentation: --------------------------------------------------
public void indent() { indent(0); }
// node-specific worker function:
abstract void indent(int n);
// general utility function:
protected void indent(int n, String str) {
for (int i=0; i<n; i++) {
System.out.print(" ");
}
System.out.println(str);
}
// Graphviz trees: -----------------------------------------------
public void toDot(String filename) {
try {
PrintStream out = new PrintStream(filename);
out.println("digraph AST {");
out.println("node [shape=box style=filled fontname=Courier];");
toDot(out, 0);
out.println("}");
out.close();
} catch (Exception e) {
System.err.println("Exception: " + e);
}
}
// node-specific worker function:
abstract int toDot(PrintStream out, int n);
// general utility functions:
protected void node(PrintStream out, int n, String lab) {
out.println(n + "[label=\"" + lab + "\"];");
}
protected void edge(PrintStream out, int src, int dst) {
out.println(src + " -> " + dst + ";");
}
}
/** Abstract syntax for integer (literal) expressions.
*/
class IntExpr extends Expr {
private int i;
IntExpr(int i) { this.i = i; }
void indent(int n) {
indent(n, Integer.toString(i));
}
int toDot(PrintStream out, int n) {
node(out, n, Integer.toString(i));
return n+1;
}
}
/** Abstract syntax base class for binary expressions.
*/
abstract class BinExpr extends Expr {
protected Expr l;
protected Expr r;
BinExpr(Expr l, Expr r) { this.l = l; this.r = r; }
abstract String label();
void indent(int n) {
indent(n, label());
l.indent(n+1);
r.indent(n+1);
}
int toDot(PrintStream out, int n) {
node(out, n, label()); // output this node
int ln = n + 1; // find id for left child
edge(out, n, ln); // output edge to left child
int rn = l.toDot(out, ln); // output left child, find id for right
edge(out, n, rn); // output edge to right child
return r.toDot(out, rn); // output right child
}
}
/** Abstract syntax for addition expressions.
*/
class AddExpr extends BinExpr {
AddExpr(Expr l, Expr r) { super(l,r); }
String label() { return "Add"; }
}
/** Abstract syntax for subtraction expressions.
*/
class SubExpr extends BinExpr {
SubExpr(Expr l, Expr r) { super(l,r); }
String label() { return "Sub"; }
}
/** Abstract syntax for multiplication expressions.
*/
class MulExpr extends BinExpr {
MulExpr(Expr l, Expr r) { super(l,r); }
String label() { return "Mul"; }
}
/** Abstract syntax for identifier (variable) expressions.
*/
class VarExpr extends Expr {
private String var;
VarExpr(String var) { this.var = var; }
void indent(int n) {
indent(n, var);
}
int toDot(PrintStream out, int n) {
node(out, n, var);
return n+1;
}
}
/** Abstract syntax for assignment expressions.
*/
class AssignExpr extends Expr {
private String lhs;
private Expr rhs;
AssignExpr(String lhs, Expr rhs) { this.lhs = lhs; this.rhs = rhs; }
void indent(int n) {
indent(n, lhs + " =");
rhs.indent(n+1);
}
int toDot(PrintStream out, int n) {
node(out, n, lhs + " =");
edge(out, n, n+1);
return rhs.toDot(out, n+1);
}
}
| [
"hckim0625@gmail.com"
] | hckim0625@gmail.com |
a8ccfa9097bdefc4826772bac1502454e41b9082 | 5740dc85040bfd4a2d686bb97ddae4d2451a470f | /src/display/ShipLocations.java | e750cebddc9994dfcd8c2198ed8809eb0b4598a7 | [] | no_license | svramusi/Ultimate-Salvo-Battleship | 9b2b8478dd329f9dba4ed56f8c8b903af2631001 | 51d27f71781845b538efd827525dd8a1092b215b | refs/heads/master | 2016-09-08T19:03:06.343381 | 2013-06-04T03:26:15 | 2013-06-04T03:47:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,597 | java | package display;
import java.util.ArrayList;
import java.util.List;
import board.Board;
import ships.*;
//This class is designed to be an efficient way for the display
//to query what ship is at a given location.
//Rather than have the display iterate over every single ship
//for every element that it needs to render, query this class.
//The main data structure (shipLocations) is a list of lists
//Each entry in shipLocations corresponds to a row on the board
//Each data element in shipLocations is a list of ships that occupy
//a space in that row.
//Each data element in that data structure contains the info of
//what column it is found in as well as the type of ship that it is
//Time complexity to create the data structure is O(# of ships)
//Space complexity is O(# of points for # of ships) = O(17)
//Time complexity to query is O(# of points for # of ships)
public class ShipLocations {
private List<List<Info>> shipLocations;
public ShipLocations(Board board)
{
shipLocations = new ArrayList<List<Info>>();
for(int i=0;i<board.getHeight();i++)
shipLocations.add(new ArrayList<Info>());
List<Ship> ships = board.getActiveShips();
for(Ship s : ships)
{
for(Point p : s.getShipLocation())
{
shipLocations.get(p.getX()).add(convertToInfo(p, s));
}
}
}
public Info getShip(int row, int col)
{
List<Info> cols = shipLocations.get(row);
for(Info i : cols)
{
if(i.getCol() == col)
return i;
}
return null;
}
private Info convertToInfo(Point p, Ship s)
{
return new Info(s.getShipType(), p.getY(), s.isDamaged(p));
}
} | [
"svramusi@gmail.com"
] | svramusi@gmail.com |
074fab9288a7f19478c08b77bd46dd828e8a42d4 | 91552b5d2c9d59c8a4c391c9c340c3c8acc1a0c3 | /Team15_CSCI201L_Project/src/client/HostClassDialog.java | 20a9024aa53b35dae46796b6348787164636ce35 | [] | no_license | Zha0q1/Online_Teaching_Platform_SE_Class_Project | 2f5c93d1f63a29906d8b1bea0a485752d7d4da48 | 51d743bdfa9923ba60fb73d59f3918e02d43e5bc | refs/heads/master | 2021-05-15T22:38:26.655030 | 2017-10-12T18:57:57 | 2017-10-12T18:57:57 | 106,733,204 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,757 | java | package client;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Map;
import java.util.Vector;
import javax.swing.BoxLayout;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import listeners.TextFocusListener;
import shared.Classroom;
import shared.User;
import util.AppearanceSettings;
import util.SwingUtils;
public class HostClassDialog extends JDialog {
private static final long serialVersionUID = 1L;
private Classroom classroom;
private JTextField className;
private JButton startClass, cancel;
private JPanel centerPanel, buttonPanel;
private Boolean activityChosen = false;
private User userinfo;
public Vector<Integer> vectorToStoreActivityIDs = new Vector<Integer>();
public Map<Integer, String> userActivityMap;
private JComboBox selectActivity = new JComboBox();
public int selectedActivity;
JList<String> list;
DefaultListModel<String> listModel;
private int[] activities;
public boolean success = false;
public HostClassDialog(JFrame frame,Map<Integer, String> userActivityMap){
super(frame, "Host a new class", true);
//this.vectorToStoreActivityIDs = vectorToStoreActivityIDs;
this.userActivityMap = userActivityMap;
initializeVariables();
createGUI();
setUndecorated(true);
this.getRootPane().setOpaque(false);
SwingUtils.createDialogBackPanel(this, frame.getContentPane());
addEvents();
}
@SuppressWarnings("unchecked")
public void initializeVariables(){
className = new JTextField(15);
startClass = new JButton("Host Class");
cancel = new JButton("Cancel");
startClass.setEnabled(false);
for (Map.Entry<Integer, String> mapEntry : userActivityMap.entrySet()) {
String value = mapEntry.getValue();
System.out.println("activity id " + value);
selectActivity.addItem(value);
vectorToStoreActivityIDs.add(mapEntry.getKey());
}
}
public void createGUI(){
JPanel northPanel = new JPanel();
northPanel.setLayout(new BoxLayout(northPanel,BoxLayout.Y_AXIS));
centerPanel = new JPanel();
buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(1,2));
JLabel classAndActivityLabel = new JLabel("Name this class and choose an activity");
northPanel.add(classAndActivityLabel);
northPanel.add(className);
//Setting Background and foreground and text;
AppearanceSettings.setBackground(Constants.maroon, classAndActivityLabel, className, selectActivity, cancel, startClass);
AppearanceSettings.setBackground(Constants.maroon, northPanel,centerPanel,buttonPanel);
AppearanceSettings.setForeground(Constants.gold, classAndActivityLabel, className, selectActivity, cancel, startClass);
AppearanceSettings.setForeground(Constants.gold, northPanel,centerPanel,buttonPanel);
AppearanceSettings.setFont(Constants.standardFont, classAndActivityLabel, className, cancel, startClass);
AppearanceSettings.setTextAlignment(classAndActivityLabel);
buttonPanel.add(cancel);
buttonPanel.add(startClass);
add(northPanel,BorderLayout.NORTH);
add(centerPanel,BorderLayout.CENTER);
add(buttonPanel,BorderLayout.SOUTH);
centerPanel.add(selectActivity);
}
public void addEvents(){
//setSize(400,300);
this.setDefaultCloseOperation(this.DISPOSE_ON_CLOSE);
className.addFocusListener(new TextFocusListener("Name this class", className));
className.getDocument().addDocumentListener(new MyDocumentListener());
startClass.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
//null should be changed to the activity chosen from the combobox
int index = selectActivity.getSelectedIndex();
if(index != -1)
selectedActivity = vectorToStoreActivityIDs.get(index);
success = true;
SwingUtils.fadeOut(HostClassDialog.this);
}
});
cancel.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
// setVisible(false);
// dispose();
SwingUtils.fadeOut(HostClassDialog.this);
}
});
// listModel= new DefaultListModel<String>();
// list = new JList<String>(listModel);
// list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// list.setEnabled(false);
//
// list.addListSelectionListener(new ListSelectionListener(){
// @Override
// public void valueChanged(ListSelectionEvent e) {
// // TODO Auto-generated method stub
// startClass.setEnabled(list.getSelectedIndex()!=-1 && canPressButton());
// }
//
// });
// centerPanel.add(list);
}
public String getClassName(){
return className.getText();
}
public Boolean canPressButton(){
return (!className.getText().isEmpty() && !className.getText().equals("Name this class"));
}
//sets the buttons enabled or disabled
private class MyDocumentListener implements DocumentListener{
@Override
public void insertUpdate(DocumentEvent e) {
startClass.setEnabled(canPressButton());
}
@Override
public void removeUpdate(DocumentEvent e) {
startClass.setEnabled(canPressButton());
}
@Override
public void changedUpdate(DocumentEvent e) {
startClass.setEnabled(canPressButton());
}
}
}
| [
"zhaoqizh@usc.edu"
] | zhaoqizh@usc.edu |
49d5349c6680679e650fd889be6abf3a850c8ec6 | 7800688d24eb1d9d5ea63eec331ea9e579d2146c | /rpg/src/com/me/rpg/utils/GlobalTimerTask.java | dc7db456032de379e1cc63bf7496fd7858547cff | [] | no_license | slanger/RPG | 44f3d4dfb2892d2a4143f91c9b62d7b3bf061791 | c0057ecf2fd61c7877054d5410b75142cca93668 | refs/heads/master | 2021-01-01T15:31:26.079647 | 2014-04-24T20:24:52 | 2014-04-24T20:24:52 | 15,801,740 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,410 | java | package com.me.rpg.utils;
import java.io.Serializable;
import com.me.rpg.utils.Timer.Task;
public class GlobalTimerTask extends Task {
private static final long serialVersionUID = 1L;
private static GlobalTimerTask instance;
private GlobalTimerTask() {}
public static GlobalTimerTask getInstance() {
if (instance != null)
return instance;
instance = new GlobalTimerTask();
return instance;
}
@Override
// Do nothing
public void run() {}
/**
* Saves the current time
* @return
*/
public static Time getCurrentTime() {
return instance.new Time();
}
/**
* @param past A past time, retrieved from the GlobalTimerTask
* @return The difference in the past time with the current time, in seconds
*/
public static float getTimeDifference(Time past) {
return (past.getMillis() - instance.timeLeftBeforeExecute) / 1000.0f;
}
/**
* Encapsulates a Time from the GlobalTimerTask
* @author Alex
*
*/
public class Time implements Serializable {
private static final long serialVersionUID = 1L;
private long milliRemaining;
public Time() {
milliRemaining = timeLeftBeforeExecute;
}
public long getMillis() {
return milliRemaining;
}
public boolean equals(Object o) {
Time t = null;
try {
t = (Time)o;
} catch (Exception e) {}
if (t == null) return false;
return t.milliRemaining == milliRemaining;
}
}
}
| [
"alexanderson@ufl.edu"
] | alexanderson@ufl.edu |
d8396d341b7b8ffeb2ea267098f0b5ef1ad04235 | ceb5fce522dd58d4271e1d7f07188d0fe8770e0e | /src/main/java/com/derrick/springbootTEST/entitiy/Category.java | ab6fffef676f1adf6f6b1c0e3cdf672142868669 | [] | no_license | KnightCrab/springbootTEST | 38e3052c7db466a6e692fbaaf4e6065412b4fd8c | b3c56902f39a7cc6301d02beb6317a95f66008c7 | refs/heads/master | 2020-04-13T07:08:20.999444 | 2018-12-25T03:24:24 | 2018-12-25T03:24:24 | 163,041,499 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,732 | java | package com.derrick.springbootTEST.entitiy;
public class Category {
private Integer categoryId;
private Integer categoryPid;
private String categoryName;
private String categoryDescription;
private Integer categoryOrder;
private String categoryIcon;
private Integer categoryStatus;
public Integer getCategoryId() {
return categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public Integer getCategoryPid() {
return categoryPid;
}
public void setCategoryPid(Integer categoryPid) {
this.categoryPid = categoryPid;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName == null ? null : categoryName.trim();
}
public String getCategoryDescription() {
return categoryDescription;
}
public void setCategoryDescription(String categoryDescription) {
this.categoryDescription = categoryDescription == null ? null : categoryDescription.trim();
}
public Integer getCategoryOrder() {
return categoryOrder;
}
public void setCategoryOrder(Integer categoryOrder) {
this.categoryOrder = categoryOrder;
}
public String getCategoryIcon() {
return categoryIcon;
}
public void setCategoryIcon(String categoryIcon) {
this.categoryIcon = categoryIcon == null ? null : categoryIcon.trim();
}
public Integer getCategoryStatus() {
return categoryStatus;
}
public void setCategoryStatus(Integer categoryStatus) {
this.categoryStatus = categoryStatus;
}
} | [
"knightcrab@163.com"
] | knightcrab@163.com |
f641a74936d34542b823bbdd960a62abc4be472c | 8fcaac798af8b63f1df3a1189201056e582fd65c | /RajeevWeb/src/controller/ScheduleServlet.java | 19ea03419e7c0e3476ac461f3a00c1a07bd7c1f5 | [] | no_license | Rajeev65105/sscheduler | 881182b701e8a3941018b57ae8820b58d6079cb7 | b54760553fbdeba68029719e14f7157d1ba1c1a3 | refs/heads/master | 2022-11-28T18:47:02.260570 | 2020-08-16T08:05:07 | 2020-08-16T08:05:07 | 284,427,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,464 | java | package controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.SchoolClass;
import model.SchoolSchedule;
/**
* Servlet implementation class ScheduleServlet
*/
@WebServlet("/ScheduleServlet")
public class ScheduleServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ScheduleServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String title = request.getParameter("title");
int starttime = Integer.parseInt(request.getParameter("starttime"));
int endtime = Integer.parseInt(request.getParameter("endtime"));
String[] days = request.getParameterValues("day");
SchoolSchedule schedule =
(SchoolSchedule)request.getSession(true).getAttribute("schoolschedule");
if(schedule == null)
{
schedule = new SchoolSchedule();
}
if(days != null)
{
for(int i = 0; i < days.length; i++)
{
String dayString = days[i];
int day;
if(dayString.equalsIgnoreCase("SUN")) day = 0;
else if(dayString.equalsIgnoreCase("MON")) day = 1;
else if(dayString.equalsIgnoreCase("TUE")) day = 2;
else if(dayString.equalsIgnoreCase("WED")) day = 3;
else if(dayString.equalsIgnoreCase("THU")) day = 4;
else if(dayString.equalsIgnoreCase("FRI")) day = 5;
else day = 6;
SchoolClass clazz = new SchoolClass(title, starttime, endtime, day);
schedule.addClass(clazz);
}
}request.getSession().setAttribute("schoolschedule", schedule);
getServletContext().getRequestDispatcher("/Schedule.jsp").forward(request, response);
}
}
| [
"noreply@github.com"
] | Rajeev65105.noreply@github.com |
082c5884609f5e5fce283e40d88b696b8f4f3ef9 | 3eb2c31702abfe46dafdc8bb675f291b401a0ed7 | /src/Chapter_4_Fundamental_Data_Types/TimeInterval.java | d4292c6b1f241c039ea47e6187a5f075de5b84a0 | [] | no_license | cpberryman/BigJava4thEditionExerciseSolutions | b3cd91dfd7bb6f6712cb959ae12240d191bba161 | 85b2414d8ee8086507abed7cdf0148ba5b00727e | refs/heads/master | 2021-01-10T12:41:58.417189 | 2016-01-18T14:00:47 | 2016-01-18T14:00:47 | 45,547,598 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,637 | java | package Chapter_4_Fundamental_Data_Types;
/**
* Solution to exercise P4.15
*
* A time interval takes two military times and computes the difference between
* them in hours and minutes
*
* @author ChrisBerryman
*/
public class TimeInterval {
private final int firstTime;
private final int secondTime;
public final int HOURS_IN_DAY = 24;
/**
* Constructs a time interval.
*
* @param firstTime the first time in military time
* @param secondTime the second time in military time
*/
public TimeInterval(int firstTime, int secondTime) {
this.firstTime = firstTime;
this.secondTime = secondTime;
}
/**
* Returns the hours of the time difference.
*
* @return the hours
*/
public int getHours() {
int hours;
if (firstTime > secondTime) {
int firstHour = firstTime / 100;
int secondHour = secondTime / 100;
hours = ((secondHour - firstHour + HOURS_IN_DAY ) % HOURS_IN_DAY);
} else {
hours = (secondTime - firstTime) / 100;
}
return hours;
}
/**
* Returns the minutes of the time difference.
*
* @return the minutes
*/
public int getMinutes() {
int minutes = 0;
int firstTimeMinutes = firstTime % 100;
int secondTimeMinutes = secondTime % 100;
if (firstTime > secondTime) {
minutes = (firstTimeMinutes - secondTimeMinutes);
} else {
minutes = Math.abs(secondTimeMinutes - firstTimeMinutes);
}
return minutes;
}
}
| [
"c.p.berryman@btinternet.com"
] | c.p.berryman@btinternet.com |
5bbcd87e60e8f549a718c819ba85c3fa45ade370 | 21c20d4484bd26171d2f3da9411664ba98f9d0d4 | /agenda2/src/main/java/agenda2/Listado.java | e5ae94bee19c8cb60c8afe266b4b387502b89d34 | [] | no_license | PedroPabloC/Dise-o | 715c580c62209638884a26b532990c10caca5478 | 63c1c4eb3af0d174a6feb425bd51f5b717606951 | refs/heads/master | 2023-04-02T09:33:17.164218 | 2021-04-11T04:46:49 | 2021-04-11T04:46:49 | 347,143,803 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 21,153 | java | /*
* Listado.java
*
* Created on 19 de diciembre de 2007, 3:19
*/
package agenda2;
import java.util.Iterator;
import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
/**
*
* @author Cristian Riffo Huez
*/
public class Listado extends javax.swing.JFrame {
/** Creates new form Listado */
public Listado() {
initComponents();
//centrado en el monitor
this.setLocationRelativeTo(null);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
skins = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
lista = new javax.swing.JList();
jPanel2 = new javax.swing.JPanel();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel3 = new javax.swing.JPanel();
hombres = new javax.swing.JCheckBox();
mujeres = new javax.swing.JCheckBox();
movil = new javax.swing.JCheckBox();
fijo = new javax.swing.JCheckBox();
jPanel4 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
txtBuscar = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton2 = new javax.swing.JRadioButton();
jRadioButton3 = new javax.swing.JRadioButton();
jSeparator1 = new javax.swing.JSeparator();
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("Agregar Contacto");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jScrollPane1.setViewportView(lista);
jTabbedPane1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTabbedPane1MouseClicked(evt);
}
});
hombres.setSelected(true);
hombres.setText("Hombres");
hombres.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
hombres.setMargin(new java.awt.Insets(0, 0, 0, 0));
hombres.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hombresActionPerformed(evt);
}
});
mujeres.setSelected(true);
mujeres.setText("Mujeres");
mujeres.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
mujeres.setMargin(new java.awt.Insets(0, 0, 0, 0));
mujeres.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mujeresActionPerformed(evt);
}
});
movil.setSelected(true);
movil.setText("M\u00f3vil");
movil.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
movil.setMargin(new java.awt.Insets(0, 0, 0, 0));
movil.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
movilActionPerformed(evt);
}
});
fijo.setSelected(true);
fijo.setText("Fijo");
fijo.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
fijo.setMargin(new java.awt.Insets(0, 0, 0, 0));
fijo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
fijoActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hombres)
.addComponent(mujeres))
.addGap(35, 35, 35)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fijo)
.addComponent(movil))
.addContainerGap(41, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(hombres)
.addComponent(fijo))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(mujeres)
.addComponent(movil))
.addContainerGap(38, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Filtrado", jPanel3);
jLabel1.setText("Buscar en listado");
txtBuscar.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txtBuscarKeyReleased(evt);
}
});
jLabel2.setFont(new java.awt.Font("Tahoma", 2, 12));
jLabel2.setText("nombre, fono, numero");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(txtBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addContainerGap(71, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addContainerGap(23, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Buscar", jPanel4);
jTabbedPane1.getAccessibleContext().setAccessibleName("Filtrar");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE)
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
);
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11));
jLabel3.setText("Skin");
skins.add(jRadioButton1);
jRadioButton1.setText("Metal");
jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton1ActionPerformed(evt);
}
});
skins.add(jRadioButton2);
jRadioButton2.setText("Motif");
jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton2ActionPerformed(evt);
}
});
skins.add(jRadioButton3);
jRadioButton3.setText("Windows");
jRadioButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jRadioButton3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButton1))
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addComponent(jButton1)))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton1)
.addGap(39, 39, 39)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jRadioButton3)
.addComponent(jRadioButton2)
.addComponent(jRadioButton1))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, 400));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton3ActionPerformed
// TODO add your handling code here:
//cambiar LAF
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
SwingUtilities.updateComponentTreeUI(this);
} catch (Exception excep) {
}
}//GEN-LAST:event_jRadioButton3ActionPerformed
private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed
// TODO add your handling code here:
//cambiar LAF
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
SwingUtilities.updateComponentTreeUI(this);
} catch (Exception excep) {
}
}//GEN-LAST:event_jRadioButton2ActionPerformed
private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
// TODO add your handling code here:
//cambiar LAF
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
SwingUtilities.updateComponentTreeUI(this);
} catch (Exception excep) {
}
}//GEN-LAST:event_jRadioButton1ActionPerformed
private void jTabbedPane1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane1MouseClicked
// TODO add your handling code here:
//limpiar textfield
txtBuscar.setText("");
//refrescar listado
mostrarContactos();
}//GEN-LAST:event_jTabbedPane1MouseClicked
private void txtBuscarKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtBuscarKeyReleased
// TODO add your handling code here:
buscar();
}//GEN-LAST:event_txtBuscarKeyReleased
private void movilActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_movilActionPerformed
// TODO add your handling code here:
mostrarContactos();
}//GEN-LAST:event_movilActionPerformed
private void fijoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fijoActionPerformed
// TODO add your handling code here:
mostrarContactos();
}//GEN-LAST:event_fijoActionPerformed
private void mujeresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mujeresActionPerformed
// TODO add your handling code here:
mostrarContactos();
}//GEN-LAST:event_mujeresActionPerformed
private void hombresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hombresActionPerformed
// TODO add your handling code here:
mostrarContactos();
}//GEN-LAST:event_hombresActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
//ocultar esta ventana
this.setVisible(false);
//instanciar Agregar, para a�adir contacto
new Agregar().setVisible(true);
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(List agenda) {
}
void buscar(){
//Si textfield vacio recargamos agenda
if(txtBuscar.getText().length()==0){
mostrarContactos();
} else{
Iterator it = MiAgenda.getIterator();
DefaultListModel newmodelo= new DefaultListModel(), modelo= new DefaultListModel();
//cargamos datos de agenda para filtrar
while (it.hasNext()) {
String contacto[]=(String[]) it.next();
modelo.addElement(contacto[0]+" "+contacto[1]+" | "+contacto[3]+" | "+contacto[4] + " | " + contacto[5]);
}
//nuevo modelo luego de filtrar
String res = null;
for(int i=0;i<modelo.getSize();i++){
res = modelo.get(i).toString();
if(res.contains(txtBuscar.getText())){
newmodelo.addElement(res);
}
}
//limpiar lista para mostrarla filtrada
lista.removeAll();
//llenar lista con nuevos valores
lista.setModel(newmodelo);
}
}
public static void mostrarContactos(){
//limpiar lista para mostrarla filtrada
lista.removeAll();
DefaultListModel modelo = new DefaultListModel();
Iterator i = MiAgenda.getIterator();
String genero = null, fono= null;
int queGenero=0, queFono=0;
//usamos flags para filtrar por gereno y fono
if(hombres.isSelected()){
queGenero++;
}
if(mujeres.isSelected()){
queGenero--;
}
if(fijo.isSelected()){
queFono++;
}
if(movil.isSelected()){
queFono--;
}
switch(queFono){
case 1:
fono="Fijo";
break;
case -1:
fono="Celular";
break;
case 0:
fono="todos";
break;
}
switch(queGenero){
case 1:
genero="Masculino";
break;
case -1:
genero="Femenino";
break;
case 0:
genero="todos";
break;
}
//consultamos por cada item que hay en el agenda
while (i.hasNext()) {
String contacto[]=(String[]) i.next();
if(fono.compareTo("todos")!=0){
if(fono.compareTo(contacto[3])==0){
if(genero.compareTo("todos")!=0){
if(genero.compareTo(contacto[2])==0){
modelo.addElement(contacto[0]+" "+contacto[1]+" | "+contacto[3]+" | "+contacto[4] + " | " + contacto[5]);
}
} else{
modelo.addElement(contacto[0]+" "+contacto[1]+" | "+contacto[3]+" | "+contacto[4] + " | " + contacto[5]);
}
}
} else{
if(genero.compareTo("todos")!=0){
if(genero.compareTo(contacto[2])==0){
modelo.addElement(contacto[0]+" "+contacto[1]+" | "+contacto[3]+" | "+contacto[4] + " | " + contacto[5]);
}
} else{
modelo.addElement(contacto[0]+" "+contacto[1]+" | "+contacto[3]+" | "+contacto[4] + " | " + contacto[5]);
}
}
}
//asignamos los valores a JList
lista.setModel(modelo);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private static javax.swing.JCheckBox fijo;
private static javax.swing.JCheckBox hombres;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JRadioButton jRadioButton3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTabbedPane jTabbedPane1;
public static javax.swing.JList lista;
private static javax.swing.JCheckBox movil;
private static javax.swing.JCheckBox mujeres;
private javax.swing.ButtonGroup skins;
private static javax.swing.JTextField txtBuscar;
// End of variables declaration//GEN-END:variables
}
| [
"56356015+PedroPabloC@users.noreply.github.com"
] | 56356015+PedroPabloC@users.noreply.github.com |
345924c1d874fe92f14ecb459b191657757c8497 | a508e82bb5f38c482e5f9d766d4773e2aa852639 | /src/test/com/cognixia/jumplus/project1/anorthouse/utility/ColorUtilTest.java | 0ed7e2d9db318d5c9107debfe7057df746e1594f | [
"Apache-2.0"
] | permissive | ajnorthouse/JUMPlus-Project-1 | 22728cd5e29197cefa4cb62f3ce33b79ada5e3b9 | b04676634418a1d9844ca941d093d3e9ea55665a | refs/heads/origin | 2023-04-24T14:36:37.630215 | 2021-05-17T16:13:55 | 2021-05-17T16:13:55 | 354,891,467 | 0 | 1 | Apache-2.0 | 2021-05-06T17:46:02 | 2021-04-05T16:04:14 | Java | UTF-8 | Java | false | false | 3,314 | java | package com.cognixia.jumplus.project1.anorthouse.utility;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import com.cognixia.jumplus.project1.anorthouse.utility.ColorUtil;
import com.cognixia.jumplus.project1.anorthouse.utility.ColorUtil.ANSI_BACKGROUND_COLOR;
import com.cognixia.jumplus.project1.anorthouse.utility.ColorUtil.ANSI_FONT_COLOR;
@DisplayName("ColorUtil Tests")
class ColorUtilTest {
@Nested
@DisplayName("combineAnsi()")
class combineAnsiUseCases {
@Test
@DisplayName("Empty String, White Font & Background")
final void testCombineAnsiEmptyString() {
String expected = "\u001B[37m\u001B[47m\u001B[0m";
String actual = ColorUtil.combineAnsi(ANSI_FONT_COLOR.WHITE, ANSI_BACKGROUND_COLOR.WHITE, "");
assertEquals(expected, actual);
}
@Test
@DisplayName("Single Dash, Yellow Font, Blue Background")
final void testCombineAnsiSingleDash() {
String expected = "\u001B[33m\u001B[44m-\u001B[0m";
String actual = ColorUtil.combineAnsi(ANSI_FONT_COLOR.YELLOW, ANSI_BACKGROUND_COLOR.BLUE, "-");
assertEquals(expected, actual);
}
@Test
@DisplayName("Green Font, Red Background")
final void testCombineAnsi() {
String expected = "\u001B[32m\u001B[41mThis is Green and Red!\u001B[0m";
String actual = ColorUtil.combineAnsi(ANSI_FONT_COLOR.GREEN, ANSI_BACKGROUND_COLOR.RED, "This is Green and Red!");
assertEquals(expected, actual);
}
}
@Nested
@DisplayName("combineAnsiFont()")
class combineAnsiFontUseCases {
@Test
@DisplayName("Empty String, White Font")
final void testCombineAnsiFontEmptyString() {
String expected = "\u001B[37m\u001B[0m";
String actual = ColorUtil.combineAnsiFont(ANSI_FONT_COLOR.WHITE, "");
assertEquals(expected, actual);
}
@Test
@DisplayName("Single Space, Yellow Font")
final void testCombineAnsiFontSingleSpace() {
String expected = "\u001B[33m \u001B[0m";
String actual = ColorUtil.combineAnsiFont(ANSI_FONT_COLOR.YELLOW, " ");
assertEquals(expected, actual);
}
@Test
@DisplayName("Green Font")
final void testCombineAnsiFont() {
String expected = "\u001B[32mThis is Green!\u001B[0m";
String actual = ColorUtil.combineAnsiFont(ANSI_FONT_COLOR.GREEN, "This is Green!");
assertEquals(expected, actual);
}
}
@Nested
@DisplayName("combineAnsiBackground()")
class combineAnsiBackgroundUseCases {
@Test
@DisplayName("Empty String, White Background")
final void testCombineAnsiBackgroundEmptyString() {
String expected = "\u001B[47m\u001B[0m";
String actual = ColorUtil.combineAnsiBackGround(ANSI_BACKGROUND_COLOR.WHITE, "");
assertEquals(expected, actual);
}
@Test
@DisplayName("Single Dash, Blue Background")
final void testCombineAnsiBackgroundSingleDash() {
String expected = "\u001B[44m-\u001B[0m";
String actual = ColorUtil.combineAnsiBackGround(ANSI_BACKGROUND_COLOR.BLUE, "-");
assertEquals(expected, actual);
}
@Test
@DisplayName("Red Background")
final void testCombineAnsiBackground() {
String expected = "\u001B[41mThis is Red!\u001B[0m";
String actual = ColorUtil.combineAnsiBackGround(ANSI_BACKGROUND_COLOR.RED, "This is Red!");
assertEquals(expected, actual);
}
}
}
| [
"Alex.J.Northouse@gmail.com"
] | Alex.J.Northouse@gmail.com |
6a7ca9d92a39c068d45b50acbe51ed2c0ff6f2c0 | c5c2b3ba573cf040d9cc3b2b3dc030581278af15 | /src/main/java/net/eoutech/webmin/vifi/dao/ViFiStatusDao.java | 68df8c1bbe8eba2a60659eef0cbb1d598d450dfa | [] | no_license | hezhengwei92/vifiwebmin | aa2abd65638ab57412e9a91e771770174d1e89b8 | a54a0d72a1ef49eaa7cb3cdc8223d1a83633eb4b | refs/heads/master | 2021-08-23T08:30:48.634346 | 2017-12-04T09:16:28 | 2017-12-04T09:17:02 | 113,010,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java |
package net.eoutech.webmin.vifi.dao;
import com.frame.dao.FrameBaseDao;
import org.springframework.stereotype.Component;
@Component
public class ViFiStatusDao extends FrameBaseDao {
}
| [
"419084526@qq.com"
] | 419084526@qq.com |
3e0e4aeea63e186bd09aef248765af1d4b740574 | 960aad4803eb614000640da2cbc4ee836f78ca1d | /SmartD-plant(Android)/app/src/main/java/com/example/findit/chatbot/MainChatBotActivity.java | 48956fefc935bd8a4f121d5d73777065ef6f641d | [] | no_license | agungfadilnur/Smart_D-Plant | 26cada2302f5e62e105d26de93136c52926d4561 | 4c8a54caee6fb946b397d11b19ce8360da926977 | refs/heads/master | 2022-12-13T12:48:51.805207 | 2020-08-22T20:37:25 | 2020-08-22T20:37:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,821 | java | package com.example.findit.chatbot;
import android.Manifest;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.findit.R;
import com.example.findit.model.ChatMessage;
import com.example.findit.model.chat_rec;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
//
//import ai.api.AIDataService;
//import ai.api.AIListener;
//import ai.api.AIServiceException;
//import ai.api.android.AIConfiguration;
//import ai.api.android.AIService;
//import ai.api.model.AIError;
//import ai.api.model.AIRequest;
//import ai.api.model.AIResponse;
//import ai.api.model.Result;
//import com.google.gson.JsonElement;
//import java.util.Map;
public class MainChatBotActivity extends AppCompatActivity {
RecyclerView recyclerView;
EditText editText;
RelativeLayout addBtn;
DatabaseReference ref;
FirebaseRecyclerAdapter<ChatMessage, chat_rec> adapter;
Boolean flagFab = true;
// private AIService aiService;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_chat_bot);
}
} | [
"noreply@github.com"
] | agungfadilnur.noreply@github.com |
c77d368d3d28d7c8ad816d3de8b559a26d054bc8 | 18cc9453ebc3b58309aa6a05990ba6393a322df0 | /probe/src/main/java/ru/prolib/aquila/probe/datasim/l1/L1UpdateReaderFactory.java | e3f4967c7b008f627b79d65e609cedad74e61049 | [] | no_license | robot-aquila/aquila | 20ef53d813074e2346bfbd6573ffb0737bef5412 | 056af30a3610366fe47d97d0c6d53970e3ee662b | refs/heads/develop | 2022-11-30T01:54:52.653013 | 2020-12-07T00:18:01 | 2020-12-07T00:18:01 | 20,706,073 | 3 | 2 | null | 2022-11-24T08:58:08 | 2014-06-11T00:00:34 | Java | UTF-8 | Java | false | false | 441 | java | package ru.prolib.aquila.probe.datasim.l1;
import java.io.IOException;
import java.time.Instant;
import ru.prolib.aquila.core.BusinessEntities.CloseableIterator;
import ru.prolib.aquila.core.BusinessEntities.L1Update;
import ru.prolib.aquila.core.BusinessEntities.Symbol;
public interface L1UpdateReaderFactory {
public CloseableIterator<L1Update>
createReader(Symbol symbol, Instant startTime) throws IOException;
}
| [
"dmitry.zolotarev@gmail.com"
] | dmitry.zolotarev@gmail.com |
8667ad358d89180432a81b8d3be525758fc2f78d | da2a9e8b4737ea7e3e75b64aeeb6b5bb377fc8bb | /Taller3AngieCordoba-1/src/main/java/com/computacion/taller/Modelo/TsscGroup.java | 41167ab367e1d6636ee3ee0a1f11f517f25e138e | [] | no_license | angieVa/Proyecto-Thymeleaf-y-RESTful | e664011170602c47796f6a7f8d7068935685fe9e | 11d16512644a38f88a95e4e158746dffb32119cf | refs/heads/master | 2022-09-30T21:20:03.132563 | 2020-06-04T19:27:46 | 2020-06-04T19:27:46 | 269,445,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,770 | java | package com.computacion.taller.Modelo;
import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.List;
/**
* The persistent class for the TSSC_GROUP database table.
*
*/
@Entity
@Table(name="TSSC_GROUP")
@NamedQuery(name="TsscGroup.findAll", query="SELECT t FROM TsscGroup t")
public class TsscGroup implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@SequenceGenerator(name="TSSC_GROUP_ID_GENERATOR", allocationSize = 1, sequenceName="TSSC_GROUP_SEQ")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TSSC_GROUP_ID_GENERATOR")
private long id;
@Lob
private byte[] avatar;
private String name;
@Column(name="GP_POSITION")
private BigDecimal gpPosition;
@Column(name="QR_PASSWORD")
private String qrPassword;
//bi-directional many-to-one association to TsscDeliverable
@OneToMany(mappedBy="tsscGroup")
private List<TsscDeliverable> tsscDeliverables;
//bi-directional many-to-one association to TsscGame
@ManyToOne
@JoinColumn(name="TSSC_GAME_ID")
private TsscGame tsscGame;
//bi-directional many-to-one association to TsscState
@ManyToOne
@JoinColumn(name="TSSC_STATE_ID")
private TsscState tsscState;
public TsscGroup() {
}
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
public byte[] getAvatar() {
return this.avatar;
}
public void setAvatar(byte[] avatar) {
this.avatar = avatar;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getGpPosition() {
return this.gpPosition;
}
public void setGpPosition(BigDecimal position) {
this.gpPosition = position;
}
public String getQrPassword() {
return this.qrPassword;
}
public void setQrPassword(String qrPassword) {
this.qrPassword = qrPassword;
}
public List<TsscDeliverable> getTsscDeliverables() {
return this.tsscDeliverables;
}
public void setTsscDeliverables(List<TsscDeliverable> tsscDeliverables) {
this.tsscDeliverables = tsscDeliverables;
}
public TsscDeliverable addTsscDeliverable(TsscDeliverable tsscDeliverable) {
getTsscDeliverables().add(tsscDeliverable);
tsscDeliverable.setTsscGroup(this);
return tsscDeliverable;
}
public TsscDeliverable removeTsscDeliverable(TsscDeliverable tsscDeliverable) {
getTsscDeliverables().remove(tsscDeliverable);
tsscDeliverable.setTsscGroup(null);
return tsscDeliverable;
}
public TsscGame getTsscGame() {
return this.tsscGame;
}
public void setTsscGame(TsscGame tsscGame) {
this.tsscGame = tsscGame;
}
public TsscState getTsscState() {
return this.tsscState;
}
public void setTsscState(TsscState tsscState) {
this.tsscState = tsscState;
}
} | [
"angievalentina1526@gmail.com"
] | angievalentina1526@gmail.com |
98c8b9878dca9211ad56c88fbd712b28ec2b4a15 | 7b5a744665462c985652bd05685b823a0c6d64f6 | /zttx-tradecore/src/main/java/com/zttx/web/module/brand/service/BrandLiceningServiceImpl.java | f3dabe9dd90c25c2cefe8fae3e2c14927577a044 | [] | no_license | isoundy000/zttx-trading | d8a7de3d846e1cc2eb0b193c31d45d36b04f7372 | 1eee959fcf1d460fe06dfcb7c79c218bcb6f5872 | refs/heads/master | 2021-01-14T01:07:42.580121 | 2016-01-10T04:12:40 | 2016-01-10T04:12:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,881 | java | /*
* Copyright 2015 Zttx, Inc. All rights reserved. 8637.com
* PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.zttx.web.module.brand.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zttx.sdk.core.GenericServiceApiImpl;
import com.zttx.web.module.brand.entity.BrandLicening;
import com.zttx.web.module.brand.mapper.BrandLiceningMapper;
/**
* 品牌授权证书 服务实现类
* <p>File:BrandLicening.java </p>
* <p>Title: BrandLicening </p>
* <p>Description:BrandLicening </p>
* <p>Copyright: Copyright (c) May 26, 2015</p>
* <p>Company: 8637.com</p>
* @author Playguy
* @version 1.0
*/
@Service
public class BrandLiceningServiceImpl extends GenericServiceApiImpl<BrandLicening> implements BrandLiceningService
{
private BrandLiceningMapper brandLiceningMapper;
@Autowired(required = true)
public BrandLiceningServiceImpl(BrandLiceningMapper brandLiceningMapper)
{
super(brandLiceningMapper);
this.brandLiceningMapper = brandLiceningMapper;
}
/**
* 根据品牌商编号和品牌编号批量修改删除标志为删除状态
* @author 陈建平
* @param brandId
* @param brandsId
*/
@Override
public void updateDelState(String brandId, String brandsId){
brandLiceningMapper.updateDelState(true,brandId, brandsId);
}
/**
* 根据品牌商编号、品牌编号、删除标志
* @author 陈建平
* @param brandId
* @param brandsId
* @param delState
* @return
*/
@Override
public List<BrandLicening> findByBrandsId(String brandId, String brandsId, Boolean delState){
return brandLiceningMapper.findByBrandsId(brandId, brandsId, delState);
}
}
| [
"ngds@maybedeMacBook-Air.local"
] | ngds@maybedeMacBook-Air.local |
3c485efdcf5f79953f547e916ac5963bc24586da | d84c02e48c1287c95f8fe115217a1dc486d843da | /core/src/com/dxenterprise/cumulus/unit_tests/unit_tests_model.java | 8404d558312ee8d81c13dab3dce13b92adff6f79 | [] | no_license | xfontes42/LPOO1617_T6G4 | fc836fe1e0f4990b3ed5c8650fc3351cb16cc7ca | 06c0d93abafa8b0bd3dc9f0aa54e61e8c8c54f55 | refs/heads/master | 2021-03-24T12:00:00.349924 | 2017-06-06T07:27:45 | 2017-06-06T07:27:45 | 82,287,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,259 | java | package com.dxenterprise.cumulus.unit_tests;
import com.dxenterprise.cumulus.controller.SinglePGameController;
import com.dxenterprise.cumulus.model.SinglePGameModel;
import com.dxenterprise.cumulus.model.entities.BirdModel;
import com.dxenterprise.cumulus.model.entities.CloudModel;
import com.dxenterprise.cumulus.model.entities.EntityModel;
import org.junit.Test;
import java.util.List;
/**
* Created by Xavier Fontes on 24/05/2017.
*/
public class unit_tests_model {
@Test
public void model_starts_game_not_losing(){
SinglePGameModel.getInstance();
boolean lost = SinglePGameModel.getInstance().isGame_lost();
assert(lost == false);
}
@Test
public void model_player_moved(){
float init_x = SinglePGameModel.getInstance().getPlayer().getX();
float init_y = SinglePGameModel.getInstance().getPlayer().getY();
SinglePGameModel.getInstance().update(0.5f);
float end_x = SinglePGameModel.getInstance().getPlayer().getX();
float end_y = SinglePGameModel.getInstance().getPlayer().getY();
assert(Math.sqrt(Math.pow((init_x-end_x),2) + Math.pow((init_y-end_y),2)) != 0);
}
@Test
public void model_add_cloud(){
SinglePGameModel.getInstance().update(0.5f);
assert(!SinglePGameModel.getInstance().isGame_lost());
int num_clouds = SinglePGameModel.getInstance().getClouds().size();
SinglePGameModel.getInstance().addCloud(10,10,0);
assert(SinglePGameModel.getInstance().getClouds().size() == (num_clouds+1));
}
@Test
public void model_player_lost(){
SinglePGameModel.getInstance().update(5f);
assert(SinglePGameModel.getInstance().isGame_lost());
}
@Test
public void model_add_random_clouds(){
for(int i = 0; i < 100 ; i++)
SinglePGameModel.getInstance().addCloud(i*100,i*2,0);
List<CloudModel> clouds = SinglePGameModel.getInstance().getClouds();
boolean small = false, medium = false, big = false;
for(int i = 0; i < clouds.size(); i++){
if(clouds.get(i).getSize() == CloudModel.CloudSize.SMALL){
small = true;
} else if(clouds.get(i).getSize() == CloudModel.CloudSize.MEDIUM){
medium = true;
} else if(clouds.get(i).getSize() == CloudModel.CloudSize.BIG){
big =true;
}
}
assert(small && medium && big);
}
@Test(timeout = 1000)
public void model_start_random_clouds(){
boolean small = false, medium = false, big = false;
while(!(small && medium && big)){
List<CloudModel> clouds = SinglePGameModel.getInstance().getClouds();
for(CloudModel c : clouds){
if(c.getSize() == CloudModel.CloudSize.SMALL){
small = true;
} else if(c.getSize() == CloudModel.CloudSize.MEDIUM){
medium = true;
} else if(c.getSize() == CloudModel.CloudSize.BIG){
big =true;
}
}
SinglePGameModel.getInstance().clear();
}
}
@Test
public void model_clearing(){
SinglePGameModel one = SinglePGameModel.getInstance();
SinglePGameModel two = SinglePGameModel.getInstance();
assert(one == two);
one.clear();
assert(one == two);
assert(one == null);
}
@Test
public void model_removing_cloud(){
List<CloudModel> clouds = SinglePGameModel.getInstance().getClouds();
int siz = clouds.size();
if(clouds.size() > 0)
SinglePGameModel.getInstance().remove(clouds.get(0));
assert(siz > SinglePGameModel.getInstance().getClouds().size());
}
@Test
public void model_starting_zero_score(){
SinglePGameModel.getInstance();
assert (SinglePGameModel.getInstance().getHighscore() == 0);
SinglePGameModel.getInstance().update(0.5f);
assert (SinglePGameModel.getInstance().getHighscore() != 0);
}
@Test
public void model_forcing_to_lose(){
SinglePGameModel.getInstance();
float x = SinglePGameModel.getInstance().getPlayer().getX();
SinglePGameModel.getInstance().updateLostCondition(x,x-10);
assert(SinglePGameModel.getInstance().isGame_lost()==false);
SinglePGameModel.getInstance().updateLostCondition(x,x+10);
assert (SinglePGameModel.getInstance().isGame_lost());
}
@Test
public void model_test_EntityModel(){
EntityModel player = SinglePGameModel.getInstance().getPlayer();
((EntityModel)player).getRotation();
((EntityModel)player).isFlaggedToBeRemoved();
}
@Test
public void model_test_BirdModel(){
EntityModel b = SinglePGameModel.getInstance().getPlayer();
float vx = b.getVx();
float vy = b.getVy();
float x = b.getX();
float y = b.getY();
assert(b.isFlaggedToBeRemoved()==false);
assert(b.getType() == EntityModel.ModelType.PLAYER);
assert(b.getRotation() == 0);
b.setRotation(0);
assert(b instanceof BirdModel);
if(!((BirdModel)b).isWalking())
((BirdModel)b).setWalking(true);
b.setPosition(x+10,y-40); //forcing falling out
b.setVx(vx+1);
b.setVy(vy-4);
SinglePGameModel.getInstance().update(0.5f);
assert(SinglePGameModel.getInstance().isGame_lost());
BirdModel bird = SinglePGameModel.getInstance().getPlayer();
bird.getType();
}
@Test
public void model_test_CloudModel(){
for(int i = 0; i < 100 ; i++)
SinglePGameModel.getInstance().addCloud(i*100,i*2,0);
List<CloudModel> clouds = SinglePGameModel.getInstance().getClouds();
boolean small = false, medium = false, big = false;
for(CloudModel c : clouds){
CloudModel.ModelType mod = c.getType();
if(mod == CloudModel.ModelType.SMALLCLOUD)
small = true;
else if (mod == CloudModel.ModelType.MEDIUMCLOUD)
medium = true;
else if (mod == CloudModel.ModelType.BIGCLOUD)
big = true;
}
assert(small && medium && big);
CloudModel c = new CloudModel(0,0,0,null);
CloudModel.ModelType mod = c.getType();
assert(mod == null);
}
@Test
public void model_test_highscore(){
SinglePGameModel.getInstance().getHighscore();
}
@Test
public void model_test_losing(){
assert(SinglePGameModel.getInstance().getHighscore() == 0);
SinglePGameModel.getInstance().setGame_lost(true);
SinglePGameModel.getInstance().update(0.5f);
assert(SinglePGameModel.getInstance().getHighscore() == 0);
}
@Test
public void model_test_double_jump(){
boolean jump = SinglePGameModel.getInstance().canJump();
assert(jump);
SinglePGameModel.getInstance().birdJump();
assert(jump);
SinglePGameModel.getInstance().birdJump();
assert(!jump);
SinglePGameModel.getInstance().resetJumps();
assert(jump);
}
}
| [
"up201503145@fe.up.pt"
] | up201503145@fe.up.pt |
0a0f8cc501b20cbe18150325db0bbe84b88099f6 | 44e71a9b49053703ef972b5349ffbadaf8874c26 | /src/main/java/com/ua/knuca/committee/mapper/SubjectMapper.java | 976f493f0463adb1a5d5e0a3ec21c3a3548e60d3 | [] | no_license | brmdm/committe | c62510c7fb979655040bcdf3b690fa01d406113a | 8280cd699c19f30298471fd6f824318b7f3a7915 | refs/heads/master | 2023-02-21T16:07:14.970404 | 2021-01-26T10:39:28 | 2021-01-26T10:39:28 | 327,282,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.ua.knuca.committee.mapper;
import com.ua.knuca.committee.dto.SubjectDTO.SubjectDTO;
import com.ua.knuca.committee.entity.SubjectEntity;
import org.mapstruct.Mapper;
@Mapper(componentModel = "spring")
public interface SubjectMapper {
SubjectDTO toSubjectDTO(SubjectEntity subjectEntity);
}
| [
"60578980+brmdm@users.noreply.github.com"
] | 60578980+brmdm@users.noreply.github.com |
80248d46403153361025c85a62381aea0094c113 | 015dd069c70e9d3ba69b731bb298a59282e830bd | /classifiers/trees/j48/EntropySplitCrit.java | 4991ae5400920d818e830e4ad3cbc4e6397bce5e | [] | no_license | gaepury/chadolbagi | 2bc5cb6368cecbdd5140b60ed37ff4d3882e90ba | e89f591475aa68b7024039f6fd5243c9873bc1f7 | refs/heads/master | 2021-08-14T06:08:08.008997 | 2017-11-14T18:59:21 | 2017-11-14T18:59:21 | 107,370,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,481 | java | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* EntropySplitCrit.java
* Copyright (C) 1999 University of Waikato, Hamilton, New Zealand
*
*/
package com.example.g.cardet.classifiers.trees.j48;
import com.example.g.cardet.core.RevisionUtils;
import com.example.g.cardet.core.Utils;
/**
* Class for computing the entropy for a given distribution.
*
* @author Eibe Frank (eibe@cs.waikato.ac.nz)
* @version $Revision: 1.8 $
*/
public final class EntropySplitCrit
extends EntropyBasedSplitCrit {
/** for serialization */
private static final long serialVersionUID = 5986252682266803935L;
/**
* Computes entropy for given distribution.
*/
public final double splitCritValue(Distribution bags) {
return newEnt(bags);
}
/**
* Computes entropy of test distribution with respect to training distribution.
*/
public final double splitCritValue(Distribution train, Distribution test) {
double result = 0;
int numClasses = 0;
int i, j;
// Find out relevant number of classes
for (j = 0; j < test.numClasses(); j++)
if (Utils.gr(train.perClass(j), 0) || Utils.gr(test.perClass(j), 0))
numClasses++;
// Compute entropy of test data with respect to training data
for (i = 0; i < test.numBags(); i++)
if (Utils.gr(test.perBag(i),0)) {
for (j = 0; j < test.numClasses(); j++)
if (Utils.gr(test.perClassPerBag(i, j), 0))
result -= test.perClassPerBag(i, j)*
Math.log(train.perClassPerBag(i, j) + 1);
result += test.perBag(i) * Math.log(train.perBag(i) + numClasses);
}
return result / log2;
}
/**
* Returns the revision string.
*
* @return the revision
*/
public String getRevision() {
return RevisionUtils.extract("$Revision: 1.8 $");
}
}
| [
"github.com/gaepury"
] | github.com/gaepury |
2cb2d934cb3f60b318d4237a60d595bfd71bb2dd | 13275cf0603fe67baed96a041a12c7ad7df305ed | /src/com/javarush/test/level03/lesson06/task01/Solution.java | c4ce9f57ee1acb1b15cb1a4121adfa9485c12571 | [] | no_license | DragFAQ/javarush | de0b4cd95c055f6f9bf44c8fe864e603cdfec326 | fa713df3c22d0dede5fe8bf3bf6459be13f52013 | refs/heads/master | 2020-07-09T14:39:35.467497 | 2017-02-07T23:36:47 | 2017-02-07T23:36:47 | 74,016,967 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 910 | java | package com.javarush.test.level03.lesson06.task01;
/* Мама мыла раму
Вывести на экран все возможные комбинации слов «Мама», «Мыла», «Раму».
Подсказка: их 6 штук. Каждую комбинацию вывести с новой строки. Слова не разделять. Пример:
МылаРамуМама
РамуМамаМыла
...
*/
public class Solution
{
public static void main(String[] args)
{
//напишите тут ваш код
String m1 = "Мама",
m2 = "Мыла",
m3 = "Раму";
System.out.println(m1 + m2 + m3);
System.out.println(m1 + m3 + m2);
System.out.println(m2 + m1 + m3);
System.out.println(m2 + m3 + m1);
System.out.println(m3 + m1 + m2);
System.out.println(m3 + m2 + m1);
}
} | [
"drag.faq@gmail.com"
] | drag.faq@gmail.com |
41a15990a1103e234bc83464a4792297af8b2557 | a210b3075a0a686ee1d2379e4db35aeeb74f9df1 | /MyHospital/app/src/main/java/fr/vfrz/myhospital/viewmodel/HospitalBedViewModel.java | 120706beae1bc796cb74590ee5d079f5e9872079 | [] | no_license | vfrz/MyHospital | 772a580b54d47228438301327eb25b06608fe5fd | 0f6ed1bd57c9b2fc13099e6961ed35116db3e63c | refs/heads/master | 2023-02-22T02:02:18.537663 | 2021-01-31T15:48:56 | 2021-01-31T15:48:56 | 315,904,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java | package fr.vfrz.myhospital.viewmodel;
import android.app.Application;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import java.util.List;
import fr.vfrz.myhospital.database.HospitalBedRepository;
import fr.vfrz.myhospital.model.HospitalBed;
public class HospitalBedViewModel extends AndroidViewModel {
private final HospitalBedRepository repository;
public HospitalBedViewModel(Application application) {
super(application);
repository = new HospitalBedRepository(application);
}
public Long insert(HospitalBed bed) {
return repository.insert(bed);
}
public LiveData<List<HospitalBed>> getForService(long serviceId) {
return repository.getForService(serviceId);
}
}
| [
"fritz.valentin@live.fr"
] | fritz.valentin@live.fr |
f7c989dad148a3493308ec3ec5f3cfc2671cca72 | 12608b7ddd2502b9cb98345ea8efeb7de42eeba5 | /hero-of-zap/Chest.java | 409ac1ab627d28f0475c3a060da6defd27ce88f2 | [] | no_license | klauswuestefeld/zap | 09369c14cbf14ab1da8baa30998c35b3a24c7245 | acf4dcf6f01a89a8ed59fc8dc22ca722c6e7e352 | refs/heads/master | 2016-09-05T19:45:29.690926 | 2014-11-02T20:50:58 | 2014-11-02T20:50:58 | 6,762,401 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29 | java | class Chest extends Thing {}
| [
"klauswuestefeld@gmail.com"
] | klauswuestefeld@gmail.com |
342132ad965604af53eaee4e519384271c6a4600 | 311d9d10de39d7797b7b2c5dd0d695c494227706 | /encuestas/src/main/java/ws/synopsis/surveys/utils/InstructorDB.java | 3b8187b9abd36b499defffd1450c875d45b079c3 | [] | no_license | msrasheed/synopsis-surveys | 24270d18888eac69c27128c045bb7637326e4dbb | b4d6afd6452a15f2f973e9c8655fa7bbd975ef8a | refs/heads/master | 2020-06-01T11:39:50.361531 | 2019-07-18T16:31:40 | 2019-07-18T16:31:40 | 190,766,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,316 | java | package ws.synopsis.surveys.utils;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.TypedQuery;
import ws.synopsis.surveys.model.Instructor;
public class InstructorDB {
public static boolean checkCredentials(String username, String password) {
if(checkUsernameExists(username) == true) {
if(checkPasswordMatches(username, password) == true) return true;
}
return false;
}
public static boolean checkPasswordMatches(String username, String password) {
EntityManager em = EntityMan.getEmFactory().createEntityManager();
String qString = "SELECT e " +
"FROM Instructor as e " +
"WHERE e.username = :username";
TypedQuery<Instructor> q = em.createQuery(qString, Instructor.class);
q.setParameter("user", username);
try {
if(q.getSingleResult().getPassword().equals(password)) return true;
return false;
} finally {
em.close();
}
}
public static boolean checkUsernameExists(String username) {
EntityManager em = EntityMan.getEmFactory().createEntityManager();
String qString = "SELECT e.username " +
"FROM Instructor as e " +
"WHERE e.username = :username";
TypedQuery<String> q = em.createQuery(qString, String.class);
q.setParameter("username", username);
try {
if(q.getSingleResult() != null) return true;
return false;
} finally {
em.close();
}
}
public static Instructor getInstructorByUsername(String username) {
EntityManager em = EntityMan.getEmFactory().createEntityManager();
String qString ="SELECT e " +
"FROM Instructor e " +
"WHERE e.username = :username";
TypedQuery<Instructor> q = em.createQuery(qString, Instructor.class);
q.setParameter("username", username);
try {
return q.getSingleResult();
} finally {
em.close();
}
}
public static String getPasswordByUsername(String username) {
EntityManager em = EntityMan.getEmFactory().createEntityManager();
String qString = "SELECT e.contrasena " +
"FROM Instructor as e " +
"WHERE e.username = :username";
TypedQuery<String> q = em.createQuery(qString, String.class);
q.setParameter("username", username);
try {
return q.getSingleResult();
} finally {
em.close();
}
}
public static boolean insertInstructor(Instructor Instructor) {
boolean isSuccessful = false;
EntityManager em = EntityMan.getEmFactory().createEntityManager();
EntityTransaction trans = em.getTransaction();
try {
trans.begin();
System.out.println("begin");
em.persist(Instructor);
System.out.println("persist");
trans.commit();
System.out.println("commit");
isSuccessful = true;
System.out.println(isSuccessful);
} catch (Exception e) {
System.out.println(e);
trans.rollback();
isSuccessful = false;
}finally {
em.close();
}
return isSuccessful;
}
public static boolean mergeInstructor(Instructor Instructor) {
boolean isSuccessful = false;
EntityManager em = EntityMan.getEmFactory().createEntityManager();
EntityTransaction trans = em.getTransaction();
try {
trans.begin();
em.merge(Instructor);
trans.commit();
isSuccessful = true;
} catch (Exception e) {
trans.rollback();
isSuccessful = false;
}finally {
em.close();
}
return isSuccessful;
}
}
| [
"cjbrookins438@gmail.com"
] | cjbrookins438@gmail.com |
9a5018879a3a20a61f4e4d83c301ef695c920a22 | 291d72b7f096d759014e1c4fbffc67f8c7c0c249 | /src/Example10_22/JDKWindow.java | f2fc3a95fad1ce6a38ee2817733fe1ccd153016a | [] | no_license | zyhang8/java_rookie_notes | a1d5bdf0ef84cf606ea80f2292e0ff391f6f37ce | c3c23e9c6782954994bb12b0acb5a8a4c9cb4e77 | refs/heads/master | 2020-04-26T17:25:06.615744 | 2019-03-16T13:39:42 | 2019-03-16T13:39:42 | 173,712,579 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,239 | java |
// java课本例题,供学习实验;
// 参考自课本附带代码.
// 后面会持续更新详细注释说明,有意合作请联系我.--ylin
// "我爱学习,学习也爱我."专用水印.
package Example10_22;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
public class JDKWindow extends JFrame {
JTextField javaSourceFileName; //输入Java源文件
JTextField javaMainClassName; //输入主类名
JButton compile,run,edit;
HandleActionEvent listener;
public JDKWindow(){
edit = new JButton("用记事本编辑源文件");
compile = new JButton("编译");
run = new JButton("运行");
javaSourceFileName = new JTextField(10);
javaMainClassName = new JTextField(10);
setLayout(new FlowLayout());
add(edit);
add(new JLabel("输入源文件名:"));
add(javaSourceFileName);
add(compile);
add(new JLabel("输入主类名:"));
add(javaMainClassName);
add(run);
listener = new HandleActionEvent();
edit.addActionListener(listener);
compile.addActionListener(listener);
run.addActionListener(listener);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100,100,750,180);
}
class HandleActionEvent implements ActionListener { //内部类实例做监视器
public void actionPerformed(ActionEvent e) {
if(e.getSource()==edit) {
Runtime ce=Runtime.getRuntime();
String name = javaSourceFileName.getText();
File file=new File("c:/windows","Notepad.exe "+name);
try{
ce.exec(file.getAbsolutePath());
}
catch(Exception exp){}
}
else if(e.getSource()==compile) {
CompileDialog compileDialog = new CompileDialog();
String name = javaSourceFileName.getText();
compileDialog.compile(name);
compileDialog.setVisible(true);
}
else if(e.getSource()==run) {
RunDialog runDialog =new RunDialog();
String name = javaMainClassName.getText();
runDialog.run(name);
runDialog.setVisible(true);
}
}
}
}
| [
"1023708557@qq.com"
] | 1023708557@qq.com |
1409ce17df97ec7cf11b9d4573da4231d61e4d75 | c867dfb43e064b3e779638205fa6b80ada559ac7 | /src/arraysfillex/ArraysFillExTest.java | 948c42b3f2f3896ab81ebde55f13052673e93538 | [] | no_license | java-beginner/arrays-fill-ex | 8678009b8dabddaae170e63e0e0f9631f5fac3f8 | 779e53ca19c740c40096e60b233e8f332a97869c | refs/heads/master | 2020-04-18T05:03:00.085252 | 2016-09-03T04:12:39 | 2016-09-03T04:12:39 | 67,258,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,733 | java | package arraysfillex;
import java.util.Arrays;
public class ArraysFillExTest {
public static void main(String[] args) {
// 配列定義で初期化後にfill
testBoolean();
System.out.println();
testChar();
System.out.println();
testByte();
System.out.println();
testShort();
System.out.println();
testInt();
System.out.println();
testLong();
System.out.println();
testFloat();
System.out.println();
testDouble();
System.out.println();
testString();
System.out.println();
// 配列定義のみでfill
testIntegerInit();
System.out.println();
testStringInit();
System.out.println();
// 他のクラス
System.out.println("他のクラス");
testHint();
System.out.println();
// 配列以外を渡す
System.out.println("配列以外を渡す");
try {
ArraysFillEx.fill(1, 2);
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
}
// クラスが異なる
System.out.println("クラスが異なる");
try {
ArraysFillEx.fill(new String[3], new Hint(1));
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
private static void testBoolean() {
boolean[][][] array = {
{ {true, true, true}, {true, true} },
{ {true, true, true}, {true} }
};
System.out.println("boolean初期化前");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
ArraysFillEx.fill(array, false);
System.out.println("boolean初期化後");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
}
private static void testChar() {
char[][][] array = {
{ {'a', 'b', 'c'}, {'d', 'e'} },
{ {'f', 'g', 'h'}, {'i'} }
};
System.out.println("char初期化前");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
ArraysFillEx.fill(array, 'z');
System.out.println("char初期化後");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
}
private static void testByte() {
byte[][][] array = {
{ {0, 1, 2}, {3, 4} },
{ {5, 6, 7}, {8} }
};
System.out.println("byte初期化前");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
ArraysFillEx.fill(array, Byte.MAX_VALUE);
System.out.println("byte初期化後");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
}
private static void testShort() {
short[][][] array = {
{ {1, 2, 3}, {4, 5} },
{ {6, 7, 8}, {9} }
};
System.out.println("short初期化前");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
ArraysFillEx.fill(array, Short.MAX_VALUE);
System.out.println("short初期化後");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
}
private static void testInt() {
int[][][] array = {
{ {1, 2, 3}, {4, 5} },
{ {6, 7, 8}, {9} }
};
System.out.println("int初期化前");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
ArraysFillEx.fill(array, Integer.MAX_VALUE);
System.out.println("int初期化後");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
}
private static void testLong() {
long[][][] array = {
{ {1, 2, 3}, {4, 5} },
{ {6, 7, 8}, {9} }
};
System.out.println("long初期化前");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
ArraysFillEx.fill(array, Long.MAX_VALUE);
System.out.println("long初期化後");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
}
private static void testFloat() {
float[][][] array = {
{ {1f, 2f, 3f}, {4f, 5f} },
{ {6f, 7f, 8f}, {9f} }
};
System.out.println("float初期化前");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
ArraysFillEx.fill(array, Float.MAX_VALUE);
System.out.println("float初期化後");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
}
private static void testDouble() {
double[][][] array = {
{ {1d, 2d, 3d}, {4d, 5d, 6d} },
{ {7d, 8d, 9d}, {10d, 11d, 12d} }
};
System.out.println("double初期化前");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
ArraysFillEx.fill(array, 3.14);
System.out.println("double初期化後");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
}
private static void testString() {
String[][][] array = {
{ {"a", "b", "c"}, {"d", "e", "f"} },
{ {"g", "h", "i"}, {"j", "k", "l"} }
};
System.out.println("String初期化前");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
ArraysFillEx.fill(array, "zzzz");
System.out.println("String初期化後");
System.out.println(Arrays.toString(array[0][0]));
System.out.println(Arrays.toString(array[0][1]));
System.out.println(Arrays.toString(array[1][0]));
System.out.println(Arrays.toString(array[1][1]));
}
private static void testIntegerInit() {
int[][][] array = new int[3][2][4];
System.out.println("int初期化前");
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.printf("%d, %d, %s", i, j, Arrays.toString(array[i][j]));
System.out.println();
}
}
ArraysFillEx.fill(array, -1);
System.out.println("int初期化後");
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.printf("%d, %d, %s", i, j, Arrays.toString(array[i][j]));
System.out.println();
}
}
}
private static void testStringInit() {
String[][][] array = new String[3][2][4];
System.out.println("String初期化前");
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.printf("%d, %d, %s", i, j, Arrays.toString(array[i][j]));
System.out.println();
}
}
ArraysFillEx.fill(array, "Dummy");
System.out.println("String初期化後");
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.printf("%d, %d, %s", i, j, Arrays.toString(array[i][j]));
System.out.println();
}
}
}
private static void testHint() {
Hint[][][] array = new Hint[2][3][4];
System.out.println("Hint初期化前");
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.printf("%d, %d, %s", i, j, Arrays.toString(array[i][j]));
System.out.println();
}
}
ArraysFillEx.fill(array, new Hint(3));
System.out.println("Hint初期化後");
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
System.out.printf("%d, %d, %s", i, j, Arrays.toString(array[i][j]));
System.out.println();
}
}
}
}
| [
"work-java-beginner@java-beginner.com"
] | work-java-beginner@java-beginner.com |
8f9650166648645e33aa127d5fd4bd91ea619c5f | 8a3ef21e776258ac88d34a8507d22ea78aaa88a2 | /spring-cloud-contract-verifier/src/main/groovy/org/springframework/cloud/contract/verifier/builder/JaxRsRequestWhen.java | 08213d79ac1c38bdd21961cf9c0b980f6c760f91 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | Sounie/spring-cloud-contract | 2cf5bf145fb5aa9b3b9808cb9cf4fd93d053f601 | ae9436e5d217619ec462ace835446a0796e1f8ae | refs/heads/master | 2020-11-28T13:41:53.634192 | 2019-12-23T22:51:56 | 2019-12-23T22:51:56 | 229,700,852 | 0 | 0 | Apache-2.0 | 2019-12-23T07:33:33 | 2019-12-23T07:33:32 | null | UTF-8 | Java | false | false | 2,435 | java | /*
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://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.springframework.cloud.contract.verifier.builder;
import org.springframework.cloud.contract.spec.internal.Header;
import org.springframework.cloud.contract.spec.internal.Request;
import org.springframework.cloud.contract.verifier.file.SingleContractMetadata;
import org.springframework.cloud.contract.verifier.util.MapConverter;
import org.springframework.util.StringUtils;
class JaxRsRequestWhen implements When, JaxRsAcceptor, QueryParamsResolver {
private final BlockBuilder blockBuilder;
private final GeneratedClassMetaData generatedClassMetaData;
JaxRsRequestWhen(BlockBuilder blockBuilder, GeneratedClassMetaData metaData) {
this.blockBuilder = blockBuilder;
this.generatedClassMetaData = metaData;
}
@Override
public MethodVisitor<When> apply(SingleContractMetadata metadata) {
appendRequestWithRequiredResponseContentType(metadata.getContract().getRequest());
return this;
}
void appendRequestWithRequiredResponseContentType(Request request) {
String acceptHeader = getHeader(request, "Accept");
if (StringUtils.hasText(acceptHeader)) {
this.blockBuilder.addIndented(".request(\"" + acceptHeader + "\")");
}
else {
this.blockBuilder.addIndented(".request()");
}
}
private String getHeader(Request request, String name) {
if (request.getHeaders() == null || request.getHeaders().getEntries() == null) {
return "";
}
Header foundHeader = request.getHeaders().getEntries().stream()
.filter(header -> name.equals(header.getName())).findFirst().orElse(null);
if (foundHeader == null) {
return "";
}
return MapConverter.getTestSideValuesForNonBody(foundHeader.getServerValue())
.toString();
}
@Override
public boolean accept(SingleContractMetadata metadata) {
return acceptType(this.generatedClassMetaData, metadata);
}
}
| [
"noreply@github.com"
] | Sounie.noreply@github.com |
777dd0e56718aaf9a854f1787b8c4f4faebba5d3 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/14/14_1c9c818a30bb811c95b3d22db2dd8fb0d7765a3c/FlacTag/14_1c9c818a30bb811c95b3d22db2dd8fb0d7765a3c_FlacTag_s.java | 0419c736c7169e6d00d9119df987e2f67e4d19c8 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 13,914 | java | package org.jaudiotagger.tag.flac;
import org.jaudiotagger.audio.flac.metadatablock.MetadataBlockDataPicture;
import org.jaudiotagger.audio.generic.Utils;
import org.jaudiotagger.tag.*;
import org.jaudiotagger.tag.datatype.Artwork;
import org.jaudiotagger.tag.id3.valuepair.ImageFormats;
import org.jaudiotagger.tag.id3.valuepair.TextEncoding;
import org.jaudiotagger.tag.reference.PictureTypes;
import org.jaudiotagger.tag.vorbiscomment.VorbisCommentTag;
import org.jaudiotagger.tag.vorbiscomment.VorbisCommentFieldKey;
import org.jaudiotagger.tag.vorbiscomment.VorbisCommentTagField;
import org.jaudiotagger.logging.ErrorMessage;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Flac uses Vorbis Comment for most of its metadata and a Flac Picture Block for images
* <p/>
* <p/>
* This class enscapulates the items into a single tag
*/
public class FlacTag implements Tag
{
private VorbisCommentTag tag = null;
private List<MetadataBlockDataPicture> images = new ArrayList<MetadataBlockDataPicture>();
public FlacTag(VorbisCommentTag tag, List<MetadataBlockDataPicture> images)
{
this.tag = tag;
this.images = images;
}
/**
* @return images
*/
public List<MetadataBlockDataPicture> getImages()
{
return images;
}
/**
* @return the vorbis tag (this is what handles text metadata)
*/
public VorbisCommentTag getVorbisCommentTag()
{
return tag;
}
public void addField(TagField field) throws FieldDataInvalidException
{
if (field instanceof MetadataBlockDataPicture)
{
images.add((MetadataBlockDataPicture) field);
}
else
{
tag.addField(field);
}
}
public List<TagField> get(String id)
{
if (id.equals(FieldKey.COVER_ART.name()))
{
List<TagField> castImages = new ArrayList<TagField>();
for (MetadataBlockDataPicture image : images)
{
castImages.add(image);
}
return castImages;
}
else
{
return tag.get(id);
}
}
public boolean hasCommonFields()
{
return tag.hasCommonFields();
}
public boolean hasField(String id)
{
if (id.equals(FieldKey.COVER_ART.name()))
{
return images.size() > 0;
}
else
{
return tag.hasField(id);
}
}
/**
* Determines whether the tag has no fields specified.<br>
* <p/>
* <p>If there are no images we return empty if either there is no VorbisTag or if there is a
* VorbisTag but it is empty
*
* @return <code>true</code> if tag contains no field.
*/
public boolean isEmpty()
{
return (tag == null || tag.isEmpty()) && images.size() == 0;
}
public void setField(FieldKey genericKey, String value) throws KeyNotFoundException, FieldDataInvalidException
{
TagField tagfield = createField(genericKey,value);
setField(tagfield);
}
public void addField(FieldKey genericKey, String value) throws KeyNotFoundException, FieldDataInvalidException
{
TagField tagfield = createField(genericKey,value);
addField(tagfield);
}
/**
* Create and set field with name of vorbisCommentkey
*
* @param vorbisCommentKey
* @param value
* @throws KeyNotFoundException
* @throws FieldDataInvalidException
*/
public void setField(String vorbisCommentKey, String value) throws KeyNotFoundException, FieldDataInvalidException
{
TagField tagfield = createField(vorbisCommentKey,value);
setField(tagfield);
}
/**
* Create and add field with name of vorbisCommentkey
* @param vorbisCommentKey
* @param value
* @throws KeyNotFoundException
* @throws FieldDataInvalidException
*/
public void addField(String vorbisCommentKey, String value) throws KeyNotFoundException, FieldDataInvalidException
{
TagField tagfield = createField(vorbisCommentKey,value);
addField(tagfield);
}
/**
* @param field
* @throws FieldDataInvalidException
*/
public void setField(TagField field) throws FieldDataInvalidException
{
if (field instanceof MetadataBlockDataPicture)
{
if (images.size() == 0)
{
images.add(0, (MetadataBlockDataPicture) field);
}
else
{
images.set(0, (MetadataBlockDataPicture) field);
}
}
else
{
tag.setField(field);
}
}
public TagField createField(FieldKey genericKey, String value) throws KeyNotFoundException, FieldDataInvalidException
{
if (genericKey.equals(FieldKey.COVER_ART))
{
throw new UnsupportedOperationException(ErrorMessage.ARTWORK_CANNOT_BE_CREATED_WITH_THIS_METHOD.getMsg());
}
else
{
return tag.createField(genericKey, value);
}
}
/**
* Create Tag Field using ogg key
*
* @param vorbisCommentFieldKey
* @param value
* @return
* @throws org.jaudiotagger.tag.KeyNotFoundException
* @throws org.jaudiotagger.tag.FieldDataInvalidException
*/
public TagField createField(VorbisCommentFieldKey vorbisCommentFieldKey, String value) throws KeyNotFoundException,FieldDataInvalidException
{
if (vorbisCommentFieldKey.equals(VorbisCommentFieldKey.COVERART))
{
throw new UnsupportedOperationException(ErrorMessage.ARTWORK_CANNOT_BE_CREATED_WITH_THIS_METHOD.getMsg());
}
return tag.createField(vorbisCommentFieldKey,value);
}
/**
* Create Tag Field using ogg key
* <p/>
* This method is provided to allow you to create key of any value because VorbisComment allows
* arbitary keys.
*
* @param vorbisCommentFieldKey
* @param value
* @return
*/
public TagField createField(String vorbisCommentFieldKey, String value)
{
if (vorbisCommentFieldKey.equals(VorbisCommentFieldKey.COVERART.getFieldName()))
{
throw new UnsupportedOperationException(ErrorMessage.ARTWORK_CANNOT_BE_CREATED_WITH_THIS_METHOD.getMsg());
}
return tag.createField(vorbisCommentFieldKey,value);
}
public String getFirst(String id)
{
if (id.equals(FieldKey.COVER_ART.name()))
{
throw new UnsupportedOperationException(ErrorMessage.ARTWORK_CANNOT_BE_CREATED_WITH_THIS_METHOD.getMsg());
}
else
{
return tag.getFirst(id);
}
}
public String getFirst(FieldKey id) throws KeyNotFoundException
{
if (id.equals(FieldKey.COVER_ART))
{
throw new UnsupportedOperationException(ErrorMessage.ARTWORK_CANNOT_BE_RETRIEVED_WITH_THIS_METHOD.getMsg());
}
else
{
return tag.getFirst(id);
}
}
public TagField getFirstField(String id)
{
if (id.equals(FieldKey.COVER_ART.name()))
{
if (images.size() > 0)
{
return images.get(0);
}
else
{
return null;
}
}
else
{
return tag.getFirstField(id);
}
}
public TagField getFirstField(FieldKey genericKey) throws KeyNotFoundException
{
if (genericKey == null)
{
throw new KeyNotFoundException();
}
if(genericKey == FieldKey.COVER_ART )
{
return getFirstField(FieldKey.COVER_ART.name());
}
else
{
return tag.getFirstField(genericKey);
}
}
/**
* Delete any instance of tag fields with this key
*
* @param fieldKey
*/
public void deleteField(FieldKey fieldKey) throws KeyNotFoundException
{
if (fieldKey.equals(FieldKey.COVER_ART))
{
images.clear();
}
else
{
tag.deleteField(fieldKey);
}
}
//TODO addField images to iterator
public Iterator<TagField> getFields()
{
return tag.getFields();
}
public int getFieldCount()
{
return tag.getFieldCount() + images.size();
}
public boolean setEncoding(String enc) throws FieldDataInvalidException
{
return tag.setEncoding(enc);
}
public List<TagField> getFields(FieldKey id) throws KeyNotFoundException
{
if (id.equals(FieldKey.COVER_ART))
{
List<TagField> castImages = new ArrayList<TagField>();
for (MetadataBlockDataPicture image : images)
{
castImages.add(image);
}
return castImages;
}
else
{
return tag.getFields(id);
}
}
public TagField createArtworkField(byte[] imageData, int pictureType, String mimeType, String description, int width, int height, int colourDepth, int indexedColouredCount) throws FieldDataInvalidException
{
return new MetadataBlockDataPicture(imageData, pictureType, mimeType, description, width, height, colourDepth, indexedColouredCount);
}
/**
* Create Artwork when have the bufferedimage
*
* @param bi
* @param pictureType
* @param mimeType
* @param description
* @param colourDepth
* @param indexedColouredCount
* @return
* @throws FieldDataInvalidException
*/
public TagField createArtworkField(BufferedImage bi, int pictureType, String mimeType, String description, int colourDepth, int indexedColouredCount) throws FieldDataInvalidException
{
//Convert to byte array
try
{
final ByteArrayOutputStream output = new ByteArrayOutputStream();
ImageIO.write(bi, ImageFormats.getFormatForMimeType(mimeType), new DataOutputStream(output));
//Add to image list
return new MetadataBlockDataPicture(output.toByteArray(), pictureType, mimeType, description, bi.getWidth(), bi.getHeight(), colourDepth, indexedColouredCount);
}
catch (IOException ioe)
{
throw new FieldDataInvalidException("Unable to convert image to bytearray, check mimetype parameter");
}
}
/**
* Create Link to Image File, not recommended because if either flac or image file is moved link
* will be broken.
* @param url
* @return
*/
public TagField createLinkedArtworkField(String url)
{
//Add to image list
return new MetadataBlockDataPicture(Utils.getDefaultBytes(url, TextEncoding.CHARSET_ISO_8859_1), PictureTypes.DEFAULT_ID, MetadataBlockDataPicture.IMAGE_IS_URL, "", 0, 0, 0, 0);
}
/**
* Create artwork field
*
* @return
*/
public TagField createField(Artwork artwork) throws FieldDataInvalidException
{
if(artwork.isLinked())
{
return new MetadataBlockDataPicture(
Utils.getDefaultBytes(artwork.getImageUrl(), TextEncoding.CHARSET_ISO_8859_1),
artwork.getPictureType(),
MetadataBlockDataPicture.IMAGE_IS_URL,
"",
0,
0,
0,
0);
}
else
{
BufferedImage image;
try
{
image = artwork.getImage();
}
catch(IOException ioe)
{
throw new FieldDataInvalidException("Unable to createField bufferd image from the image");
}
return new MetadataBlockDataPicture(artwork.getBinaryData(),
artwork.getPictureType(),
artwork.getMimeType(),
artwork.getDescription(),
image.getWidth(),
image.getHeight(),
0,
0);
}
}
public void setField(Artwork artwork) throws FieldDataInvalidException
{
this.setField(createField(artwork));
}
public void addField(Artwork artwork) throws FieldDataInvalidException
{
this.addField(createField(artwork));
}
public List<Artwork> getArtworkList()
{
List<Artwork> artworkList = new ArrayList<Artwork>(images.size());
for(MetadataBlockDataPicture coverArt:images)
{
Artwork artwork=Artwork.createArtworkFromMetadataBlockDataPicture(coverArt);
}
return artworkList;
}
public Artwork getFirstArtwork()
{
List<Artwork> artwork = getArtworkList();
if(artwork.size()>0)
{
return artwork.get(0);
}
return null;
}
/**
* Delete all instance of artwork Field
*
* @throws KeyNotFoundException
*/
public void deleteArtworkField() throws KeyNotFoundException
{
this.deleteField(FieldKey.COVER_ART);
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
b09f466bb58ac7a2e5e0891ab16287817bfad6c8 | eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3 | /tags/2007-11-30/seasar2-2.4.18-rc3/seasar2/s2-framework/src/test/java/org/seasar/framework/container/impl/ComponentDefImplTest.java | 3d4e00a0f3ba9a20051c8c21ebf24f1beaede0ad | [
"Apache-2.0"
] | permissive | svn2github/s2container | 54ca27cf0c1200a93e1cb88884eb8226a9be677d | 625adc6c4e1396654a7297d00ec206c077a78696 | refs/heads/master | 2020-06-04T17:15:02.140847 | 2013-08-09T09:38:15 | 2013-08-09T09:38:15 | 10,850,644 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,032 | java | /*
* Copyright 2004-2007 the Seasar Foundation and the Others.
*
* 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.seasar.framework.container.impl;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.HashMap;
import junit.framework.TestCase;
import org.seasar.framework.aop.interceptors.TraceInterceptor;
import org.seasar.framework.container.ComponentDef;
import org.seasar.framework.container.InitMethodDef;
import org.seasar.framework.container.S2Container;
import org.seasar.framework.container.ognl.OgnlExpression;
/**
* @author higa
*
*/
public class ComponentDefImplTest extends TestCase {
/**
* @throws Exception
*/
public void testGetComponentForType3() throws Exception {
S2Container container = new S2ContainerImpl();
ComponentDefImpl cd = new ComponentDefImpl(A.class);
container.register(cd);
container.register(B.class);
A a = (A) container.getComponent(A.class);
assertEquals("1", "B", a.getHogeName());
assertSame("2", a, container.getComponent(A.class));
}
/**
* @throws Exception
*/
public void testGetComponentForType2() throws Exception {
S2Container container = new S2ContainerImpl();
ComponentDefImpl cd = new ComponentDefImpl(A2.class);
container.register(cd);
container.register(B.class);
A2 a2 = (A2) container.getComponent(A2.class);
assertEquals("1", "B", a2.getHogeName());
}
/**
* @throws Exception
*/
public void testGetComponentForArgDef() throws Exception {
S2Container container = new S2ContainerImpl();
ComponentDefImpl cd = new ComponentDefImpl(BigDecimal.class, "num");
cd.addArgDef(new ArgDefImpl("123"));
container.register(cd);
assertEquals("1", new BigDecimal(123), container.getComponent("num"));
}
/**
* @throws Exception
*/
public void testGetComponentForProperyDef() throws Exception {
S2Container container = new S2ContainerImpl();
ComponentDefImpl cd = new ComponentDefImpl(A2.class);
cd.addPropertyDef(new PropertyDefImpl("hoge", new B()));
container.register(cd);
A2 a2 = (A2) container.getComponent(A2.class);
assertEquals("1", "B", a2.getHogeName());
}
/**
* @throws Exception
*/
public void testGetComponentForMethodDef() throws Exception {
S2Container container = new S2ContainerImpl();
ComponentDefImpl cd = new ComponentDefImpl(HashMap.class, "myMap");
InitMethodDef md = new InitMethodDefImpl("put");
md.addArgDef(new ArgDefImpl("aaa"));
md.addArgDef(new ArgDefImpl("hoge"));
cd.addInitMethodDef(md);
container.register(cd);
HashMap myMap = (HashMap) container.getComponent("myMap");
assertEquals("1", "hoge", myMap.get("aaa"));
}
/**
* @throws Exception
*/
public void testGetComponentForAspectDef() throws Exception {
S2Container container = new S2ContainerImpl();
ComponentDefImpl cd = new ComponentDefImpl(A.class);
cd.addAspectDef(new AspectDefImpl(new TraceInterceptor()));
container.register(cd);
container.register(B.class);
A a = (A) container.getComponent(A.class);
assertEquals("1", "B", a.getHogeName());
}
/**
* @throws Exception
*/
public void testGetComponentForExpression() throws Exception {
S2Container container = new S2ContainerImpl();
container.register(Object.class, "obj");
ComponentDefImpl cd = new ComponentDefImpl(null, "hash");
cd.setExpression(new OgnlExpression("obj.hashCode()"));
container.register(cd);
assertNotNull("1", container.getComponent("hash"));
}
/**
* @throws Exception
*/
public void testCyclicReference() throws Exception {
S2Container container = new S2ContainerImpl();
container.register(A2.class);
container.register(C.class);
A2 a2 = (A2) container.getComponent(A2.class);
C c = (C) container.getComponent(C.class);
assertEquals("1", "C", a2.getHogeName());
assertEquals("1", "C", c.getHogeName());
}
/**
* @throws Exception
*/
public void testInit() throws Exception {
ComponentDef cd = new ComponentDefImpl(D.class);
cd.addInitMethodDef(new InitMethodDefImpl("init"));
cd.init();
D d = (D) cd.getComponent();
assertEquals("1", true, d.isInited());
}
/**
* @throws Exception
*/
public void testDestroy() throws Exception {
ComponentDef cd = new ComponentDefImpl(D.class);
cd.addDestroyMethodDef(new DestroyMethodDefImpl("destroy"));
D d = (D) cd.getComponent();
cd.destroy();
assertEquals("1", true, d.isDestroyed());
}
/**
* @throws Exception
*/
public void testGetConcreteClass() throws Exception {
final ClassLoader loader1 = Thread.currentThread()
.getContextClassLoader();
ClassLoader loader2 = new ClassLoader(loader1) {
public Class loadClass(String name) throws ClassNotFoundException {
if (!name.equals(Foo.class.getName())) {
return super.loadClass(name);
}
try {
InputStream is = loader1.getResourceAsStream(name.replace(
'.', '/')
+ ".class");
byte[] bytes = new byte[is.available()];
is.read(bytes, 0, bytes.length);
return defineClass(name, bytes, 0, bytes.length);
} catch (IOException e) {
throw new ClassNotFoundException(name, e);
}
}
};
Thread.currentThread().setContextClassLoader(loader2);
S2Container container;
try {
container = new S2ContainerImpl();
Class fooClass = loader2.loadClass(Foo.class.getName());
ComponentDef cd = new ComponentDefImpl(fooClass, "foo");
cd.addAspectDef(new AspectDefImpl(new TraceInterceptor()));
container.register(cd);
} finally {
Thread.currentThread().setContextClassLoader(loader1);
}
ComponentDefImpl cd = (ComponentDefImpl) container
.getComponentDef("foo");
Class concreteClass = cd.getConcreteClass();
assertTrue("1", concreteClass.getName().startsWith(
Foo.class.getName() + "$$"));
assertEquals("2", loader2, concreteClass.getClassLoader());
Class superClass = concreteClass.getInterfaces()[0];
assertEquals("3", Foo.class.getName(), superClass.getName());
assertEquals("4", loader2, superClass.getClassLoader());
}
/**
*
*/
public interface Foo {
/**
* @return
*/
public String getHogeName();
}
/**
*
*/
public static class FooImpl implements Foo {
public String getHogeName() {
return "hoge";
}
}
/**
*
*/
public static class A {
private Hoge hoge_;
/**
* @param hoge
*/
public A(Hoge hoge) {
hoge_ = hoge;
}
/**
* @return
*/
public String getHogeName() {
return hoge_.getName();
}
}
/**
*
*/
public static class A2 implements Foo {
private Hoge hoge_;
/**
* @param hoge
*/
public void setHoge(Hoge hoge) {
hoge_ = hoge;
}
public String getHogeName() {
return hoge_.getName();
}
}
/**
*
*/
public interface Hoge {
/**
* @return
*/
public String getName();
}
/**
*
*/
public static class B implements Hoge {
public String getName() {
return "B";
}
}
/**
*
*/
public static class C implements Hoge {
private Foo foo_;
/**
* @param foo
*/
public void setFoo(Foo foo) {
foo_ = foo;
}
public String getName() {
return "C";
}
/**
* @return
*/
public String getHogeName() {
return foo_.getHogeName();
}
}
/**
*
*/
public static class D {
private boolean inited_ = false;
private boolean destroyed_ = false;
/**
* @return
*/
public boolean isInited() {
return inited_;
}
/**
* @return
*/
public boolean isDestroyed() {
return destroyed_;
}
/**
*
*/
public void init() {
inited_ = true;
}
/**
*
*/
public void destroy() {
destroyed_ = true;
}
}
}
| [
"koichik@319488c0-e101-0410-93bc-b5e51f62721a"
] | koichik@319488c0-e101-0410-93bc-b5e51f62721a |
d3b67cb126c5157dc7f050d1a544ed4a7ab403d7 | 1d9bf523688291a4feddd00471c76fd943e0f787 | /programs/DVDPlayer.java | 65fbdf7d71cb1e452327e27f9036fee96c5c2610 | [] | no_license | sayedatifali/topcoder | 9d86a5991f70df45bea78b99f5733f7af8b0c782 | 0de6767b31a8a98b90b668a3a0305f8f8fb04761 | refs/heads/master | 2021-01-22T03:39:28.249613 | 2014-04-28T10:42:52 | 2014-04-28T10:42:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,282 | java | import java.util.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;
public class DVDPlayer
{
public String[] findMovies(String[] moviesWatched)
{
int i;
int N;
String value;
ArrayList<String> ans;
HashMap<String, String> movie1;
HashSet<String> movie2;
StringTokenizer st;
ans = new ArrayList<String>();
movie1 = new HashMap<String, String>();
movie2 = new HashSet<String>();
N = moviesWatched.length;
movie1.put(moviesWatched[0], moviesWatched[1]);
movie1.put(moviesWatched[1], null);
for (i = 0; i < N - 1; i++) {
value = moviesWatched[i + 1];
if (movie1.containsKey(moviesWatched[i + 1]) && movie1.get(moviesWatched[i + 1]) != null) {
value = movie1.get(moviesWatched[i + 1]);
}
movie1.put(moviesWatched[i], value);
movie1.put(moviesWatched[i + 1], null);
}
movie1.remove(moviesWatched[i]);
Set<String> keys = movie1.keySet();
for (String key: keys) {
// System.out.print(key + ": ");
// System.out.println(movie1.get(key));
if (key.equals(movie1.get(key)))
continue;
ans.add(key + " is inside " + movie1.get(key) + "'s case");
}
Collections.sort(ans);
return ans.toArray(new String[ans.size()]);
}
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
private static boolean KawigiEdit_RunTest(int testNum, String[] p0, boolean hasAnswer, String[] p1) {
System.out.print("Test " + testNum + ": [" + "{");
for (int i = 0; p0.length > i; ++i) {
if (i > 0) {
System.out.print(",");
}
System.out.print("\"" + p0[i] + "\"");
}
System.out.print("}");
System.out.println("]");
DVDPlayer obj;
String[] answer;
obj = new DVDPlayer();
long startTime = System.currentTimeMillis();
answer = obj.findMovies(p0);
long endTime = System.currentTimeMillis();
boolean res;
res = true;
System.out.println("Time: " + (endTime - startTime) / 1000.0 + " seconds");
if (hasAnswer) {
System.out.println("Desired answer:");
System.out.print("\t" + "{");
for (int i = 0; p1.length > i; ++i) {
if (i > 0) {
System.out.print(",");
}
System.out.print("\"" + p1[i] + "\"");
}
System.out.println("}");
}
System.out.println("Your answer:");
System.out.print("\t" + "{");
for (int i = 0; answer.length > i; ++i) {
if (i > 0) {
System.out.print(",");
}
System.out.print("\"" + answer[i] + "\"");
}
System.out.println("}");
if (hasAnswer) {
if (answer.length != p1.length) {
res = false;
} else {
for (int i = 0; answer.length > i; ++i) {
if (!answer[i].equals(p1[i])) {
res = false;
}
}
}
}
if (!res) {
System.out.println("DOESN'T MATCH!!!!");
} else if ((endTime - startTime) / 1000.0 >= 2) {
System.out.println("FAIL the timeout");
res = false;
} else if (hasAnswer) {
System.out.println("Match :-)");
} else {
System.out.println("OK, but is it right?");
}
System.out.println("");
return res;
}
public static void main(String[] args) {
boolean all_right;
all_right = true;
String[] p0;
String[] p1;
// ----- test 0 -----
p0 = new String[]{"citizenkane","casablanca","thegodfather"};
p1 = new String[]{"casablanca is inside thegodfather's case","citizenkane is inside casablanca's case"};
all_right = KawigiEdit_RunTest(0, p0, true, p1) && all_right;
// ------------------
// ----- test 1 -----
p0 = new String[]{"starwars","empirestrikesback","returnofthejedi","empirestrikesback","returnofthejedi","phantommenace","starwars"};
p1 = new String[]{"empirestrikesback is inside returnofthejedi's case","phantommenace is inside empirestrikesback's case","returnofthejedi is inside phantommenace's case"};
all_right = KawigiEdit_RunTest(1, p0, true, p1) && all_right;
// ------------------
// ----- test 2 -----
p0 = new String[]{"a","x","a","y","a","z","a"};
p1 = new String[]{};
all_right = KawigiEdit_RunTest(2, p0, true, p1) && all_right;
// ------------------
if (all_right) {
System.out.println("You're a stud (at least on the example cases)!");
} else {
System.out.println("Some of the test cases had errors.");
}
}
// END KAWIGIEDIT TESTING
}
//Powered by KawigiEdit 2.1.4 (beta) modified by pivanof!
| [
"sayed.atif.ali@gmail.com"
] | sayed.atif.ali@gmail.com |
71c459d287eebb975db7af36e097482ae9dffe62 | 4a833fa1ddb75fb9f8cce86944cf798575e40639 | /app/src/main/java/com/example/adrian/pdm2/MainActivity.java | 1df0496b8cbb8a20c6168c7893be625c0a914327 | [] | no_license | TuringCompleteness/practica1 | 4e1f9fde7ee3db6b6f960e948048188a7d4d64ca | d19b919b560628bcc7bacb543e9bd74ba0878b39 | refs/heads/master | 2020-03-28T13:39:48.865440 | 2018-09-12T03:45:04 | 2018-09-12T03:45:04 | 148,415,611 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,386 | java | package com.example.adrian.pdm2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private Button button;
private TextView textView;
private ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = findViewById(R.id.button);
textView = findViewById(R.id.textView);
Log. w("onCreate:","Hola desde el método onCreate");
}
@Override
protected void onStart() {
super.onStart();
textView.setOnClickListener(this);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Click en el botón", Toast.LENGTH_SHORT)
.show();
}
});
Log. w("onStart:","Hola desde el método onStart");
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.textView:
Toast.makeText(MainActivity.this, "Click en el text view", Toast.LENGTH_SHORT)
.show();
break;
}
}
public void click(View view) {
Toast.makeText(MainActivity.this, "Click en la imagen", Toast.LENGTH_SHORT)
.show();
}
@Override
protected void onResume() {
super.onResume();
Log. w("onResume:","Hola desde el método onResume");
}
@Override
protected void onPause() {
super.onPause();
Log. w("onPause:","Hola desde el método onPause");
}
@Override
protected void onStop() {
super.onStop();
Log. w("onStop:","Hola desde el método onStop");
}
@Override
protected void onRestart() {
super.onRestart();
Log. w("onRestart:","Hola desde el método onRestart");
}
@Override
protected void onDestroy() {
super.onDestroy();
Log. w("onDestroy:","Hola desde el método onDestroy");
}
}
| [
"adrian.garcia04@ciencias.unam.mx"
] | adrian.garcia04@ciencias.unam.mx |
8824e8ffe88b9e21d2a29adeed924d3c2ae7bc0d | c79cbfc44407deb22f3dd980e7726324558e8546 | /src/entities/CarRental.java | 7f696cd371387a77c58acb758165d45dbe570cef | [] | no_license | welton82/Tabalhando-Sem-Interface | 9c9ca3f8e202e1d49091284d796a3899f32cd424 | 3523cead18e399f69a2e98b9b2e355600bf695cc | refs/heads/main | 2023-06-19T06:12:52.002099 | 2021-07-20T14:35:59 | 2021-07-20T14:35:59 | 387,819,321 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 852 | java | package entities;
import java.util.Date;
public class CarRental {
private Date start;
private Date finish;
private Invoice invoice;
private Vehicle vehicle;
public CarRental() {
}
public CarRental(Vehicle v, Date start, Date finish) {
this.vehicle = v;
this.start = start;
this.finish = finish;
}
public Date getStart() {
return start;
}
public void setStart(Date start) {
this.start = start;
}
public Date getFinish() {
return finish;
}
public void setFinish(Date finish) {
this.finish = finish;
}
public Invoice getInvoice() {
return invoice;
}
public void setInvoice(Invoice invoice) {
this.invoice = invoice;
}
public Vehicle getVehicle() {
return vehicle;
}
public void setVehicle(Vehicle vehicle) {
this.vehicle = vehicle;
}
}
| [
"noreply@github.com"
] | welton82.noreply@github.com |
fe3bdebed4e2f4e37d10958a66d88f69ae7f8728 | d1d23a9339775df35426e2b0e10d59ffbb225ce3 | /spring-boot-mq/src/main/java/com/sample/mq/controller/KafkaController.java | 6cd595af1c3e4339ee6d6c7de83a7092b89243fe | [
"Apache-2.0"
] | permissive | tedburner/spring-boot-examples | 7187bbf0fd6f4931b191c604754cefa1aacd95bd | c74b541f9bc73b78d7690bc295ef88952d55ac57 | refs/heads/master | 2023-08-22T11:53:30.199441 | 2023-08-02T14:43:54 | 2023-08-02T14:43:54 | 131,130,328 | 12 | 5 | Apache-2.0 | 2023-08-02T14:51:10 | 2018-04-26T09:12:36 | Java | UTF-8 | Java | false | false | 1,130 | java | package com.sample.mq.controller;
import com.kit.common.util.common.gson.FormatUtils;
import com.sample.mq.constant.MqConstants;
import com.sample.mq.domain.Message;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* @author: lingjun.jlj
* @date: 2019/7/22 16:17
* @version:1.0.0
* @description:
*/
@Slf4j
@RestController
@RequestMapping(value = "/kafka")
public class KafkaController {
//@Autowired
private KafkaTemplate<String, String> kafkaTemplate;
@GetMapping(value = "/send")
public void send() {
log.info("向kafka发送消息===============");
Message message = Message.builder()
.id(System.currentTimeMillis())
.msg("今天是" + new Date() + " 天气真不错!!!")
.build();
kafkaTemplate.send(MqConstants.KAFKA_TOPIC_TEST, FormatUtils.obj2str(message));
}
}
| [
"jlj_vip98@qq.com"
] | jlj_vip98@qq.com |
cd49053163ec8b1bced2994196368e589fd1c106 | 5e08721aaaaa94526bfd953cd7592f98f19a23fb | /src/me/andreasfreund/schlechtegameengine/world/View.java | af67ef03849379c1de1c04c381bace0b1a28c827 | [] | no_license | AndreasFreund/SchlechteGameEngine | 694fb96ee47d8058a14e16a0e10c0e459369c017 | 01d2ef9c0f9833a9b00dcdb12e82787e5f9bd506 | refs/heads/master | 2016-09-06T21:31:45.185925 | 2015-03-16T12:04:40 | 2015-03-16T12:04:40 | 31,205,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package me.andreasfreund.schlechtegameengine.world;
public class View {
private Element element;
private int range;
public View(Element element, int range) {
this.element = element;
this.range = range;
}
public boolean canSee(Element element) {
return Math.max(Math.abs(element.getX() - this.element.getX()),
Math.abs(element.getY() - this.element.getY())) <= this.range;
}
} | [
"freund.andreas@web.de"
] | freund.andreas@web.de |
ff3f6fb2cb5f83efb19cd4b5add79283571a9be7 | 45aea98e340e07188101fc828e849a67133005aa | /src/main/java/com/sss/probie/bbs/service/HelloService.java | cab046a922343c61d6bf89c6e1c821030791d05c | [] | no_license | p0000/spring-mvc-boot | 479a1f9f7eb989a3ff865e81432e06c7e2ab8f2a | a976b784378627b2e988cd26c8d0cc96b566ac47 | refs/heads/master | 2020-05-27T14:15:17.522355 | 2015-07-16T09:34:55 | 2015-07-16T09:34:55 | 38,866,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 117 | java | package com.sss.probie.bbs.service;
/**
* Created by K.Kangai on 2015/07/14.
*/
public interface HelloService {
}
| [
"0A8936@RC787.JITOOV"
] | 0A8936@RC787.JITOOV |
dc1540012a390320f524ade183745b6f57b3aa1e | 9cfa65dc983ff450955230bbae676d8ae07e804c | /src/main/java/com/spring/ioc/ApplicationContextDemo.java | 2060632864b288a4996897fd1d4bf4e7031b008e | [] | no_license | zhangkunjie/spring | 94deb27c290989320e97f3c34d34b16bf838f460 | 36d303cfa85307f4ba0a1504cbc7c511b185a42b | refs/heads/master | 2020-03-24T19:52:49.808407 | 2018-07-31T01:54:45 | 2018-07-31T01:54:45 | 142,948,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 546 | java | package com.spring.ioc;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author kunjie.zhang
* @description:
* @date 2018/7/29 上午10:02
*/
public class ApplicationContextDemo {
@Test
public void test() {
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
UserService userService = (UserService) context.getBean("userService");
userService.say();
}
}
| [
"kunjie.zhang@corp.elong.com"
] | kunjie.zhang@corp.elong.com |
a5f9884e0a2b4fbe3cd1fe6952328c71bfe8de5f | 5c07f421810c7849058338b7704cccf4f592cee3 | /soottocfg/src/main/java/soottocfg/ast/Absyn/ListParameter.java | e62084456358be2c6578a2fb33ce49e3cade498d | [
"LGPL-2.1-only",
"MIT",
"LGPL-2.1-or-later",
"LGPL-2.0-or-later",
"BSD-3-Clause"
] | permissive | ali-shamakhi/jayhorn | 31821c2e08b03d023ff3e7ed62df499df9697b6d | 1684b5e3787cf6e844e04dbeac7aa372fb0b1ccd | refs/heads/devel | 2022-01-30T11:59:34.606800 | 2021-05-27T12:46:27 | 2021-05-27T12:46:27 | 167,131,754 | 0 | 0 | MIT | 2021-08-15T01:21:48 | 2019-01-23T06:42:33 | Java | UTF-8 | Java | false | false | 149 | java | package soottocfg.ast.Absyn; // Java Package generated by the BNF Converter.
public class ListParameter extends java.util.LinkedList<Parameter> {
}
| [
"martinschaef@gmail.com"
] | martinschaef@gmail.com |
a05e9f790b8d7ef7283d3cbb5888652749bd58a7 | e7f1329977273661a986b68c58137ffc72caa541 | /java-version/java/NativeAllocPacketManager.java | a9e945d3e81e1c1f0e4fbd639ed2f1bfee0745c0 | [] | no_license | gddg/article-allocate-or-pool | 8aa2261b94ffe15e2548c5793a302ccba4896f30 | d74cf0be52ec972d91c8dac06eb5d37152646b1e | refs/heads/master | 2020-08-17T16:39:50.167277 | 2019-01-16T20:41:03 | 2019-01-16T20:41:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 575 | java | public class NativeAllocPacketManager extends PacketManager
{
private final NativePool pool;
NativeAllocPacketManager (int size)
{
pool = new NativePool (size);
}
@Override
public Packet get ()
{
int num = pool.get ();
return new NativePacket (num, pool.buffer (num));
}
@Override
public void free (Packet packet)
{
pool.free (((NativePacket) packet).num);
packet.buf = null;
}
@Override
public String toString ()
{
return "NATIVE-ALLOC";
}
}
| [
"Pasha@vastech.co.za"
] | Pasha@vastech.co.za |
77019b520506bd50050d2b7d43733d72278ee578 | c9faea88d455e7d8df495cccca2be623ed7456ee | /PracticaJDBC/src/main/java/dao/ConexionDAO.java | 90861d5f45a72e5b7967c2d87634489751ed5a60 | [] | no_license | RGIvan/Altair1718-DWC | 2d6a0e9156d21842eac24fd4f0fe701a16f45401 | 7f4823e4ff74c7f1d5cf7164053a1ebb18d2669e | refs/heads/master | 2021-10-10T13:06:39.997652 | 2019-01-11T08:37:15 | 2019-01-11T08:37:15 | 109,231,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 773 | java | package dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConexionDAO {
private static Connection conexion;
public static void abrirConexion() {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
conexion = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/musica?serverTimezone=UTC&autoReconnect=true&useSSL=false", "root",
"root");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void cerrarConexion() {
try {
conexion.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
public static Connection getConexion() {
return conexion;
}
}
| [
"ALUM01@PC01"
] | ALUM01@PC01 |
4c006f0e75f1cc84e4b33502ec500b118fcc0cfa | 84c4eb8d678a7e7c040164d765f9deae44e9fce7 | /Dungeon-FrontEnd-GraphicsEngine2D/src/main/java/de/jdungeon/animation/AnimationTask.java | b723f107ed59a49cc0cefa566d23ca8650a79b84 | [] | no_license | jochenreutelshoefer/DungeonCore | 9eb3f48fb3bd0f0787b29f41cd5abda6893f27ec | d802d87d06c52f649df7d76e0ff062a1393d3c1c | refs/heads/master | 2021-11-28T03:48:25.903268 | 2021-10-03T12:31:10 | 2021-10-03T12:31:10 | 65,936,840 | 0 | 0 | null | 2021-04-26T20:47:16 | 2016-08-17T19:42:39 | Java | UTF-8 | Java | false | false | 310 | java | package de.jdungeon.animation;
import de.jdungeon.figure.percept.Percept;
/**
*
* @author Jochen Reutelshoefer (denkbares GmbH)
* @created 26.12.16.
*/
public interface AnimationTask {
boolean isFinished();
boolean isUrgent() ;
AnimationFrame getCurrentAnimationFrame();
Percept getPercept();
}
| [
"jochen.reutelshoefer@denkbares.com"
] | jochen.reutelshoefer@denkbares.com |
fdef3436ac621506ea76405edd872876abb6069f | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /frameworks/base/tools/layoutlib/bridge/src/android/graphics/CornerPathEffect_Delegate.java | b0f8168aa3a02eef514773e117554f182e83f728 | [
"MIT",
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | Java | false | false | 2,313 | java | /*
* Copyright (C) 2010 The Android Open Source Project
*
* 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 android.graphics;
import com.android.layoutlib.bridge.impl.DelegateManager;
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
import java.awt.Stroke;
/**
* Delegate implementing the native methods of android.graphics.CornerPathEffect
*
* Through the layoutlib_create tool, the original native methods of CornerPathEffect have been
* replaced by calls to methods of the same name in this delegate class.
*
* This class behaves like the original native implementation, but in Java, keeping previously
* native data into its own objects and mapping them to int that are sent back and forth between
* it and the original CornerPathEffect class.
*
* Because this extends {@link PathEffect_Delegate}, there's no need to use a {@link DelegateManager},
* as all the Shader classes will be added to the manager owned by {@link PathEffect_Delegate}.
*
* @see PathEffect_Delegate
*
*/
public class CornerPathEffect_Delegate extends PathEffect_Delegate {
// ---- delegate data ----
// ---- Public Helper methods ----
@Override
public Stroke getStroke(Paint_Delegate paint) {
// FIXME
return null;
}
@Override
public boolean isSupported() {
return false;
}
@Override
public String getSupportMessage() {
return "Corner Path Effects are not supported in Layout Preview mode.";
}
// ---- native methods ----
@LayoutlibDelegate
/*package*/ static int nativeCreate(float radius) {
CornerPathEffect_Delegate newDelegate = new CornerPathEffect_Delegate();
return sManager.addNewDelegate(newDelegate);
}
// ---- Private delegate/helper methods ----
}
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
d9e962a4eba4283320582abae7e5082ceed3e0d0 | 08ba751756c450ca8dd9075bb1845a5ae56596ba | /app/src/main/java/net/neoturbine/veles/testUtils/FragmentOrViewUtilActivity.java | d65478101f260fc300dc100955d343cbf443990d | [] | no_license | sargas/veles | 68e31d8dbe3b86102743385128f93f719e96ca3a | da10cb0a966f25b65a13dd9d99af30da5779a302 | refs/heads/master | 2021-05-01T18:40:03.394303 | 2017-05-01T02:02:22 | 2017-05-01T02:02:22 | 73,842,972 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 989 | java | package net.neoturbine.veles.testUtils;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;
/* Adapted from http://stackoverflow.com/a/30974956/239003
* Must be in main source (as opposed to androidTest since ActivityTestRule
* requires activities to be declared in AndroidManifest */
public class FragmentOrViewUtilActivity extends Activity {
private FrameLayout mFrame;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mFrame = new FrameLayout(this);
mFrame.setId(View.generateViewId());
setContentView(mFrame);
}
public void addFragment(Fragment frag) {
getFragmentManager().beginTransaction()
.add(mFrame.getId(), frag)
.commit();
}
@SuppressWarnings("unused")
public void addView(View view) {
mFrame.addView(view);
}
}
| [
"joe@neoturbine.net"
] | joe@neoturbine.net |
b3a93ef9cbdaa1ab5f59884e5e25f295a51bb55b | 0a8f11c042fba1ce8dda6e87bd89a9b4890d30ba | /stampmaker-library/src/test/java/com/miniblocks/stampmaker/ExampleUnitTest.java | 7a395bea5c35889dfd0ee2b9dfb7e6ce69b34bff | [
"MIT"
] | permissive | DipeshChouhan/StampMaker-Library | 26fa32696a12f5b4546b18ef6f7f4c0ced882343 | f3c1847ddea47893b0da216435a340417b656aaf | refs/heads/master | 2021-04-12T00:02:11.842610 | 2020-03-26T06:00:50 | 2020-03-26T06:00:50 | 249,067,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.miniblocks.stampmaker;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"dcdon077@gmail.com"
] | dcdon077@gmail.com |
4624078595a165060991ccb65d86be6ba1ec5cdf | 1d3aa986dbae921c63c8d27368536e6f2894e0a6 | /projects/springwebflux/src/main/java/rhirabay/infrastructure/JunitSampleClient.java | 21f8ca3c2f63c9237c8aa12fa6bd233a1d791539 | [] | no_license | rhirabay/springboot | ea738b65a01affdcab45101e6cd0358ba31d0d15 | a19fd774badb00147fad26d93e008c61439393c6 | refs/heads/master | 2023-03-17T08:44:10.040064 | 2022-03-13T14:30:36 | 2022-03-13T14:30:36 | 181,695,034 | 0 | 0 | null | 2023-03-12T04:06:28 | 2019-04-16T13:30:19 | Java | UTF-8 | Java | false | false | 676 | java | package rhirabay.infrastructure;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
@Component
public class JunitSampleClient {
private final WebClient webClient;
public JunitSampleClient(@Value("{baseUrl}") String baseUrl) {
this.webClient = WebClient.builder()
.baseUrl(baseUrl)
.build();
}
public Mono<String> ping() {
return webClient.get()
.uri("/ping")
.retrieve()
.bodyToMono(String.class);
}
}
| [
"rhirabay@yahoo-corp.jp"
] | rhirabay@yahoo-corp.jp |
27d29397a6dd65d70f7a194374475d0af147feb4 | 232be9218463ea1b276623a0c58a2b0fca27f283 | /demo/src/main/java/com/example/demo/model/Card.java | a10330b5093a93103d87fb9a20197fcda001748e | [] | no_license | elenadiman/DemoApp | 7c2549be110efdd7555c3ca71d40cbbfa3e0f6cd | 1b1e813b33610f8199ec2f9921b7b66ba2b6e842 | refs/heads/master | 2023-01-24T12:17:53.913566 | 2020-12-09T16:58:06 | 2020-12-09T16:58:06 | 311,443,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,703 | java | package com.example.demo.model;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "card")
public class Card {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String cardNo;
private String type;
private Long balance;
private Date validFrom;
private Date validTo;
private String status;
private String visiblePan;
private Boolean processed;
public Card(){}
public Card(String cardNo, String type, Long balance, Date validFrom, Date validTo, String status, String visiblePan, Boolean processed) {
this.cardNo = cardNo;
this.type = type;
this.balance = balance;
this.validFrom = validFrom;
this.validTo = validTo;
this.status = status;
this.visiblePan = visiblePan;
this.processed = processed;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCardNumber() {
return cardNo;
}
public void setCardNumber(String cardNumber) {
this.cardNo = cardNumber;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Long getBalance() {
return balance;
}
public void setBalance(Long balance) {
this.balance = balance;
}
public Date getValidFrom() {
return validFrom;
}
public void setValidFrom(Date validFrom) {
this.validFrom = validFrom;
}
public Date getValidTo() {
return validTo;
}
public void setValidTo(Date validTo) {
this.validTo = validTo;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getVisiblePan() {
return visiblePan;
}
public void setVisiblePan(String visiblePan) {
this.visiblePan = visiblePan;
}
public Boolean getProcessed() {
return processed;
}
public void setProcessed(Boolean processed) {
this.processed = processed;
}
@Override
public String toString() {
return "Card{" +
"id=" + id +
", cardNumber='" + cardNo + '\'' +
", type='" + type + '\'' +
", balance=" + balance +
", validFrom=" + validFrom +
", validTo=" + validTo +
", status='" + status + '\'' +
", visiblePan='" + visiblePan + '\'' +
", processed='" + processed + '\'' +
'}';
}
}
| [
"74191173+elenadiman@users.noreply.github.com"
] | 74191173+elenadiman@users.noreply.github.com |
23a09ba1fc45c8704b35ac370983e2d23ce7bd05 | 412007d57db828092a15a647c6564f57fcce55ed | /demo/src/main/java/com/example/demo/services/RoomService.java | d7ee6e0a3cc8faf211629c5a3371a3e30c8abc4f | [] | no_license | paaavkata/Bootcamp | 99d30cff40c6fa96a1bce1f90a1c79e33c7f79c1 | f20e10aecce7a637b34b30396b9d7c8904793211 | refs/heads/master | 2021-07-19T22:34:17.496287 | 2017-10-26T12:09:04 | 2017-10-26T12:09:04 | 104,344,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.example.demo.services;
import java.util.ArrayList;
import java.util.List;
import com.example.demo.models.Hotel;
import com.example.demo.models.Room;
public interface RoomService {
public List<Room> listAll();
public Room getById(Long id);
public Room saveOrUpdate(Room room);
public void delete(Long id);
}
| [
"pavel.damyanov@scalefocus.com"
] | pavel.damyanov@scalefocus.com |
e71b5b91c26886ad2185b7925fe17983182ea541 | 8efb4e82b0e01c1ca8510c9ff7510b9031f63376 | /src/main/java/com/juanminango/workshop_mongo/dto/UserDTO.java | 337082b0102850d79730a8c92bd7bbb4ecebc740 | [] | no_license | jminango20/workshop-spring-boot-mongodb | 307901e9c1fc659a6bdf21f17014e11b746bc93a | a64926fda908fb25b46a62ef89b06840781b0d0b | refs/heads/main | 2023-03-17T17:43:21.282419 | 2021-03-16T11:25:26 | 2021-03-16T11:25:26 | 347,946,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 773 | java | package com.juanminango.workshop_mongo.dto;
import java.io.Serializable;
import com.juanminango.workshop_mongo.domain.User;
public class UserDTO implements Serializable{
private static final long serialVersionUID = 1L;
private String id;
private String name;
private String email;
public UserDTO() {
}
public UserDTO(User obj) { //copiar os dados do User ao UserDTO
id = obj.getId();
name = obj.getName();
email = obj.getEmail();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
| [
"jcarlosminango@gmail.com"
] | jcarlosminango@gmail.com |
6d19e680bbc0546de4a4138176be117bc6b8abf6 | c81d5653608ed9df51d29a787eb0c0aa8a9def2d | /nds-master/app/src/main/java/com/ogeniuspriority/nds/nds/RoundedImageView.java | e665f6044ad032038ec412462e34273b7254964f | [] | no_license | ogeniuspriority/ndsapp | 1e206963847a6321b2cc877535148ce300f13f33 | 4c5d3c80be307c1a400d90e325c253c3ff3a0e5e | refs/heads/master | 2020-03-23T12:34:48.929120 | 2018-07-19T09:33:28 | 2018-07-19T09:33:28 | 141,567,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,414 | java | package com.ogeniuspriority.nds.nds;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by USER on 9/15/2016.
*/
public class RoundedImageView extends ImageView {
public RoundedImageView(Context ctx, AttributeSet attrs) {
super(ctx, attrs);
}
@Override
protected void onDraw(Canvas canvas) {
Drawable drawable = getDrawable();
if (drawable == null) {
return;
}
if (getWidth() == 0 || getHeight() == 0) {
return;
}
Bitmap b = ((BitmapDrawable) drawable).getBitmap();
Bitmap bitmap = b.copy(Bitmap.Config.ARGB_8888, true);
int w = getWidth(), h = getHeight();
Bitmap roundBitmap = getRoundedCroppedBitmap(bitmap, w);
canvas.drawBitmap(roundBitmap, 0, 0, null);
}
public static Bitmap getRoundedCroppedBitmap(Bitmap bitmap, int radius) {
Bitmap finalBitmap;
if (bitmap.getWidth() != radius || bitmap.getHeight() != radius)
finalBitmap = Bitmap.createScaledBitmap(bitmap, radius, radius,
false);
else
finalBitmap = bitmap;
Bitmap output = Bitmap.createBitmap(finalBitmap.getWidth(),
finalBitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, finalBitmap.getWidth(),
finalBitmap.getHeight());
paint.setAntiAlias(true);
paint.setFilterBitmap(true);
paint.setDither(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(Color.parseColor("#BAB399"));
canvas.drawCircle(finalBitmap.getWidth() / 2 + 0.7f,
finalBitmap.getHeight() / 2 + 0.7f,
finalBitmap.getWidth() / 2 + 0.1f, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(finalBitmap, rect, rect, paint);
return output;
}
}
| [
"Christian Rutayisire"
] | Christian Rutayisire |
20c28fc98b47410db3de4f1829b6980b78fc8d6b | 61f0628d3da0d7d77d72f3581bad7766dd49ea48 | /examples/apache-flink/src/test/java/nl/basjes/parse/httpdlog/flink/pojo/TestParserMapFunctionClass.java | cdbd25b269e54e2f7844b2046519fba9da26213b | [
"Apache-2.0"
] | permissive | herzcthu/logparser | 725d7af5efbaf304488362cbb08ffb9e593aa6dc | 121f4c53c26fc6862b4350ec8df11c9360aac325 | refs/heads/master | 2020-03-07T08:59:42.711657 | 2018-03-30T07:43:59 | 2018-03-30T07:43:59 | 127,395,052 | 0 | 0 | Apache-2.0 | 2018-03-30T07:14:21 | 2018-03-30T07:14:21 | null | UTF-8 | Java | false | false | 2,312 | java | /*
* Apache HTTPD & NGINX Access log parsing made easy
* Copyright (C) 2011-2018 Niels Basjes
*
* 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 nl.basjes.parse.httpdlog.flink.pojo;
import nl.basjes.parse.core.Parser;
import nl.basjes.parse.httpdlog.flink.TestCase;
import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.io.Serializable;
import java.util.List;
import static org.junit.Assert.assertEquals;
@RunWith(JUnit4.class)
public class TestParserMapFunctionClass implements Serializable {
public static class MyParserMapper extends RichMapFunction<String, TestRecord> {
private Parser<TestRecord> parser;
@Override
public void open(org.apache.flink.configuration.Configuration parameters) throws Exception {
parser = TestCase.createTestParser();
}
@Override
public TestRecord map(String line) throws Exception {
return parser.parse(line);
}
}
@Test
public void testClassDefinition() throws Exception {
// set up the execution environment
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<String> input = env.fromElements(TestCase.getInputLine());
DataSet<TestRecord> filledTestRecords = input
.map(new MyParserMapper())
.name("Extract Elements from logline");
filledTestRecords.print();
List<TestRecord> result = filledTestRecords.collect();
assertEquals(1, result.size());
assertEquals(new TestRecord().setFullValid(), result.get(0));
}
}
| [
"niels@basjes.nl"
] | niels@basjes.nl |
fff505a436bb5c0a634430163d5f352c0c74e3ac | e975a93bae0fa6d4b4d3595a9729e99bc7fea311 | /src/main/java/com/jhtest/library/web/rest/BlogResource.java | c8a9297564e24dc042d896b06ffbd7cd2b15d619 | [] | no_license | l7777777b/jhipster-library | d5bf3f9a1f0d558aea53b04bd4908166ecee4cd9 | 2f35a1bbec615250f459f866a7096cea95b699af | refs/heads/master | 2022-07-01T13:15:35.641283 | 2020-05-09T14:43:12 | 2020-05-09T14:43:12 | 262,583,113 | 0 | 0 | null | 2020-05-09T14:43:14 | 2020-05-09T14:00:28 | Java | UTF-8 | Java | false | false | 6,203 | java | package com.jhtest.library.web.rest;
import com.jhtest.library.service.BlogService;
import com.jhtest.library.web.rest.errors.BadRequestAlertException;
import com.jhtest.library.service.dto.BlogDTO;
import com.jhtest.library.service.dto.BlogCriteria;
import com.jhtest.library.service.BlogQueryService;
import io.github.jhipster.web.util.HeaderUtil;
import io.github.jhipster.web.util.PaginationUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing {@link com.jhtest.library.domain.Blog}.
*/
@RestController
@RequestMapping("/api")
public class BlogResource {
private final Logger log = LoggerFactory.getLogger(BlogResource.class);
private static final String ENTITY_NAME = "libraryBlog";
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final BlogService blogService;
private final BlogQueryService blogQueryService;
public BlogResource(BlogService blogService, BlogQueryService blogQueryService) {
this.blogService = blogService;
this.blogQueryService = blogQueryService;
}
/**
* {@code POST /blogs} : Create a new blog.
*
* @param blogDTO the blogDTO to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new blogDTO, or with status {@code 400 (Bad Request)} if the blog has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/blogs")
public ResponseEntity<BlogDTO> createBlog(@Valid @RequestBody BlogDTO blogDTO) throws URISyntaxException {
log.debug("REST request to save Blog : {}", blogDTO);
if (blogDTO.getId() != null) {
throw new BadRequestAlertException("A new blog cannot already have an ID", ENTITY_NAME, "idexists");
}
BlogDTO result = blogService.save(blogDTO);
return ResponseEntity.created(new URI("/api/blogs/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* {@code PUT /blogs} : Updates an existing blog.
*
* @param blogDTO the blogDTO to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated blogDTO,
* or with status {@code 400 (Bad Request)} if the blogDTO is not valid,
* or with status {@code 500 (Internal Server Error)} if the blogDTO couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/blogs")
public ResponseEntity<BlogDTO> updateBlog(@Valid @RequestBody BlogDTO blogDTO) throws URISyntaxException {
log.debug("REST request to update Blog : {}", blogDTO);
if (blogDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
BlogDTO result = blogService.save(blogDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, blogDTO.getId().toString()))
.body(result);
}
/**
* {@code GET /blogs} : get all the blogs.
*
* @param pageable the pagination information.
* @param criteria the criteria which the requested entities should match.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of blogs in body.
*/
@GetMapping("/blogs")
public ResponseEntity<List<BlogDTO>> getAllBlogs(BlogCriteria criteria, Pageable pageable) {
log.debug("REST request to get Blogs by criteria: {}", criteria);
Page<BlogDTO> page = blogQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* {@code GET /blogs/count} : count all the blogs.
*
* @param criteria the criteria which the requested entities should match.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the count in body.
*/
@GetMapping("/blogs/count")
public ResponseEntity<Long> countBlogs(BlogCriteria criteria) {
log.debug("REST request to count Blogs by criteria: {}", criteria);
return ResponseEntity.ok().body(blogQueryService.countByCriteria(criteria));
}
/**
* {@code GET /blogs/:id} : get the "id" blog.
*
* @param id the id of the blogDTO to retrieve.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the blogDTO, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/blogs/{id}")
public ResponseEntity<BlogDTO> getBlog(@PathVariable Long id) {
log.debug("REST request to get Blog : {}", id);
Optional<BlogDTO> blogDTO = blogService.findOne(id);
return ResponseUtil.wrapOrNotFound(blogDTO);
}
/**
* {@code DELETE /blogs/:id} : delete the "id" blog.
*
* @param id the id of the blogDTO to delete.
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/blogs/{id}")
public ResponseEntity<Void> deleteBlog(@PathVariable Long id) {
log.debug("REST request to delete Blog : {}", id);
blogService.delete(id);
return ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build();
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
1a189b89ca48b5ea1aa3ab17640918ea33bf595b | 672f336d28d6415d70b95a269cb3e9061d9a4e64 | /src/schedule/Controllers/ViewAppointmentController.java | a6dc9bbb9b7fd85831f7018a77ef60491c4213b2 | [] | no_license | Jreddysmith/WGU_Software2 | da8bbd22c0816245c01a87f5a1833e28573fb16d | bf1fe63ac7978b1d11583d140edd61e4e562072c | refs/heads/main | 2023-04-16T15:32:42.251706 | 2021-05-01T01:05:00 | 2021-05-01T01:05:00 | 358,409,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,576 | java | package schedule.Controllers;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.stage.Stage;
import schedule.Models.Appointment;
import schedule.Models.Appointments;
import schedule.Models.Customer;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
public class ViewAppointmentController implements Initializable {
@FXML
private TableView<Appointment> appointment_table;
@FXML
private TableColumn<Appointment, String> appointment_id;
@FXML
private TableColumn<Appointment, String> user_id;
@FXML
private TableColumn<Appointment, String> customer_id;
@FXML
private TableColumn<Appointment, String> title;
@FXML
private TableColumn<Appointment, String> description;
@FXML
private TableColumn<Appointment, String> location;
@FXML
private TableColumn<Appointment, String> contact;
@FXML
private TableColumn<Appointment, String> start;
@FXML
private TableColumn<Appointment, String> end;
@FXML
private Button weekly_appointments;
@FXML
private Button monthly_appointments;
@FXML
private Button all_appointments;
@FXML
private Button cancel;
@FXML
public void allAppointmentsButton() { appointment_table.setItems(Appointments.getAppointments());}
@FXML
public void appointmentsMonthly() {appointment_table.setItems(Appointments.appointmentsMonthly());}
@FXML
public void appointmentWeekly() {appointment_table.setItems(Appointments.appointmentsWeekly());}
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
appointment_id.setCellValueFactory(new PropertyValueFactory<Appointment, String>("appointmentId"));
user_id.setCellValueFactory(new PropertyValueFactory<Appointment, String>("userId"));
customer_id.setCellValueFactory(new PropertyValueFactory<Appointment, String>("customerId"));
title.setCellValueFactory(new PropertyValueFactory<Appointment, String>("title"));
description.setCellValueFactory(new PropertyValueFactory<Appointment, String>("description"));
location.setCellValueFactory(new PropertyValueFactory<Appointment, String>("location"));
contact.setCellValueFactory(new PropertyValueFactory<Appointment, String>("contact"));
start.setCellValueFactory(new PropertyValueFactory<Appointment, String>("formattedStartTime"));
end.setCellValueFactory(new PropertyValueFactory<Appointment, String>("formattedEndTime"));
allAppointmentsButton();
}
@FXML
public void allAppointments() throws IOException {
allAppointmentsButton();
}
@FXML
public void monthlyAppointments() throws IOException {
appointmentsMonthly();
}
@FXML
public void weeklyAppointments() throws IOException {
appointmentWeekly();
}
@FXML
public void cancel(ActionEvent event) throws IOException {
Stage stage;
stage = (Stage)cancel.getScene().getWindow();
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/schedule/Views/homepage.fxml"));
Parent root = loader.load();
stage.setScene(new Scene(root));
stage.show();
}
}
| [
"jreddysmith@gmail.com"
] | jreddysmith@gmail.com |
992d7f9c4f5e42ed1d1beeceddf5d3360517b927 | 867bb3414c183bc19cf985bb6d3c55f53bfc4bfd | /open/src/main/java/com/cjcx/wechat/open/weixin/JssdkManager.java | 417aadb350c2cf55f9a13a8f9a942da224907f00 | [] | no_license | easonstudy/cloud-dev | 49d02fa513df3c92c5ed03cec61844d10890b80b | fe898cbfb746232fe199e83969b89cb83e85dfaf | refs/heads/master | 2020-03-29T05:39:36.279494 | 2018-10-22T10:55:14 | 2018-10-22T10:55:32 | 136,574,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,701 | java | package com.cjcx.wechat.open.weixin;
import com.cjcx.wechat.open.utils.RequestUtil;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.*;
/**
* JssdkManager jssdk 自动刷新
*
* @author LiYi
*/
public class JssdkManager {
private static final Logger logger = LoggerFactory.getLogger(JssdkManager.class);
private static ScheduledExecutorService scheduledExecutorService;
private static Map<String, String> jssdkMap = new LinkedHashMap<String, String>();
private static Map<String, ScheduledFuture<?>> futureMap = new HashMap<String, ScheduledFuture<?>>();
private static int poolSize = 2;
private static boolean daemon = Boolean.TRUE;
/**
* 初始化 scheduledExecutorService
*/
private static void initScheduledExecutorService() {
logger.info("daemon:{},poolSize:{}", daemon, poolSize);
scheduledExecutorService = Executors.newScheduledThreadPool(poolSize, new ThreadFactory() {
@Override
public Thread newThread(Runnable arg0) {
Thread thread = Executors.defaultThreadFactory().newThread(arg0);
//设置守护线程
thread.setDaemon(daemon);
return thread;
}
});
}
/**
* 设置线程池
*
* @param poolSize poolSize
*/
public static void setPoolSize(int poolSize) {
JssdkManager.poolSize = poolSize;
}
/**
* 设置线程方式
*
* @param daemon daemon
*/
public static void setDaemon(boolean daemon) {
JssdkManager.daemon = daemon;
}
/**
* 初始化token 刷新,每118分钟刷新一次。
*
* @param access_token access_token
*/
public static void init(final String access_token) {
init(access_token, 0, 60 * 118);
}
/**
* 初始化token 刷新,每118分钟刷新一次。
*
* @param access_token access_token
* @param initialDelay 首次执行延迟(秒)
* @param delay 执行间隔(秒)
*/
public static void init(final String access_token, int initialDelay, int delay) {
if (scheduledExecutorService == null) {
initScheduledExecutorService();
}
if (futureMap.containsKey(access_token)) {
futureMap.get(access_token).cancel(true);
}
//立即执行一次
if (initialDelay == 0) {
doRun(access_token);
}
ScheduledFuture<?> scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
doRun(access_token);
}
}, initialDelay == 0 ? delay : initialDelay, delay, TimeUnit.SECONDS);
futureMap.put(access_token, scheduledFuture);
logger.info("appid:{}", access_token);
}
private static void doRun(final String access_token) {
String url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + access_token + "&type=jsapi";
try {
String rs = RequestUtil.doGet(url, null);
JSONObject obj_content = new JSONObject(rs);
String jsapi_ticket = obj_content.getString("ticket");
jssdkMap.put(access_token, jsapi_ticket);
logger.info("JSAPI TICKET refurbish with access_token:{}", access_token);
} catch (Exception e) {
logger.error("JSAPI TICKET refurbish error with access_token:{}", access_token);
e.printStackTrace();
}
}
/**
* 取消 token 刷新
*/
public static void destroyed() {
scheduledExecutorService.shutdownNow();
logger.info("destroyed");
}
/**
* 取消刷新
*
* @param access_token access_token
*/
public static void destroyed(String access_token) {
if (futureMap.containsKey(access_token)) {
futureMap.get(access_token).cancel(true);
logger.info("destroyed appid:{}", access_token);
}
}
/**
* 获取 jsapi_ticket
*
* @param access_token access_token
* @return token
*/
public static String getJsapiTicket(String access_token) {
return jssdkMap.get(access_token);
}
/**
* access_token 的 jsapi_ticket
* 适用于单一微信号
*
* @return token
*/
public static String getDefaultJsapiTicket() {
Object[] objs = jssdkMap.values().toArray();
return objs.length > 0 ? objs[0].toString() : null;
}
}
| [
"11"
] | 11 |
6f3a059f58e0895239898585e29be7136fdf66e0 | 4454cc435a02ce75a98885dc0ec31b0d456e2f58 | /PenguinFish/src/main/ThreadManager.java | 34bc99afa10758a4bde86283db39c6c1ff0943a1 | [] | no_license | camieac/penguinfish | 26519cf962af82bf619a2ca055a7ff6fab65e384 | 00e38caaf467821e9be40127a55395fb479a5c7f | refs/heads/master | 2021-01-13T01:51:08.388132 | 2015-01-17T21:39:37 | 2015-01-17T21:39:37 | 26,008,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | package main;
import graphics.Window;
import sound.SoundManager;
/**
* Starts the Window, Game and SoundManager threads. Sets up the DataStore
* class, to communicate between Threads.
*
* @author Andrew J. Rigg, Cameron A. Craig, Euan Mutch, Duncan Robertson,
* Stuart Thain
* @since 25th March 2014
*
*/
public class ThreadManager {
/**
* @param args
* No arguments are used.
*/
public static void main(String[] args) {
new ThreadManager();
boolean gameStarted = false;
while(true){
if(!gameStarted && DataStore.getInstance().gameState == State.PLAYING){
gameStarted = true;
//old set game fields
(new Thread(new Game())).start();
}
try {
Thread.sleep(16);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/**
*
*/
public ThreadManager() {
DataStore.getInstance();
DataStore.getInstance().setInitialFields();
DataStore.getInstance().setGameFields();
(new Thread(new Window())).start();
System.out.println("Started Window Thread.");
// (new Thread(new Game())).start();
// (new Thread(new SoundManager())).start();
// System.out.println("Started SoundManager Thread.");
}
} | [
"camieac@gmail.com"
] | camieac@gmail.com |
0090f56d55176735414bf52285284eb450b08c87 | 596c7846eabd6e8ebb83eab6b83d6cd0801f5124 | /spring-cache/springboot2-cache-redis-cluster-jedis/src/main/java/com/github/bjlhx15/springcache/boot2/redis/pool/ApplicationMain.java | 4e90dd774279d2c3297901b9cdcbefab989c1f24 | [] | no_license | zzw0598/common | c219c53202cdb5e74a7c76d18f90e18eca983752 | 76abfb43c93da4090bbb8861d27bbcb990735b80 | refs/heads/master | 2023-03-10T02:30:44.310940 | 2021-02-19T07:59:16 | 2021-02-19T07:59:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package com.github.bjlhx15.springcache.boot2.redis.pool;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ImportResource;
@SpringBootApplication
@EnableCaching
//xml资源
@ImportResource({
"classpath:applicationContext.xml"
})
public class ApplicationMain {
public static void main(String[] args) {
SpringApplication.run(ApplicationMain.class, args);
}
}
| [
"lihongxu6@jd.com"
] | lihongxu6@jd.com |
c969e3d85c9243cb994cbeedf6a1bb1affd8bf00 | bf0e71c3fd68f2314b8ca4dbc57b2b2d3f0d4ff7 | /src/动态规划/LongArraySeq.java | 024bc441e3d2d4b2d82af4e0ab267e4f5bc8a7ab | [] | no_license | zhenshiyiyang/Algorithm | 7a71c0cdc8991dc1831ca95bbb008c0e6b38a53b | 0dc1c45cb188e7d8130abf2b17985c1951ebb455 | refs/heads/master | 2021-07-10T20:25:30.544891 | 2019-03-08T15:57:11 | 2019-03-08T15:57:11 | 143,172,979 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,480 | java | package 动态规划;
import java.util.Stack;
/*
最长公共子序列,利用dp算法,分两种情况考虑即可,最后利用栈来对子序列进行求值输出。
*/
public class LongArraySeq {
public static void main(String[] args){
String str1 = "axbydzenf";
String str2 = "acbsdiepf";
char[] s1 = str1.toCharArray();
char[] s2 = str2.toCharArray();
System.out.println(longestSeq(s1,s2));
}
public static int longestSeq(char[] s1,char[] s2){
int n = s1.length;
int m = s2.length;
int[][] dp = new int[n+1][m+1];
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= m; j++) {
if(i==0 || j==0){
dp[i][j] = 0;
}else{
if(s1[i-1]==s2[j-1]){
dp[i][j] = dp[i-1][j-1]+1;
}else{
dp[i][j] = Math.max(dp[i-1][j],dp[i][j-1]);
}
}
}
}
Stack stack = new Stack();
int i = s1.length - 1;
int j = s2.length - 1;
while((i >= 0) && (j >= 0)){
if(s1[i] == s2[j]){//字符串从后开始遍历,如若相等,则存入栈中
stack.push(s1[i]);
i--;
j--;
}else{
//如果字符串的字符不同,则在数组中找
// 相同的字符,注意:数组的行列要比字
// 符串中字符的个数大1,因此i和j要各加1
if(dp[i+1][j] > dp[i][j+1]){
j--;
}else{
i--;
}
}
}
while(!stack.isEmpty()){//打印输出栈正好是正向输出最大的公共子序列
System.out.print(stack.pop());
}
return dp[n][m];
}
}
| [
"2224949166@qq.com"
] | 2224949166@qq.com |
4b6fe48423595405d2c8581a7fc74a7bcab533aa | 8ba1c25d48c7ebcec04d4bb7fbfda3b1453d2851 | /src/Address.java | bd29dc77a2a877af8073f59cf41f8b5af6903326 | [] | no_license | gitnoob/PersonKommunV3 | 99ca580ddf0c534615dd58a3aff8813ee59d01c7 | 55a1bc95b057b4a7de029205b9882cd01e538e9b | refs/heads/master | 2020-05-02T11:25:55.599663 | 2013-02-14T20:18:30 | 2013-02-14T20:18:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,846 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author melias
* Miguel Elias
* nobody.su@gmail.com
*/
public class Address {
//Instanzveriablen
private int id;
private String strasse;
private String hausnummer;
private String plz;
private String ort;
//Default-Konstruktor
public Address() {
id = -1;
strasse = "";
hausnummer = "";
plz = "";
ort = "";
}
//Konstruktor mit Parametern
public Address(int _id, String _strasse, String _hausnummer, String _plz, String _ort) {
id = _id;
strasse = _strasse;
hausnummer = _hausnummer;
plz = _plz;
ort = _ort;
}
// get / set ID
public void setId(int _id){
id = _id;
}
public int getId(){
return id;
}
// get / set Strasse
public void setStrasse(String _strasse){
strasse = _strasse;
}
public String getStrasse(){
return strasse;
}
// get / set Hausnummer
public void setHausnummer(String _hausnummer){
hausnummer = _hausnummer;
}
public String getHausnummer(){
return hausnummer;
}
// get / set PLZ
public void setPlz(String _plz){
plz = _plz;
}
public String getPlz(){
return plz;
}
// get / set Ort
public void setOrt(String _ort){
ort = _ort;
}
public String getOrt(){
return ort;
}
public boolean getSearchString(String _searchString){
return (strasse+hausnummer+plz+ort).contains(_searchString);
}
}
| [
"nobody.su@gmail.com"
] | nobody.su@gmail.com |
d05c41aee7ac1e0e8aa4bd9d5a0ead3a490c10e4 | ef0c1514e9af6de3ba4a20e0d01de7cc3a915188 | /sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/models/InsightsTableResultColumnsItem.java | 486e7914039cbf890d3683f95e4939c37b1b0bcb | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"CC0-1.0",
"BSD-3-Clause",
"UPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-generic-cla"
] | permissive | Azure/azure-sdk-for-java | 0902d584b42d3654b4ce65b1dad8409f18ddf4bc | 789bdc6c065dc44ce9b8b630e2f2e5896b2a7616 | refs/heads/main | 2023-09-04T09:36:35.821969 | 2023-09-02T01:53:56 | 2023-09-02T01:53:56 | 2,928,948 | 2,027 | 2,084 | MIT | 2023-09-14T21:37:15 | 2011-12-06T23:33:56 | Java | UTF-8 | Java | false | false | 1,738 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.securityinsights.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
/** The InsightsTableResultColumnsItem model. */
@Fluent
public final class InsightsTableResultColumnsItem {
/*
* the type of the colum
*/
@JsonProperty(value = "type")
private String type;
/*
* the name of the colum
*/
@JsonProperty(value = "name")
private String name;
/**
* Get the type property: the type of the colum.
*
* @return the type value.
*/
public String type() {
return this.type;
}
/**
* Set the type property: the type of the colum.
*
* @param type the type value to set.
* @return the InsightsTableResultColumnsItem object itself.
*/
public InsightsTableResultColumnsItem withType(String type) {
this.type = type;
return this;
}
/**
* Get the name property: the name of the colum.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: the name of the colum.
*
* @param name the name value to set.
* @return the InsightsTableResultColumnsItem object itself.
*/
public InsightsTableResultColumnsItem withName(String name) {
this.name = name;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
}
| [
"noreply@github.com"
] | Azure.noreply@github.com |
8f90df3767497a5ee918ffbfa31dfededf608901 | 0784797c4ba81d0e1be3341d2409ee4eddb8b581 | /src/main/java/com/hengo/util/BeanValidator.java | 1c45c26b0600eb2eee59193d48f9162ceb09ea3c | [] | no_license | changsongyang/permission | ed95ff1d80cd6cf8f92744aff3760aa88c1c81bf | 95de9da4353833670593b7cdfb88ee3831e08828 | refs/heads/master | 2020-03-15T21:19:20.323760 | 2018-04-06T15:36:23 | 2018-04-06T15:36:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,321 | java | package com.hengo.util;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.hengo.exception.ParamException;
import org.apache.commons.collections.MapUtils;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import java.util.*;
/**
* 校验工具
* Created by Hengo.
* 2018/4/5 16:03
*/
public class BeanValidator {
private static ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
public static <T> Map<String, String> validate(T t, Class... groups) {
Validator validator = validatorFactory.getValidator();
Set validateResult = validator.validate(t, groups);
if (validateResult.isEmpty()) {
return Collections.emptyMap();
} else {
LinkedHashMap errors = Maps.newLinkedHashMap();
Iterator iterator = validateResult.iterator();
while (iterator.hasNext()) {
ConstraintViolation violation = (ConstraintViolation) iterator.next();
errors.put(violation.getPropertyPath().toString(), violation.getMessage());
}
return errors;
}
}
public static Map<String, String> validateList(Collection<?> collection) {
Preconditions.checkNotNull(collection);
Iterator iterator = collection.iterator();
Map errors;
do {
if (!iterator.hasNext()) {
return Collections.emptyMap();
}
Object object = iterator.next();
errors = validate(object, new Class[0]);
} while (errors.isEmpty());
return errors;
}
public static Map<String, String> validateObject(Object first, Object... objects) {
if (objects != null && objects.length > 0) {
return validateList(Lists.asList(first, objects));
} else {
return validate(first, new Class[0]);
}
}
public static void check(Object param) throws ParamException {
Map<String, String> map = BeanValidator.validateObject(param);
if (MapUtils.isNotEmpty(map)) {
throw new ParamException(map.toString());
}
}
}
| [
"toheng@foxmail.com"
] | toheng@foxmail.com |
244e80ab0884f769494ad96845b64852ecbef25b | ad598bb5950c3a324a8dfff64cd7c3f1f4e9d0b9 | /src/test/java/ru/ematveev/model/PlayerTest.java | c991a353faa030314f0a345f19c27a0d377920f0 | [] | no_license | evgenymatveev/TicTacToe | e3a3bb3318a4b825df3b75fe5131bb442ef0a344 | 0167bad7bf4a4e925ff895bd0d1d4116e9668e0d | refs/heads/master | 2021-01-13T15:44:59.042584 | 2017-01-12T20:12:55 | 2017-01-12T20:12:55 | 76,860,165 | 2 | 0 | null | 2016-12-19T12:26:11 | 2016-12-19T12:26:11 | null | UTF-8 | Java | false | false | 1,075 | java | package ru.ematveev.model;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* Class PlayerTest tests the metods of the class Player.
* @author Matveev Evgeny.
* @version 1.0.
* @since 25.12.2016.
*/
public class PlayerTest {
/**
* Metod check return Name.
* @throws Exception Exception.
*/
@Test
public void testGetName() throws Exception {
final String inputValue = "Evgeny";
final String expectedValue = inputValue;
final Player player = new Player(inputValue, null);
final String actualValue = player.getName();
assertEquals(expectedValue, actualValue);
}
/**
* Metod check return figure.
* @throws Exception Exception.
*/
@Test
public void testGetFigure() throws Exception {
final Figure inputValue = Figure.O;
final Figure expectedValue = inputValue;
final Player player = new Player(null, inputValue);
final Figure actualValue = player.getFigure();
assertEquals(expectedValue, actualValue);
}
} | [
"evgeni2007@yandex.ru"
] | evgeni2007@yandex.ru |
9c3ababf9f961f471ed2ff130e37f7f9a7254941 | 2794c6e925578d6a1223dc40bf2db0cd8fd7da8b | /src/main/java/com/tang/model/SmartBoss.java | 51b79d110167c79afaf6cc94929849a5ef4041e2 | [] | no_license | TourDJ/study-system | c3e89e01c4001468d365f23d8977a7ae72a2fcf2 | 228f6d303378cff0e943b7019fd0b4566bb1e6ca | refs/heads/master | 2020-03-30T01:06:35.228412 | 2019-01-31T04:13:01 | 2019-01-31T04:13:01 | 150,559,661 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 132 | java | package com.tang.model;
import com.tang.service.BookingService;
public class SmartBoss {
public void goSomewhere() {
}
}
| [
"tang@localhost.localdomain"
] | tang@localhost.localdomain |
b3bc62aa7d9ea25a78fcd56566ef0ee6b69c872e | 29ba56f3c109bf8a97939d8a801d073b1e632bee | /src/com/learn/leetcode/everyday/listNode/ReverseBetween.java | 2cc988ebd26acf502339399c10c6262e9422aee8 | [] | no_license | yanglklk/algorithm_1 | f65047a62e522a4c02714ad2e604ad8c2045bb3b | ce30dc0f2e8c13f885ba2323e04e85268f36d266 | refs/heads/master | 2022-06-07T14:20:15.176170 | 2022-06-03T02:40:10 | 2022-06-03T02:40:10 | 212,273,413 | 1 | 0 | null | 2020-06-12T07:28:50 | 2019-10-02T06:50:36 | Java | UTF-8 | Java | false | false | 4,052 | java | package com.learn.leetcode.everyday.listNode;
import com.sun.xml.internal.bind.v2.model.core.ID;
import com.yanglk.algorithm.link_.ListNode;
import com.yanglk.algorithm.tree_.TreeNode;
import java.util.List;
public class ReverseBetween {
public static void main(String[] args) {
ListNode listNode = new ListNode(1,new ListNode(2,new ListNode(3,new ListNode(4,new ListNode(5)))));
//System.out.println(new ReverseBetween().reverseBetween(listNode, 1, 4));
//new ReverseBetween().largestMerge("guguuuuuuuuuuuuuuguguuuuguug","gguggggggguuggguugggggg");
new ReverseBetween().maxNumberOfBalloons("nlaebolko");
}
public ListNode reverseBetween(ListNode head, int left, int right) {
ListNode pre = null;
ListNode cur = head;
ListNode start = null;
ListNode end = null;
int count = 1;
while (cur!=null){
if (count==left){
start = pre;
}
if (count==right){
end = cur;
break;
}
pre = cur;
cur = cur.next;
count++;
}
if (start==null){
start = new ListNode(-1,head);
ListNode c = start.next;
start.next= end.next;
end.next= null;
while (c!=null){
ListNode node = c.next;
c.next= start.next;
start.next=c;
c= node;
}
return start.next;
}
ListNode c = start.next;
start.next= end.next;
end.next= null;
while (c!=null){
ListNode node = c.next;
c.next= start.next;
start.next=c;
c= node;
}
return head;
}
public ListNode reverse(ListNode head) {
if (head==null){
return head;
}
ListNode root = new ListNode(-1);
root.next = head;
ListNode next = head.next;
while (next != null) {
head.next=next.next;
next.next= root.next;
root.next=next;
next=head.next;
}
return root.next;
}
public ListNode reverseHelper(ListNode head) {
if (head==null || head.next==null){
return head;
}
ListNode node = reverseHelper(head.next);
head.next.next = head;
head.next=null;
return node;
}
public boolean isSymmetric(TreeNode root) {
return isSymmetric1(root,root);
}
public boolean isSymmetric1(TreeNode right,TreeNode left) {
if (right==null && left==null){
return true;
}
if ((right==null && left!=null) || (right!=null && left==null)){
return false;
}
return right.val==left.val && isSymmetric1(right.right,left.left) && isSymmetric1(right.left,left.right);
}
public String largestMerge(String word1, String word2) {
int n1 = word1.length();
int n2 = word2.length();
int r1 =0, r2=0;
StringBuffer sb = new StringBuffer();
while (r1<n1 || r2 < n2){
if (word1.substring(r1).compareTo(word2.substring(r2))<0){
sb.append(word2.charAt(r2++));
}else {
sb.append(word1.charAt(r1++));
}
}
return sb.toString();
}
public int maxNumberOfBalloons(String text) {
int[] count = new int[5];
char[] chars = text.toCharArray();
for (char aChar : chars) {
if (aChar=='b'){
count[0]++;
}
if (aChar=='a'){
count[1]++;
}
if (aChar=='l'){
count[2]++;
}
if (aChar=='o'){
count[3]++;
}
if (aChar=='n'){
count[4]++;
}
}
return Math.min(Math.min(Math.min(count[0],count[1]),count[4]),(Math.min(count[2]/2,count[3]/2)));
}
}
| [
"yangliankun@58.com"
] | yangliankun@58.com |
a876d8b51f175a761b26970ef2466fbd9a925c78 | 4749d3cf395522d90cb74d1842087d2f5671fa87 | /heron/lc212.java | 7bebb62241a5a70db1dd0f68a569fc2df223471a | [] | no_license | AliceTTXu/LeetCode | c1ad763c3fa229362350ce3227498dfb1f022ab0 | ed15eb27936b39980d4cb5fb61cd937ec7ddcb6a | refs/heads/master | 2021-01-23T11:49:49.903285 | 2018-08-03T06:00:16 | 2018-08-03T06:00:16 | 33,470,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,941 | java | public class Solution {
private Set<String> resultSet = new HashSet<>();
public List<String> findWords(char[][] board, String[] words) {
// Builds the trie
Trie trie = new Trie();
for (String word : words) {
trie.insert(word);
}
// Searches
int m = board.length;
int n = board[0].length;
boolean[][] visited = new boolean[m][n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
searchAt(board, "", i, j, trie, m, n, visited);
}
}
return new ArrayList<String>(resultSet);
}
private void searchAt(char[][] board, String word, int row, int col, Trie trie, int m, int n, boolean[][] visited) {
// If out of bound or visted, stops here
if (!((row >= 0 && row < m) && (col >= 0 && col < n)) || visited[row][col]) {
return;
}
// Gets the new word
word = word + board[row][col];
// No word in dictionary starts with this string, stops here
if (!trie.containsStartWith(word)) {
return;
}
// If the dictionary contains the word we have so far, saves to the result set
if (trie.contains(word)) {
resultSet.add(word);
}
// Goes to next position from here
visited[row][col] = true;
searchAt(board, word, row + 1, col, trie, m, n, visited);
searchAt(board, word, row - 1, col, trie, m, n, visited);
searchAt(board, word, row, col + 1, trie, m, n, visited);
searchAt(board, word, row, col - 1, trie, m, n, visited);
visited[row][col] = false;
}
class TrieNode {
public TrieNode[] children = new TrieNode[26];
public String item = "";
}
class Trie {
private TrieNode root = new TrieNode();
public void insert(String word) {
TrieNode node = root;
for (char c : word.toCharArray()) {
if (node.children[c - 'a'] == null) {
node.children[c - 'a'] = new TrieNode();
}
node = node.children[c - 'a'];
}
node.item = word;
}
public boolean containsStartWith(String prefix) {
TrieNode node = root;
for (char c : prefix.toCharArray()) {
if (node.children[c - 'a'] == null) {
return false;
}
node = node.children[c - 'a'];
}
return true;
}
public boolean contains(String word) {
TrieNode node = root;
for (char c : word.toCharArray()) {
if (node.children[c - 'a'] == null) {
return false;
}
node = node.children[c - 'a'];
}
return node.item.equals(word);
}
}
}
| [
"heron.yang.tw@gmail.com"
] | heron.yang.tw@gmail.com |
c2309f24d4d55e3045b9abe838f35572bf39b15e | 0ee881793de1baa8c6334591dc65e891d737520e | /doc/patch/antgo/alpha/culsite/test/cn/com/upcard/mgateway/util/.svn/text-base/AssertTest.java.svn-base | 255ea1de4f695c6abda975e25e6b0f5aa50aa62f | [] | no_license | chenliang0508/practice | e3edc3eab89390c6c1287efec03c1dc15c0acaa2 | de1bf709a1bca32a626304a25c53146c2a6ddda0 | refs/heads/master | 2020-04-27T05:40:55.815682 | 2019-05-31T01:53:48 | 2019-05-31T01:53:48 | 174,087,164 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 228 | package cn.com.upcard.mgateway.util;
import org.junit.Test;
import org.springframework.util.Assert;
public class AssertTest {
@Test
public void testIsNull() {
Assert.isNull("", "value for redis set can not be null");
}
}
| [
"chengliang0508@163.com"
] | chengliang0508@163.com | |
92f482f90675b564fdfd98d737f81712ed33268a | 21bcd1da03415fec0a4f3fa7287f250df1d14051 | /sources/org/jivesoftware/smackx/pubsub/Affiliation.java | b04879a3e0dc54c8d3ede27ca631c5218d194342 | [] | no_license | lestseeandtest/Delivery | 9a5cc96bd6bd2316a535271ec9ca3865080c3ec8 | bc3fae8f30804a2520e6699df92c2e6a4a0a7cfc | refs/heads/master | 2022-04-24T12:14:22.396398 | 2020-04-25T21:50:29 | 2020-04-25T21:50:29 | 258,875,870 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,301 | java | package org.jivesoftware.smackx.pubsub;
import com.fasterxml.jackson.core.p162w.C3868i;
import org.jivesoftware.smack.packet.ExtensionElement;
public class Affiliation implements ExtensionElement {
public static final String ELEMENT = "affiliation";
protected String node;
protected Type type;
public enum Type {
member,
none,
outcast,
owner,
publisher
}
public Affiliation(String str, Type type2) {
this.node = str;
this.type = type2;
}
private void appendAttribute(StringBuilder sb, String str, String str2) {
sb.append(C3868i.f12248b);
sb.append(str);
sb.append("='");
sb.append(str2);
sb.append("'");
}
public String getElementName() {
return "affiliation";
}
public String getNamespace() {
return null;
}
public String getNodeId() {
return this.node;
}
public Type getType() {
return this.type;
}
public String toXML() {
StringBuilder sb = new StringBuilder("<");
sb.append(getElementName());
appendAttribute(sb, "node", this.node);
appendAttribute(sb, "affiliation", this.type.toString());
sb.append("/>");
return sb.toString();
}
}
| [
"zsolimana@uaedomain.local"
] | zsolimana@uaedomain.local |
0f6465b4220c6b2feb94f9f733e43991b819196e | 054e2aa5cfe949c336095545b582dc5cb4e594b0 | /tests/players/ClericTest.java | 6ad6f43a98e757dbda3d3aa7996b1d4c5ba3df85 | [] | no_license | Joe-Darling/Harpspoon | 771cac0a17e061eccdd41e0a87cad65ed932c5d9 | db91d482053bed45fe0c3d6045ccd10e29cfcc13 | refs/heads/master | 2021-08-22T03:49:53.389214 | 2017-07-05T19:41:27 | 2017-07-05T19:41:27 | 112,434,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,504 | java | package players;
import cards.Card;
import game.Harpspoon;
/**
* Created by Joe on 7/5/2017.
* Cleric test class
*/
public class ClericTest {
public static void main(String[] args) {
Harpspoon.rng.setSeed(1);
Player p1 = new Cleric(2);
p1.newGame();
p1.newRound();
p1.drawCards(4);
for(Card card : p1.getHand())
System.out.println(card);
Card correctCard;
Card c = p1.playACard();
System.out.println("Did Cleric pick right card? " + (c == null ? "OK" : "NO") + "\n");
p1.newRound();
p1.drawCards(1);
for(Card card : p1.getHand())
System.out.println(card);
correctCard = p1.getHand().get(1);
c = p1.playACard();
System.out.println("Did Cleric pick right card? " + (correctCard.equals(c) ? "OK" : "NO") + "\n");
p1.newRound();
p1.drawCards(1);
for(Card card : p1.getHand())
System.out.println(card);
correctCard = p1.getHand().get(1);
c = p1.playACard();
p1.summonCard(c);
System.out.println("Did Cleric pick right card? " + (correctCard.equals(c) ? "OK" : "NO") + "\n");
p1.newRound();
p1.drawCards(1);
for(Card card : p1.getHand())
System.out.println(card);
correctCard = p1.getHand().get(3);
c = p1.playACard();
System.out.println("Did Cleric pick right card? " + (correctCard.equals(c) ? "OK" : "NO") + "\n");
}
}
| [
"joedarling7@gmail.com"
] | joedarling7@gmail.com |
01ee0c66931910a08a7f7157542ed84305bcfa34 | fac5d6126ab147e3197448d283f9a675733f3c34 | /src/main/java/dji/sdksharedlib/hardware/abstractions/flightcontroller/flightassistant/IntelligentFlightAssistantMavicProAbstraction.java | 0552f3f80a27d4bbf9fa68caff154249457c05cf | [] | no_license | KnzHz/fpv_live | 412e1dc8ab511b1a5889c8714352e3a373cdae2f | 7902f1a4834d581ee6afd0d17d87dc90424d3097 | refs/heads/master | 2022-12-18T18:15:39.101486 | 2020-09-24T19:42:03 | 2020-09-24T19:42:03 | 294,176,898 | 0 | 0 | null | 2020-09-09T17:03:58 | 2020-09-09T17:03:57 | null | UTF-8 | Java | false | false | 3,660 | java | package dji.sdksharedlib.hardware.abstractions.flightcontroller.flightassistant;
import dji.common.error.DJIError;
import dji.common.mission.activetrack.ActiveTrackMode;
import dji.common.util.CallbackUtils;
import dji.fieldAnnotation.EXClassNullAway;
import dji.midware.data.config.P3.Ccode;
import dji.midware.data.model.P3.DataCameraSetTrackingParms;
import dji.midware.data.model.P3.DataSingleVisualParam;
import dji.midware.interfaces.DJIDataCallBack;
import dji.sdksharedlib.hardware.abstractions.DJISDKCacheHWAbstraction;
@EXClassNullAway
public class IntelligentFlightAssistantMavicProAbstraction extends IntelligentFlightAssistant1860Abstraction {
public void setActiveTrackGestureModeEnabled(final Boolean isEnabled, final DJISDKCacheHWAbstraction.InnerCallback callback) {
new DataSingleVisualParam().setGet(false).setParamCmdId(DataSingleVisualParam.ParamCmdId.TRACK_INTELLIGENT).setTrackIntelligent(isEnabled.booleanValue()).start(new DJIDataCallBack() {
/* class dji.sdksharedlib.hardware.abstractions.flightcontroller.flightassistant.IntelligentFlightAssistantMavicProAbstraction.AnonymousClass1 */
public void onSuccess(Object model) {
if (isEnabled.booleanValue()) {
DataCameraSetTrackingParms.getInstance().setIsTrackingEnable(true).start(new DJIDataCallBack() {
/* class dji.sdksharedlib.hardware.abstractions.flightcontroller.flightassistant.IntelligentFlightAssistantMavicProAbstraction.AnonymousClass1.AnonymousClass1 */
public void onSuccess(Object model) {
CallbackUtils.onSuccess(callback, (Object) null);
}
public void onFailure(Ccode ccode) {
CallbackUtils.onFailure(callback, ccode);
}
});
} else {
DataCameraSetTrackingParms.getInstance().setIsTrackingEnable(false).start(new DJIDataCallBack() {
/* class dji.sdksharedlib.hardware.abstractions.flightcontroller.flightassistant.IntelligentFlightAssistantMavicProAbstraction.AnonymousClass1.AnonymousClass2 */
public void onSuccess(Object model) {
CallbackUtils.onSuccess(callback, (Object) null);
}
public void onFailure(Ccode ccode) {
CallbackUtils.onFailure(callback, ccode);
}
});
}
}
public void onFailure(Ccode ccode) {
CallbackUtils.onFailure(callback, ccode);
}
});
}
public void setActiveTrackMode(ActiveTrackMode mode, final DJISDKCacheHWAbstraction.InnerCallback callback) {
if (mode == ActiveTrackMode.UNKNOWN) {
CallbackUtils.onFailure(callback, DJIError.COMMON_PARAM_INVALID);
} else {
new DataSingleVisualParam().setGet(false).setParamCmdId(DataSingleVisualParam.ParamCmdId.TRACK_MODE).setTrackMode(convertModeToTrackingMode(mode)).start(new DJIDataCallBack() {
/* class dji.sdksharedlib.hardware.abstractions.flightcontroller.flightassistant.IntelligentFlightAssistantMavicProAbstraction.AnonymousClass2 */
public void onSuccess(Object model) {
CallbackUtils.onSuccess(callback, (Object) null);
}
public void onFailure(Ccode ccode) {
CallbackUtils.onFailure(callback, ccode);
}
});
}
}
}
| [
"michael@districtrace.com"
] | michael@districtrace.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.