blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6ee7f7caaf5be6ef0258c0ed4e10db951376f13b | e2adb3fadf79028a22780bc6d1c1490051d5111b | /getty-core/src/main/java/com/gettyio/core/channel/starter/Starter.java | a0bf13a798b081b4e3766e055c2d99345043c1ca | [
"Apache-2.0"
]
| permissive | endlessc/getty | 4b2d4d7faa7dcdd6d51ca6e84b82255652a1a2bb | d44fc467ed9fe15bc96d2e2b7ef0ab5a885fe8a1 | refs/heads/master | 2022-07-03T06:29:06.388147 | 2020-04-22T00:40:26 | 2020-04-22T00:40:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 787 | java | package com.gettyio.core.channel.starter;/*
* 类名:Starter
* 版权:Copyright by www.getty.com
* 描述:
* 修改人:gogym
* 时间:2020/4/8
*/
public abstract class Starter {
/**
* Boss线程数,获取cpu核心,核心小于4设置线程为3,大于4设置和cpu核心数一致
*/
protected int bossThreadNum = Runtime.getRuntime().availableProcessors() < 4 ? 3 : Runtime.getRuntime().availableProcessors();
/**
* Boss共享给Worker的线程数,核心小于4设置线程为1,大于4右移两位
*/
protected int bossShareToWorkerThreadNum = bossThreadNum > 4 ? bossThreadNum >> 2 : bossThreadNum - 2;
/**
* Worker线程数
*/
protected int workerThreadNum = bossThreadNum - bossShareToWorkerThreadNum;
}
| [
"[email protected]"
]
| |
6d8bfbe97f05221eff0f456e205a86a0bc9aed27 | eb743e3383d8cf61e88ec14a8996acce9953d9bc | /chapter2_001/src/test/java/ru/job4j/tree/TreeTest.java | b6c48b4907bf9fe49710d6b35e44f6f47615322d | [
"Apache-2.0"
]
| permissive | Tovaniks/snazarov | 80353ccba1243210a6f2847d8b39428b5498e802 | 5d1593a67cecf4f397b1a2caa334db5bc54c817d | refs/heads/master | 2018-10-09T08:42:37.893886 | 2018-07-11T08:45:25 | 2018-07-11T08:45:25 | 117,973,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,841 | java | package ru.job4j.tree;
import org.junit.Test;
import java.util.Iterator;
import java.util.NoSuchElementException;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
public class TreeTest {
@Test
public void when6ElFindLastThen6() {
Tree<Integer> tree = new Tree<>(1);
tree.add(1, 2);
tree.add(1, 3);
tree.add(1, 4);
tree.add(4, 5);
tree.add(5, 6);
tree.findBy(6);
assertThat(
tree.findBy(6).isPresent(),
is(true)
);
}
@Test
public void when6ElFindNotExitThenOptionEmpty() {
Tree<Integer> tree = new Tree<>(1);
tree.add(1, 2);
assertThat(
tree.findBy(7).isPresent(),
is(false)
);
}
@Test(expected = NoSuchElementException.class)
public void when9ElIterThen12345678910() {
Tree<Integer> tree = new Tree<>(1);
tree.add(1, 2);
assertThat(tree.add(1, 2), is(false));
tree.add(1, 3);
tree.add(1, 4);
tree.add(4, 5);
tree.add(5, 6);
tree.add(5, 7);
tree.add(6, 9);
tree.add(6, 10);
Iterator iter = tree.iterator();
assertThat(tree.isBinary(), is(false));
assertThat(iter.hasNext(), is(true));
assertThat(iter.next(), is(1));
assertThat(iter.hasNext(), is(true));
assertThat(iter.next(), is(2));
assertThat(iter.hasNext(), is(true));
assertThat(iter.next(), is(3));
assertThat(iter.hasNext(), is(true));
assertThat(iter.next(), is(4));
assertThat(iter.hasNext(), is(true));
assertThat(iter.next(), is(5));
assertThat(iter.hasNext(), is(true));
assertThat(iter.next(), is(6));
assertThat(iter.hasNext(), is(true));
assertThat(iter.next(), is(7));
assertThat(iter.hasNext(), is(true));
assertThat(iter.next(), is(9));
assertThat(iter.hasNext(), is(true));
assertThat(iter.next(), is(10));
assertThat(iter.hasNext(), is(false));
iter.next();
}
@Test
public void whenTreeIsBinary() {
Tree<Integer> tree = new Tree<>(1);
assertThat(tree.isBinary(), is(true));
tree.add(1, 2);
assertThat(tree.isBinary(), is(true));
tree.add(1, 4);
assertThat(tree.isBinary(), is(true));
tree.add(4, 5);
assertThat(tree.isBinary(), is(true));
tree.add(5, 6);
assertThat(tree.isBinary(), is(true));
tree.add(5, 7);
assertThat(tree.isBinary(), is(true));
tree.add(6, 9);
assertThat(tree.isBinary(), is(true));
tree.add(6, 10);
assertThat(tree.isBinary(), is(true));
tree.add(6, 11);
assertThat(tree.isBinary(), is(false));
}
} | [
"[email protected]"
]
| |
fa550404ae9c797f87d5c99908b2c45bd4b0c654 | b592696df6a5c08e2ff6898e0cb8163ba6b6a480 | /backuptool/src/main/java/com/fastsitesoft/backuptool/utils/FSSConfigurationFile.java | 5c33971e5dea114626d9c1d46e9dea8ceb87d60a | []
| no_license | kervinpierre/backuptool | df534d0691803a61933abceb4a910c24795d367d | 1d0b43897cccf22ca9d4a9610dfa45b571f4e466 | refs/heads/master | 2022-05-06T08:12:11.054704 | 2019-03-16T01:32:02 | 2019-03-16T01:32:02 | 164,045,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,709 | java | /*
* SLU Dev Inc. CONFIDENTIAL
* DO NOT COPY
*
* Copyright (c) [2012] - [2015] SLU Dev Inc. <[email protected]>
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of SLU Dev Inc. and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to SLU Dev Inc. and its suppliers and
* may be covered by U.S. and Foreign Patents, patents in process,
* and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from SLU Dev Inc.
*/
package com.fastsitesoft.backuptool.utils;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/**
*
* @author Kervin Pierre <[email protected]>
*/
public class FSSConfigurationFile
{
private static final Logger log
= LogManager.getLogger(FSSConfigurationFile.class);
public Document read(Path path) throws BackupToolException
{
log.info( String.format( "Configuration FilePath : %1$s\n", path ) );
Document res = null;
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder currDocBuilder;
try
{
currDocBuilder = dbFactory.newDocumentBuilder();
try
{
res = currDocBuilder.parse( path.toFile() );
}
catch (SAXException ex)
{
String errMsg = String.format("Error parsing XML Configuration file syntax.");
log.error(errMsg, ex);
throw new BackupToolException(errMsg, ex);
}
catch (IOException ex)
{
String errMsg = String.format("Error reading the XML Configuration file on disk.");
log.error(errMsg, ex);
throw new BackupToolException(errMsg, ex);
}
}
catch (ParserConfigurationException ex)
{
String errMsg = String.format("Error parsing XML Configuration file");
log.error(errMsg, ex);
throw new BackupToolException(errMsg, ex);
}
res.getDocumentElement().normalize();
return res;
}
}
| [
"[email protected]"
]
| |
890d679877e59411284fb9ed456a7344ff42885b | f378ddd47c8b7de6e9cf1d4228c84f73e9dc59f1 | /projetos/Web/Object_catalog/src/ru/spbstu/telematics/objectCatalog/DeleteStyleServlet.java | d3c1203fa7dddf5bd77ff75ba6daa5562babed5d | []
| no_license | charles-marques/dataset-375 | 29e2f99ac1ba323f8cb78bf80107963fc180487c | 51583daaf58d5669c69d8208b8c4ed4e009001a5 | refs/heads/master | 2023-01-20T07:23:09.445693 | 2020-11-27T22:35:49 | 2020-11-27T22:35:49 | 283,315,149 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 653 | java | package ru.spbstu.telematics.objectCatalog;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DeleteStyleServlet extends HttpServlet{
ObjectCatalog catalog = new ObjectCatalog();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String styleId = req.getParameter("styleId");
if (styleId != null)
catalog.deleteStyle(styleId);
req.getRequestDispatcher("/style/delete_style.jsp").forward(req, resp);
}
}
| [
"[email protected]"
]
| |
ab0780e723f652268d107cd529ae76c4ddec27e8 | 4baea63c9b7e70d0257c33f02782dbf9681de79d | /RMI/src/rmi_serializableList/ListItem.java | 329ba1e06343ab565eb472d279938ceadd188810 | [
"MIT"
]
| permissive | mwel/FOPT | 5355160d8f68691094046fae8caadb401b08f5cb | 5e20cc37816e790726711d065ec1f81b2c701731 | refs/heads/master | 2021-06-27T02:49:39.543848 | 2020-10-04T13:37:31 | 2020-10-04T13:37:31 | 154,032,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package rmi_serializableList;
import java.io.Serializable;
public class ListItem implements Serializable {
private int value;
private ListItem next;
public ListItem(int value) {
this.value = value;
this.next = null;
}
public int getValue() {
return value;
}
public ListItem getNext() {
return getNext();
}
public void setNext(ListItem nextListItem) {
next = nextListItem;
}
}
| [
"[email protected]"
]
| |
64490b71230506713d3b2ef71b878833d8e21e55 | be4675c3dc721a40c6e0b2750762fc3f96403bb3 | /src/test/java/com/empiresAndAllies/library/TestngListener.java | 07855229851e994109a41a296acc6ee98e29cc27 | []
| no_license | cbtautomation92/EmpiresandAllies | 5d939939cc44dee97f53b64b96f57bdcd3553293 | fd3acc3a35cd40f589d4ecc00618806a69a172b4 | refs/heads/master | 2021-01-11T19:53:01.961235 | 2017-01-20T06:42:51 | 2017-01-20T06:42:51 | 79,418,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,364 | java | /***********************************************************************
* @author : LAKSHMI BS
* @description : Implemented ITestListener interface and overrided methods as per requirement. It listenes to all the events performed by Testng and keep track of it.
* @method : onTestStart()
* @method : onTestSuccess()
* @method : onTestFailure()
* @method : onTestSkipped()
* @method : onTestFailedButWithinSuccessPercentage()
* @method : onStart()
* @method : onFinish()
* @method
*/
package com.empiresAndAllies.library;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.io.FileUtils;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
public class TestngListener implements ITestListener {
public static File sHtmlReports;
public static File sTestngReports;
public static String sdate;
public static String STestCaseID=null;
public TestngListener() throws IOException
{
Date date = new Date();
SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy_hh_mm_ss");
sdate = sdf.format(date);
sHtmlReports=new File(GenericLib.sDirPath+"//..//Reports//HTMLReports");
sTestngReports= new File(GenericLib.sDirPath+"//..//Reports//TestNGReports");
if(!sHtmlReports.exists())
{
FileUtils.forceMkdir(sHtmlReports);
}
if(!sTestngReports.exists())
{
FileUtils.forceMkdir(sTestngReports);
}
System.setProperty("KIRWA.reporter.config", "KIRWA.properties");
}
public void onTestStart(ITestResult result)
{
STestCaseID = result.getName();
}
public void onTestSuccess(ITestResult result)
{
}
public void onTestFailure(ITestResult result)
{
}
public void onTestSkipped(ITestResult result)
{
}
public void onTestFailedButWithinSuccessPercentage(ITestResult result)
{
}
public void onStart(ITestContext context)
{
}
public void onFinish(ITestContext context)
{
File testOuput = new File(GenericLib.sDirPath+"\\test-output");
String sTestngReports= GenericLib.sDirPath+"\\..\\Reports\\TestNGReports\\TestNG_"+sdate;
if(testOuput.renameTo(new File(sTestngReports)))
{
}else
{
System.out.println("testoutput is not moved");
}
}
}
| [
"RAGHUKIRAN92"
]
| RAGHUKIRAN92 |
c29b50041399bc03ed685d51e6772626ef5b8cbe | ced62ae5fb068627312a5e63a15fcc26e1596432 | /tests/simplify-01/src/test/java/org/jvnet/jaxb2_commons/plugin/simplify/tests01/Gh4Test.java | 0226d78e8dd5a68d1f9ab5724f18531a53218aa8 | [
"BSD-2-Clause"
]
| permissive | ja6a/jaxb2-basics | 3201d4fa346d4e0ab7aa9a9dfe8198c94a0f2a32 | fb6979be02e8acf3ba4674a4a91cd0f25d067148 | refs/heads/master | 2020-02-26T16:46:45.464595 | 2014-12-19T14:50:27 | 2014-12-19T14:50:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,081 | java | package org.jvnet.jaxb2_commons.plugin.simplify.tests01;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class Gh4Test {
private JAXBContext context;
@Before
public void setUp() throws Exception {
context = JAXBContext.newInstance(getClass().getPackage().getName());
}
@Test
public void compiles() {
final SimplifyReferencesPropertyAsElementPropertyType item = new SimplifyReferencesPropertyAsElementPropertyType();
item.getBase();
item.getBaseElement();
}
@Test
public void unmarshalls() throws Exception {
@SuppressWarnings("unchecked")
SimplifyReferencesPropertyAsElementPropertyType value = ((JAXBElement<SimplifyReferencesPropertyAsElementPropertyType>) context
.createUnmarshaller()
.unmarshal(
getClass()
.getResourceAsStream(
"simplifyReferencesPropertyAsElementProperty.xml")))
.getValue();
Assert.assertEquals(3, value.getBase().size());
Assert.assertEquals(3, value.getBaseElement().size());
}
}
| [
"[email protected]"
]
| |
4a3353deb9ace5062d29671817bcacdbf62dc0fd | 2d242a8d03163074b99e3c84547686a72a004f30 | /src/main/java/com/bettorleague/server/batch/football/data/org/processor/CompetitionProcessor.java | 0cfc47c413f5f0fb3a37f534302c00a28a6ed039 | []
| no_license | BettorLeague/bettor-league-api | 7882a5519cf2398870ea50e2ef9aac59ef16f1cd | 87019a922970bbbd29215e4da1e34aab601e6674 | refs/heads/master | 2023-05-01T12:24:22.305701 | 2019-07-02T13:20:06 | 2019-07-02T13:20:06 | 187,831,471 | 0 | 0 | null | 2023-04-14T17:47:36 | 2019-05-21T12:20:48 | Java | UTF-8 | Java | false | false | 2,130 | java | package com.bettorleague.server.batch.football.data.org.processor;
import com.bettorleague.server.dto.football.data.org.CompetitionDto;
import com.bettorleague.server.model.football.Competition;
import org.modelmapper.ModelMapper;
import org.springframework.batch.item.ItemProcessor;
public class CompetitionProcessor implements ItemProcessor<CompetitionDto,Competition> {
private ModelMapper modelMapper;
private String competitionId;
public CompetitionProcessor(ModelMapper modelMapper,
String competitionId){
this.modelMapper = modelMapper;
this.competitionId = competitionId;
}
@Override
public Competition process(CompetitionDto competitionDto) {
Competition competition = modelMapper.map(competitionDto,Competition.class);
competition.setLogo( this.getCompetitionlogo(competitionId) );
return competition;
}
private String getCompetitionlogo(String id){
switch (id){
case "2015": return "https://upload.wikimedia.org/wikipedia/fr/9/9b/Logo_de_la_Ligue_1_%282008%29.svg";
case "2001": return "https://upload.wikimedia.org/wikipedia/fr/b/bf/UEFA_Champions_League_logo_2.svg";
case "2021": return "https://upload.wikimedia.org/wikipedia/fr/f/f2/Premier_League_Logo.svg";
case "2002": return "https://upload.wikimedia.org/wikipedia/en/d/df/Bundesliga_logo_%282017%29.svg";
case "2014": return "https://upload.wikimedia.org/wikipedia/fr/2/23/Logo_La_Liga.png";
case "2019": return "https://upload.wikimedia.org/wikipedia/en/f/f7/LegaSerieAlogoTIM.png";
case "2000": return "https://upload.wikimedia.org/wikipedia/en/6/67/2018_FIFA_World_Cup.svg";
case "2003": return "https://upload.wikimedia.org/wikipedia/fr/3/3e/Eredivisie-Logo.svg";
case "2013": return "https://upload.wikimedia.org/wikipedia/en/4/42/Campeonato_Brasileiro_S%C3%A9rie_A_logo.png";
case "2017": return "http://www.thefinalball.com/img/logos/edicoes/70079_imgbank_.png";
default: return null;
}
}
}
| [
"[email protected]"
]
| |
f2c60d5a3e6d4431a470ca648be68434e9f83ba4 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/test/java/org/gradle/test/performancenull_373/Testnull_37295.java | 53fc626266751cf0ecb5ea9267bcda9fe31b0c88 | []
| no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 308 | java | package org.gradle.test.performancenull_373;
import static org.junit.Assert.*;
public class Testnull_37295 {
private final Productionnull_37295 production = new Productionnull_37295("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"[email protected]"
]
| |
58c003abc117e2ae6534da7295ececadb168cab9 | 05fb661633873b55030a18a4d18c4481492101a1 | /src/main/java/com/example/demo/config/userConfig.java | a3d8ab3dc72bf63afe9bc3d710ab730a13c529e4 | []
| no_license | chowtha/SpringRestCRUD | 45a0ed0318a5322993bbcc8028968b856f4953fc | c3bb2ea0fa74f1f7774334abbfef07db1863d4bc | refs/heads/master | 2023-07-14T18:41:39.018845 | 2021-08-24T08:03:16 | 2021-08-24T08:03:16 | 399,364,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package com.example.demo.config;
import static springfox.documentation.builders.PathSelectors.regex;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class userConfig {
@Bean
public Docket postsApi() {
return new Docket(DocumentationType.SWAGGER_2).groupName("Rest CRUD Operations").apiInfo(apiInfo()).select()
.paths(regex("/employee.*")).build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("Employee Service")
.description("Rest API CRUD operations Using SWAGGER2 for Employee details").build();
}
} | [
"[email protected]"
]
| |
f968626cdae00b2c8235f1a80026a8a9aa0f4d6f | d83908ad9a9273a0a966788e3e945bfc11eb3008 | /product/src/main/java/com/ys/product/utils/ResponseStatus.java | fd7e49521b2057d7045929fd009fa8447e0fa1ea | []
| no_license | yang1097711044/springboot-fit | fe0d7cb46cb8b9539036992622a7f6d8d727367c | 31bf6b5f821ab86f70b925cc6635d161a721af52 | refs/heads/master | 2022-08-18T18:14:17.131301 | 2019-09-21T08:37:36 | 2019-09-21T08:37:36 | 209,501,586 | 0 | 0 | null | 2022-06-21T01:54:15 | 2019-09-19T08:26:31 | Java | UTF-8 | Java | false | false | 2,423 | java | package com.ys.product.utils;
/**
* 自己根据公司的业务场景定制,
* 参照 https://docs.open.alipay.com/common/105806/
*
* @author zhangwei
*/
public enum ResponseStatus {
/* 成功状态码 10000 */
SUCCESS(200, "成功"),
/* 账号错误*/
/*用户未登录*/
ACCOUNT_NOT_LOGIN(10001, "user no login"),
/*账号不存在或密码错误*/
ACCOUNT_LOGIN_ERROR(10002, "user login error"),
/*账号已存在*/
ACCOUNT_IS_EXISTENT(10003, "account is existent"),
/*账号不存在*/
ACCOUNT_NOT_EXIST(10004, "account not exist"),
/*账号已禁止 请与管理员联系*/
USER_ACCOUNT_LOCKED(10005, "user account locked"),
/* 参数错误*/
/*参数不为空*/
PARAMS_NOT_IS_BLANK(20001, "params not is blank"),
/*参数无效*/
PARAMS_IS_INVALID(20002, "params is invalid"),
/*参数类型错误*/
PARAM_TYPE_ERROR(20003, "param type error"),
/*参数缺失*/
PARAM_IS_DEFICIENCY(20004, "param is deficiency"),
/*暂无权限*/
PERMISSION_NO_ACCESS(20006, "no permissions access"),
AUTH_ERROR(20007, "auth error"),
/* 业务错误 */
/* 业务繁忙 请稍后在试 */
BUSINESS_UNKNOW_ERROR(30001, " busy with business"),
/*内部调用服务不可用*/
GW_UNKNOW_ERROR(30002, "unknow error"),
/* ======系统错误:40001-49999===== */
/* 提示语 "系统繁忙,请稍后重试"*/
SYSTEM_INNER_ERROR(40001, "system error"),
/*未知错误 请稍后在试*/
SYSTEM_UNKNOW_ERROR(40002, "system unknow error"),
/*内部系统接口调用异常*/
INNER_INVOKE_ERROR(50001, "inner invoke error"),
/*外部系统接口调用异常*/
OUTER_INVOKE_ERROR(50002, "outer invoke error"),
/*该接口禁止访问*/
NO_ACCESS_FORBIDDEN(50003, "no access forbidden"),
/*接口地址无效*/
NO_FOUND_ERROR(50004, "no found error"),
/* 数据错误 */
DATA_IS_WRONG(60001, "DATA_IS_WRONG");
private Integer status;
private String msg;
ResponseStatus(Integer status, String message) {
this.status = status;
this.msg = message;
}
public Integer getStatus() {
return status;
}
public String getMsg() {
return msg;
}
public void setStatus(Integer status) {
this.status = status;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
| [
"[email protected]"
]
| |
656728c2383e7ca613a35598105a7bd1583d7693 | 55d32ebe3b454254ccdc12510cc69db64b128612 | /app/src/main/java/com/krzysiudan/ourshoppinglist/activities/BaseActivity.java | 6d4dc7d511c5b56e22698eb1f22157ca305c6877 | []
| no_license | Krzysiudan/OurShoppingList | 94549f86b40e5f30e198152bd37ffd16b872c01f | bfc9935b980bfc8bb2da0d1db136052336424fea | refs/heads/master | 2020-04-12T04:17:46.437958 | 2020-03-03T20:47:56 | 2020-03-03T20:47:56 | 162,291,130 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | package com.krzysiudan.ourshoppinglist.activities;
import android.app.Activity;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.krzysiudan.ourshoppinglist.application.MyApp;
public class BaseActivity extends AppCompatActivity {
protected MyApp mMyApp;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMyApp = (MyApp)this.getApplicationContext();
}
protected void onResume() {
super.onResume();
mMyApp.setCurrentActivity(this);
}
protected void onPause() {
clearReferences();
super.onPause();
}
protected void onDestroy() {
clearReferences();
super.onDestroy();
}
private void clearReferences(){
Activity currActivity = mMyApp.getCurrentActivity();
if (this.equals(currActivity))
mMyApp.setCurrentActivity(null);
}
}
| [
"[email protected]"
]
| |
3b9533c016e1e669f2b2818b2d3a1dea12e2cb57 | 96ab6673c6e44133491c0644409d08b15af19cd6 | /src/test/java/com/example/clinic/service/PrescriptionServiceTest.java | b84390374358c8df1fa07bd7ec108cd6d152b6e2 | []
| no_license | warkoczek/clinic | 03f1ec391b7b3beb51fea34360f8ff56376200e3 | 92d32ea67582a3a8d8867d41d622336b98c682fc | refs/heads/master | 2021-03-01T16:17:48.588544 | 2020-04-15T08:51:28 | 2020-04-15T08:51:28 | 245,798,023 | 0 | 0 | null | 2020-10-13T21:12:25 | 2020-03-08T10:58:37 | Java | UTF-8 | Java | false | false | 3,590 | java | package com.example.clinic.service;
import com.example.clinic.domain.*;
import com.example.clinic.model.dto.prescription.PrescriptionDTO;
import com.example.clinic.repository.DoctorRepository;
import com.example.clinic.repository.PatientRepository;
import com.example.clinic.repository.PrescriptionRepository;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.time.LocalDateTime;
import java.util.Optional;
@SpringBootTest
@ExtendWith(SpringExtension.class)
class PrescriptionServiceTest {
@Autowired
private PrescriptionService sut;
@Autowired
private PrescriptionRepository prescriptionRepository;
@Autowired
private PatientRepository patientRepository;
@Autowired
private DoctorRepository doctorRepository;
@Test
void addPrescriptionShouldReturnPrescriptionId4forNewPrescription() {
//given
Patient patient = patientRepository.findPatientByUsername("juras").get();
Doctor doctor = doctorRepository.findDoctorByUsername("mario").get();
Prescription prescription = new Prescription(LocalDateTime.of(2020,03,29,9,00,00),
LocalDateTime.of(2020,04,29,00,00,00), PrescriptionType.ONGOING
, patient , doctor,"common flu, take vitamin C 3 times a day");
Long expectedPrescriptionId = 5l;
String expectedPrescriptionDescription = "common flu, take vitamin C 3 times a day";
//when
Long actualPrescriptionId = sut.addPrescription(prescription);
String actualPrescriptionDescription = sut.getPrescriptionsByPatient(patient.getUsername()).get(1).getDescription();
//then
Assert.assertEquals(expectedPrescriptionId,actualPrescriptionId);
Assert.assertEquals(expectedPrescriptionDescription,actualPrescriptionDescription);
}
@Test
public void dispenseMedicineShouldReturnNewExpiryDateForOngoingPrescriptionWithId1(){
//given
Long prescriptionId = 1l;
LocalDateTime expectedExpiryDate = LocalDateTime.of(2020, 10, 02, 00, 00 ,00);
//when
sut.dispenseMedicine(prescriptionId);
LocalDateTime actualExpiryDate = sut.getPrescriptionById(prescriptionId).get().getPrescriptionExpiryDate();
//then
Assert.assertEquals(expectedExpiryDate, actualExpiryDate);
}
@Test
public void dispenseMedicineShouldReturnPrescriptionInValidForDisposablePrescriptionWithId3(){
//given
Long prescriptionId = 3l;
Dispense dispense = new Dispense("Prescription invalid!!!");
Optional<Dispense> expectedMessage = Optional.of(dispense);
//when
Optional<Dispense> actualMessage = sut.dispenseMedicine(prescriptionId);
//then
Assert.assertEquals(expectedMessage.get().getMessage(), actualMessage.get().getMessage());
}
@Test
public void dispenseMedicineShouldReturnMessageDispensedForOngoingPrescriptionWithId1(){
//given
Long prescriptionId = 1l;
Dispense dispense = new Dispense("Dispensed");
Optional<Dispense> expectedMessage = Optional.of(dispense);
//when
Optional<Dispense> actualMessage = sut.dispenseMedicine(prescriptionId);
//then
Assert.assertEquals(expectedMessage.get().getMessage(), actualMessage.get().getMessage());
}
}
| [
"[email protected]"
]
| |
e1e7d45b633f55638b0ec9bce7cda8ceabefb0ba | be7fe807b2a7af7b8c196de18bcd707e5802b224 | /String/unqiueEmailaddress.java | 190736663b102e790427001cecc345948a327edb | []
| no_license | VijayPutta/Algorithms | 9c1d7473a233f4d2dc76bed2d88f51399f462520 | fc550fbbe34cf60486c49194bb6bb8822525110a | refs/heads/master | 2020-11-25T05:13:46.628864 | 2020-01-05T12:16:34 | 2020-01-05T12:16:34 | 228,515,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | class Solution {
public int numUniqueEmails(String[] emails) {
Set<String> seen = new HashSet();
for(String email:emails){
int i=email.indexOf('@');
String local = email.substring(0,i);
String rest = email.substring(i);
if(local.contains("+")){
local= local.substring(0,local.indexOf('+'));
}
local = local.replace(".","");
String s = local+rest;
seen.add(s);
}
return seen.size();
}
}
| [
"[email protected]"
]
| |
d32147daac37ad2d095e003e94cf77bee60984d0 | 88a65a4f471612e14b769c4c0bdbf3b3f30cb045 | /SMA1/src/aasss/Task1.java | 588036742b453b87a5c0a398f19bb5c74e633b7d | []
| no_license | Alhussien31/DStask1 | 258dc9b78998f6167bf3388cc4094b939b12df54 | ebfba4f3ddb731c77f4286c61fae833553eb6b66 | refs/heads/master | 2022-12-20T21:54:11.417592 | 2020-09-25T17:22:53 | 2020-09-25T17:22:53 | 298,633,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,461 | java | package aasss;
public class Task1 {
public static void main(String[] args) {
double[] myList = {1,-7, -6, 9, 8};
//Q1:Find the sum of all negative numbers in array.
double sumoutP = 0;
for (int i = 0; i < myList.length; i++) {
if(myList[i]<0)
sumoutP += myList[i];
}
System.out.println("sum of all negative numbers :" + sumoutP);
//Q2:Find the sum of all positive numbers in array.
double sumoutN = 0;
for (int i = 0; i < myList.length; i++) {
if(myList[i]>0)
sumoutN += myList[i];
}
System.out.println("sum of all positive numbers :" +sumoutN);
//Q3:Find the average of all negative numbers
System.out.println("average of all negative numbers :" +sumoutP/2
);
//Q4:Find the average of all positive numbers
System.out.println("average of all positive numbers :"+sumoutN/3);
//Q5:Find the maximum value in array
double max = myList[0];
for (int i = 1; i < myList.length; i++) {
if (myList[i] > max) max = myList[i];
}
System.out.println("maximum value in array :"+max);
//Q6:6. Find the minimum value in array.
double min = myList[0];
for (int i = 1; i < myList.length; i++) {
if (myList[i] < min) min = myList[i];
}
System.out.println("min value in array :"+min);
}}
| [
"ALHUSSIEN@DESKTOP-186M9MT"
]
| ALHUSSIEN@DESKTOP-186M9MT |
7ba0f62b909c74986bc70589d4ef5849212cba0b | 511670f0a7b04b99a093f02cc280369cb5d67f67 | /src/main/java/leetcode/搜索插入位置.java | 1605fad99faa713eeb62977f564d2e9e3ff0a025 | []
| no_license | xiaosamo/Algorithms | 11c9f7103a2277482f66d6d505edd0c64036c0fc | d73c626df72289ef59b6de1cdf768df28d2a5603 | refs/heads/master | 2022-07-02T00:58:04.544446 | 2020-06-28T03:34:27 | 2020-06-28T03:34:27 | 186,937,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package leetcode;
public class 搜索插入位置 {
public static int searchInsert(int[] nums, int target) {
for (int i = 0; i < nums.length; i++) {
if (nums[i] == target) {
return i;
} else if (nums[i] > target) {
return i;
}
}
return nums.length;
}
public static void main(String[] args) {
int []a={1,3,5,6};
System.out.println(searchInsert(a, 0));
}
}
| [
"[email protected]"
]
| |
10599fc55d56e038b07b2d843a22e6aceacb1799 | 30cc96af0327f00c2830fc6ba9f856aeb74c179c | /core/src/main/java/ru/nikita/platform/sms/providers/ProtocolsRegistry.java | 120338533d28a090e4de9b6c9c069bf9c90b76da | []
| no_license | nikelin/SMSi | 6562ec04f74a8abe3bd72a055136fe02f025c2f1 | 9c79af8ae9a6c61ec054c899a2303d1fe3a7e9d3 | refs/heads/master | 2021-01-17T17:05:44.661627 | 2012-03-18T10:52:37 | 2012-03-18T10:52:37 | 3,754,302 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package ru.nikita.platform.sms.providers;
import com.redshape.utils.IEnum;
import ru.nikita.platform.sms.providers.impl.ESMEProvider;
import java.util.HashMap;
import java.util.Map;
/**
* This class is not suitable to be used in RMI context!
*/
public final class ProtocolsRegistry {
private static Map<ProtocolType, Class<? extends IProvider>> registry
= new HashMap<ProtocolType, Class<? extends IProvider>>();
static {
registry.put( ProtocolType.SMSC, ESMEProvider.class );
}
public static Class<? extends IProvider> get( ProtocolType type ) {
return registry.get( type );
}
public static void register( ProtocolType type, Class<? extends IProvider> protocolClazz ) {
registry.put( type, protocolClazz );
}
}
| [
"[email protected]"
]
| |
0b8b88298f0781aa720462563e4fae109a38a507 | 4fff4285330949b773e0b615484fb9c4562ff2cd | /vc-web/vc-web-front/src/main/java/com/ccclubs/admin/model/CsCan.java | 462ffe5674f48746ce9f238b56a8334a11ca9a3b | [
"Apache-2.0"
]
| permissive | soldiers1989/project-2 | de21398f32f0e468e752381b99167223420728d5 | dc670d7ba700887d951287ec7ff4a7db90ad9f8f | refs/heads/master | 2020-03-29T08:48:58.549798 | 2018-07-24T03:28:08 | 2018-07-24T03:28:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,783 | java | package com.ccclubs.admin.model;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import com.ccclubs.frm.spring.resolver.Resolver;
/**
* 车辆实时CAN信息
* @author Joel
*/
public class CsCan implements java.io.Serializable
{
private static final long serialVersionUID = 1L;
/**
* [csc_id]编号
*/
private @Id@GeneratedValue(strategy = GenerationType.IDENTITY) Long cscId;
/**
* [csc_access]接入商
*/
private Integer cscAccess;
/**
* [csc_number]车机号
*/
private String cscNumber;
/**
* [csc_car]车辆
*/
private Integer cscCar;
/**
* [csc_model]适配车型
*/
private Short cscModel;
/**
* [csc_type]CAN类型1:11bit 2:29bit
*/
private Short cscType;
/**
* [csc_order]订单号
*/
private Long cscOrder;
/**
* [csc_data]报文数据
*/
private String cscData;
/**
* [csc_upload_time]报文时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
private Date cscUploadTime;
/**
* [csc_add_time]接收时间
*/
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
private Date cscAddTime;
/**
* [csc_status]状态
*/
private Short cscStatus;
//默认构造函数
public CsCan(){
}
//主键构造函数
public CsCan(Long id){
this.cscId = id;
}
//设置非空字段
public CsCan setNotNull(Long cscId,Integer cscAccess,String cscNumber,Date cscUploadTime,Date cscAddTime){
this.cscId=cscId;
this.cscAccess=cscAccess;
this.cscNumber=cscNumber;
this.cscUploadTime=cscUploadTime;
this.cscAddTime=cscAddTime;
return this;
}
public Object getCscAccessText(){
return resolve("cscAccessText");
}
public Object getCscNumberText(){
return resolve("cscNumberText");
}
public Object getCscCarText(){
return resolve("cscCarText");
}
public Object getCscTypeText(){
return resolve("cscTypeText");
}
@Transient
Map<String, Resolver<CsCan>> resolvers = new HashMap<String, Resolver<CsCan>>();
public void registResolver(Resolver<CsCan> resolver){
this.resolvers.put(resolver.getName(), resolver);
}
public Object resolve(String key){
if(resolvers.get(key)!=null){
return resolvers.get(key).execute(this);
}
return null;
}
/*******************************编号**********************************/
/**
* 编号 [非空]
**/
public Long getCscId(){
return this.cscId;
}
/**
* 编号 [非空]
**/
public void setCscId(Long cscId){
this.cscId = cscId;
}
/*******************************接入商**********************************/
/**
* 接入商 [非空]
**/
public Integer getCscAccess(){
return this.cscAccess;
}
/**
* 接入商 [非空]
**/
public void setCscAccess(Integer cscAccess){
this.cscAccess = cscAccess;
}
/*******************************车机号**********************************/
/**
* 车机号 [非空]
**/
public String getCscNumber(){
return this.cscNumber;
}
/**
* 车机号 [非空]
**/
public void setCscNumber(String cscNumber){
this.cscNumber = cscNumber;
}
/*******************************车辆**********************************/
/**
* 车辆 [可空]
**/
public Integer getCscCar(){
return this.cscCar;
}
/**
* 车辆 [可空]
**/
public void setCscCar(Integer cscCar){
this.cscCar = cscCar;
}
/*******************************适配车型**********************************/
/**
* 适配车型 [可空]
**/
public Short getCscModel(){
return this.cscModel;
}
/**
* 适配车型 [可空]
**/
public void setCscModel(Short cscModel){
this.cscModel = cscModel;
}
/*******************************CAN类型**********************************/
/**
* CAN类型 [可空]
**/
public Short getCscType(){
return this.cscType;
}
/**
* CAN类型 [可空]
**/
public void setCscType(Short cscType){
this.cscType = cscType;
}
/*******************************订单号**********************************/
/**
* 订单号 [可空]
**/
public Long getCscOrder(){
return this.cscOrder;
}
/**
* 订单号 [可空]
**/
public void setCscOrder(Long cscOrder){
this.cscOrder = cscOrder;
}
/*******************************报文数据**********************************/
/**
* 报文数据 [可空]
**/
public String getCscData(){
return this.cscData;
}
/**
* 报文数据 [可空]
**/
public void setCscData(String cscData){
this.cscData = cscData;
}
/*******************************报文时间**********************************/
/**
* 报文时间 [非空]
**/
public Date getCscUploadTime(){
return this.cscUploadTime;
}
/**
* 报文时间 [非空]
**/
public void setCscUploadTime(Date cscUploadTime){
this.cscUploadTime = cscUploadTime;
}
/*******************************接收时间**********************************/
/**
* 接收时间 [非空]
**/
public Date getCscAddTime(){
return this.cscAddTime;
}
/**
* 接收时间 [非空]
**/
public void setCscAddTime(Date cscAddTime){
this.cscAddTime = cscAddTime;
}
/*******************************状态**********************************/
/**
* 状态 [可空]
**/
public Short getCscStatus(){
return this.cscStatus;
}
/**
* 状态 [可空]
**/
public void setCscStatus(Short cscStatus){
this.cscStatus = cscStatus;
}
} | [
"[email protected]"
]
| |
32ba8d6810b489b70e3738d61a980ab65b2538a3 | 34c07fd5d1d790636b5e358c27a767801c22a6c3 | /Integrador/src/integrador/Practica.java | a6ca165906538582970ff5cbc740d270a2ffa199 | []
| no_license | GonzaloDRM/EjerciciosJava | ec865692d6dedceaac08f83cd41b8625aa5df037 | 1b65951e707b064a9af7fc5b6292dec813cd60f5 | refs/heads/main | 2023-06-25T09:27:34.836209 | 2021-07-15T15:09:59 | 2021-07-15T15:09:59 | 385,814,790 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,003 | java | package integrador;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.List;
public class Practica {
/**
* El programa debera tomar un numero x y determinar si es capicua o no
* **Contemplar que el num que llega puede ser null,en caso de que sea null,
* retornar false, en caso que sea capicua retornar true.
*
* @param num
* @return esCapicua
*/
public Boolean numeroCapicua(Long num) {
try {
long num1 = Math.abs(num);
num = Math.abs(num);
String n;
boolean fin;
int resp = 0;
int larg = String.valueOf(num).length() / 2;
for (int i = 0; i < larg; i++) {
n = String.valueOf(num1 % 10);
if (n.equals(num.toString().substring(i, i + 1))) {
resp += 1;
}
num1 = num1 / 10;
}
if (resp == larg) {
fin = true;
} else {
fin = false;
}
return fin;
} catch (NullPointerException e) {
return false;
}
}
/**
* Estamos en caramelolandia, donde estan los peores ladrones de dulces. Una
* vez al mes, se sienta una n cantidad de presos en ronda, contemplando al
* primer preso que se sienta, como el preso 0. A los presos se le repartira
* una m cantidad de caramelos contemplando que se comenzaran a repartir los
* caramelos desde el primer preso (inicio). El ultimo caramelo en
* repartirse estara podrido, determinar a que preso, segun su posicion en
* la ronda le tocara.
*
* @param inicio
* @param cantidadCaramelos
* @param cantidadPresos
* @return presoQueLeTocoElCarameloPodrido
*/
public int prisioneroDulce(int inicio, int cantidadCaramelos, int cantidadPresos) {
//Aca escribir la logica necesaria
int resp = 0;
try {
resp = cantidadCaramelos % cantidadPresos;
resp = resp + inicio;
if (resp > cantidadPresos) {
resp = resp - cantidadPresos;
}
} catch (Exception e) {
System.out.println(e.getClass().getSimpleName());
}
return resp - 1;
}
/**
* En un universo paralelo, donde los habitantes son medias, existe un
* crucero de medias donde se sube una lista de medias. Esta lista de
* tripulantes del crucero es una Collection de letras, lo que se debera
* hacer, es filtrar la lista de medias que se suben al crucero y retornar
* una lista que contenga los grupos de medias que si tenian amigas. Esta
* lista final de medias amigas se mostraran ordenadas de menor a mayor. A
* continuacion un ejemplo:
*
* List de medias que llegan : A,B,A,B,C,A,F,Z,C,H **F,Z,H no tienen amigas
* :( List que se deberia retornar : A,B,C
*
*
* @param pasajeros
* @return mediasAmigas
*/
public List<String> mediasAmigas(List<String> pasajeros) {
//Aca escribir la logica necesaria
List<String> amigas = new ArrayList();
try {
for (int i = 0; i < pasajeros.size(); i++) {
for (int j = i + 1; j < pasajeros.size(); j++) {
if (pasajeros.get(i).equals(pasajeros.get(j))) {
amigas.add(pasajeros.get(i));
break;
}
}
}
for (int i = 0; i < amigas.size(); i++) {
for (int j = i+1; j < amigas.size(); j++) {
if(amigas.get(i).equals(amigas.get(j))){
amigas.remove(j);
}
}
}
Collections.sort(amigas);
} catch (Exception e) {
System.out.println(e.getClass().getSimpleName());
}
return amigas;
}
}
| [
"[email protected]"
]
| |
665d72ca645a915e421b450d600d58532bfa0a07 | ad562f39e2c652030d2dda054ab508c98c65ef1c | /src/oops_concepts/Constructor.java | c71d3c9acf284b30c5d7f9132097f58ebdaa0bf1 | [
"MIT"
]
| permissive | Mahesh-Parmar/CoreJava | cd88193ccba413f71500a63a3a63d5648ed08ede | 27da921ce8f5407f29a71632b7fda8c21b15336a | refs/heads/master | 2021-01-03T10:53:42.055213 | 2020-06-13T11:22:45 | 2020-06-13T11:22:45 | 240,049,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java | package oops_concepts;
public class Constructor {
/**
* Concept of Constructor
* A block of code similar to method that get executed when instance of a class is created
* Generally used to initialize member variables of a class
* Constructor name is same as that of class name
* Constructor does not have return type (It does not return only value)
* Constructor overloading
*/
/**
* ***Example***
* 1. Create a Road_Toll class
* 2. Create member variables for Type of Vehicle, Number of Tries
* 3. Create a method to calculate the toll amount depending upon the number of tires for a vehicle
* If tires count == 2 Then Toll Amount is 0
* If tires count == 4 Then Toll Amount is 10
* If tires count > 4 Then Toll Amount is 20
* 4. Create a RoadToll_Main class with Main Method
* 5. Create Object of Road_Toll
* 6. Assign values to member variables fo class and call the method to calculate the roll
* 7. Create a constructor in Road_Toll class
* 8. Create object of Road_Toll class using new constructor
*/
}
| [
"[email protected]"
]
| |
524f4d606899736f24028fb64f4cbdc4a1d89d22 | bc8e436ad945cc075b9d47869e82529d972969b6 | /ca-dbtool/src/main/java/org/xipki/ca/dbtool/xmlio/ca/RequestCertsWriter.java | deedf493cb9f93a1f78b3b43a6c48523d48acc78 | [
"Apache-2.0"
]
| permissive | etsangsplk/xipki | 283ac407756c2856a91e01787db271f8a92bb4b0 | 230365bf7e5686b83a186e2bebcef49c08b55887 | refs/heads/master | 2020-03-18T13:16:57.382344 | 2018-05-24T05:19:10 | 2018-05-24T05:19:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,296 | java | /*
*
* Copyright (c) 2013 - 2018 Lijun Liao
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xipki.ca.dbtool.xmlio.ca;
import java.io.IOException;
import javax.xml.stream.XMLStreamException;
import org.xipki.ca.dbtool.xmlio.DbiXmlWriter;
import org.xipki.ca.dbtool.xmlio.InvalidDataObjectException;
import org.xipki.common.util.ParamUtil;
/**
* TODO.
* @author Lijun Liao
* @since 2.0.0
*/
public class RequestCertsWriter extends DbiXmlWriter {
public RequestCertsWriter() throws IOException, XMLStreamException {
super(RequestCertType.TAG_PARENT, "1");
}
public void add(RequestCertType entry) throws InvalidDataObjectException, XMLStreamException {
ParamUtil.requireNonNull("entry", entry);
entry.validate();
entry.writeTo(this);
}
}
| [
"[email protected]"
]
| |
b08ff2d6da5a212208fa038a105801915bccab4f | 0ee6b1b3fe52952a7bcff344927324b32361f31a | /app/src/main/java/org/stepik/android/adaptive/api/ViewRequest.java | 9a145c99fff17e556e1b5dc38ff3f6ff73be2cad | []
| no_license | gusio-ai/stepik-android-adaptive | 314912ae283c2a73c57abbddf59134d719f3453f | f6bb8e68e926857d216bf6d845c05af0ecaa7b75 | refs/heads/master | 2023-01-03T10:29:50.705751 | 2018-12-14T11:37:01 | 2018-12-14T11:37:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package org.stepik.android.adaptive.api;
import org.stepik.android.adaptive.data.model.View;
public final class ViewRequest {
private View view;
public ViewRequest(long assignment, long step) {
this.view = new View(assignment, step);
}
}
| [
"[email protected]"
]
| |
e003e8c90bc7cafacf83380bf9f960d647ca14c5 | dc8da4e0ad7bebe9ffeabd05de6a71c04fab940f | /src/main/java/com/example/imsproject/Recyclerviewadapter.java | 6649345cb6bfe69f9f4bf30509f5ee4894b71e33 | []
| no_license | Vinzler/IMS | 719efc9cafe385b842b022193d180c1c77cd7604 | 8dba2c8f3b6c9b10cc39757e22358d255319edf7 | refs/heads/master | 2020-06-09T10:22:45.991108 | 2019-06-24T04:38:44 | 2019-06-24T04:38:44 | 193,422,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,764 | java | package com.example.imsproject;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class Recyclerviewadapter extends RecyclerView.Adapter<Recyclerviewadapter.ViewHolder> {
private Context context;
private ArrayList<String> submitters = new ArrayList<String>();
private ArrayList<String> categories = new ArrayList<String>();
private ArrayList<String> ideas = new ArrayList<String>();
private ArrayList<String> types = new ArrayList<String>();
private ArrayList<String> uids = new ArrayList<String>();
private ArrayList<String> ideatags = new ArrayList<String>();
public Recyclerviewadapter(Context context,ArrayList<String> submitters,ArrayList<String> categories,ArrayList<String> ideas,ArrayList<String> types,ArrayList<String> uids,ArrayList<String> ideatags){
this.submitters = submitters;
this.context = context;
this.categories = categories;
this.ideas = ideas;
this.types = types;
this.uids = uids;
this.ideatags = ideatags;
}
@NonNull
@Override
public Recyclerviewadapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_listitem,parent,false);
ViewHolder holder = new ViewHolder(view,context,ideatags);
return holder;
}
@Override
public void onBindViewHolder(@NonNull Recyclerviewadapter.ViewHolder holder, int position) {
holder.recyclersubmitter.setText(submitters.get(position));
holder.recyclercategory.setText(categories.get(position));
holder.recycleridea.setText(ideas.get(position));
holder.recyclertype.setText(types.get(position));
holder.recycleruid.setText(uids.get(position));
holder.recyclerideatag.setText(ideatags.get(position));
}
@Override
public int getItemCount() {
return ideas.size();
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
Context context;
ArrayList<String> ideatags;
TextView recyclersubmitter;
TextView recyclercategory;
TextView recycleridea;
TextView recyclertype;
TextView recycleruid;
TextView recyclerideatag;
RelativeLayout parentlayout;
public ViewHolder(@NonNull View itemView,Context context,ArrayList<String> ideatags) {
super(itemView);
parentlayout = itemView.findViewById(R.id.parent_layout);
recyclersubmitter = itemView.findViewById(R.id.recyclersubmitter);
recyclercategory = itemView.findViewById(R.id.recyclercategory);
recycleridea = itemView.findViewById(R.id.recycleridea);
recyclertype = itemView.findViewById(R.id.recyclertype);
recycleruid = itemView.findViewById(R.id.recyclersubmitteruid);
recyclerideatag = itemView.findViewById(R.id.recyclerideatag);
itemView.setOnClickListener(this);
this.context = context;
this.ideatags = ideatags;
}
@Override
public void onClick(View view) {
Intent intent = new Intent(context,ViewideaActivity.class);
intent.putExtra("ideatag",ideatags.get(getAdapterPosition()));
context.startActivity(intent);
}
}
}
| [
"[email protected]"
]
| |
314a43856a86fe0baa0fe5498db9ab567a3b926f | 0659d2711518cd9016b1dd0ec4a69cdd31989532 | /src/com/syncsys/factories/FactoryHolder.java | eaeb819d20db1bda093f383309de4ed6c86e3c60 | []
| no_license | antonrogo1/SynchronousSystem | baf9b9d0bfbae5b5f85cba39c0ecebe1bec5a646 | 69067299d13953d23fa493e21a0012ddd5f71d3e | refs/heads/master | 2021-01-13T11:30:39.680339 | 2017-03-27T01:32:03 | 2017-03-27T01:32:03 | 81,682,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package com.syncsys.factories;
/**
* Created by z on 3/26/17.
* The idea behind the FactoryHolder is to make it easier to switch modes by simply changing the factory implementation.
*/
public class FactoryHolder {
private static Factory factory;
public static void setFactory(Factory implementation){
factory = implementation;
}
public static Factory getFactory(){
return factory;
}
}
| [
"[email protected]"
]
| |
5848c9870416e0f87e8b051cca05a712d115708f | b07a627dbbbb7a2afd5082520f17f81b9d048d05 | /javaBasic/src/Operator/OperatorEx9.java | 421ba1567db8988f9d70f691cbdf36f8c614c028 | []
| no_license | ParkHanSeo/Java_Basic | dd2f5029e5e87d472ce6c21b187af138cb1ee572 | cfdf56882b04be589ea9ed56c730ee7a185604ba | refs/heads/master | 2023-07-14T03:46:39.448057 | 2021-08-13T11:35:50 | 2021-08-13T11:35:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | package Operator;
public class OperatorEx9 {
public static void main(String[] args) {
long c = 1_000_000;
long d = 1_000_000;
long a = c * d;
long b = 1_000_000 * 1_000_000L;
System.out.println(a);
System.out.println(b);
}
}
| [
"user@DESKTOP-04GIHST"
]
| user@DESKTOP-04GIHST |
d32666f6d67c0d628161653bb150955123893ee1 | e8e8d2f0054d09d21089dad95edaffb560ef927f | /src/main/java/me/lucko/networkinterceptor/common/CommonCommandSender.java | 270eb067164d118ecd2d44892951e9d645cc631b | [
"Unlicense"
]
| permissive | xiyiziran/NetworkInterceptor | e7fed9819d1d3c1e2241a00b1b48aaaca545e9fe | d8881cab2d5f1d132936d0ded101705ef6d945a0 | refs/heads/master | 2023-08-19T03:56:54.244137 | 2021-10-17T01:57:36 | 2021-10-17T01:57:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,206 | java | package me.lucko.networkinterceptor.common;
import com.velocitypowered.api.command.CommandSource;
import net.kyori.adventure.text.Component;
import net.md_5.bungee.api.chat.TextComponent;
public interface CommonCommandSender {
void send(String msg);
void send(String... msgs);
boolean hasPermission(String perm);
public static final class Spigot implements CommonCommandSender {
private final org.bukkit.command.CommandSender sender;
public Spigot(org.bukkit.command.CommandSender sender) {
this.sender = sender;
}
@Override
public void send(String msg) {
sender.sendMessage(msg);
}
@Override
public void send(String... msgs) {
sender.sendMessage(msgs);
}
@Override
public boolean hasPermission(String perm) {
return sender.hasPermission(perm);
}
}
public static class Bungee implements CommonCommandSender {
private final net.md_5.bungee.api.CommandSender sender;
public Bungee(net.md_5.bungee.api.CommandSender sender) {
this.sender = sender;
}
@Override
public void send(String msg) {
sender.sendMessage(new TextComponent(msg));
}
@Override
public void send(String... msgs) {
for (String msg : msgs) {
send(msg);
}
}
@Override
public boolean hasPermission(String perm) {
return sender.hasPermission(perm);
}
}
public static class Velocity implements CommonCommandSender {
private final CommandSource source;
public Velocity(CommandSource source) {
this.source = source;
}
@Override
public void send(String msg) {
source.sendMessage(Component.text(msg)); // TODO - colors
}
@Override
public void send(String... msgs) {
for (String msg : msgs) {
send(msg);
}
}
@Override
public boolean hasPermission(String perm) {
return source.hasPermission(perm);
}
}
}
| [
"[email protected]"
]
| |
e61749113e2cc2dbbcc355fca8bc657f92e2d6a7 | a152cedc843a597225c30cb9c3d5e38929773a3a | /java/ohi/andre/consolelauncher/commands/raw/peoples.java | bb9437b0a99f74ff420917272ca9591eb0aae9a2 | []
| no_license | Citlalatonac/andre1299-ConsoleLauncher | 98374c34cc376cd4c0e1893b3e127e9e5d8fdd93 | 4fec6cafbcd1e6760a509b56fba367ef5d14cfbe | refs/heads/master | 2020-04-11T03:37:02.374270 | 2016-01-09T09:38:01 | 2016-01-09T09:38:01 | 50,442,793 | 1 | 0 | null | 2016-01-26T16:39:00 | 2016-01-26T16:39:00 | null | UTF-8 | Java | false | false | 1,037 | java | package ohi.andre.consolelauncher.commands.raw;
import java.util.List;
import ohi.andre.consolelauncher.R;
import ohi.andre.consolelauncher.commands.CommandAbstraction;
import ohi.andre.consolelauncher.commands.ExecInfo;
import ohi.andre.consolelauncher.tuils.Tuils;
public class peoples implements CommandAbstraction {
@Override
public String exec(ExecInfo info) {
List<String> contacts = info.contacts.list();
Tuils.insertHeaders(contacts);
return Tuils.toPlanString(contacts);
}
@Override
public int helpRes() {
return R.string.help_contacts;
}
@Override
public boolean useRealTime() {
return false;
}
@Override
public int minArgs() {
return 0;
}
@Override
public int maxArgs() {
return 0;
}
@Override
public int[] argType() {
return null;
}
@Override
public int priority() {
return 2;
}
@Override
public String[] parameters() {
return null;
}
@Override
public String onNotArgEnough(ExecInfo info) {
return null;
}
@Override
public int notFoundRes() {
return 0;
}
}
| [
"[email protected]"
]
| |
cf379c28dcd47bd3dc6e5934f6a0a62caa4ffbb9 | ca74f7247776abf804b1cbaedbb89d90bea66aa4 | /JerseyRestService/src/test/java/com/java/spring/jersey/MyJerseyEndpoint.java | 3a76455bc6774a96a4b33d5c4a26677d2ec54058 | []
| no_license | rmondal-tech/WebService-Spring-Jersy | e56d2dfa98e6a1dab5aec38baf5dc0f415eb715b | cd5095b30e0fbf8b172aa485ab7cfa82ace38b47 | refs/heads/main | 2023-04-28T17:31:41.776178 | 2021-05-15T04:58:48 | 2021-05-15T04:58:48 | 358,854,358 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,249 | java | package com.java.spring.jersey;
import java.net.URI;
import java.net.http.HttpResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import com.java.spring.jersey.model.Details;
import ch.qos.logback.core.status.Status;
/* All the registered endpoints should be @Components with HTTP resource annotations
(@GET and others), as shown in the following example:
*/
/**
* @author LENOVO
*
*/
/**
* @author LENOVO
*
*/
@Component
@Path("/hello")
public class MyJerseyEndpoint {
//http://localhost:8080/hello
@GET public String message()
{ return "Hello"; }
//with pathparam -http://localhost:8080/hello/pathparam1
@GET
@Path("{name}")
@Produces("text/plain")
public Response getHuman(@PathParam("name") String name) {
return Response.accepted("Hello- " + name + " api called successfully.").build();
}
//Read Sub Resource URI Path Parameter using @PathParam Mapping /hello/rahul/addresses/2
//http://localhost:8080/hello/rahul/addresses/221
@GET
@Path("{name}/addresses/{addressId}")
@Produces("text/plain")
public Response getAddress(@PathParam("name") String name, @PathParam("addressId") int addressId) {
return Response.accepted(
"Hello -" + name + "/addresses/" + addressId + " api called successfully.")
.build();
}
/*
*
* @GET public Response message1() {
*
* return
* Response.status(Response.Status.OK).entity("entiry string object or any object").build();
*
*
* }
*/
// MediaType needs to be specified when returning an object. also jaxb mapper has to be added in jar
/*
@GET
@Produces(MediaType.APPLICATION_JSON)
public Details message1() {
Details
details=new Details("Rahul", "Palongpur");
return details;
}
*/
//HttpEntity<T> can teturn responsebosy + headers. its similar how we used ResponseEntity.
//HttpEntity can be used to create both RequestEntity and ResponseEntity. Where as ResponseEntity
//is subclassed from HttpEntity with a more elaborative way to send the ResponseObject and it only limited to sending the Response.
/* @GET
@Produces(MediaType.APPLICATION_JSON)
public HttpEntity<Details> message1() {
Details details=new Details("Rahul", "Palongpur");
HttpHeaders headers = new HttpHeaders();
headers.set("dd", "dd");
return new HttpEntity<>(details,headers);
// return Response.status(Response.Status.OK).entity("entiry string object").build();
// return "Hello2";
}
*/
/*
GET: It represents one or a list of resources or sub resources.
POST: It creates a new resource as represented by URI from the request payload.
PUT: It change an existing resource as represented by URI from the request payload.
DELETE: It delete an existing resource as represented by URI.
HEAD: It has URI similar to GET, but server don’t send any response body. It used mainly to know response headers information.
*/
}
| [
"[email protected]"
]
| |
cbe3f573cec59e29adb5aa5859c0c5f666aa996c | c9f05857b9007ea92198499f186acaf853dcbd53 | /src/main/java/com/hcl/ecommerce/service/ProductServiceImplementation.java | 361fa05d6bcbc4286de048d61f3e5baec33af0f3 | []
| no_license | chethana613/ecommerce | 95d0d2567b4a99d1fd59fbe348475dbc037cde6a | d8252734d7412f8f2dddadd868786a81022e9fbc | refs/heads/master | 2020-09-18T18:25:25.701863 | 2019-11-26T10:33:46 | 2019-11-26T10:33:46 | 224,164,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,849 | java | package com.hcl.ecommerce.service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hcl.ecommerce.constants.ProductConstants;
import com.hcl.ecommerce.dto.ProductRequestdto;
import com.hcl.ecommerce.dto.ProductResponse;
import com.hcl.ecommerce.dto.ProductResponsedto;
import com.hcl.ecommerce.entity.Product;
import com.hcl.ecommerce.exception.ProductException;
import com.hcl.ecommerce.repository.ProductRepository;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author Chethana M
* @Description This class is used to perform the product related operations
*
*/
@Service
@Slf4j
public class ProductServiceImplementation implements ProductService {
@Autowired
ProductRepository productRepository;
/**
*
* @Description This method lets the admin to add a new product into the
* ecommerce application
* @param productRequestdto
* @return ProductResponsedto
* @exception PRODUCT_EXISTS
*
*/
public Optional<ProductResponsedto> addNewProduct(ProductRequestdto productRequestdto) {
log.info("Entering into addNewProduct of ProductServiceImplementation");
Optional<Product> productDetails = productRepository
.findByProductNameAndCategory(productRequestdto.getProductName(), productRequestdto.getCategory());
if (productDetails.isPresent()) {
log.error("Exception in addNewProduct of ProductServiceImplementation:" + ProductConstants.PRODUCT_EXISTS);
throw new ProductException(ProductConstants.PRODUCT_EXISTS);
}
Product product = new Product();
product.setCategory(productRequestdto.getCategory());
product.setPrice(productRequestdto.getPrice());
product.setProductName(productRequestdto.getProductName());
productRepository.save(product);
ProductResponsedto productResponsedto = new ProductResponsedto();
return Optional.of(productResponsedto);
}
/**
* @Description This method gets all the product details available in the
* ecommerce application that matches with the requested product
* name pattern
* @param productName
* @return ProductResponse
*/
public Optional<List<ProductResponse>> getAllAvailableProducts(String productName) {
log.info("Entering into getAllAvailableProducts of ProductServiceImplementation");
List<Product> productDetails = productRepository.findByProductNameContaining(productName);
List<ProductResponse> productResponseList = new ArrayList<>();
for (Product product : productDetails) {
ProductResponse productResponse = new ProductResponse();
BeanUtils.copyProperties(product, productResponse);
productResponseList.add(productResponse);
}
return Optional.of(productResponseList);
}
}
| [
"[email protected]"
]
| |
f3b2df048622089d3fb527ad0ca3f043e428e670 | 39e36b0518f6b67aa3168b184fab9a19aee53c5e | /app/src/main/java/com/example/gagan/proj1/adapter/PagerAdapter.java | 01261eb179bb103da530cdff1cc4368c27b94819 | []
| no_license | gagan1994/SomeProj | 5264f84be23a3fe8286201d5259e9314d41be329 | fa59e83b61a5c11334b92ecc170355e5f723817b | refs/heads/master | 2020-03-24T03:51:31.629127 | 2018-07-26T12:01:32 | 2018-07-26T12:01:32 | 142,434,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,729 | java | package com.example.gagan.proj1.adapter;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import com.example.gagan.proj1.fragments.AddUserFragment;
import com.example.gagan.proj1.fragments.BaseFragment;
import com.example.gagan.proj1.fragments.ChattFragment;
import java.util.List;
/**
* Created by Gagan on 4/16/2018.
*/
public class PagerAdapter extends FragmentStatePagerAdapter {
private final List<BaseFragment> baseFragments;
private int ChattFragmentId = -1;
private int ProfileFragmentId = -1;
private int AddUserFragmentId = -1;
public PagerAdapter(FragmentManager fm, List<BaseFragment> baseFragments) {
super(fm);
this.baseFragments = baseFragments;
for (int i = 0; i < baseFragments.size(); i++) {
if (baseFragments.get(i) instanceof ChattFragment) {
ChattFragmentId = i;
}
if (baseFragments.get(i) instanceof BaseFragment) {
ProfileFragmentId = i;
}
if (baseFragments.get(i) instanceof AddUserFragment) {
AddUserFragmentId = i;
}
}
}
@Override
public BaseFragment getItem(int position) {
return baseFragments.get(position);
}
@Override
public int getCount() {
return baseFragments.size();
}
public ChattFragment getChattFragment() {
return (ChattFragment) getItem(ChattFragmentId);
}
public int getChattFragmentPosition() {
return ChattFragmentId;
}
public int getProfilePos() {
return ProfileFragmentId;
}
public int getAddUserId() {
return AddUserFragmentId;
}
}
| [
"[email protected]"
]
| |
b77acfcf96ab649b5d62f3397819cc7e7b3eab13 | fb8c2030ed487379dddf5e1fecab54c6a21c7ac6 | /javaLearned/src/myLearnedClase.java | 79262553b06673a84c8093856cae4302b32b2de4 | [
"Unlicense"
]
| permissive | Yoshicyc/AllCodes | 144ee4995f7774c82a53e0eb300c9ecb007c853d | 6a72669d243065a5b7009e0cbd03de27a720e5f5 | refs/heads/master | 2020-03-28T08:56:36.278048 | 2018-09-09T08:04:53 | 2018-09-09T08:04:53 | 148,001,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,088 | java |
public class myLearnedClase {
public static void main(String[] args) {
// TODO Auto-generated method stub
//1 set auto-fill-in
// auto activation triggers for Java ".abc...ABC"
System.out.println("successful");
//2 shortcut key reminder
// (1)Ctrl+Space
// 说明:内容助理。提供对方法,变量,参数,javadoc等得提示,
// 应运在多种场合,总之需要提示的时候可先按此快捷键。
// 注:避免输入法的切换设置与此设置冲突
// (2)Ctrl+Shift+Space
// 说明:变量提示
// (3)Ctrl+/
// 说明:添加/消除//注释,在eclipse2.0中,消除注释为Ctrl+\
// (4)Ctrl+Shift+/
// 说明:添加/* */注释
// (5)Ctrl+Shift+\
// 说明:消除/* */注释
// (6)Ctrl+Shift+F
// 说明:自动格式化代码
// (7)Ctrl+1
// 说明:批量修改源代码中的变量名,此外还可用在catch块上.
// (8)Ctril+F6
// 说明:界面切换
// (9)Ctril+Shift+M
// 说明:查找所需要得包
// (10)Ctril+Shift+O
// 说明:自动引入所需要得包
//3 code1
System.out.println("second try");
}
}
| [
"[email protected]"
]
| |
40cb886260a18743350bed9d545461b188ad9ffb | b9559e00a99cc08ee72efb30d3a04166054651e2 | /Java/ZipMe/Base/net/sf/zipme/CheckedOutputStream.java | 4d1f7abfaab0c4e22ef0799cc532aeca0e312bd9 | []
| no_license | joliebig/featurehouse_fstcomp_examples | d4dd7d90a77ae3b20b6118677a17001fdb53ee93 | 20dd7dc9a807ec0c20939eb5c6e00fcc1ce19d20 | refs/heads/master | 2021-01-19T08:08:37.797995 | 2013-01-29T13:48:20 | 2013-01-29T13:48:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,374 | java | //
package net.sf.zipme;
import java.io.IOException;
import java.io.OutputStream;
/**
* OutputStream that computes a checksum of data being written using a
* supplied Checksum object.
* @see Checksum
* @author Tom Tromey
* @date May 17, 1999
*/
public class CheckedOutputStream extends OutputStream {
/**
* This is the subordinate <code>OutputStream</code> that this class
* redirects its method calls to.
*/
protected OutputStream out;
/**
* Creates a new CheckInputStream on top of the supplied OutputStream
* using the supplied Checksum.
*/
public CheckedOutputStream( OutputStream out, Checksum cksum){
this.out=out;
this.sum=cksum;
}
/**
* Returns the Checksum object used. To get the data checksum computed so
* far call <code>getChecksum.getValue()</code>.
*/
public Checksum getChecksum(){
return sum;
}
/**
* Writes one byte to the OutputStream and updates the Checksum.
*/
public void write( int bval) throws IOException {
out.write(bval);
sum.update(bval);
}
/**
* This method writes all the bytes in the specified array to the underlying
* <code>OutputStream</code>. It does this by calling the three parameter
* version of this method - <code>write(byte[], int, int)</code> in this
* class instead of writing to the underlying <code>OutputStream</code>
* directly. This allows most subclasses to avoid overriding this method.
* @param buf The byte array to write bytes from
* @exception IOException If an error occurs
*/
public void write( byte[] buf) throws IOException {
write(buf,0,buf.length);
}
/**
* Writes the byte array to the OutputStream and updates the Checksum.
*/
public void write( byte[] buf, int off, int len) throws IOException {
out.write(buf,off,len);
sum.update(buf,off,len);
}
/**
* This method closes the underlying <code>OutputStream</code>. Any
* further attempts to write to this stream may throw an exception.
* @exception IOException If an error occurs
*/
public void close() throws IOException {
flush();
out.close();
}
/**
* This method attempt to flush all buffered output to be written to the
* underlying output sink.
* @exception IOException If an error occurs
*/
public void flush() throws IOException {
out.flush();
}
/**
* The checksum object.
*/
private Checksum sum;
}
| [
"apel"
]
| apel |
2bddab52235e6603795113ba353b58bad8041f38 | 15f5a7ed37142c17c2fe65ff00fa6a50af3a496d | /jsf2/jsf2-widgets/src/java/org/sakaiproject/jsf2/model/PhaseAware.java | 11b3de5f363570fa2c345d1febb5fb6d956a2d71 | [
"ECL-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LicenseRef-scancode-generic-cla"
]
| permissive | hec-montreal/sakai | 1037be1cab6d2c610f249aa9e438569c1eaa02a9 | 165886f530aeb0a046be33d32bb1daa6960ca116 | refs/heads/zonecours | 2023-06-21T19:27:59.962709 | 2023-06-20T18:28:14 | 2023-06-20T18:28:20 | 57,977,965 | 2 | 1 | ECL-2.0 | 2020-04-07T14:17:45 | 2016-05-03T14:59:56 | Java | UTF-8 | Java | false | false | 1,473 | java | /**********************************************************************************
Copyright (c) 2018 Apereo Foundation
Licensed under the Educational Community 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://opensource.org/licenses/ecl2
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**********************************************************************************/
package org.sakaiproject.jsf2.model;
/**
* Beans that wish to be notified of interesting transitions in the
* JSF request life cycle should implement this interface.
*/
public interface PhaseAware {
/**
* Called after the component has finished the Process Validations
* phase. If validations are processed but the Update Model Values
* phase is never reached, then validations probably failed.
*/
public void endProcessValidators();
/**
* Called after the component has finished the Update Model Values
* phase.
*/
public void endProcessUpdates();
/**
* Called when the component is about to begin rendering.
*/
public void startRenderResponse();
}
| [
"[email protected]"
]
| |
f76e0be8224bb5f84d54b6a9675fe3cb59577412 | f7ef5c22ee2c5f27c378f9e28b6b19479d6ccf32 | /Projekat/Backend/eventTS/src/main/java/ba/eventTS/models/Options.java | e0a328dc9543a92cce34fad4d7ae2632392b0260 | []
| no_license | SoftverInzenjeringETFSA/SI2016_TIM3 | 96c01b0a945c48d74368e35c3836eec768cd1adf | 1c7f3aef350fe17d6ef3efc9b85e1248852fc232 | refs/heads/master | 2021-01-21T17:22:48.542264 | 2017-06-17T20:42:49 | 2017-06-17T20:42:49 | 85,181,880 | 0 | 1 | null | 2017-06-17T20:42:50 | 2017-03-16T10:12:48 | Java | UTF-8 | Java | false | false | 1,720 | java | package ba.eventTS.models;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="Options")
public class Options implements Serializable {
//Univerzalni identifikator klase koja je serijalizirana
//Deserijalizacija koristi ovaj broj da osigura da podaci unutar klase adekvatno reaguju sa serijaliziranim objektom
//Ukoliko nema poklapanja baca se izuzetak: InvalidClassException
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="idOption")
private Integer idOption;
@Column(name="text")
private String text;
@ManyToOne(targetEntity=Detail.class)
@JoinColumn(name="idDetail")
private Event ideDetail;
public Integer getIdOption() {
return idOption;
}
public void setIdOption(Integer idOption) {
this.idOption = idOption;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public Event getIdeDetail() {
return ideDetail;
}
public void setIdeDetail(Event ideDetail) {
this.ideDetail = ideDetail;
}
//Ako ne bude radilo vidi ovo:
/* @Id
@GeneratedValue(generator="SharedPrimaryKeyGenerator")
@GenericGenerator(name="SharedPrimaryKeyGenerator",strategy="foreign",parameters = @Parameter(name="", value=""))
@Column(name = "", unique = , nullable =
private Integer ;
*
*
*
*
*/
}
| [
"[email protected]"
]
| |
cf0c2d54855f5a951b711b6abe9c58cac730593c | 5a5677e5b8e7842d212a5e129ec0d2f673ab3b3f | /module_2/src/_case_study/models/House.java | 47b3550e16eaec4cae08fa835aec3f1e7e1163fc | []
| no_license | HoTrang123/C0920G1-HoNguyenThuyTrang | 8a7c593f31669a59ba2119caf6b103f928e1d82f | db1ab79533f7a4d2fa92301756ce9c68fef39b69 | refs/heads/master | 2023-03-13T10:33:32.373133 | 2021-02-26T09:51:53 | 2021-02-26T09:51:53 | 295,307,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,019 | java | package _case_study.models;
public class House extends Services implements Comparable<House>{
private String kindHouse;
private String differentServiceHouse;
private String numFloorHouse;
public House() {
}
public House(String kindHouse, String differentServiceHouse, String numFloorHouse) {
this.kindHouse = kindHouse;
this.differentServiceHouse = differentServiceHouse;
this.numFloorHouse = numFloorHouse;
}
public House(String id, String nameService, String areaService, String priceService, String numMaxPerson, String kindService, String kindHouse, String differentServiceHouse, String numFloorHouse) {
super(id, nameService, areaService, priceService, numMaxPerson, kindService);
this.kindHouse = kindHouse;
this.differentServiceHouse = differentServiceHouse;
this.numFloorHouse = numFloorHouse;
}
public String getKindHouse() {
return kindHouse;
}
public void setKindHouse(String kindHouse) {
this.kindHouse = kindHouse;
}
public String getDifferentServiceHouse() {
return differentServiceHouse;
}
public void setDifferentServiceHouse(String differentServiceHouse) {
this.differentServiceHouse = differentServiceHouse;
}
public String getNumFloorHouse() {
return numFloorHouse;
}
public void setNumFloorHouse(String numFloorHouse) {
this.numFloorHouse = numFloorHouse;
}
@Override
public void showInfor() {
// System.out.println(super.toString());
System.out.println(this.toString());
}
@Override
public String toString() {
return "House: " + super.toString() +
",kindHouse " + kindHouse +
", differentServiceHouse " + differentServiceHouse +
", numFloorHouse " + numFloorHouse;
}
@Override
public int compareTo(House house) {
return this.getNameService().compareTo(house.getNameService());
}
}
| [
"HoTrang123"
]
| HoTrang123 |
9cff10bb084ff6f54b513f599ac87bae263d41ec | d3f78e08477644882bb044362240818e99bfc621 | /CourseSystem/src/com/servlet/SearchByPchapter.java | 0076d7396fd4c25b088c96c1d38a1d6fa894e68c | []
| no_license | ckt15/-web- | 086ba7818e531d407b17026a5d446204ff451770 | f2ff03e1362bfda74e6e111722c869bd988c26b9 | refs/heads/master | 2020-03-26T21:19:43.082670 | 2019-05-28T13:32:11 | 2019-05-28T13:32:11 | 145,380,978 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,237 | java | package com.servlet;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.dao.StudentDao;
import com.dao.StudentDaoImpl;
import com.entity.Practise;
public class SearchByPchapter extends HttpServlet { //需要继承HttpServlet 并重写doGet
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response); //将信息使用doPost方法执行 对应jsp页面中的form表单中的method
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String pchapter = request.getParameter("pchapter"); //得到html页面传过来的参数
StudentDao ud = new StudentDaoImpl();
List<Practise> practise = ud.getPractiseByPchapterAll(pchapter);
if(practise!=null){
request.setAttribute("xiaoxi", practise);
request.getRequestDispatcher("/searchByTid.jsp").forward(request, response);
}else{
response.sendRedirect("index.jsp");
}
}
}
| [
"[email protected]"
]
| |
964509f994291010d9e526380e3a2a2c55ac4dee | 96b7a06e10e3e78c6005858371d395aaf3dda226 | /src/main/java/com/personal/nserver/OnNewEventListener.java | 000c28ebdce61b0068d2ed6cec85774d7f42c84e | []
| no_license | yaxixixixi/NServer | 2fe5201d6897e6deb4827b6171e9cc47f410f195 | 837e7fb3c5e2973ed7c3a33c737f83e6d2566fb6 | refs/heads/master | 2020-03-11T08:11:06.036259 | 2018-04-19T07:36:55 | 2018-04-19T07:36:55 | 129,876,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com.personal.nserver;
import io.netty.channel.ChannelHandlerContext;
public interface OnNewEventListener {
void onMessage(ChannelHandlerContext ctx, String msg);
void onServerFilure(Exception e, String errorMsg);
void onServerSuccess(String msg);
void onChannelError(Exception e,String errorMsg);
void onChannelsChanged(ChannelInfo info,Operate operate);
}
| [
"[email protected]"
]
| |
d2fe2187ca130d65d090ebcfb2066b563e8c7790 | c359beff19d9fbb944ef04e28b3e7f9e59a742a2 | /sources/com/android/keyguard/widget/IAodClock.java | 2e7ecbc515563bd4d5ab06283f4c575f23d50ef7 | []
| no_license | minz1/MIUISystemUI | 872075cae3b18a86f58c5020266640e89607ba17 | 5cd559e0377f0e51ad4dc0370cac445531567c6d | refs/heads/master | 2020-07-16T05:43:35.778470 | 2019-09-01T21:12:11 | 2019-09-01T21:12:11 | 205,730,364 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.android.keyguard.widget;
import android.view.View;
import java.util.TimeZone;
public interface IAodClock {
void bindView(View view);
int getLayoutResource();
void setPaint(int i);
void setTimeZone(TimeZone timeZone);
void setTimeZone2(TimeZone timeZone);
void updateTime(boolean z);
}
| [
"[email protected]"
]
| |
909adb3b7982ba6df35e926f3481b17d84c49ae9 | a0c63177f987e1742261a60302189c8b72960db0 | /Download.java | e63a3ae30e8a571017420a7b41f9835ef6cbfa72 | []
| no_license | JoJoUp/dMusicAndPicture | 74bae1027211cf477ab929e840b5e3002427aa66 | 5e59c9404ef7e0ee10e2e2bd07fe20be035791f2 | refs/heads/master | 2020-04-13T07:41:09.967040 | 2018-12-29T07:44:06 | 2018-12-29T07:44:06 | 163,059,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
public class Download extends Thread {
private URL url;
private String file;
private String type;
Download(String url, String file,String type) throws MalformedURLException {
this.url = new URL(url);
this.file = file;
this.type = type;
}
public void run() {
try (ReadableByteChannel byteChannel = Channels.newChannel(url.openStream());
FileOutputStream stream = new FileOutputStream(file)) {
stream.getChannel().transferFrom(byteChannel, 0, Long.MAX_VALUE);
System.out.println("Скачивание файла " + file + " прошло успешно");
} catch (IOException e) {
System.out.println("Произошла ошибка при скачивании файла " + file);
}if(type == "mp3") {
play();
}
}
public void play() {
try (FileInputStream inputStream = new FileInputStream( file)) {
try {
Player player = new Player(inputStream);
player.play();
} catch (JavaLayerException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
} | [
"[email protected]"
]
| |
6d97e48176e24e1f317c0a55236f875c15ab4c34 | 3ad7c63b02d5b40304d5547f5cf175c62061400e | /collections/map/adventure/LocationManager.java | 7ea69fedcaa3514db0cbd127bc962c5a1506b4d4 | [
"MIT"
]
| permissive | cankush625/Java | d3d0c04ffdc26ec7b1999ab4f6dbb84b3090e2be | 8bb999303f578121fbb6dbe6f9671a20f6f00b30 | refs/heads/master | 2021-07-13T13:54:27.264449 | 2021-07-10T06:42:51 | 2021-07-10T06:42:51 | 178,910,844 | 1 | 1 | MIT | 2020-01-25T12:16:02 | 2019-04-01T17:14:00 | Java | UTF-8 | Java | false | false | 3,036 | java | package com.collections.map.adventure;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class LocationManager {
private static Map<Integer, Location> locations = new HashMap<>(); //Hashmap for the locations
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
//Creating locations
locations.put(0, new Location(0, "You are on the top of the building"));
locations.put(1, new Location(1, "You are in the home"));
locations.put(2, new Location(2, "You are on the top of the hill"));
locations.put(3, new Location(3, "You are swimming in the ocean"));
locations.put(4, new Location(4, "You are in the aeroplane"));
locations.put(5, new Location(5, "You are in the forest"));
//Adding exits for the locations
locations.get(1).addExit("W", 2);
locations.get(1).addExit("E", 3);
locations.get(1).addExit("S", 4);
locations.get(1).addExit("N", 5);
// locations.get(1).addExit("Q", 0); //Instead add once in the constructor of the locations
locations.get(2).addExit("N", 5);
// locations.get(2).addExit("Q", 0);
locations.get(3).addExit("W", 1);
// locations.get(3).addExit("Q", 0);
locations.get(4).addExit("N", 1);
locations.get(4).addExit("W", 2);
// locations.get(4).addExit("Q", 0);
locations.get(5).addExit("S", 1);
locations.get(5).addExit("W", 2);
// locations.get(5).addExit("Q", 0);
Map<String, String> vocabulary = new HashMap<>();
vocabulary.put("QUIT", "Q");
vocabulary.put("NORTH", "N");
vocabulary.put("SOUTH", "S");
vocabulary.put("EAST", "E");
vocabulary.put("WEST", "W");
int loc = 1;
while (true) {
System.out.println(locations.get(loc).getDescription());
if (loc == 0) {
break;
}
//Copying all the exits for the entered location in exits map
Map<String, Integer> exits = locations.get(loc).getExits();
System.out.print("Available exits are : ");
for (String exit : exits.keySet()) { //Printing all the exits for the entered location
System.out.print(exit + ", ");
}
System.out.println();
String direction = scanner.nextLine().toUpperCase();
if(direction.length() > 1) {
String[] words = direction.split(" ");
for (String word:
words) {
if (vocabulary.containsKey(word)) {
direction = vocabulary.get(word);
break;
}
}
}
if (exits.containsKey(direction)) {
loc = exits.get(direction);
} else {
System.out.println("You cannot go in that direction");
}
}
}
}
//by Ankush Chavan | [
"[email protected]"
]
| |
dbb4ab264666638fc7256c4ce0d8059ed44a9608 | 9d0ed40ffb8119f94af3f42d534369f2581cb702 | /es-train/src/test/java/com/yfs/es/train/estrain/StockProfitServiceTest.java | e06da919488283870a1e30caed30b0b022873bff | []
| no_license | yfs666/routine | b0446966569a2d39c0a048d920ec7e6d5c5955ff | cce56303575707055ca91c601db13dafe798c08d | refs/heads/master | 2022-12-24T18:32:23.042117 | 2021-05-16T22:48:03 | 2021-05-16T22:48:03 | 248,658,841 | 0 | 1 | null | 2022-12-16T01:49:00 | 2020-03-20T03:21:38 | Java | UTF-8 | Java | false | false | 5,273 | java | package com.yfs.es.train.estrain;
import com.google.common.collect.Lists;
import com.yfs.es.train.estrain.biz.BizService;
import com.yfs.es.train.estrain.entity.StockProfit;
import com.yfs.es.train.estrain.entity.ThsPrice;
import com.yfs.es.train.estrain.service.StockPriceService;
import com.yfs.es.train.estrain.service.StockProfitService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@SpringBootTest
public class StockProfitServiceTest {
@Autowired
private StockProfitService stockProfitService;
@Autowired
private BizService bizService;
@Autowired
private StockPriceService stockPriceService;
@Test
public void findUpListTest() {
List<StockProfit> stockProfits = stockProfitService.findUpList();
Map<String, StockProfit> stockProfitMap = stockProfits.stream().collect(Collectors.toMap(StockProfit::getSymbol, Function.identity(), (o1, o2) -> o1));
List<String> symbols = stockProfits.stream().map(StockProfit::getSymbol).collect(Collectors.toList());
SearchSourceBuilder searchSourceBuilder = SearchSourceBuilder.searchSource().query(
QueryBuilders.boolQuery()
.filter(QueryBuilders.termQuery("date","2021-02-22"))
.filter(QueryBuilders.termsQuery("symbol.keyword", symbols))
).from(0).size(10000);
List<ThsPrice> thsPrices = stockPriceService.queryFrom(searchSourceBuilder).stream().filter(
it-> {
StockProfit stockProfit = stockProfitMap.get(it.getSymbol());
if (stockProfit == null) {
return true;
}
return stockProfit.getProfit().multiply(BigDecimal.valueOf(40)).compareTo(it.getMarketValue()) > 0;
}
).collect(Collectors.toList());
System.out.println(thsPrices);
Map<String, List<ThsPrice>> priceMap = thsPrices.stream().collect(Collectors.groupingBy(it -> {
if (StockProfitService.YI.multiply(BigDecimal.valueOf(500)).compareTo(it.getMarketValue()) < 0) {
return "大盘";
}
if (StockProfitService.YI.multiply(BigDecimal.valueOf(200)).compareTo(it.getMarketValue()) < 0) {
return "中盘";
}
if (StockProfitService.YI.multiply(BigDecimal.valueOf(100)).compareTo(it.getMarketValue()) < 0) {
return "中小盘";
}
if (StockProfitService.YI.multiply(BigDecimal.valueOf(50)).compareTo(it.getMarketValue()) < 0) {
return "小盘";
}
return "超小盘";
}));
System.out.println(priceMap);
for (Map.Entry<String, List<ThsPrice>> stringListEntry : priceMap.entrySet()) {
System.out.print(stringListEntry.getKey() + " ");
System.out.println(stringListEntry.getValue().stream().map(ThsPrice::getCode).collect(Collectors.joining(" ")));
}
}
@Test
public void queryMyStockTest() {
String date = null;
if (StringUtils.isBlank(date)) {
date = stockPriceService.getTodayDate();
}
List<String> symbols = bizService.queryMyStock();
if (CollectionUtils.isEmpty(symbols)) {
return ;
}
String yesterdayDate = stockPriceService.getYesterdayDate(date);
SearchSourceBuilder searchSourceBuilder = SearchSourceBuilder.searchSource().query(
QueryBuilders.boolQuery()
.filter(QueryBuilders.termsQuery("date", Lists.newArrayList(date, yesterdayDate)))
.filter(QueryBuilders.termsQuery("symbol.keyword", symbols))
).from(0).size(10000);
List<ThsPrice> thsPrices = stockPriceService.queryFrom(searchSourceBuilder);
Map<String, List<ThsPrice>> datePriceMap = thsPrices.stream().collect(Collectors.groupingBy(ThsPrice::getDate));
List<ThsPrice> todayPrices = datePriceMap.getOrDefault(date, Collections.emptyList());
Map<String, ThsPrice> yesterdayPriceMap = datePriceMap.getOrDefault(date, Collections.emptyList()).stream().collect(Collectors.toMap(ThsPrice::getCode, Function.identity(), (o1, o2) -> o1));
List<String> codes = todayPrices.stream().filter(todayPrice -> {
if (todayPrice.getClose().compareTo(todayPrice.getMa10()) >= 0) {
return true;
}
return Optional.ofNullable(yesterdayPriceMap.get(todayPrice.getCode())).map(it -> todayPrice.getMa10().compareTo(it.getMa10()) > 0).orElse(false);
}).map(ThsPrice::getCode).collect(Collectors.toList());
log.info(String.join(" ", codes));
}
}
| [
"[email protected]"
]
| |
eaa6be98e4eda7655f48c81ebd76582336a1bfeb | b14a60f107f6f336f3393105a88076b7a7148a68 | /src/MySolution/P110_Power.java | b60df67165fbcaeef888aa75f5fe8b633980999a | []
| no_license | hongpp/SwordOffer | d18d9aa2cc4dd354e0590e9fc6ee4bed0af3fe9c | 47e8bce6b432b9cb87b1f31ed40fa29dc2f9d930 | refs/heads/master | 2020-09-17T20:47:54.599201 | 2019-03-08T06:59:03 | 2019-03-08T06:59:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 805 | java | package MySolution;
/**
* 数值的整数次方
* <p>
* 给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。
*/
public class P110_Power {
/**
* 已过牛客
* https://www.nowcoder.com/practice/1a834e5e3e1a4b7ba251417554e07c00?tpId=13&tqId=11165&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking
*
* @param base
* @param exponent
* @return
*/
public double Power(double base, int exponent) {
double result = 1;
if (exponent == 0) {
return result;
}
for (int i = 0; i < Math.abs(exponent); i++) {
result *= base;
}
if (exponent < 0) {
result = 1 / result;
}
return result;
}
}
| [
"[email protected]"
]
| |
a949a61e0012dbe70ba69714b99fe5727c54782d | 5df38fdd2541c5d11f6884d5e6d675ac1517ba13 | /考试系统/trunk/remote-exam-system/WangGe/src/com/OnlineGridShop/timer/BrandgridTask.java | 71366aa9f9256916f39420dd1b021a47deba28c2 | []
| no_license | liubag/test0325 | 999b38040adf413987bba5c37764baebce43ccf0 | a53bdf74f617ece5a40837f0d6a2ee5e853317ec | refs/heads/master | 2020-06-06T09:41:15.362177 | 2014-03-25T09:14:17 | 2014-03-25T09:17:02 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,624 | java | package com.OnlineGridShop.timer;
import java.util.Date;
import java.util.TimerTask;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.OnlineGridShop.brand.Service.BrandgridGoodsSerivce;
import com.OnlineGridShop.brand.Service.BrandgridPreferentialSerivce;
import com.OnlineGridShop.brand.Service.BrandgridSerivce;
import com.OnlineGridShop.util.DateUtil;
public class BrandgridTask extends TimerTask {
private BrandgridSerivce brandgridSerivce;
private BrandgridGoodsSerivce brandgridGoodsSerivce;
private BrandgridPreferentialSerivce brandgridPreferentialSerivce;
public BrandgridTask(){
}
public void run() {
try {
ApplicationContext cxt = new ClassPathXmlApplicationContext(
"bean.xml");
brandgridSerivce = (BrandgridSerivce) cxt.getBean("brandgridSerivce");
brandgridGoodsSerivce = (BrandgridGoodsSerivce) cxt.getBean("brandgridGoodsSerivce");
brandgridPreferentialSerivce = (BrandgridPreferentialSerivce) cxt.getBean("brandgridPreferentialSerivce");
} catch (RuntimeException e) {
e.printStackTrace();
}
// TODO Auto-generated method stub
Date today = new Date();
String overtime_str = DateUtil.toSQLDate(today).toString() + " 00:00:10";
brandgridSerivce.isOverAgreementTimeToDo(overtime_str);//检测过期品牌店,并制为过期状态
brandgridGoodsSerivce.isOverApplyTimeToDo(overtime_str);//检测申请过期商品,并制为过期状态
brandgridPreferentialSerivce.isOverApplyTimeToDo(overtime_str);//检测申请过期优惠信息,并制为过期状态
}
}
| [
"[email protected]"
]
| |
32e4be4e80a90da3cde76bb330c4d5c747bc11d0 | aa56bc37d7496cbfce9e96ab904b3e851c438231 | /SQL/GestioneStudenti.java | b449da42325a3120a9b66aee818e54b93d57826f | []
| no_license | aleDiomedi/JavaRep | bf574db68df80b18a152d3cbc5c5c8a52c276f6b | d9cc89bd3bcad2e35ad6ab4ab8f54837ac1fca63 | refs/heads/master | 2020-08-22T14:47:50.005005 | 2019-12-09T20:54:34 | 2019-12-09T20:54:34 | 216,419,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,442 | java | import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class GestioneStudenti {
private static final String DB_URL = "jdbc:mysql://didattica.liceocuneo.it:3306/db5E?serverTimezone=Europe/Rome";
private static final String DB_USER = "quintaf";
private static final String DB_PWD = "5furra";
private static final String INSERT_STUD = "INSERT INTO DOC_Studente (NrBadge, Cognome, Nome) VALUES (?,?,?)";
private static final String SELECT_STUD = "SELECT * FROM DOC_Studente";
private static final String DELETE_STUD = "DELETE FROM DOC_Studente WHERE NrBadge = ?";
private static final String UPDATE_STUD = "UPDATE DOC_Studente SET Cognome = ?, Nome=? WHERE NrBadge = ?";
public void inserisciStudente(Studente s) {
Connection conn = null;
PreparedStatement stmt = null;
try {
//connessione con il dbms
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PWD);
//preparare lo statement sql
stmt = conn.prepareStatement(INSERT_STUD);
stmt.setString(1, s.getMatricola());
stmt.setString(2, s.getCognome());
stmt.setString(3, s.getNome());
//eseguo lo statement
stmt.executeUpdate();
}catch(Exception exc) {
exc.printStackTrace();
}
finally {
//chiudere le risorse
try {
if(stmt != null) {
stmt.close();
}
if(conn != null) {
conn.close();
}
}catch(SQLException sqlExc) {}
}
}
public void aggiornaStudente(Studente s) {
Connection conn = null;
PreparedStatement stmt = null;
try {
//connessione con il dbms
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PWD);
//preparare lo statement sql
stmt = conn.prepareStatement(UPDATE_STUD);
stmt.setString(1, s.getCognome());
stmt.setString(2, s.getNome());
stmt.setString(3, s.getMatricola());
//eseguo lo statement
stmt.executeUpdate();
}catch(Exception exc) {
exc.printStackTrace();
}
finally {
//chiudere le risorse
try {
if(stmt != null) {
stmt.close();
}
if(conn != null) {
conn.close();
}
}catch(SQLException sqlExc) {}
}
}
public void cancellaStudente(Studente s) {
Connection conn = null;
PreparedStatement stmt = null;
try {
//connessione con il dbms
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PWD);
//preparare lo statement sql
stmt = conn.prepareStatement(DELETE_STUD);
stmt.setString(1, s.getMatricola());
//eseguo lo statement
stmt.executeUpdate();
}catch(Exception exc) {
exc.printStackTrace();
}
finally {
//chiudere le risorse
try {
if(stmt != null) {
stmt.close();
}
if(conn != null) {
conn.close();
}
}catch(SQLException sqlExc) {}
}
}
public ArrayList<Studente> leggiStudenti() {
ArrayList<Studente> ris = new ArrayList<Studente>();
Connection conn = null;
PreparedStatement stmt = null;
try {
//connessione con il dbms
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PWD);
//preparare lo statement sql
stmt = conn.prepareStatement(SELECT_STUD);
//eseguo lo statement
ResultSet rs = stmt.executeQuery();
while(rs.next()) {
String nrBadge = rs.getString("NrBadge");
String c = rs.getString("Cognome");
String n = rs.getString("Nome");
Studente s = new Studente(nrBadge, c, n);
ris.add(s);
}
}catch(Exception exc) {
exc.printStackTrace();
}
finally {
//chiudere le risorse
try {
if(stmt != null) {
stmt.close();
}
if(conn != null) {
conn.close();
}
}catch(SQLException sqlExc) {}
}
return ris;
}
public static void main(String[] args) {
Studente s1 = new Studente("12345", "Yagami", "Light");
GestioneStudenti db = new GestioneStudenti();
db.inserisciStudente(s1);
ArrayList<Studente> lista = db.leggiStudenti();
for(Studente s: lista) {
System.out.println(s);
}
}
} | [
"[email protected]"
]
| |
9cfab63c12817b41d04aa37540d27c87ca6edecf | d5718b8bcba5f0f4d608c2cddb665685df89d0cb | /src/test/java/fileApiTest.java | 1b6e68e07aee9f48cb032e8f97fc240a2d61ba28 | []
| no_license | VeenuAiran/APITesting | 7c0ff736267c6184c3c33b72667c7cb272c93d20 | 4dc882d83f829e5b1c1df003efa72d8374a0bb85 | refs/heads/master | 2016-08-12T10:20:56.619619 | 2016-04-06T07:13:52 | 2016-04-06T07:13:52 | 55,583,832 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,859 | java | import com.jayway.awaitility.Duration;
import com.jayway.awaitility.core.ConditionFactory;
import org.junit.Test;
import com.jayway.restassured.response.Response;
import static com.jayway.restassured.RestAssured.given;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
import static com.jayway.awaitility.Awaitility.await;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNot.not;
import java.io.File;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class fileApiTest {
private static String fileId;
private String fileName = "APPLE_EX";
//Ideally Token should have been extracted through OAuth,
// since it was not mentioned, value has been hard-coded.
final String TOKEN = "xoxp-30829859861-30819630308-30829897184-a5b1f9cd2c";
private final String URL = "https://slack.com/api/";
final ConditionFactory WAIT = await().atMost(new Duration(45, TimeUnit.SECONDS))
.pollInterval(Duration.FIVE_SECONDS)
.pollDelay(Duration.FIVE_SECONDS);
private Response post(String fileName) {
Response response = given().
param("token", TOKEN).
multiPart(new File("src/main/resources/" + fileName + ".png")).
when().
post(URL + "files.upload").
then().
statusCode(200).extract().response();
return response;
}
private Response get() {
Response response = given().param("token", TOKEN).
param("types", "images").
when().
get(URL + "files.list").
then().statusCode(200).extract().response();
return response;
}
private Response delete(String fileId) {
Response response = given().param("token", TOKEN).
param("file", fileId).
when().
delete(URL + "files.delete").
then().statusCode(200).extract().response();
return response;
}
/**
* files.upload
1. Upload a PNG file no greater than 1 MB in size
2. files.upload returns a file object with a file ID and all expected
thumbnail URLs
3. The thumbnail URLs point to what appear to be the correct file –
the filename will be a lowercase version of the original upload
*/
@Test
public void test1FileUploadTest() {
Response response = post(fileName);
boolean ok = response.path("ok");
fileId = response.path("file.id");
String thumb_64_URL = response.path("file.thumb_64");
String thumb_80_URL = response.path("file.thumb_80");
String thumb_360_URL = response.path("file.thumb_360");
String thumb_160_URL = response.path("file.thumb_160");
//Assert value of ok
assertThat("Ok is not true", ok == true);
//Empty Check for ID
assertThat("File ID is empty", !fileId.isEmpty());
//Null Check for ID
assertThat("File ID is null", !fileId.equals(null));
//Thumbnail 64
assertThat("Thumbnail is empty ", !thumb_64_URL.isEmpty());
assertThat("thumb_64 is null", !thumb_64_URL.equals(null));
assertThat("fileName is not in lowercase", thumb_64_URL.contains(fileName.toLowerCase()));
//Thumbnail 80
assertThat("Thumbnail is empty ", !thumb_80_URL.isEmpty());
assertThat("thumb_80 is null", !thumb_80_URL.equals(null));
assertThat("fileName is not in lowercase", thumb_80_URL.contains(fileName.toLowerCase()));
//Thumbnail 360
assertThat("Thumbnail is empty ", !thumb_360_URL.isEmpty());
assertThat("thumb_360 is null", !thumb_360_URL.equals(null));
assertThat("fileName is not in lowercase", thumb_360_URL.contains(fileName.toLowerCase()));
//Thumbnail 160
assertThat("Thumbnail is empty ", !thumb_160_URL.isEmpty());
assertThat("thumb_160 is null", !thumb_160_URL.equals(null));
assertThat("fileName is not in lowercase", thumb_160_URL.contains(fileName.toLowerCase()));
}
/**
* files.list
A file you uploaded is properly listed in the response with the correct ID
*/
@Test
public void test2FileList() {
/*File doesn't appear instantly, have to poll (explicit wait).
Polling every 5 seconds upto 45 seconds
polling stops if file appears anytime before 45 seconds*/
WAIT.until(new Callable<String>() {
public String call() throws Exception {
return get().path("files[0].id");
}
}, equalTo(fileId));
}
/**
* List only by type:images when calling the endpoint
*/
@Test
public void test3FileList() {
// Asserting only png files are shown,
// since other fileName are unknown to me.
Response response = get();
List<String> fileType = response.path("files.filetype");
for (String s : fileType) {
assertThat("Contains files other than png", s.equals("png"));
}
}
/**
* files.delete
Delete a file you uploaded and confirm it is deleted
*/
@Test
public void test4DeleteUploadedFile() {
Response response = delete(fileId);
assertThat("Error deleting file", response.path("ok").equals(true));
//confirm file is deleted by doing a get
WAIT.until(new Callable<String>() {
public String call() throws Exception {
return get().path("files[0].id");
}
}, not(equalTo(fileId)));
//deleting the file again to confirm
Response response2 = delete(fileId);
assertThat("Error should say file deleted", response2.path("error").equals("file_deleted"));
}
/**
* Another test is to try deleting
* a file that doesn't exist and
* confirm that the correct error message appears
*/
@Test
public void test5DeleteNonExistentFile() {
Response response = delete("123ASDFG");
assertThat("should give ok as false", response.path("ok").equals(false));
assertThat("should give an error", response.path("error").equals("file_not_found"));
}
} | [
"[email protected]"
]
| |
63641af68d2bb3ac1871fea517cf7ad6b67c08c6 | 4507ddb8c35fe114da8420af3e5b2b5f9a0dad24 | /src/test/java/dataDriven.java | 37a48a386d88728de5b9272f34d1018fdb1d3927 | []
| no_license | coolrahim29/excel-driven-test | 731b1e111b4e492dc5a126706db91008c06ecef9 | 5ca6134173dc867bcb11abe9584a78f4bc8c5a6c | refs/heads/master | 2020-04-21T22:59:15.669430 | 2019-02-10T21:34:56 | 2019-02-10T21:34:56 | 169,931,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,685 | java | import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.util.NumberToTextConverter;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class dataDriven {
//Identify Testcases coloum by scanning the entire 1st row
//once coloumn is identified then scan entire testcase coloum to identify purcjhase testcase row
//after you grab purchase testcase row = pull all the data of that row and feed into test
public ArrayList<String> getData(String testcaseName) throws IOException
{
//fileInputStream argument
ArrayList<String> a=new ArrayList<String>();
FileInputStream fis=new FileInputStream(System.getProperty("user.dir")+"//env.xlsx");
XSSFWorkbook workbook=new XSSFWorkbook(fis);
int sheets=workbook.getNumberOfSheets();
for(int i=0;i<sheets;i++)
{
if(workbook.getSheetName(i).equalsIgnoreCase("testdata"))
{
XSSFSheet sheet=workbook.getSheetAt(i);
//Identify Testcases coloum by scanning the entire 1st row
Iterator<Row> rows= sheet.iterator();// sheet is collection of rows
Row firstrow= rows.next();
Iterator<Cell> ce=firstrow.cellIterator();//row is collection of cells
int k=0;
int coloumn = 0;
while(ce.hasNext())
{
Cell value=ce.next();
if(value.getStringCellValue().equalsIgnoreCase("TestCases"))
{
coloumn=k;
}
k++;
}
////once coloumn is identified then scan entire testcase coloum
while(rows.hasNext())
{
Row r=rows.next();
if(r.getCell(coloumn).getStringCellValue().equalsIgnoreCase(testcaseName))
{
////after you grab purchase testcase row = pull all the data of that row and feed into test
Iterator<Cell> cv=r.cellIterator();
while(cv.hasNext())
{
Cell c= cv.next();
if(c.getCellTypeEnum()==CellType.STRING)
{
a.add(c.getStringCellValue());
}
else{
a.add(NumberToTextConverter.toText(c.getNumericCellValue()));
}
}
}
}
}
}
return a;
}
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
]
| |
540f775fbb6fde97ac8a69eddbeecd66b99699c2 | 8ddddb1114dd42598648f6d7a80ffc31c7802602 | /Z_FactoryModel/src/com/liu/factory/simplefactory/JavaCourse.java | 3c082092ea892addf0b461ac6972dfaa9b3d7fe8 | []
| no_license | 2397459813/gupao | 1c3182afb31f42d2723044619d609a1cf6d448e7 | 816737dd270f8b204509f2a61afcca62dff8ed70 | refs/heads/master | 2021-06-28T13:00:15.122706 | 2020-02-16T03:29:17 | 2020-02-16T03:29:17 | 175,378,676 | 0 | 0 | null | 2020-10-13T12:30:55 | 2019-03-13T08:33:02 | Java | ISO-8859-13 | Java | false | false | 191 | java | package com.liu.factory.simplefactory;
public class JavaCourse implements ICourse{
@Override
public void buy() {
System.out.println("ĪŅĀņµÄŹĒJavaæĪ³Ģ");
}
}
| [
"[email protected]"
]
| |
40e4902619677006b6b6f4b49a7fefce2c3e5ad7 | a95fbe4532cd3eb84f63906167f3557eda0e1fa3 | /src/main/java/l2f/commons/collections/LazyArrayList.java | 53f84e6c0c9a787c5078207c081dfb2315f697f9 | [
"MIT"
]
| permissive | Kryspo/L2jRamsheart | a20395f7d1f0f3909ae2c30ff181c47302d3b906 | 98c39d754f5aba1806f92acc9e8e63b3b827be49 | refs/heads/master | 2021-04-12T10:34:51.419843 | 2018-03-26T22:41:39 | 2018-03-26T22:41:39 | 126,892,421 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,262 | java | package l2f.commons.collections;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.RandomAccess;
import org.apache.commons.pool.ObjectPool;
import org.apache.commons.pool.PoolableObjectFactory;
import org.apache.commons.pool.impl.GenericObjectPool;
/**
* Упрощенная реализация массива с интерфейсом <tt>List</tt> Не потоко-безопасная версия. Порядок элементов при удалении не сохраняется. В качестве аргумента при добавлении элементов может быть <tt>null</tt>.
* <p>
* В качестве параметра при создании обьекта <tt>LazyArrayList</tt> задается начальный размер массива элементов <tt>initialCapacity</tt>.
* </p>
* При добавлении элементов, в случае переполнения массива, размер увеличивается на <tt>capacity * 1.5</tt> При удалении элемента, массив не сокращается, вместо этого последний элемент массива становится на место удаленного. Массив элементов обнуляется, если количество элементов в нем равно
* <tt>0</tt>. При получении элементов с помощью метода {@link List#get(int) List.get(int)}, как и при итерации, может вернуть null, в случае, если индекс выходит за пределы массива.
* <p>
* Для идентификации элементов используется <tt>==</tt>, а не {@link Object#equals(Object) Object.equals(Object)}.
* </p>
* @author G1ta0
* @param <E>
*/
@SuppressWarnings("unchecked")
public class LazyArrayList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializable
{
private static final long serialVersionUID = 8683452581122892189L;
private static class PoolableLazyArrayListFactory implements PoolableObjectFactory
{
public PoolableLazyArrayListFactory()
{
}
@Override
public Object makeObject()
{
return new LazyArrayList<>();
}
@Override
public void destroyObject(Object obj)
{
((LazyArrayList<?>) obj).clear();
}
@Override
public boolean validateObject(Object obj)
{
return true;
}
@Override
public void activateObject(Object obj)
{
}
@Override
public void passivateObject(Object obj)
{
((LazyArrayList<?>) obj).clear();
}
}
private static final int POOL_SIZE = Integer.parseInt(System.getProperty("lazyarraylist.poolsize", "-1"));
private static final ObjectPool POOL = new GenericObjectPool(new PoolableLazyArrayListFactory(), POOL_SIZE, GenericObjectPool.WHEN_EXHAUSTED_GROW, 0L, -1);
/**
* Получить список LazyArrayList из пула. В случае, если в пуле нет свободных объектов, будет создан новый.
* @param <E>
* @return список LazyArrayList, созданный с параметрами по-умолчанию
* @see #recycle
*/
public static <E> LazyArrayList<E> newInstance()
{
try
{
return (LazyArrayList<E>) POOL.borrowObject();
}
catch (final Exception e)
{
e.printStackTrace();
}
return new LazyArrayList<>();
}
/**
* Добавить список LazyArrayList обратно в пул.
* @param <E>
* @param obj список LazyArrayList
* @see #newInstance
*/
public static <E> void recycle(LazyArrayList<E> obj)
{
try
{
POOL.returnObject(obj);
}
catch (final Exception e)
{
e.printStackTrace();
}
}
private static final int L = 1 << 3;
private static final int H = 1 << 10;
protected transient Object[] elementData;
protected transient int size = 0;
protected transient int capacity = L;
/**
* Создать новый список, с начальным размером внутреннего массива <tt>initialCapacity</tt>
* @param initialCapacity начальный размер списка
*/
public LazyArrayList(int initialCapacity)
{
if (initialCapacity < H)
while (capacity < initialCapacity)
capacity <<= 1;
else
capacity = initialCapacity;
}
public LazyArrayList()
{
this(8);
}
/**
* Добавить элемент в список
* @param element элемент, который добавляется в список
*/
@Override
public boolean add(E element)
{
ensureCapacity(size + 1);
elementData[size++] = element;
return true;
}
/**
* Заменить элемент списка в заданной позиции
* @param index позиция в которой необходимо заменить элемент
* @param element элемент, который следует установить в заданной позиции
* @return предыдущий элемент списка в заданной позиции, либо <tt>null</tt>, в случае, если заданная позиция выходит за пределы размерности списка
*/
@Override
public E set(int index, E element)
{
E e = null;
if ((index >= 0) && (index < size))
{
e = (E) elementData[index];
elementData[index] = element;
}
return e;
}
/**
* Вставить указанный элемент в указанную позицию списка, при этом все элементы в этой позиции сдвигаются направо
* @param index позиция, в которую необходимо вставить указанный элемент
* @param element элемент для вставки
*/
@Override
public void add(int index, E element)
{
if ((index >= 0) && (index < size))
{
ensureCapacity(size + 1);
System.arraycopy(elementData, index, elementData, index + 1, size - index);
elementData[index] = element;
size++;
}
}
/**
* Вставить элементы коллекции в указанную позицию списка, при этом все элементы в этой позиции сдвигаются направо. Для получения элементов коллекции используется метод {@link Collection#toArray() Collection.toArray()}
* @param index позиция, в которую необходимо вставить элементы указанной коллекции
* @param c коллекция, которая содержит элементы для вставки
* @return true, если список был изменен
*/
@Override
public boolean addAll(int index, Collection<? extends E> c)
{
if ((c == null) || c.isEmpty())
return false;
if ((index >= 0) && (index < size))
{
final Object[] a = c.toArray();
final int numNew = a.length;
ensureCapacity(size + numNew);
final int numMoved = size - index;
if (numMoved > 0)
System.arraycopy(elementData, index, elementData, index + numNew, numMoved);
System.arraycopy(a, 0, elementData, index, numNew);
size += numNew;
return true;
}
return false;
}
/**
* Расширить внутренний массив так, чтобы он смог разместить как минимум <b>newSize</b> элементов
* @param newSize минимальная размерность нового массива
*/
protected void ensureCapacity(int newSize)
{
if (newSize > capacity)
{
if (newSize < H)
while (capacity < newSize)
capacity <<= 1;
else
while (capacity < newSize)
capacity = (capacity * 3) / 2;
final Object[] elementDataResized = new Object[capacity];
if (elementData != null)
System.arraycopy(elementData, 0, elementDataResized, 0, size);
elementData = elementDataResized;
}
else // array initialization
if (elementData == null)
elementData = new Object[capacity];
}
/**
* Remove the element in the position parameter. The elements do not move to the left and to the specified position, instead of the remote, place the item to the end of the list
* @Param index the position at which you want to remove an item
* @Return the item removed from the specified position
*/
@Override
public E remove(int index)
{
E e = null;
if ((index >= 0) && (index < size))
{
size--;
e = (E) elementData[index];
elementData[index] = elementData[size];
elementData[size] = null;
trim();
}
return e;
}
/**
* Удалить из списка первое вхождение объекта, может быть <tt>null</tt>, при проверке идиентичности используется оператор <tt>==</tt>
* @param o объект, который следует удалить из списка
* @return true, если объект находился в списке
*/
@Override
public boolean remove(Object o)
{
if (size == 0)
return false;
int index = -1;
for (int i = 0; i < size; i++)
if (elementData[i] == o)
{
index = i;
break;
}
if (index == -1)
return false;
size--;
elementData[index] = elementData[size];
elementData[size] = null;
trim();
return true;
}
/**
* Возвращает true, если объект содержится в списке, в качестве аргумента может быть <tt>null</tt>, при проверке идиентичности используется оператор <tt>==</tt>
* @param o объект, присутствие которого проверяется в списке
* @return true, если объект находится в списке
*/
@Override
public boolean contains(Object o)
{
if (size == 0)
return false;
for (int i = 0; i < size; i++)
if (elementData[i] == o)
return true;
return false;
}
/**
* Возвращает позицию первого вхождения объекта в списке, в качестве аргумента может быть <tt>null</tt>, при проверке идиентичности используется оператор <tt>==</tt>, если объект не найден, возвращает -1
* @param o объект для поиска в списке
* @return позиция, в которой находится объект в списке, либо -1, если объект не найден
*/
@Override
public int indexOf(Object o)
{
if (size == 0)
return -1;
int index = -1;
for (int i = 0; i < size; i++)
if (elementData[i] == o)
{
index = i;
break;
}
return index;
}
/**
* Возвращает позицию последнего вхождения объекта в списке, в качестве аргумента может быть <tt>null</tt>, при проверке идиентичности используется оператор <tt>==</tt>, если объект не найден, возвращает -1
* @param o объект для поиска в списке
* @return последняя позиция, в которой находится объект в списке, либо -1, если объект не найден
*/
@Override
public int lastIndexOf(Object o)
{
if (size == 0)
return -1;
int index = -1;
for (int i = 0; i < size; i++)
if (elementData[i] == o)
index = i;
return index;
}
protected void trim()
{
}
/**
* Получить элемент списка в заданной позиции
* @param index позиция списка, элемент из которой необходимо получить
* @return возвращает элемент списка в заданной позиции, либо <tt>null</tt>, если заданая позиция выходит за пределы размерности списка
*/
@Override
public E get(int index)
{
if ((size > 0) && (index >= 0) && (index < size))
return (E) elementData[index];
return null;
}
/**
* Получить копию списка
* @return список, с параметрами и набором элементов текущего
*/
@Override
public Object clone()
{
final LazyArrayList<E> clone = new LazyArrayList<>();
if (size > 0)
{
clone.capacity = capacity;
clone.elementData = new Object[elementData.length];
System.arraycopy(elementData, 0, clone.elementData, 0, size);
}
return clone;
}
/**
* Очистить список
*/
@Override
public void clear()
{
if (size == 0)
return;
for (int i = 0; i < size; i++)
elementData[i] = null;
size = 0;
trim();
}
/**
* Возвращает количество элементов в списке
* @return количество элементов в списке
*/
@Override
public int size()
{
return size;
}
/**
* Возвращает true, если список не содержит элементов
* @return true, если список пуст
*/
@Override
public boolean isEmpty()
{
return size == 0;
}
/**
* Возвращает размер внутреннего массива списка
* @return размер внутреннего массива
*/
public int capacity()
{
return capacity;
}
/**
* Добавить все элементы коллекции в список. Для получения элементов коллекции используется метод {@link Collection#toArray() Collection.toArray()}
* @param c коллекция, которая содержит элементы для добавления
* @return true, если список был изменен
*/
@Override
public boolean addAll(Collection<? extends E> c)
{
if ((c == null) || c.isEmpty())
return false;
final Object[] a = c.toArray();
final int numNew = a.length;
ensureCapacity(size + numNew);
System.arraycopy(a, 0, elementData, size, numNew);
size += numNew;
return true;
}
/**
* Проверяет, содержатся ли все элементы коллекции в списке
* @param c коллекция, которая содержит элементы для проверки нахождения в списке
* @return true, если список содержит все элементы коллекции
* @see #contains(Object)
*/
@Override
public boolean containsAll(Collection<?> c)
{
if (c == null)
return false;
if (c.isEmpty())
return true;
final Iterator<?> e = c.iterator();
while (e.hasNext())
if (!contains(e.next()))
return false;
return true;
}
/**
* Удаляет из списка все элементы, которые не содержатся в заданной коллекции, для проверки нахождения элемента в коллекции используется метод коллекции {@link Collection#contains(Object) Collection.contains(Object)}
* @param c коллекция, которая содержит элементы, которые необходимо оставить в списке
* @return true, если список был изменен
*/
@Override
public boolean retainAll(Collection<?> c)
{
if (c == null)
return false;
boolean modified = false;
final Iterator<E> e = iterator();
while (e.hasNext())
if (!c.contains(e.next()))
{
e.remove();
modified = true;
}
return modified;
}
/**
* Удаляет из списка все элементы, которые содержатся в заданной коллекции, для проверки нахождения элемента в коллекции используется метод коллекции {@link Collection#contains(Object) Collection.contains(Object)}
* @param c коллекция, которая содержит элементы для удаления из списка
* @return true, если список был изменен
*/
@Override
public boolean removeAll(Collection<?> c)
{
if ((c == null) || c.isEmpty())
return false;
boolean modified = false;
final Iterator<?> e = iterator();
while (e.hasNext())
if (c.contains(e.next()))
{
e.remove();
modified = true;
}
return modified;
}
@Override
public Object[] toArray()
{
final Object[] r = new Object[size];
if (size > 0)
System.arraycopy(elementData, 0, r, 0, size);
return r;
}
@Override
public <T> T[] toArray(T[] a)
{
final T[] r = a.length >= size ? a : (T[]) java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size);
if (size > 0)
System.arraycopy(elementData, 0, r, 0, size);
if (r.length > size)
r[size] = null;
return r;
}
@Override
public Iterator<E> iterator()
{
return new LazyItr();
}
@Override
public ListIterator<E> listIterator()
{
return new LazyListItr(0);
}
@Override
public ListIterator<E> listIterator(int index)
{
return new LazyListItr(index);
}
private class LazyItr implements Iterator<E>
{
int cursor = 0;
int lastRet = -1;
public LazyItr()
{
}
@Override
public boolean hasNext()
{
return cursor < size();
}
@Override
public E next()
{
final E next = get(cursor);
lastRet = cursor++;
return next;
}
@Override
public void remove()
{
if (lastRet == -1)
throw new IllegalStateException();
LazyArrayList.this.remove(lastRet);
if (lastRet < cursor)
cursor--;
lastRet = -1;
}
}
private class LazyListItr extends LazyItr implements ListIterator<E>
{
LazyListItr(int index)
{
cursor = index;
}
@Override
public boolean hasPrevious()
{
return cursor > 0;
}
@Override
public E previous()
{
final int i = cursor - 1;
final E previous = get(i);
lastRet = cursor = i;
return previous;
}
@Override
public int nextIndex()
{
return cursor;
}
@Override
public int previousIndex()
{
return cursor - 1;
}
@Override
public void set(E e)
{
if (lastRet == -1)
throw new IllegalStateException();
LazyArrayList.this.set(lastRet, e);
}
@Override
public void add(E e)
{
LazyArrayList.this.add(cursor++, e);
lastRet = -1;
}
}
@Override
public String toString()
{
if (size == 0)
return "[]";
final StringBuilder sb = new StringBuilder();
sb.append('[');
for (int i = 0; i < size; i++)
{
final Object e = elementData[i];
sb.append(e == this ? "this" : e);
if (i == (size - 1))
sb.append(']').toString();
else
sb.append(", ");
}
return sb.toString();
}
/**
* Метод не реализован
* @throws UnsupportedOperationException
*/
@Override
public List<E> subList(int fromIndex, int toIndex)
{
throw new UnsupportedOperationException();
}
}
| [
"[email protected]"
]
| |
8e5abcc5d4597da8a4b22326b10a06656078364e | eabac3d150136c2d6d649cba687db0830e1e2e48 | /lucene_3_5/src/main/java/com/wdxxl/lucene/basic/Step01Index.java | 93be384103a180f1e67b3b544d0fb257284bd89d | []
| no_license | wdxxl/wdxxl_demo | 0f84a64c60dbe5d609812666e0e71d34d94a795e | be2be8e7d1999298353dff0e3b1922abb3825651 | refs/heads/master | 2021-05-16T06:40:40.123476 | 2018-04-20T03:51:31 | 2018-04-20T03:51:31 | 42,219,318 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,823 | java | package com.wdxxl.lucene.basic;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Index;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.util.Version;
public class Step01Index {
/**
* Steps for index method.
* 1. Create Directory
* 2. Create IndexWriter
* 3. Create Document
* 4. Add Field to Document
* 5. IndexWriter add the document to Lucene Index
*/
public static void main(String[] args) {
new Step01Index().index();
}
public void index() {
IndexWriter writer = null;
try {
// 1. Create Directory
Directory directory =
FSDirectory.open(new File(System.getProperty("user.dir")
+ "/lib/lucene35/index"));
// 2. Create IndexWriter
IndexWriterConfig iwc =
new IndexWriterConfig(Version.LUCENE_35,
new StandardAnalyzer(Version.LUCENE_35));
writer = new IndexWriter(directory, iwc);
// 3. Create Document
Document doc = null;
File f = new File(System.getProperty("user.dir") + "/lib/lucene35/datafiles");
for (File file : f.listFiles()) {
doc = new Document();
// 4. Add Field to Document
doc.add(new Field("content", new FileReader(file)));
doc.add(new Field("filename", file.getName(), Field.Store.YES, Index.NOT_ANALYZED));
doc.add(new Field("path", file.getAbsolutePath(), Field.Store.YES,
Index.NOT_ANALYZED));
// 5. IndexWriter add the document to Lucene Index
writer.addDocument(doc);
}
} catch (CorruptIndexException e) {
e.printStackTrace();
} catch (LockObtainFailedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (writer != null) {
try {
// 6. writer must be closed.
writer.close();
} catch (CorruptIndexException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
| [
"[email protected]"
]
| |
8df71e8764d21dfd93249ac65f7ca9f992835f99 | 3d7d7e632e22f7c48c6e13c644de49c82e7dfda8 | /src/main/java/com/spring/batch/record/api/RecordProcessingApplication.java | f15f0955bc80d860fdf43eaf18f73d33401d1595 | []
| no_license | Java-Gyan-Mantra/spring-batch-scheduler | 0689f3dd51b26668887d6f6179d10639e80aa885 | 50dd05f7aff20d8317800cea29f54fef9b401ca3 | refs/heads/master | 2020-03-21T13:36:11.478449 | 2018-06-25T15:37:59 | 2018-06-25T15:37:59 | 138,615,133 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.spring.batch.record.api;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RecordProcessingApplication {
public static void main(String[] args) {
SpringApplication.run(RecordProcessingApplication.class, args);
}
}
| [
"[email protected]"
]
| |
e0f39f0ce35474a6b0cc443c7c40ad083bfe0809 | 2f0dde3eff69b44db1bcae1a2a1554f497f6e972 | /bikc/src/java/mx/com/kubez/bikc/dao/RegistrosPos.java | 493d309b9f337620706d839d83f7f2fba211a995 | []
| no_license | c-rlos/bikc | 9f91bda4e67a8915f3ffa6c00b99b72d6665651a | 34344d64b3605c5e3a46579dbc3af21d4ae8c715 | refs/heads/master | 2020-04-04T12:08:38.075694 | 2018-11-02T20:05:47 | 2018-11-02T20:05:47 | 155,481,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,585 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mx.com.kubez.bikc.dao;
import mx.com.kubez.bikc.dto.VentaDTO;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import mx.qubez.utilierias.conexion.Factory;
import mx.com.kubez.bikc.vo.PosVO;
import static mx.com.kubez.bikc.vo.PosVO.listaVenta;
import static mx.com.kubez.bikc.vo.PosVO.venta;
/**
*
* @author Usuario1
*/
public class RegistrosPos {
public void registarCompra(PosVO pos, Connection con) {
int id_venta = 0;
Statement st = null;
try {
st = con.createStatement();
String query;
int estatus = 0;
PreparedStatement ps;
st.executeUpdate("BEGIN");
if (!pos.v_en_espera) {
query = query = "INSERT INTO venta (fecha_venta,id_cliente,id_usuario,id_terminal,id_almacen,id_tienda) VALUES (?,?,?,?,?,?)";
ps = con.prepareStatement(query);
ps.setDate(1, venta.getFechaVenta());
ps.setInt(2, venta.getIdCliente());
ps.setInt(3, venta.getIdUsuario());
ps.setInt(4, venta.getIdTermninal());
ps.setInt(5, venta.getIdAlmacen());
ps.setInt(6, venta.getIdTienda());
ps.executeUpdate();
ps = con.prepareStatement("select last_insert_id() as id");
System.out.println("paso---");
ResultSet rs = ps.executeQuery();
rs.next();
id_venta = rs.getInt("id");
venta.setIdVenta(id_venta);
ps.close();
}
for (int i = 0; i < listaVenta.size(); i++) {
if (listaVenta.get(i).getEstatus() == 1 || (!pos.v_en_espera & listaVenta.get(i).getEstatus() == 0)) {
query = "INSERT INTO venta_producto (id_venta,id_producto,cantidad,costo,precio_unitario,id_promocion,estatus,precio_venta,precio_venta_sin_iva,iva,barcode,descuento) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)";
ps = con.prepareStatement(query);
//ps = con.prepareStatement(query);
ps.setInt(1, venta.getIdVenta());
ps.setInt(2, listaVenta.get(i).getIdProducto());
ps.setInt(3, listaVenta.get(i).getCantidad());
ps.setDouble(4, listaVenta.get(i).getCosto());
ps.setDouble(5, listaVenta.get(i).getPrecioUno());
ps.setInt(6, 1);
ps.setInt(7, listaVenta.get(i).getEstatus());
estatus = listaVenta.get(i).getEstatus();
ps.setDouble(8, (listaVenta.get(i).getCosto() * listaVenta.get(i).getCantidad()) + listaVenta.get(i).getIva());
ps.setDouble(9, (listaVenta.get(i).getCosto() * listaVenta.get(i).getCantidad()));
ps.setDouble(10, listaVenta.get(i).getIva());
ps.setString(11, listaVenta.get(i).getBarcode());
ps.setDouble(12, listaVenta.get(i).getDescuentoPromocion());
ps.executeUpdate();
ps.close();
}
}
//if(estatus == 1){
for (int i = 0; i < listaVenta.size(); i++) {
if (listaVenta.get(i).getEstatus() == 1) {
query = "INSERT INTO movimiento_producto (id_tipo_transaccion, id_producto, barcode, cantidad, fecha_registro, numero_documento_externo,"
+ "id_tipo_documento,id_almacen,id_tienda, id_usuario_registro) VALUES (1,?,?,?,?,1,1,?,?,?)";
ps = con.prepareStatement(query);
//ps = con.prepareStatement(query);
ps.setInt(1, listaVenta.get(i).getIdProducto());
ps.setString(2, listaVenta.get(i).getBarcode());
ps.setInt(3, -listaVenta.get(i).getCantidad());
java.util.Date d = new java.util.Date();
Date fechaActual = new Date(d.getTime());
ps.setDate(4, fechaActual);
ps.setInt(5, venta.getIdAlmacen());
ps.setInt(6, venta.getIdTienda());
ps.setInt(7, venta.getIdUsuario());
ps.executeUpdate();
ps.close();
}
}
st.executeUpdate("COMMIT");
st.close();
//}
if (estatus == 0) {
VentaDTO v = new VentaDTO();
v.setIdVenta(id_venta);
pos.ventasEspera.add(v);
}
} catch (Exception ex) {
try {
st.executeUpdate("ROLLBACK");
} catch (SQLException ex1) {
Logger.getLogger(RegistrosPos.class.getName()).log(Level.SEVERE, null, ex1);
}
System.out.println("Error en AccesoVO.validaAcceso: " + ex.getMessage());
} finally {
//Factory.close(con);
}
pos.listaVenta.clear();
}
public void regisVentaEnEspera(PosVO pos, Connection con) {
for (int i = 0; i < listaVenta.size(); i++) {
listaVenta.get(i).setEstatus(0);
}
registarCompra(pos, con);
pos.listaVenta.clear();
}
public void ventasEnEspera(PosVO pos, Connection con) {
int id_venta = 0;
if (pos.v_en_espera) {
try {
String query = "UPDATE venta SET fecha_venta = ?, id_cliente = ?, id_usuario = ?, id_terminal = ?, id_almacen= ?, id_tienda = ? WHERE id_venta = ?";
int estatus = 0;
PreparedStatement ps;
ps = con.prepareStatement(query);
ps.setDate(1, venta.getFechaVenta());
ps.setInt(2, venta.getIdCliente());
ps.setInt(3, venta.getIdUsuario());
ps.setInt(4, venta.getIdTermninal());
ps.setInt(5, venta.getIdAlmacen());
ps.setInt(6, venta.getIdTienda());
ps.setInt(7, venta.getIdVenta());
ps.executeUpdate();
id_venta = venta.getIdVenta();
for (int i = 0; i < listaVenta.size(); i++) {
if (listaVenta.get(i).getEstatus() == 0) {
query = "UPDATE venta_producto SET id_producto = ?, cantidad = ?, costo = ?,precio_unitario = ?,id_promocion = ?,estatus = ?,precio_venta = ?,precio_venta_sin_iva = ?,iva = ?,barcode = ?, descuento = ? WHERE id_venta = ?";
ps = con.prepareStatement(query);
//ps = con.prepareStatement(query);
ps.setInt(1, listaVenta.get(i).getIdProducto());
ps.setInt(2, listaVenta.get(i).getCantidad());
ps.setDouble(3, listaVenta.get(i).getCosto());
ps.setDouble(4, listaVenta.get(i).getPrecioUno());
ps.setInt(5, 1);
ps.setInt(6, 1);
//estatus = 1;
ps.setDouble(7, (listaVenta.get(i).getCosto() * listaVenta.get(i).getCantidad()) + listaVenta.get(i).getIva());
ps.setDouble(8, (listaVenta.get(i).getCosto() * listaVenta.get(i).getCantidad()));
ps.setDouble(9, listaVenta.get(i).getIva());
ps.setString(10, listaVenta.get(i).getBarcode());
ps.setDouble(11, listaVenta.get(i).getDescuentoPromocion());
ps.setInt(12, id_venta);
ps.executeUpdate();
ps.close();
}
}
System.out.println("aqui si");
for (int i = 0; i < listaVenta.size(); i++) {
if (listaVenta.get(i).getEstatus() == 0) {
query = "INSERT INTO movimiento_producto (id_tipo_transaccion,id_producto,barcode,cantidad,fecha_registro,numero_documento_externo,"
+ "id_tipo_documento,id_almacen, id_tienda,id_usuario_registro) VALUES (1,?,?,?,?,1,?,?,?,?)";
ps = con.prepareStatement(query);
//ps = con.prepareStatement(query);
//.setInt(1, id_venta);
ps.setInt(1, listaVenta.get(i).getIdProducto());
ps.setString(2, listaVenta.get(i).getBarcode());
ps.setInt(3, -listaVenta.get(i).getCantidad());
java.util.Date d = new java.util.Date();
Date fechaActual = new Date(d.getTime());
ps.setDate(4, fechaActual);
ps.setInt(5, 1);
ps.setInt(6, venta.getIdAlmacen());
ps.setInt(7, venta.getIdTienda());
ps.setInt(8, venta.getIdUsuario());
ps.executeUpdate();
ps.close();
}
}
VentaDTO v = new VentaDTO();
v.setIdVenta(id_venta);
pos.ventasEspera.add(v);
for (int i = 0; i < pos.ventasEspera.size(); i++) {
if (pos.ventasEspera.get(i).getIdVenta() == id_venta) {
pos.ventasEspera.remove(i);
}
}
} catch (Exception ex) {
System.out.println("Error en AccesoVO.validaAcceso: " + ex.getMessage());
} finally {
}
//pos.listaVenta.clear();
}
}
public void cancelarEnEspera(PosVO pos, Connection con) {
int id_venta = venta.getIdVenta();
try {
String query;
PreparedStatement ps;
for (int i = 0; i < listaVenta.size(); i++) {
query = "DELETE FROM venta_producto WHERE id_venta = ?";
ps = con.prepareStatement(query);
ps.setInt(1, id_venta);
ps.executeUpdate();
ps.close();
}
query = "DELETE FROM venta WHERE id_venta = ?";
ps = con.prepareStatement(query);
ps.setInt(1, venta.getIdVenta());
ps.executeUpdate();
id_venta = venta.getIdVenta();
ps.close();
VentaDTO v = new VentaDTO();
v.setIdVenta(id_venta);
pos.ventasEspera.add(v);
for (int i = 0; i < pos.ventasEspera.size(); i++) {
if (pos.ventasEspera.get(i).getIdVenta() == id_venta) {
pos.ventasEspera.remove(i);
}
}
if (pos.ventasEspera.get(0).getIdVenta() == id_venta) {
pos.ventasEspera.remove(0);
}
} catch (Exception ex) {
System.out.println("Error en AccesoVO.validaAcceso: " + ex.getMessage());
} finally {
try {
con.close();
//Factory.close(con);
} catch (SQLException ex) {
Logger.getLogger(PosVO.class.getName()).log(Level.SEVERE, null, ex);
}
}
pos.listaVenta.clear();
}
}
| [
"[email protected]"
]
| |
740c25f437485265caa33025d9461ab7f442b742 | 4ddf9f10317396980c3360dedf762d23ab943599 | /app/src/main/java/com/example/piezone/widget/IngredientsRemoteViewsFactory.java | 1c2fa44f17b07b31ff3e6b4971e5aa5214a7317d | []
| no_license | enochpc/PieZone | e74b8ce84e383a4582204fdb3998300e362bbf9f | 449455f578ae651ef759a77fc93149818662bd2d | refs/heads/master | 2023-03-01T23:08:53.630298 | 2021-02-16T02:22:36 | 2021-02-16T02:22:36 | 339,262,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,082 | java | package com.example.piezone.widget;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;
import android.widget.RemoteViewsService;
import com.example.piezone.R;
import com.example.piezone.model.Ingredient;
import com.example.piezone.model.Recipe;
import com.example.piezone.ui.MainActivity;
import java.util.List;
public class IngredientsRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory {
private Context mContext;
private List<Ingredient> mIngredients;
public IngredientsRemoteViewsFactory(Context context) {this.mContext = context; }
@Override
public void onCreate(){
//nothing to see here, move along
}
@Override
public void onDataSetChanged() {
Recipe recipe = WidgetPrefs.loadRecipe(mContext);
if(recipe != null){
mIngredients = recipe.getIngredients();
}
}
@Override
public void onDestroy() {
//these are not the droids you are looking for
}
@Override
public int getCount() {
return mIngredients == null ? 0 : mIngredients.size();
}
@Override
public RemoteViews getViewAt(int position){
Ingredient ingredient = mIngredients.get(position);
RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.recipe_widget_list_item);
rv.setTextViewText(R.id.tv_widget_ingredient_name, ingredient.toString());
/**
* Set a fillIn Intent to open the PendingIntent set in {@link RecipeWidget#updateAppWidgets(Context, AppWidgetManager, int[])}
*/
rv.setOnClickFillInIntent(R.id.tv_widget_ingredient_name, new Intent());
return rv;
}
@Override
public RemoteViews getLoadingView() {
return null;
}
@Override
public int getViewTypeCount() {
return 1;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public boolean hasStableIds() {
return false;
}
}
| [
"[email protected]"
]
| |
c9cf21ab249cd3345a89b4c02ef751f453eea4cf | 0705c798f5febabf1746101b67b1ceb735f51aa9 | /MyHistory/app/src/main/java/com/araujodev/myhistory/TelaAdicionar.java | c96a0c336d79b08ad5308bd741537f00373e86e5 | []
| no_license | CrazyRural/Android | 37f7dde0a8453149f7edfc2bbcf42db0c15d1c7f | 19f158739ab7ab85a16ffd3e450f058f5f7e37af | refs/heads/master | 2021-01-01T18:26:31.563568 | 2017-07-26T18:14:40 | 2017-07-26T18:14:40 | 98,340,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,598 | java | package com.araujodev.myhistory;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.TabActivity;
import android.content.Intent;
import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TabHost;
import android.widget.Toolbar;
import java.util.ArrayList;
import java.util.List;
public class TelaAdicionar extends TabActivity {
private TabHost TabHostWindow;
private final String um = "Dados", dois = "Visita", tres = "Receita";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tela_adicionar);
TabHostWindow = (TabHost)findViewById(android.R.id.tabhost);
TabHost.TabSpec TabMenu1 = TabHostWindow.newTabSpec(um);
TabHost.TabSpec TabMenu2 = TabHostWindow.newTabSpec(dois);
TabHost.TabSpec TabMenu3 = TabHostWindow.newTabSpec(tres);
TabMenu1.setIndicator(um);
TabMenu1.setContent(new Intent(this, TelaBasico.class));
TabMenu2.setIndicator(dois);
TabMenu2.setContent(new Intent(this, TelaDetalhes.class));
TabMenu3.setIndicator(tres);
TabMenu3.setContent(new Intent(this, TelaReceituario.class));
TabHostWindow.addTab(TabMenu1);
TabHostWindow.addTab(TabMenu2);
TabHostWindow.addTab(TabMenu3);
}
}
| [
"[email protected]"
]
| |
fd80f45b8f313cedfc90c831a2049d7429c0ab90 | b713e2223d290fa30e993b1d4f34b1d13900dc75 | /java/armeria-test/src/main/java/kr/notforme/thrift/MyHelloAsyncService.java | b8a62c93bdf662c7fdee67026b48857d8effbaae | []
| no_license | not-for-me/til | 5eba9704514072cc5c80883cf28d6c49f03bc8d5 | e4133a76ab8acfe478a4c7bd25043184e737d0bc | refs/heads/master | 2023-02-04T19:07:51.834578 | 2021-06-13T14:26:15 | 2021-06-13T14:26:15 | 61,928,877 | 2 | 1 | null | 2023-01-25T12:26:21 | 2016-06-25T05:42:22 | JavaScript | UTF-8 | Java | false | false | 540 | java | package kr.notforme.thrift;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
public class MyHelloAsyncService implements HelloService.AsyncIface {
@Override
public void hello(String name, AsyncMethodCallback resultHandler) throws TException {
System.out.println("[" +Thread.currentThread().getStackTrace()[1].getClassName() +"] Start!!!");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
resultHandler.onComplete("Hello, " + name + '!');
}
}
| [
"[email protected]"
]
| |
a91aede81f0b7bd7be7c53944918298fa33c5d59 | 18b6ae3ad066c09e918f18a0476b76773c0fbd82 | /src/main/java/com/rlab/web/controller/TeleCustomerController.java | cf1886f7524c6d5b09c8ad758084bc6dd477b031 | []
| no_license | olengedavid/TelecomChurnDemoApp | ca9ac20956eaf22eb53813c8afd8bb9587be5190 | 9dd2d982e01078ab1524c4119418559264d2c027 | refs/heads/master | 2021-10-25T23:30:32.026744 | 2019-04-08T06:49:11 | 2019-04-08T06:49:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,188 | java | package com.rlab.web.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.rlab.cache.ContractInfoRepository;
import com.rlab.cache.CustomerUsageRepository;
import com.rlab.entity.ContractInfo;
import com.rlab.entity.CustomerUsageDetails;
import com.rlab.jet.connectivity.JetIntegrator;
import com.rlab.kafka.message.KMessage;
/**
*
* @author Riaz Mohammed
*
*/
@Controller
public class TeleCustomerController {
@Autowired
ContractInfoRepository ciRep;
@Autowired
CustomerUsageRepository cuRep;
@Autowired
JetIntegrator jetI;
@RequestMapping(value="/churnpredictor/{key}", method=RequestMethod.GET)
public String churnpredictor(@PathVariable String key, Model model) {
ContractInfo ci = ciRep.findByKey(key);
CustomerUsageDetails cud = cuRep.findByKey(key);
model.addAttribute("contractInfo", ci);
model.addAttribute("customerUsage", cud);
try {
String churn = "1" ;
// ApamaIntegrator.predictChurn(ci,cud);
KMessage res = jetI.predictChurn(ci, cud);
model.addAttribute("churn", res.getAttribute("Result"));
model.addAttribute("P0", res.getAttribute("P0")+"%");
model.addAttribute("P1", res.getAttribute("P1")+"%");
System.out.println( "WEB MOdel "+model);
if(churn.equals("1"))
model.addAttribute("churnMessage", "CUSTOMER LIKELY TO CHURN");
else
model.addAttribute("churnMessage", "CUSTOMER NOT LIKELY TO CHURN");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "churnpredictor";
}
@RequestMapping(value="/churnpredictorMain",method=RequestMethod.GET)
public String churnpredictorMain(Model model) {
return "churnpredictorMain";
}
@RequestMapping(value="/churnpredictorMain",method=RequestMethod.POST)
public String basketsAdd(@RequestParam String areaCode,String phone, Model model) {
ContractInfo ci = ciRep.findByKey(areaCode+"-"+phone);
model.addAttribute("contractInfo", ci);
return "redirect:/churnpredictor/" + ci.getKey();
}
/*
@RequestMapping(value="/basket/{id}/items", method=RequestMethod.POST)
public String basketsAddSkill(@PathVariable Long id, @RequestParam Long itemId, Model model) {
Item item = itemSvc.findOne(itemId);
Basket basket = basketSvc.findOne(id);
if (basket != null) {
if (!basket.hasItem(item)) {
//basket.getItems().add(item);
basket.addItem(item);
}
basketSvc.save(basket);
model.addAttribute("basket", basketSvc.findOne(id));
model.addAttribute("items", itemSvc.findAll());
return "redirect:/basket/" + basket.getId();
}
model.addAttribute("baskets", basketSvc.findAll());
return "redirect:/baskets";
} */
}
| [
"[email protected]"
]
| |
26aa5bbb81d94093bee54c51b7a813372fb84806 | e5683b820e6c34bd2c0acaf0a915d0c400775324 | /app-order-service/src/main/java/uz/pdp/apporderservice/controller/PaymentController.java | 0246c90dd00618b7485f1aa96905f58eb93bca04 | []
| no_license | ismoil001/ismoilsrepository | 11258f0bf83fe4a9fd17a2f49aa29199edc6837f | ac62f8589559eab43b79bb53298eb6ebfb03aaed | refs/heads/master | 2021-06-21T00:01:31.548251 | 2019-10-08T00:10:31 | 2019-10-08T00:10:31 | 214,147,748 | 0 | 0 | null | 2021-04-26T19:34:43 | 2019-10-10T09:58:09 | JavaScript | UTF-8 | Java | false | false | 1,072 | java | package uz.pdp.apporderservice.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import uz.pdp.apporderservice.payload.ReqPayment;
import uz.pdp.apporderservice.service.PaymentService;
import java.util.UUID;
@RestController
@RequestMapping("/api/payment")
public class PaymentController {
@Autowired
PaymentService paymentService;
@GetMapping
public HttpEntity<?> getPayment(@RequestParam Integer page,@RequestParam Integer size,@RequestParam String name,@RequestParam Boolean isArchive){
return paymentService.getPayments(page,size,name,isArchive);
}
@PostMapping
public HttpEntity<?> savePayment(@RequestBody ReqPayment reqPayment){
return paymentService.savePayment(reqPayment);
}
@DeleteMapping("{id}")
public HttpEntity<?> deletePayment(@PathVariable UUID id){
return paymentService.deletePayment(id);
}
}
| [
"[email protected]"
]
| |
33060a800f7ab2ec4d2a53918b9e00a97c1e115b | 1600c2eb6ed2c8c49a798df8bd37f5108ff07331 | /user/src/main/java/com/github/duychuongvn/user/exception/UserAlreadyExistsException.java | a71361b48e91f7e7869909efcfa6f99875989bb6 | []
| no_license | duychuongvn/enterprise-web-app | c0f5bd6de00447673f8f468738c92e2c044c50c5 | 5f58a4541d730c8c03d6fb964459cca8da32bb90 | refs/heads/master | 2020-05-30T07:16:36.062183 | 2017-01-11T02:33:22 | 2017-01-11T02:33:22 | 69,794,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 699 | java | package com.github.duychuongvn.user.exception;
/**
* Created by huynhduychuong on 10/8/2016.
*/
public class UserAlreadyExistsException extends Exception {
public UserAlreadyExistsException() {
}
public UserAlreadyExistsException(String message) {
super(message);
}
public UserAlreadyExistsException(String message, Throwable cause) {
super(message, cause);
}
public UserAlreadyExistsException(Throwable cause) {
super(cause);
}
public UserAlreadyExistsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"[email protected]"
]
| |
c59b89dc7afb27644bc1633ddfc0f6d134f3d1fa | 8d859bcadb20132b3145b2d1194a4ecb3bb02626 | /src/main/java/com/emk/email/esendht/entity/ESendHtEntityA.java | e77b62d23d26744b9e59f62d3d9b293cdbbbc073 | []
| no_license | panjs008/yun2 | a7cbaf63becd15e33f0ee66376589b59721cda1c | 88887593dcc1b29232e5fdef79439b1bcbbd1f0f | refs/heads/master | 2022-12-21T00:16:13.405709 | 2020-02-19T01:14:49 | 2020-02-19T01:14:49 | 241,502,060 | 0 | 0 | null | 2022-12-16T04:25:16 | 2020-02-19T01:00:53 | Java | UTF-8 | Java | false | false | 8,594 | java | package com.emk.email.esendht.entity;
import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
import javax.persistence.*;
import java.util.Date;
/**
* @Title: Entity
* @Description: 邮箱数据
* @author onlineGenerator
* @date 2019-10-29 23:23:12
* @version V1.0
*
*/
@Entity
@Table(name = "e_send_ht", schema = "")
@SuppressWarnings("serial")
public class ESendHtEntityA implements java.io.Serializable {
/**主键*/
private String id;
/**创建人名称*/
private String createName;
/**创建人登录名称*/
private String createBy;
/**创建日期*/
private Date createDate;
/**所属部门*/
private String sysOrgCode;
/**同事编号*/
@Excel(name="同事编号",width=15)
private String workNo;
/**同事姓名*/
@Excel(name="同事姓名",width=15)
private String userName;
/**续签期限*/
@Excel(name="续签期限",width=15)
private String xqqx;
/**模板编号*/
@Excel(name="模板编号",width=15)
private String mbbh;
/**经理姓名*/
@Excel(name="经理姓名",width=15)
private String manger;
/**经理姓名*/
@Excel(name="经理电话",width=15)
private String mangerTelphone;
/**经理邮箱*/
@Excel(name="经理邮箱",width=15)
private String email;
/**发送状态*/
private String sendState;
@Excel(name="发送状态",width=15)
private String sendState2;
/**发送时间*/
@Excel(name="发送时间",width=15)
private String sendTime;
/**状态*/
private String state;
@Excel(name="回复状态",width=15)
private String state2;
/**回复时间*/
@Excel(name="回复时间",width=15)
private String replyTime;
/**电话*/
@Excel(name="同事电话",width=15)
private String telphone;
@Excel(name="职业危害",width=15)
private String zywh;
@Excel(name="上岗证",width=15)
private String sgxx;
/**
*方法: 取得java.lang.String
*@return: java.lang.String 主键
*/
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=36)
public String getId(){
return this.id;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 主键
*/
public void setId(String id){
this.id = id;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 创建人名称
*/
@Column(name ="CREATE_NAME",nullable=true,length=50)
public String getCreateName(){
return this.createName;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 创建人名称
*/
public void setCreateName(String createName){
this.createName = createName;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 创建人登录名称
*/
@Column(name ="CREATE_BY",nullable=true,length=50)
public String getCreateBy(){
return this.createBy;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 创建人登录名称
*/
public void setCreateBy(String createBy){
this.createBy = createBy;
}
/**
*方法: 取得java.util.Date
*@return: java.util.Date 创建日期
*/
@Column(name ="CREATE_DATE",nullable=true,length=20)
public Date getCreateDate(){
return this.createDate;
}
/**
*方法: 设置java.util.Date
*@param: java.util.Date 创建日期
*/
public void setCreateDate(Date createDate){
this.createDate = createDate;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 所属部门
*/
@Column(name ="SYS_ORG_CODE",nullable=true,length=50)
public String getSysOrgCode(){
return this.sysOrgCode;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 所属部门
*/
public void setSysOrgCode(String sysOrgCode){
this.sysOrgCode = sysOrgCode;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 同事编号
*/
@Column(name ="WORK_NO",nullable=true,length=32)
public String getWorkNo(){
return this.workNo;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 同事编号
*/
public void setWorkNo(String workNo){
this.workNo = workNo;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 同事姓名
*/
@Column(name ="USER_NAME",nullable=true,length=32)
public String getUserName(){
return this.userName;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 同事姓名
*/
public void setUserName(String userName){
this.userName = userName;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 续签期限
*/
@Column(name ="XQQX",nullable=true,length=32)
public String getXqqx(){
return xqqx;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 续签期限
*/
public void setXqqx(String xqqx){
this.xqqx = xqqx;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 模板编号
*/
@Column(name ="MBBH",nullable=true,length=32)
public String getMbbh(){
return this.mbbh;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 模板编号
*/
public void setMbbh(String mbbh){
this.mbbh = mbbh;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 经理姓名
*/
@Column(name ="MANGER",nullable=true,length=32)
public String getManger(){
return this.manger;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 经理姓名
*/
public void setManger(String manger){
this.manger = manger;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 经理邮箱
*/
@Column(name ="EMAIL",nullable=true,length=56)
public String getEmail(){
return this.email;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 经理邮箱
*/
public void setEmail(String email){
this.email = email;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 发送状态
*/
@Column(name ="SEND_STATE",nullable=true,length=32)
public String getSendState(){
return sendState;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 发送状态
*/
public void setSendState(String sendState){
this.sendState = sendState;
}
public String getSendState2() {
if("0".equals(sendState)){
return "创建";
}else if("1".equals(sendState)){
return "已发送";
}
return "";
}
public void setSendState2(String sendState2) {
this.sendState2 = sendState2;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 电话
*/
@Column(name ="TELPHONE",nullable=true,length=32)
public String getTelphone(){
return this.telphone;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 电话
*/
public void setTelphone(String telphone){
this.telphone = telphone;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 状态
*/
@Column(name ="STATE",nullable=true,length=32)
public String getState(){
return state;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 状态
*/
public void setState(String state){
this.state = state;
}
public String getState2() {
if("0".equals(state)){
return "创建";
}else if("1".equals(state)){
return "已确认";
}else if("2".equals(state)){
return "拒绝";
}
return "";
}
public void setState2(String state2) {
this.state2 = state2;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 发送时间
*/
@Column(name ="SEND_TIME",nullable=true,length=32)
public String getSendTime(){
return this.sendTime;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 发送时间
*/
public void setSendTime(String sendTime){
this.sendTime = sendTime;
}
/**
*方法: 取得java.lang.String
*@return: java.lang.String 回复时间
*/
@Column(name ="REPLY_TIME",nullable=true,length=32)
public String getReplyTime(){
return this.replyTime;
}
/**
*方法: 设置java.lang.String
*@param: java.lang.String 回复时间
*/
public void setReplyTime(String replyTime){
this.replyTime = replyTime;
}
@Column(name ="manger_telphone",nullable=true,length=32)
public String getMangerTelphone() {
return mangerTelphone;
}
public void setMangerTelphone(String mangerTelphone) {
this.mangerTelphone = mangerTelphone;
}
@Column(name ="zywh",nullable=true,length=32)
public String getZywh() {
return zywh;
}
public void setZywh(String zywh) {
this.zywh = zywh;
}
@Column(name ="sgxx",nullable=true,length=32)
public String getSgxx() {
return sgxx;
}
public void setSgxx(String sgxx) {
this.sgxx = sgxx;
}
}
| [
"[email protected]"
]
| |
92ea37f114f92b45ce3da84fd303ad4bdb5f7afc | 85a77ee6955a3cb37e9ce5667ebec58ba3dce6c3 | /src/BinarySearch.java | 86e84d69d343f0e3a51edf162047ca65d3a872c2 | []
| no_license | cadywsq/Data-Structures | 52c5a94ed19012cbfcf65512fb309a0dd08ab4ed | 07f4b188bc554569c9c3254cb9eefbb2df6338af | refs/heads/master | 2020-04-09T06:58:10.799653 | 2016-07-16T21:20:18 | 2016-07-16T21:20:18 | 60,864,432 | 0 | 0 | null | 2019-10-04T18:18:09 | 2016-06-10T17:11:51 | Java | UTF-8 | Java | false | false | 659 | java | /**
* @author Siqi Wang siqiw1 on 6/10/16.
*/
public class BinarySearch {
public int binarySearch(int[] nums, int target) {
if (nums == null || nums.length == 0) {
return -1;
}
int start = 0, end = nums.length - 1;
while (start < end) {
int mid = start + (end - start) / 2;
if (nums[mid] == target) {
return mid;
} else if (nums[mid] < target) {
start = mid + 1;
} else {
end = mid - 1;
}
}
if (nums[start] == target) {
return start;
}
return -1;
}
}
| [
"[email protected]"
]
| |
6b4bb2625d28c9997a044a28e8c66570858fdc3c | fe5b4e7af9a4504437d33734de0ea62baf454b69 | /Learning/OtherLanguages/Java/javaNet/src/javaNet/Client.java | 6a2365f357a51234a5a0a300ad3d1ac3c8a12ee8 | []
| no_license | FelicxFoster/Sources | 937f2936b0fa3eef9dd2bbbde09e7f44755b8a8a | 3750c393088c281c000228d84fe619ba321bd5bc | refs/heads/master | 2020-04-22T09:37:05.191325 | 2016-08-06T07:02:50 | 2016-08-06T07:02:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | package javaNet;
import java.net.*;
import java.io.*;
public class Client {
public static void main(String[] args){
String serverName = args[0];
int port = Integer.parseInt(args[1]);
try{
System.out.println("Connecting to " + serverName + "on port " + port);
Socket client = new Socket(serverName, port);
System.out.println("Just connected to " + client.getRemoteSocketAddress());
OutputStream outToServer = client.getOutputStream();
DataOutputStream outputStream = new DataOutputStream(outToServer);
outputStream.writeUTF("Hello from " + client.getLocalSocketAddress());
InputStream inputFromServer = client.getInputStream();
DataInputStream inputStream = new DataInputStream(inputFromServer);
System.out.println("Server says " + inputStream.readUTF());
client.close();
}catch(IOException e){
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
0a82ff98ae88602b7d13798551350d9f7184cc6c | 7038f48a2fa19c775f93b73e25f46d89121a5d38 | /lab2/Salarymanagment/src/application/SalaryController.java | 9dca5cdcf28fc34c35e36d80bd8da5b55ad7c11a | []
| no_license | ShengKeTan/lab_of_Database | f28650c92dbe1043746a3cac8e5bcf1be68e94a2 | fa4c2b95e293e4cd6f181c40ce37bf675e3f438a | refs/heads/master | 2020-05-21T07:12:48.350949 | 2019-06-08T12:17:13 | 2019-06-08T12:17:13 | 185,954,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,851 | java | package application;
import java.net.URL;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.util.ResourceBundle;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.DatePicker;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
public class SalaryController implements Initializable {
@FXML
private Button back;
@FXML
private TextField inputname;
@FXML
private DatePicker date_end,date_begin;
private ObservableList<String> pbox = FXCollections.observableArrayList();
private ObservableList<String> dbox = FXCollections.observableArrayList();
@FXML
private ChoiceBox<String> dchoice, pchoice;
private ObservableList<Monthdate> monthdata = FXCollections.observableArrayList();
@FXML
private TableView<Monthdate> monthtable;
@FXML
private TableColumn<Monthdate,String> eid, ename, dname, pname, rest, duty, allowance, bpay, salary, time;
@Override
public void initialize(URL location, ResourceBundle resources) {
// TODO Auto-generated method stub
date_end.setValue(LocalDate.now());
date_begin.setValue(LocalDate.now());
//initbox
init_choicebox();
eid.setCellValueFactory(cellDate -> new
SimpleStringProperty(cellDate.getValue().getEid()));
ename.setCellValueFactory(cellDate -> new
SimpleStringProperty(cellDate.getValue().getEname()));
dname.setCellValueFactory(cellDate -> new
SimpleStringProperty(cellDate.getValue().getDname()));
pname.setCellValueFactory(cellDate -> new
SimpleStringProperty(cellDate.getValue().getPname()));
rest.setCellValueFactory(cellDate -> new
SimpleStringProperty(cellDate.getValue().getRest()));
duty.setCellValueFactory(cellDate -> new
SimpleStringProperty(cellDate.getValue().getDuty()));
allowance.setCellValueFactory(cellDate -> new
SimpleStringProperty(cellDate.getValue().getExtra()));
bpay.setCellValueFactory(cellDate -> new
SimpleStringProperty(cellDate.getValue().getBpay()));
salary.setCellValueFactory(cellDate -> new
SimpleStringProperty(cellDate.getValue().getSalary()));
time.setCellValueFactory(cellDate -> new
SimpleStringProperty(cellDate.getValue().getTime()));
}
private void init_choicebox() {
dbox.clear();
pbox.clear();
//connect to mysql
Con2mysql con = new Con2mysql();
Connection mycon = con.connect2mysql();
//get info
PreparedStatement pStatement = null;
ResultSet rs = null;
String sql = null;
try {
sql = "select department.dname from department";
pStatement = (PreparedStatement)mycon.prepareStatement(sql);
}catch(SQLException e) {
e.printStackTrace();
}
try {
rs = pStatement.executeQuery();
String dpart = null;
while(rs.next()) {
dpart = rs.getString("department.dname");
dbox.add(dpart);
System.out.println(dpart);
}
dbox.addAll("ALL");
dchoice.setItems(dbox);
dchoice.setValue("ALL");
}catch(SQLException e) {
e.printStackTrace();
}
try {
sql = "select post.pname from post";
pStatement = (PreparedStatement)mycon.prepareStatement(sql);
}catch(SQLException e) {
e.printStackTrace();
}
try {
rs = pStatement.executeQuery();
String po = null;
while(rs.next()) {
po = rs.getString("post.pname");
pbox.add(po);
System.out.println(po);
}
pbox.addAll("ALL");
pchoice.setItems(pbox);
pchoice.setValue("ALL");
}catch(SQLException e) {
e.printStackTrace();
}
try {
mycon.close();
}catch(SQLException e1) {
e1.printStackTrace();
}
}
@FXML
private void on_serach_click() {
monthdata.clear();
//connect to mysql
Con2mysql con = new Con2mysql();
Connection mycon = con.connect2mysql();
//get info
PreparedStatement pStatement = null;
ResultSet rs = null;
String sql = null;
int bdatayear, edatayear;
int bdatamonth, edatamonth;
bdatayear = date_begin.getValue().getYear();
bdatamonth = date_begin.getValue().getMonthValue();
edatayear = date_end.getValue().getYear();
edatamonth = date_end.getValue().getMonthValue();
String inpname = " and post.pname=" + "'" + pchoice.getValue().toString().trim() + "'";
String indname = " and department.dname=" + "'" + dchoice.getValue().toString().trim() + "'";
int inid = get_inputname_id();
String getinid = " and employee.eid="+inid;
if(pchoice.getValue().toString().trim().equals("ALL")) {
inpname = " ";
}
if(dchoice.getValue().toString().trim().equals("ALL")) {
indname = " ";
}
if(inid==0) {
getinid = " ";
}
try {
String temp = null;
temp = "select salary.eid, employee.ename, department.dname, post.pname,"
+ " salary.latetimes, salary.ctimes, salary.mtimes, salary.bpay,"
+ " salary.extra, salary.pay, salary.syear, salary.smonth"
+ " from salary, employee, department, post"
+ " where salary.eid=employee.eid"
+ " and employee.did=department.did"
+ " and employee.pid=post.pid"
+ " and salary.syear between %1$d and %2$d"
+ " and salary.smonth between %3$d and %4$d"
+ inpname + indname + getinid;
sql = String.format(temp, bdatayear, edatayear, bdatamonth, edatamonth);
pStatement = (PreparedStatement)mycon.prepareStatement(sql);
}catch(SQLException e1) {
e1.printStackTrace();
}
try {
rs = pStatement.executeQuery();
int eid_tmp = 0;
String ename_tmp = null;
String dname_tmp = null;
String pname_tmp = null;
//int rest_tmp = 0;
int late_tmp = 0;
int duty_tmp = 0;
int noduty_tmp = 0;
String extra_tmp = null;
String bpay_sum = null;
String total_tmp = null;
String time_tmp;
while(rs.next()) {
eid_tmp = rs.getInt("salary.eid");
ename_tmp = rs.getString("employee.ename");
dname_tmp = rs.getString("department.dname");
pname_tmp = rs.getString("post.pname");
late_tmp = rs.getInt("salary.latetimes");
duty_tmp = rs.getInt("salary.ctimes");
noduty_tmp = rs.getInt("salary.mtimes");
//rest_tmp = date_of_month() - late_tmp - duty_tmp - noduty_tmp;
extra_tmp = rs.getBigDecimal("salary.extra").toString();
bpay_sum = rs.getBigDecimal("salary.bpay").toString();
total_tmp = rs.getBigDecimal("salary.pay").toString();
time_tmp = rs.getString("salary.syear") + "-" + rs.getString("salary.smonth");
monthdata.addAll(new Monthdate(eid_tmp + "",ename_tmp,dname_tmp,pname_tmp,
late_tmp+"",duty_tmp+"/"+noduty_tmp,extra_tmp,bpay_sum,total_tmp,time_tmp));
}
}catch(SQLException e1) {
e1.printStackTrace();
}
try {
mycon.close();
}catch(SQLException e1) {
e1.printStackTrace();
}
monthtable.setItems(monthdata);
}
@FXML
private void on_printput_click() {
if(monthdata.isEmpty()) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Information Dialog");
alert.setHeaderText("生成失败");
alert.setContentText("生成失败!");
alert.showAndWait();
return;
}
String[] headers = {"职工编号","姓名","部门","职务","迟到次数","考勤/缺勤","津贴","基本工资","总工资","时间"};
Out2Excel.exportExcel("test", monthdata, headers, "table");
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Information Dialog");
alert.setHeaderText("打印成功");
alert.setContentText("打印成功");
alert.showAndWait();
}
/*private int date_of_month() {
int days = 0;
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DATE, 1);
cal.roll(Calendar.DATE, -1);
days = cal.get(Calendar.DATE);
return days;
}*/
private int get_inputname_id() {
int id = 0;
//connect to mysql
Con2mysql con = new Con2mysql();
Connection mycon = con.connect2mysql();
//get info
PreparedStatement pStatement = null;
ResultSet rs = null;
String sql = null;
try {
sql = "select employee.eid from employee where ename=?";
pStatement = (PreparedStatement)mycon.prepareStatement(sql);
pStatement.setString(1,inputname.getText().toString().trim());
}catch(SQLException e) {
e.printStackTrace();
}
try {
rs = pStatement.executeQuery();
while(rs.next()) {
id = rs.getInt("employee.eid");
}
}catch(SQLException e) {
e.printStackTrace();
}
try {
mycon.close();
}catch(SQLException e1) {
e1.printStackTrace();
}
return id;
}
@FXML
private void on_back_click() {
Stage stage = (Stage)back.getScene().getWindow();
stage.close();
}
}
| [
"[email protected]"
]
| |
cb4727ba4c6daf477cfcc4bb642f5e99b17904a8 | f5df01f50cfbf5208caca6ab755f31b28552c2c3 | /project/NeighbourMother/app/src/main/java/com/qiantang/neighbourmother/logic/CreateTagsTextView.java | 72a52bea707d5626b1368327dde470efb5c2c784 | []
| no_license | WCocoa/experiment | 14ed8a9fe09b2ac3a7e0591b1bb005e481440f56 | 70eab9dc20797236f0817acf1d4d0d6f52154bf9 | refs/heads/master | 2020-07-02T09:47:09.294088 | 2017-08-24T02:06:43 | 2017-08-24T02:06:43 | 74,316,612 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,492 | java | package com.qiantang.neighbourmother.logic;
import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.qiantang.neighbourmother.R;
import com.qiantang.neighbourmother.model.TagObj;
import com.qiantang.neighbourmother.util.QLScreenUtil;
import com.qiantang.neighbourmother.widget.taglayout.Tag;
import java.util.ArrayList;
/**
* @author quliang
* @version 2015-9-2 上午9:41:39
* desc 创建标签文本
*/
public class CreateTagsTextView {
private BbsTagUtil bbsTagUtil = new BbsTagUtil();
private int consultTagColor[] = null;
public void createTag(Context context, int[] tag, LinearLayout parentLayout) {
parentLayout.removeAllViews();
if (tag != null && tag.length > 0) {
for (int i = 0; i < tag.length; i++) {
if (i>=3)
break;
LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
if (i == 1)
ll.setMargins((int) QLScreenUtil.dpToPxInt(context, 5), 0, (int)QLScreenUtil.dpToPxInt(context, 5), 0);
TextView textView = new TextView(context);
textView.setTextSize(QLScreenUtil.pxToSpInt(context, context.getResources().getDimension(R.dimen.active_detail_tags)));
textView.setPadding((int)QLScreenUtil.dpToPxInt(context, 4), (int)QLScreenUtil.dpToPxInt(context, 2), (int)QLScreenUtil.dpToPxInt(context, 4), (int)QLScreenUtil.dpToPxInt(context, 2));
bbsTagUtil.setViewDrawable(context, textView, bbsTagUtil.getTag(context, tag[i]).getColorlist());
textView.setText(bbsTagUtil.getTag(context, tag[i]).getTitle());
textView.setSelected(true);
textView.setSingleLine(true);
textView.setMinWidth((int)QLScreenUtil.dpToPxInt(context, 45));
textView.setGravity(Gravity.CENTER);
textView.setLayoutParams(ll);
parentLayout.addView(textView);
}
}
parentLayout.invalidate();
}
public void consultCreateTag(Context context, String[] strTag, LinearLayout parentLayout) {
parentLayout.removeAllViews();
if (strTag != null && strTag.length > 0)
for (int i = 0; i < strTag.length; i++) {
if (i>=3)
break;
LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
if (i == 1)
ll.setMargins((int)QLScreenUtil.dpToPxInt(context, 3), 0, (int)QLScreenUtil.dpToPxInt(context, 3), 0);
TextView textView = new TextView(context);
textView.setTextSize(QLScreenUtil.pxToSpInt(context, context.getResources().getDimension(R.dimen.active_detail_tags)));
textView.setPadding((int)QLScreenUtil.dpToPxInt(context,3), (int)QLScreenUtil.dpToPxInt(context, 2), (int)QLScreenUtil.dpToPxInt(context, 3), (int)QLScreenUtil.dpToPxInt(context, 2));
textView.setBackground(context.getResources().getDrawable(R.drawable.lable_style));
textView.setTextColor(context.getResources().getColor(R.color.color_app_title_bg));
textView.setSelected(true);
textView.setText(strTag[i]);
textView.setSingleLine(true);
textView.setMaxEms(4);
textView.setMinWidth((int)QLScreenUtil.dpToPxInt(context, 40));
textView.setGravity(Gravity.CENTER);
textView.setLayoutParams(ll);
parentLayout.addView(textView);
}
parentLayout.invalidate();
}
public void newsCreateTag(Context context, String[] strTag, LinearLayout parentLayout) {
parentLayout.removeAllViews();
if (strTag != null && strTag.length > 0)
for (int i = 0; i < strTag.length; i++) {
if (i>=3)
break;
LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
if (i == 1)
ll.setMargins((int)QLScreenUtil.dpToPxInt(context, 5), 0, (int)QLScreenUtil.dpToPxInt(context, 5), 0);
TextView textView = new TextView(context);
textView.setTextSize(QLScreenUtil.pxToSpInt(context, context.getResources().getDimension(R.dimen.active_detail_tags)));
textView.setPadding((int)QLScreenUtil.dpToPxInt(context, 4), (int)QLScreenUtil.dpToPxInt(context, 2), (int)QLScreenUtil.dpToPxInt(context, 4), (int)QLScreenUtil.dpToPxInt(context, 2));
bbsTagUtil.setViewDrawable(context, textView, getConsultTagColor(context, i));
textView.setSelected(true);
textView.setText(strTag[i]);
textView.setSingleLine(true);
textView.setMinWidth((int)QLScreenUtil.dpToPxInt(context, 45));
textView.setGravity(Gravity.CENTER);
textView.setLayoutParams(ll);
parentLayout.addView(textView);
}
parentLayout.invalidate();
}
public void newsCreateTag(Context context, ArrayList<TagObj> tags, LinearLayout parentLayout) {
parentLayout.removeAllViews();
if (tags != null && tags.size() > 0)
for (int i = 0; i < tags.size(); i++) {
if (i>=3)
break;
LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
if (i == 1)
ll.setMargins((int)QLScreenUtil.dpToPxInt(context, 5), 0, (int)QLScreenUtil.dpToPxInt(context, 5), 0);
TextView textView = new TextView(context);
textView.setTextSize(QLScreenUtil.pxToSpInt(context, context.getResources().getDimension(R.dimen.active_detail_tags)));
textView.setPadding((int)QLScreenUtil.dpToPxInt(context, 4), (int)QLScreenUtil.dpToPxInt(context, 2), (int)QLScreenUtil.dpToPxInt(context, 4), (int)QLScreenUtil.dpToPxInt(context, 2));
// bbsTagUtil.setViewDrawable(context, textView, getConsultTagColor(context, i));
bbsTagUtil.setViewDrawable(context,textView, Color.parseColor("#"+tags.get(i).getColor()));
textView.setSelected(true);
textView.setText(tags.get(i).getName());
textView.setSingleLine(true);
textView.setMinWidth((int)QLScreenUtil.dpToPxInt(context, 45));
textView.setGravity(Gravity.CENTER);
textView.setLayoutParams(ll);
parentLayout.addView(textView);
}
parentLayout.invalidate();
}
private int getConsultTagColor(Context context, int pos) {
if (consultTagColor == null)
consultTagColor = new int[]{context.getResources().getColor(R.color.consult_tag_backgroud_selected_1), context.getResources().getColor(R.color.consult_tag_backgroud_selected_2), context.getResources().getColor(R.color.consult_tag_backgroud_selected_3)};
return pos < consultTagColor.length ? consultTagColor[pos] : consultTagColor[0];
}
} | [
"[email protected]"
]
| |
557cb96b4818bab90487b391810adcd80f55933d | 54c1dcb9a6fb9e257c6ebe7745d5008d29b0d6b6 | /app/src/main/java/com/p118pd/sdk/C9005ooOo00O0.java | 6e832d9ea4243e4ee873fbe1cef50c22eba937ea | []
| no_license | rcoolboy/guilvN | 3817397da465c34fcee82c0ca8c39f7292bcc7e1 | c779a8e2e5fd458d62503dc1344aa2185101f0f0 | refs/heads/master | 2023-05-31T10:04:41.992499 | 2021-07-07T09:58:05 | 2021-07-07T09:58:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,322 | java | package com.p118pd.sdk;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import java.util.ArrayList;
import java.util.List;
/* renamed from: com.pd.sdk.ooOo00O0 reason: case insensitive filesystem */
public class C9005ooOo00O0<T extends BroadcastReceiver> {
public List<T> OooO00o;
/* renamed from: OooO00o reason: collision with other method in class */
public List<T> m20672OooO00o(Context context, String str, Class cls) {
if (this.OooO00o == null) {
OooO00o(context, str, cls);
}
return this.OooO00o;
}
/* renamed from: OooO00o reason: collision with other method in class */
public T m20671OooO00o(Context context, String str, Class cls) {
if (this.OooO00o == null) {
OooO00o(context, str, cls);
}
if (this.OooO00o.size() > 0) {
return this.OooO00o.get(0);
}
return null;
}
/* JADX DEBUG: Multi-variable search result rejected for r1v7, resolved type: java.util.List<T extends android.content.BroadcastReceiver> */
/* JADX WARN: Multi-variable type inference failed */
private void OooO00o(Context context, String str, Class cls) {
this.OooO00o = new ArrayList();
if (context != null) {
Intent intent = new Intent(str);
intent.setPackage(context.getPackageName());
try {
List<ResolveInfo> queryBroadcastReceivers = context.getPackageManager().queryBroadcastReceivers(intent, 64);
if (queryBroadcastReceivers != null) {
for (ResolveInfo resolveInfo : queryBroadcastReceivers) {
if (resolveInfo.activityInfo != null && resolveInfo.activityInfo.packageName.equals(context.getPackageName())) {
String str2 = resolveInfo.activityInfo.name;
if (cls.isAssignableFrom(Class.forName(str2))) {
this.OooO00o.add((BroadcastReceiver) Class.forName(str2).newInstance());
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
]
| |
00c3a579fbf1798745921890f2c84ea633f2c9f7 | 7d71c79d04b3ef04b63803512400fe4a7d313253 | /src/main/java/com/besuikerd/mirandacraft/lib/entity/filter/EntityFilterRuleName.java | eff1df1cd061c0aa8fa48cb9ea9d873b12dd63bb | []
| no_license | besuikerd/MirandaCraft | cd4c93679a374814a59e9e1d43a3de41fb448575 | f035793d2ad60d89f55d0de45bec1aa910c8710e | refs/heads/master | 2021-01-22T04:34:24.011985 | 2015-04-28T20:17:44 | 2015-04-28T20:17:44 | 30,036,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package com.besuikerd.mirandacraft.lib.entity.filter;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import com.besuikerd.mirandacraft.lib.classifier.ClassifierArgumentString;
public class EntityFilterRuleName extends AbstractEntityFilterRule<ClassifierArgumentString>{
public EntityFilterRuleName() {
super(ClassifierArgumentString.class);
}
@Override
public boolean validate(Entity entity, ClassifierArgumentString argument) {
if(entity instanceof EntityItem){
return match(((EntityItem) entity).getEntityItem().getDisplayName(), argument.getValue());
}
return match(entity.getCommandSenderName(), argument.getValue());
}
private boolean match(String name, String match){
return name.matches(match) || name.toLowerCase().equals(match.toLowerCase());
}
}
| [
"[email protected]"
]
| |
38c616b7fe066c40948944fb2e49183162ff2780 | 5e086f4a672024f597319a2acf53fba6add5659e | /java-base/src/main/java/designpattern/facade/SystemC.java | 5e7cd87c7f89bb2267011a6fbdaaa0cb117665de | []
| no_license | wuxiangjingjing/hszperfect | 74c72737858dec27693d82bdf51bcb4603085a26 | c9900c3e52a47efce19c9233b0203c26f1988d20 | refs/heads/master | 2022-01-17T13:49:34.991378 | 2020-06-03T10:38:59 | 2020-06-03T10:38:59 | 243,483,401 | 0 | 0 | null | 2022-01-12T23:04:43 | 2020-02-27T09:42:45 | Java | UTF-8 | Java | false | false | 178 | java | package designpattern.facade;
public class SystemC implements ISystemC {
@Override
public void excute() {
System.out.println("系统C的方法.......");
}
}
| [
"[email protected]"
]
| |
7bef78fd0868605ee8b84f701f45360d16cb5d0f | 540089061a1bc4c31056f44fe486da4100e261a4 | /src/main/java/com/chenyl/module/spring/test/springTest01.java | cfa6e165cf755e530e30515227968ddc7e1abfc6 | []
| no_license | chenyongliangbj/wise-base-module | fbdb5b8aada50e052d7e5f206da0ae9959a4e7f9 | e53469bbbed9489fc03bd61ae9b0dcaa2802eea3 | refs/heads/master | 2022-12-21T04:51:37.769150 | 2021-01-29T02:21:12 | 2021-01-29T02:21:12 | 178,314,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | package com.chenyl.module.spring.test;
import com.chenyl.module.spring.model1.PersonScan;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class springTest01 {
@Test
public void test01(){
{
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
PersonScan personScan = context.getBean("personScan",PersonScan.class);
personScan.liuDog();
}
}
}
| [
"[email protected]"
]
| |
42f5278f0e2df4f038371ad9c797fab9c759d67d | 89af364048bad72b3362e526788d8719be67c9f2 | /sc-provider/sc-xzsd-pc/src/main/java/com/xzsd/pc/rotationChart/entity/RotationChartInfo.java | fc19473f3b75c752034c7b332406a631bc02222d | []
| no_license | panzehaopzh/xzsd | d0a01d0e5260022424c93b58c170c481de954ef7 | 35020a57212e4a32755774e720a06b32ff70a10c | refs/heads/master | 2022-04-23T03:00:33.099844 | 2020-04-28T18:55:46 | 2020-04-28T18:55:46 | 255,128,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,475 | java | package com.xzsd.pc.rotationChart.entity;
public class RotationChartInfo {
/**
* 页码
*/
private int pageSize;
/**
* 页数
*/
private int pageNum;
/**
* 轮播图id
*/
private String chartId;
/**
* 轮播图序号
*/
private int sort;
/**
* 轮播图片地址
*/
private String chartImage;
/**
* 商品编号
*/
private String goodsCode;
/**
* 有效期起
*/
private String termValidityBegin;
/**
* 有效期止
*/
private String termValidityEnd;
/**
* 轮播图状态 0启用 1禁用
*/
private int chartState;
/**
* 删除标记 0未删 1已删
*/
private String isDelete;
/**
* 创建者
*/
private String createId;
/**
* 创建时间
*/
private String createTime;
/**
* 更新者
*/
private String updateId;
/**
* 更新时间
*/
private String updateTime;
/**
* 版本号
*/
private String version;
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public String getChartId() {
return chartId;
}
public void setChartId(String chartId) {
this.chartId = chartId;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public String getChartImage() {
return chartImage;
}
public void setChartImage(String chartImage) {
this.chartImage = chartImage;
}
public String getGoodsCode() {
return goodsCode;
}
public void setGoodsCode(String goodsCode) {
this.goodsCode = goodsCode;
}
public String getTermValidityBegin() {
return termValidityBegin;
}
public void setTermValidityBegin(String termValidityBegin) {
this.termValidityBegin = termValidityBegin;
}
public String getTermValidityEnd() {
return termValidityEnd;
}
public void setTermValidityEnd(String termValidityEnd) {
this.termValidityEnd = termValidityEnd;
}
public int getChartState() {
return chartState;
}
public void setChartState(int chartState) {
this.chartState = chartState;
}
public String getIsDelete() {
return isDelete;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getCreateId() {
return createId;
}
public void setCreateId(String createId) {
this.createId = createId;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateId() {
return updateId;
}
public void setUpdateId(String updateId) {
this.updateId = updateId;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
}
| [
"[email protected]"
]
| |
7cd7fad34aaed2c36a23cb34bbd7b584d9e53db9 | cd0a61466a6734a2789abd061474b085478a3973 | /src/cn/lyx/ioc/MySpring4_14.java | 7ef69e8a7096cf6a731d82a7c24909340a5de26d | []
| no_license | lyx296530053/Code-Exercise | 98dcef4b97069fe85e93b5fa5d62867e535d1a23 | acd1137722847b2bbf3833222777ae28dae93973 | refs/heads/master | 2021-07-07T01:29:09.033253 | 2019-09-09T12:38:16 | 2019-09-09T12:38:16 | 195,737,008 | 1 | 0 | null | 2020-10-14T00:35:16 | 2019-07-08T04:34:10 | Java | UTF-8 | Java | false | false | 1,458 | java | package ioc;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Scanner;
/**
* Created by lyx on 2019/4/15.
*/
public class MySpring4_14 {
public Object getBean(String className) {
System.out.println("请给" + className + "对象赋值");
Scanner input = new Scanner(System.in);
Object obj = null;
try {
Class cls = Class.forName(className);
obj = cls.newInstance();
Field[] fields = cls.getDeclaredFields();
for (Field f : fields
) {
String fName = f.getName();
String old = fName.substring(0, 1).toUpperCase();
String aft = fName.substring(1);
StringBuilder stringBuilder = new StringBuilder("set");
stringBuilder.append(old);
stringBuilder.append(aft);
Class getType = f.getType();
Method method = cls.getDeclaredMethod(stringBuilder.toString(), getType);
Constructor constructor = getType.getDeclaredConstructor(String.class);
System.out.println("请给" + fName + "属性赋值");
String value = input.nextLine();
method.invoke(obj, constructor.newInstance(value));
}
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
}
| [
"[email protected]"
]
| |
5eca509f26bc948ddf2ab32067812428bd695b00 | 768ee7fe3fba51f3a270626ff717a9d7e9390def | /src/main/java/com/faendir/acra/ui/view/app/tabs/StatisticsTab.java | cdc9d99f35f5d568d267348380fdd993a7b685da | [
"Apache-2.0",
"BSD-3-Clause",
"EPL-1.0",
"CDDL-1.1",
"W3C",
"LGPL-2.1-only",
"MPL-1.1",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"GPL-2.0-only"
]
| permissive | mirzazulfan/Acrarium | e8f0c21ce7ea7ebec2e8fb7ccccb54201c4ddc7d | 53feb1e015f59395fd57d9c5ddcdd5a4dfe452f0 | refs/heads/master | 2020-04-06T09:17:35.065902 | 2018-11-13T07:17:55 | 2018-11-13T07:17:55 | 157,336,065 | 0 | 0 | Apache-2.0 | 2018-11-13T07:08:32 | 2018-11-13T07:08:32 | null | UTF-8 | Java | false | false | 2,203 | java | /*
* (C) Copyright 2018 Lukas Morawietz (https://github.com/F43nd1r)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.faendir.acra.ui.view.app.tabs;
import com.faendir.acra.i18n.Messages;
import com.faendir.acra.model.App;
import com.faendir.acra.service.DataService;
import com.faendir.acra.ui.navigation.NavigationManager;
import com.faendir.acra.ui.view.base.statistics.Statistics;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Component;
import com.vaadin.ui.Panel;
import com.vaadin.ui.themes.AcraTheme;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.NonNull;
import org.vaadin.spring.i18n.I18N;
/**
* @author Lukas
* @since 22.05.2017
*/
@SpringComponent
@ViewScope
public class StatisticsTab implements AppTab {
@NonNull private final DataService dataService;
@NonNull private final I18N i18n;
@Autowired
public StatisticsTab(@NonNull DataService dataService, @NonNull I18N i18n) {
this.dataService = dataService;
this.i18n = i18n;
}
@Override
public Component createContent(@NonNull App app, @NonNull NavigationManager navigationManager) {
Panel root = new Panel(new Statistics(app, null, dataService, i18n));
root.setSizeFull();
root.addStyleNames(AcraTheme.NO_BACKGROUND, AcraTheme.NO_BORDER);
return root;
}
@Override
public String getCaption() {
return i18n.get(Messages.STATISTICS);
}
@Override
public String getId() {
return "statistics";
}
@Override
public int getOrder() {
return 2;
}
}
| [
"[email protected]"
]
| |
c97d27568ec031bf6ed5def2052606bcb0af9685 | 826b9e7a1856e4068d5d6402f304a461a0484abc | /A. Good Number.java | 1d48d9f4800a159eb8e3f7d109fe4e155f977929 | []
| no_license | AmnaAhmedOk/ProblemSolving | 68c79f0a312776377177678f87c82976b3ef52d2 | b51960cca51009d3a23ffb14f12d03805f02b314 | refs/heads/master | 2020-09-22T08:22:02.346717 | 2019-12-19T13:17:27 | 2019-12-19T13:17:27 | 225,060,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | import java.util.Scanner;
public class vanyaandFence {
public static void main(String[] args) {
int n,k,t=0;
String num;
Scanner sc = new Scanner(System.in);
n =sc.nextInt();
k =sc.nextInt();
for (int i = 0; i <n; i++)
{
boolean []arr=new boolean[10];
num=sc.next();
if(num.length()>=k)
{
boolean good=true;
for (int j = 0; j <num.length(); j++)
{
arr[num.charAt(j)-48]= true;
}
for (int j = 0; j <=k;j++)
{
if(!arr[j])
{good=false;
break;
}
}
if (good)
t++;
}
}
System.out.println(t);
sc.close();
}
} | [
"[email protected]"
]
| |
0ddb6fa8d0145c34a07960e0598931c1cd5d6768 | b07968d5519a345c7b53b5fa33720c32d6812a88 | /heima_day10_/src/netTest/SunziAb.java | 3c74d4f98274ae66943dc61c0f3024a171c89ab1 | []
| no_license | ni247/jialian_c-2Java | d67a24800a53844b352e5ca7febc16d254e28249 | 1b478c10699c45ee0da70f29548029ae338ad0d9 | refs/heads/master | 2021-01-02T08:48:47.588902 | 2017-08-05T14:32:29 | 2017-08-05T14:32:29 | 99,066,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package netTest;
public class SunziAb extends Parenst {
@Override
public void make() {
System.out.println("做");
}
@Override
public void getSum() {
System.out.println("求和");
}
}
| [
"Administrator@DESKTOP-SLN17N8"
]
| Administrator@DESKTOP-SLN17N8 |
7893805d2c279b93fafdd62049bba1457e790627 | 2f0aeef3f9dde1d14e794c6664c92fe91eb7715c | /src/com/mobileaviationtool/Tile.java | cf160eac6a16235d5fdb744caa0c7ce3ae127c66 | []
| no_license | mobileaviation/TileDownloader | 9fd8733a55645e78c4cc6783c5f7149da53f7375 | 8a16426163c4f0c1c34dafddc5ed24a32770f76c | refs/heads/master | 2020-07-06T11:12:46.753724 | 2016-11-21T15:58:41 | 2016-11-21T15:58:41 | 74,045,349 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,614 | java | package com.mobileaviationtool;
import com.vividsolutions.jts.geom.Coordinate;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.net.URL;
/**
* Created by Rob Verhoef on 17-11-2016.
*/
public class Tile {
public int x;
public int y;
public int z;
public Coordinate tile;
public Tile()
{
}
public Tile(int x, int y, int z)
{
this.x = x;
this.y = y;
this.z = z;
this.tile = new Coordinate(this.x, this.y, this.z);
}
public void getTileNumber(final double lat, final double lon, final int zoom)
{
int xtile = (int)Math.floor( (lon + 180) / 360 * (1<<zoom) );
int ytile = (int)Math.floor( (1 - Math.log(Math.tan(Math.toRadians(lat)) + 1 / Math.cos(Math.toRadians(lat))) / Math.PI) / 2 * (1<<zoom));
if (xtile < 0) xtile = 0;
if (xtile >= (1<<zoom)) xtile = ((1<<zoom) -1 );
if (ytile < 0) ytile = 0;
if (ytile >= (1<<zoom)) ytile = ((1<<zoom) - 1 );
this.x = xtile;
this.y = ytile;
this.z = zoom;
this.tile = new Coordinate(this.x, this.y, this.z);
}
public String Url()
{
return "http://tile.openstreetmap.org/" + z + "/" + x + "/" + y + ".png";
}
public void DownloadFile(String localPath, String baseName)
{
try {
String f = localPath + "\\" + baseName + z + "-" + x + "-" + y + ".png";
FileUtils.copyURLToFile(new URL(Url()), new File(f));
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
d34f181b6b05b81585db2a261c48a821c6d814bd | 7e65f451e917577a00bf12b9614638231ccd530a | /Week3/Day-05/Apple/src/Main.java | bfa67d25d89d248242668667cecf66b1a38770cd | []
| no_license | green-fox-academy/aronkaczur | afd64f8c9bfaee60e1b19dabcdccdc3e6e4c3f93 | 72d8d87adedfbba188ebd1c801d06078740b1a5a | refs/heads/master | 2022-12-02T19:20:38.936064 | 2020-08-14T14:18:02 | 2020-08-14T14:18:02 | 265,580,077 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 142 | java | public class Main {
public static void main(String[] args) {
}
public static String getApple(){
return "apple";
}
}
| [
"[email protected]"
]
| |
36a5839bcdef2ff1108f3322e0e03dba034a9f0d | f7739c2b50ad69f5208b659397f57ee2033dc7db | /[ADVANDB] Combined Server/src/transaction/handler/QueryReceiver.java | 3b61bcbebe0d70990373eee9dc02330314894520 | []
| no_license | arvention/ADVANDB-CBMS | 860802103ca9095df814cd02f0584f7d4b83ec64 | 64c10a61513b6acbb831522e9e0f895c4531f981 | refs/heads/master | 2021-01-10T13:58:02.374473 | 2016-04-11T14:52:57 | 2016-04-11T14:52:57 | 52,192,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,936 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package transaction.handler;
import GUI.ServerGUI;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import model.Transaction;
/**
*
* @author Arces
*/
public class QueryReceiver implements Runnable {
private int port;
private ServerSocket serverSocket;
private BufferedReader bufferedReader;
private ServerGUI gui;
private TransactionMonitor tm;
private PrintWriter pw;
private int COMBINED_ID = 3;
public QueryReceiver() {
port = 1235;
this.gui = ServerGUI.getInstance();
try {
serverSocket = new ServerSocket(port);
} catch (IOException e) {
e.printStackTrace();
}
this.tm = TransactionMonitor.getInstance();
}
@Override
public void run() {
try {
while (true) {
System.out.println("Waiting");
Socket socket = serverSocket.accept();
System.out.println("Accepted");
bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
pw = new PrintWriter(socket.getOutputStream(), true);
String request = bufferedReader.readLine();
//add transaction
String[] splitRequest = request.split("-");
int id = Integer.parseInt(splitRequest[0]);
int source = Integer.parseInt(splitRequest[1]);
int destination = Integer.parseInt(splitRequest[2]);
String query = "";
for (int j = 3; j < splitRequest.length; j++) {
if (j > 3) {
query += " - ";
}
query += splitRequest[j];
}
query = query.substring(0, query.length() - 1);
String log = "TRANSACTION RECEIVED: " + query;
System.out.println(log);
gui.getServerLogArea().append(log + "\n");
Transaction transaction = new Transaction(id, source, query, destination);
tm.addTransaction(transaction);
System.out.println("SOURCE = " + source);
if(source != COMBINED_ID){
System.out.println("SENDING: OK-" + id + "-" + source);
pw.println("OK-" + id + "-" + source);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
4b1cc4f5a5f81991652bab586e775c7ffae27200 | 23036ebbc82ffaf6760056bcc427e8e95c08b91f | /org.jrebirth/core/src/main/java/org/jrebirth/core/ui/adapter/DefaultMouseAdapter.java | ecd8aff6b1e86092d56ea5b02e548f75911a2936 | []
| no_license | AndrewLiu/JRebirth | 67d52a04fabeb6a578cd864aeb1500b38bfc8d93 | 275a0f0e73e3cca25d04130a6d531f6f89b01ce2 | refs/heads/master | 2020-04-08T22:49:10.006352 | 2012-10-06T14:01:26 | 2012-10-06T14:01:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,027 | java | /**
* Copyright JRebirth.org © 2011-2012
* Contact : [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jrebirth.core.ui.adapter;
import javafx.scene.input.MouseEvent;
import org.jrebirth.core.ui.AbstractController;
/**
* The class <strong>DefaultMouseAdapter</strong>.
*
* @author Sébastien Bordes
*
* @param <C> The controller class which manage this event adapter
*/
public class DefaultMouseAdapter<C extends AbstractController<?, ?>> extends AbstractDefaultAdapter<C> implements MouseAdapter {
/**
* {@inheritDoc}
*/
@Override
public void mouse(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
/**
* {@inheritDoc}
*/
@Override
public void mouseDragDetected(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
/**
* {@inheritDoc}
*/
@Override
public void mouseClicked(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
/**
* {@inheritDoc}
*/
@Override
public void mouseDragged(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
/**
* {@inheritDoc}
*/
@Override
public void mouseEntered(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
/**
* {@inheritDoc}
*/
@Override
public void mouseEnteredTarget(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
/**
* {@inheritDoc}
*/
@Override
public void mouseExited(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
/**
* {@inheritDoc}
*/
@Override
public void mouseExitedTarget(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
/**
* {@inheritDoc}
*/
@Override
public void mouseMoved(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
/**
* {@inheritDoc}
*/
@Override
public void mousePressed(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
/**
* {@inheritDoc}
*/
@Override
public void mouseReleased(final MouseEvent mouseEvent) {
// Nothing to do yet must be overridden
}
}
| [
"[email protected]"
]
| |
341e4f4bca10236f7cad5bbccaff03fe51658b74 | 7d966c22c83258cc21ffc040271d62aea122d658 | /MegaMek/src/megamek/common/actions/BrushOffAttackAction.java | c9ed7084050e5bb5a2f5de296a5499e63b57f88b | []
| no_license | Ayamin0x539/MegaMek | 5f1f2db42f01a907b8467cefc95cf56d697bdf8f | 9ea4712f2ddf5a7af8c65b9e09211d7b76904f8e | refs/heads/master | 2021-01-09T11:42:01.513443 | 2015-12-03T02:04:04 | 2015-12-03T02:04:04 | 59,911,944 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,818 | java | /*
* MegaMek - Copyright (C) 2000,2001,2002,2003,2004 Ben Mazur ([email protected])
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
package megamek.common.actions;
import megamek.common.Compute;
import megamek.common.CriticalSlot;
import megamek.common.Entity;
import megamek.common.EquipmentType;
import megamek.common.IGame;
import megamek.common.Infantry;
import megamek.common.Mech;
import megamek.common.MiscType;
import megamek.common.Mounted;
import megamek.common.TargetRoll;
import megamek.common.Targetable;
import megamek.common.ToHitData;
import megamek.common.options.OptionsConstants;
/**
* The attacker brushes the target off.
*/
public class BrushOffAttackAction extends AbstractAttackAction {
/**
*
*/
private static final long serialVersionUID = -7455082808488032572L;
public static final int BOTH = 0;
public static final int LEFT = 1;
public static final int RIGHT = 2;
private int arm;
public BrushOffAttackAction(int entityId, int targetType, int targetId,
int arm) {
super(entityId, targetType, targetId);
this.arm = arm;
}
public int getArm() {
return arm;
}
public void setArm(int arm) {
this.arm = arm;
}
/**
* Damage that the specified mech does with a brush off attack. This equals
* the damage done by a punch from the same arm.
*
* @param entity - the <code>Entity</code> brushing off the swarm.
* @param arm - the <code>int</code> of the arm making the attack; this
* value must be <code>BrushOffAttackAction.RIGHT</code> or
* <code>BrushOffAttackAction.LEFT</code>.
* @return the <code>int</code> amount of damage caused by the attack. If
* the attack hits, the swarming infantry takes the damage; if the
* attack misses, the entity deals the damage to themself.
*/
public static int getDamageFor(Entity entity, int arm) {
return PunchAttackAction.getDamageFor(entity, arm, false);
}
/**
* To-hit number for the specified arm to brush off swarming infantry. If
* this attack misses, the Mek will suffer punch damage. This same action is
* used to remove iNARC pods.
*
* @param game - the <code>IGame</code> object containing all entities.
* @return the <code>ToHitData</code> containing the target roll.
*/
public ToHitData toHit(IGame game) {
return toHit(game, getEntityId(), game.getTarget(getTargetType(),
getTargetId()), getArm());
}
/**
* To-hit number for the specified arm to brush off swarming infantry. If
* this attack misses, the Mek will suffer punch damage. This same action is
* used to remove iNARC pods.
*
* @param game - the <code>IGame</code> object containing all entities.
* @param attackerId - the <code>int</code> ID of the attacking unit.
* @param target - the <code>Targetable</code> object being targeted.
* @param arm - the <code>int</code> of the arm making the attack; this
* value must be <code>BrushOffAttackAction.RIGHT</code> or
* <code>BrushOffAttackAction.LEFT</code>.
* @return the <code>ToHitData</code> containing the target roll.
*/
public static ToHitData toHit(IGame game, int attackerId,
Targetable target, int arm) {
final Entity ae = game.getEntity(attackerId);
int targetId = Entity.NONE;
Entity te = null;
if ((ae == null) || (target == null)) {
return new ToHitData(TargetRoll.IMPOSSIBLE,
"Attacker or target not valid");
}
if (target.getTargetType() == Targetable.TYPE_ENTITY) {
te = (Entity) target;
targetId = target.getTargetId();
}
final int armLoc = (arm == BrushOffAttackAction.RIGHT) ? Mech.LOC_RARM
: Mech.LOC_LARM;
ToHitData toHit;
// non-mechs can't BrushOff
if (!(ae instanceof Mech)) {
return new ToHitData(TargetRoll.IMPOSSIBLE,
"Only mechs can brush off swarming infantry or iNarc Pods");
}
// arguments legal?
if ((arm != BrushOffAttackAction.RIGHT)
&& (arm != BrushOffAttackAction.LEFT)) {
throw new IllegalArgumentException("Arm must be LEFT or RIGHT");
}
if (((targetId != ae.getSwarmAttackerId()) || (te == null) || !(te instanceof Infantry))
&& (target.getTargetType() != Targetable.TYPE_INARC_POD)) {
return new ToHitData(TargetRoll.IMPOSSIBLE,
"Can only brush off swarming infantry or iNarc Pods");
}
// Quads can't brush off.
if (ae.entityIsQuad()) {
return new ToHitData(TargetRoll.IMPOSSIBLE, "Attacker is a quad");
}
// Can't brush off with flipped arms
if (ae.getArmsFlipped()) {
return new ToHitData(TargetRoll.IMPOSSIBLE,
"Arms are flipped to the rear. Can not punch.");
}
// check if arm is present
if (ae.isLocationBad(armLoc)) {
return new ToHitData(TargetRoll.IMPOSSIBLE, "Arm missing");
}
//check for no/minimal arms quirk
if (ae.hasQuirk(OptionsConstants.QUIRK_NEG_NO_ARMS)) {
return new ToHitData(TargetRoll.IMPOSSIBLE, "No/minimal arms");
}
// check if shoulder is functional
if (!ae.hasWorkingSystem(Mech.ACTUATOR_SHOULDER, armLoc)) {
return new ToHitData(TargetRoll.IMPOSSIBLE, "Shoulder destroyed");
}
// check if attacker has fired arm-mounted weapons
if (ae.weaponFiredFrom(armLoc)) {
return new ToHitData(TargetRoll.IMPOSSIBLE,
"Weapons fired from arm this turn");
}
// can't physically attack mechs making dfa attacks
if ((te != null) && te.isMakingDfa()) {
return new ToHitData(TargetRoll.IMPOSSIBLE,
"Target is making a DFA attack");
}
// Can't brush off while prone.
if (ae.isProne()) {
return new ToHitData(TargetRoll.IMPOSSIBLE, "Attacker is prone");
}
// Can't target woods or a building with a brush off attack.
if ((target.getTargetType() == Targetable.TYPE_BUILDING)
|| (target.getTargetType() == Targetable.TYPE_BLDG_IGNITE)
|| (target.getTargetType() == Targetable.TYPE_FUEL_TANK)
|| (target.getTargetType() == Targetable.TYPE_FUEL_TANK_IGNITE)
|| (target.getTargetType() == Targetable.TYPE_HEX_CLEAR)
|| (target.getTargetType() == Targetable.TYPE_HEX_IGNITE)) {
return new ToHitData(TargetRoll.IMPOSSIBLE, "Invalid attack");
}
// okay, modifiers...
toHit = new ToHitData(ae.getCrew().getPiloting(), "base PSR");
toHit.addModifier(4, "brush off swarming infantry");
// damaged or missing actuators
if (!ae.hasWorkingSystem(Mech.ACTUATOR_UPPER_ARM, armLoc)) {
toHit.addModifier(2, "Upper arm actuator destroyed");
}
if (!ae.hasWorkingSystem(Mech.ACTUATOR_LOWER_ARM, armLoc)) {
toHit.addModifier(2, "Lower arm actuator missing or destroyed");
}
if (ae.hasFunctionalArmAES(armLoc)) {
toHit.addModifier(-1, "AES modifer");
}
// Claws replace Actuators, but they are Equipment vs System as they
// take up multiple crits.
// Rules state +1 bth with claws and if claws are critted then you get
// the normal +1 bth for missing hand actuator.
// Damn if you do damned if you dont. --Torren.
final boolean hasClaws = ((Mech) ae).hasClaw(armLoc);
final boolean hasLowerArmActuator =
ae.hasSystem(Mech.ACTUATOR_LOWER_ARM, armLoc);
final boolean hasHandActuator =
ae.hasSystem(Mech.ACTUATOR_HAND, armLoc);
// Missing hand actuator is not cumulative with missing actuator,
// but critical damage is cumulative
if (!hasClaws && !hasHandActuator &&
hasLowerArmActuator) {
toHit.addModifier(1, "Hand actuator missing");
// Check for present but damaged hand actuator
} else if (hasHandActuator && !hasClaws &&
!ae.hasWorkingSystem(Mech.ACTUATOR_HAND, armLoc)) {
toHit.addModifier(1, "Hand actuator destroyed");
} else if (hasClaws) {
toHit.addModifier(1, "Using Claws");
}
// If it has a torso-mounted cockpit and two head sensor hits or three
// sensor hits...
// It gets a =4 penalty for being blind!
if (((Mech) ae).getCockpitType() == Mech.COCKPIT_TORSO_MOUNTED) {
int sensorHits = ae.getBadCriticals(CriticalSlot.TYPE_SYSTEM,
Mech.SYSTEM_SENSORS, Mech.LOC_HEAD);
int sensorHits2 = ae.getBadCriticals(CriticalSlot.TYPE_SYSTEM,
Mech.SYSTEM_SENSORS, Mech.LOC_CT);
if ((sensorHits + sensorHits2) == 3) {
return new ToHitData(TargetRoll.IMPOSSIBLE,
"Sensors Completely Destroyed for Torso-Mounted Cockpit");
} else if (sensorHits == 2) {
toHit.addModifier(4,
"Head Sensors Destroyed for Torso-Mounted Cockpit");
}
}
Compute.modifyPhysicalBTHForAdvantages(ae, te, toHit, game);
// If the target has assault claws, give a 1 modifier.
// We can stop looking when we find our first match.
if (te != null) {
for (Mounted mount : te.getMisc()) {
EquipmentType equip = mount.getType();
if (equip.hasFlag(MiscType.F_MAGNET_CLAW)) {
toHit.addModifier(1, "defender has magnetic claws");
break;
}
}
}
// done!
return toHit;
}
}
| [
"[email protected]"
]
| |
fffa08c00174b9488645e7b6b86941960888feb4 | 98faf4361afaef498c45b3a23576fc961f2a503d | /Hangman/app/src/main/java/com/example/huntertsai/hangman/WelcomeActivity.java | b0d200edf0e9dd63e006fb52941dd625c575cc3c | []
| no_license | as5823934/Android-Studio-InClass-Example | 0a2e1c6229ca367c7cb4f4458cb35919a506a839 | 51fa68631529c40f0428ee6a58455360f6fa4023 | refs/heads/master | 2020-03-21T04:24:54.262832 | 2018-06-21T02:12:10 | 2018-06-21T02:12:10 | 138,106,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,443 | java | package com.example.huntertsai.hangman;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import com.hanks.htextview.HTextView;
import com.hanks.htextview.HTextViewType;
public class WelcomeActivity extends AppCompatActivity {
private HTextView hTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
hTextView = (HTextView) findViewById(R.id.htext);
hTextView.setAnimateType(HTextViewType.TYPER);
hTextView.animateText("What do you want to play today?"); // animate
}
public void to_Tic_tac_toe_player(View view) {
Intent intent = new Intent(this, TicTacToe_Player_Activity.class);
startActivity(intent);
}
public void to_Tic_tac_toe_ai(View view) {
Intent intent = new Intent(this, TicTacToe_AI_Activity.class);
startActivity(intent);
}
public void to_Hangman(View view) {
Intent intent = new Intent(this, HangmanActivity.class);
startActivity(intent);
}
@Override
protected void onResume() {
super.onResume();
hTextView = (HTextView) findViewById(R.id.htext);
hTextView.setAnimateType(HTextViewType.TYPER);
hTextView.animateText("What do you want to play today?"); // animate
}
}
| [
"[email protected]"
]
| |
621d0bb089ef475d4e67b3e00af2eda491b14f2b | 37183ae97e9b183af57ccbe5e38e92c225a0d3d7 | /app/src/main/java/com/arnoldvaz27/countriesofasia/JavaClasses/ImageFetch.java | 33b43470b50dff8df4a273b259f387a4a4f9eead | []
| no_license | arnoldvaz27/CountriesOfAsia | 6f23ad0f40160eac85742fa3ee68fb4381336dc5 | 8e2d446c23ac05b655c1f02892a37dc055e3db08 | refs/heads/master | 2023-08-16T20:40:08.240736 | 2021-08-24T07:05:54 | 2021-08-24T07:05:54 | 385,628,770 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,760 | java | package com.arnoldvaz27.countriesofasia.JavaClasses;
import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;
import android.widget.Toast;
import com.arnoldvaz27.countriesofasia.R;
import com.github.twocoffeesoneteam.glidetovectoryou.GlideToVectorYou;
import com.github.twocoffeesoneteam.glidetovectoryou.GlideToVectorYouListener;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
public class ImageFetch {
private static OkHttpClient httpClient;
// this method is used to fetch svg and load it into target imageview.
public static void fetchSvg(Context context, String url, final ImageView target) {
if (httpClient == null) {
//used for caching the image and storing it locally so that the user can view the images in offline mode as well
httpClient = new OkHttpClient.Builder()
.cache(new Cache(context.getCacheDir(), 5 * 1024 * 1024))
.build();
}
//used to display all the images that are the retrieved from the url into the imageview
GlideToVectorYou
.init()
.with(context.getApplicationContext())
.withListener(new GlideToVectorYouListener() {
@Override
public void onLoadFailed() {
Toast.makeText(context.getApplicationContext(), "Load failed, please connect to internet to fetch the flag", Toast.LENGTH_SHORT).show();
}
@Override
public void onResourceReady() {
}
})
.setPlaceHolder(R.drawable.android, R.drawable.android)
.load(Uri.parse(url), target);
}
}
| [
"[email protected]"
]
| |
55acf9ca374099069996e01d2104d5032f3dc035 | 92b7cbb3c657170d38d75a5cd646fa3be12fd4bb | /L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/MultiSellChoose.java | 310c4f3ebd2ff45209d8b4ec51888a7aa598e36d | []
| no_license | uvbs/l2j_mobius | 1197702ecd2e2b37b4c5a5f98ec665d6b1c0efef | bf4bbe4124497f338cb5ce50c88c06c6280ca50a | refs/heads/master | 2020-07-29T20:43:38.851566 | 2019-08-08T10:29:34 | 2019-08-08T10:29:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,538 | java | /*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.datatables.xml.ItemTable;
import org.l2jmobius.gameserver.model.Augmentation;
import org.l2jmobius.gameserver.model.PlayerInventory;
import org.l2jmobius.gameserver.model.actor.instance.ItemInstance;
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.multisell.MultiSellEntry;
import org.l2jmobius.gameserver.model.multisell.MultiSellIngredient;
import org.l2jmobius.gameserver.model.multisell.MultiSellListContainer;
import org.l2jmobius.gameserver.model.multisell.Multisell;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.ItemList;
import org.l2jmobius.gameserver.network.serverpackets.PledgeShowInfoUpdate;
import org.l2jmobius.gameserver.network.serverpackets.StatusUpdate;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.templates.item.Armor;
import org.l2jmobius.gameserver.templates.item.Item;
import org.l2jmobius.gameserver.templates.item.Weapon;
/**
* @author programmos
*/
public class MultiSellChoose extends GameClientPacket
{
private static Logger LOGGER = Logger.getLogger(MultiSellChoose.class.getName());
private int _listId;
private int _entryId;
private int _amount;
private int _enchantment;
private int _transactionTax; // local handling of taxation
@Override
protected void readImpl()
{
_listId = readD();
_entryId = readD();
_amount = readD();
// _enchantment = readH(); // Commented this line because it did NOT work!
_enchantment = _entryId % 100000;
_entryId = _entryId / 100000;
_transactionTax = 0; // Initialize tax amount to 0...
}
@Override
public void runImpl()
{
final PlayerInstance player = getClient().getPlayer();
if (player == null)
{
return;
}
if (!getClient().getFloodProtectors().getMultiSell().tryPerformAction("multisell choose"))
{
player.setMultiSellId(-1);
return;
}
if ((_amount < 1) || (_amount > 5000))
{
player.setMultiSellId(-1);
return;
}
final NpcInstance merchant = player.getTarget() instanceof NpcInstance ? (NpcInstance) player.getTarget() : null;
// Possible fix to Multisell Radius
if ((merchant == null) || !player.isInsideRadius(merchant, NpcInstance.INTERACTION_DISTANCE, false, false))
{
player.setMultiSellId(-1);
return;
}
final MultiSellListContainer list = Multisell.getInstance().getList(_listId);
final int selectedList = player.getMultiSellId();
if ((list == null) || (list.getListId() != _listId) || (selectedList != _listId))
{
player.setMultiSellId(-1);
return;
}
if (player.isCastingNow() || player.isCastingPotionNow())
{
player.sendPacket(ActionFailed.STATIC_PACKET);
player.setMultiSellId(-1);
return;
}
for (MultiSellEntry entry : list.getEntries())
{
if (entry.getEntryId() == _entryId)
{
doExchange(player, entry, list.getApplyTaxes(), list.getMaintainEnchantment(), _enchantment);
// dnt change multisell on exchange to avoid new window open need
// player.setMultiSellId(-1);
return;
}
}
}
private void doExchange(PlayerInstance player, MultiSellEntry templateEntry, boolean applyTaxes, boolean maintainEnchantment, int enchantment)
{
final PlayerInventory inv = player.getInventory();
boolean maintainItemFound = false;
// given the template entry and information about maintaining enchantment and applying taxes re-create the instance of
// the entry that will be used for this exchange i.e. change the enchantment level of select ingredient/products and adena amount appropriately.
final NpcInstance merchant = player.getTarget() instanceof NpcInstance ? (NpcInstance) player.getTarget() : null;
// if(merchant == null) TODO: Check this
// return;
final MultiSellEntry entry = prepareEntry(merchant, templateEntry, applyTaxes, maintainEnchantment, enchantment);
// Generate a list of distinct ingredients and counts in order to check if the correct item-counts
// are possessed by the player
List<MultiSellIngredient> _ingredientsList = new ArrayList<>();
boolean newIng = true;
for (MultiSellIngredient e : entry.getIngredients())
{
newIng = true;
// at this point, the template has already been modified so that enchantments are properly included
// whenever they need to be applied. Uniqueness of items is thus judged by item id AND enchantment level
for (MultiSellIngredient ex : _ingredientsList)
{
// if the item was already added in the list, merely increment the count
// this happens if 1 list entry has the same ingredient twice (example 2 swords = 1 dual)
if ((ex.getItemId() == e.getItemId()) && (ex.getEnchantmentLevel() == e.getEnchantmentLevel()))
{
if (((double) ex.getItemCount() + e.getItemCount()) > Integer.MAX_VALUE)
{
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
_ingredientsList.clear();
return;
}
ex.setItemCount(ex.getItemCount() + e.getItemCount());
newIng = false;
}
}
if (newIng)
{
// If there is a maintainIngredient, then we do not need to check the enchantment parameter as the enchant level will be checked elsewhere
if (maintainEnchantment)
{
maintainItemFound = true;
}
// if it's a new ingredient, just store its info directly (item id, count, enchantment)
_ingredientsList.add(new MultiSellIngredient(e));
}
}
// If there is no maintainIngredient, then we must make sure that the enchantment is not kept from the client packet, as it may have been forged
if (!maintainItemFound)
{
for (MultiSellIngredient product : entry.getProducts())
{
product.setEnchantmentLevel(0);
}
}
// now check if the player has sufficient items in the inventory to cover the ingredients' expences
for (MultiSellIngredient e : _ingredientsList)
{
if ((e.getItemCount() * _amount) > Integer.MAX_VALUE)
{
player.sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
_ingredientsList.clear();
return;
}
if ((e.getItemId() != 65336) && (e.getItemId() != 65436))
{
// if this is not a list that maintains enchantment, check the count of all items that have the given id.
// otherwise, check only the count of items with exactly the needed enchantment level
if (inv.getInventoryItemCount(e.getItemId(), maintainEnchantment ? e.getEnchantmentLevel() : -1) < (Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMantainIngredient() ? e.getItemCount() * _amount : e.getItemCount()))
{
player.sendPacket(SystemMessageId.NOT_ENOUGH_ITEMS);
_ingredientsList.clear();
return;
}
}
else
{
if (e.getItemId() == 65336)
{
if (player.getClan() == null)
{
player.sendPacket(SystemMessageId.YOU_ARE_NOT_A_CLAN_MEMBER);
return;
}
if (!player.isClanLeader())
{
player.sendPacket(SystemMessageId.ONLY_THE_CLAN_LEADER_IS_ENABLED);
return;
}
if (player.getClan().getReputationScore() < (e.getItemCount() * _amount))
{
player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_SCORE_IS_TOO_LOW);
return;
}
}
if ((e.getItemId() == 65436) && ((e.getItemCount() * _amount) > player.getPcBangScore()))
{
player.sendPacket(SystemMessageId.NOT_ENOUGH_ITEMS);
return;
}
}
}
_ingredientsList.clear();
final List<Augmentation> augmentation = new ArrayList<>();
/** All ok, remove items and add final product */
for (MultiSellIngredient e : entry.getIngredients())
{
if ((e.getItemId() != 65336) && (e.getItemId() != 65436))
{
for (MultiSellIngredient a : entry.getProducts())
{
if ((player.getInventoryLimit() < (inv.getSize() + _amount)) && !ItemTable.getInstance().createDummyItem(a.getItemId()).isStackable())
{
player.sendPacket(SystemMessageId.SLOTS_FULL);
return;
}
if ((player.getInventoryLimit() < inv.getSize()) && ItemTable.getInstance().createDummyItem(a.getItemId()).isStackable())
{
player.sendPacket(SystemMessageId.SLOTS_FULL);
return;
}
}
ItemInstance itemToTake = inv.getItemByItemId(e.getItemId()); // initialize and initial guess for the item to take.
// this is a cheat, transaction will be aborted and if any items already tanken will not be returned back to inventory!
if (itemToTake == null)
{
LOGGER.warning("Character: " + player.getName() + " is trying to cheat in multisell, merchatnt id:" + (merchant != null ? merchant.getNpcId() : 0));
return;
}
if (itemToTake.isWear())
{
LOGGER.warning("Character: " + player.getName() + " is trying to cheat in multisell with weared item");
return;
}
if (Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMantainIngredient())
{
// if it's a stackable item, just reduce the amount from the first (only) instance that is found in the inventory
if (itemToTake.isStackable())
{
if (!player.destroyItem("Multisell", itemToTake.getObjectId(), (e.getItemCount() * _amount), player.getTarget(), true))
{
return;
}
}
else // a) if enchantment is maintained, then get a list of items that exactly match this enchantment
if (maintainEnchantment)
{
// loop through this list and remove (one by one) each item until the required amount is taken.
final ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantmentLevel());
for (int i = 0; i < (e.getItemCount() * _amount); i++)
{
if (inventoryContents[i].isAugmented())
{
augmentation.add(inventoryContents[i].getAugmentation());
}
if (inventoryContents[i].isEquipped())
{
if (inventoryContents[i].isAugmented())
{
inventoryContents[i].getAugmentation().removeBonus(player);
}
}
if (!player.destroyItem("Multisell", inventoryContents[i].getObjectId(), 1, player.getTarget(), true))
{
return;
}
}
}
else
// b) enchantment is not maintained. Get the instances with the LOWEST enchantment level
{
/*
* NOTE: There are 2 ways to achieve the above goal. 1) Get all items that have the correct itemId, loop through them until the lowest enchantment level is found. Repeat all this for the next item until proper count of items is reached. 2) Get all items that have the correct
* itemId, sort them once based on enchantment level, and get the range of items that is necessary. Method 1 is faster for a small number of items to be exchanged. Method 2 is faster for large amounts. EXPLANATION: Worst case scenario for algorithm 1 will make it run in a
* number of cycles given by: m*(2n-m+1)/2 where m is the number of items to be exchanged and n is the total number of inventory items that have a matching id. With algorithm 2 (sort), sorting takes n*LOGGER(n) time and the choice is done in a single cycle for case b (just
* grab the m first items) or in linear time for case a (find the beginning of items with correct enchantment, index x, and take all items from x to x+m). Basically, whenever m > LOGGER(n) we have: m*(2n-m+1)/2 = (2nm-m*m+m)/2 > (2nlogn-logn*logn+logn)/2 = nlog(n) -
* LOGGER(n*n) + LOGGER(n) = nlog(n) + LOGGER(n/n*n) = nlog(n) + LOGGER(1/n) = nlog(n) - LOGGER(n) = (n-1)LOGGER(n) So for m < LOGGER(n) then m*(2n-m+1)/2 > (n-1)LOGGER(n) and m*(2n-m+1)/2 > nlog(n) IDEALLY: In order to best optimize the performance, choose which algorithm to
* run, based on whether 2^m > n if ( (2<<(e.getItemCount() * _amount)) < inventoryContents.length ) // do Algorithm 1, no sorting else // do Algorithm 2, sorting CURRENT IMPLEMENTATION: In general, it is going to be very rare for a person to do a massive exchange of
* non-stackable items For this reason, we assume that algorithm 1 will always suffice and we keep things simple. If, in the future, it becomes necessary that we optimize, the above discussion should make it clear what optimization exactly is necessary (based on the comments
* under "IDEALLY").
*/
// choice 1. Small number of items exchanged. No sorting.
for (int i = 1; i <= (e.getItemCount() * _amount); i++)
{
final ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId());
itemToTake = inventoryContents[0];
// get item with the LOWEST enchantment level from the inventory...
// +0 is lowest by default...
if (itemToTake.getEnchantLevel() > 0)
{
for (ItemInstance inventoryContent : inventoryContents)
{
if (inventoryContent.getEnchantLevel() < itemToTake.getEnchantLevel())
{
itemToTake = inventoryContent;
// nothing will have enchantment less than 0. If a zero-enchanted
// item is found, just take it
if (itemToTake.getEnchantLevel() == 0)
{
break;
}
}
}
}
if (itemToTake.isEquipped())
{
if (itemToTake.isAugmented())
{
itemToTake.getAugmentation().removeBonus(player);
}
}
if (!player.destroyItem("Multisell", itemToTake.getObjectId(), 1, player.getTarget(), true))
{
return;
}
}
}
}
}
else if (e.getItemId() == 65336)
{
final int repCost = player.getClan().getReputationScore() - e.getItemCount();
player.getClan().setReputationScore(repCost, true);
player.sendPacket(new SystemMessage(SystemMessageId.S1_DEDUCTED_FROM_CLAN_REP).addNumber(e.getItemCount()));
player.getClan().broadcastToOnlineMembers(new PledgeShowInfoUpdate(player.getClan()));
}
else
{
player.reducePcBangScore(e.getItemCount() * _amount);
player.sendPacket(new SystemMessage(SystemMessageId.USING_S1_PCPOINT).addNumber(e.getItemCount()));
}
}
// Generate the appropriate items
for (MultiSellIngredient e : entry.getProducts())
{
if (ItemTable.getInstance().createDummyItem(e.getItemId()).isStackable())
{
inv.addItem("Multisell[" + _listId + "]", e.getItemId(), (e.getItemCount() * _amount), player, player.getTarget());
}
else
{
ItemInstance product = null;
for (int i = 0; i < (e.getItemCount() * _amount); i++)
{
product = inv.addItem("Multisell[" + _listId + "]", e.getItemId(), 1, player, player.getTarget());
if (maintainEnchantment && (product != null))
{
if (i < augmentation.size())
{
product.setAugmentation(new Augmentation(product, augmentation.get(i).getAugmentationId(), augmentation.get(i).getSkill(), true));
}
product.setEnchantLevel(e.getEnchantmentLevel());
}
}
}
// Msg part
SystemMessage sm;
if ((e.getItemCount() * _amount) > 1)
{
sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);
sm.addItemName(e.getItemId());
sm.addNumber(e.getItemCount() * _amount);
player.sendPacket(sm);
}
else
{
if (maintainEnchantment && (e.getEnchantmentLevel() > 0))
{
sm = new SystemMessage(SystemMessageId.ACQUIRED);
sm.addNumber(e.getEnchantmentLevel());
sm.addItemName(e.getItemId());
}
else
{
sm = new SystemMessage(SystemMessageId.EARNED_ITEM);
sm.addItemName(e.getItemId());
}
player.sendPacket(sm);
}
}
player.sendPacket(new ItemList(player, false));
final StatusUpdate su = new StatusUpdate(player.getObjectId());
su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
player.sendPacket(su);
player.broadcastUserInfo();
// Finally, give the tax to the castle...
if ((merchant != null) && merchant.getIsInTown() && (merchant.getCastle().getOwnerId() > 0))
{
merchant.getCastle().addToTreasury(_transactionTax * _amount);
}
}
// Regarding taxation, the following appears to be the case:
// a) The count of aa remains unchanged (taxes do not affect aa directly).
// b) 5/6 of the amount of aa is taxed by the normal tax rate.
// c) the resulting taxes are added as normal adena value.
// d) normal adena are taxed fully.
// e) Items other than adena and ancient adena are not taxed even when the list is taxable.
// example: If the template has an item worth 120aa, and the tax is 10%,
// then from 120aa, take 5/6 so that is 100aa, apply the 10% tax in adena (10a)
// so the final price will be 120aa and 10a!
private MultiSellEntry prepareEntry(NpcInstance merchant, MultiSellEntry templateEntry, boolean applyTaxes, boolean maintainEnchantment, int enchantLevel)
{
final MultiSellEntry newEntry = new MultiSellEntry();
newEntry.setEntryId(templateEntry.getEntryId());
int totalAdenaCount = 0;
boolean hasIngredient = false;
for (MultiSellIngredient ing : templateEntry.getIngredients())
{
// Load the ingredient from the template
final MultiSellIngredient newIngredient = new MultiSellIngredient(ing);
if ((newIngredient.getItemId() == 57) && newIngredient.isTaxIngredient())
{
double taxRate = 0.0;
if (applyTaxes)
{
if ((merchant != null) && merchant.getIsInTown())
{
taxRate = merchant.getCastle().getTaxRate();
}
}
_transactionTax = (int) Math.round(newIngredient.getItemCount() * taxRate);
totalAdenaCount += _transactionTax;
continue; // Do not yet add this adena amount to the list as non-taxIngredient adena might be entered later (order not guaranteed)
}
else if (ing.getItemId() == 57) // && !ing.isTaxIngredient()
{
totalAdenaCount += newIngredient.getItemCount();
continue; // Do not yet add this adena amount to the list as taxIngredient adena might be entered later (order not guaranteed)
}
// If it is an armor/weapon, modify the enchantment level appropriately, if necessary
else if (maintainEnchantment)
{
final Item tempItem = ItemTable.getInstance().createDummyItem(newIngredient.getItemId()).getItem();
if ((tempItem instanceof Armor) || (tempItem instanceof Weapon))
{
newIngredient.setEnchantmentLevel(enchantLevel);
hasIngredient = true;
}
}
// finally, add this ingredient to the entry
newEntry.addIngredient(newIngredient);
}
// Next add the adena amount, if any
if (totalAdenaCount > 0)
{
newEntry.addIngredient(new MultiSellIngredient(57, totalAdenaCount, false, false));
}
// Now modify the enchantment level of products, if necessary
for (MultiSellIngredient ing : templateEntry.getProducts())
{
// Load the ingredient from the template
final MultiSellIngredient newIngredient = new MultiSellIngredient(ing);
if (maintainEnchantment && hasIngredient)
{
// If it is an armor/weapon, modify the enchantment level appropriately
// (note, if maintain enchantment is "false" this modification will result to a +0)
final Item tempItem = ItemTable.getInstance().createDummyItem(newIngredient.getItemId()).getItem();
if ((tempItem instanceof Armor) || (tempItem instanceof Weapon))
{
if ((enchantLevel == 0) && maintainEnchantment)
{
enchantLevel = ing.getEnchantmentLevel();
}
newIngredient.setEnchantmentLevel(enchantLevel);
}
}
newEntry.addProduct(newIngredient);
}
return newEntry;
}
} | [
"[email protected]"
]
| |
1fba9d346062488d9a2cbc108a7c66d1d784b66e | 9dac019b6c5341bff55b4ba094dd70c5ceddfb57 | /src/Homework5/StudentGroup.java | 6bd903216e80f1536c499ef873caede08061f14a | []
| no_license | StefanaK/HOMEWORKS | ac86f04216069f6329cbfe9c46d3ef9a6c1e9552 | 77ebd5bb5a85e956b99f0cbd665b8789033ed545 | refs/heads/master | 2023-03-07T16:30:20.744265 | 2021-02-19T13:58:27 | 2021-02-19T13:58:27 | 337,971,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,931 | java | package Homework5;
import Homework4.Student;
public class StudentGroup {
String groupSubject;
Student[] students;
int freePlaces;
StudentGroup() {
this.students = new Student[5];
this.freePlaces = 5;
}
StudentGroup(String subject) {
this();
this.groupSubject = subject;
}
void addStudent(Student s) {
if (s.subject.equals(groupSubject) && freePlaces > 0){
students[students.length-freePlaces] = s;
freePlaces--;
System.out.println(s.name + " is added to StudentGroup: " + groupSubject);
System.out.println(freePlaces + " places available in " + groupSubject);
} else {
if (freePlaces == 0) {
System.out.println(s.name + " can't be added because there is no enough places in the group " + groupSubject);
}
}
if (!s.subject.equals(groupSubject)) {
System.out.println(s.name + " studies " + s.subject + " and can't be add to StudentGroup: " + groupSubject);
}
System.out.println();
}
void emptyGroup() {
System.out.println();
students = new Student[5];
freePlaces = 5;
System.out.println("There is another " + freePlaces + " places in group Marketing");
System.out.println();
}
String theBestStudent() {
Student max = students[0];
for (int i = 0; i < students.length; i++) {
if (students[i].grade > max.grade) {
max.grade = students[i].grade;
}
}
return max.name + " - " + max.grade;
}
void printStudentsInGroup () {
System.out.println();
for (int i = 0; i < students.length; i++) {
System.out.println(students[i].toString());
}
System.out.println();
}
}
| [
"[email protected]"
]
| |
639684ebe9ff90959bd7c8cb9cfe1229ba232812 | 6236899a036e120f6cce4696039344c642c375fb | /app/src/test/java/com/example/mrhappyyy/arkanoid/ExampleUnitTest.java | 85fd239f61a4d94df925bd9f4ad1b3536d96c475 | []
| no_license | MrHappyyy/Arkanoid | a93c1a6c82050f6491c390c79b9f9e297b6d8c25 | 515f7292dd4e9534b984ea5a28ce8bb94119cae5 | refs/heads/master | 2021-01-10T14:59:54.402140 | 2016-03-17T15:42:35 | 2016-03-17T15:42:35 | 53,790,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.example.mrhappyyy.arkanoid;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
0cbda5b6ed08e71acce9743d68d11d3ff015d1f5 | b8fec4bb6d0993feac10648ae9fe2833fc2ce402 | /core-io/src/main/java/com/couchbase/client/core/error/transaction/internal/CoreTransactionFailedException.java | 09a8e34c00c8ba449799228154d07d1869e9037d | [
"Apache-2.0"
]
| permissive | couchbase/couchbase-jvm-clients | cdd5f19a808d5cb7e8b89553ccb00807342e7a53 | 272e9a555afeef7a4effb674af4b671d2ad63197 | refs/heads/master | 2023-09-01T11:38:30.698356 | 2023-08-23T09:09:08 | 2023-08-31T10:34:04 | 151,122,650 | 36 | 42 | Apache-2.0 | 2023-06-20T17:29:06 | 2018-10-01T16:44:58 | Java | UTF-8 | Java | false | false | 1,799 | java | /*
* Copyright 2022 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.couchbase.client.core.error.transaction.internal;
import com.couchbase.client.core.annotation.Stability;
import com.couchbase.client.core.error.CouchbaseException;
import com.couchbase.client.core.transaction.log.CoreTransactionLogger;
/**
* The transaction failed to reach the Committed point.
*
* No actors can see any changes made by this transaction.
*/
@Stability.Internal
public class CoreTransactionFailedException extends CouchbaseException {
private final CoreTransactionLogger logger;
private final String transactionId;
public CoreTransactionFailedException(Throwable cause, CoreTransactionLogger logger, String transactionId) {
this(cause, logger, transactionId, ("Transaction has failed with cause '" + (cause == null ? "unknown" : cause.toString()) + "'"));
}
public CoreTransactionFailedException(Throwable cause, CoreTransactionLogger logger, String transactionId, String msg) {
super(msg, cause);
this.logger = logger;
this.transactionId = transactionId;
}
public CoreTransactionLogger logger() {
return logger;
}
public String transactionId() {
return transactionId;
}
}
| [
"[email protected]"
]
| |
13d65c9549ddc93f3c1bab5d9bd2053d5f045cc4 | 749daad7306bfce5a411426cabaa4ba16fdeadc6 | /app/src/main/java/com/example/brill/bdatingapp/fragments/FriendRequestReceived.java | e356b455d3f3d063aea371739f83295198a875b2 | []
| no_license | imashutoshchaudhary/DatingApp | 569a25a4f46edaa6414b1371b188eb24d55093c1 | 7071f2568ba9b30669b9f49ab794be4cbe860977 | refs/heads/master | 2020-04-27T16:12:47.680268 | 2019-03-08T06:05:51 | 2019-03-08T06:05:51 | 174,476,509 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 22,133 | java | package com.example.brill.bdatingapp.fragments;
import android.app.Fragment;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ProgressBar;
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.JsonArrayRequest;
import com.android.volley.toolbox.StringRequest;
import com.example.brill.bdatingapp.Configs;
import com.example.brill.bdatingapp.ConnectDetector;
import com.example.brill.bdatingapp.R;
import com.example.brill.bdatingapp.VolleySingleton;
import com.example.brill.bdatingapp.adapter.AdapterFriendRequestReceived;
import com.example.brill.bdatingapp.adapter.AdapterFriendRequestSended;
import com.example.brill.bdatingapp.gattersatter.GatterGetAllFriendRequestReceived;
import com.example.brill.bdatingapp.gattersatter.GatterGetAllFriendRequestSended;
import com.example.brill.bdatingapp.gattersatter.GatterGetAllUser;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import es.dmoral.toasty.Toasty;
import static android.content.Context.MODE_PRIVATE;
/**
* A simple {@link Fragment} subclass.
*/
public class FriendRequestReceived extends android.support.v4.app.Fragment {
ProgressBar progressBar;
JsonArrayRequest jsonArrayReq;
RequestQueue requestQueue;
private AdapterFriendRequestReceived recyclerAdapter;
private ArrayList<GatterGetAllFriendRequestReceived> recyclerModels;
List<GatterGetAllUser> GetDataAdapter1;
RecyclerView recyclerView;
RecyclerView.LayoutManager recyclerlayoutManager;
private static final int LOAD_LIMIT = 15;
private String lastId = "0";
private boolean itShouldLoadMore = true;
//EditText edtSearchuser;
Boolean isinternetpresent;
ConnectDetector cd;
String reslength="0";
String sharid;
SharedPreferences prefrance;
GridView grid;
int nextdata=0;
public FriendRequestReceived() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_all, container, false);
progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar1);
//edtSearchuser=(EditText) rootView.findViewById(R.id.edtSearchuser);
prefrance=getContext().getSharedPreferences(Configs.UserPrefrance, MODE_PRIVATE);
sharid= prefrance.getString("id","");
// cd=new ConnectDetector(getActivity().getApplicationContext());
// isinternetpresent=cd.isConnectToInternet();
// if(isinternetpresent) {
recyclerModels = new ArrayList<>();
recyclerAdapter = new AdapterFriendRequestReceived(recyclerModels,getActivity());
GetDataAdapter1 = new ArrayList<>();
RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.loadmore_recycler_view);
recyclerlayoutManager=new GridLayoutManager(getActivity(),2);
recyclerView.setLayoutManager(recyclerlayoutManager);
recyclerView.setHasFixedSize(true);
//we can now set adapter to recyclerView;
recyclerView.setAdapter(recyclerAdapter);
GetDataAdapter1 = new ArrayList<>();
getAllUsers();
/*edtSearchuser.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable editable) {
String username=editable.toString();
filter(username.toLowerCase());
}
});*/
// }
// else
// {
// Toast.makeText(getActivity().getApplicationContext(),"Connect To Internet",Toast.LENGTH_SHORT).show();
// }
/*
recyclerModels = new ArrayList<>();
recyclerAdapter = new AdapterGetAllUserList(recyclerModels,getActivity());
GetDataAdapter1 = new ArrayList<>();
recyclerView = (RecyclerView) rootView.findViewById(R.id.loadmore_recycler_view);
recyclerView.setHasFixedSize(true);
recyclerlayoutManager = new LinearLayoutManager(getActivity());
GetDataAdapter1 = new ArrayList<>();*/
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
// for this tutorial, this is the ONLY method that we need, ignore the rest
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (dy > 0) {
// Recycle view scrolling downwards...
// this if statement detects when user reaches the end of recyclerView, this is only time we should load more
if (!recyclerView.canScrollVertically(RecyclerView.FOCUS_DOWN)) {
// remember "!" is the same as "== false"
// here we are now allowed to load more, but we need to be careful
// we must check if itShouldLoadMore variable is true [unlocked]
if (itShouldLoadMore) {
loadMoredta();
}
}
}
}
});
return rootView;
}
private void filter(String text) {
ArrayList<GatterGetAllFriendRequestReceived> filteredname=new ArrayList<>();
for (GatterGetAllFriendRequestReceived s : recyclerModels) {
if(s.getUname().toLowerCase().startsWith(text))
{
filteredname.add(s);
}
}
recyclerAdapter.filterList(filteredname);
}
private void getAllUsers() {
progressBar.setVisibility(View.VISIBLE);
progressBar.setClickable(false);
Log.i("","Configs.GetAllUser========"+ Configs.GetAllUser);
//if everything is fine
StringRequest stringRequest = new StringRequest(Request.Method.POST, Configs.GetAllFriendRequestList,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// progressBar.setVisibility(View.GONE);
Log.i("","ggggggggggggggg"+response);
progressBar.setVisibility(View.GONE);
try {
JSONArray jsonArray = new JSONArray(response);
nextdata=jsonArray.length();
Log.i("","getAllUsersresponser============"+jsonArray.length());
for (int i = 0; i < jsonArray.length(); i++) {
try {
JSONObject jsonObject = jsonArray.getJSONObject(i);
// lastId= jsonObject.getString("id");
// Log.i("","ggggggggggggggg"+lastId);
String userId, uname,gender,birthday,city,profile_pic;
userId=jsonObject.getString("id");
uname=jsonObject.getString("name");
gender=jsonObject.getString("gender");
birthday=jsonObject.getString("birthday");
city=jsonObject.getString("city");
profile_pic=jsonObject.getString("profile_pic");
recyclerModels.add(new GatterGetAllFriendRequestReceived(userId, uname,gender,birthday,city,profile_pic));
recyclerAdapter.notifyDataSetChanged();
}
catch (JSONException e)
{
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Toast.makeText(getActivity(), error.getMessage(), Toast.LENGTH_SHORT).show();
Log.i("","profile error========="+error.toString());
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
// params.put("GetAllUser", "1");
// params.put("limit ",Integer.toString(nextdata) );
params.put("GetAllFriendReq", "1");
params.put("cuserid",sharid);
Log.i("","next data profile error========="+nextdata);
return params;
}
};
VolleySingleton.getInstance(getActivity()).addToRequestQueue(stringRequest);
}
/*private void getAllUsers() {
progressBar.setVisibility(View.VISIBLE);
progressBar.setClickable(false);
String JSON_URL=Configs.GetAllUser+"?limit=16&LoadData=yes";
Log.i("","json links is======"+JSON_URL);
jsonArrayReq = new JsonArrayRequest(JSON_URL,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
// uploading.dismiss();
Log.i("", "00000000000response is --------------" + response);
reslength=Integer.toString(response.length());
progressBar.setVisibility(View.GONE);
if (response.length() <= 0) {
// no data available
Toast.makeText(getActivity(), "No data available", Toast.LENGTH_SHORT).show();
return;
}
for (int i = 0; i < response.length(); i++) {
try {
JSONObject jsonObject = response.getJSONObject(i);
lastId= jsonObject.getString("intId");
String fname= jsonObject.getString("fname");
String lname= jsonObject.getString("lname");
String sex= jsonObject.getString("sex");
String dob= jsonObject.getString("dob");
String country_code= jsonObject.getString("country");
String state_code= jsonObject.getString("state");
String city_code= jsonObject.getString("city");
String online_status= jsonObject.getString("online_status");
Log.i("","fname is=="+fname);
recyclerModels.add(new GatterGetAllUser(lastId, fname,lname,sex,dob,country_code,state_code,city_code,online_status));
recyclerAdapter.notifyDataSetChanged();
} catch (JSONException e) {
e.printStackTrace();
}
}
// progressBar.setVisibility(View.GONE);
// GetRecentNewsResponse(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// progressBar.setVisibility(View.GONE);
progressBar.setVisibility(View.GONE);
Log.i("","error============"+error);
}
});
requestQueue = Volley.newRequestQueue(getActivity());
requestQueue.add(jsonArrayReq);
}*/
/* private void loadMore() {
progressBar.setVisibility(View.VISIBLE);
progressBar.setClickable(false);
itShouldLoadMore = false; // lock this until volley completes processing
// progressWheel is just a loading spinner, please see the content_main.xml
*//**//* final ProgressWheel progressWheel = (ProgressWheel) this.findViewById(R.id.progress_wheel);
progressWheel.setVisibility(View.VISIBLE);
http://www.ankalan.com/rescue/AdminPanel/AdminRecentNews.php?lastids=89&MoreData=yes&limit=15
*//**//*
// uploading = ProgressDialog.show(AdminAddNews.this, "fatching data", "Please wait...", false, false);
//String urls=Configs.GetAllUser+"?lastid="+lastId+"&MoreData=yes&limit=16";
String urls= Configs.GetAllUser+"?limit=16&MoreData=yes&lastid="+reslength;
Log.i("","nfgasdgsdgLoad more urlis "+urls);
JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(urls, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
// progressWheel.setVisibility(View.GONE);
// since volley has completed and it has our response, now let's update
// itShouldLoadMore
Log.i("","88888888888loadmord data is==========="+response);
reslength= Integer.toString(Integer.parseInt(reslength)+response.length());
Log.i("","88888888888loadmord data is===========length"+reslength);
progressBar.setVisibility(View.GONE);
itShouldLoadMore = true;
if (response.length() <= 0) {
// we need to check this, to make sure, our dataStructure JSonArray contains
// something
Toast.makeText(getActivity(), "no data available", Toast.LENGTH_SHORT).show();
return; // return will end the program at this point
}
for (int i = 0; i < response.length(); i++) {
try {
JSONObject jsonObject = response.getJSONObject(i);
lastId= jsonObject.getString("intId");
String fname= jsonObject.getString("fname");
String lname= jsonObject.getString("lname");
String sex= jsonObject.getString("sex");
String dob= jsonObject.getString("dob");
String country_code= jsonObject.getString("country");
String state_code= jsonObject.getString("state");
String city_code= jsonObject.getString("city");
String online_status= jsonObject.getString("online_status");
Log.i("","fname is=="+fname);
recyclerModels.add(new GatterGetAllUser(lastId, fname,lname,sex,dob,country_code));
recyclerAdapter.notifyDataSetChanged();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// progressWheel.setVisibility(View.GONE);
// volley finished and returned network error, update and unlock itShouldLoadMore
progressBar.setVisibility(View.GONE);
itShouldLoadMore = true;
Toast.makeText(getActivity(), "Failed to load more, network error", Toast.LENGTH_SHORT).show();
}
});
Volley.newRequestQueue(getActivity()).add(jsonArrayRequest);
}*/
private void loadMoredta() {
progressBar.setVisibility(View.VISIBLE);
progressBar.setClickable(false);
Log.i("","convert in string gooooooooooooooo"+Integer.toString(nextdata));
final String sendmore=Integer.toString(nextdata);
itShouldLoadMore = false;
Log.i("","loadmord datra"+sendmore);
//if everything is fine
StringRequest stringRequest = new StringRequest(Request.Method.POST, Configs.GetAllUser,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// progressBar.setVisibility(View.GONE);
Log.i("","string responsesdasdg======="+response);
progressBar.setVisibility(View.GONE);
if (response.equals("[]")) {
// we need to check this, to make sure, our dataStructure JSonArray contains
// something
Toasty.info(getActivity(), "no data available", Toast.LENGTH_SHORT).show();
return; // return will end the program at this point
}
try {
JSONArray jsonArray = new JSONArray(response);
Log.i("","string responsesdasdg======="+jsonArray.length());
if (jsonArray.length()==0) {
// we need to check this, to make sure, our dataStructure JSonArray contains
// something
Toasty.info(getActivity(), "no data available", Toast.LENGTH_SHORT).show();
return; // return will end the program at this point
}
else if (jsonArray.length() <= 0) {
// we need to check this, to make sure, our dataStructure JSonArray contains
// something
Toasty.info(getActivity(), "no data available", Toast.LENGTH_SHORT).show();
return; // return will end the program at this point
}
else
{
int getNextLength= jsonArray.length();
Log.i("","loadMoredtaggggggggggggggg"+jsonArray.length());
nextdata=nextdata+getNextLength;
Log.i("","next data================"+nextdata);
itShouldLoadMore = true;
for (int i = 0; i < jsonArray.length(); i++) {
try {
JSONObject jsonObject = jsonArray.getJSONObject(i);
// lastId= jsonObject.getString("id");
// Log.i("","ggggggggggggggg"+lastId);
String userId, uname,gender,birthday,city,profile_pic;
userId=jsonObject.getString("id");
uname=jsonObject.getString("name");
gender=jsonObject.getString("gender");
birthday=jsonObject.getString("birthday");
city=jsonObject.getString("city");
profile_pic=jsonObject.getString("profile_pic");
recyclerModels.add(new GatterGetAllFriendRequestReceived(userId, uname,gender,birthday,city,profile_pic));
recyclerAdapter.notifyDataSetChanged();
}
catch (JSONException e) {
e.printStackTrace();
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
progressBar.setVisibility(View.GONE);
itShouldLoadMore = true;
Toasty.error(getActivity(), "Failed to load more, network error", Toast.LENGTH_SHORT).show();
}
}) {
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
Log.i("","check sending data==============="+sendmore);
params.put("moredta", "more");
params.put("mored", sendmore);
return params;
}
};
VolleySingleton.getInstance(getActivity()).addToRequestQueue(stringRequest);
}
}
| [
"[email protected]"
]
| |
5311accec8e7aa4ecc5d9e0c302029e2b86b0409 | faad188c4d5c2b8944ac7c47316e451f5143aa63 | /src/main/java/de/processmining/app/config/ApplicationProperties.java | 909dcd211d0722239d2da8d434668424b4913b3b | []
| no_license | ChristopherWy/processmining | bdc8e05435d7251bb10aba13f56a2bc95ad355a7 | 2ebd3eda2b89cca833acd2232d6c8ff89752d5ba | refs/heads/master | 2023-01-22T08:39:34.245517 | 2020-12-05T20:49:19 | 2020-12-05T20:49:19 | 287,061,773 | 0 | 0 | null | 2020-10-20T19:46:18 | 2020-08-12T16:23:30 | Java | UTF-8 | Java | false | false | 433 | java | package de.processmining.app.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Properties specific to Processmining.
* <p>
* Properties are configured in the {@code application.yml} file.
* See {@link io.github.jhipster.config.JHipsterProperties} for a good example.
*/
@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
public class ApplicationProperties {}
| [
"[email protected]"
]
| |
44ff73870077f7eafc75d51a589089080366993c | 7d57fa8271a602c146127c14d371b8226d2aeef1 | /bel.sii/src/main/java/cl/sebastian/bel/sii/BuscarTxtNodo.java | 5dd3b68acbee4a99d07e7e2151f21d31b10d427f | [
"MIT"
]
| permissive | sebastian4j/implementacion-sii | 63a307642265777ccef94f9d9aab025429320091 | a9bd4cba90aae8eaf1fd0b7bb64d2c09f22acada | refs/heads/master | 2022-10-28T01:51:41.847271 | 2019-05-29T03:21:19 | 2019-05-29T03:21:19 | 188,947,932 | 2 | 1 | MIT | 2022-10-05T19:26:55 | 2019-05-28T03:33:18 | Java | UTF-8 | Java | false | false | 2,599 | java | package cl.sebastian.bel.sii;
import java.io.IOException;
import java.io.StringReader;
import org.apache.xerces.parsers.DOMParser;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Clase para buscar el contenido texto de un nodo.
* @author Sebastian Avila A.
*/
public class BuscarTxtNodo {
/** contenido xml. */
private final String xml;
/** nombre a buscar. */
private final String nombre;
/** prefijo de la busqueda. */
private final String prefijo;
/** contenido obtenido. */
private String buscado;
/** parser. */
private final DOMParser parser;
/**
*
* @param xml
* @param nombre
* @param prefijo
* @throws SAXException error sax
* @throws IOException error E/S
*/
public BuscarTxtNodo(String xml, String nombre, String prefijo) throws SAXException, IOException {
this.xml = xml;
this.nombre = nombre;
this.prefijo = prefijo;
parser = new DOMParser();
parser.parse(new InputSource(new StringReader(this.xml)));
}
/**
* obtener el documento.
* @return el documento
*/
public Document getDocument() {
return parser.getDocument();
}
/**
* buscar un elemento.
* @param d nodo a buscar
*/
public void buscar(Node d) {
switch (d.getNodeType()) {
case Node.DOCUMENT_NODE:
buscarDocumentNode(d);
break;
case Node.ELEMENT_NODE:
if (d.getLocalName().equals(nombre) && (prefijo != null ? d.getPrefix().equals(prefijo) : true)) {
buscado = d.getTextContent();
break;
}
buscarElementNode(d);
break;
default:
// sin default
break;
}
}
/**
* buscar un element node.
* @param d
*/
private void buscarElementNode(final Node d) {
final NodeList ln = d.getChildNodes();
for (int a = 0; a < ln.getLength(); a++) {
buscar(ln.item(a));
}
}
/**
* busca el document node.
* @param d
*/
private void buscarDocumentNode(final Node d) {
final Document dc = (Document)d;
final NodeList nl = dc.getChildNodes();
for (int a = 0; a < nl.getLength(); a++) {
buscar(nl.item(a));
}
}
/**
* obtener el resultado de la busqueda.
* @return
*/
public String getBuscado() {
return buscado;
}
}
| [
"[email protected]"
]
| |
ad23a3c755957f3472a5fc950702e78361e26d3d | 94e3c743c40cefd6110b292dce82aa9ee276b626 | /BarVolume008/app/src/test/java/com/example/barvolume008/ExampleUnitTest.java | 1079208608c038555112392f61200996eebe7028 | []
| no_license | yuliviaannisa/PrakMobile | 927dc135af79e1082d7bfb2580b10a038f184ff2 | e621fcde4d5b2f31e06c9361575093c673d56f15 | refs/heads/master | 2023-01-30T11:13:17.388354 | 2020-12-13T18:05:33 | 2020-12-13T18:05:33 | 304,042,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.example.barvolume008;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
1726bb16fb887115c60471b411d0ff0181efc051 | e164d4005f688ce482c822c0cd7cb99cfd60cf32 | /java/TwoSum.java | 0b1b5308de25e872b805b9dab5a64518fdd00654 | [
"MIT"
]
| permissive | ashwani-builds/leetcode | 414929102629691b72d853d08daf9505bf9a3601 | e80b0a02db651f3a0dcefd11928c7dc6805b81c5 | refs/heads/main | 2023-07-18T04:30:38.096859 | 2021-08-21T07:45:54 | 2021-08-21T07:45:54 | 393,768,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | import java.util.HashMap;
class Solution {
public int[] twoSum(int[] nums, int target) {
HashMap <Integer, Integer> map = new HashMap<>();
for(int i = 0; i < nums.length; i++) {
int rem_target = target - nums[i];
if (map.containsKey(rem_target)) {
return new int[]{i, map.get(rem_target)};
}
map.put(nums[i], i);
}
return new int[0];
}
} | [
"[email protected]"
]
| |
67b1f3643e4c77963d148ad7800b3073a4756fa3 | a70f03609fedbc3b3b0d40346c91eaba97716a6a | /ISEP_RISK_AITARKOUB_BERDA_BRY/src/Region.java | f9567d2441eca8821561f194d0cb89f67a942580 | []
| no_license | jeremyberda/ISEP_RISK | a6dd5ad0a9b8250588de6bf0a5f6f5d8275ccfe0 | 5a8c90ecf34a00031a40387ae816fe1668a48b24 | refs/heads/master | 2020-03-18T09:03:56.575710 | 2018-06-08T20:52:33 | 2018-06-08T20:52:33 | 134,543,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,145 | java | import java.util.ArrayList;
public class Region {
int regionID;
private ArrayList<Territory> territoriesOfRegion = new ArrayList<Territory>();
//constructor
public Region(int regionID, ArrayList<Territory> territoriesOfRegion) {
this.regionID = regionID;
this.territoriesOfRegion = territoriesOfRegion;
}
//on fait une fonction qui vérifie si un joueur contrôle une région entière, ou pas
public boolean isControlledBy(Player player) {
for (int i = 0; i < this.territoriesOfRegion.size(); i++) {
if (this.territoriesOfRegion.get(i).getOwner() != player) {
return false;
}
}
return true;
}
// getters and setters
public int getRegionID() {
return regionID;
}
public void setRegionID(int regionID) {
this.regionID = regionID;
}
public ArrayList<Territory> getTerritoriesOfRegion() {
return territoriesOfRegion;
}
public void setTerritoriesOfRegion(ArrayList<Territory> territoriesOfRegion) {
this.territoriesOfRegion = territoriesOfRegion;
}
}
| [
"[email protected]"
]
| |
6651ca8a48ee35eab92f666e4a4c61678b7139f1 | 33b1f0c9c71a07af06afaad6a74f03b6ed3ba9c2 | /src/main/java/fetchers/PhotoFetcher.java | 65890b5b2c72e68d7e4dac05916e1753349167a1 | []
| no_license | MiaSimone/3SemesterProject-Backend | b71900a8822a6f96f5286eb887b5533467d54f6f | 25b745ee5948998268ac1aeee2175be880573031 | refs/heads/master | 2023-04-04T19:53:33.342016 | 2021-04-14T17:59:44 | 2021-04-14T17:59:44 | 315,699,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 61,103 | java |
package fetchers;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import dto.PlaceDetailsDTO;
import dto.PlaceSearchDTO;
import dto.RealtorDTO;
import dto.StandartDTO;
import entities.Photo;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import utils.HttpUtils;
/**
*
* @author miade
*/
public class PhotoFetcher {
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
public static String retrievePlaceID(ExecutorService threadPool, final Gson gson, String PLACE_SERVER) throws Exception{
Callable<PlaceSearchDTO> task = new Callable<PlaceSearchDTO>(){
@Override
public PlaceSearchDTO call() throws Exception {
String data = HttpUtils.fetchDataGoogle(PLACE_SERVER);
//System.out.println("DATA: " + data);
PlaceSearchDTO place = GSON.fromJson(data, PlaceSearchDTO.class);
//System.out.println("DTO: " + place.candidates);
return place;
}
};
Future<PlaceSearchDTO> futurePlace = threadPool.submit(task);
PlaceSearchDTO place = futurePlace.get(30, TimeUnit.SECONDS);
String placeID = place.candidates.get(0).place_id;
return placeID;
}
public static String retrievePhotoRef(ExecutorService threadPool, final Gson gson, String PLACE_SERVER) throws Exception{
List<String> photoRefs = new ArrayList();
long start = System.nanoTime();
Callable<PlaceDetailsDTO> task = new Callable<PlaceDetailsDTO>(){
@Override
public PlaceDetailsDTO call() throws Exception {
String data = HttpUtils.fetchDataGoogle(PLACE_SERVER);
PlaceDetailsDTO placeDetails = GSON.fromJson(data, PlaceDetailsDTO.class);
return placeDetails;
}
};
Future<PlaceDetailsDTO> futurePlaceDetails = threadPool.submit(task);
PlaceDetailsDTO placeDetails = futurePlaceDetails.get(30, TimeUnit.SECONDS);
long end = System.nanoTime();
String time = "Time Parallel: " + ((end-start)/1_000_000) + " ms.";
// https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=&key=key
for (Photo p: placeDetails.result.photos){
String url = "https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference="
+p.photo_reference + "&key=";
photoRefs.add(url);
}
StandartDTO sDTO = new StandartDTO(photoRefs, time);
String standartJSON = gson.toJson(sDTO);
return standartJSON;
}
/*
private static final String FACT_SERVER =
"https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=London&inputtype=textquery&key=AIzaSyBiq63f5HkI1RqsxVsVcgNcVXKQIhdi3LQ";
public static void main(String[] args) throws IOException {
String data = HttpUtils.fetchDataGoogle(FACT_SERVER);
// String data = "{\"meta\":{\"build\":\"3.23.125\",\"schema\":\"core.3\",\"tracking_params\":{\"channel\":\"for_sale\",\"siteSection\":\"for_sale\",\"city\":\"New York City\",\"county\":\"unknown\",\"neighborhood\":\"unknown\",\"searchCityState\":\"New York City, NY\",\"state\":\"NY\",\"zip\":\"unknown\",\"srpPropertyStatus\":\"srp:for_sale\",\"listingActivity\":\"unknown\",\"propertyStatus\":\"for_sale\",\"propertyType\":\"any\",\"searchBathrooms\":\"any\",\"searchBedrooms\":\"any\",\"searchMaxPrice\":\"unknown\",\"searchMinPrice\":\"unknown\",\"searchRadius\":\"unknown\",\"searchHouseSqft\":\"any\",\"searchLotSqft\":\"any\",\"searchResults\":\"20\",\"sortResults\":\"relevance\",\"searchCoordinates\":\"unknown\",\"version\":\"1.0\"},\"tracking\":\"type|meta|data|resource_type|property_list|query|client_id|rdc_mobile_native,13.3.0.53|prop_status|for_sale|schema|core.3|limit|offset|city|New+York+City|state_code|NY|sort|relevance|count|total^K|0|K|TQ4^^$0|1|2|$3|4|5|$6|7|8|9|A|B|C|M|D|N|E|F|G|H|I|J]|8|9|K|O|L|P]]\",\"returned_rows\":20,\"matching_rows\":38524},\"properties\":[{\"property_id\":\"M4870759275\",\"listing_id\":\"2923772011\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/525-Borden-Ave-D3_Long-Island-City_NY_11101_M48707-59275\",\"prop_type\":\"condo\",\"prop_sub_type\":\"condos\",\"address\":{\"city\":\"Long Island City\",\"line\":\"5-19 Borden Ave Unit 3D\",\"postal_code\":\"11101\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Queens\",\"fips_code\":\"36081\",\"lat\":40.741708,\"lon\":-73.955257,\"neighborhood_name\":\"Long Island City\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Realmart Realty Llc\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":1229000,\"baths_full\":2,\"baths\":2,\"beds\":2,\"building_size\":{\"size\":1059,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"1489539\",\"id\":\"1489539\",\"photo\":{\"href\":\"https://ap.rdcpix.com/218362871/5036d26b17e1a11d7d77d6b94a9646cda-c0od-r7_w110.jpg\"},\"name\":\"Qizhan Jack Yao Buyer Rebate Realtor\"}],\"office\":{\"id\":\"93d4dd81e471cdd6116a62b648d68e62\",\"name\":\"Realmart Realty Llc\"},\"last_update\":\"2020-11-25T07:00:04Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":20,\"thumbnail\":\"https://ap.rdcpix.com/9fadf4505813cd4ee911229f55f5e94dl-m3766914200x.jpg\",\"page_no\":1,\"rank\":1,\"list_tracking\":\"type|property|data|prop_id|4870759275|list_id|2923772011|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|property_status|product_code|advantage_code^1|1|0|1|VXC3|1TVUM|35T|G|1^^$0|1|2|$3|4|5|6|7|I|8|J|9|$A|K|B|L]|C|$D|M|E|N]|F|O|G|P|H|Q]]\",\"mls\":{\"name\":\"ManhattanNY\",\"id\":\"16917\",\"plan_id\":null,\"abbreviation\":\"MANY\",\"type\":\"mls\"}},{\"property_id\":\"M9575695800\",\"listing_id\":\"2923771604\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/443-Classon-Ave_Brooklyn_NY_11238_M95756-95800\",\"prop_type\":\"condo\",\"prop_sub_type\":\"townhomes\",\"address\":{\"city\":\"New York\",\"line\":\"443 Classon Ave\",\"postal_code\":\"11238\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Kings\",\"fips_code\":\"36047\",\"lat\":40.685562,\"lon\":-73.959053,\"neighborhood_name\":\"Northern Brooklyn\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"The Corcoran Group - Bedford Stuyvesant\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":1895000,\"baths_full\":3,\"baths\":3,\"beds\":4,\"building_size\":{\"size\":2560,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"2999753\",\"id\":\"2999753\",\"photo\":null,\"name\":\"Emma James\"}],\"office\":{\"id\":\"c49768fae8edc34a3bd4dbaf67272d70\",\"name\":\"The Corcoran Group - Bedford Stuyvesant\"},\"last_update\":\"2020-11-25T06:01:22Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":0,\"page_no\":1,\"rank\":2,\"list_tracking\":\"type|property|data|prop_id|9575695800|list_id|2923771604|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|property_status|product_code|advantage_code^1|2|0|1|1SAMH|1|G|1^^$0|1|2|$3|4|5|6|7|H|8|I|9|$A|J|B|K]|C|$D|L]|E|M|F|N|G|O]]\",\"mls\":{\"name\":\"CorcoranGroup\",\"id\":\"6191060\",\"plan_id\":null,\"abbreviation\":\"CCRN\",\"type\":\"mls\"}},{\"property_id\":\"M4280915162\",\"listing_id\":\"2923771004\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/416-Ocean-Ave-Apt-37_Brooklyn_NY_11226_M42809-15162\",\"prop_type\":\"condo\",\"prop_sub_type\":\"coop\",\"address\":{\"city\":\"Brooklyn\",\"line\":\"416 Ocean Ave Apt 37\",\"postal_code\":\"11226\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Kings\",\"fips_code\":\"36047\",\"lat\":40.652373,\"lon\":-73.961809,\"neighborhood_name\":\"Central Brooklyn\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Compass\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":750000,\"baths_full\":1,\"baths\":1,\"beds\":2,\"agents\":[{\"primary\":true,\"advertiser_id\":\"2733010\",\"id\":\"2733010\",\"photo\":null,\"name\":\"Terrence Harding\"}],\"office\":{\"id\":\"83ca2d1346e6423497cb1b449c392cb7\",\"name\":\"Compass\"},\"last_update\":\"2020-11-24T23:41:10Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":13,\"thumbnail\":\"https://ap.rdcpix.com/ed7c204e30d26630471b0e27f618f74al-m1745472782x.jpg\",\"page_no\":1,\"rank\":3,\"list_tracking\":\"type|property|data|prop_id|4280915162|list_id|2923771004|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|broker|property_status|product_code|advantage_code^1|3|0|1|1MKSY|196HY|35T|G|1^^$0|1|2|$3|4|5|6|7|I|8|J|9|$A|K|B|L]|C|$D|M|E|N]|F|O|G|P|H|Q]]\",\"mls\":{\"name\":\"REBNY\",\"id\":\"OLRS-540269\",\"plan_id\":null,\"abbreviation\":\"RBNY\",\"type\":\"mls\"}},{\"property_id\":\"M4156223501\",\"listing_id\":\"2923769927\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/126-W-22nd-St-Apt-8N_New-York_NY_10011_M41562-23501\",\"prop_type\":\"condo\",\"prop_sub_type\":\"condos\",\"address\":{\"city\":\"New York\",\"line\":\"126 W 22nd St Apt 8N\",\"postal_code\":\"10011\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"New York\",\"fips_code\":null,\"is_approximate\":true,\"time_zone\":\"America/New_York\",\"lat\":40.742105,\"lon\":-74.000689},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Brown Harris Stevens - 445 Park Avenue\",\"photo\":\"https://ap.rdcpix.com/2097287678/db877cb60c24bd9d24367e4971880881o-c0s.jpg\",\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":3450000,\"baths_full\":2,\"baths\":2,\"beds\":2,\"building_size\":{\"size\":2200,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"4112651\",\"id\":\"4112651\",\"photo\":{\"href\":\"https://ap.rdcpix.com/1312829939/f5aa3e20b4839bd5b2a2133cb610539ca-e0od-r7_w110.jpg\"},\"name\":\"Chris Poore\"}],\"office\":{\"id\":\"8d07f550feb0a2a48a801bce60ae7fe3\",\"name\":\"Brown Harris Stevens - 445 Park Avenue\"},\"last_update\":\"2020-11-23T16:10:53Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":false,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"advantage_pro_flag\":true,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":true,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"advantage_pro\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":0,\"page_no\":1,\"rank\":4,\"list_tracking\":\"type|property|data|prop_id|4156223501|list_id|2923769927|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|4|0|3|2G5CB|1C7U4|17KOD|35T|0|5N2C^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"mls\":{\"name\":\"TerraHoldings\",\"id\":\"BHSR20519290\",\"plan_id\":null,\"abbreviation\":\"TENY\",\"type\":\"mls\"}},{\"property_id\":\"M9278021079\",\"listing_id\":\"2923769929\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/330-3rd-Ave-Apt-10J_New-York_NY_10010_M92780-21079\",\"prop_type\":\"condo\",\"prop_sub_type\":\"coop\",\"address\":{\"city\":\"New York\",\"line\":\"330 Third Ave Unit 10J\",\"postal_code\":\"10010\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"New York\",\"fips_code\":\"36061\",\"lat\":40.73987,\"lon\":-73.982761,\"neighborhood_name\":\"Kips Bay\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Halstead Real Estate - 831 Broadway\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":550000,\"baths_full\":1,\"baths\":1,\"beds\":1,\"building_size\":{\"size\":575,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"1512148\",\"id\":\"1512148\",\"photo\":{\"href\":\"https://ap.rdcpix.com/1174107202/2eb2136f9af6cf3aea46ece0da00e910a-w0od-r7_w110.jpg\"},\"name\":\"Andrew Saracino\"}],\"office\":{\"id\":\"d5a6563f3e8ec1eeb85fe2e36c0c2729\",\"name\":\"Halstead Real Estate - 831 Broadway\"},\"last_update\":\"2020-11-24T11:06:59Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":0,\"page_no\":1,\"rank\":5,\"list_tracking\":\"type|property|data|prop_id|9278021079|list_id|2923769929|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|5|0|1|WES4|1C7YN|17KOB|35T|G|5^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"mls\":{\"name\":\"TerraHoldings\",\"id\":\"HALS20528502\",\"plan_id\":null,\"abbreviation\":\"TENY\",\"type\":\"mls\"}},{\"property_id\":\"M4315772483\",\"listing_id\":\"2923768936\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/75-York-Ave_Staten-Island_NY_10301_M43157-72483\",\"prop_type\":\"multi_family\",\"address\":{\"city\":\"Staten Island\",\"line\":\"75 York Ave\",\"postal_code\":\"10301\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Richmond\",\"fips_code\":\"36085\",\"lat\":40.644791,\"lon\":-74.087959,\"neighborhood_name\":\"New Brighton\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"DIVERSE ESTATES MANAGEMENT LLC\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":550000,\"baths_full\":2,\"baths\":2,\"beds\":5,\"agents\":[{\"primary\":true,\"photo\":null,\"name\":\"Kenyatta King\"}],\"office\":{\"id\":\"6434188f32149f814fc0f4593331cbb4\",\"name\":\"DIVERSE ESTATES MANAGEMENT LLC\"},\"last_update\":\"2020-11-25T02:32:37Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":4,\"thumbnail\":\"https://ap.rdcpix.com/b3ffbb5ee65b87ade0fe8be09e4cc0d5l-m3714109847x.jpg\",\"page_no\":1,\"rank\":6,\"list_tracking\":\"type|property|data|prop_id|4315772483|list_id|2923768936|page|rank|list_branding|listing_agent|listing_office|property_status|product_code|advantage_code^1|6|0|1|35T|G|0^^$0|1|2|$3|4|5|6|7|F|8|G|9|$A|H|B|I]|C|J|D|K|E|L]]\",\"lot_size\":{\"size\":2024,\"units\":\"sqft\"},\"mls\":{\"name\":\"MyStateMLS\",\"id\":\"10955796\",\"plan_id\":null,\"abbreviation\":\"STNY\",\"type\":\"mls\"}},{\"property_id\":\"M3873806781\",\"listing_id\":\"2923768454\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/25-Parade-Pl-Apt-3C_Brooklyn_NY_11226_M38738-06781\",\"prop_type\":\"single_family\",\"prop_sub_type\":\"co_op\",\"address\":{\"city\":\"Brooklyn\",\"line\":\"25 Parade Pl Apt 3C\",\"postal_code\":\"11226\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Kings\",\"fips_code\":\"36047\",\"time_zone\":\"America/New_York\",\"lat\":40.652403,\"lon\":-73.965275,\"neighborhood_name\":\"Central Brooklyn\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"COMPASS\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":695000,\"baths_full\":1,\"baths\":1,\"beds\":2,\"open_houses\":[{\"start_date\":\"2020-11-29T19:00:00.000Z\",\"end_date\":\"2020-11-29T20:30:00.000Z\",\"time_zone\":\"EST\",\"dst\":true}],\"agents\":[{\"primary\":true,\"advertiser_id\":\"2155915\",\"id\":\"2155915\",\"photo\":null,\"name\":\"Helen Chee\"}],\"office\":{\"id\":\"b513c44a4d8c00922c7155d8a90dfde5\",\"name\":\"COMPASS\"},\"last_update\":\"2020-11-25T02:03:07Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":true,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":11,\"thumbnail\":\"https://ap.rdcpix.com/292dfb20297aeab691833b2326b8f706l-m3594899398x.jpg\",\"page_no\":1,\"rank\":7,\"list_tracking\":\"type|property|data|prop_id|3873806781|list_id|2923768454|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|7|0|1|1A7IJ|1QT28|196HY|1|G|5^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"mls\":{\"name\":\"Compass\",\"id\":\"655050245304049\",\"plan_id\":null,\"abbreviation\":\"UCNY\",\"type\":\"mls\"}},{\"property_id\":\"M9152638760\",\"listing_id\":\"2923768436\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/11020-71st-Rd-Apt-901_Forest-Hills_NY_11375_M91526-38760\",\"prop_type\":\"condo\",\"prop_sub_type\":\"coop\",\"virtual_tour\":{\"href\":\"95187\"},\"address\":{\"city\":\"New York\",\"line\":\"110-20 71st Rd Unit 901\",\"postal_code\":\"11375\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Queens\",\"fips_code\":\"36081\",\"lat\":40.721609,\"lon\":-73.840441,\"neighborhood_name\":\"Northwestern Queens\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"The Corcoran Group\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":479000,\"baths_full\":1,\"baths\":1,\"beds\":1,\"agents\":[{\"primary\":true,\"advertiser_id\":\"1826285\",\"id\":\"1826285\",\"photo\":null,\"name\":\"Madeline Castrese\"}],\"office\":{\"id\":\"5fe97fdc45cab763b9f12408b338fac1\",\"name\":\"The Corcoran Group\"},\"last_update\":\"2020-11-25T08:01:22Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":0,\"page_no\":1,\"rank\":8,\"list_tracking\":\"type|property|data|prop_id|9152638760|list_id|2923768436|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|8|0|1|13565|134O2|134NM|1|G|5^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"mls\":{\"name\":\"CorcoranGroup\",\"id\":\"6180085\",\"plan_id\":null,\"abbreviation\":\"CCRN\",\"type\":\"mls\"}},{\"property_id\":\"M3751855129\",\"listing_id\":\"2923768395\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/5730-Mosholu-Ave-Apt-4F_Bronx_NY_10471_M37518-55129\",\"prop_type\":\"condo\",\"prop_sub_type\":\"coop\",\"address\":{\"city\":\"Bronx\",\"line\":\"5730 Mosholu Ave Apt 4F\",\"postal_code\":\"10471\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Bronx\",\"fips_code\":\"36005\",\"lat\":40.905418,\"lon\":-73.89932,\"neighborhood_name\":\"West Bronx\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Compass\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":189000,\"baths_half\":1,\"baths_full\":1,\"baths\":2,\"beds\":1,\"agents\":[{\"primary\":true,\"photo\":null,\"name\":\"Chris Casey\"}],\"office\":{\"id\":\"83ca2d1346e6423497cb1b449c392cb7\",\"name\":\"Compass\"},\"last_update\":\"2020-11-24T20:51:07Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":15,\"thumbnail\":\"https://ap.rdcpix.com/3061cf98559f3af923c7407a865fb015l-m3779068252x.jpg\",\"page_no\":1,\"rank\":9,\"list_tracking\":\"type|property|data|prop_id|3751855129|list_id|2923768395|page|rank|list_branding|listing_agent|listing_office|property_status|product_code|advantage_code^1|9|0|1|35T|G|0^^$0|1|2|$3|4|5|6|7|F|8|G|9|$A|H|B|I]|C|J|D|K|E|L]]\",\"mls\":{\"name\":\"REBNY\",\"id\":\"OLRS-1435067\",\"plan_id\":null,\"abbreviation\":\"RBNY\",\"type\":\"mls\"}},{\"property_id\":\"M4873478100\",\"listing_id\":\"2923767782\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/113-Carroll-St-3_Brooklyn_NY_11231_M48734-78100\",\"prop_type\":\"condo\",\"prop_sub_type\":\"coop\",\"address\":{\"city\":\"Brooklyn\",\"line\":\"113 Carroll St Unit 3\",\"postal_code\":\"11231\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Kings\",\"fips_code\":\"36047\",\"time_zone\":\"America/New_York\",\"lat\":40.682657,\"lon\":-74.001424,\"neighborhood_name\":\"Carroll Gardens\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Compass\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":899000,\"baths_full\":1,\"baths\":1,\"beds\":2,\"open_houses\":[{\"start_date\":\"2020-11-29T15:00:00.000Z\",\"end_date\":\"2020-11-29T18:00:00.000Z\",\"time_zone\":\"EST\",\"dst\":true}],\"agents\":[{\"primary\":true,\"advertiser_id\":\"2294997\",\"id\":\"2294997\",\"photo\":null,\"name\":\"Abigail Palanca\"}],\"office\":{\"id\":\"83ca2d1346e6423497cb1b449c392cb7\",\"name\":\"Compass\"},\"last_update\":\"2020-11-24T20:01:08Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":true,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":7,\"thumbnail\":\"https://ap.rdcpix.com/f52a38d17aece57e546ebe107e51fdfel-m658012972x.jpg\",\"page_no\":1,\"rank\":10,\"list_tracking\":\"type|property|data|prop_id|4873478100|list_id|2923767782|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|broker|property_status|product_code|advantage_code^1|A|0|1|1D6TX|196HY|35T|G|1^^$0|1|2|$3|4|5|6|7|I|8|J|9|$A|K|B|L]|C|$D|M|E|N]|F|O|G|P|H|Q]]\",\"mls\":{\"name\":\"REBNY\",\"id\":\"OLRS-649495\",\"plan_id\":null,\"abbreviation\":\"RBNY\",\"type\":\"mls\"}},{\"property_id\":\"M3024953176\",\"listing_id\":\"2923766028\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/130-Oceana-Dr-W-Apt-1A_Brooklyn_NY_11235_M30249-53176\",\"prop_type\":\"condo\",\"prop_sub_type\":\"condos\",\"address\":{\"city\":\"Brooklyn\",\"line\":\"130 Oceana Dr W Apt 1A\",\"postal_code\":\"11235\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Kings\",\"fips_code\":\"36047\",\"lat\":40.575679,\"lon\":-73.958807,\"neighborhood_name\":\"Brighton Beach\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"DIAMOND REAL INC\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":2250000,\"baths_full\":3,\"baths\":3,\"beds\":3,\"building_size\":{\"size\":1800,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"2276351\",\"id\":\"2276351\",\"photo\":null,\"name\":\"Irina Herman\"}],\"office\":{\"id\":\"61e5a0a33fdd0ab03b65d83a2803f426\",\"name\":\"DIAMOND REAL INC\"},\"last_update\":\"2020-11-24T23:52:37Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":1,\"thumbnail\":\"https://ap.rdcpix.com/d175c51fa0cbb31776570ff4e4ffaef8l-m939502534x.jpg\",\"page_no\":1,\"rank\":11,\"list_tracking\":\"type|property|data|prop_id|3024953176|list_id|2923766028|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|property_status|product_code|advantage_code^1|B|0|1|1CSFZ|35T|G|1^^$0|1|2|$3|4|5|6|7|H|8|I|9|$A|J|B|K]|C|$D|L]|E|M|F|N|G|O]]\",\"mls\":{\"name\":\"MyStateMLS\",\"id\":\"10955774\",\"plan_id\":null,\"abbreviation\":\"STNY\",\"type\":\"mls\"}},{\"property_id\":\"M4319196578\",\"listing_id\":\"2923765556\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/24227-88th-Dr_Bellerose_NY_11426_M43191-96578\",\"prop_type\":\"single_family\",\"address\":{\"city\":\"Jamaica\",\"line\":\"242-27 88th Dr\",\"postal_code\":\"11426\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Queens\",\"fips_code\":\"36081\",\"lat\":40.728619,\"lon\":-73.724373,\"neighborhood_name\":\"Northeastern Queens\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Douglas Elliman - Roslyn\",\"photo\":\"https://ap.rdcpix.com/458023381/1b229f7ad5d6b64cdbedb4b4bb5f0200g-c0s.jpg\",\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":299000,\"baths_full\":2,\"baths\":2,\"beds\":3,\"agents\":[{\"primary\":true,\"advertiser_id\":\"3041907\",\"id\":\"3041907\",\"photo\":{\"href\":\"https://ap.rdcpix.com/1006143419/7ac5109fa70881927018f42caa64800ea-w0od-r7_w110.jpg\"},\"name\":\"Richard Drury\"}],\"office\":{\"id\":\"f2288b68e63163d7277b83d97aa4351c\",\"name\":\"Douglas Elliman - Roslyn\"},\"last_update\":\"2020-11-25T00:52:37Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":false,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"advantage_pro_flag\":true,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":true,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"advantage_pro\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":4,\"thumbnail\":\"https://ap.rdcpix.com/ae30837f09f460e3bb4db985d81177afl-m3174688555x.jpg\",\"page_no\":1,\"rank\":12,\"list_tracking\":\"type|property|data|prop_id|4319196578|list_id|2923765556|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|C|0|3|1T75F|1CTKJ|1CTLE|35T|0|5N2D^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"lot_size\":{\"size\":2850,\"units\":\"sqft\"},\"mls\":{\"name\":\"MyStateMLS\",\"id\":\"10955783\",\"plan_id\":null,\"abbreviation\":\"STNY\",\"type\":\"mls\"}},{\"property_id\":\"M4015652971\",\"listing_id\":\"2923764749\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/702-Ocean-Ter_Staten-Island_NY_10301_M40156-52971\",\"prop_type\":\"single_family\",\"address\":{\"city\":\"Staten Island\",\"line\":\"702 Ocean Ter\",\"postal_code\":\"10301\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Richmond\",\"fips_code\":\"36085\",\"lat\":40.608088,\"lon\":-74.101268,\"neighborhood_name\":\"Emerson Hill\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Tom Crimmins Realty, Ltd.\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":759000,\"baths_half\":1,\"baths_full\":3,\"baths\":4,\"beds\":3,\"building_size\":{\"size\":2365,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"3185275\",\"id\":\"3185275\",\"photo\":null,\"name\":\"Laura Mooney\"}],\"office\":{\"id\":\"106b20660a38e24d0848a16c3e142848\",\"name\":\"Tom Crimmins Realty, Ltd.\"},\"last_update\":\"2020-11-24T17:44:33Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":19,\"thumbnail\":\"https://ap.rdcpix.com/df7ed5e6a329aea52e794e77b09b2fcel-m3674279683x.jpg\",\"page_no\":1,\"rank\":13,\"list_tracking\":\"type|property|data|prop_id|4015652971|list_id|2923764749|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|property_status|product_code|advantage_code^1|D|0|1|1W9RV|TP93|35T|G|1^^$0|1|2|$3|4|5|6|7|I|8|J|9|$A|K|B|L]|C|$D|M|E|N]|F|O|G|P|H|Q]]\",\"lot_size\":{\"size\":2829,\"units\":\"sqft\"},\"mls\":{\"name\":\"StatenIsland\",\"id\":\"1142327\",\"plan_id\":null,\"abbreviation\":\"SINY\",\"type\":\"mls\"}},{\"property_id\":\"M9967403027\",\"listing_id\":\"2923764680\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/21-W-20th-St_New-York_NY_10011_M99674-03027\",\"prop_type\":\"condo\",\"prop_sub_type\":\"condos\",\"address\":{\"city\":\"Manhattan\",\"line\":\"21 W 20th St Unit Ph\",\"postal_code\":\"10011\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"New York\",\"fips_code\":\"36061\",\"time_zone\":\"America/New_York\",\"lat\":40.740513,\"lon\":-73.99238,\"neighborhood_name\":\"Flatiron District\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"COMPASS\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":12995000,\"baths_half\":1,\"baths_full\":2,\"baths\":3,\"beds\":3,\"building_size\":{\"size\":2710,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"3821709\",\"id\":\"3821709\",\"photo\":null,\"name\":\"Rachel Glazer\"}],\"office\":{\"id\":\"b513c44a4d8c00922c7155d8a90dfde5\",\"name\":\"COMPASS\"},\"last_update\":\"2020-11-25T05:02:40Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_new_construction\":true,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":23,\"thumbnail\":\"https://ap.rdcpix.com/ad55e4d05c4fa03723485bafee3409fel-m100372568x.jpg\",\"page_no\":1,\"rank\":14,\"list_tracking\":\"type|property|data|prop_id|9967403027|list_id|2923764680|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|E|0|1|29WUL|1QT28|196HY|1|G|5^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"mls\":{\"name\":\"Compass\",\"id\":\"649361762512827\",\"plan_id\":null,\"abbreviation\":\"UCNY\",\"type\":\"mls\"}},{\"property_id\":\"M9994482629\",\"listing_id\":\"2923764169\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/183-Vanderbilt-Ave_Brooklyn_NY_11205_M99944-82629\",\"prop_type\":\"condo\",\"prop_sub_type\":\"townhomes\",\"address\":{\"city\":\"Brooklyn\",\"line\":\"183 Vanderbilt Ave\",\"postal_code\":\"11205\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Kings\",\"fips_code\":\"36047\",\"time_zone\":\"America/New_York\",\"lat\":40.692585,\"lon\":-73.969464,\"neighborhood_name\":\"Northwestern Brooklyn\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Halstead Real Estate - 770 Lexington Avenue\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":2500000,\"baths_full\":2,\"baths\":2,\"beds\":2,\"building_size\":{\"size\":1900,\"units\":\"sqft\"},\"open_houses\":[{\"start_date\":\"2020-11-29T17:30:00.000Z\",\"end_date\":\"2020-11-29T19:00:00.000Z\",\"time_zone\":\"EST\",\"dst\":true}],\"agents\":[{\"primary\":true,\"advertiser_id\":\"2251063\",\"id\":\"2251063\",\"photo\":{\"href\":\"https://ap.rdcpix.com/1778967701/8903acdc26f389d1d3808035d05e2d61a-w0od-r7_w110.jpg\"},\"name\":\"Joanna Mayfield Marks\"}],\"office\":{\"id\":\"f1c5f675b6b0be5c161cac4697f80199\",\"name\":\"Halstead Real Estate - 770 Lexington Avenue\"},\"last_update\":\"2020-11-25T09:50:29Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":true,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":12,\"thumbnail\":\"https://ap.rdcpix.com/c89bb7a71cbd9843060af92ea620ffcfl-m3298203543x.jpg\",\"page_no\":1,\"rank\":15,\"list_tracking\":\"type|property|data|prop_id|9994482629|list_id|2923764169|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|F|0|1|1C8XJ|17KOC|17KOB|35T|G|5^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"lot_size\":{\"size\":2831400,\"units\":\"sqft\"},\"mls\":{\"name\":\"RealPlus\",\"id\":\"HALS20503901\",\"plan_id\":null,\"abbreviation\":\"RPNY\",\"type\":\"mls\"}},{\"property_id\":\"M3340473640\",\"listing_id\":\"2923764171\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/3238-Tibbett-Ave_Bronx_NY_10463_M33404-73640\",\"prop_type\":\"single_family\",\"address\":{\"city\":\"Bronx\",\"line\":\"3238 Tibbett Ave\",\"postal_code\":\"10463\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Bronx\",\"fips_code\":\"36005\",\"lat\":40.882681,\"lon\":-73.906053,\"neighborhood_name\":\"West Bronx\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Halstead Real Estate - 770 Lexington Avenue\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":899000,\"baths_half\":1,\"baths_full\":3,\"baths\":4,\"beds\":4,\"building_size\":{\"size\":2310,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"2033260\",\"id\":\"2033260\",\"photo\":null,\"name\":\"Vicki Green\"}],\"office\":{\"id\":\"f1c5f675b6b0be5c161cac4697f80199\",\"name\":\"Halstead Real Estate - 770 Lexington Avenue\"},\"last_update\":\"2020-11-25T09:50:29Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":16,\"thumbnail\":\"https://ap.rdcpix.com/825b1baace8b5f8b51eb8139f3b13fd6l-m1011216517x.jpg\",\"page_no\":1,\"rank\":16,\"list_tracking\":\"type|property|data|prop_id|3340473640|list_id|2923764171|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|G|0|1|17KVG|17KOC|17KOB|35T|G|5^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"mls\":{\"name\":\"RealPlus\",\"id\":\"HALS20496339\",\"plan_id\":null,\"abbreviation\":\"RPNY\",\"type\":\"mls\"}},{\"property_id\":\"M3158519940\",\"listing_id\":\"2923764170\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/9-E-92nd-St_New-York_NY_10128_M31585-19940\",\"prop_type\":\"condo\",\"prop_sub_type\":\"townhomes\",\"address\":{\"city\":\"New York\",\"line\":\"9 E 92nd St\",\"postal_code\":\"10128\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"New York\",\"fips_code\":\"36061\",\"lat\":40.785212,\"lon\":-73.956731,\"neighborhood_name\":\"Upper East Side\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"BHSR - Brown Harris Stevens\",\"photo\":\"https://p.rdcpix.com/v02/o6e051f00-c0s.gif\",\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":15500000,\"baths_half\":1,\"baths_full\":7,\"baths\":8,\"beds\":7,\"building_size\":{\"size\":7205,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"1512777\",\"id\":\"1512777\",\"photo\":{\"href\":\"https://ap.rdcpix.com/1997152434/d5a3a7b06b5be2def79195e5048123b2a-w0od-r7_w110.jpg\"},\"name\":\"Paula Del Nunzio\"}],\"office\":{\"id\":\"d53036ddaf9b94939abb1c375e7e47d2\",\"name\":\"BHSR - Brown Harris Stevens\"},\"last_update\":\"2020-11-25T09:50:29Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":false,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"advantage_pro_flag\":true,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":true,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"advantage_pro\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":14,\"thumbnail\":\"https://ap.rdcpix.com/926633b4a815bc338d1613faa90c1d7bl-m2980845518x.jpg\",\"page_no\":1,\"rank\":17,\"list_tracking\":\"type|property|data|prop_id|3158519940|list_id|2923764170|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|H|0|3|WF9L|17KOE|17KOD|35T|0|5N2D^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"mls\":{\"name\":\"RealPlus\",\"id\":\"BHSR20516367\",\"plan_id\":null,\"abbreviation\":\"RPNY\",\"type\":\"mls\"}},{\"property_id\":\"M9354298074\",\"listing_id\":\"2923763712\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/543-W-122nd-St-21G_New-York_NY_10027_M93542-98074\",\"prop_type\":\"condo\",\"prop_sub_type\":\"condos\",\"address\":{\"city\":\"New York\",\"line\":\"543 W 122nd St Unit 21G\",\"postal_code\":\"10027\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"New York\",\"fips_code\":null,\"is_approximate\":true,\"time_zone\":\"America/New_York\",\"lat\":40.812345,\"lon\":-73.956183},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Halstead Real Estate - 770 Lexington Avenue\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":3240000,\"baths_half\":1,\"baths_full\":2,\"baths\":3,\"beds\":3,\"building_size\":{\"size\":1864,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"3428808\",\"id\":\"3428808\",\"photo\":null,\"name\":\"Vandewater Sales Office\"}],\"office\":{\"id\":\"f1c5f675b6b0be5c161cac4697f80199\",\"name\":\"Halstead Real Estate - 770 Lexington Avenue\"},\"last_update\":\"2020-11-24T17:07:26Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":false,\"is_new_plan\":false,\"is_new_construction\":true,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"is_pending\":true,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":11,\"thumbnail\":\"https://ap.rdcpix.com/abf25ae5d4aa45d0fe7147731df59d3bl-m2688829198x.jpg\",\"page_no\":1,\"rank\":18,\"list_tracking\":\"type|property|data|prop_id|9354298074|list_id|2923763712|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|I|0|1|21HOO|1C7YR|17KOB|6BL|G|5^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"mls\":{\"name\":\"TerraHoldings\",\"id\":\"HALS19382930\",\"plan_id\":null,\"abbreviation\":\"TENY\",\"type\":\"mls\"}},{\"property_id\":\"M4133504542\",\"listing_id\":\"2923763717\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/119-W-71st-St-Apt-3A_New-York_NY_10023_M41335-04542\",\"prop_type\":\"condo\",\"prop_sub_type\":\"coop\",\"address\":{\"city\":\"New York\",\"line\":\"119 W 71st St Apt 3A\",\"postal_code\":\"10023\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"New York\",\"fips_code\":\"36061\",\"lat\":40.777232,\"lon\":-73.979896,\"neighborhood_name\":\"Upper West Side\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Brown Harris Stevens - 445 Park Avenue\",\"photo\":\"https://ap.rdcpix.com/2097287678/db877cb60c24bd9d24367e4971880881o-c0s.jpg\",\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":2195000,\"baths_full\":2,\"baths\":2,\"beds\":3,\"agents\":[{\"primary\":true,\"advertiser_id\":\"1513021\",\"id\":\"1513021\",\"photo\":{\"href\":\"https://ap.rdcpix.com/598970474/b90d6b942bb0be3abae47c9c35e165c7a-w0od-r7_w110.jpg\"},\"name\":\"Juliana Frei\"}],\"office\":{\"id\":\"8d07f550feb0a2a48a801bce60ae7fe3\",\"name\":\"Brown Harris Stevens - 445 Park Avenue\"},\"last_update\":\"2020-11-24T17:07:26Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":false,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"advantage_pro_flag\":true,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":true,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"advantage_pro\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":18,\"thumbnail\":\"https://ap.rdcpix.com/a0afdff6be3140592b2f62a3a254b79bl-m3036265745x.jpg\",\"page_no\":1,\"rank\":19,\"list_tracking\":\"type|property|data|prop_id|4133504542|list_id|2923763717|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|J|0|3|WFGD|1C7U4|17KOD|35T|0|5N2D^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"mls\":{\"name\":\"TerraHoldings\",\"id\":\"BHSR20489220\",\"plan_id\":null,\"abbreviation\":\"TENY\",\"type\":\"mls\"}},{\"property_id\":\"M3602297699\",\"listing_id\":\"2923763738\",\"rdc_web_url\":\"https://www.realtor.com/realestateandhomes-detail/525-W-235th-St-Apt-5E_Bronx_NY_10463_M36022-97699\",\"prop_type\":\"condo\",\"prop_sub_type\":\"coop\",\"address\":{\"city\":\"Bronx\",\"line\":\"525 W 235th St Apt 5E\",\"postal_code\":\"10463\",\"state_code\":\"NY\",\"state\":\"New York\",\"county\":\"Bronx\",\"fips_code\":\"36005\",\"lat\":40.88558,\"lon\":-73.908329,\"neighborhood_name\":\"West Bronx\"},\"branding\":{\"listing_office\":{\"list_item\":{\"name\":\"Halstead Real Estate - 3531 Johnson Avenue\",\"photo\":null,\"phone\":null,\"slogan\":null,\"show_realtor_logo\":false,\"link\":null,\"accent_color\":null}}},\"prop_status\":\"for_sale\",\"price\":419000,\"baths_full\":2,\"baths\":2,\"beds\":2,\"building_size\":{\"size\":1175,\"units\":\"sqft\"},\"agents\":[{\"primary\":true,\"advertiser_id\":\"3397031\",\"id\":\"3397031\",\"photo\":null,\"name\":\"Julia Gran\"}],\"office\":{\"id\":\"982dd1673031fb85ec4589d3cd1ed2b1\",\"name\":\"Halstead Real Estate - 3531 Johnson Avenue\"},\"last_update\":\"2020-11-24T17:07:26Z\",\"client_display_flags\":{\"presentation_status\":\"for_sale\",\"is_showcase\":false,\"lead_form_phone_required\":true,\"price_change\":0,\"is_co_broke_email\":true,\"has_open_house\":false,\"is_co_broke_phone\":false,\"is_new_listing\":true,\"is_new_plan\":false,\"is_turbo\":false,\"is_office_standard_listing\":false,\"suppress_map_pin\":false,\"show_contact_a_lender_in_lead_form\":false,\"show_veterans_united_in_lead_form\":false,\"is_showcase_choice_enabled\":false},\"lead_forms\":{\"form\":{\"name\":{\"required\":true,\"minimum_character_count\":1},\"email\":{\"required\":true,\"minimum_character_count\":5},\"phone\":{\"required\":true,\"minimum_character_count\":10,\"maximum_character_count\":11},\"message\":{\"required\":false,\"minimum_character_count\":0},\"show\":true},\"show_agent\":false,\"show_broker\":false,\"show_builder\":false,\"show_contact_a_lender\":false,\"show_veterans_united\":false,\"form_type\":\"classic\",\"lead_type\":\"co_broke\",\"is_lcm_enabled\":false,\"flip_the_market_enabled\":false,\"show_text_leads\":true,\"cashback_enabled\":false,\"smarthome_enabled\":false},\"photo_count\":0,\"page_no\":1,\"rank\":20,\"list_tracking\":\"type|property|data|prop_id|3602297699|list_id|2923763738|page|rank|list_branding|listing_agent|listing_office|advertiser_id|agent|office|broker|property_status|product_code|advantage_code^1|K|0|1|20T5Z|1C7XS|17KOB|35T|G|5^^$0|1|2|$3|4|5|6|7|J|8|K|9|$A|L|B|M]|C|$D|N|E|O|F|P]|G|Q|H|R|I|S]]\",\"mls\":{\"name\":\"TerraHoldings\",\"id\":\"HALS20528882\",\"plan_id\":null,\"abbreviation\":\"TENY\",\"type\":\"mls\"}}]}\n";
System.out.println("DATA: " + data);
//AllDTO all = GSON.fromJson(data, AllDTO.class);
PlaceSearchDTO outer = GSON.fromJson(data, PlaceSearchDTO.class);
System.out.println("OUTHER: " + outer);
System.out.println("OUTHER List: " + outer.candidates.get(0));
}
*/
}
| [
"[email protected]"
]
| |
b7acbe62a03e6b2c5bdf51bcf1a604a61f15ba2c | 50b387462df0c8c85e6addbb2709d1e36cae001c | /demo-test/src/main/java/tk/fulsun/demo/service/ServiceA.java | 32e718aa8654f39bff4c6b4c7f63650eb5a4d686 | []
| no_license | fulsun/springboot-study | d483abefcde086fa1b3b492286e4681a6697c013 | 793903f49ac1e1f9df13fd37ee6e6e1adb66d425 | refs/heads/master | 2023-06-11T01:31:49.883342 | 2021-07-10T15:59:05 | 2021-07-10T15:59:05 | 371,025,883 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | package tk.fulsun.demo.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.fulsun.demo.mapper.UserMapper;
import tk.fulsun.demo.model.User;
/**
* @Description ServiceA
* @Date 2021/6/13
* @Created by 凉月-文
*/
@Service
public class ServiceA {
public void doSomething() {
System.out.println("ServiceA running .... ");
}
@Autowired
private UserMapper userDao;
public User getUserById(Integer id) {
return userDao.selectByPrimaryKey(id);
}
public Integer insertUser(User user) {
return userDao.insert(user);
}
}
| [
"[email protected]"
]
| |
375233d577bfb8f7bdff8c6e8ba19588332e4418 | 65d57fe7ab12c5c7734d9c79a10d7649400ae84b | /app/src/main/java/com/example/shahi/pokemonlist/MainActivity.java | 21f1c2b0b3fae6c781e693eb0d10d335e5041a10 | []
| no_license | Shahil-Patel/Pokedex-App | a1d221004ee8c1e15fffbad396bc01cc183a827b | 818633818ee18ea8e9eaeb6bfc4a552b41086154 | refs/heads/master | 2022-12-22T05:15:50.469398 | 2020-09-23T00:16:48 | 2020-09-23T00:16:48 | 261,318,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,670 | java | package com.example.shahi.pokemonlist;
import android.app.Activity;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
ListView list;
ArrayList<String> a;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
list=findViewById(R.id.list);
a=new ArrayList<>();
a.add("Abra");
a.add("Magikarp");
a.add("Eevee");
a.add("Flareon");
a.add("Jolteon");
a.add("Dialga");
a.add("Palkia");
a.add("Mew");
CustomAdapter adapter=new CustomAdapter(this,R.layout.custom_layout,a);
list.setAdapter(adapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(MainActivity.this,position+"",Toast.LENGTH_SHORT).show();
}
});
}
public class CustomAdapter extends ArrayAdapter<String>
{
Context context;
int resource;
List<String> list;
public CustomAdapter(@NonNull Context context, int resource, @NonNull List<String> objects) {
super(context, resource, objects);
this.context=context;
this.resource=resource;
this.list=objects;
}
@NonNull
@Override
public View getView(final int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater inflator=(LayoutInflater)context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
View adapterLayout=inflator.inflate(resource,null);
TextView textView=adapterLayout.findViewById(R.id.textView);
final TextView textView2=adapterLayout.findViewById(R.id.textView2);
Button button=adapterLayout.findViewById(R.id.button);
ImageView imageView=adapterLayout.findViewById(R.id.imageView);
textView.setText(a.get(position));
if(position==0){
imageView.setImageResource(R.drawable.abra);
textView2.setText("This pokemon is acutally useless as its only move is teleport");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView2.setText("Evolves into pretty dope pokemon");
}
});
}
if(position==1){
imageView.setImageResource(R.drawable.magikarp);
textView2.setText("Literaly is a steaming pile of crap that splashes water everywhere");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView2.setText("Evolves into a really good Pokemon");
}
});
}
if(position==2){
imageView.setImageResource(R.drawable.eevee);
textView2.setText("Best pokemon hands down");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView2.setText("Has like 10 different evolutions adding on to his coolness");
}
});
}
if(position==3){
imageView.setImageResource(R.drawable.flareon);
textView2.setText("Just a powerful fire version of Eevee");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView2.setText("Is attack oriented");
}
});
}
if(position==4){
imageView.setImageResource(R.drawable.jolteon);
textView2.setText("Like Eevee is he/she was Thor");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView2.setText("Is speed oriented");
}
});
}
if(position==5){
imageView.setImageResource(R.drawable.dialga);
textView2.setText("Bends time like am absolute madlad");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView2.setText("Is like a god in the Pokemon universe");
}
});
}
if(position==6){
imageView.setImageResource(R.drawable.palkia);
textView2.setText("Bends space like a fricken baller");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView2.setText("Fights Dialga I think");
}
});
}
if(position==7){
imageView.setImageResource(R.drawable.mew);
textView2.setText("Honestly super overrated and is pretty grabage");
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
textView2.setText("MewTwo has Mew's DNA");
}
});
}
return adapterLayout;
}
}
}
| [
"[email protected]"
]
| |
8f90a0040920f59486d0a515bed0168a5f540f90 | f6666aa94888c77e44bd46ef265a02d4efafc28e | /src/com/ibm/training/qpa/UserProfile.java | 3a28aba9876946462102154c22ad110c553610c1 | []
| no_license | queryposting/queryPostingApp | e38239332e01f04efa7d4b892ebd6364c00db417 | a790dda02f4cafc661d7c72e4934f65500b45e2c | refs/heads/master | 2020-06-06T21:50:43.078939 | 2019-06-20T06:23:38 | 2019-06-20T06:23:38 | 192,860,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | package com.ibm.training.qpa;
import java.sql.ResultSet;
import javax.servlet.ServletContext;
import com.ibm.training.qpa.model.QueryDao;
public class UserProfile {
QueryDao dao = new QueryDao();
public ResultSet fetchUser(int userId, ServletContext context) {
return dao.fetchUser(userId, context);
}
}
| [
"[email protected]"
]
| |
e568ec333d5a66a101ed2026b19430b15d4d351e | daef0dae12f712a14cc235f1821f907a247b6521 | /src/edu/FreeParking.java | 66e3b64432088822c28b41ec0686a30dbb819768 | []
| no_license | sergiopnvds/Monopoly | 77cfaf6902a961defd955959113b0f73bfeb4481 | cd6fd0e7f45a451e452f351887d2809f87dd84b3 | refs/heads/master | 2021-01-11T02:41:44.916075 | 2016-10-14T17:26:50 | 2016-10-14T17:26:50 | 70,932,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package edu;
/**
* The class ChanceSpace extends BasicSpace and controls the Free Parking space
*
* @author: Sergio Penavades Suarez
* @version: 1
*/
public class FreeParking extends BasicSpace{
/**
* The method onLand performs the space operation
* @param game contains the Monopoly board and the actual state
*/
@Override
public void onLand(Monopoly game, Integer... dice) {
}
}
| [
"[email protected]"
]
| |
0925264b07699a88a715f4145716ae245d1e7095 | dbc258080422b91a8ff08f64146261877e69d047 | /java-opensaml2-2.3.1/src/main/java/org/opensaml/samlext/saml2mdquery/impl/AttributeQueryDescriptorTypeImpl.java | 9a64fd2cffb07ad1a7d3b0cce8e22e5cc096b960 | []
| no_license | mayfourth/greference | bd99bc5f870ecb2e0b0ad25bbe776ee25586f9f9 | f33ac10dbb4388301ddec3ff1b130b1b90b45922 | refs/heads/master | 2020-12-05T02:03:59.750888 | 2016-11-02T23:45:58 | 2016-11-02T23:45:58 | 65,941,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,648 | java | /*
* Copyright [2006] [University Corporation for Advanced Internet Development, Inc.]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.opensaml.samlext.saml2mdquery.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.xml.namespace.QName;
import org.opensaml.saml2.metadata.AttributeConsumingService;
import org.opensaml.saml2.metadata.Endpoint;
import org.opensaml.samlext.saml2mdquery.AttributeQueryDescriptorType;
import org.opensaml.xml.XMLObject;
import org.opensaml.xml.util.XMLObjectChildrenList;
/**
* Concrete implementation of {@link AttributeQueryDescriptorType}.
*/
public class AttributeQueryDescriptorTypeImpl extends QueryDescriptorTypeImpl implements AttributeQueryDescriptorType {
/** Attribute consuming endpoints. */
private XMLObjectChildrenList<AttributeConsumingService> attributeConsumingServices;
/**
* Constructor.
*
* @param namespaceURI the namespace the element is in
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
protected AttributeQueryDescriptorTypeImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
attributeConsumingServices = new XMLObjectChildrenList<AttributeConsumingService>(this);
}
/** {@inheritDoc} */
public List<AttributeConsumingService> getAttributeConsumingServices() {
return attributeConsumingServices;
}
/** {@inheritDoc} */
public List<Endpoint> getEndpoints() {
return new ArrayList<Endpoint>();
}
/** {@inheritDoc} */
public List<Endpoint> getEndpoints(QName type) {
return null;
}
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
ArrayList<XMLObject> children = new ArrayList<XMLObject>();
children.addAll(super.getOrderedChildren());
children.addAll(attributeConsumingServices);
return Collections.unmodifiableList(children);
}
} | [
"[email protected]"
]
| |
e77adddaaf49250a7752c8ab9a181da88552450e | b6c127b1f852f34018d278901ad758c8e4c3b58e | /frontend/src/main/java/com/geh/frontend/controllers/SearchPatientMvcController.java | ec6dd5e2dbdd0992979c3397c59f796c76c4d219 | []
| no_license | vboutchkova/sbgehch4 | 30ace39d1ec8bd0f7807f343805a6fc0aa2de6bc | d9de6b19b102d9de666cf282fa9cae58659d1c5d | refs/heads/master | 2021-04-15T12:52:14.817181 | 2018-03-25T20:45:43 | 2018-03-25T20:45:43 | 126,736,789 | 0 | 0 | null | 2018-03-25T20:45:44 | 2018-03-25T20:22:28 | Java | UTF-8 | Java | false | false | 4,531 | java | package com.geh.frontend.controllers;
import java.util.List;
import org.bson.types.ObjectId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.geh.bc.SearchPatientsBusinessController;
import com.geh.frontend.dtos.PatientDetailsEditDto;
import com.geh.frontend.dtos.PatientListDto;
import com.geh.frontend.mappers.PatientEntityToDetailsDtoMapper;
import com.geh.frontend.mappers.PatientEntityToDtoListMapper;
import com.geh.mongodb.morphia.dao.HospitalizationDAO;
import com.geh.mongodb.morphia.entities.Patient;
/**
* Frontend Controller handling the search of patients
*
* @author Vera Boutchkova
*/
@Controller
public class SearchPatientMvcController {
private static Logger logger = LoggerFactory.getLogger(SearchPatientMvcController.class);
@Value("${spring.application.name}")
String appName;
@Autowired
private HospitalizationDAO hospDao;
@Autowired
private SearchPatientsBusinessController searchBC;
@Autowired
private PatientEntityToDtoListMapper mapper;
@Autowired
private PatientEntityToDetailsDtoMapper mapperEntityToDto;
/**
* Returns a patient for a given ID
*
* @param patientId
* @param model
* @return
*/
@RequestMapping(method = RequestMethod.GET, value = "/patient/{patientId}")
public String getPatient(@PathVariable ObjectId patientId, Model model) {
Patient patient = searchBC.getById(patientId);
PatientDetailsEditDto patientDto = mapperEntityToDto.map(patient);
model.addAttribute("patient", patientDto);
MvcControllerUtils.setModelForHospitalizationsList(model, patient, hospDao);
return "hospitalizationsList";
}
/**
* Returns all the Patients with given personal number passed with the "keyword"
* with paging. The patients are returned as a list to be displayed in html.
*
* @param keyword
* @param page
* @param size
* @param model
* @return
*/
@RequestMapping(method = RequestMethod.GET, value = "/patients")
public String searchAndListGet(@RequestParam String personalNumber, @RequestParam int page, @RequestParam int size,
Model model) {
return searchAndListPatients(personalNumber, page, size, model);
}
/**
* Executes a search of patient by personal number and returns a paged result
*/
@RequestMapping(method = RequestMethod.POST, value = "/patients")
public String searchAndListPost(@RequestParam String personalNumber, @RequestParam int page, @RequestParam int size,
Model model) {
return searchAndListPatients(personalNumber, page, size, model);
}
private String searchAndListPatients(String personalNumber, int page, int size, Model model) {
Page<Patient> patientsPage;
String showView = "patientsList";
personalNumber = personalNumber.trim();
patientsPage = searchBC.findByPersonalNumberAndPageSubstring(personalNumber, page, size);
List<PatientListDto> displayList = mapper.mapList(patientsPage.getContent());
model.addAttribute("patientsIds", displayList);
if (!patientsPage.getContent().isEmpty()) {
PatientDetailsEditDto patientDto = mapperEntityToDto.map(patientsPage.getContent().get(0));
model.addAttribute("patient", patientDto);
}
if (patientsPage.getTotalElements() == 1) {
// Redirect to hospitalizations list
MvcControllerUtils.setModelForHospitalizationsList(model, patientsPage.getContent().get(0), hospDao);
showView = "hospitalizationsList";
} else {
addPageAttributes(personalNumber, page, size, model, patientsPage);
}
return showView;
}
private void addPageAttributes(String personalNumber, int page, int size, Model model, Page<?> entitiesPage) {
model.addAttribute("totalElements", entitiesPage.getTotalElements());
model.addAttribute("totalPages", entitiesPage.getTotalPages());
model.addAttribute("personalNumber", personalNumber);
model.addAttribute("currentPage", page);
model.addAttribute("pageSize", size);
model.addAttribute("patientsPage", entitiesPage);
}
}
| [
"[email protected]"
]
| |
2266e3ee68592ff4f83acbec209d78052648461b | 5d7b7c9c49c3808bb638b986a00a87dabb3f4361 | /boot/single-angular-swagger-jpa-typescript/src/main/java/com/omnicns/medicine/domain/CorpGrpAuth.java | 8f20f338cafaadee41a6331ba5e032c614820110 | []
| no_license | kopro-ov/lib-spring | f4e67f8d9e81f9ec4cfbf190e30479013a2bcc1c | 89e7d4b9a6318138d24f81e4e0fc2646f2d6a3d5 | refs/heads/master | 2023-04-04T07:56:14.312704 | 2021-02-15T01:59:59 | 2021-02-15T01:59:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package com.omnicns.medicine.domain;
import com.omnicns.medicine.domain.base.CorpGrpAuthBase;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Getter @Setter @EqualsAndHashCode(callSuper=false) @Entity @Table(name = "T_CORP_GRP_AUTH")
public class CorpGrpAuth extends CorpGrpAuthBase {
@ManyToOne
@JoinColumn(name="AUTH_ID" , referencedColumnName = "AUTH_ID", insertable = false, updatable = false)
private Auth auth;
}
| [
"[email protected]"
]
| |
4e805b52e1f165436ea02466aca015b0a4ca90df | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/neo4j/testing/498/IndexProviders.java | da4bfb4fff8e31a010f0719c5c8e897b11f08c86 | []
| no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,236 | java | /*
* Copyright (c) 2002-2018 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.spi.legacyindex;
import org.neo4j. kernel.spi.explicitindex.IndexImplementation;
/**
* Registry of currently active index implementations. Indexing extensions should register the implementation
* here on startup, and unregister it on stop.
* @deprecated removed in 4.0
*/
@Deprecated
public interface IndexProviders
{
void registerIndexProvider( String name, IndexImplementation index );
boolean unregisterIndexProvider( String name );
}
| [
"[email protected]"
]
| |
b300f1827a48e233dd465d1fc66d43e36432a393 | 2dc712da5659abb91fe271908cb3269a19d4283d | /src/main/java/action/UploadAction.java | e1de69ae29f29922d09fdd457968d3cc74fed895 | []
| no_license | fuhuacn/free_board | 84f8816bbdbb16aa14cd061c284e9231273e76f4 | 7a7cb64f4f88e1b0030eaec6bb5dcdbfcd179608 | refs/heads/master | 2020-05-23T16:57:12.670538 | 2019-09-20T15:51:52 | 2019-09-20T15:51:52 | 186,858,474 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,223 | java | package action;
import com.opensymphony.xwork2.Action;
import constants.Constants;
import entity.FilelistEntity;
import manager.FilelistManager;
import manager.UploadfileManager;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import com.opensymphony.xwork2.ActionContext;
public class UploadAction extends BaseAction {
private File uploadFile;
private String uploadFileContentType; //得到文件的类型
private String uploadFileFileName; //得到文件的名称
private List<Map> files = new ArrayList<>();
final static Logger logger = Logger.getLogger(UploadAction.class);
private List<FilelistEntity> filelistEntityList=new ArrayList<>();
private Integer page = 0;
private long endPage;
private Integer pageSize = 20;
private long count;
private Integer size=20;
private String result;
private Integer id;
private String modifiedTime;
private String fullName;
private String fileName;
private String value;
@Override
public String execute() throws Exception {
String filePath = Constants.PICURL;
File file = new File(filePath);
if (!file.exists()) file.mkdirs();
try {
//保存文件
String randomUri = UUID.randomUUID().toString();
FileUtils.copyFile(uploadFile, new File(file, randomUri + uploadFileFileName));
FilelistEntity filelistEntity=new FilelistEntity();
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date=new Date();
modifiedTime=format.format(date);
filelistEntity.setModifiedTime(modifiedTime);
filelistEntity.setFullName(randomUri+uploadFileFileName);
filelistEntity.setFileName(uploadFileFileName);
FilelistManager.save(filelistEntity);
} catch (IOException e) {
e.printStackTrace();
}
return SUCCESS;
}
public String listFiles() {
if(page == 0 && ActionContext.getContext().getSession().containsKey("currentPage")){
page = (Integer) ActionContext.getContext().getSession().get("currentPage");
}
ActionContext.getContext().getSession().remove("currentPage");
//获取pathName的File对象
String pathName = Constants.PICURL;
File dirFile = new File(pathName);
//判断该文件或目录是否存在,不存在时在控制台输出提醒
if (!dirFile.exists()) {
logger.error("do not exist");
return null;
}
//获取此目录下的所有文件名与目录名
File[] fileList=dirFile.listFiles();
Arrays.sort(fileList, new UploadfileManager.compratorByLastModified());
// String[] fileList = dirFile.list();
logger.info("size:" + fileList.length);
count=fileList.length;
if(count%this.pageSize > 0) {
this.endPage = count/this.pageSize + 1;
}
else {
this.endPage = count/this.pageSize;
}
long index=(page+1)*20;
if(index>count){
index=count;
}
for (int i = page*20; i < index ; i++) {
//遍历文件目录
// String string = fileList[i];
//File("documentName","fileName")是File的另一个构造器
// File file = new File(dirFile.getPath(), string);
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String name = fileList[i].getName();
Long modifiedTime = fileList[i].lastModified();
Date d = new Date(modifiedTime);
Map param = new HashMap();
param.put("fullName", name);
if(name.length()>36){
param.put("name", name.substring(36,name.length()));
}else {
param.put("name",name);
}
param.put("modifiedTime", format.format(d));
files.add(param);
}
return SUCCESS;
}
//从数据库中查找
public String findFileInDatabase(){
if(page == 0 && ActionContext.getContext().getSession().containsKey("currentPage")){
page = (Integer) ActionContext.getContext().getSession().get("currentPage");
}
ActionContext.getContext().getSession().remove("currentPage");
count=FilelistManager.countAll();
if(count%this.pageSize > 0) {
this.endPage = count/this.pageSize + 1;
}
else {
this.endPage = count/this.pageSize;
}
filelistEntityList=FilelistManager.findByProperty(null,page,size,"id",false);
System.out.println(filelistEntityList.size());
return Action.SUCCESS;
}
//删除文件
public String deleteFile(){
logger.info("ready for delete "+uploadFileFileName);
try {
String pathName = Constants.PICURL;
File file = new File(pathName+"/"+uploadFileFileName);
if (!file.exists()) {
logger.info("do not exist");
return null;
}
if(file.delete()) {
logger.info("delete successfully "+uploadFileFileName);
}else {
logger.info("delete failed "+uploadFileFileName);
}
FilelistManager.deleteById(id);
} catch(Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String strs = sw.toString();
logger.info(strs);
}
return SUCCESS;
}
//更新数据库
public String updateFileDatabase(){
List<FilelistEntity> filelistEntities=new ArrayList<>();
truncateFile();
String pathName = Constants.PICURL;
File dirFile = new File(pathName);
//判断该文件或目录是否存在,不存在时在控制台输出提醒
if (!dirFile.exists()) {
logger.error("do not exist");
return Action.ERROR;
}
//获取此目录下的所有文件名与目录名
File[] fileList=dirFile.listFiles();
Arrays.sort(fileList, new UploadfileManager.compratorByLastModified());
Collections.reverse(Arrays.asList(fileList));
// String[] fileList = dirFile.list();
logger.info("size:" + fileList.length);
for (int i = 0; i < fileList.length; i++) {
//遍历文件目录
// String string = fileList[i];
//File("documentName","fileName")是File的另一个构造器
// File file = new File(dirFile.getPath(), string);
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String name = fileList[i].getName();
Long modifiedTime = fileList[i].lastModified();
Date d = new Date(modifiedTime);
// Map param = new HashMap();
FilelistEntity filelistEntity=new FilelistEntity();
filelistEntity.setFullName(name);
//param.put("fullName", name);
if(name.length()>36){
filelistEntity.setFileName(name.substring(36,name.length()));
// param.put("name", name.substring(36,name.length()));
}else {
filelistEntity.setFileName(name);
// param.put("name",name);
}
filelistEntity.setModifiedTime(format.format(d));
// param.put("modifiedTime", format.format(d));
// files.add(param);
// FilelistManager.save(filelistEntity);
filelistEntities.add(filelistEntity);
}
FilelistManager.save(filelistEntities);
result="success";
return Action.SUCCESS;
}
//清空数据库文件
private void truncateFile(){
FilelistManager.truncateFile();
}
//模糊查询
public String fuzzySearch(){
if(page == 0 && ActionContext.getContext().getSession().containsKey("currentPage")){
page = (Integer) ActionContext.getContext().getSession().get("currentPage");
}
ActionContext.getContext().getSession().remove("currentPage");
count=FilelistManager.countFuzzyAll(value);
if(count%this.pageSize > 0) {
this.endPage = count/this.pageSize + 1;
}
else {
this.endPage = count/this.pageSize;
}
logger.info("fuzzy count:"+count);
filelistEntityList=FilelistManager.fuzzyFindByFullName(value,page,size,"id",false);
return Action.SUCCESS;
}
public File getUploadFile() {
return uploadFile;
}
public void setUploadFile(File uploadFile) {
this.uploadFile = uploadFile;
}
public String getUploadFileContentType() {
return uploadFileContentType;
}
public void setUploadFileContentType(String uploadFileContentType) {
this.uploadFileContentType = uploadFileContentType;
}
public List<Map> getFiles() {
return files;
}
public void setFiles(List<Map> files) {
this.files = files;
}
public String getUploadFileFileName() {
return uploadFileFileName;
}
public void setUploadFileFileName(String uploadFileFileName) {
this.uploadFileFileName = uploadFileFileName;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public long getEndPage() {
return endPage;
}
public void setEndPage(long endPage) {
this.endPage = endPage;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public long getCount() {
return count;
}
public void setCount(long count) {
this.count = count;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public List<FilelistEntity> getFilelistEntityList() {
return filelistEntityList;
}
public void setFilelistEntityList(List<FilelistEntity> filelistEntityList) {
this.filelistEntityList = filelistEntityList;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getModifiedTime() {
return modifiedTime;
}
public void setModifiedTime(String modifiedTime) {
this.modifiedTime = modifiedTime;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
| [
"[email protected]"
]
| |
0d85eb26ef9b79d51883307b8f27b5825795a094 | 469739b5144bbfc1e900f7a57e0021b8b262c926 | /src/main/java/com/cjrj/edu/service/RoleService.java | 3c7f00da558fd5453d0adbc71716305781ad2fa2 | []
| no_license | 1035761024/Educational | 752d9f93dbce45dc3b060ffaac6cc8806ff64d8d | 00831e2cf4a6bf8ba823ad1ea9f0b6b4383e557e | refs/heads/master | 2021-08-06T20:57:43.421408 | 2017-11-07T01:18:44 | 2017-11-07T01:18:44 | 108,806,041 | 0 | 0 | null | 2017-10-30T05:31:52 | 2017-10-30T05:31:52 | null | UTF-8 | Java | false | false | 163 | java | package com.cjrj.edu.service;
import com.cjrj.edu.entity.Role;
import java.util.Set;
public interface RoleService {
Set<Role> findRoles(String username);
}
| [
"[email protected]"
]
| |
cce75993c08541f1cfe8b2c434ac6225f1a3520a | cdcf82659f546017601f7328e67ca1df293081d4 | /src/info/gridworld/actor/ActorWorld.java | 26d978a42d670f233489c930ebbf318f922b19b5 | []
| no_license | nirwin/Skyteam | 7131cbec79d6f19d34360d42c9a9ac8c7dff05a5 | 1786ebcf72a26d207639f77a2dd5a6fd2735e587 | refs/heads/master | 2020-03-13T08:22:20.936850 | 2018-05-22T03:39:25 | 2018-05-22T03:39:25 | 131,042,586 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,993 | java | /*
* AP(r) Computer Science GridWorld Case Study:
* Copyright(c) 2005-2006 Cay S. Horstmann (http://horstmann.com)
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* @author Cay Horstmann
*/
package info.gridworld.actor;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Collections;
import info.gridworld.grid.Grid;
import info.gridworld.grid.Location;
import info.gridworld.world.World;
/**
* An <code>ActorWorld</code> is occupied by actors. <br />
* This class is not tested on the AP CS A and AB exams.
*/
public class ActorWorld extends World<Actor> {
private static final String DEFAULT_MESSAGE = "Click on a grid location to construct or manipulate an actor.";
/**
* Constructs an actor world with a default grid.
*/
public ActorWorld() {
super();
}
public ActorWorld(BufferedImage backgroundImage) {
super(backgroundImage);
}
/**
* Constructs an actor world with a given grid.
*
* @param grid
* the grid for this world.
*/
public ActorWorld(Grid<Actor> grid) {
this(grid, null);
}
public ActorWorld(Grid<Actor> g, BufferedImage backgroundImage) {
super(g, backgroundImage);
}
public void show() {
if (getMessage() == null)
setMessage(DEFAULT_MESSAGE);
super.show();
}
public void step() {
Grid<Actor> gr = getGrid();
ArrayList<Actor> actors = new ArrayList<Actor>();
for (Location loc : gr.getOccupiedLocations())
actors.add(gr.get(loc));
// Not a part of the default GridWorld, but used for capture the flag
Collections.shuffle(actors);
for (Actor a : actors) {
// only act if another actor hasn't removed a
if (a.getGrid() == gr)
a.act();
}
}
/**
* Adds an actor to this world at a given location.
*
* @param loc
* the location at which to add the actor
* @param occupant
* the actor to add
*/
public void add(Location loc, Actor occupant) {
occupant.putSelfInGrid(getGrid(), loc);
}
/**
* Adds an occupant at a random empty location.
*
* @param occupant
* the occupant to add
*/
public void add(Actor occupant) {
Location loc = getRandomEmptyLocation();
if (loc != null)
add(loc, occupant);
}
/**
* Removes an actor from this world.
*
* @param loc
* the location from which to remove an actor
* @return the removed actor, or null if there was no actor at the given
* location.
*/
public Actor remove(Location loc) {
Actor occupant = getGrid().get(loc);
if (occupant == null)
return null;
occupant.removeSelfFromGrid();
return occupant;
}
} | [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.