blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
df45ef01bf32fdcdf61ac3002b6c2a2fa4e9a457 | a28380c65fe68ef0431d0415b9db7e1f3fc816f5 | /Fragmentos-master/app/src/main/java/elrizo/com/fragmentos/model/Juego.java | 3567e3ddbb6c86729fc5bbe0d50ed070dee81817 | [] | no_license | Chino009/Fragment | a42ba7073a8213a07f82787fee3b5ec4f65abf59 | 92398c5b6e3a140f51726aa8e8892d5b0cb2fa39 | refs/heads/master | 2023-01-29T18:08:58.897033 | 2020-12-16T05:31:41 | 2020-12-16T05:31:41 | 321,875,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,291 | java | package elrizo.com.fragmentos.model;
public class Juego {
private int idJuego;
private String imagen;
private String titulo;
private int clasificacion;
private String descripcion;
public Juego() {
}
public Juego(int idJuego, String imagen, String titulo, int clasificacion, String descripcion) {
this.idJuego = idJuego;
this.imagen = imagen;
this.titulo = titulo;
this.clasificacion = clasificacion;
this.descripcion = descripcion;
}
public int getIdJuego() {
return idJuego;
}
public void setIdJuego(int idJuego) {
this.idJuego = idJuego;
}
public String getImagen() {
return imagen;
}
public void setImagen(String imagen) {
this.imagen = imagen;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public int getClasificacion() {
return clasificacion;
}
public void setClasificacion(int clasificacion) {
this.clasificacion = clasificacion;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
}
| [
"cesar-eduardo2000@hotmail.com"
] | cesar-eduardo2000@hotmail.com |
9cfe8f4af4bfa553db90ae3e6d5c6af50855bafe | 82771e845fcd6b31f1c850561c8eb403d6cf22c4 | /gen/com/example/growupsnake/R.java | 22b4460eb7f7302d6b272fc411661d674821fdcb | [] | no_license | Chen0901/GrowUpSnake | ebbd810ce7c7b46f045df65f2afae04060ea2390 | f8e283420538af425efccbc187a2dc50affe443b | refs/heads/master | 2021-01-18T09:38:50.139478 | 2017-03-09T02:58:59 | 2017-03-09T02:58:59 | 84,314,802 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,904 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.growupsnake;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
*/
public static final int activity_horizontal_margin=0x7f050000;
public static final int activity_vertical_margin=0x7f050001;
}
public static final class drawable {
public static final int backg=0x7f020000;
public static final int body=0x7f020001;
public static final int boom2=0x7f020002;
public static final int button1=0x7f020003;
public static final int button1down=0x7f020004;
public static final int button2=0x7f020005;
public static final int button2down=0x7f020006;
public static final int drug=0x7f020007;
public static final int food=0x7f020008;
public static final int gamebg=0x7f020009;
public static final int head=0x7f02000a;
public static final int help=0x7f02000b;
public static final int ic_launcher=0x7f02000c;
public static final int rank=0x7f02000d;
public static final int set=0x7f02000e;
public static final int setdown=0x7f02000f;
public static final int shelf=0x7f020010;
public static final int x=0x7f020011;
public static final int x2=0x7f020012;
}
public static final class id {
public static final int action_settings=0x7f090005;
public static final int button1=0x7f090000;
public static final int button2=0x7f090001;
public static final int textView1=0x7f090002;
public static final int textView2=0x7f090004;
public static final int textView3=0x7f090003;
}
public static final class layout {
public static final int activity_main=0x7f030000;
public static final int game_controller=0x7f030001;
public static final int game_helper=0x7f030002;
public static final int rank_dialog=0x7f030003;
}
public static final class menu {
public static final int main=0x7f080000;
}
public static final class raw {
public static final int bgm=0x7f040000;
public static final int game=0x7f040001;
}
public static final class string {
public static final int action_settings=0x7f060001;
public static final int app_name=0x7f060000;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f070000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f070001;
public static final int Rank=0x7f070002;
}
}
| [
"Cyl0901@126.com"
] | Cyl0901@126.com |
9b34e9df83cea9cfd407b859367a5dfa6f6f7f37 | f7c80eae6bb926d11e43573df2e2c8255e774f87 | /springcloud_rabbitmq_consumer/src/main/java/com/gsm/baseconsumer/StringNameConsumerBBB.java | 7eaaf2ed631a0b0380d2390e9fa7946b487acdfb | [] | no_license | wenjiaqi123/StudySpringCloud_Parent | 4c5461406ab9f484b1f45e5df2778ccd1189a905 | a4f52fcac65efbe458f9a01352245cf18777373f | refs/heads/master | 2021-02-15T03:14:13.421625 | 2020-03-24T04:50:58 | 2020-03-24T04:50:58 | 244,858,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package com.gsm.baseconsumer;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
@Component
// 监听队列
@RabbitListener(queues = "myQueue")
public class StringNameConsumerBBB {
@RabbitHandler
public void doSomeThing(String msg){
System.out.println("我是消费者BBB");
System.out.println(msg);
}
}
| [
"939949243@qq.com"
] | 939949243@qq.com |
0901e576fc62fb9c0815442d25fc2d2c6c353702 | d4bf3f83102c93e259b768e6a38102bf19a7a4af | /build/generated/src/org/apache/jsp/indexx_jsp.java | 748ad09a3befd8bed50467889858ebfc58414469 | [] | no_license | MartinSan145/JoyeriaTalle | d7dd67c3784cd3bddba4657a5205c3665ab5bf56 | 19cd684adeded75770325f31f42055e621828a93 | refs/heads/master | 2020-06-30T00:48:15.791998 | 2019-08-07T20:36:10 | 2019-08-07T20:36:10 | 200,670,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,984 | java | package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import prg.Sesion;
public final class indexx_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List<String> _jspx_dependants;
private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;
public java.util.List<String> getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("\n");
out.write("\n");
out.write("\n");
Sesion.codigo_sucursal = "";
Sesion.codigo_usuario = "";
Sesion.nombre_funcionario = "";
Sesion.nombre_sucursal = "";
Sesion.nombre_usuario = "";
Sesion.perfil = "";
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html lang=\"en\">\n");
out.write(" <head>\n");
out.write(" <meta charset=\"utf-8\">\n");
out.write(" <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n");
out.write(" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n");
out.write(" <title>SOFTWARE SYSTEMOro</title> \n");
out.write(" \n");
out.write(" <link rel=\"stylesheet\" href=\"http://fonts.googleapis.com/css?family=Roboto:400,100,300,500\">\n");
out.write(" <link rel=\"stylesheet\" href=\"form-1/assets/css/font-awesome/css/font-awesome.min.css\">\n");
out.write("\t<link rel=\"stylesheet\" href=\"form-1/assets/css/form-elements.css\">\n");
out.write(" <link rel=\"stylesheet\" href=\"form-1/assets/css/style.css\">\n");
out.write(" <link rel=\"shortcut icon\" href=\"form-1/assets/ico/favicon.png\">\n");
out.write(" \n");
out.write("\n");
out.write(" </head>\n");
out.write(" \n");
out.write(" <body class=\"img-responsive center-box\" style=\"width:50%;\">\n");
out.write(" \n");
out.write(" <div class=\"inner-bg\">\n");
out.write(" <div class=\"container\">\n");
out.write(" \n");
out.write(" <div class=\"row\">\n");
out.write(" <div class=\"col-sm-5 col-sm-offset-2 text\">\n");
out.write(" \n");
out.write(" <h1><strong>SYSTEMOro</strong> Acceso</h1>\n");
out.write(" <div class=\"description\">\n");
out.write(" \t<p>\n");
out.write("\t \tBienvenido al acceso de SYSTEMOro\n");
out.write(" Sistema de Gestion de Compra, Ventas y Servicios\n");
out.write(" JOYERIA SAN RAMON\n");
out.write(" \t</p>\n");
out.write(" \n");
out.write(" \n");
out.write(" </div>\n");
out.write(" \n");
out.write(" </div>\n");
out.write("\n");
out.write(" </div> \n");
out.write(" \n");
out.write(" \n");
out.write(" <div class=\"row\">\n");
out.write(" <div class=\"col-sm-6 col-sm-offset-3 form-box\">\n");
out.write(" \t<div class=\"form-top\">\n");
out.write("\n");
out.write(" \t\t<div class=\"form-top-left\">\n");
out.write("\n");
out.write(" \t\t\t<h3>Inicia sesion para acceder al sistema</h3>\n");
out.write(" \t\t<p>Ingresa su usuario y contraseña</p>\n");
out.write(" \t\t</div>\n");
out.write(" \t\t<div class=\"form-top-right\">\n");
out.write(" \t\t\t<i class=\"fa fa-key\"></i>\n");
out.write(" \n");
out.write("\n");
out.write(" \t\t</div>\n");
out.write(" </div>\n");
out.write(" \n");
out.write(" <div class=\"form-bottom\">\n");
out.write(" <form action=\"acceso\" class=\"form-signin\" method=\"post\"> \n");
out.write(" <div>\n");
out.write(" <label class=\"sr-only\" for=\"txtusuario\">Usuario</label>\n");
out.write(" <input type=\"text\" id=\"txtusuario\" name=\"txtusuario\" class=\"form-control\" required placeholder=\"Ingrese Usuario\" autofocus/></div>\n");
out.write(" <div><label class=\"sr-only\" for=\"txtpass\">Contraseña</label>\n");
out.write(" <input type=\"password\" id=\"txtpass\" name=\"txtpass\" class=\"form-control\" required placeholder=\"Ingrese Contraseña\"/></div>\n");
out.write(" <button class=\"btn btn-lg btn-primary btn-block\" type=\"submit\">Ingresar</button></a>\n");
out.write("\n");
out.write("\n");
out.write(" </form>\n");
out.write("\n");
out.write(" \n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" \n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" \n");
out.write(" </div>\n");
out.write(" \n");
out.write(" \n");
out.write(" <!-- Javascript -->\n");
out.write(" <script src=\"js/jquery-1.11.1.min.js\"></script>\n");
out.write(" <script src=\"js/bootstrap.min_3.js\"></script>\n");
out.write(" <script src=\"js/jquery.backstretch.min.js\"></script>\n");
out.write(" <script src=\"js/scripts.js\"></script>\n");
out.write(" \n");
out.write(" \n");
out.write(" </center>\n");
out.write(" \n");
out.write(" </body>\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"martinsan145@gmail.com"
] | martinsan145@gmail.com |
8fe663c41a6f27a52c620fc8d6b9ca48ad64f9a5 | 81941ad872aa450aaa0d9e5cec5b84bafa931129 | /app/src/main/java/com/weima/aishangyi/pop/FunTypePop.java | 5451ceb08e59633318001a7317fd184403e994ab | [] | no_license | cgy529387306/AiShangYi | b6fc5c1c62e89813916399fdffa5aeaeb11a35be | 6363540293b67b84f640698a51196d899b9cc1e0 | refs/heads/master | 2020-04-26T03:17:06.607710 | 2019-04-01T11:21:24 | 2019-04-01T11:21:24 | 173,262,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,211 | java | package com.weima.aishangyi.pop;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.PopupWindow;
import com.weima.aishangyi.R;
import com.weima.aishangyi.adapter.FunTypeAdapter;
/**
* Created by cgy
*/
public class FunTypePop extends PopupWindow implements View.OnClickListener {
private View rootView;
private ListView listView;
private Context mContext;
private FunTypeAdapter adapter;
private SelectListener selectListener;
public interface SelectListener {
public void onSelected(int type);
}
public FunTypePop(Context context, SelectListener listener) {
super(context);
this.mContext = context;
this.selectListener = listener;
rootView = View.inflate(mContext, R.layout.pop_filter_sort, null);
setFocusable(false);
setOutsideTouchable(false);
setWidth(ViewPager.LayoutParams.MATCH_PARENT);
setHeight(ViewPager.LayoutParams.WRAP_CONTENT);
setContentView(rootView);
setBackgroundDrawable(new BitmapDrawable());
findComponent();
initComponent();
}
private void findComponent() {
listView = (ListView) rootView.findViewById(R.id.listView);
}
private void initComponent() {
rootView.findViewById(R.id.outView).setOnClickListener(this);
adapter = new FunTypeAdapter(mContext, null);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
adapter.setTempIndex(position);
selectListener.onSelected(position+1);
dismiss();
}
});
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.outView){
selectListener.onSelected(-1);
dismiss();
}
}
public void show(View v) {
showAsDropDown(v);
}
}
| [
"661005@nd.com"
] | 661005@nd.com |
5fa176488d669417b2abe9a6b3ea611635f6a3a1 | a3949e0ca18f9ec238ff0fb46a1f0afbf400a8ed | /design/src/main/java/PrincipleDemo/OpenClose/test1/Rectangle.java | 8d7d3f05e5c92c8fd295813db8a9fff69c09ba56 | [] | no_license | qyingit/Design-Patterns | ac34f6d2b6d38d0933d8e888bd07fb63d6af91ef | efab49c9d90033f35e8da1438b9a8f9c96002ba5 | refs/heads/master | 2020-06-19T22:58:47.739218 | 2019-07-26T08:58:54 | 2019-07-26T08:58:54 | 196,905,125 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | package PrincipleDemo.OpenClose.test1;
public class Rectangle extends Shape{
Rectangle(){
super.m_type = 1;
}
void draw() {
System.out.println("绘制矩形");
}
}
| [
"qinyang@iwubida.com"
] | qinyang@iwubida.com |
af1b2f52b190f23b05a9d83925b0c185233eb243 | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Jsoup-92/org.jsoup.nodes.Attributes/BBC-F0-opt-10/12/org/jsoup/nodes/Attributes_ESTest.java | 4d73d734b2a1ec17195c975ce414afbac43280c3 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 44,782 | java | /*
* This file was automatically generated by EvoSuite
* Wed Oct 20 11:45:47 GMT 2021
*/
package org.jsoup.nodes;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.io.IOException;
import java.io.PipedWriter;
import java.io.StringWriter;
import java.nio.BufferOverflowException;
import java.nio.CharBuffer;
import java.nio.ReadOnlyBufferException;
import java.util.Iterator;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.mock.java.io.MockPrintStream;
import org.jsoup.nodes.Attribute;
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Document;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class Attributes_ESTest extends Attributes_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("org.jsoup.nodes.Document$OutputSettings$Syntax", (String) null);
attributes0.put(attribute0);
attributes0.hashCode();
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test01() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.clone();
boolean boolean0 = attributes0.equals(attributes1);
assertTrue(boolean0);
assertNotSame(attributes1, attributes0);
}
@Test(timeout = 4000)
public void test02() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.clone();
Attribute attribute0 = new Attribute("BM4>#JEmu5%'fH{K]!", "BM4>#JEmu5%'fH{K]!", attributes1);
attributes1.put(attribute0);
boolean boolean0 = attributes1.equals(attributes0);
assertEquals(1, attributes1.size());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test03() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("</", true);
Attributes attributes1 = attributes0.put("Tag name must not be empty.", true);
attributes1.remove("Tag name must not be empty.");
assertEquals(1, attributes1.size());
}
@Test(timeout = 4000)
public void test04() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("j}Sr+", "");
Attribute attribute0 = new Attribute("org.jsoup.nodes.EntitiesData", "S");
Attributes attributes1 = attributes0.put(attribute0);
Attributes attributes2 = attributes0.put("@3h2bcK'y(]'Xx:|VAb", "S");
String[] stringArray0 = new String[5];
attributes2.keys = stringArray0;
// Undeclared exception!
// try {
attributes0.addAll(attributes1);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test05() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("org.jsoup.nodes.Document$OutputSettings$Syntax", (String) null);
attributes0.put(attribute0);
int int0 = attributes0.size();
assertEquals(1, int0);
}
@Test(timeout = 4000)
public void test06() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("T8_P8%c", "B", attributes0);
Attributes attributes1 = attributes0.put(attribute0);
int int0 = attributes1.indexOfKey("T8_P8%c");
assertEquals(1, attributes0.size());
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test07() throws Throwable {
Attributes attributes0 = new Attributes();
String string0 = "D:+u5%&/Q>a>2}MkT\\u";
attributes0.putIgnoreCase(string0, "9kOxT FBp@<D)J/J");
attributes0.putIgnoreCase("", "9kOxT FBp@<D)J/J");
int int0 = attributes0.indexOfKey("");
assertEquals(2, attributes0.size());
assertEquals(1, int0);
}
@Test(timeout = 4000)
public void test08() throws Throwable {
Attributes attributes0 = new Attributes();
int int0 = attributes0.indexOfKey("##&rfJ");
assertEquals((-1), int0);
}
@Test(timeout = 4000)
public void test09() throws Throwable {
Attributes attributes0 = new Attributes();
String string0 = "D:+u5%&/Q>a>2}MkT\\u";
attributes0.putIgnoreCase(string0, "9kOxT FBp@<D)J/J");
attributes0.html();
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test10() throws Throwable {
String string0 = Attributes.checkNotNull("qhfst`itnhw}xr)");
assertEquals("qhfst`itnhw}xr)", string0);
}
@Test(timeout = 4000)
public void test11() throws Throwable {
String string0 = Attributes.checkNotNull((String) null);
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test12() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("", "");
attributes0.keys = null;
// Undeclared exception!
// try {
attributes0.toString();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test13() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("KstN", "5{v[t<~i*//r=E");
Attributes attributes1 = attributes0.put(attribute0);
String[] stringArray0 = new String[1];
attributes0.put("f/W+/?LH", "KstN");
attributes1.vals = stringArray0;
// Undeclared exception!
// try {
attributes0.toString();
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 1
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test14() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("/", "/");
attributes0.keys = null;
// Undeclared exception!
// try {
attributes0.removeIgnoreCase("/");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test15() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.removeIgnoreCase((String) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test16() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("/", "/");
String[] stringArray0 = new String[0];
attributes0.keys = stringArray0;
// Undeclared exception!
// try {
attributes0.removeIgnoreCase(".");
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test17() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put(";1aQ'#6", ";1aQ'#6");
attributes1.keys = null;
// Undeclared exception!
// try {
attributes1.remove(";10Q#6");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test18() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.remove((String) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test19() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("/", "/");
String[] stringArray0 = new String[0];
attributes0.keys = stringArray0;
// Undeclared exception!
// try {
attributes0.remove(".");
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test20() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.vals = null;
// Undeclared exception!
// try {
attributes0.putIgnoreCase(" <=\"*kvgodz\" 44je=\"e9]bzu\"", " <=\"*kvgodz\" 44je=\"e9]bzu\"");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test21() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.putIgnoreCase((String) null, (String) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test22() throws Throwable {
Attributes attributes0 = new Attributes();
String[] stringArray0 = new String[1];
attributes0.keys = stringArray0;
// Undeclared exception!
// try {
attributes0.putIgnoreCase("85,,Ig+[", "/#X4+3:%1CX<Ce");
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test23() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.vals = null;
Attribute attribute0 = Attribute.createFromEncoded(":<c.W7u 4+(inv", ":<c.W7u 4+(inv");
// Undeclared exception!
// try {
attributes0.put(attribute0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test24() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.put((Attribute) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test25() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("org.jsoup.nodes.Document$OutputSettings$Syntax", (String) null);
attributes0.put(attribute0);
Attributes attributes1 = attributes0.clone();
String[] stringArray0 = new String[0];
attributes1.vals = stringArray0;
// Undeclared exception!
// try {
attributes1.put(attribute0);
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test26() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("uq%},W3).?WI2=l1a", "org.jsoup.nodes.Attributes$Dataset$EntrySet");
attributes1.keys = null;
// Undeclared exception!
// try {
attributes0.put("U?<y@HA<+Gt^NV/X|", false);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test27() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.put((String) null, false);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test28() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.keys = null;
// Undeclared exception!
// try {
attributes0.put("f*gscp~u3!w)p^%i", "f*gscp~u3!w)p^%i");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test29() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.put((String) null, " </=\"\"");
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test30() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("O{,Zq ;o[Ksx>P", "org.jsoup.nodes.Attributes$Dataset$DatasetIterator");
Attribute attribute0 = new Attribute("org.jsoup.nodes.Attributes$Dataset$DatasetIterator", "org.jsoup.nodes.Attributes$Dataset$DatasetIterator");
Attributes attributes2 = attributes1.put(attribute0);
Attributes attributes3 = attributes2.put("9", "org.jsoup.nodes.Attributes$Dataset$DatasetIterator");
String[] stringArray0 = new String[3];
attributes3.vals = stringArray0;
// Undeclared exception!
// try {
attributes3.put("ScriptDataEndTagOpen", "9");
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test31() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("uq%},W3).?WI2=l1a", "org.jsoup.nodes.Attributes$Dataset$EntrySet");
attributes1.keys = null;
// Undeclared exception!
// try {
attributes1.normalize();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test32() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put(":<c.h@uvM+?inv", ":<c.h@uvM+?inv");
String[] stringArray0 = new String[0];
attributes1.keys = stringArray0;
// Undeclared exception!
// try {
attributes0.normalize();
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test33() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("M/", "M/", attributes0);
Attributes attributes1 = attributes0.put(attribute0);
attributes1.keys = null;
// Undeclared exception!
// try {
attributes0.indexOfKey("M/");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test34() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.indexOfKey((String) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test35() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("d3D%mRQkV*9", true);
String[] stringArray0 = new String[0];
attributes1.keys = stringArray0;
// Undeclared exception!
// try {
attributes1.indexOfKey("d3D%mRQkV*9");
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test36() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("!:<c.W7u 4+(ihv", "!:<c.W7u 4+(ihv");
CharBuffer charBuffer0 = CharBuffer.wrap((CharSequence) "!:<c.W7u 4+(ihv");
// Undeclared exception!
// try {
attributes1.html((Appendable) charBuffer0, (Document.OutputSettings) null);
// fail("Expecting exception: ReadOnlyBufferException");
// } catch(ReadOnlyBufferException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.StringCharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test37() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("width must be > 0", "{XO");
char[] charArray0 = new char[9];
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
Document.OutputSettings document_OutputSettings0 = new Document.OutputSettings();
// Undeclared exception!
// try {
attributes0.html((Appendable) charBuffer0, document_OutputSettings0);
// fail("Expecting exception: BufferOverflowException");
// } catch(BufferOverflowException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("java.nio.CharBuffer", e);
// }
}
@Test(timeout = 4000)
public void test38() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("uxu{@6", "RI-^tpph!4@sqqEgm9A");
Document.OutputSettings document_OutputSettings0 = new Document.OutputSettings();
// Undeclared exception!
// try {
attributes0.html((Appendable) null, document_OutputSettings0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test39() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("T8_P8%c", "B", attributes0);
Attributes attributes1 = attributes0.put(attribute0);
String[] stringArray0 = new String[0];
attributes0.vals = stringArray0;
PipedWriter pipedWriter0 = new PipedWriter();
Document.OutputSettings document_OutputSettings0 = new Document.OutputSettings();
// Undeclared exception!
// try {
attributes1.html((Appendable) pipedWriter0, document_OutputSettings0);
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test40() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("/", "/");
PipedWriter pipedWriter0 = new PipedWriter();
Document.OutputSettings document_OutputSettings0 = new Document.OutputSettings();
// try {
attributes0.html((Appendable) pipedWriter0, document_OutputSettings0);
// fail("Expecting exception: IOException");
// } catch(IOException e) {
// //
// // Pipe not connected
// //
// verifyException("java.io.PipedWriter", e);
// }
}
@Test(timeout = 4000)
public void test41() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("data-", "data-");
Attributes attributes1 = attributes0.clone();
attributes1.keys = null;
// Undeclared exception!
// try {
attributes1.html();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test42() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("org.jsoup.nodes.Attributes$1", "org.jsoup.nodes.Attributes$1");
attributes0.putIgnoreCase("RawtextEndTagName", "]AxTS_'W>U(%l@w_;");
String[] stringArray0 = new String[1];
attributes1.vals = stringArray0;
// Undeclared exception!
// try {
attributes1.html();
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 1
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test43() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("uq%},W3).?WI2=l1a", "org.jsoup.nodes.Attributes$Dataset$EntrySet");
attributes1.keys = null;
// Undeclared exception!
// try {
attributes1.hasKeyIgnoreCase(";n k%+z^`p%zj}");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test44() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.hasKeyIgnoreCase((String) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test45() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("d3D%mRQkV*9", true);
String[] stringArray0 = new String[0];
attributes1.keys = stringArray0;
// Undeclared exception!
// try {
attributes1.hasKeyIgnoreCase("d3D%mRQkV*9");
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test46() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("uq%},W3).?WI2=l1a", "org.jsoup.nodes.Attributes$Dataset$EntrySet");
attributes1.keys = null;
// Undeclared exception!
// try {
attributes1.hasKey("org.jsoup.nodes.Attributes$Dataset$EntrySet");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test47() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.hasKey((String) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test48() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("/", "/");
String[] stringArray0 = new String[0];
attributes0.keys = stringArray0;
// Undeclared exception!
// try {
attributes0.hasKey("/");
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test49() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("", "");
attributes0.keys = null;
// Undeclared exception!
// try {
attributes0.getIgnoreCase(" =\"\"");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test50() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.getIgnoreCase((String) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test51() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("dp#ku5+=9n)x", "data-");
String[] stringArray0 = new String[0];
attributes0.keys = stringArray0;
// Undeclared exception!
// try {
attributes0.getIgnoreCase("9");
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test52() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("i~|Br@~+GS.", true);
attributes1.keys = null;
// Undeclared exception!
// try {
attributes1.get("i~|Br@~+GS.");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test53() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.get((String) null);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // Object must not be null
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test54() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("d3D%mRQkV*9", true);
String[] stringArray0 = new String[0];
attributes1.keys = stringArray0;
// Undeclared exception!
// try {
attributes0.get("6n{?");
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test55() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.keys = null;
// Undeclared exception!
// try {
attributes0.clone();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test56() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase(".", ".");
Attributes attributes1 = attributes0.clone();
attributes1.vals = null;
// Undeclared exception!
// try {
attributes1.asList();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test57() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("", true);
// Undeclared exception!
// try {
attributes0.asList();
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // String must not be empty
// //
// verifyException("org.jsoup.helper.Validate", e);
// }
}
@Test(timeout = 4000)
public void test58() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("O{,Zq ;o[Ksx>P", "org.jsoup.nodes.Attributes$Dataset$DatasetIterator");
Attributes attributes2 = attributes0.put("9", "&@b!Q");
String[] stringArray0 = new String[1];
attributes2.vals = stringArray0;
// Undeclared exception!
// try {
attributes1.asList();
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 1
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test59() throws Throwable {
Attributes attributes0 = new Attributes();
// Undeclared exception!
// try {
attributes0.addAll((Attributes) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.jsoup.nodes.Attributes", e);
// }
}
@Test(timeout = 4000)
public void test60() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = new Attribute("T8_P8%c", "B", attributes0);
attributes0.put(attribute0);
String[] stringArray0 = new String[0];
attributes0.vals = stringArray0;
// Undeclared exception!
// try {
attributes0.addAll(attributes0);
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // 0
// //
// verifyException("org.jsoup.nodes.Attributes$1", e);
// }
}
@Test(timeout = 4000)
public void test61() throws Throwable {
Attributes attributes0 = new Attributes();
Attribute attribute0 = Attribute.createFromEncoded("%G9JD{_t", "");
Attributes attributes1 = attributes0.put(attribute0);
StringWriter stringWriter0 = new StringWriter(273);
Document.OutputSettings document_OutputSettings0 = new Document.OutputSettings();
attributes1.html((Appendable) stringWriter0, document_OutputSettings0);
assertEquals(1, attributes0.size());
assertEquals(" %G9JD{_t=\"\"", stringWriter0.toString());
}
@Test(timeout = 4000)
public void test62() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.remove("9kOxT FBp@<D)J/J");
assertEquals(0, attributes0.size());
}
@Test(timeout = 4000)
public void test63() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("I/z.t'CQS", true);
attributes0.put("I/z.t'CQS", "I/z.t'CQS");
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test64() throws Throwable {
Attributes attributes0 = new Attributes();
String string0 = attributes0.get("u(kn");
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test65() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("</", true);
attributes0.addAll(attributes1);
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test66() throws Throwable {
Attributes attributes0 = new Attributes();
int int0 = attributes0.size();
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test67() throws Throwable {
Attributes attributes0 = new Attributes();
Iterator<Attribute> iterator0 = attributes0.iterator();
assertNotNull(iterator0);
}
@Test(timeout = 4000)
public void test68() throws Throwable {
Attributes attributes0 = new Attributes();
String string0 = attributes0.html();
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test69() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put(",tofV#%g{%#", "t");
Attributes attributes1 = new Attributes();
Attributes attributes2 = attributes1.clone();
Attributes attributes3 = attributes2.put("M% z@6q", true);
boolean boolean0 = attributes0.equals(attributes3);
assertEquals(1, attributes0.size());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test70() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("S", "_^S");
Attributes attributes2 = new Attributes();
boolean boolean0 = attributes2.equals(attributes1);
assertEquals(1, attributes0.size());
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test71() throws Throwable {
Attributes attributes0 = new Attributes();
Object object0 = new Object();
boolean boolean0 = attributes0.equals(object0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test72() throws Throwable {
Attributes attributes0 = new Attributes();
boolean boolean0 = attributes0.equals((Object) null);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test73() throws Throwable {
Attributes attributes0 = new Attributes();
boolean boolean0 = attributes0.equals(attributes0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test74() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("R", true);
MockPrintStream mockPrintStream0 = new MockPrintStream("R");
Document.OutputSettings document_OutputSettings0 = new Document.OutputSettings();
Document.OutputSettings.Syntax document_OutputSettings_Syntax0 = Document.OutputSettings.Syntax.xml;
Document.OutputSettings document_OutputSettings1 = document_OutputSettings0.syntax(document_OutputSettings_Syntax0);
attributes0.html((Appendable) mockPrintStream0, document_OutputSettings1);
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test75() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("{XO", (String) null);
char[] charArray0 = new char[9];
CharBuffer charBuffer0 = CharBuffer.wrap(charArray0);
Document.OutputSettings document_OutputSettings0 = new Document.OutputSettings();
attributes1.html((Appendable) charBuffer0, document_OutputSettings0);
assertEquals(1, attributes0.size());
assertEquals(5, charBuffer0.remaining());
}
@Test(timeout = 4000)
public void test76() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("", "");
attributes0.toString();
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test77() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("I/z.t'CQS", true);
attributes0.asList();
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test78() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase(".", ".");
attributes0.asList();
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test79() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.addAll(attributes0);
assertEquals(0, attributes0.size());
}
@Test(timeout = 4000)
public void test80() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("@3h2bcK'y(]'Xx:|VAb", "S");
boolean boolean0 = attributes0.hasKeyIgnoreCase("@3h2bcK'y(]'Xx:|VAb");
assertEquals(1, attributes0.size());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test81() throws Throwable {
Attributes attributes0 = new Attributes();
boolean boolean0 = attributes0.hasKeyIgnoreCase(" <=\"*kvgodz\" 44je=\"e9]bzu\"");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test82() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("", "O{,Zq ;o[Ksx>P");
boolean boolean0 = attributes0.hasKey("");
assertEquals(1, attributes0.size());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test83() throws Throwable {
Attributes attributes0 = new Attributes();
boolean boolean0 = attributes0.hasKey("t");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test84() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.removeIgnoreCase(" <=\"*kvgodz\" 44je=\"e9]bzu\"");
assertEquals(0, attributes0.size());
}
@Test(timeout = 4000)
public void test85() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("nowrap", "");
attributes0.putIgnoreCase("", "Array must not contain any null objects");
attributes0.removeIgnoreCase("nowrap");
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test86() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("", false);
assertEquals(0, attributes1.size());
}
@Test(timeout = 4000)
public void test87() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put("AS", (String) null);
attributes1.normalize();
attributes1.put("AS", true);
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test88() throws Throwable {
Attributes attributes0 = new Attributes();
String string0 = attributes0.getIgnoreCase(" ");
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test89() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.put("'N3Zbv1Yz", "TStDbCU?_bu(Lk9M");
attributes0.getIgnoreCase("'N3Zbv1Yz");
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test90() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.putIgnoreCase("", "Array must not contain any null objects");
attributes0.get("");
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test91() throws Throwable {
Attributes attributes0 = new Attributes();
assertEquals(0, attributes0.size());
attributes0.put("`jnr),1GC@", "");
attributes0.putIgnoreCase("`jnr),1GC@", "/akUZ4i|Rpf");
assertEquals(1, attributes0.size());
}
@Test(timeout = 4000)
public void test92() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.put(">/_t&X", ">/_t&X");
Attributes attributes2 = attributes0.clone();
Attribute attribute0 = new Attribute(">WW}n,#?d1%;\"t>u", "H2F", attributes1);
Attributes attributes3 = attributes2.put(attribute0);
attributes0.putIgnoreCase("org.jsoup.nodes.Attributes$Dataset$EntrySet", "org.jsoup.nodes.Attributes$1");
attributes3.put("org.jsoup.nodes.Attributes$Dataset$EntrySet", true);
attributes0.addAll(attributes2);
assertEquals(3, attributes0.size());
}
@Test(timeout = 4000)
public void test93() throws Throwable {
Attributes attributes0 = new Attributes();
Attributes attributes1 = attributes0.clone();
String[] stringArray0 = new String[8];
attributes1.keys = stringArray0;
// Undeclared exception!
// try {
attributes1.put("", true);
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test94() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.hashCode();
assertEquals(0, attributes0.size());
}
@Test(timeout = 4000)
public void test95() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.dataset();
assertEquals(0, attributes0.size());
}
@Test(timeout = 4000)
public void test96() throws Throwable {
Attributes attributes0 = new Attributes();
attributes0.toString();
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
cb2b481749a5827e1d6899467d0c6eadebe7b869 | 9931b891c3ddbc5ab491a9807dffc39ececa1411 | /javac-plugin/src/main/java/org/moditect/deptective/internal/model/ConfigParser.java | 97ce9bd20f916a8eaa03358aae151089ca38b03c | [
"Apache-2.0"
] | permissive | iCodeIN/deptective | a0cfc7294dfa89e29fe18180a545e6d4817158f2 | e5bd0f1dcc9dc23c1b3175615049e6e30b093d46 | refs/heads/master | 2023-03-16T05:20:28.748127 | 2021-02-21T17:44:47 | 2021-02-21T18:10:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,630 | java | /**
* Copyright 2019 The ModiTect authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.moditect.deptective.internal.model;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.moditect.deptective.internal.model.PackageDependencies.Builder;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
public class ConfigParser {
private PackageDependencies packageDependencies;
public ConfigParser(InputStream config) {
if (config == null) {
throw new IllegalArgumentException("Config must not be null");
}
try {
this.packageDependencies = parseConfig(config);
}
catch (RuntimeException e) {
throw e;
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
public ConfigParser(String config) {
if (config == null) {
throw new IllegalArgumentException("Config must not be null");
}
try {
this.packageDependencies = parseConfig(config);
}
catch (RuntimeException e) {
throw e;
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
public PackageDependencies getPackageDependencies() {
return packageDependencies;
}
private PackageDependencies parseConfig(InputStream config) throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
return parseComponents(objectMapper.readTree(config));
}
private PackageDependencies parseConfig(String config) throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
return parseComponents(objectMapper.readTree(config));
}
private PackageDependencies parseComponents(JsonNode config) throws IOException {
PackageDependencies.Builder builder = PackageDependencies.builder();
ArrayNode components = (ArrayNode) config.get("components");
if (components != null) {
Iterator<JsonNode> it = components.iterator();
while (it.hasNext()) {
parseComponent(it.next(), builder);
}
}
ArrayNode whitelisted = (ArrayNode) config.get("whitelisted");
if (whitelisted != null) {
Iterator<JsonNode> it = whitelisted.iterator();
while (it.hasNext()) {
PackagePattern pattern = PackagePattern.getPattern(it.next().asText());
builder.addWhitelistedPackage(pattern);
}
}
return builder.build();
}
private void parseComponent(JsonNode component, Builder builder) {
String name = component.get("name").asText();
List<PackagePattern> contains = parseContains((ArrayNode) (component.get("contains")));
List<String> reads = parseReads((ArrayNode) (component.get("reads")));
for (String read : reads) {
builder.addRead(name, read, ReadKind.ALLOWED);
}
for (PackagePattern pattern : contains) {
builder.addContains(name, pattern);
}
}
private List<String> parseReads(ArrayNode arrayNode) {
if (arrayNode == null) {
return Collections.emptyList();
}
Iterator<JsonNode> it = arrayNode.iterator();
List<String> packages = new ArrayList<>();
while (it.hasNext()) {
packages.add(it.next().asText());
}
return packages;
}
private List<PackagePattern> parseContains(ArrayNode arrayNode) {
if (arrayNode == null) {
return Collections.emptyList();
}
Iterator<JsonNode> it = arrayNode.iterator();
List<PackagePattern> components = new ArrayList<>();
while (it.hasNext()) {
components.add(PackagePattern.getPattern(it.next().asText()));
}
return components;
}
}
| [
"gunnar.morling@googlemail.com"
] | gunnar.morling@googlemail.com |
547ac790cabe363e072405d1e534ced64976d27e | 7fad9832002a577d05e93fc28fa58ee1d4415e12 | /src/ExampleInTIJ/Eight/HansterMalze.java | 620b6dcba31ae4e5dc59bd9065e0c4a827f3e727 | [] | no_license | DanDaye/DataStructure | bfd00bbfe8ae6258c1f5899abbdd82da6f2aa5e7 | c3ec44f9f6a07c4ac324a35f2e9c6efc8d56e789 | refs/heads/master | 2020-04-07T22:59:39.345958 | 2019-02-27T13:42:43 | 2019-02-27T13:42:43 | 158,793,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 734 | java | package ExampleInTIJ.Eight;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
import java.util.Enumeration;
import java.util.Vector;
class Hanster{
private int hansterNumber;
Hanster(int i){
hansterNumber=i;
}
public String toString(){
return "This is Hanster #"+hansterNumber;
}
}
class Printer{
static void printAll(Enumeration e){
while (e.hasMoreElements()){
System.out.println(e.nextElement().toString());
}
}
}
public class HansterMalze {
public static void main(String[] args){
Vector v = new Vector();
for (int i = 0;i<3;i++){
v.addElement(new Hanster(i));
}
Printer.printAll(v.elements());
}
}
| [
"jinsi_l@foxmail.com"
] | jinsi_l@foxmail.com |
8d35200b8bd004ff3e2651cdb3a73d58e4a50ac6 | 769455adb2b9c310888b3eb908f8e9ed8f9d3d63 | /src/com/TreeSetExample/TreeSetExample.java | 191fe810a0e68debde5daaa0f30686fb03a65e64 | [] | no_license | vijeeshtp/javabatch3 | ed42244432f567c0056c549d0e41fb834dbf4550 | 0eaee573d99ebab62cf96e4d863b62e11953c4f7 | refs/heads/master | 2021-08-06T05:04:59.073068 | 2017-11-03T07:07:32 | 2017-11-03T07:07:32 | 108,886,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,503 | java | package com.TreeSetExample;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
/**
* Created by vijeesh on 01/11/17.
*/
public class TreeSetExample {
public static void main(String a[]) {
Set<String> set = new TreeSet<>();
set.add("ssss");
set.add("aaa");
set.add("www");
System.out.println(set);
Set<Account> accSet = new TreeSet<>();
accSet.add(new Account(123, "aaaa", 22, 10000));
accSet.add(new Account(456, "aaaa", 22, 78782));
accSet.add(new Account(789, "aaaa", 22, 77));
accSet.add(new Account(432, "aaaa", 22, 55545));
accSet.add(new Account(232, "aaaa", 22, 10000));
List<Account> accList = new ArrayList<>();
accList.add(new Account(123, "aaaa", 22, 10000));
accList.add(new Account(456, "aaaa", 45, 78782));
accList.add(new Account(789, "aaaa", 33, 77));
accList.add(new Account(432, "aaaa", 28, 55545));
accList.add(new Account(232, "aaaa", 55, 10000));
System.out.println(accSet);
Collections.sort(accList, new BalanceComarator());
System.out.println("Balance Sorting >>"+ accList);
Collections.sort(accList, new AgeComarator());
System.out.println("Age Sorting >>"+ accList);
//System.out.println(Collections.sort(accList, new BalanceComarator()));
}
}
class Account implements Comparable<Account> {
int id;
String name;
int age;
int balance;
public int compareTo(Account o){
return id-o.id;
}
public Account(int id, String name, int age, int balance) {
this.id = id;
this.name = name;
this.age = age;
this.balance = balance;
}
@Override
public String toString() {
return "Account{" +
"id=" + id +
", name='" + name + '\'' +
", age=" + age +
", balance=" + balance +
'}';
}
}
class BalanceComarator implements Comparator<Account>{
@Override
public int compare(Account o1, Account o2) {
return o1.balance-o2.balance;
}
}
class AgeComarator implements Comparator<Account>{
@Override
public int compare(Account o1, Account o2) {
return o1.age-o2.age;
}
}
| [
"vijeesh.tp@expertzlab.com"
] | vijeesh.tp@expertzlab.com |
7be439dd4fd7ddf25ed32b87fc8af830b93d118c | 6a8e1f0c77b953b0065830a07325a4cb723cfe17 | /2.JavaCore/src/com/javarush/task/task20/task2018/Solution.java | 3a3958a0cee192c32c06883bec1b3010438fa5c6 | [] | no_license | praddx/JavaRushTasks | 2161ed620054b1efc83cac9a2f40b7a074e3e356 | b7fa7bc9af713860aa91c860b268191b021bd752 | refs/heads/master | 2021-08-22T17:16:38.245709 | 2017-11-30T19:26:53 | 2017-11-30T19:26:53 | 108,898,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,524 | java | package com.javarush.task.task20.task2018;
import java.io.*;
/*
Найти ошибки
*/
public class Solution {
public static class A {
protected String name = "A";
public A(String name) {
this.name += name;
}
}
public class B extends A implements Serializable {
public B(String name) {
super(name);
this.name += name;
}
public void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
objectOutputStream.writeObject(this.name);
}
public void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
objectInputStream.defaultReadObject();
name = (String) objectInputStream.readObject();
}
}
public static void main(String[] args) throws IOException, ClassNotFoundException {
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(arrayOutputStream);
Solution solution = new Solution();
B b = solution.new B("B2");
System.out.println(b.name);
oos.writeObject(b);
ByteArrayInputStream arrayInputStream = new ByteArrayInputStream(arrayOutputStream.toByteArray());
ObjectInputStream ois = new ObjectInputStream(arrayInputStream);
B b1 = (B)ois.readObject();
System.out.println(b1.name);
}
}
| [
"praddcell@gmail.com"
] | praddcell@gmail.com |
be6617ccdb4bd0242162cb3c0cb3c6f9bc121517 | 78ae31942dfd2473bba01449ef633908fd123c01 | /src/main/java/com/softserve/academy/dao/impl/GuideDaoImpl.java | 99f9b3e1e668861bf7aeac6d4419a83b99b82acd | [] | no_license | DimaNarepeha/jspjdbcmuseum | 28b6a5966f4d8372e092b8c6a051a4e2f9ee4b40 | 4d5529d0598a95a84e0dcd523e4d79d5c9751485 | refs/heads/master | 2020-05-09T09:34:46.542247 | 2019-04-17T08:19:37 | 2019-04-17T08:19:37 | 181,006,749 | 0 | 0 | null | 2019-04-16T20:26:43 | 2019-04-12T12:46:54 | Java | UTF-8 | Java | false | false | 4,296 | java | package com.softserve.academy.dao.impl;
import com.softserve.academy.dao.GuideDao;
import com.softserve.academy.db.Database;
import com.softserve.academy.entity.GuideEntity;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class GuideDaoImpl implements GuideDao {
@Override
public boolean saveGuide(GuideEntity guide) {
try (PreparedStatement insertToGuide = Database.getInstance()
.getConnection()
.prepareStatement("INSERT INTO guide(id_position,firstname,lastname)" +
"VALUES(?,?,?)")
) {
insertToGuide.setInt(1, 2);
insertToGuide.setString(2, guide.getFirstname());
insertToGuide.setString(3, guide.getLastname());
insertToGuide.execute();
System.out.println("Successfully added new guide: " + guide.getFirstname() + " " + guide.getLastname());
} catch (SQLException e) {
System.out.println("Oh...");
return false;
}
return true;
}
@Override
public List<GuideEntity> readAllGuides()
{
Connection conn = Database.getInstance().getConnection();
String query = "SELECT id_guide, firstname,lastname,position_name FROM guide g join guide_position p on " +
"g.id_position=p.id_guide_position group by id_guide";
List<GuideEntity> guides = new ArrayList<>();
PreparedStatement pstmt = null;
try {
pstmt = conn.prepareStatement(query);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
GuideEntity guideEntity = new GuideEntity(rs.getInt("id_guide"),rs.getString("firstname"), rs.getString("lastname"));
guides.add(guideEntity);
}
rs.close();
} catch (SQLException e) {
System.out.println("Database fail");
return null;
}
return guides;
}
@Override
public int updateGuide(GuideEntity guide) {
try (PreparedStatement updateGuide = Database.getInstance()
.getConnection()
.prepareStatement("UPDATE guide SET id_position = ?, firstname = ?, lastname = ? WHERE id_guide=?")
) {
System.out.println("===================UPDATE GUIDE====================");
updateGuide.setInt(1, 2);
updateGuide.setString(2, guide.getFirstname());
updateGuide.setString(3, guide.getLastname());
updateGuide.setInt(4, guide.getId());
System.out.println("Successfully updated guide: " + guide.getFirstname() + " " + guide.getLastname());
int rowsAffected = updateGuide.executeUpdate();
if (rowsAffected > 0) {
System.out.println("Successfully updated " + rowsAffected + " row");
return 1;
} else {
System.out.println("Nothing was updated");
return 0;
}
} catch (SQLException e) {
System.out.println("Database fail");
return 0;
}
}
@Override
public int deleteGuide(int id_guide) {
System.out.println("===================Delete Guide====================");
try (
PreparedStatement deleteGuide = Database.getInstance()
.getConnection()
.prepareStatement(" DELETE FROM guide\n" +
"WHERE id_guide = ?;")
) {
deleteGuide.setInt(1, id_guide);
int rowsAffected = deleteGuide.executeUpdate();
if (rowsAffected > 0) {
System.out.println("Successfully deleted " + rowsAffected + " row");
return 1;
} else {
System.out.println("Nothing was deleted");
return 0;
}
} catch (SQLException e) {
System.out.println("Database fail");
return 0;
}
}
}
| [
"dimanarepeha@gmail.com"
] | dimanarepeha@gmail.com |
a40dffdd89f1843a9ad9ec3e427bdc0bb3e490b4 | 3cd220213214bc49e45e5acd495e5853f91c042b | /src/main/java/com/pcschool/ocp/d09/case2/LottoStore.java | 68f99aad37827aca8cdf4a4889b242e63169f146 | [] | no_license | vincenttuan/Java0811 | c8dfe765df16d0f26169ff0eb290d31209ad9955 | 66b246cf9c68fd8591e050872d7313cd0d47daf2 | refs/heads/master | 2022-12-15T19:32:56.356021 | 2020-08-27T06:27:15 | 2020-08-27T06:27:15 | 286,371,719 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.pcschool.ocp.d09.case2;
public class LottoStore {
public static void main(String[] args) {
// 實作 lotto 介面以開出 0~9 一個數字
Lotto one = new LottoOne();
one.printNumber();
// 實作 lotto 介面以開出 0~9 四個數字
Lotto four = new LottoFour();
four.printNumber();
}
}
| [
"MB-teacher@192.168.1.157"
] | MB-teacher@192.168.1.157 |
0638f4adabd777f56ef539f1dc5b32869ca0eae2 | df1337ce07fe1ecad1410cd0364145ebae0e52f0 | /eNumeric/subClass.java | 6f58ce5b1f010c139f0a16fa3792fa3b47dbb2fc | [] | no_license | tharinduAyagama/simple-java-programes | ab34061a2d6f53c2e00961ef3ebff5cdbf9d1b25 | 049833504f9b69ba9da102b1bfabd7310c5479f9 | refs/heads/master | 2021-03-19T02:18:12.620218 | 2020-03-21T15:20:36 | 2020-03-21T15:20:36 | 247,123,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | public enum subClass{
tharindu("nice" , "sri lanka"),
aliice("good" , "england"),
peter("bad" , "usa"),
linda("beauty" , "poland"),
nathaliya("cute" , "coria"),
john("thin" , "newzeland");
//this enum can be use to store data set
private final String description;
private final String country;
subClass(String description , String country){
this.description = description;
this.country = country;
}
String getDescription(){
return description;
}
String getCountry(){
return country;
}
} | [
"tharinduhirantha32@gmail.com"
] | tharinduhirantha32@gmail.com |
24d6c3f92f36546f51f5e6ad5a745746471e1d4c | 18bb6446c9c9dc5d834fc1b39fe574f339b8c57b | /src/test/java/com/mindlinksoft/recruitment/mychat/ValidUserConsoleInputTest.java | e36d79e12b710c02e60003cef48ca518cf577686 | [] | no_license | Shehreem/my-chat | 7fd214edf94a5e557bdd399a6aabfa09f9c55886 | d6adc87ad2310e203def3160d1c482a0cc91f9a3 | refs/heads/master | 2022-11-29T19:26:27.385679 | 2020-08-19T17:36:35 | 2020-08-19T17:36:35 | 286,263,577 | 0 | 0 | null | 2020-08-09T15:26:41 | 2020-08-09T15:26:41 | null | UTF-8 | Java | false | false | 4,003 | java | package com.mindlinksoft.recruitment.mychat;
import com.google.gson.*;
import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.time.Instant;
import static org.junit.Assert.assertEquals;
/**
* Tests for the {@link ConversationExporter}.
*/
public class ValidUserConsoleInputTest {
/**
* Tests that valid user inputs are accepted by the program
* Expected output: For the system to accept the valid input
* Actual output: The system accepted the input
* @throws Exception When something bad happens.
*/
@Test
public void testInvalidUserConsoleInputTest() throws Exception {
ConversationExporter exporter = new ConversationExporter();
exporter.exportConversation("chat.txt", "chat.json");
ConversationBlackList blacklist = new ConversationBlackList();
ConversationFilters cf = new ConversationFilters();
String input = "yes";
InputStream in = new ByteArrayInputStream(input.getBytes());
System.setIn(in);
assertEquals(in, ConversationBlackList.AskBlackList());
InputStream in2 = new ByteArrayInputStream(input.getBytes());
System.setIn(in2);
assertEquals("in2", ConversationFilters.AskNameFilter());
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Instant.class, new InstantDeserializer());
Gson g = builder.create();
Conversation c = g.fromJson(new InputStreamReader(new FileInputStream("chat.json")), Conversation.class);
assertEquals("My Conversation", c.name);
assertEquals(7, c.messages.size());
Message[] ms = new Message[c.messages.size()];
c.messages.toArray(ms);
assertEquals(ms[0].timestamp, Instant.ofEpochSecond(1448470901));
assertEquals(ms[0].senderId, "bob");
assertEquals(ms[0].content, "Hello there!");
assertEquals(ms[1].timestamp, Instant.ofEpochSecond(1448470905)); //
assertEquals(ms[1].senderId, "mike");
assertEquals(ms[1].content, "how are you?");
assertEquals(ms[2].timestamp, Instant.ofEpochSecond(1448400906));
assertEquals(ms[2].senderId, "bob");
assertEquals(ms[2].content, "I'm good thanks, do you like pie?");
assertEquals(ms[3].timestamp, Instant.ofEpochSecond(1448470910));
assertEquals(ms[3].senderId, "mike");
assertEquals(ms[3].content, "no, let me ask Angus...");
assertEquals(ms[4].timestamp, Instant.ofEpochSecond(1448470912));
assertEquals(ms[4].senderId, "angus");
assertEquals(ms[4].content, "Hell yes! Are we buying some pie?");
assertEquals(ms[5].timestamp, Instant.ofEpochSecond(1448470914));
assertEquals(ms[5].senderId, "bob");
assertEquals(ms[5].content, "No, just want to know if there's anybody else in the pie society...");
assertEquals(ms[6].timestamp, Instant.ofEpochSecond(1448470915));
assertEquals(ms[6].senderId, "angus");
assertEquals(ms[6].content, "YES! I'm the head pie eater there...");
}
class InstantDeserializer implements JsonDeserializer<Instant> {
@Override
public Instant deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
if (!jsonElement.isJsonPrimitive()) {
throw new JsonParseException("Expected instant represented as JSON number, but no primitive found.");
}
JsonPrimitive jsonPrimitive = jsonElement.getAsJsonPrimitive();
if (!jsonPrimitive.isNumber()) {
throw new JsonParseException("Expected instant represented as JSON number, but different primitive found.");
}
return Instant.ofEpochSecond(jsonPrimitive.getAsLong());
}
}
}
| [
"shaddad786@gmail.com"
] | shaddad786@gmail.com |
1cef02c57f6bf7a22fd92465b8860860e04fc2e8 | bea4aeac4eb4d6b816b75948dd0f4eeaf2079b10 | /src/main/java/com/aki/sorting/webSocket/sortingWebSocket.java | 7dd15d60b75a8332b05418dd6084dba97c8c8d00 | [] | no_license | kamiaki/sorting_algorithm | 886b26a6a0ed90ce01d953c8e5074b1ed4bcef3d | cba65e8cf337081e5bb45cecacbb6098d1e3be2c | refs/heads/master | 2023-06-25T21:06:11.352121 | 2022-11-14T03:29:39 | 2022-11-14T03:29:39 | 153,045,430 | 2 | 0 | null | 2023-06-14T22:22:07 | 2018-10-15T03:01:13 | Java | UTF-8 | Java | false | false | 1,985 | java | package com.aki.sorting.webSocket;
import com.aki.sorting.service.ServiceSorting;
import com.aki.sorting.thread.outPutSorting;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;
import java.util.concurrent.CopyOnWriteArraySet;
@ServerEndpoint(value = "/sortingWS")
@Component
public class sortingWebSocket {
private Session WSSession;
private static CopyOnWriteArraySet<sortingWebSocket> sortingWebSockets = new CopyOnWriteArraySet<>();
@Autowired
@Qualifier(value = "sort")
ServiceSorting serviceSorting;
@OnOpen
public void onOpen(Session session){
WSSession = session;
sortingWebSockets.add(this);
int[] arr = new int[]{10,23,42,1,35,65,111,34,321,95,0,8,9};
Thread thread = new Thread(new outPutSorting(arr,this));
thread.start();
System.out.println("连接开启");
}
@OnClose
public void OnClose(){
System.out.println("连接关闭");
}
@OnMessage
public void onMessage(String msg){
System.out.println(new StringBuffer().append("收到客户端消息:").append(msg) );
sendMsg(new StringBuffer().append("客户端告诉你,你发的消息是:").append(msg).toString());
}
@OnError
public void OnError(Throwable error){
System.out.println("连接开启");
error.printStackTrace();
}
public void sendMsg(String msg){
try {
WSSession.getBasicRemote().sendText(msg);
} catch (IOException e) {
System.out.println("发送异常");
e.printStackTrace();
}
}
private void allSendMsg(String msg){
for(sortingWebSocket sortingWebSocket : sortingWebSockets){
sortingWebSocket.sendMsg(msg);
}
}
}
| [
"247557768@qq.com"
] | 247557768@qq.com |
d92f28f3c681df6c866d30686668fcaedd9f0663 | ce056c2531a2ea73e3f6a820c225a3e9c1cd082b | /ch15-work/src/main/java/com/dao/DeptDao.java | 79823090eb374e36c495fcb2b836530df9e5d7b2 | [] | no_license | Rivenerdawqrq/spring-parent | b6d26670825f7ea36c0e0ddd549f98b3d313c114 | 9b65c22c1fdb2fe8274a66484127321f02f39f83 | refs/heads/master | 2022-12-22T20:29:55.980397 | 2019-11-27T12:08:46 | 2019-11-27T12:08:46 | 224,417,384 | 0 | 0 | null | 2022-12-16T14:51:13 | 2019-11-27T11:41:18 | Java | UTF-8 | Java | false | false | 118 | java | package com.dao;
import org.springframework.stereotype.Repository;
public interface DeptDao {
void delete();
}
| [
"1595606639@qq.com"
] | 1595606639@qq.com |
66eea134168ca345337bdc3dc495a3fb38b0e8c8 | 10033ce60e74cff330651109b518ccab4a4a0ad4 | /src/main/java/com/crm/springboot/crmcruddemo/config/DemoDataSourceConfig.java | 5fe23ad51d1d4115ac0c0fc7cddab6490b20c1e2 | [] | no_license | someshbhardwaj/crmcruddemo | 87cae7cd4ddb9806229a217eb2b14e856ff7d942 | 6044bf43df3fc5cd069884ae4a75900c0b40033f | refs/heads/master | 2022-07-17T07:39:17.672156 | 2020-05-20T07:48:10 | 2020-05-20T07:48:10 | 257,800,178 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,307 | java | package com.crm.springboot.crmcruddemo.config;
import javax.sql.DataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
@Configuration
@EnableJpaRepositories(basePackages={"${spring.data.jpa.repository.packages}"})
public class DemoDataSourceConfig {
@Primary
@Bean
@ConfigurationProperties(prefix="app.datasource")
public DataSource appDataSource() {
return DataSourceBuilder.create().build();
}
@Bean
@ConfigurationProperties(prefix="spring.data.jpa.entity")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder, DataSource appDataSource) {
return builder
.dataSource(appDataSource)
.build();
}
@Bean
@ConfigurationProperties(prefix="security.datasource")
public DataSource securityDataSource() {
return DataSourceBuilder.create().build();
}
}
| [
"somesh0905@gmail.com"
] | somesh0905@gmail.com |
f5c099cbbdbd37bb3408509f6063e99a4a873663 | e106ed1b19e8bb93e788da4e895c2bf29e89809e | /src/main/java/com/ylink/ylpay/common/project/securitydeposit/app/SecurityDepositAppService.java | 668e2bc3256a12db4443367db32ff43502bab114 | [] | no_license | lf2035724/aucross-commons | ab691f93ac21bd2bdaa959fd492efd86d2591853 | d2977749da24db8dc1db4ea6f42624c95991d0b2 | refs/heads/master | 2020-06-13T11:39:31.064143 | 2016-12-02T11:20:57 | 2016-12-02T11:21:02 | 75,385,027 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,823 | java | package com.ylink.ylpay.common.project.securitydeposit.app;
import com.ylink.ylpay.common.project.securitydeposit.dto.SecurityDepositAccountTransferDTO;
import com.ylink.ylpay.common.project.securitydeposit.dto.SecurityDepositAccountTransferReturnDTO;
import com.ylink.ylpay.common.project.securitydeposit.dto.SecurityDepositPayDTO;
import com.ylink.ylpay.common.project.securitydeposit.dto.SecurityDepositPayReturnDTO;
import com.ylink.ylpay.common.project.securitydeposit.dto.SecurityDepositQueryPayStateDTO;
import com.ylink.ylpay.common.project.securitydeposit.dto.SecurityDepositQueryPayStateReturnDTO;
import com.ylink.ylpay.common.project.securitydeposit.dto.SecurityDepositSignDTO;
import com.ylink.ylpay.common.project.securitydeposit.dto.SecurityDepositSignReturnDTO;
import com.ylink.ylpay.common.project.securitydeposit.dto.SecurityDepositWithdrawDTO;
import com.ylink.ylpay.common.project.securitydeposit.dto.SecurityDepositWithdrawReturnDTO;
import com.ylink.ylpay.common.project.securitydeposit.exception.SecurityDepositCheckedException;
/**
* @author wanglei
* @date 2014-4-11
* @description 保证金对外提供的实名签约的APP
*/
public interface SecurityDepositAppService
{
/**
* @description 保证金对外提供的实名签约口
* @param SecurityDepositSignDTO
* @return SecurityDepositSignReturnDTO
* @author wanglei
* @date 2014-4-11
*/
SecurityDepositSignReturnDTO sign(SecurityDepositSignDTO sdsDto) throws SecurityDepositCheckedException;
/**
* @description 保证金对外提供的快捷购买接口
* @param SecurityDepositPayDTO
* @return SecurityDepositPayReturnDTO
* @author wanglei
* @date 2014-4-14
*/
SecurityDepositPayReturnDTO pay(SecurityDepositPayDTO sdpDto) throws SecurityDepositCheckedException;
/**
* @description 保证金对外提供的余额提现到保证金接口
* @param SecurityDepositWithdrawDTO
* @return SecurityDepositWithdrawReturnDTO
* @author wanglei
* @date 2014-4-14
*/
SecurityDepositWithdrawReturnDTO withdraw(SecurityDepositWithdrawDTO sdwDto) throws SecurityDepositCheckedException;
/**
* @description 保证金对外提供的保证金支付查询接口
* @param SecurityDepositQueryPayStateDTO
* @return SecurityDepositQueryPayStateReturnDTO
* @author wanglei
* @date 2014-4-14
*/
SecurityDepositQueryPayStateReturnDTO queryPayState(SecurityDepositQueryPayStateDTO sdqpsDto) throws SecurityDepositCheckedException;
/**
* @description 保证金对外提供的银证转账接口
* @param SecurityDepositAccountTransferDTO
* @return SecurityDepositAccountTransferReturnDTO
* @author wanglei
* @date 2014-4-14
*/
SecurityDepositAccountTransferReturnDTO accountTransfer(SecurityDepositAccountTransferDTO sdatDto) throws SecurityDepositCheckedException;
}
| [
"a2168885@sina.com"
] | a2168885@sina.com |
c33f4336cf1a761ae36daf4c5aa24b0d2b080ab1 | 09412c96170609f7a4dd0dba314810cdbb8f8bc2 | /src/main/java/com/tistory/hskimsky/rest/Error.java | 038db15720ceb8dfac66f5c08a23fe47ab44c2a8 | [] | no_license | hskimsky/FinanceMon | 1aaee92cb9f5e25163caa1d9b1c6b46eb91f908d | 25dee3a7bfba622447da6f0cd9923aecd66c4110 | refs/heads/master | 2023-05-11T00:40:22.990726 | 2017-07-18T14:23:54 | 2017-07-18T14:23:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,736 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tistory.hskimsky.rest;
import com.fasterxml.jackson.annotation.JsonInclude;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.io.Serializable;
/**
* Description.
*
* @author Edward KIM
* @since 0.1
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"code",
"message",
"cause",
"exception"
})
@XmlRootElement(name = "error")
public class Error implements Serializable {
/**
* Serialization UID
*/
private static final long serialVersionUID = 1;
@JsonInclude(value = JsonInclude.Include.NON_NULL)
String code;
@JsonInclude(value = JsonInclude.Include.NON_NULL)
String message;
@JsonInclude(value = JsonInclude.Include.NON_NULL)
String cause;
@JsonInclude(value = JsonInclude.Include.NON_NULL)
String exception;
public Error(String code) {
this.code = code;
}
public Error() {
}
public Error(String code, String message) {
this.code = code;
this.message = message;
}
public Error(String code, String message, String cause) {
this.code = code;
this.message = message;
this.cause = cause;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getCause() {
return cause;
}
public void setCause(String cause) {
this.cause = cause;
}
public String getException() {
return exception;
}
public void setException(String exception) {
this.exception = exception;
}
}
| [
"haneul.kim@cloudine.co.kr"
] | haneul.kim@cloudine.co.kr |
89ed206021efadf5949a8757c2c09b9578b9ba8f | 0aa4a42bc90c358229da672c566bccc7714f0de0 | /app/src/main/java/com/hongguo/read/widget/reader/down/DownAnimation.java | 850dfa9ecfcb630e6772063674276b183744ba65 | [] | no_license | masite/book | dc36ed3f4d81847e7ad5d7677ea73a23ffb53de3 | c6d7f3a06a8238c9848d3992890295fe378f82eb | refs/heads/master | 2020-05-16T07:59:59.656189 | 2019-04-23T00:49:12 | 2019-04-23T00:49:12 | 182,891,677 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,087 | java | package com.hongguo.read.widget.reader.down;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.drawable.GradientDrawable;
import android.support.v4.widget.ScrollerCompat;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import com.hongguo.read.widget.reader.ChapterPagerInfo;
import com.hongguo.read.widget.reader.PageController;
import com.hongguo.read.widget.reader.base.BaseViewControl;
/**
* Created by losg on 2018/4/2.
* 单章节话滑动,章节之间采用上下式(整页滑动)
*/
public class DownAnimation extends BaseViewControl {
private static final int SHADOW_WIDTH = 30;
private static final int ANIMTION_TIME = 500;
private ScrollerCompat mScrollerCompat;
private float mMinMove;
private DrawItem mCurrentItem;
private DrawItem mCacheItem;
private int mChapterTotalMoveSize;
private int mMinFling;
private int mStartScroll;
private boolean mFirstScroll;
private boolean mChapterChange;
private int mChapterMove;
private GradientDrawable mBackShadowDrawableLR;
public DownAnimation(View view, PageController pageProvider) {
super(view, pageProvider);
mMinMove = ViewConfiguration.get(view.getContext()).getScaledTouchSlop() * 1.2f;
mCurrentItem = new DrawItem();
mCacheItem = new DrawItem();
mMinFling = ViewConfiguration.get(view.getContext()).getScaledMinimumFlingVelocity();
mScrollerCompat = ScrollerCompat.create(view.getContext());
int[] mBackShadowColors = new int[]{0x66000000, 0x00000000};
mBackShadowDrawableLR = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, mBackShadowColors);
mBackShadowDrawableLR.setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent me, float distanceX, float distanceY) {
super.onScroll(e1, me, distanceX, distanceY);
//第一次 distanceY 跳跃(不用)
if (mFirstScroll) {
mFirstScroll = false;
return true;
}
startScroll((int) distanceY);
return true;
}
@Override
public boolean onDown(MotionEvent me) {
mScrollerCompat.abortAnimation();
mFirstScroll = true;
return super.onDown(me);
}
private void startScroll(int dy) {
int contentHeight = mPageController.getContentHeight();
if (dy == 0) {
return;
}
if (mChapterTotalMoveSize == 0 && mPageController.getCurrentPage() != 0) {
mChapterTotalMoveSize = contentHeight * (mPageController.getCurrentPage());
}
if (mChapterTotalMoveSize <= 0) {
mChapterTotalMoveSize = 0;
}
if (mChapterTotalMoveSize >= (mCurrentItem.mTotalSize - 1) * contentHeight) {
mChapterTotalMoveSize = (mCurrentItem.mTotalSize - 1) * contentHeight;
}
//向下滑动,并且当前是首页,检查是否有上一章节
if (mChapterTotalMoveSize == 0 && dy < 0 || (mChapterMove != 0 && mMoveDirectTopBottom == MOVE_TO_BOTTOM)) {
//滚动做准备
if (mMoveDirectTopBottom == MOVE_TO_TOP_BOTTOM_NONE) {
mMoveDirectTopBottom = MOVE_TO_BOTTOM;
prepareMove(mMoveDirectTopBottom);
}
if (mMoveDirectTopBottom != MOVE_TO_TOP_BOTTOM_NONE) {
moveScroll(dy);
}
return;
}
//往上滑动,并且当前页是最后一页
if (mChapterTotalMoveSize == (mCurrentItem.mTotalSize - 1) * contentHeight && dy > 0 || (mChapterMove != 0 && mMoveDirectTopBottom == MOVE_TO_TOP)) {
//滚动做准备
if (mMoveDirectTopBottom == MOVE_TO_TOP_BOTTOM_NONE) {
mMoveDirectTopBottom = MOVE_TO_TOP;
prepareMove(mMoveDirectTopBottom);
}
if (mMoveDirectTopBottom != MOVE_TO_TOP_BOTTOM_NONE) {
moveScroll(dy);
}
return;
}
mChapterTotalMoveSize += dy;
//到达末页
if (mChapterTotalMoveSize >= (mCurrentItem.mTotalSize - 1) * contentHeight) {
mChapterTotalMoveSize = (mCurrentItem.mTotalSize - 1) * contentHeight;
if (mCacheItem.mPagerInfo != null && mCacheItem.mPagerInfo.pageNumber == mCacheItem.mTotalSize - 1) {
DrawItem drawItem = mCurrentItem;
mCurrentItem = mCacheItem;
mCacheItem = drawItem;
mPageController.setCurrentPage(mCurrentItem.mPagerInfo.pageNumber);
}
mCurrentItem.offset = 0;
mCacheItem.offset = 2 * contentHeight;
mBookView.invalidate();
return;
}
//当前是第一页
if (mChapterTotalMoveSize <= 0) {
mChapterTotalMoveSize = 0;
if (mCacheItem.mPagerInfo != null && mCacheItem.mPagerInfo.pageNumber == 0) {
DrawItem drawItem = mCurrentItem;
mCurrentItem = mCacheItem;
mCacheItem = drawItem;
mPageController.setCurrentPage(mCurrentItem.mPagerInfo.pageNumber);
}
mCurrentItem.offset = 0;
mCacheItem.offset = 2 * contentHeight;
mBookView.invalidate();
return;
}
int currentPageStart = mCurrentItem.mPagerInfo.pageNumber * contentHeight;
int currentPageEnd = (mCurrentItem.mPagerInfo.pageNumber + 1) * contentHeight;
if (mChapterTotalMoveSize >= currentPageStart && mChapterTotalMoveSize < currentPageEnd) {
//下一页已经获取到了,直接移动
if (mCacheItem.mPagerInfo == null || mCacheItem.mPagerInfo.pageNumber < mCurrentItem.mPagerInfo.pageNumber) {
//没有获取,先获取当前页面信息
mCacheItem.mPagerInfo = mPageController.getPageInfo(mCurrentItem.mPagerInfo.pageNumber + 1);
mCacheItem.mTotalSize = mCurrentItem.mTotalSize;
}
//做滑动操作
mCurrentItem.offset = -(mChapterTotalMoveSize - currentPageStart);
mCacheItem.offset = contentHeight + mCurrentItem.offset;
} else if (mChapterTotalMoveSize >= currentPageEnd) {
DrawItem drawItem = mCurrentItem;
mCurrentItem = mCacheItem;
mCacheItem = drawItem;
mPageController.setCurrentPage(mCurrentItem.mPagerInfo.pageNumber);
currentPageStart = mCurrentItem.mPagerInfo.pageNumber * contentHeight;
mCurrentItem.offset = -(mChapterTotalMoveSize - currentPageStart);
mCacheItem.offset = contentHeight + mCurrentItem.offset;
} else if (mChapterTotalMoveSize < currentPageStart && mChapterTotalMoveSize > currentPageStart - contentHeight) {
//下一页已经获取到了,直接移动
if (mCacheItem.mPagerInfo == null || mCacheItem.mPagerInfo.pageNumber > mCurrentItem.mPagerInfo.pageNumber) {
//没有获取,先获取当前页面信息
mCacheItem.mPagerInfo = mPageController.getPageInfo(mCurrentItem.mPagerInfo.pageNumber - 1);
mCacheItem.mTotalSize = mCurrentItem.mTotalSize;
}
//做滑动操作
mCurrentItem.offset = currentPageStart - mChapterTotalMoveSize;
mCacheItem.offset = mCurrentItem.offset - contentHeight;
} else if (mChapterTotalMoveSize <= currentPageStart - contentHeight) {
DrawItem drawItem = mCurrentItem;
mCurrentItem = mCacheItem;
mCacheItem = drawItem;
mPageController.setCurrentPage(mCurrentItem.mPagerInfo.pageNumber);
currentPageStart = mCurrentItem.mPagerInfo.pageNumber * contentHeight;
mCurrentItem.offset = currentPageStart - mChapterTotalMoveSize;
mCacheItem.offset = mCurrentItem.offset - contentHeight;
}
mBookView.invalidate();
}
private void moveScroll(int dy) {
//滚动操作
mChapterMove += dy;
if (mMoveDirectTopBottom == MOVE_TO_TOP) {
if (mChapterMove > mPageController.getViewRect().height()) {
mChapterMove = mPageController.getViewRect().height();
}
if (mChapterMove < 0) {
mChapterMove = 0;
}
} else {
if (mChapterMove > mPageController.getViewRect().height() + SHADOW_WIDTH) {
mChapterMove = mPageController.getViewRect().height() + SHADOW_WIDTH;
}
if (mChapterMove < 0) {
mChapterMove = 0;
}
}
mBookView.invalidate();
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if (mChapterChange) return true;
if (Math.abs(velocityY) > mMinFling) {
mStartScroll = 0;
mScrollerCompat.fling(0, 0, 0, (int) velocityY, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE);
mBookView.invalidate();
}
return super.onFling(e1, e2, velocityX, velocityY);
}
@Override
public void onDraw(Canvas canvas) {
if (mChapterChange) {
drawMove(canvas);
return;
}
if (mCurrentItem.mPagerInfo == null) {
mCurrentItem.mPagerInfo = mPageController.drawPage(canvas, mPageController.getCurrentPage(), 0, null, true).pagerInfo;
mCurrentItem.mTotalSize = mCurrentItem.mPagerInfo.totalSize;
} else {
mPageController.drawPage(canvas, mCurrentItem.mPagerInfo.pageNumber, mCurrentItem.offset, mCurrentItem.mPagerInfo, true);
}
if (mCacheItem.mPagerInfo != null) {
mPageController.drawPage(canvas, mCacheItem.mPagerInfo.pageNumber, mCacheItem.offset, mCacheItem.mPagerInfo, true, false);
}
mPageController.drawHeader(canvas, false);
}
private void drawMove(Canvas canvas) {
//画底部
canvas.drawBitmap(mDrawBitmaps.get(0), 0, 0, mDrawPaint);
canvas.drawBitmap(mDrawBitmaps.get(1), 0, -mChapterMove, mDrawPaint);
mBackShadowDrawableLR.setBounds(0, mPageController.getViewRect().bottom - mChapterMove, mPageController.getViewRect().right, mPageController.getViewRect().bottom - mChapterMove + SHADOW_WIDTH);
mBackShadowDrawableLR.draw(canvas);
}
public static class DrawItem {
public ChapterPagerInfo.PagerInfo mPagerInfo; //画图缓存的信息
public int offset; //当前页相对计算前的位移
public int mTotalSize; //本章节总共的页数
}
@Override
public void computeScroll() {
super.computeScroll();
if (mScrollerCompat.computeScrollOffset()) {
int currY = mScrollerCompat.getCurrY();
int dy = mStartScroll - currY;
if (mChapterTotalMoveSize == (mCurrentItem.mTotalSize - 1) * mPageController.getContentHeight() || mChapterTotalMoveSize == 0) {
mScrollerCompat.abortAnimation();
} else {
startScroll(dy);
}
mBookView.postInvalidate();
mStartScroll = currY;
}
}
private boolean prepareMove(int direct) {
if (mBookViewClickListener != null) {
mBookViewClickListener.bookScrolled();
}
int currentPage;
switch (direct) {
//往左滑滑动(获取下一页 当前页为动,下一页为静态)
case MOVE_TO_TOP:
//没有下一页了
if (mPageController.currentChapterIsEnd()) {
mMoveDirectTopBottom = MOVE_TO_TOP_BOTTOM_NONE;
mChapterChange = false;
if (mBookViewClickListener != null) {
mBookViewClickListener.bookIsEndChapter();
}
return false;
}
mTemp = mMoveBitmap;
mMoveBitmap = mStaticBitmap;
mStaticBitmap = mTemp;
mDrawBitmaps.clear();
mDrawBitmaps.add(mStaticBitmap);
mDrawBitmaps.add(mMoveBitmap);
mPageController.setDrawBitmap(mMoveBitmap);
mMoveBitmap = mPageController.drawPage(null, mCurrentItem.mTotalSize - 1, 0, null, false).drawBitmap;
//章节改变
mPageController.chapterChange(PageController.PAGE_NEXT);
currentPage = 0;
mChapterChange = true;
mPageController.setDrawBitmap(mStaticBitmap);
mStaticBitmap = mPageController.drawPage(null, currentPage, 0, null, false).drawBitmap;
mChapterMove = 0;
mBookView.invalidate();
break;
//往右滑动(获取上一页,当前页为静,上一页为动态)
case MOVE_TO_BOTTOM:
if (mPageController.currentChapterIsFirst()) {
mMoveDirectTopBottom = MOVE_TO_TOP_BOTTOM_NONE;
mChapterChange = false;
if (mBookViewClickListener != null) {
mBookViewClickListener.bookIsFirstChapter();
}
return false;
}
mDrawBitmaps.clear();
mDrawBitmaps.add(mStaticBitmap);
mDrawBitmaps.add(mMoveBitmap);
//当前章节的第一页
mPageController.setDrawBitmap(mStaticBitmap);
mStaticBitmap = mPageController.drawPage(null, 0, 0, null, false).drawBitmap;
//上一章节的末页
mPageController.chapterChange(PageController.PAGE_FORWARD);
mPageController.setDrawBitmap(mMoveBitmap);
mMoveBitmap = mPageController.drawPage(null, -1, 0, null, false).drawBitmap;
mChapterChange = true;
mChapterMove = mPageController.getViewRect().height() + SHADOW_WIDTH;
mBookView.invalidate();
break;
}
return true;
}
@Override
public boolean onTouch(MotionEvent me) {
//actionUp super 主要处理是否是单击事件,如果单击时间,本成不做处理
boolean event = super.onTouch(me);
if (event && me.getAction() == MotionEvent.ACTION_UP && mChapterChange) {
if (mMoveDirectTopBottom != MOVE_TO_LEFT_RIGHT_NONE)
//处理动画信息(翻页动画)
animationToArm(ANIMTION_TIME);
}
return true;
}
private void animationToArm(int time) {
ValueAnimator valueAnimator = new ValueAnimator();
if (mMoveDirectTopBottom == MOVE_TO_TOP) {
valueAnimator.setIntValues(mChapterMove, mPageController.getViewRect().bottom + SHADOW_WIDTH);
} else {
valueAnimator.setIntValues(mChapterMove, 0);
}
valueAnimator.setDuration(time);
valueAnimator.addUpdateListener(animation -> {
mChapterMove = (int) animation.getAnimatedValue();
if (mMoveDirectTopBottom == MOVE_TO_TOP && mChapterMove >= mPageController.getViewRect().bottom + SHADOW_WIDTH) {
mAnimationStart = false;
mDrawBitmaps.remove(mStaticBitmap);
mDrawBitmaps.remove(mMoveBitmap);
mChapterMove = 0;
mChapterTotalMoveSize = 0;
mCurrentItem.mPagerInfo = null;
mCacheItem.mPagerInfo = null;
mChapterChange = false;
animtionEndCheckUpate();
mBookView.invalidate();
return;
} else if (mMoveDirectTopBottom == MOVE_TO_BOTTOM && mChapterMove <= 0) {
mAnimationStart = false;
mDrawBitmaps.remove(mStaticBitmap);
mDrawBitmaps.remove(mMoveBitmap);
mChapterMove = 0;
mChapterTotalMoveSize = 0;
mCurrentItem.mPagerInfo = null;
mCacheItem.mPagerInfo = null;
mChapterChange = false;
animtionEndCheckUpate();
mBookView.invalidate();
return;
}
mBookView.invalidate();
});
valueAnimator.start();
}
@Override
public void notifyDataChange() {
mHasNotify = true;
if (mAnimationStart || mChapterChange) return;
mDrawBitmaps.clear();
//重新获取显示的内容
show();
initOthers();
mBookView.invalidate();
mHasNotify = false;
}
@Override
public void initOthers() {
super.initOthers();
mChapterTotalMoveSize = 0;
mCurrentItem.mPagerInfo = null;
mCacheItem.mPagerInfo = null;
mChapterChange = false;
mChapterTotalMoveSize = 0;
}
}
| [
"1003793102@qq.com"
] | 1003793102@qq.com |
39ac259f9dc1f639560586aa075fbc6909b81c4b | a9bfd913ebb7a5ce344473dced6b0c374be850e9 | /src/java/br/com/jsfinicio/model/AlunoModel.java | c50c4f37541b8ae9b8c463e850ed52a0b83107de | [] | no_license | DerickLuan/Frames1Atv7 | 9d4f33c6c381c0358d7b0fee386925554b2c8eb4 | a42b67375ec19e2411c31aa595ce33d1c883008a | refs/heads/master | 2022-11-04T21:54:48.062680 | 2020-07-02T20:36:08 | 2020-07-02T20:36:08 | 276,738,770 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,013 | java | package br.com.jsfinicio.model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
@Entity
@Table(name = "aluno")
@PrimaryKeyJoinColumn(name = "idpessoa")
public class AlunoModel extends PessoaModel implements Serializable {
@Column(nullable = false)
private int ra;
@ManyToMany(mappedBy = "listaDeAlunos", fetch = FetchType.EAGER)
private List<DisciplinaModel> listaDeDisciplinas;
public AlunoModel() {
}
public int getRa() {
return ra;
}
public void setRa(int ra) {
this.ra = ra;
}
public List<DisciplinaModel> getListaDeDisciplinas() {
return listaDeDisciplinas;
}
public void setListaDeDisciplinas(List<DisciplinaModel> listaDeDisciplinas) {
this.listaDeDisciplinas = listaDeDisciplinas;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f7d7d01823b84ce872c30c5f849cd15b541dbb7c | 9c9c0a6cd542d5b1c2329209abf144249e275609 | /src/java/com/zimbra/qa/selenium/projects/ajax/tests/mail/readreceipt/SendReadReceiptsPrompt.java | 215696efaafb1f30e254c387c91accf7347958d5 | [] | no_license | jiteshsojitra/zm-selenium | 8e55ed108d08784485d22e03884f3d63571b44e2 | 4ed342c33433907a49d698c967a4eb24b435eb80 | refs/heads/develop | 2019-07-11T14:28:27.951485 | 2018-04-13T10:05:02 | 2018-04-13T10:05:02 | 91,348,171 | 0 | 0 | null | 2017-05-15T14:35:48 | 2017-05-15T14:35:48 | null | UTF-8 | Java | false | false | 5,340 | java | /*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2011, 2013, 2014, 2015, 2016 Synacor, Inc.
*
* 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,
* version 2 of the License.
*
* 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, see <https://www.gnu.org/licenses/>.
* ***** END LICENSE BLOCK *****
*/
package com.zimbra.qa.selenium.projects.ajax.tests.mail.readreceipt;
import org.testng.annotations.Test;
import com.zimbra.common.soap.Element;
import com.zimbra.qa.selenium.framework.ui.*;
import com.zimbra.qa.selenium.framework.util.*;
import com.zimbra.qa.selenium.framework.util.staf.Stafpostqueue;
import com.zimbra.qa.selenium.projects.ajax.core.SetGroupMailByMessagePreference;
import com.zimbra.qa.selenium.projects.ajax.pages.DialogWarning;
import com.zimbra.qa.selenium.projects.ajax.pages.DialogWarning.DialogWarningID;
public class SendReadReceiptsPrompt extends SetGroupMailByMessagePreference {
public SendReadReceiptsPrompt() {
logger.info("New "+ SendReadReceiptsPrompt.class.getCanonicalName());
super.startingAccountPreferences.put("zimbraPrefMailSendReadReceipts", "prompt");
}
@Test (description = "zimbraPrefMailSendReadReceipts=prompt - verify prompt, verify receipt is sent",
groups = { "functional", "L2" })
public void SendReadReceiptsPrompt_01() throws HarnessException {
// Create a source account
ZimbraAccount sender = new ZimbraAccount();
sender.provision().authenticate();
// Create the message data to be sent
String subject = "subject" + ConfigProperties.getUniqueString();
// Send the message from AccountA to the ZCS user
sender.soapSend(
"<SendMsgRequest xmlns='urn:zimbraMail'>"
+ "<m>"
+ "<e t='t' a='"+ app.zGetActiveAccount().EmailAddress +"'/>"
+ "<e t='n' a='"+ sender.EmailAddress +"'/>"
+ "<su>"+ subject +"</su>"
+ "<mp ct='text/plain'>"
+ "<content>"+ "body" + ConfigProperties.getUniqueString() +"</content>"
+ "</mp>"
+ "</m>"
+ "</SendMsgRequest>");
// Refresh current view
ZAssert.assertTrue(app.zPageMail.zVerifyMailExists(subject), "Verify message displayed in current view");
// Select the message so that it shows in the reading pane
app.zPageMail.zListItem(Action.A_LEFTCLICK, subject);
DialogWarning dialog = (DialogWarning)app.zPageMain.zGetWarningDialog(DialogWarningID.SendReadReceipt);
ZAssert.assertNotNull(dialog, "Verify the read receipt dialog is popped up");
// Click YES to send
dialog.zPressButton(Button.B_YES);
// Make sure all read-receipts are delivered
Stafpostqueue q = new Stafpostqueue();
q.waitForPostqueue();
// Verify the sender receives the read receipt
sender.soapSend(
"<SearchRequest xmlns='urn:zimbraMail' types='message'>"
+ "<query>subject:(Read-Receipt) subject:("+ subject +")</query>"
+ "</SearchRequest>");
Element[] nodes = sender.soapSelectNodes("//mail:m");
ZAssert.assertEquals(nodes.length, 1, "Verify the read receipt is received by the sender");
}
@Test (description = "zimbraPrefMailSendReadReceipts=prompt - verify prompt, verify receipt is not sent",
groups = { "functional", "L2" })
public void SendReadReceiptsPrompt_02() throws HarnessException {
// Create a source account
ZimbraAccount sender = new ZimbraAccount();
sender.provision().authenticate();
// Create the message data to be sent
String subject = "subject" + ConfigProperties.getUniqueString();
// Send the message from AccountA to the ZCS user
sender.soapSend(
"<SendMsgRequest xmlns='urn:zimbraMail'>"
+ "<m>"
+ "<e t='t' a='"+ app.zGetActiveAccount().EmailAddress +"'/>"
+ "<e t='n' a='"+ sender.EmailAddress +"'/>"
+ "<su>"+ subject +"</su>"
+ "<mp ct='text/plain'>"
+ "<content>"+ "body" + ConfigProperties.getUniqueString() +"</content>"
+ "</mp>"
+ "</m>"
+ "</SendMsgRequest>");
// Refresh current view
ZAssert.assertTrue(app.zPageMail.zVerifyMailExists(subject), "Verify message displayed in current view");
// Select the message so that it shows in the reading pane
app.zPageMail.zListItem(Action.A_LEFTCLICK, subject);
DialogWarning dialog = (DialogWarning)app.zPageMain.zGetWarningDialog(DialogWarningID.SendReadReceipt);
ZAssert.assertNotNull(dialog, "Verify the read receipt dialog is popped up");
// Click NO to not send
dialog.zPressButton(Button.B_NO);
// Make sure all read-receipts are delivered
Stafpostqueue q = new Stafpostqueue();
q.waitForPostqueue();
// Verify the sender receives the read receipt
sender.soapSend(
"<SearchRequest xmlns='urn:zimbraMail' types='message'>"
+ "<query>subject:(Read-Receipt) subject:("+ subject +")</query>"
+ "</SearchRequest>");
Element[] nodes = sender.soapSelectNodes("//mail:m");
ZAssert.assertEquals(nodes.length, 0, "Verify the read receipt is not received by the sender");
}
} | [
"jitesh.sojitra@synacor.com"
] | jitesh.sojitra@synacor.com |
dcf0037942e161a9de0ab92dc34638299e686a5c | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/android/generated/src/main/java/org/openapitools/client/model/ComAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo.java | b4c7d7ee31d67c4a9730501bc87076b15f9d7a30 | [
"Apache-2.0"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | Java | false | false | 4,066 | java | /**
* Adobe Experience Manager OSGI config (AEM) API
* Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API
*
* OpenAPI spec version: 1.0.0-pre.0
* Contact: opensource@shinesolutions.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import org.openapitools.client.model.ComAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLProperties;
import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
@ApiModel(description = "")
public class ComAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo {
@SerializedName("pid")
private String pid = null;
@SerializedName("title")
private String title = null;
@SerializedName("description")
private String description = null;
@SerializedName("properties")
private ComAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLProperties properties = null;
/**
**/
@ApiModelProperty(value = "")
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
/**
**/
@ApiModelProperty(value = "")
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
/**
**/
@ApiModelProperty(value = "")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
/**
**/
@ApiModelProperty(value = "")
public ComAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLProperties getProperties() {
return properties;
}
public void setProperties(ComAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLProperties properties) {
this.properties = properties;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ComAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo comAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo = (ComAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo) o;
return (this.pid == null ? comAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo.pid == null : this.pid.equals(comAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo.pid)) &&
(this.title == null ? comAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo.title == null : this.title.equals(comAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo.title)) &&
(this.description == null ? comAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo.description == null : this.description.equals(comAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo.description)) &&
(this.properties == null ? comAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo.properties == null : this.properties.equals(comAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo.properties));
}
@Override
public int hashCode() {
int result = 17;
result = 31 * result + (this.pid == null ? 0: this.pid.hashCode());
result = 31 * result + (this.title == null ? 0: this.title.hashCode());
result = 31 * result + (this.description == null ? 0: this.description.hashCode());
result = 31 * result + (this.properties == null ? 0: this.properties.hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ComAdobeCqSocialEnablementLearningpathEndpointsImplEnablementLInfo {\n");
sb.append(" pid: ").append(pid).append("\n");
sb.append(" title: ").append(title).append("\n");
sb.append(" description: ").append(description).append("\n");
sb.append(" properties: ").append(properties).append("\n");
sb.append("}\n");
return sb.toString();
}
}
| [
"cliffano@gmail.com"
] | cliffano@gmail.com |
c5f557fd7af1ee4a95557b4b6b87018c564772da | 3a6b4749b7228d7343bfc3a103ee293490537d83 | /Stacks/P2/src/StackImplTest.java | b590c2408ab913ac72c71890670e375b0a24c202 | [] | no_license | LlucSerramitjana/Stack | 589644ea723c8d1d19e7aee791b4c95ebcdac33c | 7246c050614f608d5f63727b55e862ac901f2b3e | refs/heads/main | 2023-08-23T05:14:43.225454 | 2021-09-27T15:10:38 | 2021-09-27T15:10:38 | 410,933,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | import java.util.EmptyStackException;
public class StackImplTest {
public static void main(String[] args) {
System.out.println("TEST");
Stack<Integer> s = new StackImpl<Integer>(3);
try{
s.push (1);
System.out.println(s.size());
s.push(200);
System.out.println(s.size());
s.push(12);
System.out.println(s.size());
Stack<String> s2 = new StackImpl<String>(2);
s2.push("Hello");
System.out.println(s.size());
s2.push ("World");
System.out.println(s.size());
s2.pop();
}
catch (EmptyStackException empty){
empty.printStackTrace();
}
catch (FullStackException full){
//
}
finally {
//
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
4e5e76deffa58335b049dccf653af7146c437ced | 232dadc38b4d37da50f87624aceaace8b239eb4a | /src/main/java/tw/ym/fshra/config/ApiExceptionConfig.java | 3c77db5a6ecbf372daf8a07d0e018297f245dd04 | [
"MIT"
] | permissive | JHying/FSRIS | 67eec46b37d2f707bfde0e384bffb9633f639ec0 | f00642bc05d0b787464daafb13228e23836e6632 | refs/heads/master | 2023-07-06T13:48:03.521412 | 2023-06-28T02:33:22 | 2023-06-28T02:33:22 | 372,013,707 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,705 | java | package tw.ym.fshra.config;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import tw.ym.fshra.pojo.ResponseObj;
import java.util.ArrayList;
import java.util.List;
/**
* Restful 接收資料並進行驗證,產生的 error 訊息做客製化設定
*
* @author H-yin
*/
@ControllerAdvice
public class ApiExceptionConfig extends ResponseEntityExceptionHandler {
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex,
HttpHeaders headers, HttpStatus status, WebRequest request) {
List<String> errors = new ArrayList<>();
for (FieldError error : ex.getBindingResult().getFieldErrors()) {
errors.add(error.getField() + ": " + error.getDefaultMessage());
}
for (ObjectError error : ex.getBindingResult().getGlobalErrors()) {
errors.add(error.getObjectName() + ": " + error.getDefaultMessage());
}
ResponseObj apiError = new ResponseObj(HttpStatus.BAD_REQUEST, errors, ex.getLocalizedMessage(), "Bad Request");
return handleExceptionInternal(ex, apiError, headers, apiError.getStatus(), request);
}
}
| [
"rita66010@gmail.com"
] | rita66010@gmail.com |
77e31940cffb92764449ebaaeb9c30db85ca264c | 06e5d215139d5ac9246f650285ea39269d1f7b29 | /labbook6/Exercise2.java | 5da70b19d30768232af0045e08bc2f5f3a06678c | [] | no_license | Ankybasu/LabBook | 5f95ff5babe03bf7a175ed85a18011bec1e11473 | 71654aa6ceab41fab55b6f169871ca0cb19b8148 | refs/heads/master | 2023-06-06T11:52:06.864377 | 2021-06-24T17:51:49 | 2021-06-24T17:51:49 | 368,187,880 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | package labbook6;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Exercise2 {
//Collection: Create a method that accepts a character array and count the number of times each character is present in the array.
public static Map<Character, Integer> countChars(char[] arr){
Map<Character, Integer> hm=new HashMap<>();
int count;
for(int i=0;i<arr.length;i++) {
count=1;
for(int j=0;j<arr.length;j++) {
if(i!=j&&arr[i]==arr[j]) {
count++;
}
}
hm.put(arr[i],count);
}
return hm;
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter the String: ");
String str=sc.nextLine();
char[] arr=str.toCharArray();
Map<Character,Integer> hm=countChars(arr);
System.out.println(hm);
sc.close();
}
}
| [
"ankitabasu.8420539497@gmail.com"
] | ankitabasu.8420539497@gmail.com |
4204c67e69d93ac26e493c89decee77ce723bd38 | b676ab450a4c7758c62e98c131e1a912b52fd933 | /src/Main.java | 8d27a0409185b2cadce4afadb1e9d4a19321b189 | [] | no_license | LunaCelestine/KWayMergeSort | 5c86500038445cf1901576a958639b911d3c9834 | 4438865daee442189136da0c3a475f750aacd990 | refs/heads/master | 2020-03-14T19:26:19.807702 | 2018-05-02T14:33:53 | 2018-05-02T14:33:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("K Way Merge Test\n");
/** Accept k and n **/
System.out.println("Enter K and N");
int K = scan.nextInt();
int N = scan.nextInt();
Sorter sorter = new Sorter();
sorter.testTiming(1073741824, 4);
/*
int[][] arr = new int[K][N];
*//** Accept all elements **//*
System.out.println("Enter " + K + " sorted arrays of length " + N);
for (int i = 0; i < K; i++)
for (int j = 0; j < N; j++)
arr[i][j] = scan.nextInt();
Sorter kwm = new Sorter();
int[] mergedArray = kwm.iterativeMergeSort(arr);
*/
}
}
| [
"bdabdoub@gmail.com"
] | bdabdoub@gmail.com |
0e5099f67d83e96cb2e6c7a8dacfba66276bab9b | b65bd87c33ee9f03cef0ee8fa67435e6cdb36cb4 | /activity/src/main/java/com/fantasy/activity/constant/IdNoValidator.java | 3053ef377a2afa4344b24ce85ccd0f4c0302af79 | [] | no_license | fantasy1993612/fancloud | d6cf67038ea0e22df597f34f978f05b8ee7a1d47 | bbc0d730195a77bee5786eb133d9e5c2897a5f8b | refs/heads/master | 2022-06-25T08:31:51.829926 | 2020-03-20T09:45:41 | 2020-03-20T09:45:41 | 236,221,678 | 0 | 0 | null | 2022-06-17T02:56:21 | 2020-01-25T19:53:32 | Java | UTF-8 | Java | false | false | 673 | java | package com.fantasy.activity.constant;
import com.fantasy.activity.annotation.IdNo;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
/**
* @author: xiangming
* @date: 2020/03/01 01:53
* @describetion:注解校验器
*/
public class IdNoValidator implements ConstraintValidator<IdNo,String> {
private String idNo;
@Override
public void initialize(IdNo idNo) {
this.idNo = idNo.idNo();
}
@Override
public boolean isValid(String idNo, ConstraintValidatorContext constraintValidatorContext) {
if(idNo.equals(idNo)){
return true;
}
return false;
}
}
| [
"1265911780@qq.com"
] | 1265911780@qq.com |
fe12eb6415f7fd7ea7efd424ef6ec9589c360cde | 57820f51c057c872fb1031da4ce2f13bd0f6572e | /src/test/java/dev/ikhtiyor/springbootfullemail/SpringBootFullEmailApplicationTests.java | 9deabe2c0b706bb99b9d6bbe6a543b3def06cd70 | [] | no_license | IkhtiyorDev/spring-boot-full-email | d555029d5f254a60ff792435699a582c48e74810 | 1a0e9338e3755b23e2fdd9f3b236b66c9c22e769 | refs/heads/main | 2023-07-18T14:45:21.953876 | 2021-08-27T15:29:13 | 2021-08-27T15:29:13 | 389,294,864 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 246 | java | package dev.ikhtiyor.springbootfullemail;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringBootFullEmailApplicationTests {
@Test
void contextLoads() {
}
}
| [
"ikhtiyordev@gmail.com"
] | ikhtiyordev@gmail.com |
f243f50ad03e92f398a20cefd755c6b702709dc0 | 97eed623fa32219b33685748c630efaca52a3208 | /src/main/java/com/shenjinxiang/jkit/exceptions/BizException.java | 2a4a8ce84847705f9dbbe430dc8fdf26b374d96a | [] | no_license | ShenJinXiang/jkit | 43904dfd508bcc7a429175e80034470eba6e7e59 | 4ef02f309ff59a04eb70f87704933d6b3a7ab435 | refs/heads/master | 2020-03-24T10:28:01.417460 | 2018-07-29T15:40:41 | 2018-07-29T15:40:41 | 142,656,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package com.shenjinxiang.jkit.exceptions;
public class BizException extends RuntimeException {
private static final long serialVersionUID = 1778611900103215005L;
public BizException(String message) {
super(message);
}
}
| [
"sjx-sword@163.com"
] | sjx-sword@163.com |
7d7d96a545ecb28447fd96aefd938c2229d29bcb | 12ac341dd16bc7c44fdf5ac0c2fe5151fdd33bd6 | /src/cn/frank/arch/bridge/PaintYellow.java | 05b7a636a944e3023375aae3789f0ae24938572f | [] | no_license | lxyangfan/design-pattern | e79f827d0aba5de08ca98823880486cbd10059f2 | e31aef1174722bf5eec1aa4665a6b2581229b26f | refs/heads/master | 2021-01-22T12:25:05.550901 | 2017-09-04T10:08:23 | 2017-09-04T10:08:23 | 102,347,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 174 | java | package cn.frank.arch.bridge;
public class PaintYellow implements PaintColor{
@Override
public void paint() {
System.out.println("Color is YELLOW");
}
}
| [
"lxyangfan@gmail.com"
] | lxyangfan@gmail.com |
20e4003275abd38e4a03bfcf6222b6ce01e70db8 | 7907790dffa0c3a27da8721c8d0313a69b0ddf09 | /common/src/main/java/com/misterpemodder/shulkerboxtooltip/impl/network/message/C2SHandshakeStart.java | 38d89d65a0350faad896f5d46e648cc08f455a15 | [
"MIT"
] | permissive | MisterPeModder/ShulkerBoxTooltip | b035bccb8b76e2ab3e0e4aa2bbe62db55839595f | e6724ae41e1645513115c9b98836f76e16fd9f90 | refs/heads/1.20.x | 2023-07-18T08:34:03.327610 | 2023-07-12T22:13:34 | 2023-07-12T22:13:34 | 170,941,988 | 85 | 19 | MIT | 2023-07-12T22:13:35 | 2019-02-15T23:34:01 | Java | UTF-8 | Java | false | false | 2,691 | java | package com.misterpemodder.shulkerboxtooltip.impl.network.message;
import com.misterpemodder.shulkerboxtooltip.ShulkerBoxTooltip;
import com.misterpemodder.shulkerboxtooltip.impl.network.ProtocolVersion;
import com.misterpemodder.shulkerboxtooltip.impl.network.ServerNetworking;
import com.misterpemodder.shulkerboxtooltip.impl.network.channel.C2SChannel;
import com.misterpemodder.shulkerboxtooltip.impl.network.context.MessageContext;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.network.ServerPlayerEntity;
/**
* Initiates a handshake with the server.
* <p>
* Sent by clients as soon as the server registers the capability to handle it.
*
* @param clientVersion The protocol version of the client.
*/
public record C2SHandshakeStart(ProtocolVersion clientVersion) {
public static class Type implements MessageType<C2SHandshakeStart> {
@Override
public void encode(C2SHandshakeStart message, PacketByteBuf buf) {
message.clientVersion.writeToPacketBuf(buf);
}
@Override
public C2SHandshakeStart decode(PacketByteBuf buf) {
return new C2SHandshakeStart(ProtocolVersion.readFromPacketBuf(buf));
}
@Override
public void onReceive(C2SHandshakeStart message, MessageContext<C2SHandshakeStart> context) {
var player = (ServerPlayerEntity) context.getPlayer();
var channel = (C2SChannel<C2SHandshakeStart>) context.getChannel();
if (message.clientVersion == null) {
ShulkerBoxTooltip.LOGGER.error(player.getEntityName() + ": received invalid handshake packet");
channel.unregisterFor(player);
return;
}
// compatibility check
ShulkerBoxTooltip.LOGGER.info(player.getEntityName() + ": protocol version: "
+ message.clientVersion);
if (message.clientVersion.major() != ProtocolVersion.CURRENT.major()) {
ShulkerBoxTooltip.LOGGER.error(player.getEntityName()
+ ": incompatible client protocol version, expected " + ProtocolVersion.CURRENT.major() + ", got "
+ message.clientVersion.major());
channel.unregisterFor(player);
return;
}
// client is compatible, send the server's version and register the client
context.execute(() -> {
S2CMessages.HANDSHAKE_RESPONSE.sendTo(player,
new S2CHandshakeResponse(ProtocolVersion.CURRENT, ShulkerBoxTooltip.config));
ServerNetworking.addClient(player, message.clientVersion);
});
}
@Override
public void onRegister(MessageContext<C2SHandshakeStart> context) {
if (context.getReceivingSide() == MessageContext.Side.CLIENT)
C2SMessages.attemptHandshake();
}
}
}
| [
"yguaye44@gmail.com"
] | yguaye44@gmail.com |
14fcf5de775fcd899241d71ca55ab3bed4bc9b30 | 0fc09f55c0730b268e9d6770be5c810fef5a9e06 | /FormatResourceName/src/main/java/cn/sjj/tool/FileUtil.java | 52cbfb50c6573807fb5ce4e1781cf7893cff3e9f | [] | no_license | tofaluanle/Sjj | 2253456f9247f21766295b6ddc0936f9ce6e284f | 34b402e480919d1dd37d6b17632ec900f9677ef2 | refs/heads/master | 2021-01-20T01:46:21.718237 | 2019-09-29T08:15:32 | 2019-09-29T08:15:32 | 89,328,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,676 | java | package cn.sjj.tool;
import org.mozilla.intl.chardet.HtmlCharsetDetector;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
/**
* 对文件和文件夹的操作的支持类
*
* @author 宋疆疆
*/
public class FileUtil {
private static final boolean DEBUG = false;
// 循环遍历指定目录里的文件和文件夹
public static void lsFiles(String path) {
File dir = new File(path);
if (dir.exists()) {
File[] listFiles = dir.listFiles();
for (File file : listFiles) {
if (file.isDirectory()) {
System.out.println("dir: " + file.getName());
}
if (file.isFile()) {
System.out.println("file: " + file.getName());
}
}
}
}
// 复制文件夹
public static void copyDirectory(String sourceDir, String targetDir)
throws IOException {
// 新建目标目录
createDirectory(targetDir, true, true, true);
// 获取源文件夹当前下的文件或目录
File[] file = (new File(sourceDir)).listFiles();
for (int i = 0; i < file.length; i++) {
if (file[i].isFile()) {
// 源文件
File sourceFile = file[i];
// 目标文件
File targetFile = new File(
new File(targetDir).getAbsolutePath() + File.separator
+ file[i].getName());
copyFile(sourceFile, targetFile);
}
if (file[i].isDirectory()) {
// 准备复制的源文件夹
String dir1 = sourceDir + "/" + file[i].getName();
// 准备复制的目标文件夹
String dir2 = targetDir + "/" + file[i].getName();
copyDirectory(dir1, dir2);
}
}
}
// 复制文件
public static void copyFile(File sourceFile, File targetFile)
throws IOException {
BufferedInputStream inBuff = null;
BufferedOutputStream outBuff = null;
if (!targetFile.exists()) {
createFile(targetFile.getAbsolutePath(), true, true, true);
}
try {
// 新建文件输入流并对它进行缓冲
inBuff = new BufferedInputStream(new FileInputStream(sourceFile));
// 新建文件输出流并对它进行缓冲
outBuff = new BufferedOutputStream(new FileOutputStream(targetFile));
// 缓冲数组
byte[] b = new byte[1024 * 5];
int len;
while ((len = inBuff.read(b)) != -1) {
outBuff.write(b, 0, len);
}
// 刷新此缓冲的输出流
outBuff.flush();
} finally {
// 关闭流
if (inBuff != null)
inBuff.close();
if (outBuff != null)
outBuff.close();
}
}
// 复制文件
public static void copyFile(String srcPath, String tarPath)
throws IOException {
BufferedInputStream inBuff = null;
BufferedOutputStream outBuff = null;
File sourceFile = new File(srcPath);
File targetFile = new File(tarPath);
if (!targetFile.exists()) {
createFile(targetFile.getAbsolutePath(), true, true, true);
}
try {
// 新建文件输入流并对它进行缓冲
inBuff = new BufferedInputStream(new FileInputStream(sourceFile));
// 新建文件输出流并对它进行缓冲
outBuff = new BufferedOutputStream(new FileOutputStream(targetFile));
// 缓冲数组
byte[] b = new byte[1024 * 5];
int len;
while ((len = inBuff.read(b)) != -1) {
outBuff.write(b, 0, len);
}
// 刷新此缓冲的输出流
outBuff.flush();
} finally {
// 关闭流
if (inBuff != null)
inBuff.close();
if (outBuff != null)
outBuff.close();
}
}
// 复制文件
public static void copyFile(File sourceFile, File targetFile,
String oldCode, String tarCode) throws IOException {
BufferedInputStream inBuff = null;
BufferedOutputStream outBuff = null;
FileInputStream is = null;
FileOutputStream os = null;
if (!targetFile.exists()) {
createFile(targetFile.getAbsolutePath(), true, true, true);
}
try {
// 新建文件输入流并对它进行缓冲
is = new FileInputStream(sourceFile);
inBuff = new BufferedInputStream(is);
// 新建文件输出流并对它进行缓冲
os = new FileOutputStream(targetFile);
outBuff = new BufferedOutputStream(os);
// 缓冲数组
byte[] b = new byte[1024 * 2];
int len;
while ((len = inBuff.read(b)) != -1) {
byte[] b2 = new String(b, 0, len, oldCode).getBytes(tarCode);
outBuff.write(b2, 0, b2.length);
}
// 刷新此缓冲的输出流
outBuff.flush();
} finally {
// 关闭流
if (inBuff != null)
inBuff.close();
if (outBuff != null)
outBuff.close();
if (os != null)
os.close();
if (is != null)
is.close();
}
}
// 验证字符串是否为正确路径名的正则表达式
private static String matches = "[A-Za-z]:\\\\[^:?\"><*]*";
// 通过 sPath.matches(matches) 方法的返回值判断是否正确
// sPath 为路径字符串
/**
* 根据路径删除指定的目录或文件,无论存在与否
*
* @param sPath 要删除的目录或文件
* @return 删除成功返回 true,否则返回 false。
*/
public static boolean deleteFolder(String sPath) {
boolean flag = false;
File file = new File(sPath);
// 判断目录或文件是否存在
if (!file.exists()) { // 不存在返回 false
return true;
} else {
// 判断是否为文件
if (file.isFile()) { // 为文件时调用删除文件方法
return deleteFile(sPath);
} else { // 为目录时调用删除目录方法
return deleteDirectory(sPath);
}
}
}
/**
* 删除单个文件
*
* @param sPath 被删除文件的文件名
* @return 单个文件删除成功返回true,否则返回false
*/
public static boolean deleteFile(String sPath) {
boolean flag = false;
File file = new File(sPath);
if (!file.exists()) {
return true;
}
if (file.isFile()) {
flag = file.delete();
}
return flag;
}
/**
* 删除目录(文件夹)以及目录下的文件
*
* @param sPath 被删除目录的文件路径
* @return 目录删除成功返回true,否则返回false
*/
public static boolean deleteDirectory(String sPath) {
// 如果sPath不以文件分隔符结尾,自动添加文件分隔符
if (!sPath.endsWith(File.separator)) {
sPath = sPath + File.separator;
}
File dirFile = new File(sPath);
// 如果dir对应的文件不存在,或者不是一个目录,则退出
if (!dirFile.exists()) {
return true;
}
if (!dirFile.isDirectory()) {
return false;
}
boolean flag = true;
// 删除文件夹下的所有文件(包括子目录)
File[] files = dirFile.listFiles();
if (files == null || files.length <= 0) {
return dirFile.delete();
}
if (null != files) {
for (int i = 0; i < files.length; i++) {
// 删除子文件
if (files[i].isFile()) {
flag = deleteFile(files[i].getAbsolutePath());
if (!flag)
break;
} // 删除子目录
else {
flag = deleteDirectory(files[i].getAbsolutePath());
if (!flag)
break;
}
}
}
if (!flag)
return false;
// 删除当前目录
if (dirFile.delete()) {
return true;
} else {
return false;
}
}
/**
* 创建文件夹,赋予所有人权限
*
* @param path
* @return
*/
public static boolean createDirectory(String path) {
File dir = new File(path);
boolean isSuccess = true;
File parentFile = dir.getParentFile();
if (parentFile.exists()) {
if (!parentFile.isDirectory()) {
isSuccess &= deleteFolder(parentFile.getAbsolutePath());
isSuccess &= createDirectory(parentFile.getAbsolutePath());
}
} else {
isSuccess &= createDirectory(parentFile.getAbsolutePath());
}
if (!dir.exists()) {
isSuccess &= dir.mkdirs();
} else if (!dir.isDirectory()) {
isSuccess &= deleteFolder(dir.getAbsolutePath());
if (isSuccess) {
isSuccess &= createDirectory(dir.getAbsolutePath());
}
} else {
return dir.canExecute() & dir.canRead() & dir.canWrite();
}
return isSuccess;
}
/**
* 创建文件夹,赋予所有人权限
*
* @param path
* @param readable
* @param writable
* @param executable
* @return
*/
public static boolean createDirectory(String path, boolean readable, boolean writable, boolean executable) {
boolean isSuccess = true;
File dir = new File(path);
File parentFile = dir.getParentFile();
if (parentFile.exists()) {
if (!parentFile.isDirectory()) {
isSuccess &= deleteFolder(parentFile.getAbsolutePath());
isSuccess &= createDirectory(parentFile.getAbsolutePath(), readable, writable, executable);
}
} else {
isSuccess &= createDirectory(parentFile.getAbsolutePath(), readable, writable, executable);
}
if (!dir.exists()) {
isSuccess &= dir.mkdirs();
if (readable) {
isSuccess &= dir.setReadable(true, false);
}
if (writable) {
isSuccess &= dir.setWritable(true, false);
}
if (executable) {
isSuccess &= dir.setExecutable(true, false);
}
} else if (!dir.isDirectory()) {
isSuccess &= deleteFolder(dir.getAbsolutePath());
if (isSuccess) {
isSuccess &= createDirectory(dir.getAbsolutePath(), readable, writable, executable);
}
} else {
if (readable) {
isSuccess &= dir.canRead();
}
if (writable) {
isSuccess &= dir.canWrite();
}
if (executable) {
isSuccess &= dir.canExecute();
}
}
if (DEBUG) {
System.out.println("dir create " + isSuccess + ", " + path);
}
return isSuccess;
}
/**
* 创建文件,赋予所有人权限
*
* @param path
* @return
*/
public static boolean createFile(String path) throws IOException {
boolean isSuccess = true;
File file = new File(path);
File parentFile = file.getParentFile();
if (parentFile.exists()) {
if (!parentFile.isDirectory()) {
isSuccess &= deleteFolder(parentFile.getAbsolutePath());
isSuccess &= createDirectory(parentFile.getAbsolutePath());
}
} else {
isSuccess &= createDirectory(parentFile.getAbsolutePath());
}
if (!file.exists()) {
isSuccess &= file.createNewFile();
} else if (!file.isFile()) {
isSuccess &= deleteFolder(file.getAbsolutePath());
if (isSuccess) {
isSuccess &= createFile(file.getAbsolutePath());
}
} else {
return file.canRead() & file.canWrite();
}
return isSuccess;
}
/**
* 创建文件,赋予所有人需要的权限
*
* @param path
* @param readable
* @param writable
* @param executable
* @return
*/
public static boolean createFile(String path, boolean readable, boolean writable, boolean executable) throws IOException {
boolean isSuccess = true;
File file = new File(path);
File parentFile = file.getParentFile();
if (parentFile.exists()) {
if (!parentFile.isDirectory()) {
isSuccess &= deleteFolder(parentFile.getAbsolutePath());
isSuccess &= createDirectory(parentFile.getAbsolutePath(), readable, writable, executable);
}
} else {
isSuccess &= createDirectory(parentFile.getAbsolutePath(), readable, writable, executable);
}
if (!file.exists()) {
isSuccess &= file.createNewFile();
if (readable) {
isSuccess &= file.setReadable(true, false);
}
if (writable) {
isSuccess &= file.setWritable(true, false);
}
if (executable) {
isSuccess &= file.setExecutable(true, false);
}
} else if (!file.isFile()) {
isSuccess &= deleteFolder(file.getAbsolutePath());
if (isSuccess) {
isSuccess &= createFile(file.getAbsolutePath(), readable, writable, executable);
}
} else {
if (readable) {
isSuccess &= file.canRead();
}
if (writable) {
isSuccess &= file.canWrite();
}
if (executable) {
isSuccess &= file.canExecute();
}
}
return isSuccess;
}
/**
* 重命名文件名字
*
* @param oldPath
* @param newPath
* @return true 重命名成功
*/
public static boolean rename(String oldPath, String newPath) {
File file = new File(oldPath);
if (file.exists()) {
File dest = new File(newPath);
return file.renameTo(dest);
}
return false;
}
/**
* 获取文件夹的大小
*
* @return
* @throws Exception
* @author 宋疆疆
* @date 2013-11-28 下午2:37:03
*/
public static long getDirSize(String path) {
long size = 0;
File file = new File(path);
File flist[] = file.listFiles();
if (flist == null) {
return size;
}
for (int i = 0; i < flist.length; i++) {
if (flist[i].isDirectory()) {
size = size + getDirSize(flist[i].getAbsolutePath());
} else {
size = size + flist[i].length();
}
}
return size;
}
/**
* 递归求取目录里的文件个数
*
* @param path
* @return
* @author 宋疆疆
* @date 2013-11-28 下午2:48:55
*/
public static long getFileCount(String path) {
long size = 0;
File f = new File(path);
File flist[] = f.listFiles();
size = flist.length;
for (int i = 0; i < flist.length; i++) {
if (flist[i].isDirectory()) {
size = size + getFileCount(flist[i].getAbsolutePath());
size--;
}
}
return size;
}
/**
* 递归求取目录里的文件夹个数
*
* @param path
* @return
* @author 宋疆疆
* @date 2013-11-28 下午2:48:55
*/
public static long getDirCount(String path) {
long size = 0;
File f = new File(path);
File flist[] = f.listFiles();
for (int i = 0; i < flist.length; i++) {
if (flist[i].isDirectory()) {
size = size + getDirCount(flist[i].getAbsolutePath());
size++;
}
}
return size;
}
/**
* 找出指定目录里的文件或文件夹的位置,会递归查找子目录
*
* @param dirPath
* @param fileName
* @return
* @author 宋疆疆
* @date 2017-10-11 16:06:31
*/
public static List<File> findFile(String dirPath, String fileName) {
List<File> paths = new ArrayList<>();
File dir = new File(dirPath);
if (dir.exists() && dir.isDirectory()) {
File[] listFiles = dir.listFiles();
if (listFiles == null || listFiles.length <= 0) {
return paths;
}
for (File file : listFiles) {
if (file.getName().equals(fileName)) {
paths.add(file);
}
if (file.isDirectory()) {
List<File> tempPaths = findFile(file.getAbsolutePath(), fileName);
if (tempPaths != null && 0 != tempPaths.size()) {
paths.addAll(tempPaths);
}
}
}
}
return paths;
}
/**
* 找出指定目录里的带有指定的扩展名的文件,会递归查找子目录
*
* @param dirPath
* @param extension
* @return
* @author 宋疆疆
* @date 2014年6月13日 上午9:42:32
*/
public static List<File> findFileByEx(String dirPath, String extension) {
List<File> paths = new ArrayList<>();
File dir = new File(dirPath);
if (dir.exists() && dir.isDirectory()) {
File[] listFiles = dir.listFiles();
if (listFiles == null || listFiles.length <= 0) {
return paths;
}
for (File file : listFiles) {
if (file.getName().endsWith(extension)) {
paths.add(file);
}
if (file.isDirectory()) {
List<File> tempPaths = findFileByEx(file.getAbsolutePath(), extension);
if (tempPaths != null && 0 != tempPaths.size()) {
paths.addAll(tempPaths);
}
}
}
}
return paths;
}
/**
* 移动文件或文件夹到指定目录
*
* @param from
* @param to
* @return
* @author 宋疆疆
* @date 2014年5月27日 下午1:44:40
*/
public static boolean moveFile(String from, String to) {// 移动指定文件夹内的全部文件
boolean flag = true;
File src = new File(from);
File tar = new File(to);
if (!src.exists()) {
if (DEBUG) {
System.out.println(from + " not found, false");
}
return false;
}
if (src.isDirectory()) {
File[] files = src.listFiles();
if (files == null || files.length == 0) {
if (!tar.exists()) {
flag &= src.renameTo(tar);
} else {
deleteFolder(from);
}
} else {
for (File file : files) {
flag &= moveFile(file.getAbsolutePath(), tar.getAbsolutePath() + File.separator + file.getName());
}
deleteFolder(from);
}
} else {
if (tar.exists()) {
deleteFolder(tar.getAbsolutePath());
}
createDirectory(tar.getParent());
flag &= src.renameTo(tar);
}
if (DEBUG) {
System.out.println("rename " + from);
System.out.println("to " + to);
System.out.println(flag);
}
return flag;
}
public static boolean isEmpty(String path) {
File src = new File(path);
if (src.isFile()) {
return false;
}
String[] list = src.list();
return list == null || list.length == 0;
}
public static boolean isEmpty(File file) {
if (file.isFile()) {
return false;
}
String[] list = file.list();
return list == null || list.length == 0;
}
public static String readFile(InputStream is) throws Exception {
return readFile(is, null);
}
public static String readFile(InputStream is, String charset) throws Exception {
StringBuilder sb = new StringBuilder();
InputStreamReader isr;
if (charset != null) {
isr = new InputStreamReader(is, charset);
} else {
isr = new InputStreamReader(is);
}
BufferedReader br = new BufferedReader(isr);
String line = "";
while ((line = br.readLine()) != null) {
sb.append(line + "\n");
}
sb.delete(sb.length() - 1, sb.length());
br.close();
isr.close();
return sb.toString();
}
public static String readFile(String filePath) throws Exception {
String charset = new HtmlCharsetDetector().main(new String[]{filePath});
return readFile(filePath, charset);
}
public static String readFile(String filePath, String charset) throws Exception {
File file = new File(filePath);
FileInputStream fis = new FileInputStream(file);
String s = readFile(fis, charset);
fis.close();
return s;
}
public static boolean writeFile(String filePath, String contents) throws Exception {
File file = new File(filePath);
if (!file.exists()) {
createFile(filePath);
}
FileOutputStream fos = new FileOutputStream(file);
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
BufferedWriter bw = new BufferedWriter(osw);
String[] split = contents.split("\n");
int index = 0;
for (String string : split) {
if (index == 0) {
index = 1;
bw.write(string);
} else {
bw.write("\n" + string);
}
}
bw.close();
osw.close();
fos.close();
return true;
}
public static boolean writeFileAppend(String filePath, String contents)
throws Exception {
File file = new File(filePath);
FileOutputStream fos = new FileOutputStream(file, true);
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
BufferedWriter bw = new BufferedWriter(osw);
String[] split = contents.split("\n");
int index = 0;
for (String string : split) {
if (index == 0) {
index = 1;
bw.write(string);
} else {
bw.write("\n" + string);
}
}
bw.close();
osw.close();
fos.close();
return true;
}
public static boolean writeFile(String filePath, InputStream is, WriteListener listener) {
File file = new File(filePath);
return writeFile(file, is, listener);
}
public static boolean writeFile(String filePath, InputStream is) {
File file = new File(filePath);
return writeFile(file, is);
}
public static boolean writeFile(File file, InputStream is) {
return writeFile(file, is, null);
}
public static boolean writeFile(File file, InputStream is, WriteListener listener) {
return writeFile(file, is, false, listener);
}
public static boolean writeFile(File file, InputStream is, boolean append, WriteListener listener) {
FileOutputStream fos = null;
try {
createFile(file.getAbsolutePath());
fos = new FileOutputStream(file, append);
byte[] buf = new byte[1024];
int len = 0;
long totalLen = 0;
while ((len = is.read(buf)) != -1) {
totalLen += len;
fos.write(buf, 0, len);
if (listener != null) {
listener.onWrite(totalLen, len);
if (listener.isCancel()) {
break;
}
}
}
return true;
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return false;
}
public interface WriteListener {
/**
* @param total 已经写入的总字节数
* @param len 本次回调写入的字节数
*/
void onWrite(long total, int len);
boolean isCancel();
}
public static boolean deleteText(String filePath, String contents)
throws Exception {
String readFile = readFile(filePath);
File file = new File(filePath);
FileOutputStream fos = new FileOutputStream(file);
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
BufferedWriter bw = new BufferedWriter(osw);
String[] split = readFile.split("\n");
for (String string : split) {
// System.out.println(string);
if (string.equals(contents))
continue;
bw.write(string + "\n");
}
bw.close();
osw.close();
fos.close();
return true;
}
/**
* 将文件的名字里追加指定内容
*
* @param file
* @param append
* @return 追加之后的名字
*/
public static String appendName(File file, String append) {
String name = file.getName();
StringBuilder sb = new StringBuilder();
if (name.contains(".")) {
String[] split = name.split("\\.");
for (int i = 0; i < split.length; i++) {
if (i == 0) {
sb.append(split[i]);
sb.append(append);
} else {
sb.append(".");
sb.append(split[i]);
}
}
} else {
sb.append(name);
sb.append(append);
}
return sb.toString();
}
public static boolean isFile(String path) {
return isFile(new File(path));
}
public static boolean isDir(String path) {
return isDir(new File(path));
}
public static boolean isFile(File file) {
if (!file.exists()) {
return false;
}
return file.isFile();
}
public static boolean isDir(File file) {
if (!file.exists()) {
return false;
}
return file.isDirectory();
}
}
| [
"songjj@ziroom.com"
] | songjj@ziroom.com |
80e01723bfa9f7d305a350133c40e0cc804d422d | 8f1e57ab9c755c8d207336139d6b834c47620488 | /src/main/java/concurrent/ticketseller/Test32.java | 9c0557d0be9e62fc8a852ad96939db3a683d2a1d | [] | no_license | Prokaryotic/concurrent | eb3decbf3e3e6c3a80882f7b805d74e9097c603e | 8cb959b11eca39cc5e22f8c000acd000504fcfe0 | refs/heads/master | 2020-03-19T05:41:47.962353 | 2018-06-04T01:13:50 | 2018-06-04T01:13:50 | 135,954,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | package concurrent.ticketseller;
import java.util.ArrayList;
import java.util.List;
/**
* 有N张火车票 每张票都有一个编号
* 同事有10个窗口对外售票
* 请写一个模拟程序
*
* @author lijunxue
* @create 2018-04-16 22:49
**/
public class Test32 {
static List<String> tickets = new ArrayList<>();
static {
for (int i = 0; i < 10000; i++) {
tickets.add("票号: " + i);
}
}
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
new Thread(() -> {
while (tickets.size() > 0){ // TODO 这里有问题 取票的时候 会重复取票 因为list不是同步的
System.out.println("销售了 :" +tickets.remove(0));
}
}).start();
}
}
}
| [
"522387494@qq.com"
] | 522387494@qq.com |
9174312da8341049edb54da3d430180b3a5fc75b | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/transform/CreateConnectorDefinitionVersionRequestProtocolMarshaller.java | d7c06b299ef8c1663b30cc86cb7e49566d4818d0 | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 2,942 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.greengrass.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.greengrass.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* CreateConnectorDefinitionVersionRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class CreateConnectorDefinitionVersionRequestProtocolMarshaller implements
Marshaller<Request<CreateConnectorDefinitionVersionRequest>, CreateConnectorDefinitionVersionRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.REST_JSON)
.requestUri("/greengrass/definition/connectors/{ConnectorDefinitionId}/versions").httpMethodName(HttpMethodName.POST)
.hasExplicitPayloadMember(false).hasPayloadMembers(true).serviceName("AWSGreengrass").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public CreateConnectorDefinitionVersionRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<CreateConnectorDefinitionVersionRequest> marshall(CreateConnectorDefinitionVersionRequest createConnectorDefinitionVersionRequest) {
if (createConnectorDefinitionVersionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<CreateConnectorDefinitionVersionRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(
SDK_OPERATION_BINDING, createConnectorDefinitionVersionRequest);
protocolMarshaller.startMarshalling();
CreateConnectorDefinitionVersionRequestMarshaller.getInstance().marshall(createConnectorDefinitionVersionRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
82c6b16a85cf8317911b4a252af8a31f3ec45afe | 1a4c03c69eeafdeac1c2d4267a2953fc62081602 | /java.corba/org/omg/PortableServer/CurrentOperations.java | c1fce9a71868165ed9b092a6a40ba037980d870e | [] | no_license | senchzzZ/source-jdk9 | 593dbb872a7960a262efd5762713eec4045c5c84 | c46ca2e7e9c3286e0609ecc2696407f62be88d44 | refs/heads/master | 2021-01-25T13:23:38.272084 | 2018-04-02T11:23:59 | 2018-04-02T11:23:59 | 123,562,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,034 | java | package org.omg.PortableServer;
/**
* org/omg/PortableServer/CurrentOperations.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from t:/workspace/corba/src/java.corba/share/classes/org/omg/PortableServer/poa.idl
* Tuesday, December 19, 2017 6:18:37 PM PST
*/
/**
* The PortableServer::Current interface, derived from
* CORBA::Current, provides method implementations with
* access to the identity of the object on which the
* method was invoked. The Current interface is provided
* to support servants that implement multiple objects,
* but can be used within the context of POA-dispatched
* method invocations on any servant. To provide location
* transparency, ORBs are required to support use of
* Current in the context of both locally and remotely
* invoked operations. An instance of Current can be
* obtained by the application by issuing the
* CORBA::ORB::resolve_initial_references("POACurrent")
* operation. Thereafter, it can be used within the
* context of a method dispatched by the POA to obtain
* the POA and ObjectId that identify the object on
* which that operation was invoked.
*/
public interface CurrentOperations extends org.omg.CORBA.CurrentOperations
{
/**
* Returns reference to the POA implementing the
* object in whose context it is called.
*
* @return The poa implementing the object
*
* @exception NoContext is raised when the operation is
* outside the context of a POA-dispatched
* operation
*/
org.omg.PortableServer.POA get_POA () throws org.omg.PortableServer.CurrentPackage.NoContext;
/**
* Returns the ObjectId identifying the object in
* whose context it is called.
*
* @return the ObjectId of the object
*
* @exception NoContext is raised when the operation
* is called outside the context of a POA-dispatched
* operation.
*/
byte[] get_object_id () throws org.omg.PortableServer.CurrentPackage.NoContext;
} // interface CurrentOperations
| [
"zhaoshengqi@passiontec.com"
] | zhaoshengqi@passiontec.com |
123b9ea760232f6a05d4de1376f08efc3ccf31e8 | 0696ccdf1ac29fdfec3ba8f864aab54e35522956 | /app/src/main/java/br/com/vitrol4/wannaknow/data/Place.java | cc4bc0980bb9bafe836f35557b225b77b9439348 | [] | no_license | vitrol4/WannaKnow | ee060fb9e9afa9803d7a1b7addaab12d8d7a4d87 | 0f561d72ee89ab85b1801b14202609750d5ee22f | refs/heads/master | 2021-01-09T21:54:30.801848 | 2016-04-09T14:11:29 | 2016-04-09T14:11:29 | 46,382,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package br.com.vitrol4.wannaknow.data;
import java.util.Date;
/**
* Created by vitrol4 on 14/11/15.
*/
public class Place {
private String title;
private String description;
private Date created;
public Place(String title, String description, Date created) {
this.title = title;
this.description = description;
this.created = created;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
}
| [
"v.gomes90@gmail.com"
] | v.gomes90@gmail.com |
69d5d7764ce7a9b3da24927ce6f3a46aa7157d46 | 5ba2da4ae95cfb094ed7b25d73e2e393e63862ab | /app/src/main/java/kz/almaty/boombrains/viewmodel/password_view_model/change_pass_view_model/ChangeViewModel.java | b58180f03713259eed899a9d6774dd6eba933369 | [] | no_license | mvvm-android/BoomBrains | 847a9d8b82a8f58c20ab304910a3149961fc3c72 | b98e9714cbfdaa8964b47ab33fd040d1c29d42b2 | refs/heads/master | 2022-04-07T15:43:49.672716 | 2020-02-28T12:20:36 | 2020-02-28T12:20:36 | 285,550,724 | 0 | 0 | null | 2020-08-06T11:16:07 | 2020-08-06T11:16:06 | null | UTF-8 | Java | false | false | 2,509 | java | package kz.almaty.boombrains.viewmodel.password_view_model.change_pass_view_model;
import android.content.Context;
import android.widget.Toast;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import org.jetbrains.annotations.NotNull;
import kz.almaty.boombrains.util.helpers.preference.SharedPrefManager;
import kz.almaty.boombrains.data.models.auth_models.ChangePassModel;
import kz.almaty.boombrains.data.services.APIService;
import kz.almaty.boombrains.data.services.RetrofitClass;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ChangeViewModel extends ViewModel {
public void changePassword(String current, String newPass, Context context, ChangePassView view) {
final MutableLiveData<ChangePassModel> data = new MutableLiveData<>();
APIService service = RetrofitClass.getApiService();
view.showProgressBar();
service.changePassword(RetrofitClass.getUserToken(context),
RetrofitClass.getLang(context), current, newPass).enqueue(new Callback<ChangePassModel>() {
@Override
public void onResponse(@NotNull Call<ChangePassModel> call, @NotNull Response<ChangePassModel> response) {
if (response.isSuccessful()) {
if (response.body() != null) {
if (response.body().getStatus().equals("accepted")) {
SharedPrefManager.setUserPass(context, newPass);
SharedPrefManager.setUserAuthTokenKey(context, response.body().getToken());
}
ChangePassModel loginModel = response.body();
data.setValue(loginModel);
view.goToMain(data.getValue());
view.hideProgressBar();
} else {
showToast(context, "Response is empty");
}
} else {
showToast(context, "Response not successful!");
view.hideProgressBar();
}
}
@Override
public void onFailure(@NotNull Call<ChangePassModel> call, @NotNull Throwable t) {
showToast(context, t.getMessage());
view.hideProgressBar();
}
});
}
private void showToast(Context context, String text) {
Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}
}
| [
"abylay.tillabek@gmail.com"
] | abylay.tillabek@gmail.com |
0f582718e9fd3e6c7caf4067ca24b9f728cdc57d | 5d72b7e48f844d88a53b7c2cac0c5c3c43d58e4f | /src/hr/java/vjezbe/glavna/Glavna.java | 7cad2d2d9f6198970b46203b316e03f1ee5decb6 | [] | no_license | pekiZG/animated-eureka | 0012d10d905c7a27fcf77dac899d41c81d1df397 | 12b7454729f95afec7c7a18f6bf241925fb475e7 | refs/heads/master | 2023-05-12T11:56:07.336863 | 2018-04-12T20:46:15 | 2018-04-12T20:46:15 | 128,135,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,519 | java | package hr.java.vjezbe.glavna;
import java.math.BigDecimal;
import java.util.Scanner;
import hr.java.vjezbe.entitet.Drzava;
import hr.java.vjezbe.entitet.GeografskaTocka;
import hr.java.vjezbe.entitet.MjernaPostaja;
import hr.java.vjezbe.entitet.Mjesto;
import hr.java.vjezbe.entitet.RadioSondaznaMjernaPostaja;
import hr.java.vjezbe.entitet.Senzor;
import hr.java.vjezbe.entitet.SenzorTemperature;
import hr.java.vjezbe.entitet.SenzorVjetra;
import hr.java.vjezbe.entitet.SenzorVlage;
import hr.java.vjezbe.entitet.Zupanija;
import hr.java.vjezbe.iznimke.NiskaTemperaturaException;
import hr.java.vjezbe.iznimke.VisokaTemperaturaException;
import hr.java.vjezbe.utilities.Validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Glavna {
private static final int KOLICINA_MJERNIH_SENZORA = 3;
private static final int KOLICINA_MJERNIH_POSTAJA = 3;
private static final Logger logger = LoggerFactory.getLogger(Glavna.class);
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
MjernaPostaja[] mjernePostaje = new MjernaPostaja[KOLICINA_MJERNIH_POSTAJA];
// kreiranje
for (int i = 0; i < mjernePostaje.length; i++) {
if (i < 2) {
mjernePostaje[i] = kreirajMjernuPostaju(scanner);
} else {
mjernePostaje[i] = kreirajRadioSondaznuMjernuPostaju(scanner);
}
}
// ispis
for (int i = 0; i < mjernePostaje.length; i++) {
MjernaPostaja mjernaPostaja = mjernePostaje[i];
System.out.println("--------------------");
System.out.println("Naziv mjerne postaje: " + mjernaPostaja.getNaziv());
System.out.println("Postaja se nalazi u mjestu " + mjernaPostaja.getMjesto().getNaziv() + ", županiji "
+ mjernaPostaja.getMjesto().getZupanija().getNaziv() + ", drzavi "
+ mjernaPostaja.getMjesto().getZupanija().getDrzava().getNaziv());
System.out.println("Točne koordinate postaje su x:" + mjernaPostaja.getGeografskaTocka().getX() + " y:"
+ mjernaPostaja.getGeografskaTocka().getX());
System.out.println("Vrijednosti senzora postaje su:");
Senzor[] sortiraniSenzori = mjernaPostaja.dohvatiSenzore();
for (int j = 0; j < sortiraniSenzori.length; j++) {
System.out.println(sortiraniSenzori[j].dohvatiPodatkeSenzora());
}
if (mjernaPostaja instanceof RadioSondaznaMjernaPostaja) {
((RadioSondaznaMjernaPostaja) mjernaPostaja)
.povecajVisinu(((RadioSondaznaMjernaPostaja) mjernaPostaja).dohvatiVisinuPostaje());
}
}
// generiranje
while (true) {
for (int i = 0; i < mjernePostaje.length; i++) {
Senzor[] senzori = mjernePostaje[i].dohvatiSenzore();
for (int j = 0; j < senzori.length; j++) {
Senzor senzor = senzori[j];
if (senzor instanceof SenzorTemperature) {
try {
((SenzorTemperature) senzor).generirajVrijednost();
} catch (VisokaTemperaturaException e) {
System.out.println("Pogresna temperatura postaje " + mjernePostaje[i].getNaziv());
logger.error(e.getMessage());
} catch (NiskaTemperaturaException e) {
System.out.println("Pogresna temperatura postaje " + mjernePostaje[i].getNaziv());
logger.error(e.getMessage());
}
}
}
}
try {
Thread.sleep(1 * 1000);
} catch (InterruptedException e) {
}
}
}
private static GeografskaTocka kreirajGeografskuTocku(Scanner scanner) {
System.out.println("Unesite X geo tocku");
BigDecimal x = Validator.bigDecimal(scanner);
System.out.println("Unesite Y geo tocku");
BigDecimal y = Validator.bigDecimal(scanner);
return new GeografskaTocka(x, y);
}
private static MjernaPostaja kreirajRadioSondaznuMjernuPostaju(Scanner scanner) {
System.out.println("Unesi naziv radio sondažne mjerne postaje:");
String nazivMjernePostaje = scanner.nextLine();
Mjesto mjesto = kreirajMjesto(scanner);
GeografskaTocka geografskaTocka = kreirajGeografskuTocku(scanner);
Senzor[] senzori = kreirajSenzore(scanner);
RadioSondaznaMjernaPostaja radioSondaznaMjernaPostaja = new RadioSondaznaMjernaPostaja(nazivMjernePostaje,
mjesto, geografskaTocka, senzori);
System.out.println("Unesi visinu radio sondažne mjerne postaje:");
Integer visinaNaKojojLebdi = Validator.integer(scanner);
radioSondaznaMjernaPostaja.podesiVisinuPostaje(visinaNaKojojLebdi);
return radioSondaznaMjernaPostaja;
}
private static MjernaPostaja kreirajMjernuPostaju(Scanner scanner) {
System.out.println("Unesi naziv mjerne postaje:");
String nazivMjernePostaje = scanner.nextLine();
Mjesto mjesto = kreirajMjesto(scanner);
GeografskaTocka geografskaTocka = kreirajGeografskuTocku(scanner);
Senzor[] senzori = kreirajSenzore(scanner);
return new MjernaPostaja(nazivMjernePostaje, mjesto, geografskaTocka, senzori);
}
private static Senzor[] kreirajSenzore(Scanner scanner) {
Senzor[] senzori = new Senzor[KOLICINA_MJERNIH_SENZORA];
for (int i = 0; i < senzori.length; i++) {
switch (i) {
case 0:
System.out.println("Unesi senzor Vlage");
senzori[i] = new SenzorVlage();
break;
case 1:
System.out.println("Unesi naziv Elektronicke Komponente senzora Temperature");
String nazivElektronickeKomponente = scanner.nextLine();
senzori[i] = new SenzorTemperature(nazivElektronickeKomponente);
break;
case 2:
System.out.println("Unesi veličinu senzora Vjetra");
String velicina = scanner.nextLine();
senzori[i] = new SenzorVjetra(velicina);
break;
default:
break;
}
}
return senzori;
}
private static Mjesto kreirajMjesto(Scanner scanner) {
System.out.println("Unesite naziv mjessta:");
String nazivMjesta = scanner.nextLine();
Zupanija zupanija = kreirajZupaniju(scanner);
return new Mjesto(nazivMjesta, zupanija);
}
private static Zupanija kreirajZupaniju(Scanner scanner) {
System.out.println("Unesite naziv zupanije:");
String nazivZupanije = scanner.nextLine();
Drzava drzava = kreirajDrzavu(scanner);
return new Zupanija(nazivZupanije, drzava);
}
private static Drzava kreirajDrzavu(Scanner scanner) {
System.out.println("Unesite naziv drzave:");
String nazivDrzave = scanner.nextLine();
System.out.println("Unesite povrsinu drzave:");
BigDecimal povrsina = Validator.bigDecimal(scanner);
// scanner.nextLine();
return new Drzava(nazivDrzave, povrsina);
}
}
| [
"petar.slat@gmail.com"
] | petar.slat@gmail.com |
1f6136a2a7979a96a22240a1f611b0660829a6b3 | ccde39ecc6768f06a3b1eb30d642f92007b54bcf | /src/network/Remote.java | 2e3de5ef4a7afb799d2390307e935f4e898c65e7 | [] | no_license | mkshiblu/iconnect | 3174755181358d12711e178bc7491f739a7f8b21 | 496f4a85b5d6cbf60a9219587340496ad796ef91 | refs/heads/master | 2021-01-23T07:26:24.540962 | 2017-02-07T07:18:08 | 2017-02-07T07:18:08 | 80,504,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | package network;
public class Remote implements Runnable {
@Override
public void run() {
}
}
| [
"mosabbir.shiblu@enosisbd.com"
] | mosabbir.shiblu@enosisbd.com |
0dd8b31918a99f16b53fadec5d93cc8b6219d842 | aea1a0ffa951096c053f1724b6864ac0c48884b7 | /desktop/src/game/xonix/desktop/MyPacker.java | feba31a71349c05021e7fb6e3b86ce2abb07544a | [] | no_license | Sonnad/XONIX | 8bcdc3316399dcd9afe81736f6060e78e296816d | 36f17957f58d18cbd47f22c188019d8c9b0f5fb4 | refs/heads/master | 2021-08-10T16:09:56.925929 | 2017-09-27T21:16:17 | 2017-09-27T21:16:17 | 105,066,663 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package game.xonix.desktop;
import com.badlogic.gdx.tools.texturepacker.TexturePacker;
public class MyPacker {
public static void main (String[] args) throws Exception {
String inputDir = "/Users/jura/Desktop/Учеба/Курсач/XONIX/android/assets/button";
String outputDir = "/Users/jura/Desktop/Учеба/Курсач/XONIX/android/assets/button";
String packFileName = "buttons";
TexturePacker.process(inputDir, outputDir, packFileName);
}
} | [
"sonad395@gmail.com"
] | sonad395@gmail.com |
b9f097310fa31437abf658e64537b7e9898717b2 | 3d2a2271f8a252c0b4e6a60ed53deecc00bdf1b4 | /src/dp/UniquePathsII.java | 0c10827fe1ce687888538c19db44fe01b3458aef | [] | no_license | pnayek/algos | f419fd797acfd30e70daf7eb25931008345ef71e | 1af128a85b426b5acfa837cd5b86727a4f154fd1 | refs/heads/master | 2020-05-21T20:04:39.015183 | 2016-11-20T04:51:37 | 2016-11-20T04:51:37 | 60,020,819 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package dp;
public class UniquePathsII {
/*
* Follow up for "Unique Paths":
* Now consider if some obstacles are added to the grids.
* How many unique paths would there be?
* An obstacle and empty space is marked as 1 and 0 respectively in the grid.
* For example, There is one obstacle in the middle of a 3x3 grid as illustrated below.
* [ [0,0,0],
* [0,1,0],
* [0,0,0]
* ]
* The total number of unique paths is 2. Note: m and n will be at most 100.
*
* Leetcode #63, Medium
*/
private int[][] cache;
private int upwo(int[][] grid, int x, int y) {
if (cache[x][y] >= 0) return cache[x][y];
if (grid[x][y] == 1) return 0;
int m = cache.length;
int n = cache[0].length;
if (x == m - 1 && y == n - 1) return 1;
int n1 = x < m - 1 ? upwo(grid, x + 1, y) : 0;
int n2 = y < n - 1 ? upwo(grid, x, y + 1) : 0;
cache[x][y] = n1 + n2;
return cache[x][y];
}
// O(m * n), O(m * n)
public int uniquePathsWithObstacles(int[][] obstacleGrid) {
int m = obstacleGrid.length;
int n = obstacleGrid[0].length;
cache = new int[m][n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
cache[i][j] = -1;
}
}
cache[0][0] = upwo(obstacleGrid, 0, 0);
return cache[0][0];
}
}
| [
"patron@dyn-10-138-13-200.local.uwnet.wisc.edu"
] | patron@dyn-10-138-13-200.local.uwnet.wisc.edu |
e5353dd0fe3bf6e33c1614ffd656c824cccb0aec | a87334db548ed1c16f27e9e84a5ccc03f7e9a416 | /Provatosoft/src/Assignment1/Q_25_BubbleSort.java | d8cd7e8f81577d4d5457d2e3d0fd985eb3d723c6 | [] | no_license | parikshitkapure/coreJavaProvatosoft | 75895c3e9ad55ebe766036ff0fed4151d4dbf6e9 | 24223656e9d65be5c95eed42d571971f06990a07 | refs/heads/master | 2023-06-24T15:09:28.741401 | 2021-07-26T06:19:21 | 2021-07-26T06:19:21 | 389,523,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package Assignment1;
public class Q_25_BubbleSort {
public static void main(String[] args) {
int arr[]= {1,20,11,3,2};
for(int i : arr)
{
System.out.print(i+" ");
}
bubbleSort(arr);
System.out.println(" ");
System.out.println("after sorting");
for(int i : arr)
{
System.out.print(i+" ");
}
}
public static void bubbleSort(int[] arr) {
int temp =0;
for(int i=0;i<arr.length;i++) {
for(int j=1;j<(arr.length-i);j++)
{
if(arr[j-1]>arr[j])
{
temp=arr[j-1];
arr[j-1]=arr[j];
arr[j]=temp;
}
}
}
}
}
| [
"parikshitkapure1@gmail.com"
] | parikshitkapure1@gmail.com |
4ba989996551f5416896e63c18528251741a0aff | 8a6144cf1106b8236eed77b006370c2a048fab23 | /MobileTesting/src/main/java/RunOnBrowser.java | 3ae96acb87abed33f65ef08a159fac88fc4bc9eb | [] | no_license | invincibleSachi/JavaMasterFramework | 79db72c946317ef4053f8e10dc0df82e8208f460 | 17ec60bd4343f87b3d3875f7911338fab4a75784 | refs/heads/master | 2020-03-27T03:14:09.731319 | 2018-11-11T06:13:33 | 2018-11-11T06:13:33 | 145,847,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,243 | java | import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import io.appium.java_client.android.AndroidDriver;
public class RunOnBrowser {
WebDriver driver;
DesiredCapabilities capbility;
@BeforeClass
public void setup(){
capbility=new DesiredCapabilities();
capbility.setCapability("browserName", "Chrome");
capbility.setCapability("platformVersion", "4.4.2");
capbility.setCapability("deviceName", "59QKMREAYS8TP7DE");
//get device name from adb devices command
capbility.setCapability("platformName", "Android");
capbility.setCapability("device", "Android");
}
@Test
public void runtest() throws MalformedURLException{
driver =new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),capbility);
driver.manage().timeouts().implicitlyWait(20l, TimeUnit.SECONDS);
driver.get("https://www.google.co.in/");
driver.findElement(By.name("q")).sendKeys("appium");
driver.findElement(By.name("btnG")).click();
}
}
| [
"automationtrainer1@gmail.com"
] | automationtrainer1@gmail.com |
41a80cd356bb5cdd86d0f1d1b23049ced720c9cb | db5e2811d3988a5e689b5fa63e748c232943b4a0 | /jadx/sources/o/C3033.java | adae24a12cbc15144758ecdf060562333f594866 | [] | no_license | ghuntley/TraceTogether_1.6.1.apk | 914885d8be7b23758d161bcd066a4caf5ec03233 | b5c515577902482d741cabdbd30f883a016242f8 | refs/heads/master | 2022-04-23T16:59:33.038690 | 2020-04-27T05:44:49 | 2020-04-27T05:44:49 | 259,217,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,193 | java | package o;
import o.C2816;
import o.C3100;
/* renamed from: o.ԼΙ reason: contains not printable characters */
final class C3033 implements C3108 {
/* renamed from: ɩ reason: contains not printable characters */
private final C3203<C2942> f13930;
public C3033(C3203<C2942> r1) {
this.f13930 = r1;
}
/* renamed from: ǃ reason: contains not printable characters */
public final boolean m15498(C0399 r6) {
if (!(r6.m4667() == C3100.If.REGISTERED) || C3050.m15562(r6)) {
return false;
}
this.f13930.f14555.m6079(new C2816.Cif().m15200(r6.m4668()).m15201(r6.m4670()).m15198(r6.m4673()).m15199());
return true;
}
/* renamed from: ǃ reason: contains not printable characters */
public final boolean m15499(C0399 r5, Exception exc) {
if (!(r5.m4667() == C3100.If.REGISTER_ERROR)) {
if (!(r5.m4667() == C3100.If.NOT_GENERATED || r5.m4667() == C3100.If.ATTEMPT_MIGRATION)) {
if (!(r5.m4667() == C3100.If.UNREGISTERED)) {
return false;
}
}
}
this.f13930.f14555.m6068(exc);
return true;
}
}
| [
"ghuntley@ghuntley.com"
] | ghuntley@ghuntley.com |
03cc0f01a1f54d5ce90e84d113c881f567de3f35 | f5e06d38388b4bd9b1a64ee72be0958105fdc6fb | /Node1.java | dda5aff393626619e3f33c87208d210b969cadfb | [] | no_license | MADAOtea/java- | 8a0fea46d70cdd618dd1be9c56a871ac72fa45b2 | 2d78411bca3fb5d7eb48bfedba94e0b119f5267f | refs/heads/master | 2020-03-30T19:07:32.020978 | 2018-10-04T06:51:36 | 2018-10-04T06:51:36 | 151,529,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | public class Node1 {
private String item ;
private int count ;
private Node1 link ;
public Node1(){
link = null ;
item = null ;
count = 0 ;
} //
public Node1( String nItem, int nCount, Node1 linkValue ){
setData(nItem, nCount);
link = linkValue ;
} //
public void setData( String nItem, int nCount ) {
item = nItem ;
count = nCount ;
} //
public void setLink( Node1 newValue ) {
link = newValue ;
} //
public String getItem() {
return item ;
} //
public int getCount() {
return count ;
} //
public Node1 getLink() {
return link ;
} //
} // | [
"noreply@github.com"
] | noreply@github.com |
45dadff09040454967687a85884a495be0d5cc82 | e95966b7652a67469c73b46b8b54514bcd3db5a3 | /src/main/java/com/hrada/oms/model/model/Equipment.java | 80809f02f8d1568f526952a3dd5754d909570179 | [] | no_license | xch3166/oms | 5f766711787d34168c01b48e6f22ac5486419651 | 39812bb1e3b631d4dba9a9f3a0a18b0c494f7c48 | refs/heads/master | 2020-05-14T13:15:57.852213 | 2019-04-16T08:55:18 | 2019-04-16T08:55:18 | 181,808,425 | 0 | 0 | null | 2019-04-17T03:18:01 | 2019-04-17T03:12:23 | JavaScript | UTF-8 | Java | false | false | 938 | java | package com.hrada.oms.model.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hrada.oms.model.BaseEntity;
import lombok.Data;
import javax.persistence.*;
import java.util.List;
/**
* Created by shin on 2018/4/8.
*/
@Data
@Entity
@Table(name="model_equipment")
public class Equipment extends BaseEntity {
@ManyToOne
private Base base;
@ManyToOne
private Well well;
private String name;
private String no;
private Integer length;
private Integer width;
private Integer height;
private Double weight;
private Double power;
private Integer state;
private Integer hours;
@ManyToMany
@JoinTable(
name="model_equipment_parts",
joinColumns=@JoinColumn(name="equipment_id", referencedColumnName="id"),
inverseJoinColumns=@JoinColumn(name="parts_id", referencedColumnName="id")
)
@JsonIgnore
private List<Parts> partsList;
}
| [
"xinchonga@163.com"
] | xinchonga@163.com |
28650d4c3b9e59822e7093085b518ca8ee394487 | 14e01913eefec92af99aa63fbd175668cd0369bb | /src/main/java/io/github/ifris/loans/service/mapper/LoanAccountMapper.java | 7d0056d56d8809fe4a03526e2046cfde2394d0f0 | [] | no_license | ifris-data/loan_service | f77a805cf2d92ea579dda59b8c88c54e9ecba05b | 2d32facdf8cb26e30804ff9547b2cbc95457ca0a | refs/heads/master | 2020-05-04T23:15:33.791999 | 2019-04-11T04:56:36 | 2019-04-11T04:56:36 | 179,537,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 601 | java | package io.github.ifris.loans.service.mapper;
import io.github.ifris.loans.domain.*;
import io.github.ifris.loans.service.dto.LoanAccountDTO;
import org.mapstruct.*;
/**
* Mapper for the entity LoanAccount and its DTO LoanAccountDTO.
*/
@Mapper(componentModel = "spring", uses = {})
public interface LoanAccountMapper extends EntityMapper<LoanAccountDTO, LoanAccount> {
default LoanAccount fromId(Long id) {
if (id == null) {
return null;
}
LoanAccount loanAccount = new LoanAccount();
loanAccount.setId(id);
return loanAccount;
}
}
| [
"mailnjeru@gmail.com"
] | mailnjeru@gmail.com |
ac395e64c85e18e82a160bdeab71e1b2dbddcb3c | 32b72e1dc8b6ee1be2e80bb70a03a021c83db550 | /ast_results/oschina_android-app/src/com/weibo/net/Token.java | 8adadf4f48b47c7da0163392581df7f0de2a42a2 | [] | no_license | cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning | d90c41a17e88fcd99d543124eeb6e93f9133cb4a | 0564143d92f8024ff5fa6b659c2baebf827582b1 | refs/heads/master | 2020-07-13T13:53:40.297493 | 2019-01-11T11:51:18 | 2019-01-11T11:51:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,400 | java | // isComment
package com.weibo.net;
import javax.crypto.spec.SecretKeySpec;
public class isClassOrIsInterface {
// isComment
private String isVariable = "isStringConstant";
private String isVariable = "isStringConstant";
private long isVariable = isIntegerConstant;
private String isVariable = "isStringConstant";
protected String isVariable = "isStringConstant";
protected String[] isVariable = null;
protected SecretKeySpec isVariable;
public isConstructor() {
}
public String isMethod() {
return this.isFieldAccessExpr;
}
public String isMethod() {
return isNameExpr;
}
public void isMethod(String isParameter) {
this.isFieldAccessExpr = isNameExpr;
}
public long isMethod() {
return isNameExpr;
}
public void isMethod(long isParameter) {
this.isFieldAccessExpr = isNameExpr;
}
public void isMethod(String isParameter) {
if (isNameExpr != null && !isNameExpr.isMethod("isStringConstant")) {
isMethod(isNameExpr.isMethod() + isNameExpr.isMethod(isNameExpr) * isIntegerConstant);
}
}
public void isMethod(String isParameter) {
this.isFieldAccessExpr = isNameExpr;
}
public void isMethod(String isParameter) {
isNameExpr = isNameExpr;
}
public String isMethod() {
return isNameExpr;
}
public String isMethod() {
return isNameExpr;
}
public isConstructor(String isParameter) {
isNameExpr = isNameExpr.isMethod("isStringConstant");
isNameExpr = isMethod("isStringConstant");
isNameExpr = isMethod("isStringConstant");
}
public isConstructor(String isParameter, String isParameter) {
isNameExpr = isNameExpr;
isNameExpr = isNameExpr;
}
public String isMethod(String isParameter) {
String isVariable = null;
for (String isVariable : isNameExpr) {
if (isNameExpr.isMethod(isNameExpr + 'isStringConstant')) {
isNameExpr = isNameExpr.isMethod("isStringConstant")[isIntegerConstant].isMethod();
break;
}
}
return isNameExpr;
}
protected void isMethod(SecretKeySpec isParameter) {
this.isFieldAccessExpr = isNameExpr;
}
protected SecretKeySpec isMethod() {
return isNameExpr;
}
}
| [
"matheus@melsolucoes.net"
] | matheus@melsolucoes.net |
b5fd80cd9c1934e57bba6d0bbb090b346a09f334 | b9c53a0b6bff44db2d107310e2bef82fa3cde62c | /src/main/java/com/oguzdirenc/notebook/controller/TodoListController.java | 7fe3270b943c34f426bcf3d0e198e89730a447e2 | [] | no_license | oguzdirenc/notebook-server | 20a1f0c058184051bf6ef4eb2bf57f59df900f9e | e0463a63de03024e28f0118807df56110e077784 | refs/heads/master | 2023-06-03T10:40:32.818415 | 2021-06-21T16:40:51 | 2021-06-21T16:40:51 | 373,607,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,371 | java | package com.oguzdirenc.notebook.controller;
import com.oguzdirenc.notebook.domain.TodoList;
import com.oguzdirenc.notebook.request.TodoListSaveRequest;
import com.oguzdirenc.notebook.response.UserTodoListResponse;
import com.oguzdirenc.notebook.service.TodoListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.security.Principal;
import java.util.List;
@RestController
@CrossOrigin
@RequestMapping("/api/todoList")
public class TodoListController {
private final TodoListService todoListService;
@Autowired
public TodoListController(TodoListService todoListService) {
this.todoListService = todoListService;
}
@PostMapping("/save")
public ResponseEntity<TodoList> saveTodoList(@Valid @RequestBody TodoListSaveRequest todoListSaveRequest, Principal principal){
return new ResponseEntity<>(todoListService.saveTodoList(todoListSaveRequest, principal.getName()), HttpStatus.CREATED);
}
@GetMapping("/user")
public ResponseEntity<List<UserTodoListResponse>> getUserTodoLists(Principal principal){
return new ResponseEntity<>(todoListService.getUserLists(principal.getName()),HttpStatus.OK);
}
} | [
"oguzdirenc@hotmail.com"
] | oguzdirenc@hotmail.com |
58dbf120e310c5d7ed5e858a7267a23b3718788d | f174db8f24e6d03f04cb900b15a270b0863417d1 | /weather_station/src/main/java/com/common/observer/BindObserver.java | bab2d327887ab0e42478fc70c60bd907fdfec1da | [] | no_license | zhuashaoweiwu/nnlightctl-1 | 3c8de987acd5e9b5081414626ad2fe8bcf00a2a3 | 800bfe6b2cde00d61a14f50a0cd23ee4c105781c | refs/heads/master | 2020-05-14T13:03:58.125610 | 2019-07-01T06:11:30 | 2019-07-01T06:11:30 | 181,803,334 | 1 | 3 | null | 2019-04-17T02:35:13 | 2019-04-17T02:35:12 | null | UTF-8 | Java | false | false | 151 | java | package com.common.observer;
public interface BindObserver {
/**
* 绑定mac
* @param mac
*/
void bindMacUpdate(String mac);
}
| [
"2595478533@qq.com"
] | 2595478533@qq.com |
5251fa67d3f4cd66bcbcdc34ca93bf591ea8c729 | 12ce41794f36a8ff2e82286d2e39c8687bd86c8e | /cms-web/src/main/java/com/xzjie/et/core/security/DefineModularRealmAuthenticator.java | c88074872536d12edcac71bc205b6229b797d10f | [
"Apache-2.0"
] | permissive | lhongjum/cms | 89bf47953e9beed0eef3d27316a85ca7e821c1c9 | b754167d97165c744462b845dc28244a2e736345 | refs/heads/master | 2023-02-22T10:31:26.930021 | 2020-12-02T15:56:14 | 2020-12-02T15:56:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,029 | java | package com.xzjie.et.core.security;
import org.apache.shiro.ShiroException;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.pam.ModularRealmAuthenticator;
import org.apache.shiro.realm.Realm;
import org.apache.shiro.util.CollectionUtils;
import java.util.Collection;
import java.util.Map;
public class DefineModularRealmAuthenticator extends ModularRealmAuthenticator {
private Map<String, Object> definedRealms;
/**
* 调用单个realm执行操作
*
* @param realm
* @param token
* @return
*/
@Override
protected AuthenticationInfo doSingleRealmAuthentication(Realm realm, AuthenticationToken token) {
// 如果该realms不支持(不能验证)当前token
if (!realm.supports(token)) {
throw new ShiroException("token 错误");
}
AuthenticationInfo info = null;
try {
info = realm.getAuthenticationInfo(token);
if (info == null) {
throw new ShiroException("token不存在!");
}
} catch (Exception e) {
throw new ShiroException("用户名或者密码错误!");
}
return info;
}
/**
* 判断登录类型执行操作
*
* @param authenticationToken
* @return
* @throws AuthenticationException
*/
@Override
protected AuthenticationInfo doAuthenticate(AuthenticationToken authenticationToken) throws AuthenticationException {
this.assertRealmsConfigured();
Realm realm = null;
UsernamePasswordCaptchaToken token = (UsernamePasswordCaptchaToken) authenticationToken;
//判断是否是后台用户 getUsertype().equals("admin")
if ("1".equals(token.getStype())) {
realm = (Realm) this.definedRealms.get("systemAuthorizingRealm");
} else {
realm = (Realm) this.definedRealms.get("clientAuthorizingRealm");
}
return this.doSingleRealmAuthentication(realm, authenticationToken);
}
/**
* 判断realm是否为空
*
* @throws IllegalStateException
*/
@Override
protected void assertRealmsConfigured() throws IllegalStateException {
this.definedRealms = this.getDefinedRealms();
if (CollectionUtils.isEmpty(this.definedRealms)) {
throw new ShiroException("值传递错误!");
}
}
/**
* 多个realm实现
*
* @param realms
* @param token
* @return
*/
@Override
protected AuthenticationInfo doMultiRealmAuthentication(Collection<Realm> realms, AuthenticationToken token) {
return super.doMultiRealmAuthentication(realms, token);
}
public Map<String, Object> getDefinedRealms() {
return this.definedRealms;
}
public void setDefinedRealms(Map<String, Object> definedRealms) {
this.definedRealms = definedRealms;
}
}
| [
"513961835@qq.com"
] | 513961835@qq.com |
007b269bd8cc9c0c78afc677689175e180547da4 | 39444474eeb395a95d10d2e69eed8f0c6be7d3a2 | /Project1/Log.java | ace5ec489869b2c87d77b7873e4f3a2c93ff63bd | [] | no_license | XEllis/Java-Projects | aeb5cf99b3eab76cebbff3f220e0a17383439873 | 32cf8370324f65f3013349141c34246357135853 | refs/heads/master | 2021-01-18T18:09:58.397975 | 2017-03-31T18:12:50 | 2017-03-31T18:12:50 | 86,847,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,886 | java | /**
* Keeps count of the statistics:
* the number of items that have logged their information and left the simulation,
* the time it takes items to be processed,
* the time they wait in line prior to processing.
* @author xellis
*
*/
public class Log {
/**
* The number of items that have logged their information and left the simulation.
*/
private int numCompleted;
/**
* The sum of all wait times logged by items so far.
*/
private int totalWaitTime;
/**
* The sum of all times that items took to do actual processing (not including wait time).
*/
private int totalProcessTime;
/**
* Null Constructor.
*/
public Log() {
// Null Constructor
}
/**
* Returns the number of items that have logged their information and left the simulation.
* @return the numCompleted the number of items that have logged their information and left the simulation
*/
public int getNumCompleted() {
return numCompleted;
}
/**
* Updates its three data members from the item that was just processed.
* @param item the item that was just processed
*/
public void logItem(ItemToShip item) {
if (item != null) {
numCompleted += 1;
totalWaitTime += item.getWaitTime();
totalProcessTime += item.getProcessTime();
}
}
/**
* Returns the average number of seconds so far the item needs to wait
* in a shipment process station queue before processing.
* @return average wait time
*/
public double averageWaitTime() {
if (numCompleted == 0) {
return 0.0;
}
return ((double) totalWaitTime) / numCompleted;
}
/**
* Returns the average number of seconds required so far to process the item (not including wait time).
* @return average process time
*/
public double averageProcessTime() {
if (numCompleted == 0) {
return 0.0;
}
return ((double) totalProcessTime) / numCompleted;
}
}
| [
"xzheng6@ncsu.edu"
] | xzheng6@ncsu.edu |
e481581342b28af9d76fbd367264f408519aa8b0 | d3b8bc9be7048ed001642c7cd033322676a29763 | /src/main/java/pl/com/softproject/camel/sample/routing/FileToQRouteBuilder.java | 30818545366e3ab858c3b7b90a5eb070243cb58c | [] | no_license | alapierre/camel | 8ca0e56fa91aad4f82d2bca68da489beaebe3226 | bd17d6dd23e62137f0b1291aeb9b688edca742b1 | refs/heads/master | 2021-01-01T03:37:42.843353 | 2016-05-20T09:59:46 | 2016-05-20T09:59:46 | 59,234,362 | 0 | 0 | null | 2020-10-13T17:21:02 | 2016-05-19T19:07:33 | Java | UTF-8 | Java | false | false | 438 | java | /**
* Copyright 2016-02-17 the original author or authors.
*/
package pl.com.softproject.camel.sample.routing;
import org.apache.camel.builder.RouteBuilder;
/**
* @author Adrian Lapierre {@literal <adrian@soft-project.pl>}
*/
public class FileToQRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("file://d:/orders?charset=UTF-8").to("activemq:queue:test.queue");
}
}
| [
"adrian@soft-project.pl"
] | adrian@soft-project.pl |
98d087876eef713c2ad751692e032bab7af23faa | fa1408365e2e3f372aa61e7d1e5ea5afcd652199 | /src/testcases/CWE190_Integer_Overflow/s04/CWE190_Integer_Overflow__long_rand_add_53b.java | 5ba14efd9be28864a975ed243e350f8a51831412 | [] | no_license | bqcuong/Juliet-Test-Case | 31e9c89c27bf54a07b7ba547eddd029287b2e191 | e770f1c3969be76fdba5d7760e036f9ba060957d | refs/heads/master | 2020-07-17T14:51:49.610703 | 2019-09-03T16:22:58 | 2019-09-03T16:22:58 | 206,039,578 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,431 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__long_rand_add_53b.java
Label Definition File: CWE190_Integer_Overflow.label.xml
Template File: sources-sinks-53b.tmpl.java
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: rand Set data to result of rand()
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: add
* GoodSink: Ensure there will not be an overflow before adding 1 to data
* BadSink : Add 1 to data, which can cause an overflow
* Flow Variant: 53 Data flow: data passed as an argument from one method through two others to a fourth; all four functions are in different classes in the same package
*
* */
package testcases.CWE190_Integer_Overflow.s04;
import testcasesupport.*;
import javax.servlet.http.*;
public class CWE190_Integer_Overflow__long_rand_add_53b
{
public void badSink(long data ) throws Throwable
{
(new CWE190_Integer_Overflow__long_rand_add_53c()).badSink(data );
}
/* goodG2B() - use goodsource and badsink */
public void goodG2BSink(long data ) throws Throwable
{
(new CWE190_Integer_Overflow__long_rand_add_53c()).goodG2BSink(data );
}
/* goodB2G() - use badsource and goodsink */
public void goodB2GSink(long data ) throws Throwable
{
(new CWE190_Integer_Overflow__long_rand_add_53c()).goodB2GSink(data );
}
}
| [
"bqcuong2212@gmail.com"
] | bqcuong2212@gmail.com |
8a1353a1c12d41e43306b4b3fa45242f2996fbd2 | f91271cddd61f3b53828086a396612d7a30e676d | /src/main/java/gtl/spark/java/example/apache/ml/JavaMinMaxScalerExample.java | c2841f47b8578720cabf92e2c669c3417eed090e | [] | no_license | xyfigo/gtl_for_java | 12f24527846210f68a0691044296b81a14cd53a3 | f6ee589655c787e4a4e96e2752067637b11c78c8 | refs/heads/master | 2020-04-15T15:55:45.152916 | 2018-02-11T01:06:23 | 2018-02-11T01:06:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,762 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package gtl.spark.java.example.apache.ml;
import org.apache.spark.sql.SparkSession;
// $example on$
import java.util.Arrays;
import java.util.List;
import org.apache.spark.ml.feature.MinMaxScaler;
import org.apache.spark.ml.feature.MinMaxScalerModel;
import org.apache.spark.ml.linalg.Vectors;
import org.apache.spark.ml.linalg.VectorUDT;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.RowFactory;
import org.apache.spark.sql.types.DataTypes;
import org.apache.spark.sql.types.Metadata;
import org.apache.spark.sql.types.StructField;
import org.apache.spark.sql.types.StructType;
// $example off$
public class JavaMinMaxScalerExample {
public static void main(String[] args) {
SparkSession spark = SparkSession
.builder()
.appName("JavaMinMaxScalerExample")
.getOrCreate();
// $example on$
List<Row> data = Arrays.asList(
RowFactory.create(0, Vectors.dense(1.0, 0.1, -1.0)),
RowFactory.create(1, Vectors.dense(2.0, 1.1, 1.0)),
RowFactory.create(2, Vectors.dense(3.0, 10.1, 3.0))
);
StructType schema = new StructType(new StructField[]{
new StructField("id", DataTypes.IntegerType, false, Metadata.empty()),
new StructField("features", new VectorUDT(), false, Metadata.empty())
});
Dataset<Row> dataFrame = spark.createDataFrame(data, schema);
MinMaxScaler scaler = new MinMaxScaler()
.setInputCol("features")
.setOutputCol("scaledFeatures");
// Compute summary statistics and generate MinMaxScalerModel
MinMaxScalerModel scalerModel = scaler.fit(dataFrame);
// rescale each feature to range [min, max].
Dataset<Row> scaledData = scalerModel.transform(dataFrame);
System.out.println("Features scaled to range: [" + scaler.getMin() + ", "
+ scaler.getMax() + "]");
scaledData.select("features", "scaledFeatures").show();
// $example off$
spark.stop();
}
}
| [
"zwhe@cug.edu.cn"
] | zwhe@cug.edu.cn |
b6613dba5ed1c8e39b8a40d4bf313e46721c43d2 | f175a1561cfee00036490cd3ab5d3ac6dbbfcd14 | /Regensbad/app/src/main/java/com/example/tom/regensbad/Persistence/WeatherJSONConverter.java | 9b6efa9a2ee4be0f42104cc17c50fad45fde4c65 | [] | no_license | Tca1107/Regensbad | b313d4ff8e1f2fa24d46407d724958a542446430 | 3820e5b0342e7d021e58d5bb7471c4756b741b16 | refs/heads/master | 2021-01-23T08:56:58.433273 | 2015-09-27T11:56:17 | 2015-09-27T11:56:17 | 40,909,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,575 | java | package com.example.tom.regensbad.Persistence;
import android.util.Log;
import com.example.tom.regensbad.Domain.Weather;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by Tom on 26.08.2015.
*/
public class WeatherJSONConverter {
private static final String MAIN ="main";
private static final String DEGREES = "temp";
private static final String WEATHER = "weather";
private static final String DESCRIPTION = "description";
private static final String ICON_CODE = "id";
private static final String SYS = "sys";
private static final String SUNRISE = "sunrise";
private static final String SUNSET = "sunset";
private static final String MAX_DEGREES = "temp_max";
private static final String MIN_DEGREES = "temp_min";
private static final String HUMIDITY = "humidity";
private static final String WIND = "wind";
private static final String WIND_SPEED = "speed";
private String JSONResult;
private Weather weatherToReturn;
/* The creation of this class was inspired by a similar class being used in the "3.Studienleistung", that is to say the MensaAppStarterProject. */
public WeatherJSONConverter (String JSONResult) {
this.JSONResult = JSONResult;
}
public Weather convertJSONToWeatherObject () {
try {
JSONObject jsonObject = new JSONObject(JSONResult);
JSONObject main = jsonObject.getJSONObject(MAIN);
String degrees = main.getString(DEGREES);
String maxDegrees = main.getString(MAX_DEGREES);
String minDegrees = main.getString(MIN_DEGREES);
String humidity = main.getString(HUMIDITY);
JSONObject sys = jsonObject.getJSONObject(SYS);
long sunrise = sys.getLong(SUNRISE);
long sunset = sys.getLong(SUNSET);
JSONObject wind = jsonObject.getJSONObject(WIND);
String windSpeed = wind.getString(WIND_SPEED);
JSONArray weather = jsonObject.getJSONArray(WEATHER);
JSONObject weatherObject = weather.getJSONObject(0);
String weatherDescription = weatherObject.getString(DESCRIPTION);
String weatherIcon = weatherObject.getString(ICON_CODE);
weatherToReturn = new Weather (degrees, maxDegrees, minDegrees, humidity, sunrise, sunset,
windSpeed, weatherDescription, weatherIcon);
} catch (JSONException exception) {
exception.printStackTrace();
}
return weatherToReturn;
}
}
| [
"tom.ch.auer@googlemail.com"
] | tom.ch.auer@googlemail.com |
d306120d5be45adca2e2f1e3a5ba8037fec5fd59 | 5de467445d4cb47de6bd5741a5fc6c735559d668 | /maman16/students/udpclient/IUdpMessageHandler.java | 8eea148d2aa3dd1adef7df73e4ac9492059aca0b | [] | no_license | ayalw/JavaMaman16 | fa888d774f5c762bc8af54f547349c8e78c2cc66 | fabfad09de5c90b08f2c25ca65ebd5fb1338c4f0 | refs/heads/master | 2020-04-17T12:57:11.925364 | 2019-02-02T10:46:44 | 2019-02-02T10:46:44 | 166,597,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package maman16.students.udpclient;
/**
* Interface for classes who want to respond to incoming UDP packets.
*/
public interface IUdpMessageHandler {
void onUdpMessageArrived(String message);
}
| [
"awarman@apple.com"
] | awarman@apple.com |
48cf8683f305079928976e7bbc5b1c1919771e36 | fb9f35125a837e7b43cad3b550914d0b3873cb90 | /src/main/java/com/springboot/start/web/controller/ErrorController.java | 2bac49cc7e8ef78fd9ae860dd587e6de2741e943 | [] | no_license | AnkitVartak1993/SpringBoot | 0184e5480a2707fd7ff3394ef56655f1b79f1e13 | db08ddae8fd8505c9bef7083efd6875e5a903fe0 | refs/heads/master | 2022-11-26T20:20:29.778628 | 2020-08-09T17:33:16 | 2020-08-09T17:33:16 | 284,149,686 | 0 | 0 | null | 2020-08-09T17:33:17 | 2020-07-31T23:39:38 | Java | UTF-8 | Java | false | false | 970 | java | package com.springboot.start.web.controller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller("error")
public class ErrorController {
private Log logger = LogFactory.getLog(ErrorController.class);
@ExceptionHandler(Exception.class)
public ModelAndView handleError(HttpServletRequest req, Exception ex) {
logger.error("Request: " + req.getRequestURL() + " raised " + ex);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", ex);
mav.addObject("url", req.getRequestURL());
mav.setViewName("error");
return mav;
}
}
| [
"ankitvartak@gmail.com"
] | ankitvartak@gmail.com |
1b5b3e67a27ab449bec321159b5b62edbe8744ee | 2df68f8eade159f929f8a1aca76fa5a1af130b41 | /src/LavaRunecrafter.java | 244f9d86cae3ffbd4f786ca91feaab39889d58bd | [] | no_license | nicoqueijo/OSRS-Lava-Runecrafter-Bot-Script | dd16290cc699cabcc1d94b0f2274f3770d3c939d | 7da14b9290bba7c8535dcdc8f8334acd949b287e | refs/heads/master | 2022-12-05T21:03:35.722718 | 2020-08-01T19:36:57 | 2020-08-01T19:36:57 | 284,321,938 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,678 | java | import org.dreambot.api.methods.map.Tile;
import org.dreambot.api.methods.skills.Skill;
import org.dreambot.api.script.AbstractScript;
import org.dreambot.api.script.Category;
import org.dreambot.api.script.ScriptManifest;
import org.dreambot.api.utilities.Timer;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import static org.dreambot.api.methods.Calculations.random;
@ScriptManifest(
author = "Nico",
description = "Runecrafts lava runes",
category = Category.RUNECRAFTING,
version = 1.0,
name = "Lava Runecrafter"
)
public class LavaRunecrafter extends AbstractScript {
/**
* Equipment: Fire tiara, Graceful cape, Binding necklace, Mist battlestaff, Gracefultop,
* Graceful legs, Tome of fire, Graceful gloves, Graceful boots, Ring of dueling
* <p>
* Inventory: Earth runes, Giant pouch, Large pouch
* Rune pouch (Cosmic runes, Astral runes)
* <p>
* Spellbook: Ancient
*/
public enum State {
BANK, DESERT, RUINS
}
public State state = State.BANK;
public final Tile BANK_TILE = new Tile(2443, 3083, 0);
public final Rectangle MINIMAP_LEFT_SIDE_RECTANGLE = new Rectangle(600, 90, 30, 40);
public final Rectangle MINIMAP_RIGHT_SIDE_RECTANGLE = new Rectangle(645, 90, 30, 40);
public final Rectangle BANK_RECTANGLE = new Rectangle(310, 10, 200, 90);
public Timer timer = new Timer();
private final long timeToStop = (long) 60 * 1000 * 118;
private List<Node> nodes = new ArrayList<>();
public boolean isPouchFull = false;
public int breaksTaken = 0;
private Node lastNodeExecuted = null;
private int timesExecutedSameNode = 0;
private final int XP_LEVEL_82 = 2421087;
private int beginningXp;
@Override
public void onStart() {
// Assure run on
// Assure bank is set on quantity all
super.onStart();
logInfo("Started at " + timer.formatTime());
beginningXp = getSkills().getExperience(Skill.RUNECRAFTING);
nodes.add(new RepairPouchesNode(this));
nodes.add(new DepositRunesNode(this));
nodes.add(new WithdrawJewelryNode(this));
nodes.add(new WithdrawPureEssenceNode(this));
nodes.add(new WearJewelryNode(this));
nodes.add(new FillPouchesNode(this));
nodes.add(new WithdrawPureEssenceNode(this));
nodes.add(new TeleToDuelArenaNode(this));
nodes.add(new WalkToRuinNode(this));
nodes.add(new RunecraftNode(this));
}
@Override
public void onPaint(Graphics graphics) {
super.onPaint(graphics);
int currentXp = getSkills().getExperience(Skill.RUNECRAFTING);
int xpGrained = currentXp - beginningXp;
graphics.setColor(Color.BLACK);
graphics.drawString("Lava Runecrafter", 330, 365);
graphics.drawString("Time running: " + timer.formatTime(), 330, 383);
graphics.drawString("Total XP gained: " + formatInt(xpGrained), 330, 401);
graphics.drawString("Hourly XP rate: " + formatInt(timer.getHourlyRate(xpGrained)), 330, 419);
graphics.drawString("XP until 82: " + formatInt(XP_LEVEL_82 - currentXp), 330, 437);
graphics.drawString("Hours until 82: " + String.format("%.2f",
(double) (XP_LEVEL_82 - currentXp) / timer.getHourlyRate(xpGrained)), 330, 455);
}
@Override
public int onLoop() {
log("Looping...");
for (Node node : nodes) {
if (node.validate()) {
checkInfiniteLoop(node);
return node.execute();
}
if (timer.elapsed() > timeToStop) {
logInfo("Stopped after " + timer.formatTime() + ". Reached time limit.");
stop();
}
}
return sleepTime();
}
private String formatInt(int num) {
return NumberFormat.getNumberInstance(Locale.US).format(num);
}
private void checkInfiniteLoop(Node node) {
if (node == lastNodeExecuted) {
timesExecutedSameNode++;
} else {
timesExecutedSameNode = 0;
}
if (timesExecutedSameNode > 5) {
logInfo("Stopped after " + timer.formatTime() + ". " + node.getClass().getSimpleName() + " in infinite loop.");
stop();
}
lastNodeExecuted = node;
}
public int sleepTime() {
return random(150, 200);
}
public void adjustCamera(State state) {
int yaw = getCamera().getYaw();
int pitch = getCamera().getPitch();
final int BANK_RUINS_MIN_YAW = 1300;
final int BANK_RUINS_MAX_YAW = 1450;
final int DESERT_MIN_YAW = 1850;
final int DESERT_MAX_YAW = 2000;
final int MIN_PITCH = 128;
final int MAX_PITCH = 383;
switch (state) {
case BANK: {
yaw = random(BANK_RUINS_MIN_YAW, BANK_RUINS_MAX_YAW);
pitch = MIN_PITCH;
break;
}
case DESERT: {
yaw = random(DESERT_MIN_YAW, DESERT_MAX_YAW);
pitch = MIN_PITCH;
break;
}
case RUINS: {
yaw = random(BANK_RUINS_MIN_YAW, BANK_RUINS_MAX_YAW);
pitch = MAX_PITCH;
break;
}
}
getCamera().rotateTo(yaw, pitch);
}
public void logValidation(String node) {
log("Validating: " + node);
}
public void logExecution(String node) {
log("Executing: " + node);
}
}
| [
"queijonicolas@gmail.com"
] | queijonicolas@gmail.com |
7e7e6a1079f9617608dc8ecd2704f45df2f33319 | f08fae1c322265d7b08843aeaf44ca2e45ed3a43 | /tutorial/alex/Items/TwinSword.java | 37f21a6eb5813963f9720354cacdaee8aec24805 | [] | no_license | gutza1/DTGMod | 3c00d7c07c672a166e90f2243559523e62063c54 | 796098bf00bdbcbc6318a7300ab62bf8b523dde0 | refs/heads/master | 2021-01-16T22:14:12.842196 | 2015-01-11T13:26:52 | 2015-01-11T13:26:52 | 28,500,169 | 0 | 0 | null | 2015-01-11T13:26:52 | 2014-12-26T05:04:56 | Java | UTF-8 | Java | false | false | 725 | java | /* */ package tutorial.alex.Items;
/* */
/* */ import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
/* */ import net.minecraft.item.ItemSword;
/* */ import tutorial.alex.alex;
/* */
/* */ public class TwinSword extends ItemSword
/* */ {
/* */ public TwinSword(Item.ToolMaterial material)
/* */ {
/* 11 */ super(AlexItemLoader.TWIN);
/* 12 */ setUnlocalizedName("twinSword");
/* 13 */ setCreativeTab(alex.tabGodcraft);
/* 14 */ setTextureName("alexmodid:twinsword");
/* */ }
/* */ }
/* Location: C:\Users\Cris\Desktop\MyMods\Minecraft\DTGMod\
* Qualified Name: tutorial.alex.Items.TwinSword
* JD-Core Version: 0.6.0
*/ | [
"peterushtoma@yahoo.com"
] | peterushtoma@yahoo.com |
85920e696eb655524a18589eabf3f331b79b7164 | 2b2fcb1902206ad0f207305b9268838504c3749b | /WakfuClientSources/srcx/class_4449_bpd.java | 399b943b3f2f67362a036d1d760cd1022dbbc045 | [] | no_license | shelsonjava/Synx | 4fbcee964631f747efc9296477dee5a22826791a | 0cb26d5473ba1f36a3ea1d7163a5b9e6ebcb0b1d | refs/heads/master | 2021-01-15T13:51:41.816571 | 2013-11-17T10:46:22 | 2013-11-17T10:46:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | public class bpd extends aOI
{
public doh a(int paramInt, String paramString, TD paramTD)
{
return new cGP(paramInt, paramString, paramTD);
}
} | [
"music_inme@hotmail.fr"
] | music_inme@hotmail.fr |
d8463f0a85d83f2e35b335879060c3bc1a304361 | 873069a9eb9f1b6def6e7a3cbb201a62e3157ecd | /app/src/main/java/com/tetris/djj/machine_m/api/kankan/wheel/widget/OnWheelClickedListener.java | f7115503a4ce0d9b0454b07e4c2e95eb11e9bf97 | [] | no_license | Mesmers/machine | c72b5f9ea15a7feb6c63ea09370a3bec7dba29aa | 5ddd9ff7df23fe0e24549ecf966b3179aab527ae | refs/heads/master | 2020-07-19T10:32:01.317671 | 2016-09-02T14:20:17 | 2016-09-02T14:20:17 | 67,229,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,113 | java | /*
* Copyright 2011 Yuri Kanivets
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tetris.djj.machine_m.api.kankan.wheel.widget;
/**
* Wheel clicked listener interface.
* <p>The onItemClicked() method is called whenever a wheel item is clicked
* <li> New Wheel position is set
* <li> Wheel view is scrolled
*/
public interface OnWheelClickedListener {
/**
* Callback method to be invoked when current item clicked
* @param wheel the wheel view
* @param itemIndex the index of clicked item
*/
void onItemClicked(WheelView wheel, int itemIndex);
}
| [
"171145448@qq.com"
] | 171145448@qq.com |
9ab523fef35aab8d5092b2f7dc461dfc36881918 | ac1768b715e9fe56be8b340bc1e4bc7f917c094a | /ant_tasks/branches/release/11.02.x/common/source/java/ch/systemsx/cisd/common/db/ISqlScriptExecutor.java | 5f27849abee0353c3140019f37661275211d5287 | [
"Apache-2.0"
] | permissive | kykrueger/openbis | 2c4d72cb4b150a2854df4edfef325f79ca429c94 | 1b589a9656d95e343a3747c86014fa6c9d299b8d | refs/heads/master | 2023-05-11T23:03:57.567608 | 2021-05-21T11:54:58 | 2021-05-21T11:54:58 | 364,558,858 | 0 | 0 | Apache-2.0 | 2021-06-04T10:08:32 | 2021-05-05T11:48:20 | Java | UTF-8 | Java | false | false | 1,354 | java | /*
* Copyright 2007 ETH Zuerich, CISD
*
* 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 ch.systemsx.cisd.common.db;
import ch.systemsx.cisd.common.Script;
/**
* Executor of SQL scripts.
*
* @author Franz-Josef Elmer
*/
public interface ISqlScriptExecutor
{
/**
* Executes the specified SQL script.
*
* @param sqlScript The script to execute.
* @param honorSingleStepMode If <code>false</code>, the single step mode will be ignored for
* this script, even if configured in the properties.
* @param loggerOrNull A logger to log the execution of the <var>sqlScript</var>, or
* <code>null</code>, if no logging should be performed.
*/
public void execute(Script sqlScript, boolean honorSingleStepMode,
ISqlScriptExecutionLogger loggerOrNull);
}
| [
"fedoreno"
] | fedoreno |
9bea94aed425fd83d2248cc832f21facad586bdb | cb60ff6a3c6c9cf1ed631d789d7430ec9292c25d | /stylenandari/src/nandari/command/_02_ManagerLogin.java | f6ca981dcad22cf405e087805e37616eeee7a6da | [] | no_license | yourchikorita/nandari | f08fabf993a42bbc992fd2ad9596033d83e37adb | 0fae851875478c57c92d160b2dad6aed2efa0ae3 | refs/heads/master | 2022-12-27T11:29:06.555564 | 2020-10-01T07:19:50 | 2020-10-01T07:19:50 | 300,181,707 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 338 | java | package nandari.command;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class _02_ManagerLogin implements CommandAction {
@Override
public String requestPro(HttpServletRequest request, HttpServletResponse response)
throws Throwable {
return "/02_managerLogin.jsp";
}
}
| [
"yourchikorita@gmail.com"
] | yourchikorita@gmail.com |
b5da57d8d69a9ab60f8b7ca63f21d7db636777ff | d926a10ade7b5ed4d78bea0e2f16037db9538f15 | /src/Main.java | f16707d3ed62854bbd3b80a840568a3a06bf32cc | [] | no_license | NickPtr/MemoryGame | 54d9260fdaad3ef99d0b6d2316a9fb56dbbfabc3 | a2fce947e30f2be34e555cb307fdb5bd043c3e3b | refs/heads/master | 2020-12-11T12:30:46.268606 | 2020-01-14T13:44:07 | 2020-01-14T13:44:07 | 233,850,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java |
import javax.swing.JOptionPane;
/**
*
* @author Νίκος
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//Emfanisi minimatos sston xristi gia tin kataxorisi tou onomatos tou
String name = (String) JOptionPane.showInputDialog(null, "Δώστε το όνομά σας", "Όνομα Παίχτη", JOptionPane.PLAIN_MESSAGE);
//kaloume tin klasi Panel gia tin dimiourgia twn grafikwn tis efarmogis
Panel panel = new Panel(name);
}
}
| [
"44138348+NickPtr@users.noreply.github.com"
] | 44138348+NickPtr@users.noreply.github.com |
8ecd6288291346ee4d4a4c320899d9742c5891f0 | b28f08cee22b7f8bdc4b197c89e8db87f7ecb501 | /src/main/java/com/seungjun/touchball/service/TouchBallService.java | 5f3410f183a5cbf4ff4b4e479b58180a9e49d828 | [] | no_license | ESeungJun/TouchBall_Server | 787808f51aad41b9826c7b5941ade7fba4aacf9b | ca82b745edbd6c3b639fc6979241bd029d64f080 | refs/heads/master | 2020-03-11T12:18:19.495190 | 2018-04-18T02:49:35 | 2018-04-18T02:49:35 | 129,993,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,832 | java | package com.seungjun.touchball.service;
import java.util.ArrayList;
import com.seungjun.touchball.vo.RankInfoVO;
import com.seungjun.touchball.vo.UserInfoVO;
import com.seungjun.touchball.vo.UserJsonVO;
public interface TouchBallService {
//============================================================//
public void addUserInfo(UserInfoVO userInfo) throws Exception;
public UserInfoVO getUserInfo(String user_id) throws Exception;
//============================================================//
//============================================================//
public void addEasyRankInfo(RankInfoVO rankInfo) throws Exception;
public ArrayList<RankInfoVO> getEasyRankInfo() throws Exception;
//============================================================//
//============================================================//
public void addNormalRankInfo(RankInfoVO rankInfo) throws Exception;
public ArrayList<RankInfoVO> getNormalRankInfo() throws Exception;
//============================================================//
//============================================================//
public void addHardRankInfo(RankInfoVO rankInfo) throws Exception;
public ArrayList<RankInfoVO> getHardRankInfo() throws Exception;
//============================================================//
//============================================================//
public void addHellRankInfo(RankInfoVO rankInfo) throws Exception;
public ArrayList<RankInfoVO> getHellRankInfo() throws Exception;
//============================================================//
//============================================================//
public ArrayList<RankInfoVO> getPersonRankInfo(String user_id) throws Exception;
//============================================================//
}
| [
"rbfaosldk@hubilon.com"
] | rbfaosldk@hubilon.com |
b05b3bd780aaa203a288adf8fc93e511c5304254 | b9db4a35fb1f26bd1ea2f04902b74cb218967464 | /generated/java/src/cli/cashier/NewTransactionMenu.java | 3ad54d6973d83ad01943f871c6093c107a66e2a6 | [] | no_license | ineeve/MFES-FEUP | 9af1310a69e5de0c361b1435053f7ac6b49d904c | 1fec1f10279ea2f48b5a0f8c06d34ebb698aa881 | refs/heads/master | 2020-04-11T13:26:10.859391 | 2019-01-07T07:47:08 | 2019-01-07T07:47:08 | 161,816,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package cli.cashier;
import org.overture.codegen.runtime.VDMSet;
import cli.Menu;
import instance.Kid2KidSingleton;
import vdm.Client;
import vdm.Kid2Kid;
public class NewTransactionMenu extends Menu {
private Kid2Kid kid2kid;
private VDMSet clients;
public NewTransactionMenu() {
loop();
}
@SuppressWarnings("unchecked")
@Override
protected void initialize() {
kid2kid = Kid2KidSingleton.getInstance();
clients = kid2kid.getClients();
addOption("New client", () -> {
new NewClientForTransaction();
reinitialize();
});
clients.forEach((clientObj) -> {
Client client = (Client) clientObj;
addOption(client.getName(), () -> new PickNewTransactionTypeMenu(client));
});
}
}
| [
"joaofvde@gmail.com"
] | joaofvde@gmail.com |
a6e526dca42beaaca8ee71820b045500dccfb9d0 | e132b84b1579d4cf5a97535877c0e32639366f32 | /drools-compiler/src/test/java/org/drools/compiler/integrationtests/KieBaseIncludesTest.java | 30cf359a4ada31eed5c63ee4d78f0d538a145e09 | [
"Apache-2.0"
] | permissive | karreiro/drools | 142df0c92b2ae899cb4a1aa9181d09d50f95686e | fdb7c4d2486224312483d00aa0e3df3f345d5840 | refs/heads/master | 2021-06-12T07:04:05.099778 | 2017-04-10T15:19:10 | 2017-04-10T15:19:10 | 64,861,705 | 1 | 0 | Apache-2.0 | 2021-03-04T09:17:28 | 2016-08-03T16:32:11 | Java | UTF-8 | Java | false | false | 10,429 | java | /*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* 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.drools.compiler.integrationtests;
import org.drools.compiler.CommonTestMethodBase;
import org.junit.Test;
import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.builder.KieFileSystem;
import org.kie.api.builder.ReleaseId;
import org.kie.api.definition.KiePackage;
import org.kie.api.definition.rule.Rule;
import org.kie.api.runtime.KieContainer;
import java.util.Collection;
// DROOLS-1044
public class KieBaseIncludesTest extends CommonTestMethodBase {
/**
* Test the inclusion of a KieBase defined in one KJAR into the KieBase of another KJAR.
* <p/>
* The 2 KieBases use different package names for the rules (i.e. "rules" and "rules2").
*/
@Test
public void testKieBaseIncludesCrossKJarDifferentPackageNames() {
// @formatter:off
String pomContent1 = "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n" +
"<modelVersion>4.0.0</modelVersion>\n" +
"<groupId>org.kie</groupId>\n" +
"<artifactId>rules-1</artifactId>\n" +
"<version>1.0.0</version>\n" +
"<packaging>jar</packaging>\n" +
"<dependencies>\n" +
"<dependency>\n" +
"<groupId>org.kie</groupId>\n" +
"<artifactId>rules-2</artifactId>\n" +
"<version>1.0.0</version>\n" +
"</dependency>\n" +
"</dependencies>\n" +
"</project>\n";
String kmoduleContent1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<kmodule xmlns=\"http://jboss.org/kie/6.0.0/kmodule\">\n" +
"<kbase name=\"kbase1\" equalsBehavior=\"equality\" default=\"true\" packages=\"rules\" includes=\"kbase2\">\n" +
"<ksession name=\"ksession1\" default=\"true\" type=\"stateful\"/>\n" +
"</kbase>\n"+
"</kmodule>";
String drl1 = "package org.jboss.ddoyle.drools.rules1\n" +
"\n" +
"rule \"Rule in KieBase 1\"\n" +
"when\n" +
"then\n" +
"System.out.println(\"Rule in KieBase1\");\n" +
"end";
String kmoduleContent2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<kmodule xmlns=\"http://jboss.org/kie/6.0.0/kmodule\">\n" +
"<kbase name=\"kbase2\" equalsBehavior=\"equality\" default=\"false\" packages=\"rules2\">\n" +
"<ksession name=\"ksession2\" default=\"false\" type=\"stateful\"/>\n" +
"</kbase>\n"+
"</kmodule>";
String drl2 = "package org.jboss.ddoyle.drools.rules2\n" +
"\n" +
"rule \"Rule in KieBase 2\"\n" +
"when\n" +
"then\n" +
"System.out.println(\"Rule in KieBase2\");\n" +
"end";
// @formatter:on
KieServices ks = KieServices.Factory.get();
ReleaseId releaseId1 = ks.newReleaseId( "org.kie", "rules-1", "1.0.0" );
ReleaseId releaseId2 = ks.newReleaseId("org.kie", "rules-2", "1.0.0");
//First deploy the second KJAR on which the first one depends.
KieFileSystem kfs2 = ks.newKieFileSystem()
.generateAndWritePomXML(releaseId2)
.write("src/main/resources/rules2/rules.drl", drl2)
.writeKModuleXML(kmoduleContent2);
ks.newKieBuilder(kfs2).buildAll();
KieFileSystem kfs1 = ks.newKieFileSystem()
//.generateAndWritePomXML(releaseId1)
.writePomXML(pomContent1)
.write("src/main/resources/rules/rules.drl", drl1)
.writeKModuleXML(kmoduleContent1);
ks.newKieBuilder(kfs1).buildAll();
KieContainer kc = ks.newKieContainer( releaseId1 );
KieBase kieBase = kc.getKieBase();
// Assert the number of rules in the KieBase.
long nrOfRules = getNumberOfRules(kieBase);
// We should have 2 rules in our KieBase. One from our own DRL and one from the DRL in the KieBase we've included.
assertEquals(2, nrOfRules);
}
/**
* Test the inclusion of a KieBase defined in one KJAR into the KieBase of another KJAR.
* <p/>
* The 2 KieBases use the same package names for the rules (i.e. "rules").
*/
@Test
public void testKieBaseIncludesCrossKJarSamePackageNames() {
// @formatter:off
String pomContent1 = "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n" +
"<modelVersion>4.0.0</modelVersion>\n" +
"<groupId>org.kie</groupId>\n" +
"<artifactId>rules-1</artifactId>\n" +
"<version>1.0.0</version>\n" +
"<packaging>jar</packaging>\n" +
"<dependencies>\n" +
"<dependency>\n" +
"<groupId>org.kie</groupId>\n" +
"<artifactId>rules-2</artifactId>\n" +
"<version>1.0.0</version>\n" +
"</dependency>\n" +
"</dependencies>\n" +
"</project>\n";
String kmoduleContent1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<kmodule xmlns=\"http://jboss.org/kie/6.0.0/kmodule\">\n" +
"<kbase name=\"kbase1\" equalsBehavior=\"equality\" default=\"true\" packages=\"rules\" includes=\"kbase2\">\n" +
"<ksession name=\"ksession1\" default=\"true\" type=\"stateful\"/>\n" +
"</kbase>\n"+
"</kmodule>";
String drl1 = "package org.jboss.ddoyle.drools.rules1\n" +
"\n" +
"rule \"Rule in KieBase 1\"\n" +
"when\n" +
"then\n" +
"System.out.println(\"Rule in KieBase1\");\n" +
"end";
String kmoduleContent2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<kmodule xmlns=\"http://jboss.org/kie/6.0.0/kmodule\">\n" +
"<kbase name=\"kbase2\" equalsBehavior=\"equality\" default=\"false\" packages=\"rules\">\n" +
"<ksession name=\"ksession2\" default=\"false\" type=\"stateful\"/>\n" +
"</kbase>\n"+
"</kmodule>";
String drl2 = "package org.jboss.ddoyle.drools.rules2\n" +
"\n" +
"rule \"Rule in KieBase 2\"\n" +
"when\n" +
"then\n" +
"System.out.println(\"Rule in KieBase2\");\n" +
"end";
// @formatter:on
KieServices ks = KieServices.Factory.get();
ReleaseId releaseId1 = ks.newReleaseId("org.kie", "rules-1", "1.0.0");
ReleaseId releaseId2 = ks.newReleaseId("org.kie", "rules-2", "1.0.0");
//First deploy the second KJAR on which the first one depends.
KieFileSystem kfs2 = ks.newKieFileSystem()
.generateAndWritePomXML(releaseId2)
.write("src/main/resources/rules/rules.drl", drl2)
.writeKModuleXML(kmoduleContent2);
ks.newKieBuilder(kfs2).buildAll();
KieFileSystem kfs1 = ks.newKieFileSystem()
//.generateAndWritePomXML(releaseId1)
.writePomXML(pomContent1)
.write("src/main/resources/rules/rules.drl", drl1)
.writeKModuleXML(kmoduleContent1);
ks.newKieBuilder(kfs1).buildAll();
KieContainer kc = ks.newKieContainer(releaseId1);
KieBase kieBase = kc.getKieBase();
// Assert the number of rules in the KieBase.
long nrOfRules = getNumberOfRules(kieBase);
// We should have 2 rules in our KieBase. One from our own DRL and one from the DRL in the KieBase we've included.
assertEquals(2, nrOfRules);
}
/**
* Helper method which determines the number of rules in the {@link KieBase}.
*
* @param kieBase
* the {@link KieBase}
* @return the number of rules in the {@link KieBase}
*/
private static long getNumberOfRules(KieBase kieBase) {
long nrOfRules = 0;
Collection<KiePackage> kiePackages = kieBase.getKiePackages();
for (KiePackage nextKiePackage : kiePackages) {
Collection<Rule> rules = nextKiePackage.getRules();
System.out.println(rules);
nrOfRules += rules.size();
}
return nrOfRules;
}
}
| [
"mario.fusco@gmail.com"
] | mario.fusco@gmail.com |
ef348d37bcf0e78b2792611333a8bfdecd6fe729 | 45ee5dbfe334ba1ad1a041c37dfb107cf3a43c43 | /src/main/java/com/capstone/kots/service/UserJoinCaseService.java | 074ab6082814a14fd9cce95a38aa92841299da58 | [] | no_license | thuthao109/backendd | 690d7f3903cd0d54fafd42bc2f32b590782014b9 | 899fafb80e0467d3ae68f5751db967f167db2d87 | refs/heads/master | 2023-04-27T15:11:20.299092 | 2019-07-18T06:46:44 | 2019-07-18T06:46:44 | 198,071,352 | 0 | 0 | null | 2023-04-14T17:48:08 | 2019-07-21T15:09:04 | Java | UTF-8 | Java | false | false | 73 | java | package com.capstone.kots.service;
public class UserJoinCaseService {
}
| [
"tnqv1021997@gmail.com"
] | tnqv1021997@gmail.com |
3bc71d3f36075090196de3020090098184220d72 | 3cb40f5799af335fc66691bfce0d20014dc6a87e | /src/main/java/frc/robot/commands/setCamera.java | 469e0783355c4b986dc4acff281efa68b22ff74a | [] | no_license | HoyaRobotics/ExampleRobot2021March | 1b7f0699a6eb2486d7e548bd83cf07118185c78b | 75b901e33c5a7802287049b20afc2437712f8884 | refs/heads/master | 2023-03-27T23:57:30.036546 | 2021-03-29T16:06:11 | 2021-03-29T16:06:11 | 352,705,718 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,423 | java | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.commands;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.subsystems.Vision;
public class setCamera extends CommandBase {
public final Vision vision;
public Boolean ranOnce = false;
/**
* Creates a new setCamera.
*/
public setCamera(Vision vision) {
this.vision = vision;
addRequirements(vision);
// Use addRequirements() here to declare subsystem dependencies.
}
// Called when the command is initially scheduled.
@Override
public void initialize() {
}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
}
public void cc(){ vision.changeCamera();}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}
| [
"hoyarobotics@gmail.com"
] | hoyarobotics@gmail.com |
94ffab8b286a5bcc504713e63ef80a369eecdda2 | 0cf989eebb939f191da3b69636f6d976c04b9301 | /src/java/servlets/Servlet2.java | 7b767ad1413af6ab0f753597ffb83b37e8eb3d2e | [] | no_license | AbelVasquezYuto/calificada | 931d7099856b5db873065869b8c635f9b3d4fdca | 2a26d5e832c3a8e54257b65376f4da7ef5bba5f2 | refs/heads/master | 2020-03-29T00:54:26.938891 | 2018-09-18T22:57:17 | 2018-09-18T22:57:17 | 149,361,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,958 | 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 servlets;
import conexion.ConexionDB;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author LaboratorioFISI
*/
@WebServlet(name = "Servlet2", urlPatterns = {"/Servlet2"})
public class Servlet2 extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
ConexionDB conexionBD = new ConexionDB();
if(request.getParameter("actualizar")!=null){
conexionBD.actualizar(request.getParameter(""));
}
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"LaboratorioFISI@UNMSM.pe"
] | LaboratorioFISI@UNMSM.pe |
1078bb815c0c820d4846de6b5d59fc8169d1228a | 9283ba052d0ab2f1ae8c13c25a0533e7c694c9b6 | /demo-java/src/main/java/iunsuccessful/demo/guava/basedemo/StopwatchDemo.java | fd9c09eca00db59d6356af000709fc527c576f9f | [] | no_license | iunsuccessful/demo-spring-mvc | 69f6f23d21473b7c3765eaeb963c1a5de021d696 | c1d49710701cef5dd4fb27a0d311cce60104f7b6 | refs/heads/master | 2022-06-30T14:25:59.468321 | 2022-06-25T08:07:41 | 2022-06-25T08:07:41 | 77,351,434 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 703 | java | package iunsuccessful.demo.guava.basedemo;
import com.google.common.base.Stopwatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.Duration;
/**
* 依韵 2022/3/19
*/
public class StopwatchDemo {
private static final Logger logger = LoggerFactory.getLogger(StopwatchDemo.class);
public static void main(String[] args) throws InterruptedException {
Stopwatch stopwatch = Stopwatch.createStarted();
Thread.sleep(100L);
stopwatch.stop(); // optional
Duration duration = stopwatch.elapsed();
logger.info("time: " + stopwatch); // formatted string like "12.3 ms"
logger.info("time: " + duration.toNanos());
}
}
| [
"n_syiyun@3songshu.com"
] | n_syiyun@3songshu.com |
f4c1d432b766dd34fda8f8dc3f58f335611b6cfe | bc3c2945c420c48b15c9892e3ddac244f29f3fc1 | /src-dlna/org/cybergarage/http/HTTPServer.java | 58fc16292a1f7e5ba2f34238cc66496b49e825c0 | [] | no_license | CoderDg/DlnaBaofeng | 10da047367902ee72f461f1c114efb849728ef22 | d6b77042d2bac59e2ede1bab66d95de31b4081ae | refs/heads/master | 2020-06-01T06:58:17.799891 | 2014-12-25T04:09:35 | 2014-12-25T04:09:35 | 28,225,661 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,699 | java | /******************************************************************
*
* CyberHTTP for Java
*
* Copyright (C) Satoshi Konno 2002-2003
*
* File: HTTPServer.java
*
* Revision;
*
* 12/12/02
* - first revision.
* 10/20/03
* - Improved the HTTP server using multithreading.
* 08/27/04
* - Changed accept() to set a default timeout, HTTP.DEFAULT_TIMEOUT, to the socket.
*
******************************************************************/
package org.cybergarage.http;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import org.cybergarage.util.Debug;
import org.cybergarage.util.ListenerList;
/**
* This class identifies an HTTP over TCP server<br>
* The server must be initialized iether by the
* {@link HTTPServer#open(InetAddress, int)} or the
* {@link HTTPServer#open(String, int)} method.<br>
* Optionally a set of {@link HTTPRequestListener} may be set<br>
* The server then can be started or stopped by the method
* {@link HTTPServer#start()} and {@link HTTPServer#stop()}
*
* @author Satoshi "skonno" Konno
* @author Stefano "Kismet" Lenzi
* @version 1.8
*/
public class HTTPServer implements Runnable {
// //////////////////////////////////////////////
// Constants
// //////////////////////////////////////////////
public final static String NAME = "CyberHTTP";
public final static String VERSION = "1.0";
public final static int DEFAULT_PORT = 80;
/**
* Default timeout connection for HTTP comunication
*
* @since 1.8
*/
public final static int DEFAULT_TIMEOUT = DEFAULT_PORT * 1000;
public static String getName() {
String osName = System.getProperty("os.name");
String osVer = System.getProperty("os.version");
return osName + "/" + osVer + " " + NAME + "/" + VERSION;
}
// //////////////////////////////////////////////
// Constructor
// //////////////////////////////////////////////
public HTTPServer() {
serverSock = null;
}
// //////////////////////////////////////////////
// ServerSocket
// //////////////////////////////////////////////
private ServerSocket serverSock = null;
private InetAddress bindAddr = null;
private int bindPort = 0;
/**
* Store the current TCP timeout value The variable should be accessed by
* getter and setter metho
*/
protected int timeout = DEFAULT_TIMEOUT;
public ServerSocket getServerSock() {
return serverSock;
}
public String getBindAddress() {
if (bindAddr == null)
return "";
return bindAddr.toString();
}
public int getBindPort() {
return bindPort;
}
// //////////////////////////////////////////////
// open/close
// //////////////////////////////////////////////
/**
* Get the current socket timeout
*
* @since 1.8
*/
public synchronized int getTimeout() {
return timeout;
}
/**
* Set the current socket timeout
*
* @param longout new timeout
* @since 1.8
*/
public synchronized void setTimeout(int timeout) {
this.timeout = timeout;
}
public boolean open(InetAddress addr, int port) {
if (serverSock != null)
return true;
try {
serverSock = new ServerSocket(bindPort, 0, bindAddr);
} catch (IOException e) {
return false;
}
return true;
}
public boolean open(String addr, int port) {
if (serverSock != null)
return true;
try {
bindAddr = InetAddress.getByName(addr);
bindPort = port;
serverSock = new ServerSocket(bindPort, 0, bindAddr);
} catch (IOException e) {
return false;
}
return true;
}
public boolean close() {
if (serverSock == null)
return true;
try {
serverSock.close();
serverSock = null;
bindAddr = null;
bindPort = 0;
} catch (Exception e) {
Debug.warning(e);
return false;
}
return true;
}
public Socket accept() {
if (serverSock == null)
return null;
try {
Socket sock = serverSock.accept();
sock.setSoTimeout(getTimeout());
return sock;
} catch (Exception e) {
return null;
}
}
public boolean isOpened() {
return (serverSock != null) ? true : false;
}
// //////////////////////////////////////////////
// httpRequest
// //////////////////////////////////////////////
private ListenerList httpRequestListenerList = new ListenerList();
public void addRequestListener(HTTPRequestListener listener) {
httpRequestListenerList.add(listener);
}
public void removeRequestListener(HTTPRequestListener listener) {
httpRequestListenerList.remove(listener);
}
public void performRequestListener(HTTPRequest httpReq) {
int listenerSize = httpRequestListenerList.size();
for (int n = 0; n < listenerSize; n++) {
HTTPRequestListener listener = (HTTPRequestListener) httpRequestListenerList.get(n);
listener.httpRequestRecieved(httpReq);
}
}
// //////////////////////////////////////////////
// run
// //////////////////////////////////////////////
private Thread httpServerThread = null;
@Override
public void run() {
if (isOpened() == false)
return;
Thread thisThread = Thread.currentThread();
while (httpServerThread == thisThread) {
Thread.yield();
Socket sock;
try {
Debug.message("accept ...");
sock = accept();
if (sock != null) {
Debug.message("sock = " + sock.getRemoteSocketAddress());
}
} catch (Exception e) {
Debug.warning(e);
break;
}
HTTPServerThread httpServThread = new HTTPServerThread(this, sock);
httpServThread.start();
Debug.message("httpServThread ...");
}
}
public boolean start() {
StringBuffer name = new StringBuffer("Cyber.HTTPServer/");
name.append(serverSock.getLocalSocketAddress());
httpServerThread = new Thread(this, name.toString());
httpServerThread.start();
return true;
}
public boolean stop() {
httpServerThread = null;
return true;
}
}
| [
"duxings426@icloud.com"
] | duxings426@icloud.com |
fc1a1d3843bfce42f2a97bd9d3a109acb8ab2b6a | d2de04d67eb9523d7e8412239371bae27b57a546 | /build/Android/Debug/app/src/main/java/com/foreign/Fuse/Controls/Native/Android/ImageView.java | aeded662bcee2b6de66be71b7cf8c10d9c4d4ec0 | [] | no_license | alloywheels/exploring | e103d6d4924dae117f019558018c1e48cd643e01 | 75d49914df0563d1956f998199724bc4e9c71a87 | refs/heads/master | 2021-09-01T21:12:12.052577 | 2017-12-28T16:10:20 | 2017-12-28T16:10:20 | 115,637,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,822 | java | package com.foreign.Fuse.Controls.Native.Android;
// fuse defined imports
import com.uno.UnoObject;
import com.uno.BoolArray;
import com.uno.ByteArray;
import com.uno.CharArray;
import com.uno.DoubleArray;
import com.uno.FloatArray;
import com.uno.IntArray;
import com.uno.LongArray;
import com.uno.ObjectArray;
import com.uno.ShortArray;
import com.uno.StringArray;
import com.Bindings.UnoHelper;
import com.Bindings.UnoWrapped;
import com.Bindings.ExternedBlockHost;
public class ImageView
{
static void debug_log(Object message)
{
android.util.Log.d("exploring", (message==null ? "null" : message.toString()));
}
public static void ClearBitmap135(final Object handle)
{
((android.widget.ImageView)handle).setImageResource(0);
((android.widget.ImageView)handle).invalidate();
}
public static Object Create136(final Object container)
{
android.widget.RelativeLayout relativeLayout = (android.widget.RelativeLayout)container;
android.widget.ImageView imageView = new android.widget.ImageView(com.fuse.Activity.getRootActivity());
imageView.setScaleType(android.widget.ImageView.ScaleType.MATRIX);
imageView.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT));
relativeLayout.addView(imageView);
return imageView;
}
public static Object CreateContainer137()
{
android.widget.RelativeLayout relativeLayout = new android.widget.RelativeLayout(com.fuse.Activity.getRootActivity());
relativeLayout.setFocusable(true);
relativeLayout.setFocusableInTouchMode(true);
relativeLayout.setClipToPadding(true);
relativeLayout.setClipChildren(true);
relativeLayout.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT));
return relativeLayout;
}
public static void GetImageSize138(final Object handle,final com.uno.IntArray wh)
{
android.widget.ImageView imageView = (android.widget.ImageView)handle;
imageView.measure(
android.view.View.MeasureSpec.UNSPECIFIED,
android.view.View.MeasureSpec.UNSPECIFIED);
wh.set(0, imageView.getMeasuredWidth());
wh.set(1, imageView.getMeasuredHeight());
}
public static void SetBitmap139(final Object handle,final Object bitmapHandle)
{
((android.widget.ImageView)handle).setImageBitmap( (android.graphics.Bitmap)bitmapHandle );
((android.widget.ImageView)handle).invalidate();
}
public static void SetImageMatrix140(final Object handle,final float x,final float y,final float scaleX,final float scaleY)
{
android.widget.ImageView imageView = (android.widget.ImageView)handle;
float[] m = new float[]
{
scaleX, 0.0f, x,
0.0f, scaleY, y,
0.0f, 0.0f, 1.0f
};
android.graphics.Matrix matrix = new android.graphics.Matrix();
matrix.setValues(m);
imageView.setImageMatrix(matrix);
}
public static void SetImageSize1141(final Object handle,final com.uno.IntArray wh)
{
android.widget.ImageView imageView = (android.widget.ImageView)handle;
imageView.setLayoutParams(new android.widget.RelativeLayout.LayoutParams(wh.get(0), wh.get(1)));
}
public static void SetTint142(final Object handle,final int rgba)
{
android.graphics.drawable.Drawable drawable = ((android.widget.ImageView)handle).getDrawable();
if (drawable != null) {
drawable.setColorFilter(rgba, android.graphics.PorterDuff.Mode.MULTIPLY);
}
}
}
| [
"turrifftyresandalloys@gmail.com"
] | turrifftyresandalloys@gmail.com |
f340403c4f2590dfcc12a8b6f67d79e600a05289 | c46f99dbb1ea967302d4ba6f974928c43e0b7eb1 | /src/main/java/org/docx4j/wml/CTTblPrEx.java | 419ce233c609ea74c6330da60a0cbac7935c8dd0 | [
"Apache-2.0"
] | permissive | manivannans/docx4j | 688320ebde87c6f6d7cd43f32d475eb635d5e9c1 | 777c78a844b98e15c3d472fedd3b3e01e6017327 | refs/heads/master | 2020-12-25T00:50:18.304299 | 2012-05-29T03:59:59 | 2012-05-29T03:59:59 | 4,479,085 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,081 | java | /*
* Copyright 2007-2008, Plutext Pty Ltd.
*
* This file is part of docx4j.
docx4j is 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.docx4j.wml;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.ppp.Child;
/**
* <p>Java class for CT_TblPrEx complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="CT_TblPrEx">
* <complexContent>
* <extension base="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_TblPrExBase">
* <sequence>
* <element name="tblPrExChange" type="{http://schemas.openxmlformats.org/wordprocessingml/2006/main}CT_TblPrExChange" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_TblPrEx", propOrder = {
"tblPrExChange"
})
public class CTTblPrEx
extends CTTblPrExBase
implements Child
{
protected CTTblPrExChange tblPrExChange;
@XmlTransient
private Object parent;
/**
* Gets the value of the tblPrExChange property.
*
* @return
* possible object is
* {@link CTTblPrExChange }
*
*/
public CTTblPrExChange getTblPrExChange() {
return tblPrExChange;
}
/**
* Sets the value of the tblPrExChange property.
*
* @param value
* allowed object is
* {@link CTTblPrExChange }
*
*/
public void setTblPrExChange(CTTblPrExChange value) {
this.tblPrExChange = value;
}
/**
* Gets the parent object in the object tree representing the unmarshalled xml document.
*
* @return
* The parent object.
*/
public Object getParent() {
return this.parent;
}
public void setParent(Object parent) {
this.parent = parent;
}
/**
* This method is invoked by the JAXB implementation on each instance when unmarshalling completes.
*
* @param parent
* The parent object in the object tree.
* @param unmarshaller
* The unmarshaller that generated the instance.
*/
public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
setParent(parent);
}
}
| [
"jason@plutext.org"
] | jason@plutext.org |
be0dde3dd1e3f8c3fdb1c4591c5b85d81c2648f3 | 74e723c4ccffd06e45debe022d584aa16cc9efd6 | /2020_QR/QuickReaction_Android-develop/QuickReactionMJ/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/androidx/vectordrawable/R.java | 6b78cf06c5592e1f1b5598bfe9d7d85cfc67567d | [] | no_license | wotjd4305/QuickReaction_Android_Project | a3de8de66031ad0faf4425104f9b33eb75a23c77 | b1340e8ad180191e28b5ad1544c54deeaff1df8f | refs/heads/master | 2022-11-06T20:27:11.742458 | 2020-06-22T08:32:16 | 2020-06-22T08:32:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,483 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package androidx.vectordrawable;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f03002b;
public static final int font = 0x7f0300c4;
public static final int fontProviderAuthority = 0x7f0300c6;
public static final int fontProviderCerts = 0x7f0300c7;
public static final int fontProviderFetchStrategy = 0x7f0300c8;
public static final int fontProviderFetchTimeout = 0x7f0300c9;
public static final int fontProviderPackage = 0x7f0300ca;
public static final int fontProviderQuery = 0x7f0300cb;
public static final int fontStyle = 0x7f0300cc;
public static final int fontVariationSettings = 0x7f0300cd;
public static final int fontWeight = 0x7f0300ce;
public static final int ttcIndex = 0x7f0301c5;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f050055;
public static final int notification_icon_bg_color = 0x7f050056;
public static final int ripple_material_light = 0x7f050067;
public static final int secondary_text_default_material_light = 0x7f050069;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f06006b;
public static final int compat_button_inset_vertical_material = 0x7f06006c;
public static final int compat_button_padding_horizontal_material = 0x7f06006d;
public static final int compat_button_padding_vertical_material = 0x7f06006e;
public static final int compat_control_corner_material = 0x7f06006f;
public static final int compat_notification_large_icon_max_height = 0x7f060070;
public static final int compat_notification_large_icon_max_width = 0x7f060071;
public static final int notification_action_icon_size = 0x7f060087;
public static final int notification_action_text_size = 0x7f060088;
public static final int notification_big_circle_margin = 0x7f060089;
public static final int notification_content_margin_start = 0x7f06008a;
public static final int notification_large_icon_height = 0x7f06008b;
public static final int notification_large_icon_width = 0x7f06008c;
public static final int notification_main_column_padding_top = 0x7f06008d;
public static final int notification_media_narrow_margin = 0x7f06008e;
public static final int notification_right_icon_size = 0x7f06008f;
public static final int notification_right_side_padding_top = 0x7f060090;
public static final int notification_small_icon_background_padding = 0x7f060091;
public static final int notification_small_icon_size_as_large = 0x7f060092;
public static final int notification_subtext_size = 0x7f060093;
public static final int notification_top_pad = 0x7f060094;
public static final int notification_top_pad_large_text = 0x7f060095;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f07017a;
public static final int notification_bg = 0x7f07017b;
public static final int notification_bg_low = 0x7f07017c;
public static final int notification_bg_low_normal = 0x7f07017d;
public static final int notification_bg_low_pressed = 0x7f07017e;
public static final int notification_bg_normal = 0x7f07017f;
public static final int notification_bg_normal_pressed = 0x7f070180;
public static final int notification_icon_background = 0x7f070181;
public static final int notification_template_icon_bg = 0x7f070182;
public static final int notification_template_icon_low_bg = 0x7f070183;
public static final int notification_tile_bg = 0x7f070184;
public static final int notify_panel_notification_icon_bg = 0x7f070185;
}
public static final class id {
private id() {}
public static final int accessibility_action_clickable_span = 0x7f08000d;
public static final int accessibility_custom_action_0 = 0x7f08000e;
public static final int accessibility_custom_action_1 = 0x7f08000f;
public static final int accessibility_custom_action_10 = 0x7f080010;
public static final int accessibility_custom_action_11 = 0x7f080011;
public static final int accessibility_custom_action_12 = 0x7f080012;
public static final int accessibility_custom_action_13 = 0x7f080013;
public static final int accessibility_custom_action_14 = 0x7f080014;
public static final int accessibility_custom_action_15 = 0x7f080015;
public static final int accessibility_custom_action_16 = 0x7f080016;
public static final int accessibility_custom_action_17 = 0x7f080017;
public static final int accessibility_custom_action_18 = 0x7f080018;
public static final int accessibility_custom_action_19 = 0x7f080019;
public static final int accessibility_custom_action_2 = 0x7f08001a;
public static final int accessibility_custom_action_20 = 0x7f08001b;
public static final int accessibility_custom_action_21 = 0x7f08001c;
public static final int accessibility_custom_action_22 = 0x7f08001d;
public static final int accessibility_custom_action_23 = 0x7f08001e;
public static final int accessibility_custom_action_24 = 0x7f08001f;
public static final int accessibility_custom_action_25 = 0x7f080020;
public static final int accessibility_custom_action_26 = 0x7f080021;
public static final int accessibility_custom_action_27 = 0x7f080022;
public static final int accessibility_custom_action_28 = 0x7f080023;
public static final int accessibility_custom_action_29 = 0x7f080024;
public static final int accessibility_custom_action_3 = 0x7f080025;
public static final int accessibility_custom_action_30 = 0x7f080026;
public static final int accessibility_custom_action_31 = 0x7f080027;
public static final int accessibility_custom_action_4 = 0x7f080028;
public static final int accessibility_custom_action_5 = 0x7f080029;
public static final int accessibility_custom_action_6 = 0x7f08002a;
public static final int accessibility_custom_action_7 = 0x7f08002b;
public static final int accessibility_custom_action_8 = 0x7f08002c;
public static final int accessibility_custom_action_9 = 0x7f08002d;
public static final int action_container = 0x7f080036;
public static final int action_divider = 0x7f080038;
public static final int action_image = 0x7f080039;
public static final int action_text = 0x7f08003f;
public static final int actions = 0x7f080040;
public static final int async = 0x7f080051;
public static final int blocking = 0x7f080059;
public static final int chronometer = 0x7f080080;
public static final int dialog_button = 0x7f080094;
public static final int forever = 0x7f0800a7;
public static final int icon = 0x7f0800b6;
public static final int icon_group = 0x7f0800b7;
public static final int info = 0x7f0800c0;
public static final int italic = 0x7f0800c8;
public static final int line1 = 0x7f0800cd;
public static final int line3 = 0x7f0800ce;
public static final int normal = 0x7f080116;
public static final int notification_background = 0x7f080117;
public static final int notification_main_column = 0x7f080118;
public static final int notification_main_column_container = 0x7f080119;
public static final int right_icon = 0x7f08013c;
public static final int right_side = 0x7f08013d;
public static final int tag_accessibility_actions = 0x7f080169;
public static final int tag_accessibility_clickable_spans = 0x7f08016a;
public static final int tag_accessibility_heading = 0x7f08016b;
public static final int tag_accessibility_pane_title = 0x7f08016c;
public static final int tag_screen_reader_focusable = 0x7f08016d;
public static final int tag_transition_group = 0x7f08016e;
public static final int tag_unhandled_key_event_manager = 0x7f08016f;
public static final int tag_unhandled_key_listeners = 0x7f080170;
public static final int text = 0x7f080173;
public static final int text2 = 0x7f080175;
public static final int time = 0x7f080181;
public static final int title = 0x7f080183;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f09000a;
}
public static final class layout {
private layout() {}
public static final int custom_dialog = 0x7f0b0023;
public static final int notification_action = 0x7f0b0037;
public static final int notification_action_tombstone = 0x7f0b0038;
public static final int notification_template_custom_big = 0x7f0b003f;
public static final int notification_template_icon_group = 0x7f0b0040;
public static final int notification_template_part_chronometer = 0x7f0b0044;
public static final int notification_template_part_time = 0x7f0b0045;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0e007a;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0f00f5;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0f00f6;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f00f8;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0f00fb;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0f00fd;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0f0179;
public static final int Widget_Compat_NotificationActionText = 0x7f0f017a;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f03002b };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f0300c6, 0x7f0300c7, 0x7f0300c8, 0x7f0300c9, 0x7f0300ca, 0x7f0300cb };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f0300c4, 0x7f0300cc, 0x7f0300cd, 0x7f0300ce, 0x7f0301c5 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"wotjd4305@naver.com"
] | wotjd4305@naver.com |
44de04fb1cb6aef94a22daa4efb973b15163476b | 4bcc272d21d77d275f5393ec3920de934fde7959 | /TheAmazingAdventure/src/GameOver.java | 6c932a23af210543ed0c5fb6810e1bc7f53ff3fe | [
"MIT"
] | permissive | Aly91/TheGreatAdventure | c67a42f8f0f6da26405adda2c6d0ebdae0276abb | dafcbacd5ba44989ac5e4ce05e334e479a74b38d | refs/heads/master | 2021-01-13T00:50:23.127064 | 2016-04-20T15:25:17 | 2016-04-20T15:25:17 | 52,315,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,227 | java | import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.GameState;
import org.newdawn.slick.state.StateBasedGame;
import org.newdawn.slick.state.transition.FadeInTransition;
import org.newdawn.slick.state.transition.FadeOutTransition;
public class GameOver implements GameState {
public final int stateID = 2;
private StateBasedGame game;
@Override
public void setInput(Input arg0) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(int arg0, char arg1) {
// TODO Auto-generated method stub
}
@Override
public void keyReleased(int arg0, char arg1) {
// TODO Auto-generated method stub
}
@Override
public void controllerButtonPressed(int arg0, int arg1) {
// TODO Auto-generated method stub
}
@Override
public void controllerButtonReleased(int arg0, int arg1) {
// TODO Auto-generated method stub
}
@Override
public void controllerDownPressed(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void controllerDownReleased(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void controllerLeftPressed(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void controllerLeftReleased(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void controllerRightPressed(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void controllerRightReleased(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void controllerUpPressed(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void controllerUpReleased(int arg0) {
// TODO Auto-generated method stub
}
@Override
//method to ID of state
public int getID() {
return stateID;
}
public void init(GameContainer gameContainer, StateBasedGame game) throws SlickException {
this.game = game;
game.getState(Game.gameOver);
}
//public void leave(GameContainer arg0, StateBasedGame arg1) throws SlickException {
// TODO Auto-generated method stub
public void render(GameContainer gameContainer, StateBasedGame game, Graphics g) throws SlickException {
g.setBackground(Color.black);
g.drawString("Game Over",200,250);
g.drawString("Try again?", 250, 200);
g.drawString("Press Enter to continue or hit Backspace to return to the Main Menu",300,250);
}
@Override
public void update(GameContainer gameContainer, StateBasedGame game, int delta) throws SlickException {
if(gameContainer.getInput().isKeyPressed(Input.KEY_ENTER))
{
game.enterState(Game.gameScreen, new FadeOutTransition(Color.black), new FadeInTransition (Color.black));
}
else if(gameContainer.getInput().isKeyPressed(Input.KEY_BACK))
{
game.enterState(Game.mainMenu, new FadeOutTransition(Color.black), new FadeInTransition (Color.black));
}
}
@Override
public void mouseClicked(int arg0, int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
}
@Override
public void mouseDragged(int arg0, int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
}
@Override
public void mouseMoved(int arg0, int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(int arg0, int arg1, int arg2) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(int arg0, int arg1, int arg2) {
// TODO Auto-generated method stub
}
@Override
public void mouseWheelMoved(int arg0) {
// TODO Auto-generated method stub
}
@Override
public void enter(GameContainer arg0, StateBasedGame arg1) throws SlickException {
// TODO Auto-generated method stub
}
@Override
public void inputEnded() {
// TODO Auto-generated method stub
}
@Override
public void inputStarted() {
// TODO Auto-generated method stub
}
@Override
public boolean isAcceptingInput() {
// TODO Auto-generated method stub
return false;
}
@Override
public void leave(GameContainer arg0, StateBasedGame arg1) throws SlickException {
// TODO Auto-generated method stub
}
}
| [
"d13122916@student.dit.ie"
] | d13122916@student.dit.ie |
92116bf1b69b782a7c325ebee6e8c9377ab6153b | b0962f26015bef17f701664dd46c285ef8833f92 | /app/src/main/java/gafurov/developers_kipu/com/myapplication/Vocabulary_user.java | 1639315dd9a550ec23c5d38ae231967d49155712 | [] | no_license | lymanov/Hakaton_Nazim | 645e4e76f33969f79e75e55ae9d8443fdf12b27d | 9f47839d8b120212c518d664d02c1a8d23374c8c | refs/heads/master | 2020-04-07T09:35:05.234615 | 2018-11-14T20:04:53 | 2018-11-14T20:04:53 | 158,258,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,598 | java | package gafurov.developers_kipu.com.myapplication;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
public class Vocabulary_user extends AppCompatActivity {
ListView userList;
DatabaseHelper_2 databaseHelper;
SQLiteDatabase db;
Cursor userCursor;
SimpleCursorAdapter userAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vocabulary_user);
userList = (ListView)findViewById(R.id.list);
userList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(getApplicationContext(), UserActivity.class);
intent.putExtra("id", id);
startActivity(intent);
}
});
databaseHelper = new DatabaseHelper_2(getApplicationContext());
}
@Override
public void onResume() {
super.onResume();
// открываем подключение
db = databaseHelper.getReadableDatabase();
//получаем данные из бд в виде курсора
userCursor = db.rawQuery("select * from "+ DatabaseHelper_2.TABLE, null);
// определяем, какие столбцы из курсора будут выводиться в ListView
String[] headers = new String[] {DatabaseHelper_2.COLUMN_RUS_2, DatabaseHelper_2.COLUMN_ENG_2};
// создаем адаптер, передаем в него курсор
userAdapter = new SimpleCursorAdapter(this, android.R.layout.two_line_list_item,
userCursor, headers, new int[]{android.R.id.text1, android.R.id.text2}, 0);
userList.setAdapter(userAdapter);
}
// по нажатию на кнопку запускаем UserActivity для добавления данных
public void add(View view){
Intent intent = new Intent(this, UserActivity.class);
startActivity(intent);
}
@Override
public void onDestroy(){
super.onDestroy();
// Закрываем подключение и курсор
db.close();
userCursor.close();
}
}
| [
"abdurashitov1999@mail.ru"
] | abdurashitov1999@mail.ru |
735063523ff34e2b0067dc815c72b91e3cb5baa8 | 97b545171d6a5366860c42037080138abcceaff2 | /metaschema-model/src/main/java/gov/nist/secauto/metaschema/model/util/ModelWalker.java | ddddb9d04f9e3635ad29d241973da417014fcfe9 | [
"CC0-1.0",
"NIST-PD"
] | permissive | kaydoh/metaschema-java | 001760989a72a0f40dee0c6a4ec54b90cce0a284 | 6edfa47bb75bce42c636a3dc05e142dd435647c5 | refs/heads/main | 2023-04-24T18:51:11.372628 | 2021-05-04T03:48:22 | 2021-05-04T03:48:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,334 | java | /*
* Portions of this software was developed by employees of the National Institute
* of Standards and Technology (NIST), an agency of the Federal Government and is
* being made available as a public service. Pursuant to title 17 United States
* Code Section 105, works of NIST employees are not subject to copyright
* protection in the United States. This software may be subject to foreign
* copyright. Permission in the United States and in foreign countries, to the
* extent that NIST may hold copyright, to use, copy, modify, create derivative
* works, and distribute this software and its documentation without fee is hereby
* granted on a non-exclusive basis, provided that this notice and disclaimer
* of warranty appears in all copies.
*
* THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND, EITHER
* EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY
* THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND FREEDOM FROM
* INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL CONFORM TO THE
* SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR FREE. IN NO EVENT
* SHALL NIST BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT,
* INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM,
* OR IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,
* CONTRACT, TORT, OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY PERSONS OR
* PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED FROM, OR AROSE OUT
* OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER.
*/
package gov.nist.secauto.metaschema.model.util;
import gov.nist.secauto.metaschema.model.definitions.AssemblyDefinition;
import gov.nist.secauto.metaschema.model.definitions.FieldDefinition;
import gov.nist.secauto.metaschema.model.definitions.FlagDefinition;
import gov.nist.secauto.metaschema.model.instances.AssemblyInstance;
import gov.nist.secauto.metaschema.model.instances.ChoiceInstance;
import gov.nist.secauto.metaschema.model.instances.FieldInstance;
import gov.nist.secauto.metaschema.model.instances.FlagInstance;
import gov.nist.secauto.metaschema.model.instances.ModelInstance;
import java.util.Collection;
import java.util.List;
/**
* Walks a metaschema model. The "visit" methods can be implemented by child classes to perform
* processing on a visited node.
*/
public abstract class ModelWalker {
/**
* Will visit the provided metaschema field definition, and then walk the associated flag instances.
*
* @param field
* the metaschema field definition to walk
*/
public void walk(FieldDefinition field) {
if (visit(field)) {
walkFlagInstances(field.getFlagInstances().values());
}
}
/**
* Will visit the provided metaschema assembly definition, and then walk the associated flag and
* model instances.
*
* @param assembly
* the metaschema assembly definition to walk
*/
public void walk(AssemblyDefinition assembly) {
if (visit(assembly)) {
walkFlagInstances(assembly.getFlagInstances().values());
walkModelInstances(assembly.getModelInstances());
}
}
/**
* Will visit the provided metaschema flag instance, and then walk the associated flag definition.
*
* @param instance
* the metaschema flag instance to walk
*/
public void walk(FlagInstance<?> instance) {
if (visit(instance)) {
visit(instance.getDefinition());
}
}
/**
* Will visit the provided metaschema field instance, and then walk the associated field definition.
*
* @param instance
* the metaschema field instance to walk
*/
public void walk(FieldInstance<?> instance) {
if (visit(instance)) {
walk(instance.getDefinition());
}
}
/**
* Will visit the provided metaschema assembly instance, and then walk the associated assembly
* definition.
*
* @param instance
* the metaschema assembly instance to walk
*/
public void walk(AssemblyInstance<?> instance) {
if (visit(instance)) {
walk(instance.getDefinition());
}
}
/**
* Will visit the provided metaschema choice instance, and then walk the choice's child model
* instances.
*
* @param instance
* the metaschema choice instance to walk
*/
public void walk(ChoiceInstance instance) {
if (visit(instance)) {
walkModelInstances(instance.getModelInstances());
}
}
/**
* Will walk each of the provided flag instances.
*
* @param instances
* a collection of flag instances to visit
*/
protected void walkFlagInstances(Collection<? extends FlagInstance<?>> instances) {
for (FlagInstance<?> instance : instances) {
walk(instance);
}
}
/**
* Will walk each of the provided model instances.
*
* @param instances
* a collection of model instances to visit
*/
protected void walkModelInstances(List<ModelInstance> instances) {
for (ModelInstance instance : instances) {
walkModelInstance(instance);
}
}
/**
* Will walk the provided model instance.
*
* @param instance
* the instance to walk
*/
protected void walkModelInstance(ModelInstance instance) {
if (instance instanceof AssemblyInstance) {
walk((AssemblyInstance<?>) instance);
} else if (instance instanceof FieldInstance) {
walk((FieldInstance<?>) instance);
} else if (instance instanceof ChoiceInstance) {
walk((ChoiceInstance) instance);
}
}
/**
* Called when the provided definition is walked. This can be overridden by child classes to enable
* processing of the visited definition.
*
* @param def
* the definition that is visited
*/
protected void visit(FlagDefinition def) {
}
/**
* Called when the provided definition is walked. This can be overridden by child classes to enable
* processing of the visited definition.
*
* @param def
* the definition that is visited
* @return {@code true} if child instances are to be walked, or {@code false} otherwise
*/
protected boolean visit(FieldDefinition def) {
return true;
}
/**
* Called when the provided definition is walked. This can be overridden by child classes to enable
* processing of the visited definition.
*
* @param def
* the definition that is visited
* @return {@code true} if child instances are to be walked, or {@code false} otherwise
*/
protected boolean visit(AssemblyDefinition def) {
return true;
}
/**
* Called when the provided instance is walked. This can be overridden by child classes to enable
* processing of the visited instance.
*
* @param instance
* the instance that is visited
* @return {@code true} if the associated definition is to be walked, or {@code false} otherwise
*/
protected boolean visit(FlagInstance<?> instance) {
return true;
}
/**
* Called when the provided instance is walked. This can be overridden by child classes to enable
* processing of the visited instance.
*
* @param instance
* the instance that is visited
* @return {@code true} if the associated definition is to be walked, or {@code false} otherwise
*/
protected boolean visit(FieldInstance<?> instance) {
return true;
}
/**
* Called when the provided instance is walked. This can be overridden by child classes to enable
* processing of the visited instance.
*
* @param instance
* the instance that is visited
* @return {@code true} if the associated definition is to be walked, or {@code false} otherwise
*/
protected boolean visit(AssemblyInstance<?> instance) {
return true;
}
/**
* Called when the provided instance is walked. This can be overridden by child classes to enable
* processing of the visited instance.
*
* @param instance
* the instance that is visited
* @return {@code true} if the child instances are to be walked, or {@code false} otherwise
*/
protected boolean visit(ChoiceInstance instance) {
return true;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
89e74afc177ad3a97c6fc83ceff2be12ccacdad3 | 66e2f35b7b56865552616cf400e3a8f5928d12a2 | /src/main/java/com/alipay/api/domain/AddTagRequest.java | f9a6ac675bf8c94ceb90669cf2628b0a31cfaa56 | [
"Apache-2.0"
] | permissive | xiafaqi/alipay-sdk-java-all | 18dc797400847c7ae9901566e910527f5495e497 | 606cdb8014faa3e9125de7f50cbb81b2db6ee6cc | refs/heads/master | 2022-11-25T08:43:11.997961 | 2020-07-23T02:58:22 | 2020-07-23T02:58:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,045 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 打标请求
*
* @author auto create
* @since 1.0, 2020-06-15 10:51:44
*/
public class AddTagRequest extends AlipayObject {
private static final long serialVersionUID = 4385468533842459495L;
/**
* biz_id,唯一,业务id,用于业务请求的幂等标志
*/
@ApiField("biz_id")
private String bizId;
/**
* 饿了么schainId
*/
@ApiField("schain_id")
private String schainId;
/**
* 支付宝交易号
*/
@ApiField("trade_no")
private String tradeNo;
public String getBizId() {
return this.bizId;
}
public void setBizId(String bizId) {
this.bizId = bizId;
}
public String getSchainId() {
return this.schainId;
}
public void setSchainId(String schainId) {
this.schainId = schainId;
}
public String getTradeNo() {
return this.tradeNo;
}
public void setTradeNo(String tradeNo) {
this.tradeNo = tradeNo;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
e0fb40f2a5ae0a79414c6145e2d2c023589826fb | 09963cbfe143a39dd27493823b512dd531ea919b | /faceDetected/build/generated/source/r/debug/com/crazylin/facedetected/R.java | 9bf2ab4f004bf02b7a873314c5a253279e025dd7 | [] | no_license | with1993/faceDetect | e34eec589fe0c8063a4f95bb43772056f858c557 | 5936413c21a01a2df8998d9c90df87a2f9ec914a | refs/heads/master | 2021-01-12T17:26:00.566331 | 2016-10-21T13:39:04 | 2016-10-21T13:39:04 | 71,567,924 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,265 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.crazylin.facedetected;
public final class R {
public static final class attr {
}
public static final class dimen {
public static final int activity_horizontal_margin=0x7f050000;
public static final int activity_vertical_margin=0x7f050001;
}
public static final class drawable {
public static final int brother=0x7f020000;
public static final int brother2=0x7f020001;
public static final int facepp_icon=0x7f020002;
public static final int ic_action_search=0x7f020003;
public static final int ic_launcher=0x7f020004;
}
public static final class id {
public static final int action_settings=0x7f080007;
public static final int capture_image=0x7f080006;
public static final int detect_image=0x7f080001;
public static final int get_image=0x7f080000;
public static final int info_text=0x7f080005;
public static final int loading=0x7f080004;
public static final int num_detected=0x7f080002;
public static final int photo_image=0x7f080003;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int main=0x7f070000;
}
public static final class string {
public static final int action_settings=0x7f060000;
public static final int app_name=0x7f060001;
public static final int hello_world=0x7f060002;
}
public static final class style {
/** API 11 theme customizations can go here.
API 14 theme customizations can go here.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
*/
public static final int AppBaseTheme=0x7f040000;
/** All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f040001;
}
}
| [
"1490249589@qq.com"
] | 1490249589@qq.com |
51f379345534f10c343cea3fbd23c646d694dbb7 | c7406bbc67d980c7896b386fc439f7ad5d94bb38 | /src/main/java/cl/app/model/entity/Role.java | 04750505cbc64ec06fc3a03d328ea528905cc9c3 | [] | no_license | agonzalezlevio/SpringBoot-OAuth2 | a517028dd1a9b12b0299fbce00c8547261426f22 | 6e3269c4a7bf7c2f538291f643245c99693aaa70 | refs/heads/main | 2023-07-04T02:48:12.453420 | 2021-08-05T05:34:08 | 2021-08-05T05:34:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 727 | java | package cl.app.model.entity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="roles")
public class Role implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique=true)
private String name;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"agonzalezlevio.dev@gmail.com"
] | agonzalezlevio.dev@gmail.com |
f753b60fedb450c3e7289ace542b378a00bdf2f2 | 7626d7fdbe3d096c4d0b342c746b539db5fca51d | /enterprise-calculator.web/src/main/java/com/sap/internship/web/calculator/controller/CalculatorController.java | fcdbcc4e26b4cda8534e4d1f9f1a747d54c3414c | [] | no_license | RosinaGeorgieva/Enterprise-calculator | 69f872f415ca4fcaa6912b78cfef71567c93f2e8 | 480f8789347b7cb10582107fe880cfd5e6ddc83d | refs/heads/master | 2022-09-22T11:31:51.176752 | 2019-11-28T12:05:43 | 2019-11-28T12:05:43 | 224,638,309 | 1 | 0 | null | 2022-09-08T01:04:53 | 2019-11-28T11:27:41 | Java | UTF-8 | Java | false | false | 2,897 | java | package com.sap.internship.web.calculator.controller;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.sap.internship.core.PostfixCalculator;
import com.sap.internship.exception.CalculationException;
import com.sap.internship.exception.ContentException;
import com.sap.internship.web.calculator.adapter.CalculatorAdapter;
import com.sap.internship.web.calculator.dto.CalculationDTO;
import com.sap.internship.web.database.Calculation;
import com.sap.internship.web.database.CalculationsDAO;
import com.sap.internship.web.exception.RESTInvalidInputException;
import com.sap.internship.web.security.WebSecurityUtil;;
@RestController
public class CalculatorController implements CalculatorAdapter {
private CalculationsDAO calculationsRepository;
private PostfixCalculator calculator;
@Autowired
private CalculatorController(PostfixCalculator calculator, CalculationsDAO calculationsRepository) {
this.calculator = calculator;
this.calculationsRepository = calculationsRepository;
}
@GetMapping("/calculator/api/v1/evaluate")
@Override
public ResponseEntity<CalculationDTO> evaluate(@RequestParam String expression)
throws RESTInvalidInputException {
Double result = null;
HttpStatus status = HttpStatus.BAD_REQUEST;
try {
result = calculator.evaluate(expression);
status = HttpStatus.OK;
return new ResponseEntity<CalculationDTO>(new CalculationDTO(expression, result, timestamp()),
HttpStatus.OK);
} catch (ContentException contentException) {
throw new RESTInvalidInputException("Expression content is invalid.");
} catch (CalculationException calculationException) {
throw new RESTInvalidInputException("Attempt for invalid calculation.");
} finally {
calculationsRepository.insert(
new Calculation(WebSecurityUtil.currentUser(), status.value(), expression, result, timestamp()));
}
}
@GetMapping("/calculator/api/v1/history")
public List<CalculationDTO> getHistory() {
return convert(calculationsRepository.getHistory(WebSecurityUtil.currentUser()));
}
private List<CalculationDTO> convert(List<Calculation> calculationsTable) {
List<CalculationDTO> calculationResponses = new ArrayList<CalculationDTO>();
for (Calculation calculation : calculationsTable) {
calculationResponses.add(new CalculationDTO(calculation.getExpression(), calculation.getResult(),
calculation.getTimestamp()));
}
return calculationResponses;
}
private Timestamp timestamp() {
return new Timestamp(new Date().getTime());
}
}
| [
"rosina.georgieva@sap.com"
] | rosina.georgieva@sap.com |
860d0d38ca316c4694a3d441e1ca32231b746ed1 | 8de0190ba91403621d09cdb0855612d00d8179b2 | /leetcode-algorithm-java/src/test/java/johnny/leetcode/algorithm/Solution029Test.java | 0873649bfaf55a39e1810059a02a48f484c4a4d6 | [] | no_license | 156420591/algorithm-problems-java | e2494831becba9d48ab0af98b99fca138aaa1ca8 | 1aec8a6e128763b1c1378a957d270f2a7952b81a | refs/heads/master | 2023-03-04T12:36:06.143086 | 2021-02-05T05:38:15 | 2021-02-05T05:38:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,123 | java | package johnny.leetcode.algorithm;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class Solution029Test extends JunitBase {
@Test
public void testDivide() {
System.out.println("divide");
Solution029 instance = new Solution029();
assertEquals(0, instance.divide(0, 1));
assertEquals(Integer.MAX_VALUE, instance.divide(13, 0));
assertEquals(6, instance.divide(13, 2));
assertEquals(0, instance.divide(1, 2));
assertEquals(1, instance.divide(4, 4));
assertEquals(1, instance.divide(7, 4));
assertEquals(4, instance.divide(4, 1));
assertEquals(15, instance.divide(63, 4));
assertEquals(-15, instance.divide(63, -4));
assertEquals(12, instance.divide(63, 5));
assertEquals(Integer.MAX_VALUE, instance.divide(Integer.MAX_VALUE, 1));
assertEquals(-Integer.MAX_VALUE, instance.divide(Integer.MAX_VALUE, -1));
assertEquals(Integer.MIN_VALUE, instance.divide(Integer.MIN_VALUE, 1));
assertEquals(Integer.MAX_VALUE, instance.divide(Integer.MIN_VALUE, -1));
}
}
| [
"jojozhuang@gmail.com"
] | jojozhuang@gmail.com |
b880de66c8f099988e3be4962237998ea71fec1f | 8c67650ef255cda4fad8cb8316a819136bb33b03 | /onResort/src/onResort/service/NoticeService.java | 31cef47b381e2010c4706733304ef1a55ce993bf | [] | no_license | supportleee/onResort | b40aa27a1138a2143edc78ef007a69c2cf3f4341 | b3580d1aeb251f0ede5e7b03042f5e6a43ee2819 | refs/heads/master | 2020-06-23T21:21:40.513638 | 2019-08-09T12:59:30 | 2019-08-09T12:59:30 | 198,755,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | package onResort.service;
import java.util.List;
import onResort.dto.NoticeDto;
public interface NoticeService {
// Create
int insert(NoticeDto noticedto);
// Read
NoticeDto selectOne(int id);
List<NoticeDto> selectAll();
int selectOneLastest();
// Update
int update(int key, NoticeDto noticedto);
int update(NoticeDto noticedto);
int updateViewcnt(int key);
// Delete
int delete(int id);
int delete(NoticeDto noticedto);
}
| [
"ljw7313@naver.com"
] | ljw7313@naver.com |
854f20342e8523e451b8e4c0117331093b8911cc | f3b93fd43509b3c37c56df5e90fcf90d1ed79f74 | /cloudalibaba-config-nacos-client3377/src/main/java/cn/jason/huang/springcloud/alibaba/NacosConfigClientMain3377.java | 085ce18d709e8baa4157b4322bd57f98193b9525 | [] | no_license | jasonhuang9529/SpringCloud2020 | 63d467cb541ed5b0b17bcc2973e101fde3cb3d9b | 823a331a379f3ce0567ca6ea188d51fcc53e4b97 | refs/heads/master | 2022-12-17T09:02:21.212390 | 2020-08-27T05:11:45 | 2020-08-27T05:11:45 | 290,680,372 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 520 | java | package cn.jason.huang.springcloud.alibaba;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* DESC:
*
* @author: huangxinquan
* DATE: 2020/8/17 14:23
**/
@SpringBootApplication
@EnableDiscoveryClient
public class NacosConfigClientMain3377 {
public static void main(String[] args) {
SpringApplication.run(NacosConfigClientMain3377.class, args);
}
}
| [
"tk9529@163.com"
] | tk9529@163.com |
83c600772f1d4bbeffff2ef9bd00829db32ceb5c | 6c82e62b70f8bbaaa0b8b0ae5474fcecbd6afc17 | /app/src/main/java/com/mahesaiqbal/greendaocrud/home/PengeluaranAdapter.java | 638b8b42a54b6b1058cfe52e758ec04adb8a7030 | [] | no_license | mahesaiqbal/GreenDaoCRUD | 0f2f5cd7f9d1be5adf4b6dafd09b206bfc7f975b | 5df43340382a134518afb5688d1d2ba06f4cec4b | refs/heads/master | 2020-04-24T02:04:46.407835 | 2019-02-20T07:36:42 | 2019-02-20T07:36:42 | 171,623,953 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,993 | java | package com.mahesaiqbal.greendaocrud.home;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.mahesaiqbal.greendaocrud.R;
import com.mahesaiqbal.greendaocrud.utils.database.TblPengeluaran;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
public class PengeluaranAdapter extends
RecyclerView.Adapter<PengeluaranAdapter.ViewHolder> {
private static final String TAG = PengeluaranAdapter.class.getSimpleName();
private List<TblPengeluaran> list;
private PengeluaranAdapterCallback mAdapterCallback;
public PengeluaranAdapter(List<TblPengeluaran> list, PengeluaranAdapterCallback adapterCallback) {
this.list = list;
this.mAdapterCallback = adapterCallback;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_pengeluaran,
parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
TblPengeluaran item = list.get(position);
String pengeluaran = item.getPengeluaran();
int nominal = item.getNominal();
holder.tvPengeluaran.setText(pengeluaran);
Locale localeID = new Locale("in", "ID");
NumberFormat formatRupiah = NumberFormat.getCurrencyInstance(localeID);
holder.tvNominal.setText(formatRupiah.format(nominal));
}
@Override
public int getItemCount() {
return list.size();
}
public void clear() {
int size = this.list.size();
this.list.clear();
notifyItemRangeRemoved(0, size);
}
public class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.tvPengeluaran)
TextView tvPengeluaran;
@BindView(R.id.tvNominal)
TextView tvNominal;
@BindView(R.id.ivDelete)
ImageView ivDelete;
public ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
ivDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mAdapterCallback.onDelete(getAdapterPosition());
}
});
itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
mAdapterCallback.onLongClick(getAdapterPosition());
return true;
}
});
}
}
public interface PengeluaranAdapterCallback {
void onLongClick(int position);
void onDelete(int position);
}
}
| [
"mahesa@popbox.asia"
] | mahesa@popbox.asia |
116ec52f57e10ea842695c39143904157718081c | 1e7fe09c314338276bc9e96b6d5ca92d2dc9787b | /src/homework/third/Main.java | 9ea12db5667dba2e5441601be4a8799a84c2419e | [] | no_license | WokoDoko/Java2_hw3 | 126c25412149abdb197e2baf929bfdee03e0ad43 | 73f69a0a1f62756294e59e90fbb74691ac188ea5 | refs/heads/main | 2023-03-10T20:11:48.855964 | 2021-02-28T13:30:25 | 2021-02-28T13:30:25 | 336,300,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,585 | java | package homework.third;
import java.util.*;
public class Main {
static int countOfA;
static int countOfB;
static int countOfC;
static int countOfD;
public static void main(String[] args) {
//ArrayList<String> taskNote = new ArrayList<>(Arrays.asList("A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "A", "A", "A", "A", "B", "B", "B"));
String [] taskNote = new String[] {"A", "A", "C", "A", "D", "B", "B", "B", "C", "B", "A", "D", "A", "C", "B", "B", "D"};
for (String s : taskNote) {
if (s == "A")
countOfA++;
else if (s == "B")
countOfB++;
else if (s == "C")
countOfC++;
else if (s == "D")
countOfD++;
else
System.out.println("Undefined element.");
}
System.out.println(countOfA);
System.out.println(countOfB);
System.out.println(countOfC);
System.out.println(countOfD);
System.out.println(Arrays.deepToString(taskNote));
Set<String> mySet = new HashSet<>(Arrays.asList(taskNote));
System.out.println(mySet);
Phonebook phBook = new Phonebook();
phBook.addAndPrint("Иванов", "9876543");
phBook.addAndPrint("Дмитриев", "98765467865");
phBook.addAndPrint("Семенов", "234512");
phBook.addAndPrint("asd", "2543546");
phBook.addAndPrint("asc", "67546352464");
}
}
| [
"noreply@github.com"
] | noreply@github.com |
adca0e85e54c25b958a983e69578771cd08b1a73 | edfafb9f9dce3dc00e5f0df054b4b112e00180f1 | /src/main/java/Framework/TestNG/Pratice1.java | acf7c8509f34cc53ba4c0fcb32bd4db9c2b396a3 | [] | no_license | ahmadlayeq/TestNGFrameword | 481bc0c410174cd4144af4a21bf0b0e055e307cb | 7b5cbfcd5eadca84404be37538e77d81c5fe765d | refs/heads/master | 2022-07-17T07:29:29.542860 | 2019-06-09T15:49:05 | 2019-06-09T15:49:05 | 191,023,570 | 0 | 0 | null | 2020-10-13T13:46:36 | 2019-06-09T15:31:31 | HTML | UTF-8 | Java | false | false | 3,736 | java | package Framework.TestNG;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class Pratice1 {
// go to the app shoping cart check to see if the continue buttonn is displayed
// I want to login in the app in 3 different test cas
// 1. 1 with coorect user and pass
// 2 with incorrect user and corrcct password
// 3. with correct user and incorrect pass
// 4. with incorect user and pass
WebDriver driver;
@BeforeMethod
public void setEnviroment() {
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().deleteAllCookies();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(120, TimeUnit.SECONDS);
}
@Test
public void clickOnShopingCart() {
driver.get("https://www.tekschoolofamerica.com/test-environment/");
driver.findElement(By.xpath("//span[text() = 'Shopping Cart']")).click();
boolean btn = driver.findElement(By.xpath("//a[text() = 'Continue']")).isDisplayed();
Assert.assertTrue(btn);
}
@Test
public void testLogIn1() {
driver.get("https://www.tekschoolofamerica.com/test-environment/");
driver.findElement(By.xpath("//span[text() ='My Account']")).click();
driver.findElement(By.xpath("//a[text() ='Login']")).click();
driver.findElement(By.xpath("//input[@id='input-email']")).sendKeys("test001@test.com");
driver.findElement(By.xpath("//input[@id='input-password']")).sendKeys("test001");
driver.findElement(By.xpath("//input[@value='Login']")).click();
String title = driver.getTitle();
Assert.assertEquals(title, "My Account");
}
@Test
public void testLogIn2() {
driver.get("https://www.tekschoolofamerica.com/test-environment/");
driver.findElement(By.xpath("//span[text() ='My Account']")).click();
driver.findElement(By.xpath("//a[text() ='Login']")).click();
driver.findElement(By.xpath("//input[@id='input-email']")).sendKeys("test1001@test.com");
driver.findElement(By.xpath("//input[@id='input-password']")).sendKeys("test001");
driver.findElement(By.xpath("//input[@value='Login']")).click();
String title = driver.getTitle();
Assert.assertNotEquals(title, "My Account");
}
@Test
public void testLogIn3() {
driver.get("https://www.tekschoolofamerica.com/test-environment/");
driver.findElement(By.xpath("//span[text() ='My Account']")).click();
driver.findElement(By.xpath("//a[text() ='Login']")).click();
driver.findElement(By.xpath("//input[@id='input-email']")).sendKeys("test001@test.com");
driver.findElement(By.xpath("//input[@id='input-password']")).sendKeys("test1001");
driver.findElement(By.xpath("//input[@value='Login']")).click();
String title = driver.getTitle();
Assert.assertNotEquals(title, "My Account");
}
@Test
public void testLogIn4() {
driver.get("https://www.tekschoolofamerica.com/test-environment/");
driver.findElement(By.xpath("//span[text() ='My Account']")).click();
driver.findElement(By.xpath("//a[text() ='Login']")).click();
driver.findElement(By.xpath("//input[@id='input-email']")).sendKeys("test001@test.com");
driver.findElement(By.xpath("//input[@id='input-password']")).sendKeys("test1001");
driver.findElement(By.xpath("//input[@value='Login']")).click();
String title = driver.getTitle();
Assert.assertNotEquals(title, "My Account");
}
@AfterMethod
public void closeTheEnviroment() {
driver.close();
driver.quit();
}
} | [
"layeq22@yahoo.com"
] | layeq22@yahoo.com |
e9cc55c1c0f9bfd77d9c146c07ea1b3829370af0 | bdc7287a60ab10765c400af12ad478e70440fe31 | /src/chap14/lecture/lambda/LambdaEx1.java | c9e23441c494b00a0e273e712c43a699d894154b | [] | no_license | youjeong-chae/java20200929 | 3abcf9a1e559463cc0de3e8b1a580e445e4d4468 | 0dbfffaa7c1f861723de1b267a89dc159dd47f7d | refs/heads/master | 2023-01-04T17:18:57.330586 | 2020-10-30T09:02:48 | 2020-10-30T09:02:48 | 299,485,565 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package chap14.lecture.lambda;
public class LambdaEx1 {
public static void main(String[] args) {
// 추상메소드가 하나인 인터페이스의 객체를 만들 때
MyInterface o1 = new MyInterface() {
@Override
public void method() {
System.out.println("추상메소드 재정의");
}
};
MyInterface o2 = () -> System.out.println("추상메소드 재정의2");
// 왼쪽은 파라미터, 오른쪽은
o1.method();
o2.method();
}
}
| [
"yjchae16@naver.com"
] | yjchae16@naver.com |
75aa6f41686c749f37ec5106031786a7746d96b8 | c8bde15069de9c464c1bcf56fc30b2ad30760d06 | /src/ex3_2.java | 7969bba3356020e6818d949e6dcfcfefadc17999 | [] | no_license | ssprdjjoyy/lab3 | 2d8ccfacf8bdafd5b2849251c332341123039976 | 2cb79fa14914ef7f03a1e66098e0f1429d5de456 | refs/heads/master | 2023-05-31T02:16:54.249497 | 2021-06-04T16:35:36 | 2021-06-04T16:35:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package com.company;
classNode {
public int value;
publicNode next;
Node(int value, Node next) {
this.value = value;
this.next = next;
}}
public class Main{
public static void main(String[] args) {
Node head=new Node(0, null);
Node tail=head;
for (int i = 0; i <9; i++) {
tail.next=new Node(i+1, null);
tail=tail.next;
}
Node ref = head;
while (ref != null) {
System.out.print(" " + ref.value);
ref = ref.next;
}
}}
| [
"nariyasprdnva@mail.ru"
] | nariyasprdnva@mail.ru |
5727ff8ce1772f4df1f5e6348a21f753fa8b8f0a | 143da47ffe664823633c5bcec8f122a8de7adb7c | /java/src/com/waitwha/util/ArrayUtils.java | d5cedfbc37b5137cfbeeff8795f0bdc334137be5 | [] | no_license | acochenour/NessusTools | 9deb60494744efa34e5b4134152fd7edf4c0808e | 3c61bae53b8dabde328ccd5b130ef5c230ce0f20 | refs/heads/master | 2020-03-28T14:58:25.661308 | 2014-03-22T04:40:10 | 2014-03-22T04:40:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,661 | java | package com.waitwha.util;
import java.util.Arrays;
/**
* <b>NessusTools</b>: ArrayUtils<br/>
* <small>Copyright (c)2013 Mike Duncan <<a href="mailto:mike.duncan@waitwha.com">mike.duncan@waitwha.com</a>></small><p />
*
* <pre>
* 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.
* </pre>
*
* TODO Document this class/interface.
*
* @author Mike Duncan <mike.duncan@waitwha.com>
* @version $Id$
* @package com.waitwha.util
*/
public class ArrayUtils {
/**
* Concats the given arrays into a single array.
*
* @param arr0 First array.
* @param more Additional arrays to merge/concat onto the first given.
* @return Merged array
*/
public static final <T> T[] concat(T[] arr0, @SuppressWarnings("unchecked") T[]...more) {
int size = arr0.length;
for(T[] a : more)
size += a.length;
T[] r = Arrays.copyOf(arr0, size);
int o = arr0.length;
for(T[] a : more) {
System.arraycopy(a, 0, r, o, a.length);
o += a.length;
}
return r;
}
}
| [
"morbos.vermin@gmail.com"
] | morbos.vermin@gmail.com |
fee279e83439fbb4defcfd646aeb0fa4160ee7fc | bff07407ff3fd9cb397f313b72f6f4935e955311 | /Problem_047.java | 3f8210fd604a2288d6d0c31f54a4a6b099b8db04 | [] | no_license | jwyce/Project-Euler-Problems | e1a08174eff0facfd89828bdfae3607924846efd | 9725b3b5e6e29e7fa7bc6ec007586b3c59d167d4 | refs/heads/master | 2021-09-14T21:07:04.368995 | 2018-05-19T19:23:46 | 2018-05-19T19:23:46 | 96,117,379 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | package euler;
import java.util.ArrayList;
import java.util.HashSet;
public class Problem_047 {
static long firstNNumsWithNDistinctPrimeFactors() {
return firstNNumsWithNDistinctPrimeFactors(4).get(0);
}
private static ArrayList<Long> firstNNumsWithNDistinctPrimeFactors(int n) {
ArrayList<Long> nums = new ArrayList<Long>();
ArrayList<Long> memo = new ArrayList<Long>();
memo.add(2L);
long c = 3;
while (nums.size() < n) {
if (isPrime(c)) {
memo.add(c);
nums.clear();
} else {
if (getNumberOfDistinctPrimeFactors(c, memo) == n)
nums.add(c);
else
nums.clear();
}
c++;
}
for (Long num : nums) {
System.out.print(num + " ");
}
System.out.println();
return nums;
}
private static int getNumberOfDistinctPrimeFactors(long n, ArrayList<Long> primes) {
HashSet<Long> primeFactors = new HashSet<>();
while (n > 1) {
for (Long prime : primes) {
if ((double) n / prime == n / prime) {
n /= prime;
primeFactors.add(prime);
break;
}
}
}
return primeFactors.size();
}
private static boolean isPrime(long num) {
if (num < 2) return false;
if (num == 2) return true;
if (num % 2 == 0) return false;
for (long i = 3; i * i <= num; i += 2)
if (num % i == 0) return false;
return true;
}
}
| [
"wycejared@gmail.com"
] | wycejared@gmail.com |
c2cabcf65fb1992fab8704ae9dcd11991960bf0f | 96d5769bf9c99c57a17cea168744376c98840ebe | /src/starpatterns/Example3.java | 5343abb5e9e9d67da15f431518b8ffd861f90e0e | [] | no_license | priyavaishla/StarPattern | a84613140a3d7fa3f5ebe71146e491ca9127fb50 | 097004d05edc5bbd941c99bf991a05d5e125856a | refs/heads/master | 2021-01-19T16:40:52.829647 | 2017-08-22T03:25:42 | 2017-08-22T03:25:42 | 101,016,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package starpatterns;
public class Example3 {
public static void main(String[] args) {
for(int i=1;i<=5;i++){
for(int j=5;j>=i;j--){
System.out.print("*");
}
System.out.println("\n");
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
b0aaa25a5ab16ba9e2ec06196a7c411f53f7ec95 | ae95daca547faa619560165f6a35a7f392f93306 | /Generator.java | de0acfb5302a40e4e1e885b04b8dac69b7e8ee8a | [] | no_license | k-rush/Airline_project_final | 7c4a3ca782c734cddfe9f4dc033a86af74a6339c | 2805145f09631b5c8f44cab91ebd9a1a84e1b794 | refs/heads/master | 2021-05-28T18:45:14.087099 | 2015-06-21T02:11:37 | 2015-06-21T02:11:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 54,074 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rushairdatagen;
import java.io.*;
import java.math.BigDecimal;
import java.math.MathContext;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
/**
*
* @author kdr213
*/
public class Generator {
private Connection con;
public Generator() {
}
public void connect() {
TimeZone timeZone = TimeZone.getTimeZone("Asia/Kolkata");
TimeZone.setDefault(timeZone);
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@edgar2.cse.lehigh.edu:1521:cse241","kdr213","P890041607");
} catch(Exception e) { e.printStackTrace();}
}
public void disConnect() {
try {
con.close();
} catch(Exception e) { e.printStackTrace();}
}
public void genPilots() {
String fUpdate = "INSERT INTO CUSTOMER (NAME,FF_MILES,ACCT_NUM) VALUES ";
String lUpdate = "INSERT INTO LEG (ARR_TIME,DEP_TIME,ROUTE_ID,FLIGHT_ID,CAPTAIN_ID,COPILOT_ID,AIRPLANE_ID) VALUES";
try{
int count = 0;
String line;
String cupdate = "";
String aupdate = "";
String name = "";
String uname = "";
String pword = "";
FileInputStream nstream = new FileInputStream(new File("DATA/cnames.txt"));
FileInputStream ustream = new FileInputStream(new File("DATA/cusers.txt"));
FileInputStream pstream = new FileInputStream(new File("DATA/pwords.txt"));
BufferedReader brn = new BufferedReader(new InputStreamReader(new DataInputStream(nstream)));
BufferedReader bru = new BufferedReader(new InputStreamReader(new DataInputStream(ustream)));
BufferedReader brp = new BufferedReader(new InputStreamReader(new DataInputStream(pstream)));
Statement s = con.createStatement();
ResultSet r = null;
int age = 0, p, salary = 0, hrs;
long msecs = 0;/*
for(int i = 0; i < 200; i++) {
name = brn.readLine();
uname = bru.readLine();
pword = brp. readLine();
salary = 40000 + (int)(Math.random()* 30000);
age = 25 + (int)(Math.random()* 50);
hrs = 2000 + (int)(Math.random()* 5000);
aupdate = "INSERT INTO E_ACCT (username,password) values ('" + uname + "','" + pword + "')";
System.out.println(aupdate);
p = s.executeUpdate(aupdate);
System.out.println(p);
r = s.executeQuery("SELECT ACCT_ID FROM E_ACCT WHERE USERNAME = '" + uname+"'");
r.next();
cupdate = "INSERT INTO PILOT (NAME,SALARY, AGE,FLIGHT_HOURS,ACCT_ID) values ('" + name + "'," +salary+ ","+ age + "," + hrs + "," + r.getInt("ACCT_ID") + ")";
System.out.println(cupdate);
p = s.executeUpdate(cupdate);
System.out.println(p);
count++;
}*/
for(int i = 0; i < 200; i++) {
name = brn.readLine();
uname = bru.readLine();
pword = brp. readLine();
salary = 40000 + (int)(Math.random()* 30000);
age = 25 + (int)(Math.random()* 50);
aupdate = "INSERT INTO E_ACCT (username,password) values ('" + uname + "','" + pword + "')";
System.out.println(aupdate);
p = s.executeUpdate(aupdate);
System.out.println(p);
r = s.executeQuery("SELECT ACCT_ID FROM E_ACCT WHERE USERNAME = '" + uname+"'");
r.next();
cupdate = "INSERT INTO MANAGER (NAME,SALARY,ACCT_ID) values ('" + name + "'," +salary+ ","+ r.getInt("ACCT_ID") + ")";
System.out.println(cupdate);
p = s.executeUpdate(cupdate);
System.out.println(p);
count++;
}
s.close();
brn.close();
bru.close();
brp.close();
nstream.close();
ustream.close();
pstream.close();
} catch(Exception e) { e.printStackTrace(); }
}
public void genAirplanes() {
try{
int count = 0;
String line;
String cupdate = "";
String aupdate = "";
String name = "";
String uname = "";
String pword = "";
Statement s = con.createStatement();
ResultSet r = null;
int age = 0, p, loc = 0, hrs, model;
long msecs = 0;
for(int i = 0; i < 800; i++) {
model = 1 + (int)(Math.random()* 8);
//age = 25 + (int)(Math.random()* 10);
hrs = 5000 + (int)(Math.random()* 5000);
aupdate = "INSERT INTO AIRPLANE (MODEL_ID,FLIGHT_HRS) values ('" +model+"','"+ hrs + "')";
System.out.println(aupdate);
p = s.executeUpdate(aupdate);
System.out.println(p);
}
s.close();
} catch(Exception e) { e.printStackTrace(); }
}
public void genCusts() {
String fUpdate = "INSERT INTO CUSTOMER (NAME,FF_MILES,ACCT_NUM) VALUES ";
String lUpdate = "INSERT INTO LEG (ARR_TIME,DEP_TIME,ROUTE_ID,FLIGHT_ID,CAPTAIN_ID,COPILOT_ID,AIRPLANE_ID) VALUES";
try{
int count = 0;
String line;
String cupdate = "";
String aupdate = "";
String name = "";
String uname = "";
String pword = "";
FileInputStream nstream = new FileInputStream(new File("DATA/enames.txt"));
FileInputStream ustream = new FileInputStream(new File("DATA/eusers.txt"));
FileInputStream pstream = new FileInputStream(new File("DATA/pwords.txt"));
BufferedReader brn = new BufferedReader(new InputStreamReader(new DataInputStream(nstream)));
BufferedReader bru = new BufferedReader(new InputStreamReader(new DataInputStream(ustream)));
BufferedReader brp = new BufferedReader(new InputStreamReader(new DataInputStream(pstream)));
Statement s = con.createStatement();
ResultSet r = null;
int miles = 0, p;
for(int i = 0; i < 400; i++) {
name = brn.readLine();
uname = bru.readLine();
pword = brp. readLine();
miles = (int)(Math.random()* 2000);
aupdate = "INSERT INTO C_ACCT (username,password) values ('" + uname + "','" + pword + "')";
System.out.println(aupdate);
p = s.executeUpdate(aupdate);
System.out.println(p);
r = s.executeQuery("SELECT ACCT_ID FROM C_ACCT WHERE USERNAME = '" + uname+"'");
r.next();
cupdate = "INSERT INTO CUSTOMER (NAME,FF_MILES, ACCT_ID) values ('" + name + "'," +miles+ "," + r.getInt("ACCT_ID") + ")";
System.out.println(cupdate);
p = s.executeUpdate(cupdate);
System.out.println(p);
count++;
}
s.close();
brn.close();
bru.close();
brp.close();
nstream.close();
ustream.close();
pstream.close();
} catch(Exception e) { e.printStackTrace(); }
}
public void genBookings() {
for(int i = 0; i < 50000; i++) {
try {
Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet r = null;
String countTickets = "SELECT COUNT(*) FROM TICKET";
System.out.println(countTickets);
r = s.executeQuery(countTickets);
r.next();
int count = r.getInt("COUNT(*)");
System.out.println("COUNT: " + count);
int ticket_id = (int)(Math.random()*count);
String isBookedQ = "SELECT * FROM TICKET NATURAL JOIN BOOKING WHERE TICKET_ID = " + ticket_id;
r = s.executeQuery(isBookedQ);
while(r.next()) {
r = s.executeQuery(countTickets);
r.next();
count = r.getInt("COUNT(*)");
ticket_id = (int)(Math.random()*count);
isBookedQ = "SELECT * FROM TICKET NATURAL JOIN BOOKING WHERE TICKET_ID = " + ticket_id;
r = s.executeQuery(isBookedQ);
}
System.out.println("TICKET_ID: " + ticket_id);
int bags = (int)(Math.random()*count);
System.out.println("BAGS: " + bags);
int price;
int miles = 0;
String milesQ = "SELECT * "
+ "FROM TICKET NATURAL JOIN LEG NATURAL JOIN ROUTE "
+ "WHERE TICKET_ID = " + ticket_id;
r = s.executeQuery(milesQ);
if(r.next()) miles = r.getInt("DISTANCE");
System.out.println("MILES: " + miles);
price = 100;
if(miles < 100) price = 50;
else if (miles < 300) price = 100;
else if (miles < 500) price = 150;
else if (miles < 1000) price = 200;
else if (miles < 1500) price = 300;
else if (miles < 2000) price = 400;
else if (miles < 3000) price = 500;
else if (miles < 4000) price = 600;
else if (miles >= 4000) price = 750;
price += bags*10;
System.out.println("PRICE: " + price);
String countCusts = "SELECT COUNT(*) FROM CUSTOMER";
r = s.executeQuery(countCusts);
r.next();
count = r.getInt("COUNT(*)");
int cust_id = (int)(Math.random()*count);
String bookInsert = "INSERT INTO BOOKING (PRICE, FF_MILES, BAGS, TICKET_ID, CUST_ID) VALUES (" + price + "," + miles + "," + bags + "," + ticket_id + "," + cust_id + ")";
s.executeUpdate(bookInsert);
System.out.println("CUST_ID: " + cust_id);
String u = "UPDATE CUSTOMER SET FF_MILES = FF_MILES + " + miles + " WHERE CUST_ID = " + cust_id;
System.out.println(u);
s.executeUpdate(u);
String cQ = "SELECT * FROM CUSTOMER WHERE CUST_ID = " + cust_id;
ResultSet res = s.executeQuery(cQ);
if(res.next())
System.out.println(res.getInt("FF_MILES"));
} catch(Exception e) { e.printStackTrace(); }
}
}
public void genFlights() {
try {
Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet r = null;
int num = 0;
String statuses[] = {"DELAYED", "ON TIME", "CANCELLED"};
String status = "", fUpdate ="";
int st = 0, delay, fid;
int ap_id;
int ais, did, route, capid, coid, airid;
long offset, end, diff;
Timestamp stamp;
Date dd, ad;
double dist, speed;
long hrs;
int start_loc;
int num_flights;
//Loop Through every airplan in fleet.
for(int a = 36; a <= 40; a++) {
// Random starting date of our airplane's first flight.
offset = Timestamp.valueOf("2013-04-20 00:00:00").getTime();
end = Timestamp.valueOf("2013-04-26 00:00:00").getTime();
diff = end - offset + 1;
stamp = new Timestamp(offset + (long)(Math.random() * diff));
dd = new Date(stamp.getTime());
//Random starting location of our airplane's first flight (1 of 7411).
r = s.executeQuery("SELECT COUNT(*) FROM (SELECT COUNT(*) FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 100)");
r.next();
int count = r.getInt("COUNT(*)");
r = s.executeQuery("SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 80");
r.next();
r.relative((int)(Math.random()*count)-1);
ap_id = r.getInt("AIRPORT_ID");
System.out.println("Starting loc: " + ap_id);
//Random number of flights our airplane will have been scheduled for. (from 6-26)
num_flights = 4 + (int)(Math.random() * 8);
//For Each airplane, generate flights.
for(int i = 0; i < num_flights;i++) {
//Find unique flight number (1-600000)
do {
num = (int)(Math.random()* 600000);
r = s.executeQuery("SELECT COUNT(*) FROM FLIGHT WHERE FLIGHT_NUM = '" + num + "'");
r.next();
} while(r.getInt("COUNT(*)") > 0);
// Is our flight on time or delayed?
st = (int)(Math.random()* 2-.000001);
if(st == 1) delay = 0;
else delay = (int)(Math.random()* 120);
fUpdate = "INSERT INTO FLIGHT (FLIGHT_NUM,STATUS,DELAY) VALUES (" + num + ",'" + statuses[st] + "'," + delay +")";
System.out.println(fUpdate);
s.executeUpdate(fUpdate);
r = s.executeQuery("SELECT FLIGHT_ID FROM FLIGHT WHERE FLIGHT_NUM = " + num + " AND STATUS = '" + statuses[st] + "' AND DELAY = " + delay);
r.next();
fid = r.getInt("FLIGHT_ID");
r = s.executeQuery("SELECT COUNT(*) FROM (ROUTE A JOIN AIRPORT B ON A.DEPT_AP_ID = B.AIRPORT_ID) WHERE B.AIRPORT_ID = " + ap_id
+ "AND A.ROUTE_ID NOT IN (SELECT ROUTE_ID FROM ROUTE, (SELECT * FROM AIRPLANE NATURAL JOIN MODEL) A WHERE ROUTE.DISTANCE > A.RANGE AND AIRPLANE_ID = " + a + ")"
+ "AND A.ARRI_AP_ID IN (SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 30 )");
r.next();
count = r.getInt("COUNT(*)");
System.out.println("Count: " + count);
r = s.executeQuery("SELECT * FROM (ROUTE A JOIN AIRPORT B ON A.DEPT_AP_ID = B.AIRPORT_ID) WHERE B.AIRPORT_ID = " + ap_id
+ "AND A.ROUTE_ID NOT IN (SELECT ROUTE_ID FROM ROUTE, (SELECT * FROM AIRPLANE NATURAL JOIN MODEL) A WHERE ROUTE.DISTANCE > A.RANGE AND AIRPLANE_ID = " + a + ")"
+ "AND A.ARRI_AP_ID IN (SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 30 )");
r.next();
r.relative((int)(Math.random()*count));
route = r.getInt("ROUTE_ID");
r =s.executeQuery("SELECT ARRI_AP_ID FROM ROUTE WHERE ROUTE_ID = " + route);
r.next();
ap_id = r.getInt("ARRI_AP_ID");
r =s.executeQuery("SELECT DISTANCE FROM ROUTE WHERE ROUTE_ID = " + route);
r.next();
dist = r.getDouble("DISTANCE");
r = s.executeQuery("SELECT MAX_SPEED FROM AIRPLANE NATURAL JOIN MODEL WHERE AIRPLANE_ID = " + a);
r.next();
speed = r.getDouble("MAX_SPEED");
hrs = (long)(3600000. * dist/speed);
stamp = new Timestamp(stamp.getTime() + hrs + 1800000);
ad = new Date(stamp.getTime());
System.out.println(stamp.toString());
// Find Captain and Copilots:
capid = (int)(Math.random()*99);
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + "' AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND CAPTAIN_ID = " + capid);
r.next();
int x = r.getInt("COUNT(*)");
while(x > 1) {
capid = (int)(Math.random()*98) + 1;
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + "' AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND CAPTAIN_ID = " + capid);
}
coid = 99+(int)(Math.random()*98) + 1;
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + "' AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND COPILOT_ID = " + coid);
r.next();
x = r.getInt("COUNT(*)");
while(x > 1) {
coid = 99+(int)(Math.random()*99);
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + "' AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND COPILOT_ID = " + coid);
}
String departStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(dd);
String arrivalStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(ad);
s.executeUpdate("INSERT INTO LEG (DEP_TIME,ARR_TIME,ROUTE_ID,CAPTAIN_ID,COPILOT_ID,AIRPLANE_ID, FLIGHT_ID) values (timestamp'" +
departStamp + "',timestamp'" + arrivalStamp + "'," + route + "," + capid + "," + coid + "," + a + "," + fid + ")");
r = s.executeQuery("SELECT LEG_ID FROM LEG WHERE FLIGHT_ID = " + fid + " AND CAPTAIN_ID = " + capid + " AND ROUTE_ID = " + route + " AND ARR_TIME = timestamp'" + arrivalStamp + "'");
r.next();
int legId = r.getInt("LEG_ID");
r = s.executeQuery("SELECT F_CLASS_SEATS, S_CLASS_SEATS FROM AIRPLANE NATURAL JOIN MODEL WHERE AIRPLANE_ID = " + a);
r.next();
int fcSeats = r.getInt("F_CLASS_SEATS");
int scSeats = r.getInt("S_CLASS_SEATS");
int t = 0;
for(; t < fcSeats; t++) {
s.executeUpdate("INSERT INTO TICKET (SEAT,BOARDING_GROUP,CLASS,LEG_ID) VALUES (" + t + "," + (int)(t/30) + ",1," + legId + ")");
}
for(; t < scSeats; t++) {
s.executeUpdate("INSERT INTO TICKET (SEAT,BOARDING_GROUP,CLASS,LEG_ID) VALUES (" + t + "," + (int)(t/30) + ",2," + legId + ")");
}
for(int j = 0; j < 1+ (int)(Math.random()*10); j++) {
stamp = new Timestamp(stamp.getTime() + 3600000);
dd = new Date(stamp.getTime());
r = s.executeQuery("SELECT COUNT(*) FROM (ROUTE A JOIN AIRPORT B ON A.DEPT_AP_ID = B.AIRPORT_ID) WHERE B.AIRPORT_ID = " + ap_id
+ "AND A.ROUTE_ID NOT IN (SELECT ROUTE_ID FROM ROUTE, (SELECT * FROM AIRPLANE NATURAL JOIN MODEL) A WHERE ROUTE.DISTANCE > A.RANGE AND AIRPLANE_ID = " + a + ")"
+ "AND A.ARRI_AP_ID IN (SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 10 )");
r.next();
count = r.getInt("COUNT(*)");
//System.out.println("Count: " + count);
r = s.executeQuery("SELECT * FROM (ROUTE A JOIN AIRPORT B ON A.DEPT_AP_ID = B.AIRPORT_ID) WHERE B.AIRPORT_ID = " + ap_id
+ "AND A.ROUTE_ID NOT IN (SELECT ROUTE_ID FROM ROUTE, (SELECT * FROM AIRPLANE NATURAL JOIN MODEL) A WHERE ROUTE.DISTANCE > A.RANGE AND AIRPLANE_ID = " + a + ")"
+ "AND A.ARRI_AP_ID IN (SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 10 )");
r.next();
r.relative((int)(Math.random()*count));
route = r.getInt("ROUTE_ID");
r =s.executeQuery("SELECT ARRI_AP_ID FROM ROUTE WHERE ROUTE_ID = " + route);
r.next();
ap_id = r.getInt("ARRI_AP_ID");
r = s.executeQuery("SELECT DISTANCE FROM ROUTE WHERE ROUTE_ID = " + route);
r.next();
dist = r.getDouble("DISTANCE");
r = s.executeQuery("SELECT MAX_SPEED FROM AIRPLANE NATURAL JOIN MODEL WHERE AIRPLANE_ID = " + a);
r.next();
speed = r.getDouble("MAX_SPEED");
hrs = (long)(3600000. * dist/speed);
stamp = new Timestamp(stamp.getTime() + hrs + 1800000);
ad = new Date(stamp.getTime());
// Find Captain and Copilots:
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + "' AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND CAPTAIN_ID = " + capid);
r.next();
x = r.getInt("COUNT(*)");
while(x > 1) {
capid = (int)(Math.random()*99);
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + "' AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND CAPTAIN_ID = " + capid);
}
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + "' AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND COPILOT_ID = " + coid);
r.next();
x = r.getInt("COUNT(*)");
while(x > 1) {
coid = 99+(int)(Math.random()*99);
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + "' AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND COPILOT_ID = " + coid);
}
departStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(dd);
arrivalStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(ad);
s.executeUpdate("INSERT INTO LEG (DEP_TIME,ARR_TIME,ROUTE_ID,CAPTAIN_ID,COPILOT_ID,AIRPLANE_ID, FLIGHT_ID) values (timestamp'" +
departStamp + "',timestamp'" + arrivalStamp + "'," + route + "," + capid + "," + coid + "," + a + "," + fid + ")");
r = s.executeQuery("SELECT LEG_ID FROM LEG WHERE FLIGHT_ID = " + fid + " AND CAPTAIN_ID = " + capid + " AND ROUTE_ID = " + route + " AND ARR_TIME = timestamp'" + arrivalStamp + "'");
r.next();
legId = r.getInt("LEG_ID");
r = s.executeQuery("SELECT F_CLASS_SEATS, S_CLASS_SEATS FROM AIRPLANE NATURAL JOIN MODEL WHERE AIRPLANE_ID = " + a);
r.next();
fcSeats = r.getInt("F_CLASS_SEATS");
scSeats = r.getInt("S_CLASS_SEATS");
t = 0;
for(; t < fcSeats; t++) {
s.executeUpdate("INSERT INTO TICKET (SEAT,BOARDING_GROUP,CLASS,LEG_ID) VALUES (" + t + "," + (int)(t/30) + ",1," + legId + ")");
}
for(; t < scSeats; t++) {
s.executeUpdate("INSERT INTO TICKET (SEAT,BOARDING_GROUP,CLASS,LEG_ID) VALUES (" + t + "," + (int)(t/30) + ",2," + legId + ")");
}
}
hrs = (long)(3600000. * (int)(Math.random()*24));
stamp = new Timestamp(stamp.getTime() + hrs + 1800000);
dd = new Date(stamp.getTime());
}
}
} catch(Exception e) { e.printStackTrace(); }
}
public void genFlightsTest() {
try {
Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet r = null;
int num = 0;
String statuses[] = {"DELAYED", "ON TIME", "CANCELLED"};
String status = "", fUpdate ="";
int st = 0, delay, fid;
int ap_id;
int ais, did, route, capid, coid, airid;
long offset, end, diff;
Timestamp stamp;
Date dd, ad;
double dist, speed;
long hrs;
int start_loc;
int num_flights;
//Loop Through every airplan in fleet.
for(int a = 1; a <= 10; a++) {
// Random starting date of our airplane's first flight.
offset = Timestamp.valueOf("2011-01-01 00:00:00").getTime();
end = Timestamp.valueOf("2011-04-04 00:00:00").getTime();
diff = end - offset + 1;
stamp = new Timestamp(offset + (long)(Math.random() * diff));
dd = new Date(stamp.getTime());
//Random starting location of our airplane's first flight (1 of 7411).
r = s.executeQuery("SELECT COUNT(*) FROM (SELECT COUNT(*) FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 30)");
r.next();
int count = r.getInt("COUNT(*)");
r = s.executeQuery("SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 10");
r.next();
r.relative((int)(Math.random()*count)-1);
ap_id = r.getInt("AIRPORT_ID");
System.out.println("Starting loc: " + ap_id);
//Random number of flights our airplane will have been scheduled for. (from 6-20)
num_flights = 6 + (int)(Math.random() * 20);
//For Each airplane, generate flights.
for(int i = 0; i < num_flights;i++) {
//Find unique flight number (1-600000)
do {
num = (int)(Math.random()* 600000);
r = s.executeQuery("SELECT COUNT(*) FROM FLIGHT WHERE FLIGHT_NUM = '" + num);
r.next();
} while(r.getInt("COUNT(*)") > 0);
// Is our flight on time or delayed?
st = (int)(Math.random()* 2);
if(st == 2) delay = 0;
else delay = (int)(Math.random()* 120);
fUpdate = "INSERT INTO FLIGHT (FLIGHT_NUM,STATUS,DELAY) VALUES (" + num + ",'" + statuses[st] + "'," + delay +")";
System.out.println(fUpdate);
System.out.println(fUpdate);
r = s.executeQuery("SELECT FLIGHT_ID FROM FLIGHT WHERE FLIGHT_NUM = " + num + " AND STATUS = '" + statuses[st] + "' AND DELAY = " + delay);
r.next();
fid = r.getInt("FLIGHT_ID");
r = s.executeQuery("SELECT COUNT(*) FROM (ROUTE A JOIN AIRPORT B ON A.DEPT_AP_ID = B.AIRPORT_ID) WHERE B.AIRPORT_ID = " + ap_id
+ "AND A.ROUTE_ID NOT IN (SELECT ROUTE_ID FROM ROUTE, (SELECT * FROM AIRPLANE NATURAL JOIN MODEL) A WHERE ROUTE.DISTANCE > A.RANGE AND AIRPLANE_ID = " + a + ")"
+ "AND A.ARRI_AP_ID IN (SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 10 )");
r.next();
count = r.getInt("COUNT(*)");
System.out.println("Count: " + count);
r = s.executeQuery("SELECT * FROM (ROUTE A JOIN AIRPORT B ON A.DEPT_AP_ID = B.AIRPORT_ID) WHERE B.AIRPORT_ID = " + ap_id
+ "AND A.ROUTE_ID NOT IN (SELECT ROUTE_ID FROM ROUTE, (SELECT * FROM AIRPLANE NATURAL JOIN MODEL) A WHERE ROUTE.DISTANCE > A.RANGE AND AIRPLANE_ID = " + a + ")"
+ "AND A.ARRI_AP_ID IN (SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 10 )");
r.next();
r.relative((int)(Math.random()*count)-1);
route = r.getInt("ROUTE_ID");
r =s.executeQuery("SELECT ARRI_AP_ID FROM ROUTE WHERE ROUTE_ID = " + route);
r.next();
ap_id = r.getInt("ARRI_AP_ID");
r =s.executeQuery("SELECT DISTANCE FROM ROUTE WHERE ROUTE_ID = " + route);
r.next();
dist = r.getDouble("DISTANCE");
r = s.executeQuery("SELECT MAX_SPEED FROM AIRPLANE NATURAL JOIN MODEL WHERE AIRPLANE_ID = " + a);
r.next();
speed = r.getDouble("MAX_SPEED");
hrs = (long)(3600000. * dist/speed);
stamp = new Timestamp(stamp.getTime() + hrs + 1800000);
ad = new Date(stamp.getTime());
// Find Captain and Copilots:
capid = (int)(Math.random()*99);
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + " AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND CAPTAIN_ID = " + capid);
r.next();
int x = r.getInt("COUNT(*)");
while(x > 1) {
capid = (int)(Math.random()*99);
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + " AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND CAPTAIN_ID = " + capid);
}
coid = 99+(int)(Math.random()*99);
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + " AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND COPILOT_ID = " + coid);
r.next();
x = r.getInt("COUNT(*)");
while(x > 1) {
coid = 99+(int)(Math.random()*99);
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + " AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND COPILOT_ID = " + coid);
}
String departStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(dd);
String arrivalStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(ad);
System.out.println("INSERT INTO LEG (DEP_TIME,ARR_TIME,ROUTE_ID,CAPTAIN_ID,COPILOT_ID,AIRPLANE_ID, FLIGHT_ID) values (timestamp'" +
departStamp + "',timestamp'" + arrivalStamp + "'," + route + "," + capid + "," + coid + "," + a + "," + fid + ")");
r = s.executeQuery("SELECT LEG_ID FROM LEG WHERE FLIGHT_ID = " + fid + " AND CAPTAIN_ID = " + capid + " AND ROUTE_ID = " + route + " AND ARR_TIME = " + arrivalStamp);
r.next();
int legId = r.getInt("LEG_ID");
r = s.executeQuery("SELECT F_CLASS_TICKETS, S_CLASS_TICKETS AIRPLANE NATURAL JOIN MODEL WHERE AIRPLANE_ID = " + a);
r.next();
int fcSeats = r.getInt("F_CLASS_SEATS");
int scSeats = r.getInt("S_CLASS_SEATS");
int t = 0;
for(; t < fcSeats; t++) {
System.out.println("INSERT INTO TICKET (SEAT,BOARDING_GROUP,CLASS,LEG_ID) VALUES (" + t + "," + (int)(t/30) + ",1," + legId);
}
for(; t < scSeats; t++) {
System.out.println("INSERT INTO TICKET (SEAT,BOARDING_GROUP,CLASS,LEG_ID) VALUES (" + t + "," + (int)(t/30) + ",2," + legId);
}
for(int j = 0; j < 1+ (int)(Math.random()*10); j++) {
stamp = new Timestamp(stamp.getTime() + 3600000);
dd = new Date(stamp.getTime());
r = s.executeQuery("SELECT COUNT(*) FROM (ROUTE A JOIN AIRPORT B ON A.DEPT_AP_ID = B.AIRPORT_ID) WHERE B.AIRPORT_ID = " + ap_id
+ "AND A.ROUTE_ID NOT IN (SELECT ROUTE_ID FROM ROUTE, (SELECT * FROM AIRPLANE NATURAL JOIN MODEL) A WHERE ROUTE.DISTANCE > A.RANGE AND AIRPLANE_ID = " + a + ")"
+ "AND A.ARRI_AP_ID IN (SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 10 )");
r.next();
count = r.getInt("COUNT(*)");
//System.out.println("Count: " + count);
r = s.executeQuery("SELECT * FROM (ROUTE A JOIN AIRPORT B ON A.DEPT_AP_ID = B.AIRPORT_ID) WHERE B.AIRPORT_ID = " + ap_id
+ "AND A.ROUTE_ID NOT IN (SELECT ROUTE_ID FROM ROUTE, (SELECT * FROM AIRPLANE NATURAL JOIN MODEL) A WHERE ROUTE.DISTANCE > A.RANGE AND AIRPLANE_ID = " + a + ")"
+ "AND A.ARRI_AP_ID IN (SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 10 )");
r.next();
r.relative((int)(Math.random()*count)-1);
route = r.getInt("ROUTE_ID");
r = s.executeQuery("SELECT DISTANCE FROM ROUTE WHERE ROUTE_ID = " + route);
r.next();
dist = r.getDouble("DISTANCE");
r = s.executeQuery("SELECT MAX_SPEED FROM AIRPLANE NATURAL JOIN MODEL WHERE AIRPLANE_ID = " + a);
r.next();
speed = r.getDouble("MAX_SPEED");
hrs = (long)(3600000. * dist/speed);
stamp = new Timestamp(stamp.getTime() + hrs + 1800000);
ad = new Date(stamp.getTime());
// Find Captain and Copilots:
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + " AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND CAPTAIN_ID = " + capid);
r.next();
x = r.getInt("COUNT(*)");
while(x > 1) {
capid = (int)(Math.random()*99);
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + " AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND CAPTAIN_ID = " + capid);
}
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + " AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND COPILOT_ID = " + coid);
r.next();
x = r.getInt("COUNT(*)");
while(x > 1) {
coid = 99+(int)(Math.random()*99);
r = s.executeQuery("SELECT COUNT(*) FROM LEG WHERE ARR_TIME >= timestamp'" + stamp.toString() + " AND DEP_TIME <= timestamp'" + stamp.toString() +"' AND COPILOT_ID = " + coid);
}
departStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(dd);
arrivalStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(ad);
System.out.println("INSERT INTO LEG (DEP_TIME,ARR_TIME,ROUTE_ID,CAPTAIN_ID,COPILOT_ID,AIRPLANE_ID, FLIGHT_ID) values (timestamp'" +
departStamp + "',timestamp'" + arrivalStamp + "'," + route + "," + capid + "," + coid + "," + a + "," + fid + ")");
r = s.executeQuery("SELECT LEG_ID FROM LEG WHERE FLIGHT_ID = " + fid + " AND CAPTAIN_ID = " + capid + " AND ROUTE_ID = " + route + " AND ARR_TIME = " + arrivalStamp);
r.next();
legId = r.getInt("LEG_ID");
r = s.executeQuery("SELECT F_CLASS_TICKETS, S_CLASS_TICKETS AIRPLANE NATURAL JOIN MODEL WHERE AIRPLANE_ID = " + a);
r.next();
fcSeats = r.getInt("F_CLASS_SEATS");
scSeats = r.getInt("S_CLASS_SEATS");
t = 0;
for(; t < fcSeats; t++) {
System.out.println("INSERT INTO TICKET (SEAT,BOARDING_GROUP,CLASS,LEG_ID) VALUES (" + t + "," + (int)(t/30) + ",1," + legId);
}
for(; t < scSeats; t++) {
System.out.println("INSERT INTO TICKET (SEAT,BOARDING_GROUP,CLASS,LEG_ID) VALUES (" + t + "," + (int)(t/30) + ",2," + legId);
}
}
stamp = new Timestamp(stamp.getTime() + 3600000);
dd = new Date(stamp.getTime());
}
}
} catch(Exception e) { e.printStackTrace(); }
}
public void test() {
try {
int ap = 1218;
int route = 0;
int pl = 840;
int count;
Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet r;
//Random starting location of our airplane's first flight (1 of 7411).
r = s.executeQuery("SELECT COUNT(*) FROM (SELECT COUNT(*) FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 30)");
r.next();
count = r.getInt("COUNT(*)");
System.out.println("Count 1: " + count);
r = s.executeQuery("SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) > 20");
r.next();
r.relative((int)(Math.random()*count)-1);
ap = r.getInt("AIRPORT_ID");
ap = 1804;
System.out.println("AIRPORT_ID: " + ap);
r = s.executeQuery("SELECT COUNT(*) FROM (ROUTE A JOIN AIRPORT B ON A.DEPT_AP_ID = B.AIRPORT_ID) WHERE B.AIRPORT_ID = " + ap
+ "AND A.ROUTE_ID NOT IN (SELECT ROUTE_ID FROM ROUTE, (SELECT * FROM AIRPLANE NATURAL JOIN MODEL) A WHERE ROUTE.DISTANCE > A.RANGE AND AIRPLANE_ID = " + pl + ")"
+ "AND A.ARRI_AP_ID IN (SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) >6 )");
r.next();
count = r.getInt("COUNT(*)");
System.out.println("Count: " + count);
r = s.executeQuery("SELECT * FROM (ROUTE A JOIN AIRPORT B ON A.DEPT_AP_ID = B.AIRPORT_ID) WHERE B.AIRPORT_ID = " + ap
+ "AND A.ROUTE_ID NOT IN (SELECT ROUTE_ID FROM ROUTE, (SELECT * FROM AIRPLANE NATURAL JOIN MODEL) A WHERE ROUTE.DISTANCE > A.RANGE AND AIRPLANE_ID = " + pl + ")"
+ "AND A.ARRI_AP_ID IN (SELECT AIRPORT_ID FROM AIRPORT JOIN ROUTE ON airport_id = dept_ap_id GROUP BY AIRPORT_ID HAVING COUNT(*) >6 )");
r.next();
if(count > 0) {
r.relative((int)(Math.random()*count)-1);
route = r.getInt("ROUTE_ID");
ap = r.getInt("ARRI_AP_ID");
}
else route = (int)(Math.random()*51000);
System.out.println("ROUTE: " + route + "\nARRIVING AP: " + ap);
} catch (Exception e) { e.printStackTrace(); }
}
public void inputData(String tabname, String vars, String path) {
try {
int count = 0;
String line;
String update = "";
FileInputStream fstream = new FileInputStream(new File(path));
BufferedReader br = new BufferedReader(new InputStreamReader(new DataInputStream(fstream)));
Statement s = con.createStatement();
int i;
while( (line = br.readLine()) != null) {
update = "INSERT INTO " + tabname + " (" + vars + ") values (" + line + ")";
System.out.println(update);
i = 0;
try {
System.out.println("here");
i = s.executeUpdate(update); } catch(Exception e) {System.out.println("Excpeption."); e.printStackTrace();}
System.out.println("Value returned: " + i +"\tCount: " + count);
count++;
}
s.close();
br.close();
fstream.close();
} catch (Exception e) { e.printStackTrace(); }
}
public void inputUniqueData(String tabname, String vars, String path) {
try {
int count = 0;
String line;
String update = "";
FileInputStream fstream = new FileInputStream(new File(path));
BufferedReader br = new UniqueLineReader(new InputStreamReader(new DataInputStream(fstream)));
Statement s = con.createStatement();
int i;
while( (line = br.readLine()) != null) {
update = "INSERT INTO " + tabname + " (" + vars + ") values (" + line + ")";
System.out.println(update);
i = 0;
try {
i = s.executeUpdate(update);
} catch(Exception e) {System.out.println("Excpetion during insert."); e.printStackTrace(); }
System.out.println("Value returned: " + i +"\tCount: " + count);
count++;
}
s.close();
br.close();
fstream.close();
} catch (Exception e) { e.printStackTrace(); }
}
public void executeUpdateFile(String path) {
try {
String line;
FileInputStream fstream = new FileInputStream(new File(path));
BufferedReader br = new BufferedReader(new InputStreamReader(new DataInputStream(fstream)));
Statement s = con.createStatement();
int i;
while( (line = br.readLine()) != null) {
System.out.println(line);
i = s.executeUpdate(line);
System.out.println("Value returned: " + i);
}
s.close();
br.close();
fstream.close();
} catch (Exception e) { e.printStackTrace(); }
}
public void resetAll() {
dropTriggers();
dropSequences();
dropTables();
addTables();
addConstraints();
addSequences();
addTriggers();
}
public void dropTables() {
executeUpdateFile("DDL/DROP_TABLES");
}
public void dropSequences() {
executeUpdateFile("DDL/DROP_SEQUENCES");
}
public void dropTriggers() {
executeUpdateFile("DDL/DROP_TRIGGERS");
}
public void addTables() {
executeUpdateFile("DDL/ADD_TABLES");
}
public void addConstraints() {
executeUpdateFile("DDL/ADD_CONSTRAINTS");
}
public void addSequences() {
executeUpdateFile("DDL/ADD_SEQUENCES");
}
public void addTriggers() {
executeUpdateFile("DDL/ADD_TRIGGERS");
}
public void parseSQL_ForJDBC(String path) {
try {
int val;
char ch;
//FileInputStream fstream = new FileInputStream(new File(path));
String fpath = path + "_jdbc";
String line = "";
System.out.println("Creating new file: "+fpath);
File f = new File(fpath);
f.createNewFile();
BufferedWriter bw = new BufferedWriter(new FileWriter(f));
BufferedReader br = new BufferedReader(new FileReader(path));
System.out.println("Writing to "+fpath+": ");
while( (val = br.read()) != -1) {
ch = (char)val;
if(ch == ';') {
System.out.print("\n");
bw.newLine();
line = "";
}
else if(ch == '\n' || ch == '\r') {
System.out.print(' ');
bw.write(' ');
}
else {
System.out.print(ch);
bw.write(ch);
}
}
br.close();
bw.close();
} catch (Exception e) { e.printStackTrace(); }
}
public void parseAirportData(String path) {
try {
int val;
char ch = ' ';
//FileInputStream fstream = new FileInputStream(new File(path));
String fpath = path + "_new";
String line = "";
System.out.println("Creating new file: "+fpath);
File f = new File(fpath);
f.createNewFile();
BufferedWriter bw = new BufferedWriter(new FileWriter(f));
BufferedReader br = new BufferedReader(new FileReader(path));
System.out.println("Writing to "+fpath+": ");
while( (val = br.read()) != -1) {
ch = (char)val;
if(ch == '"')
bw.write('\'');
else if(ch == '\''){
bw.write('\'');
bw.write('\'');}
else
bw.write(ch);
}
br.close();
bw.close();
} catch (Exception e) { e.printStackTrace(); }
}
public void parseRoutes(String path) {
try {
String vals[];
int lcount = 0;
//FileInputStream fstream = new FileInputStream(new File(path));
String fpath = path + "_parsed";
String line = "";
String newline = "";
String aName = "", bName = "";
String aQuery, bQuery;
System.out.println("Creating new file: "+fpath);
File f = new File(fpath);
f.createNewFile();
BufferedWriter bw = new BufferedWriter(new FileWriter(f));
BufferedReader br = new BufferedReader(new FileReader(path));
System.out.println("Writing to "+fpath+": ");
Statement s = con.createStatement();
ResultSet result;
double aLon = 0, aLat = 0, bLon = 0, bLat = 0;
double d = 0;
while( (line = br.readLine()) != null) {
vals = line.split(",");
if(!vals[3].equals("null") && !vals[5].equals("null")) {
System.out.println("COUNT: " + lcount + "\tLINE: " + line);
System.out.println("SOURCE ID: " + vals[3] + "\tDEST ID: " + vals[5]);
aQuery = "SELECT NAME, LONGITUDE, LATITUDE " +
"FROM AIRPORT " +
"WHERE AIRPORT_ID = " + vals[3];
bQuery = "SELECT NAME, LONGITUDE, LATITUDE " +
"FROM AIRPORT " +
"WHERE AIRPORT_ID = " + vals[5];
result = s.executeQuery(aQuery);
if (!result.next()) System.out.println ("Empty result.");
else {
aName = result.getString("NAME");
aLon = Double.parseDouble(result.getString("LONGITUDE"));
aLat = Double.parseDouble(result.getString("LATITUDE"));
}
result = s.executeQuery(bQuery);
if (!result.next()) System.out.println ("Empty result.");
else {
bName = result.getString("NAME");
bLon = Double.parseDouble(result.getString("LONGITUDE"));
bLat = Double.parseDouble(result.getString("LATITUDE"));
}
System.out.println("SOURCE NAME: " + aName + " [LONGITUDE: " + aLon + " LATITUDE: "+ aLat + "]");
System.out.println("DESTINATION NAME: " + bName + " [LONGITUDE: " + bLon + " LATITUDE: "+ bLat + "]");
d = (new BigDecimal(distance(aLat, aLon, bLat, bLon, 'M'))).round(new MathContext(6)).doubleValue();
System.out.println("DISTANCE: " + d+ "\n");
newline = vals[3]+","+vals[5]+","+d+"\n";
bw.write(newline);
lcount++;
}
else {
System.out.println("NULL AIRPORT_ID VALUE.\n");
lcount++;
}
}
br.close();
bw.flush();
bw.close();
} catch (Exception e) { e.printStackTrace(); }
}
private double distance(double lat1, double lon1, double lat2, double lon2, char unit) {
double theta = lon1 - lon2;
double dist = Math.sin(deg2rad(lat1)) * Math.sin(deg2rad(lat2)) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.cos(deg2rad(theta));
dist = Math.acos(dist);
dist = rad2deg(dist);
dist = dist * 60 * 1.1515;
if (unit == 'K') {
dist = dist * 1.609344;
} else if (unit == 'N') {
dist = dist * 0.8684;
}
return (dist);
}
private double deg2rad(double deg) {
return (deg * Math.PI / 180.0);
}
private double rad2deg(double rad) {
return (rad * 180 / Math.PI);
}
public void createFlights() {
}
}
| [
"kdr213@gmail.com"
] | kdr213@gmail.com |
1541d69d19df8656db283d1dedc219d844bdab4b | 2595fd47f6f0d0b491493e968228442737a58c4b | /app/src/main/java/com/example/rachit/aemjdemo/Utility/BlurKit.java | b1bdf5398eff21e6f6ca9dbd7db96100985e9618 | [] | no_license | rachit-openxcell/BlurDemo | 95859376910dd716b9f5de30fe179b5b67c48c85 | 068ba4055cff9971d177791edfce897508af51a5 | refs/heads/master | 2020-03-17T20:16:37.838511 | 2018-05-24T06:44:58 | 2018-05-24T06:44:58 | 133,901,530 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,290 | java | package com.example.rachit.aemjdemo.Utility;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.support.v8.renderscript.Allocation;
import android.support.v8.renderscript.Element;
import android.support.v8.renderscript.RenderScript;
import android.support.v8.renderscript.ScriptIntrinsicBlur;
import android.view.View;
public class BlurKit {
private static com.example.rachit.aemjdemo.Utility.BlurKit instance;
private RenderScript rs;
public static void init(Context context) {
if (instance != null) {
return;
}
instance = new com.example.rachit.aemjdemo.Utility.BlurKit();
instance.rs = RenderScript.create(context);
}
public Bitmap blur(Bitmap src, int radius) {
final Allocation input = Allocation.createFromBitmap(rs, src);
final Allocation output = Allocation.createTyped(rs, input.getType());
final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
script.setRadius(radius);
script.setInput(input);
script.forEach(output);
output.copyTo(src);
return src;
}
public Bitmap blur(View src, int radius) {
Bitmap bitmap = getBitmapForView(src, 1f);
return blur(bitmap, radius);
}
public Bitmap fastBlur(View src, int radius, float downscaleFactor) {
Bitmap bitmap = getBitmapForView(src, downscaleFactor);
return blur(bitmap, radius);
}
private Bitmap getBitmapForView(View src, float downscaleFactor) {
Bitmap bitmap = Bitmap.createBitmap(
(int) (src.getWidth() * downscaleFactor),
(int) (src.getHeight() * downscaleFactor),
Bitmap.Config.ARGB_4444
);
Canvas canvas = new Canvas(bitmap);
Matrix matrix = new Matrix();
matrix.preScale(downscaleFactor, downscaleFactor);
canvas.setMatrix(matrix);
src.draw(canvas);
return bitmap;
}
public static com.example.rachit.aemjdemo.Utility.BlurKit getInstance() {
if (instance == null) {
throw new RuntimeException("BlurKit not initialized!");
}
return instance;
}
}
| [
"rachit@Dhruvil-Bavishi.local"
] | rachit@Dhruvil-Bavishi.local |
e98cdff535d8616c4d98d8431aedeaca4ce15dba | 6a5037efcbf36ce0f4f43353bfd52790cb0e109a | /src/main/java/br/com/hot/escola/academico/dominio/indicacao/Indicacao.java | 0ab66d33e74538d24e5f64a073f032707eefdbd5 | [] | no_license | rangelvarnier/clean-architecture-ddd | a6fb9d1edf5258ba7d67c446f1908092f8d70c09 | ea969fcde72ee8e0872062d5ab6d9d83090aa8f2 | refs/heads/master | 2023-04-28T14:28:19.991686 | 2021-05-06T16:38:57 | 2021-05-06T16:38:57 | 364,920,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package br.com.hot.escola.academico.dominio.indicacao;
import br.com.hot.escola.academico.dominio.aluno.Aluno;
import java.time.LocalDateTime;
public class Indicacao {
private Aluno indicado;
private Aluno indicante;
private LocalDateTime dataIndicacao;
public Indicacao(Aluno indicado, Aluno indicante, LocalDateTime dataIndicacao) {
this.indicado = indicado;
this.indicante = indicante;
this.dataIndicacao = LocalDateTime.now();
}
public Aluno getIndicado() {
return indicado;
}
public Aluno getIndicante() {
return indicante;
}
}
| [
"rangel.varnier"
] | rangel.varnier |
668e371f8fc591efc9967a01e70e5a6f84de31f0 | f7115d7eb4edc4f22bc0a9b31b27d42aa321688c | /app/src/main/java/model/Player.java | 23d66485fedd622c6eeaccd8a198ed337ea2154c | [] | no_license | DavidMx2/PulseTrip | b15550b58756d2d01069452f86084f4606499e75 | 30630b0374b765836aacdbff3d8c447464ba6ed6 | refs/heads/master | 2022-11-23T05:45:50.561885 | 2016-06-30T16:02:30 | 2016-06-30T16:02:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,986 | java | package model;
import android.graphics.Bitmap;
import android.graphics.Canvas;
/**
* Created by David on 17/05/2016.
*/
public class Player extends GameObject {
private Bitmap spritesheet;
private int score;
private double dy, dx;
private boolean playing;
private boolean jump;
private boolean slide=false;
private Animation animation = new Animation();
private long startTIme;
private boolean newAnim;
public Player(Bitmap res, int w, int h, int numFrames){
x = 50;
y = GamePanel.HEIGHT-125;
score = 0;
height = h;
width = w;
dy = 0;
//We create a Bitmap array that's going to store all the different sprites for the image of the player
Bitmap[] image = new Bitmap[numFrames];
spritesheet = res;
for (int i = 0; i<image.length; i++){
image[i] = Bitmap.createBitmap(spritesheet, i*width, 0, width, height);
}
animation.setFrames(image);
animation.setDelay(10);
startTIme = System.nanoTime();
}
public void setJump(boolean b){
jump = b;
newAnim = true;
}
public void setSlide(boolean b){
slide = b;
y+=16;
dx = 0;
}
public void update(){
long elapsed = (System.nanoTime()-startTIme)/1000000;
if (elapsed > 100){
startTIme = System.nanoTime();
}
animation.update();
if(jump){
y -=10;
dy++;
}
if (dy > 10){
jump = false;
}
if (!jump && dy>0){
y+=10;
dy--;
}
if (dy == 0 && newAnim){
setBitmap(spritesheet, 75, 79, 10);
setDimensions(65,79);
newAnim = false;
}
if (slide){
dx += 1;
if (dx > 12){
slide = false;
y-=16;
setBitmap(spritesheet, 75, 79, 10);
setDimensions(65,79);
}
}
}
public void draw(Canvas canvas){
canvas.drawBitmap(animation.getImage(), x, y, null);
}
public int getScore(){
return score;
}
public void incScore(){
score++;
}
public boolean getPlaying(){
return playing;
}
public void setPlaying(boolean b){
playing = b;
}
public void resetScore(){
score = 0;
}
public void setBitmap(Bitmap res, int w, int h, int numFrames){
Bitmap[] image = new Bitmap[numFrames];
for (int i = 0; i<image.length; i++){
image[i] = Bitmap.createBitmap(res, i*w, 0, w, h);
}
animation.setFrames(image);
startTIme = System.nanoTime();
}
public boolean getJumping(){
return dy != 0;
}
public boolean getSliding(){
return slide;
}
public void setDimensions(int h, int w){
height = h;
width = w;
}
}
| [
"david_m_0@hotmail.com"
] | david_m_0@hotmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.