blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
174131b0144f3f3e60813448aaa109d3ca0c99d7
b76ce50032bdae15f5a3654e1fa55345fe20aca2
/build/generated/src/org/apache/jsp/show_jsp.java
2cfef997a3b7026315d4820e5d4bfd0a51839f12
[]
no_license
yogesh00007/yogeshtest
20a54565722e7cf35b65b3ef697d8d26012d8a86
554ec309a26caf7d2a5b41c0492eb0d7c2a27c93
refs/heads/master
2020-12-02T18:12:50.601326
2017-07-07T03:35:25
2017-07-07T03:35:25
96,497,004
0
0
null
null
null
null
UTF-8
Java
false
false
3,914
java
package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.sql.ResultSet; import java.sql.DriverManager; import java.sql.*; public final class show_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"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("<!DOCTYPE html>\n"); Class.forName("com.mysql.jdbc.Driver"); Connection cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/ygamit?zeroDateTimeBehavior=convertToNull","root",""); Statement st=cn.createStatement(); ResultSet rs; if(request.getParameter("action")!=null) { String vid=request.getParameter("value"); String d="delete from regi where id='"+vid+"'"; st.executeUpdate(d); } out.write("\n"); out.write("<html>\n"); out.write(" <head>\n"); out.write(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"); out.write(" <title>JSP Page</title>\n"); out.write(" </head>\n"); out.write(" <body>\n"); out.write(" <form name=\"f\" method=\"post\">\n"); out.write(" \n"); out.write(" </form>\n"); out.write(" <h1>show data</h1>\n"); out.write(" <a href=\"regitration.jsp\">Regitration</a>\n"); out.write(" <a href=\"login.jsp\">Login </a>\n"); out.write(" <a href=\"regitration.jsp\">show data</a>\n"); out.write(" <a href=\"login.jsp\">Logout</a>\n"); out.write(" </body>\n"); out.write("</html>\n"); String q="select * from regi"; rs=st.executeQuery(q); out.print("<table border='1'><tr><th>action</th><th>name</th><th>password</th><th>date</th><th>gender</th><th>city</th></tr>"); while(rs.next()) { out.print("<tr><td><a href='show.jsp?action=delete&value="+rs.getString(1)+"'>delete</a></td><td>"+rs.getString(2)+"</td><td>"+rs.getString(3)+"</td><td>"+rs.getString(4)+"</td><td>"+rs.getString(5)+"</td><td>"+rs.getString(6)+"</td></tr>"); } out.print("</table"); out.write("\n"); out.write("%>\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); } } }
b40589becdba1991729c5fb611fc7f42e7123f6c
2847d4c31adae04f620c805d285ea2f6bacd5caa
/referenceguide/Droid/obj/Debug/android/src/md52cbbb386ce1d336d1e7fd8910a8d96d8/EntryUnderlineRenderer.java
58803b053f62d0430bf03cccec296acf352777f1
[]
no_license
SteveFarmerJr/CommonCore
6f29568af8f88890b3e2f348ce7d9bc392fbbf7e
b0eb3e43107fd5dfddc6d6f055f7b8f3a9d8b2f1
refs/heads/master
2021-01-20T13:58:11.464283
2017-05-04T20:36:19
2017-05-04T20:36:19
90,543,571
1
0
null
2017-05-07T15:45:15
2017-05-07T15:45:15
null
UTF-8
Java
false
false
2,578
java
package md52cbbb386ce1d336d1e7fd8910a8d96d8; public class EntryUnderlineRenderer extends md5b60ffeb829f638581ab2bb9b1a7f4f3f.EntryRenderer implements mono.android.IGCUserPeer { /** @hide */ public static final String __md_methods; static { __md_methods = ""; mono.android.Runtime.register ("Xamarin.Forms.CommonCore.EntryUnderlineRenderer, referenceguide.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", EntryUnderlineRenderer.class, __md_methods); } public EntryUnderlineRenderer (android.content.Context p0, android.util.AttributeSet p1, int p2) throws java.lang.Throwable { super (p0, p1, p2); if (getClass () == EntryUnderlineRenderer.class) mono.android.TypeManager.Activate ("Xamarin.Forms.CommonCore.EntryUnderlineRenderer, referenceguide.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e", this, new java.lang.Object[] { p0, p1, p2 }); } public EntryUnderlineRenderer (android.content.Context p0, android.util.AttributeSet p1) throws java.lang.Throwable { super (p0, p1); if (getClass () == EntryUnderlineRenderer.class) mono.android.TypeManager.Activate ("Xamarin.Forms.CommonCore.EntryUnderlineRenderer, referenceguide.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065:Android.Util.IAttributeSet, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0, p1 }); } public EntryUnderlineRenderer (android.content.Context p0) throws java.lang.Throwable { super (p0); if (getClass () == EntryUnderlineRenderer.class) mono.android.TypeManager.Activate ("Xamarin.Forms.CommonCore.EntryUnderlineRenderer, referenceguide.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Android.Content.Context, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065", this, new java.lang.Object[] { p0 }); } private java.util.ArrayList refList; public void monodroidAddReference (java.lang.Object obj) { if (refList == null) refList = new java.util.ArrayList (); refList.add (obj); } public void monodroidClearReferences () { if (refList != null) refList.clear (); } }
2eedebb1df8b91c8d37f97aad06e23103e62ae29
fa1408365e2e3f372aa61e7d1e5ea5afcd652199
/src/testcases/CWE81_XSS_Error_Message/CWE81_XSS_Error_Message__Servlet_listen_tcp_81_base.java
baa2631f20821fa2632e8b9ca96dc50c8b15a154
[]
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
871
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE81_XSS_Error_Message__Servlet_listen_tcp_81_base.java Label Definition File: CWE81_XSS_Error_Message__Servlet.label.xml Template File: sources-sink-81_base.tmpl.java */ /* * @description * CWE: 81 Cross Site Scripting (XSS) in Error Message * BadSource: listen_tcp Read data using a listening tcp connection * GoodSource: A hardcoded string * Sinks: sendErrorServlet * BadSink : XSS in sendError * Flow Variant: 81 Data flow: data passed in a parameter to an abstract method * * */ package testcases.CWE81_XSS_Error_Message; import testcasesupport.*; import javax.servlet.http.*; public abstract class CWE81_XSS_Error_Message__Servlet_listen_tcp_81_base { public abstract void action(String data , HttpServletRequest request, HttpServletResponse response) throws Throwable; }
b1cc0f31052d66a90e882aa480a45b005fc75748
b7200579583b9220a7e1268e7c0b31edac882077
/app/src/test/java/com/example/gode_user01/splashactivitydemo/ExampleUnitTest.java
db05e355266f481c0d86bbcd82114fd80b4e1822
[]
no_license
DeLaSalleUniversity-Manila/splashactivitydemo-laureeeengarcia
47f1f30f52cbc5a891a5bfde2cf7d5108fda6b04
73f53b4d938dff3c7c31ce81edf67cf42d9fe9bb
refs/heads/master
2016-08-13T01:00:29.555668
2015-12-07T15:43:33
2015-12-07T15:43:33
47,048,363
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
package com.example.gode_user01.splashactivitydemo; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
7db290ea132eac8c55723f368f4530eb4530d0b2
301870bf914dc4bd4dbeda58b20a1bbfc9a2d3ec
/applib2/build/tmp/kapt3/stubs/debug/com/zhuorui/securities/applib2/mvp/MarketTabVmWarpper.java
4fa7567779ebc8eb5ae55d22a998f4886fef32ee
[]
no_license
MaxwellZhg/StockComment
adb478865276d19804c635650f1a07239609ff6f
2e3c1dbae1a359f863fc8e58ab7459f6f98a6682
refs/heads/master
2022-02-22T13:37:42.528854
2019-10-09T23:39:14
2019-10-09T23:39:14
211,811,677
1
0
null
null
null
null
UTF-8
Java
false
false
2,287
java
package com.zhuorui.securities.applib2.mvp; import java.lang.System; /** * Created by Maxwell. * E-mail: [email protected] * Date: 2019/8/14 * Desc: */ @kotlin.Metadata(mv = {1, 1, 15}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0002\u0018\u00002\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00030\u00012\u00020\u0004B\r\u0012\u0006\u0010\u0005\u001a\u00020\u0002\u00a2\u0006\u0002\u0010\u0006J\b\u0010\r\u001a\u00020\u000eH\u0016J\b\u0010\u000f\u001a\u00020\u000eH\u0016R\u001b\u0010\u0007\u001a\u00020\b8BX\u0082\u0084\u0002\u00a2\u0006\f\n\u0004\b\u000b\u0010\f\u001a\u0004\b\t\u0010\n\u00a8\u0006\u0010"}, d2 = {"Lcom/zhuorui/securities/applib2/mvp/MarketTabVmWarpper;", "Lcom/zhuorui/securities/base2app/mvp/wrapper/BaseViewWrapper;", "Lcom/zhuorui/securities/applib2/contract/MarketTabContract$View;", "Lcom/zhuorui/securities/applib2/databinding/FargmentTestsubBinding;", "Lcom/zhuorui/securities/applib2/contract/MarketTabContract$ViewWrapper;", "view", "(Lcom/zhuorui/securities/applib2/contract/MarketTabContract$View;)V", "viewModel", "Lcom/zhuorui/securities/applib2/viewmodel/MarketTabViewModel;", "getViewModel", "()Lcom/zhuorui/securities/applib2/viewmodel/MarketTabViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "onBind", "", "setData", "applib2_debug"}) public final class MarketTabVmWarpper extends com.zhuorui.securities.base2app.mvp.wrapper.BaseViewWrapper<com.zhuorui.securities.applib2.contract.MarketTabContract.View, com.zhuorui.securities.applib2.databinding.FargmentTestsubBinding> implements com.zhuorui.securities.applib2.contract.MarketTabContract.ViewWrapper { private final kotlin.Lazy viewModel$delegate = null; private final com.zhuorui.securities.applib2.viewmodel.MarketTabViewModel getViewModel() { return null; } @java.lang.Override() public void setData() { } @java.lang.Override() public void onBind() { } public MarketTabVmWarpper(@org.jetbrains.annotations.NotNull() com.zhuorui.securities.applib2.contract.MarketTabContract.View view) { super(); } }
d60dbebc4d489da2aa254beb2fe7d28072f6b912
c992cc664787167313fb4d317f172e8b057b1f5b
/modules/ui-widgets/src/main/java/io/jmix/ui/widgets/client/addons/dragdroplayouts/ui/VDDLayoutStateDragImageProvider.java
6ebb845d868efb5a49367874d1eb79b218d0fdd2
[ "Apache-2.0" ]
permissive
alexbudarov/jmix
42628ce00a2a67bac7f4113a7e642d5a67c38197
23272dc3d6cb1f1a9826edbe888b3c993ab22d85
refs/heads/master
2020-12-19T15:57:38.886284
2020-01-23T10:06:16
2020-01-23T10:06:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,687
java
/* * Copyright 2015 John Ahlroos * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package io.jmix.ui.widgets.client.addons.dragdroplayouts.ui; import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.ui.Widget; import io.jmix.ui.widgets.client.addons.dragdroplayouts.ui.interfaces.DDLayoutState; import io.jmix.ui.widgets.client.addons.dragdroplayouts.ui.interfaces.VDragImageProvider; import com.vaadin.client.ComponentConnector; import com.vaadin.client.ConnectorMap; import com.vaadin.client.Util; import com.vaadin.shared.Connector; public class VDDLayoutStateDragImageProvider implements VDragImageProvider { private final DDLayoutState state; public VDDLayoutStateDragImageProvider(DDLayoutState state) { this.state = state; } @Override public Element getDragImageElement(Widget w) { ComponentConnector component = Util.findConnectorFor(w); Connector dragImage = state.referenceImageComponents.get(component); if (dragImage != null) { return ConnectorMap.get(component.getConnection()) .getElement(dragImage.getConnectorId()); } return null; } }
6234549a99532cfff60c0664a2ba5b170d24c478
beb9924aea1950e6d7b5e6843dfe646c707f436b
/src/main/java/com/agency04/sbss/pizza/controller/customer/exception/CustomerErrorResponse.java
5ec7de6e8d07bdb89076d9d90a97d0c0020b6887
[]
no_license
AKristo10/summeragency04
d6d23e77b079692a96f762455eb2a5d375368817
874705fd359df20f975eb5fe05351ed45b1156af
refs/heads/main
2023-07-15T19:30:31.825328
2021-08-27T14:10:12
2021-08-27T14:10:12
387,786,370
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package com.agency04.sbss.pizza.controller.customer.exception; public class CustomerErrorResponse { private int status; private String message; public CustomerErrorResponse(){} public CustomerErrorResponse(int status, String message){ this.status = status; this.message = message; } public int getStatus() { return status; } public String getMessage() { return message; } public void setStatus(int status) { this.status = status; } public void setMessage(String message) { this.message = message; } }
3d6c6cf3d8ecf17ed0af61fcda69e99de0c27a60
aa15679345905da58284e85efd53f9815226fc32
/tarea5/factorialOpotencia.java
15df7e9a01c52a89338872ddd93534791a46260d
[]
no_license
joshuansu0897/Estructura-de-Datos
cf5e3c0ddf4374e3aa90d157fdaeb33e219616c0
6b5a7928fb4905cc85967ad9c208b51a7b4a9d3e
refs/heads/master
2021-01-13T07:06:35.485974
2017-05-18T21:39:50
2017-05-18T21:39:50
81,613,684
0
0
null
null
null
null
UTF-8
Java
false
false
1,183
java
import java.util.Scanner; class factorialOpotencia{ static String seguir = "si"; public static void main(String[] args) { Scanner sc = new Scanner(System.in); if (seguir.equals("si")) { System.out.println("Que quieres hacer?(1.-Factorial 2.-Potencia)"); int hacer = sc.nextInt(); if (hacer == 1) { System.out.println("Dame el numero al cual se aplicara el Factorial"); int num = sc.nextInt(); System.out.println(factorial(num)); }else{ System.out.println("Dame el numero al cual se aplicara la potencia"); int num = sc.nextInt(); System.out.println("Dame la potencia"); int pot = sc.nextInt(); System.out.println(potencia(num,pot)); } System.out.println("Que quieres hacer mas operaciones? (si no)"); seguir = sc.next(); System.out.println(); main(args); } } static int factorial(int n){ if (n == 1) { return n; }else{ return n * factorial(n-1); } } static int tot = 1; static int potencia(int n, int p){ if (p == 0) { return tot; }else{ tot *= n; return potencia(n,(p-1)); } } }
ecc974bfce304727ff01062bcad50d1720866487
3bdc07c6307bb26ab18c5a6f177991b28627ee32
/src/main/java/it/unibz/inf/dis/network/components/OffsetEntry.java
31562a1c661fcb6d9a6eb503c29d2db3dbf8de46
[]
no_license
markusin/sasa2gtfs
ad143f9b6388559deb1310163799c864f508beba
b91dc17a248c7e42bfbfb96f0989ac596d00d886
refs/heads/master
2021-01-15T13:36:51.851784
2012-11-14T15:22:51
2012-11-14T15:22:51
2,604,848
0
0
null
null
null
null
UTF-8
Java
false
false
837
java
/** * */ package it.unibz.inf.dis.network.components; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; /** * * <p>The <code>OffsetEntry</code> class</p> * <p>Copyright: 2006 - 2009 <a href="http://www.inf.unibz.it/dis">Dis Research Group</a></p> * <p> Domenikanerplatz - Bozen, Italy.</p> * <p> </p> * @author <a href="mailto:[email protected]">Markus Innerebner</a>. * @version 2.2 */ public class OffsetEntry { SortedSet<Integer> busNodeIds = new TreeSet<Integer>(); double offset; public OffsetEntry(double offset) { this.offset = offset; } public void addBusNodeId(int busNodeId){ busNodeIds.add(busNodeId); } public Set<Integer> getAllBusNodeIds() { return busNodeIds; } public double getOffset() { return offset; } }
234087b4f11fefc1e8f357bf6da315ab944a8ebb
3f3d9f9eb25adfd1732fc01be6d9686b458b8939
/src/main/java/com/sqlva/springboot/po/Person.java
26ba6275ef96b77e4de83433fad3b9c21cbda8d2
[]
no_license
lvshtwl/spring_boot
584b51e8079f0af96364d73689acba4d5b4d4cf7
d23cfbc70c1fc700bc08978a3712bcfe6a850058
refs/heads/master
2022-06-28T16:13:00.011700
2019-07-10T07:09:01
2019-07-10T07:09:01
192,478,497
0
0
null
2022-06-21T01:18:10
2019-06-18T06:23:24
Java
UTF-8
Java
false
false
898
java
package com.sqlva.springboot.po; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity @Data @NoArgsConstructor public class Person { @Id @GeneratedValue private int id; @Column(nullable = false) private String name; @Column(nullable = false) private int age; public Person(String name, int age) { this.name = name; this.age = age; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } }
42694ce194f170acab6819869cfb6ec1078ad827
36fb18b00fcef0a2ddadada6ff90d4c460f32f72
/Chapter10/src/string/StringTest.java
945abb12e0b3712fb00fc6ec8de5a7dd331778c7
[]
no_license
seokjinjeong-cod/Java_basic
926c894702c303c1dfc833ef4264fca5f2456ac0
adbb4662d01f5b3291e504fee2b71a575383557a
refs/heads/main
2023-07-01T15:02:07.376111
2021-08-03T14:49:27
2021-08-03T14:49:27
387,075,154
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
package string; public class StringTest { public static void main(String[] args) { String str1 = new String("abc"); String str2 = new String("abc"); System.out.println(str1 == str2); String str3 = "abc"; String str4 = "abc"; System.out.println(str3 == str4); } }
b9cfdb596a4bfb3e7665b9e43c2e01803f112576
f69a98535e5d331eda3ea400b7020eca30e2521f
/src/main/java/com/gubko/blog/controllers/BlogController.java
93a8eb5ba026531f61d9d1b21044d962ce7009e6
[]
no_license
Sergeibest/blog
0a73888cf7671e5d980595bda7df4ac754f75bb2
867a0aa2a216019aa81f95911e004a6fda5aa590
refs/heads/master
2023-04-28T19:35:31.461404
2021-05-26T13:15:53
2021-05-26T13:15:53
264,412,991
0
0
null
2021-05-23T17:01:30
2020-05-16T10:31:20
HTML
UTF-8
Java
false
false
5,199
java
package com.gubko.blog.controllers; import com.gubko.blog.models.Post; import com.gubko.blog.repo.PostRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.ArrayList; import java.util.Optional; @Controller /*это анотоция*/ public class BlogController { /*создаем перемунную которая будетссылаться на репозиторий PostRepository созадее эту переменную через Autowired * */ @Autowired private PostRepository postRepository; @GetMapping("/") /*Если мы хотим чтобы запрос обрабатывал информацию с главной страницы оставляем просто "/" */ public String home(Model model) { model.addAttribute("title", "Главная страница"); /*Тут указываем имя параметра который будет передан в шаблон*/ return "main-page"; } @GetMapping("/about") public String about(Model model) { model.addAttribute("title", "Cтраница про нас "); return "about"; } @GetMapping("/blog") /*Это нужно для того чтобы отслеживать какой - то u - rl адрес*/ public String blogMain(Model model){ Iterable<Post> posts = postRepository.findAll(); /*указываем модель получения данных массив значений которые будут получены из БД*/ model.addAttribute("posts", posts); return "blog-main"; } @GetMapping("/blog/add") public String blogAdd(Model model){ return "blog-add"; } @PostMapping("/blog/add") public String blogPostAdd(@RequestParam String title, @RequestParam String anons, @RequestParam String full_text, Model model){ Post post = new Post(title, anons, full_text); postRepository.save(post); return "redirect:/blog"; } @GetMapping("/login") public String blogLogin(Model model) { return "login"; } /**/ @GetMapping("/blog/{id}")/*Достаем нужный id статьи*/ public String blogDetails( /*анотацией @PathVariable берем динамическое значение из URL адреса и в параметрах указываем какой дин парм принимаем */ @PathVariable(value = "id") long id, Model model) { /*Идем в бд и ищем там нужную нам запись по айди. Помещаем полученый id в объект на оснвое класса * Optional и указываем модель с которой мы будем работать для передачи его в шаблон*/ if (!postRepository.existsById(id)){ return "redirect:/blog"; } Optional<Post> post = postRepository.findById(id); /*Чтобы шаблону было проще работать с объктом Optional<Post> post и не было ошибок переводим(преобразовываем) его в класс ArrayList */ ArrayList<Post> res= new ArrayList<>(); /*Теперь обращаемся к post и говорим что мы сейчас все переводим из класса Optional в ArrayList*/ post.ifPresent(res::add); model.addAttribute("post",res); return "blog-details"; } @GetMapping("/blog/{id}/edit") public String blogEdit(@PathVariable(value = "id") long id, Model model) { if (!postRepository.existsById(id)){ return "redirect:/blog"; } Optional<Post> post = postRepository.findById(id); ArrayList<Post> res= new ArrayList<>(); post.ifPresent(res::add); model.addAttribute("post",res); return "blog-edit"; } @PostMapping("/blog/{id}/edit") public String blogPostUpdate(@PathVariable(value = "id") long id, @RequestParam String title, @RequestParam String anons, @RequestParam String full_text, Model model) { Post post = postRepository.findById(id).orElseThrow(null); /*такая запись потомучто 8-ка не поддерживает метод orElseThrow без аргуменента*/ post.setTitle(title); post.setAnons(anons); post.setFull_text(full_text); postRepository.save(post); return "redirect:/blog"; } @PostMapping("/blog/{id}/remove") public String blogPostDelete(@PathVariable(value = "id") long id, Model model) { Post post = postRepository.findById(id).orElseThrow(null); /*+ еще костыль*/ postRepository.delete(post); return "redirect:/blog"; } }
790b0444935d385c9aaa17fc1fca0f5e1aff53c0
a1b18280bb0593260e8e6c8a30cffb72f55becf0
/GestioneMunicipioSpringJPA/src/it/prova/gestionemunicipiospringjpa/web/servlet/abitante/ExecuteEliminaAbitanteServlet.java
23f27793946fdd163ca2e7f48a7be98b2029aefa
[]
no_license
alemoretto/ws_eclipse
73471ab3421b603b69618a829efd2b85bff4e74b
cb3341f8030a2be4380f5ba09839cb473688e72e
refs/heads/master
2020-05-26T02:23:23.594351
2019-06-19T08:59:33
2019-06-19T08:59:33
188,073,269
1
0
null
null
null
null
UTF-8
Java
false
false
1,826
java
package it.prova.gestionemunicipiospringjpa.web.servlet.abitante; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.context.support.SpringBeanAutowiringSupport; import it.prova.gestionemunicipiospringjpa.service.abitante.AbitanteService; @WebServlet("/ExecuteEliminaAbitanteServlet") public class ExecuteEliminaAbitanteServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Autowired private AbitanteService abitanteService; @Override public void init(ServletConfig config) throws ServletException { super.init(config); SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); } public ExecuteEliminaAbitanteServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getSession().getAttribute("userInfo") == null) { response.sendRedirect(request.getContextPath()); return; } String idAbitanteDaPagina = request.getParameter("idAbitante"); abitanteService.rimuovi(abitanteService.caricaSingoloAbitante(Long.parseLong(idAbitanteDaPagina))); request.setAttribute("listaAbitantiAttributeName", abitanteService.listAllAbitanti()); RequestDispatcher rd = request.getRequestDispatcher("/abitante/result.jsp"); rd.forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }
fa3d70f90146a6071a73ce1393826f5fa3a183a6
aba70bcb50dceea88ada5878ec13bef49ffd390a
/src/main/java/com/timaar/tiimspot/web/rest/AuditResource.java
62ec79b70bc8227ca3d8a5ecdf1c4f1beb1d3bd5
[]
no_license
timaar/Tiimspot
70b37e29d9c1524f8824437b34b8aec161c9b018
bf1e4d5289d44c359f70387eb8d5d072fadf0c4f
refs/heads/master
2021-01-25T10:44:07.249233
2015-12-27T08:41:41
2015-12-27T08:41:41
22,459,655
0
1
null
2020-09-18T12:27:28
2014-07-31T06:57:09
Java
UTF-8
Java
false
false
1,774
java
package com.timaar.tiimspot.web.rest; import com.timaar.tiimspot.service.AuditEventService; import java.time.LocalDate; import org.springframework.boot.actuate.audit.AuditEvent; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import javax.inject.Inject; import java.util.List; /** * REST controller for getting the audit events. */ @RestController @RequestMapping(value = "/api/audits", produces = MediaType.APPLICATION_JSON_VALUE) public class AuditResource { private AuditEventService auditEventService; @Inject public AuditResource(AuditEventService auditEventService) { this.auditEventService = auditEventService; } @RequestMapping(method = RequestMethod.GET) public List<AuditEvent> getAll() { return auditEventService.findAll(); } @RequestMapping(method = RequestMethod.GET, params = {"fromDate", "toDate"}) public List<AuditEvent> getByDates( @RequestParam(value = "fromDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate fromDate, @RequestParam(value = "toDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate toDate) { return auditEventService.findByDates(fromDate.atTime(0, 0), toDate.atTime(23, 59)); } @RequestMapping(value = "/{id:.+}", method = RequestMethod.GET) public ResponseEntity<AuditEvent> get(@PathVariable Long id) { return auditEventService.find(id) .map((entity) -> new ResponseEntity<>(entity, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); } }
a87b90e3680bfdb5f784a153bcd936ad52c37586
120db99aa3f3d817ea575e3acb206c7ddf5c1287
/jthinker/src/oss/jthinker/util/UPair.java
d9d2c9ea7b5372170fe4984c984c146dc30221af
[]
no_license
ShakirrIsmail/jthinker
e1a0312783ba733e131eaa022987361fae1278b2
a6029cb24ba028dd3861d2f1fc6c173501f7b9e5
refs/heads/master
2021-01-21T10:38:43.096657
2010-12-01T20:09:06
2010-12-01T20:09:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,972
java
/* * Copyright (c) 2009, Ivan Appel <[email protected]> * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of Ivan Appel nor the names of any other jThinker * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package oss.jthinker.util; /** * Pair of objects of same uniform type. * * @author iappel * @param T type of both objects */ public class UPair<T> extends Pair<T,T> { /** * Creates a new UPair instance. * * @param a first object of the pair * @param b second object of the pair */ public UPair(T a, T b) { super(a,b); } }
450b3453d9321c5c5e6004b5c1a4eb28cd2e93c7
6f8da9300b274e10b04c0eff01e9e235b5311465
/Server/Game/Game-excel/src/main/java/com/su/excel/mapper/ContestRewardConf.java
7dfd6e0048d36fc477f1bb581e0ae572b7e0d26a
[]
no_license
husu09/510K
a03d26dc279bc991d56da2bd7bf96892f28448c1
a6931bd715ceadff773c03e5da353055bc9c69eb
refs/heads/master
2023-01-11T23:42:05.061516
2023-01-10T09:14:41
2023-01-10T09:14:41
147,209,842
5
1
null
null
null
null
UTF-8
Java
false
false
529
java
package com.su.excel.mapper; import org.springframework.stereotype.Component; import com.su.config.ContestRewardCo; import com.su.excel.core.BaseMapper; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import java.util.LinkedHashMap; ///start ///end @Component public class ContestRewardConf extends BaseMapper<ContestRewardCo> { @Override public void mapper(String str) { storageMap = JSON.parseObject(str, new TypeReference<LinkedHashMap<Integer, ContestRewardCo>>(){}); } ///start ///end }
b6cd0418719f18dc23c1deea4c8b6ad782419396
dfac1eb4ac647b96f311a7cdd07dec558a209bd6
/src/com/zjxjwxk/leetcode/_0725_Split_Linked_List_in_Parts/SolutionTest.java
60015720b0cd8cedfe38c0753108339d42b5a195
[]
no_license
zjxjwxk/LeetCode
7f8e91edb23b24bbedbff6cca49c32e4e3bd78bf
99a8a17fa1417b066bbd204ab7170fdcb5295532
refs/heads/master
2023-08-25T18:46:11.137419
2023-08-15T08:10:45
2023-08-15T08:10:45
141,663,719
0
0
null
null
null
null
UTF-8
Java
false
false
1,267
java
package com.zjxjwxk.leetcode._0725_Split_Linked_List_in_Parts; import com.zjxjwxk.leetcode.util.DSFactory; import com.zjxjwxk.leetcode.util.ListNode; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class SolutionTest { private final Solution solution = new Solution(); @Test void splitListToParts1() { ListNode head = DSFactory.newLinkedList(new int[]{ 1, 2, 3 }); int k = 5; ListNode[] ans = { DSFactory.newLinkedList(new int[]{1}), DSFactory.newLinkedList(new int[]{2}), DSFactory.newLinkedList(new int[]{3}), null, null }; assertArrayEquals(ans, solution.splitListToParts(head, k)); } @Test void splitListToParts2() { ListNode head = DSFactory.newLinkedList(new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); int k = 3; ListNode[] ans = { DSFactory.newLinkedList(new int[]{1, 2, 3, 4}), DSFactory.newLinkedList(new int[]{5, 6 ,7}), DSFactory.newLinkedList(new int[]{8, 9, 10}) }; assertArrayEquals(ans, solution.splitListToParts(head, k)); } }
7fa2d87e694f43723e4eed32b7aec58b36a2601c
1bb550a0bf75b6725e1988b860db5489ec7ee88d
/Tactical DDD/src/main/java/com/juancarlosmaya/videogame/events/UpdatedPlattform.java
e417b3187c910e0a8e3a0f0187270b1aa2893a18
[]
no_license
maxdarkx/DomainModel
b8aed65ed8da95e16b27db1b316426de05383925
6ec8bb3a2460f0926b5d2ae9f2bf00306288c457
refs/heads/master
2023-08-19T23:11:17.796358
2021-10-01T21:35:08
2021-10-01T21:35:08
411,467,303
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
package com.juancarlosmaya.videogame.events; import co.com.sofka.domain.generic.DomainEvent; import com.juancarlosmaya.videogame.Plattform; public class UpdatedPlattform extends DomainEvent { private final Plattform plattform; public UpdatedPlattform(Plattform plattform) { super("com.juancarlosmaya.videogame.plattform"); this.plattform = plattform; } public Plattform getPlattform() { return plattform; } }
8252553a72b8f04543f08a9a0de03e7647b79ebf
7659f30bb518a13511b1d60506feeb7d60b5d584
/V1.0/GAJenes/src/jenes/performance/TSPMutator.java
2665ed64f4b98616c52494bf7e80856ce3f04a22
[]
no_license
ironau/umucswen67090411302ga
f4ab720d0779090ce4d2916f51debb03843310c1
b3cd1ee51e446276be82d4859c7021d2565229fe
refs/heads/master
2020-05-18T16:56:09.197250
2013-04-29T00:43:15
2013-04-29T00:43:15
33,217,928
0
0
null
null
null
null
UTF-8
Java
false
false
2,549
java
/* * JENES * A time and memory efficient Java library for genetic algorithms and more * Copyright (C) 2011 Intelligentia srl * * 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 3 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, see <http://www.gnu.org/licenses/>. */ package jenes.performance; import java.util.Vector; import jenes.chromosome.IntegerChromosome; import jenes.population.Individual; import jenes.stage.operator.Mutator; public class TSPMutator extends Mutator<IntegerChromosome> { public TSPMutator(double probability) { super(probability); } @Override protected void mutate(Individual<IntegerChromosome> t) { IntegerChromosome chrom = t.getChromosome(); int size = chrom.length(); if (this.random.nextBoolean(0.5)) { //swap only one time chrom.swap(this.random.nextInt(size), this.random.nextInt(size)); } else { Vector<Integer> v = new Vector<Integer>(); for (int i = 0; i < size; i++) { v.add(chrom.getValue(i)); } int nNodes = this.random.nextInt(size / 2); int[] tmp = new int[nNodes]; int startPos = this.random.nextInt(size); for (int i = 0; i < nNodes; i++) { tmp[i] = v.remove(startPos); if (v.size() == startPos) { startPos = 0; } } boolean invert = this.random.nextBoolean(0.5); int insertPos = this.random.nextInt(size - nNodes + 1); for (int i = 0; i < nNodes; i++) { int pos = invert ? i : nNodes - 1 - i; v.add(insertPos, tmp[pos]); } for (int i = 0; i < size; i++) { chrom.setValue(i, v.get(i)); } } } @Override public void processProperties(String props) { log.info("recieve properties\n"+props); } }
[ "[email protected]@50fe83e0-5da2-2d17-a276-8fefdb4a6be4" ]
[email protected]@50fe83e0-5da2-2d17-a276-8fefdb4a6be4
2ee2521fcaaacebe5a0db1a861a0b5f5c4a4357d
fbe207a6bd56124025bdaaed3108e6c8a62aaa33
/kodilla-hibernate/src/test/java/com/kodilla/hibernate/task/dao/TaskDaoTestSuite.java
7b269306f80b8a917c3beb545aa0a5a8f6345c31
[]
no_license
Ewcia100/kodilla-hibernate
eb5258e4b693dea858f14c783bbc8d550e1cf4d3
f56f1ba8d1eb3d8944d087f6eafbb09107b6adf8
refs/heads/master
2021-05-13T16:37:15.270662
2018-01-11T10:21:37
2018-01-11T10:21:37
116,798,082
0
1
null
null
null
null
UTF-8
Java
false
false
1,838
java
package com.kodilla.hibernate.task.dao; import com.kodilla.hibernate.task.Task; import com.kodilla.hibernate.task.TaskFinancialDetails; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.math.BigDecimal; import java.util.List; @RunWith(SpringRunner.class) @SpringBootTest public class TaskDaoTestSuite { @Autowired private TaskDao taskDao; private static final String DESCRIPTION = "Test: Learn Hibernate"; @Test public void testTaskDaoSave() { //Given Task task = new Task(DESCRIPTION, 7); //When taskDao.save(task); //Then int id = task.getId(); Task readTask = taskDao.findOne(id); Assert.assertEquals(id, readTask.getId()); //CleanUp taskDao.delete(id); } @Test public void testTaskDaoFindByDuration() { //Given Task task = new Task(DESCRIPTION, 7); taskDao.save(task); int duration = task.getDuration(); //When List<Task> readTasks = taskDao.findByDuration(duration); //Then Assert.assertEquals(1, readTasks.size()); //CleanUp int id = readTasks.get(0).getId(); taskDao.delete(id); } @Test public void testTaskDaoSaveWithFinancialDetails() { //Given Task task = new Task(DESCRIPTION, 30); task.setTaskFinancialDetails(new TaskFinancialDetails(new BigDecimal(120), false)); //When taskDao.save(task); int id = task.getId(); //Then Assert.assertNotEquals(0, id); //CleanUp taskDao.delete(id); } }
94a082db26a8ce482eac161e786e52333c7ea134
7c0d6596e7c67d8cc0ee36f0be6db6fb9300de31
/jpa2-template/src/main/java/pro/jpa2/util/Resources.java
16320edf68dabf2377f252856d7ddfb57dbc38c4
[]
no_license
TheSide/jpa
fc63b867dc21d5afd92a8a1c1802c771fbe416c2
4c192bf56129a4f8dfb215a764a55df14088820b
refs/heads/master
2021-05-26T18:16:49.047894
2013-11-01T19:27:26
2013-11-01T19:27:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
923
java
package pro.jpa2.util; import javax.enterprise.inject.Produces; import javax.enterprise.inject.spi.InjectionPoint; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.criteria.CriteriaBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This class uses CDI to alias Java EE resources, such as the persistence context, to CDI beans * * <p> * Example injection on a managed bean field: * </p> * * <pre> * &#064;Inject * private EntityManager em; * </pre> */ public class Resources { @Produces @PersistenceContext private EntityManager em; @Produces public CriteriaBuilder produceCriteriaBuilder(){ return em.getCriteriaBuilder(); } @Produces public Logger produceLog(InjectionPoint injectionPoint) { return LoggerFactory.getLogger(injectionPoint.getMember().getDeclaringClass().getName()); } }
45361b61956e471b8324f7a8b63c17028d61bb38
a7d16c916baa1c935448112990d9900960ca62e9
/src/main/java/io/github/gandrade/domain/AbstractAuditingEntity.java
295b80a01df0ee086501a3cec2bf9fe650c9a8c0
[]
no_license
gandrade/book-excerpts-complete
8e6888e41eb93aced80458c393cc04da2e58469d
0db2ae2e55730d6b1174d4ba59c67de194413427
refs/heads/master
2021-01-10T11:13:48.397345
2016-04-06T14:41:11
2016-04-06T14:41:11
51,659,810
1
0
null
null
null
null
UTF-8
Java
false
false
2,340
java
package io.github.gandrade.domain; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.envers.Audited; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import java.time.ZonedDateTime; import javax.persistence.Column; import javax.persistence.EntityListeners; import javax.persistence.MappedSuperclass; import javax.validation.constraints.NotNull; /** * Base abstract class for entities which will hold definitions for created, last modified by and created, * last modified by date. */ @MappedSuperclass @Audited @EntityListeners(AuditingEntityListener.class) public abstract class AbstractAuditingEntity implements Serializable { private static final long serialVersionUID = 1L; @CreatedBy @NotNull @Column(name = "created_by", nullable = false, length = 50, updatable = false) @JsonIgnore private String createdBy; @CreatedDate @NotNull @Column(name = "created_date", nullable = false) @JsonIgnore private ZonedDateTime createdDate = ZonedDateTime.now(); @LastModifiedBy @Column(name = "last_modified_by", length = 50) @JsonIgnore private String lastModifiedBy; @LastModifiedDate @Column(name = "last_modified_date") @JsonIgnore private ZonedDateTime lastModifiedDate = ZonedDateTime.now(); public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public ZonedDateTime getCreatedDate() { return createdDate; } public void setCreatedDate(ZonedDateTime createdDate) { this.createdDate = createdDate; } public String getLastModifiedBy() { return lastModifiedBy; } public void setLastModifiedBy(String lastModifiedBy) { this.lastModifiedBy = lastModifiedBy; } public ZonedDateTime getLastModifiedDate() { return lastModifiedDate; } public void setLastModifiedDate(ZonedDateTime lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } }
72f86fbdb5af764763e5b6442d2368328d652afd
345cf2be940c4be27b2eb276947dba6160d62723
/dynamic_problems/power_set/string/Solution.java
39e4a1d1f39304206659043fc99144cbdc62e62e
[]
no_license
shivamGo/competitive_programming
27660d9811863c3aebc6b3cf9ca2af2e40af4761
4876f7ced63afaa5e45d54ec676bd8efe4e5d5e1
refs/heads/master
2021-09-02T15:34:27.486795
2018-01-03T12:16:55
2018-01-03T12:16:55
107,716,649
0
1
null
null
null
null
UTF-8
Java
false
false
1,118
java
package dynamic_problems.power_set.string; import java.util.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = Integer.parseInt(in.nextLine()); while(t-- > 0){ int n = Integer.parseInt(in.nextLine()); char[] pat = in.nextLine().toCharArray(); List<String> sets = new ArrayList<>(); solve(pat, sets); Collections.sort(sets); for(String p : sets){ System.out.print(p + " "); } System.out.println(); } } public static void solve(char[] chs, List<String> treeSet){ int max = 1 << chs.length; for(int i = 1; i < max; i++){ String e = setElement(chs, i); treeSet.add(e); } } private static String setElement(char[] chs, int i) { String p = ""; int idx = 0; for(int k = i; k > 0; k = k >> 1){ if((k & 1) == 1){ p += chs[idx]; } idx++; } return p; } }
57a2dc8754a788232ccada3848fb7d55f95994b2
14c8d94f294d8a8eadebdd4e384d1ba8d74448b0
/Log/Log/src/main/java/com/example/demo/LogApplication.java
c88e2459cc7dbfac1eaf19d01e4e009e9aa766e0
[]
no_license
lordsonfernando/InventoryManagement-SPB
4b7f9214f4aa80fc88d649bc179edd0532df6039
ceb0dec5461cdafc1e2cd3aea0a787746840a65f
refs/heads/main
2023-04-03T03:44:49.958356
2021-04-14T14:12:51
2021-04-14T14:12:51
357,928,325
0
0
null
null
null
null
UTF-8
Java
false
false
1,268
java
package com.example.demo; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.ComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import controller.LogController; import model.LogFile; import model.MaterialsLog; import model.User; @SpringBootApplication @ComponentScan(basePackageClasses = LogController.class) @EnableJpaRepositories("repository") //@EntityScan(basePackageClasses = MaterialsLog.class) @EntityScan(basePackageClasses = LogFile.class) /** * Material Log Application * * * @author VK5061978 * */ public class LogApplication { public static void main(String[] args) { SpringApplication.run(LogApplication.class, args); System.out.println("Working......."); Date objDate=new Date(); String strDateFormat="hh:mm:ss"; DateFormat dte =new SimpleDateFormat(strDateFormat); String fdate = dte.format(objDate); //DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.ENGLISH).toFormat(date); System.out.println(fdate); } }
977cffd0e131784a4a669366840fe066f0ac730e
d612fb7464251048ea4e156c8438a08b94b99997
/lab8-begin/src/main/java/jwd/wafepa/repository/UserRepository.java
5d34a21ed6c132be4abb2b8d78af572440ff2270
[]
no_license
aljosalukic/wafepa
fb3520b320e9b72a00b476a77d17b953a9ba6eb5
c2ad6cbe2ec4d941438b8374f6e5945926ccc0ba
refs/heads/master
2021-01-22T05:57:20.422848
2017-05-26T12:38:47
2017-05-26T12:38:47
92,508,990
0
0
null
null
null
null
UTF-8
Java
false
false
630
java
package jwd.wafepa.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import jwd.wafepa.model.Activity; import jwd.wafepa.model.User; @Repository public interface UserRepository extends PagingAndSortingRepository<User, Long> { //@Query("select u from User u where u.first_name = :name") //List<User> findByName(@Param("name") String name); }
92a71b95b816b9dcc46399e57daab61996c7b85a
c06a866299bd0c1b69b5e455a9d59473dd36d67c
/leetcode/src/code2019/code19_7/code23_96/UniqueBinarySearchTrees.java
54790ca1a0948ec1f25357e1c0ed6b44c0bd0b55
[]
no_license
zhangjingao/algorithm
88efeedc88102b53a158c35bed25e46e06ffbbf8
97e4bc939ec4b72fb87b0fe4d9ba927313d1dce4
refs/heads/master
2020-03-25T06:11:54.378524
2019-10-13T11:58:06
2019-10-13T11:58:06
143,488,632
2
0
null
null
null
null
UTF-8
Java
false
false
486
java
package code23_96; /** * @author zjg * @ClassName UniqueBinarySearchTrees * @Description TODO * @Date 2019/7/23 17:01 **/ public class UniqueBinarySearchTrees { public int numTrees(int n) { int[] dp = new int[n+1]; dp[0] = 1; dp[1] = 1; for(int i = 2; i < n + 1; i++) { for(int j = 1; j < i + 1; j++) { dp[i] += dp[j-1] * dp[i-j]; } } return dp[n]; } }
a08d648c690a90b65fd51903e321691b9412723d
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipsejdt_cluster/6225/tar_0.java
051f1be691ea67e59aaa93da707c0d39960fcf4f
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
52,170
java
/******************************************************************************* * Copyright (c) 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.core.tests.model; import java.lang.reflect.Method; import org.eclipse.jdt.core.*; import org.eclipse.jdt.internal.codeassist.RelevanceConstants; import junit.framework.*; public class JavadocCompletionContextTests extends AbstractJavaModelCompletionTests implements RelevanceConstants { public JavadocCompletionContextTests(String name) { super(name); } public void setUpSuite() throws Exception { if (COMPLETION_PROJECT == null) { COMPLETION_PROJECT = setUpJavaProject("Completion", "1.4"); } else { setUpProjectCompliance(COMPLETION_PROJECT, "1.4"); } super.setUpSuite(); } public void tearDownSuite() throws Exception { super.tearDownSuite(); } public static Test suite() { TestSuite suite = new Suite(JavadocCompletionContextTests.class.getName()); if (true) { Class c = JavadocCompletionContextTests.class; Method[] methods = c.getMethods(); for (int i = 0, max = methods.length; i < max; i++) { if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$ suite.addTest(new JavadocCompletionContextTests(methods[i].getName())); } } return suite; } suite.addTest(new JavadocCompletionContextTests("test0050")); return suite; } public void test0001() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0001/X.java", "package test0001;\n" + "/**\n" + " * @see ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0002() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0002/X.java", "package test0002;\n" + "/**\n" + " * @see ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0003() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0003/X.java", "package test0003;\n" + "/**\n" + " * @see ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0004() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0004/X.java", "package test0004;\n" + "/**\n" + " * @see \n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("@see ") + "@see ".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("@see ") + "@see ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0005() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0005/X.java", "package test0005;\n" + "/**\n" + " * @see X.ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0006() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0006/X.java", "package test0006;\n" + "/**\n" + " * @see X.ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0007() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0007/X.java", "package test0007;\n" + "/**\n" + " * @see X.ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0008() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0008/X.java", "package test0008;\n" + "/**\n" + " * @see X.\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("X.") + "X.".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("X.") + "X.".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0009() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0009/X.java", "package test0009;\n" + "/**\n" + " * @see test0009.ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0010() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0010/X.java", "package test0010;\n" + "/**\n" + " * @see test0010.ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0011() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0011/X.java", "package test0011;\n" + "/**\n" + " * @see test0011.ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0012() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0012/X.java", "package test0012;\n" + "/**\n" + " * @see test0012.\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("test0012.") + "test0012.".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("test0012.") + "test0012.".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0013() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0013/X.java", "package test0013;\n" + "/**\n" + " * @see #ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0014() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0014/X.java", "package test0014;\n" + "/**\n" + " * @see #ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0015() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0015/X.java", "package test0015;\n" + "/**\n" + " * @see #ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0016() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0012/X.java", "package test0016;\n" + "/**\n" + " * @see #\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("#") + "#".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("#") + "#".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0017() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0017/X.java", "package test0017;\n" + "/**\n" + " * @see X#ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0018() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0018/X.java", "package test0018;\n" + "/**\n" + " * @see X#ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0019() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0019/X.java", "package test0019;\n" + "/**\n" + " * @see X#ZZZZ\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0020() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0020/X.java", "package test0020;\n" + "/**\n" + " * @see X#\n" + " */\n" + "public class X {\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("#") + "#".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("#") + "#".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0021() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0021/X.java", "package test0021;\n" + "/**\n" + " * @see X#foo(ZZZZ\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0022() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0022/X.java", "package test0022;\n" + "/**\n" + " * @see X#foo(ZZZZ\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0023() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0023/X.java", "package test0023;\n" + "/**\n" + " * @see X#foo(ZZZZ\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0024() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0024/X.java", "package test0024;\n" + "/**\n" + " * @see X#foo(\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("#foo(") + "#foo(".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("#foo(") + "#foo(".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0025() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0025/X.java", "package test0025;\n" + "/**\n" + " * @see X#foo(Object ZZZZ\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0026() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0026/X.java", "package test0026;\n" + "/**\n" + " * @see X#foo(Object ZZZZ\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0027() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0027/X.java", "package test0027;\n" + "/**\n" + " * @see X#foo(Object ZZZZ\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0028() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0028/X.java", "package test0028;\n" + "/**\n" + " * @see X#foo(Object \n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("#foo(Object ") + "#foo(Object ".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("#foo(Object ") + "#foo(Object ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0029() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0029/X.java", "package test0029;\n" + "/**\n" + " * @see X#foo(Object a,ZZZZ\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0030() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0030/X.java", "package test0030;\n" + "/**\n" + " * @see X#foo(Object a,ZZZZ\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0031() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0031/X.java", "package test0031;\n" + "/**\n" + " * @see X#foo(Object a,ZZZZ\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0032() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0032/X.java", "package test0032;\n" + "/**\n" + " * @see X#foo(Object a,\n" + " */\n" + "public class X {\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("#foo(Object a,") + "#foo(Object a,".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("#foo(Object a,") + "#foo(Object a,".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0033() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0033/X.java", "package test0033;\n" + "/**\n" + " * @see X#X(ZZZZ\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0034() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0034/X.java", "package test0034;\n" + "/**\n" + " * @see X#X(ZZZZ\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0035() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0035/X.java", "package test0035;\n" + "/**\n" + " * @see X#X(ZZZZ\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0036() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0036/X.java", "package test0036;\n" + "/**\n" + " * @see X#X(\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("#X(") + "#X(".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("#X(") + "#X(".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0037() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0037/X.java", "package test0037;\n" + "/**\n" + " * @see X#X(Object ZZZZ\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0038() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0038/X.java", "package test0038;\n" + "/**\n" + " * @see X#X(Object ZZZZ\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0039() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0039/X.java", "package test0039;\n" + "/**\n" + " * @see X#X(Object ZZZZ\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0040() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0040/X.java", "package test0040;\n" + "/**\n" + " * @see X#X(Object \n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("#X(Object ") + "#X(Object ".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("#X(Object ") + "#X(Object ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0041() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0041/X.java", "package test0041;\n" + "/**\n" + " * @see X#X(Object a,ZZZZ\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0042() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0042/X.java", "package test0042;\n" + "/**\n" + " * @see X#X(Object a,ZZZZ\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0043() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0043/X.java", "package test0043;\n" + "/**\n" + " * @see X#X(Object a,ZZZZ\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0044() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0044/X.java", "package test0044;\n" + "/**\n" + " * @see X#X(Object a,\n" + " */\n" + "public class X {\n" + " public X(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("#X(Object a,") + "#X(Object a,".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("#X(Object a,") + "#X(Object a,".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0045() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0045/X.java", "package test0045;\n" + "public class X {\n" + " /**\n" + " * @param ZZZZ\n" + " */\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0046() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0046/X.java", "package test0046;\n" + "public class X {\n" + " /**\n" + " * @param ZZZZ\n" + " */\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0047() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0047/X.java", "package test0047;\n" + "public class X {\n" + " /**\n" + " * @param ZZZZ\n" + " */\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("ZZZZ"); int tokenEnd = tokenStart + "ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0048() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0048/X.java", "package test0048;\n" + "public class X {\n" + " /**\n" + " * @param \n" + " */\n" + " public void foo(Object a, Object b){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("@param ") + "@param ".length(); int tokenEnd = tokenStart + "".length() - 1; int cursorLocation = str.lastIndexOf("@param ") + "@param ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0049() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0049/X.java", "package test0049;\n" + "public class X {\n" + " /**\n" + " * @ZZZZ\n" + " */\n" + " public void foo(){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("@ZZZZ"); int tokenEnd = tokenStart + "@ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"@ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0050() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0050/X.java", "package test0050;\n" + "public class X {\n" + " /**\n" + " * @ZZZZ\n" + " */\n" + " public void foo(){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("@ZZZZ"); int tokenEnd = tokenStart + "@ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"@\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0051() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0051/X.java", "package test0051;\n" + "public class X {\n" + " /**\n" + " * @ZZZZ\n" + " */\n" + " public void foo(){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("@ZZZZ"); int tokenEnd = tokenStart + "@ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"@ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0052() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0052/X.java", "package test0052;\n" + "public class X {\n" + " /**\n" + " * @\n" + " */\n" + " public void foo(){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("@"); int tokenEnd = tokenStart + "@".length() - 1; int cursorLocation = str.lastIndexOf("@") + "@".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"@\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0053() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0053/X.java", "package test0053;\n" + "public class X {\n" + " /**\n" + " * blabla @ZZZZ\n" + " */\n" + " public void foo(){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("@ZZZZ"); int tokenEnd = tokenStart + "@ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"@ZZZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0054() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0054/X.java", "package test0054;\n" + "public class X {\n" + " /**\n" + " * blabla @ZZZZ\n" + " */\n" + " public void foo(){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("@ZZZZ"); int tokenEnd = tokenStart + "@ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ"); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"@\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0055() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0055/X.java", "package test0055;\n" + "public class X {\n" + " /**\n" + " * blabla @ZZZZ\n" + " */\n" + " public void foo(){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("@ZZZZ"); int tokenEnd = tokenStart + "@ZZZZ".length() - 1; int cursorLocation = str.lastIndexOf("ZZZZ") + "ZZ".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"@ZZ\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } public void test0056() throws JavaModelException { this.workingCopies = new ICompilationUnit[1]; this.workingCopies[0] = getWorkingCopy( "/Completion/src3/test0056/X.java", "package test0056;\n" + "public class X {\n" + " /**\n" + " * blabla @\n" + " */\n" + " public void foo(){}\n" + "}"); String str = this.workingCopies[0].getSource(); int tokenStart = str.lastIndexOf("@"); int tokenEnd = tokenStart + "@".length() - 1; int cursorLocation = str.lastIndexOf("@") + "@".length(); CompletionResult result = contextComplete(this.workingCopies[0], cursorLocation); assertResults( "completion offset="+(cursorLocation)+"\n" + "completion range=["+(tokenStart)+", "+(tokenEnd)+"]\n" + "completion token=\"@\"\n" + "completion token kind=TOKEN_KIND_NAME\n" + "expectedTypesSignatures=null\n" + "expectedTypesKeys=null", result.context); } }
4a3c59e72aedc0664324f36c3fb8c0cbfc3d1127
9a8855d2eb7c987e819daa730edf8f4605be5ab8
/DesignPatterns/src/creational/factorypattern/factory/operatingsystem/OperatingSytemFactory.java
f9049705d56ed631616429d4d9762387fb12180d
[]
no_license
zimrancis/workspace-18-Dec-2019
c837696f8b4937dcefb0a6a8f116bad312a257af
a1e2355b8dfef5f1b29d1ecfd7a5ebd810a744b1
refs/heads/master
2022-12-31T21:48:00.515697
2020-07-13T08:25:49
2020-07-13T08:25:49
279,241,738
0
0
null
2020-10-13T23:31:45
2020-07-13T08:26:25
CSS
UTF-8
Java
false
false
521
java
package creational.factorypattern.factory.operatingsystem; import creational.factorypattern.factory.os.OS; import creational.factorypattern.factory.os.android.Android; import creational.factorypattern.factory.os.ios.IOS; import creational.factorypattern.factory.os.windows.Windows; public class OperatingSytemFactory { public OS getInstance(String str) { if (str.equals("Open")) return new Android(); else if (str.equals("Closed")) return new IOS(); else return new Windows(); } }
a54ab6c92a457c7fd673db3e2c75385b1f14fabd
9b506facf5ff85df4ee1dd8b6ed07ce8fef5bb00
/boot/26springboot-registbean/src/test/java/com/wno704/boot/RegistBeanApplicationTests.java
61b11b2e06d169916368247e46eed3697b580b89
[]
no_license
wno704/spring
9a1ab61cdae854833a73771f82f0ee3c9a352b5b
3fc1fe9f7f1701d10391fcecfdfea26bd3715fea
refs/heads/master
2022-12-23T03:45:57.307876
2020-09-17T15:37:10
2020-09-17T15:37:10
288,180,139
0
0
null
null
null
null
UTF-8
Java
false
false
3,212
java
package com.wno704.boot; import com.wno704.boot.test.config.WebConfig; import com.wno704.boot.test.domain.User; import com.wno704.boot.test.service.CalculateService; import org.junit.*; import org.junit.runner.RunWith; import org.springframework.boot.WebApplicationType; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.test.context.junit4.SpringRunner; import java.util.Arrays; @RunWith(SpringRunner.class) @SpringBootTest public class RegistBeanApplicationTests { @BeforeClass public static void beforeClassTest() { System.out.println("--------------------------------------"); } @Before public void beforeTest() { System.out.println("++++++++++++++++++++++++++++++++++++++"); } @Test public void test() { // 返回 IOC 容器,使用注解配置,传入配置类 ApplicationContext context = new AnnotationConfigApplicationContext(WebConfig.class); System.out.println("容器创建完毕"); User user = context.getBean(User.class); System.out.println(user); // 查看 User 这个类在 Spring 容器中叫啥玩意 String[] beanNames = context.getBeanNamesForType(User.class); Arrays.stream(beanNames).forEach(System.out::println); System.out.println("--------------------------------------"); // 查看基于注解的 IOC容器中所有组件名称 beanNames = context.getBeanDefinitionNames(); Arrays.stream(beanNames).forEach(System.out::println); } @Test public void test1() { ApplicationContext context = new AnnotationConfigApplicationContext(WebConfig.class); // 查看基于注解的 IOC容器中所有组件名称 String[] beanNames = context.getBeanDefinitionNames(); Arrays.stream(beanNames).forEach(System.out::println); } @Test public void test2(){ ConfigurableApplicationContext context1 = new SpringApplicationBuilder(RegistBeanApplication.class) .web(WebApplicationType.NONE) .profiles("java8") .run(); CalculateService service = context1.getBean(CalculateService.class); System.out.println("求合结果: " + service.sum(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); } @Test public void test3(){ ApplicationContext context = new AnnotationConfigApplicationContext(WebConfig.class); Object cherry = context.getBean("cherryFactoryBean"); System.out.println(cherry.getClass()); Object cherryFactoryBean = context.getBean("&cherryFactoryBean"); System.out.println(cherryFactoryBean.getClass()); } @After public void afterTest() { System.out.println("++++++++++++++++++++++++++++++++++++++"); } @AfterClass public static void afterClassTest() { System.out.println("--------------------------------------"); } }
f18efa563dc96a042b2791d7911326d40e7ce267
eb9f655206c43c12b497c667ba56a0d358b6bc3a
/platform/testFramework/bootstrap/src/com/intellij/tests/IgnoreException.java
9721ec7c7af9335a09bf70280bf3191e09140641
[ "Apache-2.0" ]
permissive
JetBrains/intellij-community
2ed226e200ecc17c037dcddd4a006de56cd43941
05dbd4575d01a213f3f4d69aa4968473f2536142
refs/heads/master
2023-09-03T17:06:37.560889
2023-09-03T11:51:00
2023-09-03T12:12:27
2,489,216
16,288
6,635
Apache-2.0
2023-09-12T07:41:58
2011-09-30T13:33:05
null
UTF-8
Java
false
false
1,262
java
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.tests; import org.junit.AssumptionViolatedException; import java.lang.reflect.Method; import java.util.List; public class IgnoreException extends Exception { public static final IgnoreException INSTANCE = new IgnoreException(); private static final String MULTIPLE_FAILURES_ERROR = "org.opentest4j.MultipleFailuresError"; private IgnoreException() { } public static boolean isIgnoringThrowable(Throwable throwable) { if (throwable instanceof AssumptionViolatedException) return true; if (throwable instanceof IgnoreException) return true; if (throwable.getClass().getName().equals(MULTIPLE_FAILURES_ERROR)) { try { Method getFailuresMethod = Class.forName(MULTIPLE_FAILURES_ERROR).getDeclaredMethod("getFailures"); @SuppressWarnings("unchecked") List<Throwable> failures = (List<Throwable>)getFailuresMethod.invoke(throwable); for (Throwable failure : failures) { if (isIgnoringThrowable(failure)) return true; } } catch (Throwable e) { return false; } } return false; } }
0e4e55dff616165d2bf786c70375323bb94d1401
38ca46e252f01a871ee4879614d8c8c7fe0d3b89
/src/main/java/com/cqupt/goods_ssm/web/admin/AdminOrderController.java
772d429773b2748d013603e8a1b3ba3e736e2ecc
[]
no_license
oweiziqiango/goods_ssm
1abec2659ffdf42ce70d5064f7fb1cbf4d2fc36c
038466f0f58b5fd5cf1077da1cd20635d1e476ce
refs/heads/master
2020-03-25T22:34:44.279047
2018-08-24T14:22:14
2018-08-24T14:22:14
144,230,344
0
0
null
null
null
null
UTF-8
Java
false
false
3,278
java
package com.cqupt.goods_ssm.web.admin; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import com.cqupt.goods_ssm.domain.extend.TOrderExtend; import com.cqupt.goods_ssm.domain.page.PageBean; import com.cqupt.goods_ssm.service.OrderService; /** * 后台订单管理 * @author Administrator * */ @Controller @RequestMapping("/admin") public class AdminOrderController { @Autowired OrderService orderService; private int getPc(HttpServletRequest req) { String pc = req.getParameter("pc"); int n = 1; System.out.println("pc is " + pc + "\n"); if (pc != null && !pc.trim().isEmpty()) { n = Integer.parseInt(pc); } return n; } /* * 获得url http://localhost:8080 req.getRequestURI()+?+req.getQueryString() * http://localhost:8080/goods/OrderServlet?method=myByOrder&bname=xx&pc=xx */ private String getUrl(HttpServletRequest req) { String url = req.getRequestURI() + "?" + req.getQueryString(); int index = url.lastIndexOf("&pc="); if (index != -1) { // 截取url,去掉关于pc参数的部分 url = url.substring(0, index); } return url; } @RequestMapping("/findAllOrder") public String findAllOrder(HttpServletRequest request,HttpServletResponse response)throws Exception{ PageBean<TOrderExtend> pb = new PageBean<TOrderExtend>(); int pc = getPc(request); String url = getUrl(request); pb = orderService.findAllOrder(pc); pb.setUrl(url); request.setAttribute("pb", pb); return "forward:/adminjsps/admin/order/list.jsp"; } /* * status改为5 */ @RequestMapping("/cancel") public String cancel(HttpServletRequest request,HttpServletResponse response, String oid)throws Exception{ int status = orderService.findStatus(oid); if(status==1){ orderService.updateOrderStatus(oid, 5); request.setAttribute("code", "success"); request.setAttribute("msg", "已经取消!是否还有继续看看?"); return "forward:/adminjsps/admin/msg.jsp"; }else{ request.setAttribute("code", "error"); request.setAttribute("msg", "状态不对,不能取消!"); return "forward:/adminjsps/admin/msg.jsp"; } } @RequestMapping("/load") public String load(HttpServletRequest request,HttpServletResponse response, String oid,String btn)throws Exception{ TOrderExtend load = orderService.load(oid); request.setAttribute("order", load); request.setAttribute("btn", btn); return "forward:/adminjsps/admin/order/desc.jsp"; } /* * status 改为 3 */ @RequestMapping("/delivery") public String delivery(HttpServletRequest request,HttpServletResponse response, String oid)throws Exception{ int status = orderService.findStatus(oid); if(status==2){ orderService.updateOrderStatus(oid, 3); request.setAttribute("code", "success"); request.setAttribute("msg", "已经发货"); return "forward:/adminjsps/admin/msg.jsp"; }else{ request.setAttribute("code", "error"); request.setAttribute("msg", "状态不对,不能发货!"); return "forward:/adminjsps/admin/msg.jsp"; } } }
5400fd57a63f3e74ceb3f696f10c07d969038515
1591b38d9b7fb8ef3e16c79f32980cb3b6e04fa2
/examples/hostCardEmulationClient/src/main/java/com/github/skjolber/nfc/external/hceclient/EchoHostAdpuServiceActivity.java
0b70b9926fbf206261c35be4025ffbcbe069977c
[ "Apache-2.0" ]
permissive
imartinezortiz/external-nfc-api
4dd7a5df40b8678a7591bd0edbf5c8c353c6fe56
e98aa670f656219151b2bbf25b51cbaa0de92280
refs/heads/master
2022-04-09T12:56:47.104520
2020-03-25T10:13:42
2020-03-25T10:13:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,292
java
package com.github.skjolber.nfc.external.hceclient; import android.app.AlertDialog; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; import android.net.Uri; import android.nfc.NfcAdapter; import android.nfc.cardemulation.CardEmulation; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import com.github.skjolber.nfc.util.Broadcast; /** * * Activity for this app to echo the HCE service using internal NFC. * */ public class EchoHostAdpuServiceActivity extends DialogActivity { private static String TAG = EchoHostAdpuServiceActivity.class.getName(); private boolean receiving = false; private final BroadcastReceiver hostCardEmulationBroadcastReceiver = new BroadcastReceiver() { public void onReceive(Context context, final Intent intent) { String action = intent.getAction(); if (Broadcast.HOST_CARD_EMULATION_ACTION_PROCESS_COMMAND_ADPU.equals(action)) { final byte[] command = intent.getByteArrayExtra(Broadcast.HOST_CARD_EMULATION_EXTRA_COMMAND); final byte[] response = intent.getByteArrayExtra(Broadcast.HOST_CARD_EMULATION_EXTRA_RESPONSE); runOnUiThread(new Runnable() { public void run() { TextView textView = (TextView) findViewById(R.id.text); textView.setText(textView.getText() + " <- " + EchoHostApduService.toHexString(command) + "\n -> " + EchoHostApduService.toHexString(response) + "\n"); } }); } else if (Broadcast.HOST_CARD_EMULATION_ACTION_DEACTIVATED.equals(action)) { runOnUiThread(new Runnable() { public void run() { TextView textView = (TextView) findViewById(R.id.text); textView.setText(textView.getText() + "Deactivated (tag lost or IsoDep.close() called)" + "\n"); } }); } else if ("android.intent.action.MAIN".equals(action)) { // ignore } else throw new IllegalArgumentException("Unexpected action " + action); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); setContentView(R.layout.activity_main); CardEmulation cardEmulation = CardEmulation.getInstance(NfcAdapter.getDefaultAdapter(this)); boolean defaultService = cardEmulation.isDefaultServiceForAid(new ComponentName(this, EchoHostApduService.class), EchoHostApduService.AID); if (!defaultService) { Log.w(TAG, "Expected default service for AID " + EchoHostApduService.AID); } Log.d(TAG, "Service AID is " + EchoHostApduService.AID); enableBroadcast(); showHelpfulDialog(); Intent intent = getIntent(); hostCardEmulationBroadcastReceiver.onReceive(this, getIntent()); } private void showHelpfulDialog() { final AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.dialogTitle); alert.setMessage(R.string.dialogMessage); alert.setNegativeButton(R.string.dialogClose, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); return; } }); final AlertDialog dialog = alert.create(); dialog.setCanceledOnTouchOutside(true); dialog.setCancelable(true); // back button show(dialog); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void enableBroadcast() { if (!receiving) { IntentFilter serviceFilter = new IntentFilter(); serviceFilter.addAction(Broadcast.HOST_CARD_EMULATION_ACTION_PROCESS_COMMAND_ADPU); serviceFilter.addAction(Broadcast.HOST_CARD_EMULATION_ACTION_DEACTIVATED); registerReceiver(hostCardEmulationBroadcastReceiver, serviceFilter); receiving = true; } } public void disableBroadcast() { if (receiving) { unregisterReceiver(hostCardEmulationBroadcastReceiver); receiving = false; } } public void showHelp(View view) { String url = "https://developer.android.com/guide/topics/connectivity/nfc/hce.html#ScreenOffBehavior"; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } public void clear(View view) { TextView textView = (TextView) findViewById(R.id.text); textView.setText(""); } @Override protected void onDestroy() { disableBroadcast(); super.onDestroy(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_server: { Intent intent = new Intent(this, HceInvokerActivity.class); startActivity(intent); return true; } case R.id.action_preferences: { Intent intent = new Intent(this, PreferencesActivity.class); startActivity(intent); return true; } default: return super.onOptionsItemSelected(item); } } }
44cc7391c15225b226ffbe370e4bfe21acb91a03
1d8cadbe702d2f23f68f09ce668528cd44ccb2c8
/domino-ui/src/main/java/org/dominokit/domino/ui/modals/DefaultZIndexManager.java
6bd963bb34c0e0651caf01da4c90fc1a929f7ca7
[ "Apache-2.0" ]
permissive
mamta/domino-ui
1f2c438c11ffe98efc576a8b29477e36ded2611e
39ce3e679ddae269b847d236c6d6a1065d3b1cb1
refs/heads/master
2023-06-24T15:32:24.613806
2023-03-21T09:07:59
2023-03-21T09:07:59
202,545,464
0
0
Apache-2.0
2019-11-29T08:45:07
2019-08-15T13:24:32
Java
UTF-8
Java
false
false
3,349
java
/* * Copyright © 2019 Dominokit * * 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.dominokit.domino.ui.modals; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import static org.dominokit.domino.ui.utils.DominoElement.body; import java.util.*; import org.dominokit.domino.ui.utils.DominoUIConfig; import org.dominokit.domino.ui.utils.IsPopup; public class DefaultZIndexManager implements ZIndexManager { private Integer currentZIndex; private static Deque<IsPopup<?>> modals = new LinkedList<>(); private final List<ZIndexListener> listeners = new ArrayList<>(); /** * {@inheritDoc} * * @return The next z-index starting from {@link DominoUIConfig#getInitialZIndex()} and * incremented by {@link DominoUIConfig#getZindexIncrement()} with every call */ @Override public Integer getNextZIndex() { if (isNull(currentZIndex)) { this.currentZIndex = DominoUIConfig.INSTANCE.getInitialZIndex(); } currentZIndex += DominoUIConfig.INSTANCE.getZindexIncrement(); return currentZIndex; } /** * {@inheritDoc} Also attach the modal backdrop if not attached * * @param popup the popup to be shown next */ @Override public void onPopupOpen(IsPopup<?> popup) { if (popup.isModal()) { Integer nextZIndex = getNextZIndex(); ModalBackDrop.INSTANCE.setZIndex(nextZIndex); if (!ModalBackDrop.INSTANCE.isAttached()) { body().appendChild(ModalBackDrop.INSTANCE); } modals.push(popup); } Integer nextZIndex = getNextZIndex(); popup.setZIndex(nextZIndex); listeners.forEach( listener -> listener.onZIndexChange(new ZIndexListener.ZIndexInfo(popup, modals))); } /** * {@inheritDoc} Also remove the modal backdrop when modal remain open * * @param popup the popup to be closed */ @Override public void onPopupClose(IsPopup<?> popup) { if (popup.isModal()) { modals.remove(popup); if (!modals.isEmpty()) { Integer backdropZIndex = getNextZIndex(); ModalBackDrop.INSTANCE.setZIndex(backdropZIndex); Integer modalZIndex = getNextZIndex(); modals.peek().setZIndex(modalZIndex); listeners.forEach( listener -> listener.onZIndexChange(new ZIndexListener.ZIndexInfo(modals.peek(), modals))); } else { ModalBackDrop.INSTANCE.remove(); } } } @Override public Optional<IsPopup<?>> getTopLevelModal() { return Optional.ofNullable(modals.peek()); } @Override public void addZIndexListener(ZIndexListener listener) { if (nonNull(listener)) { listeners.add(listener); } } @Override public void removeZIndexListener(ZIndexListener listener) { if (nonNull(listener)) { listeners.remove(listener); } } }
80327ec29e9593f19b188896861841f0ed9c552d
d4692be261739742257f24bd4df17defd70ce4de
/src/model/storeModel/Category.java
4ebfa6c5a4a52078e996a437f7d645bf11bcc805
[]
no_license
dd1227514920/SCM
053253e29a95b2b8587df10a8724f02188f694d0
bde80081d1927828cd0d329d7e70c40f3cb11ed1
refs/heads/master
2020-03-16T14:55:08.175562
2017-09-10T09:10:34
2017-09-10T09:10:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
819
java
package model.storeModel; /** * Created by leo on 2017/7/7. */ //产品分类 public class Category { private int categoryId; private String name; private String remark; public Category(){ } public Category(int categoryId, String name, String remark) { this.categoryId = categoryId; this.name = name; this.remark = remark; } public int getCategoryId() { return categoryId; } public void setCategoryId(int categoryId) { this.categoryId = categoryId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } }
483121e133514b4289ab3246d35c00a9129ca375
658f49c9bb5b64419ade51f67a89ef6405a13c51
/src/main/java/org/snaker/framework/security/dao/ResourceDao.java
f3a79312ab8eb137868889c9da652d11cf3420cd
[ "Apache-2.0" ]
permissive
hybbj/snaker-demo
e88ec129ba6f93df0936a089ef824dc19c995741
e8e7799a9e3d549c5b203173716ea1123181f5a5
refs/heads/master
2020-12-26T10:50:25.146039
2014-03-11T08:57:50
2014-03-11T08:57:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package org.snaker.framework.security.dao; import org.snaker.framework.orm.hibernate.HibernateDao; import org.snaker.framework.security.entity.Resource; import org.springframework.stereotype.Component; /** * 资源持久化类 * @author yuqs * @version 1.0 */ @Component public class ResourceDao extends HibernateDao<Resource, Long> { }
cbc6d07756d9729920365c0b8c4fa98fa5369bf4
ae2bcf6433f7657f1ba44e023e1adf38ac5e7e6f
/src/main/java/com/epam/handler/calculator/interpreter/PostfixExpressionInterpreter.java
038540b0c74d407baba84e161c74a6492d7b1322
[]
no_license
geobreze/epam-infohandling
c6b1f0c56c32e41fdfde4fd47dac6a989ac6eea0
096851fc95f12eb4c1515f72dead3a5a6780fcc8
refs/heads/master
2020-05-03T05:45:35.015215
2019-03-29T18:23:01
2019-03-29T18:23:01
178,456,406
0
0
null
null
null
null
UTF-8
Java
false
false
1,880
java
package com.epam.handler.calculator.interpreter; import com.epam.handler.calculator.interpreter.expressions.*; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; import java.util.List; public class PostfixExpressionInterpreter implements Interpreter { private static final String EXPRESSION_DELIMITER = "_"; public Integer interpret(String expression) { Deque<Integer> context = new ArrayDeque<>(); List<Expression> parsedExpressions = parse(expression); for (Expression mathExpression : parsedExpressions) { mathExpression.interpret(context); } return context.pop(); } private List<Expression> parse(String expression) { String[] mathExpressionsList = expression.split(EXPRESSION_DELIMITER); List<Expression> parsedExpressions = new ArrayList<>(); for (String mathExpression : mathExpressionsList) { Expression createdExpression = createExpression(mathExpression); parsedExpressions.add(createdExpression); } return parsedExpressions; } private Expression createExpression(String value) { Expression expression; switch (value) { case "+": { expression = new PlusExpression(); break; } case "-": { expression = new MinusExpression(); break; } case "*": { expression = new MultiplyExpression(); break; } case "/": { expression = new DivideExpression(); break; } default: { Integer number = Integer.parseInt(value); expression = new NumberExpression(number); } } return expression; } }
1eee0477dc614f71a79e0d5c8211d068bd9472fe
701752fede1d9a03fc26524b7ac9a350e44137b1
/src/cn/lisa/smartventilator/view/fragment/ContactFragment.java
cbd05bda6999af0c73c8f4a3304b045765b9ebe1
[]
no_license
lingshuo/smartVentilator
2f4bd7faafaf2841bbf3e5993f49a1465c225079
3ee40c92050026ec1a1c539bbada75fa7d48f03d
refs/heads/master
2021-01-10T08:41:09.707128
2015-09-20T04:28:42
2015-09-20T04:28:42
36,790,478
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
package cn.lisa.smartventilator.view.fragment; import cn.lisa.smartventilator.R; import android.annotation.SuppressLint; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class ContactFragment extends Fragment { @SuppressLint("InflateParams") @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_contact, null); return view; } @Override public void onDestroy() { super.onDestroy(); } @Override public void onPause() { super.onPause(); } @Override public void onResume() { super.onResume(); } }
facdf70b8a96fde18e203401c57ee7f2a13451cb
319a371ab83c04a9a2466b0ec1e2a67b93fa7f2f
/zj-xm-salary/src/main/java/com/apih5/mybatis/dao/ZjXmJxPeripheryScoreDetailedMapper.java
1109ee6c6c09c608e59193370908acfb37d4dde2
[]
no_license
zhangrenyi666/apih5-2
0232faa65e2968551d55db47fb35f689e5a03996
afd9b7d574fab11410aab5e0465a0bd706bcf942
refs/heads/master
2023-08-01T13:11:51.678508
2021-09-10T05:52:34
2021-09-10T05:52:34
406,647,352
0
0
null
null
null
null
UTF-8
Java
false
false
1,786
java
package com.apih5.mybatis.dao; import java.util.List; import java.util.Map; import com.apih5.mybatis.pojo.ZjXmJxPeripheryScoreDetailed; public interface ZjXmJxPeripheryScoreDetailedMapper { int deleteByPrimaryKey(String key); int insert(ZjXmJxPeripheryScoreDetailed record); int insertSelective(ZjXmJxPeripheryScoreDetailed record); ZjXmJxPeripheryScoreDetailed selectByPrimaryKey(String key); int updateByPrimaryKeySelective(ZjXmJxPeripheryScoreDetailed record); int updateByPrimaryKey(ZjXmJxPeripheryScoreDetailed record); List<ZjXmJxPeripheryScoreDetailed> selectByZjXmJxPeripheryScoreDetailedList(ZjXmJxPeripheryScoreDetailed record); List<ZjXmJxPeripheryScoreDetailed> getZjXmJxPeripheryScoreDetailedList(ZjXmJxPeripheryScoreDetailed record); int batchDeleteUpdateZjXmJxPeripheryScoreDetailed(List<ZjXmJxPeripheryScoreDetailed> recordList, ZjXmJxPeripheryScoreDetailed record); int batchInsertZjXmJxPeripheryScoreDetailed(List<ZjXmJxPeripheryScoreDetailed> recordList); int batchUpdateZjXmJxPeripheryScoreDetailedByReviewer(List<ZjXmJxPeripheryScoreDetailed> recordList); int countZjXmJxPeripheryScoreDetailedList(ZjXmJxPeripheryScoreDetailed record); List<ZjXmJxPeripheryScoreDetailed> getZjXmJxPeripheryScoreDetailedReviewerByTime( ZjXmJxPeripheryScoreDetailed record); List<ZjXmJxPeripheryScoreDetailed> getZjXmJxPeripheryScoreDetailedListBySystem(ZjXmJxPeripheryScoreDetailed record); List<ZjXmJxPeripheryScoreDetailed> getZjXmJxPeripheryScoreDetailedListByReviewer( ZjXmJxPeripheryScoreDetailed record); List<ZjXmJxPeripheryScoreDetailed> getZjXmJxPeripheryScoreDetailedAllAuditee(ZjXmJxPeripheryScoreDetailed record); List<Map<String, Object>> getZjXmJxPeripheryScoreDetailedPeripheryExcel(ZjXmJxPeripheryScoreDetailed record); }
020ee36cd686a919af26f68bd68b824b24f76899
370f985963b3f9b2755a4024a92f8d8cd84eabce
/src/main/java/com/oysteinstrand/mappy/MatchesTuples.java
a3aff6e9907b3bd02f960ead73571000465e18b7
[ "MIT" ]
permissive
strandoe/mappy
17598fd6f3d36751817a41bcb5cce936eaa98d2b
284c5fc7ccdc7ecc4d1fba22ba2331555ae08173
refs/heads/master
2020-06-01T01:32:58.648156
2014-02-24T10:19:10
2014-02-24T10:19:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,233
java
package com.oysteinstrand.mappy; import com.google.common.base.Predicate; import java.util.Collections; import java.util.Map; import static com.oysteinstrand.mappy.Keys.keys; import static com.oysteinstrand.mappy.Mappy.pick; public class MatchesTuples implements Predicate<Map<String, Object>> { public final Iterable<String> keys; public final Tuple[] tuples; private MatchesTuples(Iterable<String> keys, Tuple... tuples) { this.keys = keys; this.tuples = tuples; } @Override public boolean apply(Map<String, Object> map) { Object o = keys.iterator().hasNext() ? pick(map, keys(keys)) : map; if (o == null || !(o instanceof Map)) { return false; } Map m = (Map)o; boolean matches = true; for (Tuple tuple : tuples) { matches &= m.get(tuple.k) != null && m.get(tuple.k).equals(tuple.v); } return matches; } public static MatchesTuples matchesTuples(Tuple ... tuples) { return new MatchesTuples(Collections.<String>emptyList(), tuples); } public static MatchesTuples matchesTuples(Keys keys, Tuple ... tuples) { return new MatchesTuples(keys.keys, tuples); } }
8052a722b67370d2db1025f8e3d68e2336e18f41
ff500989e6fc0811b3231a9a3ac4f3d37b7f3693
/src/com/ydbaobao/dao/AdminConfigDao.java
4acbd7602e37578390e2fa42a11f4feebd6a6e46
[]
no_license
hwiba/YDbaobao
092c0bd31353aa7b3502edde71e6e769dbc6291e
f61c0eeab939bc33a892104e7be730abae8ccaa9
refs/heads/master
2021-01-18T08:04:15.161137
2015-07-19T06:21:36
2015-07-19T06:21:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
993
java
package com.ydbaobao.dao; import javax.annotation.PostConstruct; import javax.annotation.Resource; import javax.sql.DataSource; import org.springframework.jdbc.core.support.JdbcDaoSupport; import org.springframework.stereotype.Repository; import com.ydbaobao.model.AdminConfig; @Repository public class AdminConfigDao extends JdbcDaoSupport { @Resource private DataSource dataSource; @PostConstruct private void initialize() { setDataSource(dataSource); } public AdminConfig read() { String sql = "select * from ADMINCONFIG limit 1"; return getJdbcTemplate().queryForObject( sql, (rs, rowNum) -> new AdminConfig(rs.getInt("adminConfigId"), rs.getInt("adminDisplayProducts"), rs.getString("adminPassword"))); } public void update(AdminConfig adminConfig) { String sql = "update ADMINCONFIG set adminDisplayProducts = ?, adminPassword = ?"; getJdbcTemplate().update(sql, adminConfig.getAdminDisplayProducts(), adminConfig.getAdminPassword()); } }
f5ee3a47911eb57e3de387349b9fd93d881f548f
b1b384babcd05010d78b75905fc786f4aba08cf1
/app/src/main/java/aut/bme/sportsdbandroidclient/ui/Presenter.java
d6f4f703b356db4c0436c589bd606c761f681b7a
[]
no_license
adamsza/SportsDBAndroidClient
8fcc3fdcfe37bce53f314e0cea7cb73cd02cb42b
6cbcaa82bdf6ff6f5a3291aefbd317e1e444ebc7
refs/heads/main
2023-04-20T23:17:14.417579
2021-05-02T16:55:42
2021-05-02T16:55:42
354,358,649
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package aut.bme.sportsdbandroidclient.ui; public abstract class Presenter<S> { protected S screen; public void attachScreen(S screen){ this.screen = screen; } public void detachScreen(){ this.screen = null; } }
d09059823c0f480753369ed35324202371bcf7f4
b95c56f6c7dff5485fe4ec134f36e503ab8e33ae
/src/main/java/sereinfish/bot/controller/group/normal/WikiController.java
6f7b413c74eb2e5fa8e6098385074f43f7562498
[]
no_license
biqigubafan1/SereinFish
5bf77b4a5ceed6ea67c2689736bd1652d4bbbc1c
d0ad0ec2c84578a9fd59cb17ffcf5904bf5eaeaa
refs/heads/master
2023-03-25T06:26:31.414236
2021-03-13T15:05:09
2021-03-13T15:05:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,955
java
package sereinfish.bot.controller.group.normal; import com.IceCreamQAQ.Yu.annotation.Action; import com.IceCreamQAQ.Yu.annotation.Before; import com.icecreamqaq.yuq.annotation.GroupController; import com.icecreamqaq.yuq.entity.Group; import com.icecreamqaq.yuq.message.Message; import sereinfish.bot.entity.jsonEx.JsonMsg; import sereinfish.bot.mlog.SfLog; import sereinfish.bot.myYuq.MyYuQ; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; /** * Wiki相关指令 */ @GroupController public class WikiController { @Before public void before(){ } @Action("\\[!!.]wiki\\ {key}") public Message wiki(String key){ String url = "https://minecraft-zh.gamepedia.com/index.php?search="; try { url += URLEncoder.encode(key,"utf-8"); } catch (UnsupportedEncodingException e) { SfLog.getInstance().e(this.getClass(),"[" + key + "] 查询失败",e); return MyYuQ.getMif().text("[" + key + "] 查询失败").toMessage(); } return MyYuQ.getMif().jsonEx(JsonMsg.getUrlCard("Wiki:" + key,key + " - Minecraft Wiki,最详细的官方我的世界百科", "https://images.wikia.com/minecraft_zh_gamepedia/images/b/bc/Wiki.png",url)).toMessage(); } @Action("\\[!!.]百度\\ {key}") public void baidu(Group group, String key){ String url = "http://www.baidu.com/s?wd="; try { url += URLEncoder.encode(key,"utf-8"); } catch (UnsupportedEncodingException e) { SfLog.getInstance().e(this.getClass(),"[" + key + "] 查询失败",e); MyYuQ.sendGroupMessage(group, MyYuQ.getMif().text("[" + key + "] 查询失败").toMessage()); } MyYuQ.sendGroupMessage(group, MyYuQ.getMif().jsonEx(JsonMsg.getUrlCard("百度-" + key,key + "_百度一下,你就知道", "https://www.baidu.com/img/bd_logo1.png",url)).toMessage()); } }
95543d9fb0f813398d05ef33b8737269187d73c0
827fff5ca14f5780744c3abd3e6d0d337c80d849
/engine/src/main/java/engine/expressions/parser/ClauseTypeVisitor.java
8d13143a526cd545aaf8abe9f8ce21b3d34de8a7
[ "Apache-2.0" ]
permissive
oleksiyp/equal5
2113e7bf6951b1e86222f8b57e5ecb5b0f24eb9f
4f0f2b17c3766672e933ef1044ad877d45c2db9f
refs/heads/master
2021-01-17T06:28:51.335597
2016-09-03T07:01:22
2016-09-03T07:01:22
8,747,105
0
0
null
null
null
null
UTF-8
Java
false
false
551
java
package engine.expressions.parser; /** * User: Oleksiy Pylypenko * Date: 3/30/13 * Time: 12:10 PM */ public interface ClauseTypeVisitor<T> { T equations() throws Exception; T equation() throws Exception; T additiveExpression() throws Exception; T primaryExpression() throws Exception; T multiplicativeExpression() throws Exception; T parentheses() throws Exception; T constant() throws Exception; T variable() throws Exception; T arguments() throws Exception; T mathFunction() throws Exception; }
8339c4c5586703336dc97ee53c52cbdb00b95b13
6b479693990edc69097ae2b453bacb9270d2c412
/JoglEventListener (2).java
1bd84f6eb54255d550d3850a8d3db1b2c9726b79
[]
no_license
nazdtaylor/Java
e8cebe8cf0b767906418a1abc3268e1edf5c5c6f
395c32a22930288c517428f056a8e7d6f8a0ddc2
refs/heads/master
2021-04-03T14:01:55.846149
2018-03-14T16:13:42
2018-03-14T16:13:42
125,242,563
0
0
null
null
null
null
UTF-8
Java
false
false
14,059
java
// Naz Taylor // CS 335 // Homework 4 Skybox package HW4; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.io.File; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.glu.GLU; import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureIO; public class JoglEventListener implements GLEventListener, KeyListener, MouseListener, MouseMotionListener { int windowWidth, windowHeight; float orthoX=40; boolean leftClick; boolean dragging; boolean toggle; int toggleCount = 1; float dragX; float dragY; float tilt = 0; float tiltInc = 0; int mouseX, mouseY; float picked_x = 0.0f, picked_y = 0.0f; float focalLength = 30.0f; boolean diffuse_flag = false; boolean specular_flag = false; boolean smooth_flag = true; private GLU glu = new GLU(); float backrgb[] = new float[4]; float rotx; float roty; float rotz; Texture skybox0 = null; Texture skybox1 = null; Texture skybox2 = null; Texture skybox3 = null; Texture skybox4 = null; Texture skybox5 = null; Texture woodbox = null; int eyex = 0; int eyez = 1; float camx = 0; float camy = 0; float camz = 0; float camz2 = 1; float movx = 0f; float movz = 1.0f; float theta = 0; public void displayChanged(GLAutoDrawable gLDrawable, boolean modeChanged, boolean deviceChanged) { } /** Called by the drawable immediately after the OpenGL context is * initialized for the first time. Can be used to perform one-time OpenGL * initialization such as setup of lights and display lists. * @param gLDrawable The GLAutoDrawable object. */ public void init(GLAutoDrawable gLDrawable) { GL2 gl = gLDrawable.getGL().getGL2(); //gl.glShadeModel(GL.GL_LINE_SMOOTH); // Enable Smooth Shading gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background gl.glClearDepth(1.0f); // Depth Buffer Setup gl.glEnable(GL.GL_DEPTH_TEST); // Enables Depth Testing gl.glDepthFunc(GL.GL_LEQUAL); // The Type Of Depth Testing To Do // Really Nice Perspective Calculations //gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // load the texture; try { skybox0 = TextureIO.newTexture(new File("C:/Users/iPhone/Documents/CS 335/Skybox texture/skybox_pine_forest_front.jpg"), false); // left skybox1 = TextureIO.newTexture(new File("C:/Users/iPhone/Documents/CS 335/Skybox texture/skybox_pine_forest_left.jpg"), false); // back skybox2 = TextureIO.newTexture(new File("C:/Users/iPhone/Documents/CS 335/Skybox texture/skybox_autum_forest_back.jpg"), false); // right skybox3 = TextureIO.newTexture(new File("C:/Users/iPhone/Documents/CS 335/Skybox texture/skybox_autum_forest_right.jpg"), false); // top skybox4 = TextureIO.newTexture(new File("C:/Users/iPhone/Documents/CS 335/Skybox texture/skybox_autum_forest_top.jpg"), false); // bottom skybox5 = TextureIO.newTexture(new File("C:/Users/iPhone/Documents/CS 335/Skybox texture/skybox_autum_forest_bottom.jpg"), false); woodbox = TextureIO.newTexture(new File("C:/Users/iPhone/Documents/CS 335/Skybox texture/box.jpg"), false); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); gl.glEnable(GL.GL_TEXTURE_2D); //gl.glBindTexture(GL.GL_TEXTURE_2D, texID); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP); gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE); gl.glBlendFunc(GL2.GL_SRC_ALPHA,GL2.GL_ONE); } catch (Exception ex) { ex.printStackTrace(); } } public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height) { windowWidth = width; windowHeight = height; final GL2 gl = gLDrawable.getGL().getGL2(); if (height <= 0) // avoid a divide by zero error! height = 1; final float h = (float) width / (float) height; gl.glViewport(0, 0, width, height); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); // gl.glOrtho(-orthoX*0.5, orthoX*0.5, -orthoX*0.5*height/width, orthoX*0.5*height/width, -100, 100); glu.gluPerspective(45.0f, h, 1, 100000.0); } @Override public void display(GLAutoDrawable gLDrawable) { // TODO Auto-generated method stub final GL2 gl = gLDrawable.getGL().getGL2(); gl.glClearColor(backrgb[0], 0, 1, 1); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); glu.gluLookAt(0, 0, 1, 0, 0, 0, 0, 1, 1); gl.glRotatef(rotx, 0, 1, 0); gl.glRotatef(roty, 1, 0, 0); gl.glRotatef(rotz, 0, 0, 1); gl.glTranslated(movx, 1, movz); gl.glPushMatrix(); gl.glPushAttrib(GL2.GL_ENABLE_BIT); gl.glDisable(GL.GL_DEPTH_TEST); gl.glDisable(GL2.GL_LIGHTING); gl.glDisable(GL.GL_BLEND); gl.glEnable(GL.GL_TEXTURE_2D); // Front skybox0.bind(gl); gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(50f, -50f, -50f); gl.glTexCoord2f(1,0); gl.glVertex3f(-50f, -50f, -50f); // gl.glTexCoord2f(1,1); gl.glVertex3f(-50f, 50f, -50f); gl.glTexCoord2f(0,1); gl.glVertex3f(50f, 50f, -50f); gl.glEnd(); // Left skybox1.bind(gl); //gl.glDisable(GL.GL_TEXTURE_2D); gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(50f, -50f, 50f); gl.glTexCoord2f(1,0); gl.glVertex3f(50f, -50f, -50f); // gl.glTexCoord2f(1,1); gl.glVertex3f(50f, 50f, -50f); gl.glTexCoord2f(0,1); gl.glVertex3f(50f, 50f, 50f); gl.glEnd(); // back skybox2.bind(gl); //gl.glDisable(GL.GL_TEXTURE_2D); gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(-50f, -50f, 50f); gl.glTexCoord2f(1,0); gl.glVertex3f(50f, -50f, 50f); // gl.glTexCoord2f(1,1); gl.glVertex3f(50f, 50f, 50f); gl.glTexCoord2f(0,1); gl.glVertex3f(-50f, 50f, 50f); gl.glEnd(); // right skybox3.bind(gl); //gl.glDisable(GL.GL_TEXTURE_2D); gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(-50f, -50f, -50f); gl.glTexCoord2f(1,0); gl.glVertex3f(-50f, -50f, 50f); // gl.glTexCoord2f(1,1); gl.glVertex3f(-50f, 50f, 50f); gl.glTexCoord2f(0,1); gl.glVertex3f(-50f, 50f, -50f); gl.glEnd(); // top skybox4.bind(gl); //gl.glDisable(GL.GL_TEXTURE_2D); gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(50f, 50f, -50f); gl.glTexCoord2f(1,0); gl.glVertex3f(-50f, 50f, -50f); // gl.glTexCoord2f(1,1); gl.glVertex3f(-50f, 50f, 50f); gl.glTexCoord2f(0,1); gl.glVertex3f(50f, 50f, 50f); gl.glEnd(); // bottom skybox5.bind(gl); //gl.glDisable(GL.GL_TEXTURE_2D); gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(50f, -50f, 50f); gl.glTexCoord2f(1,0); gl.glVertex3f(-50f, -50f, 50f); // gl.glTexCoord2f(1,1); gl.glVertex3f(-50f, -50f, -50f); gl.glTexCoord2f(0,1); gl.glVertex3f(50f, -50f, -50f); gl.glEnd(); //gl.glDisable(GL.GL_TEXTURE_2D); // Front woodbox.bind(gl); gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(-5f, -10f, -10f); gl.glTexCoord2f(1,0); gl.glVertex3f(-10f, -10f, -10f); // gl.glTexCoord2f(1,1); gl.glVertex3f(-10f, -5f, -10f); gl.glTexCoord2f(0,1); gl.glVertex3f(-5f, -5f, -10f); gl.glEnd(); // left gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(-5f, -10f, -5f); gl.glTexCoord2f(1,0); gl.glVertex3f(-5f, -10f, -10f); // gl.glTexCoord2f(1,1); gl.glVertex3f(-5f, -5f, -10f); gl.glTexCoord2f(0,1); gl.glVertex3f(-5f, -5f, -5f); gl.glEnd(); // back gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(-10f, -10f, -5f); gl.glTexCoord2f(1,0); gl.glVertex3f(-5f, -10f, -5f); // gl.glTexCoord2f(1,1); gl.glVertex3f(-5f, -5f, -5f); gl.glTexCoord2f(0,1); gl.glVertex3f(-10f, -5f, -5f); gl.glEnd(); /* // right gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(-10f, -10f, -10f); gl.glTexCoord2f(1,0); gl.glVertex3f(-10f, -10f, -5f); // gl.glTexCoord2f(1,1); gl.glVertex3f(-10f, -5f, -5f); gl.glTexCoord2f(0,1); gl.glVertex3f(-10f, -5f, -10f); gl.glEnd(); */ // top gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(-5f, -5f, -10f); gl.glTexCoord2f(1,0); gl.glVertex3f(-10f, -5f, -10f); // gl.glTexCoord2f(1,1); gl.glVertex3f(-10f, -5f, -5f); gl.glTexCoord2f(0,1); gl.glVertex3f(-5f, -5f, -5f); gl.glEnd(); /* // bottom gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0,0); gl.glVertex3f(-5f, -10f, -5f); gl.glTexCoord2f(1,0); gl.glVertex3f(-10f, -10f, -5f); // gl.glTexCoord2f(1,1); gl.glVertex3f(-10f, -10f, -10f); gl.glTexCoord2f(0,1); gl.glVertex3f(-5f, -10f, -10f); gl.glEnd(); */ gl.glPopMatrix(); gl.glDisable(GL.GL_TEXTURE_2D); } @Override public void dispose(GLAutoDrawable arg0) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub char key= e.getKeyChar(); System.out.printf("Key typed: %c\n", key); switch(key) { case 'w': movz += 0.5; break; case 's': movz -= 0.5; break; case 'd': movx -= 0.5; break; case 'a': movx += 0.5; break; case '0': eyex = 0; eyez = 0; break; default: break; } } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } @Override public void mouseDragged(MouseEvent e) { float XX = (e.getX()-windowWidth*0.5f)*orthoX/windowWidth; float YY = -(e.getY()-windowHeight*0.5f)*orthoX/windowHeight; dragX = XX/2; dragY = YY/2; System.out.printf("Point drug to: (%.3f, %.3f)\n", XX, YY); dragging = true; if (leftClick == true){ if (dragX != 0 && dragY < 5){ rotx += dragX / 10; } if (dragY != 0 && dragX < 5 ){ roty -= dragY / 10; } } else if (leftClick == false){ focalLength -= dragX/8; } //repaint(); } @Override public void mouseMoved(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub System.out.println("Your window get focus."); } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub /* * Coordinates printout */ picked_x = (e.getX()-windowWidth*0.5f)*orthoX/windowWidth; picked_y = -(e.getY()-windowHeight*0.5f)*orthoX/windowHeight; System.out.printf("Point clicked: (%.3f, %.3f)\n", picked_x, picked_y); mouseX = e.getX(); mouseY = e.getY(); if(e.getButton()==MouseEvent.BUTTON1) { // Left button leftClick = true; } else if(e.getButton()==MouseEvent.BUTTON3) { // Right button leftClick = false; } } @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent e) { // cursor enter the window // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // cursor exit the window // TODO Auto-generated method stub } }
98597d1527a59ba1a549d994b638cc7e1bfedc48
b47dac0a3cdbc01d73e896fe99fbb76caa525847
/src/FunctionHandler.java
20e0b1d2d61ce5fb4c0998975e9e3a67f13707ab
[]
no_license
BardhMustafa/Email_Directory
64f68da2acfff8d9cb85780475b57f94cb96a647
60e18d968766e488ee4760ec128e4acf84a34484
refs/heads/master
2023-04-29T00:42:23.398950
2021-05-17T14:24:47
2021-05-17T14:24:47
365,359,028
0
0
null
null
null
null
UTF-8
Java
false
false
2,515
java
import java.security.spec.RSAOtherPrimeInfo; import java.util.List; public class FunctionHandler { private List<EmailPerson> emailPersons; FunctionHandler(List<EmailPerson> emailPersons) { this.emailPersons = emailPersons; } public void showAll() { for (EmailPerson e : emailPersons) { System.out.println(e.getName() + " " + e.getEmail()); } } public List<EmailPerson> getEmailPersons() { return emailPersons; } public void setEmailPersons(List<EmailPerson> emailPersons) { this.emailPersons = emailPersons; } public boolean checkIfExist(EmailPerson emailPerson) { boolean exist = false; for (EmailPerson emailPerson1 : emailPersons) { if (emailPerson.getName().equals(emailPerson1.getName()) || emailPerson.getEmail().equals(emailPerson1.getEmail())) { exist = true; break; } } return exist; } public boolean insertEmailPerson(EmailPerson emailPerson) { boolean exist = true; if (!checkIfExist(emailPerson)) { emailPersons.add(emailPerson); } else { exist = false; } return exist; } public EmailPerson findByName(String name) { int index = getIndexByName(name); EmailPerson e; if (index >= 0) { e = emailPersons.get(getIndexByName(name)); } else { e = null; } return e; } public EmailPerson findByEmail(String email) { int index = getIndexByEmail(email); EmailPerson e; if (index >= 0) { e = emailPersons.get(getIndexByEmail(email)); } else { e = null; } return e; } public int getIndexByName(String name) { int index = -1; String name1; for (EmailPerson emailPerson1 : emailPersons) { name1 = emailPerson1.getName(); if (name1.equals(name)) { index = emailPersons.indexOf(emailPerson1); break; } } return index; } public int getIndexByEmail(String email) { int index = -1; for (EmailPerson emailPerson1 : emailPersons) { if (emailPerson1.getEmail().equals(email)) { index = emailPersons.indexOf(emailPerson1); break; } } return index; } }
b380b3ed155aec3af2f63cc5e9c9b238c87c8137
df1c014668f34f841563c1501ece64f1fe138755
/ctojavaDC.java
d76d32fe7ef5a558a89dc1fed4037ff8f558b0a0
[]
no_license
shuhash/codes
758ea7ef7bd71aef32288b79501c675c24dd286c
386573a41b63934eadb8ee75985e67fa7db06ee1
refs/heads/main
2023-07-08T17:39:25.102555
2021-08-07T07:01:13
2021-08-07T07:01:13
361,060,822
1
0
null
null
null
null
UTF-8
Java
false
false
488
java
import java.util.*; class Hello{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int row=0,sum=0; while(sc.hasNext()){ row++; if(row%2==1){ if(row!=1){ System.out.print(" "); } System.out.print(sc.next()); } else{ sum+=sc.nextInt(); } } System.out.print("\n"+sum); } }
ccf871b2fbe7c00f77f520d344aaa4a238a17ca4
ed666bc346b0d1f1440240b0676d532daa2d79f0
/src/org/usfirst/frc/team2485/robot/utils/ConstantsIO.java
6d77bebb90dfc348c43d438f712684374a0be7c3
[]
no_license
ncsariowan/FRC_2016_Command_Based_Nathan
acb5d4a6fe297b7b9d8592c76c728b54e6751ea0
9ec3ec45e5031caffd24483899c942b07721e615
refs/heads/master
2021-03-27T11:47:24.215591
2018-08-13T20:39:49
2018-08-13T20:39:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,739
java
package org.usfirst.frc.team2485.robot.utils; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Scanner; import org.usfirst.frc.team2485.robot.Robot; /** * Static class to interface IO between the RoboRio and the Driver Station. Used * to save constants to a file rather than being hard coded. * * @author Ben Clark * @author Jeremy McCulloch */ public class ConstantsIO { public static final String ROBO_RIO_CONSTANTS_FILE_PATH = "/home/lvuser/constants.txt"; public static HashMap<String, String> data; public static double kP_Shooter; public static double kI_Shooter; public static double kD_Shooter; public static double kF_Shooter; public static double kShotRPS; public static double kP_IntakeArm; public static double kI_IntakeArm; public static double kD_IntakeArm; public static void init() { System.out.println("ConstantsIO .class file loc: " + ConstantsIO.class.getResource("").getPath()); if (Robot.isSimulation()) { String constantsFile = findConstantsFile(); try { data = parseLoadFile(readLocalFile(constantsFile)); } catch (IOException e1) { e1.printStackTrace(); } } else { try { data = parseLoadFile(readLocalFile(ROBO_RIO_CONSTANTS_FILE_PATH)); } catch (IOException e1) { e1.printStackTrace(); } } // createUnMatchedConstants(); kP_Shooter = Double.parseDouble(data.get("kP_Shooter")); kI_Shooter = Double.parseDouble(data.get("kI_Shooter")); kD_Shooter = Double.parseDouble(data.get("kD_Shooter")); kF_Shooter = Double.parseDouble(data.get("kF_Shooter")); kShotRPS = Double.parseDouble(data.get("kShotRPS")); kP_IntakeArm = Double.parseDouble(data.get("kP_IntakeArm")); kI_IntakeArm = Double.parseDouble(data.get("kI_IntakeArm")); kD_IntakeArm = Double.parseDouble(data.get("kD_IntakeArm")); } @SuppressWarnings("unused") private static void createUnMatchedConstants() { Field[] fields = ConstantsIO.class.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { fields[i].getName().startsWith("k"); if (!data.containsKey(fields[i].getName())) { } } } /** * I'm so sorry Jeremy */ private static String findConstantsFile() { File curFolder = new File(ConstantsIO.class.getResource("").getPath()); while (!curFolder.getName().equals("frc-2017")) { curFolder = curFolder.getParentFile(); System.out.println("Backed out to: " + curFolder.getPath()); } return new File(curFolder, "Constants.txt").getPath().substring(5); } /** * Used to read a file locally. * * @param filePath */ public static String readLocalFile(String filePath) throws IOException { File file = new File(filePath); System.out.println("Resolved file path: " + file.getPath()); String fileString; StringBuilder fileContents = new StringBuilder((int) file.length()); Scanner scanner = new Scanner(file); String lineSeperator = "\n"; try { while (scanner.hasNextLine()) fileContents.append(scanner.nextLine() + lineSeperator); fileString = fileContents.toString(); // remove the added "\n" fileString = fileString.substring(0, fileString.length() - 1); } finally { scanner.close(); } return fileString; } /** * @param loadFileContents * @return HashMap containing constant names and their values as declared in * the load file. */ public static HashMap<String, String> parseLoadFile(String fileContents) { HashMap<String, String> constantsMap = new HashMap<String, String>(); Scanner scanner = new Scanner(fileContents); while (scanner.hasNextLine()) { String currLine = scanner.nextLine().trim(); if (currLine.contains("=")) { String constantName = currLine.substring(0, currLine.indexOf("=")).trim(); String constantValue = currLine.substring(currLine.indexOf("=") + 1).trim(); constantsMap.put(constantName, constantValue); } } scanner.close(); return constantsMap; } /** * NEEDS TO BE WRITTEN AND DEPLOTED FROM ELSE WHERE: WIDGITS? */ public static void writeConstantsToRoboRio(String loadFileContents) { PrintWriter printWriter = null; try { printWriter = new PrintWriter( new FileOutputStream("ftp://roborio-2485-frc.local" + ROBO_RIO_CONSTANTS_FILE_PATH)); // definitely // won't // work } catch (FileNotFoundException e) { e.printStackTrace(); } if (printWriter != null) { printWriter.write(loadFileContents); printWriter.flush(); printWriter.close(); } else { System.err.println("PrintWriting failed to init, unable to write constants."); } } }
12f24019da18511bd122cd7898c4c51bb234ecd0
8756b494459ab0d117b824df6c25ba1d0f4e6122
/源码/Android源码/SoftwareContest/app/src/main/java/com/czmec/softwarecontest/drawpannel/dollar/DollarListener.java
9c2ec99e0dc80e576832ab2c55b4d9f095f87d0a
[]
no_license
zxcvbnmzsedr/SoftwareContest
7307942a6ad8c51e07627cf9568fd4f49010f148
d7e752cf8a480eef19c99aa4c7c0c1b12921563f
refs/heads/master
2021-01-11T08:15:39.055646
2016-09-23T01:46:23
2016-09-23T01:46:23
68,974,522
0
0
null
null
null
null
UTF-8
Java
false
false
125
java
package com.czmec.softwarecontest.drawpannel.dollar; public interface DollarListener{ void dollarDetected(Dollar dollar); }
e28d2b7b1088fc1613152209c837fdc0375b28a5
fa74e2f1aa3a9e32733f64e48642a350b961dd47
/src/main/java/com/zhufeng/design/pattern/behavioral/strategy/Test.java
cca477c14db6dc8f28173342ea443c81436c4554
[]
no_license
zhufeng8407/jvm_design_pattern
ae847b8eec1ebd0e9666342d96eef654e72de261
1e36ceb9ddb8df80b09c7be169f63f3b4730f0f1
refs/heads/master
2021-07-09T10:16:54.089335
2019-04-12T06:23:51
2019-04-12T06:23:51
150,852,807
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
package com.zhufeng.design.pattern.behavioral.strategy; public class Test { public static void main(String[] args) { PromotionActivity promotionActivity611 = new PromotionActivity(new LijianPromotionStrategy()); promotionActivity611.executePromotion(); PromotionActivity promotionActivity1111 = new PromotionActivity(new ManjianPromotionStrategy()); promotionActivity1111.executePromotion(); } }
4fea931cacc9c202815a1dca77a9b62578663379
925ee2d77997ad588a79cb368840eba41034651e
/Tetris-4A/PieceEnFormeDeElle.java
781bf0d24cc888b7db2f8d31f71402c053390727
[]
no_license
Mankouri/Tris-Te-de-l-espace
3edfa73a961f6b64a7f07a6af1fbe0f02c00b143
da23233e735a13c3e5cb8713e9e20588d2a08568
refs/heads/master
2016-08-12T17:33:36.868770
2016-04-03T21:49:18
2016-04-03T21:49:18
55,365,565
0
0
null
null
null
null
UTF-8
Java
false
false
708
java
/** * Piece de type: forme en 'L'. * @author Ange FOFE, Jalil MANKOURI & Andy HARVEL; * @version $Revision: 1.0 $ */ public class PieceEnFormeDeElle extends Piece { /** * Constructeur de la piece en 'L'. * @param posX Position X de la piece. * @param posY Position Y de la piece. */ public PieceEnFormeDeElle(int posX, int posY) { super(posX, posY); /* Le 'L' tient dans une matrice 3x3: */ mat = new Matrix(3); /* On choisit une couleur al�atoire: */ int couleur = (int) (Math.random() * 4); /* Dessine la forme d'un 'L' dans la matrice: */ mat.setVal(1, 0, couleur); mat.setVal(1, 1, couleur); mat.setVal(1, 2, couleur); mat.setVal(2, 2, couleur); } }
c995e72abe93e951e899fce2669aa77d833986d9
3023ecdb1c4824544f1457d46c956c798682d7d3
/source/spiralcraft/launcher/LibraryClasspath.java
7394eecfe81fdac996bfe0fdf9ea980227876876
[]
no_license
Spiralcraft/launcher
11bc4c01b6be8af29730b983e6869e1f4a9626ce
0f7f06338f6b1ea384b32e30424fe31b817e5ba9
refs/heads/master
2021-07-08T22:44:27.358444
2021-04-27T01:04:09
2021-04-27T01:04:09
18,156,356
0
0
null
null
null
null
UTF-8
Java
false
false
1,897
java
// // Copyright (c) 1998,2005 Michael Toth // Spiralcraft Inc., All Rights Reserved // // This package is part of the Spiralcraft project and is licensed under // a multiple-license framework. // // You may not use this file except in compliance with the terms found in the // SPIRALCRAFT-LICENSE.txt file at the top of this distribution, or available // at http://www.spiralcraft.org/licensing/SPIRALCRAFT-LICENSE.txt. // // Unless otherwise agreed to in writing, this software is distributed on an // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. // package spiralcraft.launcher; import java.io.IOException; import java.net.URL; import java.util.Enumeration; /** * Resolves class and resource data from a set of libraries * in a LibraryCatalog */ public interface LibraryClasspath { byte[] loadData(String path) throws IOException; URL getResource(String path) throws IOException; Enumeration<URL> getResources(String path) throws IOException; void addLibrary(String path) throws IOException; /** * Return the path of the native library in the catalog with the * specified name */ String findNativeLibrary(String name); /** * Resolve the most recent library which contains the resource, and * all the other libraries on which that library depends. */ void resolveLibrariesForResource(String name) throws IOException; /** * Add the libraries associated with the specified module * to the class path */ void addModule(String moduleName) throws IOException; /** * Release any resources we have allocated, such as open libraries */ void release(); void setDebug(boolean debug); /** * Add the latest versions of all the modules in the library to the * classpath */ void addAllModules() throws IOException; String getClassPath(); }
[ "" ]
9e31d452af51047df8d7bc21ca1a116387ad53b4
03fe93195c6a4fa68a7d5372d3b9db686ba5d702
/servlet/springbootServlet/src/main/java/com/mymaven/ssmDemo/Servlet/CustomServlet.java
584e9a86de12f1430497bc67c3507dddebdf465f
[]
no_license
zhouxiaopengzhang/springboot
33ada8b82ce43f82061dcedea1e3aab4f18c149d
0c782b8d251e2fa4c4834efed515bea9825b445f
refs/heads/master
2020-07-22T16:41:07.395408
2019-09-11T09:24:45
2019-09-11T09:24:45
207,263,625
0
0
null
null
null
null
UTF-8
Java
false
false
897
java
package com.mymaven.ssmDemo.Servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /* 第一种方法创建Servlet步骤: 1.自定义CustomServlet 2.在自定义CustomServlet上添加注解@WebServlet **/ @WebServlet(name="customServlet",urlPatterns={"/"}) public class CustomServlet extends HttpServlet{ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub super.doGet(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub super.doPost(req, resp); } }
0a13854b57e644d295a77fe04951e99214bfa3a3
cd59b4f7b7026f5389983a86614df7ebb7bc15e1
/ticketmonster-web/src/main/java/com/example/ticketmonster/rest/ShowService.java
e622aa2234911740f0de8903a5786d73228463f4
[]
no_license
timstoner/ticketmonster
b31e424a88974ee29ddc76812a2a216afb3ea092
5460b04536c3f6fe0fe183e61582464e184f4286
refs/heads/master
2023-01-10T23:57:00.976148
2014-07-02T11:16:46
2014-07-02T11:16:46
19,214,259
0
0
null
2023-01-02T22:03:27
2014-04-27T19:12:23
JavaScript
UTF-8
Java
false
false
369
java
package com.example.ticketmonster.rest; import java.util.List; import javax.ws.rs.Path; import javax.ws.rs.core.MultivaluedHashMap; import com.example.ticketmonster.dto.ShowDTO; import com.example.ticketmonster.model.Show; @Path("/shows") public interface ShowService extends BaseService<ShowDTO> { List<Show> getAll(MultivaluedHashMap<String, String> empty); }
ff7896b44036e07ee094c7f128e01c5cafd27fbf
d71e879b3517cf4fccde29f7bf82cff69856cfcd
/ExtractedJars/RT_News_com.rt.mobile.english/javafiles/android/support/transition/ViewUtils$1.java
812319c338ae73d3c7851c4043e8e961e3df7367
[ "MIT" ]
permissive
Andreas237/AndroidPolicyAutomation
b8e949e072d08cf6c6166c3f15c9c63379b8f6ce
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
refs/heads/master
2020-04-10T02:14:08.789751
2019-05-16T19:29:11
2019-05-16T19:29:11
160,739,088
5
1
null
null
null
null
UTF-8
Java
false
false
1,986
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package android.support.transition; import android.util.Property; import android.view.View; // Referenced classes of package android.support.transition: // ViewUtils static final class ViewUtils$1 extends Property { public Float get(View view) { return Float.valueOf(ViewUtils.getTransitionAlpha(view)); // 0 0:aload_1 // 1 1:invokestatic #18 <Method float ViewUtils.getTransitionAlpha(View)> // 2 4:invokestatic #24 <Method Float Float.valueOf(float)> // 3 7:areturn } public volatile Object get(Object obj) { return ((Object) (get((View)obj))); // 0 0:aload_0 // 1 1:aload_1 // 2 2:checkcast #27 <Class View> // 3 5:invokevirtual #29 <Method Float get(View)> // 4 8:areturn } public void set(View view, Float float1) { ViewUtils.setTransitionAlpha(view, float1.floatValue()); // 0 0:aload_1 // 1 1:aload_2 // 2 2:invokevirtual #35 <Method float Float.floatValue()> // 3 5:invokestatic #39 <Method void ViewUtils.setTransitionAlpha(View, float)> // 4 8:return } public volatile void set(Object obj, Object obj1) { set((View)obj, (Float)obj1); // 0 0:aload_0 // 1 1:aload_1 // 2 2:checkcast #27 <Class View> // 3 5:aload_2 // 4 6:checkcast #20 <Class Float> // 5 9:invokevirtual #42 <Method void set(View, Float)> // 6 12:return } ViewUtils$1(Class class1, String s) { super(class1, s); // 0 0:aload_0 // 1 1:aload_1 // 2 2:aload_2 // 3 3:invokespecial #11 <Method void Property(Class, String)> // 4 6:return } }
65eeeb1145f2cb4f81fe036ca177b00a11f76e00
8a01d67604b281491d54b41a9b86e8ba835f6b48
/jModex/src/ro/ieat/isummarize/jsptomcat/ProgramOutput.java
227642f62f43cd49edbf18a7d6bb517a47a02cb8
[ "MIT" ]
permissive
petrufm/jModex
585e774db72e48e3e33aac684d2ff555cc5ca5c6
6045c58f7b845ca20ddfd438cf996ffa77158484
refs/heads/master
2021-01-10T05:32:31.939142
2017-02-07T08:24:16
2017-02-07T08:24:16
43,284,278
0
0
null
null
null
null
UTF-8
Java
false
false
5,473
java
/* * Copyright (c) 2013-2014 Institute eAustria Timisoara * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package ro.ieat.isummarize.jsptomcat; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import ro.ieat.isummarize.ExpressionAcyclicVisitor; import ro.ieat.isummarize.ModelFactory; import ro.ieat.isummarize.PredicateAbstractionAbstractVariable; import ro.ieat.isummarize.PredicateAbstractionAbstractization; import ro.ieat.isummarize.ProgramExpression; import ro.ieat.isummarize.ProgramExpressionProxy; import ro.ieat.isummarize.ProgramIndexExpression; import ro.ieat.isummarize.ProgramSubstitutableVariable; import ro.ieat.isummarize.TracedVariable; public class ProgramOutput extends ProgramSubstitutableVariable implements TracedVariable { public interface ProgramOutputVisitor { public Object visitProgramOutput(ProgramOutput expression); } private List<ProgramExpression> uses = new ArrayList<ProgramExpression>(); public ProgramOutput(ProgramIndexExpression use) { uses.add(use); } public ProgramOutput() {} public ProgramOutput(List<ProgramExpression> l) { uses.addAll(l); } @Override public ProgramExpression substitute(ProgramSubstitutableVariable sub, ProgramExpression newExpression) { List<ProgramExpression> newUses = new ArrayList<ProgramExpression>(); if(this.equals(sub)) { if(newExpression instanceof ProgramOutput) { newUses.addAll(((ProgramOutput) newExpression).uses); } else { newUses.add(newExpression); } newUses.addAll(uses); return new ProgramOutput(newUses); } for(ProgramExpression pie : uses) { newUses.add(pie.substitute(sub, newExpression)); } return new ProgramOutput(newUses); } @Override public boolean equals(Object o) { if(o instanceof ProgramOutput) { return true; } return false; } @Override protected int getHashCode() { return 17; } @Override public String toString() { if(uses.isEmpty()) return "ProgramOutput"; else return uses.toString().replace("\n", "\\n"); } @Override public boolean structuralEquals(ProgramExpression o) { if(o instanceof ProgramOutput) { if(this.uses.size() == ((ProgramOutput)o).uses.size()) { for(int i = 0; i < this.uses.size(); i++) { if(!(this.uses.get(i) == ((ProgramOutput)o).uses.get(i) || this.uses.get(i).structuralEquals(((ProgramOutput)o).uses.get(i)))) { return false; } } } else { return false; } } return true; } @Override public Set<ProgramExpression> getVariables() { HashSet<ProgramExpression> result = new HashSet<ProgramExpression>(); for(ProgramExpression aUse : uses) { result.addAll(aUse.getVariables()); } result.add(new ProgramOutput()); return result; } @Override public Set<ProgramExpression> getSubVariables() { HashSet<ProgramExpression> result = new HashSet<ProgramExpression>(); for(ProgramExpression aUse : uses) { result.addAll(aUse.getVariables()); } return result; } @Override public boolean isObservedGlobally() { return true; } @Override public Object accept(ExpressionAcyclicVisitor visitor) { if(visitor instanceof ProgramOutputVisitor) { return ((ProgramOutputVisitor)visitor).visitProgramOutput(this); } return null; } @Override public TracedVariable substituteSubExpression(ProgramSubstitutableVariable toSub, ProgramExpression newExp) { return this; } public List<ProgramExpression> getOutputExpressions() { return Collections.unmodifiableList(uses); } public ProgramExpression preparedForUpdateAssignment(ProgramExpression toAssign) { if(toAssign instanceof PredicateAbstractionAbstractization) { return ModelFactory.getInstance().createPredicateAbstractionConcretization(toAssign, ((PredicateAbstractionAbstractization) toAssign).getPredicate()); } if(toAssign instanceof PredicateAbstractionAbstractVariable) { return ModelFactory.getInstance().createPredicateAbstractionConcretization(toAssign, ((PredicateAbstractionAbstractVariable) toAssign).getPredicate()); } return toAssign; } @Override public List<ProgramExpressionProxy> getProxies() { if(uses.size() == 0) { return new ArrayList<ProgramExpressionProxy>(); } List<ProgramExpressionProxy> res = this.uses.get(0).getProxies(); for(int i = 1; i < uses.size(); i++) { res.addAll(this.uses.get(i).getProxies()); } return res; } }
bc08479c6382ec687d427169c7a2c8db1e64e8d3
406856cc4bddfe155163998b13abbe60c0691a4d
/trunk/demonstrate-project/ddd-mybatis-project/infra/src/main/java/com/dayatang/domain/InstanceFactory.java
32561239280e52503cf846a73b408435b00cdd4c
[]
no_license
tylerchen/demonstrates
15368098ad121ac292646ff389bc744685321e90
2c9cc9bc7c30455e328b2e4aaac8efae2b51fe56
refs/heads/master
2020-04-05T23:14:05.153233
2018-09-13T03:34:19
2018-09-13T03:34:19
2,938,431
10
3
null
null
null
null
UTF-8
Java
false
false
4,335
java
package com.dayatang.domain; import java.util.HashMap; import java.util.Map; /** * 实例工厂类。通过它可以获得其管理的类的实例。 InstanceFactory向客户代码隐藏了IoC工厂的具体实现。在后台,它通过 * InstanceProvider策略接口,允许选择不同的IoC工厂,例如Spring, Google Guice和TapestryIoC等等。 * IoC工厂应该在应用程序启动时装配好,也就是把初始化好的InstanceProvider * 实现类提供给InstanceFactory。对于web应用来说,最佳的初始化方式是创 * 建一个Servlet过滤器或监听器,并部署到web.xml里面;对普通java应用程 * 序来说,最佳的初始化位置是在main()函数里面;对于单元测试,最佳的初始 化位置是setUp()方法内部。 * * * @author yyang * */ public class InstanceFactory { private static InstanceProvider instanceProvider; /** * 设置实例提供者。 * * @param provider * 一个实例提供者的实例。 */ public static void setInstanceProvider(InstanceProvider provider) { instanceProvider = provider; } /** * 获取指定类型的对象实例。如果IoC容器没配置好或者IoC容器中找不到该类型的实例则抛出异常。 * * @param <T> * 对象的类型 * @param beanClass * 对象的类 * @return 类型为T的对象实例 */ @SuppressWarnings("unchecked") public static <T> T getInstance(Class<T> beanClass) { T result = null; result = (T) instances.get(beanClass.getName()); if (result != null) { return result; } checkInstanceProviderExistance(); try { result = getInstanceProvider().getInstance(beanClass); } catch (Exception e) { throw new IllegalArgumentException("IoC container exception!", e); } if (result == null) { throw new IllegalArgumentException("There's not bean of type '" + beanClass + "' exists in IoC container!"); } return result; } /** * 获取指定类型的对象实例。如果IoC容器没配置好或者IoC容器中找不到该实例则抛出异常。 * * @param <T> * 对象的类型 * @param beanName * 实现类在容器中配置的名字 * @param beanClass * 对象的类 * @return 类型为T的对象实例 */ @SuppressWarnings("unchecked") public static <T> T getInstance(Class<T> beanClass, String beanName) { T result = (T) instances.get(toName(beanClass.getName(), beanName)); if (result != null) { return result; } checkInstanceProviderExistance(); try { result = getInstanceProvider().getInstance(beanClass, beanName); } catch (Exception e) { throw new IllegalArgumentException("IoC container exception!", e); } if (result == null) { throw new IllegalArgumentException("There's not bean '" + beanName + "' of type '" + beanClass + "' exists in IoC container!"); } return result; } /** * 获取实例提供者。 * * @return 实体提供者的一个实现类。 */ private static InstanceProvider getInstanceProvider() { return instanceProvider; } private static void checkInstanceProviderExistance() { if (instanceProvider == null) { throw new IllegalArgumentException( "No IoC instance provider exists!"); } } /** * 以下部分仅用于提供代码测试功能,产品代码不要用 */ private static Map<String, Object> instances = new HashMap<String, Object>(); /** * 将服务绑定到具体实例 * @param serviceInterface * @param serviceImplementation */ public static <T> void bind(Class<T> serviceInterface, T serviceImplementation) { instances.put(serviceInterface.getName(), serviceImplementation); } /** * 将服务绑定到具体实例并指定名字 * @param serviceInterface * @param serviceImplementation * @param beanName */ public static <T> void bind(Class<T> serviceInterface, T serviceImplementation, String beanName) { instances.put(toName(serviceInterface.getName(), beanName), serviceImplementation); } private static String toName(String className, String beanName) { return className + ":" + beanName; } /** * 判断是否已经初始化,也就是设置了InstanceProvider * @return */ public static boolean isInitialized() { return instanceProvider != null; } }
8676d8d02357ad260cf08f52a5c23e788ba7f391
2eb5604c0ba311a9a6910576474c747e9ad86313
/chado-pg-orm/src/org/irri/iric/chado/so/Orf.java
84bd2addccc668cdfb50a8c90ccfec83073346b5
[]
no_license
iric-irri/portal
5385c6a4e4fd3e569f5334e541d4b852edc46bc1
b2d3cd64be8d9d80b52d21566f329eeae46d9749
refs/heads/master
2021-01-16T00:28:30.272064
2014-05-26T05:46:30
2014-05-26T05:46:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package org.irri.iric.chado.so; // Generated 05 26, 14 1:32:25 PM by Hibernate Tools 3.4.0.CR1 /** * Orf generated by hbm2java */ public class Orf implements java.io.Serializable { private OrfId id; public Orf() { } public Orf(OrfId id) { this.id = id; } public OrfId getId() { return this.id; } public void setId(OrfId id) { this.id = id; } }
812b57a3e59603846ae77425e0ecb120be228a45
27ebd68f113d1fd6045d65e3475289b286c2cdc5
/temp/src/minecraft_server/net/minecraft/block/BlockCactus.java
2814773ec8381a3f64a9abc641e5cdbe9e873b1c
[]
no_license
EvilKanoa/KClient
1959a4b4cdcb659c356a3ee0ee2a8cb6469c9bc9
0003f5a8b86d6866140cc6be8d2dc6e13f7ce810
refs/heads/master
2021-01-20T23:16:47.776753
2014-08-19T22:10:15
2014-08-19T22:10:15
23,127,153
0
1
null
null
null
null
UTF-8
Java
false
false
3,795
java
package net.minecraft.block; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; public class BlockCactus extends Block { private static final String __OBFID = "CL_00000210"; protected BlockCactus() { super(Material.field_151570_A); this.func_149675_a(true); this.func_149647_a(CreativeTabs.field_78031_c); } public void func_149674_a(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { if(p_149674_1_.func_147437_c(p_149674_2_, p_149674_3_ + 1, p_149674_4_)) { int var6; for(var6 = 1; p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - var6, p_149674_4_) == this; ++var6) { ; } if(var6 < 3) { int var7 = p_149674_1_.func_72805_g(p_149674_2_, p_149674_3_, p_149674_4_); if(var7 == 15) { p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_ + 1, p_149674_4_, this); p_149674_1_.func_72921_c(p_149674_2_, p_149674_3_, p_149674_4_, 0, 4); this.func_149695_a(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, this); } else { p_149674_1_.func_72921_c(p_149674_2_, p_149674_3_, p_149674_4_, var7 + 1, 4); } } } } public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { float var5 = 0.0625F; return AxisAlignedBB.func_72332_a().func_72299_a((double)((float)p_149668_2_ + var5), (double)p_149668_3_, (double)((float)p_149668_4_ + var5), (double)((float)(p_149668_2_ + 1) - var5), (double)((float)(p_149668_3_ + 1) - var5), (double)((float)(p_149668_4_ + 1) - var5)); } public boolean func_149686_d() { return false; } public boolean func_149662_c() { return false; } public int func_149645_b() { return 13; } public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { return !super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_)?false:this.func_149718_j(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); } public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) { if(!this.func_149718_j(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_)) { p_149695_1_.func_147480_a(p_149695_2_, p_149695_3_, p_149695_4_, true); } } public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) { if(p_149718_1_.func_147439_a(p_149718_2_ - 1, p_149718_3_, p_149718_4_).func_149688_o().func_76220_a()) { return false; } else if(p_149718_1_.func_147439_a(p_149718_2_ + 1, p_149718_3_, p_149718_4_).func_149688_o().func_76220_a()) { return false; } else if(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_, p_149718_4_ - 1).func_149688_o().func_76220_a()) { return false; } else if(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_, p_149718_4_ + 1).func_149688_o().func_76220_a()) { return false; } else { Block var5 = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_); return var5 == Blocks.field_150434_aF || var5 == Blocks.field_150354_m; } } public void func_149670_a(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_) { p_149670_5_.func_70097_a(DamageSource.field_76367_g, 1.0F); } }
0f474626ead57e3f092ab0d868fd58c92abc77d6
322aaf0ec35c7c8fa669188a87eaccf962f12b3f
/app/src/main/java/br/ujst/jonathan/studentregister/model/UserViewModel.java
119e1840f390e2b47b37b5b741ce219368e53b29
[]
no_license
DjowNathan/USJT-StudentRegister
a60e572c3ab8482036ef867b452f481d412b33ce
8c96b9a7b79c711d0961670c0397cb931d345394
refs/heads/master
2022-12-28T10:52:32.779267
2020-10-13T03:29:12
2020-10-13T03:29:12
303,576,068
0
0
null
null
null
null
UTF-8
Java
false
false
603
java
package br.ujst.jonathan.studentregister.model; import android.app.Application; import androidx.lifecycle.AndroidViewModel; import androidx.lifecycle.LiveData; public class UserViewModel extends AndroidViewModel { public UserRepository userRepository; public LiveData<User> user; public UserViewModel (Application application) { super(application); userRepository = new UserRepository(application); user = userRepository.getUser(); } public LiveData<User> getUser() { return user; } public void insert(User user) { userRepository.insert(user); } }
40acdfd7af243c8146d17fefe5efdeb59f454ba0
58a33df041305b0cea6199f83c383a45d1c57419
/taxi-online-service/src/main/java/by/bsuir/matys_rozin_zarudny/configuration/URLTokenParser.java
cb0d237e5e99ce0762ac34a30374ad5d53cc400e
[]
no_license
avmatys/taxi-online-service
688b93037f6715dd63ef3f3f8208b1e2613f476e
cbcd4aeca0b7a209bd31c728223639ad7f072ab1
refs/heads/master
2021-01-11T13:48:45.957236
2017-05-08T09:56:41
2017-05-08T09:56:41
86,623,092
4
7
null
2017-05-07T17:30:32
2017-03-29T19:49:07
Java
UTF-8
Java
false
false
1,565
java
package by.bsuir.matys_rozin_zarudny.configuration; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class URLTokenParser { String result = ""; String token = ""; Map<String, String> tokens; URLTokenParserState state; public URLTokenParser(Map<String, String> tokens) { this.tokens = tokens; } public void changeState(URLTokenParserState newState) { state = newState; } public String tokenize(String line) { this.state = new URLTokenParserNoBracesState(this); for (int i = 0; i < line.length(); i++) { char read = line.charAt(i); if (read == '{') { state.addLeftBracket(); } else if (read == '}') { state.addRightBracket(); } else { state.addChar(read); } } // add final part to url this.addToURL(); return this.result; } public String getTemp(){ return this.token; } public void setToken(String token){ this.token = token; } public String getKey(String key){ return this.tokens.get(key); } public void addToTemp(char c) { token += c; } public void addToURL() { if (token != null && !token.equals("")) { result += token; token = ""; } } }
9d2d7a75be7b21842ec36b5291f5814902a4ef96
016e0836468fdf4a43a89f125e7ee07fa112a46b
/app/src/main/java/com/example/user/pop/MainActivity.java
bd78794ee08c3587c6b8f9327fb1f634a66dd6da
[]
no_license
filozofmaks/App
2755bcd960cde2e84d13f14b5ca3eb44951cc86e
a1a6533f926434164c9f02949e395074238adebf
refs/heads/master
2020-04-22T23:02:48.576292
2019-02-14T17:13:36
2019-02-14T17:13:36
170,727,536
0
0
null
null
null
null
UTF-8
Java
false
false
1,745
java
package com.example.user.pop; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void click(View view) { switch (view.getId()) { case R.id.czat: break; } switch (view.getId()) { case R.id.awarie: break; } switch (view.getId()) { case R.id.dobrawoda: Intent intent=new Intent(MainActivity.this,dobrawoda.class); startActivity(intent); break; } switch (view.getId()) { case R.id.mojemiasto: Intent intent=new Intent(MainActivity.this,mojemiasto.class); startActivity(intent); break; } } }
b274961764b4e112996f54297f25a8fdd2c4d428
82dc493dfa5f9b386f9ed0cddc53cce55b98fee5
/src/main/java/edu/warbot/hexablock/interpreter/blocks/Block.java
1ef0968d7afddb156a283981809fd83467e6f555
[]
no_license
Falindir/Warbot
23e83a87b85ab4a978616e5634def9ffbceb7061
88255507e4ff7171e7fcde6dc49dda21ac3ec2c7
refs/heads/hexablock
2020-12-25T02:30:20.689585
2015-06-22T19:55:35
2015-06-22T19:55:35
32,985,447
1
0
null
2015-06-22T19:56:52
2015-03-27T12:44:16
Java
UTF-8
Java
false
false
3,652
java
package edu.warbot.hexablock.interpreter.blocks; import edu.warbot.scriptcore.wrapper.BlockWrapper; import edu.warbot.hexablock.interpreter.blocks.type.TypeBlock; /** * Classe qui représente un bloc de manière générique (abstract) * @author Lopez Jimmy * @version 0.3 */ public abstract class Block implements Evaluable { /** * Le père du bloc. Ce père peut être modifié. * @see edu.warbot.hexablock.interpreter.blocks.Block * @since 0.1 */ private Block father; private BlockWrapper<Object> wrapper; /** * Le type du bloc. Ce type ne peut être modifié. * @see edu.warbot.hexablock.interpreter.blocks.type.TypeBlock * @since 0.1 */ private TypeBlock type; /** * La profondeur du bloc. Cette profondeur indique la position dans l'arbre du bloc. * Cette profondeur peut être modifié * @see int * @since 0.1 */ private int depth = -1; /** * Constructeur d'un bloc * @param type : le type du block * @since 0.1 */ public Block(TypeBlock type) { this.type = type; } /** * Permet de récupérer le père du bloc * @return Une instance de Block * @since 0.1 */ public Block getFather() { return father; } /** * Permet de modifier le père du bloc * @param father : le nouveau père du bloc * @since 0.1 */ public void setFather(Block father) { this.father = father; } /** * Permet de récupérer le type du block * @return Une instance de TypeBlock * @since 0.1 */ public TypeBlock getType() { return type; } /** * Permet de savoir si deux bloc sont du même type * @param other : Un autre bloc * @return Un boolean * @since 0.1 */ public boolean isSameType(Block other) { return this.type.equals(other.getType()); } /** * Permet de récupérer la profondeur du bloc * @return Un int * @since 0.1 */ public int getDepth() { return depth; } /** * Permet de modfier la profondeur du bloc * @param depth : la nouvelle profondeur du bloc * @since 0.1 */ public void setDepth(int depth) { this.depth = depth; } /** * Permet d'incrémenter de 1 la profondeur du bloc * @since 0.2 */ public void incrementDepth() { this.depth++; } /** * Permet de décrémenter de 1 la profondeur du bloc * @since 0.2 */ public void decrementDepth() { this.depth--; } /** * Permet de savoir si ce bloc à la même profondeur qu'un autre bloc * @param other : Un autre bloc * @return Un boolean * @since 0.2 */ public boolean isSameDepth(Block other) { return this.depth == other.getDepth(); } /** * Permet de prendre la meme profondeur que le bloc other, plus 1 * @param other : Un autre bloc * @since 0.3 */ public void setSameDepthIncremented(Block other) { setDepth(other.getDepth()); incrementDepth(); } /** * Permet de prendre la meme profondeur que le bloc other, moins 1 * @param other : Un autre bloc * @since 0.3 */ public void setSameDepthDecremented(Block other) { setDepth(other.getDepth()); decrementDepth(); } @Override public boolean eval() { return false; } public Object getWrapper() { return wrapper.get(); } public void setWrapper(Object o){ wrapper = new BlockWrapper<Object>(o); } }
6ea1d8a137106b2e97f9afcfe9fec1a0c4e1b292
35a78e4dccf09899e42d299c3d1b27af2233693c
/Dimensions_health/app/src/main/java/com/wd/health/view/frag/VideoFrag.java
5ac4e20a484f6d830d17f0aec7e718e7f94aaa15
[]
no_license
15031021126/wd
ba902b7ddbc6a3ed5a8431c707e17a97be608276
e9f52acb052fd982f7e99784ab9d18f040a6e9c9
refs/heads/master
2020-09-11T02:02:27.566643
2019-11-15T10:55:13
2019-11-15T10:55:13
221,904,271
0
0
null
null
null
null
UTF-8
Java
false
false
506
java
package com.wd.health.view.frag; import com.wd.base_core.base.BaseFragment; import com.wd.base_core.mvp.BasePresenter; import com.wd.health.R; /* *@Auther:陈浩 *@Date: 2019/8/3 *@Time:15:55 *@Description:${DESCRIPTION} * */public class VideoFrag extends BaseFragment { @Override protected void iniData() { } @Override protected int bindlayout() { return R.layout.videofrag; } @Override public BasePresenter initPresenter() { return null; } }
645460bc62ad553919d7a3396e3a9048e82975a9
95a4e90946b5eb0bb263d99d7cadfae5dc5a7dd1
/src/test/java/com/microservices/ProductsApplicationTests.java
2d09f4923bacdfd5108fa889a21f076643a03878
[]
no_license
SpringBootClass/MongoDBIntegration
4f1cd8bdf91628b543e43c8e7e92bb4254961e11
300c3785b5a2a5595370f6168786d758386f15e0
refs/heads/master
2020-04-18T00:16:46.432723
2016-08-30T15:42:00
2016-08-30T15:42:00
66,954,093
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package com.microservices; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ProductsApplicationTests { @Test public void contextLoads() { } }
57f1c511f6140afbd2923876727b1ca6eb98e62a
7f460849470384c23c0203d042439f8207b3c11b
/src/org/usfirst/frc/team614/robot/Constants.java
a3c4f34d86187c66051b4f5d63d0199780bb5317
[]
no_license
team614frc/2017-Steamworks-PostCompetition
2a444d04c2058093d431947ce95ecca71b4eb0cf
bc425777f881f16652b331f471e1ca24c28daeab
refs/heads/master
2021-01-23T13:41:48.602433
2017-02-18T17:02:20
2017-02-18T17:02:20
102,675,116
1
0
null
null
null
null
UTF-8
Java
false
false
1,443
java
package org.usfirst.frc.team614.robot; // Constant values used throughout the project public class Constants { // Drivetrain public static final double drivetrainP = 0.05; public static final double drivetrainI = 0; public static final double drivetrainD = 0.12; public static final double drivetrainF = 0; public static final double DRIVETRAIN_WHEEL_DIAMETER = 4; public static final double DRIVETRAIN_AUTONOMOUS_SPEED = .5; public static final double DRIVETRAIN_ENCODER_PULSES_PER_REV = 256.0; public static final double DRIVETRAIN_DISTANCE_PER_PULSE = (Constants.DRIVETRAIN_WHEEL_DIAMETER * Math.PI) / Constants.DRIVETRAIN_ENCODER_PULSES_PER_REV; // Shooter public static final double SHOOTER_ENCODER_COUNTS_PER_REV = 1024.0; public static final double SHOOTER_DISTANCE_PER_PULSE = 1 / SHOOTER_ENCODER_COUNTS_PER_REV; // Winch public static final double WINCH_SPEED = .4; public static final double WINCH_ENCODER_REVOLUTIONS_TO_TOP = 100; public static final double WINCH_CURRENT_DRAW_AT_MAX_HEIGHT = 60.0; // must be adjusted as new weights are added public static final double WINCH_CURRENT_DRAW_AT_CATCHING_ROPE = 10.0; // must be adjusted as new weights are added public static final double WINCH_ENCODER_COUNTS_PER_REV = 1024; // must be changed public static final double WINCH_ENCODER_DISTANCE_PER_PULSE = 1 / WINCH_ENCODER_COUNTS_PER_REV; // Elevator public static final double ELEVATOR_SPEED = 1.0; }
de3b5d810939752cb6529d622132ad0882114204
afdef06d80392126192a3c3ee1e36ef615d77c35
/src/com/api/portal/web/HomepageAction.java
91c0016588c09fd2c2a9861045a26d94d46f28fe
[]
no_license
alert0/mywork
c1df586470723c5a183e0aaad435cd35929acea6
ebf60e52f1bafab3fae19584a8b3bfc72bea65fb
refs/heads/master
2020-03-21T05:07:23.198971
2017-06-19T11:31:50
2017-06-19T11:31:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
889
java
package com.api.portal.web; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import weaver.page.interfaces.HomepageInterface; import weaver.page.interfaces.commons.PageInterfaceFactory; /** * @Comment : * @author : qingsg * @date : 2017年3月7日 * @version 1.0 */ @Path("/portal/homepage") public class HomepageAction { @POST @Path("/hpdata") @Produces(MediaType.TEXT_PLAIN) public String getHpDataJson(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception{ HomepageInterface hi= new PageInterfaceFactory<HomepageInterface>().getImplementByInterface(HomepageInterface.class.getName()); return hi.getHpAllElementJson(request,response); } }
[ "jhy6221240baby" ]
jhy6221240baby
7d01c495c69a859c625acece5a0e585512fa835b
a552a6aeaf299c186589c129b898f52f634ae278
/src/logic/NextShapeInfo.java
a8b867fc3181764957f763da2ad43b53177c2099
[]
no_license
wowthecoder/JavaFX-tetris
cb72af4eb78a404a12d11d4e02aabc468bec847a
4b65a61816887bc0b8db2ba8aa15fa73c86abaa6
refs/heads/main
2023-06-12T12:32:49.820915
2023-06-10T09:47:15
2023-06-10T09:47:15
382,986,216
1
0
null
null
null
null
UTF-8
Java
false
false
332
java
package logic; public class NextShapeInfo { private final int[][] shape; private final int position; public NextShapeInfo(int[][] shape, int position) { this.shape = shape; this.position = position; } public int[][] getShape() { return shape; } public int getPosition() { return position; } }
cc194732e5c598d1a22b6aea10b825fae337b2d0
5d1596fc1c2f00c0aaf8a94cfdfff11763d40f17
/cloud-customer-feign-order80/src/main/java/com/dkf/springcloud/service/PaymentFeignService.java
abfea2cf6bacdea603d505be263885a7329b0968
[]
no_license
xuyue-19940120/xy
0d1a50cb7711f1ce5cc272e7d35d24af9c124bac
7415fa90ac09c1b1752426687bae15b81a756b24
refs/heads/master
2023-03-29T02:22:38.875501
2021-03-30T13:17:49
2021-03-30T13:17:51
353,001,832
0
0
null
null
null
null
UTF-8
Java
false
false
519
java
package com.dkf.springcloud.service; import com.dkf.springcloud.entities.CommonResult; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @Component @FeignClient(value = "CLOUD-PROVIDER-SERVICE") public interface PaymentFeignService { @GetMapping(value = "/payment/{id}") CommonResult getPaymentById(@PathVariable("id")Long id); }
61ecdd30b26678b201b903bfc15600652300c73d
87ce2a2d4975921214723acb4e4f9f3b8902c2e9
/src/AnimalRescue/MedicalStaff.java
3f5950ee303da363bb7a6984db0eea8da31b78ef
[]
no_license
Buksa07/java2
5ad707f6947a4f600cc1cb3af1a8c9a5f51f9df8
10fa422a44b8847f8f612868ae330ce2bfea5f7b
refs/heads/master
2022-10-29T16:18:20.755872
2020-06-17T11:34:09
2020-06-17T11:34:09
255,614,187
0
0
null
null
null
null
UTF-8
Java
false
false
540
java
package AnimalRescue; public abstract class MedicalStaff { private String name; private String specialization; public String getName(){ return name; } public void setName(String name){ this.name = name; } public String getSpecializatio(){ return specialization; } public void setSpecialization(String specialization){ this.specialization = specialization; } public abstract void heal(); public abstract void clean(); public abstract void save(); }
e284ed436511c952115275a97c94ab867db290af
fbd5602a39da1a78339d14e4712a7ccfd5f53206
/LiveChatMVN/src/main/java/org/tymonr/livechat/model/Message.java
7e5546e8ea7f1474ff853f1a67782c6bb5d1bcab
[]
no_license
nusyOweS89/JEE6-PF-Chat
d6d2de0dab422a3ad8f775d38bf8e0d066540a17
2f0ec79520bd9b1fe22a12e2d5c3d7b9cd02cace
refs/heads/master
2021-01-24T00:32:26.703815
2013-03-01T18:09:30
2013-03-01T18:09:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,257
java
package org.tymonr.livechat.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @Entity @Table(name = "MESSAGES") public class Message extends BaseEntity{ private static final long serialVersionUID = 2259935515088345163L; @Column(name = "CONTENT") private String content; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "AUTHOR") private User author; @Column(name = "TIME_SENT") private Date timeSent; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "CONVERSATION") private Conversation conversation; public String getContent() { return content; } public void setContent(String content) { this.content = content; } public User getAuthor() { return author; } public void setAuthor(User author) { this.author = author; } public Date getTimeSent() { return timeSent; } public void setTimeSent(Date timeSent) { this.timeSent = timeSent; } public Conversation getConversation() { return conversation; } public void setConversation(Conversation conversation) { this.conversation = conversation; } }
0f15dc4651fee5002a904b839262e50e3f780013
2f435f45ba07028a2d1d0b9c3551cce375ad0322
/generics/src/main/java/eric/generics/fifteen/seven/ArrayMaker.java
5a7c618737f8f074c92892f7e9030607a5c468e7
[]
no_license
Eric-yangzong/spring
d2351a7c24e93c85fb452811a263ae3c26eacb12
1b8c17f08f86931a4d3a1cd08e80c1395b181b9c
refs/heads/master
2021-07-13T20:02:52.609399
2017-10-15T13:44:31
2017-10-15T13:44:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
540
java
package eric.generics.fifteen.seven; import java.lang.reflect.Array; import java.util.Arrays; public class ArrayMaker<T> { private Class<T> kind; public ArrayMaker(Class<T> kind) { this.kind = kind; } @SuppressWarnings("unchecked") T[] create(int size) { return (T[])Array.newInstance(kind, size); } public static void main(String[]args) { ArrayMaker<String> stringMaker = new ArrayMaker<String>(String.class); String[] stringArray = stringMaker.create(9); System.out.println(Arrays.toString(stringArray)); } }
6820e5711200b09ef43f605d3df3d03dd2dedcca
08dce21c780340a60daa3365e19dc864d3ec78e7
/src/main/java/com/tw/walle/controller/HelloController.java
de50d67eec0a3e2ccb2ceed44fc354ab17e5a406
[]
no_license
nandhae/walle
0f3db0d43457bcdd83b2ab35680bb351b7ace753
0d66c972ba38688db3f95f3b40175e2a8fa279cf
refs/heads/master
2022-11-30T02:10:45.302665
2020-08-11T16:38:18
2020-08-11T16:38:18
284,747,679
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package com.tw.walle.controller; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping; @RestController public class HelloController { @RequestMapping("/") public String index() { return "Greetings from Wall-E!!!"; } }
f1a1f0adcca4e8073f0d45c600fbf646fdaaf336
bc2c9aa4d17aafd22bcbeae4981ecf9ce0b70b91
/src/main/java/com/shureck/controllers/Doctor.java
e91d102fba9d8e2100f288464fb69f7b1441f761
[]
no_license
Shureck/Polyclinic
e73df187f8b9dd2304f2092a86b5ca344e988948
745660e29cf2a766d30972021d2e7bb6337bdd22
refs/heads/master
2023-05-06T04:53:14.244725
2021-05-25T21:28:06
2021-05-25T21:28:06
347,867,790
0
0
null
null
null
null
UTF-8
Java
false
false
1,360
java
package com.shureck.controllers; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; @Entity @Table(name = "doctors") @Getter @Setter @AllArgsConstructor @NoArgsConstructor public class Doctor { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "first_name") private String firstName; @Column(name = "last_name") private String lastName; @Column(name = "middle_name") private String middleName; @Column(name = "email") private String email; @Column(name = "phone_number") private String phoneNumber; public Doctor(String firstName, String lastName, String middleName, String email, String phoneNumber) { this.firstName = firstName; this.lastName = lastName; this.middleName = middleName; this.email = email; this.phoneNumber = phoneNumber; } @Override public String toString() { return "Doctor{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", middleName='" + middleName + '\'' + ", email='" + email + '\'' + ", phoneNumber='" + phoneNumber + '\'' + '}'; } }
b039189dbbbde075974bf3c16242d158b902a738
c0e7d9fd6106810603e2b34a0cbe3a7b544dd1cb
/src/kit/src/main/java/io/ayte/utility/predicate/kit/binary/sortable/InAscendingOrder.java
d9f52649cd9aae178a1164e710cc37a00b1ca023
[ "MIT", "UPL-1.0" ]
permissive
ayte-io/java-utility-predicate
fa55dbe2789dcb9f6f49d2a2ce16468b4b9f2d92
f2bbbefae70c3906974101276d486c99ebc938b7
refs/heads/release/0.1
2020-04-14T23:04:11.054244
2019-05-15T02:12:04
2019-05-15T02:12:04
164,188,935
0
0
NOASSERTION
2019-03-30T23:07:52
2019-01-05T06:32:19
Java
UTF-8
Java
false
false
977
java
package io.ayte.utility.predicate.kit.binary.sortable; import io.ayte.utility.predicate.BinaryPredicate; import io.ayte.utility.predicate.kit.binary.AugmentedBinaryPredicate; import lombok.AccessLevel; import lombok.EqualsAndHashCode; import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.ToString; import java.util.Comparator; @EqualsAndHashCode @ToString @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public class InAscendingOrder<T> implements AugmentedBinaryPredicate<T, T> { private final Comparator<T> comparator; @Override public boolean test(T alpha, T beta) { return comparator.compare(alpha, beta) <= 0; } public static <T> BinaryPredicate<T, T> create(@NonNull Comparator<T> comparator) { return new InAscendingOrder<>(comparator); } public static <T extends Comparable<T>> BinaryPredicate<T, T> create() { return InAscendingOrder.<T>create(Comparator.naturalOrder()); } }
a19db0f1d544920e81324ea6ed404d08d409dad4
012cbf474a72b59fafeb671bd263f4045acafd0f
/core/src/com/abhimanyu/coinman/game/CoinMan.java
42e313c7cd29dc47925038114c416443497d80f3
[]
no_license
AbhimanyuDeswal/coin-man
831376f12079460a1ba6dc2e65f0d14cea03fe1a
c33b65c087dfd10d5278cd9a6d593d3f5ec2cad0
refs/heads/master
2022-11-10T05:48:49.020128
2020-06-24T06:09:10
2020-06-24T06:09:10
274,313,876
0
0
null
null
null
null
UTF-8
Java
false
false
4,727
java
package com.abhimanyu.coinman.game; import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Intersector; import com.badlogic.gdx.math.Rectangle; import java.util.ArrayList; import java.util.Random; public class CoinMan extends ApplicationAdapter { SpriteBatch batch; Texture background; Texture[] man; Texture dizzy; int manState = 0; int pause = 0; float gravity = 0.2f; float velocity = 0; int manY = 0; Rectangle manRectangle; BitmapFont font; int score=0; int gameState = 0; Random random; ArrayList<Integer> coinXs = new ArrayList<Integer>(); ArrayList<Integer> coinYs = new ArrayList<Integer>(); ArrayList<Rectangle> coinRectangles = new ArrayList<Rectangle>(); Texture coin; int coinCount; ArrayList<Integer> bombXs = new ArrayList<Integer>(); ArrayList<Integer> bombYs = new ArrayList<Integer>(); ArrayList<Rectangle> bombRectangles = new ArrayList<Rectangle>(); Texture bomb; int bombCount; @Override public void create () { batch = new SpriteBatch(); background = new Texture("bg.png"); man = new Texture[4]; man[0] = new Texture("frame-1.png"); man[1] = new Texture("frame-2.png"); man[2] = new Texture("frame-3.png"); man[3] = new Texture("frame-4.png"); manY = Gdx.graphics.getHeight() / 2; coin = new Texture("coin.png"); bomb = new Texture("bomb.png"); random = new Random(); dizzy = new Texture("dizzy-1.png"); font = new BitmapFont(); font.setColor(Color.WHITE); font.getData().setScale(10); } public void makeCoin() { float height = random.nextFloat() * Gdx.graphics.getHeight(); coinYs.add((int)height); coinXs.add(Gdx.graphics.getWidth()); } public void makeBomb() { float height = random.nextFloat() * Gdx.graphics.getHeight(); bombYs.add((int)height); bombXs.add(Gdx.graphics.getWidth()); } @Override public void render () { batch.begin(); batch.draw(background,0,0,Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); if (gameState == 1) { // Game is LIVE // Bomb if (bombCount < 250) { bombCount++; } else { bombCount = 0; makeBomb(); } bombRectangles.clear(); for (int i =0;i < bombXs.size();i++) { batch.draw(bomb, bombXs.get(i), bombYs.get(i)); bombXs.set(i, bombXs.get(i) - 8); bombRectangles.add(new Rectangle(bombXs.get(i), bombYs.get(i), bomb.getWidth(), bomb.getHeight())); } // COINS if (coinCount < 100) { coinCount++; } else { coinCount = 0; makeCoin(); } coinRectangles.clear(); for (int i =0;i < coinXs.size();i++) { batch.draw(coin, coinXs.get(i), coinYs.get(i)); coinXs.set(i, coinXs.get(i) - 4); coinRectangles.add(new Rectangle(coinXs.get(i), coinYs.get(i), coin.getWidth(), coin.getHeight())); } if (Gdx.input.justTouched()){ velocity = -10; } if (pause < 8){ pause++; } else { pause = 0; if (manState < 3){ manState++; } else { manState = 0; } } velocity += gravity; manY -= velocity; if (manY <= 0){ manY = 0; } } else if (gameState == 0) { // Waiting to START if (Gdx.input.justTouched()) { gameState = 1; } } else if (gameState == 2) { // Game OVER if (Gdx.input.justTouched()) { gameState = 1; manY = Gdx.graphics.getHeight() / 2; score = 0; velocity = 0; coinXs.clear(); coinYs.clear(); coinRectangles.clear(); coinCount = 0; bombXs.clear(); bombYs.clear(); bombRectangles.clear(); bombCount = 0; } } if (gameState != 2) { batch.draw(man[manState],Gdx.graphics.getWidth() / 2 - man[manState].getWidth() / 2, manY); } else { batch.draw(dizzy,Gdx.graphics.getWidth() / 2 - man[manState].getWidth() / 2, manY); } manRectangle = new Rectangle(Gdx.graphics.getWidth() / 2 - man[manState].getWidth() / 2, manY, man[manState].getWidth(), man[manState].getHeight()); for (int i=0; i < coinRectangles.size(); i++) { if (Intersector.overlaps(manRectangle, coinRectangles.get(i))) { //Gdx.app.log("Coin!", "Collision!"); score++; coinRectangles.remove(i); coinXs.remove(i); coinYs.remove(i); break; } } for (int i=0; i < bombRectangles.size(); i++) { if (Intersector.overlaps(manRectangle, bombRectangles.get(i))) { Gdx.app.log("Bomb!", "Collision!"); gameState = 2; } } font.draw(batch, String.valueOf(score), 100, 200); batch.end(); } @Override public void dispose () { batch.dispose(); } }
1f134bc57a3ee1f0d19c58e9112989871a2346d5
1f8498c886dedd9cd9cb5296f25a5a4962abb6d4
/stack-client/src/main/java/com/inductiveautomation/opcua/stack/client/fsm/states/DisconnectedState.java
5994190599afa9816d742d040e5244a6addc231b
[ "Apache-2.0" ]
permissive
doutdex/opc-ua-stack
ea6c98f6ee92b48ee3f8778c75b37bcb5c221044
a577af239a255a9de784ceded1be5b638aaccefa
refs/heads/master
2021-01-17T21:53:09.912599
2015-02-16T14:28:09
2015-02-16T14:28:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,422
java
package com.inductiveautomation.opcua.stack.client.fsm.states; import java.util.concurrent.CompletableFuture; import com.inductiveautomation.opcua.stack.client.UaTcpClient; import com.inductiveautomation.opcua.stack.client.fsm.ConnectionStateContext; import com.inductiveautomation.opcua.stack.client.fsm.ConnectionStateEvent; import io.netty.channel.Channel; public class DisconnectedState implements ConnectionState { private final CompletableFuture<Channel> channelFuture = new CompletableFuture<>(); @Override public ConnectionState transition(ConnectionStateEvent event, ConnectionStateContext context) { switch (event) { case ConnectRequested: CompletableFuture<Channel> channelFuture = UaTcpClient.bootstrap(context.getClient()); channelFuture.whenCompleteAsync((ch, ex) -> { if (ch != null) { context.handleEvent(ConnectionStateEvent.ConnectSuccess); } else { context.handleEvent(ConnectionStateEvent.ConnectFailure); } }, context.getClient().getExecutorService()); return new ConnectingState(channelFuture); default: return context.getState(); } } @Override public CompletableFuture<Channel> getChannelFuture() { return channelFuture; } }
4ce857a8f41d552e51131a4c38ea03d094d0b0b2
f644a33c321e5d0a317e4fd6feb81bff17a4f83a
/tema4/src/tema4/Imobil.java
caa1fc2004e7e193da00d3959d8761891bbdbdfc
[]
no_license
EgriAlexandra/ProiectProgramareProcedurala
f54a4dc8b9853705eb9059a0d7642b92b5849cc6
e900c59554995c6e97716003237c71e57b800fb7
refs/heads/master
2020-12-15T15:11:14.628067
2020-02-28T12:14:57
2020-02-28T12:14:57
235,151,550
0
0
null
null
null
null
UTF-8
Java
false
false
720
java
package tema4; public class Imobil { private String tipCasa; private int nrEtaje; private double pret; //constructor implicit public Imobil() { tipCasa=""; nrEtaje=0; pret=0; } //constructor cu 3 parametrii public Imobil(String tipCasa, int nrEtaje, double pret) { this.tipCasa=tipCasa; this.nrEtaje=nrEtaje; this.pret=pret; } public String getTipCasa() { return tipCasa; } public void setTipCasa(String tipCasa) { this.tipCasa=tipCasa; } public int getNrEtaje() { return nrEtaje; } public void setNrEtaje(int nrEtaje) { this.nrEtaje=nrEtaje; } public double getPret() { return pret; } public void setPret(double pret) { this.pret=pret; } }
2fc985aa7bf4caac7057073f16b33cd49f89430c
4d6f449339b36b8d4c25d8772212bf6cd339f087
/netreflected/src/Core/System.Drawing.Common,Version=4.0.2.0,Culture=neutral,PublicKeyToken=cc7b13ffcd2ddd51/system/drawing/printing/PageSettings.java
0659adb0561ce5ac5b743bca861d43f2ba7af4b7
[ "MIT" ]
permissive
lvyitian/JCOReflector
299a64550394db3e663567efc6e1996754f6946e
7e420dca504090b817c2fe208e4649804df1c3e1
refs/heads/master
2022-12-07T21:13:06.208025
2020-08-28T09:49:29
2020-08-28T09:49:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
18,799
java
/* * MIT License * * Copyright (c) 2020 MASES s.r.l. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /************************************************************************************** * <auto-generated> * This code was generated from a template using JCOReflector * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. * </auto-generated> *************************************************************************************/ package system.drawing.printing; import org.mases.jcobridge.*; import org.mases.jcobridge.netreflection.*; import java.util.ArrayList; // Import section import system.drawing.printing.PrinterSettings; import system.Single; import system.drawing.printing.Margins; import system.drawing.printing.PaperSize; import system.drawing.printing.PaperSource; import system.drawing.printing.PrinterResolution; import system.drawing.Rectangle; import system.drawing.RectangleF; /** * The base .NET class managing System.Drawing.Printing.PageSettings, System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51. Extends {@link NetObject}. * <p> * * See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.Drawing.Printing.PageSettings" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.Drawing.Printing.PageSettings</a> */ public class PageSettings extends NetObject { /** * Fully assembly qualified name: System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 */ public static final String assemblyFullName = "System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"; /** * Assembly name: System.Drawing.Common */ public static final String assemblyShortName = "System.Drawing.Common"; /** * Qualified class name: System.Drawing.Printing.PageSettings */ public static final String className = "System.Drawing.Printing.PageSettings"; static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName); /** * The type managed from JCOBridge. See {@link JCType} */ public static JCType classType = createType(); static JCEnum enumInstance = null; JCObject classInstance = null; static JCType createType() { try { return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName)); } catch (JCException e) { return null; } } void addReference(String ref) throws Throwable { try { bridge.AddReference(ref); } catch (JCNativeException jcne) { throw translateException(jcne); } } public PageSettings(Object instance) throws Throwable { super(instance); if (instance instanceof JCObject) { classInstance = (JCObject) instance; } else throw new Exception("Cannot manage object, it is not a JCObject"); } public String getJCOAssemblyName() { return assemblyFullName; } public String getJCOClassName() { return className; } public String getJCOObjectName() { return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } public Object getJCOInstance() { return classInstance; } public void setJCOInstance(JCObject instance) { classInstance = instance; super.setJCOInstance(classInstance); } public JCType getJCOType() { return classType; } /** * Try to cast the {@link IJCOBridgeReflected} instance into {@link PageSettings}, a cast assert is made to check if types are compatible. */ public static PageSettings cast(IJCOBridgeReflected from) throws Throwable { NetType.AssertCast(classType, from); return new PageSettings(from.getJCOInstance()); } // Constructors section public PageSettings() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.FormatException { try { // add reference to assemblyName.dll file addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public PageSettings(PrinterSettings printerSettings) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.resources.MissingManifestResourceException, system.ObjectDisposedException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArgumentOutOfRangeException, system.FormatException { try { // add reference to assemblyName.dll file addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(printerSettings == null ? null : printerSettings.getJCOInstance())); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Methods section public NetObject Clone() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objClone = (JCObject)classInstance.Invoke("Clone"); return new NetObject(objClone); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Properties section public boolean getColor() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.componentmodel.Win32Exception, system.PlatformNotSupportedException, system.AccessViolationException, system.drawing.printing.InvalidPrinterException, system.ArgumentOutOfRangeException, system.ArrayTypeMismatchException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.InvalidCastException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Get("Color"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setColor(boolean Color) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("Color", Color); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean getLandscape() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.componentmodel.Win32Exception, system.PlatformNotSupportedException, system.AccessViolationException, system.drawing.printing.InvalidPrinterException, system.ArgumentOutOfRangeException, system.ArrayTypeMismatchException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.InvalidCastException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Get("Landscape"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setLandscape(boolean Landscape) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("Landscape", Landscape); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Single getHardMarginX() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.PlatformNotSupportedException, system.componentmodel.Win32Exception, system.AccessViolationException, system.ArgumentOutOfRangeException, system.drawing.printing.InvalidPrinterException, system.ArrayTypeMismatchException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.InvalidCastException, system.MulticastNotSupportedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("HardMarginX"); return new Single(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Single getHardMarginY() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.PlatformNotSupportedException, system.componentmodel.Win32Exception, system.AccessViolationException, system.ArgumentOutOfRangeException, system.drawing.printing.InvalidPrinterException, system.ArrayTypeMismatchException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.InvalidCastException, system.MulticastNotSupportedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("HardMarginY"); return new Single(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Margins getMargins() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Margins"); return new Margins(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setMargins(Margins Margins) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("Margins", Margins == null ? null : Margins.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public PaperSize getPaperSize() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.componentmodel.Win32Exception, system.PlatformNotSupportedException, system.AccessViolationException, system.drawing.printing.InvalidPrinterException, system.ArgumentOutOfRangeException, system.ArrayTypeMismatchException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.InvalidCastException, system.OutOfMemoryException, system.IndexOutOfRangeException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("PaperSize"); return new PaperSize(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setPaperSize(PaperSize PaperSize) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("PaperSize", PaperSize == null ? null : PaperSize.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public PaperSource getPaperSource() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.PlatformNotSupportedException, system.componentmodel.Win32Exception, system.AccessViolationException, system.ArgumentOutOfRangeException, system.drawing.printing.InvalidPrinterException, system.ArrayTypeMismatchException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.InvalidCastException, system.OutOfMemoryException, system.IndexOutOfRangeException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("PaperSource"); return new PaperSource(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setPaperSource(PaperSource PaperSource) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("PaperSource", PaperSource == null ? null : PaperSource.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public PrinterResolution getPrinterResolution() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.PlatformNotSupportedException, system.componentmodel.Win32Exception, system.AccessViolationException, system.ArgumentOutOfRangeException, system.drawing.printing.InvalidPrinterException, system.ArrayTypeMismatchException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.InvalidCastException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("PrinterResolution"); return new PrinterResolution(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setPrinterResolution(PrinterResolution PrinterResolution) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("PrinterResolution", PrinterResolution == null ? null : PrinterResolution.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public PrinterSettings getPrinterSettings() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("PrinterSettings"); return new PrinterSettings(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setPrinterSettings(PrinterSettings PrinterSettings) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.FormatException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("PrinterSettings", PrinterSettings == null ? null : PrinterSettings.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Rectangle getBounds() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.PlatformNotSupportedException, system.componentmodel.Win32Exception, system.AccessViolationException, system.ArgumentOutOfRangeException, system.drawing.printing.InvalidPrinterException, system.ArrayTypeMismatchException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.InvalidCastException, system.OutOfMemoryException, system.IndexOutOfRangeException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Bounds"); return new Rectangle(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public RectangleF getPrintableArea() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.PlatformNotSupportedException, system.componentmodel.Win32Exception, system.AccessViolationException, system.ArgumentOutOfRangeException, system.drawing.printing.InvalidPrinterException, system.ArrayTypeMismatchException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.InvalidCastException, system.MulticastNotSupportedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("PrintableArea"); return new RectangleF(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Instance Events section }
8a1f93f99634e27471426b76287289b9629d6456
f55723aa83e45e639dd637cad80dc11c686dfaf6
/src/main/java/cn/crazy/appium/page/Login.java
22a9bcec64fcd77c29609f090a6e0a1b031e9665
[]
no_license
zhm721/appiumcode2
28c5ccd86b5679bcce3bd99ce51185201be59bae
75309a8e8dc228450a27bfd0aff4f2aae175f8f0
refs/heads/master
2021-04-27T03:36:56.909041
2018-02-24T07:58:56
2018-02-24T07:58:56
122,716,791
0
0
null
null
null
null
UTF-8
Java
false
false
1,846
java
package cn.crazy.appium.page; import io.appium.java_client.android.AndroidElement; import cn.crazy.appium.base.AndroidDriverBase; import cn.crazy.appium.util.GetByLocator; public class Login extends BasePage{ public AndroidElement loginBtn; public AndroidElement username; public AndroidElement password; public AndroidElement loginSubmit; public AndroidElement sheqiaoLoginBtn; public AndroidElement notLoginBtn; public AndroidElement notWarn; public AndroidElement cancle; public Login(AndroidDriverBase driver) { super(driver); // TODO Auto-generated constructor stub } public AndroidElement getNotWarn() { if(notWarn!=null){ return super.driver.findElement(GetByLocator.getLocator("notwarn")); } return notWarn; } public AndroidElement getCancle() { return super.driver.findElement(GetByLocator.getLocator("ingroe")); } public AndroidElement getLoginBtn() { return super.driver.findElement(GetByLocator.getLocator("loginOrReg")); } public AndroidElement getUsername() { return super.driver.findElement(GetByLocator.getLocator("username")); } public AndroidElement getPassword() { return super.driver.findElement(GetByLocator.getLocator("password")); } public AndroidElement getLoginSubmit() { return super.driver.findElement(GetByLocator.getLocator("loginSubmit")); } public AndroidElement getSheqiaoLoginBtn() { return super.driver.findElement(GetByLocator.getLocator("shejiaoLogin")); } public AndroidElement getNotLoginBtn() { return super.driver.findElement(GetByLocator.getLocator("notLoginBtn")); } //登录 public Home loginTest(String username,String pwd){ click(getNotWarn()); click(getCancle()); click(getLoginBtn()); sendkeys(getUsername(), username); sendkeys(getPassword(), pwd); click(getLoginSubmit()); return new Home(super.driver); } }
1a6bf0ba1ae3ede0e0c314e014003f860dfdfd71
b19fe75bfe62bff25843b2c219ca2fd252d01a59
/app/src/main/java/untag/daskom/myapplication/activity/laboran/LABORANDetilPengumuman.java
b0171116094e734025c5336b9ee80c585c8e14cc
[]
no_license
fadila08/android-SilabMikroprosessorUntagSby
bb92bf36968203191d010bf319c426ed85a013e5
7a0e51eca2771bc0d7c91d95c7444ba929c6ea8f
refs/heads/master
2020-04-27T06:33:01.436436
2019-06-27T14:03:23
2019-06-27T14:03:23
174,111,570
0
0
null
null
null
null
UTF-8
Java
false
false
3,216
java
package untag.daskom.myapplication.activity.laboran; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.Html; import android.text.method.LinkMovementMethod; import android.util.Log; import android.widget.TextView; import android.widget.Toast; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import untag.daskom.myapplication.R; import untag.daskom.myapplication.model.DataPengumumanDetailList; import untag.daskom.myapplication.model.PengumumanDetailList; import untag.daskom.myapplication.my_interface.PengumumanDetailDataService; import untag.daskom.myapplication.network.RetrofitInstance; import untag.daskom.myapplication.session.SessionManager; public class LABORANDetilPengumuman extends AppCompatActivity { String id; TextView txtJudul; TextView txtCreatedat; TextView txtIsi; TextView txtFileLampiran; SessionManager sessionManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_laborandetil_pengumuman); txtJudul = findViewById(R.id.txt_judul_pengumuman_laboran); txtCreatedat = findViewById(R.id.txt_created_at_pengumuman_laboran); txtIsi = findViewById(R.id.txt_isi_pengumuman_laboran); txtFileLampiran = findViewById(R.id.txt_file_lampiran_laboran); //untuk mengambil data session sessionManager = new SessionManager(this); String session = sessionManager.getSessionData().get("ID"); id = getIntent().getStringExtra("id"); Log.d("id", id); PengumumanDetailDataService service = RetrofitInstance.getRetrofitInstance().create(PengumumanDetailDataService.class); Call<PengumumanDetailList> call = service.getPengumumanDetail(id); call.enqueue(new Callback<PengumumanDetailList>() { @Override public void onResponse(Call<PengumumanDetailList> call, Response<PengumumanDetailList> response) { Log.d("rspon", response.body().toString()); DataPengumumanDetailList dataPengumumanDetailList = response.body().getData(); //isi variabelnya txtJudul.setText(dataPengumumanDetailList.getJudul()); txtIsi.setText(dataPengumumanDetailList.getIsi()); txtCreatedat.setText(dataPengumumanDetailList.getDiupload_pada()); String fileLampiran = dataPengumumanDetailList.getFile_lampiran(); //cek isi lampiran if ( fileLampiran != null) { txtFileLampiran.setText( Html.fromHtml("<a href=\"http://www.google.com\">unduh file lampiran</a>") ); txtFileLampiran.setMovementMethod(LinkMovementMethod.getInstance()); } } @Override public void onFailure(Call<PengumumanDetailList> call, Throwable t) { Toast.makeText(LABORANDetilPengumuman.this,"Something went wrong.....Error message : " + t.getMessage(), Toast.LENGTH_SHORT ).show(); } }); } }
475a6a6d4c0fa2f0ee1363c7cc3bd2e584eff13a
fc2e4e31bc0484cd932ade57fae3c13c4a15c0fc
/app/src/main/java/com/ypshengxian/daojia/utils/ServiceUtils.java
dd2413b8465d9daff5bae46e9a0c0c067776eef2
[]
no_license
wangxiaochou/YMDJ
8d71489b6c7d9286123ddfebe2ec500199942fcb
b45179342852f5ac21617fe0d1d8e3457170f767
refs/heads/master
2020-03-18T11:17:45.350206
2018-05-24T04:56:33
2018-05-24T04:56:33
134,662,725
1
0
null
null
null
null
UTF-8
Java
false
false
5,588
java
package com.ypshengxian.daojia.utils; import android.app.ActivityManager; import android.app.ActivityManager.RunningServiceInfo; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import java.util.HashSet; import java.util.List; import java.util.Set; /** * <p> 服务相关工具类 </p><br> * * @author lwc * @date 2017/3/10 15:58 * @note - * getAllRunningService: 获取所有运行的服务 * startService : 启动服务 * stopService : 停止服务 * bindService : 绑定服务 * unbindService : 解绑服务 * isServiceRunning : 判断服务是否运行 * ------------------------------------------------------------------------------------------------- * @modified - * @date - * @note - */ public class ServiceUtils { /** * 构造类 */ private ServiceUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } /** * 获取所有运行的服务 * * @param context 上下文 * @return 服务名集合 */ public static Set getAllRunningService(Context context) { ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List<RunningServiceInfo> infos = activityManager.getRunningServices(0x7FFFFFFF); Set<String> names = new HashSet<>(); if (infos == null || infos.size() == 0) { return null; } for (RunningServiceInfo info : infos) { names.add(info.service.getClassName()); } return names; } /** * 启动服务 * * @param context 上下文 * @param className 完整包名的服务类名 */ public static void startService(Context context, String className) { try { startService(context, Class.forName(className)); } catch (Exception e) { e.printStackTrace(); } } /** * 启动服务 * * @param context 上下文 * @param cls 服务类 */ public static void startService(Context context, Class<?> cls) { Intent intent = new Intent(context, cls); context.startService(intent); } /** * 停止服务 * * @param context 上下文 * @param className 完整包名的服务类名 * @return {@code true}: 停止成功<br>{@code false}: 停止失败 */ public static boolean stopService(Context context, String className) { try { return stopService(context, Class.forName(className)); } catch (Exception e) { e.printStackTrace(); return false; } } /** * 停止服务 * * @param context 上下文 * @param cls 服务类 * @return {@code true}: 停止成功<br>{@code false}: 停止失败 */ public static boolean stopService(Context context, Class<?> cls) { Intent intent = new Intent(context, cls); return context.stopService(intent); } /** * 绑定服务 * * @param context 上下文 * @param className 完整包名的服务类名 * @param conn 服务连接对象 * @param flags 绑定选项 * <ul> * <li>{@link Context#BIND_AUTO_CREATE}</li> * <li>{@link Context#BIND_DEBUG_UNBIND}</li> * <li>{@link Context#BIND_NOT_FOREGROUND}</li> * <li>{@link Context#BIND_ABOVE_CLIENT}</li> * <li>{@link Context#BIND_ALLOW_OOM_MANAGEMENT}</li> * <li>{@link Context#BIND_WAIVE_PRIORITY}</li> * </ul> */ public static void bindService(Context context, String className, ServiceConnection conn, int flags) { try { bindService(context, Class.forName(className), conn, flags); } catch (Exception e) { e.printStackTrace(); } } /** * 绑定服务 * * @param context 上下文 * @param cls 服务类 * @param conn 服务连接对象 * @param flags 绑定选项 * <ul> * <li>{@link Context#BIND_AUTO_CREATE}</li> * <li>{@link Context#BIND_DEBUG_UNBIND}</li> * <li>{@link Context#BIND_NOT_FOREGROUND}</li> * <li>{@link Context#BIND_ABOVE_CLIENT}</li> * <li>{@link Context#BIND_ALLOW_OOM_MANAGEMENT}</li> * <li>{@link Context#BIND_WAIVE_PRIORITY}</li> * </ul> */ public static void bindService(Context context, Class<?> cls, ServiceConnection conn, int flags) { Intent intent = new Intent(context, cls); context.bindService(intent, conn, flags); } /** * 解绑服务 * * @param context 上下文 * @param conn 服务连接对象 */ public static void unbindService(Context context, ServiceConnection conn) { context.unbindService(conn); } /** * 判断服务是否运行 * * @param context 上下文 * @param className 完整包名的服务类名 * @return {@code true}: 是<br>{@code false}: 否 */ public static boolean isServiceRunning(Context context, String className) { ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List<RunningServiceInfo> infos = activityManager.getRunningServices(0x7FFFFFFF); if (infos == null || infos.size() == 0) { return false; } for (RunningServiceInfo info : infos) { if (className.equals(info.service.getClassName())) { return true; } } return false; } }
f2f8f555f47496b35fd1e6b5eb4ed6878d526ebd
f577c99267dffb5591b7e933b57ecf94b8755724
/src/main/java/org/drip/xva/derivative/ReplicationPortfolioVertex.java
dbfab27cf9d505e2e58c25f6ac965b975537d917
[ "Apache-2.0" ]
permissive
MacroFinanceHub/DROP
18d59cf9fedbaf335e0feb890bcfbfe344c5dfa1
faa3d6469962d1420aef13863334104056d6047b
refs/heads/master
2023-03-17T07:06:26.438651
2021-03-14T04:59:56
2021-03-14T04:59:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,204
java
package org.drip.xva.derivative; /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! * Copyright (C) 2020 Lakshmi Krishnamurthy * Copyright (C) 2019 Lakshmi Krishnamurthy * Copyright (C) 2018 Lakshmi Krishnamurthy * Copyright (C) 2017 Lakshmi Krishnamurthy * * This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics, * asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment * analytics, and portfolio construction analytics within and across fixed income, credit, commodity, * equity, FX, and structured products. It also includes auxiliary libraries for algorithm support, * numerical analysis, numerical optimization, spline builder, model validation, statistical learning, * and computational support. * * https://lakshmidrip.github.io/DROP/ * * DROP is composed of three modules: * * - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/ * - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/ * - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/ * * DROP Product Core implements libraries for the following: * - Fixed Income Analytics * - Loan Analytics * - Transaction Cost Analytics * * DROP Portfolio Core implements libraries for the following: * - Asset Allocation Analytics * - Asset Liability Management Analytics * - Capital Estimation Analytics * - Exposure Analytics * - Margin Analytics * - XVA Analytics * * DROP Computational Core implements libraries for the following: * - Algorithm Support * - Computation Support * - Function Analysis * - Model Validation * - Numerical Analysis * - Numerical Optimizer * - Spline Builder * - Statistical Learning * * Documentation for DROP is Spread Over: * * - Main => https://lakshmidrip.github.io/DROP/ * - Wiki => https://github.com/lakshmiDRIP/DROP/wiki * - GitHub => https://github.com/lakshmiDRIP/DROP * - Repo Layout Taxonomy => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md * - Javadoc => https://lakshmidrip.github.io/DROP/Javadoc/index.html * - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal * - Release Versions => https://lakshmidrip.github.io/DROP/version.html * - Community Credits => https://lakshmidrip.github.io/DROP/credits.html * - Issues Catalog => https://github.com/lakshmiDRIP/DROP/issues * - JUnit => https://lakshmidrip.github.io/DROP/junit/index.html * - Jacoco => https://lakshmidrip.github.io/DROP/jacoco/index.html * * 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. */ /** * <i>ReplicationPortfolioVertex</i> contains the Dynamic Replicating Portfolio of the Pay-out using the * Assets in the Economy, from the Dealer's View Point. The References are: * * <br><br> * <ul> * <li> * Burgard, C., and M. Kjaer (2014): PDE Representations of Derivatives with Bilateral Counter-party * Risk and Funding Costs <i>Journal of Credit Risk</i> <b>7 (3)</b> 1-19 * </li> * <li> * Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): <i>Modeling, * Pricing, and Hedging Counter-party Credit Exposure - A Technical Guide</i> <b>Springer * Finance</b> New York * </li> * <li> * Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk <i>Risk</i> <b>20 (2)</b> * 86-90 * </li> * <li> * Li, B., and Y. Tang (2007): <i>Quantitative Analysis, Derivatives Modeling, and Trading * Strategies in the Presence of Counter-party Credit Risk for the Fixed Income Market</i> * <b>World Scientific Publishing</b> Singapore * </li> * <li> * Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing * <i>Risk</i> <b>21 (2)</b> 97-102 * </li> * </ul> * * <br><br> * <ul> * <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li> * <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/XVAAnalyticsLibrary.md">XVA Analytics Library</a></li> * <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/xva/README.md">Valuation Adjustments that account for Collateral, CC Credit/Debt and Funding Overhead</a></li> * <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/xva/derivative/README.md">Burgard Kjaer Dynamic Portfolio Replication</a></li> * </ul> * <br><br> * * @author Lakshmi Krishnamurthy */ public class ReplicationPortfolioVertex { private double _cashAccount = java.lang.Double.NaN; private double _positionHoldings = java.lang.Double.NaN; private double _clientNumeraireHoldings = java.lang.Double.NaN; private double _dealerSeniorNumeraireHoldings = java.lang.Double.NaN; private double _dealerSubordinateNumeraireHoldings = java.lang.Double.NaN; /** * Construct a ReplicationPortfolioVertex Instance without the Zero Recovery Dealer Numeraire * * @param positionHoldings The Asset Numeraire Holdings * @param dealerSeniorNumeraireHoldings The Dealer Senior Numeraire Holdings * @param clientNumeraireHoldings The Client Numeraire Replication Holdings * @param cashAccount The Cash Account * * @return The ReplicationPortfolioVertex Instance without the Zero Recovery Dealer Numeraire */ public static final ReplicationPortfolioVertex Standard ( final double positionHoldings, final double dealerSeniorNumeraireHoldings, final double clientNumeraireHoldings, final double cashAccount) { try { return new ReplicationPortfolioVertex ( positionHoldings, dealerSeniorNumeraireHoldings, 0., clientNumeraireHoldings, cashAccount ); } catch (java.lang.Exception e) { e.printStackTrace(); } return null; } /** * ReplicationPortfolioVertex Constructor * * @param positionHoldings The Asset Numeraire Holdings * @param dealerSeniorNumeraireHoldings The Dealer Senior Numeraire Holdings * @param dealerSubordinateNumeraireHoldings The Dealer Subordinate Numeraire Holdings * @param clientNumeraireHoldings The Client Numeraire Holdings * @param cashAccount The Cash Account * * @throws java.lang.Exception Thrown if the Inputs are Invalid */ public ReplicationPortfolioVertex ( final double positionHoldings, final double dealerSeniorNumeraireHoldings, final double dealerSubordinateNumeraireHoldings, final double clientNumeraireHoldings, final double cashAccount) throws java.lang.Exception { if (!org.drip.numerical.common.NumberUtil.IsValid (_dealerSeniorNumeraireHoldings = dealerSeniorNumeraireHoldings) || !org.drip.numerical.common.NumberUtil.IsValid (_dealerSubordinateNumeraireHoldings = dealerSubordinateNumeraireHoldings) || !org.drip.numerical.common.NumberUtil.IsValid (_clientNumeraireHoldings = clientNumeraireHoldings) || !org.drip.numerical.common.NumberUtil.IsValid (_cashAccount = cashAccount)) { throw new java.lang.Exception ("ReplicationPortfolioVertex Constructor => Invalid Inputs"); } _positionHoldings = positionHoldings; } /** * Retrieve the Number of Position Holdings * * @return The Number of Position Holdings */ public double positionHoldings() { return _positionHoldings; } /** * Retrieve the Number of Dealer Senior Numeraire Holdings * * @return The Number of Dealer Senior Numeraire Holdings */ public double dealerSeniorNumeraireHoldings() { return _dealerSeniorNumeraireHoldings; } /** * Retrieve the Number of Dealer Subordinate Numeraire Holdings * * @return The Number of Dealer Subordinate Numeraire Holdings */ public double dealerSubordinateNumeraireHoldings() { return _dealerSubordinateNumeraireHoldings; } /** * Retrieve the Client Numeraire Holdings * * @return The Client Numeraire Holdings */ public double clientNumeraireHoldings() { return _clientNumeraireHoldings; } /** * Retrieve the Cash Account Amount * * @return The Cash Account Amount */ public double cashAccount() { return _cashAccount; } /** * Compute the Market Value of the Dealer Position Pre-Default * * @param marketVertex The Market Vertex * * @return The Market Value of the Dealer Position Pre-Default * * @throws java.lang.Exception Thrown if the Inputs are Invalid */ public double dealerPreDefaultPositionValue ( final org.drip.exposure.universe.MarketVertex marketVertex) throws java.lang.Exception { if (null == marketVertex) { throw new java.lang.Exception ("ReplicationPortfolioVertex::dealerPreDefaultPositionValue => Invalid Inputs"); } org.drip.exposure.universe.MarketVertexEntity dealerMarketVertex = marketVertex.dealer(); double value = -1. * dealerMarketVertex.seniorFundingReplicator() * _dealerSeniorNumeraireHoldings; double dealerSubordinateFundingMarketVertex = dealerMarketVertex.subordinateFundingReplicator(); if (org.drip.numerical.common.NumberUtil.IsValid (dealerSubordinateFundingMarketVertex)) { value -= dealerSubordinateFundingMarketVertex * _dealerSubordinateNumeraireHoldings; } return value; } /** * Compute the Market Value of the Dealer Position Post-Default * * @param marketVertex The Market Vertex * * @return The Market Value of the Dealer Position Post-Default * * @throws java.lang.Exception Thrown if the Inputs are Invalid */ public double dealerPostDefaultPositionValue ( final org.drip.exposure.universe.MarketVertex marketVertex) throws java.lang.Exception { if (null == marketVertex) { throw new java.lang.Exception ("ReplicationPortfolioVertex::dealerPostDefaultPositionValue => Invalid Inputs"); } org.drip.exposure.universe.MarketVertexEntity dealerMarketVertex = marketVertex.dealer(); double value = dealerMarketVertex.seniorFundingReplicator() * _dealerSeniorNumeraireHoldings * dealerMarketVertex.seniorRecoveryRate(); double dealerSubordinateFundingMarketVertex = dealerMarketVertex.subordinateFundingReplicator(); if (org.drip.numerical.common.NumberUtil.IsValid (dealerSubordinateFundingMarketVertex)) { value -= dealerSubordinateFundingMarketVertex * _dealerSubordinateNumeraireHoldings * dealerMarketVertex.subordinateRecoveryRate(); } return value; } }
ce101aa70222548f0bc8e18242076c84bac2ec26
c941ea08ca4a02ac0e4cc9573ca71ad9c5f9e901
/app/src/test/java/com/example/dynamicbuttonadding/ExampleUnitTest.java
247926535860ca1c0a23cd1dc2729d1500352121
[]
no_license
SwarnaMadhuriP/DynamicButtonAdding1
5d4c31fa10ace46d9cb744036f3ebf39f89ddabf
85c207ac92b0e8fdcdcc2d298138dff275a54cd0
refs/heads/master
2022-06-18T09:57:47.578649
2020-05-02T10:35:21
2020-05-02T10:35:21
260,648,194
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package com.example.dynamicbuttonadding; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
56739d1892aa27799abdded5b72e3daec7b14e43
38e0cdfc0b68addbd910d541f915720d38c19bd5
/app/src/main/java/es/iesquevedo/descubreespana/ui/nuevopunto/NuevoPuntoFragment.java
b09527e5c2dc9de1f7163a357a68feb2e75ba56d
[]
no_license
gcuadrado/DescubreEspana_Android
2f7231212ef9d1c83450f60f4886ab95fdc44479
9422f7bda3a90b7e2bdfe4c2920cdb609daf886d
refs/heads/master
2022-09-24T21:41:15.217140
2020-06-07T14:21:23
2020-06-07T14:21:23
248,971,086
0
0
null
null
null
null
UTF-8
Java
false
false
12,332
java
package es.iesquevedo.descubreespana.ui.nuevopunto; import android.content.DialogInterface; import android.content.Intent; import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProvider; import androidx.navigation.NavController; import androidx.navigation.Navigation; import com.bumptech.glide.Glide; import com.esafirm.imagepicker.features.ImagePicker; import com.esafirm.imagepicker.features.ReturnMode; import com.esafirm.imagepicker.model.Image; import com.mobsandgeeks.saripaar.ValidationError; import com.mobsandgeeks.saripaar.Validator; import com.mobsandgeeks.saripaar.annotation.NotEmpty; import java.util.List; import es.iesquevedo.descubreespana.R; import es.iesquevedo.descubreespana.asynctask.AddPoiTask; import es.iesquevedo.descubreespana.databinding.NuevoPuntoFragmentBinding; import es.iesquevedo.descubreespana.modelo.ApiError; import es.iesquevedo.descubreespana.modelo.dto.PuntoInteresDtoGetDetalle; import es.iesquevedo.descubreespana.servicios.ServiciosPuntoInteres; import es.iesquevedo.descubreespana.utils.FotosAdapter; import io.vavr.control.Either; public class NuevoPuntoFragment extends Fragment { public static final double COSTE_GRATUITO = -1d; private NuevoPuntoViewModel nuevoPuntoViewModel; private NuevoPuntoFragmentBinding binding; private PuntoInteresDtoGetDetalle nuevoPuntoInteres; private List<Image> images; private ServiciosPuntoInteres serviciosPuntoInteres; private Validator validator; @NotEmpty(message = "Debes introducir un nombre") private EditText etNombre; @NotEmpty(message = "Debes introducir una descripción del lugar") private EditText etInformacion; private EditText etDireccion; private EditText etContacto; @NotEmpty(message = "Es necesario indicar el coste") private EditText etCoste; private EditText etEnlace; private EditText etFecha; @NotEmpty(message = "Establece un horario, si no lo conoces, indícalo") private EditText etHorario; private NavController navController; private AlertDialog dialog; public static NuevoPuntoFragment newInstance() { return new NuevoPuntoFragment(); } @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { binding = NuevoPuntoFragmentBinding.inflate(inflater, container, false); nuevoPuntoViewModel = new ViewModelProvider(requireActivity()).get(NuevoPuntoViewModel.class); return binding.getRoot(); } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); nuevoPuntoInteres = NuevoPuntoFragmentArgs.fromBundle(getArguments()).getNuevoPunto(); binding.etDireccion.setText(nuevoPuntoInteres.getDireccion()); serviciosPuntoInteres = new ServiciosPuntoInteres(); inicializarViews(); setListeners(); } private void setListeners() { validator.setValidationListener(new Validator.ValidationListener() { @Override public void onValidationSucceeded() { if (images != null && !images.isEmpty()) { if (nuevoPuntoViewModel.getmImagenPrincipal().getValue() != null) { nuevoPuntoInteres.setNombre(binding.etNombre.getText().toString()); nuevoPuntoInteres.setInfoDetallada(binding.etInformacion.getText().toString()); nuevoPuntoInteres.setResumen(binding.etInformacion.getText().toString()); nuevoPuntoInteres.setFechaInicio(binding.etFecha.getText().toString()); nuevoPuntoInteres.setCategoria(binding.spinnerCategoria.getSelectedItem().toString()); nuevoPuntoInteres.setDireccion(binding.etDireccion.getText().toString()); nuevoPuntoInteres.setContacto(binding.etContacto.getText().toString()); if(!binding.cbGratuito.isChecked()) { nuevoPuntoInteres.setCoste(Double.parseDouble(binding.etCoste.getText().toString())); }else{ nuevoPuntoInteres.setCoste(COSTE_GRATUITO); } nuevoPuntoInteres.setEnlaceInfo(binding.etEnlace.getText().toString()); nuevoPuntoInteres.setAccesibilidad(binding.cbAccesibilidad.isChecked()); nuevoPuntoInteres.setHorario(binding.etHorario.getText().toString()); new AddPoiTask(serviciosPuntoInteres, nuevoPuntoInteres, images, nuevoPuntoViewModel.getmImagenPrincipal().getValue()) { @Override protected void onPreExecute() { dialog.show(); } @Override protected void onPostExecute(Either<ApiError, PuntoInteresDtoGetDetalle> result) { dialog.dismiss(); if (result.isRight()) { new AlertDialog.Builder(requireContext()) .setCancelable(false) .setTitle("¡Perfecto!") .setMessage("Tu solicitud ha sido recogida correctamente. Te enviaremos un email en cuanto la aceptemos") .setNeutralButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); navController.navigate(R.id.navigation_home); } }) .create().show(); } else { Toast.makeText(requireContext(), result.getLeft().getMessage(), Toast.LENGTH_SHORT).show(); } } }.execute(); } else { binding.imageViewPrincipal.setBackgroundResource(R.drawable.error_imagen_principal); Toast.makeText(requireContext(), "Selecciona una de tus imágenes como imagen principal", Toast.LENGTH_LONG).show(); } } else { //Le metemos el background como tag para recuperarlo luego binding.btnImagePicker.setTag(binding.btnImagePicker.getBackground()); binding.btnImagePicker.setBackgroundResource(R.drawable.error_imagen_principal); Toast.makeText(requireContext(), "Debes incluir al menos una fotografía", Toast.LENGTH_LONG).show(); } } @Override public void onValidationFailed(List<ValidationError> errors) { for (ValidationError error : errors) { View view = error.getView(); String message = error.getCollatedErrorMessage(requireContext()); // Display error messages ;) if (view instanceof EditText) { ((EditText) view).setError(message); } else { Toast.makeText(requireContext(), message, Toast.LENGTH_LONG).show(); } } } }); binding.btnImagePicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { ImagePicker.create(NuevoPuntoFragment.this) .returnMode(ReturnMode.NONE) // set whether pick and / or camera action should return immediate result or not. .folderMode(true) // folder mode (false by default) .toolbarFolderTitle("Directorios") // folder selection title .toolbarImageTitle("Toca para seleccionar") // image selection title .toolbarArrowColor(Color.BLACK) // Toolbar 'up' arrow color .multi() // multi mode (default mode) .limit(5) // max images can be selected (99 by default) .showCamera(true) // show camera or not (true by default) .imageDirectory("Cámara") // directory name for captured image ("Camera" folder by default) .start(); } catch (Exception e) { Log.d("descubreespana", null, e); } } }); binding.btEnviarPunto.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { validator.validate(); } }); binding.cbGratuito.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked){ binding.etCoste.setEnabled(false); }else{ binding.etCoste.setEnabled(true); } } }); } private void inicializarViews() { etNombre = binding.etNombre; etInformacion = binding.etInformacion; etDireccion = binding.etDireccion; etContacto = binding.etContacto; etCoste = binding.etCoste; etEnlace = binding.etEnlace; etFecha = binding.etFecha; etHorario = binding.etHorario; navController = Navigation.findNavController(requireActivity(), R.id.nav_host_fragment); validator = new Validator(this); AlertDialog.Builder builder = new AlertDialog.Builder(requireContext()); builder.setCancelable(false); // if you want user to wait for some process to finish, builder.setView(R.layout.layout_loading_dialog); dialog = builder.create(); } @Override public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { if (ImagePicker.shouldHandle(requestCode, resultCode, data)) { //Eliminamos el recuadro rojo en caso de que lo tuviera if (binding.btnImagePicker.getTag() != null) { binding.btnImagePicker.setBackground((Drawable) binding.btnImagePicker.getTag()); } // Get a list of picked images images = ImagePicker.getImages(data); if (!images.isEmpty()) { binding.recyclerImagenes.setAdapter(new FotosAdapter(images, nuevoPuntoViewModel)); nuevoPuntoViewModel.getmImagenPrincipal().observe(getViewLifecycleOwner(), new Observer<Image>() { @Override public void onChanged(@Nullable Image image) { Glide.with(requireContext()).load(image.getPath()).into(binding.imageViewPrincipal); //binding.imageViewPrincipal.setTag(image); } }); binding.tvImagenPrincipal.setVisibility(View.VISIBLE); binding.imageViewPrincipal.setVisibility(View.VISIBLE); } } super.onActivityResult(requestCode, resultCode, data); } }
10f3d40652b23bb9fc8e3e1f07e7c8876126d994
39abd01331701304dc3e9019d2c12dfdf2f14cb6
/src/practicechapter/StarPattern16.java
945ca5653867b3dc7ede2b3c1306d6586c549fba
[]
no_license
Subham-sahoo/JAVA_SIMPLE_PROGRAMMING
78acd0d6a45ebc350acf70adf2816ccad35f1cbd
72e329ae45f85d7901183c897cb3e7a6c9172104
refs/heads/master
2020-09-19T14:34:34.351385
2020-06-05T17:46:59
2020-06-05T17:46:59
224,237,808
0
0
null
null
null
null
UTF-8
Java
false
false
287
java
package practicechapter; public class StarPattern16 { public static void main(String[] args) { int n=5;char c='a',x='a'; for(int i=1;i<=n;i++) { if(i%2==0) { c='O'; }else { c=x++; } for(int j=1;j<=i;j++) { System.out.print(c + " "); } System.out.println(); } } }
32ee8a25593944ee2c67926736259b545d10e0b1
4832b6ed987ff59527feff04424407f748927354
/Weddingproject/src/test/java/com/niit/Weddingproject/test/CategoryTest.java
66ef5c88a801fa43cf71121eda6ed89eb4303d79
[]
no_license
Rindumathi/WeddingPurchase
11d15da8220a0276c7a3dd4c87e5e3ba59af643a
27449d74765d4662fb0367a7fa5e878136c4d61b
refs/heads/master
2021-01-22T01:10:28.949257
2017-09-06T13:00:58
2017-09-06T13:00:58
102,200,547
0
0
null
null
null
null
UTF-8
Java
false
false
1,622
java
package com.niit.Weddingproject.test; import java.util.List; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import com.niit.Dao.CategoryDao; import com.niit.model.CategoryInfo; public class CategoryTest { public static void main(String args[]) { AnnotationConfigApplicationContext context=new AnnotationConfigApplicationContext(); context.scan("com.niit.*"); context.refresh(); System.out.println(46); CategoryInfo categoryInfo=(CategoryInfo)context.getBean("categoryInfo"); CategoryDao categoryDao=(CategoryDao)context.getBean("categoryDao"); categoryInfo.setCatid("101"); categoryInfo.setCatname("Madhu"); if(categoryDao.saveorupdate(categoryInfo)==true) { System.out.println("Category is saved successfully"); } else { System.out.println("Category is not saved"); } categoryInfo.setCatid("102"); categoryInfo.setCatname("kalai"); if(categoryDao.saveorupdate(categoryInfo)==true) { System.out.println("Category is saved successfully"); } else { System.out.println("Category is not saved"); } categoryInfo=categoryDao.Getcategory("102"); if(categoryDao.delete(categoryInfo)==true) { System.out.println("Category deleted"); } else { System.out.println("Category not deleted"); } categoryInfo=categoryDao.Getcategory("101"); if(categoryInfo==null) { System.out.println("Category not found"); } else { System.out.println(categoryInfo.getCatid()); System.out.println(categoryInfo.getCatname()); } List<CategoryInfo> cat=categoryDao.list(); for(CategoryInfo c : cat) { System.out.println(c.getCatid()); System.out.println(c.getCatname()); } } }
a4febf779baad28d13cbd428246f720be3dcd596
bf7b4c21300a8ccebb380e0e0a031982466ccd83
/middlewareConcepts2014-master/Assignment3/lib/jacorb-3.4/src/generated/org/omg/PortableServer/POAManagerFactoryHolder.java
fd733e8a6b5d4cbb1e94f4acfdc4f9340b77331f
[]
no_license
Puriakshat/Tuberlin
3fe36b970aabad30ed95e8a07c2f875e4912a3db
28dcf7f7edfe7320c740c306b1c0593a6c1b3115
refs/heads/master
2021-01-19T07:30:16.857479
2014-11-06T18:49:16
2014-11-06T18:49:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package org.omg.PortableServer; /** * Generated from IDL interface "POAManagerFactory". * * @author JacORB IDL compiler V @project.version@ * @version generated at 27-May-2014 20:14:30 */ public final class POAManagerFactoryHolder implements org.omg.CORBA.portable.Streamable{ public POAManagerFactory value; public POAManagerFactoryHolder() { } public POAManagerFactoryHolder (final POAManagerFactory initial) { value = initial; } public org.omg.CORBA.TypeCode _type() { return POAManagerFactoryHelper.type(); } public void _read (final org.omg.CORBA.portable.InputStream in) { value = POAManagerFactoryHelper.read (in); } public void _write (final org.omg.CORBA.portable.OutputStream _out) { POAManagerFactoryHelper.write (_out,value); } }
d64498833ef10f39f8dc32574c9fb6203681df0a
ac8d489834eb5623e735a6911eff3371fe4eedff
/fair-sc/src/main/java/cn/paulpaulzhang/fair/sc/main/user/adapter/GoodsManageAdapter.java
a783167c9f0525f7f13dab026e07b0f26a1c9084
[]
no_license
paulpaulzhang/FairFest
51c3aecfbf48018fd74df6a708fc10806dc7646c
f73c6d92197af4ef7d6888704569469aaf190dd3
refs/heads/master
2020-05-24T15:31:43.690844
2019-10-07T11:11:43
2019-10-07T11:11:43
187,331,026
0
0
null
null
null
null
UTF-8
Java
false
false
5,864
java
package cn.paulpaulzhang.fair.sc.main.user.adapter; import android.content.Intent; import android.net.Uri; import android.text.TextUtils; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.AppCompatTextView; import com.alibaba.fastjson.JSON; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.facebook.drawee.view.SimpleDraweeView; import com.google.android.material.button.MaterialButton; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import java.util.List; import cn.paulpaulzhang.fair.app.AccountManager; import cn.paulpaulzhang.fair.constant.Api; import cn.paulpaulzhang.fair.constant.UserConfigs; import cn.paulpaulzhang.fair.net.RestClient; import cn.paulpaulzhang.fair.sc.R; import cn.paulpaulzhang.fair.sc.database.Entity.User; import cn.paulpaulzhang.fair.sc.database.ObjectBox; import cn.paulpaulzhang.fair.sc.main.user.activity.SettingActivity; import cn.paulpaulzhang.fair.sc.main.user.model.Goods; import cn.paulpaulzhang.fair.sc.sign.SignUpActivity; import cn.paulpaulzhang.fair.util.storage.FairPreference; import es.dmoral.toasty.Toasty; import io.objectbox.Box; /** * 包名:cn.paulpaulzhang.fair.sc.main.user.adapter * 创建时间:9/18/19 * 创建人: paulpaulzhang * 描述: */ public class GoodsManageAdapter extends BaseQuickAdapter<Goods, BaseViewHolder> { public GoodsManageAdapter(int layoutResId, @Nullable List<Goods> data) { super(layoutResId, data); } @Override protected void convert(BaseViewHolder helper, Goods item) { helper.setText(R.id.tv_name, item.getSname()) .setText(R.id.tv_price, String.valueOf(item.getPrice())) .setText(R.id.tv_info, item.getOverview()); AppCompatTextView mStatus = helper.getView(R.id.tv_status); SimpleDraweeView mPicture = helper.getView(R.id.dv_picture); MaterialButton mShelf = helper.getView(R.id.btn_shelf); MaterialButton mObtained = helper.getView(R.id.btn_obtained); MaterialButton mDelete = helper.getView(R.id.btn_delete); int status = item.getIsSold(); if (status == 0) { mStatus.setText("售卖中"); } else if (status == 1) { mStatus.setText("已售出"); } else if (status == 2) { mStatus.setText("已下架"); } mPicture.setImageURI(Uri.parse(item.getHeadImg())); mShelf.setOnClickListener(v -> RestClient.builder() .url(Api.SET_STORE_STATUS) .params("sid", item.getSid()) .params("status", 0) .success(response -> { String result = JSON.parseObject(response).getString("result"); if (TextUtils.equals(result, "ok")) { mStatus.setText("售卖中"); Toasty.success(mContext, "已上架", Toasty.LENGTH_SHORT).show(); } else { Toasty.error(mContext, "上架失败", Toasty.LENGTH_SHORT).show(); } }) .error((code, msg) -> Toasty.error(mContext, "上架失败 " + code, Toasty.LENGTH_SHORT).show()) .build() .post()); mObtained.setOnClickListener(v -> RestClient.builder() .url(Api.SET_STORE_STATUS) .params("sid", item.getSid()) .params("status", 2) .success(response -> { String result = JSON.parseObject(response).getString("result"); if (TextUtils.equals(result, "ok")) { mStatus.setText("已下架"); Toasty.success(mContext, "已下架", Toasty.LENGTH_SHORT).show(); } else { Toasty.error(mContext, "下架失败", Toasty.LENGTH_SHORT).show(); } }) .error((code, msg) -> Toasty.error(mContext, "下架失败 " + code, Toasty.LENGTH_SHORT).show()) .build() .post()); mDelete.setOnClickListener(v -> { AlertDialog dialog = new MaterialAlertDialogBuilder(mContext) .setTitle("操作确认") .setMessage("点击确认下架并删除该宝贝") .setPositiveButton("确认", (dialogInterface, i) -> { RestClient.builder() .url(Api.DELETE_STORE) .params("sid", item.getSid()) .success(response -> { String result = JSON.parseObject(response).getString("result"); if (TextUtils.equals(result, "ok")) { remove(helper.getLayoutPosition()); } else { Toasty.error(mContext, "删除失败", Toasty.LENGTH_SHORT).show(); } }) .error((code, msg) -> Toasty.error(mContext, "删除失败 " + code, Toasty.LENGTH_SHORT).show()) .build() .post(); dialogInterface.dismiss(); }) .setNegativeButton("取消", (dialogInterface, i) -> dialogInterface.dismiss()) .show(); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(mContext.getColor(android.R.color.holo_red_light)); dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(mContext.getColor(R.color.font_default)); }); } }
e5f6346e2dd984a0c3cad12ee9733aa4541312b1
0c24d49da33e857d4b6064c0d35e459e3c2fc5db
/2019-TAMUCTF/Android/2. Local Weather/weather/classes3.dex_source_from_JADX/sources/android/support/v4/app/RemoteInputCompatJellybean.java
e6ad1302994cdbabe6cdedcabead9c8a55f7cd93
[]
no_license
nadrojisk/ctf-writeups
87ba0526e1f45aae2c126c68df30576dab040002
17e064c84b556d5fcbef3ae1a28a859126f513f7
refs/heads/master
2023-01-02T14:53:16.203246
2020-10-30T17:59:22
2020-10-30T17:59:22
279,992,616
0
0
null
2020-10-30T18:00:11
2020-07-15T22:19:25
Smali
UTF-8
Java
false
false
3,614
java
package android.support.v4.app; import android.content.ClipData; import android.content.ClipDescription; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.RemoteInputCompatBase.RemoteInput; import android.support.v4.app.RemoteInputCompatBase.RemoteInput.Factory; class RemoteInputCompatJellybean { public static final String EXTRA_RESULTS_DATA = "android.remoteinput.resultsData"; private static final String KEY_ALLOW_FREE_FORM_INPUT = "allowFreeFormInput"; private static final String KEY_CHOICES = "choices"; private static final String KEY_EXTRAS = "extras"; private static final String KEY_LABEL = "label"; private static final String KEY_RESULT_KEY = "resultKey"; public static final String RESULTS_CLIP_LABEL = "android.remoteinput.results"; RemoteInputCompatJellybean() { } static RemoteInput fromBundle(Bundle data, Factory factory) { return factory.build(data.getString(KEY_RESULT_KEY), data.getCharSequence(KEY_LABEL), data.getCharSequenceArray(KEY_CHOICES), data.getBoolean(KEY_ALLOW_FREE_FORM_INPUT), data.getBundle(KEY_EXTRAS)); } static Bundle toBundle(RemoteInput remoteInput) { Bundle data = new Bundle(); data.putString(KEY_RESULT_KEY, remoteInput.getResultKey()); data.putCharSequence(KEY_LABEL, remoteInput.getLabel()); data.putCharSequenceArray(KEY_CHOICES, remoteInput.getChoices()); data.putBoolean(KEY_ALLOW_FREE_FORM_INPUT, remoteInput.getAllowFreeFormInput()); data.putBundle(KEY_EXTRAS, remoteInput.getExtras()); return data; } static RemoteInput[] fromBundleArray(Bundle[] bundles, Factory factory) { if (bundles == null) { return null; } RemoteInput[] remoteInputs = factory.newArray(bundles.length); for (int i = 0; i < bundles.length; i++) { remoteInputs[i] = fromBundle(bundles[i], factory); } return remoteInputs; } static Bundle[] toBundleArray(RemoteInput[] remoteInputs) { if (remoteInputs == null) { return null; } Bundle[] bundles = new Bundle[remoteInputs.length]; for (int i = 0; i < remoteInputs.length; i++) { bundles[i] = toBundle(remoteInputs[i]); } return bundles; } static Bundle getResultsFromIntent(Intent intent) { ClipData clipData = intent.getClipData(); if (clipData == null) { return null; } ClipDescription clipDescription = clipData.getDescription(); if (clipDescription.hasMimeType("text/vnd.android.intent") && clipDescription.getLabel().equals("android.remoteinput.results")) { return (Bundle) clipData.getItemAt(0).getIntent().getExtras().getParcelable("android.remoteinput.resultsData"); } return null; } static void addResultsToIntent(RemoteInput[] remoteInputs, Intent intent, Bundle results) { Bundle resultsBundle = new Bundle(); for (RemoteInput remoteInput : remoteInputs) { Object result = results.get(remoteInput.getResultKey()); if (result instanceof CharSequence) { resultsBundle.putCharSequence(remoteInput.getResultKey(), (CharSequence) result); } } Intent clipIntent = new Intent(); clipIntent.putExtra("android.remoteinput.resultsData", resultsBundle); intent.setClipData(ClipData.newIntent("android.remoteinput.results", clipIntent)); } }
611078b5b203070eff8c36de3334cc33c145b634
fa7e6a717bc28e3c8347fbd6e1a93cd2d03be248
/WagesCalculation.java
d4270d527dd8d95c0be700d3bc9f1f0126531d7f
[]
no_license
changzeng/ccf
709eb15554fce3891a0fbf1a3c44cdbfb9ad2a62
93ebfe8a21dae95a273164a94acb2976dc617a49
refs/heads/master
2020-05-22T11:47:20.916538
2017-04-22T14:10:40
2017-04-22T14:10:40
84,696,044
1
0
null
null
null
null
UTF-8
Java
false
false
1,027
java
import java.util.Scanner; public class WagesCalculation{ public static void main(String[] args){ Scanner in = new Scanner(System.in); int input_wages = in.nextInt(); int tax_wages = input_wages - 3500; if(tax_wages <= 0) System.out.println(input_wages); int[] max_cost = new int[6]; int[] sep = {1500,4500,9000,35000,55000,80000}; double[] rate = {0.03,0.1,0.2,0.25,0.3,0.35,0.45}; int[] new_sep = new int[6]; int tmp,i,j; max_cost[0] = (int)(1500*0.03); for(i=1;i<6;i++){ max_cost[i] = (int)((sep[i] - sep[i-1])*rate[i]); } for(i=0;i<6;i++){ tmp = sep[i]; for(j=0;j<=i;j++) tmp -= max_cost[j]; new_sep[i] = tmp; } int out = 0; for(i=0;i<6;i++){ if(tax_wages < new_sep[i]){ if(i == 0) out = tax_wages; else out = tax_wages - new_sep[i-1]; break; } } int max = i; int total_salary = (int)(out/(1-rate[max])) + 3500 + tax_wages - out; for(i=0;i<max;i++){ total_salary += max_cost[i]; } System.out.println(total_salary); } }
3fc635a2ef355758ebc426f397f86cfc32d03123
78c1bd5452dd14d28d80e0174644d9b458e5a522
/app/build/generated/source/buildConfig/release/com/horizon/BuildConfig.java
6e3ecb325be83ffd3bcefa7b0cddcfa26a629291
[]
no_license
destinywz/Horizon
984619a5a59c5e84a843d170b3bd8a8ad786b1be
fd1c481361ef90d93fbb4c3116b70b048a2d7aba
refs/heads/master
2020-04-13T18:30:11.502627
2018-12-28T07:23:14
2018-12-28T07:23:58
163,376,111
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
/** * Automatically generated file. DO NOT MODIFY */ package com.horizon; public final class BuildConfig { public static final boolean DEBUG = false; public static final String APPLICATION_ID = "com.horizon"; public static final String BUILD_TYPE = "release"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
00151120d6e1516bac2b78562604d93053114a5a
13c68c3dc922acfb8171ab7418451156ab8ea0c5
/app/build/generated/source/r/debug/com/alibaba/android/vlayout/R.java
bce6aa595062f9defbdacd710de4250ab21446ee
[]
no_license
sceneren/yuntx_sdk_new_ui
d94ca530759c7682b20a72c7e612ec9a6cdb70ea
9e6ffcd03ab022e0bc680d5e95057886a3a79b6c
refs/heads/master
2020-06-10T08:19:13.122557
2019-06-25T02:46:02
2019-06-25T02:46:02
193,621,948
0
1
null
null
null
null
UTF-8
Java
false
false
1,265
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 com.alibaba.android.vlayout; public final class R { public static final class attr { public static final int layoutManager = 0x7f010076; public static final int reverseLayout = 0x7f010078; public static final int spanCount = 0x7f010077; public static final int stackFromEnd = 0x7f010079; } public static final class dimen { public static final int item_touch_helper_max_drag_scroll_per_frame = 0x7f0900be; } public static final class id { public static final int item_touch_helper_previous_elevation = 0x7f0f0010; } public static final class styleable { public static final int[] RecyclerView = { 0x010100c4, 0x7f010076, 0x7f010077, 0x7f010078, 0x7f010079 }; public static final int RecyclerView_android_orientation = 0; public static final int RecyclerView_layoutManager = 1; public static final int RecyclerView_reverseLayout = 3; public static final int RecyclerView_spanCount = 2; public static final int RecyclerView_stackFromEnd = 4; } }
1275d80e67b19da7187415343e17a01ea2441fad
8fdf675816fc31107c38601c3ae81de124ae060e
/ExamPreparations2/src/PawInc/models/animals/Dog.java
4e6772218f13959db4da1a09ed608b13e3eba4bd
[ "MIT" ]
permissive
Dochko0/OOP_Basics_October_2017
af8294873475867062102ec31656e4ef4166080f
c992729ef893b63bbfc2eff4636606ab2ee7f363
refs/heads/master
2021-04-27T08:30:46.576181
2018-02-22T14:45:01
2018-02-22T14:45:01
122,491,481
0
0
null
null
null
null
UTF-8
Java
false
false
432
java
package PawInc.models.animals; public class Dog extends Animal{ private int commands; Dog(String name, int age, int commands) { super(name, age); this.commands = commands; } public Dog(String name, int age, String adoptionCenter, int commands) { super(name, age, adoptionCenter); this.commands=commands; } public int getCommands() { return this.commands; } }
07ea2e4287ca5bcd404ebfaa760a8fcb33327f61
4a7ef9815f7fa2e44d952d9613f7cc53d6123a8b
/src/test/java/guru/springframework/spring5recipeapp/converters/RecipeCommandToRecipeTest.java
dd4c5adfc7baa19f3dc32ad1420b13c8453e06a8
[]
no_license
FernandoArellano/spring5-recipe-app
282f957a27fcbf2576795c7d3b89629c9dc362eb
e0b71bf0e6b02487b033508e194f3bd5cbf16b48
refs/heads/master
2023-04-15T03:10:04.950070
2023-04-01T00:12:37
2023-04-01T00:12:37
611,879,424
0
0
null
2023-03-17T18:48:42
2023-03-09T18:21:29
Java
UTF-8
Java
false
false
3,944
java
package guru.springframework.spring5recipeapp.converters; import guru.springframework.spring5recipeapp.commands.CategoryCommand; import guru.springframework.spring5recipeapp.commands.IngredientCommand; import guru.springframework.spring5recipeapp.commands.NotesCommand; import guru.springframework.spring5recipeapp.commands.RecipeCommand; import guru.springframework.spring5recipeapp.domain.Difficulty; import guru.springframework.spring5recipeapp.domain.Recipe; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class RecipeCommandToRecipeTest { public static final Long RECIPE_ID = 1L; public static final Integer COOK_TIME = Integer.valueOf("5"); public static final Integer PREP_TIME = Integer.valueOf("7"); public static final String DESCRIPTION = "My Recipe"; public static final String DIRECTIONS = "Directions"; public static final Difficulty DIFFICULTY = Difficulty.EASY; public static final Integer SERVINGS = Integer.valueOf("3"); public static final String SOURCE = "Source"; public static final String URL = "Some URL"; public static final Long CAT_ID_1 = 1L; public static final Long CAT_ID2 = 2L; public static final Long INGRED_ID_1 = 3L; public static final Long INGRED_ID_2 = 4L; public static final Long NOTES_ID = 9L; RecipeCommandToRecipe converter; @Before public void setUp() throws Exception { converter = new RecipeCommandToRecipe(new CategoryCommandToCategory(), new IngredientCommandToIngredient(new UnitOfMeasureCommandToUnitOfMeasure()), new NotesCommandToNotes()); } @Test public void testNullObject() throws Exception { assertNull(converter.convert(null)); } @Test public void testEmptyObject() throws Exception { assertNotNull(converter.convert(new RecipeCommand())); } @Test public void convert() throws Exception { //given RecipeCommand recipeCommand = new RecipeCommand(); recipeCommand.setId(RECIPE_ID); recipeCommand.setCookTime(COOK_TIME); recipeCommand.setPrepTime(PREP_TIME); recipeCommand.setDescription(DESCRIPTION); recipeCommand.setDifficulty(DIFFICULTY); recipeCommand.setDirections(DIRECTIONS); recipeCommand.setServings(SERVINGS); recipeCommand.setSource(SOURCE); recipeCommand.setUrl(URL); NotesCommand notes = new NotesCommand(); notes.setId(NOTES_ID); recipeCommand.setNotes(notes); CategoryCommand category = new CategoryCommand(); category.setId(CAT_ID_1); CategoryCommand category2 = new CategoryCommand(); category2.setId(CAT_ID2); recipeCommand.getCategories().add(category); recipeCommand.getCategories().add(category2); IngredientCommand ingredient = new IngredientCommand(); ingredient.setId(INGRED_ID_1); IngredientCommand ingredient2 = new IngredientCommand(); ingredient2.setId(INGRED_ID_2); recipeCommand.getIngredients().add(ingredient); recipeCommand.getIngredients().add(ingredient2); //when Recipe recipe = converter.convert(recipeCommand); assertNotNull(recipe); assertEquals(RECIPE_ID, recipe.getId()); assertEquals(COOK_TIME, recipe.getCookTime()); assertEquals(PREP_TIME, recipe.getPrepTime()); assertEquals(DESCRIPTION, recipe.getDescription()); assertEquals(DIFFICULTY, recipe.getDifficulty()); assertEquals(DIRECTIONS, recipe.getDirections()); assertEquals(SERVINGS, recipe.getServings()); assertEquals(SOURCE, recipe.getSource()); assertEquals(URL, recipe.getUrl()); assertEquals(NOTES_ID, recipe.getNotes().getId()); assertEquals(2, recipe.getCategories().size()); assertEquals(2, recipe.getIngredients().size()); } }
6d27a4d1ce292e85de46946f4ca3ea1b6c7afccf
d40ae6dca13e6be7c914f6a9fc3539b3ea201a7d
/extensions/robospice-spring-android-parent/robospice-spring-android-test/src/com/octo/android/robospice/springandroid/test/model/xml/Forecast.java
f813f008568037a8a3e40baea66935b05a4d66a3
[ "Apache-2.0" ]
permissive
hakan42/robospice
f8fabfe3dc54699b5c4fe25597d1293aabdb68b3
a93ee5d7ee6c565ec72995614de93a8808292920
refs/heads/master
2021-01-17T05:26:00.163051
2013-01-02T15:54:25
2013-01-02T15:54:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,354
java
package com.octo.android.robospice.springandroid.test.model.xml; import java.util.List; import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; public class Forecast { private int id; @Element private String date; @ElementList(inline = true) private List< Day > listDay; @Element private String day_max_temp; @ElementList(inline = true) private List< Night > listNight; @Element private String night_min_temp; @Element private String temp_unit; public String getDate() { return this.date; } public void setDate( String date ) { this.date = date; } public List< Day > getDay() { return this.listDay; } public void setDay( List< Day > day ) { this.listDay = day; } public String getDay_max_temp() { return this.day_max_temp; } public void setDay_max_temp( String day_max_temp ) { this.day_max_temp = day_max_temp; } public List< Night > getNight() { return this.listNight; } public void setNight( List< Night > night ) { this.listNight = night; } public String getNight_min_temp() { return this.night_min_temp; } public void setNight_min_temp( String night_min_temp ) { this.night_min_temp = night_min_temp; } public String getTemp_unit() { return this.temp_unit; } public void setTemp_unit( String temp_unit ) { this.temp_unit = temp_unit; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ( date == null ? 0 : date.hashCode() ); result = prime * result + ( day_max_temp == null ? 0 : day_max_temp.hashCode() ); result = prime * result + id; result = prime * result + ( listDay == null ? 0 : listDay.hashCode() ); result = prime * result + ( listNight == null ? 0 : listNight.hashCode() ); result = prime * result + ( night_min_temp == null ? 0 : night_min_temp.hashCode() ); result = prime * result + ( temp_unit == null ? 0 : temp_unit.hashCode() ); return result; } @Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } Forecast other = (Forecast) obj; if ( date == null ) { if ( other.date != null ) { return false; } } else if ( !date.equals( other.date ) ) { return false; } if ( day_max_temp == null ) { if ( other.day_max_temp != null ) { return false; } } else if ( !day_max_temp.equals( other.day_max_temp ) ) { return false; } if ( id != other.id ) { return false; } if ( listDay == null ) { if ( other.listDay != null ) { return false; } } else if ( !listDay.equals( other.listDay ) ) { return false; } if ( listNight == null ) { if ( other.listNight != null ) { return false; } } else if ( !listNight.equals( other.listNight ) ) { return false; } if ( night_min_temp == null ) { if ( other.night_min_temp != null ) { return false; } } else if ( !night_min_temp.equals( other.night_min_temp ) ) { return false; } if ( temp_unit == null ) { if ( other.temp_unit != null ) { return false; } } else if ( !temp_unit.equals( other.temp_unit ) ) { return false; } return true; } @Override public String toString() { return "Forecast [date=" + date + ", day=" + listDay + ", day_max_temp=" + day_max_temp + ", night=" + listNight + ", night_min_temp=" + night_min_temp + ", temp_unit=" + temp_unit + "]"; } }
561987e8f75d3c228f6b3eaf4ba69d61d115cbb9
f52d29cf3fe164bd753e5f40fc5815dfd5118533
/src/main/java/com/newx/staging/config/DynamicDataSourceContextHolder.java
2c77ab6490ef0701ca6a376340e5b1e935290739
[]
no_license
NewxTL/staging
c1e7380e70c2650a3be7c136b0c6d51da3ad3cfd
345b6c559277d1021170e9d0fb51825bf110295f
refs/heads/master
2021-05-06T20:51:24.473183
2019-01-09T07:37:22
2019-01-09T07:37:22
112,414,815
0
0
null
null
null
null
UTF-8
Java
false
false
814
java
package com.newx.staging.config; import java.util.ArrayList; import java.util.List; /** * Created by Newx on 2017/10/21. */ public class DynamicDataSourceContextHolder { private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>(); public static List<String> dataSourceIds = new ArrayList<>(); public static void setDataSourceType(String dataSourceType) { contextHolder.set(dataSourceType); } public static String getDataSourceType() { return contextHolder.get(); } public static void clearDataSourceType() { contextHolder.remove(); } /** * 判断指定DataSrouce当前是否存在 */ public static boolean containsDataSource(String dataSourceId){ return dataSourceIds.contains(dataSourceId); } }
bfb559cfb20d4a11b7014924401e2d9572f4ce93
b353818b9d4f6259fa2bf4871635982ba242d4d9
/products/src/main/java/com/lightspeed/example/products/ProductRepository.java
e1b3a9d7b81906c3bdabc8da2265b2c092e0e33f
[]
no_license
facet-it/spring-boot-microservices
baca9e3a93977ec367bde974bf662fbb0a1d0e06
83d8f5f73b92271a3c99eb8e7565ac6921b095f0
refs/heads/master
2022-06-13T06:29:43.879296
2020-04-16T12:09:39
2020-04-16T12:09:39
223,361,181
0
0
null
2022-05-20T21:35:09
2019-11-22T08:45:14
Java
UTF-8
Java
false
false
566
java
package com.lightspeed.example.products; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface ProductRepository extends CrudRepository<Product, Integer> { @Query(value = "Select sum(loyalty_points) from products where id in :productIds", nativeQuery = true) Integer getTotalLoyalty(@Param("productIds") List<Integer> productIds); }
3e477669bf044d8038d608c45588bd1ab44735df
1f0be9c2cecbef38e538cf9f384c6448049b5d2f
/home_work07/Subject.java
41da6762b237668096a6772ec18d7b044c16ce8c
[]
no_license
ramanasha/Java_exams
19d4d0db467e3e5684445101f9917894d2a407a4
df38ba5104cc4fe6338a14f32ddec82508e2ebd2
refs/heads/master
2020-03-22T11:24:36.951392
2019-11-18T06:15:35
2019-11-18T06:15:35
139,969,053
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
class Subject extends Student{ String[] sub; Subject(int id, String name, String[] sub){ super(id,name); this.sub=sub; } void display(){ super.display(); } }
bba8c6c4a872485522de91ef195f12001c4ac648
4fa65cd07c6038fca05cfa85b5b4cf9fb922abd0
/app/src/main/java/com/app/erladmin/view/fragment/BaseFragment.java
b859fce7fa59f96167c2e1e22ff2c7694000601d
[]
no_license
rjkalola/ERL-ADMIN-NEW
db6ff086d1c011c5240ef1c9093f7b66a1516441
77e41ddf1c6761348061805558bedf42662cdc3c
refs/heads/master
2023-01-01T21:04:02.670716
2020-10-22T17:19:59
2020-10-22T17:19:59
306,406,936
0
0
null
null
null
null
UTF-8
Java
false
false
3,326
java
package com.app.erladmin.view.fragment; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.app.erladmin.callback.OnFragmentBackListener; import com.app.erladmin.callback.BackPressImpl; import com.app.erladmin.callback.BaseCallBack; import com.app.erladmin.callback.ViewListener; import com.app.erladmin.network.RetrofitException; import com.app.erladmin.util.AppUtils; import com.app.utilities.utils.ProgressDialogHelper; import com.app.utilities.utils.StringHelper; public class BaseFragment extends Fragment implements OnFragmentBackListener, ViewListener { public BaseCallBack baseCallBack; private boolean isHidden = true; private ProgressDialogHelper progressDialogHelper; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); } @Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof BaseCallBack) { baseCallBack = (BaseCallBack) context; } } @Override public boolean onBackPressed() { return new BackPressImpl(this).onBackPressed(); } public BaseCallBack getBaseCallBack() { return baseCallBack; } public void moveActivity(Context context, Class<?> c, boolean finish, boolean clearStack, Bundle bundle) { Intent intent = new Intent(context, c); if (bundle != null) { intent.putExtras(bundle); } if (clearStack) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); } context.startActivity(intent); if (finish) { ((Activity) context).finish(); } } public void moveActivity(Context context, Intent intent, boolean finish, boolean clearStack, Bundle bundle) { if (bundle != null) { intent.putExtras(bundle); } if (finish) { ((Activity) context).finish(); } if (clearStack) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); } context.startActivity(intent); } public void showProgressDialog(Context context, String message) { if (progressDialogHelper == null) { progressDialogHelper = new ProgressDialogHelper(context); } if (StringHelper.isEmpty(message)) { progressDialogHelper.showCircularProgressDialog(); } else { progressDialogHelper.showProgressDialog(message); } } public void hideProgressDialog() { if (progressDialogHelper != null) { progressDialogHelper.hideProgressDialog(); progressDialogHelper.hideCircularProgressDialog(); } } @Override public void showProgress() { showProgressDialog(getActivity(), ""); } @Override public void hideProgress() { hideProgressDialog(); } @Override public void showApiError(RetrofitException retrofitException, String errorCode) { AppUtils.handleApiError(getActivity(), retrofitException); } }
e38fd94030e103ce7e279270ccd39145505c8830
0487b3aa560fb587dca5d0c1978a6adf60e2a03e
/plugins/gradle/src/org/jetbrains/plugins/gradle/action/AbstractGradleLinkedProjectAction.java
7f228ee17aa5dc44e7b5e7faffa2d99f5f5d554d
[ "Apache-2.0" ]
permissive
serso/intellij-community
c09ed9ce0b00340cb58a7fb7fa7cf280896ac1bf
f7e8ad45f6b987c1c7940bb8a667086d1b554365
refs/heads/master
2021-01-15T17:59:53.752302
2012-11-08T12:59:30
2012-11-08T12:59:51
6,597,019
1
0
null
null
null
null
UTF-8
Java
false
false
2,155
java
package org.jetbrains.plugins.gradle.action; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.gradle.config.GradleSettings; import java.io.File; /** * Common super class for gradle actions that require {@link GradleSettings#getLinkedProjectPath()} linked project}. * <p/> * Not thread-safe. * * @author Denis Zhdanov * @since 1/31/12 5:36 PM */ public abstract class AbstractGradleLinkedProjectAction extends AnAction { @Override public void update(AnActionEvent e) { final Pair<Project, String> pair = deriveProjects(e.getDataContext()); final boolean visible = pair != null; e.getPresentation().setVisible(visible); if (!visible) { return; } doUpdate(e.getPresentation(), pair.first, pair.second); } @Override public void actionPerformed(AnActionEvent e) { final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext()); if (project == null) { return; } final Pair<Project, String> pair = deriveProjects(e.getDataContext()); if (pair == null) { e.getPresentation().setVisible(false); return; } doActionPerformed(project, pair.second); } @Nullable private static Pair<Project, String> deriveProjects(@Nullable DataContext context) { if (context == null) { return null; } final Project project = PlatformDataKeys.PROJECT.getData(context); if (project == null) { return null; } final String path = GradleSettings.getInstance(project).getLinkedProjectPath(); if (StringUtil.isEmpty(path) || !new File(path).isFile()) { return null; } return new Pair<Project, String>(project, path); } protected abstract void doUpdate(@NotNull Presentation presentation, @NotNull Project project, @NotNull String linkedProjectPath); protected abstract void doActionPerformed(@NotNull Project project, @NotNull String linkedProjectPath); }