blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 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 684M ⌀ | 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 132 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 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
63c273bd6f6e559a0506f1f5a16c18d5b6aa3d64 | e980453b5fc18b3730cda88dd43b58987f54bb63 | /src/day08_casting_scanner/ScannerIntro.java | 9b4fb25e8721b972d03141568aea82800be3991a | [] | no_license | mmiakhel/java-programming | 993cbdc6675f28e38cad7d2e4df7393481b9f144 | 4cc99c7761e383642a29e5251d00b3ca3a9fc26f | refs/heads/master | 2023-06-15T02:43:24.260212 | 2021-07-15T03:10:57 | 2021-07-15T03:10:57 | 365,539,389 | 0 | 0 | null | 2021-06-05T21:05:55 | 2021-05-08T14:47:54 | Java | UTF-8 | Java | false | false | 347 | java | package day08_casting_scanner;
import java.util.Scanner;
public class ScannerIntro {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Please enter your name:");
String firstName = scan.next();
System.out.println("nice to meet you, " + firstName);
}
}
| [
"mmiakhel@gmail.com"
] | mmiakhel@gmail.com |
f767d52a2729b114acd2a874294a4263ce6225ae | f2fe7f580ba240476a1279a5c18c052e734f8c22 | /src/io/RegexDelimitedParser.java | bd4c59bcb951c5e892a5c2e1093a3baec4e8ee0c | [
"Apache-2.0"
] | permissive | martingraham/JSwingPlus | 57a7a3e5a1630193c89e2e581587985595ad403b | ae6d4a985a38eb75da6671812dbd9fefb20f1148 | refs/heads/master | 2016-08-05T09:51:02.020985 | 2015-09-22T16:05:05 | 2015-09-22T16:05:05 | 42,943,398 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,847 | java | package io;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import org.apache.log4j.Logger;
import util.Messages;
public class RegexDelimitedParser {
private final static Logger LOGGER = Logger.getLogger (RegexDelimitedParser.class);
protected final RegexReader regexReader;
CSVColumnObj columns;
public static void main (final String[] args) {
InputStream inStream = null;
try {
inStream = DataPrep.getInstance().getInputStream (args[0]);
} catch (FileNotFoundException e) {
LOGGER.error (e.toString(), e);
}
final RegexReader regexReader = new RegexReader (inStream, Messages.getString ("regex", "CSV_REGEX"));
if (regexReader != null) {
//RegexDelimitedParser rReader = new RegexDelimitedParser (fr, true);
String[] dataRow;
try {
while (!((dataRow = regexReader.readAndSplitLine()) == null)) {
for (Object obj : dataRow) {
LOGGER.debug ("["+obj+"] ");
}
}
} catch (IOException e) {
LOGGER.error (e);
}
}
}
public RegexDelimitedParser (final RegexReader in, final boolean readHeaders) {
regexReader = in;
columns = new CSVColumnObj ();
if (readHeaders) {
try {
final String[] al = regexReader.readAndSplitLine();
if (al != null) {
for (int n = 0; n < al.length; n++) {
columns.getColumnHeaderIndices().put (al [n], Integer.valueOf (n));
}
columns.getColumnList().addAll (Arrays.asList (al));
}
} catch (IOException e) {
LOGGER.error (e);
}
}
}
void dealWithCommentLine (List<String> strings) {}
public CSVColumnObj getColumnsObj () { return columns; }
}
| [
"embers01"
] | embers01 |
c4607c012a686ce14588d254f217fcf2f3ea7172 | a8fa9b4707cb3f1f36ecaecec16ef04e57d0cbcd | /topStar/src/main/java/big/proj/aws/App.java | c4a6ecdb6eecf9e564c4e81c7a8f7950a2d51321 | [] | no_license | AshutoshMahala/AmazonCustomerReviewAnalysis | 694e721addf5168a09c32452363b1602bfcfa98b | ceca2f1971ae4cf32ef18d476d4d00869bd354b1 | refs/heads/master | 2020-12-26T23:11:55.027681 | 2020-02-01T21:56:33 | 2020-02-01T21:56:33 | 237,681,258 | 0 | 0 | null | 2020-10-13T19:12:58 | 2020-02-01T21:36:22 | Java | UTF-8 | Java | false | false | 3,494 | java | package big.proj.aws;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.IntWritable;
// import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
// import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println("Starting!");
Instant start = Instant.now();
Configuration conf1 = new Configuration();
String inPath = args[0];
String midPath = args[1];
String outPath = args[2];
try{
Job job1 = Job.getInstance(conf1, "Avg Star");
job1.setJarByClass(App.class);
job1.setMapperClass(AverageStarMapper.class);
// job1.setCombinerClass(AverageStarReducer.class);
job1.setReducerClass(AverageStarReducer.class);
job1.setInputFormatClass(TextInputFormat.class);
job1.setOutputFormatClass(TextOutputFormat.class);
job1.setMapOutputKeyClass(Text.class);
job1.setMapOutputValueClass(CompositeValue.class);
job1.setOutputKeyClass(Text.class);
job1.setOutputValueClass(CompositeValue.class);
FileInputFormat.addInputPath(job1, new Path(inPath));
FileOutputFormat.setOutputPath(job1, new Path(midPath));
// Delete the result folder if present
FileSystem fs = FileSystem.get(conf1);
fs.delete(new Path(midPath),true);
int n = job1.waitForCompletion(true) ? 0 : 1;
Instant end = Instant.now();
Duration timeElapsed = Duration.between(start, end);
System.out.println("Time taken: "+ timeElapsed.toMillis() +" milliseconds");
}catch(Exception e){
e.printStackTrace();
}
try{
Job job2 = Job.getInstance(conf1,"star top");
job2.setJarByClass(App.class);
job2.setMapperClass(TopStarMap.class);
job2.setReducerClass(TopStarReduce.class);
job2.setInputFormatClass(TextInputFormat.class);
job2.setOutputFormatClass(TextOutputFormat.class);
job2.setMapOutputKeyClass(Text.class);
job2.setMapOutputValueClass(DoubleWritable.class);
job2.setOutputKeyClass(Text.class);
job2.setOutputValueClass(DoubleWritable.class);
FileInputFormat.addInputPath(job2,new Path(midPath));
FileOutputFormat.setOutputPath(job2,new Path(outPath));
// Delete result folder if exists
FileSystem fs = FileSystem.get(conf1);
fs.delete(new Path(outPath), true);
int n = job2.waitForCompletion(true)? 0: 1;
Instant end = Instant.now();
Duration timeElapsed = Duration.between(start, end);
System.out.println("Time taken: "+ timeElapsed.toMillis() +" milliseconds");
System.exit(n);
}catch(Exception e){
e.printStackTrace();
}
}
}
| [
"ashutoshmahala@live.com"
] | ashutoshmahala@live.com |
ac48e31057ce8fd4603b3f955e5036c6d5b501a7 | 0d98e84c2cc3b702ed30030b98f71a46f638bf56 | /src/main/java/structuralpattern/facadepattern/Stock.java | 7dd352710109504463423cffae4a087e17afc221 | [] | no_license | rsun07/Design_Pattern | 1cf55c063588b94871714387276481b4168ee17b | 48a301b9e8f176a0ee836d8f43f47d40c398fb2b | refs/heads/master | 2023-04-01T22:45:45.787420 | 2019-07-23T20:06:22 | 2019-07-23T20:06:22 | 124,569,614 | 0 | 0 | null | 2021-03-31T19:06:25 | 2018-03-09T17:03:30 | Java | UTF-8 | Java | false | false | 177 | java | package structuralpattern.facadepattern;
public class Stock implements Investment {
@Override
public void trade() {
System.out.println("Invest Stock");
}
}
| [
"rsun2014@gmail.com"
] | rsun2014@gmail.com |
6c9e62cd890dffaf625525a57dc369cf13baace3 | 312cae83cc27c108d17919618d4df97674ffd805 | /sts02/src/main/java/com/bit/day02/controller/IndexController.java | 626c01b4a83ce420ed24a586766269eeb24fb5a7 | [] | no_license | lim-doyoung/Spring2019 | 22b31f48ec99672a0d8822364e1dd37e508ab62c | 26b02511781b0bb4c0a26bb022870ac3c59d3179 | refs/heads/master | 2022-12-21T10:51:30.355836 | 2019-07-31T02:38:49 | 2019-07-31T02:38:49 | 198,587,835 | 0 | 0 | null | 2022-12-16T09:59:29 | 2019-07-24T08:03:24 | JavaScript | GB18030 | Java | false | false | 835 | java | package com.bit.day02.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
public class IndexController implements Controller{
// Logger log=Logger.getLogger(IndexCotroller.class);
Logger log=Logger.getLogger(this.getClass()); //按眉甫 嘛绢陈阑嫐 荤侩
public IndexController() {
System.out.println("index create....");
}
@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
// TODO Auto-generated method stub
log.debug("index...");
ModelAndView mav=new ModelAndView();
mav.setViewName("index"); //立加且 林家 捞抚
return mav;
}
}
| [
"isdsadas1234@gmail.com"
] | isdsadas1234@gmail.com |
f2a432a83cf5cfaf2b3b9bc4e7fffe5990766a7f | 1d43a4deff6abc4926acfc933f065692dbac78da | /src/test/java/test/TestClass3.java | 105a19f5c51ff931f4d2f576deb338bf593ceb89 | [] | no_license | Sonender/Comparision | 1c75e8849baaa350bbf296b29814d5e0baa802a4 | 44bb12ee2264f00bc753d89d2981f82d4fdb833f | refs/heads/master | 2020-12-30T14:19:37.213711 | 2017-05-15T07:17:36 | 2017-05-15T07:17:36 | 91,305,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 862 | java |
package test;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import pages.MakeMyTripPage;
import pages.OneMore;
import pages.ForBangalore;
import pages.ForKerala;
import pages.ForJaipur1;
import pages.IbiboTest;
public class TestClass3 {
RemoteWebDriver driver;
ForBangalore page = new ForBangalore();
@BeforeClass
public RemoteWebDriver initilizeBrowser()
{
driver=page.initializeBrowser("chrome");
return driver;
}
@AfterClass
public void closeBrowser()
{
page.closeBrowser();
}
@Test
public void runTest1()
{
try{
page.InitializeBookingBangalore(driver);
page.runTest();
}
catch(Exception e)
{System.out.println("Error"+e);}
}
}
| [
"sonender.singh@Administrators-MacBook-Air-62.local"
] | sonender.singh@Administrators-MacBook-Air-62.local |
cf4f907aebd39df39ac507af434b7368ceca5e63 | ec649c006c51aec1e039eb627ac21f1e3d399618 | /src/main/java/com/dxc/git/controller/SimpleController.java | be73dae332329d649afb9130defe2e596254bac7 | [] | no_license | sahi3/Assignment | eea2f16418f76e577a01a47006176124fbc95f00 | 6fd2d7f2f5f281ff816f80f925791a1ccd70fc89 | refs/heads/master | 2020-05-24T20:37:15.057045 | 2019-05-19T10:24:42 | 2019-05-19T10:24:42 | 187,458,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 963 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.dxc.git.controller;
import com.dxc.git.persistence.repo.BookRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @author gino
*/
@Controller
@RestController
@RequestMapping("/welcome")
public class SimpleController {
@Value("${spring.application.name}")
String appName;
@Autowired
BookRepository repo;
@GetMapping("/")
public String homePage(Model model) {
model.addAttribute("appName", appName);
return "home";
}
}
| [
"katukuri-sahithi@dxc.com"
] | katukuri-sahithi@dxc.com |
b32f5d304cfacfc079c0cdfc27367c7a0a899e12 | d745e9a72c6fdf9a2631f5436dcdf98dab1a8a46 | /gimnasio-backend/src/main/java/co/edu/uniandes/baco/gimnasio/persistence/EjercicioInstanciaPersistence.java | 8293aab1e34100ea12ab6d9cccbc29cb3b9fcbba | [
"MIT"
] | permissive | Uniandes-ISIS2603-backup/201720-s3_gimnasio | 99d9a191a6157adc8098012c050d9d217abbf4d2 | f24ccec40799805f0e95b84537742bfbd1a62f7c | refs/heads/master | 2021-03-27T11:10:39.260973 | 2017-11-30T17:29:23 | 2017-11-30T17:29:23 | 101,682,505 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 598 | 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 co.edu.uniandes.baco.gimnasio.persistence;
import co.edu.uniandes.baco.gimnasio.entities.EjercicioInstanciaEntity;
import javax.ejb.Stateless;
/**
*
* @author jc.bojaca
*/
@Stateless
public class EjercicioInstanciaPersistence extends BasePersistence<EjercicioInstanciaEntity> {
public EjercicioInstanciaPersistence() {
super(EjercicioInstanciaEntity.class);
}
}
| [
"jc.bojaca@ISIS2603S3-0023.sis.virtual.uniandes.edu.co"
] | jc.bojaca@ISIS2603S3-0023.sis.virtual.uniandes.edu.co |
179fe5ba9373b4da779e35bac801f030849a073c | d78f10d875476f977d236cad91647e5ea2e90c9d | /src/main/java/org/bmn/parts/auto/directory/model/Part.java | 4f8101f95b139a9d75373745dd0f99695a0b3a2f | [] | no_license | BMNcode/parts.auto.directory | 72674858066373af5bf421959bbd9d14c1bcadab | ccf74112235490893ed2b7b017aa7043e168a248 | refs/heads/master | 2023-06-03T01:01:23.495760 | 2021-05-26T08:33:20 | 2021-05-26T08:33:20 | 377,434,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 908 | java | package org.bmn.parts.auto.directory.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "part")
public class Part {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", nullable = false)
private Long id;
@Column(name = "article", nullable = false)
private String article;
@Column(name = "part_name", nullable = false)
private String partName;
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "part_models",
joinColumns = @JoinColumn(name = "parts_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "models_id", referencedColumnName = "id"))
private List<Model> models;
@ManyToOne
@JoinColumn(name = "category_id", nullable = false)
private Category category;
}
| [
"happymax@list.ru"
] | happymax@list.ru |
dd7a322ab51699d67288b744bc8021e57cb19595 | f643eb2bffea8995b057f01347ccf9ff63e85344 | /7.1_code/apps-edoc/com/seeyon/v3x/edoc/domain/EdocRegister.java | 7bdd17b011f2edef5b0337bb9b77c59218350637 | [] | no_license | AirSkye/A-8-code | 13598ff31d554ec68f1e677c2f9284931594d0c9 | 008c6d21dd8c9b406c16fc86b899534b712121c4 | refs/heads/master | 2023-07-18T10:54:24.056687 | 2021-03-16T03:02:41 | 2021-03-16T03:02:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,986 | java | package com.seeyon.v3x.edoc.domain;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.seeyon.ctp.common.po.filemanager.Attachment;
import com.seeyon.ctp.util.Datetimes;
import com.seeyon.ctp.util.Strings;
import com.seeyon.v3x.common.domain.BaseModel;
import com.seeyon.v3x.edoc.constants.EdocNavigationEnum;
import com.seeyon.ctp.util.IdentifierUtil;
/**
* 公文登记对象
* @author 唐桂林 2011.09.27
*/
public class EdocRegister extends BaseModel implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2987994269664372485L;
public static final int AUTO_REGISTER = 1;
/**
*
*/
public static final int REGISTER_TYPE_BY_PAPER_REC_EDOC = 100; //新建纸质收文时,登记表中也插入数据并设置该状态,不在登记表中显示
/**
* 标志位, 共100位,采用枚举的自然顺序
*/
protected static enum INENTIFIER_INDEX{
HAS_ATTACHMENTS, // 是否有附件
};
/** 标志位 */
private String identifier;
/** 签收单ID */
private Long recieveId = 0L;
/** 来文公文ID */
private Long edocId = 0L;
/** 登记单类型 0发文登记 1收文登记 */
private Integer edocType = 0;
/** 登记方式 1电子公文登记 2纸质公文登记 3二维码公文登记 */
private Integer registerType = 0;
/** 创建人Id */
private Long createUserId = 0L;
/** 创建人名字 */
private String createUserName;
/** 创建时间 */
private java.sql.Timestamp createTime;
/** 修改时间 */
private java.sql.Timestamp updateTime;
/** 来文单位 */
private String sendUnit;
/** 来文单位id */
private Long sendUnitId = 0L;
/** 来文类型 1内部单位 2外部单位 */
private Integer sendUnitType = 0;
/** 成文单位 */
private String edocUnit;
/** 成文单位id */
private String edocUnitId;
/** 成文日期 发文最后一个签发节点的处理日期,如果没有签发节点,用封发日期 */
private java.sql.Date edocDate;
/** 登记人id */
private Long registerUserId = 0L;
/** 登记人 */
private String registerUserName;
/** 登记日期 */
private java.sql.Date registerDate;
/** 签发人id */
private Long issuerId = 0L;
/** 签发人 */
private String issuer;
/** 签发日期 */
private java.sql.Date issueDate;
/** 会签人 */
private String signer;
/** 分发人id */
private Long distributerId = -1L;
/** 是否代理 */
private boolean proxy;
private Long proxyId;
/** 代理人 */
private String proxyName;
private String proxyLabel;
/** 代理人 Id*/
private Long proxyUserId;
/** 分发人 */
private String distributer;
/** 分发时间 */
private java.sql.Date distributeDate;
/** 分发状态 0草稿箱 1待分发 2已分发 */
private Integer distributeState = 0;
/** 分发关联公文id */
private Long distributeEdocId = 0L;
/** 标题 */
private String subject;
/** 公文类型-来自系统枚举值 */
private String docType;
/** 行文类型- 来自系统枚举值 */
private String sendType;
/** 来文字号 */
private String docMark;
/** 收文编号 */
private String serialNo;
/** 文件密级 */
private String secretLevel;
/** 紧急程度 */
private String urgentLevel;
/** 保密期限 */
private String keepPeriod;
/** 主送单位 */
private String sendTo;
/** 主送单位id */
private String sendToId;
/** 抄送单位 */
private String copyTo;
/** 主送单位id */
private String copyToId;
/** 主题词 */
private String keywords;
/** 印发份数 */
private Integer copies;
/** 附注 */
private String noteAppend;
/** 附件说明 */
private String attNote;
/** 登记状态 0草稿箱 1待登记 2已登记 3退回给签收 4被退回 5删除 */
private Integer state = 0;
/** 登记单位 */
private Long orgAccountId = 0L;
/** 签收时间 */
private java.sql.Timestamp recTime;
/** 交换机关类型 0部门 1单位(非数据库字段) */
private int exchangeType;
/** 交换机关id (非数据库字段) */
private long exchangeOrgId;
/** 是否有附件 */
private boolean hasAttachments;
/** 公文级别 */
private String unitLevel;
/** 送文日期 */
private java.sql.Timestamp exchangeSendTime;
/** 交换方式:区分往外发送的方式(内部公文交换又叫致远交换、书生公文交换) */
private Integer exchangeMode =0;
/** 附件 */
private List<Attachment> attachmentList = new ArrayList<Attachment>();
/** 正文 */
private RegisterBody registerBody = null;
private Integer isRetreat = 0;//是否被退回
private Integer autoRegister;//是否自动登记(V5-G6版本使用,但A8中也有这个字段)
private Long recieveUserId; //签收人id
private String recieveUserName; //签收人名称
public Long getRecieveUserId() {
return recieveUserId;
}
public void setRecieveUserId(Long recieveUserId) {
this.recieveUserId = recieveUserId;
}
public String getRecieveUserName() {
return recieveUserName;
}
public void setRecieveUserName(String recieveUserName) {
this.recieveUserName = recieveUserName;
}
public Integer getAutoRegister() {
return autoRegister;
}
public void setAutoRegister(Integer autoRegister) {
this.autoRegister = autoRegister;
}
public String getProxyLabel() {
return proxyLabel;
}
public void setProxyLabel(String proxyLabel) {
this.proxyLabel = proxyLabel;
}
public Integer getIsRetreat() {
return isRetreat;
}
public void setIsRetreat(Integer isRetreat) {
this.isRetreat = isRetreat;
}
public Long getProxyId() {
return proxyId;
}
public void setProxyId(Long proxyId) {
this.proxyId = proxyId;
}
//解析Long值
private Long parseLongVal(HttpServletRequest request, String code, Long defualtValue){
Long ret = defualtValue;
String rValue = request.getParameter(code);
if(Strings.isNotBlank(rValue)){
ret = Long.parseLong(rValue);
}
return ret;
}
//解析Integer值
private Integer parseIntegerVal(HttpServletRequest request, String code, Integer defualtValue){
Integer ret = defualtValue;
String rValue = request.getParameter(code);
if(Strings.isNotBlank(rValue)){
ret = Integer.parseInt(rValue);
}
return ret;
}
//解析String 类型
private String parseStringVal(HttpServletRequest request, String code, String defualtValue){
String ret = defualtValue;
String rValue = request.getParameter(code);
if(Strings.isNotBlank(rValue)){
ret = rValue;
}
return ret;
}
public void bind(HttpServletRequest request) {
this.setId(parseLongVal(request, "id", -1L));
this.setIdentifier(parseStringVal(request, "identifier", "00000000000000000000"));
this.setEdocId(parseLongVal(request, "edocId", -1L));
this.setEdocType(parseIntegerVal(request, "edocType", 1));
this.setRecieveId(parseLongVal(request, "recieveId", -1L));
this.setRegisterType(parseIntegerVal(request, "registerType", EdocNavigationEnum.RegisterType.ByAutomatic.ordinal()));
this.setCreateUserId(parseLongVal(request, "createUserId", -1L));
this.setCreateUserName(parseStringVal(request, "createUserName", ""));
this.setCreateTime(request.getParameter("createTime") == null ? new java.sql.Timestamp(new java.util.Date().getTime()) : Timestamp.valueOf(request.getParameter("createTime")));
this.setUpdateTime(request.getParameter("updateTime") == null ? null : Timestamp.valueOf(request.getParameter("updateTime")));
this.setSendUnit(parseStringVal(request, "sendUnit", ""));
this.setSendUnitId(parseLongVal(request, "sendUnitId", -1L));
this.setSendUnitType(parseIntegerVal(request, "sendUnitType", this.getSendUnitType()));
this.setEdocUnit(parseStringVal(request, "edocUnit", ""));
this.setEdocUnitId(parseStringVal(request, "edocUnitId", ""));
this.setRegisterUserId(parseLongVal(request, "registerUserId", -1L));
this.setRegisterUserName(parseStringVal(request, "registerUserName", ""));
this.setIssuerId(parseLongVal(request, "issuerId", -1L));
this.setIssuer(parseStringVal(request, "issuer", ""));
java.sql.Date date = null;
if(Strings.isNotBlank(request.getParameter("edocDate"))) {
date = new java.sql.Date(Datetimes.parseDatetime(request.getParameter("edocDate")+" 00:00:00").getTime());
}
this.setEdocDate(date);
date = null;
if(Strings.isNotBlank(request.getParameter("registerDate"))) {
date = new java.sql.Date(Datetimes.parseDatetime(request.getParameter("registerDate")+" 00:00:00").getTime());
}
this.setRegisterDate(date);
date = null;
if(Strings.isNotBlank(request.getParameter("issueDate"))) {
date = new java.sql.Date(Datetimes.parseDatetime(request.getParameter("issueDate")+" 00:00:00").getTime());
}
this.setIssueDate(date);
date = null;
if(Strings.isNotBlank(request.getParameter("distributeDate"))) {
date = new java.sql.Date(Datetimes.parseDatetime(request.getParameter("distributeDate")+" 00:00:00").getTime());
}
this.setDistributeDate(date);
this.setRecTime(Strings.isBlank(request.getParameter("recTime")) ? null : Timestamp.valueOf(request.getParameter("recTime")));
this.setSigner(parseStringVal(request, "signer", ""));
this.setDistributerId(parseLongVal(request, "distributerId", -1L));
this.setDistributer(parseStringVal(request, "distributer", ""));
this.setDistributeState(parseIntegerVal(request, "distributeState", 0));
this.setDistributeEdocId(parseLongVal(request, "distributeEdocId", -1L));
this.setSubject(parseStringVal(request, "subject", ""));
this.setDocType(parseStringVal(request, "docType", this.getDocType()));
this.setSendType(parseStringVal(request, "sendType", this.getSendType()));
this.setDocMark(parseStringVal(request, "docMark", ""));
this.setSerialNo(parseStringVal(request, "serialNo", ""));
this.setSecretLevel(parseStringVal(request, "secretLevel", this.getSecretLevel()));
this.setUrgentLevel(parseStringVal(request, "urgentLevel", this.getUrgentLevel()));
this.setKeepPeriod(parseStringVal(request, "keepPeriod", this.getKeepPeriod()));
this.setUnitLevel(parseStringVal(request, "unitLevel", null));
this.setSendTo(parseStringVal(request, "sendTo", ""));
this.setSendToId(parseStringVal(request, "sendToId", ""));
this.setCopyTo(parseStringVal(request, "copyTo", ""));
this.setCopyToId(parseStringVal(request, "copyToId", ""));
this.setKeywords(parseStringVal(request, "keywords", ""));
this.setCopies(parseIntegerVal(request, "registerCopies", null));
this.setNoteAppend(parseStringVal(request, "noteAppend", ""));
this.setAttNote(parseStringVal(request, "attNote", ""));
this.setState(parseIntegerVal(request, "state", 1));
this.setOrgAccountId(parseLongVal(request, "orgAccountId", -1L));
}
/**
* @return distributeEdocId
*/
public Long getDistributeEdocId() {
return distributeEdocId;
}
/**
* @param distributeEdocId
*/
public void setDistributeEdocId(Long distributeEdocId) {
this.distributeEdocId = distributeEdocId;
}
/**
* @return the recTime
*/
public java.sql.Timestamp getRecTime() {
return recTime;
}
/**
* @param recTime the recTime to set
*/
public void setRecTime(java.sql.Timestamp recTime) {
this.recTime = recTime;
}
/**
* @return the exchangeType
*/
public int getExchangeType() {
return exchangeType;
}
/**
* @param exchangeType the exchangeType to set
*/
public void setExchangeType(int exchangeType) {
this.exchangeType = exchangeType;
}
/**
* @return the exchangeOrgId
*/
public long getExchangeOrgId() {
return exchangeOrgId;
}
public Long getProxyUserId() {
return proxyUserId;
}
public void setProxyUserId(Long proxyUserId) {
this.proxyUserId = proxyUserId;
}
/**
* @param exchangeOrgId the exchangeOrgId to set
*/
public void setExchangeOrgId(long exchangeOrgId) {
this.exchangeOrgId = exchangeOrgId;
}
/**
* @param id the id to set
*/
public void setId(long id) {
this.id = id;
}
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @return the identifier
*/
public String getIdentifier() {
return identifier;
}
/**
* @param identifier the identifier to set
*/
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
/**
* @return the recieveId
*/
public Long getRecieveId() {
return recieveId;
}
/**
* @param recieveId the recieveId to set
*/
public void setRecieveId(Long recieveId) {
this.recieveId = recieveId;
}
/**
* @return the edocId
*/
public Long getEdocId() {
return edocId;
}
/**
* @param edocId the edocId to set
*/
public void setEdocId(Long edocId) {
this.edocId = edocId;
}
/**
* @return the edocType
*/
public Integer getEdocType() {
return edocType;
}
/**
* @param edocType the edocType to set
*/
public void setEdocType(Integer edocType) {
this.edocType = edocType;
}
/**
* @return the registerType
*/
public Integer getRegisterType() {
return registerType;
}
/**
* @param registerType the registerType to set
*/
public void setRegisterType(Integer registerType) {
this.registerType = registerType;
}
/**
* @return the createUserId
*/
public Long getCreateUserId() {
return createUserId;
}
/**
* @param createUserId the createUserId to set
*/
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
/**
* @return the createUserName
*/
public String getCreateUserName() {
return createUserName;
}
/**
* @param createUserName the createUserName to set
*/
public void setCreateUserName(String createUserName) {
this.createUserName = createUserName;
}
/**
* @return the createTime
*/
public java.sql.Timestamp getCreateTime() {
return createTime;
}
/**
* @param createTime the createTime to set
*/
public void setCreateTime(java.sql.Timestamp createTime) {
this.createTime = createTime;
}
/**
* @return the updateTime
*/
public java.sql.Timestamp getUpdateTime() {
return updateTime;
}
/**
* @param updateTime the updateTime to set
*/
public void setUpdateTime(java.sql.Timestamp updateTime) {
this.updateTime = updateTime;
}
/**
* @return the sendUnit
*/
public String getSendUnit() {
return sendUnit;
}
/**
* @param sendUnit the sendUnit to set
*/
public void setSendUnit(String sendUnit) {
this.sendUnit = sendUnit;
}
/**
* @return the sendUnitId
*/
public Long getSendUnitId() {
return sendUnitId;
}
/**
* @param sendUnitId the sendUnitId to set
*/
public void setSendUnitId(Long sendUnitId) {
this.sendUnitId = sendUnitId;
}
/**
* @return the sendUnitType
*/
public Integer getSendUnitType() {
return sendUnitType;
}
/**
* @param sendUnitType the sendUnitType to set
*/
public void setSendUnitType(Integer sendUnitType) {
this.sendUnitType = sendUnitType;
}
/**
* @return the edocUnit
*/
public String getEdocUnit() {
return edocUnit;
}
/**
* @param edocUnit the edocUnit to set
*/
public void setEdocUnit(String edocUnit) {
this.edocUnit = edocUnit;
}
/**
* @return the edocUnitId
*/
public String getEdocUnitId() {
return edocUnitId;
}
/**
* @param edocUnitId the edocUnitId to set
*/
public void setEdocUnitId(String edocUnitId) {
this.edocUnitId = edocUnitId;
}
/**
* @return the edocDate
*/
public java.sql.Date getEdocDate() {
return edocDate;
}
/**
* @param edocDate the edocDate to set
*/
public void setEdocDate(java.sql.Date edocDate) {
this.edocDate = edocDate;
}
/**
* @return the registerUserId
*/
public Long getRegisterUserId() {
return registerUserId;
}
/**
* @param registerUserId the registerUserId to set
*/
public void setRegisterUserId(Long registerUserId) {
this.registerUserId = registerUserId;
}
/**
* @return the registerUserName
*/
public String getRegisterUserName() {
return registerUserName;
}
/**
* @param registerUserName the registerUserName to set
*/
public void setRegisterUserName(String registerUserName) {
this.registerUserName = registerUserName;
}
/**
* @return the registerDate
*/
public java.sql.Date getRegisterDate() {
return registerDate;
}
/**
* @param registerDate the registerDate to set
*/
public void setRegisterDate(java.sql.Date registerDate) {
this.registerDate = registerDate;
}
/**
* @return the signer
*/
public String getSigner() {
return signer;
}
/**
* @param signer the signer to set
*/
public void setSigner(String signer) {
this.signer = signer;
}
/**
* @return the issuer
*/
public String getIssuer() {
return issuer;
}
/**
* @param issuer the issuer to set
*/
public void setIssuer(String issuer) {
this.issuer = issuer;
}
/**
* @return the distributerId
*/
public Long getDistributerId() {
return distributerId;
}
/**
* @param distributerId the distributerId to set
*/
public void setDistributerId(Long distributerId) {
this.distributerId = distributerId;
}
/**
* @return the distributer
*/
public String getDistributer() {
return distributer;
}
/**
* @param distributer the distributer to set
*/
public void setDistributer(String distributer) {
this.distributer = distributer;
}
/**
* @return the subject
*/
public String getSubject() {
return subject;
}
/**
* @param subject the subject to set
*/
public void setSubject(String subject) {
this.subject = subject;
}
/**
* @return the docType
*/
public String getDocType() {
return docType;
}
/**
* @param docType the docType to set
*/
public void setDocType(String docType) {
this.docType = docType;
}
/**
* @return the sendType
*/
public String getSendType() {
return sendType;
}
/**
* @param sendType the sendType to set
*/
public void setSendType(String sendType) {
this.sendType = sendType;
}
/**
* @return the docMark
*/
public String getDocMark() {
return docMark;
}
/**
* @param docMark the docMark to set
*/
public void setDocMark(String docMark) {
this.docMark = docMark;
}
/**
* @return the serialNo
*/
public String getSerialNo() {
return serialNo;
}
/**
* @param serialNo the serialNo to set
*/
public void setSerialNo(String serialNo) {
this.serialNo = serialNo;
}
/**
* @return the secretLevel
*/
public String getSecretLevel() {
return secretLevel;
}
/**
* @param secretLevel the secretLevel to set
*/
public void setSecretLevel(String secretLevel) {
this.secretLevel = secretLevel;
}
/**
* @return the urgentLevel
*/
public String getUrgentLevel() {
return urgentLevel;
}
/**
* @param urgentLevel the urgentLevel to set
*/
public void setUrgentLevel(String urgentLevel) {
this.urgentLevel = urgentLevel;
}
/**
* @return the keepPeriod
*/
public String getKeepPeriod() {
return keepPeriod;
}
/**
* @param keepPeriod the keepPeriod to set
*/
public void setKeepPeriod(String keepPeriod) {
this.keepPeriod = keepPeriod;
}
/**
* @return the sendTo
*/
public String getSendTo() {
return sendTo;
}
/**
* @param sendTo the sendTo to set
*/
public void setSendTo(String sendTo) {
this.sendTo = sendTo;
}
/**
* @return the sendToId
*/
public String getSendToId() {
return sendToId;
}
/**
* @param sendToId the sendToId to set
*/
public void setSendToId(String sendToId) {
this.sendToId = sendToId;
}
/**
* @return the copyTo
*/
public String getCopyTo() {
return copyTo;
}
/**
* @param copyTo the copyTo to set
*/
public void setCopyTo(String copyTo) {
this.copyTo = copyTo;
}
/**
* @return the copyToId
*/
public String getCopyToId() {
return copyToId;
}
/**
* @param copyToId the copyToId to set
*/
public void setCopyToId(String copyToId) {
this.copyToId = copyToId;
}
/**
* @return the keywords
*/
public String getKeywords() {
return keywords;
}
/**
* @param keywords the keywords to set
*/
public void setKeywords(String keywords) {
this.keywords = keywords;
}
/**
* @return the noteAppend
*/
public String getNoteAppend() {
return noteAppend;
}
/**
* @param noteAppend the noteAppend to set
*/
public void setNoteAppend(String noteAppend) {
this.noteAppend = noteAppend;
}
/**
* @return the attNote
*/
public String getAttNote() {
return attNote;
}
/**
* @param attNote the attNote to set
*/
public void setAttNote(String attNote) {
this.attNote = attNote;
}
/**
* @return the state
*/
public Integer getState() {
return state;
}
/**
* @param state the state to set
*/
public void setState(Integer state) {
this.state = state;
}
/**
* @return the orgAccountId
*/
public Long getOrgAccountId() {
return orgAccountId;
}
/**
* @return the issuerId
*/
public Long getIssuerId() {
return issuerId;
}
/**
* @param issuerId the issuerId to set
*/
public void setIssuerId(Long issuerId) {
this.issuerId = issuerId;
}
/**
* @return the issueDate
*/
public java.sql.Date getIssueDate() {
return issueDate;
}
/**
* @param issueDate the issueDate to set
*/
public void setIssueDate(java.sql.Date issueDate) {
this.issueDate = issueDate;
}
public boolean isProxy() {
return proxy;
}
public void setProxy(boolean proxy) {
this.proxy = proxy;
}
public String getProxyName() {
return proxyName;
}
public void setProxyName(String proxyName) {
this.proxyName = proxyName;
}
/**
* @param orgAccountId the orgAccountId to set
*/
public void setOrgAccountId(Long orgAccountId) {
this.orgAccountId = orgAccountId;
}
/**
* @return the distributeDate
*/
public java.sql.Date getDistributeDate() {
return distributeDate;
}
/**
* @param distributeDate the distributeDate to set
*/
public void setDistributeDate(java.sql.Date distributeDate) {
this.distributeDate = distributeDate;
}
/**
* @return the distributeState
*/
public Integer getDistributeState() {
return distributeState;
}
/**
* @param distributeState the distributeState to set
*/
public void setDistributeState(Integer distributeState) {
this.distributeState = distributeState;
}
/**
* @return the attachmentList
*/
public List<Attachment> getAttachmentList() {
return attachmentList;
}
/**
* @param attachmentList the attachmentList to set
*/
public void setAttachmentList(List<Attachment> attachmentList) {
this.attachmentList = attachmentList;
}
/**
* @return the edocBodyList
*/
public RegisterBody getRegisterBody() {
return registerBody;
}
/**
* @param edocBody the edocBody to set
*/
public void setRegisterBody(RegisterBody registerBody) {
this.registerBody = registerBody;
}
public boolean getHasAttachments() {
return IdentifierUtil.lookupInner(identifier, EdocSummary.INENTIFIER_INDEX.HAS_ATTACHMENTS.ordinal(), '1');
}
public void setHasAttachments(boolean hasAttachments) {
this.hasAttachments = hasAttachments;
this.identifier = IdentifierUtil.update(this.getIdentifier(), EdocSummary.INENTIFIER_INDEX.HAS_ATTACHMENTS.ordinal(), hasAttachments ? '1' : '0');
}
public String getUnitLevel() {
return unitLevel;
}
public void setUnitLevel(String unitLevel) {
this.unitLevel = unitLevel;
}
public Integer getCopies() {
return copies;
}
public void setCopies(Integer copies) {
this.copies = copies;
}
public java.sql.Timestamp getExchangeSendTime() {
return exchangeSendTime;
}
public void setExchangeSendTime(java.sql.Timestamp exchangeSendTime) {
this.exchangeSendTime = exchangeSendTime;
}
public Integer getExchangeMode() {
return exchangeMode;
}
public void setExchangeMode(Integer exchangeMode) {
this.exchangeMode = exchangeMode;
}
}
| [
"741963634@qq.com"
] | 741963634@qq.com |
082ef10e0058ed5bebbc0006e436fed277b3e4e0 | 793a8adfe7e25e45b7a1fc0a2827aa6b5ffe36f2 | /src/main/java/assignment1/response/ResponseBody.java | 3350b68a0743b43a6abd4663032cc92704de0b52 | [] | no_license | laihaotao/COMP6461 | ddd9a1f065a41a2c8b6ea0a9a637425cf6b9ce85 | 7a1d374c77b84c25fff3e2ffd3c960f6e5402100 | refs/heads/master | 2021-01-23T17:03:43.883830 | 2017-11-30T05:46:59 | 2017-11-30T05:46:59 | 102,753,964 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java | package assignment1.response;
/**
* Author: Eric(Haotao) Lai
* Date: 2017-09-23
* E-mail: haotao.lai@gmail.com
* Website: http://laihaotao.me
*/
public class ResponseBody {
private String content;
public ResponseBody(String str) {
this.content = str;
}
@Override
public String toString() {
return content;
}
}
| [
"haotao.lai@gmail.com"
] | haotao.lai@gmail.com |
732622fb5001a24bb383833743f0a25e96cad41f | 42dd07f872f70cbc1f8378122666b41f6c9d08c1 | /src/test/com/test/JunitTest.java | 573331c35ede39cf6aab884b31d4249b7ce59229 | [] | no_license | probie6/springbootDemo | b3345141ed69a544f39c26199f6f4f9a68d85388 | 6665447a8d269508ddbf9f46e3a9043d40e56bd3 | refs/heads/master | 2020-04-24T00:59:07.327873 | 2019-02-20T02:00:35 | 2019-02-20T02:00:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | /*
package com.test;
import org.joda.time.DateTime;
import org.junit.Test;
import java.io.File;
import java.io.FileWriter;
public class JunitTest {
@Test
public void test() throws Exception{
*/
/*File file = new File("d://log.txt");
String s = DateTime.now().toString("YYYY-MM-dd");
System.out.println(s);
FileWriter fileWriter=new FileWriter(file,true);
fileWriter.write("asdfasdfasdfsadf\r\n");
fileWriter.flush();*//*
}
}
*/
| [
"731746237@qq.com"
] | 731746237@qq.com |
7ccd9d86b5cbbe324665bc90a6c8c3b668fdb3d4 | 61e18036031535c069a12f031cf91578d598ef0f | /fyg-kq-kaoqin/src/main/java/cn/fyg/kq/interfaces/web/module/kqbusi/kaoqin/flow/DistributeSet.java | 3fad1eeae4a4d9319fcb767f8dccec5a89bc125f | [] | no_license | jarod-chan/fyg-kq-process | 2eaa9e09ca372513a31eedf3dd3549d33f73f0e8 | 1006133bad57eef72c20bc9394c5420c52a7130a | refs/heads/master | 2016-09-06T10:04:18.134900 | 2015-07-13T02:17:34 | 2015-07-13T02:17:34 | 38,910,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 360 | java | package cn.fyg.kq.interfaces.web.module.kqbusi.kaoqin.flow;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
public class DistributeSet implements JavaDelegate{
@Override
public void execute(DelegateExecution execution) throws Exception {
// TODO Auto-generated method stub
}
}
| [
"jhon.chen@gmail.com"
] | jhon.chen@gmail.com |
8dd15b9fbad2cb3349c77eae80f96deb4e46f437 | 32e28106e02043778e2c3b06522f85289dbcb6f3 | /src/Uebungsblatt4/Demo.java | e5a4a9dbe2de41518f9efecaa730c56f60441218 | [] | no_license | keni21/UebungsKlausurSS16 | 7d6fd3fcd62857b0b5814224204874a3aba19b48 | 6fbb0af0295e5728bc613f255f6d528a6cfd8a4f | refs/heads/master | 2021-01-01T05:15:28.989291 | 2016-05-08T15:47:55 | 2016-05-08T15:47:55 | 58,069,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,582 | java | package Uebungsblatt4;
import java.util.ArrayList;
public class Demo {
public static void main(String[] args) {
Kredit kredit1=new Kredit("Max Muster", "2014-12-24", 4000, 20, 200);
Kredit kredit2=new Kredit("Mix Muster", "2014-12-26", 5000, 5, 1000);
Kredit kredit3=new Kredit("Mux Muster", "2014-12-24", 7000, 14, 500);
ArrayList<Kredit> listkredit=new ArrayList<>();
listkredit.add(kredit1);
listkredit.add(kredit2);
listkredit.add(kredit3);
Bank list =new Bank(listkredit);
//list.getKredit();
// for (Kredit kredit : listkredit) {
// System.out.println(kredit);
// }
//
// System.out.println("______________________________________________________________________________________________________________________________________________________________________");
// list.getNaechsteKreditFaellig();
// for (Kredit kredit : listkredit) {
// System.out.println(kredit);
// }
// System.out.println("______________________________________________________________________________________________________________________________________________________________________");
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
list.deductAll();
//list.deductAll();
for (Kredit kredit : listkredit) {
System.out.println(kredit);
}
}
}
| [
"david@WINDELL-2VK3UMC.home"
] | david@WINDELL-2VK3UMC.home |
0ff46c2c8b1ad18a90dd5b8512d6d731ab72abbc | 6f437fac5de2ec8b3f19be57f92ffe2ed6757301 | /common-orm/src/main/java/jef/database/datasource/TomcatCpWrapper.java | 44cf44601c558efd220160496e327e346548a091 | [
"Apache-2.0"
] | permissive | azureidea/ef-orm | 9f37015565ea603085179a252594286618f2a6a8 | 8940b4d9727ac33d5e884461185423f2528d71b1 | refs/heads/master | 2021-01-18T07:55:58.301453 | 2016-06-26T16:45:14 | 2016-06-26T16:45:14 | 63,916,124 | 1 | 0 | null | 2016-07-22T02:11:29 | 2016-07-22T02:11:29 | null | UTF-8 | Java | false | false | 1,880 | java | package jef.database.datasource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
import javax.sql.DataSource;
import org.apache.tomcat.jdbc.pool.PoolConfiguration;
public class TomcatCpWrapper extends AbstractDataSource implements DataSourceWrapper{
org.apache.tomcat.jdbc.pool.DataSource datasource;
public TomcatCpWrapper() {
datasource = new org.apache.tomcat.jdbc.pool.DataSource();
}
public String getUrl() {
return datasource.getUrl();
}
public String getUser() {
return datasource.getUsername();
}
public String getPassword() {
return datasource.getPassword();
}
public String getDriverClass() {
return datasource.getDriverClassName();
}
public void setUrl(String url) {
datasource.setUrl(url);
}
public void setUser(String user) {
datasource.setUsername(user);
}
public void setPassword(String password) {
datasource.setPassword(password);
}
public void setDriverClass(String driverClassName) {
datasource.setDriverClassName(driverClassName);
}
public Properties getProperties() {
return new ReflectionProperties(PoolConfiguration.class, datasource.getPoolProperties());
}
public void putProperty(String key, Object value) {
new ReflectionProperties(PoolConfiguration.class, datasource.getPoolProperties()).put(key, value);
}
public Connection getConnection() throws SQLException {
return datasource.getConnection();
}
public Connection getConnection(String username, String password) throws SQLException {
return datasource.getConnection(username, password);
}
public boolean isConnectionPool() {
return true;
}
public void setWrappedDataSource(DataSource ds) {
datasource=(org.apache.tomcat.jdbc.pool.DataSource)ds;
}
@Override
protected Class<? extends DataSource> getWrappedClass() {
return org.apache.tomcat.jdbc.pool.DataSource.class;
}
}
| [
"hzjiyi@gmail.com"
] | hzjiyi@gmail.com |
6bead0c5a4b280361ae793f94c0f20dc4cd878b0 | e81d2ab2b8ea9a4a8b50a89f9843f719c1a592d4 | /abagail/src/main/java/dist/Distribution.java | 0f8fef3ed00a71f4253d654fafb7aab5babd31e3 | [] | no_license | adhiravishankar/ml-random-algorithms | bb52501e7c3ad4e08d8230b927ccc47e23bf8d0c | 0ee69b513ca8c49032e2967a09b55407637edf79 | refs/heads/master | 2021-04-09T13:19:42.725958 | 2018-03-12T02:40:22 | 2018-03-12T02:40:22 | 124,731,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,332 | java | package dist;
import java.io.Serializable;
import java.util.Random;
import shared.DataSet;
import shared.Instance;
/**
* A interface for distributions
* @author Andrew Guillory gtg008g@mail.gatech.edu
* @version 1.0
*/
public interface Distribution extends Serializable {
/**
* A random number generator
*/
Random random = new Random();
/**
* Get the probability of i
* @param i the discrete value to get the probability of
* @return the probability of i
*/
double p(Instance i);
/**
* Calculate the log likelihood
* @param i the instance
* @return the log likelihood
*/
double logp(Instance i);
/**
* Generate a random value
* @param i the conditional values or null
* @return the value
*/
Instance sample(Instance i);
/**
* Generate a random value
* @return the value
*/
Instance sample();
/**
* Get the mode of the distribution
* @param i the instance
* @return the mode
*/
Instance mode(Instance i);
/**
* Get the mode of the distribution
* @return the mode
*/
Instance mode();
/**
* Estimate the distribution from data
* @param set the data set to estimate from
*/
void estimate(DataSet set);
} | [
"adhiravishankar@gmail.com"
] | adhiravishankar@gmail.com |
1478ccb86919d23c1f90d129720e0e53497b840d | 62cc47fc30032e40ba0bc5e0eb177460e384a1ed | /core/src/main/java/lando/systems/ld48/Game.java | 26ad6d892e9fc868022ca46074207194d49f3916 | [] | no_license | bploeckelman/LudumDare48 | 5fcb627a6f6380d1508562f37f17464ff15347f8 | 3be28842acac1cb3caf9b33e14a6bc79904449d0 | refs/heads/master | 2023-04-10T10:24:22.474289 | 2021-04-27T21:32:45 | 2021-04-27T21:32:45 | 359,710,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,461 | java | package lando.systems.ld48;
import aurelienribon.tweenengine.Timeline;
import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenManager;
import aurelienribon.tweenengine.primitives.MutableFloat;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Disposable;
import lando.systems.ld48.screens.BaseScreen;
import lando.systems.ld48.screens.LaunchScreen;
import lando.systems.ld48.screens.TitleScreen;
import lando.systems.ld48.utils.Time;
import lando.systems.ld48.utils.accessors.*;
public class Game extends ApplicationAdapter {
public Assets assets;
public Audio audio;
public TweenManager tween;
private BaseScreen screen;
private ScreenTransition screenTransition;
@Override
public void create() {
Time.init();
tween = new TweenManager();
Tween.setWaypointsLimit(4);
Tween.setCombinedAttributesLimit(4);
Tween.registerAccessor(Color.class, new ColorAccessor());
Tween.registerAccessor(Rectangle.class, new RectangleAccessor());
Tween.registerAccessor(Vector2.class, new Vector2Accessor());
Tween.registerAccessor(Vector3.class, new Vector3Accessor());
Tween.registerAccessor(OrthographicCamera.class, new CameraAccessor());
assets = new Assets();
audio = new Audio(this);
screenTransition = new ScreenTransition(Config.windowWidth, Config.windowHeight);
if (Config.showLaunchScreen || Gdx.app.getType() == Application.ApplicationType.WebGL) {
setScreen(new LaunchScreen(this));
} else {
setScreen(new TitleScreen(this));
}
}
public void update() {
if (Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)) {
Gdx.app.exit();
}
// update global timer
Time.delta = Gdx.graphics.getDeltaTime();
// update code that always runs (regardless of pause)
screen.alwaysUpdate(Time.delta);
// handle a pause
if (Time.pause_timer > 0) {
Time.pause_timer -= Time.delta;
if (Time.pause_timer <= -0.0001f) {
Time.delta = -Time.pause_timer;
} else {
// skip updates if we're paused
return;
}
}
Time.millis += Time.delta;
Time.previous_elapsed = Time.elapsed_millis();
// update systems
tween.update(Time.delta);
audio.update(Time.delta);
screen.update(Time.delta);
}
@Override
public void render() {
update();
// render the active screen
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
if (!screenTransition.active) {
screen.render(assets.batch);
} else {
screenTransition.updateAndRender(Time.delta, assets.batch, screen);
}
}
@Override
public void dispose() {
screenTransition.dispose();
audio.dispose();
assets.dispose();
}
public BaseScreen getScreen() {
return screen;
}
public void setScreen(BaseScreen newScreen) {
setScreen(newScreen, null);
}
public void setScreen(BaseScreen newScreen, ShaderProgram transitionShader) {
// only one active transition at a time
if (screenTransition.active || screenTransition.next != null) {
return;
}
if (screen == null) {
screen = newScreen;
} else {
if (transitionShader == null) {
screenTransition.shader = Assets.Transitions.shaders.random();
} else {
screenTransition.shader = transitionShader;
}
Timeline.createSequence()
.pushPause(0.1f)
.push(Tween.call((i, baseTween) -> {
screenTransition.active = true;
screenTransition.percent.setValue(0f);
screenTransition.next = newScreen;
}))
.push(Tween.to(screenTransition.percent, -1, screenTransition.duration).target(1))
.push(Tween.call((i, baseTween) -> {
screen = screenTransition.next;
screenTransition.next = null;
screenTransition.active = false;
}))
.start(tween);
}
}
// ------------------------------------------------------------------------
static class ScreenTransition implements Disposable {
boolean active = false;
float duration = 0.5f;
BaseScreen next;
ShaderProgram shader;
MutableFloat percent;
Texture sourceTexture;
Texture destTexture;
FrameBuffer sourceFramebuffer;
FrameBuffer destFramebuffer;
public ScreenTransition(int windowWidth, int windowHeight) {
next = null;
shader = null;
percent = new MutableFloat(0f);
sourceFramebuffer = new FrameBuffer(Pixmap.Format.RGBA8888, windowWidth, windowHeight, false);
destFramebuffer = new FrameBuffer(Pixmap.Format.RGBA8888, windowWidth, windowHeight, false);
sourceTexture = sourceFramebuffer.getColorBufferTexture();
destTexture = destFramebuffer.getColorBufferTexture();
}
@Override
public void dispose() {
sourceTexture.dispose();
destTexture.dispose();
sourceFramebuffer.dispose();
destFramebuffer.dispose();
}
public void updateAndRender(float delta, SpriteBatch batch, BaseScreen screen) {
// update the next screen
next.update(delta);
// render the next screen to a buffer
destFramebuffer.begin();
{
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
next.render(batch);
}
destFramebuffer.end();
// render the current screen to a buffer
sourceFramebuffer.begin();
{
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
screen.render(batch);
}
sourceFramebuffer.end();
batch.setShader(shader);
batch.begin();
{
shader.setUniformf("u_percent", percent.floatValue());
sourceTexture.bind(1);
shader.setUniformi("u_texture1", 1);
destTexture.bind(0);
shader.setUniformi("u_texture", 0);
// TODO - this only works cleanly if source and dest equal window size,
// if one screen has a different size it ends up either too big or too small during the transition
batch.setColor(Color.WHITE);
batch.draw(destTexture, 0, 0, Config.windowWidth, Config.windowHeight);
}
batch.end();
batch.setShader(null);
}
}
} | [
"brian.ploeckelman@gmail.com"
] | brian.ploeckelman@gmail.com |
789c66335e968fc1082cae52eb4531509129a180 | 253f1283c27435fa990d8fc247d4265007d12525 | /src/main/java/io/github/crystic/oreganic/container/ContainerBasicMineralExtractor.java | d314117fbb354b33ab29f730929b6dd9d10a4754 | [
"MIT"
] | permissive | Crystastic/Minecraft1.8Mod-Oreganic | 984d04be790788198557a6d9fff128df8e4d75c9 | dbbe5d51cb56bc3db52c2f3758fa3de388148739 | refs/heads/master | 2020-12-02T11:29:11.271973 | 2017-07-08T20:32:27 | 2017-07-08T20:32:27 | 96,642,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,617 | java | package io.github.crystic.oreganic.container;
import io.github.crystic.oreganic.slot.SlotMEFuel;
import io.github.crystic.oreganic.slot.SlotMEMineral;
import io.github.crystic.oreganic.tileentity.TileEntityBasicMineralExtractor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnace;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ContainerBasicMineralExtractor extends Container {
private TileEntityBasicMineralExtractor basicMineralExtractor;
public int lastBurnTime;
public int lastCurrentItemBurnTime;
public int lastCookTime;
public ContainerBasicMineralExtractor(InventoryPlayer inventory, TileEntityBasicMineralExtractor tileentity) {
this.basicMineralExtractor = tileentity;
this.addSlotToContainer(new SlotMEMineral(inventory.player, tileentity, 0, 48, 34));
this.addSlotToContainer(new SlotMEFuel(inventory.player, tileentity, 1, 17, 54));
this.addSlotToContainer(new SlotFurnace(inventory.player, tileentity,
2, 104, 34));
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9,
8 + j * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
}
}
public void addCraftingToCrafters(ICrafting icrafting) {
super.addCraftingToCrafters(icrafting);
icrafting
.sendProgressBarUpdate(this, 0, this.basicMineralExtractor.cookTime);
icrafting
.sendProgressBarUpdate(this, 1, this.basicMineralExtractor.burnTime);
icrafting.sendProgressBarUpdate(this, 2,
this.basicMineralExtractor.currentItemBurnTime);
}
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.lastCookTime != this.basicMineralExtractor.cookTime) {
icrafting.sendProgressBarUpdate(this, 0,
this.basicMineralExtractor.cookTime);
}
if (this.lastBurnTime != this.basicMineralExtractor.burnTime) {
icrafting.sendProgressBarUpdate(this, 1,
this.basicMineralExtractor.burnTime);
}
if (this.lastCurrentItemBurnTime != this.basicMineralExtractor.currentItemBurnTime) {
icrafting.sendProgressBarUpdate(this, 2,
this.basicMineralExtractor.currentItemBurnTime);
}
}
this.lastCookTime = this.basicMineralExtractor.cookTime;
this.lastBurnTime = this.basicMineralExtractor.burnTime;
this.lastCurrentItemBurnTime = this.basicMineralExtractor.currentItemBurnTime;
}
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2) {
if (par1 == 0) {
this.basicMineralExtractor.cookTime = par2;
}
if (par1 == 1) {
this.basicMineralExtractor.burnTime = par2;
}
if (par1 == 2) {
this.basicMineralExtractor.currentItemBurnTime = par2;
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotNum) {
ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(slotNum);
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (slotNum == 2) {
if (!this.mergeItemStack(itemstack1, 3, 39, true)) {
return null;
}
slot.onSlotChange(itemstack1, itemstack);
} else if (slotNum != 1 && slotNum != 0) {
if (TileEntityBasicMineralExtractor.isItemInput(itemstack1)) {
if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
return null;
}
} else if (TileEntityBasicMineralExtractor.isItemFuel(itemstack1)) {
if (!this.mergeItemStack(itemstack1, 1, 2, false)) {
return null;
}
} else if (slotNum >= 3 && slotNum < 30) {
if (!this.mergeItemStack(itemstack1, 30, 39, false)) {
return null;
}
} else if (slotNum >= 30 && slotNum < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) {
return null;
}
} else if (!this.mergeItemStack(itemstack1, 3, 39, false)) {
return null;
}
if (itemstack1.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) {
return null;
}
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
}
return itemstack;
}
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
}
| [
"chrisedwicker@gmail.com"
] | chrisedwicker@gmail.com |
cd8b2bae1d798bf6b83ae05fb202165635caea5a | f5f12b5bb94654dd0b18fdbed4e32f9368063695 | /src/main/java/geo/yoyo/Report.java | e03062bb20c0345f5aa3b37fcb05bf2ffdeadb84 | [] | no_license | uponmylife/geo | 118e71665280ea2be3aad3402ec8326420b8ae61 | 6bb6119f1a83485abfed442704caf5319033004c | refs/heads/master | 2020-04-30T23:06:24.979522 | 2015-02-09T22:20:56 | 2015-02-09T22:20:56 | 30,489,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 546 | java | package geo.yoyo;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class Report {
private String range;
private int[] typeScore;
private int score;
public String getLevel() {
if (score < 50) return "FAT";
if (score < 75) return "ACTIVE";
if (score < 100) return "GOOD";
if (score < 125) return "HUMAN";
if (score < 150) return "MAN";
if (score < 175) return "CHARMER";
if (score < 200) return "ACTOR";
return "HERO";
}
}
| [
"geo.c@daumkakao.com"
] | geo.c@daumkakao.com |
8733534972706ce05a790e3629afe5f6d6a91e93 | f9fd138d5e6f1f23d9aced533b5a3f5ff2b7d6f4 | /Common/src/main/java/com/blamejared/crafttweaker/impl/preprocessor/PriorityPreprocessor.java | fb212aabfc68f40b74246a02bdbffed5b7411fa3 | [
"MIT"
] | permissive | kindlich/CraftTweaker | fd61116413b274dc6eac2d6f7468095eb04a9a06 | c15ecad34374f09a4917506dc9eb17cf743b792e | refs/heads/1.18 | 2023-08-17T16:30:47.448860 | 2022-05-29T14:45:02 | 2022-05-29T14:45:02 | 109,025,585 | 0 | 0 | MIT | 2023-04-04T09:46:26 | 2017-10-31T16:49:14 | Java | UTF-8 | Java | false | false | 2,249 | java | package com.blamejared.crafttweaker.impl.preprocessor;
import com.blamejared.crafttweaker.api.CraftTweakerAPI;
import com.blamejared.crafttweaker.api.annotation.Preprocessor;
import com.blamejared.crafttweaker.api.annotation.ZenRegister;
import com.blamejared.crafttweaker.api.zencode.IPreprocessor;
import com.blamejared.crafttweaker.api.zencode.scriptrun.IMutableScriptRunInfo;
import com.blamejared.crafttweaker.api.zencode.scriptrun.IScriptFile;
import java.util.List;
@ZenRegister
@Preprocessor
public final class PriorityPreprocessor implements IPreprocessor {
public static final PriorityPreprocessor INSTANCE = new PriorityPreprocessor();
private static final int DEFAULT_PRIORITY = 0;
private PriorityPreprocessor() {}
@Override
public String name() {
return "priority";
}
@Override
public String defaultValue() {
return Integer.toString(DEFAULT_PRIORITY);
}
@Override
public boolean apply(final IScriptFile file, final List<String> preprocessedContents, final IMutableScriptRunInfo runInfo, final List<Match> matches) {
if(matches.size() > 1) {
CraftTweakerAPI.LOGGER.warn("Conflicting priorities in file {}: only the first will be used", file.name());
}
final String priority = matches.get(0).content().trim();
try {
Integer.parseInt(priority);
} catch(final NumberFormatException e) {
CraftTweakerAPI.LOGGER.warn("Invalid priority value '{}' for file {}", priority, file.name());
}
return true;
}
@Override
public int compare(final IScriptFile a, final IScriptFile b) {
return Integer.compare(
this.getIntSafely(a.matchesFor(this).get(0)),
this.getIntSafely(b.matchesFor(this).get(0))
);
}
@Override
public int priority() {
return 100;
}
private int getIntSafely(final Match match) {
try {
return Integer.parseInt(match.content().trim());
} catch(final NumberFormatException e) {
return DEFAULT_PRIORITY;
}
}
}
| [
"jaredlll08@gmail.com"
] | jaredlll08@gmail.com |
b8c47fffa495342daca5f8f5d409d7a11fbce846 | 131d39303b54a0cfc2001a1b3181656297b9f183 | /src/test/java/page1/App_page.java | 75aa3ea14be1d8166a21535153ba2bb147c8a721 | [] | no_license | bamboo1991/Appium-Mod-testing- | 32fad9560c06ac3160ebebd1cc6048ce4cc21c0b | a509bb056b849878a1d04c140e45dcd4381c83ae | refs/heads/master | 2022-12-29T13:49:03.366439 | 2020-04-25T20:41:00 | 2020-04-25T20:41:00 | 257,174,277 | 0 | 0 | null | 2020-10-13T21:20:17 | 2020-04-20T04:49:29 | Java | UTF-8 | Java | false | false | 1,330 | java | package page1;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.pagefactory.AndroidFindBy;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import org.openqa.selenium.support.PageFactory;
public class App_page {
private AndroidDriver<AndroidElement> driver;
public App_page(AndroidDriver<AndroidElement> driver) {
this.driver = driver;
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
}
@AndroidFindBy(uiAutomator = "text(\"General Store\")")
public AndroidElement generalStore;
@AndroidFindBy(uiAutomator = "text(\"Select the country where you want to shop\")")
public AndroidElement countryTitle;
@AndroidFindBy(uiAutomator = "text(\"Your Name\")")
public AndroidElement nameText;
@AndroidFindBy(uiAutomator = "text(\"Gender\")")
public AndroidElement genderText;
@AndroidFindBy(uiAutomator = "text(\"Afghanistan\")")
public AndroidElement defaultCountry;
@AndroidFindBy(uiAutomator = "text(\"Enter name here\")")
public AndroidElement nameFieldText;
@AndroidFindBy(uiAutomator = "text(\"Male\")")
public AndroidElement maleText;
@AndroidFindBy(uiAutomator = "text(\"Female\")")
public AndroidElement FemaleText;
}
| [
"stamovuber@gmail.com"
] | stamovuber@gmail.com |
2906eca21435d1dd5e222ec5baf5b84016f992cc | a55b17cade9223c606daba730fb1b03ed6baa41f | /mockexercise5 mock/src/test/java/exercise5/TradeServiceTest.java | a2b3e1033bc70d2b22322f79c1407fe089e97c0e | [] | no_license | enricoesposito/eelab-mockito | 0d0360cddc8bb01fec86dc5fe506a70475bd151d | d868fd510742fad1bf206ff7d16b75b01510bccd | refs/heads/master | 2020-03-13T09:03:53.501058 | 2018-04-25T20:08:23 | 2018-04-25T20:08:23 | 131,056,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,536 | java | package exercise5;
import com.sun.org.glassfish.gmbal.ManagedObject;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.BDDMockito;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class TradeServiceTest {
@Mock
private TradeRepository mockTradeRepository;
@Mock
private ReportValue dummyReportValue;
@Mock
private ReportService mockReportService;
private String isin;
private TradeService tradeService;
@Before
public void setUp(){
tradeService = new TradeService(mockTradeRepository, mockReportService);
isin = "EUR/USD";
}
// Stub variante responder
@Test
public void shouldReturnGiustoString() {
// Lo stub ci permette di impostare l'indirect input
BDDMockito.given(mockTradeRepository.read(Mockito.anyString())).willReturn(0.1);
// Mockito.when(stubTradeRepository.read(Mockito.anyString())).thenReturn(mockTradeResult);
String result = tradeService.save(isin, dummyReportValue);
Assert.assertEquals("Prezzo giusto", result);
// Utilizzo il verify sul mock per l'indirect output
BDDMockito.then(mockTradeRepository).should().read(Mockito.eq(isin));
BDDMockito.then(mockReportService).should().save(Mockito.eq(dummyReportValue));
Mockito.verify(mockReportService).save(Mockito.eq(dummyReportValue));
}
} | [
"enrico.esposito.14@gmail.com"
] | enrico.esposito.14@gmail.com |
d76bfed6c75babdc8c1af140e98735c412eab7b7 | 3426da6090f2b3171340ba75adb04f965185699c | /cicMorGan/src/main/java/com/ztmg/cicmorgan/receive/MyReceiver.java | e5d59c64c79bb43554537b57838c6636893d18e8 | [] | no_license | menglongfengyuqing/cic-android | 58a48504ff6b6d02ae6635d12c5a53d33feb46b6 | e5e9bc9da36d102191b5fe0503ade6e818e91363 | refs/heads/master | 2022-07-17T10:14:58.090623 | 2020-05-12T08:13:24 | 2020-05-12T08:13:24 | 263,254,969 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,300 | java | package com.ztmg.cicmorgan.receive;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import com.ztmg.cicmorgan.activity.MainActivity;
import com.ztmg.cicmorgan.activity.RollViewActivity;
import com.ztmg.cicmorgan.util.ExampleUtil;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Iterator;
import cn.jpush.android.api.JPushInterface;
/**
* 自定义接收器
* <p>
* 如果不定义这个 Receiver,则:
* 1) 默认用户会打开主界面
* 2) 接收不到自定义消息
*/
public class MyReceiver extends BroadcastReceiver {
private static final String TAG = "JPush";
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
Log.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
Log.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
//send the Registration Id to your server...
} else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
processCustomMessage(context, bundle);
} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 接收到推送下来的通知");
int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
Log.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 用户点击打开了通知");
String string = bundle.getString(JPushInterface.EXTRA_EXTRA);
// //打开自定义的Activity
// Intent i = new Intent(context, MainActivity.class);
// i.putExtras(bundle);
// //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
// context.startActivity(i);
try {
JSONObject jsonObject = new JSONObject(string);
String Url = jsonObject.getString("Url");
//JPushEntity jPushEntity = GsonManager.fromJson(json, JPushEntity.class);
Intent noticeIntent = new Intent(context, RollViewActivity.class);
noticeIntent.putExtra("Url", Url);
noticeIntent.putExtras(bundle);
noticeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(noticeIntent);
} catch (JSONException e) {
e.printStackTrace();
}
} else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
//在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等..
} else if (JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
Log.w(TAG, "[MyReceiver]" + intent.getAction() + " connected state change to " + connected);
} else {
Log.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
}
}
// 打印所有的 intent extra 数据
private static String printBundle(Bundle bundle) {
StringBuilder sb = new StringBuilder();
for (String key : bundle.keySet()) {
if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
} else if (key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)) {
sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
} else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
if (bundle.getString(JPushInterface.EXTRA_EXTRA).isEmpty()) {
Log.i(TAG, "This message has no Extra data");
continue;
}
try {
JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
Iterator<String> it = json.keys();
while (it.hasNext()) {
String myKey = it.next().toString();
sb.append("\nkey:" + key + ", value: [" +
myKey + " - " + json.optString(myKey) + "]");
}
} catch (JSONException e) {
Log.e(TAG, "Get message extra JSON error!");
}
} else {
sb.append("\nkey:" + key + ", value:" + bundle.getString(key));
}
}
return sb.toString();
}
//send msg to MainActivity
private void processCustomMessage(Context context, Bundle bundle) {
if (MainActivity.isForeground) {
String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
Intent msgIntent = new Intent(MainActivity.MESSAGE_RECEIVED_ACTION);
msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
if (!ExampleUtil.isEmpty(extras)) {
try {
JSONObject extraJson = new JSONObject(extras);
if (null != extraJson && extraJson.length() > 0) {
msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
}
} catch (JSONException e) {
}
}
context.sendBroadcast(msgIntent);
}
}
}
| [
"liyun@cicmorgan.com"
] | liyun@cicmorgan.com |
6688ad579d3f91f1ce6a24cf37c9ed609be41c17 | 678a3d58c110afd1e9ce195d2f20b2531d45a2e0 | /sources/com/airbnb/android/react/maps/LatLngBoundsUtils.java | 595ba8a7a6067de8bf407b43d3cbd16939a1db92 | [] | no_license | jasonnth/AirCode | d1c37fb9ba3d8087efcdd9fa2103fb85d13735d5 | d37db1baa493fca56f390c4205faf5c9bbe36604 | refs/heads/master | 2020-07-03T08:35:24.902940 | 2019-08-12T03:34:56 | 2019-08-12T03:34:56 | 201,842,970 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,644 | java | package com.airbnb.android.react.maps;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
public class LatLngBoundsUtils {
public static boolean BoundsAreDifferent(LatLngBounds a, LatLngBounds b) {
LatLng centerA = a.getCenter();
double latA = centerA.latitude;
double lngA = centerA.longitude;
double latDeltaA = a.northeast.latitude - a.southwest.latitude;
double lngDeltaA = a.northeast.longitude - a.southwest.longitude;
LatLng centerB = b.getCenter();
double latB = centerB.latitude;
double lngB = centerB.longitude;
double latDeltaB = b.northeast.latitude - b.southwest.latitude;
double lngDeltaB = b.northeast.longitude - b.southwest.longitude;
double latEps = LatitudeEpsilon(a, b);
double lngEps = LongitudeEpsilon(a, b);
return different(latA, latB, latEps) || different(lngA, lngB, lngEps) || different(latDeltaA, latDeltaB, latEps) || different(lngDeltaA, lngDeltaB, lngEps);
}
private static boolean different(double a, double b, double epsilon) {
return Math.abs(a - b) > epsilon;
}
private static double LatitudeEpsilon(LatLngBounds a, LatLngBounds b) {
return Math.min(Math.abs(a.northeast.latitude - a.southwest.latitude), Math.abs(b.northeast.latitude - b.southwest.latitude)) / 2560.0d;
}
private static double LongitudeEpsilon(LatLngBounds a, LatLngBounds b) {
return Math.min(Math.abs(a.northeast.longitude - a.southwest.longitude), Math.abs(b.northeast.longitude - b.southwest.longitude)) / 2560.0d;
}
}
| [
"thanhhuu2apc@gmail.com"
] | thanhhuu2apc@gmail.com |
e5db1c129b9eebb9bf2da23ae5ed200bdd74c392 | be28a7b64a4030f74233a79ebeba310e23fe2c3a | /generated-tests/rmosa/tests/s1011/24_saxpath/evosuite-tests/com/werken/saxpath/XPathLexer_ESTest_scaffolding.java | 233584641aa089703c730d05747c18cc553115bc | [
"MIT"
] | permissive | blindsubmissions/icse19replication | 664e670f9cfcf9273d4b5eb332562a083e179a5f | 42a7c172efa86d7d01f7e74b58612cc255c6eb0f | refs/heads/master | 2020-03-27T06:12:34.631952 | 2018-08-25T11:19:56 | 2018-08-25T11:19:56 | 146,074,648 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,258 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Aug 23 09:51:11 GMT 2018
*/
package com.werken.saxpath;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class XPathLexer_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "com.werken.saxpath.XPathLexer";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("file.encoding", "UTF-8");
java.lang.System.setProperty("java.awt.headless", "true");
java.lang.System.setProperty("java.io.tmpdir", "/tmp");
java.lang.System.setProperty("user.country", "US");
java.lang.System.setProperty("user.dir", "/home/ubuntu/evosuite_readability_gen/projects/24_saxpath");
java.lang.System.setProperty("user.home", "/home/ubuntu");
java.lang.System.setProperty("user.language", "en");
java.lang.System.setProperty("user.name", "ubuntu");
java.lang.System.setProperty("user.timezone", "Etc/UTC");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(XPathLexer_ESTest_scaffolding.class.getClassLoader() ,
"com.werken.saxpath.Token",
"com.werken.saxpath.XPathLexer"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(XPathLexer_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"com.werken.saxpath.XPathLexer",
"com.werken.saxpath.Token"
);
}
}
| [
"my.submission.blind@gmail.com"
] | my.submission.blind@gmail.com |
89e0d405ed1db858c4fc1bef4e7dabd8c33c2f6a | 08b8d598fbae8332c1766ab021020928aeb08872 | /src/gcom/relatorio/cobranca/parcelamento/RelatorioRelacaoParcelamento.java | 4d7fcce3f9972f1125165124f8b18d795549a921 | [] | no_license | Procenge/GSAN-CAGEPA | 53bf9bab01ae8116d08cfee7f0044d3be6f2de07 | dfe64f3088a1357d2381e9f4280011d1da299433 | refs/heads/master | 2020-05-18T17:24:51.407985 | 2015-05-18T23:08:21 | 2015-05-18T23:08:21 | 25,368,185 | 3 | 1 | null | null | null | null | WINDOWS-1252 | Java | false | false | 9,404 | java | /*
* Copyright (C) 2007-2007 the GSAN – Sistema Integrado de Gestão de Serviços de Saneamento
*
* This file is part of GSAN, an integrated service management system for Sanitation
*
* GSAN 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.
*
* GSAN is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place – Suite 330, Boston, MA 02111-1307, USA
*/
/*
* GSAN – Sistema Integrado de Gestão de Serviços de Saneamento
* Copyright (C) <2007>
* Adriano Britto Siqueira
* Alexandre Santos Cabral
* Ana Carolina Alves Breda
* Ana Maria Andrade Cavalcante
* Aryed Lins de Araújo
* Bruno Leonardo Rodrigues Barros
* Carlos Elmano Rodrigues Ferreira
* Cláudio de Andrade Lira
* Denys Guimarães Guenes Tavares
* Eduardo Breckenfeld da Rosa Borges
* Fabíola Gomes de Araújo
* Flávio Leonardo Cavalcanti Cordeiro
* Francisco do Nascimento Júnior
* Homero Sampaio Cavalcanti
* Ivan Sérgio da Silva Júnior
* José Edmar de Siqueira
* José Thiago Tenório Lopes
* Kássia Regina Silvestre de Albuquerque
* Leonardo Luiz Vieira da Silva
* Márcio Roberto Batista da Silva
* Maria de Fátima Sampaio Leite
* Micaela Maria Coelho de Araújo
* Nelson Mendonça de Carvalho
* Newton Morais e Silva
* Pedro Alexandre Santos da Silva Filho
* Rafael Corrêa Lima e Silva
* Rafael Francisco Pinto
* Rafael Koury Monteiro
* Rafael Palermo de Araújo
* Raphael Veras Rossiter
* Roberto Sobreira Barbalho
* Rodrigo Avellar Silveira
* Rosana Carvalho Barbosa
* Sávio Luiz de Andrade Cavalcante
* Tai Mu Shih
* Thiago Augusto Souza do Nascimento
* Tiago Moreno Rodrigues
* Vivianne Barbosa Sousa
*
* Este programa é software livre; você pode redistribuí-lo e/ou
* modificá-lo sob os termos de Licença Pública Geral GNU, conforme
* publicada pela Free Software Foundation; versão 2 da
* Licença.
* Este programa é distribuído na expectativa de ser útil, mas SEM
* QUALQUER GARANTIA; sem mesmo a garantia implícita de
* COMERCIALIZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM
* PARTICULAR. Consulte a Licença Pública Geral GNU para obter mais
* detalhes.
* Você deve ter recebido uma cópia da Licença Pública Geral GNU
* junto com este programa; se não, escreva para Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA.
*/
package gcom.relatorio.cobranca.parcelamento;
import gcom.batch.Relatorio;
import gcom.cadastro.sistemaparametro.SistemaParametro;
import gcom.fachada.Fachada;
import gcom.relatorio.ConstantesRelatorios;
import gcom.relatorio.RelatorioDataSource;
import gcom.relatorio.RelatorioVazioException;
import gcom.seguranca.acesso.usuario.Usuario;
import gcom.tarefa.TarefaException;
import gcom.tarefa.TarefaRelatorio;
import gcom.util.ControladorException;
import gcom.util.Util;
import gcom.util.agendadortarefas.AgendadorTarefas;
import java.math.BigDecimal;
import java.util.*;
/**
* classe responsável por criar o relatório de
* [UC0580]Emitir Protocolo de Documento de Cobrança do Cronogrma
*
* @author Ana Maria
* @date 05/10/06
*/
public class RelatorioRelacaoParcelamento
extends TarefaRelatorio {
/**
*
*/
private static final long serialVersionUID = 1L;
public RelatorioRelacaoParcelamento(Usuario usuario) {
super(usuario, ConstantesRelatorios.RELATORIO_EMITIR_PROTOCOLO_DOCUMENTO_COBRANCA);
}
@Deprecated
public RelatorioRelacaoParcelamento() {
super(null, "");
}
private Collection<RelatorioRelacaoParcelamentoBean> inicializarBeanRelatorio(
Collection<RelacaoParcelamentoRelatorioHelper> dadosRelatorio){
Collection<RelatorioRelacaoParcelamentoBean> retorno = new ArrayList();
Iterator iterator = dadosRelatorio.iterator();
while(iterator.hasNext()){
RelacaoParcelamentoRelatorioHelper helper = (RelacaoParcelamentoRelatorioHelper) iterator.next();
String situacao = "";
if(helper.getSituacao() != null){
situacao = helper.getSituacao();
}
String localidade = "";
if(helper.getLocalidade() != null){
localidade = helper.getIdGerencia() + "-" + helper.getGerencia() + "/" + helper.getLocalidade();
}
String cliente = "";
String telefone = "";
if(helper.getCliente() != null){
cliente = helper.getCliente();
if(helper.getTelefone() != null){
telefone = helper.getDdd() + " " + helper.getTelefone();
}
}
String matricula = "";
if(helper.getMatricula() != null){
matricula = helper.getMatricula().toString();
}
// String idParcelamento = "";
// if(helper.getParcelamento() != null){
// idParcelamento = helper.getParcelamento().toString();
// }
BigDecimal valorDebito = new BigDecimal("0.00");
if(helper.getDebitoTotal() != null){
valorDebito = helper.getDebitoTotal();
}
BigDecimal valorEntrada = new BigDecimal("0.00");
if(helper.getValorEntrada() != null){
valorEntrada = helper.getValorEntrada();
}
BigDecimal valorParcelas = new BigDecimal("0.00");
if(helper.getValorParcelamento() != null){
valorParcelas = helper.getValorParcelamento();
}
String dataParcelamento = "";
if(helper.getDataParcelamento() != null){
dataParcelamento = Util.formatarData(helper.getDataParcelamento());
}
// String vencimento = "";
// if(helper.getVencimento() != null){
// vencimento = helper.getVencimento().toString();
// // vencimento = vencimento.substring(0, 2);
// }
String numeroParcelas = "";
if(helper.getNumeroParcelamento() != null){
numeroParcelas = helper.getNumeroParcelamento().toString();
}
String idLocalidade = "";
if(helper.getIdLocalidade() != null){
idLocalidade = helper.getIdLocalidade().toString();
}
String idGerencia = "";
if(helper.getIdGerencia() != null){
idGerencia = helper.getIdGerencia().toString();
}
String gerencia = "";
if(helper.getGerencia() != null){
gerencia = helper.getIdGerencia() + "-" + helper.getGerencia();
}
String unidade = "";
if(helper.getUnidade() != null){
unidade = helper.getUnidade();
}
String ultimaAlteracao = "";
if(helper.getUltimaAlteracao() != null){
ultimaAlteracao = Util.formatarData(helper.getUltimaAlteracao());
}
RelatorioRelacaoParcelamentoBean bean = new RelatorioRelacaoParcelamentoBean(situacao, localidade, cliente, telefone,
matricula, valorDebito, valorEntrada, valorParcelas, dataParcelamento,
numeroParcelas, idLocalidade, idGerencia, gerencia, unidade, ultimaAlteracao);
retorno.add(bean);
}
return retorno;
}
/**
* Método que executa a tarefa
*
* @return Object
*/
public Object executar() throws TarefaException{
// ------------------------------------
Integer idFuncionalidadeIniciada = this.getIdFuncionalidadeIniciada();
// ------------------------------------
Collection dadosRelatorio = (Collection) getParametro("colecaoRelacaoParcelamento");
int tipoFormatoRelatorio = (Integer) getParametro("tipoFormatoRelatorio");
String cabecalho = (String) getParametro("cabecalho");
String faixaValores = (String) getParametro("faixaValores");
String periodo = (String) getParametro("periodo");
// valor de retorno
byte[] retorno = null;
Fachada fachada = Fachada.getInstancia();
// Parâmetros do relatório
Map parametros = new HashMap();
SistemaParametro sistemaParametro = fachada.pesquisarParametrosDoSistema();
parametros.put("imagem", sistemaParametro.getImagemRelatorio());
parametros.put("cabecalho", cabecalho);
parametros.put("faixaValores", faixaValores);
parametros.put("periodo", periodo);
parametros.put("numeroRelatorio", "O0594");
parametros.put("P_NM_ESTADO", sistemaParametro.getNomeEstado());
Collection<RelatorioRelacaoParcelamentoBean> colecaoBean = this.inicializarBeanRelatorio(dadosRelatorio);
if(colecaoBean == null || colecaoBean.isEmpty()){
// Não existem dados para a exibição do relatório.
throw new RelatorioVazioException("atencao.relatorio.vazio");
}
RelatorioDataSource ds = new RelatorioDataSource((List) colecaoBean);
retorno = this.gerarRelatorio(ConstantesRelatorios.RELATORIO_RELACAO_PARCELAMENTO, parametros, ds, tipoFormatoRelatorio);
// ------------------------------------
// Grava o relatório no sistema
try{
persistirRelatorioConcluido(retorno, Relatorio.RELACAO_PARCELAMENTO, idFuncionalidadeIniciada, null);
}catch(ControladorException e){
e.printStackTrace();
throw new TarefaException("Erro ao gravar relatório no sistema", e);
}
// ------------------------------------
// retorna o relatório gerado
return retorno;
}
@Override
public int calcularTotalRegistrosRelatorio(){
int retorno = 0;
// retorno = ((Collection) getParametro("idsGuiaDevolucao")).size();
return retorno;
}
@Override
public void agendarTarefaBatch(){
AgendadorTarefas.agendarTarefa("RelatorioRelacaoParcelamento", this);
}
} | [
"Yara.Souza@procenge.com.br"
] | Yara.Souza@procenge.com.br |
6f8f5094eeb80736ffb719364ec0645c1da65d68 | 2effcda1337c41033eb2234ac4d4e11268706877 | /src/test/java/com/trading/gateway/binance/market/BinanceDiffDepth.java | 52af09d5f5f4b33a22cb54bb2ff178c101807c4c | [] | no_license | jfengan/Gateway | 851fe7c66a342357824795cffd9d2e392c54c507 | 6a8a0579a8ca6bb2907dfc2dbeae7fa3023ca2ff | refs/heads/master | 2023-08-26T16:41:42.671241 | 2021-10-04T11:32:14 | 2021-10-04T11:32:14 | 396,220,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.trading.gateway.binance.market;
import com.trading.gateway.utils.websocket.Printer;
import com.trading.gateway.utils.websocket.SubscriptionClient;
public class BinanceDiffDepth {
public static void main(String[] args) {
SubscriptionClient client = SubscriptionClient.create();
client.subscribeDiffDepthEvent("btcusdt", Printer::logInfo, null);
}
}
| [
"jfengan@connet.ust.hk"
] | jfengan@connet.ust.hk |
092ea9dfc09cc8c2ba1ce87a6c2b7e52adefa516 | d6484b4364a2204d9d09bb7077d7ea07c17fcfb3 | /src/ta/example/interfaces/FileHandlerImpl.java | e9b0c3f48412d8fe0bb26891e351bab68a519c40 | [] | no_license | RMSnow/iss-exp-1 | ed36782c3cfd05a6687550fe7dce3cbcb3e34c31 | 808fbd6bff8acfb454b6903405effe93a3ceca3b | refs/heads/master | 2021-07-23T14:09:02.977997 | 2017-11-02T06:36:59 | 2017-11-02T06:36:59 | 108,118,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,107 | java | package ta.example.interfaces;
import ta.example.vo.StockInfo;
import java.io.*;
import java.util.ArrayList;
public class FileHandlerImpl implements FileHandler {
public StockInfo[] getStockInfoFromFile(String filePath) {
try {
FileInputStream inputStream = new FileInputStream(filePath);
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String templine = "";
String[] arrs = null;
int line = 0;
ArrayList<StockInfo> stockInfos = new ArrayList<>();
while ((templine = bufferedReader.readLine()) != null) {
line++;
if (line == 1) continue;
StockInfo tempInfo = new StockInfo();
arrs = templine.split("\t");
tempInfo.id = Integer.parseInt(arrs[0]);
tempInfo.title = arrs[1];
tempInfo.author = arrs[2];
tempInfo.date = arrs[3];
tempInfo.lastupdate = arrs[4];
tempInfo.content = arrs[5];
tempInfo.answerauthor = arrs[6];
tempInfo.answer = arrs[7];
stockInfos.add(tempInfo);
}
bufferedReader.close();
inputStreamReader.close();
inputStream.close();
return stockInfos.toArray(new StockInfo[stockInfos.size()]);
} catch (FileNotFoundException e) {
System.out.println("The file " + filePath + " doesn't exist.");
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public int setStockInfo2File(String filePath, StockInfo[] stocks) {
try {
FileOutputStream fileOutputStream = new FileOutputStream(new File(filePath));
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream);
BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);
bufferedWriter.write("ID\tTITLE\tAUTHOR\tDATE\tLASTUPDATE" +
"\tCONTENT\tANSWERAUTHOR\tANSWER\n");
int line = 1;
for (StockInfo stock : stocks) {
bufferedWriter.write(stock.id + "\t" + stock.title + "\t" + stock.author
+ "\t" + stock.date + "\t" + stock.lastupdate + "\t" + stock.content
+ "\t" + stock.answerauthor + "\t" + stock.answer + "\n");
line++;
}
bufferedWriter.close();
outputStreamWriter.close();
fileOutputStream.close();
return line;
} catch (FileNotFoundException e) {
System.out.println("The file " + filePath + " doesn't exist.");
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return -1;
}
}
| [
"xueyao_98@foxmail.com"
] | xueyao_98@foxmail.com |
a9c5fef5b46380067a1a1d599820eec46af4c440 | a74f4e0d615f70d4748a21b77edd59e953f5b610 | /app/src/main/java/com/admin/samplefblogin/ProfileActivity.java | cc787a26607e7d31f831f9b48b17bb2e738e83ca | [] | no_license | Vin5Sas/SampleFirebaseLogin | a274a288155c73c00e094af8b0d55e93ee954d04 | 5298dd88801daff23ffd5e6b236b0b3421a688dd | refs/heads/master | 2020-04-16T20:37:44.521607 | 2019-01-15T18:32:52 | 2019-01-15T18:32:52 | 165,902,804 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,432 | java | package com.admin.samplefblogin;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class ProfileActivity extends AppCompatActivity {
private FirebaseAuth firebaseAuth;
Button logoutButton;
TextView userIDLabel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
firebaseAuth = FirebaseAuth.getInstance();
FirebaseUser user = firebaseAuth.getCurrentUser();
logoutButton = (Button) findViewById(R.id.LogoutButton);
userIDLabel = (TextView) findViewById(R.id.UserIDLabel);
userIDLabel.setText(user.getEmail());
logoutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
firebaseAuth.signOut();
finish();
Intent mainIntent = new Intent(getApplicationContext(),MainActivity.class);
Toast.makeText(getApplicationContext(),"Logged Out Successfully!",Toast.LENGTH_SHORT);
startActivity(mainIntent);
}
});
}
}
| [
"visas98@gmail.com"
] | visas98@gmail.com |
e96332ed9ac69ff1c5871366a51c210750af0ab4 | 2c638d38b354fbc1cf8f756dac76b689822ba591 | /Technical_Skill_Improvement_Tasks/src/Design Pattern/src/main/java/mt2/command/ex2/LocationImpl.java | 486a6faf51751b8dddad578dd36893313c28eb9a | [] | no_license | volkantolu/euler_projects | 675b55474d167d0457487aa6a1e605b86ca881dc | 34767d6a1bfc0139773301c193a61408a46be657 | refs/heads/master | 2021-01-22T22:03:10.705974 | 2017-07-16T10:56:34 | 2017-07-16T10:56:34 | 85,500,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package mt2.command.ex2;
class LocationImpl implements Location{
private String location;
public LocationImpl(){ }
public LocationImpl(String newLocation){
location = newLocation;
}
public String getLocation(){ return location; }
public void setLocation(String newLocation){ location = newLocation; }
public String toString(){ return location; }
}
| [
"volkantolu@gmail.com"
] | volkantolu@gmail.com |
265c1dd563f4fc4ce9b3e2f24af20d79ea2c5678 | ad5cd983fa810454ccbb8d834882856d7bf6faca | /platform/ext/platformservices/src/de/hybris/platform/order/strategies/impl/DefaultCreateQuoteSnapshotStrategy.java | 63e4fbc04a1ec1cd0f31f4d9e4c3648a66d4feba | [] | no_license | amaljanan/my-hybris | 2ea57d1a4391c9a81c8f4fef7c8ab977b48992b8 | ef9f254682970282cf8ad6d26d75c661f95500dd | refs/heads/master | 2023-06-12T17:20:35.026159 | 2021-07-09T04:33:13 | 2021-07-09T04:33:13 | 384,177,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,364 | java | /*
* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
*/
package de.hybris.platform.order.strategies.impl;
import static de.hybris.platform.servicelayer.util.ServicesUtil.validateParameterNotNullStandardMessage;
import de.hybris.platform.core.enums.QuoteState;
import de.hybris.platform.core.model.order.QuoteEntryModel;
import de.hybris.platform.core.model.order.QuoteModel;
import de.hybris.platform.order.strategies.CreateQuoteSnapshotStrategy;
import java.util.Optional;
/**
* The Class DefaultCreateQuoteSnapshotStrategy.
*/
public class DefaultCreateQuoteSnapshotStrategy
extends GenericAbstractOrderCloningStrategy<QuoteModel, QuoteEntryModel, QuoteModel>
implements CreateQuoteSnapshotStrategy
{
public DefaultCreateQuoteSnapshotStrategy()
{
super(QuoteModel.class, QuoteEntryModel.class, QuoteModel.class);
}
@Override
public QuoteModel createQuoteSnapshot(final QuoteModel quote, final QuoteState quoteState)
{
validateParameterNotNullStandardMessage("quote", quote);
validateParameterNotNullStandardMessage("quoteState", quoteState);
final QuoteModel quoteSnapshot = clone(quote, Optional.of(quote.getCode()));
quoteSnapshot.setState(quoteState);
quoteSnapshot.setVersion(Integer.valueOf(quote.getVersion().intValue() + 1));
postProcess(quote, quoteSnapshot);
return quoteSnapshot;
}
}
| [
"amaljanan333@gmail.com"
] | amaljanan333@gmail.com |
9bc3852309234f882ba3772aaa6585c17ca85807 | 11d154087964cb8756a2b3fc3833895fdb5e104b | /flixelgame/src/com/yourname/flixelgame/examples/particles/ParticleDemo.java | bed644ff5ac80af6c865ed4a847caf22961a5139 | [
"Apache-2.0"
] | permissive | jjhaggar/libGDX-flixel-test-autogenerated | c65feb6865a1fd28d469152454f08819c192edfb | 5c7b0cbb245d7c693bd84baa744ea66030fd0b1e | refs/heads/master | 2020-05-19T03:41:19.950326 | 2014-09-22T08:10:17 | 2014-09-22T08:10:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,084 | java | package com.yourname.flixelgame.examples.particles;
import org.flixel.FlxGame;
/**
* In games, "particles" and "particle emitters" refer to a whole
* class of behaviors that are usually used for special effects and
* flavor. The "emitter" is the source and manager of the actual
* "particle" objects that are spewed out and/or floating around.
* FlxParticle is just an extension of FlxSprite, and FlxEmitter
* is just an extension of FlxGroup, so a particle system in Flixel
* isn't really that different from any normal group of sprites. It just
* adds some special behavior for creating and launching
* particles, and the particles themselves have some optional,
* special behavior to bounce more believably in platformer
* situations. FlxEmitter also has built-in variables that let you
* specify velocity ranges, rotation speeds, gravity, collision
* behaviors, and more.
*
* @author Zachary Travit
* @author Ka Wing Chin
*/
public class ParticleDemo extends FlxGame
{
public ParticleDemo()
{
super(400, 300, PlayState.class, 1, 30, 30);
}
}
| [
"jjhaggar@gmail.com"
] | jjhaggar@gmail.com |
2aa9b97d7d89fe331ba9395a870ea8145418bb41 | f96942f294cb48f5e939226e72ba8f94611631e1 | /src/com/netpace/itc/activity/PlanToSaveActivity.java | cb9e5dbfe8482458dc03ab0e45c11a3ed86f3b0a | [] | no_license | umairkhancis/IncomeTaxCalculator | 9643729ae64f8df5d9d51df2c253f96131cfad1e | facc91e60f08b909cf67d86527e85515333e0065 | refs/heads/master | 2016-08-03T21:13:13.295489 | 2014-02-12T12:08:26 | 2014-02-12T12:08:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package com.netpace.itc.activity;
import com.example.incometaxcalculator.R;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class PlanToSaveActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_plan_to_save);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.plan_to_save, menu);
return true;
}
}
| [
"ahmednasir91@gmail.com"
] | ahmednasir91@gmail.com |
7f23732f8ead3225aa3af176aa912ca6a76faa7d | 383907ab9b8a6491c687b493b8fe63ed211d8579 | /src/main/java/cn/kcyf/pms/modular/business/controller/ContentController.java | 76d9af8dde247b3832974d95ed6f991be3e2a4aa | [] | no_license | bjzk2012/pms-master | c222d728d8fa3c75ef86199b88bb4e4dc6fcdbeb | b9d7c4aa96ece6bbe1c6b5ef27dcb8158b3f68ec | refs/heads/master | 2022-05-17T16:30:14.335574 | 2019-11-01T02:05:31 | 2019-11-01T02:05:31 | 203,763,899 | 0 | 0 | null | 2022-03-31T18:53:20 | 2019-08-22T09:44:40 | TSQL | UTF-8 | Java | false | false | 3,360 | java | package cn.kcyf.pms.modular.business.controller;
import cn.kcyf.orm.jpa.criteria.Criteria;
import cn.kcyf.orm.jpa.criteria.Restrictions;
import cn.kcyf.pms.core.controller.BasicController;
import cn.kcyf.pms.core.enumerate.Status;
import cn.kcyf.pms.core.model.ResponseData;
import cn.kcyf.pms.modular.business.entity.Catalogue;
import cn.kcyf.pms.modular.business.entity.Content;
import cn.kcyf.pms.modular.business.entity.Mode;
import cn.kcyf.pms.modular.business.entity.ModeField;
import cn.kcyf.pms.modular.business.service.ContentService;
import cn.kcyf.pms.modular.business.service.ModeFieldService;
import cn.kcyf.pms.modular.business.service.ModeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/content")
@Api(tags = "内容管理", description = "内容管理")
public class ContentController extends BasicController {
@Autowired
private ModeService modeService;
@Autowired
private ModeFieldService modeFieldService;
@Autowired
private ContentService contentService;
private String PREFIX = "/modular/business/content/content/";
private void setModes(Model model){
Criteria<Mode> criteria = new Criteria<Mode>();
criteria.add(Restrictions.eq("status", Status.ENABLE));
model.addAttribute("modes", modeService.findList(criteria));
}
@GetMapping("")
@RequiresPermissions(value = "content")
public String index(Model model) {
setModes(model);
return PREFIX + "content.html";
}
@GetMapping("/content_add")
// @RequiresPermissions(value = "content_add")
public String contentAdd(Long modeId, Model model) {
Criteria<ModeField> criteria = new Criteria<ModeField>();
criteria.add(Restrictions.eq("mode.id", modeId));
criteria.add(Restrictions.eq("status", Status.ENABLE));
model.addAttribute("fields", modeFieldService.findList(criteria, new Sort(Sort.Direction.ASC, "sort")));
model.addAttribute("mode", modeService.getOne(modeId));
return PREFIX + "content_add.html";
}
@GetMapping("/content_edit")
// @RequiresPermissions(value = "content_edit")
public String contentUpdate(Long contentId, Model model) {
return PREFIX + "content_edit.html";
}
@GetMapping(value = "/list")
@ResponseBody
@ApiOperation("查询内容目录树形结构")
// @RequiresPermissions(value = "content_list")
public ResponseData list(String condition) {
Criteria<Content> criteria = new Criteria<Content>();
if (!StringUtils.isEmpty(condition)) {
criteria.add(Restrictions.or(Restrictions.like("subject", condition), Restrictions.like("text", condition)));
}
return ResponseData.list(contentService.findList(criteria));
}
}
| [
"bjzk_2012_zk@163.com"
] | bjzk_2012_zk@163.com |
440acc28e5a57e144d3954cacbe60ac8cb5d89a3 | 53e17b0e930c21c71dc133f15c85569a27f559b0 | /java-ast-extractor/src/main/java/pl/umk/wmii/SourceSnapshotApp.java | d22b63c2f71c9592e4949c8dd0706c161888926c | [
"MIT"
] | permissive | mfejzer/tracking_buggy_files | 4ead83b8a346050db4de0e0df45ace0676f3050b | 3037e9754ea8a7b20a562e3f5d85871a0ccf63b1 | refs/heads/master | 2022-11-22T04:31:09.637257 | 2021-12-03T15:02:20 | 2021-12-03T15:02:20 | 194,846,350 | 4 | 3 | MIT | 2022-11-16T12:33:10 | 2019-07-02T11:00:31 | Python | UTF-8 | Java | false | false | 1,868 | java | package pl.umk.wmii;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class SourceSnapshotApp {
public static List<Path> findAllSourceFilesInRepository(String repositoryPath) throws IOException {
return Files.find(Paths.get(repositoryPath), 100,
(path, attributes) -> path.toString().toLowerCase().endsWith(".java"))
.collect(Collectors.toList());
}
public static void main(String[] args) throws IOException {
final AstWalker astWalker = new AstWalker();
final GraphFeaturesAstWalker graphFeaturesAstWalker = new GraphFeaturesAstWalker();
String sourcePath = args[0];
String outputFile = args[1];
ObjectMapper objectMapper = new ObjectMapper();
final Map<String, FileDetails> contentMap = new HashMap<>();
findAllSourceFilesInRepository(sourcePath).forEach(path -> {
try {
String rawContent = new String(Files.readAllBytes(path));
SourceFileContent sourceFileContent = astWalker.extract(rawContent);
GraphFeaturesResult graphFeaturesResult = graphFeaturesAstWalker.extract(path.getFileName().toString(), rawContent);
FileDetails fileDetails = new FileDetails(sourceFileContent, graphFeaturesResult);
contentMap.put(path.toString(), fileDetails);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
objectMapper.writerWithDefaultPrettyPrinter().writeValue(new File(outputFile), contentMap);
}
}
| [
"mfejzer@mat.umk.pl"
] | mfejzer@mat.umk.pl |
46962248c7c126b9e40e1c7f6b739a12d088f49d | 2a51b18bdd39c550ff43e806050131c8d5fe218f | /com.demobank/src/main/java/com/demobank/domain/Customer.java | 128ed23acf756d7a6015feeb1566821167aae9db | [] | no_license | mvnguyen3/OnlineBankApp | 9c81ab132bfe2a7193e6d7643681bfeb56654f3c | 6392418988a5324de2c6bfb77ff4716f43cb9d66 | refs/heads/master | 2022-12-07T03:17:06.186696 | 2020-05-04T17:37:44 | 2020-05-04T17:37:44 | 218,149,068 | 1 | 0 | null | 2022-11-15T23:31:18 | 2019-10-28T21:30:56 | Java | UTF-8 | Java | false | false | 3,196 | java | package com.demobank.domain;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import org.springframework.format.annotation.DateTimeFormat;
@Entity(name = "customer") // Create table named customer
public class Customer {
@Id // Primary key
@GeneratedValue(strategy = GenerationType.IDENTITY) // Auto increment by SQL
private long customerId;
private String customerName;
private String customerEmail;
private String customerPhone;
private String customerGender;
private String customerSsn;
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
private String customerDob;
@Embedded // Depend on customer, does not require primary key
private Address address;
// 1 customer can have many accounts
@OneToMany
private Set<Account> customerAccounts = new HashSet<>();
@OneToOne
private User user;
public Customer() {
// TODO Auto-generated constructor stub
}
public long getCustomerId() {
return customerId;
}
public void setCustomerId(long customerId) {
this.customerId = customerId;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getCustomerEmail() {
return customerEmail;
}
public void setCustomerEmail(String customerEmail) {
this.customerEmail = customerEmail;
}
public String getCustomerPhone() {
return customerPhone;
}
public void setCustomerPhone(String customerPhone) {
this.customerPhone = customerPhone;
}
public String getCustomerGender() {
return customerGender;
}
public void setCustomerGender(String customerGender) {
this.customerGender = customerGender;
}
public String getCustomerSsn() {
return customerSsn;
}
public void setCustomerSsn(String customerSsn) {
this.customerSsn = customerSsn;
}
public String getCustomerDob() {
return customerDob;
}
public void setCustomerDob(String customerDob) {
this.customerDob = customerDob;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Set<Account> getCustomerAccounts() {
return customerAccounts;
}
public void setCustomerAccounts(Set<Account> customerAccounts) {
this.customerAccounts = customerAccounts;
}
public User getUsers() {
return user;
}
public void setUsers(User user) {
this.user = user;
}
@Override
public String toString() {
return "Customer [customerId=" + customerId + ", customerName=" + customerName + ", customerEmail="
+ customerEmail + ", customerPhone=" + customerPhone + ", customerGender=" + customerGender
+ ", customerSsn=" + customerSsn + ", customerDob=" + customerDob + ", address=" + address
+ ", customerAccounts=" + customerAccounts + ", users=" + user + "]";
}
}
| [
"mvnguy16@neiu.edu"
] | mvnguy16@neiu.edu |
d0418cac4e4b86c35fce8b0897b69b697f2138ef | 0680a0d9b6b77f69b3f46540e3347ae03f816e1e | /src/events/CameraPositionEventListener.java | bc5e4c1033b4b587bc3d201be5978d70f9a2fe5f | [] | no_license | kotplusha/objViewer | b44f4272577260babed3fae49b868c5c55847068 | 8bc64058d03b7395d401c8f1b61536410384a0d1 | refs/heads/master | 2021-01-20T13:23:26.588372 | 2017-05-06T20:33:52 | 2017-05-06T20:33:52 | 90,486,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 180 | java | package events;
import java.util.EventListener;
public interface CameraPositionEventListener extends EventListener{
public void onCameraPositionEvent(CameraPositionEvent e);
}
| [
"Mikita Manaichuk"
] | Mikita Manaichuk |
9b188d6e848d463d27227b9c2a1ceee08e0e25e2 | 577e8c989edd408086ecb2773322663a2083b4a1 | /JAVA/JavaSourceCode/src/Source/org/omg/CosNaming/NamingContextExtPackage/URLStringHelper.java | c8caea8edbc164c672596d647dca575446e3a690 | [] | no_license | hezhicai/JAVA | 72e0a0af878b0e3fdcc4cd0e9437a96870587356 | edb3fc551f4c6dad019b30865f8de9d0c53d7172 | refs/heads/master | 2022-12-15T01:34:26.428706 | 2020-09-10T10:29:38 | 2020-09-10T10:29:38 | 294,353,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,696 | java | package org.omg.CosNaming.NamingContextExtPackage;
/**
* org/omg/CosNaming/NamingContextExtPackage/URLStringHelper.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from d:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u40/2855/corba/src/share/classes/org/omg/CosNaming/nameservice.idl
* Tuesday, February 10, 2015 9:55:25 PM PST
*/
/**
* URLString is the URL address (corbaloc: or corbaname:) represented as
* a String.
*/
abstract public class URLStringHelper
{
private static String _id = "IDL:omg.org/CosNaming/NamingContextExt/URLString:1.0";
public static void insert (org.omg.CORBA.Any a, String that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static String extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
private static org.omg.CORBA.TypeCode __typeCode = null;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0);
__typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CosNaming.NamingContextExtPackage.URLStringHelper.id (), "URLString", __typeCode);
}
return __typeCode;
}
public static String id ()
{
return _id;
}
public static String read (org.omg.CORBA.portable.InputStream istream)
{
String value = null;
value = istream.read_string ();
return value;
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
{
ostream.write_string (value);
}
}
| [
"423767423687@qq.com"
] | 423767423687@qq.com |
18639840cba2c2d81aa053f4671c2a67a1e5414f | 42db27dfe0ebabad30b0cffb13458d986f17edf2 | /src/main/java/com/tts/transitapp/model/Bus.java | 1b680168a395e7130d424d9039af08fd8e4f96eb | [] | no_license | delancey/Java_Marta | 2b85362ba445c4329ca17092502b01413f7112ef | c5601387c3767a7ab2735fb70e0ff19202b38b05 | refs/heads/master | 2022-12-05T09:58:29.236648 | 2020-08-04T20:57:31 | 2020-08-04T20:57:31 | 285,058,138 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package com.tts.transitapp.model;
import lombok.Data;
@Data
public class Bus {
public String ADHERENCE;
public String BLOCKID;
public String BLOCK_ABBR;
public String DIRECTION;
public String LATITUDE;
public String LONGITUDE;
public String MSGTIME;
public String ROUTE;
public String STOPID;
public String TIMEPOINT;
public String TRIPID;
public String VEHICLE;
public double distance;
} | [
"dsdelancey@gmail.com"
] | dsdelancey@gmail.com |
0cb59f441885bdae069ddfc9246db5590ec87be9 | 73c84c1e8994bafa496306552542a31495c22ce6 | /reposi/Rishikesh_Khire_assign3/src/taskmanager/filters/UserFilter.java | 0d5f74b2e2a6abd72acfe2d967f3d706ca527685 | [] | no_license | rishik1/reposi | 107dd6999b37e942426dfc0a7bce78fbc46b0cdb | a24be4e2edf6b674957b393431c74487f2caaedf | refs/heads/master | 2021-01-02T23:07:10.050838 | 2017-05-11T06:33:14 | 2017-05-11T06:33:14 | 34,776,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 461 | java | package taskmanager.filters;
import taskmanager.util.Logger;
/**
* UseFilter implements the Filter Interface
* it implements the filter method
* @author aashay-Rishikesh
*
*/
public class UserFilter implements Fileter {
public UserFilter()
{
Logger.dump(2, "IN the UserFilter constructor ");
}
/**
* This method sets the value tab3 for the UserFilter
*/
@Override
public String filter() {
return "tab3";
}
}
| [
"rushikesh.khire@gmail.com"
] | rushikesh.khire@gmail.com |
75a2fa883a13de56c30b123b9b296fc052ebbe45 | 5a33440b865e3c5cb9cd7eea412ed1fa42313e2d | /spring-method-di/src/org/websparrow/beans/Car.java | 77f0c81da4e802356a4f33bb0242d481d1951858 | [
"Apache-2.0"
] | permissive | tanbinh123/spring-1 | b83267281dd065939865a2365f2826642f586dc3 | 54669d03bb62946f0cc9d0d0c31be13d98517862 | refs/heads/master | 2022-04-22T00:08:04.075867 | 2019-09-30T16:02:13 | 2019-09-30T16:02:13 | 479,906,680 | 1 | 0 | null | 2022-04-10T03:53:17 | 2022-04-10T03:53:16 | null | UTF-8 | Java | false | false | 95 | java | package org.websparrow.beans;
public interface Car {
public Engine myCarEngine();
}
| [
"Atul@Atul-PC"
] | Atul@Atul-PC |
c6967b5bee6e1bd97150348bd78acbc2f3ac2367 | a86dcaabb71b91cb2a61dc35bce016dfa6053069 | /api/src/test/java/api/modules/ApplicationE2EModuleTest.java | ac891a0f0c62015ce424b5d1f83bd1ce19299ed1 | [] | no_license | suowik/form3-payment-api | 5451572744e55ad89e19f4ebad3b71d5050283d1 | ae5e699dca000b1e2131954dfb1c66c3d3527f9d | refs/heads/master | 2020-04-25T00:24:21.974631 | 2019-02-26T15:21:49 | 2019-02-26T15:21:49 | 172,377,182 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,346 | java | package api.modules;
import api.model.Payment;
import io.restassured.RestAssured;
import io.vertx.reactivex.core.Vertx;
import org.hamcrest.Matchers;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.testcontainers.containers.GenericContainer;
import static io.restassured.RestAssured.given;
public class ApplicationE2EModuleTest {
@ClassRule
public static GenericContainer mongoTestClient = new GenericContainer<>("mongo:3.4.19-jessie")
.withExposedPorts(27017);
@BeforeClass
public static void setup() {
RestAssured.port = 64321;
var vertx = Vertx.vertx();
var application = ApplicationModule.createApplication(vertx,
new ApplicationModule.EnvironmentConfig(
new PersistenceModule.PersistenceConfig(
"localhost",
mongoTestClient.getMappedPort(27017),
"form3"
),
64321));
application.subscribe(server -> System.out.println("up and running"), Throwable::printStackTrace);
}
@Test
public void applicationShouldBeAbleToCreatePayment() {
given()
.header("x-request-id", "requestId")
.body(new Payment("", "", 0, "", null))
.post("/api/v1/payments")
.then()
.statusCode(201)
.body("paymentId", Matchers.notNullValue());
}
@Test
public void applicationShouldNotBeAbleToListPayment() {
given()
.get("/api/v1/payments")
.then()
.statusCode(501);
}
@Test
public void applicationShouldNotBeAbleToDeletePayment() {
given()
.delete("/api/v1/payments/anyPaymentId")
.then()
.statusCode(501);
}
@Test
public void applicationShouldNotBeAbleToGetPayment() {
given()
.get("/api/v1/payments/anyPaymentId")
.then()
.statusCode(501);
}
@Test
public void applicationShouldNotBeAbleToUpdatePayment() {
given()
.patch("/api/v1/payments/anyPaymentId")
.then()
.statusCode(501);
}
} | [
"pawel.slowik.extern@pentacor.de"
] | pawel.slowik.extern@pentacor.de |
547a47b9bccbf2814c99fa80ec712a110ff4fbdb | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/actorapp--actor-platform/00d8bf64c793173cfb8f8912bf2f42cba199b6da/before/ConnectingStateChanged.java | c678faca995f3872ae9758ad71ded4649fb7da5b | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package im.actor.core.modules.events;
import im.actor.runtime.eventbus.Event;
public class ConnectingStateChanged extends Event {
public static final String EVENT = "connecting_state_changed";
private boolean isConnecting;
public ConnectingStateChanged(boolean isConnecting) {
this.isConnecting = isConnecting;
}
public boolean isConnecting() {
return isConnecting;
}
@Override
public String getType() {
return EVENT;
}
@Override
public String toString() {
return EVENT + " {" + isConnecting + "}";
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
e78bb16336c6d0fc64e0de29eaf0d007715b7d3a | f1e0ab8fd3493521000cfd98c8c05ba4931b2951 | /src/main/java/walker/blue/beacon/lib/utils/CompatibilityManager.java | 7c8ea1a8852bfc7638f45004d3025cacf7e6f167 | [] | no_license | BlueWalker/BeaconLib | fff81999a3d6fa05191ea3f9fe9de19da6cf7d4f | 6877692fcc886d41a98308c673fd3e93b28b5805 | refs/heads/master | 2021-01-10T21:34:01.223268 | 2015-05-01T13:48:11 | 2015-05-01T13:48:11 | 27,715,449 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,930 | java | package walker.blue.beacon.lib.utils;
import android.content.Context;
import android.content.pm.PackageManager;
import android.util.Log;
/**
* Class in charge of checking device compatibility with Bluetooth LE
* TODO Add separate check for different things?
*/
public class CompatibilityManager {
/**
* Log message for devices running an unsupported version of android
*/
private static final String INVALID_VERSION_MESSAGE =
"Android version (%d) on device does not support Bluetooth LE";
/**
* Log message for when the device doesnt support BLE
*/
private static final String UNSUPPORTED_DEVICE_MESSAGE =
"Device does not support Bluetooth LE";
/**
* Log message for when the CompatibilityManager isn't initialized
*/
private static final String INITALIZATION_ERROR =
"CompatibilityManager has not been initalized";
/**
* Holds the application context
*/
private static Context applicationContext;
/**
* Private constructor so this class can't be initialized
*/
private CompatibilityManager() {}
/**
* Initializes the CompatibilityManager
*
* @param context Context
*/
public static void init(final Context context) {
applicationContext = context;
}
/**
* Indicates whether the CompatibilityManager has been initialized
*
* @return boolean
*/
public static boolean isInitalized() {
return applicationContext != null;
}
/**
* Checks if version of android the device is running and the device
* hardware supports Bluetooth LE. If the device doesn't support BLE,
* the reasons will be printed to the log. If the class has not yet
* been initialized, false will be returned TODO Check more things?
*
* @return boolean
*/
public static boolean isDeviceCompatible() {
if (!isInitalized()) {
Log.w(getClassName(), INITALIZATION_ERROR);
return false;
}
// Check if device is running at least android version 4.3
final int deviceVersion = android.os.Build.VERSION.SDK_INT;
//Check if device hardware supports BLE
final boolean compatibleHardware = applicationContext.getPackageManager()
.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE);
if (deviceVersion < 18) {
Log.w(getClassName(), String.format(INVALID_VERSION_MESSAGE, deviceVersion));
}
if (!compatibleHardware) {
Log.w(getClassName(), UNSUPPORTED_DEVICE_MESSAGE);
}
return deviceVersion >= 18 && compatibleHardware;
}
/**
* Gets the class name since we can't use this.getClass()
* from static methods
*
* @return String
*/
public static String getClassName() {
return CompatibilityManager.class.getName();
}
} | [
"acompag@gmail.com"
] | acompag@gmail.com |
b05eb2e0b03a1404a26d64642ea97eb90a0a3edc | 2eeff73686aea02b4b59b1a02fe9abc60987da86 | /user/src/test/java/org/tessell/model/dsl/WhenConditionsTest.java | 04115b32d5ff6816a97238b26a2f700a89f3b68e | [
"Apache-2.0"
] | permissive | jcarver989/tessell | bef33893a68f6103c3734f97f279f8b63ea891d9 | f35eb952386f55c00d61faf65d665deff1895ab4 | refs/heads/master | 2021-04-15T14:38:03.650868 | 2012-08-13T17:55:41 | 2012-08-13T17:55:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package org.tessell.model.dsl;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.tessell.model.dsl.WhenConditions.greaterThan;
import static org.tessell.model.dsl.WhenConditions.lessThan;
import static org.tessell.model.properties.NewProperty.integerProperty;
import org.junit.Test;
import org.tessell.model.properties.IntegerProperty;
public class WhenConditionsTest {
@Test
public void testGreaterThan() {
IntegerProperty i = integerProperty("i", 1);
assertThat(greaterThan(0).evaluate(i), is(true));
assertThat(greaterThan(1).evaluate(i), is(false));
assertThat(greaterThan(2).evaluate(i), is(false));
}
@Test
public void testLessThan() {
IntegerProperty i = integerProperty("i", 1);
assertThat(lessThan(0).evaluate(i), is(false));
assertThat(lessThan(1).evaluate(i), is(false));
assertThat(lessThan(2).evaluate(i), is(true));
}
}
| [
"stephen@exigencecorp.com"
] | stephen@exigencecorp.com |
e19752b8ec0baf5632acc680d6ea60b82f1d4fed | 1668008996b92ff1547270650833243260abe1bc | /src/main/java/jp/uphy/dsptn/factory/abstractfactory2/ReggianoCheese.java | fc097057c20de549576d5880fb2d2d0462d0faba | [] | no_license | uphy/design-pattern | 221e684e6f086eff6b4c2d97402dd216491630de | 24650b0c5a45bfb37d385d16de98153cc72efaa9 | refs/heads/master | 2021-07-03T09:29:41.599993 | 2013-01-12T13:37:16 | 2013-01-12T13:37:16 | 4,689,625 | 0 | 0 | null | 2020-10-13T08:33:47 | 2012-06-17T04:31:32 | Java | UTF-8 | Java | false | false | 733 | java | /**
* Copyright (C) 2012 uphy.jp
*
* 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 jp.uphy.dsptn.factory.abstractfactory2;
/**
* @author Yuhi Ishikura
*/
public class ReggianoCheese implements Cheese {
}
| [
"yuhi.ishikura@gmail.com"
] | yuhi.ishikura@gmail.com |
5b0b794eadb3575a86de5c18842d48aed3ec094e | 523f1edce6a9213fab03388c7c1039426b9fe186 | /src/main/java/com/minakov/railwayticketbookingjdbc/exception/UserNotFoundException.java | f775969986a504d5ed43dfad9c43c2ed48059763 | [] | no_license | MinakovYaroslav/railway-ticket-booking-jdbc | 74e6cd823936e12e4b48b31e0964e2518f748181 | 953deee72fc1c80f11641eb8674664d2cc809e84 | refs/heads/master | 2022-06-24T22:16:22.867171 | 2019-11-22T20:21:27 | 2019-11-22T20:21:27 | 221,920,487 | 1 | 0 | null | 2022-06-21T02:14:37 | 2019-11-15T12:33:09 | Java | UTF-8 | Java | false | false | 340 | java | package com.minakov.railwayticketbookingjdbc.exception;
public class UserNotFoundException extends Throwable {
private String message;
public UserNotFoundException(String userId) {
this.message = "User with id " + userId + " not found";
}
@Override
public String toString() {
return message;
}
}
| [
"minakov.yaroslav92@gmail.com"
] | minakov.yaroslav92@gmail.com |
7c396e80356677ac4efdd0a1b301be605f6a3dba | 738193cedbbbf280b915360eb36bc9d3be8aebd8 | /src/CodeNInja/Pattern1.java | 58d94b69dd262c38d99f679bd8acae1642af712e | [] | no_license | sainath0056/BasicInterviewProgramms | 39e3033997da4e2c69cd1b3186c33bce5b321521 | f73adab54fbf92c5a003da2a3fb28f3c52bb43a9 | refs/heads/master | 2022-12-30T06:07:44.425732 | 2020-08-31T08:52:13 | 2020-08-31T08:52:13 | 281,362,776 | 0 | 0 | null | 2020-10-13T23:46:26 | 2020-07-21T10:08:04 | Java | UTF-8 | Java | false | false | 322 | java | package CodeNInja;
import java.util.Scanner;
public class Pattern1 {
public static void main(String[] args) {
Scanner s1=new Scanner(System.in);
int n=s1.nextInt();
int i=1;
while(i<=n) {
int j=1;
while(j<=n) {
System.out.print('*');
j++;
}
System.out.println();
i++;
}
}
}
| [
"stalagad@igategegdc.com"
] | stalagad@igategegdc.com |
652a357f871876cab6b8cb1c1c02510812269f1c | 715e9f3ecb948900349840a34e58091ecf78a1fa | /TCC/Academics-Copia-JV/Academics/src/BUS/package-info.java | e6bb277b64a2fcc5d4dfb2c10dada566de6a5c07 | [] | no_license | brunosversutti/ProjetoWebJava | dc4247609ce956d598b626ba0961cfb46a110efd | 7ea6544e1e82e2073e87aa83944a8568e9a3d1ad | refs/heads/master | 2021-01-09T12:28:41.364191 | 2020-02-22T08:18:30 | 2020-02-22T08:18:30 | 242,300,454 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 53 | java | /**
*
*/
/**
* @author Carlos
*
*/
package BUS; | [
"58674202+brunobrsv@users.noreply.github.com"
] | 58674202+brunobrsv@users.noreply.github.com |
aaf2bc348bb4601561599b59645899754c6c3ce0 | b40289ee8ef55297445172cec0ce71b6a2cd4d04 | /src/main/java/boot/spring/controller/CustomerController.java | f206dbe30ba69dfed40d678d8ac9b7b2ba498d11 | [] | no_license | wnagmi/tables | cec04d6ba8a8dd8703492c3513a3dcabc28e0a56 | 25d83ec31509fbaca8a85c72e4504e47224947c0 | refs/heads/master | 2020-04-16T13:38:40.043810 | 2019-01-14T09:50:54 | 2019-01-14T09:50:54 | 165,636,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 729 | java | package boot.spring.controller;
import boot.spring.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class CustomerController {
@Autowired
private CustomerService customerService;
@RequestMapping("/list")
@ResponseBody
public String list(Model model) {
model.addAttribute("test" ,customerService.selectAll());
return "index";
}
@RequestMapping("/test")
public String pages (){
return "test";
}
}
| [
"wangmiclam@163.com"
] | wangmiclam@163.com |
c9cdd15c61a99493d60e99ee66390062b262347e | 57506a5f157aa52e6b9075e351945273ab0c4bd0 | /app/src/androidTest/java/dev/jsoh/reactiveandroidexam/ExampleInstrumentedTest.java | f1a15c74b0a7b795aa635d1bf422abd905c7e8f0 | [] | no_license | junsuk5/ReactiveAndroidExam | b40990e63402b00d3628f4f32b7b48ceaa6994ca | c38eb1423738d341f7c3575d063892aa48acc2c3 | refs/heads/master | 2020-05-14T12:55:59.636706 | 2019-04-17T02:52:00 | 2019-04-17T02:52:00 | 181,802,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package dev.jsoh.reactiveandroidexam;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("dev.jsoh.reactiveandroidexam", appContext.getPackageName());
}
}
| [
"a811219@gmail.com"
] | a811219@gmail.com |
607575add9c98ae4a25b752be4d35d9dc0c3909d | dfb9aa409e0c7377de8962c48e45025e17a699cf | /src/main/java/com/spring/base/service/BlogMenuService.java | 6a4c8f0188881cbf4923b451d1b5631b3ada6dc0 | [] | no_license | hinzzz/spring-learn | 7199085c57a5df278ebe64cdb69b3bb86a45a9d7 | 874698dfb7bc16dc73a0006196cc0d6c6097addd | refs/heads/master | 2022-07-04T02:59:37.835859 | 2019-10-14T10:00:16 | 2019-10-14T10:00:16 | 208,729,264 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.spring.base.service;
import com.spring.base.model.user.BlogMenu;
import com.baomidou.mybatisplus.service.IService;
/**
* <p>
* 菜单表 服务类
* </p>
*
* @author hinzzz
* @since 2019-10-14
*/
public interface BlogMenuService extends IService<BlogMenu> {
}
| [
"157957329@qq.com"
] | 157957329@qq.com |
79d355d2da08f2bdfbce7ceb230f7ecfe8da89ff | ca555c951f1a37e7c4cbf6d982fdb53fedceb5eb | /src/test/java/org/sonar/samples/java/checks/AvoidComplexConditionCheckTest.java | e5e75f746e1c51d719ddcd9b78599ffe798beb6a | [] | no_license | halo-check/sonarqube_java_custom_rule | b4444197fdb7a6ae4759d7e9366401a5b1e2a443 | 3166a37e9a7ba5f1e5e54f9b869c45e512f08ce1 | refs/heads/master | 2022-02-02T11:08:55.547456 | 2018-11-22T07:26:05 | 2018-11-22T07:26:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | package org.sonar.samples.java.checks;
import org.junit.Test;
import org.sonar.java.checks.verifier.JavaCheckVerifier;
import org.sonar.samples.java.checks.exception.AvoidReturnInFinallyCheck;
import org.sonar.samples.java.checks.flowcontrol.AvoidComplexConditionCheck;
public class AvoidComplexConditionCheckTest {
@Test
public void test() {
//JavaCheckVerifier.verify("src/test/files/exception/IfStatementDemo.java", new AvoidComplexConditionCheck());
}
}
| [
"chenzhouwy@163.com"
] | chenzhouwy@163.com |
f7f1386721615ffb5f6c7d3f482b69c77f67a81d | 66575eeac5b0a52c36e776eb3c9108de4a5ce605 | /src/main/java/com/linxtt/core/service/impl/BaseDictServiceImpl.java | 9d155cfcead5fe00802aac87dbfcd261a3cd4a0d | [] | no_license | linxtt/Customer_Management | 18cfa6b2d49b2e0d1602cdbe99a84d8fafba43e8 | 2837af44390cd048ec50ef95f42d4217767aad39 | refs/heads/master | 2020-04-25T20:20:07.353771 | 2019-02-28T06:54:15 | 2019-02-28T06:54:15 | 173,048,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 614 | java | package com.linxtt.core.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.linxtt.core.dao.BaseDictDao;
import com.linxtt.core.po.BaseDict;
import com.linxtt.core.service.BaseDictService;
@Service("baseDictService")
public class BaseDictServiceImpl implements BaseDictService {
@Autowired
private BaseDictDao baseDictDao;
@Override
public List<BaseDict> findBaseDictByTypeCode(String typecode) {
// TODO Auto-generated method stub
return baseDictDao.selectBaseDictByTypeCode(typecode);
}
}
| [
"845208259@qq.com"
] | 845208259@qq.com |
13ef46192e4a34d559cce204b9e56e2ccae99400 | 421f96cf54e07507eebaa6f662ac396003930f4a | /APCS2/hw34-queue/Queue.java | 287c3fd81dcae7bc840fe4cbeef7c7d5d07e07b8 | [] | no_license | qzhou0/AP251-Smster-1 | fb703915146c89d767c9a2c3ca48a10044e41c7a | 3e0a3365fadd5f469a117f26395accc9b0bb5812 | refs/heads/master | 2021-10-28T20:40:48.369511 | 2019-04-24T23:31:47 | 2019-04-24T23:31:47 | 111,107,718 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 1,153 | java | //Qian Zhou
//APCS2 pd01
//HW34 -- The English Do Not Wait In Line for Soup or Anything Else; They ˇ°Queue Upˇ±
//2018-04-13
/*****************************************************
* interface Queue
* Includes only methods listed in AP subset of Java
* (Local version, to override built-in Java implementation.)
******************************************************/
public interface Queue<Quasar> {
//~~~~~~~~~~~~~~~~~~begin AP subset~~~~~~~~~~~~~~~~~~
//means of removing an element from collection:
//Dequeues and returns the first element of the queue.
public Quasar dequeue();
//means of adding an element to collection:
//Enqueue an element onto the back of this queue.
public void enqueue( Quasar x );
//Returns true if this queue is empty, otherwise returns false.
public boolean isEmpty();
//Returns the first element of the queue without dequeuing it.
public Quasar peekFront();
//~~~~~~~~~~~~~~~~~~~end AP subset~~~~~~~~~~~~~~~~~~~
}//end interface Queue
| [
"qzhou@stuy.edu"
] | qzhou@stuy.edu |
92527e6274144d039ccf46528c7b48599edcb1e6 | f40c5613a833bc38fca6676bad8f681200cffb25 | /kubernetes-model-generator/openshift-model-hive/src/generated/java/io/fabric8/openshift/api/model/hive/v1/SelectorSyncIdentityProviderList.java | cf661f6488cf6965420aeaa45d5e650c07a2515f | [
"Apache-2.0"
] | permissive | rohanKanojia/kubernetes-client | 2d599e4ed1beedf603c79d28f49203fbce1fc8b2 | 502a14c166dce9ec07cf6adb114e9e36053baece | refs/heads/master | 2023-07-25T18:31:33.982683 | 2022-04-12T13:39:06 | 2022-04-13T05:12:38 | 106,398,990 | 2 | 3 | Apache-2.0 | 2023-04-28T16:21:03 | 2017-10-10T09:50:25 | Java | UTF-8 | Java | false | false | 5,320 | java |
package io.fabric8.openshift.api.model.hive.v1;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.fabric8.kubernetes.api.model.Container;
import io.fabric8.kubernetes.api.model.IntOrString;
import io.fabric8.kubernetes.api.model.KubernetesResource;
import io.fabric8.kubernetes.api.model.KubernetesResourceList;
import io.fabric8.kubernetes.api.model.LabelSelector;
import io.fabric8.kubernetes.api.model.ListMeta;
import io.fabric8.kubernetes.api.model.LocalObjectReference;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.ObjectReference;
import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
import io.fabric8.kubernetes.api.model.PodTemplateSpec;
import io.fabric8.kubernetes.api.model.ResourceRequirements;
import io.fabric8.kubernetes.model.annotation.Group;
import io.fabric8.kubernetes.model.annotation.Version;
import io.sundr.builder.annotations.Buildable;
import io.sundr.builder.annotations.BuildableReference;
import lombok.EqualsAndHashCode;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
@JsonDeserialize(using = com.fasterxml.jackson.databind.JsonDeserializer.None.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"apiVersion",
"kind",
"metadata",
"items"
})
@ToString
@EqualsAndHashCode
@Setter
@Accessors(prefix = {
"_",
""
})
@Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = {
@BuildableReference(ObjectMeta.class),
@BuildableReference(LabelSelector.class),
@BuildableReference(Container.class),
@BuildableReference(PodTemplateSpec.class),
@BuildableReference(ResourceRequirements.class),
@BuildableReference(IntOrString.class),
@BuildableReference(ObjectReference.class),
@BuildableReference(LocalObjectReference.class),
@BuildableReference(PersistentVolumeClaim.class)
})
@Version("v1")
@Group("hive.openshift.io")
public class SelectorSyncIdentityProviderList implements KubernetesResource, KubernetesResourceList<io.fabric8.openshift.api.model.hive.v1.SelectorSyncIdentityProvider>
{
/**
*
* (Required)
*
*/
@JsonProperty("apiVersion")
private String apiVersion = "hive.openshift.io/v1";
@JsonProperty("items")
private List<io.fabric8.openshift.api.model.hive.v1.SelectorSyncIdentityProvider> items = new ArrayList<io.fabric8.openshift.api.model.hive.v1.SelectorSyncIdentityProvider>();
/**
*
* (Required)
*
*/
@JsonProperty("kind")
private String kind = "SelectorSyncIdentityProviderList";
@JsonProperty("metadata")
private ListMeta metadata;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
/**
* No args constructor for use in serialization
*
*/
public SelectorSyncIdentityProviderList() {
}
/**
*
* @param metadata
* @param apiVersion
* @param kind
* @param items
*/
public SelectorSyncIdentityProviderList(String apiVersion, List<io.fabric8.openshift.api.model.hive.v1.SelectorSyncIdentityProvider> items, String kind, ListMeta metadata) {
super();
this.apiVersion = apiVersion;
this.items = items;
this.kind = kind;
this.metadata = metadata;
}
/**
*
* (Required)
*
*/
@JsonProperty("apiVersion")
public String getApiVersion() {
return apiVersion;
}
/**
*
* (Required)
*
*/
@JsonProperty("apiVersion")
public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}
@JsonProperty("items")
public List<io.fabric8.openshift.api.model.hive.v1.SelectorSyncIdentityProvider> getItems() {
return items;
}
@JsonProperty("items")
public void setItems(List<io.fabric8.openshift.api.model.hive.v1.SelectorSyncIdentityProvider> items) {
this.items = items;
}
/**
*
* (Required)
*
*/
@JsonProperty("kind")
public String getKind() {
return kind;
}
/**
*
* (Required)
*
*/
@JsonProperty("kind")
public void setKind(String kind) {
this.kind = kind;
}
@JsonProperty("metadata")
public ListMeta getMetadata() {
return metadata;
}
@JsonProperty("metadata")
public void setMetadata(ListMeta metadata) {
this.metadata = metadata;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| [
"marc@marcnuri.com"
] | marc@marcnuri.com |
bd6b96da6ba48ac51d76a386bf28bf4aa3ec979b | e8f19486803dc25526598aed26873e6bb5c478b2 | /src/com/android/gallery3d/filtershow/state/PanelTrack.java | d15e139099032a24783d372b6e88d6b5262a5fa6 | [] | no_license | Jimmy8618/NewGallery2 | 741d41e9c179e21eca714c1b1a7e588310b9a354 | ec38ce207c950e63f2d0c6f8a07cacbc5a530a07 | refs/heads/main | 2023-03-02T16:23:21.681021 | 2021-02-03T02:31:56 | 2021-02-03T02:31:56 | 335,483,234 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,229 | java | /*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.gallery3d.filtershow.state;
import android.graphics.Point;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Adapter;
public interface PanelTrack {
int getOrientation();
void onTouch(MotionEvent event, StateView view);
StateView getCurrentView();
void setCurrentView(View view);
Point getTouchPoint();
View findChildAt(int x, int y);
int findChild(View view);
Adapter getAdapter();
void fillContent(boolean value);
View getChildAt(int pos);
void setExited(boolean value);
void checkEndState();
}
| [
"jimmy8618@163.com"
] | jimmy8618@163.com |
f7a10c68cf53e59580c04faf382e31ce80d47240 | 0933e64d6ead5743df73abbea1c11a286f44ee8f | /src/ArrayOfPhone.java | f72ce48737eaaf54b7a39fa1e0b69ac44e5e1c6b | [] | no_license | OnlineCounselling/Xero-Accounting-API-Classes | 0ac808dade90c2fabc68a75e9d11b1fc07256c6e | c9aba4f9910bdf11dbe8984006b7f14119f2e1b3 | refs/heads/master | 2021-01-21T14:24:04.391423 | 2016-06-24T01:02:31 | 2016-06-24T01:02:31 | 59,336,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,192 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.05.10 at 01:28:15 PM EST
//
package com.xeroobjects.xero;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ArrayOfPhone complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ArrayOfPhone">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Phone" type="{}Phone" maxOccurs="4" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfPhone", propOrder = {
"phone"
})
public class ArrayOfPhone {
@XmlElement(name = "Phone", nillable = true)
protected List<Phone> phone;
/**
* Gets the value of the phone property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the phone property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPhone().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Phone }
*
*
*/
public List<Phone> getPhone() {
if (phone == null) {
phone = new ArrayList<Phone>();
}
return this.phone;
}
}
| [
"support@onlinecounselling.io"
] | support@onlinecounselling.io |
5f06d73845d2e0c5d36372feb9a76cdfa8b16b1d | cc6679e93340935c22d15984f1a939d15867721b | /src/RegexEx/ExtractEmails.java | 5a106e07d7e8bdb3bd89bcab57e16fc886d3994e | [] | no_license | GerganaL/JavaFundamentals-2020-Softuni | 2cd21f31e9cd500e3dedde0f5562e54749e4c70f | 8f7cae0ff424b8a44346c1c47a69af455c1ccdc6 | refs/heads/master | 2023-01-30T18:36:35.274829 | 2020-12-12T08:03:11 | 2020-12-12T08:03:11 | 318,480,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package RegexEx;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ExtractEmails {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String input = scan.nextLine();
String userRegex = "((?<=\\s)[a-zA-Z0-9]+([-.]\\w*)*@[a-zA-Z]+?([.-][a-zA-Z]*)*(\\.[a-z]{2,}))";
Pattern userPattern = Pattern.compile(userRegex);
Matcher matcher = userPattern.matcher(input);
while (matcher.find()){
System.out.println(matcher.group());
}
}
}
| [
"lulchevagergana@gmail.com"
] | lulchevagergana@gmail.com |
11d378daec20a9f65cae83baafcc906a32f0034a | 18ad9770f9e430e2f48deceed37416735940312d | /app/src/main/java/com/boala/fixcar/MaxHeightLinearLayout.java | 8f0d92a2f5ce7a28dcf49fee3bc23b6aa26c384f | [] | no_license | samusamu2304/FixCar | 55f4e7c878205a3324ce27f3cd0cfc928905e3ab | 5cebe387ee52dd928874f94c1b68226b10faf1de | refs/heads/master | 2022-11-18T20:04:02.048708 | 2020-06-22T08:26:41 | 2020-06-22T08:26:41 | 265,013,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | package com.boala.fixcar;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import com.google.android.material.internal.ViewUtils;
public class MaxHeightLinearLayout extends LinearLayout {
private int maxHeightDp;
public MaxHeightLinearLayout(Context context) {
super(context);
}
public MaxHeightLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
final TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.MaxHeightLinearLayout, 0, 0);
try {
maxHeightDp = a.getInteger(R.styleable.MaxHeightLinearLayout_maxHeightDp, 0);
} finally {
a.recycle();
}
}
public MaxHeightLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
@SuppressLint("RestrictedApi") int maxHeightPx = (int) ViewUtils.dpToPx(getContext(),maxHeightDp);
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeightPx, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
public void setMaxHeightDp(int maxHeightDp) {
this.maxHeightDp = maxHeightDp;
invalidate();
}
}
| [
"46870006+BoalaTheGod@users.noreply.github.com"
] | 46870006+BoalaTheGod@users.noreply.github.com |
97bcff4fa9e25448c7fd12d6a7b0e829362210c3 | ce7d74a491fb36242692a960837c9f13619cb038 | /testprojects/java/recognition/localvariables/a/TheType.java | fac58ccad17a49cbc15f91d7486a0beeda4acf56 | [
"MIT"
] | permissive | senkz/HUSACCT | f6f7cf8fcc12d7f156e12e02be785b372cf26c70 | 4888062b1a933c5e8458a6d087a3c6f3781207e7 | refs/heads/master | 2020-12-25T01:45:23.249006 | 2013-06-24T08:00:46 | 2013-06-24T08:01:01 | 8,951,329 | 0 | 1 | null | 2013-06-25T16:13:45 | 2013-03-22T12:22:53 | Java | UTF-8 | Java | false | false | 55 | java | package localvariables.a;
public class TheType {
}
| [
"erikblanken@gmail.com"
] | erikblanken@gmail.com |
8b60154495ea0a235ca9b382dae2195eb20c784c | 8511b8f7f37885ae30e2a0970a41f14acf9fe9c6 | /shared/src/com/tinyparty/game/shared/RequestPlayerFireJson.java | ba7ae16efdac6fdf3e6dd8b3d208fe758ecdcb21 | [] | no_license | julianmaster/TinyParty | 8124f475b43887ac2084f26a598c391b9ee67edc | 4ac741c9ceea0a0a534cec329c6832b5381e8ba0 | refs/heads/master | 2020-04-09T06:11:37.146756 | 2019-03-03T17:28:09 | 2019-03-03T17:28:09 | 160,102,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package com.tinyparty.game.shared;
public class RequestPlayerFireJson {
public int idPlayer;
public float x;
public float y;
public float worldClickCoordsX;
public float worldClickCoordsY;
public float worldClickCoordsZ;
public String bulletSizeSpeedParameter;
public String bulletDistanceAmountParameter;
}
| [
"julienm86230@hotmail.fr"
] | julienm86230@hotmail.fr |
776dcd5f2ea3d2e8185d1f493fe762a2e9a7126b | 4f3fbd90662e4e0607809025c3709017c305c2d7 | /iters-service/src/main/java/com/xinghui/service/PersonalFileService.java | 6331e668a19fee01dd21f3f96c111dff024ef08e | [] | no_license | chenkuanxing/iters | f76332aec5648317f35683c51c7a52b3d57a3043 | 4e65eab3445e98e60023cf03ff94ad3cb1d4d453 | refs/heads/master | 2022-07-09T07:29:30.128430 | 2020-05-22T09:00:37 | 2020-05-22T09:00:37 | 195,210,743 | 1 | 0 | null | 2022-06-29T17:29:19 | 2019-07-04T09:23:47 | JavaScript | UTF-8 | Java | false | false | 489 | java | package com.xinghui.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xinghui.dot.PersonalFileDot;
import com.xinghui.entity.PersonalFile;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
public interface PersonalFileService extends IService<PersonalFile> {
boolean create(PersonalFileDot personalFileDot);
String fileUpload(MultipartFile file);
}
| [
"12345678"
] | 12345678 |
23287259f052797e934b25b14e31915324447714 | cbceb8bbeb7666bd27a949058c3c47bf6cfd93d1 | /src/main/java/br/com/fef/campingclubapi/service/ImplUserDetailsService.java | 8e79d2f16aa944cf7757f005eed62b7c7717bb2e | [] | no_license | JJAnony/campingclub-api | a2d019e50d8b3f145146404edfab0b9df59cb0b7 | 7f877899b37422f096a845ec6d0917fa0a4051ac | refs/heads/master | 2023-03-24T16:46:51.988152 | 2021-03-24T02:20:29 | 2021-03-24T02:20:29 | 237,833,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 874 | java | package br.com.fef.campingclubapi.service;
import br.com.fef.campingclubapi.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class ImplUserDetailsService implements UserDetailsService {
@Autowired
private UserRepository userRepository;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
return Optional.ofNullable(userRepository.findByUsername(username)).orElseThrow(() -> new UsernameNotFoundException("Usuario Não Foi Encontrado!"));
}
}
| [
"jcolivati@gmail.com"
] | jcolivati@gmail.com |
9298c18d65cf671f7b483aa3d3ba34e68d52c67d | b1aaf43ed60f6f91f32f909783dd35aab4ac346b | /H2RDF+v0.2/src/main/java/gr/ntua/h2rdf/concurrent/QueueDP.java | 74b5b29bf3e394b695d4bd582a0fea44b5a01b57 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | npapa/h2rdf | 96bd8f5861c26e564b1a2756983218455af549b6 | b1d8d05cc21d0a23adf64877f0bc2244b99e7584 | refs/heads/master | 2021-01-13T01:55:42.406671 | 2015-09-24T06:00:46 | 2015-09-24T06:00:46 | 32,719,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,006 | java | /*******************************************************************************
* Copyright 2014 Nikolaos Papailiou
*
* 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 gr.ntua.h2rdf.concurrent;
import gr.ntua.h2rdf.dpplanner.CachingExecutor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooDefs.Ids;
import org.apache.zookeeper.data.Stat;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryFactory;
public class QueueDP extends Queue {
int first;
String separator = "$query$" ;
public static boolean cacheResults=false;
/**
* Constructor of producer-consumer queue
*
* @param address
* @param cacheResults
* @param name
*/
QueueDP(String address, String input, String output, String cacheResults) {
super(address, input, output);
if(cacheResults.equals("true")){
this.cacheResults=true;
}
else{
this.cacheResults=false;
}
}
/**
* Add element to the queue.
*
* @param i
* @return
*/
boolean produce(String query, Watcher w) throws KeeperException, InterruptedException{
byte[] value;
value = Bytes.toBytes(query);
String f =zk.create(input + "/element", value, Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT_SEQUENTIAL);
String filename = "/out/"+f.split("/")[2];
//System.out.println(filename);
//zk.exists(filename, w);
return true;
}
/**
* Remove first element from the queue.
*
* @return
* @throws KeeperException
* @throws InterruptedException
*/
int consume(int id) throws KeeperException, InterruptedException{
Stat stat = null;
// Get the first element available
while (true) {
synchronized (mutex) {
/*List<String> sync = zk.getChildren("/sync", true);
if(sync.size()==0){
System.out.println("Going to wait:");
mutex.wait();
//Thread.sleep(500);
}
else{*/
List<String> list = zk.getChildren(input, true);
System.out.println(first+" "+list.size());
if(list.size()==0){
System.out.println("Going to wait:");
mutex.wait();
//Thread.sleep(500);
}
else{
/*Integer min = new Integer(list.get(0).substring(7));
String minval=list.get(0).substring(7);
for(String s : list){
Integer tempValue = new Integer(s.substring(7));
//System.out.println("Temporary value: " + tempValue);
if(tempValue < min){
min = tempValue;
minval = s.substring(7);
}
}*/
Random g2 = new Random();
int i = g2.nextInt(list.size());
String minval=list.get(i).substring(7);
String filename=input+"/element" + minval;
System.out.println("Temporary file: " + filename);
byte[] b = zk.getData(filename,false, stat);
zk.delete(filename, 0);
if(b[0]!=(byte)0){
byte type = b[0];
byte[] input = new byte[b.length-1];
for (int j = 0; j < input.length; j++) {
input[j] = b[j+1];
}
System.out.println("Api request type: "+type);
//byte[] outfile = Bytes.toBytes("Hello from server!!");
ClassLoader parentClassLoader = MyClassLoader.class.getClassLoader();
MyClassLoader classLoader = new MyClassLoader(parentClassLoader);
classLoader.clearAssertionStatus();
String classNameToBeLoaded = "gr.ntua.h2rdf.apiCalls.ApiCalls";
try {
Class myClass = classLoader.loadClass(classNameToBeLoaded);
Object whatInstance = myClass.newInstance();
Method myMethod = myClass.getMethod("process",
new Class[] { byte.class, byte[].class });
byte[] outfile = (byte[]) myMethod.invoke(whatInstance,
new Object[] { type, input });
//byte[] outfile = ExampleApiCall.process(b);
if(outfile!=null){
zk.create(output + "/element" + minval, outfile,Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
byte[] outfile = Bytes.toBytes(e.getMessage());
zk.create(output + "/element" + minval, outfile,Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
byte[] outfile = Bytes.toBytes(e.getMessage());
zk.create(output + "/element" + minval, outfile,Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
byte[] outfile = Bytes.toBytes(e.getMessage());
zk.create(output + "/element" + minval, outfile,Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
byte[] outfile = Bytes.toBytes(e.getMessage());
zk.create(output + "/element" + minval, outfile,Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
byte[] outfile = Bytes.toBytes(e.getMessage());
zk.create(output + "/element" + minval, outfile,Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
byte[] outfile = Bytes.toBytes(e.getMessage());
zk.create(output + "/element" + minval, outfile,Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e.getCause().toString());
byte[] outfile = Bytes.toBytes(e.getMessage());
zk.create(output + "/element" + minval, outfile,Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
}
return 1;
}
if(b.length>=2){
try {
long startTimeReal = new Date().getTime();
byte[] input = new byte[b.length-1];
for (int j = 0; j < input.length; j++) {
input[j]=b[j+1];
}
b=input;
String data = Bytes.toString(b);
String params = data.substring(0,data.indexOf(separator));
StringTokenizer tok = new StringTokenizer(params);
String table=tok.nextToken("|");
//String algo=tok.nextToken("|");
//String pool=tok.nextToken("|");
//System.out.println("t "+table);
String q = data.substring(data.indexOf(separator)+separator.length());
//System.out.println(q);
Query query = QueryFactory.create(q) ;
// h2rdf new
Configuration hconf = HBaseConfiguration.create();
hconf.set("hbase.rpc.timeout", "3600000");
hconf.set("zookeeper.session.timeout", "3600000");
CachingExecutor.connectTable(table, hconf);
CachingExecutor executor = new CachingExecutor(table,id);
startTimeReal = new Date().getTime();
executor.executeQuery(query,true, cacheResults);
long stopTime = new Date().getTime();
System.out.println("Real time in ms: "+ (stopTime-startTimeReal));
/* // Generate algebra
Op opQuery = Algebra.compile(query) ;
System.out.println(opQuery) ;
//op = Algebra.optimize(op) ;
//System.out.println(op) ;
MyOpVisitor v = new MyOpVisitor(minval, query);
//v.setQuery(query);
JoinPlaner.setTable(table, "4", "pool45");
JoinPlaner.setQuery(query);
OpWalker.walk(opQuery, v);
v.execute();*/
//byte[] outfile = Bytes.toBytes(JoinPlaner.getOutputFile());
byte[] outfile = Bytes.toBytes(executor.visitor.varIds.toString()+"\n"+executor.getOutputFile());
zk.create(output + "/element" + minval, outfile,Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
} catch (Exception e) {
e.printStackTrace();
byte[] outfile = Bytes.toBytes(e.getMessage());
zk.create(output + "/element" + minval, outfile,Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
}
return 1;
}
else{
return 0;
}
}
//}
}
}
}
}
| [
"npapa@cslab.ece.ntua.gr@29f01f91-bbd8-63f5-d2aa-eb046b36aed7"
] | npapa@cslab.ece.ntua.gr@29f01f91-bbd8-63f5-d2aa-eb046b36aed7 |
602bb9f56870d5be174cc32e3762d9a1c6646109 | 4a6f52eb172ca463d2488b9f17459793ce224201 | /Book-Store-Servlet/src/com/tampro/service/impl/DistrictServiceImpl.java | 6efa3d9732eb655520bbd27d97230a188eabacf9 | [] | no_license | xomrayno1/test | a2982392d7c6ae969c4677c730d1d837db224254 | ceee10b3d8ab92865ef1d6f63c41195d3b8dcbf0 | refs/heads/master | 2022-12-01T18:25:59.520499 | 2020-08-10T16:10:30 | 2020-08-10T16:10:30 | 286,278,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package com.tampro.service.impl;
import java.util.List;
import com.tampro.dao.DistrictDao;
import com.tampro.dao.impl.DistrictDaoImpl;
import com.tampro.model.District;
import com.tampro.service.DistrictService;
public class DistrictServiceImpl implements DistrictService{
DistrictDao districtDao = new DistrictDaoImpl();
@Override
public List<District> getAll() {
// TODO Auto-generated method stub
return districtDao.getAll();
}
@Override
public List<District> getAllByIdProvince(int idProvince) {
// TODO Auto-generated method stub
return districtDao.getAllByIdProvince(idProvince);
}
@Override
public District getDistrictById(int id) {
// TODO Auto-generated method stub
return districtDao.getDistrictById(id);
}
@Override
public boolean delete(int id) {
// TODO Auto-generated method stub
return districtDao.delete(id);
}
@Override
public boolean update(District district) {
// TODO Auto-generated method stub
return districtDao.update(district);
}
@Override
public boolean add(District district) {
// TODO Auto-generated method stub
return districtDao.add(district);
}
}
| [
"xomrayno5"
] | xomrayno5 |
b8ffe5916a8ee50666f95102769819540218e760 | abdfcd0b85492463f7076ff3c23003d78533bd21 | /app/src/main/java/me/juhezi/codewars/MainApplication.java | ed4681f071a503a1ec51f36e1c5fac90112b9d95 | [] | no_license | qiaoyunrui/Dai | 402dfee5bb5310c40a91aa42511f40a8b7e08dd9 | 86d2544d3cdd364c1686e0f252d14f2972873cb3 | refs/heads/master | 2021-01-02T08:35:00.564541 | 2018-04-01T13:50:16 | 2018-04-01T13:50:16 | 99,021,096 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 635 | java | package me.juhezi.codewars;
import com.juhezi.module.router_annotation.annotation.Proxy;
import me.juhezi.module.base.BaseApplication;
import me.juhezi.module.base.router.Repository;
import me.juhezi.module.router_api.Router;
/**
* Created by Juhezi[juhezix@163.com] on 2017/10/18.
*/
@Proxy
public class MainApplication extends BaseApplication {
@Override
public void onInject() {
super.onInject();
Router.inject(this);
routerRegist();
}
/**
* 路由注册
*/
private void routerRegist() {
Repository.register("me.juhezi.module.camera.ui.CameraActivity");
}
}
| [
"juhezix@163.com"
] | juhezix@163.com |
6e1ed863b68d7c1dcf9b736a31dbfed9c77c0e4a | ff507c421b379db2f445fa635fd0d5670465d61c | /src/main/java/com/Lph/project/resultinput/input/model/TCCClientsatisfysurvey.java | 573c6783de8d468b814ffa5380dbf3ef16b08837 | [] | no_license | kyrie1135/Tobacco | 88bf76bdcd87f583bc596490067342f5e8d410b1 | 7211f274ed61b068ba1d9112f3cb2eab61ad26b3 | refs/heads/master | 2022-07-04T10:45:07.215808 | 2020-04-11T08:22:57 | 2020-04-11T08:22:57 | 237,164,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,120 | java | package com.Lph.project.resultinput.input.model;
import java.io.Serializable;
import java.util.Date;
/**
* t_c_c_clientsatisfysurvey
* @author
*/
public class TCCClientsatisfysurvey implements Serializable {
private String bickid;
private String subscriptBickid;
private String deptName;
private String clientCode;
private String clientName;
private Date inputDate;
private Date getDate;
private String inputer;
private String geter;
private Integer isOver;
private static final long serialVersionUID = 1L;
public String getBickid() {
return bickid;
}
public void setBickid(String bickid) {
this.bickid = bickid;
}
public String getSubscriptBickid() {
return subscriptBickid;
}
public void setSubscriptBickid(String subscriptBickid) {
this.subscriptBickid = subscriptBickid;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getClientCode() {
return clientCode;
}
public void setClientCode(String clientCode) {
this.clientCode = clientCode;
}
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public Date getInputDate() {
return inputDate;
}
public void setInputDate(Date inputDate) {
this.inputDate = inputDate;
}
public Date getGetDate() {
return getDate;
}
public void setGetDate(Date getDate) {
this.getDate = getDate;
}
public String getInputer() {
return inputer;
}
public void setInputer(String inputer) {
this.inputer = inputer;
}
public String getGeter() {
return geter;
}
public void setGeter(String geter) {
this.geter = geter;
}
public Integer getIsOver() {
return isOver;
}
public void setIsOver(Integer isOver) {
this.isOver = isOver;
}
} | [
"1135030547@qq.com"
] | 1135030547@qq.com |
dcafcb90cb7e98c350b2f1390a26f9b4aee7f9e4 | 4dc486a1c47bbb1659c3c77262c779b4784281fd | /17 网络编程/src/10 客户上传文件,服务器控制台输出/ServerDemo.java | fec30c2f37d4e4baeda566f60cd6298c697e640e | [] | no_license | Ymengchun/javase | 2c9d03631502ddd2f80b29aa22c5913363085a18 | c370c2dd91fd312ec8e442760c78c0761337a08b | refs/heads/master | 2020-07-12T01:30:55.107093 | 2019-11-24T03:45:42 | 2019-11-24T03:45:42 | 204,684,225 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 629 | java | package cn.itcast_10;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
public class ServerDemo {
public static void main(String[] args) throws IOException {
// 创建服务器Socket对象
ServerSocket ss = new ServerSocket(34567);
// 监听客户端连接
Socket s = ss.accept();
// 封装通道内的流
BufferedReader br = new BufferedReader(new InputStreamReader(
s.getInputStream()));
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
s.close();
}
}
| [
"1005029961@qq.com"
] | 1005029961@qq.com |
355d8b4dbcf2d33b0246ee2d12bc90d7bb5fdb1d | 1cb923de23c26f9e863655bf4945d3733121324e | /projeto-base/src/ssendereco/negocio/Bairro.java | df5aad5899ee7481627d5b45bab0f88ee61ba222 | [] | no_license | juniorstreichan/ifmt-educacional | b51a1ad7de9fcba83b876313279b9c5d595a4f02 | 1bddd687d15bb9fcdb8285d2ec96caf86c559f88 | refs/heads/master | 2020-04-08T10:01:05.014169 | 2018-12-12T01:28:08 | 2018-12-12T01:28:08 | 159,250,324 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,528 | java | package ssendereco.negocio;
import base.negocio.INegocio;
import java.util.List;
import base.negocio.RetornoNegocio;
import ssendereco.vo.BairroVO;
public class Bairro implements INegocio<BairroVO>{
private final SubsistemaEndereco subsistemaEndereco;
public Bairro(SubsistemaEndereco addressSubsystem) {
this.subsistemaEndereco = addressSubsystem;
}
@Override
public RetornoNegocio validarInclusao(BairroVO bairroVO) {
if (bairroVO == null) {
return new RetornoNegocio(false, "Dados inconsistentes - elemento nulo");
}
//validacao de dados
if (!bairroVO.isValido()) {
return new RetornoNegocio(false, bairroVO.getValidacaoMsg());
}
//verificacao de regras de negocio
List<BairroVO> listaBairro = subsistemaEndereco.bairroBuscarPorNome(bairroVO.getNome());
if (listaBairro != null) {
for (BairroVO tempBairroVO : listaBairro) {
if (tempBairroVO.getMunicipio().equals(bairroVO.getMunicipio())) {
return new RetornoNegocio(false, "Ja existe um Bairro com esse nome para essa Cidade");
}
}
}
return new RetornoNegocio(true, "Inclusao valida");
}
@Override
public RetornoNegocio validarAlteracao(BairroVO bairroVO) {
if (bairroVO == null || bairroVO.getId() == null) {
return new RetornoNegocio(false, "Dados inconsistentes - elemento nulo");
}
//Verificacao de validacao de dados
if (!bairroVO.isValido()) {
return new RetornoNegocio(false, bairroVO.getValidacaoMsg());
}
//verificacao de regras de negocio
if (subsistemaEndereco.bairroBuscarPorID(bairroVO.getId()) == null) {
return new RetornoNegocio(false, "Nao existe um Bairro com esse ID: " + bairroVO.getId());
}
return new RetornoNegocio(true, "Alteracao valida");
}
@Override
public RetornoNegocio validarExclusao(BairroVO bairroVO) {
if (bairroVO == null || bairroVO.getId() == null) {
return new RetornoNegocio(false, "Dados inconsistentes - elemento nulo");
}
//verificacao de regras de negocio
if (subsistemaEndereco.bairroBuscarPorID(bairroVO.getId()) == null) {
return new RetornoNegocio(false, "Nao existe um Bairro com esse ID: " + bairroVO.getId());
}
return new RetornoNegocio(true, "Exclusao valida");
}
}
| [
"juniorstreichan@gmail.com"
] | juniorstreichan@gmail.com |
61e52656a2083ad83fe09aa6546b97b79cd80cf2 | a018b34d355869d4998a4496df7a32951bde52e3 | /broadcasttest/src/main/java/com/glg/broadcasttest/MyReceiver.java | a91fadcde555e635de2656f1365337e6ef4be286 | [] | no_license | gao271692093/Demo | 1a1c294df6ce435898f932aac2412ef19f24a57c | 3659887e6302474ce79a1169276197e0aba2e354 | refs/heads/master | 2021-08-06T16:51:56.692548 | 2020-12-31T03:06:19 | 2020-12-31T03:06:19 | 234,738,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,068 | java | package com.glg.broadcasttest;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class MyReceiver extends BroadcastReceiver {
private static final String Action1 = "zuckerberg";
private static final String Action2 = "mayun";
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals(Action1)) {
Toast.makeText(context, "MyReceiver收到:扎克伯格的广播", Toast.LENGTH_SHORT).show();
} else if(intent.getAction().equals("MyBroadcast")) {
Bundle bundle = intent.getExtras();
if(bundle != null) {
String text = bundle.getString("text");
Toast.makeText(context, "成功接收广播:"+text, Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(context, "MyReceiver收到马云的广播", Toast.LENGTH_SHORT).show();
}
}
}
| [
"271692093@qq.com"
] | 271692093@qq.com |
acd3b02a3b3f7f3a165d49710a1482d905adabe6 | eb7240bd1ab4bccdeca51a7d56bc7c948633467c | /heima/day11/src/hm_02kehouxiti/Test8.java | 46ef0b49c763e83dfac45536d5958dbad49446e6 | [] | no_license | yp684320/sms | 00890946d76d9d9d9c12eea3e58535222c25bbc5 | 9bc5a574db6436cefbeb57b4a4639907a16c613f | refs/heads/master | 2020-05-03T13:31:59.839678 | 2019-03-31T06:37:14 | 2019-03-31T06:37:14 | 178,655,242 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | package hm_02kehouxiti;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
/*描述:将上一题保存到stu.txt文件中的学生对象读取出来。*/
public class Test8 {
public static void main(String[] args) throws IOException, ClassNotFoundException {
//反序列化
//创建反序列化流对象
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("stu.txt"));
//读取一个对象
Student s =(Student) ois.readObject();
System.out.println(s);
ois.close();
}
}
| [
"naiba@example.com"
] | naiba@example.com |
9765745cd977892f02f31c42137dd68b410896c9 | 1136c11c9bf527e119d3e1471a1571290db7b32b | /src/main/java/seedu/address/ui/util/DateTimeUtil.java | 4c3222c3c4ad618c20f074401685841ab568cf3c | [
"MIT"
] | permissive | CS2103JAN2018-W13-B3/main | 8b83ca00d293b9d3873838da94d56398aee16aac | ff3d18a93fb7296d028ffac018297b9d5b253a9d | refs/heads/master | 2021-04-26T23:55:12.312584 | 2018-04-24T14:05:36 | 2018-04-24T14:05:36 | 123,879,618 | 0 | 2 | null | 2018-04-24T14:05:37 | 2018-03-05T07:12:26 | Java | UTF-8 | Java | false | false | 1,599 | java | package seedu.address.ui.util;
import java.time.format.DateTimeFormatter;
import seedu.address.model.activity.DateTime;
import seedu.address.model.activity.Event;
import seedu.address.model.activity.Task;
//@@author Kyomian
/**
* Formats DateTime for display in UI
* Example: 01/08/2018 08:00 is displayed as 1 Aug 2018 08:00 in the UI
*/
public class DateTimeUtil {
private static final String DISPLAYED_DATETIME_FORMAT = "d MMM y HH:mm";
private static final DateTimeFormatter displayFormatter = DateTimeFormatter.ofPattern(DISPLAYED_DATETIME_FORMAT);
/**
* Formats DateTime of task as day, name of month, year, hours and minutes
*/
public static String getDisplayedDateTime(Task task) {
DateTime dateTime = task.getDateTime();
String displayedDateTime = displayFormatter.format(dateTime.getLocalDateTime());
return displayedDateTime;
}
/**
* Formats StartDateTime of event as day, name of month, year, hours and minutes
*/
public static String getDisplayedStartDateTime(Event event) {
DateTime dateTime = event.getStartDateTime();
String displayedDateTime = displayFormatter.format(dateTime.getLocalDateTime());
return displayedDateTime;
}
/**
* Formats EndDateTime of event as day, name of month, year, hours and minutes
*/
public static String getDisplayedEndDateTime(Event event) {
DateTime dateTime = event.getEndDateTime();
String displayedDateTime = displayFormatter.format(dateTime.getLocalDateTime());
return displayedDateTime;
}
}
| [
"e0031779@u.nus.edu"
] | e0031779@u.nus.edu |
7e34ad2ef424e449e3f045750401bdb3fa4a138b | a4862976d43e02c14c9d90034fd18cfb46701334 | /src/test/java/com/bellintegrator/weatherbrokertomcat/controller/IndexControllerTest.java | 3cacf2d153f1795acc06976df8d764aafdbd3bff | [] | no_license | danailKondov/weatherbroker_for_tomcat | 48b5ab510ffb17662b42128928472c65a7386600 | 679cdcf31ff9b78ebbcd57547dc9297282b90f53 | refs/heads/master | 2020-03-11T03:45:42.456121 | 2018-05-17T09:38:51 | 2018-05-17T09:38:51 | 129,757,774 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,459 | java | package com.bellintegrator.weatherbrokertomcat.controller;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import static org.junit.Assert.*;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
@RunWith(SpringRunner.class)
@WebMvcTest(IndexController.class)
public class IndexControllerTest {
@Autowired
private MockMvc mvc;
@Test
public void getIndexTest() throws Exception {
mvc.perform(MockMvcRequestBuilders
.get("/index")
.accept(MediaType.TEXT_HTML))
.andExpect(status().isOk())
.andExpect(view().name("index"))
.andExpect(content().string(Matchers.containsString("Enter city for weather info")))
.andDo(print());
}
} | [
"dkondov@yandex.ru"
] | dkondov@yandex.ru |
d680e7938e58771b0f61a5b0fd5ae52673bb337b | 0cd85b9f7f930cc69302679b983c8ccf40bd07b7 | /src/main/java/com/db/DocumentStore.java | e67ecf10bcd8d685ebda6d190b6e47292d4935a4 | [] | no_license | anandProDev/RailStatusTracker | dda7db71fc6db027e9fa76321ec7229159d12bed | 3b1ae9b4f886f35b0f02a8aa8175359c94ccfd54 | refs/heads/master | 2021-01-25T14:56:40.770282 | 2018-05-11T15:09:32 | 2018-05-11T15:09:32 | 123,739,759 | 0 | 1 | null | 2018-05-09T11:00:06 | 2018-03-03T23:19:49 | Java | UTF-8 | Java | false | false | 398 | java | package com.db;
import com.exception.DataAlreadyExistsException;
public interface DocumentStore {
<T> T get(String id, Class<T> c);
long add(String id, Object object, int opTimeout);
void delete(String id, long cas, int opTimeout);
void update(String id, Object object);
void create(String id, Object object) throws DataAlreadyExistsException;
void delete(String id);
}
| [
"anand.elangovan@sky.uk"
] | anand.elangovan@sky.uk |
6ad3e3decce62b5db81d12301c04f8a286abe437 | 799c7dbe44b2df9c940fb8d89f82a11baebef20c | /KeystoreDemo/app/src/test/java/android/keystoredemo/ExampleUnitTest.java | 6470641699c58618189fd3a6a1413380e8980b85 | [] | no_license | zhanmusi2323/Android-Demos | 6e01bbb1233f58211c63343483ce997602f370ac | d594dbae1dece8fbcb594f2fd7a255441cca6fa4 | refs/heads/master | 2021-06-21T10:06:50.940944 | 2017-06-21T09:56:27 | 2017-06-21T09:56:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package android.keystoredemo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"hiphonezhu@gmail.com"
] | hiphonezhu@gmail.com |
d65f5e355661c7336a20b1c186384ce7558eccc2 | b187a8271261b68d3c8dcb1af159dd7bc88b9e4b | /src/Implementation/OccupancyComponent_IOccupancyDecision.java | afb40ad647f6565057a293a5e18d45d012d625e8 | [] | no_license | williamgranli/papyrus_hotel_project | 04cf102437ddf1fcdff92ab0a18b7bfec34ca993 | f88d300ddd049e7c55e991225d1450afe1edd0d7 | refs/heads/master | 2021-01-21T09:24:06.119383 | 2015-01-06T11:48:02 | 2015-01-06T11:48:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 710 | java | /**
*/
package Implementation;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Occupancy Component IOccupancy Decision</b></em>'.
* <!-- end-user-doc -->
*
*
* @see Implementation.ImplementationPackage#getOccupancyComponent_IOccupancyDecision()
* @model interface="true" abstract="true"
* @generated
*/
public interface OccupancyComponent_IOccupancyDecision extends EObject {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @model kind="operation" dataType="org.eclipse.uml2.types.String" required="true" ordered="false"
* @generated
*/
String getDSSOccupancyInfo();
} // OccupancyComponent_IOccupancyDecision
| [
"william.granli@gmail.com"
] | william.granli@gmail.com |
c689a9febb770d22023a58d37929f0b31138ecc7 | c36c8cbeaac2dfa95eb66f3d17686af256535941 | /src/at/bitflip/predatorandprey/utils/Pair.java | 94a4af2604bdc5b65883643c71b62d7b288427d2 | [
"MIT"
] | permissive | bitflip-at/Predator-And-Prey | 39916e7e2a93c815605910a579e0ead75dc2a0e3 | 55d127e7d0f6fa93e3ed65d887ee858958fcdaea | refs/heads/master | 2021-01-20T01:05:52.179780 | 2017-08-29T08:37:42 | 2017-08-29T08:37:42 | 101,279,402 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,689 | java | /*
* The MIT License
*
* Copyright 2017 Emanuel Gitterle <emanuel.gitterle@bitflip.at>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package at.bitflip.predatorandprey.utils;
/**
*
* @author Emanuel Gitterle <emanuel.gitterle@bitflip.at>
* @param <T> Type of variables in the Pair
*/
public class Pair<T> {
private T x;
private T y;
public Pair( T x, T y){
this.x = x;
this.y = y;
}
public void setX( T x ){
this.x = x;
}
public T getX(){
return x;
}
public void setY( T y ){
this.y = y;
}
public T getY(){
return y;
}
}
| [
"emanuel.gitterle@bitflip.at"
] | emanuel.gitterle@bitflip.at |
67b3e16b2f08ab815f052036e02730f3db8f0ebb | 179a6769e11b5d93825ee292c6b8dd1bd5813061 | /app/src/androidTest/java/com/example/user/iii/ApplicationTest.java | 836b0a1cb28a6a00de986c157ed4f024db70e175 | [] | no_license | zawwaizoez/OrderSystem | f3ab584dcb7dc1c037955f61cc6543ec90456822 | 1dc7ba16396d16210214f136d28166b7f2baaf25 | refs/heads/master | 2020-03-12T08:53:25.263851 | 2018-04-22T12:07:55 | 2018-04-22T12:07:55 | 130,538,912 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package com.example.user.iii;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"hsumon.1740@gmail.com"
] | hsumon.1740@gmail.com |
ce2ef1398d7e576be10c8ab0d5111d39d4a66956 | 91343e21ec18145ee076e03003fad51e3fd8987d | /microservice-provider-weixin/src/main/java/com/weixindev/micro/serv/msg/service/IMsgService.java | 3602504e72508282b74041c2904fcb78dedc74ea | [] | no_license | 15838028035/weixindev | ddaf069f888ba09f12814e7183c557f59e2a5034 | c1b96cbea7b3dd3cb262827365d00d7eed5fc241 | refs/heads/master | 2020-03-07T03:03:01.981016 | 2018-04-03T02:05:25 | 2018-04-03T02:05:25 | 127,224,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 283 | java | package com.weixindev.micro.serv.msg.service;
public interface IMsgService {
/**
* add a new message
*
* @param serialNo
* @param msgType
* @param target
* @param content
* @return
*/
int addMsg(String serialNo, String msgType, String target, String content);
}
| [
"15838028035@163.com"
] | 15838028035@163.com |
ad5fa0da71300566f9ef49f6d85fdcdc688c54bd | 8b3350861e19ae79925fa665587dda1586dd5cf6 | /app/src/main/java/com/example/aplikasisqlite/FirstFragment.java | 906c306efabc1177de8b8711ef92242938a563c1 | [] | no_license | Rahmiekaputri19/tugas11 | e1574c84aba11201a166db9ea324d2d7ee24db77 | 26227bdf1398dd08e94e189172675b862073d7fc | refs/heads/master | 2022-12-27T04:49:05.861752 | 2020-10-09T14:08:16 | 2020-10-09T14:08:16 | 302,659,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,091 | java | package com.example.aplikasisqlite;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
public class FirstFragment extends Fragment {
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_first, container, false);
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.button_first).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(FirstFragment.this)
.navigate(R.id.action_FirstFragment_to_SecondFragment);
}
});
}
}
| [
"rahmiekaputri123@gmail.com"
] | rahmiekaputri123@gmail.com |
e7d361aea6a903e859f452cbe2849bc8c287a5f0 | 79330101788346dcb77d6355598421975a2c568b | /src/main/java/com/akuma/chat/model/entity/Message.java | 7acb86969f646d96963894c57eedf4371134e913 | [] | no_license | cenganhui/Chat_Server | 86404561b23d8c97317a53c7119dbdaee0e5b415 | eec5a25fa3a7b36d086633f4bf038f7989455304 | refs/heads/master | 2022-04-27T01:52:35.272860 | 2020-05-06T14:25:21 | 2020-05-06T14:25:21 | 259,592,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package com.akuma.chat.model.entity;
import lombok.Data;
/**
* 消息类
* @author Akuma
* @date 2020/4/27 19:54
*/
@Data
public class Message {
private Integer mid; //消息id
private String senderId; //发送者
private String receiverId; //接收者
private String content; //内容
private Long sendTime; //时间
private Integer status; //状态
}
| [
"NMSL@qq.com"
] | NMSL@qq.com |
28987e9868c3556ed9b8a2ed2be7238816148579 | 5d75cf39da084d67eb1f8a7e2d3095c376455008 | /service/src/com/keyking/coin/service/net/logic/user/Appraise.java | 5eb6ba00f3ced2a9b2d549846b347cff870247f8 | [] | no_license | keyking-coin/code | 1413a32a9901725228004cd971f6efac4a4e5121 | bdba6b9d8a7bb8a4ac682d7ff5f12d3e37c27bdb | refs/heads/master | 2020-04-04T05:46:34.108286 | 2016-09-30T07:09:46 | 2016-09-30T07:09:46 | 52,215,473 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,541 | java | package com.keyking.coin.service.net.logic.user;
import com.keyking.coin.service.domain.deal.Deal;
import com.keyking.coin.service.domain.deal.DealAppraise;
import com.keyking.coin.service.domain.deal.DealOrder;
import com.keyking.coin.service.domain.user.UserCharacter;
import com.keyking.coin.service.net.buffer.DataBuffer;
import com.keyking.coin.service.net.logic.AbstractLogic;
import com.keyking.coin.service.net.resp.impl.GeneralResp;
import com.keyking.coin.util.ServerLog;
public class Appraise extends AbstractLogic {
@Override
public Object doLogic(DataBuffer buffer, String logicName) throws Exception {
GeneralResp resp = new GeneralResp(logicName);
byte type = buffer.get();
long dealId = buffer.getLong();
long orderId = buffer.getLong();
long uid = buffer.getLong();
UserCharacter user = CTRL.search(uid);
String forbidStr = user.getForbid().getReason();
if (forbidStr != null){
resp.setError("您已经被封号原因是:" + forbidStr);
return resp;
}
byte star = buffer.get();
String value = buffer.getUTF();
Deal deal = CTRL.tryToSearch(dealId);
resp.add(type);
if (deal != null){
DealOrder order = deal.searchOrder(orderId);
if (order != null){
if (!order.over()){
resp.setError("未完成交易,无法评价");
return resp;
}
synchronized (order) {
if (order.checkRevoke()) {
resp.setError("订单已撤销,无法评价");
return resp;
}
boolean couldAppraise = false;
if (type ==0 && (deal.checkBuyer(uid) || order.checkBuyer(deal,uid))){//我是买家
couldAppraise = true;
}
if (type == 1 && (deal.checkSeller(uid) || order.checkSeller(deal,uid))){//我是卖家
couldAppraise = true;
}
if (couldAppraise){
DealAppraise appraise = type == 0 ? order.getSellerAppraise() : order.getBuyerAppraise();
if (!appraise.isCompleted()){
appraise.appraise(deal,order,user,star,value);
resp.add(appraise);
UserCharacter other = CTRL.search(uid == deal.getUid() ? order.getBuyId() : deal.getUid());
if (other != null){
other.getCredit().addNum(star);
}
ServerLog.info(user.getAccount() + " appraised : star = " + star + " context = " + value);
resp.setSucces();
}else{
resp.setError("已评价过了");
}
}else{
resp.setError("您没有权限评价");
}
}
}else{
resp.setError("订单编号错误");
}
}else{
resp.setError("交易已取消");
}
return resp;
}
}
| [
"keyking@163.com"
] | keyking@163.com |
6aeb501b8221da57b3f56b2f8076339436d8d947 | 7a37472d0ff1eb273aed84a6f57d7cb6dc267731 | /src/main/java/duke/exceptions/ToDoInputWrongFormatException.java | 80c661c95fd67cc5ad298dc7af6bcf1ddc163341 | [] | no_license | AmeliaTYR/ip | 1c7a54e5167d7307ee4435b98e34c596e6251328 | 714806aef801b1c437d786688e39a55123780c19 | refs/heads/master | 2023-02-10T03:59:42.831758 | 2020-10-03T01:07:16 | 2020-10-03T01:07:16 | 286,487,110 | 1 | 0 | null | 2020-09-25T02:19:05 | 2020-08-10T13:46:14 | Java | UTF-8 | Java | false | false | 91 | java | package duke.exceptions;
public class ToDoInputWrongFormatException extends Exception {
}
| [
"53657436+AmeliaTYR@users.noreply.github.com"
] | 53657436+AmeliaTYR@users.noreply.github.com |
0ba3aa58365f0f4badbb609b3b50b1a8404e964f | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/grpc--grpc-java/71e4a92c10fe0ba22a1a7d8eed56d8e3047b8b8c/before/NettyClientHandler.java | ff6282db3f46da045560fd7f8628cfc08f4f1329 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,879 | java | package com.google.net.stubby.newtransport.netty;
import static com.google.net.stubby.newtransport.netty.NettyClientStream.PENDING_STREAM_ID;
import com.google.common.base.Preconditions;
import com.google.net.stubby.Metadata;
import com.google.net.stubby.Status;
import com.google.net.stubby.transport.Transport;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.http2.AbstractHttp2ConnectionHandler;
import io.netty.handler.codec.http2.DefaultHttp2InboundFlowController;
import io.netty.handler.codec.http2.Http2Connection;
import io.netty.handler.codec.http2.Http2ConnectionAdapter;
import io.netty.handler.codec.http2.Http2Error;
import io.netty.handler.codec.http2.Http2Exception;
import io.netty.handler.codec.http2.Http2FrameReader;
import io.netty.handler.codec.http2.Http2FrameWriter;
import io.netty.handler.codec.http2.Http2Headers;
import io.netty.handler.codec.http2.Http2OutboundFlowController;
import io.netty.handler.codec.http2.Http2Stream;
import io.netty.handler.codec.http2.Http2StreamException;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Iterator;
/**
* Client-side Netty handler for GRPC processing. All event handlers are executed entirely within
* the context of the Netty Channel thread.
*/
class NettyClientHandler extends AbstractHttp2ConnectionHandler {
private static final Status GOAWAY_STATUS = new Status(Transport.Code.UNAVAILABLE);
/**
* A pending stream creation.
*/
private final class PendingStream {
private final Http2Headers headers;
private final NettyClientStream stream;
private final ChannelPromise promise;
public PendingStream(CreateStreamCommand command, ChannelPromise promise) {
headers = command.headers();
stream = command.stream();
this.promise = promise;
}
}
private final DefaultHttp2InboundFlowController inboundFlow;
private final Deque<PendingStream> pendingStreams = new ArrayDeque<PendingStream>();
private Status goAwayStatus = GOAWAY_STATUS;
public NettyClientHandler(Http2Connection connection,
Http2FrameReader frameReader,
Http2FrameWriter frameWriter,
DefaultHttp2InboundFlowController inboundFlow,
Http2OutboundFlowController outboundFlow) {
super(connection, frameReader, frameWriter, inboundFlow, outboundFlow);
this.inboundFlow = Preconditions.checkNotNull(inboundFlow, "inboundFlow");
// Disallow stream creation by the server.
connection.remote().maxStreams(0);
connection.local().allowPushTo(false);
// Observe the HTTP/2 connection for events.
connection.addListener(new Http2ConnectionAdapter() {
@Override
public void streamHalfClosed(Http2Stream stream) {
// Check for disallowed state: HALF_CLOSED_REMOTE.
terminateIfInvalidState(stream);
}
@Override
public void streamInactive(Http2Stream stream) {
// Whenever a stream has been closed, try to create a pending stream to fill its place.
createPendingStreams();
}
@Override
public void goingAway() {
NettyClientHandler.this.goingAway();
}
});
}
public DefaultHttp2InboundFlowController inboundFlow() {
return inboundFlow;
}
/**
* Handler for commands sent from the stream.
*/
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
try {
if (msg instanceof CreateStreamCommand) {
createStream((CreateStreamCommand) msg, promise);
} else if (msg instanceof SendGrpcFrameCommand) {
sendGrpcFrame(ctx, (SendGrpcFrameCommand) msg, promise);
} else if (msg instanceof CancelStreamCommand) {
cancelStream(ctx, (CancelStreamCommand) msg, promise);
} else {
throw new AssertionError("Write called for unexpected type: " + msg.getClass().getName());
}
} catch (Throwable t) {
promise.setFailure(t);
}
}
@Override
public void onHeadersRead(ChannelHandlerContext ctx,
int streamId,
Http2Headers headers,
int streamDependency,
short weight,
boolean exclusive,
int padding,
boolean endStream) throws Http2Exception {
NettyClientStream stream = clientStream(connection().requireStream(streamId));
stream.inboundHeadersRecieved(headers, endStream);
}
/**
* Handler for an inbound HTTP/2 DATA frame.
*/
@Override
public void onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding,
boolean endOfStream) throws Http2Exception {
NettyClientStream stream = clientStream(connection().requireStream(streamId));
stream.inboundDataReceived(data, endOfStream);
}
/**
* Handler for an inbound HTTP/2 RST_STREAM frame, terminating a stream.
*/
@Override
public void onRstStreamRead(ChannelHandlerContext ctx, int streamId, long errorCode)
throws Http2Exception {
// TODO(user): do something with errorCode?
Http2Stream http2Stream = connection().requireStream(streamId);
NettyClientStream stream = clientStream(http2Stream);
stream.setStatus(new Status(Transport.Code.UNKNOWN), new Metadata.Trailers());
}
/**
* Handler for the Channel shutting down.
*/
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
super.channelInactive(ctx);
// Fail any streams that are awaiting creation.
failPendingStreams(goAwayStatus);
// Any streams that are still active must be closed.
for (Http2Stream stream : http2Streams()) {
clientStream(stream).setStatus(goAwayStatus, new Metadata.Trailers());
}
}
/**
* Handler for connection errors that have occurred during HTTP/2 frame processing.
*/
@Override
protected void onConnectionError(ChannelHandlerContext ctx, Http2Exception cause) {
// Save the exception that is causing us to send a GO_AWAY.
goAwayStatus = Status.fromThrowable(cause);
// Call the base class to send the GOAWAY. This will call the goingAway handler.
super.onConnectionError(ctx, cause);
}
/**
* Handler for stream errors that have occurred during HTTP/2 frame processing.
*/
@Override
protected void onStreamError(ChannelHandlerContext ctx, Http2StreamException cause) {
// Close the stream with a status that contains the cause.
Http2Stream stream = connection().stream(cause.streamId());
if (stream != null) {
clientStream(stream).setStatus(Status.fromThrowable(cause), new Metadata.Trailers());
}
super.onStreamError(ctx, cause);
}
/**
* Attempts to create a new stream from the given command. If there are too many active streams,
* the creation request is queued.
*/
private void createStream(CreateStreamCommand command, ChannelPromise promise) {
// Add the creation request to the queue.
pendingStreams.addLast(new PendingStream(command, promise));
// Process the pending streams queue.
createPendingStreams();
}
/**
* Cancels this stream.
*/
private void cancelStream(ChannelHandlerContext ctx, CancelStreamCommand cmd,
ChannelPromise promise) throws Http2Exception {
NettyClientStream stream = cmd.stream();
stream.setStatus(Status.CANCELLED, new Metadata.Trailers());
// No need to set the stream status for a cancellation. It should already have been
// set prior to sending the command.
// If the stream hasn't been created yet, remove it from the pending queue.
if (stream.id() == PENDING_STREAM_ID) {
removePendingStream(stream);
promise.setSuccess();
return;
}
// Send a RST_STREAM frame to terminate this stream.
Http2Stream http2Stream = connection().requireStream(stream.id());
if (http2Stream.state() != Http2Stream.State.CLOSED) {
// Note: RST_STREAM frames are automatically flushed.
writeRstStream(ctx, stream.id(), Http2Error.CANCEL.code(), promise);
}
}
/**
* Sends the given GRPC frame for the stream.
*/
private void sendGrpcFrame(ChannelHandlerContext ctx, SendGrpcFrameCommand cmd,
ChannelPromise promise) throws Http2Exception {
Http2Stream http2Stream = connection().requireStream(cmd.streamId());
switch (http2Stream.state()) {
case CLOSED:
case HALF_CLOSED_LOCAL:
case IDLE:
case RESERVED_LOCAL:
case RESERVED_REMOTE:
cmd.release();
promise.setFailure(new Exception("Closed before write could occur"));
return;
default:
break;
}
// Call the base class to write the HTTP/2 DATA frame.
// Note: no need to flush since this is handled by the outbound flow controller.
writeData(ctx, cmd.streamId(), cmd.content(), 0, cmd.endStream(), promise);
}
/**
* Handler for a GOAWAY being either sent or received.
*/
private void goingAway() {
// Fail any streams that are awaiting creation.
failPendingStreams(goAwayStatus);
if (connection().local().isGoAwayReceived()) {
// Received a GOAWAY from the remote endpoint. Fail any streams that were created after the
// last known stream.
int lastKnownStream = connection().local().lastKnownStream();
for (Http2Stream stream : http2Streams()) {
if (lastKnownStream < stream.id()) {
clientStream(stream).setStatus(goAwayStatus, new Metadata.Trailers());
stream.close();
}
}
}
}
/**
* Processes the pending stream creation requests. This considers several conditions:
*
* <p>
* 1) The HTTP/2 connection has exhausted its stream IDs. In this case all pending streams are
* immediately failed.
* <p>
* 2) The HTTP/2 connection is going away. In this case all pending streams are immediately
* failed.
* <p>
* 3) The HTTP/2 connection's MAX_CONCURRENT_STREAMS limit has been reached. In this case,
* processing of pending streams stops until an active stream has been closed.
*/
private void createPendingStreams() {
Http2Connection connection = connection();
Http2Connection.Endpoint local = connection.local();
while (!pendingStreams.isEmpty()) {
final int streamId = local.nextStreamId();
if (streamId <= 0) {
// The HTTP/2 connection has exhausted its stream IDs. Permanently fail all stream creation
// attempts for this transport.
// TODO(user): send GO_AWAY?
failPendingStreams(goAwayStatus);
return;
}
if (connection.isGoAway()) {
failPendingStreams(goAwayStatus);
return;
}
if (!local.acceptingNewStreams()) {
// We're bumping up against the MAX_CONCURRENT_STEAMS threshold for this endpoint. Need to
// wait until the endpoint is accepting new streams.
return;
}
// Finish creation of the stream by writing a headers frame.
final PendingStream pendingStream = pendingStreams.remove();
writeHeaders(ctx(), streamId, pendingStream.headers, 0, false, ctx().newPromise())
.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
streamCreated(pendingStream.stream, streamId, pendingStream.promise);
} else {
// Fail the creation request.
pendingStream.promise.setFailure(future.cause());
}
}
});
ctx().flush();
}
}
/**
* Handles the successful creation of a new stream.
*/
private void streamCreated(NettyClientStream stream, int streamId, ChannelPromise promise)
throws Http2Exception {
// Attach the client stream to the HTTP/2 stream object as user data.
Http2Stream http2Stream = connection().requireStream(streamId);
http2Stream.data(stream);
// Notify the stream that it has been created.
stream.id(streamId);
promise.setSuccess();
}
/**
* Gets the client stream associated to the given HTTP/2 stream object.
*/
private NettyClientStream clientStream(Http2Stream stream) {
return stream.<NettyClientStream>data();
}
/**
* Fails all pending streams with the given status and clears the queue.
*/
private void failPendingStreams(Status status) {
while (!pendingStreams.isEmpty()) {
PendingStream pending = pendingStreams.remove();
pending.promise.setFailure(status.asException());
}
}
/**
* Removes the given stream from the pending queue
*
* @param stream the stream to be removed.
*/
private void removePendingStream(NettyClientStream stream) {
for (Iterator<PendingStream> iter = pendingStreams.iterator(); iter.hasNext();) {
PendingStream pending = iter.next();
if (pending.stream == stream) {
iter.remove();
return;
}
}
}
/**
* Gets a copy of the streams currently in the connection.
*/
private Http2Stream[] http2Streams() {
return connection().activeStreams().toArray(new Http2Stream[0]);
}
/**
* Terminates the stream if it's in an unsupported state.
*/
private void terminateIfInvalidState(Http2Stream stream) {
switch (stream.state()) {
case HALF_CLOSED_REMOTE:
case IDLE:
case RESERVED_LOCAL:
case RESERVED_REMOTE:
// Disallowed state, terminate the stream.
clientStream(stream).setStatus(
new Status(Transport.Code.INTERNAL, "Stream in invalid state: " + stream.state()),
new Metadata.Trailers());
writeRstStream(ctx(), stream.id(), Http2Error.INTERNAL_ERROR.code(), ctx().newPromise());
ctx().flush();
break;
default:
break;
}
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
8d955363049b4e29d3c2eefca70324dd13945182 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_26aedd86ceaacb9dd0b598a0c55d27f6d8f3705f/AmibeToMesh/11_26aedd86ceaacb9dd0b598a0c55d27f6d8f3705f_AmibeToMesh_t.java | 37508131e57bc0f330f7fcee059a18a5dd661d14 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,048 | java | /*
* Project Info: http://jcae.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 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 Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2009, by EADS France
*/
package org.jcae.vtk;
import gnu.trove.TIntArrayList;
import gnu.trove.TIntHashSet;
import gnu.trove.TIntIntHashMap;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jcae.mesh.xmldata.AmibeReader;
import org.jcae.mesh.xmldata.AmibeReader.Group;
import org.jcae.mesh.xmldata.AmibeReader.SubMesh;
import org.xml.sax.SAXException;
/**
*
* @author Jerome Robert
*/
public class AmibeToMesh
{
private final static Logger LOGGER=Logger.getLogger(AmibeToMesh.class.getName());
private Map<String, LeafNode.DataProvider> triangles =
new HashMap<String, LeafNode.DataProvider>();
private Map<String, LeafNode.DataProvider> beams =
new HashMap<String, LeafNode.DataProvider>();
public Map<String, LeafNode.DataProvider> getTriangles()
{
return Collections.unmodifiableMap(triangles);
}
public Map<String, LeafNode.DataProvider> getBeams()
{
return Collections.unmodifiableMap(beams);
}
/**
* Create the list of needed nodes for a triangle array
* @param trias the triangles which require nodes
* @return the nodes id
*/
private static int[] makeNodeIDArray(int[] ... ids)
{
int n = 0;
for(int[] id:ids)
n += id.length;
TIntHashSet set = new TIntHashSet(n/2);
for(int[] id:ids)
set.addAll(id);
TIntArrayList list = new TIntArrayList(set.size());
list.add(set.toArray());
list.sort();
return list.toNativeArray();
}
private static void renumberArray(int[] newIndices, int[] ... arraysToRenumber)
{
TIntIntHashMap map = new TIntIntHashMap(newIndices.length);
for (int i = 0; i < newIndices.length; i++)
map.put(newIndices[i], i);
for(int[] arrayToRenumber:arraysToRenumber)
for (int i = 0; i < arrayToRenumber.length; i++)
arrayToRenumber[i] = map.get(arrayToRenumber[i]);
}
private static class TriaData extends LeafNode.DataProvider
{
private final AmibeReader.Dim3 provider;
private final String id;
TriaData(AmibeReader.Dim3 provider, String id)
{
this.provider = provider;
this.id = id;
}
@Override
public void load()
{
try {
SubMesh sm = provider.getSubmeshes().get(0);
Group g = sm.getGroup(id);
int[] triangles = g.readTria3();
int[] nodesID = makeNodeIDArray(triangles);
setNodes(sm.readNodes(nodesID));
renumberArray(nodesID, triangles);
setPolys(triangles.length/3, Utils.createTriangleCells(triangles, 0));
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
}
}
}
private static class BeamData extends LeafNode.DataProvider
{
private final AmibeReader.Dim3 provider;
private final String id;
BeamData(AmibeReader.Dim3 provider, String id)
{
this.provider = provider;
this.id = id;
}
@Override
public void load()
{
try {
SubMesh sm = provider.getSubmeshes().get(0);
Group g = sm.getGroup(id);
int[] beams = g.readBeams();
int[] nodesID = makeNodeIDArray(beams);
setNodes(sm.readNodes(nodesID));
renumberArray(nodesID, beams);
setLines(Utils.createBeamCells(beams));
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
}
}
}
public AmibeToMesh(String filePath) throws SAXException, IOException
{
this(filePath, null);
}
public AmibeToMesh(String filePath, String[] groupExtraction)
throws SAXException, IOException
{
AmibeReader.Dim3 reader = new AmibeReader.Dim3(filePath);
SubMesh sm = reader.getSubmeshes().get(0);
List<Group> grps = sm.getGroups();
if(groupExtraction == null)
{
groupExtraction = new String[grps.size()];
for(int i=0; i<groupExtraction.length; i++)
groupExtraction[i]=grps.get(i).getName();
}
for(String id : groupExtraction)
{
Group g = sm.getGroup(id);
if(g != null)
{
if(g.getNumberOfTrias() > 0)
triangles.put(id, new TriaData(reader, id));
if(g.getNumberOfBeams() > 0)
beams.put(id, new BeamData(reader, id));
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
cb4a36bdf76a87ad056a6ac3161cbc984d6a31e4 | 81cd8ebc6bb4fd0bea723dc5980f0ad2de8635d5 | /newbikeshondahackathon/src/test/java/po/Upcomingbike.java | b049b8dffdb02bd6e0009cbd715bf03bf7b266c9 | [] | no_license | AtrizRay/Hackathon_NewBikes | 4cb8b9242533e35d7d6412098b45f0104511d52b | a4ff9e0f738e29e9044f344b17440a4fcea17b71 | refs/heads/master | 2023-03-25T15:37:50.228629 | 2021-03-23T17:47:16 | 2021-03-23T17:47:16 | 350,090,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,896 | java | package po;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import util.CaptureScreenshot;
import util.Highlighter;
import util.WritetoExcel;
public class Upcomingbike {
WebDriver driver;
public Upcomingbike(WebDriver ldriver)
{
this.driver=ldriver;
}
public void upcoming(){
WebElement upcomingBikes=driver.findElement(By.xpath("//*[@id=\"headerNewNavWrap\"]/div[2]/ul/li[3]/a"));
Highlighter.highLightElement(driver, upcomingBikes);
Actions action=new Actions(driver);
action.moveToElement(upcomingBikes).build().perform();
}
public void manufacture() {
//Adding explicit wait
WebDriverWait wait=new WebDriverWait(driver,20);
//wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@id=\"headerNewNavWrap\"]/div[2]/ul/li[3]/ul/li/div[1]/ul/li[3]/span"))));
//To click Upcoming bikes
WebElement upcomingBikesLink=driver.findElement(By.xpath("//*[@id=\"headerNewNavWrap\"]/div[2]/ul/li[3]/ul/li/div[1]/ul/li[3]/span"));
Highlighter.highLightElement(driver, upcomingBikesLink);
upcomingBikesLink.click();
}
public void honda() {
Assert.assertEquals("Upcoming Bikes in India 2021/22, See Price, Launch Date, Specs @ ZigWheels", driver.getTitle());
//Select the manufacturer
WebElement manufacture=driver.findElement(By.xpath("//*[@id=\"makeId\"]"));
Highlighter.highLightElement(driver, manufacture);
Select select=new Select(driver.findElement(By.xpath("//*[@id=\"makeId\"]")));
select.selectByVisibleText("Honda");
CaptureScreenshot.ScreenShot(driver,"Upcoming_Honda_Bikes");
}
public void lakhs() throws InterruptedException, IOException {
ArrayList<String> getHondaBikesUnder4Lacs=new ArrayList<String>();
//Storing the information of all the Upcoming Honda Bikes
//wait.waitImplicit(driver);
WebElement element = driver.findElement(By.className("zw-cmn-loadMore"));
Highlighter.highLightElement(driver, element);
((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView(true);", element);
Thread.sleep(500);
element.click();
JavascriptExecutor js = ((JavascriptExecutor) driver);
js.executeScript("window.scrollTo(0,800)");
WebElement bikeModel=driver.findElement(By.xpath("//*[@id='carModels']/ul"));
String bikeModels =bikeModel.getText();
//Storing the info in an ArrayList
//wait.waitImplicit(driver);
try
{
Thread.sleep(2000);
} catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
ArrayList<String> bikeModelsElements = new ArrayList<String>();
Collections.addAll(bikeModelsElements,bikeModels.split("\n"));
//Sorting the information according to names,dates and prices
ArrayList<String> NameList = new ArrayList<String>();
ArrayList<String> DateList = new ArrayList<String>();
ArrayList<String> PriceList =new ArrayList<String>();
String[] arr = null;
for(int i = 0 ; i < bikeModelsElements.size(); i++)
{
String s = bikeModelsElements.get(i);
if(s.contains("Honda"))
{
NameList.add(s);
}
if(s.contains("Rs. "))
{
arr = s.split(" ");
PriceList.add(arr[1]);
}
if(s.contains("Exp. Launch"))
{
DateList.add(s);
}
}
//Creating an Arraylist which will add only the upcoming bikes under 4 Lakhs
//wait.waitImplicit(driver);
try
{
Thread.sleep(1000);
} catch (InterruptedException e)
{
e.printStackTrace();
}
ArrayList<String> upcomingBikesList = new ArrayList<String>();
for(int i=0; i<NameList.size();i++)
{
String temp = NameList.get(i);
double price = Double.parseDouble(PriceList.get(i));
String info=temp+" "+PriceList.get(i)+" Lakh "+DateList.get(i);
if(info.contains(temp))
{
if(Double.compare(price, 4d)<0)
{
upcomingBikesList.add(info);
}
}
}
//String upcomingBikesManufacturer=KeywordDriven.getBikeManufacturerName();
//Printing them
WritetoExcel.bikesOutputoToExcel("Upcoming Honda Bikes", upcomingBikesList);
System.out.println("PART 2:");
System.out.println("Upcoming Bikes Below 4 Lakhs are as follows:");
for(int i = 0 ; i < upcomingBikesList.size(); i++)
{
System.out.println(upcomingBikesList.get(i));
}
}
public void mainpage() {
WebElement main=driver.findElement(By.xpath("/html/body/header/div/div[1]/div[1]/a/img"));
Highlighter.highLightElement(driver, main);
main.click();
}
}
| [
"royatriz@gmail.com"
] | royatriz@gmail.com |
999e766b5aaa2d76e5f0c2afa2e30bb6911eee1b | 1de742f8e9f0fd99a44beb3b5bbf1b2a05ee8699 | /Java-Postgres/Paleteria/src/paleteria/Producto.java | 924d58510fe9caf18c32098becd9dfca5eb25be2 | [] | no_license | braulioagr/InventarioPaleteria | 26e024dd6b2f8f3f026db641d29dfbfb345bb77b | a9aa3294028c0ac2797dbf1acc9daf75506d4c6a | refs/heads/master | 2023-08-17T16:52:26.902897 | 2021-01-12T21:15:00 | 2021-01-12T21:15:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,231 | java |
package paleteria;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
public class Producto extends javax.swing.JFrame {
private static String idProducto;
private static boolean agregar;
private static Connection Conexion = null;
public static Statement st = null;
public static ResultSet rt;
public Producto(String idP, boolean agr) {
initComponents();
Conexion = Nexo.conex();
idProducto = idP;
agregar = agr;
categoria.setEnabled(false);
if(idProducto != "" && agregar == false)
{
ObtienedatosProducto();
}
}
public static void ObtienedatosProducto(){
try{
String Qery = "SELECT * FROM empleado.Producto WHERE idProducto = " + idProducto;
st = Conexion.createStatement();
rt = st.executeQuery(Qery);
String Aux[] = new String[4];// las tres columnas
while(rt.next()){
Aux[0] = rt.getString(1);
categoria.setText(rt.getString(2));
preciotxt.setText(rt.getString(3));
sabortxt.setText(rt.getString(4));
}
}
catch(Exception e){
JOptionPane.showMessageDialog(null, "Error: " + e.getMessage());
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
nombre = new javax.swing.JLabel();
categoria = new javax.swing.JTextField();
catbtn = new javax.swing.JButton();
tipoc = new javax.swing.JLabel();
preciotxt = new javax.swing.JTextField();
telefono = new javax.swing.JLabel();
sabortxt = new javax.swing.JTextField();
cancelarbtn = new javax.swing.JButton();
aceptarbtn1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
nombre.setText("Categoria");
nombre.setName("nombre"); // NOI18N
categoria.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
categoriaActionPerformed(evt);
}
});
catbtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Seleccionar.png"))); // NOI18N
catbtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
catbtnActionPerformed(evt);
}
});
tipoc.setText("Precio");
tipoc.setName("nombre"); // NOI18N
preciotxt.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
preciotxtActionPerformed(evt);
}
});
telefono.setText("Sabor");
telefono.setName("nombre"); // NOI18N
sabortxt.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sabortxtActionPerformed(evt);
}
});
cancelarbtn.setText("Cancelar");
cancelarbtn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelarbtnActionPerformed(evt);
}
});
aceptarbtn1.setText("Aceptar");
aceptarbtn1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
aceptarbtn1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(sabortxt)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(nombre, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tipoc, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(telefono, javax.swing.GroupLayout.Alignment.LEADING))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(preciotxt)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(cancelarbtn)
.addGap(120, 120, 120)
.addComponent(aceptarbtn1))
.addGroup(layout.createSequentialGroup()
.addComponent(categoria, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(catbtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(nombre)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(categoria, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(catbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
.addComponent(tipoc)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(preciotxt, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(telefono)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sabortxt, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancelarbtn)
.addComponent(aceptarbtn1))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void catbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_catbtnActionPerformed
SeleccionaCategoria SC = new SeleccionaCategoria();
SC.setVisible(true);
}//GEN-LAST:event_catbtnActionPerformed
private void categoriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_categoriaActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_categoriaActionPerformed
private void sabortxtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sabortxtActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_sabortxtActionPerformed
private void preciotxtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_preciotxtActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_preciotxtActionPerformed
private void aceptarbtn1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aceptarbtn1ActionPerformed
String cat = categoria.getText();
String pr = preciotxt.getText();
String sa = sabortxt.getText();
if(!"".equals(pr) && !"".equals(cat) && !"".equals(sa))
{
if(!"".equals(idProducto) && agregar == false)
{
Nexo.ejecutaSQL("UPDATE empleado.Producto SET idCategoria = '" + categoria.getText() + "', precio = '" + preciotxt.getText() + "', sabor = '"+ sabortxt.getText() + "' WHERE idProducto = "+ idProducto, false);
Inventario.ActualizagridProducto();
Inventario.ActualizagridProductoStock();
Inventario.ActualizagridStock();
this.dispose();
JOptionPane.showMessageDialog(this, "Actualización Correcta");
}
else
{
Nexo.ejecutaSQL("INSERT INTO empleado.Producto(idCategoria,precio,sabor) VALUES('"+ categoria.getText() +"', '"+preciotxt.getText()+"', '"+ sabortxt.getText() +"')", false);
Inventario.ActualizagridProducto();
Inventario.ActualizagridProductoStock();
Inventario.ActualizagridStock();
this.dispose();
JOptionPane.showMessageDialog(this, "Registro agregado");
}
}
else
{
JOptionPane.showMessageDialog(this, "Escriba todos los datos requeridos");
}
}//GEN-LAST:event_aceptarbtn1ActionPerformed
private void cancelarbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarbtnActionPerformed
this.dispose();
}//GEN-LAST:event_cancelarbtnActionPerformed
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Producto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Producto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Producto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Producto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Producto(idProducto, agregar).setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton aceptarbtn1;
private javax.swing.JButton cancelarbtn;
private javax.swing.JButton catbtn;
public static javax.swing.JTextField categoria;
private javax.swing.JLabel nombre;
public static javax.swing.JTextField preciotxt;
public static javax.swing.JTextField sabortxt;
private javax.swing.JLabel telefono;
private javax.swing.JLabel tipoc;
// End of variables declaration//GEN-END:variables
}
| [
"jkhruspe@gmail.com"
] | jkhruspe@gmail.com |
47b9f548724d00902cd05ab4168dad26e7229fd1 | dec0acd462a0dc5772f3840b62df68ce106a8126 | /language-advance/concurrent/src/main/java/org/laidu/learn/concurrent/common/Worker.java | d95817e6c5f258b39aca2d7c981395f90049f4ee | [
"Apache-2.0"
] | permissive | laidu/java-learn | 5382cf6a635871de27d0bd84ee75a35a5e45936d | e33e1ca519652c06e6dea47159daeb6f1f76431c | refs/heads/master | 2023-07-09T10:37:17.163359 | 2023-06-26T14:07:57 | 2023-06-26T14:07:57 | 100,566,396 | 12 | 3 | Apache-2.0 | 2023-07-07T22:07:28 | 2017-08-17T05:50:37 | Java | UTF-8 | Java | false | false | 683 | java | package org.laidu.learn.concurrent.common;
import jodd.util.ThreadUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomUtils;
import java.util.UUID;
/**
* demo 线程
*
* @author tiancai.zang
* on 2018-10-19 17:25.
*/
@Slf4j
@AllArgsConstructor
@Data
public class Worker implements Runnable{
private String name;
@Override
public void run() {
doWork();
}
protected String doWork() {
int sleep = RandomUtils.nextInt(500, 1000);
ThreadUtil.sleep(sleep);
log.info("sleep time: {}", sleep);
return UUID.randomUUID().toString();
}
} | [
"tiancai.zang@finlink.net.cn"
] | tiancai.zang@finlink.net.cn |
a7865f194e43b3451728f558c2e08d1d719c43fa | 99553dc997679f22363961dd2b8bb81b9235f4d4 | /ALCWeb/src/com/alchits/controller/AuctionInfoServlet.java | e7aa0c6d22df892d4290174a02799ecd9140f9d5 | [] | no_license | aa-ht/cla | 59743df13e12de8b8191aa01ca3c4bf21b1b6deb | 7c197c970c7f9297f96d72951c774eaef2defdc5 | refs/heads/master | 2020-03-18T19:26:03.965198 | 2018-07-21T05:24:12 | 2018-07-21T05:24:12 | 135,154,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,537 | java | package com.alchits.controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class AuctionInfoServlet
*/
@WebServlet("/info")
public class AuctionInfoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public AuctionInfoServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
response.sendRedirect("http://www.alchits.com");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//response.setHeader("Cache-Control", "nostore");
PrintWriter out = response.getWriter();
String password = request.getParameter("pwd");
if (password != null) {
if (password.equals("alc123")) {
String AlChitsFileName = (String) getServletContext().getAttribute("ALChitsFileName");
out.println("<table><tr><td>");
if (AlChitsFileName != null) {
out.println("<a href=\"data/" + AlChitsFileName + "\">" + AlChitsFileName + "</a> (Please click to download.)");
}
out.println("</td></tr><tr><td></td></tr><tr><td><div><iframe id=\"wrapper \" src=\"https://docs.google.com/presentation/d/e/2PACX-1vQmC6JTtpkF1x_Hq60rJTDQlMZbD4PKAMAuzQKA_WJF388rCZxtupf25oj3PQPGHCqlPX1DIS-alkJO/embed?start=true&loop=true&delayms=3000\" frameborder=\"0\" width=\"400\" height=\"254\" allowfullscreen=\"true\" mozallowfullscreen=\"true\" webkitallowfullscreen=\"true\"></iframe></div></td></tr></table>");
//out.println("<script src=\"js/download.js\"></script>");
}
else if (password.equals("admin560110#")) {
request.getRequestDispatcher("upload34537456834.jsp").forward(request, response);
}
else {
out.println("<p style=\"color:red\">Access Denied!!</p>");
}
} else {
out.println("<p style=\"color:red\">Access Denied!!</p>");
}
}
}
| [
"Arafath@HUHYTechnolgies.com"
] | Arafath@HUHYTechnolgies.com |
2ab40a7abe03b61406d03ffa48da7802ba68d8fa | b7b1f03f31d4298ae13c587f984085ec962c5bf9 | /src/java/app/controlers/ActualizarEmpleado.java | 3969cd4a7791f0a028cee3c280fefda911517cea | [] | no_license | Boicka/EmpleadoABC2021 | 69bcb34f0da35f70546bc031876d1bc32181d3ee | 678243bee9561a39dfdcfc19952d0b0ab129a2b6 | refs/heads/master | 2023-04-23T15:05:12.622059 | 2021-04-26T01:15:24 | 2021-04-26T01:15:24 | 350,917,588 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,604 | 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 app.controlers;
import app.model.Empleado;
import app.persistencia.EmpleadoDaoJDB;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(name = "ActualizarEmpleado", urlPatterns = {"/ActualizarEmpleado"})
public class ActualizarEmpleado extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
// try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
// out.println("<!DOCTYPE html>");
// out.println("<html>");
// out.println("<head>");
// out.println("<title>Servlet ActualizarEmpleado</title>");
// out.println("</head>");
// out.println("<body>");
// out.println("<h1>Servlet ActualizarEmpleado at " + request.getContextPath() + "</h1>");
// out.println("</body>");
// out.println("</html>");
// }
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
int id;
String nombre;
String apellidos;
String puesto;
double sueldo;
String paginaRespuesta;
Empleado e;
EmpleadoDaoJDB eJDB;
String mensaje;
//Recibir datos del formulario
//Convertir datos si es necesario
id = Integer.parseInt(request.getParameter("id"));
nombre = request.getParameter("fName");
apellidos = request.getParameter("lName");
puesto = request.getParameter("puesto");
sueldo = Double.parseDouble(request.getParameter("sueldo"));
//Crear el objeto de la Clase Empleado
//Asignar valores a sus atributos
try {
//Agregarempleado a la BD
eJDB = new EmpleadoDaoJDB();
eJDB.cambio(id, nombre, apellidos, puesto, sueldo);
//Enviar mensaje a la página de respuesta
mensaje = "Datos del empleado han sido actualizados";
} catch (SQLException ex) {
//Enviar mensaje a la página de respuesta
mensaje = ex.getMessage();
mensaje = mensaje.replace("'", "");
}
paginaRespuesta = "actualizar.jsp";
request.setAttribute("mensaje", mensaje);
// Redireccionar a la página de respuesta
RequestDispatcher dispatcher
= request.getRequestDispatcher(paginaRespuesta);
dispatcher.forward(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"serio@HectorLap"
] | serio@HectorLap |
0632ab250e664ad8ab20f84098377432135e8f14 | fbfcc57052f53e38eeda258feb71f1fdda56dff3 | /src/main/java/com/blibli/experience/commandImpl/productBidding/GetAllProductBiddingByUserAndAvailableCommandImpl.java | 7dd27b9529ce85e44d5df8c66646c2b78ff770f8 | [] | no_license | MAldianPutra/blibli-experience | 54a4fbef9016d35e19943c649342cfa762462b2d | 513dbe34c91d5d715ad9a657b6256ecad83ef71a | refs/heads/master | 2022-11-27T14:59:33.668526 | 2020-08-10T09:02:23 | 2020-08-10T09:02:23 | 241,553,259 | 0 | 1 | null | 2020-08-03T17:20:09 | 2020-02-19T06:52:23 | Java | UTF-8 | Java | false | false | 1,902 | java | package com.blibli.experience.commandImpl.productBidding;
import com.blibli.experience.command.productBidding.GetAllProductBiddingByUserAndAvailableCommand;
import com.blibli.experience.entity.document.ProductBidding;
import com.blibli.experience.enums.ProductBiddingAvailableStatus;
import com.blibli.experience.model.response.productBidding.GetAllProductBiddingByUserAndAvailableResponse;
import com.blibli.experience.repository.ProductBiddingRepository;
import javassist.NotFoundException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;
import java.util.List;
import java.util.UUID;
@Slf4j
@Service
public class GetAllProductBiddingByUserAndAvailableCommandImpl implements GetAllProductBiddingByUserAndAvailableCommand {
private ProductBiddingRepository productBiddingRepository;
@Autowired
public GetAllProductBiddingByUserAndAvailableCommandImpl(ProductBiddingRepository productBiddingRepository) {
this.productBiddingRepository = productBiddingRepository;
}
@Override
public Mono<List<GetAllProductBiddingByUserAndAvailableResponse>> execute(UUID request) {
return productBiddingRepository.findAllByUserData_UserIdAndAvailableStatus(request, ProductBiddingAvailableStatus.AVAILABLE)
.switchIfEmpty(Mono.error(new NotFoundException("Product Bidding not found.")))
.map(this::toResponse)
.collectList();
}
private GetAllProductBiddingByUserAndAvailableResponse toResponse(ProductBidding productBidding) {
GetAllProductBiddingByUserAndAvailableResponse response = new GetAllProductBiddingByUserAndAvailableResponse();
BeanUtils.copyProperties(productBidding, response);
return response;
}
}
| [
"34766290+MAldianPutra@users.noreply.github.com"
] | 34766290+MAldianPutra@users.noreply.github.com |
3ccc67d3a3fa18a832fb0b9abc92b78f16620784 | 975219326ed75c61ae6263201e34dd38db60c72c | /inget-client-commandline-generator/src/test/resources/movies-basic-auth/input/io/superbiz/video/model/MovieModel.java | ce19b6914545f8129fd3baa73cca4a909d7c27c0 | [] | no_license | kaizhiyu/inget | 2702fabe5cbc04f0ea9704c658468e8a6fd63c81 | b3b73e575e70f4098d8a7030db800a08f245521a | refs/heads/master | 2021-10-22T02:48:30.945206 | 2019-03-07T16:04:10 | 2019-03-07T16:04:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,303 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.superbiz.video.model;
import org.tomitribe.inget.api.Filter;
import org.tomitribe.inget.api.Model;
import org.tomitribe.inget.api.Resource;
@Model
@Resource
class MovieModel {
@Model(id = true, operation = Model.Operation.READ)
private String id;
@Model(filter = @Filter(name = "title", multiple = false))
private String title;
private String director;
private String genre;
private int year;
private int rating;
private CredentialModel credential;
}
| [
"ijunckes@tomitribe.com"
] | ijunckes@tomitribe.com |
b0021f5d21098edfb513162db3b2fab85f24c6b2 | dcbfb963586819672034696f98f2470b5cb3cafd | /src/main/java/com/tbe/json/Salon.java | 22b6418d5cb0845282782f2af8abf1783dcab67a | [] | no_license | badetitou/ProLab-Serv | 64e7eb36a641d96ddc668d939b12d713e8a99dbe | ba88fe6ed4362a32b174a07235a626c39be5d6d2 | refs/heads/master | 2020-05-17T16:24:58.778188 | 2017-02-01T22:57:17 | 2017-02-01T22:57:17 | 31,647,503 | 3 | 1 | null | 2015-03-23T16:40:56 | 2015-03-04T08:59:51 | Java | UTF-8 | Java | false | false | 357 | java | package com.tbe.json;
import java.util.ArrayList;
public class Salon {
public int id;
ArrayList<String> messages = new ArrayList<String>();
public Salon(int id){
this.id=id;
}
public ArrayList<String> getMessages() {
return messages;
}
public void setMessages(ArrayList<String> messages) {
this.messages = messages;
}
public Salon(){}
}
| [
"root@Shemale"
] | root@Shemale |
5c0e996f4b8199a7eead73f918c001ab76288c78 | af58b76ed502558e430299541afc07fc34edb6ee | /service/service_edu/src/main/java/com/atguigu/guli/service/edu/service/CommentService.java | 8a9739e76fd8f8fb3851e0221f3c665427263b5a | [] | no_license | LY-GO/guli_parent | d8c0a140ccda1a7fe7ec47436e6f38fc9a82c490 | 9d9379386485590f14756dc71f433a15a7db57bb | refs/heads/master | 2023-02-26T03:44:16.475637 | 2020-11-12T01:23:45 | 2020-11-12T01:23:45 | 311,982,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package com.atguigu.guli.service.edu.service;
import com.atguigu.guli.service.edu.entity.Comment;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 评论 服务类
* </p>
*
* @author zxl
* @since 2020-08-27
*/
public interface CommentService extends IService<Comment> {
}
| [
"410237002@qq.com"
] | 410237002@qq.com |
6984e281296732ebe5a40330c86a6b37e5ace115 | 4ec7d38eaf1fbd33e89d44160d4b200d0952fb76 | /plugins/TemplateResourceAnalyzer/src/main/java/br/ufrj/dcc/kettle/TemplateResourceAnalyzer/TemplateResourceAnalyzerStep.java | 4f9ad540bcb06cb24762b41bd72cb2a77e7e3f5d | [
"MIT"
] | permissive | Grupo-GRECO/ETL4Profiling | 7c4a4b7dba8ca7eb8c33b43f2533068c269d9d1e | 7aef0808d969e3f39451805a3b211d34948be3f2 | refs/heads/master | 2023-02-27T08:45:04.649034 | 2020-10-27T02:30:22 | 2020-10-27T02:30:22 | 336,040,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,164 | java | /**
*
*/
package br.ufrj.dcc.kettle.TemplateResourceAnalyzer;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.jena.query.ParameterizedSparqlString;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
import org.apache.jena.query.QueryFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
import org.apache.jena.query.ResultSetFormatter;
import org.apache.jena.sparql.engine.http.QueryEngineHTTP;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.exception.KettleStepException;
import org.pentaho.di.core.exception.KettleValueException;
import org.pentaho.di.core.row.RowDataUtil;
import org.pentaho.di.core.row.RowMeta;
import org.pentaho.di.core.row.RowMetaInterface;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.step.BaseStep;
import org.pentaho.di.trans.step.StepDataInterface;
import org.pentaho.di.trans.step.StepInterface;
import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.trans.step.StepMetaInterface;
/**
* @author IngridPacheco
*
*/
public class TemplateResourceAnalyzerStep extends BaseStep implements StepInterface {
private TemplateResourceAnalyzerData data;
private TemplateResourceAnalyzerMeta meta;
public TemplateResourceAnalyzerStep(StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans) {
super(stepMeta, stepDataInterface, copyNr, transMeta, trans);
}
public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
meta = (TemplateResourceAnalyzerMeta) smi;
data = (TemplateResourceAnalyzerData) sdi;
return super.init(smi, sdi);
}
public List<String> getResourceNames(Elements resources, List<String> notMappedResources){
Map<String,Float> resourcesCompletenessPercentage = data.resourcesCompletenessPercentage;
this.logBasic("Getting the not mapped resources names");
for (int i = 0; i < resources.size(); i++) {
if (!resources.get(i).hasAttr("accesskey")) {
String resourceName = resources.get(i).text();
this.logBasic(String.format("Not Mapped Resource: %s",resourceName));
if (!notMappedResources.contains(resourceName)) {
Float resourcePercentage = getResourcePercentage(resourceName);
resourcesCompletenessPercentage.put(resourceName, resourcePercentage);
notMappedResources.add(resourceName);
}
}
else {
break;
}
}
return notMappedResources;
}
public List<String> getNotMappedResources() {
this.logBasic("Getting the not mapped resources");
List<String> notMappedResources = data.resources;
String DBpedia = meta.getDBpedia();
String template = meta.getTemplate();
try {
String url = String.format("https://tools.wmflabs.org/templatecount/index.php?lang=%s&namespace=10&name=%s#bottom", DBpedia, template);
this.logBasic(String.format("Url: %s", url));
Document doc = Jsoup.connect(url).get();
Integer quantity = Integer.parseInt(doc.select("form + h3 + p").text().split(" ")[0]);
this.logBasic(String.format("Quantity %s", quantity));
String resourcesUrl = String.format("https://%s.wikipedia.org/wiki/Special:WhatLinksHere/Template:%s?limit=2000&namespace=0", DBpedia, template);
Document resourcesDoc = Jsoup.connect(resourcesUrl).get();
Elements resources = resourcesDoc.select("li a[href^=\"/wiki/\"]");
Element newPage = resourcesDoc.select("p ~ a[href^=\"/w/index.php?\"]").first();
this.logBasic(String.format("Not mapped resources: %s", resources.size()));
notMappedResources = getResourceNames(resources, notMappedResources);
if (quantity > 2000) {
Integer timesDivided = quantity/2000;
while (timesDivided > 0) {
String newUrl = newPage.attr("href");
newUrl = newUrl.replaceAll("amp;", "");
String otherPageUrl = String.format("https://%s.wikipedia.org%s", DBpedia, newUrl);
Document moreResourceDocs = Jsoup.connect(otherPageUrl).get();
resources = moreResourceDocs.select("li a[href^=\"/wiki/\"]");
newPage = moreResourceDocs.select("p ~ a[href^=\"/w/index.php?\"]").get(1);
notMappedResources = getResourceNames(resources, notMappedResources);
timesDivided -= 1;
}
}
return notMappedResources;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return notMappedResources;
}
}
public List<String> getProperties() {
List<String> templateProperties = new ArrayList<>();
try {
String url = String.format("http://mappings.dbpedia.org/index.php/Mapping_%s:%s", meta.getDBpedia(), meta.getTemplate().replaceAll(" ", "_"));
Document doc = Jsoup.connect(url).get();
Elements properties = doc.select("td[width=\"400px\"]");
for (int i = 0; i < properties.size(); i++) {
String templateProperty = properties.get(i).text();
String[] propertyName = templateProperty.split("\\s|_|-");
Integer size = propertyName.length - 1;
Integer counter = 1;
String newString = propertyName[0];
while(size > 0){
String newPropertyName = propertyName[counter].substring(0,1).toUpperCase().concat(propertyName[counter].substring(1));
System.out.println(newPropertyName);
newString = newString.concat(newPropertyName);
System.out.println(newString);
counter = counter + 1;
size = size - 1;
}
templateProperties.add(newString);
}
return templateProperties;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return templateProperties;
}
}
public Float getResourcePercentage(String resourceName) {
List<String> templateProperties = data.templateProperties;
Set<String> templatePropertiesSetList = new HashSet<String>(templateProperties);
List<String> resourceProperties = getResourceProperties(meta.getDBpedia(), resourceName);
Set<String> resourcePropertiesSetList = new HashSet<String>(resourceProperties);
data.resourcesExistingProperties.put(resourceName, resourcePropertiesSetList.size());
data.totalExistingProperties.addAll(templateProperties);
Set<String> notMappedProperties = getNotMappedProperties(resourcePropertiesSetList, templatePropertiesSetList);
data.resourcesNotMappedProperties.put(resourceName, notMappedProperties.size());
Set<String> missingProperties = getMissingProperties(resourcePropertiesSetList, templatePropertiesSetList);
data.resourcesMissingProperties.put(resourceName, missingProperties.size());
Integer templatePropertiesResources = getTemplatePropertiesResources(new ArrayList<String>(resourcePropertiesSetList), new ArrayList<String>(templatePropertiesSetList));
return getPercentage(templatePropertiesResources, templateProperties.size());
}
public List<String> getResources() {
Map<String, String> mapTemplateUrl = new HashMap<String, String>();
mapTemplateUrl.put("pt", "Predefinição");
mapTemplateUrl.put("fr", "Modèle");
mapTemplateUrl.put("ja", "Template");
return getSparqlResources(mapTemplateUrl.get(meta.getDBpedia()));
}
private List<String> getSparqlResources(String templateDefinition) {
String DBpedia = meta.getDBpedia();
Integer limit = 500;
List<String> templateResources = new ArrayList<>();
String templateUrl = String.format("http://%s.dbpedia.org/resource/%s:%s", DBpedia, templateDefinition, meta.getTemplate().replace(" ", "_"));
String queryStr =
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
+ "PREFIX dbp: ?dbpUrl \n"
+ "SELECT DISTINCT ?uri ?name WHERE {\n"
+ "?uri dbp:wikiPageUsesTemplate ?templateUrl. \n"
+ "?uri rdfs:label ?label.filter langMatches(lang(?label), ?language). \n"
+ "BIND(STR(?label)AS ?name).} \n";
ParameterizedSparqlString pss = new ParameterizedSparqlString();
pss.setCommandText(queryStr);
pss.setIri("dbpUrl", String.format("http://%s.dbpedia.org/property/", DBpedia));
pss.setIri("templateUrl", templateUrl);
pss.setLiteral("language", DBpedia);
String sparqlUrl = String.format("http://%s.dbpedia.org/sparql", DBpedia);
Query query = QueryFactory.create(pss.asQuery());
try ( QueryExecution qexec = QueryExecutionFactory.sparqlService(sparqlUrl, query) ) {
((QueryEngineHTTP)qexec).addParam("timeout", "10000") ;
ResultSet rs = qexec.execSelect();
while (rs.hasNext()) {
limit = limit - 1;
QuerySolution resource = rs.next();
String templateName = resource.getLiteral("name").getString();
this.logBasic(String.format("Getting the resource: %s", templateName));
Float resourcePercentage = getResourcePercentage(templateName);
data.resourcesCompletenessPercentage.put(templateName, resourcePercentage);
templateResources.add(templateName);
if (limit == 0) {
TimeUnit.MINUTES.sleep(3);
limit = 500;
}
}
ResultSetFormatter.out(System.out, rs, query);
} catch (Exception e) {
e.printStackTrace();
}
return templateResources;
}
public Integer getTemplatePropertiesResources(List<String> resourceProperties, List<String> templateProperties) {
Set<String> templatePropertiesResource = new HashSet<>();
for (String property : resourceProperties) {
if(templateProperties.contains(property)) {
templatePropertiesResource.add(property);
}
}
return templatePropertiesResource.size();
}
public Set<String> getMissingProperties(Set<String> resourceProperties, Set<String> templateProperties){
Set<String> missingProperties = new HashSet<String>(templateProperties);
missingProperties.removeAll(resourceProperties);
return missingProperties;
}
public Set<String> getNotMappedProperties(Set<String> resourceProperties, Set<String> templateProperties) {
Set<String> notMappedProperties = new HashSet<String>(resourceProperties);
notMappedProperties.removeAll(templateProperties);
return notMappedProperties;
}
public List<String> getResourceProperties(String DBpedia, String resource) {
List<String> resourceProperties = new ArrayList<>();
try {
String url = String.format("http://%s.dbpedia.org/resource/%s", DBpedia, resource.replace(" ", "_"));
Document doc = Jsoup.connect(url).get();
Elements properties = doc.select(String.format("a[href^=\"http://%s.dbpedia.org/property\"]", DBpedia));
for (int i = 0; i < properties.size(); i++) {
String resourceProperty = properties.get(i).text();
if (!resourceProperties.contains(resourceProperty.split(":")[1])) {
resourceProperties.add(resourceProperty.split(":")[1]);
}
}
return resourceProperties;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return resourceProperties;
}
}
public Float getPercentage(Integer templatePropertiesResources, Integer templateProperties) {
if (templateProperties == 0)
return (float) 0;
Float percentage = (templatePropertiesResources.floatValue()/templateProperties.floatValue()) * 100;
return percentage;
}
private void getDBpediaResources() {
if (meta.getDBpedia().equals("pt") || meta.getDBpedia().equals("fr") || meta.getDBpedia().equals("ja")) {
this.logBasic("Getting the resources");
data.resources = getResources();
}
if (meta.getNotMappedResources() == true) {
data.resources = getNotMappedResources();
}
data.quantity = data.resources.size();
}
private void orderResources() {
if (meta.getOrder().equals("Ascending")) {
data.resourcesCompletenessPercentage = data.resourcesCompletenessPercentage.entrySet()
.stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
Set<String> keys = data.resourcesCompletenessPercentage.keySet();
List<String> resourcesInOrder = new ArrayList<String>();
resourcesInOrder.addAll(keys);
data.resources = resourcesInOrder;
}
if (meta.getOrder().equals("Descending")) {
data.resourcesCompletenessPercentage = data.resourcesCompletenessPercentage.entrySet()
.stream()
.sorted((Map.Entry.<String, Float>comparingByValue().reversed()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
Set<String> keys = data.resourcesCompletenessPercentage.keySet();
List<String> resourcesInOrder = new ArrayList<String>();
resourcesInOrder.addAll(keys);
data.resources = resourcesInOrder;
}
}
private void initializeOutputFiles() {
FileWriter CSVwriter;
FileWriter writer;
try {
CSVwriter = new FileWriter(meta.getOutputCSVFile(), true);
CSVUtils.writeLine(CSVwriter, Arrays.asList("DBpedia", "Resources", "Existing Properties", "Missing Properties", "Total", "Completeness Percentage (%)"), ',');
data.CSVwriter = CSVwriter;
writer = new FileWriter(meta.getOutputFile(), true);
data.bufferedWriter = new BufferedWriter(writer);
data.bufferedWriter.write("The result of the analysis was:");
data.bufferedWriter.newLine();
} catch (IOException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
}
private boolean writeFinalOutput(Object[] inputRow) throws KettleStepException {
Object[] outputRow = RowDataUtil.resizeArray( inputRow, 6 );
if (data.resources.size() > 0) {
writeOutput(outputRow, data.resources.remove(0));
return true;
}
else {
Double percentage = Double.parseDouble(getPercentage(data.totalResourcesExistingProperties - data.totalResourcesNotMappedProperties, data.templateProperties.size()*data.quantity).toString());
outputRow[data.outputDBpediaIndex] = meta.getDBpedia();
outputRow[data.outputResourcesIndex] = "Total";
outputRow[data.outputExistingPropertiesIndex] = data.totalResourcesExistingProperties;
outputRow[data.outputMissingPropertiesIndex] = data.totalResourcesMissingProperties;
outputRow[data.outputTotalIndex] = data.templateProperties.size() * data.quantity;
outputRow[data.outputPercentageIndex] = percentage;
this.logBasic("Transformation complete");
try {
CSVUtils.writeLine(data.CSVwriter, Arrays.asList(meta.getTemplate(),"Total", data.totalResourcesExistingProperties.toString(), data.totalResourcesMissingProperties.toString(), String.format("%s", data.templateProperties.size() * data.quantity), percentage.toString()), ',');
data.CSVwriter.flush();
data.CSVwriter.close();
data.bufferedWriter.newLine();
data.bufferedWriter.write(String.format("To sum up, there are %s resource that has %s properties, in which %s template properties are not in it, and %s properties are not mapped in the template. The completeness percentage of the template is %s", data.quantity, data.totalResourcesExistingProperties, data.totalResourcesMissingProperties, data.totalResourcesNotMappedProperties, percentage));
data.bufferedWriter.close();
this.logBasic("Output Files were written.");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
putRow(data.outputRowMeta, outputRow);
setOutputDone();
return false;
}
}
private void writeOutput(Object[] outputRow, String resourceName) throws KettleStepException {
Double percentage = Double.parseDouble(data.resourcesCompletenessPercentage.get(resourceName).toString());
data.totalResourcesExistingProperties = data.totalResourcesExistingProperties + data.resourcesExistingProperties.get(resourceName);
data.totalResourcesNotMappedProperties = data.totalResourcesNotMappedProperties + data.resourcesNotMappedProperties.get(resourceName);
data.totalResourcesMissingProperties = data.totalResourcesMissingProperties + data.resourcesMissingProperties.get(resourceName);
try {
CSVUtils.writeLine(data.CSVwriter, Arrays.asList(meta.getDBpedia(),resourceName, data.resourcesExistingProperties.get(resourceName).toString(), data.resourcesMissingProperties.get(resourceName).toString(), String.format("%s", data.templateProperties.size()), percentage.toString()), ',');
data.bufferedWriter.newLine();
data.bufferedWriter.write(String.format("The resource %s has %s properties, in which %s template properties are not in it, and %s properties are not mapped in the template.", resourceName, data.resourcesExistingProperties.get(resourceName), data.resourcesMissingProperties.get(resourceName), data.resourcesNotMappedProperties.get(resourceName)));
data.bufferedWriter.newLine();
data.bufferedWriter.write(String.format("As the template has %s properties, it leads to a completude percentage of %s.", data.templateProperties.size(), percentage));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
outputRow[data.outputDBpediaIndex] = meta.getDBpedia();
outputRow[data.outputResourcesIndex] = resourceName;
outputRow[data.outputExistingPropertiesIndex] = data.resourcesExistingProperties.get(resourceName);
outputRow[data.outputMissingPropertiesIndex] = data.resourcesMissingProperties.get(resourceName);
outputRow[data.outputTotalIndex] = data.templateProperties.size();
outputRow[data.outputPercentageIndex] = percentage;
putRow(data.outputRowMeta, outputRow);
}
private void getResourceCompleteness(Object[] inputRow) throws KettleValueException {
String[] templateProperties = getInputRowMeta().getString(inputRow, meta.getTemplateProperties(), "").split(", ");
data.templateProperties = new ArrayList<String>(Arrays.asList(templateProperties));
Set<String> templatePropertiesSetList = new HashSet<String>(Arrays.asList(templateProperties));
String resource = getInputRowMeta().getString(inputRow, meta.getResource(), "");
data.resource = resource;
String[] resourcesProperties = getInputRowMeta().getString(inputRow, meta.getResourceProperties(), "").split(", ");
Set<String> resourcesPropertiesSetList = new HashSet<String>(Arrays.asList(resourcesProperties));
data.resourcesExistingProperties.put(resource, resourcesPropertiesSetList.size());
data.totalExistingProperties.addAll(new ArrayList<String>(Arrays.asList(templateProperties)));
Set<String> missingProperties = getMissingProperties(resourcesPropertiesSetList, templatePropertiesSetList);
data.resourcesMissingProperties.put(resource, missingProperties.size());
Set<String> notMappedProperties = getNotMappedProperties(resourcesPropertiesSetList,templatePropertiesSetList);
data.resourcesNotMappedProperties.put(resource, notMappedProperties.size());
Integer templatePropertiesResources = getTemplatePropertiesResources(new ArrayList<String>(resourcesPropertiesSetList), new ArrayList<String>(templatePropertiesSetList));
Float completeness = getPercentage(templatePropertiesResources, templateProperties.length);
data.resourcesCompletenessPercentage.put(resource, completeness);
}
private void writePreviousFieldsOutput() throws KettleStepException {
Object[] outputRow = new Object[6];
data.quantity = data.resources.size();
Double percentage = Double.parseDouble(getPercentage(data.totalResourcesExistingProperties - data.totalResourcesNotMappedProperties, data.totalExistingProperties.size()).toString());
outputRow[data.outputDBpediaIndex] = meta.getDBpedia();
outputRow[data.outputResourcesIndex] = "Total";
outputRow[data.outputExistingPropertiesIndex] = data.totalResourcesExistingProperties;
outputRow[data.outputMissingPropertiesIndex] = data.totalResourcesMissingProperties;
outputRow[data.outputTotalIndex] = data.totalExistingProperties.size();
outputRow[data.outputPercentageIndex] = percentage;
this.logBasic("Transformation complete");
try {
CSVUtils.writeLine(data.CSVwriter, Arrays.asList(meta.getDBpedia(),"Total", data.totalResourcesExistingProperties.toString(), data.totalResourcesMissingProperties.toString(), String.format("%s", data.totalExistingProperties.size()), percentage.toString()), ',');
data.CSVwriter.flush();
data.CSVwriter.close();
data.bufferedWriter.newLine();
data.bufferedWriter.write(String.format("To sum up, there are %s resource that has %s properties, in which %s template properties are not in it, and %s properties are not mapped in the template. The completeness percentage of the template is %s", data.quantity, data.totalResourcesExistingProperties, data.totalResourcesMissingProperties, data.totalResourcesNotMappedProperties, percentage));
data.bufferedWriter.close();
this.logBasic("Output Files were written.");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
putRow(data.outputRowMeta, outputRow);
}
public void insert(String resource, TemplateResourceAnalyzerData data, String order){
Map<String, Float> sortedList = new HashMap<>();
if (order.equals("Ascending")) {
sortedList = data.resourcesCompletenessPercentage.entrySet().stream()
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toMap(
Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
}
else {
sortedList = data.resourcesCompletenessPercentage.entrySet().stream()
.sorted((Map.Entry.<String, Float>comparingByValue().reversed()))
.collect(Collectors.toMap(
Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
}
data.resourcesCompletenessPercentage = sortedList;
data.resources = new ArrayList<>(sortedList.keySet());
}
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
meta = (TemplateResourceAnalyzerMeta) smi;
data = (TemplateResourceAnalyzerData) sdi;
Object[] inputRow = getRow(); // get row, blocks when needed!
if (inputRow == null) // no more input to be expected…
{
if (meta.getChooseInput().equals("Previous fields input")) {
writePreviousFieldsOutput();
}
setOutputDone();
return false;
}
if (first) {
first = false;
data.outputRowMeta = meta.getChooseInput().equals("Previous fields input") ? new RowMeta() : (RowMetaInterface) getInputRowMeta().clone();
meta.getFields(data.outputRowMeta, getStepname(), null, null, this);
data.outputDBpediaIndex = data.outputRowMeta.indexOfValue( "DBpedia" );
data.outputResourcesIndex = data.outputRowMeta.indexOfValue( "Resources" );
data.outputExistingPropertiesIndex = data.outputRowMeta.indexOfValue( "Existing Properties" );
data.outputMissingPropertiesIndex = data.outputRowMeta.indexOfValue( "Missing Properties" );
data.outputTotalIndex = data.outputRowMeta.indexOfValue( "Total" );
data.outputPercentageIndex = data.outputRowMeta.indexOfValue( "Completeness Percentage (%)" );
this.logBasic("Getting the template properties");
if (!meta.getChooseInput().equals("Previous fields input")) {
this.logBasic("Getting the template properties");
data.templateProperties = getProperties();
data.templateProperties.remove(0);
getDBpediaResources();
this.logBasic("Sorting the resources");
orderResources();
initializeOutputFiles();
try {
data.bufferedWriter.write(String.format("There are %s resources inside %s. In some cases, there are properties that are not mapped in the template or template properties that are not in the resource.", data.resources.size(), meta.getTemplate()));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else {
initializeOutputFiles();
}
this.logBasic("Output Files are being written... ");
}
if (!meta.getChooseInput().equals("Previous fields input")) {
return writeFinalOutput(inputRow);
}
else {
Object[] outputRow = new Object[6];
getResourceCompleteness(inputRow);
writeOutput(outputRow, data.resource);
return true;
}
}
public void dispose(StepMetaInterface smi, StepDataInterface sdi) {
meta = (TemplateResourceAnalyzerMeta) smi;
data = (TemplateResourceAnalyzerData) sdi;
super.dispose(smi, sdi);
}
} | [
"ingrid.pacheco@corp.globo.com"
] | ingrid.pacheco@corp.globo.com |
bce0033c5da0440b81303411a8bcafa4bc3f9540 | 13c068bc00407d619fd7f95a757b1058d3804a00 | /marcus_biel/nyapalaTest.java | 83e435bd3c9bdc0f3fcd7b19800220106c680589 | [] | no_license | churchillotiende/java_projects | ddf0b7304d41681240620b6232de14bc555d1860 | 85a9f0a97fdbd33ca2fb7ef47bad6152caf8098d | refs/heads/main | 2023-01-02T16:54:19.143887 | 2020-10-27T09:00:27 | 2020-10-27T09:00:27 | 307,526,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class nyapalaTest
{
@Test
public void shouldReturnNyapala()
{
nyapala greg = new nyapala();
assertEquals("hello nyapala", greg.helloNyapala("nyapala;"));
}
} | [
"churchillotiende84@gmail.com"
] | churchillotiende84@gmail.com |
090b4ae74cead7b49a8c8dcdf0bbfa723696c5cd | aefa0271332f25e81de22b1a202e6c23f86c09ff | /RssReader/src/test/java/test/TestFolder.java | 83706edaa102efeefb1c01373b323af38b610710 | [] | no_license | bonavida/rss-reader | 288fa6b679af4b880635b808cc75134cfae571e4 | 7570e0bb937002f84ecadf7cdb01a7b34b8ab556 | refs/heads/master | 2021-01-12T11:36:40.519968 | 2016-01-22T17:53:54 | 2016-01-22T17:53:54 | 72,229,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,388 | java | package test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import exceptions.NotAllowedOperationException;
import model.Entry;
import model.Feed;
import model.Folder;
import model.Tag;
public class TestFolder {
Folder folder;
Feed feed;
@Before
public void Before() {
folder = new Folder();
feed = new Feed();
}
@Test
public void getFeed_EmptyList_AddedItem() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
try {
folder.addFeed(feed);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(feed, folder.getFeed(feedName));
}
@Test
public void addFeed_ValidFeed_AddedItem() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
try {
folder.addFeed(feed);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(feed, folder.getFeed(feedName));
}
@Test
public void addFeed_ValidFeed_AddedList() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String feedUrl2 = "";
String feedName2 = "Meneame";
Feed feed2 = new Feed(feedName2, feedUrl2);
try {
folder.addFeed(feed);
folder.addFeed(feed2);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(feed, folder.getFeed(feedName));
assertEquals(feed2, folder.getFeed(feedName2));
}
@Test
public void addFeed_ValidFeed_ErrorDuplicate() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String feedUrl2 = "";
String feedName2 = "Meneame";
Feed feed2 = new Feed(feedName2, feedUrl2);
try {
folder.addFeed(feed);
folder.addFeed(feed2);
folder.addFeed(feed);
fail("Exception not throwed");
} catch (NotAllowedOperationException e) {
System.out.println(e);
}
}
@Test
public void addFeed_ValidFeed_ErrorNull() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
try {
folder.addFeed(feed);
folder.addFeed(null);
fail("Exception not throwed");
} catch (NotAllowedOperationException e){
System.out.println(e);
}
}
@Test
public void removeFeed_ValidFeed_RemovedItem() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
try {
folder.addFeed(feed);
folder.removeFeed(feedName);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(null, folder.getFeed(feedName));
}
@Test
public void removeFeed_ValidFeed_RemovedList() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String feedUrl2 = "";
String feedName2 = "Meneame";
Feed feed2 = new Feed(feedName2, feedUrl2);
try {
folder.addFeed(feed);
folder.addFeed(feed2);
folder.removeFeed(feedName);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(null, folder.getFeed(feedName));
}
@Test
public void getFeedList_NotEmptyList_FeedList() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String feedUrl2 = "";
String feedName2 = "Meneame";
Feed feed2 = new Feed(feedName2, feedUrl2);
List<Feed> feedList = new ArrayList<Feed>();
feedList.add(feed);
feedList.add(feed2);
try {
folder.addFeed(feed);
folder.addFeed(feed2);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(feedList, folder.getFeedList());
}
@Test
public void getFeedList_EmptyList_EmptyFeedList() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
List<Feed> feedList = new ArrayList<Feed>();
assertEquals(feedList, folder.getFeedList());
}
@Test
public void getEntryList_NotEmptyList_EntryList() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Meneame";
feed = new Feed(feedName, feedUrl);
String entryName = "¡Feliz 2016!";
Entry entry = new Entry(entryName, "AdminMeneame", "", new Date(), false);
List<Entry> entryList = new ArrayList<Entry>();
entryList.add(entry);
try {
feed.addEntry(entry);
folder.addFeed(feed);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(entryList, folder.getFeed(feedName).getEntryList());
}
@Test
public void getEntryList_EmptyList_EmptyEntryList() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
List<Entry> entryList = new ArrayList<Entry>();
try {
folder.addFeed(feed);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(entryList, folder.getFeed(feedName).getEntryList());
}
@Test
public void setEntryToSeen_EntryNotSeen_EntrySeen() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String entryName = "¡Feliz 2016!";
Entry entry = new Entry(entryName, "AdminBarrapunto", "", new Date(), false);
try {
folder.addFeed(feed);
folder.getFeed(feedName).addEntry(entry);
folder.getFeed(feedName).getEntry(entryName).setSeen(true);
} catch (Exception e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(folder.getFeed(feedName).getEntry(entryName).isSeen(), true);
}
@Test
public void setEntryToNotSeen_EntrySeen_EntryNotSeen() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String entryName = "¡Feliz 2016!";
Entry entry = new Entry(entryName, "AdminBarrapunto", "", new Date(), true);
try {
folder.addFeed(feed);
folder.getFeed(feedName).addEntry(entry);
folder.getFeed(feedName).getEntry(entryName).setSeen(false);
} catch (Exception e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(folder.getFeed(feedName).getEntry(entryName).isSeen(), false);
}
@Test
public void assignTagToFeed_ValidTag_TagAssigned() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String tagName = "Linux";
Tag tag = new Tag(tagName);
try {
folder.addFeed(feed);
folder.getFeed(feedName).addTag(tag);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(tag, folder.getFeed(feedName).getTag(tagName));
}
@Test
public void assignTagToFeed_DuplicatedTag_ErrorDuplicated() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String tagName = "Linux";
Tag tag = new Tag(tagName);
try {
folder.addFeed(feed);
folder.getFeed(feedName).addTag(tag);
folder.getFeed(feedName).addTag(tag);
fail("Exception not throwed");
} catch (NotAllowedOperationException e) {
System.out.println(e);
}
}
@Test
public void unassignTag_ValidTag_TagUnassigned() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String tagName = "Linux";
Tag tag = new Tag(tagName);
try {
folder.addFeed(feed);
folder.getFeed(feedName).addTag(tag);
folder.getFeed(feedName).removeTag(tagName);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(null, folder.getFeed(feedName).getTag(tagName));
}
@Test
public void getAssignedFeedList_AssignedFeeds_AssignedFeedList() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String feedUrl2 = "";
String feedName2 = "Meneame";
Feed feed2 = new Feed(feedName2, feedUrl2);
List<Feed> assignedFeedList = new ArrayList<Feed>();
assignedFeedList.add(feed);
assignedFeedList.add(feed2);
String tagName = "Linux";
Tag tag = new Tag(tagName);
try {
folder.addFeed(feed);
folder.addFeed(feed2);
folder.getFeed(feedName).addTag(tag);
folder.getFeed(feedName2).addTag(tag);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(assignedFeedList, tag.getAssignedFeedList());
}
@Test
public void getAssignedFeedList_NotAssignedFeeds_EmptyFeedList() {
String folderName = "Sin asignar";
folder = new Folder(folderName);
String feedUrl = "";
String feedName = "Barrapunto";
feed = new Feed(feedName, feedUrl);
String feedUrl2 = "";
String feedName2 = "Meneame";
Feed feed2 = new Feed(feedName2, feedUrl2);
List<Feed> list = new ArrayList<Feed>();
String tagName = "Android";
Tag tag = new Tag(tagName);
try {
folder.addFeed(feed);
folder.addFeed(feed2);
} catch (NotAllowedOperationException e) {
fail("Exception throwed");
System.out.println(e);
}
assertEquals(list, tag.getAssignedFeedList());
}
}
| [
"al095660@uji.es"
] | al095660@uji.es |
93ae2f20e2b896aa09b8e8f99d79fadec0e74e12 | 46bc7c84fd3c093c14aa50343b23a9e791096cb0 | /app/src/main/java/stud11418004/develops/beasiswapelajar/Fragment/FragmentSaved.java | 9841e14e138ee4ae3230a7d6db727c76a7def553 | [] | no_license | ifetayo14/BeasiswaPelajar | fe1e66efd362c66d48824765aad5937897bf8f1b | caa6365a3fc96f9085168391adfbe6762cbfbd87 | refs/heads/master | 2022-11-06T16:10:09.856913 | 2020-06-26T04:49:54 | 2020-06-26T04:49:54 | 260,840,569 | 0 | 0 | null | 2020-06-25T23:51:21 | 2020-05-03T06:15:22 | Java | UTF-8 | Java | false | false | 2,366 | java | package stud11418004.develops.beasiswapelajar.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import stud11418004.develops.beasiswapelajar.API.APIClient;
import stud11418004.develops.beasiswapelajar.Adapter.AdapterBeasiswa;
import stud11418004.develops.beasiswapelajar.Adapter.AdapterSaved;
import stud11418004.develops.beasiswapelajar.Model.Saved;
import stud11418004.develops.beasiswapelajar.R;
import stud11418004.develops.beasiswapelajar.Response.SavedResponse;
/**
* A simple {@link Fragment} subclass.
*/
public class FragmentSaved extends Fragment {
private RecyclerView recyclerView;
private AdapterSaved adapter;
private List<Saved> savedList;
public FragmentSaved() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
RelativeLayout rootView = (RelativeLayout) inflater.inflate(R.layout.fragment_saved, container, false);
return rootView;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
recyclerView = view.findViewById(R.id.rv_saved);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
Call<SavedResponse> call = APIClient.getInstance().getAPI().getAllSaved();
call.enqueue(new Callback<SavedResponse>() {
@Override
public void onResponse(Call<SavedResponse> call, Response<SavedResponse> response) {
savedList = response.body().getSavedList();
adapter = new AdapterSaved(getContext(), savedList);
recyclerView.setAdapter(adapter);
}
@Override
public void onFailure(Call<SavedResponse> call, Throwable t) {
}
});
}
}
| [
"alvinsimbolon6@gmail.com"
] | alvinsimbolon6@gmail.com |
4dda1e7367e2284654845d7df94b8ba1a8ec8e2f | cc33660e0d902405905292d5f78cba2a6d7886fa | /mobile/src/main/java/com/youyou/uuelectric/renter/Network/HttpNetwork.java | a699a2af0265a8eaf96de77aecc700e80cc67da8 | [] | no_license | btbDriver/uuelectricrenter | e05cec397e99b5491d013753573553682602b6bd | 2e5fd5669e00d8a9ee029bf84d0e9bbc575aa19e | refs/heads/master | 2021-08-15T02:50:55.791295 | 2017-11-17T07:38:01 | 2017-11-17T07:38:01 | 111,072,506 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 235 | java | package com.youyou.uuelectric.renter.Network;
/**
* Created by taurusxi on 14-8-6.
*/
public interface HttpNetwork<T> {
public abstract void doPost(int seq, NetworkTask networkTask, HttpResponse.NetWorkResponse response);
}
| [
"liuchao5@xiaomi.com"
] | liuchao5@xiaomi.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.