blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
sequencelengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
408a98f893c850e6726f5cdabbaf58d3e639ef2a | 039b88b8fca816fff2ea4c5485a1f3a8ef2776ce | /Jspider/Connecting2Objects/src/MainClass.java | 6a8fe23b6f0e94ba25b62e4c0a36934079e3b773 | [] | no_license | chiragsoni2401/Jspider-Java-Practice | 43e0ee2e1af021ec66431850d7bd5b4b04d2be62 | f23ccfaeb77c6cef2aa01fc055cb4dae237f9477 | refs/heads/main | 2023-08-23T05:55:09.819163 | 2021-10-21T18:02:16 | 2021-10-21T18:02:16 | 419,722,611 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 120 | java |
public class MainClass
{
public static void main(String[] args)
{
B b = new B();
b.function(new A());
}
}
| [
"[email protected]"
] | |
67dd2acd6e5fb8589408f9e07eebef4668ce2239 | 99092c6cea81059022f65893cd84655804dae389 | /src/main/java/bandtec/projeto/individual/ProjetoIndividualApplication.java | d3c05f11cfbc84ab89bafb77e5c3c2fea48ed1d6 | [] | no_license | andretorellibandtec/projeto-individual-orquestra | 4742e1e75b76ac79cec9382e50b01a5f81d82978 | b770c468575dd56f54db1921bf635234006d75fa | refs/heads/master | 2022-12-09T15:56:44.681635 | 2020-09-06T18:03:46 | 2020-09-06T18:03:46 | 293,127,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package bandtec.projeto.individual;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ProjetoIndividualApplication {
public static void main(String[] args) {
SpringApplication.run(ProjetoIndividualApplication.class, args);
}
}
| [
"[email protected]"
] | |
05ee6ea30bb12c3c97f74581baf5da285621d9eb | 60a956a0e2af0229d10554f6d713f0b37d14d2e2 | /算法/TodayCoding0508.java | 7a4a4b090b1d21627d668fd2d34616d9bd28a9b7 | [] | no_license | djxf/AlgorithmCode | 7943cadf78c3f91a92885032bde429e9c4f782b9 | c9d2e97c0d63ef344403a8c4a919b8172a42587a | refs/heads/master | 2023-04-24T08:03:55.259342 | 2021-05-10T05:03:10 | 2021-05-10T05:03:10 | 262,306,323 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java | package 算法;
public class TodayCoding0508 {
public static void main(String[] args) {
}
//问题11 给定一个整形矩阵map,其中的值只有0/1两种,求构成全部是1的矩阵的最大面积。
//问题12 给定数组arr和整数num,返回一共有多少个子数组满足如下情况。
// Max{arr[i..j]} - Min{arr[i..j]} <= num,要求时间复杂度为O(n)。
} | [
"1763380121.qq.com"
] | 1763380121.qq.com |
f327597035b98dcb2324e0e51e39d9de5f5a1831 | d9f98dd1828e25bc2e8517e5467169830c5ded60 | /src/main/java/com/alipay/api/response/ZhimaCreditEpLawsuitDetailGetResponse.java | de97ce7bcb1b357b2231d7d2a586be118ae3cc11 | [] | no_license | benhailong/open_kit | 6c99f3239de6dcd37f594f7927dc8b0e666105dc | a45dd2916854ee8000d2fb067b75160b82bc2c04 | refs/heads/master | 2021-09-19T18:22:23.628389 | 2018-07-30T08:18:18 | 2018-07-30T08:18:26 | 117,778,328 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 972 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.domain.EpInfo;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: zhima.credit.ep.lawsuit.detail.get response.
*
* @author auto create
* @since 1.0, 2017-10-13 14:43:31
*/
public class ZhimaCreditEpLawsuitDetailGetResponse extends AlipayResponse {
private static final long serialVersionUID = 6213198283162949671L;
/**
* 芝麻信用对于每一次请求返回的业务号。后续可以通过此业务号进行对账
*/
@ApiField("biz_no")
private String bizNo;
/**
* 企业涉诉详情
*/
@ApiField("lawsuit_detail")
private EpInfo lawsuitDetail;
public void setBizNo(String bizNo) {
this.bizNo = bizNo;
}
public String getBizNo( ) {
return this.bizNo;
}
public void setLawsuitDetail(EpInfo lawsuitDetail) {
this.lawsuitDetail = lawsuitDetail;
}
public EpInfo getLawsuitDetail( ) {
return this.lawsuitDetail;
}
}
| [
"[email protected]"
] | |
ee7fa6c0b9860a16345ec0bac8c5d7f8db475da0 | a4a0b1c6a7789094aab0ec94324916b08bd9f484 | /app/src/main/java/net/fitcome/jnidemo/MainActivity.java | 009e7f642fe2e3a871d8bf9f4debe7a905fbbe9e | [] | no_license | android-coco/JniDemo | 1e106a095a54f262fd63a19ef3bae31a8003a145 | 16f55f9929c42eeb8396fc9df0beaa0a6b553212 | refs/heads/master | 2021-01-19T10:35:31.305830 | 2017-04-11T06:19:31 | 2017-04-11T06:19:31 | 87,881,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 532 | java | package net.fitcome.jnidemo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity
{
JniUtil x = new JniUtil();
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textView = (TextView) findViewById(R.id.info);
textView.setText(x.getJniAdd(1,2) + " " + x.getJniString());
}
}
| [
"123456"
] | 123456 |
c1cdb0f32dc85fdbf6ad9ee3a8e065564db1a609 | c5a1d1a58c8c846494d26220eaaf2ef0968229a5 | /src/main/java/cn/xdevops/designpatterns/abstractfactory/ClamPizza.java | 6fa7b9769882b0df0216758250fdaa8999ee5ff5 | [] | no_license | cookcodeblog/design-patterns-demo | bad9b5d14074605597d33b80f138f6858e205647 | 9c6d1da4e6515fe1a6979b261ea4557a2405191b | refs/heads/master | 2023-06-02T03:43:15.614957 | 2021-06-27T01:58:15 | 2021-06-27T01:58:15 | 378,298,138 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | package cn.xdevops.designpatterns.abstractfactory;
public class ClamPizza extends Pizza {
PizzaIngredientFactory ingredientFactory;
public ClamPizza(PizzaIngredientFactory ingredientFactory) {
this.ingredientFactory = ingredientFactory;
}
@Override
void prepare() {
System.out.println("Preparing " + name);
dough = ingredientFactory.createDough();
sauce = ingredientFactory.createSauce();
cheese = ingredientFactory.createCheese();
clam = ingredientFactory.createClam();
}
}
| [
"[email protected]"
] | |
05827d251040f1898a4444f66b5216350cf5a240 | fb1591df8f4917e010ba93eab21865534a41ba53 | /Game1/MyGame1-android/gen/com/me/Main/R.java | 022b23c5bfecfdec3e33559fdd6e1b2c1c366ee9 | [] | no_license | luantrinh9x/Android_AirAttack | 004e1257fa0783730927f00b395d8b83ed453860 | 8b9cfd93a10edce0fc68a4808e71b85e1739e054 | refs/heads/master | 2021-01-22T09:32:26.006067 | 2014-08-13T15:47:35 | 2014-08-13T15:47:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.me.Main;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int aa=0x7f020000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040000;
}
}
| [
"[email protected]"
] | |
7a433f62c2ca6a245fbf2646ab950da624da64fe | efcf3233a2a21411eb1ae2bff3b71baa548c6f04 | /tracking/src/main/java/org/lcsim/recon/tracking/vsegment/hit/base/DigiTrackerHitElemental.java | 04a484476064b59a40f2b88d064e4485cdfa4026 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | slaclab/lcsim | 95af8a8821bd1e7638f3c9c039655f9b4f797a92 | afdee47b0e511a6f96595deae758dedaef2f4ae3 | refs/heads/master | 2023-07-06T19:40:04.589633 | 2023-03-20T21:38:33 | 2023-03-20T21:38:33 | 95,500,068 | 1 | 7 | NOASSERTION | 2023-03-20T21:10:47 | 2017-06-27T00:08:43 | Java | UTF-8 | Java | false | false | 2,500 | java | package org.lcsim.recon.tracking.vsegment.hit.base;
import java.util.List;
import java.util.ArrayList;
import org.lcsim.event.MCParticle;
import org.lcsim.recon.tracking.vsegment.geom.Sensor;
import org.lcsim.recon.tracking.vsegment.hit.DigiTrackerHit;
/**
* Elemental DigiTrackerHit.
* In simulation, this is a digitized signal from a single channel produced by a
* single <tt>MCParticle</tt>. In data, this is a single channel signal after calibration.
*
* @author D.Onoprienko
* @version $Id: DigiTrackerHitElemental.java,v 1.1 2008/12/06 21:53:44 onoprien Exp $
*/
public class DigiTrackerHitElemental extends DigiTrackerHitAdapter {
// -- Constructors : ----------------------------------------------------------
/** Constract from parameters. */
public DigiTrackerHitElemental(double signal, double time, Sensor sensor, int channel, MCParticle mcParticle) {
_signal = signal;
_time = time;
_sensor = sensor;
_channel = channel;
_mcParticle = mcParticle;
}
/** Constract from parameters with no associated <tt>MCParticle</tt>. */
public DigiTrackerHitElemental(double signal, double time, Sensor sensor, int channel) {
this(signal, time, sensor, channel, null);
}
/** Copy constructor. */
public DigiTrackerHitElemental(DigiTrackerHitElemental digiHit) {
_signal = digiHit._signal;
_time = digiHit._time;
_sensor = digiHit._sensor;
_channel = digiHit._channel;
_mcParticle = digiHit._mcParticle;
}
// -- Getters : ---------------------------------------------------------------
/**
* Returns <tt>true</tt> if the hit is a superposition of more than one elemental hit.
* Objects of this class always return <tt>false</tt>.
*/
public boolean isComposite() {return false;}
/**
* Returns <tt>MCParticle</tt> that produced the hit.
* If the hit is composite, or does not have <tt>MCParticle</tt> associated with
* it (noise, beam test data, etc.), returns <tt>null</tt>.
*/
public MCParticle getMCParticle() {return _mcParticle;}
/**
* Returns a list of underlying elemental hits.
* Since the hit is not composite, returns a list with a single element - this hit.
*/
public List<DigiTrackerHit> getElementalHits() {
List<DigiTrackerHit> hitList = new ArrayList<DigiTrackerHit>(1);
hitList.add(this);
return hitList;
}
// -- Private parts : ---------------------------------------------------------
protected MCParticle _mcParticle;
}
| [
"[email protected]"
] | |
27371f434824a7753109c23550470dbdaace0399 | f84b9ae1e5c42ab3afc4bd4273e200de99e1a81e | /src/main/java/com/kh/myapp/member/vo/PwdChkGrp.java | 9b14063ef1909a69a3c74ab8108c2246013d1209 | [] | no_license | minook1231/Springedu | 2a3a1167c7cb2197f938e85db5fc3f5a1d97f878 | 41290868482fe227f53514eab3f699eabc4dd5b5 | refs/heads/master | 2020-03-22T05:24:20.167817 | 2018-07-03T10:19:24 | 2018-07-03T10:19:24 | 139,563,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 61 | java | package com.kh.myapp.member.vo;
public class PwdChkGrp {
}
| [
"[email protected]"
] | |
08034d4ff370473cce538d0218f6aafba3630ba4 | f15304b7b3ff986df90b40ad088db167685e1d8e | /bookmarks-springmvc/src/main/java/com/sivalabs/bookmarks/entities/BookMark.java | 589dc3f73bf9c0ad5ba945b6515ecde3c41901ac | [] | no_license | achintayya/spring-samples | 7801d115797b2543bab7314c996ce3c0110ac3a4 | ccf8db253b35d79faf45ba499323120bae78732b | refs/heads/master | 2020-12-03T10:26:53.556740 | 2014-06-29T13:13:21 | 2014-06-29T13:13:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,215 | java | /**
*
*/
package com.sivalabs.bookmarks.entities;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.lang.StringUtils;
/**
* @author Siva
*
*/
@Entity
@Table(name = "bookmarks")
@XmlRootElement
public class BookMark implements Serializable
{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "bookmark_id")
private Integer id;
@Column(nullable=false)
private String title;
@Column(nullable=false)
private String url;
private String description;
@ManyToOne
@JoinColumn(name="user_id")
private User user;
@ManyToMany(cascade=CascadeType.ALL)
@JoinTable(name = "bookmark_tag",
joinColumns = {@JoinColumn(name="bookmark_id")},
inverseJoinColumns = {@JoinColumn(name="tag_id")}
)
private Set<Tag> tags;
public BookMark() {
}
public BookMark(Integer id) {
super();
this.id = id;
}
public BookMark(Integer id, String title, String url,
String description) {
super();
this.id = id;
this.title = title;
this.url = url;
this.description = description;
}
public BookMark(Integer id, String title, String url) {
super();
this.id = id;
this.title = title;
this.url = url;
}
public BookMark(Integer id, String title, String url,
String description, User user) {
super();
this.id = id;
this.title = title;
this.url = url;
this.description = description;
this.user = user;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Set<Tag> getTags()
{
if(tags == null){
tags = new HashSet<Tag>();
}
return tags;
}
public void setTags(Set<Tag> tags)
{
this.tags = tags;
}
public String getFormattedTags()
{
StringBuilder sb = new StringBuilder();
for (Tag tag : tags)
{
sb.append(tag.getTagName()+",");
}
String str = sb.toString();
/*if(str.length()>0){
str = str.substring(0,str.length()-1);
}*/
str = StringUtils.chomp(str, ",");
return str;
}
}
| [
"[email protected]"
] | |
02f110dc01792f737dae4923889626ac83ceb716 | ff9a5d1257982d94db80c9fc142a896123ad3f1d | /GU_Course3/src/main/java/Lesson6_Testing/MainClassTest.java | 97720663ae70f4024d1f12e3d899c16f06e7cd31 | [] | no_license | BigElmo/Java | 30039fe8ccf9abb363ec49d40885154b900ce6c2 | 470deb08f623ad6bbd55bf143fe25a281a2d2622 | refs/heads/main | 2023-08-29T10:07:01.989910 | 2021-11-05T14:36:58 | 2021-11-05T14:36:58 | 368,553,836 | 1 | 0 | null | 2021-11-05T14:36:59 | 2021-05-18T14:08:18 | Java | UTF-8 | Java | false | false | 2,359 | java | package Lesson6_Testing;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
public class MainClassTest {
private MainClass mainClass;
@BeforeEach
public void init() {
mainClass = new MainClass();
}
@Test
public void testRuntimeException() {
Assertions.assertThrows(RuntimeException.class, () -> {
int[] arr = mainClass.getAfter4Array(new int[] { 1, 2, 3, 3, 5, 6});
});
}
@ParameterizedTest
@MethodSource("dataForAfter4Array")
public void testAfter4Array(int[] array, int[] result) {
Assertions.assertArrayEquals(result, mainClass.getAfter4Array(array));
}
public static Stream<Arguments> dataForAfter4Array() {
List<Arguments> out = new ArrayList<>();
out.add(Arguments.arguments(new int[] { 1, 2, 3, 4, 5, 6 }, new int[] {5, 6}));
out.add(Arguments.arguments(new int[] { 2, 4, 2, 2 }, new int[] { 2, 2 }));
out.add(Arguments.arguments(new int[] { 1, 1, 4, 2, 2, 4, 3, 3 }, new int[] { 3, 3 }));
out.add(Arguments.arguments(new int[] { 1, 2, 3, 4 }, new int[0]));
return out.stream();
}
@ParameterizedTest
@MethodSource("dataFor1and4Array")
public void test1and4Array(int[] array, boolean result) {
Assertions.assertEquals(result, mainClass.has1and4Array(array));
}
public static Stream<Arguments> dataFor1and4Array() {
List<Arguments> out = new ArrayList<>();
out.add(Arguments.arguments(new int[] { 1, 4, 1, 4 }, true));
out.add(Arguments.arguments(new int[] { 4, 1, 4, 1 }, true));
out.add(Arguments.arguments(new int[] { 1, 1, 4, 4 }, true));
out.add(Arguments.arguments(new int[] { 4, 4, 1, 1 }, true));
out.add(Arguments.arguments(new int[] { 1, 1, 1, 4 }, true));
out.add(Arguments.arguments(new int[] { 1, 4, 4, 4 }, true));
out.add(Arguments.arguments(new int[] { 1, 2, 1, 4 }, false));
out.add(Arguments.arguments(new int[] { 1, 1, 1, 1 }, false));
return out.stream();
}
}
| [
"[email protected]"
] | |
dbf3ec6e52c35445b99a09a0c080a675097d49c8 | 305cf9c8fbb49f71f2568a1e86147a736af99c43 | /src/DataTypes/StringExample.java | 2cdf389340f8279bf009d8e3cbe85cedde6734da | [] | no_license | Karthiktesting05/SampleTesting | ea74f196068bc64b090e0222e398903f86c686ad | e6f25d27973b976d4568e35ef0b45161fd454811 | refs/heads/master | 2020-09-26T14:37:20.694591 | 2019-12-06T07:58:33 | 2019-12-06T07:58:33 | 226,274,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | package DataTypes;
public class StringExample {
public static void main(String[] args) {
// TODO Auto-generated method stub
String Name = "Karthik";
String Training = "Selenium Training";
System.out.println(Training + " Provided by "+ Name);
}
}
| [
"[email protected]"
] | |
e861217fef8c4ce8b061371d57c068f33f488dba | 84749fc225dbb6983138bfd3c0da70e2200b8a25 | /src/com/iraheta/LectorDeDatos.java | e103aabb453b640774c30818330af1fd61ecbb38 | [] | no_license | belmarely/iraheta-ejercicio-1 | 6d44ec20a1a5326bc85b111d2f5a1e118d3459d6 | 64f9b41c7c5aba700d53604994e478420d703a18 | refs/heads/master | 2020-07-02T23:47:28.858039 | 2019-08-11T03:28:35 | 2019-08-11T03:28:35 | 201,711,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 915 | java | package com.iraheta;
import java.util.InputMismatchException;
import java.util.Scanner;
public class LectorDeDatos {
public static int solicitarEntero(String mensaje){
Scanner lector = new Scanner(System.in);
System.out.print(mensaje);
try{
int numero = lector.nextInt();
return numero;
}catch (InputMismatchException e){
System.out.println("El dato ingresado no es valido");
return solicitarEntero(mensaje);
}
}
public static double solicitarDouble(String mensaje){
Scanner lector = new Scanner(System.in);
System.out.print(mensaje);
try{
double numero = lector.nextDouble();
return numero;
}catch (InputMismatchException e){
System.out.println("El dato ingresado no es valido");
return solicitarDouble(mensaje);
}
}
}
| [
"[email protected]"
] | |
65907a32bb25c6cba9b3db2758b9420d0b320694 | 3a21644bcb36e37cf7ea62e5aedcd977545ed5ba | /JavaStudy/src/baekjoon/b034.java | 817f923daed3b3cd8a4bfa9abfaf54ba1df2d28c | [] | no_license | jinyoung1704/JavaStudy | 46e3b9ad0728b670371b2abfd2df39f7d4191413 | 2e30fd1318d7752df2b9e52be8c20eaa5331fb04 | refs/heads/master | 2023-02-11T00:27:17.192440 | 2021-01-04T09:28:06 | 2021-01-04T09:28:06 | 291,988,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | package baekjoon;
//백준 9093번 단어뒤집기
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
public class b034
{
public static void main(String[] args) throws NumberFormatException, IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
StringBuffer sb = new StringBuffer();
for(int i=0;i<n;i++)
{
Stack<Character> stack = new Stack<>();
String s = br.readLine();
for(int j=0;j<s.length();j++)
{
if(s.charAt(j)==' ')
{
while(!stack.empty())
{
sb.append(stack.pop());
//System.out.print(stack.pop());
}
sb.append(" ");
//System.out.print(" ");
}
else
{
stack.push(s.charAt(j));
//stack.push(s.charAt(j));
}
}
while(!stack.empty())
{
sb.append(stack.pop());
//System.out.print(stack.pop());
}
sb.append("\n");
}
System.out.println(sb.toString());
}
}
| [
"[email protected]"
] | |
1acbcba560e14315416dd7c6ca4b1a3da90fa33d | 8baa6a6c59abd901ad380f124f7a09b6c7e1f072 | /src/specifications/RequireEngineService.java | b2cff106c99fa8db2b09e50aeb069d84fbb4fff8 | [] | no_license | nlejeune359/snooker_of_doom | 365e36408efd54c7c22cbba22a7038f3c257a0c0 | dd1365ffc9e54a82e3a0a6351a5440a03c923925 | refs/heads/master | 2023-04-02T09:46:18.256033 | 2021-04-09T23:05:57 | 2021-04-09T23:05:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | /* ******************************************************
* Simulator alpha - Composants logiciels 2015.
* Copyright (C) 2015 <[email protected]>.
* GPL version>=3 <http://www.gnu.org/licenses/>.
* $Id: specifications/RequireEngineService.java 2015-03-09 buixuan.
* ******************************************************/
package specifications;
public interface RequireEngineService {
public void bindEngineService(EngineService service);
}
| [
"[email protected]"
] | |
13b9b1f439dccebda6a46e2421903abb946a8367 | 155c66819bfb01f0c89b94c9e16f2e889e44aee7 | /src/main/java/com/example/demo/util/ScraperUtil.java | e7ceabe64057d9e7e43cba25292f52d81dfe5fb6 | [] | no_license | platonTsy/webscraper | 6829e0dea414162571f93ab31f7346d0bb09d20e | 5a079a81d4423659f200a8562efeab50db7dfe8e | refs/heads/master | 2021-05-09T08:17:57.284975 | 2018-01-29T13:44:42 | 2018-01-29T13:44:42 | 119,386,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,815 | java | package com.example.demo.util;
import com.example.demo.domain.Category;
import com.example.demo.domain.Company;
import com.example.demo.domain.CompanySearchResult;
import lombok.SneakyThrows;
import lombok.extern.java.Log;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import static java.util.stream.Collectors.toList;
/**
* Created by platon on 27.01.18.
*/
@Log
public class ScraperUtil {
private static final String HOST = "https://www.pegaxis.com";
private static final String SERVICE_ROUTE = "/services";
public static final String GOOGLE_SEARCH_URL = "https://www.google.com/search";
public static List<Category> retrieveCategories(int timeout) {
return getCategoryElementsByServicesDoc(getDocBy(HOST + SERVICE_ROUTE, timeout))
.stream()
.map(service -> Category
.builder()
.name(service.text())
.uri(HOST + service.attr("href"))
.build())
.peek(c -> log.info(c.toString()))
.collect(toList());
}
public static List<Company> retrieveCompaniesBy(Category category, int timeout) {
return getCompanyNamesByServiceDoc(getDocBy(category.getUri(), timeout), category);
}
@SneakyThrows
public static Document getDocBy(String uri, int timeout) {
return Jsoup.connect(uri).timeout(timeout).get();
}
public static List<Element> getCategoryElementsByServicesDoc(Document serviceDoc) {
return serviceDoc.getElementsByTag("a")
.stream()
.filter(el -> el.hasClass("service_list_title"))
.collect(toList());
}
@SneakyThrows(IOException.class)
public static List<CompanySearchResult> retrieveCompanySearchResults(Company company, int resultCount, int timeout) {
List<CompanySearchResult> resultList = null;
String searchUri = GOOGLE_SEARCH_URL + "?q=" + company.getName() + "&num=" + resultCount;
Random random = new Random();
int ranTimeout = random.nextInt((5000 - 3000) + 1) + 3000;
// System.setProperty("http.proxyHost", "42.104.84.107"); // set proxy server
// System.setProperty("http.proxyPort", "8080"); //
Document doc = null;
try {
doc = Jsoup.connect(searchUri).userAgent("Mozilla/5.0").timeout(ranTimeout).get();
Elements resultElements = doc.select("h3.r > a");
resultList = new ArrayList<>();
for (Element result : resultElements) {
String linkHref = result.attr("href");
String linkText = result.text();
CompanySearchResult searchResult = CompanySearchResult.builder()
.company(company)
.uri(linkHref.substring(6, linkHref.indexOf("&")))
.title(linkText)
.build();
resultList.add(searchResult);
log.info(searchResult.toString());
}
} catch (org.jsoup.HttpStatusException e) {
log.severe(e.getMessage());
}
return resultList;
}
public static List<Company> getCompanyNamesByServiceDoc(Document serviceDoc, Category category) {
return serviceDoc.getElementsByClass("company-name")
.parallelStream()
.map(serviceEl -> Company.builder()
.name(serviceEl.getElementsByTag("a").get(0).text())
.category(category)
.build())
.peek(c -> log.info(c.toString()))
.collect(toList());
}
}
| [
"[email protected]"
] | |
cb34dbd9b48680566a59e6101b67123c03e761a1 | e5bd22a1a327a8bfe4ec63f2e690a2d181b54c53 | /src/eu/freestylecraft/entitories/data/ItemLoader.java | 1e8e682b45979f8fad7474a9a30fd245e3201d86 | [] | no_license | FreeStyleCraft/Entitories | 7f33d2dbb9f9f9ac6f0e125b203f635ae03a023e | 88f4be43512f79115b8c91ba875f10dd33643f63 | refs/heads/master | 2022-11-23T22:19:19.895427 | 2020-08-07T12:45:09 | 2020-08-07T12:45:09 | 285,401,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,505 | java | package eu.freestylecraft.entitories.data;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
public class ItemLoader {
private YamlConfiguration storage;
private File storageFile;
private List<Item> cache;
public ItemLoader(File yamlStorage) {
this.storage = new YamlConfiguration();
this.storageFile = yamlStorage;
this.cache = Collections.synchronizedList(new ArrayList<Item>());
}
/**
* Reloads the cache from items.yml
* @return true if the cache was updated, false otherwise
*/
public boolean reload() {
try {
this.storage.load(this.storageFile);
List<Item> newCache = Collections.synchronizedList(new ArrayList<Item>());
for(String name : storage.getKeys(false)) {
String matname = storage.getString(name + ".material", "RED_STAINED_GLASS_PANE");
Material material = Material.getMaterial(matname);
if(material == null) {
material = Material.RED_STAINED_GLASS_PANE;
}
Item item = new Item(
material,
storage.getInt(name + ".amount", 1),
name,
storage.getString(name + ".name", "???"),
storage.getString(name + ".description", ""),
storage.getBoolean(name + ".enchanted", false),
storage.getBoolean(name + ".close-on-click", false),
ItemAction.parse(storage.getString(name + ".action", "none")));
newCache.add(item);
}
this.cache.clear();
this.cache = newCache;
return true;
} catch (IOException | InvalidConfigurationException e) {
return false;
}
}
/**
* Returns all currently loaded items
* @return a list of all items
*/
public List<Item> getItems() {
return this.cache;
}
/**
* Returns an item by its name
* @param name the name to search for
* @return the item matching the name, null if the item was not found
*/
public Item getItemByName(String name) {
for(Item i : this.cache) {
if(i.getName().equals(name)) {
return i;
}
}
return null;
}
/**
* Returns an item by its name, but case-insensitive
* @param name the name to search for
* @return the item matching the name, null if the item was not found
*/
public Item getItemByNameIgnoreCase(String name) {
for(Item i : this.cache) {
if(i.getName().equalsIgnoreCase(name)) {
return i;
}
}
return null;
}
}
| [
"[email protected]"
] | |
3e9317fd06cd54e94915585036bc627513b9acf0 | 92d79f9ce37ca996fc3b099a67bc7f06c5d22d11 | /FitnessTracker/src/main/java/com/pluralsight/service/ExerciseService.java | 3e56c48411c8b7234efb7e256b95b145462a7681 | [] | no_license | shrutikadge/Shruti | 7a76e8513c09aa59fd31cdfcacec306d213496f5 | cfe9d195422627825468d7c7969fa70a815ee6b9 | refs/heads/master | 2021-06-06T19:48:53.820913 | 2018-10-23T06:01:15 | 2018-10-23T06:01:15 | 58,985,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package com.pluralsight.service;
import java.util.List;
import com.pluralsight.model.Activity;
import com.pluralsight.model.Exercise;
public interface ExerciseService {
List<Activity> findAllActivities();
Exercise save(Exercise exercise);
} | [
"[email protected]"
] | |
3c0f683ff671e7ffd985bb3c9e3120a0c9638784 | eac112c7bf3fd48e88a180374af395c9250fbca2 | /HabitAid Points/src/main/java/com/example/sonymobile/smartextension/hellolayouts/HelloLayoutsPreferenceActivity.java | 225edd8ca2b09c0cd3debe8c5e01a1726f72ea54 | [] | no_license | mye-morr/SW2Points | df95e4c8746ca4f47c8aefb34fd9c05bec45ba9e | d1bb42b03fc22071c74bc3ee590a8ee52aa30ab5 | refs/heads/master | 2021-01-11T17:05:37.205527 | 2017-01-22T12:39:21 | 2017-01-22T12:39:21 | 79,716,917 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,359 | java | /*
Copyright (c) 2011, Sony Ericsson Mobile Communications AB
Copyright (c) 2011-2013, Sony Mobile Communications AB
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 the Sony Ericsson Mobile Communications AB / Sony Mobile
Communications AB nor the names of its 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 HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.example.sonymobile.smartextension.hellolayouts;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.EditText;
/**
* The sample control preference activity handles the preferences for the sample
* control extension.
*/
public class HelloLayoutsPreferenceActivity extends PreferenceActivity {
private static final int DIALOG_READ_ME = 1;
private static final int DIALOG_CAPTION_2 = 2;
private static final int DIALOG_CAPTION_1 = 3;
private static final int DIALOG_CAPTION0 = 4;
private static final int DIALOG_CAPTION1 = 5;
private static final int DIALOG_CAPTION2 = 6;
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource.
addPreferencesFromResource(R.xml.preference);
// Handle read me.
Preference preference = findPreference(getText(R.string.preference_key_read_me));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showDialog(DIALOG_READ_ME);
return true;
}
});
// Handle caption-2.
preference = findPreference(getText(R.string.preference_key_caption_2));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showDialog(DIALOG_CAPTION_2);
return true;
}
});
// Handle caption1.
preference = findPreference(getText(R.string.preference_key_caption_1));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showDialog(DIALOG_CAPTION_1);
return true;
}
});
// Handle caption0.
preference = findPreference(getText(R.string.preference_key_caption0));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showDialog(DIALOG_CAPTION0);
return true;
}
});
// Handle caption1.
preference = findPreference(getText(R.string.preference_key_caption1));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showDialog(DIALOG_CAPTION1);
return true;
}
});
// Handle caption2.
preference = findPreference(getText(R.string.preference_key_caption2));
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showDialog(DIALOG_CAPTION2);
return true;
}
});
}
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
switch (id) {
case DIALOG_READ_ME:
dialog = createReadMeDialog();
break;
case DIALOG_CAPTION_2:
dialog = createCaptionDialog(-2);
break;
case DIALOG_CAPTION_1:
dialog = createCaptionDialog(-1);
break;
case DIALOG_CAPTION0:
dialog = createCaptionDialog(0);
break;
case DIALOG_CAPTION1:
dialog = createCaptionDialog(1);
break;
case DIALOG_CAPTION2:
dialog = createCaptionDialog(2);
break;
default:
Log.w(HelloLayoutsExtensionService.LOG_TAG, "Not a valid dialog id: " + id);
break;
}
return dialog;
}
/**
* Create the Read me dialog.
*
* @return the D'ialog
*/
private Dialog createReadMeDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.preference_option_read_me_txt)
.setTitle(R.string.preference_option_read_me)
.setIcon(android.R.drawable.ic_dialog_info)
.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
return builder.create();
}
private Dialog createCaptionDialog(int idx) {
int iXformIdx = 0;
switch(idx) {
case -2:
iXformIdx = 0;
break;
case -1:
iXformIdx = 1;
break;
case 0:
iXformIdx = 2;
break;
case 1:
iXformIdx = 3;
break;
case 2:
iXformIdx = 4;
break;
default:
iXformIdx = 2;
}
final int iCaptionIdx = iXformIdx;
final EditText etInput = new EditText(this);
etInput.setText("1;2;3;4;5;6;7;8;9;10;11;12;13;14");
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Edit Caption")
.setIcon(android.R.drawable.ic_input_delete)
.setView(etInput)
.setPositiveButton("Set", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
String sBuf = etInput.getText().toString();
int iBuf = 0;
iBuf = sBuf.indexOf(":");
String sCategory = sBuf.substring(0, iBuf).trim();
sBuf = sBuf.substring(iBuf + 1).trim();
String[] sxProcess = sBuf.split(";");
String sCaptions = "";
String sPoints = "";
int iBuf2 = 0;
for(int i=0; i < 14; i++) {
if(i < sxProcess.length) {
sBuf = sxProcess[i];
if(sBuf.indexOf("(") < 0) {
sCaptions += ";" + sBuf.trim();
sPoints += ";0";
}
else {
iBuf = sBuf.indexOf("(");
iBuf2 = sBuf.indexOf(")");
sCaptions += ";" + sBuf.substring(0,iBuf).trim();
sPoints += ";" + sBuf.substring(iBuf + 1, iBuf2).trim();
}
}
else {
sCaptions += "; ";
sPoints += "; ";
}
}
sCaptions = sCaptions.substring(1, sCaptions.length());
sPoints = sPoints.substring(1, sPoints.length());
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
sharedPrefs.edit()
.putString("category" + Integer.toString(iCaptionIdx),sCategory)
.putString("captions" + Integer.toString(iCaptionIdx),sCaptions)
.putString("points" + Integer.toString(iCaptionIdx),sPoints)
.commit();
}
}).setNegativeButton("Cancel", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
}
});
return builder.create();
}
} | [
"[email protected]"
] | |
360f6a17e59ba42b12c1b8e2315dc0db6c95a1c1 | c61acf6f90795c98c4daa1c273eaa4fe1e235ba1 | /app/src/main/java/com/ericho/androidstackview/MainActivity.java | 1268b75f4748bb77c23107a18089b1bc07b89fbf | [] | no_license | wingsum93/Android_tack_view_example | f6bc20541a1265e5fff95bcbb30755ebdb51a1c6 | 71091b75abdfe05fac6ec4e81e59e778c554be59 | refs/heads/master | 2021-01-16T23:19:19.859172 | 2016-07-27T08:23:09 | 2016-07-27T08:23:09 | 64,289,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,104 | java | package com.ericho.androidstackview;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.StackView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private static StackView stackView;
private static ArrayList<Stack_Items> list;
//Integer array for images
private static final Integer[] icons = { R.drawable.a, R.drawable.b,
R.drawable.c, R.drawable.d };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
stackView = (StackView) findViewById(R.id.stackView1);
list = new ArrayList<>();
//Adding items to the list
for (int i = 0; i < icons.length; i++) {
list.add(new Stack_Items("Item " + i, icons[i]));
}
//Calling adapter and setting it over stackview
Stack_Adapter adapter = new Stack_Adapter(MainActivity.this, list);
stackView.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
}
| [
"[email protected]"
] | |
716bb75659748cc5a3e20d346833b82550577b20 | e6e439368bb814f7779dab15d306ffe6cfe9a48b | /CoolWeather-master/app/src/main/java/com/example/qingjiaxu/coolweather/EventId.java | b810ef35467485ff61c813d6d4daea2a1be7f942 | [] | no_license | Sharon-liu410/weather | 0db2eb79caac0ae0ae5c2c5d097aa5828ed097fe | 7d099608e1795ac084107583fc97969f480563a6 | refs/heads/master | 2020-11-28T23:21:33.091811 | 2019-12-24T13:32:10 | 2019-12-24T13:32:10 | 229,947,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 266 | java | package com.example.qingjiaxu.coolweather;
public class EventId {
public static final int EVENT_0X001 = 0x001;
public static final int EVENT_0X002 = 0x002;
public static final int EVENT_0X003 = 0x003;
public static final int EVENT_0X004 = 0x004;
}
| [
"[email protected]"
] | |
19f1949b84b1a755d6492545d4ce23120f72a453 | 83166947da1cd246617fc42407524f3b90ed23ee | /src/main/java/com/jakehonea/braedencraft/claims/Claim.java | f7be2f747ba8855c423b195f2b673bb078c57823 | [] | no_license | Jatatto/Braeden-Craft | 84bfee28b958d5a1d467037dc6e1002992f61b7b | ce0dc0c15644780ae5f457e3af57e583c6e5fc8f | refs/heads/master | 2023-03-16T21:03:19.611877 | 2021-03-04T20:57:59 | 2021-03-04T20:57:59 | 342,717,368 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,040 | java | package com.jakehonea.braedencraft.claims;
import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.jakehonea.braedencraft.utils.Util;
import org.bukkit.util.BoundingBox;
import java.io.*;
import java.util.List;
import java.util.UUID;
public class Claim {
public static final String OWNER = "owner",
TRUSTED = "trusted",
MINIMUM = "minimum",
MAXIMUM = "maximum",
WORLD = "world";
private JsonObject obj;
private File file;
public Claim(File file) {
this.file = file;
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
this.obj = new JsonObject();
} else {
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
String json = "";
String ln;
while ((ln = reader.readLine()) != null)
json += ln + " ";
obj = new JsonParser().parse(json).getAsJsonObject();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void set(String path, JsonElement element) {
obj.add(path, element);
save();
}
public JsonElement get(String path) {
return obj.get(path);
}
public List<UUID> getTrusted() {
JsonArray array = get(Claim.TRUSTED).getAsJsonArray();
List<UUID> trusted = Lists.newArrayList();
for (int i = 0; i < array.size(); i++)
trusted.add(UUID.fromString(array.remove(0).getAsString()));
return trusted;
}
public void addTrusted(UUID id) {
JsonArray array = get(Claim.TRUSTED).getAsJsonArray();
array.add(id.toString());
set(Claim.TRUSTED, array);
save();
}
public void removeTrusted(UUID id) {
JsonArray array = new JsonArray();
getTrusted().stream().filter(uuid -> !uuid.equals(id))
.forEach(uuid -> array.add(uuid.toString()));
set(Claim.TRUSTED, array);
}
public boolean isTrusted(UUID id) {
return get(Claim.OWNER).getAsString().equals(id.toString()) || getTrusted().contains(id);
}
public BoundingBox getBounds() {
return BoundingBox.of(Util.fromString(get(Claim.MINIMUM).getAsString()), Util.fromString(get(Claim.MAXIMUM).getAsString()));
}
public void save() {
try {
FileWriter writer = new FileWriter(file);
writer.write(obj.toString());
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public File getFile() {
return file;
}
public JsonObject getJson() {
return this.obj;
}
}
| [
"[email protected]"
] | |
d96b103af4cc61f77427a7a3ae683e1b145e57b4 | e8b0cf9ae1d5756c5de3d423e81a1142caa4c2e4 | /Chronostar/src/main/java/frc/robot/commands/autos/Right8Auto.java | 831039eab4689be00ac08719e3f980359e9bcc54 | [] | no_license | HighlandersFRC/2020-Chronostar-Tournament | af1cebde705c2e66b577e69e9850070934a9d574 | af429727c9ae8f79efecc6264b04827c0310b2b4 | refs/heads/master | 2023-02-18T11:18:30.482438 | 2021-01-09T03:57:43 | 2021-01-09T03:57:43 | 328,064,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,860 | java | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.commands.autos;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import frc.robot.commands.controls.FireSequence;
import frc.robot.commands.controls.SetFlyWheelVelocity;
import frc.robot.commands.controls.SetHoodPosition;
import frc.robot.commands.controls.TrackVisionTarget;
import frc.robot.tools.controlLoops.PurePursuitController;
import frc.robot.tools.pathTools.PathList;
// NOTE: Consider using this command inline, rather than writing a subclass. For more
// information, see:
// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
public class Right8Auto extends SequentialCommandGroup {
/**
* Creates a new Right8Auto.
*/
public Right8Auto() {
// Add your commands in the super() call, e.g.
// super(new FooCommand(), new BarCommand());
super(new ParallelCommandGroup(new SetFlyWheelVelocity(4500), new SetHoodPosition(10.5), new TrackVisionTarget()), new FireSequence(4500, 10, 1.0), new PurePursuitController(PathList.right8AutoPath1, 2.5, 4.0,true, true ),new ParallelCommandGroup( new PurePursuitController(PathList.right8AutoPath2, 2.5, 4.0,true, true )),new ParallelCommandGroup(new SetFlyWheelVelocity(5250), new SetHoodPosition(13.5), new TrackVisionTarget()), new FireSequence(5250, 13.5, 1.8));
}
}
| [
"[email protected]"
] | |
d94bc305fa206cee10c82243b0e72dbbd1992f8a | 8c7175ae8e0b35b680ec562ce81183cfd5913cb1 | /SpringDataJpa/src/main/java/com/springdatajpa/service/UserService.java | 8b04c997672aba1f180672b5f4f8956d8e5c6b31 | [] | no_license | dipendra-yadav/persistence | 624ba9c62126adc6af1ead20114cdc89e565e45a | 6956191f57e03ae676d777d30b93d8aeed9d62bd | refs/heads/master | 2021-01-19T21:29:36.789958 | 2017-12-21T06:42:51 | 2017-12-21T06:42:51 | 101,251,873 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 452 | java | package com.springdatajpa.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import com.springdatajpa.dao.UserRepository;
import com.springdatajpa.model.User;
@Component
@Service
public class UserService {
@Autowired
private UserRepository userRepository;
public void saveUser(User user) {
userRepository.save(user);
}
}
| [
"[email protected]"
] | |
ea9dc4d4ea109609c50ac0037dfca8883b9b780b | c2107aa03f71281def7e4e945c2a2fd7914d8ced | /PaymentWallet_MS/TransferAmount/src/test/java/com/cg/sprint2/transferamount/ms/testservice/TestService.java | 58b198ac85b8304c37b57357e6b6405841d76ccc | [] | no_license | SaiPrasad245/PaymentWallet2 | 4991902e773807493a3eedabdb7323bcf95eade3 | c028b5646ec90b00bb6e95e809f1e91ad7328faa | refs/heads/master | 2022-07-16T20:42:27.557820 | 2020-05-17T20:32:00 | 2020-05-17T20:32:00 | 264,751,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,516 | java | package com.cg.sprint2.transferamount.ms.testservice;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import com.cg.sprint2.transferamount.ms.service.TransferAmountService;
@SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT)
public class TestService {
@Autowired
TransferAmountService taservice;
@Test
public void testTransferAmountToAnotherWallet_Positive() throws Exception
{
String response =taservice.transferAmountToAnotherWalletUser("7799208319", "9398165142", 100);
Assertions.assertEquals("Transaction Sucess---->Amount Transferred", response);
}
@Test
public void testTransferAmountToAnotherWallet_Negative() throws Exception
{
String response =taservice.transferAmountToAnotherWalletUser("7799208319", "9398165142", 10000);
Assertions.assertEquals("Transaction Failed : Err --- Insufficient Balance",response);
}
@Test
public void testTransferAmountToAnotherWallet_Negative1() throws Exception
{
String response =taservice.transferAmountToAnotherWalletUser("7799208319", "9398165242", 100);
Assertions.assertEquals("Transaction Failed : Err --- The Number that the money is to be sent has to be Registerd on the Application", response);
}
@Test
public void testUpiTransfer_Positive() throws Exception
{
String response =taservice.upiTransfer("9398165142","7799208319",100,8521 );
Assertions.assertEquals("Transaction Sucess:Amount Transferred", response);
}
@Test
public void testUpiTransfer_Negative() throws Exception
{
String response =taservice.upiTransfer("9398165142","7799208319",8523,100 );
Assertions.assertEquals("Transaction Failed : Err ---> Incorrect PIN", response);
}
@Test
public void testUpiTransfer_Negative2() throws Exception
{
String response =taservice.upiTransfer("9398165142","7799208319",852000,8521 );
Assertions.assertEquals("Transaction Failed : Err --->Insufficient Balance", response);
}
@Test
public void testUpiTransfer_Negative3() throws Exception
{
String response =taservice.upiTransfer("9398165142","7799208329",8521,100 );
Assertions.assertEquals("Transaction Failed : Err --->The Number that the money is to be sent has to be Registerd on the Application", response);
}
}
| [
"[email protected]"
] | |
51868f787dab8c5145801ac86fb48716390cfd3c | 9e8afc827742e6ebf18c547071dfa2e96ab945a9 | /HMI112_V01/app_net/src/main/java/com/uninew/net/JT905/bean/P_ParamQuery.java | 01288c6698e1597f46b16f71725d847dc768988f | [] | no_license | hgdsys007/Uninew | 23c0957e58f8bdaa698db0102f62eecc91d3f538 | efedd89a2d296ca6427c48441bbdb8490c2c42bb | refs/heads/master | 2021-12-30T05:40:15.482254 | 2018-02-06T01:29:01 | 2018-02-06T01:29:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,378 | java | package com.uninew.net.JT905.bean;
import com.uninew.net.JT905.common.BaseMsgID;
import com.uninew.net.JT905.common.ProtocolTool;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
/**
* 参数查询
* Created by Administrator on 2017/8/19 0019.
*/
public class P_ParamQuery extends BaseBean {
private List<Integer> paramIds;//参数列表
public P_ParamQuery() {
}
public P_ParamQuery(byte[] body) {
getDataPacket(body);
}
public P_ParamQuery(List<Integer> paramIds) {
this.paramIds = paramIds;
}
public List<Integer> getParamIds() {
return paramIds;
}
public void setParamIds(List<Integer> paramIds) {
this.paramIds = paramIds;
}
@Override
public int getTcpId() {
return this.tcpId;
}
@Override
public void setTcpId(int tcpId) {
this.tcpId = tcpId;
}
@Override
public int getTransportId() {
return this.transportId;
}
@Override
public void setTransportId(int transportId) {
this.transportId = transportId;
}
@Override
public String getSmsPhoneNumber() {
return this.smsPhonenumber;
}
@Override
public void setSmsPhoneNumber(String smsPhonenumber) {
this.smsPhonenumber = smsPhonenumber;
}
@Override
public int getSerialNumber() {
return this.serialNumber;
}
@Override
public void setSerialNumber(int serialNumber) {
this.serialNumber = serialNumber;
}
@Override
public int getMsgId() {
return BaseMsgID.TERMINAL_PARAM_QUERY;
}
@Override
public byte[] getDataBytes() {
byte[] datas = null;
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(stream);
try {
for (Integer integer:paramIds){
out.writeShort(integer);
}
out.flush();
datas = stream.toByteArray();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (stream != null) {
stream.close();
}
if (out != null) {
out.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return datas;
}
@Override
public P_ParamQuery getDataPacket(byte[] datas) {
ByteArrayInputStream stream = new ByteArrayInputStream(datas);
DataInputStream in = new DataInputStream(stream);
try {
int number=datas.length/2;//参数ID根数
int paramId;
for (int i=0;i<number;i++){
paramId=in.readShort();
paramIds.add(paramId);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (stream != null) {
stream.close();
}
if (in != null) {
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return this;
}
}
| [
"[email protected]"
] | |
433df59c9d1f8b977297b0de8bb8b2e75df8a7ab | 75c47b6bb5faa255b4f79c9494b9cf3b0e412b2b | /kafka+ELK企业级实时日志分析平台/kafkaProducer/src/main/java/com/xiu/fastkafka/controller/KafkaController.java | 6056ed441022b2b2afc6d5338455306f6b056288 | [] | no_license | williamzhang11/fastScheme | 5ca5128e5880b9454a0a8fe5f4167bbb916732d8 | aa3525c79347b102d5584b8a2a2a21cbfd397099 | refs/heads/master | 2022-11-21T02:03:28.205928 | 2019-07-04T12:12:49 | 2019-07-04T12:12:49 | 178,649,279 | 1 | 0 | null | 2022-11-16T04:24:17 | 2019-03-31T06:03:46 | Java | UTF-8 | Java | false | false | 730 | java | package com.xiu.fastkafka.controller;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/kafka")
public class KafkaController {
@Autowired
private KafkaTemplate<String, String> kafkaTemplate;
@RequestMapping("/send")
public String sendKafka(@RequestParam String msg) {
System.err.println("msg="+msg);
kafkaTemplate.send("test", msg);
System.err.println(new Date()+"send ok");
return "ok";
}
}
| [
"[email protected]"
] | |
23c33fb87a0c719a3faefe40882297d50178e560 | 5b7b2efab0a2bf8e789a303f8e4d9c56bd220b78 | /src/main/java/com/kov/lectures/lecture_2_StringsAndRegularExpressions/item_4/Main.java | 922f490cc0fda848bd04b6c76df030fb1fe418e2 | [] | no_license | DenisLaptev/ProgrammingLectures | 04e9f5618e209157ffb6b59be7182a5bdbd795c5 | bad94c1d6a83fd433f13c87d0635e32c824ed91b | refs/heads/master | 2021-01-12T12:47:10.992714 | 2016-10-03T14:14:29 | 2016-10-03T14:14:29 | 69,856,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,155 | java | package com.kov.lectures.lecture_2_StringsAndRegularExpressions.item_4;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Kovantonlenko on 11/2/2015.
*/
public class Main {
public static void main(String[] args) {
String s = "The world is mine";
String s1 = "test";
String s2 = new String();
String name = s.substring(4, s.length()-8);
String name1 = s.substring(4, 9);
System.out.println("length = " + s.length());
System.out.println(name); // �� ������� ������� "world"
System.out.println(name1); // �� ������� ������� "world"
String domain = s.substring(s.length());
System.out.println(domain); // подстрока, начиная с N+1 буквы. Получим пустую строку.
String substring = s1.substring(4);
// System.out.println(s.substring(4));
System.out.println(substring.equals(""));
System.out.println(substring);//подстрока, начиная с N+1 буквы. Получим пустую строку.
}
}
| [
"[email protected]"
] | |
cf890509ade1af62db46c70c3967651a0bf4f46f | 4b027a96e457f90fdd146c73a92a99a63b5f6cab | /level37/lesson10/big01/AmigoSet.java | e168eede0c777070012af5c9c6a94e15f7369708 | [] | no_license | Byshevsky/JavaRush | c44a3b25afca677bbe5b6c015aec7c2561ca4830 | d8965bc8b5f060af558cc86924ae6488727cdbd4 | refs/heads/master | 2021-05-02T12:17:48.896494 | 2016-12-26T21:56:12 | 2016-12-26T21:56:12 | 52,143,706 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,650 | java | package com.javarush.test.level37.lesson10.big01;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.*;
/**
* Created by IGOR on 31.01.2016.
*/
public class AmigoSet<E> extends AbstractSet implements Cloneable, Serializable, Set
{
private static final Object PRESENT = new Object();
private transient HashMap<E, Object> map;
public AmigoSet() {
map = new HashMap<>();
}
public AmigoSet(Collection<? extends E> collection) {
int capacity = 0;
if (collection.size()/.75f > 16) {
capacity = (int) (collection.size()/.75f);
}
else capacity = 16;
map = new HashMap<>(capacity);
this.addAll(collection);
}
@Override
public boolean add(Object o)
{
map.put((E) o, PRESENT);
return map.get(o) != null;
}
@Override
public Iterator<E> iterator()
{
Set<E> keys = map.keySet();
return keys.iterator();
}
@Override
public int size()
{
return map.keySet().size();
}
@Override
public Object clone()
{
AmigoSet<E> result = null;
try
{
result = (AmigoSet<E>) super.clone();
result.map = (HashMap<E, Object>) this.map.clone();
}
catch (Exception e) {
throw new InternalError();
}
return result;
}
@Override
public boolean isEmpty()
{
return map.keySet().isEmpty();
}
@Override
public boolean contains(Object o)
{
return map.keySet().contains(o);
}
@Override
public void clear()
{
map.keySet().clear();
}
@Override
public boolean remove(Object o)
{
return map.keySet().remove(o);
}
private void writeObject(ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeInt(HashMapReflectionHelper.<Integer>callHiddenMethod(map, "capacity"));
out.writeFloat(HashMapReflectionHelper.<Float>callHiddenMethod(map, "loadFactor"));
out.writeObject(new HashSet<Integer>((Collection<Integer>) map.keySet()));
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
int capacity = in.readInt();
float loadFactor = in.readFloat();
map = new HashMap<>(capacity, loadFactor);
addAll((Collection) in.readObject());
}
}
| [
"[email protected]"
] | |
7faafb87d0dc6bb2e417f8a7f7e6bd4bdd143c96 | 98e5b3aec60935f6768cb4e2a24b21da0b528b6d | /datalayer/message/src/main/java/com/waben/stock/datalayer/message/service/RedisCache.java | d495d17c958ef319d68ee83a006009d64d577d5a | [] | no_license | sunliang123/zhongbei-zhonghang-zhongzi-yidian | 3eb95a77658d7ad9de1cdf9c3f85714ee007a871 | 54fed94b9784f5e392b4b9517cb5fe19c1b34443 | refs/heads/master | 2020-03-29T05:26:02.515289 | 2018-09-20T09:11:48 | 2018-09-20T09:11:48 | 149,582,090 | 1 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,632 | java | package com.waben.stock.datalayer.message.service;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.Protocol;
@Component("messageRedisCache")
public class RedisCache {
@Value("${redis.host}")
private String redisHost;
@Value("${redis.port}")
private String redisPort;
@Value("${redis.password}")
private String redisPassword;
private JedisPool pool;
@PostConstruct
public void initJedisPool() {
if (redisPassword != null && !"".equals(redisPassword.trim())) {
pool = new JedisPool(new JedisPoolConfig(), redisHost, Integer.parseInt(redisPort),
Protocol.DEFAULT_TIMEOUT, redisPassword);
} else {
pool = new JedisPool(new JedisPoolConfig(), redisHost, Integer.parseInt(redisPort));
}
}
public String get(String key) {
Jedis jedis = null;
try {
jedis = pool.getResource();
return jedis.get(key);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public void set(String key, String value) {
Jedis jedis = null;
try {
jedis = pool.getResource();
jedis.set(key, value);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public void set(String key, String value, int seconds) {
Jedis jedis = null;
try {
jedis = pool.getResource();
jedis.setex(key, seconds, value);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
public JedisPool getPool() {
return pool;
}
}
| [
"[email protected]"
] | |
9a640148b18a5021ce37253cad893cee0f917e23 | 349c6644fb1fe84334b432c49292f44c14bce847 | /src/main/sources/com/yoparty/bean/Area.java | b290572d11d94bb2d4457080f1a61c933fae57b1 | [] | no_license | wdfwolf3/yopartynet | 6e79f7cbfa0f02e33d398bb56ccc98092fa77e6a | c6c32869797989a85656d3653da4c7bfe38f3cb3 | refs/heads/master | 2021-01-19T16:59:42.957367 | 2017-08-22T07:04:40 | 2017-08-22T07:04:40 | 101,032,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,444 | java | package com.yoparty.bean;
import java.io.Serializable;
public class Area implements Serializable {
private String id;
private String name;
private String parentId;
private String parent_key = "0";
private String dict_key = "0";
private int dict_level;
private String root_key = "AREA";
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId == null ? null : parentId.trim();
}
public String getParent_key() {
return parent_key;
}
public void setParent_key(String parent_key) {
this.parent_key = parent_key;
}
public String getDict_key() {
return dict_key;
}
public void setDict_key(String dict_key) {
this.dict_key = dict_key;
}
public int getDict_level() {
return dict_level;
}
public void setDict_level(int dict_level) {
this.dict_level = dict_level;
}
public String getRoot_key() {
return root_key;
}
public void setRoot_key(String root_key) {
this.root_key = root_key;
}
} | [
"[email protected]"
] | |
b07622aa516f37b647ac23de4010fbdcf63c286a | dfa2c6ecdc2e6b27c4494c7f5898608ade98fbec | /cloud-stream-rabbitmq-consumer-8803/src/main/java/cn/com/springcloud/StreamMQMain8803.java | 3d98d316c2ab625f901aa8107f0efe1afd76a099 | [] | no_license | cai-xiaodou/MicroServices | 82e7c3ef45970eb2a4be944fe11c21fed8e9e69c | 53eec204949b380f44c56742fc904cf5c2574ea1 | refs/heads/master | 2023-05-02T16:00:36.474986 | 2021-05-08T08:35:00 | 2021-05-08T08:35:00 | 348,016,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package cn.com.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class StreamMQMain8803 {
public static void main(String[] args) {
SpringApplication.run(StreamMQMain8803.class,args);
}
}
| [
"[email protected]"
] | |
1ab129f9a54f9d66819a520e2ce7ac8d98396445 | 6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386 | /google/cloud/networkservices/v1beta1/google-cloud-networkservices-v1beta1-java/proto-google-cloud-networkservices-v1beta1-java/src/main/java/com/google/cloud/networkservices/v1beta1/EndpointPolicyOrBuilder.java | f2859f867d7e400c8af23d06d9981273cf87fc82 | [
"Apache-2.0"
] | permissive | oltoco/googleapis-gen | bf40cfad61b4217aca07068bd4922a86e3bbd2d5 | 00ca50bdde80906d6f62314ef4f7630b8cdb6e15 | refs/heads/master | 2023-07-17T22:11:47.848185 | 2021-08-29T20:39:47 | 2021-08-29T20:39:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 12,180 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/networkservices/v1beta1/endpoint_policy.proto
package com.google.cloud.networkservices.v1beta1;
public interface EndpointPolicyOrBuilder extends
// @@protoc_insertion_point(interface_extends:google.cloud.networkservices.v1beta1.EndpointPolicy)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* Required. Name of the EndpointPolicy resource. It matches pattern
* `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`.
* </pre>
*
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The name.
*/
java.lang.String getName();
/**
* <pre>
* Required. Name of the EndpointPolicy resource. It matches pattern
* `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`.
* </pre>
*
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The bytes for name.
*/
com.google.protobuf.ByteString
getNameBytes();
/**
* <pre>
* Output only. The timestamp when the resource was created.
* </pre>
*
* <code>.google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return Whether the createTime field is set.
*/
boolean hasCreateTime();
/**
* <pre>
* Output only. The timestamp when the resource was created.
* </pre>
*
* <code>.google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return The createTime.
*/
com.google.protobuf.Timestamp getCreateTime();
/**
* <pre>
* Output only. The timestamp when the resource was created.
* </pre>
*
* <code>.google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*/
com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder();
/**
* <pre>
* Output only. The timestamp when the resource was updated.
* </pre>
*
* <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return Whether the updateTime field is set.
*/
boolean hasUpdateTime();
/**
* <pre>
* Output only. The timestamp when the resource was updated.
* </pre>
*
* <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return The updateTime.
*/
com.google.protobuf.Timestamp getUpdateTime();
/**
* <pre>
* Output only. The timestamp when the resource was updated.
* </pre>
*
* <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
*/
com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder();
/**
* <pre>
* Optional. Set of label tags associated with the EndpointPolicy resource.
* </pre>
*
* <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
int getLabelsCount();
/**
* <pre>
* Optional. Set of label tags associated with the EndpointPolicy resource.
* </pre>
*
* <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
boolean containsLabels(
java.lang.String key);
/**
* Use {@link #getLabelsMap()} instead.
*/
@java.lang.Deprecated
java.util.Map<java.lang.String, java.lang.String>
getLabels();
/**
* <pre>
* Optional. Set of label tags associated with the EndpointPolicy resource.
* </pre>
*
* <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
java.util.Map<java.lang.String, java.lang.String>
getLabelsMap();
/**
* <pre>
* Optional. Set of label tags associated with the EndpointPolicy resource.
* </pre>
*
* <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
java.lang.String getLabelsOrDefault(
java.lang.String key,
java.lang.String defaultValue);
/**
* <pre>
* Optional. Set of label tags associated with the EndpointPolicy resource.
* </pre>
*
* <code>map<string, string> labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
java.lang.String getLabelsOrThrow(
java.lang.String key);
/**
* <pre>
* Required. The type of endpoint policy. This is primarily used to validate
* the configuration.
* </pre>
*
* <code>.google.cloud.networkservices.v1beta1.EndpointPolicy.EndpointPolicyType type = 5 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The enum numeric value on the wire for type.
*/
int getTypeValue();
/**
* <pre>
* Required. The type of endpoint policy. This is primarily used to validate
* the configuration.
* </pre>
*
* <code>.google.cloud.networkservices.v1beta1.EndpointPolicy.EndpointPolicyType type = 5 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The type.
*/
com.google.cloud.networkservices.v1beta1.EndpointPolicy.EndpointPolicyType getType();
/**
* <pre>
* Optional. This field specifies the URL of AuthorizationPolicy resource that
* applies authorization policies to the inbound traffic at the
* matched endpoints. Refer to Authorization. If this field is not
* specified, authorization is disabled(no authz checks) for this
* endpoint. Applicable only when EndpointPolicyType is
* SIDECAR_PROXY.
* </pre>
*
* <code>string authorization_policy = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code>
* @return The authorizationPolicy.
*/
java.lang.String getAuthorizationPolicy();
/**
* <pre>
* Optional. This field specifies the URL of AuthorizationPolicy resource that
* applies authorization policies to the inbound traffic at the
* matched endpoints. Refer to Authorization. If this field is not
* specified, authorization is disabled(no authz checks) for this
* endpoint. Applicable only when EndpointPolicyType is
* SIDECAR_PROXY.
* </pre>
*
* <code>string authorization_policy = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for authorizationPolicy.
*/
com.google.protobuf.ByteString
getAuthorizationPolicyBytes();
/**
* <pre>
* Required. A matcher that selects endpoints to which the policies should be applied.
* </pre>
*
* <code>.google.cloud.networkservices.v1beta1.EndpointMatcher endpoint_matcher = 9 [(.google.api.field_behavior) = REQUIRED];</code>
* @return Whether the endpointMatcher field is set.
*/
boolean hasEndpointMatcher();
/**
* <pre>
* Required. A matcher that selects endpoints to which the policies should be applied.
* </pre>
*
* <code>.google.cloud.networkservices.v1beta1.EndpointMatcher endpoint_matcher = 9 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The endpointMatcher.
*/
com.google.cloud.networkservices.v1beta1.EndpointMatcher getEndpointMatcher();
/**
* <pre>
* Required. A matcher that selects endpoints to which the policies should be applied.
* </pre>
*
* <code>.google.cloud.networkservices.v1beta1.EndpointMatcher endpoint_matcher = 9 [(.google.api.field_behavior) = REQUIRED];</code>
*/
com.google.cloud.networkservices.v1beta1.EndpointMatcherOrBuilder getEndpointMatcherOrBuilder();
/**
* <pre>
* Optional. Port selector for the (matched) endpoints. If no port selector is
* provided, the matched config is applied to all ports.
* </pre>
*
* <code>.google.cloud.networkservices.v1beta1.TrafficPortSelector traffic_port_selector = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return Whether the trafficPortSelector field is set.
*/
boolean hasTrafficPortSelector();
/**
* <pre>
* Optional. Port selector for the (matched) endpoints. If no port selector is
* provided, the matched config is applied to all ports.
* </pre>
*
* <code>.google.cloud.networkservices.v1beta1.TrafficPortSelector traffic_port_selector = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return The trafficPortSelector.
*/
com.google.cloud.networkservices.v1beta1.TrafficPortSelector getTrafficPortSelector();
/**
* <pre>
* Optional. Port selector for the (matched) endpoints. If no port selector is
* provided, the matched config is applied to all ports.
* </pre>
*
* <code>.google.cloud.networkservices.v1beta1.TrafficPortSelector traffic_port_selector = 10 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
com.google.cloud.networkservices.v1beta1.TrafficPortSelectorOrBuilder getTrafficPortSelectorOrBuilder();
/**
* <pre>
* Optional. A free-text description of the resource. Max length 1024 characters.
* </pre>
*
* <code>string description = 11 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return The description.
*/
java.lang.String getDescription();
/**
* <pre>
* Optional. A free-text description of the resource. Max length 1024 characters.
* </pre>
*
* <code>string description = 11 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return The bytes for description.
*/
com.google.protobuf.ByteString
getDescriptionBytes();
/**
* <pre>
* Optional. A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is used to
* determine the authentication policy to be applied to terminate the inbound
* traffic at the identified backends. If this field is not set,
* authentication is disabled(open) for this endpoint.
* </pre>
*
* <code>string server_tls_policy = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code>
* @return The serverTlsPolicy.
*/
java.lang.String getServerTlsPolicy();
/**
* <pre>
* Optional. A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is used to
* determine the authentication policy to be applied to terminate the inbound
* traffic at the identified backends. If this field is not set,
* authentication is disabled(open) for this endpoint.
* </pre>
*
* <code>string server_tls_policy = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for serverTlsPolicy.
*/
com.google.protobuf.ByteString
getServerTlsPolicyBytes();
/**
* <pre>
* Optional. A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy can be set
* to specify the authentication for traffic from the proxy to the actual
* endpoints. More specifically, it is applied to the outgoing traffic from
* the proxy to the endpoint. This is typically used for sidecar model where
* the proxy identifies itself as endpoint to the control plane, with the
* connection between sidecar and endpoint requiring authentication. If this
* field is not set, authentication is disabled(open). Applicable only when
* EndpointPolicyType is SIDECAR_PROXY.
* </pre>
*
* <code>string client_tls_policy = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code>
* @return The clientTlsPolicy.
*/
java.lang.String getClientTlsPolicy();
/**
* <pre>
* Optional. A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy can be set
* to specify the authentication for traffic from the proxy to the actual
* endpoints. More specifically, it is applied to the outgoing traffic from
* the proxy to the endpoint. This is typically used for sidecar model where
* the proxy identifies itself as endpoint to the control plane, with the
* connection between sidecar and endpoint requiring authentication. If this
* field is not set, authentication is disabled(open). Applicable only when
* EndpointPolicyType is SIDECAR_PROXY.
* </pre>
*
* <code>string client_tls_policy = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for clientTlsPolicy.
*/
com.google.protobuf.ByteString
getClientTlsPolicyBytes();
}
| [
"bazel-bot-development[bot]@users.noreply.github.com"
] | bazel-bot-development[bot]@users.noreply.github.com |
de7d0b661c9dd72889d82bb3e6862bc9ffea31b0 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /dm-20151123/src/main/java/com/aliyun/dm20151123/models/QueryTaskByParamRequest.java | 6ae07a3c159da15d9c58e9b0983f2e75cd5c63b5 | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 2,273 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.dm20151123.models;
import com.aliyun.tea.*;
public class QueryTaskByParamRequest extends TeaModel {
@NameInMap("KeyWord")
public String keyWord;
@NameInMap("OwnerId")
public Long ownerId;
@NameInMap("PageNo")
public Integer pageNo;
@NameInMap("PageSize")
public Integer pageSize;
@NameInMap("ResourceOwnerAccount")
public String resourceOwnerAccount;
@NameInMap("ResourceOwnerId")
public Long resourceOwnerId;
@NameInMap("Status")
public Integer status;
public static QueryTaskByParamRequest build(java.util.Map<String, ?> map) throws Exception {
QueryTaskByParamRequest self = new QueryTaskByParamRequest();
return TeaModel.build(map, self);
}
public QueryTaskByParamRequest setKeyWord(String keyWord) {
this.keyWord = keyWord;
return this;
}
public String getKeyWord() {
return this.keyWord;
}
public QueryTaskByParamRequest setOwnerId(Long ownerId) {
this.ownerId = ownerId;
return this;
}
public Long getOwnerId() {
return this.ownerId;
}
public QueryTaskByParamRequest setPageNo(Integer pageNo) {
this.pageNo = pageNo;
return this;
}
public Integer getPageNo() {
return this.pageNo;
}
public QueryTaskByParamRequest setPageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
public Integer getPageSize() {
return this.pageSize;
}
public QueryTaskByParamRequest setResourceOwnerAccount(String resourceOwnerAccount) {
this.resourceOwnerAccount = resourceOwnerAccount;
return this;
}
public String getResourceOwnerAccount() {
return this.resourceOwnerAccount;
}
public QueryTaskByParamRequest setResourceOwnerId(Long resourceOwnerId) {
this.resourceOwnerId = resourceOwnerId;
return this;
}
public Long getResourceOwnerId() {
return this.resourceOwnerId;
}
public QueryTaskByParamRequest setStatus(Integer status) {
this.status = status;
return this;
}
public Integer getStatus() {
return this.status;
}
}
| [
"[email protected]"
] | |
9cea841724d1c0230ecf1107c2d9d5384257c4c5 | 6a40c204f2a0835397ef1ccd7931730c74aa8cb9 | /app/src/main/java/helper/ConnectionDetector.java | f3366cac55c300f121a5aff6805dec523b5602f4 | [] | no_license | pierrebrtr/Moov-in-Nantes | bb42109bcec4670f6e5fb532a670b2f036f14b24 | 2b71ef405ff466d30d197da15fc29206b6743de6 | refs/heads/master | 2021-06-07T10:28:36.627879 | 2016-10-25T09:57:03 | 2016-10-25T09:57:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 905 | java | package helper;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class ConnectionDetector {
private Context _context;
public ConnectionDetector(Context context){
this._context = context;
}
/**
* Checking for all possible internet providers
* **/
public boolean isConnectingToInternet(){
ConnectivityManager connectivity = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null)
{
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null)
for (int i = 0; i < info.length; i++)
if (info[i].getState() == NetworkInfo.State.CONNECTED)
{
return true;
}
}
return false;
}
} | [
"[email protected]"
] | |
7401a71f2dc7c6aa52610b2ff0fbf6f53acf64ab | f2470c4cb0f23d6b2d3566ff7ef2fb43650def76 | /mvc/src/main/java/org/itas/util/cache/CacheSizes.java | c774b91558bab8db13a0b4ee6f72d0a5ab912317 | [] | no_license | liuxing521a/uxuan | 08b5ec702375841ac7ea3cbf276e5cb61ada0694 | 2249ce8bb991a9580b97faac82294b27d911f7ef | refs/heads/master | 2021-01-20T09:21:01.217586 | 2017-05-05T09:32:08 | 2017-05-05T09:32:08 | 90,242,019 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,626 | java | package org.itas.util.cache;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
/**
* <p>占用内存计算工具类</p>
* 用来估算常用对象占用内存大小(以字节为单位)
* @author liuzhen<[email protected]>
*/
public class CacheSizes {
public static int sizeOfObject() {
return 4;
}
public static int sizeOfString(String str) {
if (Objects.isNull(str)) {
return 0;
}
return 4 + str.getBytes().length;
}
public static int sizeOfByte() {
return 1;
}
public static int sizeOfBoolean() {
return 1;
}
public static int sizeOfChar() {
return 2;
}
public static int sizeOfShort() {
return 2;
}
public static int sizeOfInt() {
return 4;
}
public static int sizeOfFloat() {
return 4;
}
public static int sizeOfLong() {
return 8;
}
public static int sizeOfDouble() {
return 8;
}
public static int sizeOfDate() {
return 12;
}
public static int sizeOfMap(Map<?, ?> map) throws CalculateSizeException {
if (Objects.isNull(map)) {
return 0;
}
AtomicInteger size = new AtomicInteger(36);
for (Entry<?, ?> entry : map.entrySet()) {
size.addAndGet(sizeOf(entry.getKey()));
size.addAndGet(sizeOf(entry.getValue()));
}
return size.get();
}
public static int sizeOfCollection(Collection<?> list) throws CalculateSizeException {
if (Objects.isNull(list)) {
return 0;
}
AtomicInteger size = new AtomicInteger(36);
for (Object o : list) {
size.addAndGet(sizeOf(o));
}
return size.get();
}
public static int sizeOf(Object o) throws CalculateSizeException {
if (Objects.isNull(o)) {
return 0;
}
if (o instanceof Cacheable) {
return ((Cacheable) o).getCachedSize();
}
if (o instanceof Byte) {
return sizeOfObject() + sizeOfByte();
}
if (o instanceof Boolean) {
return sizeOfObject() + sizeOfBoolean();
}
if (o instanceof Character) {
return sizeOfObject() + sizeOfChar();
}
if (o instanceof Short) {
return sizeOfObject() + sizeOfShort();
}
if (o instanceof Integer) {
return sizeOfObject() + sizeOfInt();
}
if (o instanceof Float) {
return sizeOfObject() + sizeOfFloat();
}
if (o instanceof Long) {
return sizeOfObject() + sizeOfLong();
}
if (o instanceof Double) {
return sizeOfObject() + sizeOfDouble();
}
if (o instanceof String) {
return sizeOfString((String) o);
}
if (o instanceof Collection) {
return sizeOfCollection((Collection<?>) o);
}
if (o instanceof Map) {
return sizeOfMap((Map<?, ?>) o);
}
if (o instanceof long[]) {
long[] array = (long[]) o;
return sizeOfObject() + array.length * sizeOfLong();
}
if (o instanceof byte[]) {
byte[] array = (byte[]) o;
return sizeOfObject() + array.length;
}
int size = 1;
try (NullOutputStream out = new NullOutputStream();
ObjectOutputStream outObj = new ObjectOutputStream(out)){
outObj.writeObject(o);
size = out.size();
} catch (IOException ioe) {
throw new CalculateSizeException(o);
}
return size;
}
private static class NullOutputStream extends OutputStream {
int size = 0;
@Override
public void write(int b) throws IOException {
size++;
}
@Override
public void write(byte[] b) throws IOException {
size += b.length;
}
@Override
public void write(byte[] b, int off, int len) {
size += len;
}
public int size() {
return size;
}
}
}
| [
"[email protected]"
] | |
d3940cb086b6586c8f2643cd4535a6ee1c5a551e | c06b04186855e4e0fe5e771239b31983d92bbdd7 | /T1809-Java_Architect/01_Java_Beginner/01_Java300/010_Network/doc/Code/003_Net/246-250/Net_study03/src/com/sxt/chat04/Client.java | 58e5a3f0a2fe688cb83c964d4f7474e1946b1159 | [
"MIT"
] | permissive | specter01wj/ShangXueTang_Course | 0c6b8895c684891f72ee3f42c14ac3884d1b7db4 | 1de238c3385585f07e19815f680277672d2e1b9b | refs/heads/master | 2020-04-05T16:46:57.934281 | 2019-04-17T06:12:26 | 2019-04-17T06:12:26 | 157,028,215 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 862 | java | package com.sxt.chat04;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import java.net.UnknownHostException;
/**
* 在线聊天室: 客户端
* 目标: 加入容器实现群聊
* @author 裴新 QQ:3401997271
*
*/
public class Client {
public static void main(String[] args) throws UnknownHostException, IOException {
System.out.println("-----Client-----");
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入用户名:");
String name =br.readLine();
//1、建立连接: 使用Socket创建客户端 +服务的地址和端口
Socket client =new Socket("localhost",8888);
//2、客户端发送消息
new Thread(new Send(client,name)).start();
new Thread(new Receive(client)).start();
}
}
| [
"[email protected]"
] | |
eb62526711fcbafc870ef948f992eb2562f9524a | 409aee188dc6e7921a2cc050ae773f429eac4208 | /src/GameState.java | b37f4a3665abd5f56d38e71ba451566355becbc3 | [] | no_license | Hjaltejuel/DrawTree | 847c7fcae24b79ddbfa1eef40474220d88471077 | 109a61767d095af1c86159950191f43ea3965f53 | refs/heads/master | 2020-04-26T04:02:42.704230 | 2019-03-01T11:18:08 | 2019-03-01T11:18:08 | 173,287,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,291 | java | import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class GameState {
public JFrame jFrame;
public PaintPanel paintPanel;
private int nodeWidth = 25;
private int nodeHeight = 20;
public State result(State state, Action action,States states){
if(state.moves[action.firstArrayD][action.secondArrayD] == null) {
State state1 = state.copy();
if(states==States.MAX) {
state1.moves[action.firstArrayD][action.secondArrayD] = true;
} else {
state1.moves[action.firstArrayD][action.secondArrayD] = false;
}
return state1;
}
return null;
}
public List<Action> actions(State state){
List<Action> actions = new ArrayList<>();
if(state.ishead){
for(int i = 0; i <3 ; i++){
if(state.moves[0][i] == null){
actions.add(new Action(0,i));
}
}
} else {
if(state.moves[1][0] == null){
actions.add(new Action(1,0));
}
}
return actions;
}
public double playRandomFirst(State state,int depth){
State stateR = state.copy();
stateR.ishead = true;
double val = playMax(stateR,depth+1,(jFrame.getWidth()+75)/2,jFrame.getWidth(),75);
paintPanel.addShape(new OverState(depth,States.RANDOM,jFrame.getHeight()));
paintPanel.addShape(new Node(val,(jFrame.getWidth()+75)/2,height(depth),state));
paintPanel.addShape(new Line((int) (((jFrame.getWidth()+75)/2)+(nodeWidth/2)),(int)(height(depth)+nodeHeight),(int)(((jFrame.getWidth()+75)/2) + (nodeWidth/2)), height(depth+1),false,true));
jFrame.repaint();
return val;
}
public double playRandom(State state, int depth,int x, int xMax, int xLow){
if(state.isFinished()){
if(state.nextMove == States.MIN){
paintPanel.addShape(new Node(1,x,height(depth),state));
return 1;
} else {
paintPanel.addShape(new Node(-1,x,height(depth),state));
return -1;
}
}
State stateRCopy;
State stateLCopy;
double rval;
double lval;
int placementR = xLow + ((x-xLow)/2);
int placementL = x+((xMax-x)/2);
paintPanel.addShape(new Line(x+(nodeWidth/2),height(depth)+nodeHeight,placementL+(nodeWidth/2),height(depth+1),true,true));
paintPanel.addShape(new Line(x+(nodeWidth/2),height(depth)+nodeHeight,placementR+(nodeWidth/2),height(depth+1),false,true));
switch (state.nextMove){
case MAX:
stateRCopy = state.copy();
stateRCopy.ishead = true;
rval = playMax(stateRCopy,depth+1,placementR,x,xLow);
stateLCopy = state.copy();
stateLCopy.ishead = false;
lval = playMax(stateLCopy,depth+1,placementL,xMax,x);
double value = (lval + rval)/2;
paintPanel.addShape(new OverState(depth,States.RANDOM,jFrame.getHeight()));
paintPanel.addShape(new Node(value,x,height(depth),state));
if(value < -2){
System.out.println("Eh");
}
return value;
case MIN:
stateRCopy = state.copy();
stateRCopy.ishead = true;
rval = playMin(stateRCopy,depth+1,placementR,x,xLow);
stateLCopy = state.copy();
stateLCopy.ishead = false;
lval = playMin(stateLCopy,depth+1,placementL,xMax,x);
double val = (rval+lval) /2;
paintPanel.addShape(new OverState(depth,States.RANDOM,jFrame.getHeight()));
paintPanel.addShape(new Node(val,x,height(depth),state));
if(val < -2){
System.out.println("Eh");
}
return val;
}
return -500;
}
public int height(int depth){
return ((jFrame.getHeight()/9)*depth)-30;
}
public double playMin(State state, int depth,int x, int xMax, int xLow){
paintPanel.addShape(new OverState(depth,States.MIN,jFrame.getHeight()));
List<Action> actions = actions(state);
if(actions.size() == 0 ){
paintPanel.addShape(new Node(0,x,height(depth),state));
return 0;
}
double v = Integer.MAX_VALUE;
int xlowSub = xLow;
double[] connections = new double[actions.size()];
for(int i = 0 ; i< actions.size(); i++){
State result = result(state,actions.get(i),States.MIN);
if(result == null){
}
result.nextMove= States.MAX;
int part = (xMax-xLow)/actions.size();
int xMidSub = xlowSub+ (part/2);
int xMaxSub = xlowSub+ part;
connections[i] = xMidSub + nodeWidth/2;
double val = playRandom(result,depth+1,xMidSub,xMaxSub,xlowSub);
xlowSub +=part;
v = Math.min(val,v);
}
for(int j = 0; j< connections.length; j++){
paintPanel.addShape(new Line(x+(nodeWidth/2),height(depth)+nodeHeight,(int)connections[j],height(depth+1),!state.ishead,false));
}
paintPanel.addShape(new Node(v,x,height(depth),state));
return v;
}
public double playMax(State state, int depth,int x, int xMax, int xLow){
paintPanel.addShape(new OverState(depth,States.MAX,jFrame.getHeight()));
List<Action> actions = actions(state);
if(actions.size() == 0 ){
paintPanel.addShape(new Node(0,x,height(depth),state));
return 0;
}
double v = Integer.MIN_VALUE;
int xlowSub = xLow;
double[] connections = new double[actions.size()];
for(int i = 0 ; i< actions.size(); i++){
State result = result(state,actions.get(i),States.MAX);
result.nextMove= States.MIN;
int part = (xMax-xLow)/actions.size();
int xMidSub = xlowSub+ (part/2);
int xMaxSub = xlowSub+ part;
connections[i] = xMidSub + nodeWidth/2;
double val = playRandom(result,depth+1,xMidSub,xMaxSub,xlowSub);
xlowSub +=part;
v = Math.max(val,v);
}
for(int j = 0; j< connections.length; j++){
paintPanel.addShape(new Line(x+(nodeWidth/2),height(depth)+nodeHeight,(int)connections[j],height(depth+1),!state.ishead,false));
}
paintPanel.addShape(new Node(v,x,height(depth),state));
return v;
}
public double play(){
State state = new State();
state.nextMove = States.MAX;
return playRandomFirst(state,1);
}
public GameState (){
jFrame = new JFrame("Tree");
jFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
jFrame.setUndecorated(true);
jFrame.setVisible(true);
paintPanel =new PaintPanel();
jFrame.add(paintPanel);
jFrame.repaint();
System.out.println(play());
Scanner s = new Scanner(System.in);
s.next();
}
}
| [
"[email protected]"
] | |
2485340c8b082586de0d17ce27ed0a1bc8b254b9 | 443509d36d158926f26e750a0aa242c652c4aec3 | /app/src/main/java/com/aralmoro/android/movlancer/http/BaseApiService.java | 08e07832f95eb682576e94d56f2ae58377c873b8 | [] | no_license | aralmoro/MovLancer | c86f7857bf6ab6fd5729af066fa8dca7f8b72f83 | 18de0338118650bd778deab807562790163c54b8 | refs/heads/master | 2022-12-09T13:46:12.784629 | 2018-08-20T14:14:56 | 2018-08-20T14:14:56 | 286,086,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,019 | java | package com.aralmoro.android.movlancer.http;
import com.aralmoro.android.movlancer.constants.ApiConstants;
import com.aralmoro.android.movlancer.http.util.OkHttpClientFactory;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by angelaalmoro on 16/08/2018.
*/
public abstract class BaseApiService {
protected static final long CONN_TIMEOUT_MS = 32000;
protected static final long READ_TIMEOUT_MS = 32000;
protected Retrofit retrofit;
public BaseApiService() {
retrofit = new Retrofit.Builder()
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(ApiConstants.BASE_URL)
.client(OkHttpClientFactory.createOkHttpClient(0,
CONN_TIMEOUT_MS, READ_TIMEOUT_MS).build())
.build();
}
}
| [
"[email protected]"
] | |
6e648d362a2201d42be39d45d485d1e4d56d97f2 | cc2cfc2b08fb2774afb73615a5fe6b31edfccade | /QLForm/src/ql/ast/parser/QLBaseListener.java | a8b5532a92702b88df5379ca1307de63a219c021 | [] | no_license | rashadaoud/Software_construction | d9aeb30070a04e2d00c83390fe99a61e6bc41187 | 37e64b8a50789c530fbfbd3aec2d22154ef7bc70 | refs/heads/master | 2020-03-22T05:17:37.676089 | 2018-08-14T10:28:28 | 2018-08-14T10:28:28 | 139,555,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,825 | java | // Generated from .\QL\QL.g4 by ANTLR 4.7.1
package ql.ast.parser;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
/**
* This class provides an empty implementation of {@link QLListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
*/
public class QLBaseListener implements QLListener {
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLiteral(QLParser.LiteralContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLiteral(QLParser.LiteralContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIdentifier(QLParser.IdentifierContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIdentifier(QLParser.IdentifierContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterQuestionType(QLParser.QuestionTypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitQuestionType(QLParser.QuestionTypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterExpr(QLParser.ExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExpr(QLParser.ExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStatement(QLParser.StatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStatement(QLParser.StatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterQuestion(QLParser.QuestionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitQuestion(QLParser.QuestionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIfElseStatement(QLParser.IfElseStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIfElseStatement(QLParser.IfElseStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBlock(QLParser.BlockContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBlock(QLParser.BlockContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterForm(QLParser.FormContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitForm(QLParser.FormContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEveryRule(ParserRuleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitTerminal(TerminalNode node) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void visitErrorNode(ErrorNode node) { }
} | [
"[email protected]"
] | |
be8be7be90e015a599166c0a7bf82a219dbf1bb2 | 86e8712fe857786e7a3d3e7060c8881cb58d71a2 | /src/eu/clarin/weblicht/bindings/cmd/ws/Contact.java | 4959cd194fe6982f4a1c6af3eec9af2f93800660 | [] | no_license | oo222bs/exmaralda | 824f848d6daa59a9f87ac8c660826bbf2a29c2a0 | 07fc1d4c111da05ae7ad1b1cdf11c4b6629b9b97 | refs/heads/master | 2020-06-30T15:44:04.253185 | 2019-09-17T13:59:48 | 2019-09-17T13:59:48 | 200,874,879 | 0 | 0 | null | 2019-08-06T15:08:27 | 2019-08-06T15:08:26 | null | UTF-8 | Java | false | false | 4,082 | java | package eu.clarin.weblicht.bindings.cmd.ws;
import eu.clarin.weblicht.bindings.cmd.AbstractComponent;
import eu.clarin.weblicht.bindings.cmd.Descriptions;
import eu.clarin.weblicht.bindings.cmd.StringBinding;
import java.net.URI;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.*;
/**
*
* @author akislev
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"persons",
"roles",
"addresses",
"emails",
"departments",
"organisations",
"telephoneNumbers",
"faxNumbers",
"urls",
"descriptions"
})
public class Contact extends AbstractComponent {
@XmlElement(name = "Person")
private List<StringBinding> persons;
@XmlElement(name = "Role")
private List<StringBinding> roles;
@XmlElement(name = "Address")
private List<StringBinding> addresses;
@XmlElement(name = "Email")
private List<StringBinding> emails;
@XmlElement(name = "Department")
private List<StringBinding> departments;
@XmlElement(name = "Organisation")
private List<StringBinding> organisations;
@XmlElement(name = "TelephoneNumber")
private List<StringBinding> telephoneNumbers;
@XmlElement(name = "FaxNumber")
private List<StringBinding> faxNumbers;
@XmlElement(name = "Url")
@XmlSchemaType(name = "anyURI")
private List<URI> urls;
@XmlElement(name = "Descriptions")
private Descriptions descriptions;
Contact() {
}
public List<StringBinding> getPersons() {
return persons;
}
public List<StringBinding> getRoles() {
return roles;
}
public List<StringBinding> getAddresses() {
return addresses;
}
public List<StringBinding> getEmails() {
return emails;
}
public StringBinding getEmail() {
if (emails != null && !emails.isEmpty()) {
return emails.get(0);
} else {
return null;
}
}
public void setEmail(StringBinding email) {
emails = Collections.singletonList(email);
}
public List<StringBinding> getDepartments() {
return departments;
}
public List<StringBinding> getOrganisations() {
return organisations;
}
public StringBinding getOrganisation() {
if (organisations != null && !organisations.isEmpty()) {
return organisations.get(0);
} else {
return null;
}
}
public void setOrganisation(StringBinding organisation) {
organisations = Collections.singletonList(organisation);
}
public List<StringBinding> getTelephoneNumbers() {
return telephoneNumbers;
}
public List<StringBinding> getFaxNumbers() {
return faxNumbers;
}
public List<URI> getUrls() {
return urls;
}
public Descriptions getDescriptions() {
return descriptions;
}
@Override
public String toString() {
if (persons != null && persons.size() == 1) {
return persons.get(0).getValue();
} else if (emails != null && emails.size() == 1) {
return emails.get(0).getValue();
} else if (organisations != null && organisations.size() == 1) {
return organisations.get(0).getValue();
} else if (urls != null && urls.size() == 1) {
return urls.get(0).toString();
} else {
return null;
}
}
@Override
public Contact copy() {
Contact contact = (Contact) super.copy();
contact.persons = shallowCopy(persons);
contact.roles = shallowCopy(roles);
contact.addresses = shallowCopy(addresses);
contact.emails = shallowCopy(emails);
contact.departments = shallowCopy(departments);
contact.organisations = shallowCopy(organisations);
contact.telephoneNumbers = shallowCopy(telephoneNumbers);
contact.faxNumbers = shallowCopy(faxNumbers);
contact.urls = shallowCopy(urls);
contact.descriptions = copy(descriptions);
return contact;
}
}
| [
"[email protected]"
] | |
e296d22abbba16f40aa2e31a49f65a6e5123a034 | bdb2e5040841634471cd0e4c216ef66c32c23ff3 | /crawler_maven/src/main/java/Crawler.java | 3a1a0e33815ae4072a75ae84efe5e3d0bb8ff946 | [] | no_license | theorangeclockwork/basic-crawler | 5439efd3b0d1b88e8d9606e1bd99bf8ddea41c3c | 05db5571c4f23cfc319736cfd3f21c368020ab7e | refs/heads/master | 2020-04-23T12:29:50.164320 | 2019-03-22T14:38:46 | 2019-03-22T14:38:46 | 171,169,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,676 | java | import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
class Crawler {
private Document doc = null;
private int count = 1;
private HashMap<Integer, String> indexList = new HashMap<Integer, String>();
void crawlByURL(String URL) throws IOException {
try {
doc = Jsoup.connect(URL).get();
} catch (Exception e) {
e.printStackTrace();
}
assert doc != null;
Elements links = doc.select("a[href]");
scrapAndStore(doc);
indexList.put(count, URL);
count++;
for (Element link : links) {
if (!link.attr("abs:href").contains(".jpg") && !link.attr("abs:href").contains("#") && count <= 100 && !indexList.containsValue(link.attr("abs:href"))) {
try {
scrapAndStore(Jsoup.connect(link.attr("abs:href")).get());
indexList.put(count, link.attr("abs:href"));
count++;
} catch (Exception e) {
e.printStackTrace();
}
}
}
for (Element link : links) {
if (!link.attr("abs:href").contains(".jpg") && !link.attr("abs:href").contains("#") && count <= 100) {
try {
crawlByURL(link.attr("abs:href"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
private void scrapAndStore(Document doc) throws IOException {
File oFile = new File("C:\\java projects\\crawler\\crawler_maven\\src\\main\\resources\\crawler_out", count + ".txt");
boolean success = oFile.createNewFile();
System.out.println(success);
FileWriter writer = new FileWriter(oFile);
writer.write(doc.body().text());
writer.flush();
writer.close();
}
void createResult() throws IOException {
File oFile = new File("C:\\java projects\\crawler\\crawler_maven\\src\\main\\resources\\crawler_out", "index.txt");
boolean success = oFile.createNewFile();
System.out.println(success);
FileWriter writer = new FileWriter(oFile);
for (Map.Entry<Integer, String> entry : indexList.entrySet()) {
writer.append(String.valueOf(entry.getKey())).append(" ").append(entry.getValue());
writer.write(System.getProperty("line.separator"));
writer.flush();
}
writer.close();
}
}
| [
"[email protected]"
] | |
7a75e8a9e7a27068d7ca460e720d03442781b7de | 332560b666f4d2f49089ecef9f68c6ed4f5b6b28 | /src/test/java/org/emamotor/hfdp/state/gumball/GumballMachineTest.java | 8e306e8fc09fbcb5149c52375f2cd118ea2aab6a | [] | no_license | emag-notes/hf-dp | 9e08801f15aa617ee307041ac38dcdb2276ab464 | 28d18f7f7801b1e93a218fe81a854e5bb76e9bde | refs/heads/master | 2020-04-10T22:24:06.320151 | 2013-12-26T12:59:17 | 2013-12-26T12:59:17 | 8,603,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package org.emamotor.hfdp.state.gumball;
import org.junit.Test;
/**
* @author Yoshimasa Tanabe
*/
public class GumballMachineTest {
@Test
public void testAllMethod() throws Exception {
// Setup
GumballMachine sut = new GumballMachine(5);
// Exercise
// Verify
System.out.println(sut);
sut.insertQuarter();
sut.turnCrank();
System.out.println(sut);
sut.insertQuarter();
sut.ejectQuarter();
sut.turnCrank();
System.out.println(sut);
sut.insertQuarter();
sut.turnCrank();
sut.insertQuarter();
sut.turnCrank();
sut.ejectQuarter();
System.out.println(sut);
sut.insertQuarter();
sut.insertQuarter();
sut.turnCrank();
sut.insertQuarter();
sut.turnCrank();
sut.insertQuarter();
sut.turnCrank();
System.out.println(sut);
}
}
| [
"[email protected]"
] | |
638f1addef0de872b38b285aa0d81d0c1a930420 | 18c70f2a4f73a9db9975280a545066c9e4d9898e | /mirror-cmdb/cmdb-agent/src/main/java/com/aspire/cmdb/agent/client/LldpInfoServiceClient.java | e9ae10eebb2e6d6a1c24899c77a8017ac61b8092 | [] | no_license | iu28igvc9o0/cmdb_aspire | 1fe5d8607fdacc436b8a733f0ea44446f431dfa8 | 793eb6344c4468fe4c61c230df51fc44f7d8357b | refs/heads/master | 2023-08-11T03:54:45.820508 | 2021-09-18T01:47:25 | 2021-09-18T01:47:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 709 | java | package com.aspire.cmdb.agent.client;
import com.aspire.mirror.elasticsearch.api.dto.LldpInfo;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient("ELASTICSEARCH-SERVICE")
@Component
public interface LldpInfoServiceClient {
@GetMapping("/v1/lldp/querylldpInfoByidcAndIp")
List<LldpInfo> querylldpInfoByidcAndIp(@RequestParam(value = "idcType", required = false) String idcType,
@RequestParam(value = "ips", required = false) String ips);
}
| [
"[email protected]"
] | |
8389d75343effa9dad1de56eff1d399ecbb90e88 | 2c6b19fa7c8d601db008a3b370d8762a469181c4 | /call-customer/call-customer-core/src/main/java/com/xiaoniu/call/customer/core/business/AccountManageBusinessImpl.java | 5b408c414320d2d0333cde52d2a8263b2780c7c1 | [] | no_license | nearable1/cosmos | 60e43a8b3522807bca466c66142fb3f33043e0bb | cfa9404d3b1360ccfa4d1f9a55ea0cdcd7a86be9 | refs/heads/master | 2022-07-12T10:07:55.970301 | 2019-10-25T09:39:02 | 2019-10-25T09:39:02 | 115,409,813 | 1 | 1 | null | 2022-06-29T17:43:24 | 2017-12-26T09:54:41 | Java | UTF-8 | Java | false | false | 2,498 | java | package com.xiaoniu.call.customer.core.business;
import com.xiaoniu.architecture.page.api.bean.PageResult;
import com.xiaoniu.call.customer.api.business.AccountManageBusiness;
import com.xiaoniu.call.customer.api.dto.AccountManageDTO;
import com.xiaoniu.call.customer.api.dto.ManagerDTO;
import com.xiaoniu.call.customer.api.dto.UserLoginDTO;
import com.xiaoniu.call.customer.api.vo.AccountManagerVO;
import com.xiaoniu.call.customer.api.vo.ManagerVO;
import com.xiaoniu.call.customer.core.service.AccountManageService;
import com.xiaoniu.call.customer.core.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
@Controller
@ResponseBody
public class AccountManageBusinessImpl implements AccountManageBusiness {
@Autowired
AccountManageService accountManageService;
@Autowired
ManagerService managerService;
@Override
@PostMapping(value = "/accountManagelist")
public PageResult<AccountManageDTO> accountManagelist(@RequestBody AccountManagerVO accountManagerVO) {
return accountManageService.accountManageList(accountManagerVO);
}
@Override
@PostMapping(value = "/customerLoginLoglist")
public PageResult<UserLoginDTO> customerLoginLoglist(@RequestBody AccountManagerVO accountManagerVO) {
return accountManageService.userLoginLoglist(accountManagerVO);
}
@Override
@PostMapping(value = "/managerList")
public PageResult<ManagerDTO> managerList(@RequestBody ManagerVO managerVO) {
return accountManageService.managerList(managerVO);
}
/**
* 管理员新增
*
* @param uid
* @return
*/
@PutMapping(value = "/saveManager")
@Override
public void saveManager(@RequestParam("uid") Long uid) {
managerService.saveManager(uid);
}
/**
* 管理员启停用
*
* @param id
* @return
*/
@PutMapping(value = "/enableManager")
@Override
public void enableManager(@RequestParam("id") Long id, @RequestParam("status") Boolean status) {
managerService.enableManager(id, status);
}
/**
* 管理员删除
*
* @param id
* @return
*/
@DeleteMapping(value = "/deleteManager")
@Override
public void deleteManager(@RequestParam("id") Long id) {
managerService.deleteManager(id);
}
}
| [
"[email protected]"
] | |
d8845e7f557efe481e0aab0d47dc06fee1219f8d | 8a8227bf09da277a123d0e808a6b31c2a4c9bf7a | /app/src/main/java/com/liteafrica/izigourmet/Requests/listOrdersRv.java | 494746ab19ab88499ce1f40f5c364e97b13f0f2b | [] | no_license | Bbox12/IziGourmet | 051d267ad5d5900eff5470d672af08d20075d97e | f93bcd4cb87c4c115f446a4f74de046fae99e595 | refs/heads/main | 2023-06-18T18:07:51.486621 | 2021-07-16T09:33:39 | 2021-07-16T09:33:39 | 379,111,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,167 | java | package com.liteafrica.izigourmet.Requests;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.Button;
import android.widget.TextView;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkError;
import com.android.volley.NoConnectionError;
import com.android.volley.ParseError;
import com.android.volley.Response;
import com.android.volley.ServerError;
import com.android.volley.TimeoutError;
import com.android.volley.VolleyError;
import com.android.volley.VolleyLog;
import com.android.volley.toolbox.StringRequest;
import com.google.android.material.snackbar.Snackbar;
import com.liteafrica.izigourmet.Adapters.BookingAdapter;
import com.liteafrica.izigourmet.AppController;
import com.liteafrica.izigourmet.Model.Foods;
import com.liteafrica.izigourmet.Model.User;
import com.liteafrica.izigourmet.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class listOrdersRv extends BaseExpandableListAdapter {
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm aa", Locale.US);
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
private Context _context;
private List<String> _listDataHeader; // header titles
private HashMap<String, ArrayList<User>> _listDataChild;
private TextView laterDate, laterTime;
private RecyclerView morerv;
private Button details;
private com.liteafrica.izigourmet.PrefManager pref;
private CoordinatorLayout coordinatorLayout;
public listOrdersRv(Context context, List<String> listDataHeader,
HashMap<String, ArrayList<User>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
@Override
public Object getChild(int groupPosition, int childPosititon) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.get(childPosititon);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final User album_pos = (User) getChild(groupPosition, childPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.later_rv, null);
}
laterDate = convertView.findViewById(R.id.ride_date_later);
laterTime = convertView.findViewById(R.id.ride_time_later);
morerv = convertView.findViewById(R.id.moreRv);
details = convertView.findViewById(R.id.details);
DecimalFormat dft = new DecimalFormat("0.00");
Calendar cal = Calendar.getInstance();
TextView _status = convertView.findViewById(R.id.status);
if (album_pos.getDelivered(childPosition) == 0) {
_status.setText("Pending");
}
if (album_pos.getDelivered(childPosition) == 1) {
_status.setText("Accepted");
}
if (album_pos.getDelivered(childPosition) == 2) {
_status.setText("Confirmed");
}
if (album_pos.getDelivered(childPosition) == 3) {
_status.setText("ETA updated");
}
if (album_pos.getDelivered(childPosition) == 4) {
_status.setText("Dispatched");
}
if (album_pos.getDelivered(childPosition) == 5) {
_status.setText("Delivered");
}
if (album_pos.getDelivered(childPosition) == 6) {
_status.setText("Canceled");
}
TextView pending = convertView.findViewById(R.id.pending);
if (album_pos.getPaymentMode(childPosition) == 1) {
if (album_pos.getIs_Paid(childPosition) == 1) {
pending.setText(" COD, PAID");
}
} else if (album_pos.getPaymentMode(childPosition) == 2) {
if (album_pos.getPaymentVerified(childPosition) == 0) {
pending.setText("EFT PAYMENT PENDING");
} else {
pending.setText("EFT PAYMENT DONE");
}
}
if (album_pos.getPaymentMode(childPosition) == 0) {
pending.setText("PAYMENT NOT SELECTED");
}
if (!TextUtils.isEmpty(album_pos.getEnd_date(childPosition)) && !album_pos.getEnd_date(childPosition).contains("null")) {
String date_ = parseDateToddMMyyyy(album_pos.getEnd_date(childPosition));
laterDate.setText(date_);
} else {
laterDate.setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(album_pos.getEnd_time(childPosition))) {
try {
Date date = format.parse(album_pos.getEnd_time(childPosition));
cal.setTime(date);
laterTime.setText("At " + sdf.format(cal.getTime()));
} catch (ParseException e) {
e.printStackTrace();
}
} else {
laterTime.setVisibility(View.GONE);
}
go(_context, album_pos.getOrderID(childPosition), morerv);
details.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent o = new Intent(_context, OrderDashboard.class);
o.putExtra("unique", album_pos.getOrderID(childPosition));
_context.startActivity(o);
((Activity) _context).overridePendingTransition(R.anim.slide_up1, R.anim.rbounce);
}
});
return convertView;
}
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.size();
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String headerTitle = (String) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_group, null);
}
TextView lblListHeader = convertView
.findViewById(R.id.lblListHeader);
lblListHeader.setTypeface(null, Typeface.BOLD);
lblListHeader.setText(headerTitle);
return convertView;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
public String parseDateToddMMyyyy(String time) {
String inputPattern = "yyyy-MM-dd";
String outputPattern = "dd MMM yy";
SimpleDateFormat inputFormat = new SimpleDateFormat(inputPattern);
SimpleDateFormat outputFormat = new SimpleDateFormat(outputPattern);
Date date = null;
String str = null;
try {
date = inputFormat.parse(time);
str = outputFormat.format(date);
} catch (ParseException e) {
e.printStackTrace();
}
return str;
}
public void setPref(com.liteafrica.izigourmet.PrefManager pref1) {
pref = pref1;
}
public void setCoordinatorlayout(CoordinatorLayout coordinatorLayout1) {
coordinatorLayout = coordinatorLayout1;
}
private void go(final Context mContext, final String itemmenu, final RecyclerView hadapter1) {
final ArrayList<Foods> mItems = new ArrayList<Foods>();
StringRequest eventoReq = new StringRequest(com.android.volley.Request.Method.POST, com.liteafrica.izigourmet.Config_URL.GET_FOODSS,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("submenu", response);
try {
JSONObject jsonObj = new JSONObject(response);
JSONArray Eat = jsonObj.getJSONArray("bookings");
if (Eat.length() != 0) {
for (int i = 0; i < Eat.length(); i++) {
JSONObject c = Eat.getJSONObject(i);
if (!c.isNull("Price")) {
Foods items = new Foods();
items.setID(c.getInt("ID"));
items.setNoofItems(c.getInt("NoofItems"));
items.seteTEZ_Price((c.getInt("NoofItems") * c.getDouble("Price")) - (c.getInt("NoofItems") * c.getDouble("Discount")));
items.setDiscount(c.getDouble("Discount"));
items.setMenu_Name(c.getString("Name"));
mItems.add(items);
}
}
}
} catch (final JSONException e) {
Log.e("HI", "Json parsing error: " + e.getMessage());
}
BookingAdapter sAdapter1 = new BookingAdapter(mContext, mItems);
sAdapter1.notifyDataSetChanged();
sAdapter1.setPref(pref);
sAdapter1.setFrom(1);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false);
hadapter1.setLayoutManager(mLayoutManager);
hadapter1.setItemAnimator(new DefaultItemAnimator());
hadapter1.setAdapter(sAdapter1);
hadapter1.setHasFixedSize(true);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d("uuu", "Error: " + error.getMessage());
if (error instanceof TimeoutError || error instanceof NoConnectionError) {
Snackbar snackbar = Snackbar
.make(coordinatorLayout, "Network is unreachable. Please try another time", Snackbar.LENGTH_INDEFINITE)
.setAction("Refresh", new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
snackbar.setActionTextColor(Color.RED);
snackbar.setTextColor(Color.WHITE);
snackbar.show();
} else if (error instanceof AuthFailureError) {
Snackbar snackbar = Snackbar
.make(coordinatorLayout, "Network is unreachable. Please try another time", Snackbar.LENGTH_INDEFINITE)
.setAction("Refresh", new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
snackbar.setActionTextColor(Color.RED);
snackbar.setTextColor(Color.WHITE);
snackbar.show();
} else if (error instanceof ServerError) {
Snackbar snackbar = Snackbar
.make(coordinatorLayout, "Server Error.Please try another time", Snackbar.LENGTH_INDEFINITE)
.setAction("Refresh", new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
snackbar.setActionTextColor(Color.RED);
snackbar.setTextColor(Color.WHITE);
snackbar.show();
} else if (error instanceof NetworkError) {
Snackbar snackbar = Snackbar
.make(coordinatorLayout, "Network Error. Please try another time", Snackbar.LENGTH_INDEFINITE)
.setAction("Refresh", new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
snackbar.setActionTextColor(Color.RED);
snackbar.setTextColor(Color.WHITE);
snackbar.show();
} else if (error instanceof ParseError) {
Snackbar snackbar = Snackbar
.make(coordinatorLayout, "Data Error. Please try another time", Snackbar.LENGTH_INDEFINITE)
.setAction("Refresh", new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
snackbar.setActionTextColor(Color.RED);
snackbar.setTextColor(Color.WHITE);
snackbar.show();
}
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("submenu", itemmenu);
return params;
}
};
AppController.getInstance().addToRequestQueue(eventoReq);
}
}
| [
"[email protected]"
] | |
145307017c3078693706cf682500c3f5fac7a4f2 | 13dae3f6bc55ba035c1c61d929679d9454cfadc3 | /TutoHelp/src/main/java/pe/edu/upc/dao/ICursoDao.java | cf9ef0080f793e1bb7a0d9ebc0a395e071ae498f | [] | no_license | Samber1234/PrograWeb_Grupo3 | ccef8893fc4b25e9a4b3fee77c7b84c57f9ebe6a | e4a71e23562cec378cb452e28872d88aeff21e45 | refs/heads/main | 2023-08-10T20:22:58.540859 | 2021-09-17T04:48:14 | 2021-09-17T04:48:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package pe.edu.upc.dao;
import java.util.List;
import pe.edu.upc.entities.Curso;
public interface ICursoDao {
public void insert(Curso c);
public List<Curso> list();
}
| [
"[email protected]"
] | |
6223b48241621d25e25c0e1b7869d37499bb5829 | 57ecf65f0c84ebcc77d37094e0cc4bf60f30d286 | /trading-strategies/open-interest-api/src/main/java/com/stocks/oi/service/DailyOpenInterestSpurtsService.java | 01f6eadead63154a5bb4a07addd1a5d3d93d2330 | [] | no_license | brijeshbhomkar/stock-apps | a559334eefb9525ab486af6a5c8b1b192875184b | 80adbf807463549d0f9c8b01e185736a349c0831 | refs/heads/master | 2022-12-23T07:30:37.786332 | 2022-10-30T10:39:09 | 2022-10-30T10:39:09 | 161,975,402 | 0 | 1 | null | 2022-12-10T03:30:41 | 2018-12-16T06:46:31 | Java | UTF-8 | Java | false | false | 5,167 | java | package com.stocks.oi.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.stocks.oi.response.oi.spurts.DailyHighestOpenInterestResponse;
import com.stocks.oi.response.oi.spurts.DailyOpenInterestResponse;
import com.stocks.oi.util.Endpoints;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
@Log4j2
@Service
public class DailyOpenInterestSpurtsService {
private HttpClient client = HttpClient.newHttpClient();
@SneakyThrows
public DailyHighestOpenInterestResponse getOpenInterestSpurtsStocks() {
log.info("Find highest open interest " + Endpoints.TOP_POSITIVE_OI_CHANGE_DATA);
DailyHighestOpenInterestResponse response = null;
HttpRequest httpRequest = HttpRequest.newBuilder().uri(URI.create(Endpoints.TOP_POSITIVE_OI_CHANGE_DATA))
.header("Accept", "application/json").build();
final HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
final String data = httpResponse.body();
if (data != null && !data.isEmpty()) {
try {
response = new ObjectMapper().readValue(data, DailyHighestOpenInterestResponse.class);
} catch (IOException e) {
e.printStackTrace();
}
}
return response;
}
@SneakyThrows
public DailyOpenInterestResponse slideInPriceSlideInOpenInterestStocks() {
log.info("Find stocks with slide in price slide in open interest (Bearish stocks) " + Endpoints.SLIDE_IN_PRICE_SLIDE_IN_OI);
DailyOpenInterestResponse response = null;
HttpRequest httpRequest = HttpRequest.newBuilder().uri(URI.create(Endpoints.SLIDE_IN_PRICE_SLIDE_IN_OI))
.header("Accept", "application/json").build();
final HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
final String data = httpResponse.body();
if (data != null && !data.isEmpty()) {
try {
response = new ObjectMapper().readValue(data, DailyOpenInterestResponse.class);
} catch (IOException e) {
e.printStackTrace();
}
}
return response;
}
@SneakyThrows
public DailyOpenInterestResponse riseInPriceSlideInOpenInterestStocks() {
log.info("Find stocks with rise in price slide in open interest (Bearish stocks) " + Endpoints.RISE_IN_PRICE_SLIDE_IN_OI);
DailyOpenInterestResponse response = null;
HttpRequest httpRequest = HttpRequest.newBuilder().uri(URI.create(Endpoints.RISE_IN_PRICE_SLIDE_IN_OI))
.header("Accept", "application/json").build();
final HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
final String data = httpResponse.body();
if (data != null && !data.isEmpty()) {
try {
response = new ObjectMapper().readValue(data, DailyOpenInterestResponse.class);
} catch (IOException e) {
e.printStackTrace();
}
}
return response;
}
@SneakyThrows
public DailyOpenInterestResponse riseInPriceRiseInOpenInterestStocks() {
log.info("Find stocks with rise in price slide in open interest (Bearish stocks) " + Endpoints.RISE_IN_PRICE_RISE_IN_OI);
DailyOpenInterestResponse response = null;
HttpRequest httpRequest = HttpRequest.newBuilder().uri(URI.create(Endpoints.RISE_IN_PRICE_RISE_IN_OI))
.header("Accept", "application/json").build();
final HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
final String data = httpResponse.body();
if (data != null && !data.isEmpty()) {
try {
response = new ObjectMapper().readValue(data, DailyOpenInterestResponse.class);
} catch (IOException e) {
e.printStackTrace();
}
}
return response;
}
@SneakyThrows
public DailyOpenInterestResponse slideInPriceRiseInOpenInterestStocks() {
log.info("Find stocks with rise in price slide in open interest (Bearish stocks) " + Endpoints.SLIDE_IN_PRICE_RISE_IN_OI);
DailyOpenInterestResponse response = null;
HttpRequest httpRequest = HttpRequest.newBuilder().uri(URI.create(Endpoints.SLIDE_IN_PRICE_RISE_IN_OI))
.header("Accept", "application/json").build();
final HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
final String data = httpResponse.body();
if (data != null && !data.isEmpty()) {
try {
response = new ObjectMapper().readValue(data, DailyOpenInterestResponse.class);
} catch (IOException e) {
e.printStackTrace();
}
}
return response;
}
}
| [
"[email protected]"
] | |
7715cf219f196168901b0123bc90cf2dc623d0cb | 12130c5b11ebd954cecb8385059aa4693a085934 | /app/src/main/java/org/imfine/fas2/Main2Activity.java | 004035837885246435c4397b37ef601098ced25e | [] | no_license | jyshinv/FAS-FallAlertApp | dc9bd1187d900522baa0bc30e415c7a5a4d7ef55 | d64c6aad92cd2f79d5e09ec4ec72e15ce358bc1a | refs/heads/master | 2023-05-31T20:21:23.897404 | 2021-07-04T10:09:32 | 2021-07-04T10:09:32 | 382,819,972 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,055 | java | package org.imfine.fas2;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import org.imfine.fas2.Post.FirebaseFASPost;
import org.imfine.fas2.Post.FirebaseRaspPost;
import org.json.JSONArray;
import org.json.JSONObject;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import static java.lang.Math.max;
public class Main2Activity extends AppCompatActivity implements SensorEventListener {
//list 확인 버튼
Button btn;
Intent intent;
//파이어베이스 db연동을 위한 코드
private DatabaseReference mPostReference;
String NAME = "";
String VALUE = "";
String TIME = "";
//파이어베이스 db연동 라즈베리파이
String FALLCHECK = "false";
//현재 날짜와 시간을 위한 변수
long now;
private DecimalFormat df = new DecimalFormat("#.###");
//기존 알고리즘 변수
private String boundary_key;
private String phoneNumber_key;
private String notificationMethod_key;
private TextView last_x_textView;
private TextView last_y_textView;
private TextView last_z_textView;
private TextView x_textView;
private TextView y_textView;
private TextView z_textView;
private TextView current_change_amount_textView;
private TextView current_boundary_textView;
private TextView gyro1;
private TextView gyro2;
private TextView gyro3;
private TextView acc_svm;
private TextView av_svm;
private TextView timeUI;
private TextView maxACC;
private TextView maxAV;
private Sensor sensor;
private Sensor Gsensor;
private SensorManager sensorManager;
private SharedPreferences sharedPreferences;
private double[] last_gravity = new double[3];
private double[] gravity = new double[3];
private double[] ggravity = new double[3];
private boolean firstChange = true;
public int warningBoundary = 700;
private double changeAmount = 0;
//fas알고리즘을 위한 변수
double var_acc_svm;
double result_acc;
double var_av_svm;
double result_av;
boolean check = true;
int i;
//logcat avsvm, accsvm 나타내기 위한 변수
double accsvm_max = 0;
double avsvm_max = 0;
//fcm을 위한 변수
static RequestQueue requestQueue;
static String regId="eDT6FiOyaMQ:APA91bG0GgDtAfovt4sy210IZT-y0Xt1RTeHZ6cWDW4vVLFiF0B_j6_KJeugFeCqj8ubt9aeda_KHKXzC84b_8qswuwnyPY2vxiIwnEw43mc5kRkuwR5m0dzcjimYrLR0ZnqWsEUstWe";
TextView tv;
//군우아버지 폰 : eNhYhgLMHKs:APA91bH7uUnQ2NJ87DZLW-B4wMcAvKhYlgWIGDWxaFF6n4FZsl2QKSAVVlD6bt-SPH91oWs7D5iqGPFqSM8fE2pYJa0_4Q0kk53d6oTgKFxvLM_9vW7nYkzcXnsHsbFvFlDbBiizn2AN"
//myphone : cEYRkBd6PSc:APA91bGap-XU9q8EYy3rjQblGHdZ9G5jkL3O1VOgpQd-WaBbC9rvwyiFag3ZYL_YbgT5Ca7tDlZZ7lDw8fjkTX4H9HDsNql_6eKSdEqgg4YyV8W6Y-pWlHim6dwdpWR7rtpFSMB2i-Oa
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
btn = findViewById(R.id.sensor_list_btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
intent = new Intent(getApplication(), FallAlertActivity.class);
startActivity(intent);
}
});
if(requestQueue == null){
requestQueue = Volley.newRequestQueue(getApplicationContext());
}
tv = findViewById(R.id.main2_fcm_tv);
//파이어베이스
mPostReference = FirebaseDatabase.getInstance().getReference();
//기존 알고리즘
boundary_key = getString(R.string.key_boundary);
phoneNumber_key = getString(R.string.key_phone_number);
notificationMethod_key = getString(R.string.key_notification_method);
initialUI();
initialSensor();
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
warningBoundary = Integer.parseInt(sharedPreferences.getString(boundary_key, "20"));
} // end of onCreate
public void initialUI() {
last_x_textView = (TextView)findViewById(R.id.last_x_value);
last_y_textView = (TextView)findViewById(R.id.last_y_value);
last_z_textView = (TextView)findViewById(R.id.last_z_value);
x_textView = (TextView)findViewById(R.id.x_value);
y_textView = (TextView)findViewById(R.id.y_value);
z_textView = (TextView)findViewById(R.id.z_value);
current_change_amount_textView = (TextView)findViewById(R.id.current_change_amount);
current_boundary_textView = (TextView)findViewById(R.id.current_boundary);
gyro1 = findViewById(R.id.gyro1);
gyro2 = findViewById(R.id.gyro2);
gyro3 = findViewById(R.id.gyro3);
acc_svm = findViewById(R.id.acc_svm);
av_svm = findViewById(R.id.av_svm);
timeUI = findViewById(R.id.time);
maxACC = findViewById(R.id.maxACC);
maxAV = findViewById(R.id.maxAV);
}
public void initialSensor() {
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
sensor = sensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
Gsensor = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
sensorManager.registerListener(this,sensor, sensorManager.SENSOR_DELAY_NORMAL);
sensorManager.registerListener(this,Gsensor,sensorManager.SENSOR_DELAY_NORMAL);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
@Override
public void onSensorChanged(SensorEvent event) {
Sensor sensor = event.sensor;
if(sensor.getType() == Sensor.TYPE_LINEAR_ACCELERATION){
//기존 알고리즘
last_gravity[0] = gravity[0];
last_gravity[1] = gravity[1];
last_gravity[2] = gravity[2];
gravity[0] = Double.parseDouble(String.format("%.2f",event.values[0]));
gravity[1] = Double.parseDouble(String.format("%.2f",event.values[1]));
gravity[2] = Double.parseDouble(String.format("%.2f",event.values[2]));
changeAmount = Math.pow((gravity[0]-last_gravity[0]), 2) +
Math.pow((gravity[1]-last_gravity[1]), 2) +
Math.pow((gravity[2]-last_gravity[2]), 2);
//fas 알고리즘
var_acc_svm =
(Math.pow(gravity[0], 2)) + (Math.pow(gravity[1], 2)) + (Math.pow(gravity[2], 2));
result_acc = Math.sqrt(var_acc_svm);
result_acc = Double.parseDouble(String.format("%.2f",result_acc));
acc_svm.setText("acc_svm : " +result_acc );
//max값 띄우기
accsvm_max = max(accsvm_max, result_acc);
maxACC.setText("maxACC : " + accsvm_max);
}
if(sensor.getType() == Sensor.TYPE_GYROSCOPE){
ggravity[0] = Double.parseDouble(String.format("%.2f",event.values[0]));
ggravity[1] = Double.parseDouble(String.format("%.2f",event.values[1]));
//ggravity[2] = Double.parseDouble(String.format("%.2f",event.values[2]));
var_av_svm = (Math.pow(ggravity[0], 2)) + (Math.pow(ggravity[1], 2));
result_av = (Math.sqrt(var_av_svm));
result_av = Double.parseDouble(String.format("%.2f",result_av));
av_svm.setText("av_svm : " +result_av);
//logcat
avsvm_max= max(avsvm_max, result_av);
maxAV.setText("maxAV : " + avsvm_max);
}
//실시간 값 변동 보여주는 함수
updateSensorView();
//fas 알고리즘 계산 함수
fall_detect();//값이 바뀔때마다 계속 불러냄
//warningBoundary 설정은 여기서!!
//warningBoundary = Integer.parseInt(sharedPreferences.getString(boundary_key, "2000"));
//낙상이 감지 되었을 경우 코드
//if (!firstChange && changeAmount >= warningBoundary) {
// Toast.makeText(this, "낙상이 감지되었습니다.", Toast.LENGTH_SHORT).show();
// now = System.currentTimeMillis();
// Date date = new Date(now);
// SimpleDateFormat sdfnow = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// TIME = sdfnow.format(date);
// NAME = "김옥례 할머니";
// VALUE = "낙상 감지됨!!!";
// FBRegister();
//}
//firstChange = false;
}
class Time extends Thread{
public void run(){
i=0;
while(true){
Date dt = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss") ;
String disp = sdf.format(dt);
i++;
System.out.println( i + "회 현재시간" + disp);
try{ Thread.sleep(1000);} catch(Exception ex){}
}//while end
}//run() end
}//class END
public void fall_detect() {
if( result_av > 10 )
{
Time t = new Time();
t.start();
Timestamp time_st = new Timestamp(System.currentTimeMillis());
timeUI.setText("시간 : " + time_st.toString());
long start = System.currentTimeMillis();//시작시간
if( result_acc > 10 )
{
long end = System.currentTimeMillis();//끝난시간.
if(end-start <= 50000) { //50초이내 되야함.
//Toast.makeText(this, "낙상이다 새꺄", Toast.LENGTH_SHORT).show();
//Toast.makeText(this, "낙상이 감지되었습니다.", Toast.LENGTH_SHORT).show();
now = System.currentTimeMillis();
Date date = new Date(now);
SimpleDateFormat sdfnow = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
TIME = "낙상 시간 : "+sdfnow.format(date);
NAME = "낙상인 : 김옥례 할머니";
VALUE = "낙상 의심";
FALLCHECK = "true";
//fcm을 위한 send함수
send(VALUE);
//라즈베리파이에 true값 보내는 함수
FBtoRasp();
//파이어베이스에 낙상 시 낙상정보 올리는 함수
FBRegister();
}
}
}
} // end of fall detect()
//fcm 구현 코드
public void send(String input){
JSONObject requestData = new JSONObject();
try{
requestData.put("priority","high");
JSONObject dataObj = new JSONObject();
dataObj.put("contents",input);
requestData.put("data",dataObj);
JSONArray idArray = new JSONArray();
idArray.put(0,regId);
requestData.put("registration_ids",idArray);
}catch (Exception e){
e.printStackTrace();
}
sendData(requestData, new FCMSendTestActivity.SendResponseListener() {
@Override
public void onRequestStarted() {
println("onRequestStarted() 호출됨");
}
@Override
public void onRequesCompleted() {
println("onRequestCompleted() 호출됨");
}
@Override
public void onRequestWithError(VolleyError error) {
println("onRequestWithError() 호출됨");
}
});
}//end of send()
public void println(String data){
tv.append(data + "\n");
}
public interface SendResponseListener{
public void onRequestStarted();
public void onRequesCompleted();
public void onRequestWithError(VolleyError error);
}
public void sendData(JSONObject requestData, final FCMSendTestActivity.SendResponseListener listener){
JsonObjectRequest request = new JsonObjectRequest(
Request.Method.POST, "https://fcm.googleapis.com/fcm/send",
requestData,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
listener.onRequesCompleted();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
listener.onRequestWithError(error);
}
}
) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
//return super.getParams();
Map<String, String> params = new HashMap<String,String>();
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
//return super.getHeaders();
Map<String, String> headers = new HashMap<String, String>();
headers.put("Authorization",
"key=AAAAzsqzkm0:APA91bGVcTX8EbKAYC0fxicmK0Jjv1lB9xeDBpEh6N0y3TYCDk5SqrtjBIjcvBT2Ji8_vNS3SfIInh1SU-WaW8YqOQdATMgOoBnRQ5aNH73nOZdPWGFlthEfZYLD6Eb_YiMPdYm-S0SY");
return headers;
}
@Override
public String getBodyContentType() {
//return super.getBodyContentType();
return "application/json";
}
};
request.setShouldCache(false);
listener.onRequestStarted();
requestQueue.add(request);
}//end of sendData
//리스너 등록
@Override
protected void onResume() {
sensorManager.registerListener(this, sensor, sensorManager.SENSOR_DELAY_NORMAL);
sensorManager.registerListener(this, Gsensor,sensorManager.SENSOR_DELAY_NORMAL);
super.onResume();
}
//리스너 해제
@Override
protected void onPause() {
sensorManager.unregisterListener(this);
super.onPause();
}
//센서값을 보여주기 위한 함수
private void updateSensorView() {
last_x_textView.setText("Last X = "+last_gravity[0]);
last_y_textView.setText("Last Y = "+last_gravity[1]);
last_z_textView.setText("Last Z = "+last_gravity[2]);
x_textView.setText("X = "+gravity[0]);
y_textView.setText("Y = "+gravity[1]);
z_textView.setText("Z = "+gravity[2]);
current_change_amount_textView.setText("Current change amount = "+df.format(changeAmount));
current_boundary_textView.setText("Current boundary = "+ warningBoundary);
gyro1.setText("gyro x : " + ggravity[0]);
gyro2.setText("gyro y : " + ggravity[1]);
gyro3.setText("gyro z : " + ggravity[2]);
}
//낙상 정보 db에 기록하기
public void FBRegister(){
Map<String, Object> childUpdates = new HashMap<>();
Map<String, Object> postValues = null;
FirebaseFASPost post = new FirebaseFASPost(TIME,NAME,VALUE);
postValues = post.toMap();
childUpdates.put("/alarm_list/"+ TIME, postValues);
mPostReference.updateChildren(childUpdates);
Toast.makeText(this,"update completed",Toast.LENGTH_SHORT).show();
}
//라즈베리파이 카메라에 보낼 값 설정
public void FBtoRasp(){
Map<String,Object> childUpdates = new HashMap<>();
Map<String, Object> postValues = null;
FirebaseRaspPost post = new FirebaseRaspPost(FALLCHECK);
postValues = post.toMap();
childUpdates.put("/FallCheckToRasp/", postValues);
mPostReference.updateChildren(childUpdates);
}
} // end of activity
| [
"[email protected]"
] | |
d4361762ca2c2e92a447ca12e08e7c23710d3949 | e21cbbdfa2beb73c70f19f48049bf7a63c88aafa | /SSI/src/br/com/nextel/ssi/model/to/MenuProfile.java | 3f7baef802ac5843f7848dcd995c4ab807b00760 | [] | no_license | mauriciozanettisalomao/SSI | b70885e54f27f063f37c604baf49bc475fea386f | 15b727d6ba5f387ee77fc6d225679b7f5f70c1cc | refs/heads/master | 2021-01-20T09:55:07.514858 | 2017-05-14T21:38:47 | 2017-05-14T21:38:47 | 90,301,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | package br.com.nextel.ssi.model.to;
public class MenuProfile {
private String descriptionGroup;
private String profileFunctionality;
private int sequence;
public String getDescriptionGroup() {
return descriptionGroup;
}
public void setDescriptionGroup(String descriptionGroup) {
this.descriptionGroup = descriptionGroup;
}
public String getProfileFunctionality() {
return profileFunctionality;
}
public void setProfileFunctionality(String profileFunctionality) {
this.profileFunctionality = profileFunctionality;
}
public int getSequence() {
return sequence;
}
public void setSequence(int sequence) {
this.sequence = sequence;
}
@Override
public String toString() {
return "MenuProfile [descriptionGroup=" + descriptionGroup
+ ", profileFunctionality=" + profileFunctionality
+ ", sequence=" + sequence + "]";
}
}
| [
"[email protected]"
] | |
6bd21784e8c6f7d9b9e702a3cd6a6019699186d1 | cde22ead6409a28a7858aef68dc536d21ae1eaaa | /core/src/test/java/io/undertow/server/handlers/proxy/AbstractLoadBalancingProxyTestCase.java | afcd21c5c0cabc68a15058d7064f0dac8a40074d | [
"Apache-2.0"
] | permissive | tmescic/undertow | 9f5e6910b81d218b232f8df2cabe8367c4765933 | a7f9ba00e892904b7af0e532ab62944d0bafa847 | refs/heads/master | 2021-01-18T05:51:10.951982 | 2014-07-02T15:31:40 | 2014-07-02T15:31:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,956 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2014 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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.undertow.server.handlers.proxy;
import io.undertow.Undertow;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.session.Session;
import io.undertow.server.session.SessionCookieConfig;
import io.undertow.server.session.SessionManager;
import io.undertow.testutils.DefaultServer;
import io.undertow.testutils.HttpClientUtils;
import io.undertow.testutils.TestHttpClient;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.IOException;
/**
* Tests the load balancing proxy
*
* @author Stuart Douglas
*/
@RunWith(DefaultServer.class)
public abstract class AbstractLoadBalancingProxyTestCase {
private static final String COUNT = "count";
protected static Undertow server1;
protected static Undertow server2;
@AfterClass
public static void teardown() {
server1.stop();
server2.stop();
}
@Test
public void testLoadShared() throws IOException {
final StringBuilder resultString = new StringBuilder();
for (int i = 0; i < 6; ++i) {
TestHttpClient client = new TestHttpClient();
try {
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/name");
HttpResponse result = client.execute(get);
Assert.assertEquals(200, result.getStatusLine().getStatusCode());
resultString.append(HttpClientUtils.readResponse(result));
resultString.append(' ');
} finally {
client.getConnectionManager().shutdown();
}
}
Assert.assertTrue(resultString.toString().contains("server1"));
Assert.assertTrue(resultString.toString().contains("server2"));
}
@Test
public void testLoadSharedWithServerShutdown() throws IOException {
final StringBuilder resultString = new StringBuilder();
for (int i = 0; i < 6; ++i) {
TestHttpClient client = new TestHttpClient();
try {
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/name");
HttpResponse result = client.execute(get);
Assert.assertEquals(200, result.getStatusLine().getStatusCode());
resultString.append(HttpClientUtils.readResponse(result));
resultString.append(' ');
} catch (Throwable t) {
throw new RuntimeException("Failed with i=" + i, t);
} finally {
client.getConnectionManager().shutdown();
}
server1.stop();
server1.start();
server2.stop();
server2.start();
}
Assert.assertTrue(resultString.toString().contains("server1"));
Assert.assertTrue(resultString.toString().contains("server2"));
}
@Test
public void testStickySessions() throws IOException {
int expected = 0;
TestHttpClient client = new TestHttpClient();
try {
for (int i = 0; i < 6; ++i) {
try {
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/session");
get.addHeader("Connection", "close");
HttpResponse result = client.execute(get);
Assert.assertEquals(200, result.getStatusLine().getStatusCode());
int count = Integer.parseInt(HttpClientUtils.readResponse(result));
Assert.assertEquals(expected++, count);
} catch (Exception e) {
throw new RuntimeException("Test failed with i=" + i, e);
}
}
} finally {
client.getConnectionManager().shutdown();
}
}
protected static final class SessionTestHandler implements HttpHandler {
private final SessionCookieConfig sessionConfig;
protected SessionTestHandler(SessionCookieConfig sessionConfig) {
this.sessionConfig = sessionConfig;
}
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
final SessionManager manager = exchange.getAttachment(SessionManager.ATTACHMENT_KEY);
Session session = manager.getSession(exchange, sessionConfig);
if (session == null) {
session = manager.createSession(exchange, sessionConfig);
session.setAttribute(COUNT, 0);
}
Integer count = (Integer) session.getAttribute(COUNT);
session.setAttribute(COUNT, count + 1);
exchange.getResponseSender().send("" + count);
}
}
protected static final class StringSendHandler implements HttpHandler {
private final String serverName;
protected StringSendHandler(String serverName) {
this.serverName = serverName;
}
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
exchange.getResponseSender().send(serverName);
}
}
}
| [
"[email protected]"
] | |
a72e94e14f11281b468fc111338af855c4e0b3ba | 330f81dc5de92d7040f259b36e1182e9093c6c38 | /Algorithms/Recursion/QueenBox.java | e7b3779bca6951bbd7031d34f7978819d9e16a1d | [] | no_license | Ujwalgulhane/Data-Structure-Algorithm | 75f0bdd9a20de2abf567ee1f909aa91e3c2f5cfc | e5f8db3a313b3f634c002ec975e0b53029e82d90 | refs/heads/master | 2023-08-25T02:36:57.045798 | 2021-10-26T07:13:58 | 2021-10-26T07:13:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 968 | java | import java.io.*;
import java.util.*;
public class QueenBox {
public static void queensCombinations(int qpsf, int tq, int row, int col, String asf){
if(row==tq){
if(qpsf==tq){
System.out.println(asf);
}
return;
}
int nr=row,nc=col;
if(col==tq-1){
nc=0;nr=row+1;
}else{
nc=col+1;
}
if(col==tq-1){
queensCombinations(qpsf+1,tq,nr,nc,asf+"q\n");
queensCombinations(qpsf,tq,nr,nc,asf+"-\n");
}else{
queensCombinations(qpsf+1,tq,nr,nc,asf+"q");
queensCombinations(qpsf,tq,nr,nc,asf+"-");
}
}
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
// printArry(0,0,"") ;
queensCombinations(0, n, 0, 0, "");
}
} | [
"[email protected]"
] | |
d20de76bfd4fb903bb77e14d2649ff82ee32af84 | aa354bbd2fc90a3274f35dc24ff6442626ab7f91 | /redesocial-api/src/main/java/com/redesocial/api/security/UserDetailsImpl.java | 39d4c8796f9a56628984c4e51e8c0b9a77f7a533 | [] | no_license | cezarags/Spring | 452733e5aa87e9aa1f5d2d37734a51ec55389471 | 2d677ebdf009ab714518995bdc1c355f68f70455 | refs/heads/master | 2022-12-14T20:32:26.245551 | 2020-09-17T20:14:29 | 2020-09-17T20:14:29 | 292,254,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,331 | java | package com.redesocial.api.security;
import java.util.Collection;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.redesocial.api.model.Usuario;
public class UserDetailsImpl implements UserDetails{
private String userName;
private String password;
public UserDetailsImpl(Usuario user) {
this.userName = user.getEmail();
this.password = user.getSenha();
}
public UserDetailsImpl() {
}
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getPassword() {
// TODO Auto-generated method stub
return password;
}
@Override
public String getUsername() {
// TODO Auto-generated method stub
return userName;
}
@Override
public boolean isAccountNonExpired() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean isAccountNonLocked() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean isCredentialsNonExpired() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean isEnabled() {
// TODO Auto-generated method stub
return true;
}
}
| [
"[email protected]"
] | |
964f5ff45fb723085c47caf2113be19738d3da1d | f2653c695c972120808c53622e2c47baaabb2194 | /src/Formulario/FrmConLegajoNombre.java | 9f1ee17cec4c6e6cdf8f45596755bbfe67b0c3bc | [] | no_license | caoeze92/CRUDJAVA | 4a4a62f480d15590bdf03ca00c589f8e122edeea | 0a963b3ee008241060e4bda5864ede2d41ac5c57 | refs/heads/master | 2022-12-27T14:47:48.337382 | 2020-10-17T20:23:01 | 2020-10-17T20:26:39 | 304,964,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,005 | java |
package Formulario;
import Desarrollo.Busqueda;
import javax.swing.JOptionPane;
public class FrmConLegajoNombre extends javax.swing.JInternalFrame {
Busqueda ObjB = new Busqueda();
public FrmConLegajoNombre() {
initComponents();
this.PanelNombres.setVisible(false);
this.PanelPorLegajo.setVisible(false);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
GrupoBusqueda = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
rbLegajo = new javax.swing.JRadioButton();
rbNombre = new javax.swing.JRadioButton();
txtNom = new javax.swing.JTextField();
txtNroLeg = new javax.swing.JTextField();
jPanel4 = new javax.swing.JPanel();
btnBuscar = new javax.swing.JButton();
btnSalir = new javax.swing.JButton();
PanelPorLegajo = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
lblLegajo = new javax.swing.JLabel();
txtBNombre = new javax.swing.JTextField();
lblSueldo = new javax.swing.JLabel();
lblActivo = new javax.swing.JLabel();
PanelNombres = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
TablaNombre = new javax.swing.JTable();
setIconifiable(true);
setMaximizable(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(102, 102, 255));
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel2.setBackground(new java.awt.Color(102, 102, 255));
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1090, Short.MAX_VALUE)
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 70, Short.MAX_VALUE)
);
jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(-10, 20, 1090, 70));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("BUSCAR POR"));
GrupoBusqueda.add(rbLegajo);
rbLegajo.setSelected(true);
rbLegajo.setText("NUMERO DE LEGAJO");
GrupoBusqueda.add(rbNombre);
rbNombre.setText("NOMBRE");
txtNroLeg.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNroLegActionPerformed(evt);
}
});
txtNroLeg.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtNroLegKeyTyped(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(60, 60, 60)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(rbLegajo)
.addComponent(rbNombre))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtNroLeg, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtNom, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(14, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(rbLegajo)
.addComponent(txtNroLeg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(rbNombre)
.addComponent(txtNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(33, Short.MAX_VALUE))
);
jPanel1.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, 310, 130));
jPanel4.setBackground(new java.awt.Color(102, 102, 255));
btnBuscar.setText("BUSCAR");
btnBuscar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBuscarActionPerformed(evt);
}
});
btnSalir.setText("SALIR");
btnSalir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSalirActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(39, 39, 39)
.addComponent(btnBuscar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 853, Short.MAX_VALUE)
.addComponent(btnSalir)
.addGap(44, 44, 44))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnBuscar)
.addComponent(btnSalir))
.addContainerGap(28, Short.MAX_VALUE))
);
jPanel1.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 360, 1070, 80));
PanelPorLegajo.setBackground(new java.awt.Color(153, 255, 255));
jLabel1.setText("NUMERO DE LEGAJO:");
jLabel2.setText("NOMBRE: ");
jLabel3.setText("SUELDO: ");
jLabel4.setText("ACTIVO: ");
lblSueldo.setText(" ");
javax.swing.GroupLayout PanelPorLegajoLayout = new javax.swing.GroupLayout(PanelPorLegajo);
PanelPorLegajo.setLayout(PanelPorLegajoLayout);
PanelPorLegajoLayout.setHorizontalGroup(
PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelPorLegajoLayout.createSequentialGroup()
.addGap(33, 33, 33)
.addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelPorLegajoLayout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(46, 46, 46)
.addComponent(lblActivo, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(PanelPorLegajoLayout.createSequentialGroup()
.addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(18, 18, 18)
.addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lblLegajo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtBNombre, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE)
.addComponent(lblSueldo, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(50, Short.MAX_VALUE))
);
PanelPorLegajoLayout.setVerticalGroup(
PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelPorLegajoLayout.createSequentialGroup()
.addGap(36, 36, 36)
.addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(lblLegajo, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(39, 39, 39)
.addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtBNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(37, 37, 37)
.addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(lblSueldo))
.addGap(29, 29, 29)
.addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(lblActivo))
.addContainerGap(67, Short.MAX_VALUE))
);
jPanel1.add(PanelPorLegajo, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 90, 340, 270));
PanelNombres.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
TablaNombre.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(TablaNombre);
PanelNombres.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 370, 270));
jPanel1.add(PanelNombres, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 90, 370, 290));
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, -20, 1090, 430));
pack();
}// </editor-fold>//GEN-END:initComponents
private void txtNroLegActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNroLegActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtNroLegActionPerformed
private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed
dispose();
}//GEN-LAST:event_btnSalirActionPerformed
private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
if (this.rbNombre.isSelected()) {
if (this.txtNom.getText().isEmpty()) {
JOptionPane.showMessageDialog(this, "Debe ingresar un nombre");
} else {
//CASO 2
String Nom = this.txtNom.getText();
ObjB.setNom(Nom);
//ObjB.BuscaxNom();
this.PanelNombres.setVisible(true);
this.TablaNombre.setModel(ObjB.MuestroTit());
this.TablaNombre.setModel(ObjB.BuscaxNom());
}
}
else {
//CASO 1
if (this.txtNroLeg.getText().isEmpty()) {
JOptionPane.showMessageDialog(null, "Debe ingresar un numero de Legajo ");
}
else {
int Leg = Integer.parseInt(this.txtNroLeg.getText());
boolean Existe = ObjB.BuscaxLeg(Leg);
this.PanelPorLegajo.setVisible(true);
if (Existe==true) {
this.lblLegajo.setText(String.valueOf(ObjB.getLegajo()));
this.lblActivo.setText(String.valueOf(ObjB.isAct()));
this.lblSueldo.setText(String.valueOf(ObjB.getSdo()));
this.txtBNombre.setText(String.valueOf(ObjB.getNom()));
this.txtBNombre.setEditable(false);
}
else {
JOptionPane.showMessageDialog(null, "Nro de legajo inexistente");
}
}
}
}//GEN-LAST:event_btnBuscarActionPerformed
private void txtNroLegKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNroLegKeyTyped
if (this.txtNroLeg.getText().length()>=6) {
evt.consume();
}
}//GEN-LAST:event_txtNroLegKeyTyped
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup GrupoBusqueda;
private javax.swing.JPanel PanelNombres;
private javax.swing.JPanel PanelPorLegajo;
private javax.swing.JTable TablaNombre;
private javax.swing.JButton btnBuscar;
private javax.swing.JButton btnSalir;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel lblActivo;
private javax.swing.JLabel lblLegajo;
private javax.swing.JLabel lblSueldo;
private javax.swing.JRadioButton rbLegajo;
private javax.swing.JRadioButton rbNombre;
private javax.swing.JTextField txtBNombre;
private javax.swing.JTextField txtNom;
private javax.swing.JTextField txtNroLeg;
// End of variables declaration//GEN-END:variables
}
| [
"Ezequiel Cao"
] | Ezequiel Cao |
375f039d16bcb13a6fd4ee34070bc6d45e693049 | 35477fae0c6e9161e00c8010a04b5afb9e6a7c9c | /org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java | 8901a868856c8b227204ca8bcf1c4ad7d34a141b | [] | no_license | cemeyer2/fruit | 959693aada218b7552ab73c89413cd2746c9182a | 8a661d80b443efb928950553ef81277d5a0bf3a6 | refs/heads/master | 2021-01-19T19:31:09.379404 | 2014-05-13T14:36:48 | 2014-05-13T14:36:48 | 19,291,788 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,962 | java | /*******************************************************************************
* Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences 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:
* Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTComment;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationMap;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore;
import org.eclipse.cdt.internal.core.dom.rewrite.ASTRewriteAnalyzer;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriter;
import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ProblemRuntimeException;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter;
import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap;
import org.eclipse.cdt.internal.core.dom.rewrite.util.FileContentHelper;
import org.eclipse.cdt.internal.core.dom.rewrite.util.FileHelper;
import org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.text.edits.DeleteEdit;
import org.eclipse.text.edits.InsertEdit;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.text.edits.TextEditGroup;
public class ChangeGenerator extends CPPASTVisitor {
private final LinkedHashMap<String, Integer> sourceOffsets = new LinkedHashMap<String, Integer>();
public LinkedHashMap<IASTNode, List<ASTModification>> modificationParent = new LinkedHashMap<IASTNode, List<ASTModification>>();
private final LinkedHashMap<IFile, MultiTextEdit> changes = new LinkedHashMap<IFile, MultiTextEdit>();
private CompositeChange change;
private final ASTModificationStore modificationStore;
private NodeCommentMap commentMap;
{
shouldVisitExpressions = true;
shouldVisitStatements = true;
shouldVisitNames = true;
shouldVisitDeclarations = true;
shouldVisitDeclSpecifiers = true;
shouldVisitDeclarators = true;
shouldVisitInitializers = true;
shouldVisitBaseSpecifiers = true;
shouldVisitNamespaces = true;
shouldVisitTemplateParameters = true;
shouldVisitParameterDeclarations = true;
shouldVisitTranslationUnit = true;
}
public ChangeGenerator(ASTModificationStore modificationStore) {
this.modificationStore = modificationStore;
}
public void generateChange(IASTNode rootNode) throws ProblemRuntimeException {
generateChange(rootNode, this);
}
public void generateChange(IASTNode rootNode, CPPASTVisitor pathProvider)
throws ProblemRuntimeException {
change = new CompositeChange(Messages.ChangeGenerator_compositeChange);
initParentModList();
commentMap = ASTCommenter.getCommentedNodeMap(rootNode.getTranslationUnit());
rootNode.accept(pathProvider);
for (IFile currentFile : changes.keySet()) {
TextFileChange subchange= ASTRewriteAnalyzer.createCTextFileChange(currentFile);
subchange.setEdit(changes.get(currentFile));
change.add(subchange);
}
}
private void initParentModList() {
ASTModificationMap rootModifications = modificationStore
.getRootModifications();
if (rootModifications != null) {
for (IASTNode modifiedNode : rootModifications.getModifiedNodes()) {
List<ASTModification> modificationsForNode = rootModifications
.getModificationsForNode(modifiedNode);
IASTNode modifiedNodeParent = determineParentToBeRewritten(modifiedNode, modificationsForNode);
modificationParent.put(modifiedNodeParent != null ? modifiedNodeParent : modifiedNode,
modificationsForNode);
}
}
}
private IASTNode determineParentToBeRewritten(IASTNode modifiedNode, List<ASTModification> modificationsForNode) {
IASTNode modifiedNodeParent = modifiedNode;
for(ASTModification currentModification : modificationsForNode){
if(currentModification.getKind() != ASTModification.ModificationKind.APPEND_CHILD){
modifiedNodeParent = modifiedNode.getParent();
break;
}
}
modifiedNodeParent = modifiedNodeParent != null ? modifiedNodeParent : modifiedNode;
return modifiedNodeParent;
}
@Override
public int visit(IASTTranslationUnit translationUnit) {
if (hasChangedChild(translationUnit)) {
synthTreatment(translationUnit);
}
IASTFileLocation location = getFileLocationOfEmptyTranslationUnit(translationUnit);
sourceOffsets.put(location.getFileName(),
Integer.valueOf(location.getNodeOffset()));
return super.visit(translationUnit);
}
/**
* This is a Workaround for a known but not jet solved Problem in IASTNode. If you get the FileFocation of a translationUnit
* that was built on an empty file you will get null because there it explicitly returns null if the index and length is 0.
* To get to the Filename and other information, the location is never the less needed.
* @param node
* @return a hopefully "unnull" FileLocation
*/
public IASTFileLocation getFileLocationOfEmptyTranslationUnit(IASTNode node) {
IASTFileLocation fileLocation = node.getFileLocation();
if (fileLocation == null) {
ILocationResolver lr = (ILocationResolver) node.getTranslationUnit().getAdapter(ILocationResolver.class);
if (lr != null) {
fileLocation = lr.getMappedFileLocation(0, 0);
} else {
// support for old location map
fileLocation = node.getTranslationUnit().flattenLocationsToFile(node.getNodeLocations());
}
}
return fileLocation;
}
@Override
public int leave(IASTTranslationUnit tu) {
return super.leave(tu);
}
private int getOffsetForNodeFile(IASTNode rootNode) {
Integer offset = sourceOffsets.get(rootNode.getFileLocation()
.getFileName());
return offset == null ? 0 : offset.intValue();
}
@Override
public int visit(IASTDeclaration declaration) {
if (hasChangedChild(declaration)) {
synthTreatment(declaration);
return ASTVisitor.PROCESS_SKIP;
}
return super.visit(declaration);
}
private void synthTreatment(IASTNode synthNode) {
synthTreatment(synthNode, null);
}
private void synthTreatment(IASTNode synthNode, String fileScope) {
String indent = getIndent(synthNode);
ASTWriter synthWriter = new ASTWriter(indent);
synthWriter.setModificationStore(modificationStore);
String synthSource = synthWriter.write(synthNode, fileScope, commentMap);
reformatSynthCode(synthNode, synthSource); /*XXX resultat wird nicht verwendet?*/
int newOffset = synthNode.getFileLocation().getNodeOffset()
+ synthNode.getFileLocation().getNodeLength();
sourceOffsets.put(synthNode.getFileLocation().getFileName(), Integer.valueOf(newOffset));
}
private void synthTreatment(IASTTranslationUnit synthTU) {
ASTWriter synthWriter = new ASTWriter();
synthWriter.setModificationStore(modificationStore);
for (ASTModification modification : modificationParent.get(synthTU)) {
IASTFileLocation targetLocation;
targetLocation = getFileLocationOfEmptyTranslationUnit(modification.getTargetNode());
String currentFile = targetLocation.getFileName();
IPath implPath = new Path(currentFile);
IFile relevantFile = ResourcesPlugin.getWorkspace().getRoot()
.getFileForLocation(implPath);
MultiTextEdit edit;
if (changes.containsKey(relevantFile)) {
edit = changes.get(relevantFile);
} else {
edit = new MultiTextEdit();
changes.put(relevantFile, edit);
}
String newNodeCode = synthWriter.write(modification.getNewNode(), null, commentMap);
switch (modification.getKind()) {
case REPLACE:
edit.addChild(new ReplaceEdit(targetLocation.getNodeOffset(),
targetLocation.getNodeLength(), newNodeCode));
break;
case INSERT_BEFORE:
edit.addChild(new InsertEdit(getOffsetIncludingComments(modification.getTargetNode()),
newNodeCode));
break;
case APPEND_CHILD:
String lineDelimiter = FileHelper.determineLineDelimiter(FileHelper.getIFilefromIASTNode(modification.getTargetNode()));
edit.addChild(new InsertEdit(targetLocation.getNodeOffset()
+ targetLocation.getNodeLength(),lineDelimiter + lineDelimiter + newNodeCode));
break;
}
}
}
private String reformatSynthCode(IASTNode synthNode, String synthSource) {
IFile relevantFile = FileHelper.getIFilefromIASTNode(synthNode);
StringBuilder formattedCode = new StringBuilder();
String originalCode = originalCodeOfNode(synthNode);
CodeComparer codeComparer = new CodeComparer(originalCode, synthSource);
int lastCommonPositionInOriginalCode = codeComparer
.getLastCommonPositionInOriginalCode();
if (lastCommonPositionInOriginalCode > -1) {
formattedCode.append(originalCode.substring(0,
lastCommonPositionInOriginalCode + 1));
}
int lastCommonPositionInSynthCode = codeComparer
.getLastCommonPositionInSynthCode();
int firstPositionOfCommonEndInSynthCode = codeComparer
.getFirstPositionOfCommonEndInSynthCode(lastCommonPositionInSynthCode, lastCommonPositionInOriginalCode);
int firstPositionOfCommonEndInOriginalCode = codeComparer
.getFirstPositionOfCommonEndInOriginalCode(lastCommonPositionInOriginalCode, lastCommonPositionInSynthCode);
if (firstPositionOfCommonEndInSynthCode == -1) {
formattedCode.append(synthSource
.substring(lastCommonPositionInSynthCode + 1));
} else {
if (lastCommonPositionInSynthCode + 1 < firstPositionOfCommonEndInSynthCode) {
formattedCode.append(synthSource.substring(
lastCommonPositionInSynthCode + 1,
firstPositionOfCommonEndInSynthCode));
}
}
if (firstPositionOfCommonEndInOriginalCode > -1) {
formattedCode.append(originalCode
.substring(firstPositionOfCommonEndInOriginalCode));
}
MultiTextEdit edit;
if (changes.containsKey(relevantFile)) {
edit = changes.get(relevantFile);
} else {
edit = new MultiTextEdit();
changes.put(relevantFile, edit);
}
codeComparer.createChange(edit, synthNode);
return formattedCode.toString();
}
public String originalCodeOfNode(IASTNode node) {
if (node.getFileLocation() != null) {
IFile sourceFile = FileHelper.getIFilefromIASTNode(node);
int nodeOffset = getOffsetIncludingComments(node);
int nodeLength = getNodeLengthIncludingComments(node);
return FileContentHelper.getContent(sourceFile, nodeOffset, nodeLength);
}
return null;
}
private int getNodeLengthIncludingComments(IASTNode node) {
int nodeOffset = node.getFileLocation().getNodeOffset();
int nodeLength = node.getFileLocation().getNodeLength();
ArrayList<IASTComment> comments = commentMap.getAllCommentsForNode(node);
if(!comments.isEmpty()) {
int startOffset = nodeOffset;
int endOffset = nodeOffset + nodeLength;
for(IASTComment comment : comments) {
IASTFileLocation commentLocation = comment.getFileLocation();
if(commentLocation.getNodeOffset() < startOffset) {
startOffset = commentLocation.getNodeOffset();
}
if(commentLocation.getNodeOffset() + commentLocation.getNodeLength() >= endOffset) {
endOffset = commentLocation.getNodeOffset() + commentLocation.getNodeLength();
}
}
nodeLength = endOffset - startOffset;
}
return nodeLength;
}
private int getOffsetIncludingComments(IASTNode node) {
int nodeOffset = node.getFileLocation().getNodeOffset();
ArrayList<IASTComment> comments = commentMap.getAllCommentsForNode(node);
if(!comments.isEmpty()) {
int startOffset = nodeOffset;
for(IASTComment comment : comments) {
IASTFileLocation commentLocation = comment.getFileLocation();
if(commentLocation.getNodeOffset() < startOffset) {
startOffset = commentLocation.getNodeOffset();
}
}
nodeOffset = startOffset;
}
return nodeOffset;
}
private String getIndent(IASTNode nextNode) {
IASTFileLocation fileLocation = nextNode.getFileLocation();
int length = fileLocation.getNodeOffset()
- getOffsetForNodeFile(nextNode);
String originalSource = FileContentHelper.getContent(FileHelper
.getIFilefromIASTNode(nextNode),
getOffsetForNodeFile(nextNode), length);
StringBuilder indent = new StringBuilder(originalSource);
indent.reverse();
String lastline = indent
.substring(0, Math.max(indent.indexOf("\n"), 0)); //$NON-NLS-1$
if (lastline.trim().length() == 0) {
return lastline;
}
return ""; //$NON-NLS-1$
}
private boolean hasChangedChild(IASTNode parent) {
return modificationParent.containsKey(parent);
}
@Override
public int visit(IASTDeclarator declarator) {
if (hasChangedChild(declarator)) {
synthTreatment(declarator);
return ASTVisitor.PROCESS_SKIP;
}
return super.visit(declarator);
}
@Override
public int visit(ICPPASTNamespaceDefinition namespaceDefinition) {
if(hasChangedChild(namespaceDefinition)){
synthTreatment(namespaceDefinition);
return ASTVisitor.PROCESS_SKIP;
}
return super.visit(namespaceDefinition);
}
@Override
public int visit(IASTDeclSpecifier declSpec) {
if (hasChangedChild(declSpec)) {
synthTreatment(declSpec);
return ASTVisitor.PROCESS_SKIP;
}
return super.visit(declSpec);
}
@Override
public int visit(IASTExpression expression) {
if (hasChangedChild(expression)) {
synthTreatment(expression);
return ASTVisitor.PROCESS_SKIP;
}
return super.visit(expression);
}
@Override
public int visit(IASTInitializer initializer) {
if (hasChangedChild(initializer)) {
synthTreatment(initializer);
return ASTVisitor.PROCESS_SKIP;
}
return super.visit(initializer);
}
@Override
public int visit(IASTName name) {
if (hasChangedChild(name)) {
synthTreatment(name);
return ASTVisitor.PROCESS_SKIP;
}
return super.visit(name);
}
@Override
public int visit(IASTParameterDeclaration parameterDeclaration) {
if (hasChangedChild(parameterDeclaration)) {
synthTreatment(parameterDeclaration);
return ASTVisitor.PROCESS_SKIP;
}
return super.visit(parameterDeclaration);
}
@Override
public int visit(IASTStatement statement) {
if (hasChangedChild(statement)) {
synthTreatment(statement);
return ASTVisitor.PROCESS_SKIP;
}
return super.visit(statement);
}
class CodeComparer {
private final StringBuilder originalCode;
private final StringBuilder synthCode;
public CodeComparer(String originalCode, String synthCode) {
this.originalCode = new StringBuilder(originalCode);
this.synthCode = new StringBuilder(synthCode);
}
public int getLastCommonPositionInSynthCode() {
int lastCommonPosition = -1;
int originalCodePosition = -1;
int synthCodePosition = -1;
do {
lastCommonPosition = synthCodePosition;
originalCodePosition = nextInterrestingPosition(originalCode,
originalCodePosition);
synthCodePosition = nextInterrestingPosition(synthCode,
synthCodePosition);
} while (originalCodePosition > -1
&& synthCodePosition > -1
&& originalCode.charAt(originalCodePosition) == synthCode
.charAt(synthCodePosition));
return lastCommonPosition;
}
public int getLastCommonPositionInOriginalCode() {
int lastCommonPosition = -1;
int originalCodePosition = -1;
int synthCodePosition = -1;
do {
lastCommonPosition = originalCodePosition;
originalCodePosition = nextInterrestingPosition(originalCode,
originalCodePosition);
synthCodePosition = nextInterrestingPosition(synthCode,
synthCodePosition);
} while (originalCodePosition > -1
&& synthCodePosition > -1
&& originalCode.charAt(originalCodePosition) == synthCode
.charAt(synthCodePosition));
return lastCommonPosition;
}
public int getFirstPositionOfCommonEndInOriginalCode(int originalLimit, int synthLimit) {
int lastCommonPosition = -1;
int originalCodePosition = -1;
int synthCodePosition = -1;
StringBuilder reverseOriginalCode = new StringBuilder(originalCode)
.reverse();
StringBuilder reverseSynthCode = new StringBuilder(synthCode)
.reverse();
do {
lastCommonPosition = originalCodePosition;
originalCodePosition = nextInterrestingPosition(
reverseOriginalCode, originalCodePosition);
synthCodePosition = nextInterrestingPosition(reverseSynthCode,
synthCodePosition);
} while (originalCodePosition > -1
&& originalCodePosition < originalCode.length() - originalLimit
&& synthCodePosition > -1
&& synthCodePosition < synthCode.length() - synthLimit
&& reverseOriginalCode.charAt(originalCodePosition) == reverseSynthCode
.charAt(synthCodePosition));
if (lastCommonPosition < 0
|| lastCommonPosition >= originalCode.length()) {
return -1;
}
return originalCode.length() - lastCommonPosition;
}
public int getFirstPositionOfCommonEndInSynthCode(int limmit, int lastCommonPositionInOriginal) {
int lastCommonPosition = 0;
int originalCodePosition = -1;
int synthCodePosition = -1;
int korOffset = 0;
StringBuilder reverseOriginalCode = new StringBuilder(originalCode)
.reverse();
StringBuilder reverseSynthCode = new StringBuilder(synthCode)
.reverse();
do {
if (lastCommonPosition >= 0
&& lastCommonPositionInOriginal >= 0
&& originalCode.charAt(lastCommonPositionInOriginal
- korOffset) == reverseSynthCode
.charAt(lastCommonPosition)) {
++korOffset;
} else {
korOffset = 0;
}
lastCommonPosition = synthCodePosition;
originalCodePosition = nextInterrestingPosition(
reverseOriginalCode, originalCodePosition);
synthCodePosition = nextInterrestingPosition(reverseSynthCode,
synthCodePosition);
} while (originalCodePosition > -1
&& originalCodePosition < originalCode.length() - lastCommonPositionInOriginal
&& synthCodePosition > -1
&& synthCodePosition < synthCode.length() - limmit
&& reverseOriginalCode.charAt(originalCodePosition) == reverseSynthCode
.charAt(synthCodePosition));
if (lastCommonPosition < 0
|| lastCommonPosition >= synthCode.length()) {
return -1;
}
if (korOffset > 0) {
--korOffset;
}
return synthCode.length() - lastCommonPosition + korOffset;
}
private int nextInterrestingPosition(StringBuilder code, int position) {
do {
position++;
if (position >= code.length()) {
return -1;
}
} while (isUninterresting(code, position));
return position;
}
private boolean isUninterresting(StringBuilder code, int position) {
switch (code.charAt(position)) {
case ' ':
case '\n':
case '\r':
case '\t':
return true;
default:
return false;
}
}
protected void createChange(MultiTextEdit edit, IASTNode changedNode) {
int changeOffset = getOffsetIncludingComments(changedNode);
TextEditGroup editGroup = new TextEditGroup(Messages.ChangeGenerator_group);
for (ASTModification currentModification : modificationParent
.get(changedNode)) {
if (currentModification.getAssociatedEditGroup() != null) {
editGroup = currentModification.getAssociatedEditGroup();
edit.addChildren(editGroup.getTextEdits());
break;
}
}
createChange(edit, changeOffset);
}
private void createChange(MultiTextEdit edit, int changeOffset) {
int lastCommonPositionInOriginal = getLastCommonPositionInOriginalCode();
int lastCommonPositionInSynth = getLastCommonPositionInSynthCode();
int firstOfCommonEndInOriginal = getFirstPositionOfCommonEndInOriginalCode(lastCommonPositionInOriginal, lastCommonPositionInSynth);
int firstOfCommonEndInSynth = getFirstPositionOfCommonEndInSynthCode(
lastCommonPositionInSynth, lastCommonPositionInOriginal);
int i = (firstOfCommonEndInSynth >= 0 ? firstOfCommonEndInOriginal
: originalCode.length())
- lastCommonPositionInOriginal;
if (i <= 0) {
String insertCode = synthCode.substring(
lastCommonPositionInSynth, firstOfCommonEndInSynth);
InsertEdit iEdit = new InsertEdit(changeOffset
+ lastCommonPositionInOriginal, insertCode);
edit.addChild(iEdit);
} else if ((firstOfCommonEndInSynth >= 0 ? firstOfCommonEndInSynth
: synthCode.length())
- lastCommonPositionInSynth <= 0) {
int correction = 0;
if (lastCommonPositionInSynth > firstOfCommonEndInSynth) {
correction = lastCommonPositionInSynth
- firstOfCommonEndInSynth;
}
DeleteEdit dEdit = new DeleteEdit(changeOffset
+ lastCommonPositionInOriginal,
firstOfCommonEndInOriginal
- lastCommonPositionInOriginal + correction);
edit.addChild(dEdit);
} else {
String replacementCode = getReplacementCode(
lastCommonPositionInSynth, firstOfCommonEndInSynth);
ReplaceEdit rEdit = new ReplaceEdit(
changeOffset
+ Math.max(lastCommonPositionInOriginal, 0),
(firstOfCommonEndInOriginal >= 0 ? firstOfCommonEndInOriginal
: originalCode.length())
- Math.max(lastCommonPositionInOriginal, 0),
replacementCode);
edit.addChild(rEdit);
}
}
private String getReplacementCode(int lastCommonPositionInSynth,
int firstOfCommonEndInSynth) {
int replacementStart = Math.max(lastCommonPositionInSynth, 0);
int replacementEnd = (firstOfCommonEndInSynth >= 0 ? firstOfCommonEndInSynth
: synthCode.length());
if (replacementStart < replacementEnd) {
return synthCode.substring(replacementStart, replacementEnd);
}
return ""; //$NON-NLS-1$
}
}
public Change getChange() {
return change;
}
}
| [
"[email protected]"
] | |
95394cc5b1fc3f768ebf4681b6249942160fcf32 | f8a8db5a3327cc8d4c7427c5d66d00c30385ffce | /algorithms/src/main/java/algos/string/multiplystrings/Solution.java | a93651dc9b2029174e18243a2eb4936d98ffd5c8 | [] | no_license | imtiyazgit/integrated-project | c4cd8e8b867c05d6b428143b9ee689f10d018a97 | ff2517bd0c4f8214ebd4ad3f96ea980a3f0dc431 | refs/heads/master | 2022-12-22T13:09:38.654926 | 2020-10-30T18:28:48 | 2020-10-30T18:28:48 | 60,052,267 | 0 | 0 | null | 2022-12-16T01:51:51 | 2016-05-31T02:27:05 | Java | UTF-8 | Java | false | false | 907 | java | package algos.string.multiplystrings;
public class Solution {
public String multiply(String num1, String num2) {
int m=num1.length(), n=num2.length();
int[] vals = new int[m+n];
for (int i = m-1; i >= 0; --i) {
for (int j = n-1; j >=0 ; --j) {
int mul = (num1.charAt(i) - '0') * (num2.charAt(j) - '0');
int sum = vals[i+j+1] + mul;
vals[i+j] += sum / 10;
vals[i+j+1] = sum %10;
}
}
StringBuilder sb = new StringBuilder();
for(int val:vals) {
if(sb.length() != 0 || val != 0) {
sb.append(val);
}
}
return sb.length() == 0 ? "0" : sb.toString();
}
public static void main(String[] args) {
Solution solution = new Solution();
System.out.println(solution.multiply("12", "9"));
}
}
| [
"[email protected]"
] | |
20f09b9f93c795a895179e307e0785cb0cdc74cc | 21efb28ff32d7bbd2a719749f1316804d5f39b32 | /mall-mbg/src/main/java/com/macro/mall/model/OmsProcessExample.java | 5b550fbda0f6f88c3572376787d5134ad3ecc637 | [
"Apache-2.0"
] | permissive | DireW/mall | 3a44fe09021b1d45cc8558ad3628057548bab311 | 97244ac62e7c00930365e77996418cefc722789d | refs/heads/master | 2023-03-21T14:12:12.545910 | 2021-03-11T12:25:51 | 2021-03-11T12:25:51 | 295,946,065 | 0 | 0 | Apache-2.0 | 2020-09-16T06:41:34 | 2020-09-16T06:41:33 | null | UTF-8 | Java | false | false | 21,769 | java | package com.macro.mall.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class OmsProcessExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public OmsProcessExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andSortNumberIsNull() {
addCriterion("sort_number is null");
return (Criteria) this;
}
public Criteria andSortNumberIsNotNull() {
addCriterion("sort_number is not null");
return (Criteria) this;
}
public Criteria andSortNumberEqualTo(Integer value) {
addCriterion("sort_number =", value, "sortNumber");
return (Criteria) this;
}
public Criteria andSortNumberNotEqualTo(Integer value) {
addCriterion("sort_number <>", value, "sortNumber");
return (Criteria) this;
}
public Criteria andSortNumberGreaterThan(Integer value) {
addCriterion("sort_number >", value, "sortNumber");
return (Criteria) this;
}
public Criteria andSortNumberGreaterThanOrEqualTo(Integer value) {
addCriterion("sort_number >=", value, "sortNumber");
return (Criteria) this;
}
public Criteria andSortNumberLessThan(Integer value) {
addCriterion("sort_number <", value, "sortNumber");
return (Criteria) this;
}
public Criteria andSortNumberLessThanOrEqualTo(Integer value) {
addCriterion("sort_number <=", value, "sortNumber");
return (Criteria) this;
}
public Criteria andSortNumberIn(List<Integer> values) {
addCriterion("sort_number in", values, "sortNumber");
return (Criteria) this;
}
public Criteria andSortNumberNotIn(List<Integer> values) {
addCriterion("sort_number not in", values, "sortNumber");
return (Criteria) this;
}
public Criteria andSortNumberBetween(Integer value1, Integer value2) {
addCriterion("sort_number between", value1, value2, "sortNumber");
return (Criteria) this;
}
public Criteria andSortNumberNotBetween(Integer value1, Integer value2) {
addCriterion("sort_number not between", value1, value2, "sortNumber");
return (Criteria) this;
}
public Criteria andCreatedByIsNull() {
addCriterion("created_by is null");
return (Criteria) this;
}
public Criteria andCreatedByIsNotNull() {
addCriterion("created_by is not null");
return (Criteria) this;
}
public Criteria andCreatedByEqualTo(Long value) {
addCriterion("created_by =", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotEqualTo(Long value) {
addCriterion("created_by <>", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByGreaterThan(Long value) {
addCriterion("created_by >", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByGreaterThanOrEqualTo(Long value) {
addCriterion("created_by >=", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByLessThan(Long value) {
addCriterion("created_by <", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByLessThanOrEqualTo(Long value) {
addCriterion("created_by <=", value, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByIn(List<Long> values) {
addCriterion("created_by in", values, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotIn(List<Long> values) {
addCriterion("created_by not in", values, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByBetween(Long value1, Long value2) {
addCriterion("created_by between", value1, value2, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedByNotBetween(Long value1, Long value2) {
addCriterion("created_by not between", value1, value2, "createdBy");
return (Criteria) this;
}
public Criteria andCreatedTimeIsNull() {
addCriterion("created_time is null");
return (Criteria) this;
}
public Criteria andCreatedTimeIsNotNull() {
addCriterion("created_time is not null");
return (Criteria) this;
}
public Criteria andCreatedTimeEqualTo(Date value) {
addCriterion("created_time =", value, "createdTime");
return (Criteria) this;
}
public Criteria andCreatedTimeNotEqualTo(Date value) {
addCriterion("created_time <>", value, "createdTime");
return (Criteria) this;
}
public Criteria andCreatedTimeGreaterThan(Date value) {
addCriterion("created_time >", value, "createdTime");
return (Criteria) this;
}
public Criteria andCreatedTimeGreaterThanOrEqualTo(Date value) {
addCriterion("created_time >=", value, "createdTime");
return (Criteria) this;
}
public Criteria andCreatedTimeLessThan(Date value) {
addCriterion("created_time <", value, "createdTime");
return (Criteria) this;
}
public Criteria andCreatedTimeLessThanOrEqualTo(Date value) {
addCriterion("created_time <=", value, "createdTime");
return (Criteria) this;
}
public Criteria andCreatedTimeIn(List<Date> values) {
addCriterion("created_time in", values, "createdTime");
return (Criteria) this;
}
public Criteria andCreatedTimeNotIn(List<Date> values) {
addCriterion("created_time not in", values, "createdTime");
return (Criteria) this;
}
public Criteria andCreatedTimeBetween(Date value1, Date value2) {
addCriterion("created_time between", value1, value2, "createdTime");
return (Criteria) this;
}
public Criteria andCreatedTimeNotBetween(Date value1, Date value2) {
addCriterion("created_time not between", value1, value2, "createdTime");
return (Criteria) this;
}
public Criteria andUpdatedByIsNull() {
addCriterion("updated_by is null");
return (Criteria) this;
}
public Criteria andUpdatedByIsNotNull() {
addCriterion("updated_by is not null");
return (Criteria) this;
}
public Criteria andUpdatedByEqualTo(Long value) {
addCriterion("updated_by =", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByNotEqualTo(Long value) {
addCriterion("updated_by <>", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByGreaterThan(Long value) {
addCriterion("updated_by >", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByGreaterThanOrEqualTo(Long value) {
addCriterion("updated_by >=", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByLessThan(Long value) {
addCriterion("updated_by <", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByLessThanOrEqualTo(Long value) {
addCriterion("updated_by <=", value, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByIn(List<Long> values) {
addCriterion("updated_by in", values, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByNotIn(List<Long> values) {
addCriterion("updated_by not in", values, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByBetween(Long value1, Long value2) {
addCriterion("updated_by between", value1, value2, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedByNotBetween(Long value1, Long value2) {
addCriterion("updated_by not between", value1, value2, "updatedBy");
return (Criteria) this;
}
public Criteria andUpdatedTimeIsNull() {
addCriterion("updated_time is null");
return (Criteria) this;
}
public Criteria andUpdatedTimeIsNotNull() {
addCriterion("updated_time is not null");
return (Criteria) this;
}
public Criteria andUpdatedTimeEqualTo(Date value) {
addCriterion("updated_time =", value, "updatedTime");
return (Criteria) this;
}
public Criteria andUpdatedTimeNotEqualTo(Date value) {
addCriterion("updated_time <>", value, "updatedTime");
return (Criteria) this;
}
public Criteria andUpdatedTimeGreaterThan(Date value) {
addCriterion("updated_time >", value, "updatedTime");
return (Criteria) this;
}
public Criteria andUpdatedTimeGreaterThanOrEqualTo(Date value) {
addCriterion("updated_time >=", value, "updatedTime");
return (Criteria) this;
}
public Criteria andUpdatedTimeLessThan(Date value) {
addCriterion("updated_time <", value, "updatedTime");
return (Criteria) this;
}
public Criteria andUpdatedTimeLessThanOrEqualTo(Date value) {
addCriterion("updated_time <=", value, "updatedTime");
return (Criteria) this;
}
public Criteria andUpdatedTimeIn(List<Date> values) {
addCriterion("updated_time in", values, "updatedTime");
return (Criteria) this;
}
public Criteria andUpdatedTimeNotIn(List<Date> values) {
addCriterion("updated_time not in", values, "updatedTime");
return (Criteria) this;
}
public Criteria andUpdatedTimeBetween(Date value1, Date value2) {
addCriterion("updated_time between", value1, value2, "updatedTime");
return (Criteria) this;
}
public Criteria andUpdatedTimeNotBetween(Date value1, Date value2) {
addCriterion("updated_time not between", value1, value2, "updatedTime");
return (Criteria) this;
}
public Criteria andDeletedIsNull() {
addCriterion("deleted is null");
return (Criteria) this;
}
public Criteria andDeletedIsNotNull() {
addCriterion("deleted is not null");
return (Criteria) this;
}
public Criteria andDeletedEqualTo(Boolean value) {
addCriterion("deleted =", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotEqualTo(Boolean value) {
addCriterion("deleted <>", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThan(Boolean value) {
addCriterion("deleted >", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) {
addCriterion("deleted >=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThan(Boolean value) {
addCriterion("deleted <", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThanOrEqualTo(Boolean value) {
addCriterion("deleted <=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedIn(List<Boolean> values) {
addCriterion("deleted in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotIn(List<Boolean> values) {
addCriterion("deleted not in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedBetween(Boolean value1, Boolean value2) {
addCriterion("deleted between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) {
addCriterion("deleted not between", value1, value2, "deleted");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
] | |
ba993813c063530350133f7db8542d4ab1001f7a | 86ec135452f3b57ecb56e28eed2e8dcbfab58a16 | /JSF2-Spring-Hibernate-Example/src/main/java/com/keylesson/dao/UserDAO.java | 914c3ca3c08adef2a163c042ecdf79006b694371 | [] | no_license | auntaru/rokya-spring | afd3f1f02caf48618d2ec9f99d4f9c2752eeb9f7 | 4fd09926f81ca5931e77ab163bb518dc9c40318a | refs/heads/master | 2020-05-22T07:02:11.218403 | 2018-01-19T19:33:04 | 2018-01-19T19:33:04 | 34,803,204 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,213 | java | package com.keylesson.dao;
import java.util.HashSet;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Named;
import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Transactional;
import com.keylesson.model.UserModel;
import com.keylesson.persistence.Role;
import com.keylesson.persistence.User;
@Named
@Transactional("transactionManager")
public class UserDAO {
@Inject
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public void addUser(UserModel model) {
User user = new User();
user.setLogin(model.getLogin());
user.setPwd(model.getPwd());
user.setEnabled(1);
Role role = (Role) sessionFactory.getCurrentSession()
.createQuery("from Role where code='ROLE_USER'").uniqueResult();
if (role == null) {
role = new Role();
role.setCode("ROLE_USER");
role.setLabel("ROLE FOR SIMPLE ACCESS");
sessionFactory.getCurrentSession().save(role);
}
Set<Role> roles = new HashSet<Role>();
roles.add(role);
user.setRoles(roles);
sessionFactory.getCurrentSession().save(user);
}
}
| [
"[email protected]"
] | |
7acf48961da7b770fe2da67f28a3f2bcc03d7a22 | 75ee376eb8e255dbb5d4d981529585c36fe78967 | /Hibernate/In28Minutes/database-demo/src/test/java/com/in28minutes/database/databasedemo/SpringJDBCDemoApplicationTests.java | 9817521d5ddc39cb2424b5c40ff92b0051319119 | [] | no_license | nvvssmanyam/J2EEPractice | 8d340d30fe3b330624788f6156e12886edf6255f | 5df3c232b15e28c9d49c9975fa01010e1395fd5d | refs/heads/master | 2023-08-04T16:47:49.332302 | 2022-05-04T04:24:19 | 2022-05-04T04:24:19 | 168,332,164 | 0 | 1 | null | 2023-07-23T05:27:56 | 2019-01-30T11:30:27 | Java | UTF-8 | Java | false | false | 362 | java | package com.in28minutes.database.databasedemo;
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 SpringJDBCDemoApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
91cab6412c97be43aa493717a7d5da54a9f61ed9 | c16c1854880a1d806ffa2105b9b4d2b93b6baf75 | /pac-service/src/main/java/com/bocom/dao/AppBasketItemDao.java | cbb98440ca8657bfedf414e1677f22722e6ddc15 | [] | no_license | oldGoodSee/BSC | 26e71acd8c3695cd02f3e944b14e0f4e2e03b219 | 56b72b79adb122b0fe85ee570665789b973e31c8 | refs/heads/master | 2021-08-29T15:42:42.431924 | 2017-12-14T03:37:20 | 2017-12-14T03:37:20 | 114,209,439 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package com.bocom.dao;
import com.bocom.domain.pac.AppBasketItemInfo;
import com.bocom.domain.pac.PackagingInfo;
import java.util.List;
public interface AppBasketItemDao {
int deleteByPrimaryKey(Integer uuid);
int insert(AppBasketItemInfo record);
int insertSelective(AppBasketItemInfo record);
AppBasketItemInfo selectByPrimaryKey(Integer uuid);
int updateByPrimaryKeySelective(AppBasketItemInfo record);
int updateByPrimaryKey(AppBasketItemInfo record);
List<AppBasketItemInfo> queryBasketInfo(PackagingInfo param);
} | [
"[email protected]"
] | |
4b1e10abbb31c2a0c01a94af4bdeb9f6cbd3c420 | 2ca2693f5de468fc5ef0eeea4bfd34b12b32393a | /src/cn/lgx/yougou/fragment/FenLeiFragment.java | 6dbf009b245f6ad5f90beaac26e752ad4bc9aa69 | [] | no_license | digideskio/yougou | b925dda1d794d7875e46d60340584ab7cbfe0b77 | 05b9ce1e64ddd7505e2e2090069f76dee1430da5 | refs/heads/master | 2021-01-12T09:18:32.331385 | 2016-04-05T12:33:12 | 2016-04-05T12:33:12 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 5,291 | java | package cn.lgx.yougou.fragment;
import java.util.ArrayList;
import java.util.List;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.listener.FindListener;
import cn.lgx.yougou.FenLeiActivity;
import cn.lgx.yougou.R;
import cn.lgx.yougou.ShowGoodsListActivity;
import cn.lgx.yougou.application.MyApplication;
import cn.lgx.yougou.base.BaseFragment;
import cn.lgx.yougou.base.BaseInterface;
import cn.lgx.yougou.bean.GoodsBean;
import cn.lgx.yougou.utils.DialogUtils;
import cn.lgx.yougou.utils.TextUtils;
public class FenLeiFragment extends BaseFragment implements BaseInterface {
private String numberkey ="";
@ViewInject(R.id.fragment_fenlei_et)
private EditText etinfo;
@SuppressLint("InflateParams")
@Override
public View getfragmentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_fenlei, null);
ViewUtils.inject(this, view);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
initViews();
initDatas();
initViewOper();
}
@Override
public void initDatas() {
}
@Override
public void initViewOper() {
}
//搜索操作 复合查询,可根据商品编号和商品相关内容搜索
@OnClick(R.id.fragment_fenlei_sousuo)
public void searchInfoOnClick(View v){
final String info = etinfo.getText().toString().trim();
if (info==null||"".equals(info)) {
toastS("请输入检索数据");
return;
}
numberkey = "10";
BmobQuery<GoodsBean> eq1 = new BmobQuery<GoodsBean>();
eq1.addWhereEqualTo("number", info);
BmobQuery<GoodsBean> eq2 = new BmobQuery<GoodsBean>();
eq2.addWhereContains("info", info);
List<BmobQuery<GoodsBean>> queries = new ArrayList<BmobQuery<GoodsBean>>();
queries.add(eq1);
queries.add(eq2);
BmobQuery<GoodsBean> query = new BmobQuery<GoodsBean>();
query.or(queries);
query.findObjects(getActivity(), new FindListener<GoodsBean>() {
@Override
public void onSuccess(List<GoodsBean> data) {
if (data != null && data.size() > 0) {
String key = "findGoodsBean";
// 检索数据
MyApplication.putData(key, data);
// 跳转界面
Intent intent = new Intent(getActivity(), FenLeiActivity.class);
intent.putExtra("key", key);
intent.putExtra("NumberKey", numberkey);
intent.putExtra("title_Str", TextUtils.textLengthMax(info));
etinfo.setText("");
startActivity(intent);
} else {
toastS("对不起,没有相关内容");
return;
}
}
@Override
public void onError(int arg0, String arg1) {
}
});
}
@Override
public void initViews() {
}
//不同分类的监听
@OnClick({ R.id.fragment_fenlei_yudong, R.id.fragment_fenlei_huwai, R.id.fragment_fenlei_nvxie,
R.id.fragment_fenlei_nanxie, R.id.fragment_fenlei_nanzhuang, R.id.fragment_fenlei_nvzhuang,
R.id.fragment_fenlei_tongz, R.id.fragment_fenlei_xiangb, R.id.fragment_fenlei_jiaju ,R.id.fragment_fenlei_tuijian})
public void OnClick(View v) {
switch (v.getId()) {
case R.id.fragment_fenlei_yudong:
numberkey = "1";
getdatas("运动");
break;
case R.id.fragment_fenlei_huwai:
numberkey = "2";
getdatas("户外");
break;
case R.id.fragment_fenlei_nvxie:
numberkey = "3";
getdatas("女鞋");
break;
case R.id.fragment_fenlei_nanxie:
numberkey = "4";
getdatas("男鞋");
break;
case R.id.fragment_fenlei_nanzhuang:
numberkey = "5";
getdatas("男装");
break;
case R.id.fragment_fenlei_nvzhuang:
numberkey = "6";
getdatas("女装");
break;
case R.id.fragment_fenlei_tongz:
numberkey = "7";
getdatas("童装");
break;
case R.id.fragment_fenlei_xiangb:
numberkey = "8";
getdatas("箱包");
break;
case R.id.fragment_fenlei_jiaju:
numberkey = "9";
getdatas("家居");
break;
case R.id.fragment_fenlei_tuijian:
numberkey = "11";
getdatas("热门推荐");
break;
}
}
//得到搜索商品的数据源
private void getdatas(String string) {
BmobQuery<GoodsBean> query = new BmobQuery<GoodsBean>();
query.addWhereEqualTo("type", string);
DialogUtils.showDialog(getActivity(), null, null, true);
query.findObjects(getActivity(), new FindListener<GoodsBean>() {
@Override
public void onSuccess(List<GoodsBean> arg0) {
DialogUtils.dismiss();
if (arg0 != null && arg0.size() > 0) {
String key = "findGoodsBean";
// 检索数据
MyApplication.putData(key, arg0);
// 跳转界面
Intent intent = new Intent(getActivity(), FenLeiActivity.class);
intent.putExtra("key", key);
intent.putExtra("NumberKey", numberkey);
startActivity(intent);
} else {
toastS("对不起,没有相关内容");
}
}
@Override
public void onError(int arg0, String arg1) {
DialogUtils.dismiss();
}
});
}
}
| [
"[email protected]"
] | |
db5a1f9b67986ce8a6f64b390e08d058bf055f02 | 30b2eba9a7b563509fff637e10b8879c10657a76 | /web/box-front/src/main/java/com/boxamazing/webfront/util/CheckCode.java | 53c91a82381382a77062d7578504e63f0bf9757c | [] | no_license | hecj/box | 73f60c11c293cac4a66b9b0b33ba79ff5aadfc2d | e59cc1cceb238b1a6d5b35ae8a98b68b7da5918f | refs/heads/master | 2020-09-24T06:11:08.248173 | 2016-08-25T05:55:48 | 2016-08-25T05:55:48 | 66,528,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,354 | java | package com.boxamazing.webfront.util;
import java.io.Serializable;
/**
* 存验证码的VO对象
*/
public class CheckCode implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 手机验证码session key
*/
public static final String PHONE_CODE = "PHONE_CODE";
/**
* 邮箱验证码session key
*/
public static final String EMAIL_CODE = "EMAIL_CODE";
/**
* 用户id
*/
private Long user_id;
/**
* 验证码
*/
private String randomCode ;
/**
* 手机号
*/
private String phone;
/**
* 邮箱
*/
private String email;
/**
* 发送时间
*/
private Long sendTime;
public Long getUser_id() {
return user_id;
}
public void setUser_id(Long user_id) {
this.user_id = user_id;
}
public String getRandomCode() {
return randomCode;
}
public void setRandomCode(String randomCode) {
this.randomCode = randomCode;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Long getSendTime() {
return sendTime;
}
public void setSendTime(Long sendTime) {
this.sendTime = sendTime;
}
}
| [
"[email protected]"
] | |
7f3ef1d123da625d52080b6d1af6c830a994fb38 | aee352da4736a6effca3beee0aaec634a50373ce | /app/src/main/java/com/example/reminiscence/GalleryDatabase.java | 666916bdc907f07b1f53dfc47e4240cacb6a6084 | [] | no_license | berniBZS/Reminiscence | 40b63cb2e98a44c0715032bfee0451a1e9ca370d | 26b93897146862aeffd7bc777df62b526cf434df | refs/heads/main | 2023-04-27T07:39:26.128703 | 2021-05-13T11:58:29 | 2021-05-13T11:58:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,244 | java | package com.example.reminiscence;
import android.content.Context;
import android.os.AsyncTask;
import android.provider.MediaStore;
import androidx.annotation.NonNull;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import androidx.sqlite.db.SupportSQLiteDatabase;
@Database(entities = {PhotoName.class}, version = 1)
public abstract class GalleryDatabase extends RoomDatabase {
public abstract PhotoNameDao photoNameDao();
private static GalleryDatabase instance;
public static synchronized GalleryDatabase getInstance(Context context) {
if (instance == null) {
instance = Room.databaseBuilder(context.getApplicationContext(),
GalleryDatabase.class, "gallery_database")
.fallbackToDestructiveMigration()
.addCallback(roomCallback)
.build();
}
return instance;
}
private static RoomDatabase.Callback roomCallback = new RoomDatabase.Callback(){
@Override
public void onCreate(@NonNull SupportSQLiteDatabase db) {
super.onCreate(db);
new PopulateDBAsyncTask(instance).execute();
}
};
private static class PopulateDBAsyncTask extends AsyncTask<Void, Void, Void> {
private PhotoNameDao photoNameDao;
PopulateDBAsyncTask(GalleryDatabase db){
photoNameDao = db.photoNameDao();
}
@Override
protected Void doInBackground(Void... voids) {
//photoNameDao.insert(new PhotoName("content://com.android.providers.downloads.documents/document/msf%3A34", "brad"));
//photoNameDao.insert(new PhotoName("content://com.android.providers.downloads.documents/document/msf%3A33", "amigo1"));
//photoNameDao.insert(new PhotoName("content://com.android.providers.downloads.documents/document/msf%3A32", "amiga2"));
//photoNameDao.insert(new PhotoName("content://com.android.providers.downloads.documents/document/msf%3A31", "nieto"));
//photoNameDao.insert(new PhotoName("content://com.android.providers.downloads.documents/document/msf%3A35", "nieta"));
return null;
}
}
}
| [
"[email protected]"
] | |
7b7cae5bd721487e3155493872834b29aa832b75 | a334dec57cb99bfcfb2e4d39cfea13cfa0064e2b | /src/main/java/com/crs4/sem/rest/SemanticEngineRestResources.java | 3aa59338bd55e65f642fdd7bc53a7d4a8e66a1f1 | [] | no_license | natcrs4/fast-semantic-engine | 1ae45e7c40c36904f4dff114fbab57d020b49248 | fd7dc6bdc910637f02a4a51f2eb20afcfac23333 | refs/heads/master | 2021-01-14T04:57:06.984198 | 2020-05-19T09:24:47 | 2020-05-19T09:24:47 | 242,605,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,899 | java | package com.crs4.sem.rest;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;
import javax.inject.Inject;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.crs4.sem.model.Document;
import com.crs4.sem.model.Documentable;
import com.crs4.sem.model.NewDocument;
import com.crs4.sem.model.NewSearchResult;
import com.crs4.sem.model.SearchResult;
import com.crs4.sem.service.SemanticEngineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
@Path("/semantics")
@Api(value = "Semantics", description = "Resources api for semantic processing of documents")
@Data
public class SemanticEngineRestResources {
@Inject
private SemanticEngineService documentService;
@Inject
private Logger log;
@GET
@Path("/search")
@ApiOperation(value = "semantic search",
notes = "Search document from a store matching text",
response = SearchResult.class)
@Produces(MediaType.APPLICATION_JSON)
public NewSearchResult searchText(@QueryParam("text") String text,@QueryParam("entities") @DefaultValue("false") Boolean entities,@QueryParam("start") @DefaultValue("0") Integer start,@QueryParam("maxresults") @DefaultValue("1000") Integer maxresults, @QueryParam("from") String from, @QueryParam("to") String to) throws IOException, ParseException {
log.info("classify text" + text);
Date from_date=null;
Date to_date=null;
SimpleDateFormat df = new SimpleDateFormat( "yyyy-MM-dd" );
if(from!=null)
from_date=df.parse(from);
if(to!=null)
to_date=df.parse(to);
NewSearchResult searchResult = this.documentService.semanticSearch(text,start,maxresults);
return searchResult;
}
@GET
@Path("/similars/{id}")
@ApiOperation(value = "get similars",
notes = "Search similar documents to document id",
response = Document.class)
@Produces(MediaType.APPLICATION_JSON)
public List<NewDocument> similars(@PathParam("id") Long id,@QueryParam("start") @DefaultValue("0") Integer start,@QueryParam("maxresults") @DefaultValue("1000") Integer maxresults) throws IOException, ParseException {
log.info("searching similars to document id :" + id);
Documentable doc=this.documentService.get(id,false);
// doc.get
//List<Document> docs = this.documentService.semanticSearch(doc,start,maxresults);
List<NewDocument> docs=null;
return docs;
}
@GET
@Path("/buildgraph")
@ApiOperation(value = "build entity graph",
notes = "Build graph using entities")
public Response buildGraph() {
this.documentService.buildGraph();
return Response.ok().build();
}
}
| [
"mario@jortis"
] | mario@jortis |
106b38cd082dff04dbf32bf903a25cb0391a3d40 | e58a321ab122cfa44bb7482edef923a5fb12a5e7 | /src/main/java/cm/inet/Web/EmployeController.java | fe6893eb3686b55e35fbc1fd357f996d9ec2978a | [] | no_license | FranckLibaski/gestionDepartement | 34f68fb8349b0252149363992aec13b86496fa94 | 3c784abc36fbedff3f80c569094fea25202387e3 | refs/heads/main | 2023-04-16T12:32:01.626492 | 2021-04-23T13:31:19 | 2021-04-23T13:31:19 | 360,893,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,598 | java | package cm.inet.Web;
import cm.inet.Entities.Employe;
import cm.inet.Entities.UpdateEmploye;
import cm.inet.Services.EmployeReport;
import cm.inet.Services.EmployeService;
import net.sf.jasperreports.engine.JRException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.FileNotFoundException;
import java.util.List;
@RestController
@CrossOrigin("*")
@RequestMapping(value = "/employe")
public class EmployeController {
@Autowired
private EmployeService employeService;
@Autowired
private EmployeReport employeReport;
@GetMapping
public List<Employe> get() {
return employeService.getEmployes();
}
@PostMapping
public Employe post(@RequestBody Employe employe) {
return employeService.createEmploye(employe);
}
@GetMapping(value = "/{id}")
public Employe getById(@PathVariable("id") Long id) {
return employeService.getEmployeById(id);
}
@DeleteMapping(value = "/{id}")
public Employe delete(@PathVariable("id") Long id) {
return employeService.deleteEmploye(id);
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public Employe put(@PathVariable("id") Long id, @RequestBody UpdateEmploye updateEmploye) {
return employeService.updateEmploye(id, updateEmploye);
}
@GetMapping(value = "/report/{format}")
public String reportGenerate(@PathVariable("format") String format) throws FileNotFoundException, JRException {
return employeReport.exportReport(format);
}
}
| [
"[email protected]"
] | |
029ac8aa0ab15defaf0a676ba6d3afa3b80de225 | 0d0a976fb5b0b9ade8c538445a03736bc1e4730c | /goldenRaspeberry/src/main/java/com/texoit/goldenRaspeberry/exception/ErroAplicacaoException.java | 9aa665ea74ee39c4612c3753e9641f9ba37ee608 | [] | no_license | Nissaum/texoit_teste | 388eb0c951f1401a68066455ad6b60947f8fc7f9 | 4b5cec4948c249386f22f2644ed58ef49440f165 | refs/heads/main | 2023-06-26T04:46:30.878997 | 2021-07-29T14:48:59 | 2021-07-29T14:48:59 | 369,347,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.texoit.goldenRaspeberry.exception;
/**
* ErroAplicacaoException
* @author Vinicius Alvarenga
*
*/
public class ErroAplicacaoException extends RuntimeException {
private static final long serialVersionUID = 1L;
public ErroAplicacaoException(String message) {
super(message);
}
public ErroAplicacaoException(Throwable t) {
super(t);
}
}
| [
"[email protected]"
] | |
b8b792418599865003e2a9287b8ba957706b4c46 | fff8f77f810bbd5fb6b4e5f7a654568fd9d3098d | /src/main/java/kotlin/reflect/jvm/internal/impl/load/kotlin/KotlinClassFinder.java | bb445b163e5eb4696c7a045b1e8e772d1cacd319 | [] | no_license | TL148/gorkiy | b6ac8772587e9e643d939ea399bf5e7a42e89f46 | da8fbd017277cf72020c8c800326954bb1a0cee3 | refs/heads/master | 2021-05-21T08:24:39.286900 | 2020-04-03T02:57:49 | 2020-04-03T02:57:49 | 252,618,229 | 0 | 0 | null | 2020-04-03T02:54:39 | 2020-04-03T02:54:39 | null | UTF-8 | Java | false | false | 3,507 | java | package kotlin.reflect.jvm.internal.impl.load.kotlin;
import java.util.Arrays;
import kotlin.jvm.internal.Intrinsics;
import kotlin.reflect.jvm.internal.impl.load.java.structure.JavaClass;
import kotlin.reflect.jvm.internal.impl.name.ClassId;
import kotlin.reflect.jvm.internal.impl.serialization.deserialization.KotlinMetadataFinder;
/* compiled from: KotlinClassFinder.kt */
public interface KotlinClassFinder extends KotlinMetadataFinder {
Result findKotlinClassOrContent(JavaClass javaClass);
Result findKotlinClassOrContent(ClassId classId);
/* compiled from: KotlinClassFinder.kt */
public static abstract class Result {
private Result() {
}
public /* synthetic */ Result(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final KotlinJvmBinaryClass toKotlinJvmBinaryClass() {
KotlinClass kotlinClass = (KotlinClass) (!(this instanceof KotlinClass) ? null : this);
if (kotlinClass != null) {
return kotlinClass.getKotlinJvmBinaryClass();
}
return null;
}
/* compiled from: KotlinClassFinder.kt */
public static final class KotlinClass extends Result {
private final KotlinJvmBinaryClass kotlinJvmBinaryClass;
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof KotlinClass) && Intrinsics.areEqual(this.kotlinJvmBinaryClass, ((KotlinClass) obj).kotlinJvmBinaryClass);
}
return true;
}
public int hashCode() {
KotlinJvmBinaryClass kotlinJvmBinaryClass2 = this.kotlinJvmBinaryClass;
if (kotlinJvmBinaryClass2 != null) {
return kotlinJvmBinaryClass2.hashCode();
}
return 0;
}
public String toString() {
return "KotlinClass(kotlinJvmBinaryClass=" + this.kotlinJvmBinaryClass + ")";
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public KotlinClass(KotlinJvmBinaryClass kotlinJvmBinaryClass2) {
super(null);
Intrinsics.checkParameterIsNotNull(kotlinJvmBinaryClass2, "kotlinJvmBinaryClass");
this.kotlinJvmBinaryClass = kotlinJvmBinaryClass2;
}
public final KotlinJvmBinaryClass getKotlinJvmBinaryClass() {
return this.kotlinJvmBinaryClass;
}
}
/* compiled from: KotlinClassFinder.kt */
public static final class ClassFileContent extends Result {
private final byte[] content;
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof ClassFileContent) && Intrinsics.areEqual(this.content, ((ClassFileContent) obj).content);
}
return true;
}
public int hashCode() {
byte[] bArr = this.content;
if (bArr != null) {
return Arrays.hashCode(bArr);
}
return 0;
}
public String toString() {
return "ClassFileContent(content=" + Arrays.toString(this.content) + ")";
}
public final byte[] getContent() {
return this.content;
}
}
}
}
| [
"[email protected]"
] | |
70f37682f9bd41dfa7f21debe58fd3f7f636c514 | 0b9a1c2ddab3fb4bad58dfa4a0dc1c6df339c87e | /src/main/java/com/rejoice/blog/bean/http/ebook300/DownloadUrlInput.java | e805f1516d145ee2ca09afe26a65c619ba090b59 | [] | no_license | rejoiceFromJesus/rejoice-blog | 1b080dcfed458634cb01d7d23c87ca57f2f6a3b7 | a72a4723360c931b8d8c3c84fc6dc4cfa92bd212 | refs/heads/master | 2020-03-11T22:48:37.487462 | 2019-01-21T14:20:17 | 2019-01-21T14:20:17 | 108,060,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 666 | java | package com.rejoice.blog.bean.http.ebook300;
public class DownloadUrlInput {
private String op = "download2";
private String id;
private String rand;
private String down_script = "1";
public String getOp() {
return op;
}
public void setOp(String op) {
this.op = op;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRand() {
return rand;
}
public void setRand(String rand) {
this.rand = rand;
}
public String getDown_script() {
return down_script;
}
public void setDown_script(String down_script) {
this.down_script = down_script;
}
}
| [
"[email protected]"
] | |
1db91ece22b5918fc5d2d73564232d511dbf55da | c023c443c53cfe4206242265c2df0ac1d168aff9 | /src/main/java/lucas/introjava/Ejercicio8.java | b3c8b7317a663fac9f1201d1a9357980bb68d174 | [] | no_license | Mariana-Saubidet/Java-Egg | 1dcb13eff7653173ee570fae4057e1a097816982 | c0d5d7cfbe44245fdd6523a3b2faa1a96da70ed0 | refs/heads/main | 2023-06-18T06:20:10.199070 | 2021-07-15T18:09:27 | 2021-07-15T18:09:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 486 | java | package lucas.introjava;
import java.util.Scanner;
public class Ejercicio8 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Ingrese un numero");
double numero = scan.nextDouble();
scan.close();
if (numero % 2 == 0) {
System.out.println("El numero " + numero + " es par");
} else {
System.out.println("El numero " + numero + " es impar");
}
}
} | [
"[email protected]"
] | |
178c0d9cff11a04a17e7648827be7bd3b8ec9df5 | cb303468171b2d67b98dbcf0b47fe894d1daeeaf | /src/main/java/future/Test.java | ddb0ddd0e23d07983142f27e0b134231fe147e40 | [] | no_license | InkInn/snail | b46d192afb7664e3c5408296dea5ba90f00bcdcb | c58ada0cb76e5146ee9bfb7a4861d0d630285de7 | refs/heads/master | 2022-12-21T13:28:59.221954 | 2020-06-21T03:06:34 | 2020-06-21T03:06:34 | 144,343,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,614 | java | package future;
import bean.AlbumInfo;
import bean.ResultInfo;
import bean.TrackInfo;
import bean.UserInfo;
import java.time.Duration;
import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
public class Test {
public static void main(String[] args) throws InterruptedException, TimeoutException, ExecutionException {
// // 步骤1
// // ......
//
// // 步骤2.1
// ResultInfo resultInfo = new ResultInfo();
// CompletableFuture<TrackInfo> trackInfoFuture = getTrackInfo(11111L, "声音",resultInfo);
// CompletableFuture<AlbumInfo> albumInfoFuture = getAlbumInfo(22222L, "专辑",resultInfo);
// CompletableFuture<UserInfo> userInfoFuture = getUserInfo(33333L, "小明",resultInfo);
//// CompletableFuture<ResultInfo> resultInfoFuture = trackInfoFuture.thenCombine(albumInfoFuture, (trackInfo, albumInfo) -> {
//// System.out.println("combine1 " + Thread.currentThread().getName());
//// ResultInfo resultInfo = new ResultInfo();
//// resultInfo.setAlbumInfo(albumInfo);
//// resultInfo.setTrackInfo(trackInfo);
//// return resultInfo;
//// }).thenCombineAsync(userInfoFuture, (resultInfo, userInfo) -> {
//// System.out.println("combine2 " + Thread.currentThread().getName());
//// resultInfo.setUserInfo(userInfo);
//// return resultInfo;
//// });
// CompletableFuture.allOf(trackInfoFuture,albumInfoFuture,userInfoFuture).get(1000,TimeUnit.MILLISECONDS);
//
//// System.out.println(albumInfoFuture.join());
//// Thread.sleep(3000);
//
// // 步骤2.2
//
// // 步骤2.3
//
// // 步骤3
// // ....
//// ResultInfo resultInfo = resultInfoFuture.get(1000, TimeUnit.MILLISECONDS);
// System.out.println(JSON.toJSONString(resultInfo));
Arrays.asList(2,3).add(1);
}
private static CompletableFuture<ResultInfo> getResultInfo() {
return CompletableFuture.supplyAsync(() -> {
ResultInfo resultInfo = new ResultInfo();
return resultInfo;
});
}
private static CompletableFuture<TrackInfo> getTrackInfo(long trackId, String trackName,ResultInfo resultInfo) {
return CompletableFuture.supplyAsync(() -> {
TrackInfo trackInfo = new TrackInfo();
trackInfo.setTrackId(trackId);
trackInfo.setTrackName(trackName);
resultInfo.setTrackInfo(trackInfo);
return trackInfo;
});
}
private static CompletableFuture<UserInfo> getUserInfo(long userId, String userName,ResultInfo resultInfo) {
return CompletableFuture.supplyAsync(() -> {
UserInfo userInfo = new UserInfo();
userInfo.setUserId(userId);
userInfo.setUserName(userName);
resultInfo.setUserInfo(userInfo);
return userInfo;
});
}
private static CompletableFuture<AlbumInfo> getAlbumInfo(long albumId, String albumName,ResultInfo resultInfo) {
return CompletableFuture.supplyAsync(() -> {
try {
return CompletableFuture.supplyAsync(() -> {
AlbumInfo albumInfo = new AlbumInfo();
albumInfo.setAlbumId(albumId);
albumInfo.setAlbumName(albumName);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
resultInfo.setAlbumInfo(albumInfo);
return albumInfo;
}).get(1000, TimeUnit.MILLISECONDS);
} catch (Exception e) {
// e.printStackTrace();
}
return null;
});
}
private static CompletableFuture<AlbumInfo> getAlbumInfo2(long albumId, String albumName) {
CompletableFuture<AlbumInfo> future = CompletableFuture.supplyAsync(() -> {
AlbumInfo albumInfo = new AlbumInfo();
albumInfo.setAlbumId(albumId);
albumInfo.setAlbumName(albumName);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return albumInfo;
});
return FutureUtils.within(future, Duration.ofMillis(100)).exceptionally(e -> {
return null;
});
}
}
| [
"[email protected]"
] | |
b6711859ef4b2fa6508c1cf36f5ba8a30ed5a4eb | 5105b9280079c882c26835872805469b974f1f2b | /src/main/java/feed/ImageInformation.java | b5c67c1896b5dbf2333e99d7516ca116053664f3 | [] | no_license | ZarinaBozhyk/thefeedfeed_api_framework1 | e1cb3d1fa6d7045e6bb9c73b9d1fa6738479769b | ce7d0a061b6391204afcf70dae90bb1cad8c3bf1 | refs/heads/master | 2021-07-08T06:59:48.005579 | 2020-08-18T09:48:07 | 2020-08-18T09:48:07 | 244,440,469 | 0 | 0 | null | 2021-06-07T18:42:04 | 2020-03-02T18:07:56 | JavaScript | UTF-8 | Java | false | false | 419 | java | package feed;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ImageInformation {
@JsonProperty("created_at")
private String createdAt;
String description;
String name;
String rating;
@JsonProperty("updated_at")
private String updatedAt;
} | [
"[email protected]"
] | |
ba52213ead4d8ba53398a09c8238e0a3277b2771 | 01a9c946a6a076d89142b5fcd14774783026addf | /animationdemo/src/main/java/com/example/animationdemo/CircleRevealActivity.java | c65416916c0f43589a13d3dedc002110b594fc8f | [] | no_license | IntYL/UItest | 6007e29dc77708e874f5000cf3eb2b9d30eddee3 | 8d4bf1e11364ae8b43f55b7e4e127ccdbec7cf2b | refs/heads/master | 2021-06-13T19:27:50.409487 | 2021-04-21T06:54:26 | 2021-04-21T06:54:26 | 191,126,458 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,428 | java | package com.example.animationdemo;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.nfc.Tag;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.animation.Animation;
import android.widget.ImageView;
import androidx.annotation.Nullable;
public class CircleRevealActivity extends Activity {
private ImageView myView;
private boolean reveal = false;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reveal_layout);
myView = findViewById(R.id.my_image);
myView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (reveal){
reveal = false;
// translateX();
unreveal();
}else {
reveal = true;
reveal();
//translateY();
}
}
});
}
private void reveal(){
// previously invisible view
// Check if the runtime version is at least Lollipop
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// get the center for the clipping circle
int cx = myView.getWidth() / 2;
int cy = myView.getHeight() / 2;
// get the final radius for the clipping circle
float finalRadius = (float) Math.hypot(cx, cy);
// create the animator for this view (the start radius is zero)
Animator anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0f, finalRadius/2).setDuration(5000);
// make the view visible and start the animation
myView.setVisibility(View.VISIBLE);
anim.start();
} else {
// set the view to invisible without a circular reveal animation below Lollipop
myView.setVisibility(View.INVISIBLE);
}
}
private void unreveal(){
// previously visible view
// Check if the runtime version is at least Lollipop
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// get the center for the clipping circle
int cx = myView.getWidth() / 2;
int cy = myView.getHeight() / 2;
// get the initial radius for the clipping circle
float initialRadius = (float) Math.hypot(cx, cy);
// create the animation (the final radius is zero)
Animator anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, initialRadius/2).setDuration(5000);
// make the view invisible when the animation is done
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
myView.setVisibility(View.VISIBLE);
}
});
// start the animation
anim.start();
} else {
// set the view to visible without a circular reveal animation below Lollipop
myView.setVisibility(View.VISIBLE);
}
}
private void translateX(){
ObjectAnimator animator = ObjectAnimator.ofFloat(myView,"translationX",100f);
animator.setDuration(5000);
animator.start();
final ObjectAnimator animator1 = ObjectAnimator.ofFloat(myView,"translationY",100f);
animator1.setDuration(5000);
animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
/*int y = (int)animation.getAnimatedValue("y");
int x = (int)animation.getAnimatedValue("x");
Log.w("lala","X:"+x+" Y:"+y);*/
float y = myView.getY();
float x = myView.getX();
Log.w("lala","X:"+x+" Y:"+y);
}
});
animator1.start();
}
private void translateY(){
//这里的transLationX是最终值
ObjectAnimator animator = ObjectAnimator.ofFloat(myView,"translationX",500f);
animator.setDuration(5000);
animator.start();
ObjectAnimator animator1 = ObjectAnimator.ofFloat(myView,"translationY",500f);
animator1.setDuration(5000);
animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
/*int y = (int)animation.getAnimatedValue("y");
int x = (int)animation.getAnimatedValue("x");
Log.w("lala","X:"+x+" Y:"+y);*/
float y = myView.getY();
float x = myView.getX();
Log.w("lala","X:"+x+" Y:"+y);
}
});
animator1.start();
}
public static void startActivity(Context context, Intent intent){
context.startActivity(intent);
}
}
| [
"[email protected]"
] | |
e0ea3a7bf8a8019fed2b0d8f551293fbe2d34dd0 | 23de2c10f72a30ade795ac8d4d7923036c575de5 | /src/org/anddev/andengine/opengl/view/LogWriter.java | 240deb1107c2ec23231a4aea9f7691279bab08d0 | [] | no_license | PARTHIBANMS/com.divmob.doodlebubble | a2c179ad9aa762668c69c0302bb17958e895148e | 4718ee64c5edc9bcfc95861754ad9b876bd7fd5d | refs/heads/master | 2020-06-04T22:30:50.560385 | 2014-07-17T10:39:23 | 2014-07-17T10:39:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | package org.anddev.andengine.opengl.view;
import android.util.Log;
import java.io.Writer;
class LogWriter
extends Writer
{
private final StringBuilder mBuilder = new StringBuilder();
private void flushBuilder()
{
if (this.mBuilder.length() > 0)
{
Log.v("GLSurfaceView", this.mBuilder.toString());
this.mBuilder.delete(0, this.mBuilder.length());
}
}
public void close()
{
flushBuilder();
}
public void flush()
{
flushBuilder();
}
public void write(char[] paramArrayOfChar, int paramInt1, int paramInt2)
{
int i = 0;
if (i >= paramInt2) {
return;
}
char c = paramArrayOfChar[(paramInt1 + i)];
if (c == '\n') {
flushBuilder();
}
for (;;)
{
i++;
break;
this.mBuilder.append(c);
}
}
}
/* Location: C:\Users\PARTHIBAN\Desktop\source\dex2jar-0.0.9.15\classes_dex2jar.jar
* Qualified Name: org.anddev.andengine.opengl.view.LogWriter
* JD-Core Version: 0.7.0.1
*/ | [
"[email protected]"
] | |
3e6b80e70f9c548078d2554477f32d7700280ab5 | 0be3ca6d851c1a1a03e982e09438eee102d713a1 | /springcloud/oauth/src/main/java/com/fujinran/service/impl/SysDeptServiceImpl.java | 45764de2649423fd66970bc9d10493da570f32bd | [] | no_license | MSDH233/microservice | 1e3b9d6712f0aef2aa25360bfb17296c695af1b8 | c8b788b5828803d045c687a18d351be881846623 | refs/heads/master | 2023-08-08T22:26:02.089965 | 2019-12-25T17:11:55 | 2019-12-25T17:11:55 | 212,324,365 | 0 | 0 | null | 2023-07-22T17:49:52 | 2019-10-02T11:37:33 | Java | UTF-8 | Java | false | false | 4,635 | java | package com.fujinran.service.impl;
import com.fujinran.domain.SysDept;
import com.fujinran.dto.DeptLevelDto;
import com.fujinran.mapper.SysDeptMapper;
import com.fujinran.service.SysDeptService;
import com.fujinran.utils.LevelUtils;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* Created by FuJinRan on 2019/12/17.
*/
@Service
public class SysDeptServiceImpl implements SysDeptService {
@Autowired
private SysDeptMapper sysDeptMapper ;
@Override
public List<SysDept> findAllDept() {
return sysDeptMapper.selectAll();
}
@Override
public SysDept findDept(SysDept dept) {
return sysDeptMapper.selectByPrimaryKey(dept);
}
@Override
public boolean insertDept(SysDept SysDept) throws Exception{
this.checkDept(SysDept);
return sysDeptMapper.insertSelective(SysDept)>0?true:false ;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean modifyDept(SysDept SysDept) throws Exception {
//注意此功能不支持由上级部门整体并入下级部门
this.checkDept(SysDept);
//更新子部门及当前部门
this.sysDeptMapper.updateByPrimaryKeySelective(SysDept);
this.sysDeptMapper.updateChildDept(SysDept);
return true ;
}
@Override
public boolean deleteDept(SysDept SysDept) {
return sysDeptMapper.deleteByPrimaryKey(SysDept)>0?true:false ;
}
private boolean checkDept(SysDept sysDept) throws Exception{
//级别是一种标志可以抽象成一个interface 然后把这些方法提取出来
//顶级部门
SysDept foundDept = sysDeptMapper.selectByDeptNameAndParentId(sysDept) ;
if(foundDept != null ){
throw new Exception("该上级部门下已存在名称相同的部门");
}
return true ;
}
@Override
public List<DeptLevelDto> deptTree() {
List<SysDept> deptList = sysDeptMapper.selectAll();
List<DeptLevelDto> deptLevelDtoList = Lists.newArrayList();
for(SysDept dept : deptList){
DeptLevelDto deptLevelDto = DeptLevelDto.adapt(dept);
deptLevelDtoList.add(deptLevelDto);
}
return listToTree(deptLevelDtoList);
}
public List<DeptLevelDto> listToTree(List<DeptLevelDto> deptLevelDtoList){
if(CollectionUtils.isEmpty(deptLevelDtoList)){
return null ;
}
Multimap<String,DeptLevelDto> levelDtoMultimap = ArrayListMultimap.create();
List<DeptLevelDto> rootList = Lists.newArrayList();
for(DeptLevelDto dto : deptLevelDtoList){
levelDtoMultimap.put(dto.getLevel(),dto);
if(LevelUtils.getRoot().equals(dto.getLevel())){
rootList.add(dto);
}
}
//排序
Collections.sort(rootList, new DeptComparator());
transformDeptTree(rootList , LevelUtils.getRoot() , levelDtoMultimap);
return rootList ;
}
/*
* 用层级的好处是不止可以表示父子关系,所有的后代或者祖先层级都可以表示
* */
public void transformDeptTree(List<DeptLevelDto> levelList, String level, Multimap<String, DeptLevelDto> levelDtoMultimap) {
for(DeptLevelDto deptLevelDto : levelList){
//获取下一层Level
String nextLevel = LevelUtils.calculateLevel(level,deptLevelDto.getId());
//下一层级实例
List<DeptLevelDto> deptLevelDtoList = (List<DeptLevelDto>)levelDtoMultimap.get(nextLevel);
//下一层不为空
if(!CollectionUtils.isEmpty(deptLevelDtoList)){
//排序
Collections.sort(deptLevelDtoList,new DeptComparator());
//添加
deptLevelDto.setDeptLevelDtoList(deptLevelDtoList);
transformDeptTree(deptLevelDtoList,nextLevel,levelDtoMultimap);
}
}
}
public class DeptComparator implements Comparator<DeptLevelDto> {
@Override
public int compare(DeptLevelDto o1, DeptLevelDto o2) {
return o1.getSeq() - o2.getSeq();
}
}
} | [
"[email protected]"
] | |
faab717d4c782986b2b76c7bbef241c42e39d226 | fdb8593e5eefbb2058699fef41e1a3b644c73c35 | /src/ast/DecrExpr.java | be954244c46090e732b49fef187066b666e14be1 | [] | no_license | MarceloRavache/CompilerQPlusPlus_Voyager | 52b55db2845e88f8a630d388dfa021a17cb02666 | 3df7e58904b5965ac4d4b643f31ea881c64ba4a3 | refs/heads/master | 2020-06-06T15:56:55.649062 | 2019-06-26T03:18:39 | 2019-06-26T03:18:39 | 192,784,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 40 | java | package ast;
public class DecrExpr {
}
| [
"[email protected]"
] | |
21288982326d06340fe4702dc19ad85e4b0c1c0e | 65dda57d8bdb39435f8a3bbe1c5996efa9407f4f | /1002_Selenium_WebDriver_1/src/testing/HelloSelenium.java | fdbca61a076ddb6a3f0fa68679b096318d1d07d5 | [] | no_license | thegeekmonk/Automation | f31c8e7d3a5f257c36578489b9a36d8971f9d220 | 15d13a5338d13bc48680668ef4a0959a289faf26 | refs/heads/master | 2022-12-30T20:41:29.966342 | 2020-10-06T17:10:40 | 2020-10-06T17:10:40 | 292,246,141 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,355 | java | package testing;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import external.PropertiesFile;
public class HelloSelenium {
public static String browser;
public static String serachUrl;
public static WebDriver driver;
public static String expectedTitle = "YouTube";
public static String actualTitle = "";
public static void setFields()
{
PropertiesFile.readFile();
}
public static void setConfiguration()
{
if(browser.equals("Chrome"))
{
System.setProperty("webdriver.chrome.driver","C:\\Users\\AkhileshPC\\Selenium\\1002_Selenium_WebDriver_1\\lib\\chromedriver\\chromedriver.exe");
driver = new ChromeDriver();
}
else if(browser.equals("Edge"))
{
System.setProperty("webdriver.Edge.driver","C:\\Users\\AkhileshPC\\Selenium\\1002_Selenium_WebDriver_1\\lib\\chromedriver\\chromedriver.exe");
driver = new EdgeDriver();
}
}
public static void runTest()
{
driver.get(serachUrl);
actualTitle = driver.getTitle();
if(expectedTitle.equals(actualTitle))
System.out.println("Test Passed !!");
else
System.out.println("Test Failed !!");
}
public static void main(String[] args)
{
// TODO Auto-generated method stub
setFields();
setConfiguration();
runTest();
}
}
| [
"[email protected]"
] | |
27f17212f7fb28ecdd2de9e3dcfe591e53d7fef1 | 0f7527edd650066624d8750589ffb93dcfab0ded | /leet-code/src/main/java/ps/google/array/string/UniqueEmailAddress.java | 11d4c0504e256d264f0a7e5e9515b06d64a2ea15 | [] | no_license | fanqi1909/csreview | 20593f853e797d0b205ade1ebdb082de9a6f0845 | 28b98c105a22cba54491bc63a20a73c96d50fd42 | refs/heads/master | 2021-07-19T02:33:29.376299 | 2020-05-29T08:20:12 | 2020-05-29T08:20:12 | 211,638,980 | 0 | 0 | null | 2020-10-13T16:22:58 | 2019-09-29T09:33:37 | Java | UTF-8 | Java | false | false | 966 | java | package ps.google.array.string;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
public class UniqueEmailAddress {
public int numUniqueEmails(String[] emails) {
Set<String> uniqueEmails = new HashSet<>();
for(String email: emails) {
String[] parts = email.split("@");
String beforePlus = parts[0].split(Pattern.quote("+"))[0];
String sanitizedLocalName = beforePlus.replaceAll(Pattern.quote("."), "");
String sanitizedEmail = sanitizedLocalName + "@" + parts[1];
uniqueEmails.add(sanitizedEmail);
}
return uniqueEmails.size();
}
public static void main(String[] args) {
UniqueEmailAddress solution = new UniqueEmailAddress();
System.out.println( 2 + " === " + solution.numUniqueEmails(new String[]{"[email protected]","[email protected]","[email protected]"}));
}
}
| [
"[email protected]"
] | |
3bde21505052f906bdad4cd501ab03f32a0ae6b7 | afc5bd31f3ab3a4500c799ebe5c85006de7e83f3 | /src/main/java/com/uedsonreis/osworks/domain/exception/EntityNotFoundException.java | 23936aeef144baf96b270be8539e2361325bf354 | [] | no_license | uedsonreis/osworks | 01373bb21b428ff580f31ecff5d37aad02794f69 | e9f6d13c0b0744afceeed4c2c81ec96e68ee0b06 | refs/heads/master | 2022-04-18T19:58:00.221519 | 2020-04-25T14:31:41 | 2020-04-25T14:31:41 | 257,438,888 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package com.uedsonreis.osworks.domain.exception;
public class EntityNotFoundException extends DomainException {
private static final long serialVersionUID = -1988661085759694626L;
public EntityNotFoundException(String message) {
super(message);
}
} | [
"[email protected]"
] | |
26effaff4e64e90b8096a56f2bd6cf9df1789e1e | 475ecf630e78975891386050bd34a44f3443e1b3 | /src/main/java/fi/joonas/veikkaus/service/TournamentService.java | d643a9eaaece3e583c0bfb804cbc0451b195cd2d | [] | no_license | jcastren/veikkaus | 18b9da9f20c39789b549c1d7948902946161e6f4 | bf13fa27463d704d44b8a229e0fb0c75f1b1cb08 | refs/heads/master | 2022-07-17T06:19:12.066405 | 2020-04-18T09:57:53 | 2020-04-18T09:57:53 | 71,035,812 | 0 | 0 | null | 2022-06-20T23:37:19 | 2016-10-16T07:15:23 | CSS | UTF-8 | Java | false | false | 2,360 | java | package fi.joonas.veikkaus.service;
import com.google.common.collect.ImmutableList;
import fi.joonas.veikkaus.dao.TournamentDao;
import fi.joonas.veikkaus.guientity.TournamentGuiEntity;
import fi.joonas.veikkaus.jpaentity.Tournament;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* Business logic level class for DB handling of Tournament
* @author joona
*
*/
@Service
public class TournamentService {
@Autowired
TournamentDao tournamentDao;
/**
*
* @param tournament
* @return
*/
public Long insert(TournamentGuiEntity tournament) {
return tournamentDao.save(convertGuiToDb(tournament)).getId();
}
/**
*
* @param tournament
* @return
*/
public Long modify(TournamentGuiEntity tournament) {
return tournamentDao.save(convertGuiToDb(tournament)).getId();
}
/**
*
* @param id
* @return
*/
public boolean delete(String id) {
boolean succeed = false;
tournamentDao.deleteById(Long.valueOf(id));
succeed = true;
return succeed;
}
/**
*
* @return
*/
public List<TournamentGuiEntity> findAllTournaments() {
List<TournamentGuiEntity> geList = new ArrayList<>();
List<Tournament> dbTourns = ImmutableList.copyOf(tournamentDao.findAll());
for (Tournament dbTourn : dbTourns) {
geList.add(convertDbToGui(dbTourn));
}
return geList;
}
/**
*
* @param id
* @return
*/
public TournamentGuiEntity findOneTournament(String id) {
TournamentGuiEntity tournGe = convertDbToGui(tournamentDao.findById(Long.valueOf(id)).get());
return tournGe;
}
protected static TournamentGuiEntity convertDbToGui(Tournament db) {
TournamentGuiEntity ge = new TournamentGuiEntity();
ge.setId(db.getId().toString());
ge.setName(db.getName());
ge.setYear(Integer.valueOf(db.getYear()).toString());
return ge;
}
protected static Tournament convertGuiToDb(TournamentGuiEntity ge) {
Tournament db = new Tournament();
if (ge.getId() != null && !ge.getId().isEmpty()) {
db.setId(Long.valueOf(ge.getId()));
} else {
db.setId(null);
}
db.setName(ge.getName());
db.setYear(Integer.valueOf(ge.getYear()));
return db;
}
}
| [
"[email protected]"
] | |
efb23b8aed2e857e2221182e3b7bf8abc73b7155 | 3d22c168dcb09546c35a664cace11abf066d2ecd | /src/main/java/com/ipartek/formacion/controller/frontoffice/GuardarProductoFrontOfficeController.java | c88c7aacaeb42a8836f0660447d9ce541cbcc2f9 | [] | no_license | avitoria/super-alfredo | 06321d44b8e1756c50fc6c6490f40f05c3349222 | 99a3c29ac6f736627da43f3be7e670846f2a4f79 | refs/heads/master | 2022-12-29T23:19:43.620409 | 2020-10-09T07:04:55 | 2020-10-09T07:04:55 | 281,039,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,884 | java | package com.ipartek.formacion.controller.frontoffice;
import java.io.IOException;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.Part;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import org.apache.log4j.Logger;
import com.ipartek.formacion.controller.Alerta;
import com.ipartek.formacion.modelo.dao.impl.ProductoDAOImpl;
import com.ipartek.formacion.modelo.pojo.Categoria;
import com.ipartek.formacion.modelo.pojo.Producto;
import com.ipartek.formacion.modelo.pojo.Usuario;
import com.ipartek.formacion.seguridad.SeguridadException;
/**
* Servlet implementation class GuardarProductoFrontOfficeController
*/
@WebServlet("/views/frontoffice/guardar-producto")
@MultipartConfig
public class GuardarProductoFrontOfficeController extends HttpServlet {
private static final long serialVersionUID = 1L;
private final static Logger LOG = Logger.getLogger(GuardarProductoFrontOfficeController.class);
private final static ProductoDAOImpl daoProducto = ProductoDAOImpl.getInstance();
private static ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
private static Validator validator = factory.getValidator();
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// Se crea un nuevo con id = 0 (ver constructor)
Producto producto = new Producto();
Usuario usuario = null;
String view = "formulario.jsp";
int idProducto = Integer.parseInt(request.getParameter("id"));
HttpSession session = request.getSession();
usuario = (Usuario) session.getAttribute("usuario_login");
int idUsuario = usuario.getId();
try {
if (idProducto != 0) {
producto = daoProducto.checkSeguridad(idProducto, idUsuario);
}
} catch (SeguridadException e) {
// Le devolvemos al inicio
view = "/views/frontoffice/inicio";
LOG.error("El usuario " + idUsuario + " ha intentado manipular la URL.");
} catch (Exception e) {
LOG.error(e);
} finally {
request.setAttribute("producto", producto);
request.getRequestDispatcher(view).forward(request, response);
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Producto producto = new Producto();
Usuario usuario = null;
Alerta alerta = null;
String view = "";
// Recuperamos el usuario guardado en la sesión
HttpSession session = request.getSession();
usuario = (Usuario) session.getAttribute("usuario_login");
int idUsuario = usuario.getId();
// Recogemos los campos del formulario
int idProducto = Integer.parseInt(request.getParameter("id"));
String nombre = request.getParameter("nombre");
float precio = Float.parseFloat(request.getParameter("precio"));
// String imagen = request.getParameter("imagen");
Part filePart = request.getPart("fichero");
int idCategoria = Integer.parseInt(request.getParameter("idCategoria"));
try {
// Si el producto existe (id != 0), comprobamos si le pertenece al usuario
if (idProducto != 0) {
// Si el producto no pertenece al usario, se lanza una excepción
// producto = daoProducto.checkSeguridad(idProducto, idUsuario);
daoProducto.checkSeguridad(idProducto, idUsuario);
}
producto = new Producto();
producto.setId(idProducto);
producto.setNombre(nombre);
String nomFichero = filePart.getSubmittedFileName();
producto.setImagen("imagenes/" + nomFichero);
producto.setPrecio(precio);
producto.setCategoria(new Categoria(idCategoria));
producto.setUsuario(usuario);
// Validamos el POJO
Set<ConstraintViolation<Producto>> violations = validator.validate(producto);
if (violations.isEmpty()) {
if (idProducto == 0) {
// Si el id es 0, insertamos un nuevo producto
daoProducto.insert(producto);
alerta = new Alerta("success",
"Producto creado correctamente. El producto será visible una vez sea validado.");
} else {
// Si el id es distinto de 0, actualizamos el producto
daoProducto.updateByUser(producto);
alerta = new Alerta("success",
"Producto actualizado correctamente. Los cambios serán visibles una vez sean validados.");
}
// Después de insertar o actualizar, devolvemos al usuario al inicio
view = "/views/frontoffice/inicio";
} else {
String errores = "";
for (ConstraintViolation<Producto> v : violations) {
errores += "<p><b>" + v.getPropertyPath() + "</b>: " + v.getMessage() + "</p>";
}
alerta = new Alerta("danger", errores);
// Devolvemos al usuario al formulario para que corrija los errores
view = "formulario.jsp";
}
} catch (SeguridadException e) {
LOG.error("El usuario " + idUsuario + " ha intentado manipular la URL.");
// Devolvemos al usuario al inicio, sin darle ningún mensaje (alerta)
view = "/views/frontoffice/inicio";
} catch (Exception e) {
LOG.error(e);
alerta = new Alerta("danger", "ERROR: ya existe un producto con ese nombre.");
// Devolvemos al usuario al formulario para que ponga otro nombre
view = "formulario.jsp";
} finally {
request.setAttribute("producto", producto);
request.setAttribute("alerta", alerta);
request.getRequestDispatcher(view).forward(request, response);
}
}
}
| [
"[email protected]"
] | |
a8c12148045ef4defa3eaac059fe485e67661d6e | c47d97b1b0cf94fa19dce9d3bd49a171731b45ef | /voyager/src/main/java/pk/home/voyager/dao/LTypeDAO.java | b75e0ad74ae6e2e384c7cdaad71df6d6389720dd | [] | no_license | povloid/voyager | efdb3e1b197351ac8b5bab8ec298f77d87ba5171 | 5004a23a780c488300d1880d49bbf77012078be2 | refs/heads/master | 2016-09-06T10:58:17.225375 | 2011-11-04T14:53:10 | 2011-11-04T14:53:10 | 2,067,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | /**
*
*/
package pk.home.voyager.dao;
import pk.home.pulibs.basic.intefaces.dao.DAOCRUDFunctional;
import pk.home.voyager.domain.LType;
/**
* @author traveler
*
*/
public interface LTypeDAO extends DAOCRUDFunctional<LType> {
}
| [
"[email protected]"
] | |
bc5e8aa95dae789e19e1cecfa04ef131456a6172 | 7f3c3e8ae24fd04515cfea416ca9f5e659dc28a7 | /src/test/java/testCases/TodoLyTest.java | bb45f307da0a5e65421a1f126e0b8709209f8999 | [] | no_license | RoyGuido/ucb_owasap | f913495422f270517d55f0e8be2edee2a14ee41f | c5e29a16e25d832ddc6c7e4dcc6c172bf1b62ee3 | refs/heads/master | 2023-07-06T18:26:07.306889 | 2021-08-14T04:40:22 | 2021-08-14T04:40:22 | 395,890,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,285 | java | package testCases;
import io.qameta.allure.Description;
import io.qameta.allure.Issue;
import io.qameta.allure.Link;
import io.qameta.allure.Severity;
import io.qameta.allure.SeverityLevel;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import pageObject.LoginModal;
import pageObject.MainPage;
import session.Session;
public class TodoLyTest {
MainPage mainPage = new MainPage();
LoginModal loginModal= new LoginModal();
@BeforeEach
public void before(){
Session.getInstance().getDriver().get("https://todo.ly/");
Session.getInstance().maxime();
}
@DisplayName("Verificar la ejecución del LOGIN")
@Description("Este test cases es para verificar...........")
@Link("jira00000")
@Issue("BUG0000")
@Severity(SeverityLevel.CRITICAL)
@Test
public void verifyTheProjectIsLogged(){
mainPage.loginButton.click();
loginModal.emailTextBox.setValue("[email protected]");
loginModal.passwordTextBox.setValue("0000");
loginModal.loginButton.click();
//Verificaciones ........
}
@AfterEach
public void after(){
Session.getInstance().closeSession();
}
}
| [
"[email protected]"
] | |
86b10e734ca232a1cba071d4a45659f151c27c32 | 7ee19bd4c205a48f23f00d8255bcfb0c6d529267 | /facecat_java/src/facecat/topin/grid/FCGridRowCompare.java | 33a110b90f9a6a41575b3a29a8c0d6e69eb02ed6 | [
"BSD-2-Clause"
] | permissive | donnieyoung/facecat | 0dedf4cede883d9b6f6d79029be4ca15c8b2060b | 599a586be3d7dbf6d239f8d6b93acacd3cd4b1d9 | refs/heads/master | 2020-06-03T22:34:39.023738 | 2019-06-11T03:04:34 | 2019-06-11T03:04:34 | 191,758,818 | 1 | 1 | BSD-2-Clause | 2019-06-13T12:28:42 | 2019-06-13T12:28:42 | null | UTF-8 | Java | false | false | 1,297 | java | /*捂脸猫FaceCat框架 v1.0
1.创始人-矿洞程序员-上海宁米科技创始人-脉脉KOL-陶德 (微信号:suade1984);
2.联合创始人-上海宁米科技创始人-袁立涛(微信号:wx627378127);
3.联合创始人-河北思尔企业管理咨询有限公司合伙人-肖添龙(微信号:xiaotianlong_luu);
4.联合开发者-陈晓阳(微信号:chenxiaoyangzxy),助理-朱炜(微信号:cnnic_zhu);
5.该框架开源协议为BSD,欢迎对我们的创业活动进行各种支持,欢迎更多开发者加入。
包含C/C++,Java,C#,iOS,MacOS,Linux六个版本的图形和通讯服务框架。
*/
package facecat.topin.grid;
/**
* 表格排序类
*/
public class FCGridRowCompare implements java.util.Comparator<FCGridRow> {
/**
* 列索引
*/
public int m_columnIndex;
/**
* 类型
*/
public int m_type;
/**
* 比较方法
*
* @param x 行X
* @param y 行Y
* @returns 结果
*/
public int compare(FCGridRow x, FCGridRow y) {
FCGridCell cellLeft = x.getCell(m_columnIndex);
FCGridCell cellRight = y.getCell(m_columnIndex);
if (m_type == 0) {
return cellLeft.compareTo(cellRight);
} else {
return cellRight.compareTo(cellLeft);
}
}
}
| [
"[email protected]"
] | |
410831c26d604d1df7f6f6df4cf7f14df5e63407 | f97ba375da68423d12255fa8231365104867d9b0 | /study-notes/j2ee-collection/framework/00-项目驱动/12_Spring05_Converter/src/main/java/com/sq/converter/DateConverter.java | 559e9bf1e6fb4fb66f5d519cbca22dbbff81be40 | [
"MIT"
] | permissive | lei720/coderZsq.practice.server | 7a728612e69c44e0877c0153c828b50d8ea7fa7c | 4ddf9842cd088d4a0c2780ac22d41d7e6229164b | refs/heads/master | 2023-07-16T11:21:26.942849 | 2021-09-08T04:38:07 | 2021-09-08T04:38:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package com.sq.converter;
import org.springframework.core.convert.converter.Converter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
public class DateConverter implements Converter<String, Date> {
private List<String> formats;
public void setFormats(List<String> formats) {
this.formats = formats;
}
@Override
public Date convert(String s) {
for (String format : formats) {
try {
SimpleDateFormat fmt = new SimpleDateFormat(format);
return fmt.parse(s);
} catch (ParseException e) {
// e.printStackTrace();
}
}
return null;
}
}
| [
"[email protected]"
] | |
d71da7018e3a51a16b93befe087110173e89ebf0 | bde0ef1ea5e4f86e24426edbb124c113ce82bdc3 | /src/main/java/com/example/demo/common/ErrorResponseException.java | d7af90173a54ed0ee8cfd94346c6666d4847e6e5 | [] | no_license | HLanZZZ/MyFirstDemo | 2908a9084db089639aab78311b9b2efdc1d5c9f6 | 386b1e25b28104a58bd82260f7c89394fe368746 | refs/heads/master | 2021-06-09T21:45:54.863117 | 2019-06-12T07:48:10 | 2019-06-12T07:48:10 | 190,154,782 | 0 | 0 | null | 2021-06-04T01:59:41 | 2019-06-04T07:49:18 | Java | UTF-8 | Java | false | false | 1,385 | java | package com.example.demo.common;
import java.io.IOException;
public class ErrorResponseException extends IOException {
public static final String ERR_CONSTRUCT_REQUEST_HEADER = "ERR_CONSTRUCT_REQUEST_HEADER";
public static final String ERR_CONSTRUCT_REQUEST_MESSAGE = "ERR_CONSTRUCT_REQUEST_MESSAGE";
public static final String ERR_1A_EMPTY_RESPONSE = "ERR_1A_EMPTY_RESPONSE";
public static final String ERR_1A_TIME_OUT = "ERR_1A_TIME_OUT";
public static final String ERR_1A_ERROR_RESPNSE="ERR_1A_RRROR_RESPONSE";
/**
* Generated serial version ID.
*/
private static final long serialVersionUID = -7929408390606206016L;
private final String errorCode;
private final String detail;
public ErrorResponseException(String message, String errorCode, String detail) {
super(message);
this.errorCode = errorCode;
this.detail=detail;
}
public ErrorResponseException(Throwable cause, String errorCode, String detail) {
super(cause);
this.errorCode = errorCode;
this.detail=detail;
}
public ErrorResponseException(String message, Throwable cause, String errorCode, String detail) {
super(message, cause);
this.errorCode = errorCode;
this.detail=detail;
}
public String getErrorCode() {
return errorCode;
}
public String getDetail()
{
return detail;
}
@Override
public Throwable fillInStackTrace()
{
return this;
}
}
| [
"[email protected]"
] | |
a7e766de222d8d3eff13672775743e19372fd15c | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project231/src/main/java/org/gradle/test/performance/largejavamultiproject/project231/p1159/Production23193.java | 6c879d6403f7853c4f2d01b63a645c1c9bd0e68d | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,890 | java | package org.gradle.test.performance.largejavamultiproject.project231.p1159;
public class Production23193 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"[email protected]"
] | |
57dbf8621b471ff99c6ad31698e876c2cc16b063 | 4c76d54553546e1deb844017ac723eb5fdda7bc0 | /javautils/src/main/java/dong/jsoup_test/NewsCrawler.java | 3efbfa7d55d637b86fb2877ec656f7541bc761da | [] | no_license | dongshilei/java-deep | 619b35003af8ac25dd68786f4f057f4c83dc655d | 17f1e457c5608e257ec9fb3d5c216a2e44236735 | refs/heads/master | 2022-12-22T12:25:12.880641 | 2020-10-16T08:41:02 | 2020-10-16T08:41:02 | 95,748,262 | 1 | 0 | null | 2022-12-16T01:09:11 | 2017-06-29T06:58:25 | Java | UTF-8 | Java | false | false | 2,418 | java | package dong.jsoup_test;
import cn.edu.hfut.dmic.webcollector.model.CrawlDatums;
import cn.edu.hfut.dmic.webcollector.model.Page;
import cn.edu.hfut.dmic.webcollector.plugin.berkeley.BreadthCrawler;
import org.jsoup.nodes.Document;
/**
* @author DONGSHILEI
*/
public class NewsCrawler extends BreadthCrawler {
/**
* @param crawlPath crawlPath is the path of the directory which maintains
* information of this crawler
* @param autoParse if autoParse is true,BreadthCrawler will auto extract
* links which match regex rules from pag
*/
public NewsCrawler(String crawlPath, boolean autoParse) {
super(crawlPath, autoParse);
/*start page*/
this.addSeed("http://news.hfut.edu.cn/list-1-1.html");
/*fetch url like http://news.hfut.edu.cn/show-xxxxxxhtml*/
this.addRegex("http://news.hfut.edu.cn/show-.*html");
/*do not fetch jpg|png|gif*/
this.addRegex("-.*\\.(jpg|png|gif).*");
/*do not fetch url contains #*/
this.addRegex("-.*#.*");
}
@Override
public void visit(Page page, CrawlDatums next) {
String url = page.getUrl();
/*if page is news page*/
if (page.matchUrl("http://39.96.116.170:5000/#/workflow/id/54fb3258-1b7a-4ec4-ad07-5ee341297ded?_k=fvgx38")) {
/*we use jsoup to parse page*/
Document doc = page.getDoc();
/*extract title and content of news by css selector*/
String title = page.select("div[id=Article]>h2").first().text();
String content = page.select("div#artibody", 0).text();
System.out.println("URL:\n" + url);
System.out.println("title:\n" + title);
System.out.println("content:\n" + content);
/*If you want to add urls to crawl,add them to nextLink*/
/*WebCollector automatically filters links that have been fetched before*/
/*If autoParse is true and the link you add to nextLinks does not
match the regex rules,the link will also been filtered.*/
//next.add("http://xxxxxx.com");
}
}
public static void main(String[] args) throws Exception {
NewsCrawler crawler = new NewsCrawler("crawl", true);
crawler.setThreads(50);
crawler.setTopN(100);
//crawler.setResumable(true);
/*start crawl with depth of 4*/
crawler.start(4);
}
} | [
"[email protected]"
] | |
e362f96a4f3efc67d822b889a080c4c704aff0be | e932ebf6d16bee11a007feaaec94978a867a7015 | /Project/tolometGui/src/main/java/com/akrog/tolometgui/widget/providers/SpotWidgetProvider.java | 24e96621ce760411cc0e45afa56fbc8560bcc3b6 | [] | no_license | akrogp/tolomet | 62a195081e5f4f336e5c9df349aa4226dbe70855 | 2e03b9c5ee9e119c7b0ef29776f60c88877837bc | refs/heads/master | 2023-05-01T12:04:49.656796 | 2023-04-19T20:33:15 | 2023-04-19T20:33:15 | 45,478,043 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,328 | java | package com.akrog.tolometgui.widget.providers;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import androidx.work.Constraints;
import androidx.work.ExistingPeriodicWorkPolicy;
import androidx.work.NetworkType;
import androidx.work.OneTimeWorkRequest;
import androidx.work.Operation;
import androidx.work.PeriodicWorkRequest;
import androidx.work.WorkManager;
import androidx.work.WorkRequest;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
import com.akrog.tolometgui.Tolomet;
import com.akrog.tolometgui.model.AppSettings;
import com.akrog.tolometgui.model.WidgetSettings;
import com.akrog.tolometgui.widget.model.WidgetModel;
import java.util.concurrent.TimeUnit;
/**
* Created by gorka on 11/05/16.
*/
public abstract class SpotWidgetProvider extends AppWidgetProvider {
public static String FORCE_WIDGET_UPDATE = "com.akrog.tolomet.FORCE_APPWIDGET_UPDATE";
public static String EXTRA_WIDGET_SIZE = "widgetSize";
public static final int WIDGET_SIZE_SMALL = 0;
public static final int WIDGET_SIZE_MEDIUM = 1;
public static final int WIDGET_SIZE_LARGE = 2;
private final Constraints constraints = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.build();
protected abstract int getWidgetSize();
@Override
public void onEnabled(Context context) {
super.onEnabled(context);
PeriodicWorkRequest periodicRequest = new PeriodicWorkRequest
.Builder(UpdateWorker.class, 1, TimeUnit.HOURS)
.setConstraints(constraints)
.build();
WorkManager.getInstance(context)
.enqueueUniquePeriodicWork("widget_update_" + getWidgetSize(), ExistingPeriodicWorkPolicy.KEEP, periodicRequest);
}
@Override
public void onDisabled(Context context) {
super.onDisabled(context);
WorkManager.getInstance(context)
.cancelUniqueWork("widget_update_" + getWidgetSize());
}
@Override
public void onDeleted(Context context, int[] appWidgetIds) {
super.onDeleted(context, appWidgetIds);
for( int widgetId : appWidgetIds )
new WidgetSettings(context, widgetId).delete();
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
AppSettings settings = AppSettings.getInstance();
long timediff = System.currentTimeMillis() - settings.getWidgetStamp();
if( timediff < 1*60*1000 && appWidgetIds != null ) {
WidgetModel model = new WidgetModel(Tolomet.getAppContext());
model.update();
return;
}
WorkRequest updateRequest = new OneTimeWorkRequest
.Builder(UpdateWorker.class)
.setConstraints(constraints)
.build();
LiveData<Operation.State> liveState = WorkManager.getInstance(context)
.enqueue(updateRequest)
.getState();
liveState.observeForever(new Observer<Operation.State>() {
@Override
public void onChanged(Operation.State state) {
liveState.removeObserver(this);
settings.saveWidgetStamp(System.currentTimeMillis());
WidgetModel model = new WidgetModel(Tolomet.getAppContext());
model.update();
}
});
}
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
String action = intent.getAction();
if( FORCE_WIDGET_UPDATE.equals(action) || Intent.ACTION_USER_PRESENT.equals(action) )
onUpdate(context, null, null);
}
public static class UpdateWorker extends Worker {
public UpdateWorker(
@NonNull Context context,
@NonNull WorkerParameters params) {
super(context, params);
}
@NonNull
@Override
public Result doWork() {
WidgetModel model = new WidgetModel(getApplicationContext());
model.download();
return Result.success();
}
}
} | [
"[email protected]"
] | |
0ade8a47e43ec1171f7248bf0d3b5c14e6041419 | 4fd605a51673550e9c572b5bbed51676de31844f | /src/com/chunyu/front/model/BroadCastEntity.java | 73bbdfd74d3c0e929b550a8e94b10e9d509ad6b8 | [] | no_license | cxworkstation/cyfront | a907fbf4a3de773d5ee6d52a913d1df3017ad02c | fb0e622ea5196c25e0d237566ee81967b7ada9f5 | refs/heads/master | 2016-08-06T22:55:56.461857 | 2015-07-06T02:45:42 | 2015-07-06T02:45:42 | 38,574,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.chunyu.front.model;
public class BroadCastEntity {
private int id;
private String pic;
private int goodId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPic() {
return pic;
}
public void setPic(String pic) {
this.pic = pic;
}
public int getGoodId() {
return goodId;
}
public void setGoodId(int goodId) {
this.goodId = goodId;
}
}
| [
"[email protected]"
] | |
4b00f0228242a7b189fc3ad41f68044e2f1cb82f | 409a540d03423c3ffcd19787b8f2bfa4975d57c7 | /src/main/java/com/alibababa/controller/portal/UserController.java | 27e53ade5ad7f903928ea82cca25bdbaec98e22d | [] | no_license | orhLoveBlueSky/onlineshop | 2742058b4fc5bbb9b8ed17b6444b3340c2f762ca | 01c9e528d7a9dc8ede07b86aadd5a34aa335782f | refs/heads/master | 2020-03-19T21:32:05.049068 | 2018-06-12T00:29:05 | 2018-06-12T00:29:05 | 136,941,752 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,224 | java | package com.alibababa.controller.portal;
import com.alibababa.common.Const;
import com.alibababa.common.ResponseCode;
import com.alibababa.common.ServerResponse;
import com.alibababa.pojo.User;
import com.alibababa.service.IUserService;
import com.alibababa.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@Controller
@RequestMapping(value="/user/")
public class UserController {
@Autowired
IUserService iUserService;
@RequestMapping(value = "login.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse login(String username, String password, HttpSession session, HttpServletResponse httpServletRespon) {
ServerResponse response = iUserService.login(httpServletRespon, username, password);
//登陆成功往创建session,并保存用户的信息
if (response.isSuccess()) {
session.setAttribute(Const.CURRENT_USER, response.getData());
}
User userData = (User) response.getData();
UserVo userVo = new UserVo(userData.getUsername(), userData.getEmail(), userData.getPhone());
response.setData(userVo);
return response;
}
//此action怎么预防在浏览器的url输入呢
@RequestMapping(value = "logout.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse logout(HttpSession session) {
session.removeAttribute(Const.CURRENT_USER);
return ServerResponse.createBySuccess();
}
//检查用户名或邮箱等的有效性,单个检查,这里只检查存在性,缺了数据格式的检查
@RequestMapping(value = "checkValid.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse checkValid(String value, String type) { //传null怎么办??
return iUserService.checkValid(value, type);
}
@RequestMapping(value = "regist.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse<User> regist(User user) {
return iUserService.regist(user);
}
@RequestMapping(value = "forget_get_question.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse getQuestion(String username) {
return iUserService.getQuestionByUsername(username);
}
@RequestMapping(value = "forget_check_answer.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse checkAnswer(String username, String question, String answer) {
return iUserService.checkAnswer(username, question, answer);
}
@RequestMapping(value = "forget_reset_password.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse resetPassword(String username, String passwordNew, String forget_token) {
return iUserService.resetPassword(username, passwordNew, forget_token);
}
@RequestMapping(value = "getUserInfo.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse testCookieValue(HttpSession session, @CookieValue("JSESSIONID") String sessionId, @CookieValue("token") String tokenValue) {
User user = (User) session.getAttribute(Const.CURRENT_USER);
if (user == null) {
return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(), "请先登录");
}
System.out.println("getUserInfo_Controller");
System.out.println("testCookieValue,sessionId=" + sessionId);
System.out.println("testCookieValue,token=" + tokenValue);
return iUserService.getUserInfoFromRedis(tokenValue);
}
//通过手机号,和手机短信验证码登录,先验证手机号码是否存在,存在则生成验证码,否则发送错误信息
@RequestMapping(value = "checkPhone.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse checkPhone(String phone) {
return iUserService.checkPhonebumber(phone);
}
//手机存在才能获取验证码图片
@RequestMapping(value = "getValidateCode.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse getValidateCode(HttpServletRequest request, HttpServletResponse response,String phone) {
return iUserService.createValidateCode(request, response, phone);
}
//通过验证码图片登陆
@RequestMapping(value = "loginByValidatecode.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse loginByValidatecode(String phone, String validateCode,HttpSession session) {
ServerResponse serverResponse = iUserService.loginByValidateCode(phone,validateCode);
if(serverResponse.isSuccess()){
System.out.println("登陆成功!");
session.setAttribute(Const.CURRENT_USER, serverResponse.getData());
}
return serverResponse;
}
}
| [
"[email protected]"
] | |
a75885de7ca1f70e613420b72c75c7df4ea18713 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/smile/nlp/keyword/CooccurrenceKeywordExtractorTest.java | 4eaef6382cc34e8773cfc49e1d7eb83f536f6133 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 1,770 | java | /**
* *****************************************************************************
* Copyright (c) 2010 Haifeng Li
*
* 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 smile.nlp.keyword;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
import org.junit.Assert;
import org.junit.Test;
import smile.data.parser.IOUtils;
import smile.nlp.NGram;
/**
*
*
* @author Haifeng Li
*/
public class CooccurrenceKeywordExtractorTest {
public CooccurrenceKeywordExtractorTest() {
}
/**
* Test of extract method, of class KeywordExtractorTest.
*/
@Test
public void testExtract() throws FileNotFoundException {
System.out.println("extract");
Scanner scanner = new Scanner(IOUtils.getTestDataReader("text/turing.txt"));
String text = scanner.useDelimiter("\\Z").next();
scanner.close();
CooccurrenceKeywordExtractor instance = new CooccurrenceKeywordExtractor();
ArrayList<NGram> result = instance.extract(text);
Assert.assertEquals(10, result.size());
for (NGram ngram : result) {
System.out.println(ngram);
}
}
}
| [
"[email protected]"
] | |
142e25e1839c1bbba1f2b9183aa679f9d5ccef66 | 05a516e10ce9862024ef505745f79fe0b88f6802 | /src/gov/nist/microanalysis/EPQTools/JPeriodicTable.java | d2deb7ef7e9ae6b33cd57a84523e9b565cdbf47e | [
"LicenseRef-scancode-public-domain"
] | permissive | openmicroanalysis/EPQ | 8ca2f686df65ed9c844477915619bef9d780597f | 0399d446b8587c76cb39f41eb039832d326dcd3c | refs/heads/master | 2023-07-08T05:56:53.703337 | 2023-07-05T20:56:33 | 2023-07-05T20:56:33 | 237,046,993 | 0 | 0 | null | 2023-09-13T14:16:54 | 2020-01-29T17:52:59 | Java | UTF-8 | Java | false | false | 15,380 | java | package gov.nist.microanalysis.EPQTools;
import gov.nist.microanalysis.EPQLibrary.Element;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.util.Collection;
import java.util.TreeSet;
import java.util.Vector;
import javax.swing.AbstractAction;
import javax.swing.JComponent;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
/**
* <p>
* A periodic table control for selecting one or more elements.
* </p>
* <p>
* Copyright: Pursuant to title 17 Section 105 of the United States Code this
* software is not subject to copyright protection and is in the public domain
* </p>
* <p>
* Company: National Institute of Standards and Technology
* </p>
*
* @author Nicholas W. M. Ritchie
* @version 1.0
*/
public class JPeriodicTable extends JComponent {
private static final long serialVersionUID = 0x1;
private Dimension mButtonDim;
private static int END_OF_ELEMENTS = Element.elmLr + 1;
private static final int COL_COUNT = 18;
private static final int ROW_COUNT = 9;
private final boolean[] mState = new boolean[END_OF_ELEMENTS];
private final boolean[] mDisabled = new boolean[END_OF_ELEMENTS];
private int mDepressedElement;
private int mDisplayedElement;
private int mSelectedElement; // The last element selected
private static final int[] mRow = {-1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8};
private static final int[] mCol = {-1, 0, 17, 0, 1, 12, 13, 14, 15, 16, 17, 0, 1, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
private transient Vector<ActionListener> actionListeners = new Vector<ActionListener>();
protected Rectangle getButtonRect(int elm) {
final int h = mButtonDim.height;
final int w = mButtonDim.width;
final int r = (h * mRow[elm]) + ((getHeight() - (ROW_COUNT * h)) / 2);
final int c = (w * mCol[elm]) + ((getWidth() - (COL_COUNT * w)) / 2);
return new Rectangle(c, r, w - 2, h - 2);
}
private int whichElement(int x, int y) {
for (int e = Element.elmH; e < END_OF_ELEMENTS; ++e)
if (getButtonRect(e).contains(x, y))
return e;
return Element.elmNone;
}
private Rectangle getElementDisplayRect() {
return new Rectangle(4 * mButtonDim.width, (mButtonDim.height / 2), 6 * mButtonDim.width, 2 * mButtonDim.height);
}
protected void displayPopup(int x, int y) {
final JPopupMenu pm = new JPopupMenu("Periodic table menu");
{
final JMenuItem mi = new JMenuItem("Clear all");
mi.addActionListener(new AbstractAction() {
static final long serialVersionUID = 0x1;
@Override
public void actionPerformed(ActionEvent e) {
setAll(false);
}
});
pm.add(mi);
}
{
final JMenuItem mi = new JMenuItem("Select all");
mi.addActionListener(new AbstractAction() {
static final long serialVersionUID = 0x1;
@Override
public void actionPerformed(ActionEvent e) {
setAll(true);
}
});
pm.add(mi);
}
this.add(pm);
pm.show(this, x, y);
}
protected void fireSelectionEvent(int element) {
mSelectedElement = element;
fireActionPerformed(new ActionEvent(this, element, getSelection(element) ? "Selected" : "Deselected"));
}
/**
* fireActionPerformed - This control fires an event each time an element is
* selected or deselected.
*
* @param e
* ActionEvent
*/
protected void fireActionPerformed(ActionEvent e) {
if (actionListeners.size() > 0)
for (final Object element : actionListeners)
((ActionListener) element).actionPerformed(e);
}
/**
* getLastSelected - Get the last element that was selected or deselected.
*
* @return int
*/
public int getLastSelected() {
return mSelectedElement;
}
/**
* JPeriodicTable - Construct a JPeriodicTable object.
*/
public JPeriodicTable() {
super();
assert (mRow.length == END_OF_ELEMENTS);
assert (mCol.length == END_OF_ELEMENTS);
try {
jbInit();
} catch (final Exception ex) {
ex.printStackTrace();
}
}
/**
* getSelection - Is the specified element selected in the table?
*
* @param element
* int - The atomic number of the element.
* @return boolean - True if selected, false otherwise.
*/
public boolean getSelection(int element) {
return ((element > Element.elmNone) && (element < END_OF_ELEMENTS)) ? mState[element] && (!mDisabled[element]) : false;
}
/**
* setSelection - Set the selection state of the specified element.
*
* @param z
* int - The atomic number of the element
* @param b
* boolean - True to select, false to unselect.
*/
public void setSelection(int z, boolean b) {
if ((z > Element.elmNone) && (z < END_OF_ELEMENTS) && (mState[z] != b)) {
mState[z] = b;
repaint(mButtonDim.width * mCol[z], mButtonDim.height * mRow[z], mButtonDim.width, mButtonDim.height);
}
}
/**
* setSelection - Set the selection state of the specified element.
*
* @param elm
* Element - The element to select
* @param b
* boolean - True to select, false to unselect.
*/
public void setSelection(Element elm, boolean b) {
setSelection(elm.getAtomicNumber(), b);
}
void jbInit() throws Exception {
this.setOpaque(true);
this.setSize(25 * COL_COUNT, 20 * ROW_COUNT);
this.setPreferredSize(new Dimension(25 * COL_COUNT, 20 * ROW_COUNT));
this.setMaximumSize(new Dimension(50 * COL_COUNT, 40 * ROW_COUNT));
this.setMinimumSize(new Dimension(20 * COL_COUNT, 15 * ROW_COUNT));
this.setToolTipText("Select one or more elements from the periodic table.");
this.setDoubleBuffered(true);
this.setOpaque(false);
this.setLayout(null);
mButtonDim = new Dimension(getWidth() / COL_COUNT, getHeight() / ROW_COUNT);
mDepressedElement = Element.elmNone;
mDisplayedElement = Element.elmNone;
addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent me) {
if (me.isPopupTrigger())
displayPopup(me.getX(), me.getY());
else if (me.getButton() == MouseEvent.BUTTON1) {
int el = whichElement(me.getX(), me.getY());
if (mDisabled[el])
el = Element.elmNone;
mDepressedElement = el;
if (mDepressedElement != Element.elmNone)
repaint(getButtonRect(mDepressedElement));
}
}
@Override
public void mouseReleased(MouseEvent me) {
if (me.isPopupTrigger())
displayPopup(me.getX(), me.getY());
else if (me.getButton() == MouseEvent.BUTTON1)
if ((mDepressedElement != Element.elmNone) && (!mDisabled[mDepressedElement])) {
if (whichElement(me.getX(), me.getY()) == mDepressedElement) {
mState[mDepressedElement] = !mState[mDepressedElement];
fireSelectionEvent(mDepressedElement);
}
final int e = mDepressedElement;
mDepressedElement = Element.elmNone;
repaint(getButtonRect(e));
}
}
});
addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent me) {
final int el = whichElement(me.getX(), me.getY());
if (el != mDisplayedElement) {
mDisplayedElement = el;
repaint(getElementDisplayRect());
}
}
});
}
@Override
public void paintComponent(Graphics gr) {
super.paintComponent(gr);
final Insets in = getInsets();
mButtonDim.setSize((getWidth() - (2 * (in.left + in.right))) / COL_COUNT, (getHeight() - (2 * (in.top + in.bottom))) / ROW_COUNT);
FontMetrics fm = gr.getFontMetrics();
final int h = mButtonDim.height;
final int w = mButtonDim.width;
final int dh = (getHeight() - (ROW_COUNT * h)) / 2;
final int dw = (getWidth() - (COL_COUNT * w)) / 2;
for (int e = Element.elmH; e < END_OF_ELEMENTS; ++e) {
int r = (h * mRow[e]) + dh;
int c = (w * mCol[e]) + dw;
if (e == mDepressedElement) {
++r;
++c;
}
if (mDisabled[e]) {
gr.setColor(SystemColor.control);
gr.fillRoundRect(c, r, w - 2, h - 2, w / 10, w / 10);
gr.setColor(SystemColor.controlShadow);
gr.drawRoundRect(c, r, w - 2, h - 2, w / 10, w / 10);
} else if (mState[e]) {
gr.setColor(Color.green);
gr.fillRoundRect(c, r, w - 2, h - 2, w / 10, w / 10);
gr.setColor(Color.black);
gr.drawRoundRect(c, r, w - 2, h - 2, w / 10, w / 10);
} else {
gr.setColor(SystemColor.control);
gr.fillRoundRect(c, r, w - 2, h - 2, w / 10, w / 10);
gr.setColor(SystemColor.controlText);
gr.drawRoundRect(c, r, w - 2, h - 2, w / 10, w / 10);
}
final String str = Element.toAbbrev(e);
if (mDisabled[e])
gr.setColor(SystemColor.controlShadow);
gr.drawString(str, c + ((w - fm.stringWidth(str)) / 2), r + ((2 * h) / 3));
if (mDisabled[e])
gr.setColor(this.getForeground());
}
final Rectangle r = getElementDisplayRect();
gr.setColor(SystemColor.control);
gr.drawRect(r.x, r.y, r.width, r.height);
if (mDisplayedElement != Element.elmNone) {
gr.setColor(SystemColor.controlText);
if (mDisabled[mDisplayedElement])
gr.drawString("disabled", (4 * mButtonDim.width) + 2, ((5 * mButtonDim.height) / 2) - 2);
final Font oldFont = gr.getFont();
gr.setFont(new Font(oldFont.getName(), oldFont.getStyle(), (3 * oldFont.getSize()) / 2));
fm = gr.getFontMetrics();
final String str = Element.toString(mDisplayedElement);
gr.drawString(str, r.x + ((r.width - fm.stringWidth(str)) / 2), (r.y + r.height) - fm.getDescent());
gr.drawString(Integer.toString(mDisplayedElement), r.x, r.y + fm.getAscent());
}
}
/**
* getSelectedElements - Get a Set object containing a list of selected
* element.
*
* @return TreeSet>Element< - a set of Element objects
*/
public TreeSet<Element> getSelected() {
final TreeSet<Element> res = new TreeSet<Element>();
for (int el = Element.elmH; el < END_OF_ELEMENTS; ++el)
if (mState[el] && (!mDisabled[el]))
res.add(Element.byAtomicNumber(el));
return res;
}
/**
* setSelectedElements - Sets the elements that are selected on the periodic
* table control from the list of Element objects in lst.
*
* @param lst
* A collection of Element objects.
* @param clear
* boolean - Determines whether to clear the table before setting
* the specified elements.
*/
public void setSelected(Collection<Element> lst, boolean clear) {
if (clear)
setAll(false);
for (final Element el : lst)
setSelection(el.getAtomicNumber(), true);
}
/**
* setAll - Select or deselect all elements.
*
* @param set
* boolean - True to set and false to deselect.
*/
public void setAll(boolean set) {
setAllExcept(set, Element.elmNone);
}
/**
* setAll - Select or deselect all elements.
*
* @param set
* boolean - True to set and false to deselect.
* @param element
* int - The atomic number of the element whose state to leave
* unchanged
*/
public void setAllExcept(boolean set, int element) {
for (int el = Element.elmH; el < END_OF_ELEMENTS; ++el)
if ((el != element) && (mState[el] != set) && (!mDisabled[el])) {
mState[el] = set;
repaint(getButtonRect(el));
}
}
/**
* removeActionListener - This control fires an event each time an element is
* selected or deselected.
*
* @param l
* ActionListener
*/
public synchronized void removeActionListener(ActionListener l) {
if (actionListeners.contains(l)) {
final Vector<ActionListener> v = new Vector<ActionListener>(actionListeners);
v.removeElement(l);
actionListeners = v;
}
}
/**
* addActionListener - This control fires an event each time an element is
* selected or deselected.
*
* @param l
* ActionListener
*/
public synchronized void addActionListener(ActionListener l) {
if (!actionListeners.contains(l)) {
final Vector<ActionListener> v = new Vector<ActionListener>(actionListeners);
v.addElement(l);
actionListeners = v;
}
}
/**
* setEnabled - Set the enabled state for the button assocaited with the
* specified element.
*
* @param element
* int
* @param enabled
* boolean
*/
public void setEnabled(Element element, boolean enabled) {
setEnabled(element.getAtomicNumber(), enabled);
}
private void setEnabled(final int z, boolean enabled) {
if ((z > Element.elmNone) && (z < END_OF_ELEMENTS) && (mDisabled[z] == enabled)) {
mDisabled[z] = !enabled;
repaint(getButtonRect(z));
if (!enabled)
mState[z] = false;
}
}
/**
* enableAll - Enables (or disables) all buttons.
*
* @param enabled
* boolean
*/
public void enableAll(boolean enabled) {
for (int z = Element.elmH; z < END_OF_ELEMENTS; ++z)
setEnabled(z, enabled);
}
/**
* Enable/disable all elements from begin to end (excluding end)
*
* @param begin
* The beginning
* @param end
* One beyond the end
* @param enabled
*/
public void enableRange(Element begin, Element end, boolean enabled) {
for (int z = begin.getAtomicNumber(); z < end.getAtomicNumber(); ++z)
setEnabled(z, enabled);
}
}
| [
"[email protected]"
] | |
63239b561c14ea51845f80c34b310c8620610654 | 609d2b7aa93b8c789a80fad79063bba8764324aa | /testpostgres/postgresjava/src/main/java/com/company/testpostgres/postgresjava/testConnectivitycc2.java | ef36790d93375a5d542834fcaeb118b22af0d157 | [] | no_license | kumar-chandan-kc/CloudFoundry | 80571fc9e9afe26c98e053a19b96b43f7ddcd55a | 03433d6be5da2a008f81156f7df1a0e88f0c4fd1 | refs/heads/master | 2022-06-23T01:46:25.627489 | 2019-06-24T11:13:33 | 2019-06-24T11:13:33 | 154,489,349 | 0 | 0 | null | 2022-05-20T20:53:51 | 2018-10-24T11:27:30 | Java | UTF-8 | Java | false | false | 6,610 | java | package com.company.testpostgres.postgresjava;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URI;
import java.net.URL;
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.apache.commons.io.IOUtils;
import org.cloudfoundry.identity.client.UaaContext;
import org.cloudfoundry.identity.client.UaaContextFactory;
import org.cloudfoundry.identity.client.token.GrantType;
import org.cloudfoundry.identity.client.token.TokenRequest;
import org.cloudfoundry.identity.uaa.oauth.token.CompositeAccessToken;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
/**
* Servlet implementation class testConnectivitycc2
*/
@WebServlet("/testConnectivitycc2")
public class testConnectivitycc2 extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public testConnectivitycc2() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
// response.getWriter().append("Served at: ").append(request.getContextPath());
try {
HttpURLConnection urlConnection = null;
// fetching variable values env variables
// 36-39 xsuua env vars
JSONObject jsonObj = new JSONObject(System.getenv("VCAP_SERVICES"));
JSONArray jsonArr = jsonObj.getJSONArray("xsuaa");
JSONObject jsoncredentials = jsonArr.getJSONObject(0).getJSONObject("credentials");
URI xsUaaUrl = new URI(jsoncredentials.getString("url"));
// response.getWriter().println(jsoncredentials + "\n");
// response.getWriter().println(xsUaaUrl+ "\n");
// 42-47 connectivity env var
JSONArray jsonArrConnect = jsonObj.getJSONArray("connectivity");
JSONObject jsoncredentialsConn = jsonArrConnect.getJSONObject(0).getJSONObject("credentials");
String onprem_proxy_host = jsoncredentialsConn.getString("onpremise_proxy_host");
int onprem_proxy_port = Integer.parseInt(jsoncredentialsConn.getString("onpremise_proxy_port"));
String clientId = jsoncredentialsConn.getString("clientid");
String clientSecret = jsoncredentialsConn.getString("clientsecret");
// response.getWriter().println(onprem_proxy_host + "\t" + onprem_proxy_port + "\n");
// fetching a token from xsuaa using connectivity client id, secret which is needed by connectivity service 57-64
UaaContextFactory factory = UaaContextFactory.factory(xsUaaUrl).authorizePath("/oauth/authorize").tokenPath("/oauth/token");
TokenRequest tokenRequest = factory.tokenRequest();
// response.getWriter().println("worked till factory");
tokenRequest.setGrantType(GrantType.CLIENT_CREDENTIALS);
tokenRequest.setClientId(clientId);
tokenRequest.setClientSecret(clientSecret);
// response.getWriter().println("token request got created");
UaaContext xsUaaContext = factory.authenticate(tokenRequest);
// response.getWriter().println("worked till here");
CompositeAccessToken jwtToken1 = xsUaaContext.getToken();
// response.getWriter().println("jwtToken1 received" + "\n");
// creating url object for calling er9 backend
String s = "";
// s = request.getParameter("test");
URL url;
if(s.equals(""))
{ url = new URL(
"http://ldai1cc2.wdf.sap.corp:44300/sap/opu/odata/sap/API_PRODUCT_SRV/A_Product('ZSP_MARA_TEST1')?sap-client=715&$format=json");}
else
{
url = new URL(s);
}
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(onprem_proxy_host, onprem_proxy_port));
urlConnection = (HttpURLConnection) url.openConnection(proxy);
// response.getWriter().println(urlConnection + "\t proxy + connection worked");
//adding the token fetched in er9 request
urlConnection.setRequestProperty("Proxy-Authorization", "Bearer " + jwtToken1);
// adding username and password Basic authentication to back end (er9)
// String authtoken = request.getParameter("basic");
urlConnection.setRequestProperty("Authorization", "Basic X1NBUEkzMzE2Nzc6YjNfY2E2LXNGcFhkbllmRS1qdlk=");
// urlConnection.setRequestProperty("Authorization", authtoken);
urlConnection.setRequestProperty("content-type", "application/json");
urlConnection.setRequestMethod("GET");
// try{
// Authentication auth = SecurityContextHolder.getContext().getAuthentication();
// response.getWriter().println("Authentication context received");
// response.getWriter().println(auth.getDetails().toString());
// OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) auth.getDetails();
// response.getWriter().println("details fetched" + details.toString());
// String jwtToken2 = details.getTokenValue();
// response.getWriter().println("details gave token value");
// urlConnection.setRequestProperty("SAP-Connectivity-Authentication", "Bearer " + jwtToken2);
// response.getWriter().println(jwtToken2 + "\t jwt token2 received");
// }
// catch(Exception e)
// {response.getWriter().println(e.getMessage() + "\t jwttoken2 fetch failed");}
//
//
// getting the output from er9 into input stream object and converting into string and returning it
// urlConnection.setRequestProperty("SAP-Connectivity-Authentication", "Bearer " + "");
InputStream instream = urlConnection.getInputStream();
// response.getWriter().println(instream.toString());
String outString = "";
StringWriter writer = new StringWriter();
IOUtils.copy(instream, writer);
outString = writer.toString();
response.getWriter().println(outString);
}
catch (Exception e) {
// e.printStackTrace();
response.getWriter().println(e.getMessage());
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"[email protected]"
] | |
fdc7ae3840ea1b764ab77ec4475f77cab3a52973 | 75e00bdb7c925d3e84902f92a2304fe6e60a3abf | /Demo-Spring-MVC/src/main/java/kiseok/demospringmvc/config/WebConfig.java | 58bd16b44aa08c95119f3e960a5955db7aaf098b | [] | no_license | yks095/Study-SpringBoot | 14f04f9d28f4c2b92afcf2c5666a5f6db1a5fb31 | 8c7f3866643df136d222b2b20b0daf98c0e4ea99 | refs/heads/master | 2020-08-23T21:52:06.440274 | 2020-08-20T13:09:44 | 2020-08-20T13:09:44 | 216,711,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package kiseok.demospringmvc.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/m/**")
.addResourceLocations("classpath:/m/")
.setCachePeriod(20);
}
}
| [
"[email protected]"
] | |
48a00790890ca11337c75b3c76491ab6779c43e3 | e53cf63c2f8c95c84c729d2a42b3ce8aca7428ee | /app/src/main/java/vaksys/in/volleyjsondemo/pojo/NewResponse.java | 73f99bc8c9e4f401de99bb9e7ab2631694f75b3c | [] | no_license | RakshitSathvara/VolleyJsonDemo | 03b1388ab42b09e89da4b734c69821fea6078614 | 719e65109e658484e52b8d462ece023a4d02c237 | refs/heads/master | 2021-01-17T17:59:26.810800 | 2016-06-07T07:09:56 | 2016-06-07T07:09:56 | 60,590,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,490 | java | package vaksys.in.volleyjsondemo.pojo;
import java.util.List;
/**
* Created by dell980 on 4/13/2016.
*/
public class NewResponse {
/**
* name : Brad Pitt
* description : William Bradley 'Brad' Pitt is an American actor and film producer. He has received a Golden Globe Award, a Screen Actors Guild Award, and three Academy Award nominations in acting categories
* dob : December 18, 1963
* country : United States
* height : 1.80 m
* spouse : Jennifer Aniston
* children : Shiloh Nouvel Jolie-Pitt, Maddox Chivan Jolie-Pitt
* image : http://microblogging.wingnity.com/JSONParsingTutorial/brad.jpg
*/
private List<ActorsBean> actors;
public List<ActorsBean> getActors() {
return actors;
}
public void setActors(List<ActorsBean> actors) {
this.actors = actors;
}
public static class ActorsBean {
private String name;
private String description;
private String dob;
private String country;
private String height;
private String spouse;
private String children;
private String image;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
public String getSpouse() {
return spouse;
}
public void setSpouse(String spouse) {
this.spouse = spouse;
}
public String getChildren() {
return children;
}
public void setChildren(String children) {
this.children = children;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
}
}
| [
"[email protected]"
] | |
cbd873210f4042208b11b3724f0535229fe21bd4 | 86395932f803c0197d25e986a8214cb1c4472aff | /server/src/main/java/com/company/server/util/UuidUtil.java | c24e90f3009f2c1d3aa73e16c2513d7508e1dc9e | [] | no_license | lz1360069912/mooc | 99d1b72ca79e0fa24ac44cb04a22d9304555c151 | eb4956c31480e820765f6680da48b546c048e9ee | refs/heads/master | 2023-07-16T22:29:18.122538 | 2021-09-06T07:50:35 | 2021-09-06T07:50:35 | 372,182,530 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,265 | java | package com.company.server.util;
import java.util.UUID;
public class UuidUtil {
public static String[] chars = new String[] { "a", "b", "c", "d", "e", "f",
"g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
"t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I",
"J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
"W", "X", "Y", "Z" };
/**
* 获取短UUID
* @return
*/
public static String getShortUuid() {
StringBuffer shortBuffer = new StringBuffer();
String uuid = UuidUtil.getUuid();
for (int i = 0; i < 8; i++) {
String str = uuid.substring(i * 4, i * 4 + 4);
int x = Integer.parseInt(str, 16);
shortBuffer.append(chars[x % 0x3E]); // 对62取余
}
return shortBuffer.toString();
}
/**
* 获得32位UUID
*/
public static String getUuid(){
String uuid = UUID.randomUUID().toString();
//去掉“-”符号
return uuid.replaceAll("-", "");
}
public static void main(String[] args) {
System.out.println(getShortUuid());
}
}
| [
"[email protected]"
] | |
fe428d44bb708cc71a5823a298d3068cee3d8af1 | 00a1d4d205ceb81b1b4d8c49e4b063f615356223 | /src/main/java/com/patientportal/service/LogRegService.java | 106a95e3fef4ac99a3f30b124d89afd4cdfd4142 | [] | no_license | siripatnam/PatientPortal | 70605a256e09900c29d50e5b6d0e9de7a6be4a69 | a47af29da3846466d260b564d5ac73c1e76a3ac2 | refs/heads/master | 2020-03-27T16:43:14.150260 | 2018-08-30T20:20:08 | 2018-08-30T20:20:08 | 146,801,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,324 | java | package com.patientportal.service;
import com.patientportal.models.Login;
import com.patientportal.models.Register;
import com.patientportal.repository.LogRegRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;
import java.util.Map;
@Service
public class LogRegService{
@Autowired
LogRegRepository logRegRepository;
public void registerUser(Register register) {
logRegRepository.registerUser(register);
}
public Map validateUserLogin(Login login){
Map hashmap = logRegRepository.validateUserLogin(login);
return hashmap;
}
// method to validate function
public ModelAndView validateLogin(Login login,Map hashmap){
ModelAndView modelAndView = new ModelAndView();
if (login.getPassword().equals(hashmap.get("password"))){
modelAndView.setViewName("welcome");
modelAndView.addObject("login",login);
System.out.println("Details are correct....");
}else{
modelAndView.setViewName("index");
modelAndView.addObject("error","Invalid Username or password");
System.out.println("details are wrong....");
}
return modelAndView;
}
}
| [
"[email protected]"
] | |
dee51c02061b99b03646f1ec86ee1b9b5ba0aed4 | fdb0f72c4c4b6817ba29d8ba2c059947e6b8ab6d | /IMC/src/Patient.java | 51a8a5b86203c85bf3b806e198d3a4e657280927 | [] | no_license | bielzfreitas/ProjectsJava | 143c2abb14441cc792a1cf75bfa844c865096175 | 27291830e84967270a0da0c071061ec6c2a3f736 | refs/heads/main | 2023-05-01T21:58:33.184519 | 2021-05-13T16:40:42 | 2021-05-13T16:40:42 | 366,787,415 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,326 | java |
public class Patient {
public double weight;
public double height;
public double BMI;
public Patient(double weight, double height) {
this.weight = weight;
this.height = height;
}
public double calculationBMI() {
BMI = weight / (height * height);
return BMI;
}
public String diagnosis(double BMI) {
if (BMI < 16) {
return "Baixo peso muito grave = IMC abaixo de 16 kg/m²";
} else if (BMI >= 16 && BMI < 17) {
return "Baixo peso grave = IMC entre 16 e 16,99 kg/m²";
} else if (BMI >= 17 && BMI < 18.5) {
return "Baixo peso = IMC entre 17 e 18,49 kg/m²";
} else if (BMI >= 18.5 && BMI < 25) {
return "Peso normal = IMC entre 18,50 e 24,99 kg/m²";
} else if (BMI >= 25 && BMI < 30) {
return "Sobrepeso = IMC entre 25 e 29,99 kg/m²";
} else if (BMI >= 30 && BMI < 35) {
return "Obesidade grau I = IMC entre 30 e 34,99 kg/m²";
} else if (BMI >= 35 && BMI < 40) {
return "Obesidade grau II = IMC entre 35 e 39,99 kg/m²";
} else {
return "Obesidade grau III (obesidade mórbida) = IMC igual ou maior que 40 kg/m²";
}
}
}
| [
"[email protected]"
] | |
39867abbf4a495d782723cb7ff8ab00e3a789afb | 3b91b5c0e09d9a23231b5c06cffd8acb4e49736d | /app/src/test/java/com/example/skoop/skoopmag/ExampleUnitTest.java | a09b0d015df34d63a6ba67a8404af9315727c779 | [] | no_license | jatin11gidwani/SkoopMag | 3af868859e3738a50f2fd25c8048d92d74f4e1e6 | e6d052bbca10b87d97418fc3abc6564ed70b1adb | refs/heads/master | 2021-01-18T17:37:19.702039 | 2017-03-08T19:12:31 | 2017-03-08T19:12:31 | 84,356,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package com.example.skoop.skoopmag;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
48cb18d99aa1e0933b5f5f4174e00d07f9229512 | 9d9485900e4e4154c26ac1d081d82d8486bae1f7 | /app/src/main/java/com/example/fitsoc/ui/run/ShotShareUtil.java | 36b79df1496e73880f07071b7654a22b23233708 | [] | no_license | jessica-ma3/fitness | de8496d77ee43ca1e0dedfb2549cdcc66a0f656d | 29ec3fe2816376c7d30b08d1b2437c32cf762f6a | refs/heads/main | 2023-08-27T15:37:50.283306 | 2021-11-05T10:28:32 | 2021-11-05T10:28:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,863 | java | package com.example.fitsoc.ui.run;
import android.accessibilityservice.AccessibilityService;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.core.content.FileProvider;
import com.example.fitsoc.BuildConfig;
import com.example.fitsoc.R;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public class ShotShareUtil {
private static final String TAG = "";
private static Intent intent1 = new Intent(Intent.ACTION_VIEW);
public static void shotShare(Context context) {
String path = screenShot(context);
if (!StringUtil.isEmpty(path)) {
ShareImage(context, path);
}
}
private static String screenShot(Context context) {
String imagePath = null;
View rootView = ((Activity)context).getWindow().getDecorView().findViewById(R.id.underView);
Bitmap bitmap = ScreenUtil.getBitmapFromView(rootView);
if (bitmap != null) {
try {
// path of pictures
imagePath = context.getExternalFilesDir(null) + "share.png";
Toast.makeText(context, imagePath, Toast.LENGTH_SHORT).show();
File file = new File(imagePath);
// File file = new File(context.getFilesDir(),"share.png");
// context.getFilesDir().
// Toast.makeText(context, context.getFilesDir(), Toast.LENGTH_SHORT).show();
// FileOutputStream fos = context.openFileOutput("share.png",Context.MODE_PRIVATE);
FileOutputStream os = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);
os.flush();
os.close();
return imagePath;
} catch (Exception e) {
Toast.makeText(context, "====screenshot:error====", Toast.LENGTH_SHORT).show();
// LogUtil.e(ShotShareUtil.class, "====screenshot:error====" + e.getMessage());
}
}
return null;
}
private static void ShareImage(Context context, String imagePath) {
if (imagePath != null) {
Intent intent = new Intent(Intent.ACTION_SEND); // set share attribute
File file = new File(imagePath);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri contentUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID +".fileProvider",file);
// intent.setDataAndType(contentUri,"application/vnd.android.package-archive");
intent.setDataAndType(contentUri,"image/*");// set type of share message
}
// intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
intent.putExtra(Intent.EXTRA_STREAM, FileProvider.getUriForFile(context, context.getPackageName()+".fileProvider",file));//the content shared
intent.setType("image/*");//set type of share message
Intent chooser = Intent.createChooser(intent, "Share screen shot");
if (intent.resolveActivity(context.getPackageManager()) != null) {
context.startActivity(chooser);
}
} else {
Toast.makeText(context , "take screeshot first,then share", Toast.LENGTH_SHORT).show();
}
}
public static class StringUtil {
public static boolean isEmpty(String str) {
if (str == null || "null".equals(str) || str.length() == 0) {
return true;
} else {
return false;
}
}
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.