blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
18327de6cfe9f50468cbc2e8748cd90d4e608732 | a28103926cbaa5b82cbff54eec2c39a7aec58896 | /src/main/java/lhc/domain/FxSw5.java | d7a1ae94f15deb406d9482168a6387b8c7aae820 | []
| no_license | georgezeng/lhc | b1529ab8d442c421ccdd8c346eb3026f02f55d7e | 83e42bf90b2fdce6eb04c1a50e46c49bbff5d05d | refs/heads/master | 2022-10-05T01:52:11.608701 | 2019-06-29T06:44:26 | 2019-06-29T06:44:26 | 91,151,495 | 0 | 0 | null | 2022-09-01T22:15:32 | 2017-05-13T05:23:21 | Java | UTF-8 | Java | false | false | 159 | java | package lhc.domain;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "fx_sw5_yz")
public class FxSw5 extends FxSw {
}
| [
"[email protected]"
]
| |
f330c47be4664015ab722a4bbe5824d4b81ea997 | 0f567e73f1581d79d79aeea6b40ed909fb8ad92e | /src/trm/dao/vendortrainer/VendorTrainerMapper.java | 295203cfc1d0c6c266f8d4c45c6900228a9f5d81 | []
| no_license | Nthomsen9111/TRM | b36f9e75107ca7ac24565a2be3210c7f5b4720e9 | 73000eb165366954a972b2e5468e0cb8dc4384ae | refs/heads/master | 2020-04-23T00:03:20.701162 | 2019-02-10T07:57:40 | 2019-02-10T07:57:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 817 | java | package trm.dao.vendortrainer;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
/**
* This is vendor mapper
* @author Kei Ng
*
*/
public class VendorTrainerMapper implements RowMapper<VendorTrainer> {
@Override
public VendorTrainer mapRow(ResultSet result, int arg1) throws SQLException {
VendorTrainer vendorTrainer = new VendorTrainer();
vendorTrainer.setVendor_trainer_id(result.getInt(1));
vendorTrainer.setVendor_trainer_name(result.getString(2));
vendorTrainer.setPhone(result.getString(3));
vendorTrainer.setEmail(result.getString(4));
vendorTrainer.setProfile(result.getString(5));
vendorTrainer.setEvaluation_status(result.getString(6));
vendorTrainer.setVendor_trainer_log(result.getString(7));
return vendorTrainer;
}
}
| [
"[email protected]"
]
| |
9cbb1850628b39c1d55c6195b57d1f8234b5c649 | 4ccc8d612b66f8844a545a4e62cb087acdf2fadb | /ScreenReader_R2/src/washington/cs/mobileocr/main/TextParser.java | 2bb6303a522764f73803a02e6e5ca3f0e52988e1 | []
| no_license | Mark-jk/mobileocr | 8361b7128fb9daaaa1721c5b3b3f9726d3218dd8 | 59a2c30ed5ee928f6fcbb8ce4757c5dd7f11412c | refs/heads/master | 2021-01-10T16:20:59.562449 | 2015-05-27T03:03:56 | 2015-05-27T03:03:56 | 36,338,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,259 | java |
package washington.cs.mobileocr.main;
/**
* Copyright 2010, Josh Scotland & Hussein Yapit
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided you follow the BSD license.
*
*
* This class is a simple text parser that parses sentences and words
* out the text received by OCR.
*/
import android.util.Log;
public class TextParser {
private static final String TAG = "TextParser";
private static String cleanerPassedString = "";
//Parses a block of text into sentences based on the punctuation
public static String[] sentenceParse(String passedString) {
String delims = "[.?!]+|\n";
String[] tokens = passedString.trim().split(delims);
for (int i = 0; i < tokens.length; i++)
tokens[i] = tokens[i].trim();
Log.d(TAG, "SentenceParse = " + arrayToString(tokens));
return tokens;
}
//Parses a block of text into words based on the spaces
public static String[] wordParse(String[] passedSentences) {
String delims = "[ ]+";
cleanerPassedString = passedSentences[0].trim();
for (int i = 1; i < passedSentences.length; i++)
cleanerPassedString += " " + passedSentences[i];
String[] tokens = cleanerPassedString.trim().split(delims);
Log.d(TAG, "WordParse = " + arrayToString(tokens));
return tokens;
}
//Counts the number of words in each of the sentences
public static int[] countWordsInSentence(String[] passedSentences) {
String delims = "[ ]+";
int count = 0;
int[] wordsInSentence = new int[passedSentences.length];
for (int i = 0; i < wordsInSentence.length; i++) {
count += passedSentences[i].trim().split(delims).length;
wordsInSentence[i] = count;
}
Log.d(TAG, "WordCount[0] = " + wordsInSentence[0]);
return wordsInSentence;
}
//Helper method for debugging. Displays what is in the array.
public static String arrayToString(String[] a) {
String result = "";
if (a.length > 0) {
result = a[0];
for (int i=1; i<a.length; i++) {
result = result + "," + a[i];
}
}
return result;
}
}
| [
"JoshScotland@edcf3bf6-0b88-11df-ad0c-0fb4090ca1bc"
]
| JoshScotland@edcf3bf6-0b88-11df-ad0c-0fb4090ca1bc |
a2f60aa050be8495b5ff79ed379c25d2094c2cc5 | 82202a2ac5bf529955141ee8b26b2beb2a3b4c41 | /projeto-jpa/src/main/java/br/com/alura/jpa/testes/PopulaMovimentacoesComCategoria.java | 0d057eb73dff8f142501e72d03585bba39843e8a | []
| no_license | lcarlin/Alura_Java_Path_learning | cfeda3c3839bb6aa560522b3791dce045b8f8347 | 10359fda52553f0d502bc2ee98a742d4c72c25c2 | refs/heads/master | 2023-05-30T17:42:59.366843 | 2021-06-10T21:26:32 | 2021-06-10T21:26:32 | 287,602,188 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,958 | java | package br.com.alura.jpa.testes;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Arrays;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import br.com.alura.jpa.modelo.Categoria;
import br.com.alura.jpa.modelo.Conta;
import br.com.alura.jpa.modelo.Movimentacao;
import br.com.alura.jpa.modelo.TipoMovimentacao;
public class PopulaMovimentacoesComCategoria {
public static void main(String[] args) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("contas");
EntityManager em = emf.createEntityManager();
Categoria categoria1 = new Categoria("Viagem");
Categoria categoria2 = new Categoria("Negócios");
Conta conta = em.find(Conta.class, 2L);
Movimentacao movimentacao1 = new Movimentacao();
movimentacao1.setData(LocalDateTime.now()); // hoje
movimentacao1.setDescricao("Viagem à SP");
movimentacao1.setTipoMovimentacao(TipoMovimentacao.SAIDA);
movimentacao1.setValor(new BigDecimal(100.0));
movimentacao1.setCategorias(Arrays.asList(categoria1));
movimentacao1.setConta(conta);
Movimentacao movimentacao2 = new Movimentacao();
movimentacao2.setData(LocalDateTime.now().plusDays(1)); // amanhã
movimentacao2.setDescricao("Viagem ao RJ");
movimentacao2.setTipoMovimentacao(TipoMovimentacao.SAIDA);
movimentacao2.setValor(new BigDecimal(300.0));
movimentacao2.setCategorias(Arrays.asList(categoria2));
movimentacao2.setConta(conta);
em.getTransaction().begin();
em.persist(categoria1); // Agora a 'categoria1' é Managed
em.persist(categoria2); // Agora a 'categoria2' é Managed
em.persist(movimentacao1);
em.persist(movimentacao2);
em.getTransaction().commit();
em.close();
}
} | [
"[email protected]"
]
| |
700908b0ea281bfb6fde70e8226f44d7dc111d25 | 3d4830099e1f592b657781351fe5fbb3d61188ae | /disqus/src/main/java/me/philio/disqus/api/exception/BadRequestException.java | 806085bfa52b721e891ccb5a97bdc17bed9adb6a | [
"Apache-2.0"
]
| permissive | jjhesk/disqus-android | 21292348ccd9ffe19cabef7b9651a1adbe490bee | 8a486a21a5c22a0949534cd35f8677e4f4f81708 | refs/heads/master | 2021-01-18T01:21:18.642483 | 2014-11-24T09:29:21 | 2014-11-24T09:29:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package me.philio.disqus.api.exception;
/**
* Bad request
*/
public class BadRequestException extends ApiException {
public BadRequestException() {
}
public BadRequestException(String detailMessage) {
super(detailMessage);
}
public BadRequestException(String detailMessage, Throwable throwable) {
super(detailMessage, throwable);
}
public BadRequestException(Throwable throwable) {
super(throwable);
}
}
| [
"[email protected]"
]
| |
345fa6772bd7c9ae5460e9328faabb27008b5764 | 64cd9bfadc11b6753498d7376feae008eb9d614f | /Rohit java/src/Lecture1/sumofnaturalnum.java | 082efb4bc2c0b7859d8ad628fb270e868e858cac | []
| no_license | Rohit919/Data-Structure-Using-java | d8e9017c27ff01b0af15762b4ad2739db993ac94 | d083acfe81ec08f2a6ca17a87647265df30de57c | refs/heads/master | 2022-04-25T09:55:39.847061 | 2020-04-24T05:44:27 | 2020-04-24T05:44:27 | 258,416,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package Lecture1;
import java.util.Scanner;
public class sumofnaturalnum {
public static void main(String[] args) {
// TODO Auto-generated method stub
int sum=0;
System.out.println("Enter the number of natural number");
Scanner s = new Scanner(System.in);
int b=s.nextInt();
for(int i=1;i<=b;i++)
{
sum = sum + i;
}
System.out.println(sum);
}
}
| [
"[email protected]"
]
| |
99b3773cda87972025d9aaf7243a2c3fb0b1326b | aea831a99867915fb91e9befdec39f634ed2cb98 | /api-commons/src/main/java/io/joamit/caresearch/api/commons/util/Validations.java | 704041e7074f1a94ec600530abf988bbddebca02 | []
| no_license | joamit/caresearch | 7f89b2911dac174fb09414c8a2fd8e9abf870c81 | 73aef549adbc2d1e47fd728cdaae68b5491b6e68 | refs/heads/master | 2020-03-07T10:08:25.789728 | 2018-03-31T14:41:20 | 2018-03-31T14:41:20 | 127,424,382 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,360 | java | package io.joamit.caresearch.api.commons.util;
import io.joamit.caresearch.api.commons.domain.Car;
import io.joamit.caresearch.api.commons.domain.Engine;
import io.joamit.caresearch.api.commons.domain.Manufacturer;
public final class Validations {
public static void validateCar(Car car) {
if (car == null) throw new IllegalStateException("Car can not be null!!");
if (car.getEngine() == null) throw new IllegalStateException("Car must have an engine!!");
if (car.getManufacturer() == null) throw new IllegalStateException("Car must have a manufacturer!!");
if (car.getName() == null) throw new IllegalStateException("Car is missing its name!!");
}
public static void validateEngine(Engine engine) {
if (engine == null) throw new IllegalStateException("Engine can not be null!!");
if (engine.getManufacturer() == null) throw new IllegalStateException("Engine must have a manufacturer!!");
if (engine.getName() == null) throw new IllegalStateException("Engine is missing its name!!");
}
public static void validateManufacturer(Manufacturer manufacturer) {
if (manufacturer == null) throw new IllegalStateException("Manufacturer can not be null!!");
if (manufacturer.getName() == null) throw new IllegalStateException("Manufacturer is missing its name!!");
}
}
| [
"[email protected]"
]
| |
5ae7dac7525aedeebc737b4b1b5f64cd576696ba | ff61371896cb16ce12b830ddd7f9cc7700d72445 | /taotao-item-web/target/tomcat/work/Tomcat/localhost/_/org/apache/jsp/WEB_002dINF/jsp/commons/footer_jsp.java | 875ab4cd7897ffa54861ae6b7797ba9e8458fa5d | []
| no_license | denghaiping/taotaoProject | 7df2659df93ff37d50572b0e0eb9328b763234eb | 8e07a91a9fe5cbaf50c31788d50095f42ca922af | refs/heads/master | 2020-04-01T00:56:48.846877 | 2018-10-22T09:45:19 | 2018-10-22T09:45:19 | 152,719,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,532 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.47
* Generated at: 2018-10-16 07:15:23 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.WEB_002dINF.jsp.commons;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class footer_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<div class=\"w\" clstag=\"homepage|keycount|home2013|37a\">\r\n");
out.write("\t<div id=\"service-2013\">\r\n");
out.write("\t\t<dl class=\"fore1\">\r\n");
out.write("\t\t\t<dt><b></b><strong>购物指南</strong></dt>\r\n");
out.write("\t\t\t<dd>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-56.html\" target=\"_blank\" rel=\"nofollow\">购物流程</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-57.html\" target=\"_blank\" rel=\"nofollow\">会员介绍</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-181.html\" target=\"_blank\" rel=\"nofollow\">团购/机票</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-61.html\" target=\"_blank\" rel=\"nofollow\">常见问题</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-63.html\" target=\"_blank\" rel=\"nofollow\">大家电</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/index.html\" target=\"_blank\" rel=\"nofollow\">联系客服</a></div>\r\n");
out.write("\t\t\t</dd>\r\n");
out.write("\t\t</dl>\r\n");
out.write("\t\t<dl class=\"fore2\">\t\t\r\n");
out.write("\t\t\t<dt><b></b><strong>配送方式</strong></dt>\r\n");
out.write("\t\t\t<dd>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-64.html\" target=\"_blank\" rel=\"nofollow\">上门自提</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-360.html\" target=\"_blank\" rel=\"nofollow\">211限时达</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/distribution-768.html\" target=\"_blank\" rel=\"nofollow\">配送服务查询</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-892.html#help2215\" target=\"_blank\" rel=\"nofollow\">配送费收取标准</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://market.jd.com/giftcard/index.html#one5\" target=\"_blank\" rel=\"nofollow\">如何送礼</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://en.jd.com/chinese.html\" target=\"_blank\">海外配送</a></div>\r\n");
out.write("\t\t\t</dd>\r\n");
out.write("\t\t</dl>\r\n");
out.write("\t\t<dl class=\"fore3\">\r\n");
out.write("\t\t\t<dt><b></b><strong>支付方式</strong></dt>\r\n");
out.write("\t\t\t<dd>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-67.html\" target=\"_blank\" rel=\"nofollow\">货到付款</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-68.html\" target=\"_blank\" rel=\"nofollow\">在线支付</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-71.html\" target=\"_blank\" rel=\"nofollow\">分期付款</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-69.html\" target=\"_blank\" rel=\"nofollow\">邮局汇款</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-70.html\" target=\"_blank\" rel=\"nofollow\">公司转账</a></div>\r\n");
out.write("\t\t\t</dd>\r\n");
out.write("\t\t</dl>\r\n");
out.write("\t\t<dl class=\"fore4\">\t\t\r\n");
out.write("\t\t\t<dt><b></b><strong>售后服务</strong></dt>\r\n");
out.write("\t\t\t<dd>\r\n");
out.write("\t\t\t\t<div><a href=\"http://myjd.jd.com/afs/help/afshelp.action\" target=\"_blank\" rel=\"nofollow\">售后政策</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-99.html\" target=\"_blank\" rel=\"nofollow\">价格保护</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-100.html\" target=\"_blank\" rel=\"nofollow\">退款说明</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://myjd.jd.com/repair/repairs.action\" target=\"_blank\" rel=\"nofollow\">返修/退换货</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-881.html\" target=\"_blank\" rel=\"nofollow\">取消订单</a></div>\r\n");
out.write("\t\t\t</dd>\r\n");
out.write("\t\t</dl>\r\n");
out.write("\t\t<dl class=\"fore5\">\r\n");
out.write("\t\t\t<dt><b></b><strong>特色服务</strong></dt>\r\n");
out.write("\t\t\t<dd>\t\t\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-79.html\" target=\"_blank\">夺宝岛</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-86.html\" target=\"_blank\">DIY装机</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://fuwu.jd.com/\" target=\"_blank\" rel=\"nofollow\">延保服务</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://giftcard.jd.com/market/index.action\" target=\"_blank\" rel=\"nofollow\">淘淘E卡</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://help.jd.com/help/question-91.html\" target=\"_blank\" rel=\"nofollow\">节能补贴</a></div>\r\n");
out.write("\t\t\t\t<div><a href=\"http://mobile.jd.com/\" target=\"_blank\" rel=\"nofollow\">淘淘通信</a></div>\r\n");
out.write("\t\t\t</dd>\r\n");
out.write("\t\t</dl>\r\n");
out.write("\t\t<div class=\"fr\">\r\n");
out.write("\t\t\t<div class=\"sm\" id=\"branch-office\">\r\n");
out.write("\t\t\t\t<div class=\"smt\">\r\n");
out.write("\t\t\t\t\t<h3>淘淘自营覆盖区县</h3>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t\t<div class=\"smc\">\r\n");
out.write("\t\t\t\t\t<p>淘淘已向全国1859个区县提供自营配送服务,支持货到付款、POS机刷卡和售后上门服务。</p>\r\n");
out.write("\t\t\t\t\t<p class=\"ar\"><a href=\"http://help.jd.com/help/distribution-768.html\" target=\"_blank\">查看详情 ></a></p>\r\n");
out.write("\t\t\t\t</div>\r\n");
out.write("\t\t\t</div>\r\n");
out.write("\t\t</div>\r\n");
out.write("\t\t<span class=\"clr\"></span>\r\n");
out.write("\t</div>\r\n");
out.write("</div>\r\n");
out.write("<div class=\"w\" clstag=\"homepage|keycount|home2013|38a\">\r\n");
out.write("\t");
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "footer-links.jsp", out, false);
out.write("\r\n");
out.write("</div>\r\n");
out.write("<script type=\"text/javascript\" src=\"/js/jquery-1.6.4.js\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"/js/jquery-extend.js\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"/js/lib-v1.js\" charset=\"utf-8\"></script>\r\n");
out.write("<script type=\"text/javascript\" src=\"/js/taotao.js\" charset=\"utf-8\"></script>\r\n");
out.write("<script type=\"text/javascript\"> (function(){\r\n");
out.write("var A=\"<strong>热门搜索:</strong><a href='http://sale.jd.com/act/OfHQzJ2GLoYlmTIu.html' target='_blank' style='color:#ff0000' clstag='homepage|keycount|home2013|03b1'>校园之星</a><a href='http://sale.jd.com/act/aEBHqLFMfVzDZUvu.html' target='_blank'>办公打印</a><a href='http://www.jd.com/pinpai/878-12516.html' target='_blank'>美菱冰箱</a><a href='http://sale.jd.com/act/nuzKb6ZiYL.html' target='_blank'>无肉不欢</a><a href='http://sale.jd.com/act/ESvhtcAJNbaj.html' target='_blank'>万件好货</a><a href='http://sale.jd.com/act/nAqiWgU34frQolt.html' target='_blank'>iPhone6</a><a href='http://sale.jd.com/act/p0CmUlEFPHLX.html' target='_blank'>哈利波特</a><a href='http://sale.jd.com/act/FstSdb2vCOLa8BRi.html' target='_blank'>美模接驾</a>\";\r\n");
out.write("var B=[\"java\",\"apple\",\"LG G3\",\"天梭\",\"保温杯\",\"三个爸爸\"];\r\n");
out.write("B=pageConfig.FN_GetRandomData(B);\r\n");
out.write("$(\"#hotwords\").html(A);\r\n");
out.write("var _searchValue = \"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${query}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\";\r\n");
out.write("if(_searchValue.length == 0){\r\n");
out.write("\t_searchValue = B;\r\n");
out.write("}\r\n");
out.write("$(\"#key\").val(_searchValue).bind(\"focus\",function(){if (this.value==B){this.value=\"\";this.style.color=\"#333\"}}).bind(\"blur\",function(){if (!this.value){this.value=B;this.style.color=\"#999\"}});\r\n");
out.write("})();\r\n");
out.write("</script>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"[email protected]"
]
| |
96dfe7e9583ac886e2c4cb97cc9f86bce53dfde6 | 700f782c7efe4ad97d43494940f07f0f0c4099b6 | /WebSelfcare/src/main/java/com/saral/training/msdp/selfcare/controller/BaseController.java | 072ba9191d201186c4bc8f86fa5677b8b630c4b3 | []
| no_license | saxenasaral/Selfcare | 884bca53aaf4687afbb9b3df6ce25f9ca65b2391 | dff36634841a709a49ad2d980199adc7018447cd | refs/heads/master | 2021-06-30T15:44:13.820095 | 2017-09-14T07:49:44 | 2017-09-14T07:49:44 | 103,502,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | package com.saral.training.msdp.selfcare.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller("/selfcare")
public class BaseController {
@RequestMapping("/index")
public ModelAndView getIndex(){
System.out.println("recieved");
String s = "welcome ";
ModelAndView m = new ModelAndView();
m.setViewName("index");
m.addObject("index", s);
return m;
}
@RequestMapping("/hello")
public ModelAndView getHello(){
System.out.println("recieved");
String s = "hello ";
ModelAndView m = new ModelAndView();
m.setViewName("hello");
m.addObject("index", s);
return m;
}
}
| [
"[email protected]"
]
| |
be17699013de4b31e62764831742c031c01c6644 | 5194981697a363648cb049b8176e730cb61cccbd | /OCP8Apress/src/mock/QX14.java | 68c26f833b3a0d9b531eb87026f521c2bff49c9a | []
| no_license | demirramazan/OCP8 | 1b91d52c98dbf28946dddb87798be8af7a4db0c6 | ec21bd4c0afba467f1e6084756a090b04a5ffbc8 | refs/heads/master | 2020-03-29T02:08:29.972513 | 2018-06-16T19:19:30 | 2018-06-16T19:19:30 | 149,422,202 | 1 | 0 | null | 2018-09-19T09:01:23 | 2018-09-19T09:01:22 | null | UTF-8 | Java | false | false | 461 | java | package mock;
class WildCard {
interface BI {
}
interface DI extends BI {
}
interface DDI extends DI {
}
static class C<T> {
}
static void foo(C<? super DI> arg) {
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void main(String[] args) {
foo(new C<BI>()); // ONE
foo(new C<DI>()); // TWO
//foo(new C<DDI>()); // THREE //Compiler error
foo(new C()); // FOUR
}
}
public class QX14 {
}
| [
"[email protected]"
]
| |
2cd01ce057804b8127b63ba838b9b28739baf327 | ad07739a467f67d46a2952aab7d8eee63e6eedb3 | /Spotitube/src/main/java/han/oose/dea/spotitube/datasource/databaseConnection/DatabaseConnector.java | b1c892a6632efd28e0806f3684a5e394d0012cc0 | []
| no_license | HugUlf/spotitube-1 | 0773dfb3f8b3ac8f6c52b1ec737ec0acc40386ef | 89e9d9eeaf05934b0421ee96db2a57de60128daf | refs/heads/master | 2022-04-09T04:09:56.185226 | 2020-03-26T09:32:37 | 2020-03-26T09:32:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 802 | java | package han.oose.dea.spotitube.datasource.databaseConnection;
import java.sql.Connection;
import java.sql.SQLException;
public interface DatabaseConnector {
/**
* Loads database driver and creates a connection to the database
*
* @return Connection to database
* @throws ClassNotFoundException The driver could not be loaded
* @throws SQLException Something went wrong with creating a connection to the database
*/
Connection makeConnection() throws ClassNotFoundException, SQLException;
/**
* Closes connection with database
*
* @param connection The database connection to be closed
* @throws SQLException Something went wrong with closing the connection
*/
void closeConnection(Connection connection) throws SQLException;
}
| [
"[email protected]"
]
| |
b99e5cee9acdbbf5a8f68366b6916dcf38e04f10 | 394623cbcebab1e60d8b305c8d4441063fcfaefc | /app/src/main/java/me/anasmadrhar/hiddenfoundersandroidchallenge/ui/main/MainActivity.java | 1e296d59735a10becfc4988a5d2d18a50f1f341b | []
| no_license | metaltrt/HiddenFoundersMobileAppChallenge | 40b017b7e38f19fd7a5e119f0f2eff5ac609fdb3 | f1c8fe584990e4dbbc4b1cf21be93dd2887f434a | refs/heads/master | 2020-03-09T03:09:41.503185 | 2018-04-07T19:12:19 | 2018-04-07T19:12:19 | 128,558,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,929 | java | package me.anasmadrhar.hiddenfoundersandroidchallenge.ui.main;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.Toast;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import me.anasmadrhar.hiddenfoundersandroidchallenge.MyApplication;
import me.anasmadrhar.hiddenfoundersandroidchallenge.R;
import me.anasmadrhar.hiddenfoundersandroidchallenge.helper.EndlessRecyclerViewScrollListener;
import me.anasmadrhar.hiddenfoundersandroidchallenge.model.Repo;
public class MainActivity extends AppCompatActivity implements MainView {
@BindView(R.id.recyclerView)
RecyclerView reposRecyclerView;
@BindView(R.id.srl)
SwipeRefreshLayout swipeRefreshLayout;
private ReposListAdapter adapter;
private EndlessRecyclerViewScrollListener scrollListener;
private LinearLayoutManager linearLayoutManager;
private MainPresenter presenter;
private ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
//Attach View to the Presenter.
presenter=new MainPresenter(this,((MyApplication)getApplication()).getGithubAPI());
//Setup Endless Scroll listener so we can use pagination.
setupScrollListener();
//Setup Recycler View.
setupRecyclerView();
//Setup swipe to refresh layout.
setupSwipeToRefresh();
//get First page.
presenter.loadRepos(1);
}
/**
* Setup Swipe to refresh layout.
* clear current items and load new ones
* starting from page 1
*/
private void setupSwipeToRefresh() {
swipeRefreshLayout.setOnRefreshListener(() -> {
adapter.clearRepos();
adapter.notifyDataSetChanged();
scrollListener.resetState();
presenter.loadRepos(1);
});
}
/**
* setup endless scrolling in recycler view to fetch more data when reaching bottom of the list.
*/
private void setupScrollListener() {
linearLayoutManager=new LinearLayoutManager(this);
scrollListener=new EndlessRecyclerViewScrollListener(linearLayoutManager) {
@Override
public void onLoadMore(int page, int totalItemsCount, RecyclerView view) {
presenter.loadRepos(page+1);
}
};
}
/**
* Setup Recycler View
*/
private void setupRecyclerView() {
adapter=new ReposListAdapter();
reposRecyclerView.setAdapter(adapter);
reposRecyclerView.setLayoutManager(linearLayoutManager);
reposRecyclerView.addOnScrollListener(scrollListener);
}
@Override
public boolean showLoading() {
// progressDialog=new ProgressDialog(this);
// progressDialog.show();
swipeRefreshLayout.setRefreshing(true);
return true;
}
@Override
public boolean hideLoading() {
// if (progressDialog!=null)progressDialog.hide();
swipeRefreshLayout.setRefreshing(false);
return false;
}
@Override
public void showError(int resId) {
Toast.makeText(this,resId,Toast.LENGTH_LONG).show();
swipeRefreshLayout.setRefreshing(false);
}
@Override
public void showError(String message) {
Toast.makeText(this,message,Toast.LENGTH_LONG).show();
swipeRefreshLayout.setRefreshing(false);
}
@Override
public void addRepos(List<Repo> repos) {
adapter.addRepos(repos);
adapter.notifyDataSetChanged();
swipeRefreshLayout.setRefreshing(false);
}
}
| [
"[email protected]"
]
| |
1867c010a2398730b8405068df512f11ff2bab3a | 95695e471ccf7f38f1d8c491ccd71d2711da892e | /javaDemo/Area.java | fdfde8b165b6a240f88630240d2afae5136195bd | []
| no_license | ietuday/Java-Comlete-refrenence | 6ffb01f6f1fd0cf89ffb211f0b4299779452764d | f5ed93aad2e6dcdc09d740264a6ca79afcb8d133 | refs/heads/master | 2020-09-22T22:53:53.179196 | 2019-12-11T06:18:12 | 2019-12-11T06:18:12 | 225,338,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package javaDemo;
class Area {
public static void main(final String[] args) {
double pi, r, a;
r = 10.8;
pi = 3.1416;
a = pi * r * r;
System.out.println("Area of the cirlcle " + a);
}
} | [
"[email protected]"
]
| |
f123b971b85efe70af52e6271dd6cac16f31d4df | 80ec9d4d612d17165288a37380ac01713c320de1 | /dist/game/data/scripts/ai/group_template/MinionSpawnManager.java | 9253fb258490e8c95423dee8c20b8141fdbe035f | []
| no_license | 3mRe/L2Java | ee1da61493d0d4655db38f4a72188e38c3bf1918 | 37352a7a77d3a7db0b3f34df869a6d0d81d5bd5b | refs/heads/master | 2016-09-01T16:16:53.608939 | 2015-10-17T08:06:55 | 2015-10-17T08:06:55 | 44,469,265 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 16,982 | java | /*
* Copyright (C) 2004-2015 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J DataPack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ai.group_template;
import java.util.HashSet;
import java.util.Set;
import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.enums.ChatType;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.holders.MinionHolder;
import com.l2jserver.gameserver.network.NpcStringId;
/**
* Minion Spawn Manager.
* @author Zealar
*/
public final class MinionSpawnManager extends AbstractNpcAI
{
private static final Set<Integer> NPC = new HashSet<>(354);
static
{
NPC.add(18344); // Ancient Egg
NPC.add(18352); // Kamael Guard
NPC.add(18353); // Guardian of Records
NPC.add(18354); // Guardian of Observation
NPC.add(18355); // Spicula's Guard
NPC.add(18356); // Harkilgamed's Gatekeeper
NPC.add(18357); // Rodenpicula's Gatekeeper
NPC.add(18359); // Arviterre's Guardian
NPC.add(18360); // Katenar's Gatekeeper
NPC.add(18361); // Guardian of Prediction
NPC.add(18484); // Naia Failan
NPC.add(18491); // Lock
NPC.add(18547); // Ancient Experiment
NPC.add(18551); // Cruma Phantom
NPC.add(35375); // Bloody Lord Nurka
NPC.add(20376); // Varikan Brigand Leader
NPC.add(20398); // Vrykolakas
NPC.add(20520); // Pirate Captain Uthanka
NPC.add(20522); // White Fang
NPC.add(20738); // Kobold Looter Bepook
NPC.add(20745); // Gigantiops
NPC.add(20747); // Roxide
NPC.add(20749); // Death Fire
NPC.add(20751); // Snipe
NPC.add(20753); // Dark Lord
NPC.add(20755); // Talakin
NPC.add(20758); // Dragon Bearer Chief
NPC.add(20761); // Pytan
NPC.add(20767); // Timak Orc Troop Leader
NPC.add(20773); // Conjurer Bat Lord
NPC.add(20939); // Tanor Silenos Warrior
NPC.add(20941); // Tanor Silenos Chieftain
NPC.add(20944); // Nightmare Lord
NPC.add(20956); // Past Knight
NPC.add(20959); // Dark Guard
NPC.add(20963); // Bloody Lord
NPC.add(20974); // Spiteful Soul Leader
NPC.add(20977); // Elmoradan's Lady
NPC.add(20980); // Hallate's Follower Mul
NPC.add(20983); // Binder
NPC.add(20986); // Sairon
NPC.add(20991); // Swamp Tribe
NPC.add(20994); // Garden Guard Leader
NPC.add(21075); // Slaughter Bathin
NPC.add(21078); // Magus Valac
NPC.add(21081); // Power Angel Amon
NPC.add(21090); // Bloody Guardian
NPC.add(21312); // Eye of Ruler
NPC.add(21343); // Ketra Commander
NPC.add(21345); // Ketra's Head Shaman
NPC.add(21347); // Ketra Prophet
NPC.add(21369); // Varka's Commander
NPC.add(21371); // Varka's Head Magus
NPC.add(21373); // Varka's Prophet
NPC.add(21432); // Chakram Beetle
NPC.add(21434); // Seer of Blood
NPC.add(21512); // Splinter Stakato Drone
NPC.add(21517); // Needle Stakato Drone
NPC.add(21541); // Pilgrim of Splendor
NPC.add(21544); // Judge of Splendor
NPC.add(21596); // Requiem Lord
NPC.add(21599); // Requiem Priest
NPC.add(21652); // Scarlet Stakato Noble
NPC.add(21653); // Assassin Beetle
NPC.add(21654); // Necromancer of Destruction
NPC.add(21655); // Arimanes of Destruction
NPC.add(21656); // Ashuras of Destruction
NPC.add(21657); // Magma Drake
NPC.add(22028); // Vagabond of the Ruins
NPC.add(22080); // Massive Lost Bandersnatch
NPC.add(22084); // Panthera
NPC.add(22092); // Frost Iron Golem
NPC.add(22096); // Ursus
NPC.add(22100); // Freya's Gardener
NPC.add(22102); // Freya's Servant
NPC.add(22104); // Freya's Dog
NPC.add(22155); // Triol's High Priest
NPC.add(22159); // Triol's High Priest
NPC.add(22163); // Triol's High Priest
NPC.add(22167); // Triol's High Priest
NPC.add(22171); // Triol's High Priest
NPC.add(22188); // Andreas' Captain of the Royal Guard
NPC.add(22196); // Velociraptor
NPC.add(22198); // Velociraptor
NPC.add(22202); // Ornithomimus
NPC.add(22205); // Deinonychus
NPC.add(22210); // Pachycephalosaurus
NPC.add(22213); // Wild Strider
NPC.add(22223); // Velociraptor
NPC.add(22224); // Ornithomimus
NPC.add(22225); // Deinonychus
NPC.add(22275); // Gatekeeper Lohan
NPC.add(22277); // Gatekeeper Provo
NPC.add(22305); // Kechi's Captain
NPC.add(22306); // Kechi's Captain
NPC.add(22307); // Kechi's Captain
NPC.add(22320); // Junior Watchman
NPC.add(22321); // Junior Summoner
NPC.add(22346); // Quarry Foreman
NPC.add(22363); // Body Destroyer
NPC.add(22370); // Passageway Captain
NPC.add(22377); // Master Zelos
NPC.add(22390); // Foundry Foreman
NPC.add(22416); // Kechi's Captain
NPC.add(22423); // Original Sin Warden
NPC.add(22431); // Original Sin Warden
NPC.add(22448); // Leodas
NPC.add(22449); // Amaskari
NPC.add(22621); // Male Spiked Stakato
NPC.add(22625); // Cannibalistic Stakato Leader
NPC.add(22630); // Spiked Stakato Nurse
NPC.add(22666); // Barif
NPC.add(22670); // Cursed Lord
NPC.add(22742); // Ornithomimus
NPC.add(22743); // Deinonychus
NPC.add(25001); // Greyclaw Kutus
NPC.add(25004); // Turek Mercenary Captain
NPC.add(25007); // Retreat Spider Cletu
NPC.add(25010); // Furious Thieles
NPC.add(25013); // Ghost of Peasant Leader
NPC.add(25016); // The 3rd Underwater Guardian
NPC.add(25020); // Breka Warlock Pastu
NPC.add(25023); // Stakato Queen Zyrnna
NPC.add(25026); // Ketra Commander Atis
NPC.add(25029); // Atraiban
NPC.add(25032); // Eva's Guardian Millenu
NPC.add(25035); // Shilen's Messenger Cabrio
NPC.add(25038); // Tirak
NPC.add(25041); // Remmel
NPC.add(25044); // Barion
NPC.add(25047); // Karte
NPC.add(25051); // Rahha
NPC.add(25054); // Kernon
NPC.add(25057); // Beacon of Blue Sky
NPC.add(25060); // Unrequited Kael
NPC.add(25064); // Wizard of Storm Teruk
NPC.add(25067); // Captain of Red Flag Shaka
NPC.add(25070); // Enchanted Forest Watcher Ruell
NPC.add(25073); // Bloody Priest Rudelto
NPC.add(25076); // Princess Molrang
NPC.add(25079); // Cat's Eye Bandit
NPC.add(25082); // Leader of Cat Gang
NPC.add(25085); // Timak Orc Chief Ranger
NPC.add(25089); // Soulless Wild Boar
NPC.add(25092); // Korim
NPC.add(25095); // Elf Renoa
NPC.add(25099); // Rotting Tree Repiro
NPC.add(25103); // Sorcerer Isirr
NPC.add(25106); // Ghost of the Well Lidia
NPC.add(25109); // Antharas Priest Cloe
NPC.add(25112); // Beleth's Agent, Meana
NPC.add(25115); // Icarus Sample 1
NPC.add(25119); // Messenger of Fairy Queen Berun
NPC.add(25122); // Refugee Applicant Leo
NPC.add(25128); // Vuku Grand Seer Gharmash
NPC.add(25131); // Carnage Lord Gato
NPC.add(25134); // Leto Chief Talkin
NPC.add(25137); // Beleth's Seer, Sephia
NPC.add(25140); // Hekaton Prime
NPC.add(25143); // Fire of Wrath Shuriel
NPC.add(25146); // Serpent Demon Bifrons
NPC.add(25149); // Zombie Lord Crowl
NPC.add(25152); // Flame Lord Shadar
NPC.add(25155); // Shaman King Selu
NPC.add(25159); // Paniel the Unicorn
NPC.add(25166); // Ikuntai
NPC.add(25170); // Lizardmen Leader Hellion
NPC.add(25173); // Tiger King Karuta
NPC.add(25176); // Black Lily
NPC.add(25179); // Guardian of the Statue of Giant Karum
NPC.add(25182); // Demon Kuri
NPC.add(25185); // Tasaba Patriarch Hellena
NPC.add(25189); // Cronos's Servitor Mumu
NPC.add(25192); // Earth Protector Panathen
NPC.add(25199); // Water Dragon Seer Sheshark
NPC.add(25202); // Krokian Padisha Sobekk
NPC.add(25205); // Ocean Flame Ashakiel
NPC.add(25208); // Water Couatle Ateka
NPC.add(25211); // Sebek
NPC.add(25214); // Fafurion's Page Sika
NPC.add(25217); // Cursed Clara
NPC.add(25220); // Death Lord Hallate
NPC.add(25223); // Soul Collector Acheron
NPC.add(25226); // Roaring Lord Kastor
NPC.add(25230); // Timak Seer Ragoth
NPC.add(25235); // Vanor Chief Kandra
NPC.add(25238); // Abyss Brukunt
NPC.add(25241); // Harit Hero Tamash
NPC.add(25245); // Last Lesser Giant Glaki
NPC.add(25249); // Menacing Palatanos
NPC.add(25252); // Palibati Queen Themis
NPC.add(25256); // Taik High Prefect Arak
NPC.add(25260); // Iron Giant Totem
NPC.add(25263); // Kernon's Faithful Servant Kelone
NPC.add(25266); // Bloody Empress Decarbia
NPC.add(25269); // Beast Lord Behemoth
NPC.add(25273); // Carnamakos
NPC.add(25277); // Lilith's Witch Marilion
NPC.add(25283); // Lilith
NPC.add(25286); // Anakim
NPC.add(25290); // Daimon the White-Eyed
NPC.add(25293); // Hesti Guardian Deity of the Hot Springs
NPC.add(25296); // Icicle Emperor Bumbalump
NPC.add(25299); // Ketra's Hero Hekaton
NPC.add(25302); // Ketra's Commander Tayr
NPC.add(25306); // Soul of Fire Nastron
NPC.add(25309); // Varka's Hero Shadith
NPC.add(25312); // Varka's Commander Mos
NPC.add(25316); // Soul of Water Ashutar
NPC.add(25319); // Ember
NPC.add(25322); // Demon's Agent Falston
NPC.add(25325); // Flame of Splendor Barakiel
NPC.add(25328); // Eilhalder von Hellmann
NPC.add(25352); // Giant Wasteland Basilisk
NPC.add(25354); // Gargoyle Lord Sirocco
NPC.add(25357); // Sukar Wererat Chief
NPC.add(25360); // Tiger Hornet
NPC.add(25362); // Tracker Leader Sharuk
NPC.add(25366); // Kuroboros' Priest
NPC.add(25369); // Soul Scavenger
NPC.add(25373); // Malex Herald of Dagoniel
NPC.add(25375); // Zombie Lord Ferkel
NPC.add(25378); // Madness Beast
NPC.add(25380); // Kaysha Herald of Icarus
NPC.add(25383); // Revenant of Sir Calibus
NPC.add(25385); // Evil Spirit Tempest
NPC.add(25388); // Red Eye Captain Trakia
NPC.add(25392); // Captain of Queen's Royal Guards
NPC.add(25395); // Archon Suscepter
NPC.add(25398); // Beleth's Eye
NPC.add(25401); // Skyla
NPC.add(25404); // Corsair Captain Kylon
NPC.add(25407); // Lord Ishka
NPC.add(25410); // Road Scavenger Leader
NPC.add(25412); // Necrosentinel Royal Guard
NPC.add(25415); // Nakondas
NPC.add(25418); // Dread Avenger Kraven
NPC.add(25420); // Orfen's Handmaiden
NPC.add(25423); // Fairy Queen Timiniel
NPC.add(25426); // Betrayer of Urutu Freki
NPC.add(25429); // Mammon Collector Talos
NPC.add(25431); // Flamestone Golem
NPC.add(25434); // Bandit Leader Barda
NPC.add(25438); // Thief Kelbar
NPC.add(25441); // Evil Spirit Cyrion
NPC.add(25444); // Enmity Ghost Ramdal
NPC.add(25447); // Immortal Savior Mardil
NPC.add(25450); // Cherub Galaxia
NPC.add(25453); // Meanas Anor
NPC.add(25456); // Mirror of Oblivion
NPC.add(25460); // Deadman Ereve
NPC.add(25463); // Harit Guardian Garangky
NPC.add(25467); // Gorgolos
NPC.add(25470); // Last Titan Utenus
NPC.add(25473); // Grave Robber Kim
NPC.add(25475); // Ghost Knight Kabed
NPC.add(25478); // Shilen's Priest Hisilrome
NPC.add(25481); // Magus Kenishee
NPC.add(25484); // Zaken's Chief Mate Tillion
NPC.add(25487); // Water Spirit Lian
NPC.add(25490); // Gwindorr
NPC.add(25493); // Eva's Spirit Niniel
NPC.add(25496); // Fafurion's Envoy Pingolpin
NPC.add(25498); // Fafurion's Henchman Istary
NPC.add(25501); // Boss Akata
NPC.add(25504); // Nellis' Vengeful Spirit
NPC.add(25506); // Rayito the Looter
NPC.add(25509); // Dark Shaman Varangka
NPC.add(25514); // Queen Shyeed
NPC.add(25524); // Flamestone Giant
NPC.add(25528); // Tiberias
NPC.add(25536); // Hannibal
NPC.add(25546); // Rhianna the Traitor
NPC.add(25549); // Tesla the Deceiver
NPC.add(25554); // Brutus the Obstinate
NPC.add(25557); // Ranger Karankawa
NPC.add(25560); // Sargon the Mad
NPC.add(25563); // Beautiful Atrielle
NPC.add(25566); // Nagen the Tomboy
NPC.add(25569); // Jax the Destroyer
NPC.add(25572); // Hager the Outlaw
NPC.add(25575); // All-Seeing Rango
NPC.add(25579); // Helsing
NPC.add(25582); // Gillien
NPC.add(25585); // Medici
NPC.add(25589); // Brand the Exile
NPC.add(25593); // Gerg the Hunter
NPC.add(25600); // Temenir
NPC.add(25601); // Draksius
NPC.add(25602); // Kiretcenah
NPC.add(25671); // Queen Shyeed
NPC.add(25674); // Gwindorr
NPC.add(25677); // Water Spirit Lian
NPC.add(25681); // Gorgolos
NPC.add(25684); // Last Titan Utenus
NPC.add(25687); // Hekaton Prime
NPC.add(25703); // Gigantic Golem
NPC.add(25710); // Lost Captain
NPC.add(25735); // Greyclaw Kutus
NPC.add(25738); // Lead Tracker Sharuk
NPC.add(25741); // Sukar Wererat Chief
NPC.add(25744); // Ikuntai
NPC.add(25747); // Zombie Lord Crowl
NPC.add(25750); // Zombie Lord Ferkel
NPC.add(25754); // Fire Lord Shadar
NPC.add(25757); // Soul Collector Acheron
NPC.add(25760); // Lord Ishka
NPC.add(25763); // Demon Kuri
NPC.add(25767); // Carnage Lord Gato
NPC.add(25770); // Ketra Commander Atis
NPC.add(25773); // Beacon of Blue Sky
NPC.add(25776); // Earth Protector Panathen
NPC.add(25779); // Betrayer of Urutu Freki
NPC.add(25782); // Nellis' Vengeful Spirit
NPC.add(25784); // Rayito the Looter
NPC.add(25787); // Ketra's Hero Hekaton
NPC.add(25790); // Varka's Hero Shadith
NPC.add(25794); // Kernon
NPC.add(25797); // Meanas Anor
NPC.add(25800); // Mammon Collector Talos
NPC.add(27036); // Calpico
NPC.add(27041); // Varangka's Messenger
NPC.add(27062); // Tanukia
NPC.add(27065); // Roko
NPC.add(27068); // Murtika
NPC.add(27093); // Delu Chief Kalkis
NPC.add(27108); // Stenoa Gorgon Queen
NPC.add(27110); // Shyslassys
NPC.add(27112); // Gorr
NPC.add(27113); // Baraham
NPC.add(27114); // Succubus Queen
NPC.add(27185); // Fairy Tree of Wind
NPC.add(27186); // Fairy Tree of Star
NPC.add(27187); // Fairy Tree of Twilight
NPC.add(27188); // Fairy Tree of Abyss
NPC.add(27259); // Archangel Iconoclasis
NPC.add(27260); // Archangel Iconoclasis
NPC.add(27266); // Fallen Angel Haures
NPC.add(27267); // Fallen Angel Haures
NPC.add(27290); // White Wing Commander
NPC.add(29001); // Queen Ant
NPC.add(29030); // Fenril Hound Kerinne
NPC.add(29033); // Fenril Hound Freki
NPC.add(29037); // Fenril Hound Kinaz
NPC.add(29040); // Wings of Flame, Ixion
NPC.add(29056); // Ice Fairy Sirra
NPC.add(29062); // Andreas Van Halter
NPC.add(29096); // Anais
NPC.add(29129); // Lost Captain
NPC.add(29132); // Lost Captain
NPC.add(29135); // Lost Captain
NPC.add(29138); // Lost Captain
NPC.add(29141); // Lost Captain
NPC.add(29144); // Lost Captain
NPC.add(29147); // Lost Captain
}
private static final NpcStringId[] ON_ATTACK_MSG =
{
NpcStringId.COME_OUT_YOU_CHILDREN_OF_DARKNESS,
NpcStringId.SHOW_YOURSELVES,
NpcStringId.DESTROY_THE_ENEMY_MY_BROTHERS,
NpcStringId.FORCES_OF_DARKNESS_FOLLOW_ME
};
private static final int[] ON_ATTACK_NPC =
{
20767, // Timak Orc Troop Leader
};
private MinionSpawnManager()
{
super(MinionSpawnManager.class.getSimpleName(), "ai/group_template");
addSpawnId(NPC);
addAttackId(ON_ATTACK_NPC);
}
@Override
public String onSpawn(L2Npc npc)
{
if (npc.getTemplate().getParameters().getSet().get("SummonPrivateRate") == null)
{
((L2MonsterInstance) npc).getMinionList().spawnMinions(npc.getTemplate().getParameters().getMinionList("Privates"));
}
return super.onSpawn(npc);
}
@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
{
if (npc.isMonster())
{
final L2MonsterInstance monster = (L2MonsterInstance) npc;
if (!monster.isTeleporting())
{
if (getRandom(1, 100) <= npc.getTemplate().getParameters().getInt("SummonPrivateRate", 0))
{
for (MinionHolder is : npc.getTemplate().getParameters().getMinionList("Privates"))
{
addMinion((L2MonsterInstance) npc, is.getId());
}
broadcastNpcSay(npc, ChatType.NPC_GENERAL, ON_ATTACK_MSG[getRandom(ON_ATTACK_MSG.length)]);
}
}
}
return super.onAttack(npc, attacker, damage, isSummon);
}
public static void main(String[] args)
{
new MinionSpawnManager();
}
} | [
"[email protected]"
]
| |
f40af776b9296418c3dbcc7329e175ca8f7ff69a | dd32df45e1c92a3a764bd6de53942679bddcec7e | /taotao-search/taotao-search-service/src/main/java/com/taotao/search/listener/ItemChangeListener.java | 8aa2455af014f27049a1bf65f6a2bdfd4c082ecf | []
| no_license | leo-fanglei/taotao | 30bcedd16d2a485ac775d347923e504b9c22d802 | 2b717a522a52b771507e1ee30b0b7b593d751917 | refs/heads/master | 2020-04-22T21:39:16.679797 | 2019-02-27T08:20:41 | 2019-02-27T08:20:41 | 170,555,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 900 | java | package com.taotao.search.listener;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import org.springframework.beans.factory.annotation.Autowired;
import com.taotao.search.service.SearchItemService;
/**
* 同步索引库Listener
* @author 10309
*
*/
public class ItemChangeListener implements MessageListener{
@Autowired
private SearchItemService searchItemService;
@Override
public void onMessage(Message message) {
try {
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
//取消息内容
String text = textMessage.getText();
long itemId = Long.parseLong(text);
Thread.sleep(500);
searchItemService.importItem2IndexById(itemId);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
3f90fbbd82f26e8bd60ab1971b9689d18051e8f1 | bb2efb86a1f34c41d0a003530105d280f27d4643 | /Task15.2/src/com/company/business/service/FileService.java | 46fcdff4762731aa57f420ed6ea1dba8be85f8d1 | []
| no_license | KateVer/XSD-schema | 543d189317a7e91f5116e680b6883264e329ab7a | 8e41cae9833e74b39a41ad8499d87e0d60aebccb | refs/heads/master | 2021-01-17T12:47:48.369118 | 2016-07-07T16:25:14 | 2016-07-07T16:25:14 | 59,213,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,550 | java | package com.company.business.service;
import com.company.business.engine.MultOperation;
import com.company.business.engine.Operation;
import com.company.business.engine.SumOperation;
import com.company.business.engine.SumPowOperation;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.LogManager;
import java.util.logging.Logger;
/**
* Created by kateverbitskaya on 06.07.16.
*/
public class FileService {
public String read(String fileName) {
try (FileInputStream inFile = new FileInputStream(fileName)) {
byte[] str;
str = new byte[inFile.available()];
inFile.read(str);
return new String(str);
} catch (IOException ex) {
System.out.println("Error" + ex);
return null;
}
}
public Operation getOperation(String file) {
Operation operation = null;
int newLine = file.indexOf("\n");
if (newLine > 0) {
String operationNumber = file.substring(0, newLine).trim();
int operationCase = Integer.parseInt(operationNumber);
switch (operationCase) {
case 1: {
operation = new SumOperation();
}
break;
case 2: {
operation = new MultOperation();
}
break;
case 3: {
operation = new SumPowOperation();
}
break;
}
return operation;
} else {
System.out.println("Can't find input command");
return null;
}
}
public Float[] getArray(String str) {
int newLine = str.indexOf("\n");
if (newLine > 0) {
str = str.substring(newLine).trim();
float [] array;
List<Float> temps = new ArrayList<Float>();
if (!str.isEmpty()) {
String[] tabOfFloatString = str.split(" ");
for(String s : tabOfFloatString){
float res = Float.parseFloat(s);
temps.add(res);
}
return temps.toArray(new Float[0]);
} else {
System.out.println("Can't find input array");
return null;
}
} else {
System.out.println("Can't find input array");
return null;
}
}
}
| [
"[email protected]"
]
| |
2d7251bbe735b9721da0e2dc9fe9c8bd26a1a99f | 04e866814a39bff23752a1f733ba4d8515bea108 | /jspExam/src/main/java/com/entity/Film.java | 10698ba7478f1efa60c53acb9e6cae75e04ac362 | []
| no_license | castell9000/JspExam | 1f2ea38f774d9554103d95c99e24bdd44319ccf8 | 06346b6d89c5d74b6dc374f171ea6a4bbd4d4ca7 | refs/heads/master | 2021-06-01T05:53:55.664895 | 2016-08-08T03:41:03 | 2016-08-08T03:41:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package com.entity;
public class Film {
private int film_id;
private String title;
private String description;
private String languageName;
private int language_id;
public int getFilm_id() {
return film_id;
}
public void setFilm_id(int film_id) {
this.film_id = film_id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getLanguageName() {
return languageName;
}
public void setLanguageName(String languageName) {
this.languageName = languageName;
}
public int getLanguage_id() {
return language_id;
}
public void setLanguage_id(int language_id) {
this.language_id = language_id;
}
}
| [
"[email protected]"
]
| |
f004fe3a3387dfd4d15ca6a70f67c906cfbd649e | 8bced46a7248278415b9c061d6c9cdb119af9a99 | /src/main/java/accommodation/DeliveryRequested.java | 6d81fc64e09a9a741d593285cee1eb134f9b2d8a | []
| no_license | kosmocor/Delivery | 18cb54f0ec0e51ede6ddb8195cd657c2330fff9f | 3fbec3df44744ffc10ebc5cfa8b1780b787c26e1 | refs/heads/main | 2023-01-02T02:08:45.842055 | 2020-10-29T05:57:28 | 2020-10-29T05:57:28 | 307,999,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,868 | java | package accommodation;
// 배송 요청 수신 -> Reservation에서, ReqRes로 요청 수신 -> 저장 전, Notice 로 보냄.
public class DeliveryRequested extends AbstractEvent {
private Integer deliveryNumber;
private String deliveryStatus;
// 예약 정보
private Integer reservationNumber;
// 고객 정보
private Integer customerId;
private String customerName;
private String customerAddress;
private String customerContract;
public DeliveryRequested(){
super();
}
public Integer getDeliveryNumber() {
return deliveryNumber;
}
public void setDeliveryNumber(Integer deliveryNumber) {
this.deliveryNumber = deliveryNumber;
}
public String getDeliveryStatus() {
return deliveryStatus;
}
public void setDeliveryStatus(String deliveryStatus) {
this.deliveryStatus = deliveryStatus;
}
public Integer getReservationNumber() {
return reservationNumber;
}
public void setReservationNumber(Integer reservationNumber) {
this.reservationNumber = reservationNumber;
}
public Integer getCustomerId() {
return customerId;
}
public void setCustomerId(Integer customerId) {
this.customerId = customerId;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getCustomerAddress() {
return customerAddress;
}
public void setCustomerAddress(String customerAddress) {
this.customerAddress = customerAddress;
}
public String getCustomerContract() {
return customerContract;
}
public void setCustomerContract(String customerContract) {
this.customerContract = customerContract;
}
}
| [
"[email protected]"
]
| |
2c2648cf4a5757d7a017654a4c574dc78ab46714 | d43f1a83f6ddc766dafdb79d5842a95d3e10c9dd | /src/main/java/com/xtsoft/kernel/sys/service/MenuEntityServiceUtil.java | 2e5d7683fcf6112939d3bcc37f5ac544621ef775 | []
| no_license | xietf1983/gweb | 3299283433c728481e113e3bdef622b50b00c161 | ed1306dfd0a5c6b1178c3cfaefbc4155fb57fcbb | refs/heads/master | 2022-12-22T06:24:13.292535 | 2020-01-07T09:00:39 | 2020-01-07T09:00:39 | 205,958,703 | 0 | 0 | null | 2022-12-16T05:05:28 | 2019-09-03T00:45:23 | CSS | UTF-8 | Java | false | false | 660 | java | package com.xtsoft.kernel.sys.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xtsoft.kernel.sys.service.impl.MenuEntityServiceImpl;
@Service(value = "menuEntityServiceUtil")
public class MenuEntityServiceUtil {
private static MenuEntityServiceImpl _service;
public static MenuEntityServiceImpl getService() {
return _service;
}
@Autowired
public void setService(MenuEntityServiceImpl service) {
_service = service;
}
private Logger logger = LoggerFactory.getLogger(getClass());
}
| [
"[email protected]"
]
| |
7d48a79d7e6a41e43ce7a49e3860e2edd878bd92 | 7ba75d88c4c5413689800fddb4567977578aa2d1 | /canon-parser/src/main/java/org/symphonyoss/s2/canon/parser/error/CodeGenerationAbortedInfo.java | 0fbd127604e50011a8f0214f02af170db11200f8 | [
"Apache-2.0",
"GPL-2.0-only",
"CDDL-1.0",
"MPL-2.0",
"EPL-1.0",
"Classpath-exception-2.0",
"LGPL-2.0-or-later"
]
| permissive | symphonyoss/canon | 753a68c84d7e30f63989e092815306e5b0b439cb | 33af47f893047702e251a6bba8a062e61c221ae2 | refs/heads/master | 2021-07-19T09:25:02.901819 | 2020-05-01T05:55:21 | 2020-05-01T05:55:21 | 120,740,524 | 2 | 4 | Apache-2.0 | 2021-06-07T16:29:18 | 2018-02-08T09:33:45 | Java | UTF-8 | Java | false | false | 1,103 | java | /*
*
*
* Copyright 2017 Symphony Communication Services, LLC.
*
* Licensed to The Symphony Software Foundation (SSF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The SSF 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 org.symphonyoss.s2.canon.parser.error;
public class CodeGenerationAbortedInfo extends ParserInfo
{
public CodeGenerationAbortedInfo()
{
super("Code generation aborted due to model validation errors");
}
}
| [
"[email protected]"
]
| |
1c389c82cc6bda0e839558de403742e9cae8a2ff | 2122d24de66635b64ec2b46a7c3f6f664297edc4 | /spring/spring-mvc/spring-mvc-java-config-example/src/main/java/com/memorynotfound/config/ServletInitializer.java | 3df6f71b1da783cf95488567169e4f818fdec95e | []
| no_license | yiminyangguang520/Java-Learning | 8cfecc1b226ca905c4ee791300e9b025db40cc6a | 87ec6c09228f8ad3d154c96bd2a9e65c80fc4b25 | refs/heads/master | 2023-01-10T09:56:29.568765 | 2022-08-29T05:56:27 | 2022-08-29T05:56:27 | 92,575,777 | 5 | 1 | null | 2023-01-05T05:21:02 | 2017-05-27T06:16:40 | Java | UTF-8 | Java | false | false | 541 | java | package com.memorynotfound.config;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
/**
* @author min
*/
public class ServletInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[]{WebConfig.class};
}
@Override
protected String[] getServletMappings() {
return new String[]{"/"};
}
@Override
protected Class<?>[] getRootConfigClasses() {
return null;
}
}
| [
"[email protected]"
]
| |
b1b7015811c10a4b56ca0d7c327db6a0af7f387e | c1b1251ebd2a3490ab1a2fec7ba64a5d6618a768 | /src/main/java/edu/utm/service/cliente/ClienteServiceImpl.java | c934bf9fb336355ebc551d125b68b6ed6e17f378 | []
| no_license | hsantiagocruz/Equipo2Servicios | aecfdcb08caa73f010957d16e20bd7e0700a831d | 1466f11e7c696522e5b82796bda0d75454b606f7 | refs/heads/master | 2020-03-17T08:12:53.511765 | 2018-05-14T22:40:17 | 2018-05-14T22:40:17 | 133,429,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package edu.utm.service.cliente;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import edu.utm.bd.domain.Cliente;
import edu.utm.dao.cliente.ClienteDao;
@Named
public class ClienteServiceImpl implements ClienteService{
@Inject
ClienteDao clienteDao;
@Override
public List<Cliente> findAllClientes() {
return clienteDao.findAllClientes();
}
@Override
public void updateCliente(Cliente cliente) {
}
}
| [
"[email protected]"
]
| |
c6669cea2eb817e026d79c1c8f98016e43c7b692 | ace94d3b9a174378420bc612075c484f97b86365 | /core/src/com/workasintended/chromaggus/unitcomponent/CityComponent.java | 2f78f08d887be8e54692aa073ef4d486fe378c48 | []
| no_license | mazimeng/chromaggus-new | a5f9b46c59400b10b7926f79276d858544968345 | eafce24c613829f2f463d95a5f4e488cc6b6f33e | refs/heads/master | 2020-12-29T02:36:01.751179 | 2017-03-28T13:43:28 | 2017-03-28T13:43:28 | 49,648,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,411 | java | package com.workasintended.chromaggus.unitcomponent;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.utils.Align;
import com.workasintended.chromaggus.*;
import com.workasintended.chromaggus.event.GainGoldEvent;
import java.util.HashSet;
import java.util.Set;
public class CityComponent extends UnitComponent {
private float radius = 64;
private BitmapFont font;
private float development = 0;
private float incomeInterval = 3;
private float progress = 0;
private float restoreCooldown = 3;
private float restore = 0;
private CityArmory armory;
private float restoreRate = 0.2f;
private float restoreRadius2 = 64f * 64f;
private float seizeRadius2 = 64f * 64f;
private float seizeTime = 5f; //5 secs
private float seizeCount = 0f;
private Set<Faction> factionSet = new HashSet<>();
public CityComponent(Unit self) {
super(self);
}
// public CityComponent(WorldStage stage, Unit unit, BitmapFont font) {
// this.unit = unit;
// //this.gold = new Attribute<Float>(0f, 100f);
// this.font = font;
// this.stage = stage;
// }
public String printFaction() {
return String.format("cityFaction: #%s, %s/%s", getSelf().getFaction().getValue(), seizeCount, seizeTime);
}
public void update(float delta) {
restore += delta;
tax(delta);
for (Actor actor : getSelf().getWorld().getActors()) {
if (actor == getSelf()) continue;
if (!(actor instanceof Unit)) continue;
Unit unit = (Unit) actor;
restore(delta, unit);
faction(unit);
}
computeFaction(delta);
if (restore >= restoreCooldown) {
restore = 0;
}
}
public void draw(Batch batch) {
// if(font!=null) font.draw(batch, String.format("%.1f/%.1f"
// , this.gold.getValue(), this.gold.getMax())
// , this.unit.getX(), this.unit.getY());
}
private void tax(float delta) {
progress += delta;
if (progress > incomeInterval) {
progress = 0;
float gold = development;
Service.eventQueue().enqueue(new GainGoldEvent(getSelf(), gold));
}
}
private void restore(float delta, Unit unit) {
if (!unit.getFaction().isFriend(getSelf().getFaction())) return;
if (unit.city != null) return;
if (unit.combat == null) return;
if (unit.combat.getHp() == unit.combat.getMaxHp()) return;
if (unit.dead()) return;
if (Vector2.dst2(unit.getX(Align.center), unit.getY(Align.center),
getSelf().getX(Align.center), getSelf().getY(Align.center)) > restoreRadius2) return;
if (restore < restoreCooldown) return;
unit.combat.setHp((int) (unit.combat.getHp() * (restoreRate + 1f)));
}
private void faction(Unit unit) {
if (Vector2.dst2(unit.getX(Align.center), unit.getY(Align.center),
getSelf().getX(Align.center), getSelf().getY(Align.center)) > seizeRadius2) return;
if (unit.dead()) return;
factionSet.add(unit.getFaction());
}
private void computeFaction(float delta) {
if (factionSet.size() == 1) {
Faction faction = factionSet.iterator().next();
if (faction != getSelf().getFaction()) {
seizeCount += delta;
if (seizeCount >= seizeTime) {
System.out.println(String.format("faction changed: #%s->#%s", getSelf().getFaction().getValue(), faction.getValue()));
getSelf().setFaction(faction);
seizeCount = 0;
}
} else {
seizeCount = 0;
}
} else {
seizeCount = 0;
}
factionSet.clear();
}
public float getRadius() {
return radius;
}
public void setRadius(float radius) {
this.radius = radius;
}
public float getDevelopment() {
return development;
}
public void setDevelopment(float development) {
this.development = development;
}
public CityArmory getArmory() {
return armory;
}
public void setArmory(CityArmory armory) {
this.armory = armory;
}
}
| [
"[email protected]"
]
| |
253f2fd90ea81ecc05a794828ff235133b22f07a | 2ac177cf8cc4641f2859cce4838c22923687d021 | /src/main/java/cms121_playlist_generator/Server.java | d9117dcf33a8458f92dd15c4b11e6b8cebb6f72a | []
| no_license | dansmyers/Playlist-Generator | eed068e9ba5437781c4754a446b926dbbede0714 | 2b316c7d43ac16072f0931952ad33bb853f099f6 | refs/heads/main | 2023-04-15T15:11:09.364576 | 2021-04-20T14:36:16 | 2021-04-20T14:36:16 | 359,838,908 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package cms121_playlist_generator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Server {
public static void main(String[] args) {
SpringApplication.run(Server.class, args);
}
} | [
"[email protected]"
]
| |
61c788af2ce40356d5985afd91c18ab0c21d4e75 | bd93e8e0582ece746ab4b93581b123de94ca1b8f | /src/main/java/utils/EncryptUtils.java | cbaffc186d0709b78a231cf59d823ee0f60fb80d | []
| no_license | Awille/MusicBackground | 7f60211abf9c81e413c1a6886b106faef00fecfe | 16f3095a96b53ddfa9e7412e85a3a28477e90d49 | refs/heads/master | 2020-04-25T08:24:11.196640 | 2019-04-17T07:10:48 | 2019-04-17T07:10:48 | 172,645,999 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package utils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class EncryptUtils {
private static String key = "Awille";
public static String encryptByMd5 (String plainText) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte[] encryContext = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < encryContext.length; offset ++ ) {
i = encryContext[offset];
if (i < 0) {
i += 256;
}
if (i < 16) {
buf.append("0");
}
buf.append(Integer.toHexString(i));
}
return buf.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}
public static boolean verifyByMd5(String plainText, String encryptText) {
if (!TextUtils.isEmpty(plainText)) {
if (encryptText.equals(encryptByMd5(plainText))) {
return true;
}
}
return false;
}
}
| [
"[email protected]"
]
| |
2f6fa3f75252bae28221266c8bb4413069900d1a | af09331c4f701b6744e40e9642547be66917ac13 | /src/main/java/com/cheer/mybatis/dao/UserDaoImpl.java | d85b00837303004004ce6f972d36a0375940dc90 | []
| no_license | JianNan-Miao/mybatis-01 | 43b991ab2709488c15d4e1450c8dcdbb539301e2 | 3340162cabce666dbbc84f3f21c702ab0bcc2933 | refs/heads/master | 2022-07-12T22:02:55.903016 | 2019-06-03T13:22:12 | 2019-06-03T13:22:12 | 187,582,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,079 | java | package com.cheer.mybatis.dao;
import com.cheer.mybatis.po.User;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
public class UserDaoImpl implements UserDao {
private SqlSessionFactory sqlSessionFactory;
public UserDaoImpl(SqlSessionFactory sqlSessionFactory) {
this.sqlSessionFactory = sqlSessionFactory;
}
@Override
public User findUserById(int id) {
SqlSession sqlSession=sqlSessionFactory.openSession();
User user= sqlSession.selectOne("test.findUserById",id);
sqlSession.close();
return user;
}
@Override
public void insertUser(User user) {
SqlSession sqlSession=sqlSessionFactory.openSession();
sqlSession.insert("test.insertUser",user);
sqlSession.commit();
sqlSession.close();
}
@Override
public void deleteUser(int id) {
SqlSession sqlSession=sqlSessionFactory.openSession();
sqlSession.delete("test.deleteUser",id);
sqlSession.commit();
sqlSession.close();
}
}
| [
"88336261mjn"
]
| 88336261mjn |
1fa1cc9a91762a17672b578c6ace12ff9ce75a64 | c031e513370566b34ca624e93c9ce10af764c2b4 | /waffle-api-blog/src/test/java/com/waffle/api/blog/json/JsonFilterTest.java | a22f0ca321094963440f3873adc5bba21ca474b3 | [
"Apache-2.0"
]
| permissive | yuexine/waffle-platform | c0072dcbe66ea4a60fd7293b7bebcb0bc672c6c8 | 3fc35b8bcb6181ffdb8203dd4ec963a4bd3bb9d1 | refs/heads/master | 2020-03-10T00:12:45.532767 | 2018-09-04T10:09:19 | 2018-09-04T10:09:19 | 129,075,936 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.waffle.api.blog.json;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.waffle.api.blog.model.Post;
import org.junit.Test;
/**
* @author yuexin
* @since 1.0
*/
public class JsonFilterTest {
@Test
public void testFilter() throws JsonProcessingException {
Post post = new Post();
post.setAuthor("wuyuexin");
post.setKeywords("key");
ObjectMapper mapper = new ObjectMapper();
JacksonJsonFilter filter = new JacksonJsonFilter();
filter.filter(Post.class, "id", "author");
mapper.setFilterProvider(filter);
mapper.addMixIn(Post.class, filter.getClass());
System.out.println(mapper.writeValueAsString(post));
}
}
| [
"[email protected]"
]
| |
3c15546c8a78c4cadedbcfafae8b3f1838f11b49 | b269309711e03451a0b8414283c6a9fc8ad40f0e | /src/main/java/Objects/Facebook/Webhooks/SerializeWebhook.java | 19332541a69d1e4f8facbba4f565fe1fd3d3c83e | []
| no_license | mariusandreifilip/social | dc20a6592ba6bb8d82013fba53ce3cbaab1899f4 | 6ee4da012c099ad50e0decb6033ff0eaa3eded0f | refs/heads/master | 2021-06-12T20:12:04.287181 | 2019-07-10T21:52:54 | 2019-07-10T21:52:54 | 196,278,951 | 0 | 0 | null | 2021-06-07T18:30:25 | 2019-07-10T21:45:02 | Java | UTF-8 | Java | false | false | 21,221 | java | package Objects.Facebook.Webhooks;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class SerializeWebhook {
public static void main(String[] args) {
//generateSha1ForReviewPost();
//generateSha1ForReviewCommentsAndReplies();
//generateSha1ForMentionCommentsAndReplies();
//generateSha1ForMentionsTaggedEndpointPosts();
//generateSha1ForIGCommentWebhook();
//generateSha1MentionCommentsInvalidMessage();
//generateSha1MentionCommentsInvalidPostId();
//generateSha1generateSha1ForFBMessagesStandbyWebhookForInvalidIGCommentWebhook();
//generateSha1ForFBMessagesWebhook();
//generateSha1ForFBMessagesEchosWebhook();
generateSha1ForFBMessagesStandbyWebhook();
}
public static void generateSha1ForReviewPost() {
//Id of the user/page who was mentioned
String id = "1332698180228710";
String reviewer_id = "1071906252988189";
String reviewer_name = "Mihai Supertramp";
String comment_id = null;
String review_text = "Hi I'm Mihai and `i like you!";
String recommendation_type = "POSITIVE";
String open_graph_story_id = "1188840347961445";
String field = "ratings";
String time = "1553002709";
String created_time = "1553002706";
String webhookPayload = "{\"entry\": [{\"changes\": [{\"field\": \"" + field + "\",\"value\": {\"reviewer_id\": \"" + reviewer_id
+ "\",\"reviewer_name\": \"" + reviewer_name + "\",\"comment_id\": " + comment_id + ",\"review_text\": \"" + review_text
+ "\",\"recommendation_type\": \"" + recommendation_type + "\",\"item\": \"rating\",\"verb\": \"add\",\"created_time\": " + created_time
+ ",\"open_graph_story_id\": \"" + open_graph_story_id + "\"} } ],\"id\": \"" + id + "\",\"time\": " + time + "}],\"object\": \"page\"}";
// Compute the SHA1 for the post body for each of the staging environments. Select the one you wish to use
// from the test output.
System.out.println(webhookPayload + "\n\n");
Map<String, String> appKeys = new HashMap<>();
appKeys.put("FB review pots for Sha1 for QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("FB review pots for Sha1 for QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("FB review pots for Sha1 for STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()){
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
public static void generateSha1ForReviewCommentsAndReplies() {
//Id of the user/page who was reviewed
String id = "1332698180228710";
//The id of the post
String post_id = "204568073845716";
//Id of the user which has reviewed the page
String sender_id = "119131482389376";
//Name of the user which has created the review
String sender_name = "Peach MacDonald";
//Review message
String review_text = "salut sont eu, Picasso";
//parent post id
String parent_id = "204568073845716";
//The id of the open_graph_story_id
String open_graph_story_id = "204568073845716";
//The id of the comment
String comment_id = "204568073845716_204568240512366";
String time = "1551448718";
String created_time = "1551448716";
String webhookPayload = "{\"entry\": [{\"changes\": [{\"field\": \"ratings\",\"value\": {\"post_id\": \"" + post_id + "\",\"sender_name\": \"" + sender_name + "\",\"comment_id\": \"" + comment_id + "\",\"sender_id\": \"" + sender_id + "\",\"review_text\": \"" + review_text + "\",\"item\": \"comment\",\"verb\": \"add\",\"parent_id\": \"" + parent_id + "\",\"created_time\": " + created_time + ",\"open_graph_story_id\": \"" + open_graph_story_id + "\"} } ],\"id\": \"" + id + "\",\"time\": " + time + "}],\"object\": \"page\"}";
System.out.println(webhookPayload + "\n\n"); // Compute the SHA1 for the post body for each of the staging environments. Select the one you wish to use
// from the test output.
Map<String, String> appKeys = new HashMap<>();
appKeys.put("FB review comments and replies Sha1 for QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("FB review comments and replies Sha1 for QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("FB review comments and replies Sha1 for STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()){
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
public static void generateSha1ForMentionsTaggedEndpointPosts() {
//Id of the user/page who was mentioned
String id = "1332698180228710";
//Id of post in which it was mentioned
String post_id = "2128869687352614_2290200841219497";
//Post message
String message = "hello there Short Term Page!";
String field = "mention";
String time = "1547135242";
String created_time = String.valueOf((new Date().getTime())/1000);
String webhookPayload = "{\"entry\": [{\"changes\": [{\"field\": \"" + field + "\",\"value\": {\"created_time\": " + created_time + ",\"post_id\": \"" + post_id + "\",\"message\": \"" + message + "\",\"verb\": \"add\",\"item\": \"post\"} } ],\"id\": \"" + id + "\",\"time\": " + time + "}],\"object\": \"page\"}";
System.out.println("Post body: \n" + webhookPayload);
// Compute the SHA1 for the post body for each of the staging environments. Select the one you wish to use
// from the test output.
Map<String, String> appKeys = new HashMap<>();
appKeys.put("FB tagged endpoint mention post Sha1 for QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("FB tagged endpoint mention post Sha1 for QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("FB tagged endpoint mention post Sha1 for STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()){
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
public static void generateSha1ForMentionCommentsAndReplies() {
//Id of the user/page who was mentioned
String id = "434279690461902";
//Id of post in which the comment with the mention appears
String post_id = "2128869687352614_2290903647815883";
//Id of the comment in which it was mentioned
String comment_id = "2290903647815883_2290904207815827";
//Comment message
String message = "hello Adina's new temporary page I'm good. you?";
String field = "mention";
String time = "1547133454";
String created_time = String.valueOf((new Date().getTime())/1000);
String webhookPayload = "{\"entry\":[ {\"changes\":[{\"field\":\"" + field + "\", \"value\":{\"item\":\"comment\", \"comment_id\":\"" + comment_id + "\", \"post_id\":\"" + post_id + "\", \"verb\":\"add\", \"created_time\":"+ created_time + ", \"message\":\"" + message +"\"} }], \"id\":\"" + id + "\", \"time\":"+ time + "}], \"object\":\"page\"}";
System.out.println("Post body: \n" + webhookPayload);
// Compute the SHA1 for the post body for each of the staging environments. Select the one you wish to use
// from the test output.
Map<String, String> appKeys = new HashMap<>();
appKeys.put("FB mention comments and replies Sha1 for QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("FB mention comments and replies Sha1 for QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("FB mention comments and replies Sha1 for STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()){
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
public static void generateSha1ForIGCommentWebhook() {
//instagram_business_account id of the user who owns the post
String id = "17841408584919207";
//String id = "18070599157075838";
//String id = "1838049228";
//String id = "2060524463";
//Id of the comment/reply
String comment_id = "666688161919101";
//Comment/reply message
String message = "testing as v1 webhook";
String time = String.valueOf((new Date().getTime())/1000);
String webhookPayload = "{\"entry\":[{\"changes\":[{\"field\":\"comments\",\"value\":{\"text\":\"" + message + "\",\"id\":\"" + comment_id + "\"} }],\"id\":\"" + id + "\",\"time\":" + time + "}],\"object\":\"instagram\"}";
System.out.println("Post body: \n" + webhookPayload);
// Compute the SHA1 for the post body for each of the staging environments. Select the one you wish to use
// from the test output.
Map<String, String> appKeys = new HashMap<>();
appKeys.put("Webhook for IG comment QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("Webhook for IG comment QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("Webhook for IG comment STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()){
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
public static void generateSha1ForInvalidIGCommentWebhook() {
//instagram_business_account id of the user who owns the post
String id = "17841408584919207";
//Id of the comment/reply
String comment_id = "17850720196457699";
//Comment/reply message
String message = "engage now";
String time = String.valueOf((new Date().getTime())/1000);
String webhookPayload = "{\"entry\":[{\"changes\":[{\"field\":\"comments\",\"value\":{\"text\":\"" + message + "\",\"id\":\"" + comment_id + "\"} }],\"id\":\"" + id + "\",\"time\":" + time + "}],\"object\":\"instagram\"}";
System.out.println("Post body: \n" + webhookPayload);
// Compute the SHA1 for the post body for each of the staging environments. Select the one you wish to use
// from the test output.
Map<String, String> appKeys = new HashMap<>();
appKeys.put("Webhook for IG for invalid comment QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("Webhook for IG for invalid comment QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("Webhook for IG for invalid comment STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()){
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
public static void generateSha1MentionCommentsInvalidMessage() {
//Id of the user/page who was mentioned
String id = "434279690461902";
//Id of post in which the comment with the mention appears
String post_id = "755828918123244_798005230572279";
//Id of the comment in which it was mentioned
String comment_id = "798005230572279_798005593905576";
String field = "mention";
String time = "1547133454";
String created_time = String.valueOf((new Date().getTime())/1000);
String webhookPayload = "{\"entry\":[ {\"changes\":[{\"field\":\"" + field + "\", \"value\":{\"item\":\"comment\", \"comment_id\":\"" + comment_id + "\", \"post_id\":\"" + post_id + "\", \"verb\":\"add\", \"created_time\":"+ created_time + "} }], \"id\":\"" + id + "\", \"time\":"+ time + "}], \"object\":\"page\"}";
System.out.println("Post body: \n" + webhookPayload);
// Compute the SHA1 for the post body for each of the staging environments. Select the one you wish to use
// from the test output.
Map<String, String> appKeys = new HashMap<>();
appKeys.put("FB invalid message mention comments and replies Sha1 for QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("FB invalid message mention comments and replies Sha1 for QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("FB invalid message mention comments and replies Sha1 for STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()){
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
public static void generateSha1MentionCommentsInvalidPostId() {
//Id of the user/page who was mentioned
String id = "434279690461902";
//Id of the comment in which it was mentioned
String comment_id = "61516118118671_71161618181";
//Comment message
String message = "This message is a message";
String field = "mention";
String time = "1547133454";
String created_time = String.valueOf((new Date().getTime())/1000);
String webhookPayload = "{\"entry\":[ {\"changes\":[{\"field\":\"" + field + "\", \"value\":{\"item\":\"comment\", \"comment_id\":\"" + comment_id + "\", \"verb\":\"add\", \"created_time\":"+ created_time + ", \"message\":\"" + message +"\"} }], \"id\":\"" + id + "\", \"time\":"+ time + "}], \"object\":\"page\"}";
System.out.println("Post body: \n" + webhookPayload);
// Compute the SHA1 for the post body for each of the staging environments. Select the one you wish to use
// from the test output.
Map<String, String> appKeys = new HashMap<>();
appKeys.put("FB invalid post_id mention comments and replies Sha1 for QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("FB invalid post_id mention comments and replies Sha1 for QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("FB invalid post_id mention comments and replies Sha1 for STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()){
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
public static void generateSha1ForFBMessagesWebhook() {
//identification data
String receiverId = "2128869687352614";
String time = String.valueOf((new Date().getTime())/1000);
String senderId = "1896414633790869";
//message
String mid = "vD4cMmn1M8l_5xMM5MBoc4Kw72wx6GMkAR7UpiISik86Vp5Igtt2J_qolXjmHaXeDrNg";
String text = "hello!";
String seq = "0";
String timeStamp = String.valueOf((new Date().getTime())/1000);
String webhookPayload = "{\"object\":\"page\",\"entry\":[{\"id\":\"" + receiverId + "\",\"time\":\"" + time + "\",\"messaging\":[{\"sender\":{\"id\":\"" + senderId + "\"},\"recipient\":{\"id\":\"" + receiverId + "\"},\"timestamp\":" + timeStamp + ",\"message\":{\"mid\":\"" + mid + "\",\"text\":\"" + text + "\",\"seq\":" + seq + "}}]}]}";
System.out.println("Post body: \n" + webhookPayload);
// Compute the SHA1 for the payload for each of the staging environments. Select the one you wish to use
// from the test output.
Map<String, String> appKeys = new HashMap<>();
appKeys.put("FB message payload Sha1 for QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("FB message payload Sha1 for QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("FB message payload Sha1 for STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()){
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
public static void generateSha1ForFBMessagesEchosWebhook() {
//identification data
String receiverId = "2128869687352614";
String time = String.valueOf((new Date().getTime())/1000);
String senderId = "1896414633790869";
String appId = "2266088933461611";
//message
String mid = "vD4cMmn1M8l_5xMM5MBoc4Kw72wx6GMkAR7UpiISik86Vp5Igtt2J_qolXjmHaXeDrNg";
String text = "hello!";
String seq = "0";
String timeStamp = String.valueOf((new Date().getTime())/1000);
String webhookPayload = "{\"object\":\"page\",\"entry\":[{\"id\":\"" + receiverId + "\",\"time\":\"" + time + "\",\"messaging\":[{\"sender\":{\"id\":\"" + senderId + "\"},\"recipient\":{\"id\":\"" + receiverId + "\"},\"timestamp\":" + timeStamp + ",\"message\":{\"is_echo\":true,\"app_id\":" + appId + ",\"mid\":\"" + mid + "\",\"seq\":" + seq + ",\"text\":\"" + text + "\"}}]}]}";
System.out.println("Post body: \n" + webhookPayload);
// Compute the SHA1 for the payload for each of the staging environments. Select the one you wish to use
// from the test output.
Map<String, String> appKeys = new HashMap<>();
appKeys.put("FB message echo payload Sha1 for QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("FB message echo payload Sha1 for QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("FB message echo payload Sha1 for STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()) {
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
public static void generateSha1ForFBMessagesStandbyWebhook() {
//identification data
String receiverId = "2128869687352614";
String time = String.valueOf((new Date().getTime())/1000);
String senderId = "1896414633790869";
String webhookPayload = "{\"object\":\"page\",\"entry\":[{\"id\":\"" + receiverId + "\",\"time\":\"" + time + "\",\"standby\":[{\"sender\":{\"id\":\"" + senderId + "\"},\"recipient\":{\"id\":\"" + receiverId + "\"}}]}]}";
System.out.println("Post body: \n" + webhookPayload);
// Compute the SHA1 for the payload for each of the staging environments. Select the one you wish to use
// from the test output.
Map<String, String> appKeys = new HashMap<>();
appKeys.put("FB standby message payload Sha1 for QA1", "d78cf05c0256b7c5f418946524dd3aa6");
appKeys.put("FB standby message payload Sha1 for QA2", "7fa0b36764797f11da2178bced776d7a");
appKeys.put("FB standby message payload Sha1 for STAG", "936c9044b0f2dc6bd665f276f1119528");
for (String appKey : appKeys.keySet()) {
String digest = hmacDigest(webhookPayload, appKeys.get(appKey));
System.out.println(appKey + ": " + digest);
}
}
private static String hmacDigest(String msg, String keyString) {
String digest = null;
try {
SecretKeySpec key = new SecretKeySpec((keyString).getBytes(StandardCharsets.UTF_8), "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(key);
byte[] bytes = mac.doFinal(msg.getBytes(StandardCharsets.US_ASCII));
StringBuilder hash = new StringBuilder();
for (byte aByte : bytes) {
String hex = Integer.toHexString(0xFF & aByte);
if (hex.length() == 1) {
hash.append('0');
}
hash.append(hex);
}
digest = hash.toString();
} catch (InvalidKeyException | NoSuchAlgorithmException e) {
}
return digest;
}
}
| [
"[email protected]"
]
| |
25c872d2ef83ce0190f8c1925cf565ff42239780 | 528d83b83bb3e104cd5808c325a8743401f3427b | /arms/src/main/java/com/chieveke/arms/data/SPHelper.java | 7b267bf456ea1258843b2a010ed95b151558fbdf | [
"Apache-2.0"
]
| permissive | Chieve/KotlinMvp | aa8ebe4e1a05563ae64932f0bb501566b0db4a1e | c7b754e07729ddada1b9a249157847b4342a9c26 | refs/heads/master | 2020-03-29T08:09:08.782820 | 2018-10-24T02:04:32 | 2018-10-24T02:04:32 | 149,696,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,885 | java | package com.chieveke.arms.data;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Log;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.StreamCorruptedException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
/**
* @description: SharedPreferences统一管理类
* @author: chieveke
* @date: 2018/9/28 14:57
* @version: V1.0
*/
public class SPHelper {
/**
* 保存在手机里面的文件名
*/
public static final String FILE_NAME = "share_data";
public static final String VERSION_FILE_NAME = "version_file_name";
/**
* 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
*
* @param context
* @param key
* @param object
*/
public static void put(Context context, String key, Object object) {
put(context, key, object, FILE_NAME);
}
/**
* 保存数据的方法,我们需要拿到保存数据的具体类型,然后根据类型调用不同的保存方法
*
* @param context
* @param key
* @param object
* @param fileName
*/
public static void put(Context context, String key, Object object, String fileName) {
SharedPreferences sp = context.getSharedPreferences(fileName,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
if (object instanceof String) {
editor.putString(key, (String) object);
} else if (object instanceof Integer) {
editor.putInt(key, (Integer) object);
} else if (object instanceof Boolean) {
editor.putBoolean(key, (Boolean) object);
} else if (object instanceof Float) {
editor.putFloat(key, (Float) object);
} else if (object instanceof Long) {
editor.putLong(key, (Long) object);
} else {
if (object == null)
return;
editor.putString(key, object.toString());
}
SharedPreferencesCompat.apply(editor);
}
public static Object get(Context context, String key, Object defaultObject) {
return get(context, key, defaultObject, FILE_NAME);
}
/**
* 得到保存数据的方法,我们根据默认值得到保存的数据的具体类型,然后调用相对于的方法获取值
*
* @param context
* @param key
* @param defaultObject
* @return
*/
public static Object get(Context context, String key, Object defaultObject, String fileName) {
SharedPreferences sp = context.getSharedPreferences(fileName,
Context.MODE_PRIVATE);
if (defaultObject instanceof String) {
return sp.getString(key, (String) defaultObject);
} else if (defaultObject instanceof Long) {
return sp.getLong(key, (Long) defaultObject);
} else if (defaultObject instanceof Boolean) {
return sp.getBoolean(key, (Boolean) defaultObject);
} else if (defaultObject instanceof Float) {
return sp.getFloat(key, (Float) defaultObject);
} else if (defaultObject instanceof Integer) {
return sp.getInt(key, (Integer) defaultObject);
}
return null;
}
/**
* 移除某个key值已经对应的值
*
* @param context
* @param key
*/
public static void remove(Context context, String key) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.remove(key);
SharedPreferencesCompat.apply(editor);
}
/**
* 清除所有数据
*
* @param context
*/
public static void clear(Context context) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.clear();
SharedPreferencesCompat.apply(editor);
}
/**
* 查询某个key是否已经存在
*
* @param context
* @param key
* @return
*/
public static boolean contains(Context context, String key) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
return sp.contains(key);
}
/**
* 返回所有的键值对
*
* @param context
* @return
*/
public static Map<String, ?> getAll(Context context) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
return sp.getAll();
}
/**
* 创建一个解决SharedPreferencesCompat.apply方法的一个兼容类
*
* @author zhy
*/
private static class SharedPreferencesCompat {
private static final Method sApplyMethod = findApplyMethod();
/**
* 反射查找apply的方法
*
* @return
*/
@SuppressWarnings({"unchecked", "rawtypes"})
private static Method findApplyMethod() {
try {
Class clz = SharedPreferences.Editor.class;
return clz.getMethod("apply");
} catch (NoSuchMethodException e) {
}
return null;
}
/**
* 如果找到则使用apply执行,否则使用commit
*
* @param editor
*/
public static void apply(SharedPreferences.Editor editor) {
try {
if (sApplyMethod != null) {
sApplyMethod.invoke(editor);
return;
}
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {
}
editor.commit();
}
}
/**
* desc:保存对象
*
* @param context
* @param key
* @param obj 要保存的对象,只能保存实现了serializable的对象
* modified:
*/
public static void saveObject(Context context, String key, Object obj) {
try {
// 保存对象
SharedPreferences.Editor sharedata = context.getSharedPreferences(FILE_NAME, 0).edit();
//先将序列化结果写到byte缓存中,其实就分配一个内存空间
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(bos);
//将对象序列化写入byte缓存
os.writeObject(obj);
//将序列化的数据转为16进制保存
String bytesToHexString = bytesToHexString(bos.toByteArray());
//保存该16进制数组
sharedata.putString(key, bytesToHexString);
sharedata.commit();
} catch (IOException e) {
e.printStackTrace();
Log.e("", "保存obj失败");
}
}
/**
* desc:将数组转为16进制
*
* @param bArray
* @return modified:
*/
public static String bytesToHexString(byte[] bArray) {
if (bArray == null) {
return null;
}
if (bArray.length == 0) {
return "";
}
StringBuffer sb = new StringBuffer(bArray.length);
String sTemp;
for (int i = 0; i < bArray.length; i++) {
sTemp = Integer.toHexString(0xFF & bArray[i]);
if (sTemp.length() < 2)
sb.append(0);
sb.append(sTemp.toUpperCase());
}
return sb.toString();
}
/**
* desc:获取保存的Object对象
*
* @param context
* @param key
* @return modified:
*/
public static Object readObject(Context context, String key) {
try {
SharedPreferences sharedata = context.getSharedPreferences(FILE_NAME, 0);
if (sharedata.contains(key)) {
String string = sharedata.getString(key, "");
if (TextUtils.isEmpty(string)) {
return null;
} else {
//将16进制的数据转为数组,准备反序列化
byte[] stringToBytes = StringToBytes(string);
ByteArrayInputStream bis = new ByteArrayInputStream(stringToBytes);
ObjectInputStream is = new ObjectInputStream(bis);
//返回反序列化得到的对象
Object readObject = is.readObject();
return readObject;
}
}
} catch (StreamCorruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//所有异常返回null
return null;
}
/**
* desc:将16进制的数据转为数组
* <p>创建人:聂旭阳 , 2014-5-25 上午11:08:33</p>
*
* @param data
* @return modified:
*/
public static byte[] StringToBytes(String data) {
String hexString = data.toUpperCase().trim();
if (hexString.length() % 2 != 0) {
return null;
}
byte[] retData = new byte[hexString.length() / 2];
for (int i = 0; i < hexString.length(); i++) {
int int_ch; // 两位16进制数转化后的10进制数
char hex_char1 = hexString.charAt(i); ////两位16进制数中的第一位(高位*16)
int int_ch1;
if (hex_char1 >= '0' && hex_char1 <= '9')
int_ch1 = (hex_char1 - 48) * 16; //// 0 的Ascll - 48
else if (hex_char1 >= 'A' && hex_char1 <= 'F')
int_ch1 = (hex_char1 - 55) * 16; //// A 的Ascll - 65
else
return null;
i++;
char hex_char2 = hexString.charAt(i); ///两位16进制数中的第二位(低位)
int int_ch2;
if (hex_char2 >= '0' && hex_char2 <= '9')
int_ch2 = (hex_char2 - 48); //// 0 的Ascll - 48
else if (hex_char2 >= 'A' && hex_char2 <= 'F')
int_ch2 = hex_char2 - 55; //// A 的Ascll - 65
else
return null;
int_ch = int_ch1 + int_ch2;
retData[i / 2] = (byte) int_ch;//将转化后的数放入Byte里
}
return retData;
}
} | [
"[email protected]"
]
| |
088e8fadd17615a563628199fdf49ed6c8450ad7 | 7c444e6676dd9bc6c66b9121ee05340d5826c7ac | /src/main/java/it/TetrisReich/creaClassi/App.java | ddda31966daab9d8199a2256f4422d1623569a09 | []
| no_license | vdanbv/CreaClassi | 1b1c6ebaff1c86d8a1218520b49309b54e27bf60 | 288eb7c4e566bdca0b125c30e3a6785cfe1bb9c6 | refs/heads/master | 2021-01-15T20:34:19.849454 | 2016-06-17T14:56:32 | 2016-06-17T14:56:32 | 61,518,206 | 2 | 0 | null | 2016-06-20T05:03:46 | 2016-06-20T05:03:46 | null | UTF-8 | Java | false | false | 1,073 | java | package it.TetrisReich.creaClassi;
import java.io.FileNotFoundException;
import java.io.IOException;
import it.TetrisReich.creaClassi.FileO;
import it.TetrisReich.creaClassi.Utils;
import it.TetrisReich.creaClassi.Cc;
public class App{
public static String[] nome;
public static int[] competenze;
public static char[] sesso;
public static byte[] Cclasse;
public static byte[] SNclasse;
public static void main(String[] args) throws FileNotFoundException, IOException{
System.out.println("Ciao! Benvenuto nel mio programma! Creato da Luca Sorace Stranck.");
Utils.wait(250);
System.out.println("Sto inizializzando gli array...");
if(Utils.inArray()==false) return;
System.out.print("Sto leggendo la lista delle persone: ");
Utils.wait(537);
FileO.loader();
Cc.divisor();
Utils.wait(699);
System.out.print("Preparing output...");
FileO.output();
Utils.wait(201);
System.out.println("Grazie per aver usato il mio programma! :D");
Utils.wait(1100);
}
}
| [
"[email protected]"
]
| |
9a191b89accecfe6a96fe27c0625c2c3698927b5 | 258b7af0e87c46b94450edc12e73f120e97d817e | /services/sample-service/sample-service-portlet/src/main/java/org/xcolab/services/sample/service/impl/SampleEntityServiceImpl.java | a80e47ee9c279316fb45338059d299c7d3e9efb3 | [
"MIT"
]
| permissive | csaladenes/XCoLab | 8d04d8b852a5153e9b6521b04bf59f3866a85cd3 | 680dae4738df0a2b8d5c27adb9a5a3a33b5d0c23 | refs/heads/master | 2021-01-16T21:10:30.355609 | 2014-12-16T23:31:20 | 2014-12-16T23:31:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,092 | java | package org.xcolab.services.sample.service.impl;
import org.xcolab.services.sample.service.base.SampleEntityServiceBaseImpl;
/**
* The implementation of the sample entity remote service.
*
* <p>
* All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link org.xcolab.services.sample.service.SampleEntityService} interface.
*
* <p>
* This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
* </p>
*
* @author Brian Wing Shun Chan
* @see org.xcolab.services.sample.service.base.SampleEntityServiceBaseImpl
* @see org.xcolab.services.sample.service.SampleEntityServiceUtil
*/
public class SampleEntityServiceImpl extends SampleEntityServiceBaseImpl {
/*
* NOTE FOR DEVELOPERS:
*
* Never reference this interface directly. Always use {@link org.xcolab.services.sample.service.SampleEntityServiceUtil} to access the sample entity remote service.
*/
}
| [
"[email protected]"
]
| |
6ec9e59474ab8e6587e015c40dd152d7863c83ce | 0f6d3f15a6fe8fcb49799bcf4f8aba880f7013d2 | /cosmos_backend_intellij/src/main/java/com/shopping/cosmos/cart/service/KakaoPayService.java | a33ecd006d2649e3e8e5534b21a5641c4ea51c1f | []
| no_license | Teamproject0515/cosmos_AWS_1.0 | 9bf5fb2d26db9bdbf178ef43433dbbfda7882575 | c602b48fab348f9dbb8430a4ea612c77462e3c7b | refs/heads/main | 2023-06-11T00:21:32.187314 | 2021-07-01T08:41:22 | 2021-07-01T08:41:22 | 381,947,508 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 620 | java | package com.shopping.cosmos.cart.service;
import com.shopping.cosmos.cart.domain.AddressVO;
import com.shopping.cosmos.cart.domain.KaKaoPayApprovalVO;
import com.shopping.cosmos.cart.domain.UserVO;
import java.util.List;
public interface KakaoPayService {
//카카오페이 준비
public String kakaoPayReady(String userId);
//카카오페이 승인
public KaKaoPayApprovalVO kakaoPayInfo(String pg_token, String userId);
//배송지 가져오기
public List<AddressVO> listAddress(String userId);
//주문고객 정보 가져오기
public UserVO userOrderData(String userId);
}
| [
"[email protected]"
]
| |
55386e5b000ddaef29f56189f2c53bbb3a44fa88 | a95213f302f427eeff25019a009466e8e4761851 | /ArtCore/src/main/java/com/kampherbeek/art/domains/datetime/impl/DateTimeHandlerImpl.java | cdcf69238d743b3a4d72474d152e131c9df7d6ab | []
| no_license | rahulyhg/art-1 | f1f2ecf23c55a981ede60113d3a1f4af97e6c12c | c9ccb3283458f3c14de2e2347bae5cc3c5653ff5 | refs/heads/master | 2021-05-28T15:24:53.416385 | 2015-05-04T10:28:04 | 2015-05-04T10:28:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | package com.kampherbeek.art.domains.datetime.impl;
import com.kampherbeek.art.domains.datetime.DateTimeCalculator;
import com.kampherbeek.art.domains.datetime.DateTimeHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import swisseph.SweDate;
@Component
public class DateTimeHandlerImpl implements DateTimeHandler {
@Autowired
private DateTimeCalculator dateTimeCalculator;
@Override
public double calculateJdNr(SweDate sweDate) {
return dateTimeCalculator.calcJdNr(sweDate);
}
}
| [
"[email protected]"
]
| |
e9bed42c66a346648f6966a75ae4d3fb56641268 | a2cfb119e6774ed54d795d66eebc734f00ad58ba | /src/main/java/home/kryvenkosergii/communalpayments/pages/water/package-info.java | deb4c6a474c22e52b90e613c442c185479065221 | []
| no_license | KryvenkoSergii/Communal-payments | 518fb886683261ac2c0bf1a283d7477868e86213 | 8ac1acf01cef32b56b0f2061220519009c7b76bc | refs/heads/master | 2022-07-13T06:10:48.768645 | 2020-08-30T00:32:08 | 2020-08-30T00:32:08 | 221,231,277 | 0 | 0 | null | 2021-04-26T20:35:24 | 2019-11-12T14:00:34 | Java | UTF-8 | Java | false | false | 136 | java | /**
* The package with classes that describe the Info-Lviv site pages.
*/
package home.kryvenkosergii.communalpayments.pages.water; | [
"[email protected]"
]
| |
7dbbf036c651f2c56d20ce97b6ed03fa5b53f97b | 119c0e9d62e1cfc7090c2de72e86ed38f4c45d92 | /src/net/skaerf/bigasscore/cmds/ClearCommand.java | 31b982041506b8eabfeac0228820121982c076fb | []
| no_license | skaerf/BigassCore | 62e7195db03863bb09332ddc78f7ddceb1f257f7 | 3b6ce7554f8b04625cf8fa0b36693b2432356210 | refs/heads/master | 2021-05-24T11:39:53.808228 | 2020-04-07T23:08:50 | 2020-04-07T23:08:50 | 253,542,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package net.skaerf.bigasscore.cmds;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class ClearCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
return true;
}
}
| [
"[email protected]"
]
| |
3c85a080066df5b63e52765d02c5b6326ac8cc63 | defb85ce2a3ba3539f927a699d626a330aa6b954 | /interactive_engine/src/v2/src/main/java/com/alibaba/maxgraph/v2/sdk/Client.java | 66095ece70019a9537306a31dffafa583453de21 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"BSL-1.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-elastic-license-2018",
"LicenseRef-scancode-other-permissive"
]
| permissive | MJY-HUST/GraphScope | c96d2f8a15f25fc1cc1f3e3d71097ac71819afce | d2ab25976edb4cae3e764c53102ded688a56a08c | refs/heads/main | 2023-08-17T00:30:38.113834 | 2021-07-15T16:27:05 | 2021-07-15T16:27:05 | 382,337,023 | 0 | 0 | Apache-2.0 | 2021-07-02T12:17:46 | 2021-07-02T12:17:46 | null | UTF-8 | Java | false | false | 6,798 | java | /**
* Copyright 2020 Alibaba Group Holding Limited.
*
* 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.alibaba.maxgraph.v2.sdk;
import com.alibaba.maxgraph.proto.v2.*;
import com.alibaba.maxgraph.v2.common.frontend.api.schema.GraphSchema;
import com.alibaba.maxgraph.v2.common.schema.GraphDef;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class Client implements Closeable {
private static final Logger logger = LoggerFactory.getLogger(Client.class);
private ClientGrpc.ClientBlockingStub stub;
private ManagedChannel channel;
private String name = "";
private AddVerticesRequest.Builder verticesBuilder;
private AddEdgesRequest.Builder edgesBuilder;
public Client(String hosts, String name) {
this.name = name;
List<SocketAddress> addrList = new ArrayList<>();
for (String host : hosts.split(",")) {
String[] items = host.split(":");
addrList.add(new InetSocketAddress(items[0], Integer.valueOf(items[1])));
}
MultiAddrResovlerFactory resovlerFactory = new MultiAddrResovlerFactory(addrList);
ManagedChannel channel = ManagedChannelBuilder.forTarget("hosts")
.nameResolverFactory(resovlerFactory)
.defaultLoadBalancingPolicy("round_robin")
.usePlaintext()
.build();
this.channel = channel;
this.stub = ClientGrpc.newBlockingStub(this.channel);
this.init();
}
public Client(String host, int port) {
this(ManagedChannelBuilder.forAddress(host, port)
.usePlaintext()
.build());
}
public Client(ManagedChannel channel) {
this.channel = channel;
this.stub = ClientGrpc.newBlockingStub(this.channel);
this.init();
}
private void init() {
this.verticesBuilder = AddVerticesRequest.newBuilder().setSession(this.name);
this.edgesBuilder = AddEdgesRequest.newBuilder().setSession(this.name);
}
public void addVertex(String label, Map<String, String> properties) {
this.verticesBuilder.addDataList(VertexDataPb.newBuilder()
.setLabel(label)
.putAllProperties(properties)
.build());
}
public void addEdge(String label, String srcLabel, String dstLabel, Map<String, String> srcPk,
Map<String, String> dstPk, Map<String, String> properties) {
this.edgesBuilder.addDataList(EdgeDataPb.newBuilder()
.setLabel(label)
.setSrcLabel(srcLabel)
.setDstLabel(dstLabel)
.putAllSrcPk(srcPk)
.putAllDstPk(dstPk)
.putAllProperties(properties)
.build());
}
public long commit() {
long snapshotId = 0L;
if (this.verticesBuilder.getDataListCount() > 0) {
AddVerticesResponse verticesResponse = this.stub.addVertices(this.verticesBuilder.build());
snapshotId = verticesResponse.getSnapshotId();
}
if (this.edgesBuilder.getDataListCount() > 0) {
AddEdgesResponse edgesResponse = this.stub.addEdges(this.edgesBuilder.build());
snapshotId = edgesResponse.getSnapshotId();
}
this.init();
return snapshotId;
}
public void remoteFlush(long snapshotId) {
this.stub.remoteFlush(RemoteFlushRequest.newBuilder().setSnapshotId(snapshotId).build());
}
public GraphSchema getSchema() {
GetSchemaResponse response = this.stub.getSchema(GetSchemaRequest.newBuilder().build());
return GraphDef.parseProto(response.getGraphDef());
}
public GraphSchema dropSchema() {
DropSchemaResponse response = this.stub.dropSchema(DropSchemaRequest.newBuilder().build());
return GraphDef.parseProto(response.getGraphDef());
}
public GraphSchema prepareDataLoad(List<DataLoadTarget> targets) {
PrepareDataLoadRequest.Builder builder = PrepareDataLoadRequest.newBuilder();
for (DataLoadTarget target : targets) {
builder.addDataLoadTargets(target.toProto());
}
PrepareDataLoadResponse response = this.stub.prepareDataLoad(builder.build());
return GraphDef.parseProto(response.getGraphDef());
}
public void commitDataLoad(Map<Long, DataLoadTarget> tableToTarget) {
CommitDataLoadRequest.Builder builder = CommitDataLoadRequest.newBuilder();
tableToTarget.forEach((tableId, target) -> {
builder.putTableToTarget(tableId, target.toProto());
});
CommitDataLoadResponse response = this.stub.commitDataLoad(builder.build());
}
public String getMetrics(String roleNames) {
GetMetricsResponse response =
this.stub.getMetrics(GetMetricsRequest.newBuilder().setRoleNames(roleNames).build());
return response.getMetricsJson();
}
public void ingestData(String path) {
this.stub.ingestData(IngestDataRequest.newBuilder().setDataPath(path).build());
}
public String loadJsonSchema(Path jsonFile) throws IOException {
String json = new String(Files.readAllBytes(jsonFile), StandardCharsets.UTF_8);
LoadJsonSchemaResponse response = this.stub.loadJsonSchema(LoadJsonSchemaRequest.newBuilder()
.setSchemaJson(json).build());
return response.getGraphDef().toString();
}
public int getPartitionNum() {
GetPartitionNumResponse response = this.stub.getPartitionNum(GetPartitionNumRequest.newBuilder().build());
return response.getPartitionNum();
}
@Override
public void close() {
this.channel.shutdown();
try {
this.channel.awaitTermination(3000, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// Ignore
}
}
}
| [
"[email protected]"
]
| |
52b625bd6b713892e8eac864e14a12bdce10701a | e8aa7a5a08a2a7d84628e30dba58f7d9ded2420c | /src/test/java/hello/core/order/OrderServiceTest.java | 553eba78b1a65bd15e4bdab7c4948be9c6cf7343 | []
| no_license | psajo/springCore | 84346f2f52ab493b69cbae25b6c94fe9cc8a249b | 6426ca6c1d738eed77a7ae3d018dddb5559f0131 | refs/heads/master | 2023-04-07T00:16:51.154305 | 2021-04-25T14:00:11 | 2021-04-25T14:00:11 | 359,153,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 941 | java | package hello.core.order;
import hello.core.AppConfig;
import hello.core.member.Grade;
import hello.core.member.Member;
import hello.core.member.MemberService;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class OrderServiceTest {
MemberService memberService;
OrderService orderService;
@BeforeEach
public void beforeEach() {
AppConfig appConfig = new AppConfig();
memberService = appConfig.memberService();
orderService = appConfig.orderService();
}
@Test
void createOrder() {
Long memberId = 1L;
Member member = new Member(memberId,"memberA", Grade.VIP);
memberService.join(member);
Order order = orderService.createOrder(memberId, "itemA", 10000);
Assertions.assertThat(order.getDiscountPrice()).isEqualTo(1000);
}
} | [
"[email protected]"
]
| |
ed4007b380b7c0395cfb747c00933d0fc5c62740 | f21a5e5f611bb646344d31fb6c808b6f5c838cf6 | /banco-api-service/src/main/java/com/forttiori/Contas/ContaService.java | dce59700a9c9a83bb6e367dd2215be52af487db9 | []
| no_license | cassiorp/banco-api | 9d035b484ac174cba012df126ee41f16e0dbd6ab | 7014283bc56ea08405fce9f078807e138e8378f1 | refs/heads/master | 2023-02-23T15:34:04.308295 | 2021-01-28T16:58:14 | 2021-01-28T16:58:14 | 331,459,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.forttiori.Contas;
import com.forttiori.Conta;
import com.forttiori.DTO.ContaDTO;
import com.forttiori.DTO.ValorDTO;
import java.util.List;
public interface ContaService {
public Conta saveConta(String idCliente, ContaDTO contaDTO);
public List<Conta> findAllConta();
public Double deposito(String idCliente, ValorDTO valorDTO);
public Double saque(String idCliente, ValorDTO valorDTO);
}
| [
"[email protected]"
]
| |
e9407a1370300548cc04e86bd6fc798d0a363802 | 728678c1a9bf4c245afee723d761e2f00e1e9f25 | /src/main/java/com/crm/qa/base/BasePage.java | 946ff5f296f236a11018900acac62b316bce4281 | []
| no_license | ajitbhapse/SeleniumPageFactory | f3819ac488b849d723eb1e8df45d016d6d6b7c98 | 6ac892dc7079e3d7401b234018e66eaa81ea1233 | refs/heads/main | 2023-02-21T08:50:54.881226 | 2021-01-23T04:38:06 | 2021-01-23T04:38:06 | 332,127,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,159 | java | package com.crm.qa.base;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class BasePage {
WebDriver driver;
public BasePage(WebDriver driver){
this.driver = driver;
}
/**
* Wait till element is clickable.
* @param elem
*/
public void waitTillElementIsClickable(WebElement elem) {
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.elementToBeClickable(elem));
}
/**
* wait till element is visible
*/
public void waitTillElementIsVisible(WebElement elem) {
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.visibilityOf(elem));
}
/**
* click on webElement
*/
public void click(WebElement elem) {
waitTillElementIsVisible(elem);
waitTillElementIsClickable(elem);
elem.click();
}
/**
* enter text in textbox
*/
public void sendKeys(WebElement elem,String value) {
waitTillElementIsVisible(elem);
waitTillElementIsClickable(elem);
elem.clear();
elem.sendKeys(value);
}
}
| [
"[email protected]"
]
| |
de84ca73a2cd55b5b74d7a16188faa1ff7624007 | 9208ba403c8902b1374444a895ef2438a029ed5c | /sources/org/msgpack/core/buffer/ArrayBufferOutput.java | 3833e526d27a1a80c3e14c46b2501cb17a3950ed | []
| no_license | MewX/kantv-decompiled-v3.1.2 | 3e68b7046cebd8810e4f852601b1ee6a60d050a8 | d70dfaedf66cdde267d99ad22d0089505a355aa1 | refs/heads/main | 2023-02-27T05:32:32.517948 | 2021-02-02T13:38:05 | 2021-02-02T13:44:31 | 335,299,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,441 | java | package org.msgpack.core.buffer;
import java.util.ArrayList;
import java.util.List;
public class ArrayBufferOutput implements MessageBufferOutput {
private final int bufferSize;
private MessageBuffer lastBuffer;
private final List<MessageBuffer> list;
public void close() {
}
public void flush() {
}
public ArrayBufferOutput() {
this(8192);
}
public ArrayBufferOutput(int i) {
this.bufferSize = i;
this.list = new ArrayList();
}
public int getSize() {
int i = 0;
for (MessageBuffer size : this.list) {
i += size.size();
}
return i;
}
public byte[] toByteArray() {
byte[] bArr = new byte[getSize()];
int i = 0;
for (MessageBuffer messageBuffer : this.list) {
messageBuffer.getBytes(0, bArr, i, messageBuffer.size());
i += messageBuffer.size();
}
return bArr;
}
public MessageBuffer toMessageBuffer() {
if (this.list.size() == 1) {
return (MessageBuffer) this.list.get(0);
}
if (this.list.isEmpty()) {
return MessageBuffer.allocate(0);
}
return MessageBuffer.wrap(toByteArray());
}
public List<MessageBuffer> toBufferList() {
return new ArrayList(this.list);
}
public void clear() {
this.list.clear();
}
public MessageBuffer next(int i) {
MessageBuffer messageBuffer = this.lastBuffer;
if (messageBuffer != null && messageBuffer.size() > i) {
return this.lastBuffer;
}
MessageBuffer allocate = MessageBuffer.allocate(Math.max(this.bufferSize, i));
this.lastBuffer = allocate;
return allocate;
}
public void writeBuffer(int i) {
this.list.add(this.lastBuffer.slice(0, i));
if (this.lastBuffer.size() - i > this.bufferSize / 4) {
MessageBuffer messageBuffer = this.lastBuffer;
this.lastBuffer = messageBuffer.slice(i, messageBuffer.size() - i);
return;
}
this.lastBuffer = null;
}
public void write(byte[] bArr, int i, int i2) {
MessageBuffer allocate = MessageBuffer.allocate(i2);
allocate.putBytes(0, bArr, i, i2);
this.list.add(allocate);
}
public void add(byte[] bArr, int i, int i2) {
this.list.add(MessageBuffer.wrap(bArr, i, i2));
}
}
| [
"[email protected]"
]
| |
39bacbe7bbc9b33dcf661e066d67d1e78aff2eed | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project34/src/main/java/org/gradle/test/performance/largejavamultiproject/project34/p170/Production3403.java | ebf9fba0d2c984ef6ce2d3878c60d34707da8a34 | []
| no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,959 | java | package org.gradle.test.performance.largejavamultiproject.project34.p170;
public class Production3403 {
private Production3400 property0;
public Production3400 getProperty0() {
return property0;
}
public void setProperty0(Production3400 value) {
property0 = value;
}
private Production3401 property1;
public Production3401 getProperty1() {
return property1;
}
public void setProperty1(Production3401 value) {
property1 = value;
}
private Production3402 property2;
public Production3402 getProperty2() {
return property2;
}
public void setProperty2(Production3402 value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"[email protected]"
]
| |
91b324e80716e362ca018b70073700cf3248aabb | bc014bbfefce3900130a07ff4627dfabc963dcba | /casa-codigo/src/main/java/br/com/zup/desafio/casacodigo/dto/LivroFormDTO.java | 831a1ea13c40772c3f70b1a2086263677408e7e0 | []
| no_license | joaldotavares/desafio_casa_do_codigo | 2ec28316ab3c13bbac3697d15a84043117cf47b6 | 977581f9b5b1a4b2b46398a727b2bbe0f5a8311b | refs/heads/main | 2023-06-12T00:14:24.460642 | 2021-07-01T13:25:12 | 2021-07-01T13:25:12 | 381,044,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,318 | java | package br.com.zup.desafio.casacodigo.dto;
import java.time.LocalDate;
import br.com.zup.desafio.casacodigo.model.Livro;
public class LivroFormDTO {
private Long id;
private String titulo;
private String resumo;
private String sumario;
private Double preco;
private Integer paginas;
private String isbn;
private LocalDate publicacao;
private Long categoriaId;
private Long autorId;
public LivroFormDTO(Livro livro) {
this.id = livro.getId();
this.titulo = livro.getTitulo();
this.resumo = livro.getResumo();
this.sumario = livro.getSumario();
this.preco = livro.getPreco();
this.paginas = livro.getPaginas();
this.isbn = livro.getIsbn();
this.publicacao = livro.getPublicacao();
this.categoriaId = livro.getCategoria().getId();
this.autorId = livro.getAutor().getId();
}
public Long getId() {
return id;
}
public String getTitulo() {
return titulo;
}
public String getResumo() {
return resumo;
}
public String getSumario() {
return sumario;
}
public Double getPreco() {
return preco;
}
public Integer getPaginas() {
return paginas;
}
public String getIsbn() {
return isbn;
}
public LocalDate getPublicacao() {
return publicacao;
}
public Long getCategoriaId() {
return categoriaId;
}
public Long getAutorId() {
return autorId;
}
}
| [
"[email protected]"
]
| |
fd9e613bfee08af0aa8b28732248f93c4f87394b | 10125ad1bf78e92c1d8d43d3815e14ddd77f1b2e | /6_semester/docs/lab2-3/src/main/java/com/kaminovskiy/booking/repository/FoodItemRepository.java | 8b107c479e4a7f3702956922ea9ea9121bf844d6 | []
| no_license | tooSadman/iot_course_tasks | c4247a96e329397e0724e17d6a2ad25f9958b0c2 | 78dc6e3c05ab3d8fb8f4231ea003320b698eb8dd | refs/heads/master | 2022-12-12T12:04:53.709253 | 2021-01-23T18:30:08 | 2021-01-23T18:36:57 | 135,065,926 | 0 | 0 | null | 2022-12-09T09:01:20 | 2018-05-27T17:04:27 | HTML | UTF-8 | Java | false | false | 409 | java | package com.kaminovskiy.booking.repository;
import com.kaminovskiy.booking.domain.FoodItem;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the FoodItem entity.
*/
@SuppressWarnings("unused")
@Repository
public interface FoodItemRepository extends JpaRepository<FoodItem, Long>, JpaSpecificationExecutor<FoodItem> {
}
| [
"[email protected]"
]
| |
8b5d5c9b81d7e34fdd45f8fc495c5657324c5641 | 9a1400f42b117668df04829a88328f5bbfa1b67a | /src/spellchecker/SpellCheckGUI.java | fdc4ef0b74fe559cdcfdce54af803bee85cb8c4d | []
| no_license | kylepbishop/SimpleSpellChecker | 1330b05d1ab2eea5f0474b76ceafa3ce3ef306c9 | 6697d0263f950aca6f0b235f8aedb86fcb9000f5 | refs/heads/master | 2021-01-10T08:04:11.658136 | 2016-02-26T01:48:28 | 2016-02-26T01:48:28 | 52,569,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,437 | java | /**
* The GUI for the SpellChecker application
*/
package spellchecker;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.JLabel;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import javax.swing.JScrollPane;
import javax.swing.JList;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
public class SpellCheckGUI extends JFrame
{
private JFrame frame;
private JTextField txtWordsnotadded;
private JTextField txtWordsadded;
private static SpellCheck spellCheck;
DefaultListModel listOfWords = new DefaultListModel();
DefaultListModel listOfInputs = new DefaultListModel();
boolean fileSelected = false;
boolean outputNamed = false;
/**
* Launch the application.
*/
public static void main(String[] args)
{
spellCheck = new SpellCheck();
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
SpellCheckGUI window = new SpellCheckGUI();
window.frame.setVisible(true);
} catch (Exception e)
{
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public SpellCheckGUI()
{
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize()
{
/*
* Create all elements of the UI
*/
JPanel panelResults = new JPanel();
JPanel filePanel = new JPanel();
JLabel lblSpellcheckComplete = new JLabel("Spellcheck complete.");
JLabel lblChooseFile = new JLabel("Choose a file:");
JButton btnChoose = new JButton("Choose");
JList inputList = new JList(listOfInputs);
JScrollPane inputFileListScroll = new JScrollPane();
JButton btnRemove = new JButton("Remove");
JButton btnDone = new JButton("Done");
JLabel lblWordsNotAdded = new JLabel(
"Words not added output file name:");
JButton btnUpdate = new JButton("Update");
JLabel lblWordsAdded = new JLabel("Words added output file name:");
JPanel misspelledPanel = new JPanel();
JLabel lblMisspelled = new JLabel("Misspelled?");
JLabel lblWord = new JLabel("Word list");
JList list = new JList(listOfWords);
JButton btnNo = new JButton("No");
JButton btnYes = new JButton("Yes");
JScrollPane scrollPane = new JScrollPane(list);
JButton btnExit = new JButton("Exit");
JLabel lblSpellcheckMoreFiles = new JLabel("Spellcheck more files?");
JButton btnContinue = new JButton("Yes");
/*
* set up the functionality of the UI
*/
frame = new JFrame();
frame.setBounds(100, 100, 554, 224);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
panelResults.setVisible(false);
JButton btnSpellCheck = new JButton("Run Spell Check");
btnSpellCheck.setBounds(7, 150, 465, 23);
btnSpellCheck.setVisible(false);
btnSpellCheck.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
fileSelected = false;
outputNamed = false;
while (inputList.getModel().getSize() > 0)
{
spellCheck.setMisspelledWords(new Dictionary());
spellCheck.setMisspelledWords(spellCheck
.compareDictionaryTo(spellCheck.getInputFileDict(),
spellCheck.getMisspelledWords()));
}
spellCheck.setMisspelledWords(spellCheck
.compareDictionaryTo(spellCheck.getInputFileDict()));
spellCheck.getMisspelledWords().sort();
spellCheck.getMisspelledWords().removeDuplicates();
for (int alphaLoc = 0; alphaLoc < 26; alphaLoc++)
{
for (String word : spellCheck.getMisspelledWords()
.getWords()[alphaLoc])
{
listOfWords.addElement(word);
}
}
list.setSelectedIndex(list.getFirstVisibleIndex());
btnSpellCheck.setVisible(false);
filePanel.setVisible(false);
if (listOfWords.isEmpty())
{
lblSpellcheckComplete
.setText("There were no misspelled words");
panelResults.setVisible(true);
}
else
{
misspelledPanel.setVisible(true);
}
}
});
frame.getContentPane().add(btnSpellCheck);
panelResults.setBounds(7, 7, 465, 171);
frame.getContentPane().add(panelResults);
filePanel.setBounds(7, 7, 465, 171);
frame.getContentPane().add(filePanel);
filePanel.setLayout(new MigLayout("", "[168px][204px][71px]", "[27px][4px][23px][4px][33px][20px][4px][20px]"));
filePanel.add(lblChooseFile, "cell 0 0,alignx right,aligny center");
filePanel.add(inputFileListScroll, "cell 1 0 1 5,grow");
inputFileListScroll.setViewportView(inputList);
filePanel.add(btnChoose, "cell 2 0,growx,aligny bottom");
btnRemove.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
if (!inputList.isSelectionEmpty())
{
listOfInputs.remove(inputList.getSelectedIndex());
}
}
});
filePanel.add(btnRemove, "cell 2 2,alignx left,aligny top");
btnDone.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
if (!listOfInputs.isEmpty())
{
try
{
btnDone.setVisible(false);
btnChoose.setVisible(false);
btnRemove.setVisible(false);
inputFileListScroll.setVisible(false);
lblChooseFile.setVisible(false);
spellCheck.setInputFileDict(spellCheck.loadInputFile(
(String) listOfInputs.elementAt(0)));
listOfInputs.remove(0);
while (!listOfInputs.isEmpty())
{
spellCheck.setInputFileDict(spellCheck
.getInputFileDict()
.combineWith(spellCheck
.loadInputFile((String) listOfInputs
.elementAt(0))));
listOfInputs.remove(0);
}
fileSelected = true;
if (outputNamed && fileSelected)
{
btnSpellCheck.setVisible(true);
}
} catch (Exception e1)
{
e1.printStackTrace();
}
}
}
});
filePanel.add(btnDone, "cell 2 4,growx,aligny top");
filePanel.add(lblWordsNotAdded, "cell 0 5,alignx left,aligny center");
txtWordsnotadded = new JTextField();
filePanel.add(txtWordsnotadded, "cell 1 5,growx,aligny top");
txtWordsnotadded.addPropertyChangeListener(new PropertyChangeListener()
{
public void propertyChange(PropertyChangeEvent evt)
{
spellCheck.setNotAddedFileName(txtWordsnotadded.getText());
spellCheck.setNotAddedDict(new Dictionary());
}
});
txtWordsnotadded.setText("wordsNotAdded.txt");
txtWordsnotadded.setColumns(10);
filePanel.add(btnUpdate, "cell 2 5 1 3,growx,aligny center");
btnUpdate.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
spellCheck.setNotAddedFileName(txtWordsnotadded.getText());
spellCheck.setNotAddedDict(new Dictionary());
spellCheck.setAddedFileName(txtWordsadded.getText());
spellCheck.setAddedDict(new Dictionary());
outputNamed = true;
txtWordsnotadded.setVisible(false);
txtWordsadded.setVisible(false);
lblWordsAdded.setVisible(false);
lblWordsNotAdded.setVisible(false);
btnUpdate.setVisible(false);
if (outputNamed && fileSelected)
{
btnSpellCheck.setVisible(true);
}
}
});
filePanel.add(lblWordsAdded, "cell 0 7,alignx right,aligny center");
txtWordsadded = new JTextField();
filePanel.add(txtWordsadded, "cell 1 7,growx,aligny top");
txtWordsadded.addPropertyChangeListener(new PropertyChangeListener()
{
public void propertyChange(PropertyChangeEvent evt)
{
spellCheck.setAddedFileName(txtWordsadded.getText());
spellCheck.setAddedDict(new Dictionary());
}
});
txtWordsadded.setText("wordsAdded.txt");
txtWordsadded.setColumns(10);
btnChoose.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
FileFilter filter = new FileNameExtensionFilter("Text Files","txt");
final JFileChooser jFileChooser = new JFileChooser();
jFileChooser.setFileFilter(filter);
int returnVal = jFileChooser.showOpenDialog(SpellCheckGUI.this);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = jFileChooser.getSelectedFile();
listOfInputs.addElement(file.getPath());
}
}
});
misspelledPanel.setBounds(7, 7, 465, 171);
misspelledPanel.setVisible(false);
frame.getContentPane().add(misspelledPanel);
misspelledPanel.setLayout(new MigLayout("", "[53px][275px][66px][45px]", "[23px][130px]"));
misspelledPanel.add(lblMisspelled, "cell 0 0,alignx left,aligny center");
misspelledPanel.add(lblWord, "cell 1 0,growx,aligny center");
misspelledPanel.add(btnYes, "cell 2 0,growx,aligny top");
btnYes.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
spellCheck.yesButton((String) listOfWords
.getElementAt(list.getSelectedIndex()));
listOfWords.removeElementAt(list.getSelectedIndex());
list.setSelectedIndex(list.getFirstVisibleIndex());
if (list.getModel().getSize() == 0)
{
spellCheck.getNotAddedDict()
.saveFile(spellCheck.getNotAddedFileName());
spellCheck.getAddedDict()
.saveFile(spellCheck.getAddedFileName());
spellCheck.saveDictionary();
panelResults.setVisible(true);
misspelledPanel.setVisible(false);
}
}
});
misspelledPanel.add(btnNo, "cell 3 0,alignx left,aligny top");
btnNo.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
spellCheck.noButton((String) listOfWords
.getElementAt(list.getSelectedIndex()));
listOfWords.removeElementAt(list.getSelectedIndex());
list.setSelectedIndex(0);
if (list.getModel().getSize() == 0)
{
spellCheck.getNotAddedDict()
.saveFile(spellCheck.getNotAddedFileName());
spellCheck.getAddedDict()
.saveFile(spellCheck.getAddedFileName());
spellCheck.saveDictionary();
panelResults.setVisible(true);
misspelledPanel.setVisible(false);
}
}
});
misspelledPanel.add(scrollPane, "cell 1 1,growx,aligny top");
scrollPane.setViewportView(list);
btnExit.setBounds(475, 150, 57, 23);
btnExit.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
System.exit(0);
}
});
frame.getContentPane().add(btnExit);
panelResults.setLayout(new MigLayout("", "[103px][49px]", "[14px][23px]"));
panelResults.add(lblSpellcheckComplete, "cell 0 0,alignx left,aligny top");
panelResults.add(lblSpellcheckMoreFiles, "cell 0 1,alignx left,aligny center");
btnContinue.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
lblChooseFile.setVisible(true);
inputFileListScroll.setVisible(true);
btnChoose.setVisible(true);
btnRemove.setVisible(true);
btnDone.setVisible(true);
txtWordsnotadded.setVisible(true);
txtWordsadded.setVisible(true);
lblWordsAdded.setVisible(true);
lblWordsNotAdded.setVisible(true);
btnUpdate.setVisible(true);
filePanel.setVisible(true);
misspelledPanel.setVisible(false);
panelResults.setVisible(false);
lblSpellcheckComplete.setText("Spellcheck complete.");
}
});
panelResults.add(btnContinue, "cell 1 1,alignx left,aligny top");
}
}
| [
"[email protected]"
]
| |
2b46ded7ee255d5f7702487d85f666bf553e4c34 | d954670a214dc84a912d7a5942bc45164260cf49 | /src/main/java/org/apache/fop/render/intermediate/IFSerializer.java | 665c7eb68809c8c47ef24f4507f12b2086d6dd17 | [
"Apache-2.0"
]
| permissive | nghinv/Apache-Fop | d1e6663ca2f9b76d3b3055cc0f2ac88907373c09 | 9d65e2a01cd344ccdc44b5ac176b07657a1bd8cd | refs/heads/master | 2020-06-28T03:06:01.795472 | 2014-04-21T19:23:34 | 2014-04-21T19:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,773 | 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.
*/
/* $Id: IFSerializer.java 834020 2009-11-09 11:21:52Z vhennebert $ */
package org.apache.fop.render.intermediate;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Paint;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.fop.accessibility.StructureTree;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.render.PrintRendererConfigurator;
import org.apache.fop.render.RenderingContext;
import org.apache.fop.render.intermediate.extensions.AbstractAction;
import org.apache.fop.render.intermediate.extensions.Bookmark;
import org.apache.fop.render.intermediate.extensions.BookmarkTree;
import org.apache.fop.render.intermediate.extensions.DocumentNavigationExtensionConstants;
import org.apache.fop.render.intermediate.extensions.Link;
import org.apache.fop.render.intermediate.extensions.NamedDestination;
import org.apache.fop.traits.BorderProps;
import org.apache.fop.traits.RuleStyle;
import org.apache.fop.util.ColorUtil;
import org.apache.fop.util.DOM2SAX;
import org.apache.fop.util.XMLConstants;
import org.apache.fop.util.XMLUtil;
import org.apache.xmlgraphics.util.QName;
import org.apache.xmlgraphics.util.XMLizable;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
/**
* IFPainter implementation that serializes the intermediate format to XML.
*/
public class IFSerializer extends AbstractXMLWritingIFDocumentHandler implements
IFConstants, IFPainter, IFDocumentNavigationHandler {
private IFDocumentHandler mimicHandler;
private int pageSequenceIndex; // used for accessibility
/** Holds the intermediate format state */
private IFState state;
/**
* Default constructor.
*/
public IFSerializer() {
}
/** {@inheritDoc} */
@Override
protected String getMainNamespace() {
return NAMESPACE;
}
/** {@inheritDoc} */
@Override
public boolean supportsPagesOutOfOrder() {
return false;
// Theoretically supported but disabled to improve performance when
// rendering the IF to the final format later on
}
/** {@inheritDoc} */
@Override
public String getMimeType() {
return MIME_TYPE;
}
/** {@inheritDoc} */
@Override
public IFDocumentHandlerConfigurator getConfigurator() {
if (this.mimicHandler != null) {
return getMimickedDocumentHandler().getConfigurator();
} else {
return new PrintRendererConfigurator(getUserAgent());
}
}
/** {@inheritDoc} */
@Override
public IFDocumentNavigationHandler getDocumentNavigationHandler() {
return this;
}
/**
* Tells this serializer to mimic the given document handler (mostly applies
* to the font set that is used during layout).
*
* @param targetHandler
* the document handler to mimic
*/
public void mimicDocumentHandler(final IFDocumentHandler targetHandler) {
this.mimicHandler = targetHandler;
}
/**
* Returns the document handler that is being mimicked by this serializer.
*
* @return the mimicked document handler or null if no such document handler
* has been set
*/
public IFDocumentHandler getMimickedDocumentHandler() {
return this.mimicHandler;
}
/** {@inheritDoc} */
@Override
public FontInfo getFontInfo() {
if (this.mimicHandler != null) {
return this.mimicHandler.getFontInfo();
} else {
return null;
}
}
/** {@inheritDoc} */
@Override
public void setFontInfo(final FontInfo fontInfo) {
if (this.mimicHandler != null) {
this.mimicHandler.setFontInfo(fontInfo);
}
}
/** {@inheritDoc} */
@Override
public void setDefaultFontInfo(final FontInfo fontInfo) {
if (this.mimicHandler != null) {
this.mimicHandler.setDefaultFontInfo(fontInfo);
}
}
/** {@inheritDoc} */
@Override
public void startDocument() throws IFException {
super.startDocument();
try {
this.handler.startDocument();
this.handler.startPrefixMapping("", NAMESPACE);
this.handler.startPrefixMapping(XLINK_PREFIX, XLINK_NAMESPACE);
this.handler.startPrefixMapping(
DocumentNavigationExtensionConstants.PREFIX,
DocumentNavigationExtensionConstants.NAMESPACE);
this.handler.startElement(EL_DOCUMENT);
} catch (final SAXException e) {
throw new IFException("SAX error in startDocument()", e);
}
}
/** {@inheritDoc} */
@Override
public void startDocumentHeader() throws IFException {
try {
this.handler.startElement(EL_HEADER);
} catch (final SAXException e) {
throw new IFException("SAX error in startDocumentHeader()", e);
}
}
/** {@inheritDoc} */
@Override
public void endDocumentHeader() throws IFException {
try {
this.handler.endElement(EL_HEADER);
} catch (final SAXException e) {
throw new IFException("SAX error in startDocumentHeader()", e);
}
}
/** {@inheritDoc} */
@Override
public void startDocumentTrailer() throws IFException {
try {
this.handler.startElement(EL_TRAILER);
} catch (final SAXException e) {
throw new IFException("SAX error in startDocumentTrailer()", e);
}
}
/** {@inheritDoc} */
@Override
public void endDocumentTrailer() throws IFException {
try {
this.handler.endElement(EL_TRAILER);
} catch (final SAXException e) {
throw new IFException("SAX error in endDocumentTrailer()", e);
}
}
/** {@inheritDoc} */
@Override
public void endDocument() throws IFException {
try {
this.handler.endElement(EL_DOCUMENT);
this.handler.endDocument();
finishDocumentNavigation();
} catch (final SAXException e) {
throw new IFException("SAX error in endDocument()", e);
}
}
/** {@inheritDoc} */
@Override
public void startPageSequence(final String id) throws IFException {
try {
final AttributesImpl atts = new AttributesImpl();
if (id != null) {
atts.addAttribute(XML_NAMESPACE, "id", "xml:id",
XMLConstants.CDATA, id);
}
final Locale lang = getContext().getLanguage();
if (lang != null) {
atts.addAttribute(XML_NAMESPACE, "lang", "xml:lang",
XMLConstants.CDATA, XMLUtil.toRFC3066(lang));
}
XMLUtil.addAttribute(atts, XMLConstants.XML_SPACE, "preserve");
addForeignAttributes(atts);
this.handler.startElement(EL_PAGE_SEQUENCE, atts);
if (getUserAgent().isAccessibilityEnabled()) {
final StructureTree structureTree = getUserAgent()
.getStructureTree();
this.handler.startElement(EL_STRUCTURE_TREE); // add structure
// tree
final NodeList nodes = structureTree
.getPageSequence(this.pageSequenceIndex++);
for (int i = 0, n = nodes.getLength(); i < n; ++i) {
final Node node = nodes.item(i);
new DOM2SAX(this.handler).writeFragment(node);
}
this.handler.endElement(EL_STRUCTURE_TREE);
}
} catch (final SAXException e) {
throw new IFException("SAX error in startPageSequence()", e);
}
}
/** {@inheritDoc} */
@Override
public void endPageSequence() throws IFException {
try {
this.handler.endElement(EL_PAGE_SEQUENCE);
} catch (final SAXException e) {
throw new IFException("SAX error in endPageSequence()", e);
}
}
/** {@inheritDoc} */
@Override
public void startPage(final int index, final String name,
final String pageMasterName, final Dimension size)
throws IFException {
try {
final AttributesImpl atts = new AttributesImpl();
addAttribute(atts, "index", Integer.toString(index));
addAttribute(atts, "name", name);
addAttribute(atts, "page-master-name", pageMasterName);
addAttribute(atts, "width", Integer.toString(size.width));
addAttribute(atts, "height", Integer.toString(size.height));
addForeignAttributes(atts);
this.handler.startElement(EL_PAGE, atts);
} catch (final SAXException e) {
throw new IFException("SAX error in startPage()", e);
}
}
/** {@inheritDoc} */
@Override
public void startPageHeader() throws IFException {
try {
this.handler.startElement(EL_PAGE_HEADER);
} catch (final SAXException e) {
throw new IFException("SAX error in startPageHeader()", e);
}
}
/** {@inheritDoc} */
@Override
public void endPageHeader() throws IFException {
try {
this.handler.endElement(EL_PAGE_HEADER);
} catch (final SAXException e) {
throw new IFException("SAX error in endPageHeader()", e);
}
}
/** {@inheritDoc} */
@Override
public IFPainter startPageContent() throws IFException {
try {
this.handler.startElement(EL_PAGE_CONTENT);
this.state = IFState.create();
return this;
} catch (final SAXException e) {
throw new IFException("SAX error in startPageContent()", e);
}
}
/** {@inheritDoc} */
@Override
public void endPageContent() throws IFException {
try {
this.state = null;
this.handler.endElement(EL_PAGE_CONTENT);
} catch (final SAXException e) {
throw new IFException("SAX error in endPageContent()", e);
}
}
/** {@inheritDoc} */
@Override
public void startPageTrailer() throws IFException {
try {
this.handler.startElement(EL_PAGE_TRAILER);
} catch (final SAXException e) {
throw new IFException("SAX error in startPageTrailer()", e);
}
}
/** {@inheritDoc} */
@Override
public void endPageTrailer() throws IFException {
try {
commitNavigation();
this.handler.endElement(EL_PAGE_TRAILER);
} catch (final SAXException e) {
throw new IFException("SAX error in endPageTrailer()", e);
}
}
/** {@inheritDoc} */
@Override
public void endPage() throws IFException {
try {
this.handler.endElement(EL_PAGE);
} catch (final SAXException e) {
throw new IFException("SAX error in endPage()", e);
}
}
// ---=== IFPainter ===---
/** {@inheritDoc} */
@Override
public void startViewport(final AffineTransform transform,
final Dimension size, final Rectangle clipRect) throws IFException {
startViewport(IFUtil.toString(transform), size, clipRect);
}
/** {@inheritDoc} */
@Override
public void startViewport(final AffineTransform[] transforms,
final Dimension size, final Rectangle clipRect) throws IFException {
startViewport(IFUtil.toString(transforms), size, clipRect);
}
private void startViewport(final String transform, final Dimension size,
final Rectangle clipRect) throws IFException {
try {
final AttributesImpl atts = new AttributesImpl();
if (transform != null && transform.length() > 0) {
addAttribute(atts, "transform", transform);
}
addAttribute(atts, "width", Integer.toString(size.width));
addAttribute(atts, "height", Integer.toString(size.height));
if (clipRect != null) {
addAttribute(atts, "clip-rect", IFUtil.toString(clipRect));
}
this.handler.startElement(EL_VIEWPORT, atts);
} catch (final SAXException e) {
throw new IFException("SAX error in startViewport()", e);
}
}
/** {@inheritDoc} */
@Override
public void endViewport() throws IFException {
try {
this.handler.endElement(EL_VIEWPORT);
} catch (final SAXException e) {
throw new IFException("SAX error in endViewport()", e);
}
}
/** {@inheritDoc} */
@Override
public void startGroup(final AffineTransform[] transforms)
throws IFException {
startGroup(IFUtil.toString(transforms));
}
/** {@inheritDoc} */
@Override
public void startGroup(final AffineTransform transform) throws IFException {
startGroup(IFUtil.toString(transform));
}
private void startGroup(final String transform) throws IFException {
try {
final AttributesImpl atts = new AttributesImpl();
if (transform != null && transform.length() > 0) {
addAttribute(atts, "transform", transform);
}
this.handler.startElement(EL_GROUP, atts);
} catch (final SAXException e) {
throw new IFException("SAX error in startGroup()", e);
}
}
/** {@inheritDoc} */
@Override
public void endGroup() throws IFException {
try {
this.handler.endElement(EL_GROUP);
} catch (final SAXException e) {
throw new IFException("SAX error in endGroup()", e);
}
}
/** {@inheritDoc} */
@Override
public void drawImage(final String uri, final Rectangle rect)
throws IFException {
try {
final AttributesImpl atts = new AttributesImpl();
addAttribute(atts, XLINK_HREF, uri);
addAttribute(atts, "x", Integer.toString(rect.x));
addAttribute(atts, "y", Integer.toString(rect.y));
addAttribute(atts, "width", Integer.toString(rect.width));
addAttribute(atts, "height", Integer.toString(rect.height));
addForeignAttributes(atts);
addStructurePointerAttribute(atts);
this.handler.element(EL_IMAGE, atts);
} catch (final SAXException e) {
throw new IFException("SAX error in startGroup()", e);
}
}
private void addForeignAttributes(final AttributesImpl atts)
throws SAXException {
final Map<QName, String> foreignAttributes = getContext()
.getForeignAttributes();
for (final Entry<QName, String> entry : foreignAttributes.entrySet()) {
addAttribute(atts, entry.getKey(), entry.getValue());
}
}
/** {@inheritDoc} */
@Override
public void drawImage(final Document doc, final Rectangle rect)
throws IFException {
try {
final AttributesImpl atts = new AttributesImpl();
addAttribute(atts, "x", Integer.toString(rect.x));
addAttribute(atts, "y", Integer.toString(rect.y));
addAttribute(atts, "width", Integer.toString(rect.width));
addAttribute(atts, "height", Integer.toString(rect.height));
addForeignAttributes(atts);
addStructurePointerAttribute(atts);
this.handler.startElement(EL_IMAGE, atts);
new DOM2SAX(this.handler).writeDocument(doc, true);
this.handler.endElement(EL_IMAGE);
} catch (final SAXException e) {
throw new IFException("SAX error in startGroup()", e);
}
}
private static String toString(final Paint paint) {
if (paint instanceof Color) {
return ColorUtil.colorToString((Color) paint);
} else {
throw new UnsupportedOperationException("Paint not supported: "
+ paint);
}
}
/** {@inheritDoc} */
@Override
public void clipRect(final Rectangle rect) throws IFException {
try {
final AttributesImpl atts = new AttributesImpl();
addAttribute(atts, "x", Integer.toString(rect.x));
addAttribute(atts, "y", Integer.toString(rect.y));
addAttribute(atts, "width", Integer.toString(rect.width));
addAttribute(atts, "height", Integer.toString(rect.height));
this.handler.element(EL_CLIP_RECT, atts);
} catch (final SAXException e) {
throw new IFException("SAX error in clipRect()", e);
}
}
/** {@inheritDoc} */
@Override
public void fillRect(final Rectangle rect, final Paint fill)
throws IFException {
if (fill == null) {
return;
}
try {
final AttributesImpl atts = new AttributesImpl();
addAttribute(atts, "x", Integer.toString(rect.x));
addAttribute(atts, "y", Integer.toString(rect.y));
addAttribute(atts, "width", Integer.toString(rect.width));
addAttribute(atts, "height", Integer.toString(rect.height));
addAttribute(atts, "fill", toString(fill));
this.handler.element(EL_RECT, atts);
} catch (final SAXException e) {
throw new IFException("SAX error in fillRect()", e);
}
}
/** {@inheritDoc} */
@Override
public void drawBorderRect(final Rectangle rect, final BorderProps before,
final BorderProps after, final BorderProps start,
final BorderProps end) throws IFException {
if (before == null && after == null && start == null && end == null) {
return;
}
try {
final AttributesImpl atts = new AttributesImpl();
addAttribute(atts, "x", Integer.toString(rect.x));
addAttribute(atts, "y", Integer.toString(rect.y));
addAttribute(atts, "width", Integer.toString(rect.width));
addAttribute(atts, "height", Integer.toString(rect.height));
if (before != null) {
addAttribute(atts, "before", before.toString());
}
if (after != null) {
addAttribute(atts, "after", after.toString());
}
if (start != null) {
addAttribute(atts, "start", start.toString());
}
if (end != null) {
addAttribute(atts, "end", end.toString());
}
this.handler.element(EL_BORDER_RECT, atts);
} catch (final SAXException e) {
throw new IFException("SAX error in drawBorderRect()", e);
}
}
/** {@inheritDoc} */
@Override
public void drawLine(final Point start, final Point end, final int width,
final Color color, final RuleStyle style) throws IFException {
try {
final AttributesImpl atts = new AttributesImpl();
addAttribute(atts, "x1", Integer.toString(start.x));
addAttribute(atts, "y1", Integer.toString(start.y));
addAttribute(atts, "x2", Integer.toString(end.x));
addAttribute(atts, "y2", Integer.toString(end.y));
addAttribute(atts, "stroke-width", Integer.toString(width));
addAttribute(atts, "color", ColorUtil.colorToString(color));
addAttribute(atts, "style", style.getName());
this.handler.element(EL_LINE, atts);
} catch (final SAXException e) {
throw new IFException("SAX error in drawLine()", e);
}
}
/** {@inheritDoc} */
@Override
public void drawText(final int x, final int y, final int letterSpacing,
final int wordSpacing, final int[] dx, final String text)
throws IFException {
try {
final AttributesImpl atts = new AttributesImpl();
addAttribute(atts, "x", Integer.toString(x));
addAttribute(atts, "y", Integer.toString(y));
if (letterSpacing != 0) {
addAttribute(atts, "letter-spacing",
Integer.toString(letterSpacing));
}
if (wordSpacing != 0) {
addAttribute(atts, "word-spacing",
Integer.toString(wordSpacing));
}
if (dx != null) {
addAttribute(atts, "dx", IFUtil.toString(dx));
}
addStructurePointerAttribute(atts);
this.handler.startElement(EL_TEXT, atts);
final char[] chars = text.toCharArray();
this.handler.characters(chars, 0, chars.length);
this.handler.endElement(EL_TEXT);
} catch (final SAXException e) {
throw new IFException("SAX error in setFont()", e);
}
}
/** {@inheritDoc} */
@Override
public void setFont(final String family, final String style,
final Integer weight, final String variant, final Integer size,
final Color color) throws IFException {
try {
final AttributesImpl atts = new AttributesImpl();
boolean changed;
if (family != null) {
changed = !family.equals(this.state.getFontFamily());
if (changed) {
this.state.setFontFamily(family);
addAttribute(atts, "family", family);
}
}
if (style != null) {
changed = !style.equals(this.state.getFontStyle());
if (changed) {
this.state.setFontStyle(style);
addAttribute(atts, "style", style);
}
}
if (weight != null) {
changed = weight.intValue() != this.state.getFontWeight();
if (changed) {
this.state.setFontWeight(weight.intValue());
addAttribute(atts, "weight", weight.toString());
}
}
if (variant != null) {
changed = !variant.equals(this.state.getFontVariant());
if (changed) {
this.state.setFontVariant(variant);
addAttribute(atts, "variant", variant);
}
}
if (size != null) {
changed = size.intValue() != this.state.getFontSize();
if (changed) {
this.state.setFontSize(size.intValue());
addAttribute(atts, "size", size.toString());
}
}
if (color != null) {
changed = !color.equals(this.state.getTextColor());
if (changed) {
this.state.setTextColor(color);
addAttribute(atts, "color", toString(color));
}
}
if (atts.getLength() > 0) {
this.handler.element(EL_FONT, atts);
}
} catch (final SAXException e) {
throw new IFException("SAX error in setFont()", e);
}
}
/** {@inheritDoc} */
@Override
public void handleExtensionObject(final Object extension)
throws IFException {
if (extension instanceof XMLizable) {
try {
((XMLizable) extension).toSAX(this.handler);
} catch (final SAXException e) {
throw new IFException(
"SAX error while handling extension object", e);
}
} else {
throw new UnsupportedOperationException(
"Extension must implement XMLizable: " + extension + " ("
+ extension.getClass().getName() + ")");
}
}
/** {@inheritDoc} */
protected RenderingContext createRenderingContext() {
throw new IllegalStateException("Should never be called!");
}
private void addAttribute(final AttributesImpl atts,
final org.apache.xmlgraphics.util.QName attribute,
final String value) throws SAXException {
this.handler.startPrefixMapping(attribute.getPrefix(),
attribute.getNamespaceURI());
XMLUtil.addAttribute(atts, attribute, value);
}
private void addAttribute(final AttributesImpl atts,
final String localName, final String value) {
XMLUtil.addAttribute(atts, localName, value);
}
private void addStructurePointerAttribute(final AttributesImpl atts) {
final String ptr = getContext().getStructurePointer();
if (ptr != null) {
addAttribute(atts, "ptr", ptr);
}
}
// ---=== IFDocumentNavigationHandler ===---
private final Map<String, AbstractAction> incompleteActions = new HashMap<>();
private final List<AbstractAction> completeActions = new LinkedList<>();
private void noteAction(final AbstractAction action) {
if (action == null) {
throw new NullPointerException("action must not be null");
}
if (!action.isComplete()) {
assert action.hasID();
this.incompleteActions.put(action.getID(), action);
}
}
/** {@inheritDoc} */
@Override
public void renderNamedDestination(final NamedDestination destination)
throws IFException {
noteAction(destination.getAction());
final AttributesImpl atts = new AttributesImpl();
atts.addAttribute(null, "name", "name", XMLConstants.CDATA,
destination.getName());
try {
this.handler.startElement(
DocumentNavigationExtensionConstants.NAMED_DESTINATION,
atts);
serializeXMLizable(destination.getAction());
this.handler
.endElement(DocumentNavigationExtensionConstants.NAMED_DESTINATION);
} catch (final SAXException e) {
throw new IFException("SAX error serializing named destination", e);
}
}
/** {@inheritDoc} */
@Override
public void renderBookmarkTree(final BookmarkTree tree) throws IFException {
final AttributesImpl atts = new AttributesImpl();
try {
this.handler.startElement(
DocumentNavigationExtensionConstants.BOOKMARK_TREE, atts);
for (final Bookmark b : tree.getBookmarks()) {
serializeBookmark(b);
}
this.handler
.endElement(DocumentNavigationExtensionConstants.BOOKMARK_TREE);
} catch (final SAXException e) {
throw new IFException("SAX error serializing bookmark tree", e);
}
}
private void serializeBookmark(final Bookmark bookmark)
throws SAXException, IFException {
noteAction(bookmark.getAction());
final AttributesImpl atts = new AttributesImpl();
atts.addAttribute(null, "title", "title", XMLConstants.CDATA,
bookmark.getTitle());
atts.addAttribute(null, "starting-state", "starting-state",
XMLConstants.CDATA, bookmark.isShown() ? "show" : "hide");
this.handler.startElement(
DocumentNavigationExtensionConstants.BOOKMARK, atts);
serializeXMLizable(bookmark.getAction());
for (final Bookmark b : bookmark.getChildBookmarks()) {
serializeBookmark(b);
}
this.handler.endElement(DocumentNavigationExtensionConstants.BOOKMARK);
}
/** {@inheritDoc} */
@Override
public void renderLink(final Link link) throws IFException {
noteAction(link.getAction());
final AttributesImpl atts = new AttributesImpl();
atts.addAttribute(null, "rect", "rect", XMLConstants.CDATA,
IFUtil.toString(link.getTargetRect()));
if (getUserAgent().isAccessibilityEnabled()) {
addAttribute(atts, "ptr", link.getAction().getStructurePointer());
}
try {
this.handler.startElement(
DocumentNavigationExtensionConstants.LINK, atts);
serializeXMLizable(link.getAction());
this.handler.endElement(DocumentNavigationExtensionConstants.LINK);
} catch (final SAXException e) {
throw new IFException("SAX error serializing link", e);
}
}
/** {@inheritDoc} */
@Override
public void addResolvedAction(final AbstractAction action) {
assert action.isComplete();
assert action.hasID();
final AbstractAction noted = this.incompleteActions.remove(action
.getID());
if (noted != null) {
this.completeActions.add(action);
} else {
// ignore as it was already complete when it was first used.
}
}
private void commitNavigation() throws IFException {
final Iterator<AbstractAction> iter = this.completeActions.iterator();
while (iter.hasNext()) {
final AbstractAction action = iter.next();
iter.remove();
serializeXMLizable(action);
}
assert this.completeActions.size() == 0;
}
private void finishDocumentNavigation() {
assert this.incompleteActions.size() == 0 : "Still holding incomplete actions!";
}
private void serializeXMLizable(final XMLizable object) throws IFException {
try {
object.toSAX(this.handler);
} catch (final SAXException e) {
throw new IFException("SAX error serializing object", e);
}
}
}
| [
"[email protected]"
]
| |
fa7ec3463520df6bb2eb973922ccaa35a53f23df | 61c2d0696290605dece95151393fcee6a333479e | /app/src/main/java/me/zhaoliufeng/mylab/lab/WidgetProvider.java | c16f80f1acf522c503cd765b7a7ec5160c109696 | []
| no_license | zhaoliufeng/MyLab | cf5d7980f366055fe65c0e18cfca0db0a9136181 | ebb18673e5eb2e172bf09ded4eeb9f342269c3d1 | refs/heads/master | 2020-12-03T00:29:49.735632 | 2018-01-21T16:26:02 | 2018-01-21T16:26:02 | 96,036,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,971 | java | package me.zhaoliufeng.mylab.lab;
import android.app.LauncherActivity;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.RemoteViews;
import android.widget.Toast;
import me.zhaoliufeng.mylab.MainActivity;
import me.zhaoliufeng.mylab.R;
public class WidgetProvider extends AppWidgetProvider {
public static final String CLICK_ACTION = "me.zhaoliufeng.mylab.lab.action.CLICK"; // 点击事件的广播ACTION
public static final String CLICK_CIRCLE_ACTION = "me.zhaoliufeng.mylab.lab.action.CIRCLE_CLICK";
/**
* 每次窗口小部件被更新都调用一次该方法
*/
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
super.onUpdate(context, appWidgetManager, appWidgetIds);
// RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.app_widget);
// Intent intent = new Intent(context, MainActivity.class);
// PendingIntent pendingIntent = PendingIntent.getBroadcast(context, R.id.img_logo, intent, PendingIntent.FLAG_UPDATE_CURRENT);
// remoteViews.setOnClickPendingIntent(R.id.img_logo, pendingIntent);
// ComponentName myComponentName = new ComponentName(context, LauncherActivity.class);
// AppWidgetManager myAppWidgetManager = AppWidgetManager.getInstance(context);
//
// myAppWidgetManager.updateAppWidget(myComponentName, remoteViews);
for (int appWidgetId : appWidgetIds) {
System.out.println(appWidgetId);
Intent intent = new Intent(context, MainActivity.class);
intent.setAction("AAA");
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.app_widget);
remoteViews.setOnClickPendingIntent(R.id.img_logo, pendingIntent);
appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
}
}
/**
* 接收窗口小部件点击时发送的广播
*/
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
if (CLICK_ACTION.equals(intent.getAction())) {
Toast.makeText(context, "hello!", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onEnabled(Context context) {
super.onEnabled(context);
Toast.makeText(context, "被添加到桌面上了", Toast.LENGTH_SHORT).show();
}
@Override
public void onDeleted(Context context, int[] appWidgetIds) {
super.onDeleted(context, appWidgetIds);
Toast.makeText(context, "被移除了", Toast.LENGTH_SHORT).show();
}
}
| [
"[email protected]"
]
| |
57fbdf19402c737980f33ccd72527085a5ac77ef | a93a0b282e7a6281d3188b9549e070f993bb33e1 | /modules/basic/basic-api/src/main/java/basic/exception/NoSuchEventFAQsException.java | 3184da29d10a219e7c08a63867bbc97c85ac1fd4 | []
| no_license | micha-mn/youth | e12e15d8a1c0e644ecca8b2b36971cc556261884 | 3044dd068a4a5ef770a08c4ad9c8fdd42febf604 | refs/heads/master | 2020-09-25T00:48:28.565275 | 2019-12-09T11:37:08 | 2019-12-09T11:37:08 | 225,882,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library 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 library 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.
*/
package basic.exception;
import org.osgi.annotation.versioning.ProviderType;
import com.liferay.portal.kernel.exception.NoSuchModelException;
/**
* @author Brian Wing Shun Chan
*/
@ProviderType
public class NoSuchEventFAQsException extends NoSuchModelException {
public NoSuchEventFAQsException() {
}
public NoSuchEventFAQsException(String msg) {
super(msg);
}
public NoSuchEventFAQsException(String msg, Throwable cause) {
super(msg, cause);
}
public NoSuchEventFAQsException(Throwable cause) {
super(cause);
}
} | [
"[email protected]"
]
| |
24251db20b1a78419ab642cf1b98e6890800b8a1 | 105fe9f7fcb7b98f938cf109502aab04279ba969 | /Nanodegree/GreatWeddingMusicPlayer/GreatWedding/app/build/generated/source/r/debug/android/support/coreutils/R.java | a8a96b9c414bc7a073594ee38c4ce3a397093486 | []
| no_license | misiasobiekodzi/GoogleScholarshipAndroidBasics | 55082ec7a648f76175c14587aaaaf4716c841437 | b4dab38caf596f337e9ca0a66daeda4e399e2648 | refs/heads/master | 2021-09-19T11:46:25.716911 | 2018-07-27T16:10:32 | 2018-07-27T16:10:32 | 112,959,428 | 0 | 0 | null | 2018-06-10T15:48:38 | 2017-12-03T20:04:47 | Java | UTF-8 | Java | false | false | 7,922 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.coreutils;
public final class R {
public static final class attr {
public static final int font = 0x7f020078;
public static final int fontProviderAuthority = 0x7f02007a;
public static final int fontProviderCerts = 0x7f02007b;
public static final int fontProviderFetchStrategy = 0x7f02007c;
public static final int fontProviderFetchTimeout = 0x7f02007d;
public static final int fontProviderPackage = 0x7f02007e;
public static final int fontProviderQuery = 0x7f02007f;
public static final int fontStyle = 0x7f020080;
public static final int fontWeight = 0x7f020081;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f030000;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f040046;
public static final int notification_icon_bg_color = 0x7f040047;
public static final int ripple_material_light = 0x7f040052;
public static final int secondary_text_default_material_light = 0x7f040054;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f05004b;
public static final int compat_button_inset_vertical_material = 0x7f05004c;
public static final int compat_button_padding_horizontal_material = 0x7f05004d;
public static final int compat_button_padding_vertical_material = 0x7f05004e;
public static final int compat_control_corner_material = 0x7f05004f;
public static final int notification_action_icon_size = 0x7f05005d;
public static final int notification_action_text_size = 0x7f05005e;
public static final int notification_big_circle_margin = 0x7f05005f;
public static final int notification_content_margin_start = 0x7f050060;
public static final int notification_large_icon_height = 0x7f050061;
public static final int notification_large_icon_width = 0x7f050062;
public static final int notification_main_column_padding_top = 0x7f050063;
public static final int notification_media_narrow_margin = 0x7f050064;
public static final int notification_right_icon_size = 0x7f050065;
public static final int notification_right_side_padding_top = 0x7f050066;
public static final int notification_small_icon_background_padding = 0x7f050067;
public static final int notification_small_icon_size_as_large = 0x7f050068;
public static final int notification_subtext_size = 0x7f050069;
public static final int notification_top_pad = 0x7f05006a;
public static final int notification_top_pad_large_text = 0x7f05006b;
}
public static final class drawable {
public static final int notification_action_background = 0x7f060059;
public static final int notification_bg = 0x7f06005a;
public static final int notification_bg_low = 0x7f06005b;
public static final int notification_bg_low_normal = 0x7f06005c;
public static final int notification_bg_low_pressed = 0x7f06005d;
public static final int notification_bg_normal = 0x7f06005e;
public static final int notification_bg_normal_pressed = 0x7f06005f;
public static final int notification_icon_background = 0x7f060060;
public static final int notification_template_icon_bg = 0x7f060061;
public static final int notification_template_icon_low_bg = 0x7f060062;
public static final int notification_tile_bg = 0x7f060063;
public static final int notify_panel_notification_icon_bg = 0x7f060064;
}
public static final class id {
public static final int action_container = 0x7f07000d;
public static final int action_divider = 0x7f07000f;
public static final int action_image = 0x7f070010;
public static final int action_text = 0x7f070016;
public static final int actions = 0x7f070017;
public static final int async = 0x7f07001f;
public static final int blocking = 0x7f070022;
public static final int chronometer = 0x7f07002a;
public static final int forever = 0x7f07003f;
public static final int icon = 0x7f070046;
public static final int icon_group = 0x7f070047;
public static final int info = 0x7f07004a;
public static final int italic = 0x7f07004c;
public static final int line1 = 0x7f07004f;
public static final int line3 = 0x7f070050;
public static final int normal = 0x7f070059;
public static final int notification_background = 0x7f07005a;
public static final int notification_main_column = 0x7f07005b;
public static final int notification_main_column_container = 0x7f07005c;
public static final int right_icon = 0x7f070066;
public static final int right_side = 0x7f070067;
public static final int tag_transition_group = 0x7f07008a;
public static final int text = 0x7f07008b;
public static final int text2 = 0x7f07008c;
public static final int time = 0x7f07008f;
public static final int title = 0x7f070090;
}
public static final class integer {
public static final int status_bar_notification_info_maxnum = 0x7f080004;
}
public static final class layout {
public static final int notification_action = 0x7f09001d;
public static final int notification_action_tombstone = 0x7f09001e;
public static final int notification_template_custom_big = 0x7f09001f;
public static final int notification_template_icon_group = 0x7f090020;
public static final int notification_template_part_chronometer = 0x7f090021;
public static final int notification_template_part_time = 0x7f090022;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0b0028;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0c00ea;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00eb;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ec;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ed;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00ee;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0156;
public static final int Widget_Compat_NotificationActionText = 0x7f0c0157;
}
public static final class styleable {
public static final int[] FontFamily = { 0x7f02007a, 0x7f02007b, 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x7f020078, 0x7f020080, 0x7f020081 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_font = 3;
public static final int FontFamilyFont_fontStyle = 4;
public static final int FontFamilyFont_fontWeight = 5;
}
}
| [
"[email protected]"
]
| |
02415494c761b59dbc227d23a99eb6dadfab5bd2 | c908d6a58a7e79f684f9d430fa39ba34f8a320c8 | /eclipse/portal/plugins/com.liferay.ide.eclipse.taglib.ui/src/com/liferay/ide/eclipse/taglib/ui/snippets/AlloyTagItemHelper.java | 24ea1e2396cc3cf6820d88f39bab267b602e8634 | []
| no_license | admhouss/liferay-ide | b2f08294c6ac5d8dc909b97236f3006cd1f734e5 | 3b8b0bf1b98cd79b8dc794c4bd4fe4dc086fde34 | refs/heads/master | 2021-01-18T08:36:01.718248 | 2012-10-12T06:21:24 | 2012-10-12T06:21:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,929 | java | /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.liferay.ide.eclipse.taglib.ui.snippets;
import com.liferay.ide.eclipse.core.util.CoreUtil;
import com.liferay.ide.eclipse.taglib.ui.TaglibUI;
import com.liferay.ide.eclipse.taglib.ui.model.ITag;
import com.liferay.ide.eclipse.ui.snippets.SnippetsUIPlugin;
import java.io.File;
import java.io.StringWriter;
import java.net.URL;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.jface.window.Window;
import org.eclipse.sapphire.modeling.xml.RootXmlResource;
import org.eclipse.sapphire.modeling.xml.XmlResourceStore;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.wst.common.snippets.core.ISnippetItem;
import org.eclipse.wst.common.snippets.core.ISnippetsEntry;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.json.JSONObject;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Class copied from VariableItemHelper.java v1.4
*
* @author Greg Amerson
*/
@SuppressWarnings("restriction")
public class AlloyTagItemHelper {
public static String getInsertString(Shell host, ISnippetItem item, IEditorInput editorInput) {
return getInsertString(host, item, editorInput, true);
}
public static String getInsertString(final Shell host, ISnippetItem item, IEditorInput editorInput, boolean clearModality) {
if (item == null)
return ""; //$NON-NLS-1$
String insertString = null;
ITag model = getTagModel(editorInput, item);
AlloyTagInsertDialog dialog =
new AlloyTagInsertDialog( host, model, TaglibUI.PLUGIN_ID +
"/com/liferay/ide/eclipse/taglib/ui/snippets/AlloyTag.sdef!tagInsertDialog", clearModality );
// VariableInsertionDialog dialog = new TaglibVariableInsertionDialog(host, clearModality);
// dialog.setItem(item);
// The editor itself influences the insertion's actions, so we
// can't
// allow the active editor to be changed.
// Disabling the parent shell achieves psuedo-modal behavior
// without
// locking the UI under Linux
int result = Window.CANCEL;
try {
if (clearModality) {
host.setEnabled(false);
dialog.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent arg0) {
/*
* The parent shell must be reenabled when the dialog disposes, otherwise it won't automatically
* receive focus.
*/
host.setEnabled(true);
}
});
}
result = dialog.open();
}
catch (Exception t) {
SnippetsUIPlugin.logError(t);
}
finally {
if (clearModality) {
host.setEnabled(true);
}
}
if (result == Window.OK) {
insertString = dialog.getPreparedText();
}
else {
insertString = null;
}
return insertString;
}
private static ITag getTagModel(IEditorInput editorInput, ISnippetsEntry item) {
if (!(editorInput instanceof IFileEditorInput) || item == null) {
return null;
}
IFile tldFile = null;
XmlResourceStore store = null;
IFile editorFile = ((IFileEditorInput) editorInput).getFile();
Document tldDocument = null;
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
tldFile = CoreUtil.getDocroot(editorFile.getProject()).getFile("WEB-INF/tld/alloy.tld");
if (tldFile.exists()) {
try {
IDOMModel tldModel = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead( tldFile );
tldDocument = tldModel.getDocument();
}
catch (Exception e) {
SnippetsUIPlugin.logError(e);
}
}
else {
// read alloy from plugin
try {
URL alloyURL = FileLocator.toFileURL( TaglibUI.getDefault().getBundle().getEntry( "deps/alloy.tld" ) );
File alloyFile = new File(alloyURL.getFile());
tldDocument = docFactory.newDocumentBuilder().parse(alloyFile);
}
catch (Exception e) {
SnippetsUIPlugin.logError(e);
}
}
if (tldDocument == null) {
return null;
}
try {
NodeList tags = tldDocument.getElementsByTagName("tag");
Element alloyTag = null;
for (int i = 0; i < tags.getLength(); i++) {
Element tag = (Element) tags.item(i);
NodeList children = tag.getElementsByTagName("name");
if (children.getLength() > 0) {
String name = children.item(0).getChildNodes().item(0).getNodeValue();
if (item.getLabel().equals(name)) {
alloyTag = tag;
break;
}
}
}
if (alloyTag == null) {
return null;
}
// build XML model to be used by sapphire dialog
DocumentBuilder newDocumentBuilder = docFactory.newDocumentBuilder();
Document doc = newDocumentBuilder.newDocument();
Element destTag = doc.createElement("tag");
Element name = doc.createElement("name");
name.appendChild(doc.createTextNode(item.getLabel()));
destTag.appendChild(name);
Element prefix = doc.createElement("prefix");
prefix.appendChild(doc.createTextNode("alloy"));
destTag.appendChild(prefix);
Element required = (Element) destTag.appendChild(doc.createElement("required"));
Element events = (Element) destTag.appendChild(doc.createElement("events"));
Element other = (Element) destTag.appendChild(doc.createElement("other"));
NodeList attrs = alloyTag.getElementsByTagName("attribute");
for (int i = 0; i < attrs.getLength(); i++) {
try {
Element attr = (Element) attrs.item(i);
String desc =
( (Element) attr.getElementsByTagName( "description" ).item( 0 ) ).getFirstChild().getNodeValue();
String json = desc.substring(desc.indexOf("<!--") + 4, desc.indexOf("-->"));
JSONObject jsonObject = new JSONObject(json);
Node newAttr = null;
if (jsonObject.getBoolean("required")) {
newAttr = required.appendChild(doc.importNode(attr, true));
}
else if (jsonObject.getBoolean("event")) {
newAttr = events.appendChild(doc.importNode(attr, true));
}
else {
newAttr = other.appendChild(doc.importNode(attr, true));
}
if (jsonObject.has("defaultValue")) {
Element defaultValElement = doc.createElement("default-value");
defaultValElement.appendChild(doc.createTextNode(jsonObject.get("defaultValue").toString()));
newAttr.appendChild(defaultValElement);
}
}
catch (Exception e) {
TaglibUI.logError( e );
}
}
doc.appendChild(destTag);
Transformer trans = TransformerFactory.newInstance().newTransformer();
trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
// create string from xml tree
StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(sw);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);
String xmlString = sw.toString();
store = new XmlResourceStore(xmlString.getBytes());
}
catch (Exception e) {
TaglibUI.logError( e );
}
return ITag.TYPE.instantiate(new RootXmlResource(store));
}
}
| [
"[email protected]"
]
| |
2a5074c4da8a1f555aba141dd56676c742ab0494 | d5bc62d4e2a2e0485e996db6d18e4e4909e08a97 | /src/main/java/com/gp/webdriverapi/system/service/FolderService.java | 179b8bff826ff412760a3af49918fa3b00da14a6 | []
| no_license | Aim-Tric/web-driver-api | 890aec5f2edc6fcc9b5e09c42a6659a795393af4 | faa298ffaa3e2c8aa841ed1f2a3047a1a39acbb6 | refs/heads/master | 2022-02-23T07:32:16.583667 | 2021-04-27T00:14:33 | 2021-04-27T00:14:33 | 248,004,778 | 2 | 0 | null | 2022-02-09T22:25:53 | 2020-03-17T15:25:49 | Java | UTF-8 | Java | false | false | 425 | java | package com.gp.webdriverapi.system.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gp.webdriverapi.common.pojo.WdFolder;
import com.gp.webdriverapi.system.mapper.FolderMapper;
import org.springframework.stereotype.Service;
/**
* 文件夹管理服务
*
* @author Devonte
* @date 2020/03/15
*/
@Service
public class FolderService extends ServiceImpl<FolderMapper, WdFolder> {
}
| [
"[email protected]"
]
| |
c788df72f20f9b48cf85169df9fa5ec89e08a6c9 | 3df0d1c29c3d936cf5bc94659bf7db2d76c9f80e | /hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/NMController.java | ba8e41bfd68cc54edfb058cd99e948b43be0a29e | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | lalithsuresh/Scaling-HDFS-NameNode | 657046f0a6c15a1ff4acd79f87768c0238c06544 | 84c1f946fecad3449e47b6f4c529425ee757d894 | HEAD | 2016-09-10T12:57:33.128309 | 2012-01-02T23:48:03 | 2012-01-02T23:48:03 | 2,349,183 | 22 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,900 | 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 org.apache.hadoop.yarn.server.nodemanager.webapp;
import static org.apache.hadoop.yarn.util.StringHelper.join;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.server.nodemanager.NMConfig;
import org.apache.hadoop.yarn.webapp.Controller;
import com.google.inject.Inject;
public class NMController extends Controller implements NMWebParams {
@Inject
public NMController(Configuration nmConf, RequestContext requestContext) {
super(requestContext);
}
@Override
// TODO: What use of this with info() in?
public void index() {
setTitle(join("NodeManager - ", $(NM_NODENAME)));
}
public void info() {
render(NodePage.class);
}
public void node() {
render(NodePage.class);
}
public void allApplications() {
render(AllApplicationsPage.class);
}
public void allContainers() {
render(AllContainersPage.class);
}
public void application() {
render(ApplicationPage.class);
}
public void container() {
render(ContainerPage.class);
}
public void logs() {
render(ContainerLogsPage.class);
}
}
| [
"[email protected]"
]
| |
b2f223c4300bb97090e097c7dc5934f0a4c36961 | 5b55c12f1e60ea2c0f094bf6e973e9150bbda57f | /cloudviewservice_device/src/main/java/com/ssitcloud/view/sysmgmt/service/impl/DataBaseServiceImpl.java | e9184c3549384116a6e139964ff10795aeb78900 | []
| no_license | huguodong/Cloud-4 | f18a8f471efbb2167e639e407478bf808d1830c2 | 3facaf5fc3d585c938ecc93e89a6a4a7d35e5bcc | refs/heads/master | 2020-03-27T22:59:41.109723 | 2018-08-24T01:42:39 | 2018-08-24T01:43:04 | 147,279,899 | 0 | 0 | null | 2018-09-04T02:54:28 | 2018-09-04T02:54:28 | null | UTF-8 | Java | false | false | 2,636 | java | package com.ssitcloud.view.sysmgmt.service.impl;
import org.springframework.stereotype.Service;
import com.ssitcloud.common.entity.ResultEntity;
import com.ssitcloud.view.common.service.impl.BasicServiceImpl;
import com.ssitcloud.view.sysmgmt.service.DataBaseService;
@Service
public class DataBaseServiceImpl extends BasicServiceImpl implements DataBaseService{
public static final String URL_backUp="backUp";
public static final String URL_queryDbBakByparam="queryDbBakByparam";
private static final String URL_deleteBakup = "deleteBakup";
private static final String URL_getLastBakUpTime = "getLastBakUpTime";
private static final String URL_restoreBakup = "restoreBakup";
private static final String URL_getMongodbNames = "getMongodbNames";
private static final String URL_bakupByLibraryIdx = "bakupByLibraryIdx";
private static final String URL_restoreDataByLibraryIdx = "restoreDataByLibraryIdx";
private static final String URL_queryLibraryDbBakByparamExt = "queryLibraryDbBakByparamExt";
private static final String URL_checkBakUpFileIfExsit = "checkBakUpFileIfExsit";
private static final String URL_deleteLibBakup = "deleteLibBakup";
private static final String URL_getLastLibBakUpTime = "getLastLibBakUpTime";
@Override
public ResultEntity backUp(String req) {
return postUrlLongTimeout(URL_backUp, req);
}
@Override
public ResultEntity queryDbBakByparam(String req) {
return postUrl(URL_queryDbBakByparam, req);
}
@Override
public ResultEntity deleteBakup(String req) {
return postUrl(URL_deleteBakup, req);
}
@Override
public ResultEntity getLastBakUpTime(String req) {
return postUrl(URL_getLastBakUpTime, req);
}
@Override
public ResultEntity restoreBakup(String req) {
return postUrlLongTimeout(URL_restoreBakup, req);
}
@Override
public ResultEntity getMongodbNames(String req) {
return postUrl(URL_getMongodbNames, req);
}
@Override
public ResultEntity bakupByLibraryIdx(String req) {
return postUrl(URL_bakupByLibraryIdx, req);
}
@Override
public ResultEntity restoreDataByLibraryIdx(String req) {
return postUrlLongTimeout(URL_restoreDataByLibraryIdx, req);
}
@Override
public ResultEntity queryLibraryDbBakByparamExt(String req) {
return postUrl(URL_queryLibraryDbBakByparamExt, req);
}
@Override
public ResultEntity checkBakUpFileIfExsit(String req) {
return postUrl(URL_checkBakUpFileIfExsit, req);
}
@Override
public ResultEntity deleteLibBakup(String req) {
return postUrl(URL_deleteLibBakup, req);
}
@Override
public ResultEntity getLastLibBakUpTime(String req) {
return postUrl(URL_getLastLibBakUpTime, req);
}
}
| [
"chenkun141@163com"
]
| chenkun141@163com |
e93cdabb0e449638325eb6d9920d62e53f2abe20 | 1a0d44f08c3b2c6ff8bc101947275a0824a74381 | /app/src/main/java/com/nrs/rsrey/bloodbank/dagger/modules/ContextModule.java | 0bb6ae8c38748be4fb0c79f5d79eeef8a3562188 | []
| no_license | rewantsoni/BloodBank | 4b059e19d52d099059f10f5f13378bb63af135b1 | 963735a0f2b515ef3d578c2e33144fcfab53ceaf | refs/heads/master | 2021-07-20T10:31:35.926645 | 2017-10-26T09:12:31 | 2017-10-26T09:12:31 | 107,804,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | package com.nrs.rsrey.bloodbank.dagger.modules;
import android.content.Context;
import com.nrs.rsrey.bloodbank.dagger.qualifiers.ApplicationQualifier;
import org.jetbrains.annotations.NotNull;
import dagger.Module;
import dagger.Provides;
@Module
public class ContextModule {
private final Context mContext;
public ContextModule(Context mContext) {
this.mContext = mContext;
}
@NotNull
@Provides
@ApplicationQualifier
Context provideContext() {
return this.mContext;
}
}
| [
"[email protected]"
]
| |
ae71dbba4492cc394b321a052bc7c1c947034197 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/19/19_bcc44879058bc93a956f63571ba31a4a5ec737c3/SpoutEntity/19_bcc44879058bc93a956f63571ba31a4a5ec737c3_SpoutEntity_s.java | 7dd8eff3f5ffab3975b2e8c1671e67a56ffe8787 | []
| 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 | 22,418 | java | /*
* This file is part of Spout (http://www.spout.org/).
*
* Spout is licensed under the SpoutDev License Version 1.
*
* Spout 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 3 of the License, or
* (at your option) any later version.
*
* In addition, 180 days after any changes are published, you can use the
* software, incorporating those changes, under the terms of the MIT license,
* as described in the SpoutDev License Version 1.
*
* Spout 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,
* the MIT license and the SpoutDev License Version 1 along with this program.
* If not, see <http://www.gnu.org/licenses/> for the GNU Lesser General Public
* License and see <http://www.spout.org/SpoutDevLicenseV1.txt> for the full license,
* including the MIT license.
*/
package org.spout.engine.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import org.spout.api.Source;
import org.spout.api.Spout;
import org.spout.api.collision.CollisionModel;
import org.spout.api.collision.CollisionStrategy;
import org.spout.api.collision.CollisionVolume;
import org.spout.api.datatable.DatatableTuple;
import org.spout.api.datatable.GenericDatatableMap;
import org.spout.api.datatable.value.DatatableBool;
import org.spout.api.datatable.value.DatatableFloat;
import org.spout.api.datatable.value.DatatableInt;
import org.spout.api.datatable.value.DatatableSerializable;
import org.spout.api.entity.Controller;
import org.spout.api.entity.Entity;
import org.spout.api.entity.PlayerController;
import org.spout.api.entity.component.EntityComponent;
import org.spout.api.event.entity.EntityControllerChangeEvent;
import org.spout.api.event.entity.EntityHealthChangeEvent;
import org.spout.api.geo.World;
import org.spout.api.geo.cuboid.Chunk;
import org.spout.api.geo.cuboid.Region;
import org.spout.api.geo.discrete.Point;
import org.spout.api.geo.discrete.Transform;
import org.spout.api.inventory.Inventory;
import org.spout.api.math.MathHelper;
import org.spout.api.math.Quaternion;
import org.spout.api.math.Vector3;
import org.spout.api.model.Model;
import org.spout.api.player.Player;
import org.spout.api.util.concurrent.OptimisticReadWriteLock;
import org.spout.engine.SpoutConfiguration;
import org.spout.engine.SpoutEngine;
import org.spout.engine.protocol.SpoutSession;
import org.spout.engine.world.SpoutChunk;
import org.spout.engine.world.SpoutRegion;
import org.spout.engine.world.SpoutWorld;
public class SpoutEntity implements Entity {
public static final int NOTSPAWNEDID = -1;
//Thread-safe
private final AtomicReference<EntityManager> entityManagerLive;
private final AtomicReference<Controller> controllerLive;
private final AtomicReference<Chunk> chunkLive;
private final ArrayList<AtomicReference<EntityComponent>> components = new ArrayList<AtomicReference<EntityComponent>>();
private final AtomicBoolean observerLive = new AtomicBoolean(false);
private final AtomicInteger health = new AtomicInteger(1), maxHealth = new AtomicInteger(1);
private final AtomicInteger id = new AtomicInteger();
private final AtomicInteger viewDistanceLive = new AtomicInteger();
private static final long serialVersionUID = 1L;
private static final Transform DEAD = new Transform(Point.invalid, Quaternion.IDENTITY, Vector3.ZERO);
private final OptimisticReadWriteLock lock = new OptimisticReadWriteLock();
private final Transform transform = new Transform();
private boolean justSpawned = true;
private boolean observer = false;
private int viewDistance;
private Chunk chunk;
private CollisionModel collision;
private Controller controller;
private EntityManager entityManager;
private final GenericDatatableMap map;
private Model model;
private Thread owningThread;
private Transform lastTransform = transform;
private Point collisionPoint;
public SpoutEntity(SpoutEngine engine, Transform transform, Controller controller, int viewDistance) {
id.set(NOTSPAWNEDID);
this.transform.set(transform);
chunkLive = new AtomicReference<Chunk>();
entityManagerLive = new AtomicReference<EntityManager>();
controllerLive = new AtomicReference<Controller>();
if (transform != null) {
chunkLive.set(transform.getPosition().getWorld().getChunkFromBlock(transform.getPosition()));
entityManagerLive.set(((SpoutRegion) chunkLive.get().getRegion()).getEntityManager());
}
map = new GenericDatatableMap();
this.viewDistance = viewDistance;
viewDistanceLive.set(viewDistance);
//Only call setController if the controller was null (indicates this entity was just created)
if (controller != null) {
this.controller = controller;
setController(controller);
}
}
public SpoutEntity(SpoutEngine engine, Transform transform, Controller controller) {
this(engine, transform, controller, SpoutConfiguration.VIEW_DISTANCE.getInt() * SpoutChunk.CHUNK_SIZE);
}
public SpoutEntity(SpoutEngine engine, Point point, Controller controller) {
this(engine, new Transform(point, Quaternion.IDENTITY, Vector3.ONE), controller);
}
public void onTick(float dt) {
if (this.transform != null && this.transform.getPosition() != null && this.transform.getPosition().getWorld() != null && this.transform.getRotation() != null && this.transform.getScale() != null) {
lastTransform = transform.copy();
}
if (controller != null && controller.getParent() != null && !isDead()) {
controller.onTick(dt);
}
if (controllerLive.get() instanceof PlayerController) {
Player player = ((PlayerController) controllerLive.get()).getPlayer();
if (player != null && player.getSession() != null) {
((SpoutSession) player.getSession()).pulse();
}
}
}
/**
* Called right before resolving collisions. This is necessary to make sure all entities'
* get their collisions set.
* @return
*/
public boolean preResolve() {
//Don't need to do collisions if we have no collision volume
if (this.collision == null || this.getWorld() == null || controllerLive.get() == null) {
return false;
}
//Set collision point at the current position of the entity.
collisionPoint = this.transform.getPosition();
//Move the collision volume to the new position
this.collision.setPosition(collisionPoint);
//This will let SpoutRegion know it should call resolve for this entity.
return true;
}
/**
* Called when the tick is finished and collisions need to be resolved and
* move events fired
*/
public void resolve() {
if (Spout.debugMode()) {
System.out.println("COLLISION DEBUGGING");
System.out.println("Current Collision: " + this.collision.toString());
}
List<CollisionVolume> colliding = ((SpoutWorld) collisionPoint.getWorld()).getCollidingObject(this.collision);
Vector3 offset = this.lastTransform.getPosition().subtract(collisionPoint);
for (CollisionVolume box : colliding) {
if (Spout.debugMode()) {
System.out.println("Colliding box: " + box.toString());
}
Vector3 collision = this.collision.resolve(box);
if (Spout.debugMode()) {
System.out.println("Collision vector: " + collision.toString());
}
if (collision != null) {
collision = collision.subtract(collisionPoint);
if (Spout.debugMode()) {
System.out.println("Collision point: " + collision.toString() + " Collision vector: " + collision);
}
if (collision.getX() != 0F) {
offset = new Vector3(collision.getX(), offset.getY(), offset.getZ());
}
if (collision.getY() != 0F) {
offset = new Vector3(offset.getX(), collision.getY(), offset.getZ());
}
if (collision.getZ() != 0F) {
offset = new Vector3(offset.getX(), offset.getY(), collision.getZ());
}
if (Spout.debugMode()) {
System.out.println("Collision offset: " + offset.toString());
}
if (this.getCollision().getStrategy() == CollisionStrategy.SOLID && box.getStrategy() == CollisionStrategy.SOLID) {
this.setPosition(collisionPoint.add(offset));
if (Spout.debugMode()) {
System.out.println("New Position: " + this.getPosition());
}
}
controllerLive.get().onCollide(getWorld().getBlock(box.getPosition()));
}
}
//Check to see if we should fire off a Move event
}
@Override
public Transform getTransform() {
return transform.copy();
}
@Override
public Transform getLastTransform() {
return lastTransform.copy();
}
@Override
public void setTransform(Transform transform) {
if (activeThreadIsValid("set transform")) {
this.transform.set(transform);
}
}
@Override
public void translate(float x, float y, float z) {
translate(new Vector3(x, y, z));
}
@Override
public void translate(Vector3 amount) {
setPosition(getPosition().add(amount));
}
@Override
public void rotate(float ang, float x, float y, float z) {
setRotation(getRotation().rotate(ang, x, y, z));
}
@Override
public void rotate(Quaternion rot) {
setRotation(getRotation().multiply(rot));
}
@Override
public void scale(float x, float y, float z) {
scale(new Vector3(x, y, z));
}
@Override
public void scale(Vector3 amount) {
setScale(getScale().multiply(amount));
}
@Override
public Point getPosition() {
return transform.getPosition();
}
@Override
public Quaternion getRotation() {
return transform.getRotation();
}
@Override
public Vector3 getScale() {
return transform.getScale();
}
@Override
public void setPosition(Point position) {
if (activeThreadIsValid("set position")) {
transform.setPosition(position);
}
}
@Override
public void setRotation(Quaternion rotation) {
if (activeThreadIsValid("set rotation")) {
transform.setRotation(rotation);
}
}
@Override
public void setScale(Vector3 scale) {
if (activeThreadIsValid("set scale")) {
transform.setScale(scale);
}
}
@Override
public void roll(float ang) {
setRoll(getRoll() + ang);
}
@Override
public void pitch(float ang) {
setPitch(getPitch() + ang);
}
@Override
public void yaw(float ang) {
setYaw(getYaw() + ang);
}
@Override
public float getPitch() {
return transform.getRotation().getPitch();
}
@Override
public float getYaw() {
return transform.getRotation().getYaw();
}
@Override
public float getRoll() {
return transform.getRotation().getRoll();
}
@Override
public void setPitch(float pitch) {
setAxisAngles(pitch, getYaw(), getRoll(), "set pitch");
}
@Override
public void setRoll(float roll) {
setAxisAngles(getPitch(), getYaw(), roll, "set roll");
}
@Override
public void setYaw(float yaw) {
setAxisAngles(getPitch(), yaw, getRoll(), "set yaw");
}
private void setAxisAngles(float pitch, float yaw, float roll, String errorMessage) {
if (activeThreadIsValid(errorMessage)) {
setRotation(Quaternion.rotation(pitch, yaw, roll));
}
}
private boolean activeThreadIsValid(String attemptedAction) {
Thread current = Thread.currentThread();
boolean invalidAccess = !(this.owningThread == current || Spout.getEngine().getMainThread() == current);
if (invalidAccess && Spout.getEngine().debugMode()) {
if (attemptedAction == null) {
attemptedAction = "Unknown Action";
}
throw new IllegalAccessError("Tried to " + attemptedAction + " from another thread {current: " + Thread.currentThread().getPriority() + " owner: " + owningThread.getName() + "}!");
}
return !invalidAccess;
}
@Override
public int getHealth() {
return health.get();
}
@Override
public void setHealth(int health, Source source) {
// Event handling
int oldHealth = this.health.get();
int change = health - oldHealth;
EntityHealthChangeEvent event = Spout.getEventManager().callEvent(new EntityHealthChangeEvent(this, source, change));
int newHealth = oldHealth + event.getChange();
//Enforce max health
if (newHealth >= maxHealth.get()) {
this.health.getAndSet(maxHealth.get());
} else {
this.health.getAndSet(newHealth);
}
}
@Override
public void setMaxHealth(int maxHealth) {
this.maxHealth.getAndSet(maxHealth);
}
@Override
public int getMaxHealth() {
return maxHealth.get();
}
@Override
public int getId() {
return id.get();
}
public void setId(int id) {
this.id.set(id);
}
@Override
public Controller getController() {
return controllerLive.get();
}
public Controller getPrevController() {
return controller;
}
@Override
public void setController(Controller controller, Source source) {
EntityControllerChangeEvent event = Spout.getEventManager().callEvent(new EntityControllerChangeEvent(this, source, controller));
Controller newController = event.getNewController();
controllerLive.set(controller);
if (newController != null) {
controller.attachToEntity(this);
if (controller instanceof PlayerController) {
setObserver(true);
}
controller.onAttached();
}
}
@Override
public void setController(Controller controller) {
setController(controller, null);
}
@Override
public boolean kill() {
Point p = transform.getPosition();
boolean alive = p.getWorld() != null;
transform.set(DEAD);
chunkLive.set(null);
entityManagerLive.set(null);
return alive;
}
@Override
public boolean isDead() {
return id.get() != NOTSPAWNEDID && transform.getPosition().getWorld() == null;
}
// TODO - needs to be made thread safe
@Override
public void setModel(Model model) {
this.model = model;
}
// TODO - needs to be made thread safe
@Override
public Model getModel() {
return model;
}
// TODO - needs to be made thread safe
@Override
public void setCollision(CollisionModel model) {
collision = model;
if (collision != null) {
collision.setPosition(this.transform.getPosition());
}
}
// TODO - needs to be made thread safe
@Override
public CollisionModel getCollision() {
return collision;
}
@Override
public boolean isSpawned() {
return id.get() != NOTSPAWNEDID;
}
@Override
public void finalizeRun() {
if (entityManager != null) {
if (entityManager != entityManagerLive.get() || controller != controllerLive.get()) {
SpoutRegion r = (SpoutRegion) chunk.getRegion();
r.removeEntity(this);
if (entityManagerLive.get() == null) {
controller.onDeath();
if (controller instanceof PlayerController) {
Player p = ((PlayerController) controller).getPlayer();
p.getNetworkSynchronizer().onDeath();
}
}
}
}
if (entityManagerLive.get() != null) {
if (entityManager != entityManagerLive.get() || controller != controllerLive.get()) {
entityManagerLive.get().allocate(this);
}
}
if (chunkLive.get() != chunk) {
if (chunkLive.get() != null) {
((SpoutChunk) chunkLive.get()).addEntity(this);
if (observer) {
chunkLive.get().refreshObserver(this);
}
}
if (chunk != null && chunk.isLoaded()) {
((SpoutChunk) chunk).removeEntity(this);
if (observer) {
chunk.removeObserver(this);
}
}
if (chunkLive.get() == null) {
if (chunk != null && chunk.isLoaded()) {
((SpoutChunk) chunk).removeEntity(this);
if (observer) {
chunk.removeObserver(this);
}
}
if (entityManagerLive.get() != null) {
entityManagerLive.get().deallocate(this);
}
}
}
if (observerLive.get() != observer) {
observer = !observer;
if (observer) {
chunkLive.get().refreshObserver(this);
} else {
chunkLive.get().removeObserver(this);
}
}
}
public void copyToSnapshot() {
if (chunk != chunkLive.get()) {
chunk = chunkLive.get();
}
if (entityManager != entityManagerLive.get()) {
entityManager = entityManagerLive.get();
}
if (controller != controllerLive.get()) {
controller = controllerLive.get();
}
if (viewDistance != viewDistanceLive.get()) {
viewDistance = viewDistanceLive.get();
}
justSpawned = false;
}
@Override
public Chunk getChunk() {
World world = getWorld();
if (world == null) {
return null;
} else {
return world.getChunkFromBlock(MathHelper.floor(getPosition().getX()), MathHelper.floor(getPosition().getY()), MathHelper.floor(getPosition().getZ()));
}
}
public Chunk getChunkLive() {
while (true) {
int seq = lock.readLock();
Point position = transform.getPosition();
World w = position.getWorld();
if (w == null) {
if (lock.readUnlock(seq)) {
return null;
}
} else {
Chunk c = w.getChunkFromBlock(position, true);
if (lock.readUnlock(seq)) {
return c;
}
}
}
}
@Override
public Region getRegion() {
World world = getWorld();
if (world == null) {
return null;
} else {
return world.getRegionFromBlock(MathHelper.floor(getPosition().getX()), MathHelper.floor(getPosition().getY()), MathHelper.floor(getPosition().getZ()));
}
}
public Region getRegionLive() {
while (true) {
int seq = lock.readLock();
Point position = transform.getPosition();
World world = position.getWorld();
if (world == null && lock.readUnlock(seq)) {
return null;
} else {
Region r = world.getRegionFromBlock(position, true);
if (lock.readUnlock(seq)) {
return r;
}
}
}
}
@Override
public World getWorld() {
return transform.getPosition().getWorld();
}
@Override
public boolean is(Class<? extends Controller> clazz) {
return clazz.isAssignableFrom(controllerLive.get().getClass());
}
// TODO - datatable and atomics
@Override
public void setData(String key, int value) {
int ikey = map.getIntKey(key);
map.set(ikey, new DatatableInt(ikey, value));
}
@Override
public void setData(String key, float value) {
int ikey = map.getIntKey(key);
map.set(ikey, new DatatableFloat(ikey, value));
}
@Override
public void setData(String key, boolean value) {
int ikey = map.getIntKey(key);
map.set(ikey, new DatatableBool(ikey, value));
}
@Override
public void setData(String key, Serializable value) {
int ikey = map.getIntKey(key);
map.set(ikey, new DatatableSerializable(ikey, value));
}
@Override
public DatatableTuple getData(String key) {
return map.get(key);
}
@Override
public boolean hasData(String key) {
return map.contains(key);
}
private int inventorySize;
private Inventory inventory;
@Override
public int getInventorySize() {
return inventorySize;
}
@Override
public void setInventorySize(int newsize) {
if (inventorySize == newsize) {
return;
}
inventorySize = newsize;
if (inventory != null && getInventory().getSize() != inventorySize) {
inventory = null;
setData("inventory", null);
}
}
@Override
public Inventory getInventory() {
if (getInventorySize() <= 0) {
return null;
}
if (inventory == null) {
if (!hasData("inventory")) {
inventory = controllerLive == null ? new Inventory(getInventorySize()) : controllerLive.get().createInventory(getInventorySize());
setData("inventory", inventory);
} else {
inventory = (Inventory) getData("inventory").get();
}
}
return inventory;
}
@Override
public void onSync() {
//Forward to controller for now, but we may want to do some sync logic here for the entity.
controller.onSync();
//TODO - this might not be needed, if it is, it needs to send to the network synchronizer for players
}
public boolean justSpawned() {
return justSpawned;
}
@Override
public void setViewDistance(int distance) {
viewDistanceLive.set(distance);
}
@Override
public int getViewDistance() {
return viewDistanceLive.get();
}
public int getPrevViewDistance() {
return viewDistance;
}
@Override
public void setObserver(boolean obs) {
observerLive.set(obs);
}
@Override
public boolean isObserver() {
return observer;
}
@Override
public boolean isObserverLive() {
return observerLive.get();
}
public void setOwningThread(Thread thread) {
this.owningThread = thread;
}
@Override
public String toString() {
return "SpoutEntity - ID: " + this.getId() + " Controller: " + getController() + " Position: " + getPosition();
}
@Override
public void attachComponent(EntityComponent component) {
component.attachToEntity(this);
component.onAttached();
components.add(new AtomicReference<EntityComponent>(component));
}
@Override
public void removeComponent(EntityComponent component) {
if (components.remove(component)) {
component.onDetached();
}
}
@Override
public boolean hasComponent(EntityComponent component) {
return components.contains(component);
}
}
| [
"[email protected]"
]
| |
9f52e94f044e03bb6755b1f2140d5d340b8d4c7d | 99682e00085734c6c9e976501bfc4119d7d6fac3 | /Week_02/[84]柱状图中最大的矩形.java | 6d9146fb59f54c6418ab7e90e7c8c6482ab5efa9 | []
| no_license | xzuopydev/algorithm008-class01 | 2ee44e7ff9d06bc51f90a5361c72d816c55b4572 | 90e2b17f54bf362e7611c8ddeeddc31b8910dea1 | refs/heads/master | 2022-11-05T01:33:55.083146 | 2020-07-05T01:27:09 | 2020-07-05T01:27:09 | 255,500,149 | 0 | 0 | null | 2020-04-14T03:23:39 | 2020-04-14T03:23:38 | null | UTF-8 | Java | false | false | 1,109 | java | import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Stack;
public class Solution {
/**
* 84 柱状图中最大的矩形
*
* 给定 n 个非负整数,用来表示柱状图中各个柱子的高度。 每个柱子彼此相邻,且宽度为1. 求在该柱状图中,能够勾勒出来的矩形的最大面积。
*
* 示例: 输入:[2,1,5,6,2,3] 输出:10
*/
public int largestRectangleArea(int[] heights) {
Stack<Integer> stack = new Stack<>();
stack.push(-1);
int max = 0;
for (int i = 0; i < heights.length; i++) {
while (stack.peek() != -1 && heights[stack.peek()] >= heights[i]) {
max = Math.max(max, heights[stack.pop()] * (i - stack.peek() - 1));
}
stack.push(i);
}
while (stack.peek() != -1) {
max = Math.max(max, heights[stack.pop()] * (heights.length - stack.peek() - 1));
}
return max;
}
} | [
"[email protected]"
]
| |
eb8a1de323595ed0d4b8b385180454f9f3babfa9 | 8cfc88f7d1331debd5ff0bb113c2d18422990350 | /src/main/java/com/sdc/test/ServerMain.java | 42eccad26428a156cd8a6d8639897c3815066391 | []
| no_license | atidi/rpc | 2b8fe48ad27ba54143cebfdee4f1beeda8d39998 | 67e5cc0ab8f0dbbf1edf276ff5d9dc23f015c4b9 | refs/heads/master | 2021-01-08T07:31:51.317971 | 2020-02-21T15:06:48 | 2020-02-21T15:06:48 | 241,956,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package com.sdc.test;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.sdc.test.rpc.ObjectRpcServer;
import com.sdc.test.rpc.RemoteService;
import com.sdc.test.rpc.TestObject;
public class ServerMain {
public static void main(String[] args) throws Exception {
ConnectionFactory connFactory = new ConnectionFactory();
Connection conn = connFactory.newConnection();
Channel channel = conn.createChannel();
channel.queueDeclare("TestDefault", false, false, false, null);
ObjectRpcServer<RemoteService> s = new ObjectRpcServer<>(channel,"TestDefault",RemoteService.class,new TestObject());
s.startLoop();
}
}
| [
"[email protected]"
]
| |
6ed85555072314d969e9d488649585c96d1a961f | f83f8693a2435d5e68a80c2434344d837d0c3ced | /src/main/java/com/wangzi/test/jdk18/PersonFactory.java | f6cb539c18b2b7e5a7058997de845eae12a1a35d | []
| no_license | SirZiWang/testStudy | f2311e899b680a6baef2f9b605f4a40d9f2a4dfe | cb53a5566a55f1a11af573b88cb4d48db33e808d | refs/heads/master | 2022-10-19T09:51:11.699306 | 2021-07-27T01:20:22 | 2021-07-27T01:20:22 | 85,163,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package com.wangzi.test.jdk18;
public interface PersonFactory<P extends Person> {
P create(String firstName, String lastName);
PersonFactory<Person> personFactory = Person::new;
Person person = personFactory.create("Peter", "Parker");
}
| [
"[email protected]"
]
| |
40ca7693bac80dc2e18371916917d5d63bff3461 | 090b43735c5214f5f367fe676ac61a3c55c122ae | /Java/src/ImageTransferable.java | d5eb06bf8a411d53b01d4ac799392b740a002327 | []
| no_license | lzqwebsoft/QiuShiBaike | 0588fee059a8768db38d68db331a9b99e1fec4e1 | eeb64e53af5f30939c951df6b5c133d3c21bc910 | refs/heads/master | 2021-01-21T04:32:49.068043 | 2018-02-02T02:16:22 | 2018-02-02T02:16:22 | 35,261,948 | 1 | 4 | null | null | null | null | UTF-8 | Java | false | false | 857 | java | import java.awt.Image;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
/**
* 自定义图片转化类
*/
public class ImageTransferable implements Transferable {
private Image image;
public ImageTransferable(Image image)
{
this.image = image;
}
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
if (isDataFlavorSupported(flavor)) {
return image;
} else {
throw new UnsupportedFlavorException(flavor);
}
}
public boolean isDataFlavorSupported (DataFlavor flavor) {
return flavor == DataFlavor.imageFlavor;
}
public DataFlavor[] getTransferDataFlavors () {
return new DataFlavor[] { DataFlavor.imageFlavor };
}
} | [
"[email protected]"
]
| |
5a17d4f65f7cfe5261d04de11ef5421dfed69520 | 93a24c20b8b7f6f124dff36481e3c39d989ccd7e | /src/Utilities/EffectiveAddress.java | 7344467ba3afc9bc0557e4b24639dd24120573cc | []
| no_license | dilipvarma3/ComputerSystemArchitecture-Simulator | 5ac3f363447a329a714c2f6a3e41bfa1437ec6b6 | 73c0c5fccda4b1fdfdd39597b018f98ba1277980 | refs/heads/master | 2022-05-25T00:57:50.035398 | 2020-04-29T23:11:04 | 2020-04-29T23:11:04 | 223,507,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,476 | java | package Utilities;
import Memory.Memory;
import Registers.Registers;
public class EffectiveAddress {
public static String computeEA(int I, int IX, String Address, Registers reg, Memory mem) throws Exception {
//Address here should be binary String type
String EA = new String();
// System.out.println(mem.getMemValue(Address));
if (I == 0) {
// No indirect addressing
//System.out.println("I");
if (IX == 0) {
// EA = content of the Address field
System.out.println("Entered EA");
EA = Address;
System.out.println(EA);
} else if (IX == 1 || IX == 2 || IX == 3) {
//Calculating EA = c(IX) + c(Address)
System.out.println("Entered EA1");
EA = String.valueOf((Integer.parseInt(reg.getXR(IX)) + Integer.parseInt(Address)));
//System.out.println(EA);
}
} else {
if (IX == 0) {
// indirect addressing, but NO indexing, EA = c(Address)
EA = mem.getMemValue(Address);
} else {
//Both indirect addressing and indexing, EA = c(c(IX) + Address)
EA = String.valueOf((Integer.parseInt(reg.getXR(IX)) + Integer.parseInt(Address)));
}
}
return EA;
}
}
| [
"[email protected]"
]
| |
0dc947eee85a060a5d4e3d5d1213fb51066dfe9d | c7bf72fe87a0ffed5a5ec5c62aeadbb2b3959654 | /src/ch/leafit/clock_TaskBased/Main.java | e12ef08ef917a9e24b490498299cad54116cab49 | [
"MIT"
]
| permissive | raeffu/prog2-javafx | 1cc3a03f9fb9380d8ab9c8c06fd8a204de354e21 | dc7169ecaf5894b6435186847caab18b31a859c1 | refs/heads/master | 2020-12-30T10:50:17.545317 | 2014-05-27T09:21:21 | 2014-05-27T09:21:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 832 | java | package ch.leafit.clock_TaskBased;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.fxml.FXMLLoader;
public final class Main extends Application {
@Override
public void start(Stage primaryStage) {
try{AnchorPane root = (AnchorPane)FXMLLoader.load(getClass().getResource("Main.fxml"));
Scene scene = new Scene(root,420,180);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.setTitle("Chronometer Task Sample");
primaryStage.getIcons().add(new Image("5cm.png"));
primaryStage.show();
}
catch(Exception e) {e.printStackTrace();}
}
public static void main(String[] args) {launch(args);}
}
| [
"[email protected]"
]
| |
dffc2fbb5b31656d18ef33720eba497df917aaea | 6daf0ad1ea0eb4da34d9ef10a1a8febdc7781aae | /src/main/java/com/example/ddd/res/RetModel.java | 4064cee612b5d6f297a34631a55e97d0ea365eda | []
| no_license | oddddd/ddd | 5f9fcba579fd9818be63f993ecc57070cfb7974e | 3d0aeaa5abad5c525f5e017c6ed74003d3f8201c | refs/heads/master | 2020-03-13T03:37:14.206622 | 2018-06-01T11:46:53 | 2018-06-01T11:46:53 | 130,947,448 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.example.ddd.res;
/**
* RetModel
*
* @author wjp
* @desc
* @date Created in 下午4:42 2018/6/1
*/
public class RetModel {
/**
* 操作成功
*/
public static Integer RET_SUCCESS = 200;
public static String MSG_SUCCESS = "ok";
/**
* 操作成功
*/
public static Integer RET_ERROR = 501;
public static String MSG_ERROR = "炸了";
}
| [
"[email protected]"
]
| |
7dacc99ea072d18138bcb6d5833f7fc83b7bdd31 | 36f143853816dfe3f155743632e4fa95c0dc69ea | /src/main/java/frc/robot/Robot.java | ae4b5d72188fb6f916c9ba50e13f5cc54249bf37 | []
| no_license | mycoleptodiscus/TutorialBot | 2a88dd88714be3f98f7a548d269b277ee6461e37 | d1a0fc06c49c4692c71cb138b710e86ec5755b5a | refs/heads/master | 2020-10-01T02:08:52.604853 | 2019-12-14T23:09:51 | 2019-12-14T23:09:51 | 227,429,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,897 | java | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.command.Scheduler;
//import edu.wpi.first.wpilibj.command.Subsystem;
import frc.robot.subsystems.DriveTrain;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the TimedRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the build.gradle file in the
* project.
*/
public class Robot extends TimedRobot {
// public static final Subsystem DriveTrain = null;
public static DriveTrain driveTrain = new DriveTrain(); //Capital Drivetrain is class, lower-case drivetrain is object
public static OI m_oi;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
@Override
public void robotInit() {
m_oi = new OI();
}
/**
* This function is called every robot packet, no matter the mode. Use
* this for items like diagnostics that you want ran during disabled,
* autonomous, teleoperated and test.
*
* <p>This runs after the mode specific periodic functions, but before
* LiveWindow and SmartDashboard integrated updating.
*/
@Override
public void robotPeriodic() {
}
/**
* This function is called once each time the robot enters Disabled mode.
* You can use it to reset any subsystem information you want to clear when
* the robot is disabled.
*/
@Override
public void disabledInit() {
}
@Override
public void disabledPeriodic() {
Scheduler.getInstance().run();
}
/**
* This autonomous (along with the chooser code above) shows how to select
* between different autonomous modes using the dashboard. The sendable
* chooser code works with the Java SmartDashboard. If you prefer the
* LabVIEW Dashboard, remove all of the chooser code and uncomment the
* getString code to get the auto name from the text box below the Gyro
*
* <p>You can add additional auto modes by adding additional commands to the
* chooser code above (like the commented example) or additional comparisons
* to the switch structure below with additional strings & commands.
*/
@Override
public void autonomousInit() {
/*
* String autoSelected = SmartDashboard.getString("Auto Selector",
* "Default"); switch(autoSelected) { case "My Auto": autonomousCommand
* = new MyAutoCommand(); break; case "Default Auto": default:
* autonomousCommand = new ExampleCommand(); break; }
*/
// schedule the autonomous command (example)
}
/**
* This function is called periodically during autonomous.
*/
@Override
public void autonomousPeriodic() {
Scheduler.getInstance().run();
}
@Override
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
}
/**
* This function is called periodically during operator control.
*/
@Override
public void teleopPeriodic() {
Scheduler.getInstance().run();
}
/**
* This function is called periodically during test mode.
*/
@Override
public void testPeriodic() {
}
}
| [
"[email protected]"
]
| |
7e2b1ac0ece3b95c1e2f47f994383166e197f94a | 3d9396b9da16dfd711c6b0ef47b6b2cde9cc8f04 | /bill-system/src/main/java/com/usc/bill/jobSchedular/EndTermJobSchedular.java | c22e9350a6dcfd18474d3e82469a50409eb67855 | []
| no_license | heiruwu/BILL_System_Backup | 982d11ba27813a7d6cf605b4940064420afa79ff | 6caf69c0d85e8446328333473a9cb7ee35c117fe | refs/heads/master | 2023-02-08T07:43:12.441154 | 2017-12-04T21:46:51 | 2017-12-04T21:46:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,111 | java | package com.usc.bill.jobSchedular;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import com.usc.bill.model.ClassStatus;
import com.usc.bill.model.StudentProfile;
import com.usc.bill.service.BillService;
import com.usc.bill.service.StudentManagementService;
/**
* To handle collecting charges by the end of semester in tasks that are schedule on rough dates
* @author WU, Alamri, STROUD
* @version 1.0 11/19/2017
*/
@Service
@EnableScheduling
public class EndTermJobSchedular{
/**
* instance of StudentManagementService in order to assist in Student-related bussiness data operations
*/
@Autowired
private StudentManagementService studentManagementService;
/**
* instance of BillService in order to assist in charge and payment-related business operations
*/
@Autowired
private BillService billService;
/*
* get all students who are active and not graduated
* calculated charges on each student profile
*/
public void runJob(){
List<StudentProfile> studentProfileList = studentManagementService.getAllExceptClassStatus(ClassStatus.GRADUATED);
for (StudentProfile s : studentProfileList)
billService.generateEndTermCharge(s);
}
/*
* scheduled task runs on every 31 Dec. every year to calculate end of FALL semester charges
*/
@Scheduled(cron = "0 0 0 31 12 ?")
public void fallTermTask(){
runJob();
}
/*
* scheduled task runs on every 10 May every year to calculate end of SPRING semester charges
*/
@Scheduled(cron = "0 0 0 10 5 ?")
public void springTermTask(){
runJob();
}
/*
* scheduled task runs on every 15 Aug. every year to calculate end of SUMMER semester charges
*/
@Scheduled(cron = "0 0 0 15 8 ?")
public void summerTermTask(){
runJob();
}
} | [
"[email protected]"
]
| |
c03943eadd7cef22b137759e779100a4995435fa | 0d6534ebde06604f6715517c3e6b0c4872d20547 | /视频配套资料/微信公众号/weixin/src/entity/Button.java | 6acf1b06e84264730ab8095848e937f471aaa629 | []
| no_license | dyxigua/yanqun | 3986bfb8b371a7c8884c86fcee7734f55390400d | 1fd278dfc54f09df577b6bb1ef2b6973a7e6d93d | refs/heads/master | 2020-04-23T07:10:56.916090 | 2019-02-16T12:09:44 | 2019-02-16T12:09:44 | 170,998,805 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | package entity;
import java.util.ArrayList;
import java.util.List;
public class Button {
private List<AbstractButon> button = new ArrayList<>();
public List<AbstractButon> getButton() {
return button;
}
public void setButton(List<AbstractButon> button) {
this.button = button;
}
}
| [
"[email protected]"
]
| |
15c17f7ab11eb3b57350c729c24f281c8d2c57cb | 0dfc00f2f732cfc6d319d4b109b0b3bd3d435f6b | /app/src/main/java/alrefa/android/com/homefit/Utils/ApiEndpoints.java | 440403e2864e4b607d6e2058ccdba2a9bd8aa24f | [
"Apache-2.0"
]
| permissive | babakmhz/homefit_android | b47c627fe90c6d04aae4e1dd2848c4614a214ffb | 3a303cf06ef93a2e7c0a2bab1143d13af8f27adc | refs/heads/master | 2021-02-17T13:50:28.365214 | 2020-03-05T07:56:19 | 2020-03-05T07:56:19 | 245,101,508 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 772 | java | package alrefa.android.com.homefit.Utils;
import android.os.Build;
import alrefa.android.com.homefit.BuildConfig;
public final class ApiEndpoints {
// TODO: 2/20/19 change baseURL in build config for release version
public static final String HEADER_AUTH_KEY = "AUTHORIZATION";
public static final String SLIDER_ENDPOINT = BuildConfig.BASE_URL + "sliders";
public static final String SERVICE_DATETIMIE_ENDPOINT = BuildConfig.BASE_URL+"availableServiceDate";
public static final String CATEGORIES_ENDPOINT = BuildConfig.BASE_URL + "serviceCategories";
public static final String AVAILABLE_PROVIDERS_ENDPOINT = BuildConfig.BASE_URL + "getProviders";
public static final String SUBMIT_ORDER_ENDPOINT = BuildConfig.BASE_URL + "submitOrder/";
}
| [
"[email protected]"
]
| |
a37fda89904dc034a418db7f1db2e91e107c907c | c864e94d1ac25bd89be84dbaffcc3f42053cf059 | /src/main/java/org/smurn/pokerutils/Hand.java | 926539ceabe35e5445cc78476cd172027345ac8f | []
| no_license | smurn/pokerutils | 61c4ad81206abc940869c29f7e04f15119f9df09 | b27dad75e46c5f14940ed3ba33f29b80cb176138 | refs/heads/master | 2021-01-25T04:02:59.511007 | 2011-01-12T17:23:03 | 2011-01-12T17:23:03 | 1,245,603 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,386 | java | /*
* Copyright 2011 Stefan C. Mueller.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.smurn.pokerutils;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang.NullArgumentException;
/**
* Repesents a set of five poker cards.
* Instances of this class are immutable.
*/
public final class Hand {
/** Category of this hand. */
private final HandCategory category;
/** Cards this hand consists of (always 5). */
private final Set<Card> cards;
/** Ranks to compare hands of the same category. */
private final List<Rank> ranks;
/** Number of cards a hand has. */
private static final int CARDS_IN_HAND = 5;
/**
* Creates a hand.
* Note that this constructor does not guarantee that the
* hand is valid or even possible.
* @param category Category of this hand. Must not be null.
* @param cards Cards that form this hand. Must not be null, size must be 5.
* @param ranks Ranks for the loxiographic ordering
* (see {@link #getRanks()}. Must not be null.
*/
public Hand(final HandCategory category, final Collection<Card> cards,
final List<Rank> ranks) {
if (category == null) {
throw new NullArgumentException("category");
}
if (cards == null) {
throw new NullArgumentException("cards");
}
if (ranks == null) {
throw new NullArgumentException("ranks");
}
if (cards.size() != CARDS_IN_HAND) {
throw new IllegalArgumentException("cards must be of size 5, "
+ "but is " + cards.size() + ".");
}
this.category = category;
this.cards = Collections.unmodifiableSet(EnumSet.copyOf(cards));
this.ranks = Collections.unmodifiableList(new ArrayList<Rank>(ranks));
}
/**
* Gets the cards that from this hand.
* @return Immutable set of the 5 cards that form this hand. Never null.
*/
public Set<Card> getCards() {
return cards;
}
/**
* Gets the category of this hand.
* @return Category of this hand. Never null.
*/
public HandCategory getCategory() {
return category;
}
/**
* Gets the ranks relevant for comparing hands of the same category.
* @return Immutable list of ranks sorted by descending influence. When
* comparing two hands with equal hand category, the loxiographic order of
* this list defines the outcome. Never null.
*/
public List<Rank> getRanks() {
return ranks;
}
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Hand other = (Hand) obj;
if (this.category != other.category) {
return false;
}
if (this.cards != other.cards
&& ( this.cards == null || !this.cards.equals(other.cards) )) {
return false;
}
if (this.ranks != other.ranks
&& ( this.ranks == null || !this.ranks.equals(other.ranks) )) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 5;
hash = 89 * hash + ( this.category != null
? this.category.hashCode() : 0 );
hash = 89 * hash + ( this.cards != null ? this.cards.hashCode() : 0 );
hash = 89 * hash + ( this.ranks != null ? this.ranks.hashCode() : 0 );
return hash;
}
@Override
public String toString() {
return "Hand{" + "category=" + category + ", cards=" + cards
+ ", ranks=" + ranks + '}';
}
}
| [
"[email protected]"
]
| |
defe733e238c8d808db9aef87243b80b3a5d3300 | c7fa5d8021f2bb58db721b922037fcc076d17289 | /todos/src/com/simple/vo/Todo.java | 879fd260ec7cc56557dd8e40905841f33c344bac | []
| no_license | Hayebeom/web_workspace | fcd272d90a1117c7f479eeb592fdf7a7b0545632 | 6889aee03cd7b512a0c2dd5c44869876b4a9701d | refs/heads/master | 2022-11-23T03:09:33.445020 | 2020-07-24T09:04:59 | 2020-07-24T09:04:59 | 279,284,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,236 | java | package com.simple.vo;
import java.util.Date;
public class Todo {
private int no;
private String title;
private String content;
private Date day;
private Date completedDay;
private String status;
private String userId;
private Date createdDate;
public Todo() {
}
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getDay() {
return day;
}
public void setDay(Date day) {
this.day = day;
}
public Date getCompletedDay() {
return completedDay;
}
public void setCompletedDay(Date completedDay) {
this.completedDay = completedDay;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
}
| [
"[email protected]"
]
| |
1be87de1dd462bcdd5aebcb836deb4505d922d2c | 7b73756ba240202ea92f8f0c5c51c8343c0efa5f | /classes5/com/tencent/mobileqq/filemanager/data/WeiYunFileInfo.java | 50aa6f52c66bcd1c26a0ff4283f7f47d5a893b28 | []
| no_license | meeidol-luo/qooq | 588a4ca6d8ad579b28dec66ec8084399fb0991ef | e723920ac555e99d5325b1d4024552383713c28d | refs/heads/master | 2020-03-27T03:16:06.616300 | 2016-10-08T07:33:58 | 2016-10-08T07:33:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,471 | java | package com.tencent.mobileqq.filemanager.data;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import com.tencent.mobileqq.hotpatch.NotVerifyClass;
import sbc;
public class WeiYunFileInfo
implements Parcelable
{
public static final Parcelable.Creator CREATOR = new sbc();
public static final int a = 0;
public static final int b = 1;
public long a;
public String a;
public long b;
public String b;
public int c;
public String c;
public int d;
public String d;
public String e;
public String f;
public String g;
public String h;
static
{
boolean bool = NotVerifyClass.DO_VERIFY_CLASS;
}
public WeiYunFileInfo()
{
this.jdField_c_of_type_Int = 0;
}
public WeiYunFileInfo(Parcel paramParcel)
{
this.jdField_c_of_type_Int = 0;
this.jdField_a_of_type_JavaLangString = paramParcel.readString();
this.jdField_b_of_type_JavaLangString = paramParcel.readString();
this.jdField_a_of_type_Long = paramParcel.readLong();
this.jdField_b_of_type_Long = paramParcel.readLong();
this.jdField_c_of_type_Int = paramParcel.readInt();
this.jdField_c_of_type_JavaLangString = paramParcel.readString();
this.jdField_d_of_type_Int = paramParcel.readInt();
this.jdField_d_of_type_JavaLangString = paramParcel.readString();
this.e = paramParcel.readString();
this.f = paramParcel.readString();
this.g = paramParcel.readString();
this.h = paramParcel.readString();
}
public int describeContents()
{
return 0;
}
public void writeToParcel(Parcel paramParcel, int paramInt)
{
paramParcel.writeString(this.jdField_a_of_type_JavaLangString);
paramParcel.writeString(this.jdField_b_of_type_JavaLangString);
paramParcel.writeLong(this.jdField_a_of_type_Long);
paramParcel.writeLong(this.jdField_b_of_type_Long);
paramParcel.writeInt(this.jdField_c_of_type_Int);
paramParcel.writeString(this.jdField_c_of_type_JavaLangString);
paramParcel.writeInt(this.jdField_d_of_type_Int);
paramParcel.writeString(this.jdField_d_of_type_JavaLangString);
paramParcel.writeString(this.e);
paramParcel.writeString(this.f);
paramParcel.writeString(this.g);
paramParcel.writeString(this.h);
}
}
/* Location: E:\apk\QQ_91\classes5-dex2jar.jar!\com\tencent\mobileqq\filemanager\data\WeiYunFileInfo.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
]
| |
ab1590c4e51191672afe8cd7dbeae634c80c0221 | 77fa85374e447a2df309486627c80e6ce435431e | /app/src/main/java/com/example/csc_330_navigation/NoteModel.java | 657652ce3094ac0ea56a8559ca945d02e7583c33 | []
| no_license | TerrellMc/Note-App | 0a4458102edb0b52e14861c240b1a0a44a1a1ee4 | ebfb4f0b45c15c5d9f42500797f77fff12125f63 | refs/heads/main | 2023-08-20T17:01:29.786180 | 2021-10-26T18:33:12 | 2021-10-26T18:33:12 | 353,727,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,793 | java | package com.example.csc_330_navigation;
import android.content.Context;
import android.widget.Toast;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.google.gson.Gson;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class NoteModel {
private List<NoteType> noteList = new ArrayList<>();
private static NoteModel sharedInstance = null;
private Context context;
public NoteType getNote(int index){
return noteList.get(index);
}
public interface PostNoteCompletionHandler {
void postNote();
}
public interface GetNotCompletionHandler{
void getNote(List<NoteType> noteTypesList);
}
public interface PatchNoteCompletionHandler{
void patchNote();
}
public interface DeleteCompletionHandler{
void deleteNote();
}
private NoteModel() { }
static synchronized public NoteModel getSharedInstance() {
if (sharedInstance == null) {
sharedInstance = new NoteModel();
}
return sharedInstance;
}
public int getCount(){
return noteList.size();
}
//TODO: add getNotes method to pull notes from web service
public void getNotes(final GetNotCompletionHandler getNotCompletionHandler){
ServiceClient.getInstance().get(new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Gson gson = new Gson();
NoteResponseObject noteResponseObject = gson.fromJson(response.toString(),NoteResponseObject.class);
getNotCompletionHandler.getNote(noteResponseObject.data);
noteList = noteResponseObject.data;
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
}
//TODO: add postNotes method to post notes to web service
public void postNotes(NoteType noteType, final PostNoteCompletionHandler postNoteCompletionHandler){
ServiceClient.getInstance().post(noteType, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
postNoteCompletionHandler.postNote();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
int j =5 ;
}
});
}
//TODO: add patchNotes method to edit notes that exist in web service
public void patchNotes(NoteType noteType, final PatchNoteCompletionHandler patchNoteCompletionHandler){
ServiceClient.getInstance().patch(noteType, noteType.noteId, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
patchNoteCompletionHandler.patchNote();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
int j = 5;
}
});
}
//TODO: add methods to get notes from service client, edit notes from service client, post notes to service client, and delete notes from service client
public void deleteNotes(int id, final DeleteCompletionHandler deleteCompletionHandler){
ServiceClient.getInstance().delete(id, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
deleteCompletionHandler.deleteNote();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
int j = 5;
}
});
}
}
| [
"[email protected]"
]
| |
5533840ada353948cc879a0eb640950dee8a26d2 | 94d418884d8981987791f6ea4d594f0097f17db9 | /IOCProj24-NestedBeanFactoryWithLayeredApp/src/main/java/com/nt/bo/StudentBO.java | 3bc02feac777b609bb55087c9e69673e464e52cc | []
| no_license | jordan607/SpringRepo | 9218b08f016265f3025282d107a9ea0b29633b2b | fcd741b3093f9d5365e946dac22eaebbc09c3084 | refs/heads/master | 2021-08-31T02:58:36.675499 | 2017-12-19T17:03:33 | 2017-12-19T17:03:33 | 114,753,951 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package com.nt.bo;
public class StudentBO {
private int sno;
private String sname;
private int total;
private float avg;
private String result;
public int getSno() {
return sno;
}
public void setSno(int sno) {
this.sno = sno;
}
public String getSname() {
return sname;
}
public void setSname(String sname) {
this.sname = sname;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public float getAvg() {
return avg;
}
public void setAvg(float avg) {
this.avg = avg;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
}
| [
"jordan607"
]
| jordan607 |
89ba474a1952cb37f979b97dd5509ab7673c8328 | 5f8da3773c17b84eaa28edb732f986ebeb0fd2e2 | /src/com/lb/zhiworld/fragment/SelectionFragment.java | 430fcc5bc19a3a2b48b29e075b303ed17e38e031 | []
| no_license | jacktian/ZhiWorld | b32127d8c3c304646ac1ccff343e02b44eca65c8 | 1509429e1019118b557751f97703191237daec38 | refs/heads/master | 2021-01-22T20:29:17.363239 | 2015-12-13T12:01:41 | 2015-12-13T12:01:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package com.lb.zhiworld.fragment;
import org.androidannotations.annotations.EFragment;
import com.lb.zhiworld.R;
@EFragment(R.layout.fragment_news_common)
public class SelectionFragment extends BaseFragment {
}
| [
"[email protected]"
]
| |
147d9ecb19c6955357d79fea356cec26b8d58f91 | 627418867d57737baca6ec15f2dcfca46ee8dae5 | /src/app.java | e4e93f85c934d044becdc2b2b09b4b608d45f87e | []
| no_license | edilaban/hello-world | 223cac6258b73efd1f0eb79bc9ff846cdd70d9d8 | 133bfab38cbe60795393f47a84901e3b72361e94 | refs/heads/master | 2021-01-10T12:29:07.492896 | 2015-11-20T19:24:44 | 2015-11-20T19:24:44 | 46,577,049 | 0 | 0 | null | 2015-11-20T19:33:05 | 2015-11-20T17:36:38 | Java | UTF-8 | Java | false | false | 110 | java | // java
package no.edisoft.hello;
public class World {
public string Say() {
return "Hello world";
}
}
| [
"[email protected]"
]
| |
1ecb8835223256c212cbfbabd6adec1b7f5f5f43 | 036f37aa941bcecf86941704a74682a95cdb3002 | /i_PlusOne/src/i_PlusOne/Solution.java | d8edff7c1c25e880cdd81a2c6a07d24eba7560bd | []
| no_license | mbhushan/injava | 98999b0e9e0619a7b23694aa4c8b539b8434df1e | 36afa016fc8e62ee532c385b08e35fb625dc5473 | refs/heads/master | 2020-05-31T02:45:36.452691 | 2016-08-24T00:36:35 | 2016-08-24T00:36:35 | 29,081,399 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,276 | java | package i_PlusOne;
import java.util.ArrayList;
public class Solution {
public static ArrayList<Integer> plusOne(ArrayList<Integer> a) {
int n = a.size();
long number = 0;
int carry = 1;
int len = 0;
for (int i=n-1; i>=0; i--) {
int s = a.get(i);
s = s + carry;
if (s > 9) {
s = 0;
carry = 1;
} else {
carry = 0;
}
a.set(i, s);
++len;
}
ArrayList<Integer> result = new ArrayList();
int index = 0;
if (carry == 1) {
result.add(carry);
} else {
while (a.get(index) == 0) {
++index;
}
}
System.out.println("index: " + index);
System.out.println("n: " + n);
for (int i=index; i<n; i++) {
// System.out.println("len: " + len);
result.add(a.get(i));
}
return result;
}
public static void main(String [] args) {
// int [] A = {0,0,1,2,3};
// int [] A = { 3, 0, 6, 4, 0 };
// int [] A = {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9};
// int [] A = {0, 0, 9, 9, 9};
int [] A = { 9, 9, 9, 9, 9 };
ArrayList<Integer> X = new ArrayList();
for (int index = 0; index < A.length; index++) {
X.add(A[index]);
}
X = plusOne(X);
for (int i=0; i<X.size(); i++) {
System.out.print(X.get(i) + " ");
}
System.out.println();
}
}
| [
"[email protected]"
]
| |
9bdade5dec4fef52239bbbb7e59eca58bc9f654e | 3b3631d3237876270fb19a7b60d5927dd03abf5b | /viper/app/src/test/java/study/esampaio/viper/ExampleUnitTest.java | 0d0a92bc68a66a4a5db68c106c2b2301f999eb17 | []
| no_license | eduardossampaio/clean-architecture-study | 0f9bdfc5793e46049722f77694cfd775633564b4 | 8631430a1d118c023379398c49dfa332c8b3afdb | refs/heads/master | 2021-09-07T03:56:23.296495 | 2018-02-17T00:49:13 | 2018-02-17T00:49:13 | 121,807,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package study.esampaio.viper;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
3a937ad2eab13a99def21829ff2acb0c89155591 | f85dc70c07898c94d7897ab0fd7d37240aa023c8 | /src/am/controller/ArticleController.java | bc33c04176478a790bf5e32caf8c4eb6f38f17ef | []
| no_license | 0421mk/java-servlet-202109 | 7cdfcce85f9fe651d9988e83b9d448c7529fecd7 | f5deb39276c6e9f4db1df57e6e8d686cf2086f06 | refs/heads/main | 2023-09-02T05:44:05.867182 | 2021-09-23T07:44:08 | 2021-09-23T07:44:08 | 408,308,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,405 | java | package am.controller;
import java.io.IOException;
import java.sql.Connection;
import java.util.List;
import am.dto.Article;
import am.service.ArticleService;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
public class ArticleController {
private HttpServletRequest request;
private HttpServletResponse response;
private Connection conn;
private ArticleService articleService;
public ArticleController(HttpServletRequest request, HttpServletResponse response, Connection conn) {
this.request = request;
this.response = response;
this.conn = conn;
articleService = new ArticleService(conn);
}
public void actionList() throws ServletException, IOException {
int page = 1;
if (request.getParameter("page") != null && request.getParameter("page").length() != 0) {
try {
page = Integer.parseInt(request.getParameter("page"));
} catch (NumberFormatException e) {
}
}
int itemsInAPage = 20;
int totalPage = articleService.getListTotalPage(itemsInAPage);
List<Article> articles = articleService.getArticlesForPrint(page, itemsInAPage);
request.setAttribute("articles", articles);
request.setAttribute("page", page);
request.setAttribute("totalPage", totalPage);
request.getRequestDispatcher("/jsp/article/list.jsp").forward(request, response);
}
}
| [
"[email protected]"
]
| |
50fd97279cc893f02441ccae61c593662161b056 | 5173d1dae8ad8db478a1a2f9365f3ccac84168f6 | /Lab5-1173710209/src/debug/RemoveComments.java | e854934c8cafb56214bb3d9c38e76c0a65893dcc | []
| no_license | Tossnology/SoftwareConstructureLabs | 341d0f0294dd3734071628eeb31d6640097f7636 | 0cf087277bbcf714c26018000b8eee92967762e2 | refs/heads/master | 2023-02-14T00:47:43.498588 | 2021-01-08T03:12:43 | 2021-01-08T03:12:43 | 327,782,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,374 | java | package debug;
// /*
//
// This program is used for removing all the comments in a program code.
//
// Example 1:
// Input:
// source = ["/*Test program */", "int main()", "{ ", " // variable declaration ", "int a, b, c;", "/* This is a test", " multiline ", " comment for ", " testing */", "a = b + c;", "}"]
//
// The line by line code is visualized as below:
//
// /*Test program */
// int main()
// {
// // variable declaration
// int a, b, c;
// /* This is a test
// multiline
// comment for
// testing */
// a = b + c;
// }
//
// Output: ["int main()","{ "," ","int a, b, c;","a = b + c;","}"]
//
// The line by line code is visualized as below:
//
// int main()
// {
//
// int a, b, c;
// a = b + c;
// }
//
// Explanation:
// The string /* denotes a block comment, including line 1 and lines 6-9. The string // denotes line 4 as comments.
//
// Example 2:
//
// Input:
// source = ["a/*comment", "line", "more_comment*/b"]
//
// Output: ["ab"]
//
// Explanation:
// The original source string is "a/*comment\nline\nmore_comment*/b", where we have bolded the newline characters.
// After deletion, the implicit newline characters are deleted, leaving the string "ab", which when delimited by newline characters becomes ["ab"].
//
//
// Note:
//
// The length of source is in the range [1, 100].
// The length of source[i] is in the range [0, 80].
// Every open block comment is eventually closed.
// There are no single-quote, double-quote, or control characters in the source code.
//
// */
import java.util.ArrayList;
import java.util.List;
class RemoveComments {
// public List<String> removeComments(String[] source) {
// boolean inBlock = false;
// StringBuilder newline = new StringBuilder();
// List<String> ans = new ArrayList<String>();
// for (String line: source) {
// int i = 0;
// char[] chars = line.toCharArray();
// if (!inBlock)
// newline = new StringBuilder();
// while (i < line.length()) {
// if (!inBlock && i+1 <= line.length() && chars[i] == '/' && chars[i+1] == '*')
// {
// inBlock = true;
// } else if (inBlock && i+1 <= line.length() && chars[i] == '*' && chars[i+1]
// == '/') {
// inBlock = false;
// } else if (!inBlock) {
// newline.append(chars[i]);
// }
// i++;
// }
// if (inBlock && newline.length() > 0) {
// ans.add(new String(newline));
// }
// }
// return ans;
// }
public List<String> removeComments(String[] source) {
boolean inBlock = false;
StringBuilder newline = new StringBuilder();
List<String> ans = new ArrayList<String>();
for (String line : source) {
int i = 0;
char[] chars = line.toCharArray();
if (!inBlock)
newline = new StringBuilder();
while (i < line.length()) {
if (!inBlock && i + 1 < line.length() && chars[i] == '/' && chars[i + 1] == '*') {
inBlock = true;
i++;
} else if (inBlock && i + 1 < line.length() && chars[i] == '*' && chars[i + 1] == '/') {
inBlock = false;
i++;
} else if (!inBlock && i + 1 < line.length() && chars[i] == '/' && chars[i + 1] == '/') {
break;
} else if (!inBlock) {
newline.append(chars[i]);
}
i++;
}
if (!inBlock && newline.length() > 0) {
ans.add(new String(newline));
}
}
return ans;
}
} | [
"[email protected]"
]
| |
d04861a20e46a31f76b30dcaba592e338a1cf0c6 | 83a7636876f4c2aacd92801d101ddbf578e6f3b9 | /Java/Huffman Compression/Huff.java | 201d87165a5e4d83350da0c620880547b7c07945 | []
| no_license | nirajpatel/codingsamples | 8ab3a76d52369db688abe71f9a58bcb03f4674a9 | 966f23c28716cdc8ebf4c7b898f49957a6788fc7 | refs/heads/master | 2021-01-10T20:33:05.639025 | 2013-09-18T16:22:38 | 2013-09-18T16:22:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,218 | java | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
public class Huff {
int NUMB_BITS = 8;
TreeMap<Integer, Integer> freqMap;
private int numChars;
public static void main(String[] args) throws IOException{
String file = "/Applications/Eclipse/Workspace/Huffman/src/test.txt";
frequency(file);
}
public static void frequency(String file) throws IOException{
private TreeMap<Integer, Integer> countFreq(BitInputStream inFile) throws IOException {
freqMap = new TreeMap<Integer, Integer>();
int inbits;
//read input file letter by letter
while ((inbits = inFile.readBits(NUMB_BITS)) != -1) {
if (freqMap.containsKey(inbits)) {
int freq = freqMap.get(inbits);
numChars++;
freqMap.put(inbits, ++freq);
} else {
freqMap.put(inbits, 1);
numChars++;
}
}
freqMap.put(PSEUDO_EOF, 1);
inFile.close();
return freqMap;
}
| [
"[email protected]"
]
| |
3fb26e677a92b1df1dac78c90676cad1eb05f23f | 6d845d944e33dedcfd12da0f59a3bd87ea2450ee | /scs-admin/src/main/java/com/scs/modules/sys/controller/SysMenuController.java | 0320d54fd8fcd1cbdb8f3151da1185b0c8c6f079 | [
"Apache-2.0"
]
| permissive | ZeroVV/scs-project | 12a45b5f4f1f6e142b7b99a95a68467237bf99e0 | 8c31c03024f11368c360de8544e00a9638866820 | refs/heads/master | 2020-05-15T18:31:58.927425 | 2019-04-20T16:49:26 | 2019-04-20T16:49:26 | 182,428,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,666 | java | /**
* Copyright (c) 2016-2019 智慧校园 All rights reserved.
*
* http://www.overlv.com
*
* 版权所有,侵权必究!
*/
package com.scs.modules.sys.controller;
import com.scs.common.annotation.SysLog;
import com.scs.common.exception.RRException;
import com.scs.common.utils.Constant;
import com.scs.common.utils.R;
import com.scs.modules.sys.entity.SysMenuEntity;
import com.scs.modules.sys.service.SysMenuService;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 系统菜单
*
* @author Over [email protected]
*/
@RestController
@RequestMapping("/sys/menu")
public class SysMenuController extends AbstractController {
@Autowired
private SysMenuService sysMenuService;
/**
* 导航菜单
*/
@RequestMapping("/nav")
public R nav(){
List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(getUserId());
return R.ok().put("menuList", menuList);
}
/**
* 所有菜单列表
*/
@RequestMapping("/list")
@RequiresPermissions("sys:menu:list")
public List<SysMenuEntity> list(){
List<SysMenuEntity> menuList = sysMenuService.list();
for(SysMenuEntity sysMenuEntity : menuList){
SysMenuEntity parentMenuEntity = sysMenuService.getById(sysMenuEntity.getParentId());
if(parentMenuEntity != null){
sysMenuEntity.setParentName(parentMenuEntity.getName());
}
}
return menuList;
}
/**
* 选择菜单(添加、修改菜单)
*/
@RequestMapping("/select")
@RequiresPermissions("sys:menu:select")
public R select(){
//查询列表数据
List<SysMenuEntity> menuList = sysMenuService.queryNotButtonList();
//添加顶级菜单
SysMenuEntity root = new SysMenuEntity();
root.setMenuId(0L);
root.setName("一级菜单");
root.setParentId(-1L);
root.setOpen(true);
menuList.add(root);
return R.ok().put("menuList", menuList);
}
/**
* 菜单信息
*/
@RequestMapping("/info/{menuId}")
@RequiresPermissions("sys:menu:info")
public R info(@PathVariable("menuId") Long menuId){
SysMenuEntity menu = sysMenuService.getById(menuId);
return R.ok().put("menu", menu);
}
/**
* 保存
*/
@SysLog("保存菜单")
@RequestMapping("/save")
@RequiresPermissions("sys:menu:save")
public R save(@RequestBody SysMenuEntity menu){
//数据校验
verifyForm(menu);
sysMenuService.save(menu);
return R.ok();
}
/**
* 修改
*/
@SysLog("修改菜单")
@RequestMapping("/update")
@RequiresPermissions("sys:menu:update")
public R update(@RequestBody SysMenuEntity menu){
//数据校验
verifyForm(menu);
sysMenuService.updateById(menu);
return R.ok();
}
/**
* 删除
*/
@SysLog("删除菜单")
@RequestMapping("/delete")
@RequiresPermissions("sys:menu:delete")
public R delete(long menuId){
if(menuId <= 31){
return R.error("系统菜单,不能删除");
}
//判断是否有子菜单或按钮
List<SysMenuEntity> menuList = sysMenuService.queryListParentId(menuId);
if(menuList.size() > 0){
return R.error("请先删除子菜单或按钮");
}
sysMenuService.delete(menuId);
return R.ok();
}
/**
* 验证参数是否正确
*/
private void verifyForm(SysMenuEntity menu){
if(StringUtils.isBlank(menu.getName())){
throw new RRException("菜单名称不能为空");
}
if(menu.getParentId() == null){
throw new RRException("上级菜单不能为空");
}
//菜单
if(menu.getType() == Constant.MenuType.MENU.getValue()){
if(StringUtils.isBlank(menu.getUrl())){
throw new RRException("菜单URL不能为空");
}
}
//上级菜单类型
int parentType = Constant.MenuType.CATALOG.getValue();
if(menu.getParentId() != 0){
SysMenuEntity parentMenu = sysMenuService.getById(menu.getParentId());
parentType = parentMenu.getType();
}
//目录、菜单
if(menu.getType() == Constant.MenuType.CATALOG.getValue() ||
menu.getType() == Constant.MenuType.MENU.getValue()){
if(parentType != Constant.MenuType.CATALOG.getValue()){
throw new RRException("上级菜单只能为目录类型");
}
return ;
}
//按钮
if(menu.getType() == Constant.MenuType.BUTTON.getValue()){
if(parentType != Constant.MenuType.MENU.getValue()){
throw new RRException("上级菜单只能为菜单类型");
}
return ;
}
}
}
| [
"[email protected]"
]
| |
8fc79c33b1d3b33b7371028ecc939f66e0c5777b | 533ff159f125813460432c8d43956788e6da045f | /Chintha/ChinthaAdmin/app/src/main/java/com/chintha_admin/ConnectionDetecter.java | b6181d2f4bbd38883e90a976da7ab17fe66bf43c | []
| no_license | AitoApps/AndroidWorks | 7747b084e84b8ad769f4552e8b2691d9cdec3f06 | 3c6c7d17f085ee3aa714e66f13fec2a4d8663ca3 | refs/heads/master | 2022-03-14T10:57:59.215113 | 2019-12-06T17:03:24 | 2019-12-06T17:03:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 895 | java | package com.chintha_admin;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkInfo.State;
public class ConnectionDetecter {
private Context _context;
public ConnectionDetecter(Context context) {
_context = context;
}
public boolean isConnectingToInternet() {
ConnectivityManager connectivity = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null) {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null) {
for (NetworkInfo state : info) {
if (state.getState() == State.CONNECTED) {
return true;
}
}
}
}
return false;
}
}
| [
"[email protected]"
]
| |
4c7e3d8421b1e7fbca6b9f582d37be352dd036fd | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/32/32_92b15ff5c9a30124d7703b0429973ee203fd05ea/PaymentWindow/32_92b15ff5c9a30124d7703b0429973ee203fd05ea_PaymentWindow_t.java | 0a52d3a7c1829ac7d65a8ad8221284a282abff19 | []
| 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,248 | java | package ee.ut.math.tvt.sinys;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.apache.log4j.Logger;
import ee.ut.math.tvt.salessystem.domain.controller.SalesDomainController;
import ee.ut.math.tvt.salessystem.domain.data.Order;
import ee.ut.math.tvt.salessystem.domain.data.SoldItem;
import ee.ut.math.tvt.salessystem.ui.model.SalesSystemModel;
import ee.ut.math.tvt.salessystem.ui.tabs.PurchaseTab;
public class PaymentWindow extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(PurchaseTab.class);
private JTextField paymentAmount;
private SalesDomainController domainController;
private final SalesSystemModel model;
private List<SoldItem> rows;
private double sum;
private double change = 0.0;
private JPanel textPanel;
private JLabel changeValue;
private JButton acceptButton;
private JButton cancelButton;
public JLabel allDone;
public PaymentWindow(final SalesSystemModel model) {
this.model = model;
int width = 200;
int height = 150;
allDone = new JLabel();
rows = model.getCurrentPurchaseTableModel().getTableRows();
for (SoldItem item : rows) {
sum += item.getSum();
}
textPanel = new JPanel();
textPanel.setLayout(new GridLayout(4, 3));
add(textPanel);
JLabel sumLabel = new JLabel("Order sum: ");
textPanel.add(sumLabel);
JLabel sumValue = new JLabel(String.valueOf(Math.round( sum * 100.0 ) / 100.0));
textPanel.add(sumValue);
JLabel changeLabel = new JLabel("Change:");
textPanel.add(changeLabel);
changeValue = new JLabel(String.valueOf(change), 10);
textPanel.add(changeValue);
paymentAmount = new JTextField(15);
paymentAmount.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
updateChangeValue();
}
@Override
public void insertUpdate(DocumentEvent e) {
updateChangeValue();
}
@Override
public void changedUpdate(DocumentEvent e) {
updateChangeValue();
}
});
textPanel.add(paymentAmount);
JLabel emptyLabel = new JLabel("");
textPanel.add(emptyLabel);
acceptButton = new JButton("Accept");
acceptButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (change >= 0) {
submitCurrentPurchase(model.getCurrentPurchaseTableModel()
.getTableRows());
} else {
JOptionPane.showMessageDialog(getRootPane(),
"Enter value greater or equal to amount to pay",
"Attention", JOptionPane.ERROR_MESSAGE, null);
}
}
});
textPanel.add(acceptButton);
cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cancelCurrentPurchase();
}
});
textPanel.add(cancelButton);
setTitle("Payment information");
setSize(width, height);
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((screen.width - width) / 2, (screen.height - height) / 2);
setVisible(true);
}
public void updateChangeValue() {
try {
double payment = Double.parseDouble(paymentAmount.getText());
change = payment - sum;
change=Math.round( change * 100.0 ) / 100.0;
} catch (Exception e1) {
e1.getMessage();
}
changeValue.setText(String.valueOf(change));
}
public void submitCurrentPurchase(List<SoldItem> goods) {
float price = 0;
for (int i = 0; i < goods.size(); i++) {
price += goods.get(i).getSum();
model.getWarehouseTableModel().decrementItemQuantityById(
goods.get(i).getId(), goods.get(i).getQuantity());
}
model.getCurrentPurchaseTableModel().addItemsToDB();
model.getWarehouseTableModel().fireTableDataChanged();
model.getDomainController().saveWarehouseState(
model.getWarehouseTableModel().getTableRows());
model.updateWarehouseTableModel();
model.getWarehouseTableModel().fireTableDataChanged();
price=(float) (Math.round( price * 100.0 ) / 100.0);
Order o = new Order(model.getHistoryTableModel().getRowCount() + 1,
price, goods);
model.getHistoryTableModel().addItem(o);
allDone.setText("done");
reset();
this.setVisible(false);
this.dispose();// TODO fix
}
public void reset() {
paymentAmount.setText("");
changeValue.setText("");
change = 0;
}
public void cancelCurrentPurchase() {
this.setVisible(false);
reset();
// List<SoldItem> goods = model.getCurrentPurchaseTableModel().getTableRows();
// for (int i = 0; i < goods.size(); i++) {
// model.getWarehouseTableModel().incrementItemQuantityById(
// goods.get(i).getId(), goods.get(i).getQuantity());
// }
}
}
| [
"[email protected]"
]
| |
3ce98605f74da5b0420900f0758593836f98539f | 0212024c9561b61316c6ef9b74c3b042423df708 | /src/main/java/com/niit/controller/ShippingAddress.java | 16118eeaf93741c8201961aeefed8a631b4007fe | []
| no_license | Sab15011994/FrontEndWeb | 8f5717f8a2b0d20ee2778b01d9bacf05b9c8cc9a | 178145259e2290bbbbfd9cf864558a04f0743419 | refs/heads/master | 2020-04-03T06:54:57.952657 | 2018-10-31T07:25:21 | 2018-10-31T07:25:21 | 155,087,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,362 | java | package com.niit.controller;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
public class ShippingAddress
{
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int billingId;
private String apartmentnumber;
private String streetname;
private String city;
private String state;
private String country;
private String zipcode;
public int getBillingId() {
return billingId;
}
public void setBillingId(int billingId) {
this.billingId = billingId;
}
public String getApartmentnumber() {
return apartmentnumber;
}
public void setApartmentnumber(String apartmentnumber) {
this.apartmentnumber = apartmentnumber;
}
public String getStreetname() {
return streetname;
}
public void setStreetname(String streetname) {
this.streetname = streetname;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getZipcode() {
return zipcode;
}
public void setZipcode(String zipcode) {
this.zipcode = zipcode;
}
}
| [
"[email protected]"
]
| |
0047294b8a89f94a009b58f746f37aa3394c4d56 | e799031b9081a52003bb009122ec35d6994c270e | /fullcontact-back/src/main/java/dev/fullcontact/service/impl/FullContactServiceImpl.java | 09f27f153475ab58854d793c331160398d9620eb | []
| no_license | ncmajith/fullcontact-assignment | 1e42d3ba8caf0c2d02c38ae43c3b18d819f0061f | 6a761ce5186c5b98c9a59cb48e236d352ec6b5b9 | refs/heads/master | 2023-07-01T18:38:10.847836 | 2021-08-05T08:30:09 | 2021-08-05T08:30:09 | 392,690,051 | 0 | 0 | null | 2021-08-04T21:14:47 | 2021-08-04T13:01:06 | JavaScript | UTF-8 | Java | false | false | 3,038 | java | package dev.fullcontact.service.impl;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fullcontact.apilib.FullContactException;
import com.fullcontact.apilib.enrich.FullContact;
import com.fullcontact.apilib.models.Profile;
import com.fullcontact.apilib.models.Request.PersonRequest;
import com.fullcontact.apilib.models.Response.PersonResponse;
import dev.fullcontact.dao.FullContactDao;
import dev.fullcontact.entity.PeopleEnity;
import dev.fullcontact.exceptions.BusinessException;
import dev.fullcontact.exceptions.ErrorVO;
import dev.fullcontact.model.PeopleModel;
import dev.fullcontact.service.FullContactService;
@Service
public class FullContactServiceImpl implements FullContactService {
public static final Logger logger = LoggerFactory.getLogger(FullContactServiceImpl.class.getName());
@Autowired
FullContact fcClient;
@Autowired
FullContactDao fullContactDao;
@Override
public PersonResponse addPeople(PeopleModel peopleModel) throws BusinessException {
logger.info("addPeople");
PersonResponse person = null;
try {
PersonRequest personRequest = fcClient.buildPersonRequest().email(peopleModel.getEmail())
.phone(peopleModel.getPhone())
.profile(Profile.builder().service(peopleModel.getService()).url(peopleModel.getUrl()).build())
.build();
CompletableFuture<PersonResponse> personResponseCompletableFuture = fcClient.enrich(personRequest);
person = personResponseCompletableFuture.get();
saveHistory(peopleModel, person);
catchAndThrowException(person);
} catch (FullContactException | InterruptedException | ExecutionException e) {
ErrorVO errorVO = new ErrorVO("03", "Profile not found");
throw new BusinessException(Arrays.asList(errorVO));
}
return person;
}
private void saveHistory(PeopleModel person, PersonResponse personResponse) {
PeopleEnity entity = new PeopleEnity(person.getEmail(), person.getPhone(), person.getService(), person.getUrl(),
personResponse.isSuccessful, LocalDateTime.now());
fullContactDao.saveHistory(entity);
}
private void catchAndThrowException(PersonResponse person) {
if (!person.isSuccessful) {
ErrorVO errorVO = new ErrorVO("02", person.message);
throw new BusinessException(Arrays.asList(errorVO));
}
}
@Override
public List<PeopleModel> listHistory() throws BusinessException {
List<PeopleEnity> peopleList = fullContactDao.listHistory();
return peopleList.isEmpty() ? new ArrayList<>()
: peopleList
.stream().map(people -> new PeopleModel(people.getEmail(), people.getPhone(),
people.getService(), people.getUrl(), people.isSuccess(), people.getCreated()))
.collect(Collectors.toList());
}
}
| [
"[email protected]"
]
| |
9407a2bd82a771c7da1500ffc169ba317e3ade89 | 4ec81ebf9cc782d798aabb7f946cce41cdb68485 | /javaBestPractice/io.code/javaBestPractice/AbstractDemo.java | 03e0431fe1af0347441f4865b3aa09d1f0220bed | []
| no_license | shilpising/CoreJava | fc644e9be035390e2da6f5730afa5d564233d237 | 5a6bbf7a064ea0f5096689fdd19e1c486ea49646 | refs/heads/master | 2021-06-09T15:42:53.776649 | 2019-09-25T12:20:37 | 2019-09-25T12:20:37 | 135,979,074 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 904 | java | package javaBestPractice;
abstract class Shape{
Shape(){}
abstract void draw();
void display() {
System.out.println("inside Shape Display");
}
}
class Rectangle extends Shape{
Rectangle(){
super();
}
void draw() {
System.out.println(("inside Rectangle draw"));
}
void display() {
System.out.println("inside Rectngle display");
}
}
class Triangle extends Rectangle{
void draw() {
System.out.println("inside Triangle");
}
}
public class AbstractDemo {
public static void main(String[] args) {
Shape s1=new Rectangle();
s1.draw();
s1=new Triangle();
s1.draw();
//cannot instantiate Shape
//s1=new Shape();
Rectangle r1=new Rectangle();
r1.draw();
r1=new Triangle();
r1.draw();
Triangle t1=new Triangle();
t1.draw();
//cannot convert rectangle to triangle
//t1=new Rectangle();
//cannot convert shape to triangle
//t1=new Shape();
}
}
; | [
"[email protected]"
]
| |
3fb3a40fd07990e7e103e9a6073ba3f1a5ba72f0 | 5a940a1f038e03869a0934ebb3d684731face903 | /src/main/java/com/mossle/api/store/StoreConnector.java | a11cfc38ec0b1a8a10c397d99abf813daf1ade57 | []
| no_license | zhiqinghuang/SmartPlatform | 3a92f2b59fed40665396e5c2de80392ed51cab97 | 995e13d57989ec505c730a39ffff38c23342f178 | refs/heads/master | 2022-12-23T08:46:40.881068 | 2020-12-04T03:32:54 | 2020-12-04T03:32:54 | 45,810,484 | 0 | 1 | null | 2022-12-16T01:17:38 | 2015-11-09T02:35:55 | JavaScript | UTF-8 | Java | false | false | 481 | java | package com.mossle.api.store;
import javax.activation.DataSource;
public interface StoreConnector {
StoreDTO saveStore(String model, DataSource dataSource, String tenantId) throws Exception;
StoreDTO saveStore(String model, String key, DataSource dataSource, String tenantId) throws Exception;
StoreDTO getStore(String model, String key, String tenantId) throws Exception;
void removeStore(String model, String key, String tenantId) throws Exception;
}
//need to confirm | [
"[email protected]"
]
| |
0397b53bdb43e4784040c76c02b8486be54ad40e | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/jdbi/learning/4480/QueryTimeOutFactory.java | 989c9414c063c24a3c7e0ba54f96aac32731ba8e | []
| no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,104 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jdbi.v3.sqlobject.customizer.internal;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.lang.reflect.Type;
import org.jdbi.v3.sqlobject.customizer.QueryTimeOut;
import org.jdbi.v3.sqlobject.customizer.SqlStatementCustomizer;
import org.jdbi.v3.sqlobject.customizer.SqlStatementCustomizerFactory;
import org.jdbi.v3.sqlobject.customizer.SqlStatementParameterCustomizer;
public class QueryTimeOutFactory implements SqlStatementCustomizerFactory {
@Override
public SqlStatementCustomizer createForType(Annotation annotation, Class<?> sqlObjectType) {
int queryTimeout = ((QueryTimeOut) annotation).value();
return stmt -> stmt.setQueryTimeout(queryTimeout);
}
@Override
public SqlStatementCustomizer createForMethod(Annotation annotation, Class<?> sqlObjectType, Method method) {
return createForType(annotation, sqlObjectType);
}
@Override
public SqlStatementParameterCustomizer createForParameter(Annotation annotation,
Class<?> sqlObjectType,
Method method,
Parameter param,
int index,
Type type) {
return (stmt, queryTimeout) ->stmt.setQueryTimeout((Integer) queryTimeout);
}
}
| [
"[email protected]"
]
| |
b8751d0e9f5886fc5d1e3a656befda1c47dc4d24 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/21/21_cde1036cbb0890629d7f85819694fc182cbd19e4/BoundingBox/21_cde1036cbb0890629d7f85819694fc182cbd19e4_BoundingBox_t.java | 9e0970829a3ce2637f2dcb176bdbc23c53b97124 | []
| 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 | 31,974 | java | /**
* Copyright (c) 2008-2009 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at <http://www.ardor3d.com/LICENSE>.
*/
package com.ardor3d.bounding;
import java.io.IOException;
import java.nio.FloatBuffer;
import com.ardor3d.intersection.IntersectionRecord;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Plane;
import com.ardor3d.math.Vector3;
import com.ardor3d.math.type.ReadOnlyMatrix3;
import com.ardor3d.math.type.ReadOnlyPlane;
import com.ardor3d.math.type.ReadOnlyQuaternion;
import com.ardor3d.math.type.ReadOnlyRay3;
import com.ardor3d.math.type.ReadOnlyVector3;
import com.ardor3d.math.type.ReadOnlyPlane.Side;
import com.ardor3d.scenegraph.MeshData;
import com.ardor3d.util.export.Ardor3DExporter;
import com.ardor3d.util.export.Ardor3DImporter;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.geom.BufferUtils;
/**
* <code>BoundingBox</code> defines an axis-aligned cube that defines a container for a group of vertices of a
* particular piece of geometry. This box defines a center and extents from that center along the x, y and z axis. <br>
* <br>
* A typical usage is to allow the class define the center and radius by calling either <code>containAABB</code> or
* <code>averagePoints</code>. A call to <code>computeFramePoint</code> in turn calls <code>containAABB</code>.
*/
public class BoundingBox extends BoundingVolume {
private static final long serialVersionUID = 1L;
private double _xExtent, _yExtent, _zExtent;
/**
* Default constructor instantiates a new <code>BoundingBox</code> object.
*/
public BoundingBox() {}
/**
* Constructor instantiates a new <code>BoundingBox</code> object with given values.
*/
public BoundingBox(final Vector3 c, final double x, final double y, final double z) {
_center.set(c);
setXExtent(x);
setYExtent(y);
setZExtent(z);
}
@Override
public Type getType() {
return Type.AABB;
}
public void setXExtent(final double xExtent) {
_xExtent = xExtent;
}
public double getXExtent() {
return _xExtent;
}
public void setYExtent(final double yExtent) {
_yExtent = yExtent;
}
public double getYExtent() {
return _yExtent;
}
public void setZExtent(final double zExtent) {
_zExtent = zExtent;
}
public double getZExtent() {
return _zExtent;
}
@Override
public BoundingVolume transform(final ReadOnlyMatrix3 rotate, final ReadOnlyVector3 translate,
final ReadOnlyVector3 scale, final BoundingVolume store) {
BoundingBox box;
if (store == null || store.getType() != Type.AABB) {
box = new BoundingBox();
} else {
box = (BoundingBox) store;
}
_center.multiply(scale, box._center);
rotate.applyPost(box._center, box._center);
box._center.addLocal(translate);
final Vector3 compVect1 = Vector3.fetchTempInstance();
final Matrix3 transMatrix = Matrix3.fetchTempInstance();
transMatrix.set(rotate);
// Make the rotation matrix all positive to get the maximum x/y/z extent
transMatrix.setValue(0, 0, Math.abs(transMatrix.getValue(0, 0)));
transMatrix.setValue(0, 1, Math.abs(transMatrix.getValue(0, 1)));
transMatrix.setValue(0, 2, Math.abs(transMatrix.getValue(0, 2)));
transMatrix.setValue(1, 0, Math.abs(transMatrix.getValue(1, 0)));
transMatrix.setValue(1, 1, Math.abs(transMatrix.getValue(1, 1)));
transMatrix.setValue(1, 2, Math.abs(transMatrix.getValue(1, 2)));
transMatrix.setValue(2, 0, Math.abs(transMatrix.getValue(2, 0)));
transMatrix.setValue(2, 1, Math.abs(transMatrix.getValue(2, 1)));
transMatrix.setValue(2, 2, Math.abs(transMatrix.getValue(2, 2)));
compVect1.set(getXExtent() * scale.getX(), getYExtent() * scale.getY(), getZExtent() * scale.getZ());
transMatrix.applyPost(compVect1, compVect1);
// Assign the biggest rotations after scales.
box.setXExtent(Math.abs(compVect1.getX()));
box.setYExtent(Math.abs(compVect1.getY()));
box.setZExtent(Math.abs(compVect1.getZ()));
Vector3.releaseTempInstance(compVect1);
Matrix3.releaseTempInstance(transMatrix);
return box;
}
/**
* <code>computeFromPoints</code> creates a new Bounding Box from a given set of points. It uses the
* <code>containAABB</code> method as default.
*
* @param points
* the points to contain.
*/
@Override
public void computeFromPoints(final FloatBuffer points) {
containAABB(points);
}
@Override
public void computeFromPrimitives(final MeshData data, final int section, final int[] indices, final int start,
final int end) {
if (end - start <= 0) {
return;
}
final Vector3 min = Vector3.fetchTempInstance().set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.POSITIVE_INFINITY);
final Vector3 max = Vector3.fetchTempInstance().set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY,
Double.NEGATIVE_INFINITY);
final int vertsPerPrimitive = data.getIndexMode(section).getVertexCount();
Vector3[] store = new Vector3[vertsPerPrimitive];
for (int i = start; i < end; i++) {
store = data.getPrimitive(indices[i], section, store);
for (int j = 0; j < store.length; j++) {
checkMinMax(min, max, store[j]);
}
}
_center.set(min.addLocal(max));
_center.multiplyLocal(0.5);
setXExtent(max.getX() - _center.getX());
setYExtent(max.getY() - _center.getY());
setZExtent(max.getZ() - _center.getZ());
Vector3.releaseTempInstance(min);
Vector3.releaseTempInstance(max);
}
private void checkMinMax(final Vector3 min, final Vector3 max, final ReadOnlyVector3 point) {
if (point.getX() < min.getX()) {
min.setX(point.getX());
} else if (point.getX() > max.getX()) {
max.setX(point.getX());
}
if (point.getY() < min.getY()) {
min.setY(point.getY());
} else if (point.getY() > max.getY()) {
max.setY(point.getY());
}
if (point.getZ() < min.getZ()) {
min.setZ(point.getZ());
} else if (point.getZ() > max.getZ()) {
max.setZ(point.getZ());
}
}
/**
* <code>containAABB</code> creates a minimum-volume axis-aligned bounding box of the points, then selects the
* smallest enclosing sphere of the box with the sphere centered at the boxes center.
*
* @param points
* the list of points.
*/
public void containAABB(final FloatBuffer points) {
if (points == null) {
return;
}
points.rewind();
if (points.remaining() <= 2) {
return;
}
final Vector3 compVect = Vector3.fetchTempInstance();
BufferUtils.populateFromBuffer(compVect, points, 0);
double minX = compVect.getX(), minY = compVect.getY(), minZ = compVect.getZ();
double maxX = compVect.getX(), maxY = compVect.getY(), maxZ = compVect.getZ();
for (int i = 1, len = points.remaining() / 3; i < len; i++) {
BufferUtils.populateFromBuffer(compVect, points, i);
if (compVect.getX() < minX) {
minX = compVect.getX();
} else if (compVect.getX() > maxX) {
maxX = compVect.getX();
}
if (compVect.getY() < minY) {
minY = compVect.getY();
} else if (compVect.getY() > maxY) {
maxY = compVect.getY();
}
if (compVect.getZ() < minZ) {
minZ = compVect.getZ();
} else if (compVect.getZ() > maxZ) {
maxZ = compVect.getZ();
}
}
Vector3.releaseTempInstance(compVect);
_center.set(minX + maxX, minY + maxY, minZ + maxZ);
_center.multiplyLocal(0.5f);
setXExtent(maxX - _center.getX());
setYExtent(maxY - _center.getY());
setZExtent(maxZ - _center.getZ());
}
/**
* <code>transform</code> modifies the center of the box to reflect the change made via a rotation, translation and
* scale.
*
* @param rotate
* the rotation change.
* @param translate
* the translation change.
* @param scale
* the size change.
* @param store
* box to store result in
*/
@Override
public BoundingVolume transform(final ReadOnlyQuaternion rotate, final ReadOnlyVector3 translate,
final ReadOnlyVector3 scale, final BoundingVolume store) {
BoundingBox box;
if (store == null || store.getType() != Type.AABB) {
box = new BoundingBox();
} else {
box = (BoundingBox) store;
}
_center.multiply(scale, box._center);
rotate.apply(box._center, box._center);
box._center.addLocal(translate);
final Vector3 compVect1 = Vector3.fetchTempInstance();
final Vector3 compVect2 = Vector3.fetchTempInstance();
final Matrix3 transMatrix = Matrix3.fetchTempInstance();
transMatrix.set(rotate);
// Make the rotation matrix all positive to get the maximum x/y/z extent
transMatrix.setValue(0, 0, Math.abs(transMatrix.getValue(0, 0)));
transMatrix.setValue(0, 1, Math.abs(transMatrix.getValue(0, 1)));
transMatrix.setValue(0, 2, Math.abs(transMatrix.getValue(0, 2)));
transMatrix.setValue(1, 0, Math.abs(transMatrix.getValue(1, 0)));
transMatrix.setValue(1, 1, Math.abs(transMatrix.getValue(1, 1)));
transMatrix.setValue(1, 2, Math.abs(transMatrix.getValue(1, 2)));
transMatrix.setValue(2, 0, Math.abs(transMatrix.getValue(2, 0)));
transMatrix.setValue(2, 1, Math.abs(transMatrix.getValue(2, 1)));
transMatrix.setValue(2, 2, Math.abs(transMatrix.getValue(2, 2)));
compVect1.set(getXExtent() * scale.getX(), getYExtent() * scale.getY(), getZExtent() * scale.getZ());
transMatrix.applyPost(compVect1, compVect2);
// Assign the biggest rotations after scales.
box.setXExtent(Math.abs(compVect2.getX()));
box.setYExtent(Math.abs(compVect2.getY()));
box.setZExtent(Math.abs(compVect2.getZ()));
Vector3.releaseTempInstance(compVect1);
Vector3.releaseTempInstance(compVect2);
Matrix3.releaseTempInstance(transMatrix);
return box;
}
/**
* <code>whichSide</code> takes a plane (typically provided by a view frustum) to determine which side this bound is
* on.
*
* @param plane
* the plane to check against.
*/
@Override
public Side whichSide(final ReadOnlyPlane plane) {
final ReadOnlyVector3 normal = plane.getNormal();
final double radius = Math.abs(getXExtent() * normal.getX()) + Math.abs(getYExtent() * normal.getY())
+ Math.abs(getZExtent() * normal.getZ());
final double distance = plane.pseudoDistance(_center);
if (distance < -radius) {
return Plane.Side.Inside;
} else if (distance > radius) {
return Plane.Side.Outside;
} else {
return Plane.Side.Neither;
}
}
/**
* <code>merge</code> combines this sphere with a second bounding sphere. This new sphere contains both bounding
* spheres and is returned.
*
* @param volume
* the sphere to combine with this sphere.
* @return the new sphere
*/
@Override
public BoundingVolume merge(final BoundingVolume volume) {
if (volume == null) {
return this;
}
switch (volume.getType()) {
case AABB: {
final BoundingBox vBox = (BoundingBox) volume;
return merge(vBox._center, vBox.getXExtent(), vBox.getYExtent(), vBox.getZExtent(), new BoundingBox(
new Vector3(0, 0, 0), 0, 0, 0));
}
case Sphere: {
final BoundingSphere vSphere = (BoundingSphere) volume;
return merge(vSphere._center, vSphere.getRadius(), vSphere.getRadius(), vSphere.getRadius(),
new BoundingBox(new Vector3(0, 0, 0), 0, 0, 0));
}
case OBB: {
final OrientedBoundingBox box = (OrientedBoundingBox) volume;
final BoundingBox rVal = (BoundingBox) this.clone(null);
return rVal.mergeOBB(box);
}
default:
return null;
}
}
/**
* <code>mergeLocal</code> combines this sphere with a second bounding sphere locally. Altering this sphere to
* contain both the original and the additional sphere volumes;
*
* @param volume
* the sphere to combine with this sphere.
* @return this
*/
@Override
public BoundingVolume mergeLocal(final BoundingVolume volume) {
if (volume == null) {
return this;
}
switch (volume.getType()) {
case AABB: {
final BoundingBox vBox = (BoundingBox) volume;
return merge(vBox._center, vBox.getXExtent(), vBox.getYExtent(), vBox.getZExtent(), this);
}
case Sphere: {
final BoundingSphere vSphere = (BoundingSphere) volume;
return merge(vSphere._center, vSphere.getRadius(), vSphere.getRadius(), vSphere.getRadius(), this);
}
case OBB: {
return mergeOBB((OrientedBoundingBox) volume);
}
default:
return null;
}
}
/**
* Merges this AABB with the given OBB.
*
* @param volume
* the OBB to merge this AABB with.
* @return This AABB extended to fit the given OBB.
*/
private BoundingBox mergeOBB(final OrientedBoundingBox volume) {
if (!volume.correctCorners) {
volume.computeCorners();
}
double minX, minY, minZ;
double maxX, maxY, maxZ;
minX = _center.getX() - getXExtent();
minY = _center.getY() - getYExtent();
minZ = _center.getZ() - getZExtent();
maxX = _center.getX() + getXExtent();
maxY = _center.getY() + getYExtent();
maxZ = _center.getZ() + getZExtent();
for (int i = 1; i < volume._vectorStore.length; i++) {
final Vector3 temp = volume._vectorStore[i];
if (temp.getX() < minX) {
minX = temp.getX();
} else if (temp.getX() > maxX) {
maxX = temp.getX();
}
if (temp.getY() < minY) {
minY = temp.getY();
} else if (temp.getY() > maxY) {
maxY = temp.getY();
}
if (temp.getZ() < minZ) {
minZ = temp.getZ();
} else if (temp.getZ() > maxZ) {
maxZ = temp.getZ();
}
}
_center.set(minX + maxX, minY + maxY, minZ + maxZ);
_center.multiplyLocal(0.5);
setXExtent(maxX - _center.getX());
setYExtent(maxY - _center.getY());
setZExtent(maxZ - _center.getZ());
return this;
}
/**
* <code>merge</code> combines this bounding box with another box which is defined by the center, x, y, z extents.
*
* @param boxCenter
* the center of the box to merge with
* @param boxX
* the x extent of the box to merge with.
* @param boxY
* the y extent of the box to merge with.
* @param boxZ
* the z extent of the box to merge with.
* @param rVal
* the resulting merged box.
* @return the resulting merged box.
*/
private BoundingBox merge(final Vector3 boxCenter, final double boxX, final double boxY, final double boxZ,
final BoundingBox rVal) {
final Vector3 compVect1 = Vector3.fetchTempInstance();
final Vector3 compVect2 = Vector3.fetchTempInstance();
compVect1.setX(_center.getX() - getXExtent());
if (compVect1.getX() > boxCenter.getX() - boxX) {
compVect1.setX(boxCenter.getX() - boxX);
}
compVect1.setY(_center.getY() - getYExtent());
if (compVect1.getY() > boxCenter.getY() - boxY) {
compVect1.setY(boxCenter.getY() - boxY);
}
compVect1.setZ(_center.getZ() - getZExtent());
if (compVect1.getZ() > boxCenter.getZ() - boxZ) {
compVect1.setZ(boxCenter.getZ() - boxZ);
}
compVect2.setX(_center.getX() + getXExtent());
if (compVect2.getX() < boxCenter.getX() + boxX) {
compVect2.setX(boxCenter.getX() + boxX);
}
compVect2.setY(_center.getY() + getYExtent());
if (compVect2.getY() < boxCenter.getY() + boxY) {
compVect2.setY(boxCenter.getY() + boxY);
}
compVect2.setZ(_center.getZ() + getZExtent());
if (compVect2.getZ() < boxCenter.getZ() + boxZ) {
compVect2.setZ(boxCenter.getZ() + boxZ);
}
_center.set(compVect2).addLocal(compVect1).multiplyLocal(0.5f);
setXExtent(compVect2.getX() - _center.getX());
setYExtent(compVect2.getY() - _center.getY());
setZExtent(compVect2.getZ() - _center.getZ());
Vector3.releaseTempInstance(compVect1);
Vector3.releaseTempInstance(compVect2);
return rVal;
}
/**
* <code>clone</code> creates a new BoundingBox object containing the same data as this one.
*
* @param store
* where to store the cloned information. if null or wrong class, a new store is created.
* @return the new BoundingBox
*/
@Override
public BoundingVolume clone(final BoundingVolume store) {
if (store != null && store.getType() == Type.AABB) {
final BoundingBox rVal = (BoundingBox) store;
rVal._center.set(_center);
rVal.setXExtent(_xExtent);
rVal.setYExtent(_yExtent);
rVal.setZExtent(_zExtent);
rVal._checkPlane = _checkPlane;
return rVal;
}
final BoundingBox rVal = new BoundingBox(_center, getXExtent(), getYExtent(), getZExtent());
return rVal;
}
/**
* <code>toString</code> returns the string representation of this object. The form is:
* "Radius: RRR.SSSS Center: <Vector>".
*
* @return the string representation of this.
*/
@Override
public String toString() {
return "com.ardor3d.scene.BoundingBox [Center: " + _center + " xExtent: " + getXExtent() + " yExtent: "
+ getYExtent() + " zExtent: " + getZExtent() + "]";
}
/**
* intersects determines if this Bounding Box intersects with another given bounding volume. If so, true is
* returned, otherwise, false is returned.
*
* @see com.ardor3d.bounding.BoundingVolume#intersects(com.ardor3d.bounding.BoundingVolume)
*/
@Override
public boolean intersects(final BoundingVolume bv) {
if (bv == null) {
return false;
}
return bv.intersectsBoundingBox(this);
}
/**
* determines if this bounding box intersects a given bounding sphere.
*
* @see com.ardor3d.bounding.BoundingVolume#intersectsSphere(com.ardor3d.bounding.BoundingSphere)
*/
@Override
public boolean intersectsSphere(final BoundingSphere bs) {
if (!Vector3.isValid(_center) || !Vector3.isValid(bs._center)) {
return false;
}
if (Math.abs(_center.getX() - bs.getCenter().getX()) < bs.getRadius() + getXExtent()
&& Math.abs(_center.getY() - bs.getCenter().getY()) < bs.getRadius() + getYExtent()
&& Math.abs(_center.getZ() - bs.getCenter().getZ()) < bs.getRadius() + getZExtent()) {
return true;
}
return false;
}
/**
* determines if this bounding box intersects a given bounding box. If the two boxes intersect in any way, true is
* returned. Otherwise, false is returned.
*
* @see com.ardor3d.bounding.BoundingVolume#intersectsBoundingBox(com.ardor3d.bounding.BoundingBox)
*/
@Override
public boolean intersectsBoundingBox(final BoundingBox bb) {
if (!Vector3.isValid(_center) || !Vector3.isValid(bb._center)) {
return false;
}
if (_center.getX() + getXExtent() < bb._center.getX() - bb.getXExtent()
|| _center.getX() - getXExtent() > bb._center.getX() + bb.getXExtent()) {
return false;
} else if (_center.getY() + getYExtent() < bb._center.getY() - bb.getYExtent()
|| _center.getY() - getYExtent() > bb._center.getY() + bb.getYExtent()) {
return false;
} else if (_center.getZ() + getZExtent() < bb._center.getZ() - bb.getZExtent()
|| _center.getZ() - getZExtent() > bb._center.getZ() + bb.getZExtent()) {
return false;
} else {
return true;
}
}
/**
* determines if this bounding box intersects with a given oriented bounding box.
*
* @see com.ardor3d.bounding.BoundingVolume#intersectsOrientedBoundingBox(com.ardor3d.bounding.OrientedBoundingBox)
*/
@Override
public boolean intersectsOrientedBoundingBox(final OrientedBoundingBox obb) {
return obb.intersectsBoundingBox(this);
}
/**
* determines if this bounding box intersects with a given ray object. If an intersection has occurred, true is
* returned, otherwise false is returned.
*
* @see com.ardor3d.bounding.BoundingVolume#intersects(com.ardor3d.math.Ray)
*/
@Override
public boolean intersects(final ReadOnlyRay3 ray) {
if (!Vector3.isValid(_center)) {
return false;
}
final Vector3 compVect1 = Vector3.fetchTempInstance();
final Vector3 compVect2 = Vector3.fetchTempInstance();
try {
final Vector3 diff = ray.getOrigin().subtract(getCenter(), compVect1);
final double fWdU0 = ray.getDirection().dot(Vector3.UNIT_X);
final double fAWdU0 = Math.abs(fWdU0);
final double fDdU0 = diff.dot(Vector3.UNIT_X);
final double fADdU0 = Math.abs(fDdU0);
if (fADdU0 > getXExtent() && fDdU0 * fWdU0 >= 0.0) {
return false;
}
final double fWdU1 = ray.getDirection().dot(Vector3.UNIT_Y);
final double fAWdU1 = Math.abs(fWdU1);
final double fDdU1 = diff.dot(Vector3.UNIT_Y);
final double fADdU1 = Math.abs(fDdU1);
if (fADdU1 > getYExtent() && fDdU1 * fWdU1 >= 0.0) {
return false;
}
final double fWdU2 = ray.getDirection().dot(Vector3.UNIT_Z);
final double fAWdU2 = Math.abs(fWdU2);
final double fDdU2 = diff.dot(Vector3.UNIT_Z);
final double fADdU2 = Math.abs(fDdU2);
if (fADdU2 > getZExtent() && fDdU2 * fWdU2 >= 0.0) {
return false;
}
final Vector3 wCrossD = ray.getDirection().cross(diff, compVect2);
final double fAWxDdU0 = Math.abs(wCrossD.dot(Vector3.UNIT_X));
double rhs = getYExtent() * fAWdU2 + getZExtent() * fAWdU1;
if (fAWxDdU0 > rhs) {
return false;
}
final double fAWxDdU1 = Math.abs(wCrossD.dot(Vector3.UNIT_Y));
rhs = getXExtent() * fAWdU2 + getZExtent() * fAWdU0;
if (fAWxDdU1 > rhs) {
return false;
}
final double fAWxDdU2 = Math.abs(wCrossD.dot(Vector3.UNIT_Z));
rhs = getXExtent() * fAWdU1 + getYExtent() * fAWdU0;
if (fAWxDdU2 > rhs) {
return false;
}
return true;
} finally {
Vector3.releaseTempInstance(compVect1);
Vector3.releaseTempInstance(compVect2);
}
}
/**
* @see com.ardor3d.bounding.BoundingVolume#intersectsWhere(com.ardor3d.math.Ray)
*/
@Override
public IntersectionRecord intersectsWhere(final ReadOnlyRay3 ray) {
final Vector3 compVect1 = Vector3.fetchTempInstance();
final Vector3 compVect2 = Vector3.fetchTempInstance();
final Vector3 diff = ray.getOrigin().subtract(_center, compVect1);
final ReadOnlyVector3 direction = ray.getDirection();
final double[] t = { 0.0, Double.POSITIVE_INFINITY };
final double saveT0 = t[0], saveT1 = t[1];
final boolean notEntirelyClipped = clip(direction.getX(), -diff.getX() - getXExtent(), t)
&& clip(-direction.getX(), diff.getX() - getXExtent(), t)
&& clip(direction.getY(), -diff.getY() - getYExtent(), t)
&& clip(-direction.getY(), diff.getY() - getYExtent(), t)
&& clip(direction.getZ(), -diff.getZ() - getZExtent(), t)
&& clip(-direction.getZ(), diff.getZ() - getZExtent(), t);
if (notEntirelyClipped && (t[0] != saveT0 || t[1] != saveT1)) {
if (t[1] > t[0]) {
final double[] distances = t;
final Vector3[] points = new Vector3[] {
new Vector3(ray.getDirection()).multiplyLocal(distances[0]).addLocal(ray.getOrigin()),
new Vector3(ray.getDirection()).multiplyLocal(distances[1]).addLocal(ray.getOrigin()) };
final IntersectionRecord record = new IntersectionRecord(distances, points);
Vector3.releaseTempInstance(compVect1);
Vector3.releaseTempInstance(compVect2);
return record;
}
final double[] distances = new double[] { t[0] };
final Vector3[] points = new Vector3[] { new Vector3(ray.getDirection()).multiplyLocal(distances[0])
.addLocal(ray.getOrigin()), };
final IntersectionRecord record = new IntersectionRecord(distances, points);
Vector3.releaseTempInstance(compVect1);
Vector3.releaseTempInstance(compVect2);
return record;
}
return new IntersectionRecord();
}
@Override
public boolean contains(final ReadOnlyVector3 point) {
return Math.abs(_center.getX() - point.getX()) < getXExtent()
&& Math.abs(_center.getY() - point.getY()) < getYExtent()
&& Math.abs(_center.getZ() - point.getZ()) < getZExtent();
}
@Override
public double distanceToEdge(final ReadOnlyVector3 point) {
// compute coordinates of point in box coordinate system
final Vector3 closest = point.subtract(_center, Vector3.fetchTempInstance());
// project test point onto box
double sqrDistance = 0.0;
double delta;
if (closest.getX() < -getXExtent()) {
delta = closest.getX() + getXExtent();
sqrDistance += delta * delta;
closest.setX(-getXExtent());
} else if (closest.getX() > getXExtent()) {
delta = closest.getX() - getXExtent();
sqrDistance += delta * delta;
closest.setX(getXExtent());
}
if (closest.getY() < -getYExtent()) {
delta = closest.getY() + getYExtent();
sqrDistance += delta * delta;
closest.setY(-getYExtent());
} else if (closest.getY() > getYExtent()) {
delta = closest.getY() - getYExtent();
sqrDistance += delta * delta;
closest.setY(getYExtent());
}
if (closest.getZ() < -getZExtent()) {
delta = closest.getZ() + getZExtent();
sqrDistance += delta * delta;
closest.setZ(-getZExtent());
} else if (closest.getZ() > getZExtent()) {
delta = closest.getZ() - getZExtent();
sqrDistance += delta * delta;
closest.setZ(getZExtent());
}
Vector3.releaseTempInstance(closest);
return Math.sqrt(sqrDistance);
}
/**
* <code>clip</code> determines if a line segment intersects the current test plane.
*
* @param denom
* the denominator of the line segment.
* @param numer
* the numerator of the line segment.
* @param t
* test values of the plane.
* @return true if the line segment intersects the plane, false otherwise.
*/
private boolean clip(final double denom, final double numer, final double[] t) {
// Return value is 'true' if line segment intersects the current test
// plane. Otherwise 'false' is returned in which case the line segment
// is entirely clipped.
if (denom > 0.0) {
if (numer > denom * t[1]) {
return false;
}
if (numer > denom * t[0]) {
t[0] = numer / denom;
}
return true;
} else if (denom < 0.0) {
if (numer > denom * t[0]) {
return false;
}
if (numer > denom * t[1]) {
t[1] = numer / denom;
}
return true;
} else {
return numer <= 0.0;
}
}
/**
* Query extent.
*
* @param store
* where extent gets stored - null to return a new vector
* @return store / new vector
*/
public Vector3 getExtent(Vector3 store) {
if (store == null) {
store = new Vector3();
}
store.set(getXExtent(), getYExtent(), getZExtent());
return store;
}
@Override
public void write(final Ardor3DExporter e) throws IOException {
super.write(e);
final OutputCapsule capsule = e.getCapsule(this);
capsule.write(getXExtent(), "xExtent", 0);
capsule.write(getYExtent(), "yExtent", 0);
capsule.write(getZExtent(), "zExtent", 0);
}
@Override
public void read(final Ardor3DImporter e) throws IOException {
super.read(e);
final InputCapsule capsule = e.getCapsule(this);
setXExtent(capsule.readDouble("xExtent", 0));
setYExtent(capsule.readDouble("yExtent", 0));
setZExtent(capsule.readDouble("zExtent", 0));
}
@Override
public double getVolume() {
return (8 * getXExtent() * getYExtent() * getZExtent());
}
}
| [
"[email protected]"
]
| |
d622feabac9452717a43aba5c6d4e36437bec100 | e6d7727f309768b5987bc3976f9a4f60c79833a2 | /common/src/main/java/applications/tools/randomNumberGenerator.java | f5206f338c17b0bf97cf409edafa2e4eee50aefb | [
"Apache-2.0"
]
| permissive | aqifhamid786/briskstream | 2eab0b2c5789b1978c5bffb8e821dbf1a21e30d2 | 05c591f6df59c6e06797c58eb431a52d160bc724 | refs/heads/master | 2023-05-09T21:53:46.263197 | 2019-06-23T15:24:44 | 2019-06-23T15:24:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package applications.tools;
import java.util.Random;
/**
* Created by I309939 on 7/29/2016.
*/
public class randomNumberGenerator {
public static int generate(int min, int max) {
final Random rn = new Random(System.nanoTime());
int result = rn.nextInt(max - min + 1) + min;
//System.out.println(result);
return result;
}
}
| [
"[email protected]"
]
| |
0063a17e19fe5f5e6cdc9c33e2adf2e4e4eeba89 | cc0bf1f54ca8cbfc0476d210b6ef277a8317c746 | /src/main/java/com/animalclass/demo/AnimalClassApplication.java | a1de33c972cdea7ce57596c0db24dabf9c66ea02 | []
| no_license | NatashaLBallard/animalClass | ab8a713daee736d79a88176b3b0f74f6303ea6b5 | 3c33a8927318bf2f5ebe501293babda81d562ee3 | refs/heads/master | 2021-09-05T19:22:27.858684 | 2018-01-30T14:27:10 | 2018-01-30T14:27:10 | 119,517,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package com.animalclass.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AnimalClassApplication {
public static void main(String[] args) {
SpringApplication.run(AnimalClassApplication.class, args);
}
}
| [
"[[email protected]]"
]
| |
a7926e18fd90af05ed91f4c89dfaededf54ddaee | ccbfd679838f82312d7e146b4d9907ff91b5d903 | /src/Module/Ticket/TicketService.java | 7741cf76630a840991150f04f54a49da9ea02bb8 | []
| no_license | trangkum/btl | 4e6d737bf14236b985064ab821ee652a27961a04 | 60d81b03a815590b83fccdad56218cd094d74bf5 | refs/heads/master | 2021-08-30T19:36:25.848123 | 2017-12-19T05:59:18 | 2017-12-19T06:41:15 | 112,003,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,959 | java | package Module.Ticket;
import Manager.Entity.DatabaseEntity;
import Manager.Interface.IDatabaseControllService;
import Manager.Interface.IDatabaseService;
import Manager.Service.DatabaseControllService;
import Manager.Service.DatabaseService;
import Module.Employee.EmployeeService;
import Module.Enum.EnumValue;
import Module.Enum.ReadStatus;
import Module.Enum.TicketStatus;
import Module.File.FileService;
import Module.Location.LocationEntity;
import Module.Location.LocationService;
import Module.TicketImage.TicketImageService;
import Module.TicketRead.TicketReadEntity;
import Module.TicketRead.TicketReadService;
import Module.TicketRelater.TicketRelaterEntity;
import Module.TicketRelater.TicketRelaterService;
import Module.TicketRelater.TicketrelaterModel;
import Module.TicketThread.TicketThreadEntity;
import Module.TicketThread.TicketthreadModel;
import Module.User.TokenEntity;
import Module.User.TokenService;
import Module.User.UserEntity;
import Module.User.UserService;
import com.google.common.collect.Lists;
import com.mysql.cj.core.util.StringUtils;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import javax.persistence.NoResultException;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import javax.ws.rs.BadRequestException;
import javax.ws.rs.core.Cookie;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
public class TicketService {
private static SessionFactory factory;
private static int currentActive;
LocationService locationService = new LocationService();
TokenService tokenService = new TokenService();
UserService userService = new UserService();
EmployeeService employeeService = new EmployeeService();
TicketRelaterService ticketRelaterService = new TicketRelaterService();
TicketImageService ticketImageService = new TicketImageService();
TicketReadService ticketReadService = new TicketReadService();
FileService fileService = new FileService();
public TicketService(SessionFactory factory) {
this.factory = factory;
}
public TicketService() {
if (factory == null || currentActive != DatabaseEntity.Active) {
IDatabaseService databaseService = new DatabaseService();
IDatabaseControllService databaseControllService = new DatabaseControllService();
factory = databaseControllService.createConfiguration(databaseService.get(DatabaseEntity.Active)).buildSessionFactory();
currentActive = DatabaseEntity.Active;
}
}
public static void setFactory(SessionFactory factory) {
TicketService.factory = factory;
}
public TicketEntity get(int id) {
Session session = factory.openSession();
CriteriaBuilder builder = session.getCriteriaBuilder();
CriteriaQuery<TicketModel> criteria = builder.createQuery(TicketModel.class);
Root<TicketModel> TicketModels = criteria.from(TicketModel.class);
criteria.where(builder.equal(TicketModels.get("id"), id));
try {
TicketModel ticketModel = session.createQuery(criteria).getSingleResult();
TicketEntity ticketEntity = new TicketEntity(ticketModel,ticketModel.getTicketrelatersById());
return ticketEntity;
} catch (NoResultException e) {
return null;
} finally {
session.close();
}
}
public TicketEntity getFullInfo(int id) {
Session session = factory.openSession();
CriteriaBuilder builder = session.getCriteriaBuilder();
CriteriaQuery<TicketModel> criteria = builder.createQuery(TicketModel.class);
Root<TicketModel> TicketModels = criteria.from(TicketModel.class);
criteria.where(builder.equal(TicketModels.get("id"), id));
try {
TicketModel ticketModel = session.createQuery(criteria).getSingleResult();
TicketEntity ticketEntity = new TicketEntity(ticketModel, ticketModel.getTicketthreadsById(), ticketModel.getTicketimagesById(), ticketModel.getEmployeeByCreateEmployeeId(), ticketModel.getLocationByLocationId(), ticketModel.getTicketrelatersById());
if (ticketEntity.assignedEmployeeId != null)
ticketEntity.assignedEmployeeEntity = employeeService.get(ticketEntity.assignedEmployeeId);
if (ticketEntity.ticketRelaterEntities != null && ticketEntity.ticketRelaterEntities.size() > 0) {
ticketEntity.ticketRelaterEntities.parallelStream().forEach(ticketRelaterEntity -> {
ticketRelaterEntity.employeeEntity = employeeService.get(ticketRelaterEntity.employeeId);
});
}
if (ticketEntity.ticketImageEntities != null && ticketEntity.ticketImageEntities.size() > 0) {
ticketEntity.ticketImageEntities.parallelStream().forEach(ticketImageEntity -> {
ticketImageEntity.fileEntity = fileService.get(ticketImageEntity.fileId);
});
}
if (ticketEntity.ticketThreadEntities != null && ticketEntity.ticketThreadEntities.size() > 0) {
ticketEntity.ticketThreadEntities.parallelStream().forEach(ticketThreadEntity -> {
ticketThreadEntity.employeeEntity = employeeService.get(ticketThreadEntity.employeeId);
});
}
return ticketEntity;
} catch (NoResultException e) {
return null;
} finally {
session.close();
}
}
public TicketEntity create(Cookie tokenKey, TicketEntity ticketEntity) {
Transaction tx = null;
if (StringUtils.isNullOrEmpty(ticketEntity.content) || ticketEntity.content.equals("<br>"))
throw new BadRequestException("Nội dung không được để trống!");
if (StringUtils.isNullOrEmpty(ticketEntity.subject))
throw new BadRequestException("Tên công việc không được để trống!");
if (ticketEntity.priority == null) throw new BadRequestException("Chưa chọn mức độ ưu tiên!");
if (ticketEntity.deadline == null) throw new BadRequestException("Chưa chọn ngày hết hạn!");
if (ticketEntity.locationId == null) throw new BadRequestException("Chưa chọn bộ phận IT!");
ticketEntity.status = Lists.newArrayList(TicketStatus.values()).indexOf(TicketStatus.New) + 1;
TokenEntity tokenEntity = tokenService.getByTokenKey(tokenKey.getValue());
UserEntity userEntity = userService.get(tokenEntity.userId);
ticketEntity.createEmployeeId = userEntity.employeeId;
ticketEntity.createdTime = Timestamp.valueOf(LocalDateTime.now()).toString();
LocationEntity locationEntity = locationService.get(ticketEntity.locationId);
if (locationEntity == null) throw new BadRequestException("Bộ phận IT không hợp lệ!");
ticketEntity.assignedEmployeeId = locationEntity.managerEmloyeeId;
ticketEntity.ticketRelaterEntities = ticketEntity.ticketRelaterEntities.parallelStream().filter(ticketRelaterEntity -> {
return employeeService.get(ticketRelaterEntity.employeeId) != null;
}).collect(Collectors.toList());
try (Session session = factory.openSession()) {
tx = session.beginTransaction();
TicketModel ticketModel = ticketEntity.toModel(ticketEntity.ticketImageEntities);
Integer.valueOf(String.valueOf(session.save(ticketModel)));
tx.commit();
TicketEntity result = new TicketEntity(ticketModel);
if (ticketEntity.ticketRelaterEntities != null) {
ticketEntity.ticketRelaterEntities.parallelStream().forEach(ticketRelaterEntity -> {
ticketRelaterEntity.ticketId = result.id;
ticketRelaterService.create(ticketRelaterEntity);
TicketReadEntity ticketReadEntity = new TicketReadEntity();
ticketReadEntity.employeeId = ticketRelaterEntity.employeeId;
ticketReadEntity.ticketId = result.id;
ticketReadEntity.status = EnumValue.Parse(ReadStatus.UnRead);
ticketReadService.create(ticketReadEntity);
});
}
if (ticketEntity.ticketImageEntities != null) {
ticketEntity.ticketImageEntities.parallelStream().forEach(ticketImageEntity -> {
ticketImageEntity.ticketId = result.id;
ticketImageService.create(ticketImageEntity);
});
}
TicketReadEntity ticketReadEntity = new TicketReadEntity();
ticketReadEntity.employeeId = ticketEntity.createEmployeeId;
ticketReadEntity.ticketId = result.id;
ticketReadEntity.status = EnumValue.Parse(ReadStatus.UnRead);
ticketReadService.create(ticketReadEntity);
ticketReadEntity.employeeId = ticketEntity.assignedEmployeeId;
ticketReadService.create(ticketReadEntity);
return result;
} catch (HibernateException e) {
if (tx != null) tx.rollback();
e.printStackTrace();
}
return null;
}
public TicketThreadEntity addThread(Cookie tokenKey, Integer ticketId, TicketThreadEntity ticketThreadEntity) {
Transaction tx = null;
if (StringUtils.isNullOrEmpty(ticketThreadEntity.content) || ticketThreadEntity.content.equals("<br>"))
throw new BadRequestException("Nội dung không được để trống!");
TokenEntity tokenEntity = tokenService.getByTokenKey(tokenKey.getValue());
UserEntity userEntity = userService.get(tokenEntity.userId);
try (Session session = factory.openSession()) {
ticketThreadEntity.ticketId = ticketId;
ticketThreadEntity.employeeId = userEntity.employeeId;
ticketThreadEntity.createTime = Timestamp.valueOf(LocalDateTime.now()).toString();
ticketThreadEntity.updateTime = Timestamp.valueOf(LocalDateTime.now()).toString();
tx = session.beginTransaction();
TicketthreadModel ticketthreadModel = ticketThreadEntity.toModel();
session.save(ticketthreadModel);
tx.commit();
TicketThreadEntity ticketThreadEntity1 = new TicketThreadEntity(ticketthreadModel);
ticketThreadEntity1.employeeEntity = employeeService.get(userEntity.employeeId);
return ticketThreadEntity1;
} catch (HibernateException e) {
if (tx != null) tx.rollback();
e.printStackTrace();
}
return null;
}
public TicketEntity update(Cookie tokenKey, int ticketId, TicketEntity ticketEntity) {
TicketEntity ticketEntityUp = get(ticketId);
ticketEntity.createEmployeeId = ticketEntityUp.createEmployeeId;
if (ticketEntity.priority == null) throw new BadRequestException("Chưa chọn mức độ ưu tiên!");
if (ticketEntity.deadline == null) throw new BadRequestException("Chưa chọn ngày hết hạn!");
if (ticketEntity.locationId == null) throw new BadRequestException("Chưa chọn bộ phận IT!");
if (ticketEntity.assignedEmployeeId == null) throw new BadRequestException("Chưa chọn người thực hiện!");
TokenEntity tokenEntity = tokenService.getByTokenKey(tokenKey.getValue());
UserEntity userEntity = userService.get(tokenEntity.userId);
ticketEntity.createEmployeeId = userEntity.employeeId;
ticketEntity.updatedTime = Timestamp.valueOf(LocalDateTime.now()).toString();
LocationEntity locationEntity = locationService.get(ticketEntity.locationId);
if (locationEntity == null) throw new BadRequestException("Bộ phận IT không hợp lệ!");
Transaction tx = null;
ticketEntity.ticketRelaterEntities = ticketEntity.ticketRelaterEntities.parallelStream().filter(ticketRelaterEntity -> {
return employeeService.get(ticketRelaterEntity.employeeId) != null;
}).collect(Collectors.toList());
try (Session session = factory.openSession()) {
tx = session.beginTransaction();
TicketModel ticketModel = ticketEntity.toModel();
ticketModel.setContent(ticketEntityUp.content);
ticketModel.setSubject(ticketEntityUp.subject);
session.update(ticketModel);
TicketEntity result = get(ticketId);
if (ticketEntity.ticketRelaterEntities != null) {
if (result.ticketRelaterEntities == null) {
ticketEntity.ticketRelaterEntities.forEach(ticketRelaterEntity -> {
ticketRelaterEntity.ticketId = result.id;
ticketRelaterService.create(ticketRelaterEntity);
TicketReadEntity ticketReadEntity = new TicketReadEntity();
ticketReadEntity.employeeId = ticketRelaterEntity.employeeId;
ticketReadEntity.ticketId = result.id;
ticketReadEntity.status = EnumValue.Parse(ReadStatus.UnRead);
ticketReadService.create(ticketReadEntity);
});
} else {
List<TicketRelaterEntity> addList = ticketEntity.ticketRelaterEntities.parallelStream().filter(ticketRelaterEntity -> {
return result.ticketRelaterEntities.parallelStream().noneMatch(ticketthreadModel -> {
return ticketthreadModel.employeeId == ticketRelaterEntity.employeeId;
});
}).distinct().collect(Collectors.toList());
List<TicketRelaterEntity> removeList = result.ticketRelaterEntities.parallelStream().filter(ticketthreadModel -> {
return ticketEntity.ticketRelaterEntities.parallelStream().noneMatch(ticketRelaterEntity -> {
return ticketthreadModel.employeeId == ticketRelaterEntity.employeeId;
});
}).collect(Collectors.toList());
removeList.forEach(ticketRelaterEntity -> {
ticketRelaterEntity.ticketId = (result.id);
session.delete(ticketRelaterEntity.toModel());
TicketReadEntity ticketReadEntity = ticketReadService.get(result.id,ticketRelaterEntity.employeeId);
session.delete(ticketReadEntity.toModel());
});
tx.commit();
addList.forEach(ticketRelaterEntity -> {
ticketRelaterEntity.ticketId = result.id;
ticketRelaterService.create(ticketRelaterEntity);
});
addList.forEach(ticketRelaterEntity -> {
TicketReadEntity ticketReadEntity = new TicketReadEntity();
ticketReadEntity.employeeId = ticketRelaterEntity.employeeId;
ticketReadEntity.ticketId = result.id;
ticketReadEntity.status = EnumValue.Parse(ReadStatus.UnRead);
ticketReadService.create(ticketReadEntity);
});
}
}
return result;
} catch (HibernateException e) {
if (tx != null) tx.rollback();
e.printStackTrace();
}
return null;
}
public boolean delete(int id) {
Transaction tx = null;
try (Session session = factory.openSession()) {
tx = session.beginTransaction();
TicketModel ticketModel = new TicketModel();
ticketModel.setId(id);
session.delete(ticketModel);
tx.commit();
return true;
} catch (HibernateException e) {
if (tx != null) tx.rollback();
e.printStackTrace();
}
return false;
}
public List<TicketEntity> get(SearchTicketEntity searchTicketEntity) {
Session session = factory.openSession();
CriteriaBuilder builder = session.getCriteriaBuilder();
CriteriaQuery<TicketModel> criteria = builder.createQuery(TicketModel.class);
Root<TicketModel> TicketModels = criteria.from(TicketModel.class);
try {
List<TicketModel> ticketList = session.createQuery(criteria).getResultList();
return ticketList.stream()
.map(s -> new TicketEntity(s)).collect(Collectors.toList());
} catch (NoResultException e) {
return null;
} finally {
session.close();
}
}
}
| [
"[email protected]"
]
| |
54c36a3ccba145bc4c43b9577abbf7b6b5c2752d | 377405a1eafa3aa5252c48527158a69ee177752f | /src/com/braintreepayments/api/threedsecure/ThreeDSecureWebChromeClient.java | d07868eab0133d89601f66eacc87a792de5991de | []
| no_license | apptology/AltFuelFinder | 39c15448857b6472ee72c607649ae4de949beb0a | 5851be78af47d1d6fcf07f9a4ad7f9a5c4675197 | refs/heads/master | 2016-08-12T04:00:46.440301 | 2015-10-25T18:25:16 | 2015-10-25T18:25:16 | 44,921,258 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,583 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.braintreepayments.api.threedsecure;
import android.os.Message;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
// Referenced classes of package com.braintreepayments.api.threedsecure:
// ThreeDSecureWebViewActivity, ThreeDSecureWebView
public class ThreeDSecureWebChromeClient extends WebChromeClient
{
private ThreeDSecureWebViewActivity mActivity;
public ThreeDSecureWebChromeClient(ThreeDSecureWebViewActivity threedsecurewebviewactivity)
{
mActivity = threedsecurewebviewactivity;
}
public void onCloseWindow(WebView webview)
{
mActivity.popCurrentWebView();
}
public boolean onCreateWindow(WebView webview, boolean flag, boolean flag1, Message message)
{
webview = new ThreeDSecureWebView(mActivity);
webview.init(mActivity);
mActivity.pushNewWebView(webview);
((android.webkit.WebView.WebViewTransport)message.obj).setWebView(webview);
message.sendToTarget();
return true;
}
public void onProgressChanged(WebView webview, int i)
{
super.onProgressChanged(webview, i);
if (i < 100)
{
mActivity.setProgress(i);
mActivity.setProgressBarVisibility(true);
return;
} else
{
mActivity.setProgressBarVisibility(false);
return;
}
}
}
| [
"[email protected]"
]
| |
ea4bf4ecd43eb116613cb930f6fa11287c249146 | cd0e68a4cede7620bc2a44246e6f48275b556a1b | /RemoteService/app/src/test/java/com/example/yudongzhou/remoteservice/ExampleUnitTest.java | d90e75e41731af3f9a9fdae4bdc83c027df4d864 | []
| no_license | zhouyudonghit/MyPractisePro | bbf1663011d97103a048738671d6f6c3669800da | 2fbfafd7d1e7cf6dc2da647d0babdcc518871da7 | refs/heads/master | 2021-12-23T10:22:18.659649 | 2021-10-10T15:19:19 | 2021-10-10T15:19:19 | 131,786,721 | 0 | 1 | null | 2018-09-16T11:14:35 | 2018-05-02T02:20:41 | Java | UTF-8 | Java | false | false | 397 | java | package com.example.yudongzhou.remoteservice;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
f86fdc4b863f73273807080985599f638851e06a | deb9c613a77c163f5969ab8a12a3ef3a31a428bf | /src/main/java/com/jpql/entity/entityType/Album.java | 3d9d3fa2f5de7c64f61c8f9b3092b7288410c0e4 | []
| no_license | jaenyeong/Study_JPA-Basic | dbf7bf6eef8ff688299298de46948521373ac0b5 | d1d5e7f3a4172c6704a24b69661108a50be5a35e | refs/heads/master | 2023-03-06T21:55:48.716285 | 2021-02-16T10:16:27 | 2021-02-16T10:16:27 | 237,733,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package com.jpql.entity.entityType;
import javax.persistence.Entity;
@Entity
public class Album extends Item {
private String artist;
private String etc;
public String getArtist() {
return artist;
}
public Album setArtist(String artist) {
this.artist = artist;
return this;
}
public String getEtc() {
return etc;
}
public Album setEtc(String etc) {
this.etc = etc;
return this;
}
}
| [
"[email protected]"
]
| |
58642239835345ad73cd3abc38087fbfb265be23 | bc822718fbfad6164ac02b39c937cf9a93be43b6 | /src/main/java/cn/lsu/chicken/room/domain/Service.java | 14a3437e9ca11d29fdb5cf6bd1adcff3c1d4c5bb | []
| no_license | InTheBloodHorse/IntelligentRoom | c430899fc9096fe9bab4c5bbd25d5fe2362c9a7d | dceb53f5dd0720172734c9baf660e377920e86bf | refs/heads/master | 2020-04-17T07:54:27.715501 | 2019-06-08T12:34:15 | 2019-06-08T12:34:15 | 166,389,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 523 | java | package cn.lsu.chicken.room.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.Pattern;
@Data
public class Service {
private Integer id;
private Integer applyId;
private Integer workerId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date applyTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date serviceTime;
private String content;
} | [
"[email protected]"
]
| |
d4032e93be041b4183ab1013950d8e1015f2d1e5 | 4d423358fe36cabc99a518de68c2c6b69f901eba | /src/main/java/com/aequalis/scintilla/QRCodeProcessor.java | 9d0922c05c8660102578ef10e96bcf94d72c6bc9 | []
| no_license | anandsemtech/scintilla | a9e1e8e441d719d7345d858c8c8578b7f109e35a | f359a30048d1c10324075213c31c30695b19f6c7 | refs/heads/master | 2021-01-21T11:18:43.222924 | 2017-04-05T06:12:37 | 2017-04-05T06:12:37 | 83,550,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 707 | java | /**
*
*/
package com.aequalis.scintilla;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import net.glxn.qrgen.core.image.ImageType;
import net.glxn.qrgen.javase.QRCode;
/**
* @author leoanbarasanm
*
*/
public class QRCodeProcessor {
public static final String PATH = "";
public static byte[] generateQRCode(String bcAddress) {
ByteArrayOutputStream out = QRCode.from(bcAddress).to(ImageType.PNG).withSize(250, 250).stream();
return out.toByteArray();
}
public static void main(String[] args) {
System.out.println(QRCodeProcessor.generateQRCode("LeoAnbarasanM"));
}
}
| [
"[email protected]"
]
| |
0bb9a8707e28de3a91adefd2bfa44e0a135e1a78 | a20d8ed202fe3e2a5d359f454bff2ed6c4c87441 | /src/main/java/com/my/hps/webapp/controller/queryparam/HeatingMaintainCharge2015QueryParam.java | 68cdbc1445e373541249d1a67a1a62452c828c60 | []
| no_license | moxiangsheng/hps | a5ae0356fb6d7c8ca951b8488558530e44fd20bb | 92f2cb3bf35c975b71b51717682c5ddd6f569423 | refs/heads/master | 2021-01-17T19:55:38.961960 | 2015-07-07T13:55:07 | 2015-07-07T13:55:07 | 64,923,315 | 2 | 0 | null | 2016-08-04T09:50:14 | 2016-08-04T09:50:14 | null | UTF-8 | Java | false | false | 1,637 | java | package com.my.hps.webapp.controller.queryparam;
public class HeatingMaintainCharge2015QueryParam extends HouseQueryParam {
private Long paymentDateId;
// 欠费,未欠费,已取消
private String chargeState;
/**
* 是否免缴
*/
private boolean gratis = false;
/**
* 操作员
*/
private String operName;
/**
* 缴费日期
*/
private String chargeDate;
/**
* 工资号
*/
private String wageNum;
public Long getPaymentDateId() {
return paymentDateId;
}
public void setPaymentDateId(Long paymentDateId) {
this.paymentDateId = paymentDateId;
}
public boolean isEmpty() {
return super.isEmpty() && paymentDateId == null;
}
public String getChargeState() {
return chargeState;
}
public void setChargeState(String chargeState) {
this.chargeState = chargeState;
}
private String recordRemarks;
public String getRecordRemarks() {
return recordRemarks;
}
public void setRecordRemarks(String recordRemarks) {
this.recordRemarks = recordRemarks;
}
public String getOperName() {
return operName;
}
public void setOperName(String operName) {
this.operName = operName;
}
public String getChargeDate() {
return chargeDate;
}
public void setChargeDate(String chargeDate) {
this.chargeDate = chargeDate;
}
public boolean isGratis() {
return gratis;
}
public void setGratis(boolean gratis) {
this.gratis = gratis;
}
public String getWageNum() {
return wageNum;
}
public void setWageNum(String wageNum) {
this.wageNum = wageNum;
}
}
| [
"[email protected]"
]
| |
7462e9d6509558c0eb336092b54b4a38546d4066 | 3c3f5875d8ce25ba925b3af7ad4d78da3dd6856e | /app/src/test/java/com/user/songratingsystem/ExampleUnitTest.java | f91cd5fe6abe50e1463ea25c42d1a34f488166ba | []
| no_license | sudeep16/SongRatingSystem | 77bbb24853ea3c1b38b9855ebc0478a635fb9536 | 6ea44a6b296a5ba680b586ba2f8fc5e745a2d87a | refs/heads/master | 2020-09-14T10:02:02.117204 | 2019-11-21T06:10:54 | 2019-11-21T06:10:54 | 211,114,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.user.songratingsystem;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
5b5a099f44cb28041d40e863241bf566bc99535e | 6db2d2f243e0a88fa7d8c23282a989464c3283fc | /riims-service-api/src/main/java/com/hkntv/riims/core/service/TrackDivisionInfoService.java | f45a246438c7abfd4eb0909736839566146b4cfe | []
| no_license | zaki1991/riims | 93459e542020562d27acd748614c2f2875854365 | a19addb187f4deb8b5a68b737ff31bd8d1589c12 | refs/heads/master | 2020-05-18T19:05:35.109630 | 2015-08-11T16:23:22 | 2015-08-11T16:23:22 | 40,549,490 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | java |
package com.hkntv.riims.core.service;
import com.hkntv.riims.core.model.TrackDivisionInfoModel;
import java.util.Date;
public interface TrackDivisionInfoService{
public int create(TrackDivisionInfoModel trackDivisionInfoModel);
public int createSelective(TrackDivisionInfoModel trackDivisionInfoModel);
public TrackDivisionInfoModel findByPrimaryKey(String id);
public int updateByPrimaryKey(TrackDivisionInfoModel trackDivisionInfoModel);
public int updateByPrimaryKeySelective(TrackDivisionInfoModel trackDivisionInfoModel);
public int deleteByPrimaryKey(String id);
public int selectCount(TrackDivisionInfoModel trackDivisionInfoModel);
} | [
"[email protected]"
]
| |
4cad43d609573ad3ebf55f84ef2e65e206111325 | d4fe98f984727ee5958ca4994ee2a7240b7fb086 | /src/main/java/org/board/persistence/ReplyDAO.java | b11f5b2ab08d1648df8fedb5b9915b4611128bdb | []
| no_license | soo-dev/SpringBoard | 2e13c24a8a10c8eab607df39d340de18ef36d2bb | cb5278b3c82ff963da4e7d4ff81ca3c08e0e4520 | refs/heads/master | 2020-04-20T07:27:59.006615 | 2019-04-07T03:06:54 | 2019-04-07T03:06:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package org.board.persistence;
import java.util.List;
import org.board.domain.Criteria;
import org.board.domain.ReplyVO;
public interface ReplyDAO {
public List<ReplyVO> list(Integer b_no) throws Exception;
public void create(ReplyVO vo) throws Exception;
public void update(ReplyVO vo) throws Exception;
public void delete(Integer rno) throws Exception;
public List<ReplyVO> listPage(Integer b_no, Criteria cri) throws Exception;
public int count(Integer b_no) throws Exception;
public int getB_no(Integer rno) throws Exception;
}
| [
"[email protected]"
]
| |
fc6203737758db2e513b15e0fe172d7c9f59ab51 | 6be39fc2c882d0b9269f1530e0650fd3717df493 | /weixin反编译/sources/com/tencent/mm/plugin/mmsight/segment/RecyclerThumbSeekBar.java | f64072c3859416b4b4ed1a78563aee6e487a0dfe | []
| no_license | sir-deng/res | f1819af90b366e8326bf23d1b2f1074dfe33848f | 3cf9b044e1f4744350e5e89648d27247c9dc9877 | refs/heads/master | 2022-06-11T21:54:36.725180 | 2020-05-07T06:03:23 | 2020-05-07T06:03:23 | 155,177,067 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,851 | java | package com.tencent.mm.plugin.mmsight.segment;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.HandlerThread;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.k;
import android.support.v7.widget.RecyclerView.t;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import com.tencent.mm.memory.o;
import com.tencent.mm.modelsfs.FileOp;
import com.tencent.mm.sdk.platformtools.ag;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.Callable;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.locks.Lock;
public class RecyclerThumbSeekBar extends RelativeLayout implements c {
public int hQf = -1;
private int hcY;
private int hcZ;
private RecyclerView jTh;
private int oEb;
public com.tencent.mm.plugin.mmsight.segment.c.a oEc;
public com.tencent.mm.plugin.mmsight.segment.c.b oEd;
private c oEe;
private n oEf;
private int oEg;
private com.tencent.mm.plugin.mmsight.segment.d.a oEh = new com.tencent.mm.plugin.mmsight.segment.d.a(new Callable<d>() {
public final /* synthetic */ Object call() {
d fFmpegSightJNIThumbFetcher = new FFmpegSightJNIThumbFetcher();
fFmpegSightJNIThumbFetcher.init(RecyclerThumbSeekBar.this.path, RecyclerThumbSeekBar.this.oEb, RecyclerThumbSeekBar.this.hcZ, RecyclerThumbSeekBar.this.hcY);
return fFmpegSightJNIThumbFetcher;
}
});
private Runnable oEi = new Runnable() {
public final void run() {
if (RecyclerThumbSeekBar.this.getHeight() == 0 || RecyclerThumbSeekBar.this.getWidth() == 0) {
RecyclerThumbSeekBar.this.post(RecyclerThumbSeekBar.this.oEi);
return;
}
RecyclerThumbSeekBar.this.oEb = 1000;
RecyclerThumbSeekBar.this.hcY = RecyclerThumbSeekBar.this.getHeight();
RecyclerThumbSeekBar.this.hcZ = (RecyclerThumbSeekBar.this.getWidth() - (RecyclerThumbSeekBar.this.oEg * 2)) / 10;
com.tencent.mm.sdk.f.e.post(new Runnable() {
public final void run() {
int i;
try {
d bbI = RecyclerThumbSeekBar.this.oEh.bbI();
RecyclerThumbSeekBar.this.hQf = bbI.getDurationMs();
RecyclerThumbSeekBar.this.oEh.a(bbI);
i = 1;
} catch (Throwable e) {
x.printErrStackTrace("RecyclerThumbSeekBar", e, "Try to init fetcher error : %s", e.getMessage());
i = 0;
}
if (i == 0) {
RecyclerThumbSeekBar.this.bbR();
return;
}
if (RecyclerThumbSeekBar.this.hQf >= 10000) {
RecyclerThumbSeekBar.this.oEb = 1000;
} else if (RecyclerThumbSeekBar.this.hQf > 0) {
RecyclerThumbSeekBar.this.oEb = RecyclerThumbSeekBar.this.hQf / 10;
} else {
x.e("RecyclerThumbSeekBar", "RecyclerThumbSeekBar duration invalid %d", Integer.valueOf(RecyclerThumbSeekBar.this.hQf));
RecyclerThumbSeekBar.this.bbR();
return;
}
x.d("RecyclerThumbSeekBar", "duration %d interval %d", Integer.valueOf(RecyclerThumbSeekBar.this.hQf), Integer.valueOf(RecyclerThumbSeekBar.this.oEb));
ah.y(new Runnable() {
public final void run() {
try {
RecyclerThumbSeekBar.this.oEf.am(-1.0f);
RecyclerThumbSeekBar.this.oEe = new c(RecyclerThumbSeekBar.this, (byte) 0);
int e = RecyclerThumbSeekBar.e(RecyclerThumbSeekBar.this, 10000);
int e2 = RecyclerThumbSeekBar.e(RecyclerThumbSeekBar.this, 1000);
RecyclerThumbSeekBar.this.oEg = (RecyclerThumbSeekBar.this.getWidth() - e) / 2;
n k = RecyclerThumbSeekBar.this.oEf;
k.post(new com.tencent.mm.plugin.mmsight.segment.n.AnonymousClass1(e, RecyclerThumbSeekBar.this.oEg, e2));
x.i("RecyclerThumbSeekBar", "RecyclerThumbSeekBar.run(212) width %d", Integer.valueOf(RecyclerThumbSeekBar.this.getWidth()));
RecyclerThumbSeekBar.this.oEe.oEr = (RecyclerThumbSeekBar.this.getWidth() - RecyclerThumbSeekBar.this.oEg) - e;
RecyclerThumbSeekBar.this.oEe.oEq = RecyclerThumbSeekBar.this.oEg;
RecyclerThumbSeekBar.this.jTh.a(RecyclerThumbSeekBar.this.oEe);
x.d("RecyclerThumbSeekBar", "init segment thumb fetcher end, adapter.getItemCount() %d", Integer.valueOf(RecyclerThumbSeekBar.this.oEe.getItemCount()));
if (RecyclerThumbSeekBar.this.oEc != null) {
RecyclerThumbSeekBar.this.oEc.gJ(false);
}
} catch (Throwable e3) {
x.printErrStackTrace("RecyclerThumbSeekBar", e3, "RecyclerThumbSeekBar notifySuccess error : %s", e3.getMessage());
if (RecyclerThumbSeekBar.this.oEc != null) {
RecyclerThumbSeekBar.this.oEc.gJ(true);
}
}
}
});
}
}, "check duration of ");
}
};
private k oEj = new k() {
public final void e(RecyclerView recyclerView, int i) {
if (i == 0 && RecyclerThumbSeekBar.this.oEd != null) {
RecyclerThumbSeekBar.this.oEd.A(RecyclerThumbSeekBar.this.bbF(), RecyclerThumbSeekBar.this.bbG());
}
}
};
private com.tencent.mm.plugin.mmsight.segment.n.a oEk = new com.tencent.mm.plugin.mmsight.segment.n.a() {
public final void bbS() {
if (RecyclerThumbSeekBar.this.oEd != null && RecyclerThumbSeekBar.this.oEe != null) {
com.tencent.mm.plugin.mmsight.segment.c.b o = RecyclerThumbSeekBar.this.oEd;
RecyclerThumbSeekBar.this.bbF();
RecyclerThumbSeekBar.this.bbG();
o.bbH();
}
}
public final void bbT() {
if (RecyclerThumbSeekBar.this.oEd != null && RecyclerThumbSeekBar.this.oEe != null) {
RecyclerThumbSeekBar.this.oEd.B(RecyclerThumbSeekBar.this.bbF(), RecyclerThumbSeekBar.this.bbG());
}
}
public final void gK(boolean z) {
if (!(RecyclerThumbSeekBar.this.oEd == null || RecyclerThumbSeekBar.this.oEe == null)) {
RecyclerThumbSeekBar.this.oEd.C(RecyclerThumbSeekBar.this.bbF(), RecyclerThumbSeekBar.this.bbG());
}
if (z) {
RecyclerThumbSeekBar.this.oEe.o(true, RecyclerThumbSeekBar.this.oEf.bbU());
} else {
RecyclerThumbSeekBar.this.oEe.o(false, RecyclerThumbSeekBar.this.oEf.getWidth() - RecyclerThumbSeekBar.this.oEf.bbV());
}
}
};
private String path;
private class a implements Runnable {
private Bitmap bitmap;
private ImageView fwa;
private b oEn;
a(Bitmap bitmap, ImageView imageView, b bVar) {
this.bitmap = bitmap;
this.fwa = imageView;
this.oEn = bVar;
}
public final void run() {
boolean z = true;
if (this.bitmap == null || this.bitmap.isRecycled()) {
String str = "RecyclerThumbSeekBar";
String str2 = "bitmap is null %b in DrawBitmapOnViewTask";
Object[] objArr = new Object[1];
if (this.bitmap != null) {
z = false;
}
objArr[0] = Boolean.valueOf(z);
x.i(str, str2, objArr);
} else if (this.oEn == null || this.oEn.hGJ || this.fwa == null) {
x.i("RecyclerThumbSeekBar", "bitmap in DrawBitmapOnViewTask");
} else {
ImageView imageView = this.fwa;
imageView.setTag(null);
ObjectAnimator.ofInt(imageView, "imageAlpha", new int[]{50, 255}).setDuration(200).start();
imageView.setImageBitmap(this.bitmap);
}
}
}
private class b implements Runnable {
boolean hGJ = false;
private ag handler;
private WeakReference<ImageView> hlN;
private Bitmap oEo;
private int time;
b(int i, ImageView imageView, Bitmap bitmap, ag agVar) {
this.time = i;
this.hlN = new WeakReference(imageView);
this.handler = agVar;
this.oEo = bitmap;
}
public final void run() {
if (this.hGJ) {
o.hbY.g(this.oEo);
} else if (((ImageView) this.hlN.get()) == null) {
o.hbY.g(this.oEo);
} else {
try {
d bbI = RecyclerThumbSeekBar.this.oEh.bbI();
if (this.oEo == null) {
this.oEo = o.hbY.a(new com.tencent.mm.memory.o.b(bbI.getScaledWidth(), bbI.getScaledHeight()));
}
bbI.reuseBitmap(this.oEo);
if (!this.hGJ) {
this.oEo = bbI.getFrameAtTime((long) this.time);
}
RecyclerThumbSeekBar.this.oEh.a(bbI);
if (this.oEo == null || this.hGJ || this.hlN.get() == null) {
o.hbY.g(this.oEo);
} else {
this.handler.post(new a(this.oEo, (ImageView) this.hlN.get(), this));
}
} catch (Exception e) {
x.e("RecyclerThumbSeekBar", "get bitmap error " + e.getMessage());
o.hbY.g(this.oEo);
}
}
}
}
private class d {
ag handler = new ag();
HandlerThread[] oEu = new HandlerThread[this.ozh];
int oEv = 0;
private BlockingDeque<b> oEw = new LinkedBlockingDeque();
int ozh = 4;
public d() {
for (int i = 0; i < this.oEu.length; i++) {
this.oEu[i] = com.tencent.mm.sdk.f.e.dc("RecyclerThumbSeekBar_SimpleImageLoader_" + i, -1);
this.oEu[i].start();
}
this.oEv = 0;
}
}
private class e extends t {
ImageView fwa;
e(View view, int i) {
super(view);
if (i == 0) {
this.fwa = (ImageView) ((LinearLayout) view).getChildAt(0);
}
}
}
private class c extends android.support.v7.widget.RecyclerView.a<e> {
d oEp;
int oEq;
int oEr;
private View oEs;
private View oEt;
private c() {
this.oEp = new d();
this.oEq = RecyclerThumbSeekBar.this.oEg;
this.oEr = RecyclerThumbSeekBar.this.oEg;
}
/* synthetic */ c(RecyclerThumbSeekBar recyclerThumbSeekBar, byte b) {
this();
}
public final /* synthetic */ t a(ViewGroup viewGroup, int i) {
View view;
if (i == 1 || i == 2) {
view = new View(RecyclerThumbSeekBar.this.getContext());
if (i == 1) {
this.oEs = view;
} else {
this.oEt = view;
}
return new e(view, 1);
}
View imageView = new ImageView(RecyclerThumbSeekBar.this.getContext());
imageView.setScaleType(ScaleType.CENTER_CROP);
imageView.setMinimumWidth(RecyclerThumbSeekBar.this.hcZ);
imageView.setMinimumHeight(RecyclerThumbSeekBar.this.hcY);
view = new LinearLayout(RecyclerThumbSeekBar.this.getContext());
view.addView(imageView, RecyclerThumbSeekBar.this.hcZ, RecyclerThumbSeekBar.this.hcY);
return new e(view, 0);
}
public final /* synthetic */ void a(t tVar, int i) {
e eVar = (e) tVar;
if (getItemViewType(i) == 1 || getItemViewType(i) == 2) {
if (i == 0) {
eVar.VU.setMinimumWidth(this.oEq);
} else {
eVar.VU.setMinimumWidth(this.oEr);
}
eVar.VU.setBackgroundColor(0);
eVar.VU.setMinimumHeight(RecyclerThumbSeekBar.this.hcY);
} else if (this.oEp != null) {
d dVar = this.oEp;
int b = RecyclerThumbSeekBar.this.oEb * (i - 1);
ImageView imageView = eVar.fwa;
if (imageView != null && b >= 0) {
x.i("RecyclerThumbSeekBar", "loadImageAsync() called with: time = [" + b + "], view = [" + imageView + "]");
Object tag = imageView.getTag();
b bVar = (tag == null || !(tag instanceof b)) ? null : (b) tag;
if (bVar == null || bVar.time != b) {
if (bVar != null) {
bVar.hGJ = true;
}
Bitmap bitmap = (imageView.getDrawable() == null || !(imageView.getDrawable() instanceof BitmapDrawable)) ? null : ((BitmapDrawable) imageView.getDrawable()).getBitmap();
imageView.setImageBitmap(null);
Runnable bVar2 = new b(b, imageView, bitmap, dVar.handler);
imageView.setTag(bVar2);
int i2 = dVar.oEv % dVar.ozh;
dVar.oEv++;
if (dVar.oEu[i2] != null) {
new ag(dVar.oEu[i2].getLooper()).post(bVar2);
return;
}
return;
}
x.i("RecyclerThumbSeekBar", "SimpleImageLoader.loadImageAsync time equals %d return directly", Integer.valueOf(b));
}
} else {
x.e("RecyclerThumbSeekBar", "onBindViewHolder ImageLoader invoked after released.");
}
}
public final int getItemViewType(int i) {
if (i == 0) {
return 1;
}
if (i == getItemCount() - 1) {
return 2;
}
return 0;
}
public final void o(boolean z, int i) {
if (z) {
if (this.oEs != null) {
this.oEs.setMinimumWidth(i);
}
if (((LinearLayoutManager) RecyclerThumbSeekBar.this.jTh.TV).fa() == 0) {
RecyclerThumbSeekBar.this.jTh.scrollBy(i - this.oEq, 0);
}
this.oEq = i;
return;
}
this.oEr = i;
if (this.oEt != null) {
this.oEt.setMinimumWidth(this.oEr);
}
}
public final int getItemCount() {
return RecyclerThumbSeekBar.this.hQf <= 0 ? 0 : Math.max(0, (int) Math.floor((double) (((float) RecyclerThumbSeekBar.this.hQf) / ((float) RecyclerThumbSeekBar.this.oEb)))) + 2;
}
}
static /* synthetic */ int e(RecyclerThumbSeekBar recyclerThumbSeekBar, int i) {
if (recyclerThumbSeekBar.oEe == null) {
throw new IllegalStateException("recyclerAdapter is null");
} else if (recyclerThumbSeekBar.hQf <= 0) {
throw new IllegalStateException("durationMs <= 0");
} else {
recyclerThumbSeekBar.oEe.getItemCount();
return (int) ((Math.min(Math.max(0.0f, ((float) i) / ((float) recyclerThumbSeekBar.hQf)), 1.0f) * ((float) recyclerThumbSeekBar.hcZ)) * ((float) (recyclerThumbSeekBar.oEe.getItemCount() - 2)));
}
}
public RecyclerThumbSeekBar(Context context) {
super(context);
init();
}
public RecyclerThumbSeekBar(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
init();
}
public RecyclerThumbSeekBar(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
init();
}
private void init() {
this.jTh = new RecyclerView(getContext());
getContext();
this.jTh.a(new LinearLayoutManager(0, false));
this.jTh.Ub = true;
int aa = com.tencent.mm.bu.a.aa(getContext(), com.tencent.mm.plugin.mmsight.segment.k.b.oDT);
this.oEg = com.tencent.mm.bu.a.aa(getContext(), com.tencent.mm.plugin.mmsight.segment.k.b.oDS);
addView(this.jTh, new LayoutParams(-1, aa));
this.oEf = new n(getContext());
addView(this.oEf, new LayoutParams(-1, -1));
this.oEf.oEx = this.oEk;
this.jTh.a(this.oEj);
}
public final void al(float f) {
float f2 = 0.0f;
n nVar = this.oEf;
if (!(this.oEe == null || this.jTh == null)) {
float itemCount = ((float) (this.oEe.getItemCount() - 2)) * f;
int floor = (int) Math.floor((double) itemCount);
itemCount -= (float) floor;
t bi = this.jTh.bi(floor + 1);
if (bi != null) {
View view = bi.VU;
f2 = ((((float) view.getWidth()) * itemCount) + ((float) view.getLeft())) / ((float) getWidth());
}
}
nVar.am(f2);
}
public final void FR(String str) {
if (bi.oN(str) || !FileOp.bO(str)) {
bbR();
return;
}
this.path = str;
post(this.oEi);
}
public final int getDurationMs() {
return this.hQf;
}
public final void gI(boolean z) {
if (z) {
this.oEf.oEz = true;
} else {
this.oEf.oEz = false;
}
}
private void bbR() {
ah.y(new Runnable() {
public final void run() {
if (RecyclerThumbSeekBar.this.oEc != null) {
RecyclerThumbSeekBar.this.oEc.gJ(true);
}
}
});
}
public final void release() {
Lock lock = null;
this.hQf = -1;
this.path = null;
if (this.oEh != null) {
com.tencent.mm.plugin.mmsight.segment.d.a aVar = this.oEh;
if (aVar.oDa != null) {
aVar.mHC.lock();
if (aVar.oDa == null) {
aVar.mHC.unlock();
} else {
try {
Iterator it = aVar.oDa.iterator();
while (it.hasNext()) {
((d) it.next()).release();
}
} catch (Throwable e) {
x.printErrStackTrace("FetcherPool", e, "destroy fetcher %s", e.getMessage());
} finally {
aVar.oDa = null;
lock = aVar.mHC;
lock.unlock();
}
}
}
}
if (!(this.oEe == null || this.oEe.oEp == null)) {
d dVar = this.oEe.oEp;
if (!(dVar.oEu == null || dVar.oEu.length == 0)) {
for (int i = lock; i < dVar.oEu.length; i++) {
if (dVar.oEu[i] != null) {
dVar.oEu[i].quit();
dVar.oEu[i] = null;
}
}
}
this.oEe.oEp = null;
this.oEe = null;
}
if (this.oEf != null) {
n nVar = this.oEf;
if (nVar.oEU != null && nVar.oEV != null) {
nVar.oEC.setBounds(nVar.oEU);
nVar.oED.setBounds(nVar.oEV);
nVar.oEH = -1.0f;
nVar.postInvalidate();
}
}
}
public final void a(com.tencent.mm.plugin.mmsight.segment.c.a aVar) {
this.oEc = aVar;
}
public final void a(com.tencent.mm.plugin.mmsight.segment.c.b bVar) {
this.oEd = bVar;
}
public final float bbF() {
if (this.oEf == null) {
return 0.0f;
}
return tm(this.oEf.bbU());
}
public final float bbG() {
if (this.oEf == null) {
return 0.0f;
}
return tm(this.oEf.bbV());
}
private float tm(int i) {
if (this.oEe == null || this.jTh == null) {
return 0.0f;
}
View j = this.jTh.j((float) i, 0.0f);
int aZ = RecyclerView.aZ(j);
int itemCount = this.oEe.getItemCount();
if (aZ <= 0) {
return 0.0f;
}
if (aZ >= itemCount - 1) {
return 1.0f;
}
return (((float) (aZ - 1)) + (((float) (i - j.getLeft())) / ((float) j.getWidth()))) / ((float) (itemCount - 2));
}
}
| [
"[email protected]"
]
| |
e227f4ba19d47d397e53a7b2e088a64f05046a5d | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/1/1_9cd06e0b7b0af8dc0b281db8f29f910fc33254d6/PrimoServiceTest/1_9cd06e0b7b0af8dc0b281db8f29f910fc33254d6_PrimoServiceTest_t.java | 0f5d7cb101f75c78ba4da25218ed1a1cd71f4786 | []
| 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 | 33,697 | java | package uk.ac.ox.oucs.sirlouie;
import java.io.IOException;
import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.json.JSONObject;
import org.xml.sax.SAXException;
import uk.ac.ox.oucs.sirlouie.daia.Document;
import uk.ac.ox.oucs.sirlouie.daia.Item;
import uk.ac.ox.oucs.sirlouie.daia.ResponseBean;
import uk.ac.ox.oucs.sirlouie.primo.PrimoService;
import uk.ac.ox.oucs.sirlouie.reply.SearLibrary;
import uk.ac.ox.oucs.sirlouie.reply.SearObject;
public class PrimoServiceTest extends TestCase {
PrimoService service;
private String nameSpaceURI = "http://www.exlibrisgroup.com/xsd/jaguar/search";
private String WEBRESOURCE_URL = "http://primo-s-web-2.sers.ox.ac.uk:1701/PrimoWebServices/xservice/getit";
private String OLIS_XML = "<SEGMENTS xmlns=\"http://www.exlibrisgroup.com/xsd/jaguar/search\">"
+"<JAGROOT>"
+"<RESULT>"
+"<DOCSET TOTALHITS=\"1\">"
+"<sear:DOC xmlns=\"http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib\" "
+"xmlns:sear=\"http://www.exlibrisgroup.com/xsd/jaguar/search\">"
+"<PrimoNMBib>"
+"<record>"
+"<display>"
+"<type>book</type>"
+"<title>The history of the Times.</title>"
+"<contributor>Stanley Morison 1889-1967.; Stanley Morison 1889-1967.; Stanley"
+"Morison 1889-1967.; Stanley Morison 1889-1967.; Iverach McDonald; John Grigg;"
+"Graham Stewart</contributor>"
+"<publisher>London : The Times ; HarperCollins</publisher>"
+"<creationdate>1935-</creationdate>"
+"<subject>Times (London, England) -- History</subject>"
+"<description>v. 1. \"The Thunderer\" in the making, 1785-1841 / Stanley Morison"
+"-- v. 2. The tradition established, 1841-1884 / Stanley Morison -- v. 3. The twentieth century"
+"test, 1884-1912 / Stanley Morison -- v. 4. in 2 parts. The 150th anniversary and beyond,"
+"1912-1948 / Stanley Morison -- v. 5. Struggles in war and peace, 1939-1966 / by Iverach"
+"McDonald -- v. 6. The Thomson years, 1966-1981 / by John Grigg -- v. 7. The Murdoch"
+"years 1981-2002 / Graham Stewart.</description>"
+"<language>eng</language>"
+"<source>UkOxU</source>"
+"<availlibrary>$$IOX$$LBLL$$1Main Libr$$2(0360 h 015/01)$"
+"$Scheck_holdings</availlibrary>"
+"<unititle>Times (London, England)</unititle>"
+"<availinstitution>$$IOX$$Scheck_holdings</availinstitution>"
+"</display>"
+"<search>"
+"<creatorcontrib>Morison, Stanley, 1889-1967.</creatorcontrib>"
+"<title>The history of the Times.</title>"
+"<subject>Times (London, England) History.</subject>"
+"<general>The Times ; HarperCollins,</general>"
+"<sourceid>UkOxU</sourceid>"
+"<recordid>UkOxUUkOxUb10108045</recordid>"
+"<isbn>0723002622</isbn>"
+"<rsrctype>book</rsrctype>"
+"<creationdate>1935</creationdate>"
+"<lsr01>BLL:0360 h 015/01</lsr01>"
+"<lsr01>BLL:0360 h 015/02</lsr01>"
+"</search>"
+"<sort>"
+"<title>history of the Times.</title>"
+"<creationdate>1935</creationdate>"
+"<author>Morison, Stanley, 1889-1967.</author>"
+"</sort>"
+"<facets>"
+"<language>eng</language>"
+"<creationdate>1935</creationdate>"
+"<topic>Times (London, England)–History</topic>"
+"<collection>OLIS</collection>"
+"<prefilter>books</prefilter>"
+"<rsrctype>books</rsrctype>"
+"<creatorcontrib>Morison, S</creatorcontrib>"
+"<creatorcontrib>McDonald, I</creatorcontrib>"
+"<creatorcontrib>Grigg, J</creatorcontrib>"
+"<creatorcontrib>Stewart, G</creatorcontrib>"
+"<library>BLL</library>"
+"<library>BOD</library>"
+"</facets>"
+"</record>"
+"</PrimoNMBib>"
+"<sear:GETIT GetIt2=\"http://oxfordsfx-direct.hosted.exlibrisgroup.com/oxford?"
+"ctx_ver=Z39.88-2004&ctx_enc=info:ofi/"
+"enc:UTF-8&ctx_tim=2010-10-27T14%3A50%3A53IST&url_ver=Z39.88-2004&"
+"url_ctx_fmt=infofi/fmt:kev:mtx:ctx&rfr_id=info:sid/primo.exlibrisgroup.com:primo3-"
+"Journal-UkOxU&rft_val_fmt=info:ofi/"
+"fmt:kev:mtx:book&rft.genre=book&rft.atitle=&rft.jtitle=&rft.btitle=The"
+"%20history%20of%20the"
+"%20Times.&rft.aulast=Morison&rft.auinit=&rft.auinit1=&rft.auinitm=&"
+"rft.ausuffix=&rft.au=&rft.aucorp=&rft.volume=&rft.issue=&rft.part=&"
+"rft.quarter=&rft.ssn=&rft.spage=&rft.epage=&rft.pages=&"
+"rft.artnum=&rft.issn=&rft.eissn=&rft.isbn=0723002622&rft.sici=&"
+"rft.coden=&rft_id=info:doi/&rft.object_id="
+"%20&rft.eisbn=&rft_dat=<UkOxU>UkOxUb10108045</UkOxU>\" "
+"GetIt1=\"http://1.1.1.1/cgi-bin/record_display_link.pl?id=10108045\" "
+"deliveryCategory=\"Physical Item\"/>"
+"<sear:LIBRARIES>"
+"<sear:LIBRARY>"
+"<sear:institution>OX</sear:institution>"
+"<sear:library>BLL</sear:library>"
+"<sear:status>check_holdings</sear:status>"
+"<sear:collection>Main Libr</sear:collection>"
+"<sear:callNumber>(0360 h 015/01)</sear:callNumber>"
+"<sear:url>http://library.ox.ac.uk/cgi-bin/record_display_link.pl?id=10108045</sear:url>"
+"</sear:LIBRARY>"
+"<sear:LIBRARY>"
+"<sear:institution>OX</sear:institution>"
+"<sear:library>BLL</sear:library>"
+"<sear:status>check_holdings</sear:status>"
+"<sear:collection>Main Libr</sear:collection>"
+"<sear:callNumber>(0360 h 015/02)</sear:callNumber>"
+"<sear:url>http://library.ox.ac.uk/cgi-bin/record_display_link.pl?id=10108045</sear:url>"
+"</sear:LIBRARY>"
+"</sear:LIBRARIES>"
+"<sear:LINKS>"
+"<sear:backlink>http://library.ox.ac.uk/cgi-bin/record_display_link.pl?id=10108045</sear:backlink>"
+"<sear:thumbnail>http://images.amazon.com/images/P/"
+"0723002622.01._SSTHUM_.jpg</sear:thumbnail>"
+"<sear:thumbnail>http://books.google.com/books?bibkeys=ISBN:"
+"9780007184385,OCLC:,LCCN:"
+"35-27067&jscmd=viewapi&callback=updateGBSCover</sear:thumbnail>"
+"<sear:linktotoc>http://syndetics.com/index.aspx?isbn=0723002622/"
+"INDEX.HTML&client=unioxford&type=xw12</sear:linktotoc>"
+"<sear:linktoabstract>http://syndetics.com/index.aspx?isbn=0723002622/"
+"SUMMARY.HTML&client=unioxford&type=rn12</sear:linktoabstract>"
+"<sear:linktoholdings>http://library.ox.ac.uk/cgi-bin/record_display_link.pl?"
+"id=10108045</sear:linktoholdings>"
+"<sear:linktouc>http://www.amazon.co.uk/gp/search?keywords=0723002622</sear:linktouc>"
+"<sear:linktouc>http://www.worldcat.org/search?q=isbn%3A0723002622</sear:linktouc>"
+"<sear:lln03>http://books.google.com/books?vid=ISBN0723002622</sear:lln03>"
+"<sear:lln04>http://www.amazon.com/gp/reader/0723002622</sear:lln04>"
+"</sear:LINKS>"
+"</sear:DOC>"
+"</DOCSET>"
+"</RESULT>"
+"</JAGROOT>"
+"</SEGMENTS>";
private String ORA_XML = "<SEGMENTS>"
+"<JAGROOT>"
+"<RESULT>"
+"<DOCSET TOTALHITS=\"1\">"
//+"<sear:DOC>"
+"<sear:DOC xmlns=\"http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib\" "
+"xmlns:sear=\"http://www.exlibrisgroup.com/xsd/jaguar/search\">"
+"<PrimoNMBib>"
+"<record>"
+"<control>"
+"<sourcerecordid>debe641a-17ca-4196-ab2c-fe7565ced721</sourcerecordid>"
+"<sourceid>ORA</sourceid>"
+"<recordid>ORAdebe641a-17ca-4196-ab2c-fe7565ced721</recordid>"
+"<originalsourceid>ORA</originalsourceid>"
+"<sourceformat>DC</sourceformat>"
+"<sourcesystem>Other</sourcesystem>"
+"</control>"
+"<display>"
+"<type>other</type>"
+"<title>"
+"‘The times they are a-changing’ Dissemination services in an evolving scholarly landscape"
+"</title>"
+"<creator>Rumsey, Sally</creator>"
+"<creationdate>2010</creationdate>"
+"<format>Not Published</format>"
+"<format>born digital</format>"
+"<identifier>"
+"Oxford Research Archive internal ID: ora:3462; ora:3462; urn:uuid:debe641a-17ca-4196-ab2c-fe7565ced721"
+"</identifier>"
+"<subject>"
+"Library & information science; Internet and science and learning; Scholarly dissemination; publishing; scholarly communication; ORA; Oxford University Research Archive"
+"</subject>"
+"<description>"
+"Presentation given on 4 March 2010 as part of Bodleian Libraries and ORA seminar series ‘Scholarship, publishing and the dissemination of research’"
+"</description>"
+"<language>eng</language>"
+"<source>ORA</source>"
+"</display>"
+"<links>"
+"<backlink>$$Tora_backlink$$DThis item in ORA</backlink>"
+"<linktorsrc>$$Tora_linktorsrc$$DShow Resource via ORA</linktorsrc>"
+"<thumbnail>$$Tamazon_thumb</thumbnail>"
+"<openurlfulltext>$$Topenurlfull_journal</openurlfulltext>"
+"</links>"
+"<search>"
+"<creatorcontrib>Rumsey, Sally</creatorcontrib>"
+"<title>"
+"‘The times they are a-changing’ Dissemination services in an evolving scholarly landscape"
+"</title>"
+"<description>"
+"Presentation given on 4 March 2010 as part of Bodleian Libraries and ORA seminar series ‘Scholarship, publishing and the dissemination of research’"
+"</description>"
+"<subject>Library & information science</subject>"
+"<subject>Internet and science and learning</subject>"
+"<subject>Scholarly dissemination</subject>"
+"<subject>publishing</subject>"
+"<subject>scholarly communication</subject>"
+"<subject>ORA</subject>"
+"<subject>Oxford University Research Archive</subject>"
+"<sourceid>ORA</sourceid>"
+"<recordid>ORAdebe641a-17ca-4196-ab2c-fe7565ced721</recordid>"
+"<rsrctype>other</rsrctype>"
+"<creationdate>2010</creationdate>"
+"<searchscope>DIG</searchscope>"
+"<searchscope>OX</searchscope>"
+"<scope>DIG</scope>"
+"<scope>OX</scope>"
+"</search>"
+"<sort>"
+"<creationdate>2010</creationdate>"
+"</sort>"
+"<facets>"
+"<language>eng</language>"
+"<creationdate>2010</creationdate>"
+"<topic>Library & information science</topic>"
+"<topic>Internet and science and learning</topic>"
+"<topic>Scholarly dissemination</topic>"
+"<topic>publishing</topic>"
+"<topic>scholarly communication</topic>"
+"<topic>ORA</topic>"
+"<topic>Oxford University Research Archive</topic>"
+"<collection>ORA</collection>"
+"<toplevel>online_resources</toplevel>"
+"<rsrctype>other</rsrctype>"
+"<creatorcontrib>Rumsey, Sally</creatorcontrib>"
+"<format>Not Published</format>"
+"<format>born digital</format>"
+"</facets>"
+"<delivery>"
+"<institution>OX</institution>"
+"<delcategory>Online Resource</delcategory>"
+"</delivery>"
+"<ranking>"
+"<booster1>1</booster1>"
+"<booster2>1</booster2>"
+"</ranking>"
+"<addata>"
+"<au>Rumsey, Sally</au>"
+"<btitle>"
+"‘The times they are a-changing’ Dissemination services in an evolving scholarly landscape"
+"</btitle>"
+"<date>2010</date>"
+"<risdate>2010</risdate>"
+"<format>book</format>"
+"<genre>unknown</genre>"
+"<ristype>GEN</ristype>"
+"</addata>"
+"</record>"
+"</PrimoNMBib>"
+"<sear:GETIT GetIt2=\"http://oxfordsfx-direct.hosted.exlibrisgroup.com/oxford?ctx_ver=Z39.88-2004&ctx_enc=info:ofi/enc:UTF-8&ctx_tim=2010-12-20T15%3A32%3A13IST&url_ver=Z39.88-2004&url_ctx_fmt=infofi/fmt:kev:mtx:ctx&rfr_id=info:sid/primo.exlibrisgroup.com:primo3-Journal-ORA&rft_val_fmt=info:ofi/fmt:kev:mtx:book&rft.genre=unknown&rft.atitle=&rft.jtitle=&rft.btitle=‘The%20times%20they%20are%20a-changing’%20Dissemination%20services%20in%20an%20evolving%20scholarly%20landscape&rft.aulast=&rft.auinit=&rft.auinit1=&rft.auinitm=&rft.ausuffix=&rft.au=Rumsey,%20Sally&rft.aucorp=&rft.volume=&rft.issue=&rft.part=&rft.quarter=&rft.ssn=&rft.spage=&rft.epage=&rft.pages=&rft.artnum=&rft.issn=&rft.eissn=&rft.isbn=&rft.sici=&rft.coden=&rft_id=info:doi/&rft.object_id=%20&rft.eisbn=&rft_dat=<ORA>debe641a-17ca-4196-ab2c-fe7565ced721</ORA>&rft_id=http%3A%2F%2Fsolo.bodleian.ox.ac.uk%2Fprimo_library%2Flibweb%2Faction%2Fdisplay.do%3Fdoc%3Ddebe641a-17ca-4196-ab2c-fe7565ced721%26vid%3DOXVU1%26fn%3Ddisplay%26displayMode%3Dfull\" GetIt1=\"http://1.1.1.1/objects/uuid:debe641a-17ca-4196-ab2c-fe7565ced721\" deliveryCategory=\"Online Resource\"/>"
+"<sear:LINKS>"
+"<sear:backlink>"
+"http://ora.ouls.ox.ac.uk/objects/uuid:debe641a-17ca-4196-ab2c-fe7565ced721"
+"</sear:backlink>"
+"<sear:linktorsrc>"
+"http://ora.ouls.ox.ac.uk/objects/uuid:debe641a-17ca-4196-ab2c-fe7565ced721"
+"</sear:linktorsrc>"
+"<sear:thumbnail>http://images.amazon.com/images/P/.01._SSTHUM_.jpg</sear:thumbnail>"
+"<sear:openurlfulltext>"
+"http://oxfordsfx-direct.hosted.exlibrisgroup.com/oxford?ctx_ver=Z39.88-2004&ctx_enc=info:ofi/enc:UTF-8&ctx_tim=2010-12-20T15%3A32%3A13IST&url_ver=Z39.88-2004&url_ctx_fmt=infofi/fmt:kev:mtx:ctx&rfr_id=info:sid/primo.exlibrisgroup.com:primo3-Journal-ORA&rft_val_fmt=info:ofi/fmt:kev:mtx:book&rft.genre=unknown&rft.atitle=&rft.jtitle=&rft.btitle=‘The%20times%20they%20are%20a-changing’%20Dissemination%20services%20in%20an%20evolving%20scholarly%20landscape&rft.aulast=&rft.auinit=&rft.auinit1=&rft.auinitm=&rft.ausuffix=&rft.au=Rumsey,%20Sally&rft.aucorp=&rft.volume=&rft.issue=&rft.part=&rft.quarter=&rft.ssn=&rft.spage=&rft.epage=&rft.pages=&rft.artnum=&rft.issn=&rft.eissn=&rft.isbn=&rft.sici=&rft.coden=&rft_id=info:doi/&rft.object_id=&svc_val_fmt=info:ofi/fmt:kev:mtx:sch_svc&svc.fulltext=yes%20&rft.eisbn=&rft_dat=<ORA>debe641a-17ca-4196-ab2c-fe7565ced721</ORA>&rft_id=http%3A%2F%2Fsolo.bodleian.ox.ac.uk%2Fprimo_library%2Flibweb%2Faction%2Fdisplay.do%3Fdoc%3Ddebe641a-17ca-4196-ab2c-fe7565ced721%26vid%3DOXVU1%26fn%3Ddisplay%26displayMode%3Dfull"
+"</sear:openurlfulltext>"
+"</sear:LINKS>"
+"</sear:DOC>"
+"</DOCSET>"
+"</RESULT>"
+"</JAGROOT>"
+"</SEGMENTS>";
private String errorXML = "<SEGMENTS xmlns=\"http://www.exlibrisgroup.com/xsd/jaguar/search\">"
+"<JAGROOT>"
+"<RESULT>"
+"<ERROR MESSAGE=\"PrimoGetItWS Remote Search Key is missing or expired\" CODE=\"-6\"/>"
+"</RESULT>"
+"</JAGROOT>"
+"</SEGMENTS>";
private String ORA_JSON = "{\"version\":\"0.5\",\"schema\":\"http://ws.gbv.de/daia/\","
+"\"timestamp\":\"2009-06-09T15:39:52.831+02:00\","
+"\"institution\":{\"content\":\"University of Oxford\","
+"\"href\":\"http://www.ox.ac.uk\"},"
+"\"document\":[{\"id\":\"ORAdebe641a-17ca-4196-ab2c-fe7565ced721\","
+"\"item\":["
+"{\"href\":\"http://ora.ouls.ox.ac.uk/objects/uuid:debe641a-17ca-4196-ab2c-fe7565ced721\"}]}]}";
private String OLIS_JSON = "{\"version\":\"0.5\",\"schema\":\"http://ws.gbv.de/daia/\","
+"\"timestamp\":\"2009-06-09T15:39:52.831+02:00\","
+"\"institution\":{\"content\":\"University of Oxford\","
+"\"href\":\"http://www.ox.ac.uk\"},"
+"\"document\":[{\"id\":\"UkOxUUkOxUb15585873\","
+"\"href\":\"http://library.ox.ac.uk/cgi-bin/record_display_link.pl?id=10108045\","
+"\"item\":["
+"{\"department\":{\"id\":\"BLL\",\"content\":\"Balliol College Library\"},"
+"\"storage\":{\"content\":\"Main Libr\"}},"
+"{\"department\":{\"id\":\"BLL\",\"content\":\"Balliol College Library\"},"
+"\"storage\":{\"content\":\"Main Libr\"}}]}]}";
// After the library upgrade they started returning different XML.
private String NEW_OLIS_XML = "<SEGMENTS xmlns=\"http://www.exlibrisgroup.com/xsd/jaguar/search\">\n" +
" <JAGROOT>\n" +
" <RESULT>\n" +
" <DOCSET TOTALHITS=\"1\">\n" +
" <sear:DOC LOCAL=\"true\" xmlns=\"http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib\" xmlns:sear=\"http://www.exlibrisgroup.com/xsd/jaguar/search\">\n" +
" <PrimoNMBib>\n" +
" <record>\n" +
" <control>\n" +
" <sourcerecordid>017140770</sourcerecordid>\n" +
" <sourceid>oxfaleph</sourceid>\n" +
" <recordid>oxfaleph017140770</recordid>\n" +
" <originalsourceid>BIB01</originalsourceid>\n" +
" <ilsapiid>BIB01017140770</ilsapiid>\n" +
" <addsrcrecordid>017140770</addsrcrecordid>\n" +
" <sourceformat>MARC21</sourceformat>\n" +
" <sourcesystem>Aleph</sourcesystem>\n" +
" </control>\n" +
" <display>\n" +
" <type>book</type>\n" +
" <title>Linux in a nutshell</title>\n" +
" <creator>Siever, Ellen.</creator>\n" +
" <contributor>Ellen Siever</contributor>\n" +
" <edition>6th ed..</edition>\n" +
" <publisher>Sebastopol, Calif. ; Cambridge : O'Reilly</publisher>\n" +
" <creationdate>c2009</creationdate>\n" +
" <format>xxii, 917 p. ; 24 cm.</format>\n" +
" <identifier>$$CISBN$$V9780596154486 ; $$CISBN$$V0596154488</identifier>\n" +
" <subject>Operating systems (Computers); Linux</subject>\n" +
" <language>eng</language>\n" +
" <availlibrary>$$IOX$$LBODBL$$2(Box retrieval please)$$Scheck_holdings$$31$$41$$5N$$60$$XBOD50$$YBODBL</availlibrary>\n" +
" <lds01>Ellen Siever ... [et al.].</lds01>\n" +
" <lds02><![CDATA[<br><b>General Note: </b>Previous ed.: 2005.<br><b>General Note: </b>Cover title : Linux in a nutshell : a desktop quick reference.<br><b>General Note: </b>Includes index.]]></lds02>\n" +
" <lds04>Previous ed.: 2005. -- Cover title : Linux in a nutshell : a desktop quick reference. -- Includes index.</lds04>\n" +
" <lds06>Cover Title: Linux in a nutshell : a desktop quick reference</lds06>\n" +
" <lds15>017140770</lds15>\n" +
" <availinstitution>$$IOX$$Scheck_holdings</availinstitution>\n" +
" <availpnx>available</availpnx>\n" +
" <lds09><br /><br /><b>Short Description:</b> Focusing on Linux system essentials, this title covers programming tools, system and network administration tools, the shell, editors, LILO and GRUB boot options, and highlights the most important options for using the vast number of Linux commands. It can also help you learn Linux commands for system administration and network management.</lds09>\n" +
" </display>\n" +
" <links>\n" +
" <backlink>$$Taleph_backlink$$DMore bibliographic information</backlink>\n" +
" <thumbnail>$$Tamazon_thumb</thumbnail>\n" +
" <thumbnail>$$Tgoogle_thumb</thumbnail>\n" +
" <linktoholdings>$$Taleph_holdings</linktoholdings>\n" +
" <linktouc>$$Tamazon_uc$$DThis item in Amazon</linktouc>\n" +
" <linktouc>$$Tworldcat_isbn$$DThis item in WorldCat</linktouc>\n" +
" <linktoexcerpt>$$Tsyndetics_excerpt$$DExcerpt from item</linktoexcerpt>\n" +
" <lln03>$$Tgooglebsisbn</lln03>\n" +
" </links>\n" +
" <search>\n" +
" <creatorcontrib>Siever, Ellen.</creatorcontrib>\n" +
" <creatorcontrib>Ellen Siever ... [et al.].</creatorcontrib>\n" +
" <creatorcontrib>Ellen</creatorcontrib>\n" +
" <creatorcontrib>Siever, E</creatorcontrib>\n" +
" <creatorcontrib>Ellen Siever</creatorcontrib>\n" +
" <title>Linux in a nutshell /</title>\n" +
" <subject>Linux.</subject>\n" +
" <subject>Operating systems (Computers)</subject>\n" +
" <subject>Computers Operating systems</subject>\n" +
" <subject>Computer operating systems</subject>\n" +
" <subject>Disk operating systems</subject>\n" +
" <general>O'Reilly,</general>\n" +
" <sourceid>oxfaleph</sourceid>\n" +
" <recordid>oxfaleph017140770</recordid>\n" +
" <isbn>9780596154486</isbn>\n" +
" <isbn>9780596154486 (pbk.)</isbn>\n" +
" <isbn>0596154488</isbn>\n" +
" <isbn>0596154488 (pbk.)</isbn>\n" +
" <rsrctype>book</rsrctype>\n" +
" <creationdate>2009</creationdate>\n" +
" <creationdate>l|||</creationdate>\n" +
" <creationdate>|8</creationdate>\n" +
" <addsrcrecordid>017140770</addsrcrecordid>\n" +
" <addsrcrecordid>17140770</addsrcrecordid>\n" +
" <searchscope>oxfaleph</searchscope>\n" +
" <searchscope>BOD</searchscope>\n" +
" <searchscope>OULS</searchscope>\n" +
" <searchscope>OX</searchscope>\n" +
" <searchscope>NONOX</searchscope>\n" +
" <scope>oxfaleph</scope>\n" +
" <scope>BOD</scope>\n" +
" <scope>OULS</scope>\n" +
" <scope>OX</scope>\n" +
" <scope>NONOX</scope>\n" +
" <alttitle>Linux in a nutshell : a desktop quick reference</alttitle>\n" +
" <lsr01>(Box retrieval please)</lsr01>\n" +
" <lsr02>Previous ed.: 2005. -- Cover title : Linux in a nutshell : a desktop quick reference. -- Includes index.</lsr02>\n" +
" <lsr13>Sebastopol, Calif. ; Cambridge</lsr13>\n" +
" <lsr15>O'Reilly,</lsr15>\n" +
" <lsr09><br /><br /><b>Short Description:</b> Focusing on Linux system essentials, this title covers programming tools, system and network administration tools, the shell, editors, LILO and GRUB boot options, and highlights the most important options for using the vast number of Linux commands. It can also help you learn Linux commands for system administration and network management.</lsr09>\n" +
" </search>\n" +
" <sort>\n" +
" <title>Linux in a nutshell /</title>\n" +
" <creationdate>2009</creationdate>\n" +
" <author>Siever, Ellen.</author>\n" +
" <lso01>2009</lso01>\n" +
" </sort>\n" +
" <facets>\n" +
" <language>eng</language>\n" +
" <creationdate>2009</creationdate>\n" +
" <topic>Linux</topic>\n" +
" <topic>Operating systems (Computers)</topic>\n" +
" <collection>OLIS</collection>\n" +
" <toplevel>physical_item</toplevel>\n" +
" <prefilter>books</prefilter>\n" +
" <rsrctype>books</rsrctype>\n" +
" <creatorcontrib>Siever, E</creatorcontrib>\n" +
" <library>BODBL</library>\n" +
" <frbrgroupid>150606989</frbrgroupid>\n" +
" <frbrtype>5</frbrtype>\n" +
" </facets>\n" +
" <dedup>\n" +
" <c3>linuxinanutshell</c3>\n" +
" <c4>2009</c4>\n" +
" <f3>9780596154486;0596154488</f3>\n" +
" <f5>linuxinanutshell</f5>\n" +
" <f6>2009</f6>\n" +
" <f7>linux in a nutshell</f7>\n" +
" <f8>cau</f8>\n" +
" <f9>xxii, 917 p. ;</f9>\n" +
" <f10>oreilly</f10>\n" +
" </dedup>\n" +
" <frbr>\n" +
" <t>1</t>\n" +
" <k1>$$Ksiever ellen$$AA</k1>\n" +
" <k3>$$Klinux in a nutshell$$AT</k3>\n" +
" </frbr>\n" +
" <delivery>\n" +
" <institution>OX</institution>\n" +
" <institution>NONOX</institution>\n" +
" <delcategory>Physical Item</delcategory>\n" +
" </delivery>\n" +
" <ranking>\n" +
" <booster1>1</booster1>\n" +
" <booster2>1</booster2>\n" +
" </ranking>\n" +
" <addata>\n" +
" <aulast>Siever</aulast>\n" +
" <aufirst>Ellen</aufirst>\n" +
" <addau>Siever, Ellen</addau>\n" +
" <btitle>Linux in a nutshell</btitle>\n" +
" <addtitle>Linux in a nutshell : a desktop quick reference</addtitle>\n" +
" <date>2009</date>\n" +
" <risdate>c2009.</risdate>\n" +
" <isbn>9780596154486</isbn>\n" +
" <format>book</format>\n" +
" <genre>book</genre>\n" +
" <ristype>BOOK</ristype>\n" +
" <cop>Sebastopol, Calif. ; Cambridge</cop>\n" +
" <pub>O'Reilly</pub>\n" +
" </addata>\n" +
" </record>\n" +
" </PrimoNMBib>\n" +
" <sear:GETIT GetIt2=\"http://1.1.1.1?ctx_ver=Z39.88-2004&ctx_enc=info:ofi/enc:UTF-8&ctx_tim=2011-08-12T14%3A00%3A23IST&url_ver=Z39.88-2004&url_ctx_fmt=infofi/fmt:kev:mtx:ctx&rfr_id=info:sid/primo.exlibrisgroup.com:primo3-Journal-oxfaleph&rft_val_fmt=info:ofi/fmt:kev:mtx:book&rft.genre=book&rft.atitle=&rft.jtitle=&rft.btitle=Linux%20in%20a%20nutshell&rft.aulast=Siever&rft.auinit=&rft.auinit1=&rft.auinitm=&rft.ausuffix=&rft.au=&rft.aucorp=&rft.volume=&rft.issue=&rft.part=&rft.quarter=&rft.ssn=&rft.spage=&rft.epage=&rft.pages=&rft.artnum=&rft.issn=&rft.eissn=&rft.isbn=9780596154486&rft.sici=&rft.coden=&rft_id=info:doi/&rft.object_id=&rft_bat=<oxfaleph>017140770</oxfaleph>&rft.eisbn=&rft_id=info:oai/\" GetIt1=\"OVP\" deliveryCategory=\"Physical Item\"/>\n" +
" <sear:LIBRARIES>\n" +
" <sear:LIBRARY>\n" +
" <sear:institution>OX</sear:institution>\n" +
" <sear:library>BODBL</sear:library>\n" +
" <sear:status>check_holdings</sear:status>\n" +
" <sear:collection/>\n" +
" <sear:callNumber>(Box retrieval please)</sear:callNumber>\n" +
" <sear:url>OVP</sear:url>\n" +
" </sear:LIBRARY>\n" +
" </sear:LIBRARIES>\n" +
" <sear:LINKS>\n" +
" <sear:backlink>http://aleph.sers.ox.ac.uk:8991/F?func=direct&local_base=BIB01&doc_number=017140770&format=999</sear:backlink>\n" +
" <sear:thumbnail>http://images.amazon.com/images/P/9780596154486.01._SSTHUM_.jpg</sear:thumbnail>\n" +
" <sear:thumbnail>http://books.google.com/books?bibkeys=ISBN:9780596154486,OCLC:,LCCN:&jscmd=viewapi&callback=updateGBSCover</sear:thumbnail>\n" +
" <sear:linktoholdings>OVP</sear:linktoholdings>\n" +
" <sear:linktouc>http://www.amazon.co.uk/gp/search?keywords=9780596154486&index=books</sear:linktouc>\n" +
" <sear:linktouc>http://www.worldcat.org/search?q=isbn%3A9780596154486</sear:linktouc>\n" +
" <sear:lln03>http://books.google.com/books?vid=ISBN9780596154486</sear:lln03>\n" +
" </sear:LINKS>\n" +
" </sear:DOC>\n" +
" </DOCSET>\n" +
" </RESULT>\n" +
" </JAGROOT>\n" +
"</SEGMENTS>\n" +
"";
/*
private String OLIS_JSON = "{\"version\":\"0.5\",\"schema\":\"http://ws.gbv.de/daia/\","
+"\"timestamp\":\"2009-06-09T15:39:52.831+02:00\","
+"\"institution\":{\"content\":\"University of Oxford\","
+"\"href\":\"http://www.ox.ac.uk\"},"
+"\"document\":[{\"id\":\"UkOxUUkOxUb15585873\","
+"\"href\":\"http://library.ox.ac.uk/cgi-bin/record_display_link.pl?id=15585873\","
+"\"item\":["
+"{\"department\":{\"id\":\"RSL\",\"content\":\"Radcliffe Science Library\"},"
+"\"storage\":{\"content\":\"Level 2\"}},"
+"{\"department\":{\"id\":\"STX\",\"content\":\"St Cross College Library\"},"
+"\"storage\":{\"content\":\"Main Libr\"}}]}]}";
*/
protected void setUp() throws Exception {
super.setUp();
service = new PrimoService(WEBRESOURCE_URL);
}
protected void tearDown() throws Exception {
super.tearDown();
}
/*
public void testGetOLISResource() {
try {
long l = System.currentTimeMillis();
ResponseBean bean = service.getResource("UkOxUUkOxUb15585873");
System.out.println("testGetResource("+(System.currentTimeMillis()-l)+")");
Assert.assertNotNull(bean);
JSONObject jsonData = bean.toJSON("2009-06-09T15:39:52.831+02:00");
Assert.assertEquals(OLIS_JSON, jsonData.toString());
} catch (Exception e) {
System.out.println("Exception caught ["+e.getLocalizedMessage()+"]");
e.printStackTrace();
Assert.fail("Exception caught ["+e.getLocalizedMessage()+"]");
}
}
public void testGetORAResource() {
try {
long l = System.currentTimeMillis();
ResponseBean bean = service.getResource("ORAdebe641a-17ca-4196-ab2c-fe7565ced721");
System.out.println("testGetResource("+(System.currentTimeMillis()-l)+")");
Assert.assertNotNull(bean);
JSONObject jsonData = bean.toJSON("2009-06-09T15:39:52.831+02:00");
Assert.assertEquals(ORA_JSON, jsonData.toString());
} catch (Exception e) {
System.out.println("Exception caught ["+e.getLocalizedMessage()+"]");
e.printStackTrace();
Assert.fail("Exception caught ["+e.getLocalizedMessage()+"]");
}
}
*/
public void testFilterOLISResponse() {
try {
Collection<SearObject> beans =
PrimoService.filterResponse(nameSpaceURI, OLIS_XML);
Assert.assertEquals(2, beans.size());
} catch (Exception e) {
System.out.println("Exception caught ["+e.getLocalizedMessage()+"]");
Assert.fail("Exception caught ["+e.getLocalizedMessage()+"]");
}
}
public void testFilterORAResponse() {
try {
Collection<SearObject> beans =
PrimoService.filterResponse(nameSpaceURI, ORA_XML);
Assert.assertEquals(1, beans.size());
} catch (Exception e) {
System.out.println("Exception caught ["+e.getLocalizedMessage()+"]");
e.printStackTrace();
Assert.fail("Exception caught ["+e.getLocalizedMessage()+"]");
}
}
public void testParser() {
String originalString = "<tag>This string is mine & yours <trouble & strife></tag>";
Pattern pattern = Pattern.compile("&(?!(amp|apos|quot|lt|gt);)");
Matcher mat = pattern.matcher(originalString);
String result = mat.replaceAll("&");
System.out.println("parser ["+result+"]");
Assert.assertEquals("<tag>This string is mine & yours <trouble & strife></tag>", result);
}
public void testFilterErrorResponse() {
try {
PrimoService.filterResponse(nameSpaceURI, errorXML);
//Assert.fail("Exception expected");
} catch (Exception e) {
System.out.println("Exception caught ["+e.getLocalizedMessage()+"]");
Assert.fail("Exception caught ["+e.getLocalizedMessage()+"]");
}
}
/*
public void testOLISToJSON() {
try {
String id = "UkOxUUkOxUb15585873";
ResponseBean responseBean = new ResponseBean(id);
Collection<SearObject> beans = PrimoService.filterResponse(nameSpaceURI, OLIS_XML);
responseBean.addSearObjects(beans);
Map<String, Object> jsonData = responseBean.toJSON("2009-06-09T15:39:52.831+02:00");
ObjectMapper mapper = new ObjectMapper();
//mapper.writeValue(new File("response.json"), jsonData);
Assert.assertEquals(OLIS_JSON, mapper.writeValueAsString(jsonData));
} catch (Exception e) {
System.out.println("Exception caught ["+e.getLocalizedMessage()+"]");
e.printStackTrace();
Assert.fail("Exception caught ["+e.getLocalizedMessage()+"]");
}
}
*/
public void testORAoJSON() {
try {
String id = "ORAdebe641a-17ca-4196-ab2c-fe7565ced721";
ResponseBean responseBean = new ResponseBean(id);
Collection<SearObject> beans = PrimoService.filterResponse(nameSpaceURI, ORA_XML);
responseBean.addSearObjects(beans);
JSONObject json = responseBean.toJSON("2009-06-09T15:39:52.831+02:00");
Assert.assertEquals(ORA_JSON.length(), json.toString().length());
} catch (Exception e) {
System.out.println("Exception caught ["+e.getLocalizedMessage()+"]");
e.printStackTrace();
Assert.fail("Exception caught ["+e.getLocalizedMessage()+"]");
}
}
public void testNewXmlResponse() throws SAXException, IOException {
// Test that the library name lookups are working.
Collection<SearObject> beans = PrimoService.filterResponse(nameSpaceURI, NEW_OLIS_XML);
assertFalse(beans.isEmpty());
ResponseBean response = new ResponseBean();
response.addSearObjects(beans);
Document doc = response.getDocuments().iterator().next();
Item item = doc.getItems().iterator().next();
assertEquals("Bodleian Library", item.getDepartment().getName());
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.