blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6536896584afa0d93e3b96229f3f7181ce47d02c | 000805e86fc2debfc0b0a4e683fc16eee709cb96 | /config-client/src/main/java/pers/niaonao/configclient/web/ConfigClientController.java | e6277c8ac59d8e0d9b7bbcbd1bd1c3264e4d83ae | [] | no_license | niaonao/spring-cloud | b772fe21cc32a1c9f00dabf33af3ba668fc90162 | dbb9f766c18cc8ca9cc75675a0b372584c39df3d | refs/heads/master | 2020-09-04T08:20:30.368496 | 2019-11-06T06:29:53 | 2019-11-06T06:29:53 | 219,637,350 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 971 | java | package pers.niaonao.configclient.web;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Value;
/**
* @className: ConfigClientController
* @description: 测试外部属性控制类
* @author: niaonao
* @date: 2019/11/5
**/
@RestController
@RequestMapping(value = "/config/client")
public class ConfigClientController {
@Value("${account}")
private String account;
@Value("${repositoryUrl}")
private String repositoryUrl;
@GetMapping("/getRepositoryUrl")
public String getRepositoryUrl() {
StringBuilder resultUrl = new StringBuilder("Account:");
resultUrl.append(account)
.append("<br/>")
.append("RepositoryUrl:")
.append(repositoryUrl);
return resultUrl.toString();
}
}
| [
"24690311115@qq.com"
] | 24690311115@qq.com |
fc90656556baa3f96dfe97fad384ae3b6ab3da5e | d91f6aedaec16af746b18fcb4a8eb5b778afd936 | /src/com/company/PrettyNumbers.java | b5b2e0d210d9f8dbca3d19963f2052ede87c2a6c | [] | no_license | olegosipenko/Codility | 5ce45edff19044a6ac4d44d6dbb7875d327d362e | d902ff8c513f0639c7e4cf3f9a669c2b26e79f0a | refs/heads/master | 2021-01-19T13:59:05.184297 | 2018-03-27T10:12:20 | 2018-03-27T10:12:20 | 100,869,630 | 0 | 0 | null | 2017-08-21T21:08:12 | 2017-08-20T15:12:06 | Java | UTF-8 | Java | false | false | 579 | java | package com.company;
import java.util.stream.IntStream;
public class PrettyNumbers {
private static final int IN1 = 10000;
private static final int IN2 = 100;
public static void main(String[] args) {
System.out.println(count(IN1));
System.out.println(count(IN2));
}
private static int count(int N) {
return IntStream.range(1, N)
.mapToObj(String::valueOf)
.filter(s -> s.chars().distinct().toArray().length < s.length())
.mapToInt(Integer::parseInt)
.sum();
}
}
| [
"oleg.s.osipenko@gmail.com"
] | oleg.s.osipenko@gmail.com |
bfbe591f1a0e2485ca669fd6ef69aee48f254b24 | 778d364cb52e73b89658ffb068efcde1808c5c5c | /Chapter05/exercise16/FindTheFactorsOfAnInteger.java | 2403c64b265bf910f66b3086f3a6c12f4c95faec | [
"MIT"
] | permissive | oguzhan2142/IntroductionToJavaProgrammingSolutions-Y.DanielLiang | cd0d3916cc4370e9ae3e7761431c5a6ede665f68 | e2462fb1b94a2efd86fab029c630e3421731d5de | refs/heads/master | 2021-06-26T17:57:03.400661 | 2021-01-26T12:17:38 | 2021-01-26T12:17:38 | 208,146,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package Chapter05.exercise16;
import java.util.Scanner;
public class FindTheFactorsOfAnInteger {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter an integer:");
int num = scan.nextInt();
scan.close();
int devisor = 2;
while (num > 1) {
if (num % devisor == 0) {
num =num / devisor;
System.out.print(devisor + " ");
continue;
}
devisor++;
}
}
}
| [
"oguzhan2142@hotmail.com"
] | oguzhan2142@hotmail.com |
eaed65c564f05b0608e10281d6020915eb671c6f | 09e59f7288a94f712fb97f7c3b6b33f449521e95 | /src/main/java/com/atguigu/day04/Example10.java | 86659655ab6214a61cae151a22ed10cab7a4a5b6 | [] | no_license | Aliendt/flinktutorial0408_2.0 | 2bbc95cf0d79bbed990f784876ef76a91d4c524a | 79a7207bb5042e3b6ff4ae4455d1726800c52015 | refs/heads/master | 2023-07-17T05:14:41.267404 | 2021-09-06T08:02:23 | 2021-09-06T08:02:23 | 403,534,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,446 | java | package com.atguigu.day04;
import org.apache.flink.api.common.eventtime.SerializableTimestampAssigner;
import org.apache.flink.api.common.eventtime.WatermarkStrategy;
import org.apache.flink.api.common.functions.AggregateFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.state.ListState;
import org.apache.flink.api.common.state.ListStateDescriptor;
import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
import org.apache.flink.streaming.api.functions.windowing.ProcessWindowFunction;
import org.apache.flink.streaming.api.windowing.assigners.SlidingEventTimeWindows;
import org.apache.flink.streaming.api.windowing.time.Time;
import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
import org.apache.flink.util.Collector;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Comparator;
// 实时热门商品
// 每隔5分钟,统计过去一个小时的最热门的商品
// 对于离线数据集来说,flink只会插入两次水位线,开头插入负无穷大,结尾插入正无穷大
public class Example10 {
public static void main(String[] args) throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(1);
env
.readTextFile("/home/zuoyuan/flinktutorial0408/src/main/resources/UserBehavior.csv")
.map(new MapFunction<String, UserBehavior>() {
@Override
public UserBehavior map(String value) throws Exception {
String[] arr = value.split(",");
return new UserBehavior(
arr[0], arr[1], arr[2], arr[3],
Long.parseLong(arr[4]) * 1000L
);
}
})
.filter(r -> r.behavior.equals("pv"))
.assignTimestampsAndWatermarks(
WatermarkStrategy.<UserBehavior>forMonotonousTimestamps()
.withTimestampAssigner(new SerializableTimestampAssigner<UserBehavior>() {
@Override
public long extractTimestamp(UserBehavior element, long recordTimestamp) {
return element.timestamp;
}
})
)
.keyBy(r -> r.itemId)
.window(SlidingEventTimeWindows.of(Time.hours(1), Time.minutes(5)))
.aggregate(new CountAgg(), new WindowResult())
.keyBy(r -> r.windowEnd)
.process(new TopN(3))
.print();
env.execute();
}
public static class TopN extends KeyedProcessFunction<Long, ItemViewCount, String> {
private int n;
public TopN(int n) {
this.n = n;
}
// 初始化一个列表状态变量,用来保存ItemViewCount
private ListState<ItemViewCount> listState;
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
listState = getRuntimeContext().getListState(
new ListStateDescriptor<ItemViewCount>("list-state", Types.POJO(ItemViewCount.class))
);
}
@Override
public void processElement(ItemViewCount value, Context ctx, Collector<String> out) throws Exception {
// 每来一个ItemViewCount就存入列表状态变量
listState.add(value);
// 不会重复注册定时器
// 定时器用来排序,因为可以确定所有ItemViewCount都到了
// 加100毫秒,保证所有的ItemViewCount都已经到达
ctx.timerService().registerEventTimeTimer(value.windowEnd + 100L);
}
@Override
public void onTimer(long timestamp, OnTimerContext ctx, Collector<String> out) throws Exception {
super.onTimer(timestamp, ctx, out);
// 将数据取出排序
ArrayList<ItemViewCount> itemViewCounts = new ArrayList<>();
for (ItemViewCount ivc : listState.get()) {
itemViewCounts.add(ivc);
}
// 减轻内存和状态后端的存储压力,将状态变量清空
listState.clear();
// 按照浏览量降序排列
itemViewCounts.sort(new Comparator<ItemViewCount>() {
@Override
public int compare(ItemViewCount t2, ItemViewCount t1) {
return t1.count.intValue() - t2.count.intValue();
}
});
StringBuilder result = new StringBuilder();
result
.append("==================================================\n")
.append("窗口结束时间:" + new Timestamp(timestamp - 100L))
.append("\n");
for (int i = 0; i < n; i++) {
ItemViewCount currIvc = itemViewCounts.get(i);
result
.append("第" + (i+1) + "名的商品ID是:" + currIvc.itemId + ",浏览量是:" + currIvc.count + "\n");
}
result
.append("==================================================\n");
out.collect(result.toString());
}
}
public static class WindowResult extends ProcessWindowFunction<Long, ItemViewCount, String, TimeWindow> {
@Override
public void process(String s, Context context, Iterable<Long> elements, Collector<ItemViewCount> out) throws Exception {
out.collect(new ItemViewCount(
s,
elements.iterator().next(),
context.window().getStart(),
context.window().getEnd()
));
}
}
public static class CountAgg implements AggregateFunction<UserBehavior, Long, Long> {
@Override
public Long createAccumulator() {
return 0L;
}
@Override
public Long add(UserBehavior value, Long accumulator) {
return accumulator + 1L;
}
@Override
public Long getResult(Long accumulator) {
return accumulator;
}
@Override
public Long merge(Long a, Long b) {
return null;
}
}
public static class ItemViewCount {
public String itemId;
public Long count;
public Long windowStart;
public Long windowEnd;
public ItemViewCount() {
}
public ItemViewCount(String itemId, Long count, Long windowStart, Long windowEnd) {
this.itemId = itemId;
this.count = count;
this.windowStart = windowStart;
this.windowEnd = windowEnd;
}
@Override
public String toString() {
return "ItemViewCount{" +
"itemId='" + itemId + '\'' +
", count=" + count +
", windowStart=" + new Timestamp(windowStart) +
", windowEnd=" + new Timestamp(windowEnd) +
'}';
}
}
public static class UserBehavior {
public String userId;
public String itemId;
public String categoryId;
public String behavior;
public Long timestamp;
public UserBehavior() {
}
public UserBehavior(String userId, String itemId, String categoryId, String behavior, Long timestamp) {
this.userId = userId;
this.itemId = itemId;
this.categoryId = categoryId;
this.behavior = behavior;
this.timestamp = timestamp;
}
@Override
public String toString() {
return "UserBehavior{" +
"userId='" + userId + '\'' +
", itemId='" + itemId + '\'' +
", categoryId='" + categoryId + '\'' +
", behavior='" + behavior + '\'' +
", timestamp=" + new Timestamp(timestamp) +
'}';
}
}
}
| [
"aliendt@dog.com"
] | aliendt@dog.com |
b063c7865aaaa2a58e6030c05925602349b6c1d6 | 62073a15b0727d57ec6dc0faeb8e8b7424c885fc | /Disabled Code/com/alloycraft/exxo/blocks/BlockCrystalizedPlant.java | 1a57d139be790e4d3da13c33cc1cbf9dd3ecfe3c | [] | no_license | AshIndigo/main | c81d7456d1f4d5da1445a849939bf2b497d549b0 | 025a96c5797b85c5b61034d526af8dfec6d7646b | refs/heads/master | 2020-03-31T07:35:12.280045 | 2015-07-18T22:58:55 | 2015-07-18T22:58:55 | 30,644,223 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,564 | java | package com.alloycraft.exxo.blocks;
import java.util.Random;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import com.alloycraft.exxo.AlloycraftItems;
import com.ashindigo.api.BlockPlantBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCrystalizedPlant extends BlockPlantBase
{
public BlockCrystalizedPlant()
{
// Basic block setup
setBlockName("crystalizedplant");
setBlockTextureName("alloycraft:crystalizedplant_stage_0");
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(int parMetadata, int parFortune, Random parRand)
{
return (parMetadata/2);
}
@Override
public Item getItemDropped(int parMetadata, Random parRand, int parFortune)
{
// DEBUG
System.out.println("BlockCrystalizedPlant getItemDropped()");
return (AlloycraftItems.plantgem);
}
@Override
public void updateTick(World parWorld, int parX, int parY, int parZ, Random parRand)
{
super.updateTick(parWorld, parX, parY, parZ, parRand);
int growStage = parWorld.getBlockMetadata(parX, parY, parZ) + 1;
if (growStage > 7)
{
growStage = 7;
}
parWorld.setBlockMetadataWithNotify(parX, parY, parZ, growStage, 2);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister parIIconRegister)
{
iIcon = new IIcon[maxGrowthStage+1];
// seems that crops like to have 8 growth icons, but okay to repeat actual texture if you want
// to make generic should loop to maxGrowthStage
iIcon[0] = parIIconRegister.registerIcon("alloycraft:crystalizedplant_stage_0");
iIcon[1] = parIIconRegister.registerIcon("alloycraft:crystalizedplant_stage_0");
iIcon[2] = parIIconRegister.registerIcon("alloycraft:crystalizedplant_stage_1");
iIcon[3] = parIIconRegister.registerIcon("alloycraft:crystalizedplant_stage_1");
iIcon[4] = parIIconRegister.registerIcon("alloycraft:crystalizedplant_stage_2");
iIcon[5] = parIIconRegister.registerIcon("alloycraft:crystalizedplant_stage_2");
iIcon[6] = parIIconRegister.registerIcon("alloycraft:crystalizedplant_stage_3");
iIcon[7] = parIIconRegister.registerIcon("alloycraft:crystalizedplant_stage_3");
}
} | [
"firedragonman958@gmail.com"
] | firedragonman958@gmail.com |
e9332de7a2cbbf2e7f945cee40686363eca3b092 | 45207347a76a542237acc89ca430c3cf883fb39a | /src/hashMap/HashMapEntry.java | 177d9fe72746cf5e67989b8d9b326207c7ec20e9 | [] | no_license | nnasiruddin/dataStructuresPractise | 42d7acbc41cc47cfecaba340c715fc80c7def882 | 05abc33db0776af30a54312d5b0776f5a5287f6f | refs/heads/master | 2020-04-03T23:56:17.609352 | 2018-11-06T04:57:06 | 2018-11-06T04:57:06 | 155,635,247 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | java | package hashMap;
public class HashMapEntry {
public HashMapEntry getNext() {
return next;
}
public void setNext(HashMapEntry next) {
this.next = next;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
private HashMapEntry next;
private String key;
private String value;
HashMapEntry(String key, String value) {
this.key = key;
this.value = value;
this.next = null;
}
}
| [
"nuruddin-coxauto@tasneems-air.lan"
] | nuruddin-coxauto@tasneems-air.lan |
e7ac11a41beeb5c979a11de6e35c3123f83727de | 9cd48fd0d19888c1d4f94a9312afba1de78b3c1b | /src/main/java/com/cklab/httpconn/request/HTTPRequest.java | 863b4a10fa20d588cb3b75482add1cc59a9e818a | [
"MIT"
] | permissive | cklab/HTTPConn | c14f1c6ca10a5b9a45714fcf81b6722ad01795f2 | 84539bbaa466d074fe9f0c8a598c9e9f5f89c928 | refs/heads/master | 2021-01-13T01:50:19.720288 | 2014-12-14T19:52:14 | 2014-12-14T19:52:14 | 2,207,537 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,940 | java | /*******************************************************************************
* Copyright (C) 2011 CKLab
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
******************************************************************************/
package com.cklab.httpconn.request;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.cklab.httpconn.reader.HTTPReader;
import com.cklab.httpconn.util.FormData;
import com.cklab.httpconn.util.InputTag;
import com.cklab.httpconn.util.PostFormat;
import com.cklab.httpconn.util.Redirect;
import com.eclipsesource.json.JsonObject;
/**
* HTTPRequest class.
*
* This is the main object that is used to execute requests via an HTTPReader.
*
* @author cklab
*
*/
public class HTTPRequest implements Cloneable {
private Map<String, List<String>> headers;
private ArrayList<InputTag> inputs;
private Map<String, List<String>> headersToSend;
protected List<FormData> postFields;
protected String method;
protected String page;
protected String referrer;
protected String cookies;
protected PostFormat postFormat;
private StringBuilder body;
private int statusCode;
private boolean useSSL;
private Redirect redirect;
/**
* Create an HTTP Request.
*
* @param method
* The method to use, e.g. "GET"
* @param page
* the page to load
* @param useSSL
* whether or not SSL should be used
*/
public HTTPRequest(String method, String page, boolean useSSL) {
this(method, page, new ArrayList<FormData>(), null, null, useSSL);
}
/**
* Create an HTTP Request.
*
* @param method
* The method to use, e.g. "GET"
* @param page
* the page to load
* @param referrer
* the referrer
* @param useSSL
* whether or not SSL should be used
*/
public HTTPRequest(String method, String page, String referrer, boolean useSSL) {
this(method, page, new ArrayList<FormData>(), referrer, null, useSSL);
}
/**
* Create an HTTP Request.
*
* @param method
* The method to use, e.g. "GET"
* @param page
* the page to load
* @param post
* the form data
* @param cookies
* the cookie string (each cookie separated by a semi-colon)
* @param useSSL
* whether or not SSL should be used
*/
public HTTPRequest(String method, String page, String post, String cookies, boolean useSSL) {
this(method, page, new ArrayList<FormData>(), null, cookies, useSSL);
setFormData(post);
}
/**
* Create an HTTP Request.
*
* @param method
* The method to use, e.g. "GET"
* @param page
* the page to load
* @param post
* the form data
* @param referrer
* the referrer
* @param cookies
* the cookie string (each cookie separated by a semi-colon)
* @param useSSL
* whether or not SSL should be used
*/
public HTTPRequest(String method, String page, List<FormData> postFields, String referrer, String cookies, boolean useSSL) {
this.method = method;
this.page = page;
this.referrer = referrer;
this.cookies = cookies;
this.useSSL = useSSL;
this.redirect = null;
// we don't expect multiple threads to populate the body, let's stick with StringBuilder for now
this.body = new StringBuilder();
this.inputs = new ArrayList<InputTag>();
this.headersToSend = new HashMap<String, List<String>>();
this.postFields = postFields;
this.postFormat = PostFormat.QUERY;
}
public void setPostFormat(PostFormat postFormat) {
this.postFormat = postFormat;
}
/**
* Read the page and store necessary information.
*
* TODO FIXME switch to an HTML Parser for the inputs: Potential solutions include JSoup/TagSoup/JTidy
*/
public void readBody(InputStream iStream) {
// to avoid potential memory leak
// -- if this HTTPRequest is read multiple times for some reason, `body` can get arbitrarily large
body.setLength(0);
// TODO revise, don't use regex here
Scanner in = new Scanner(iStream);
Pattern inputNamePattern = Pattern.compile("<input.*?name=\"(.*?)\".*?>");
Pattern inputValuePattern = Pattern.compile("<input.*?value=\"(.*?)\".*?>");
Pattern inputTypePattern = Pattern.compile("<input.*?type=\"(.*?)\".*?>");
while (in.hasNextLine()) {
String buf = in.nextLine();
body.append(buf + "\r\n");
if (buf.contains("<input")) {
// separate all the <input>'s
Matcher m_name = inputNamePattern.matcher(buf);
Matcher m_value = inputValuePattern.matcher(buf);
Matcher m_type = inputTypePattern.matcher(buf);
while (m_name.find() && m_value.find() && m_type.find()) {
String name = m_name.group(1).trim();
String value = m_value.group(1).trim();
String type = m_type.group(1);
inputs.add(new InputTag(name, value, type));
}
}
}
}
/**
* Get the form data.
*
* Note: This is the key-value pair that is sent as a result of a POST request.
*
* @return the form data.
*/
public String getFormData() {
if (postFormat == PostFormat.JSON) {
JsonObject data = new JsonObject();
for (FormData fd : postFields) {
String value = fd.getValue();
data.add(fd.getName(), value);
}
return data.toString();
} else {
StringBuilder formData = new StringBuilder();
for (FormData fd : postFields) {
String value = fd.getValue();
value = value.replaceAll("=", "%3D").replaceAll(";", "%3B").replaceAll("\\+", "%2B").replaceAll("/", "%2F").replaceAll("\\s", "+");
formData.append(fd.getName());
formData.append("=");
formData.append(value);
formData.append("&");
}
if (formData.length() > 0) {
formData.setLength(formData.length() - 1); // remove last &
}
return formData.toString();
}
}
/**
* Set the form data.
*
* Note: This is the key-value pair that is sent as a result of a POST request.
*
* @param data
* the form data
*/
public void setFormData(String data) {
if (data == null || data.length() <= 0) {
return;
}
String fields[] = data.split("&");
for (int i = 0; i < fields.length; i++) {
String params[] = fields[i].split("=");
if (params.length <= 0) {
System.err.println("Malformed key/value pair for Post object");
continue;
}
String key = params[0];
String value = "";
if (params.length >= 2) {
value = params[1];
}
postFields.add(new FormData(key, value));
}
}
/**
* Set the post data for the POST request.
*
* @param fd
* the post data
*/
public void setFormData(FormData[] fd) {
for (FormData data : fd) {
postFields.add(data);
}
}
/**
* Add a header to be sent to the server. This will replace any default headers set by the {@link HTTPReader}.
*
* @param headerKey
* @param headerValue
*/
public void addHeader(String headerKey, String headerValue) {
List<String> values = headersToSend.get(headerKey);
if (values == null) {
values = new ArrayList<String>();
headersToSend.put(headerKey, values);
}
values.add(headerValue);
}
/**
* Add a header to be sent to the server. This will replace any default headers set by the {@link HTTPReader}.
*
* @param headerKey
* @param headerValue
*/
public void removeHeader(String headerKey) {
headersToSend.remove(headerKey);
}
/**
* The headers to be sent to the server. This will replace any default headers set by the {@link HTTPReader}.
*
* @return
*/
public Map<String, List<String>> getHeadersToSend() {
return headersToSend;
}
/**
* Set the headers.
*
* The Map keys are Strings that represent the response-header field names. Each Map value is a List of Strings that
* represents the corresponding field values
*
* @param headers
* the headers received from the server
*/
public void setHeaders(Map<String, List<String>> headers) {
this.headers = headers;
}
/**
* Get the headers.
*
* The Map keys are Strings that represent the response-header field names. Each Map value is a List of Strings that
* represents the corresponding field values
*
* @return the headers received from the server
*/
public Map<String, List<String>> getHeaders() {
return headers;
}
/**
* Set the referrer.
*
* @param ref
* the referrer.
*/
public void setReferrer(String ref) {
this.referrer = ref;
}
/**
* Set the status code received as a result of executing this HTTP Request.
*
* @param statusCode
* the statusCode
*/
public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}
/**
* Set the page to be visited.
*
* @param page
* the page to be visited
*/
public void setPage(String page) {
this.page = page;
}
/**
* Get the page to be visited.
*
* @return the page to be visited.
*/
public String getPage() {
return page;
}
/**
* The method used for this HTTP Request. (e.g. GET)
*
* @return the method used for this HTTP Request
*/
public String getMethod() {
return method;
}
/**
* Get the referrer.
*
* @return the referrer.
*/
public String getReferrer() {
return referrer;
}
/**
* Get the status code received as a result of executing this HTTP Request.
*
* @return the status code received as a result of executing this HTTP Request.
*/
public int getStatusCode() {
return statusCode;
}
/**
* Get the cookies used in this HTTP Request.
*
* @return the cookies
*/
public String getCookies() {
return cookies;
}
/**
* Get the Content-Type from the response header.
*
* @return
*/
public String getContentType() {
String contentType = null;
if (headers != null) {
List<String> types = headers.get("Content-Type");
if (types.size() > 0) {
contentType = types.get(0);
}
}
return contentType;
}
/**
* Set the cookies used in this HTTP Request.
*
* @param s
* the cookies
*/
public void setCookies(String s) {
this.cookies = s;
}
/**
* The String representation of this HTTPRequest
*/
public String toString() {
return "[method=" + getMethod() + ",page=" + getPage() + ",referrer=" + getReferrer() + ",form_data=" + getFormData() + ",cookies="
+ getCookies() + ",status_code=" + getStatusCode() + ",useSSL=" + isUsingSSL() + "]";
}
/**
* Get a Scanner object to read the body of this HTTP Request.
*
* @see #getInputStream()
* @return a Scanner object to read the body of this HTTP Request.
*/
public Scanner getScanner() {
return new Scanner(body.toString());
}
/**
* Set the body. This is what has been read from the page as a result of executing this HTTP Request.
*
* @param body
* the body of the page
*/
public void setBody(String body) {
this.body.setLength(0);
if (body != null)
this.body = new StringBuilder(body);
}
/**
* Get the body of this page (the content of this page)
*
* @return the body of the page.
*/
public String getBody() {
return body.toString();
}
/**
* Get a list <code>InputTag</code> associated with an input tag that has the given <code>name</code> field.
*
* @param name
* the name field of the tag
* @return the list of <code>InputTag</code> objects associated with an input tag that has the given
* <code>name</code> field.
*/
public ArrayList<InputTag> getInputsByName(String name) {
if (name == null) {
return null;
}
ArrayList<InputTag> found = new ArrayList<InputTag>();
for (InputTag tag : inputs) {
if (name.equals(tag.getName())) {
found.add(tag);
}
}
return found;
}
/**
* Get all the <code>input</code> tags on the page
*
* @return all the <code>input</code> tags on the page
*/
public ArrayList<InputTag> getInputFields() {
return getInputFields(null);
}
/**
* Get all the <code>input</code> tags on the page with the given type
*
* @param type
* the type, e.g. <code>hidden</code>
* @return all the <code>input</code> tags on the page with the given type.
*/
public ArrayList<InputTag> getInputFields(String type) {
ArrayList<InputTag> inputFields = new ArrayList<InputTag>();
for (InputTag tag : inputs) {
if (type == null) {
inputFields.add(tag);
} else {
if (tag.getType().equalsIgnoreCase(type)) {
inputFields.add(tag);
}
}
}
return inputFields;
}
/**
* The InputStream used for reading the body of the {@link HTTPRequest}.
*
* @return the input stream.
*/
public InputStream getInputStream() {
try {
return new ByteArrayInputStream(body.toString().getBytes("UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Set this HTTP Request to use SSL.
*
* @param useSSL
* whether or not SSL should be used.
*/
public void useSSL(boolean useSSL) {
this.useSSL = useSSL;
}
/**
* Whether or not this HTTP Request is set to use SSL.
*
* @return true if SSL is used, false otherwise.
*/
public boolean isUsingSSL() {
return useSSL;
}
/**
* Get the Redirect object that results from loading this page.
*
* @return the Redirect object that results from loading this page.
*/
public Redirect getRedirect() {
return redirect;
}
/**
* Get the Redirect object that results from loading this page.
*
* @param redir
* the Redirect object that results from loading this page.
*/
public void setRedirect(Redirect redir) {
this.redirect = redir;
}
/**
* Clone this HTTP Request.
* <p>
* Cloned attributes are: <br/>
* HTTP Method <br/>
* Page <br/>
* Post Data <br/>
* Referrer <br/>
* Cookies <br/>
* SSL Support<br/>
* <br/>
*
* The body is not copied as the clone is intended to potnetially be re-used.
*/
public HTTPRequest clone() {
HTTPRequest clone = new HTTPRequest(method, page, postFields, referrer, cookies, useSSL);
// are there any other attributes we want to copy besides the basics?
return clone;
}
}
| [
"ckproductions.lab@gmail.com"
] | ckproductions.lab@gmail.com |
32798a045f550bb3e209a459a925d943fdf26034 | d9f1c83a4ce12ed7570ad174e42680132fbbfc8a | /src/main/java/com/nextcloudapps/blogapi/model/role/RoleName.java | c435414415f8f28d24b14ed341d60725a9004923 | [
"Apache-2.0"
] | permissive | aurojyotitripathy/blogrest | 1b4a476567731c1066a7cd3d01c677eeff06553c | 1561b9508d31989ec4d6af2438ede458cc2fd43d | refs/heads/master | 2022-08-28T13:37:57.576621 | 2020-05-27T22:15:31 | 2020-05-27T22:15:31 | 267,435,175 | 0 | 0 | Apache-2.0 | 2020-05-27T22:15:11 | 2020-05-27T22:01:05 | Java | UTF-8 | Java | false | false | 103 | java | package com.nextcloudapps.blogapi.model.role;
public enum RoleName {
ROLE_ADMIN,
ROLE_USER,
}
| [
"aurojyotitripathy@gmail.com"
] | aurojyotitripathy@gmail.com |
05de61afb6a20bd6abb01f8264f902bc6d5e13d3 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/lucene-solr/2019/4/TestNumericRangeQuery64.java | 71e0e67e51c6f1e141626cb785b59178f54bbd71 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 20,549 | 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.solr.legacy;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.MultiTermQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.QueryUtils;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.TopFieldCollector;
import org.apache.lucene.search.TopScoreDocCollector;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.util.TestUtil;
import org.apache.solr.SolrTestCase;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class TestNumericRangeQuery64 extends SolrTestCase {
// distance of entries
private static long distance;
// shift the starting of the values to the left, to also have negative values:
private static final long startOffset = - 1L << 31;
// number of docs to generate for testing
private static int noDocs;
private static Directory directory = null;
private static IndexReader reader = null;
private static IndexSearcher searcher = null;
@BeforeClass
public static void beforeClass() throws Exception {
noDocs = atLeast(4096);
distance = (1L << 60) / noDocs;
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), directory,
newIndexWriterConfig(new MockAnalyzer(random()))
.setMaxBufferedDocs(TestUtil.nextInt(random(), 100, 1000))
.setMergePolicy(newLogMergePolicy()));
final LegacyFieldType storedLong = new LegacyFieldType(LegacyLongField.TYPE_NOT_STORED);
storedLong.setStored(true);
storedLong.freeze();
final LegacyFieldType storedLong8 = new LegacyFieldType(storedLong);
storedLong8.setNumericPrecisionStep(8);
final LegacyFieldType storedLong4 = new LegacyFieldType(storedLong);
storedLong4.setNumericPrecisionStep(4);
final LegacyFieldType storedLong6 = new LegacyFieldType(storedLong);
storedLong6.setNumericPrecisionStep(6);
final LegacyFieldType storedLong2 = new LegacyFieldType(storedLong);
storedLong2.setNumericPrecisionStep(2);
final LegacyFieldType storedLongNone = new LegacyFieldType(storedLong);
storedLongNone.setNumericPrecisionStep(Integer.MAX_VALUE);
final LegacyFieldType unstoredLong = LegacyLongField.TYPE_NOT_STORED;
final LegacyFieldType unstoredLong8 = new LegacyFieldType(unstoredLong);
unstoredLong8.setNumericPrecisionStep(8);
final LegacyFieldType unstoredLong6 = new LegacyFieldType(unstoredLong);
unstoredLong6.setNumericPrecisionStep(6);
final LegacyFieldType unstoredLong4 = new LegacyFieldType(unstoredLong);
unstoredLong4.setNumericPrecisionStep(4);
final LegacyFieldType unstoredLong2 = new LegacyFieldType(unstoredLong);
unstoredLong2.setNumericPrecisionStep(2);
LegacyLongField
field8 = new LegacyLongField("field8", 0L, storedLong8),
field6 = new LegacyLongField("field6", 0L, storedLong6),
field4 = new LegacyLongField("field4", 0L, storedLong4),
field2 = new LegacyLongField("field2", 0L, storedLong2),
fieldNoTrie = new LegacyLongField("field"+Integer.MAX_VALUE, 0L, storedLongNone),
ascfield8 = new LegacyLongField("ascfield8", 0L, unstoredLong8),
ascfield6 = new LegacyLongField("ascfield6", 0L, unstoredLong6),
ascfield4 = new LegacyLongField("ascfield4", 0L, unstoredLong4),
ascfield2 = new LegacyLongField("ascfield2", 0L, unstoredLong2);
Document doc = new Document();
// add fields, that have a distance to test general functionality
doc.add(field8); doc.add(field6); doc.add(field4); doc.add(field2); doc.add(fieldNoTrie);
// add ascending fields with a distance of 1, beginning at -noDocs/2 to test the correct splitting of range and inclusive/exclusive
doc.add(ascfield8); doc.add(ascfield6); doc.add(ascfield4); doc.add(ascfield2);
// Add a series of noDocs docs with increasing long values, by updating the fields
for (int l=0; l<noDocs; l++) {
long val=distance*l+startOffset;
field8.setLongValue(val);
field6.setLongValue(val);
field4.setLongValue(val);
field2.setLongValue(val);
fieldNoTrie.setLongValue(val);
val=l-(noDocs/2);
ascfield8.setLongValue(val);
ascfield6.setLongValue(val);
ascfield4.setLongValue(val);
ascfield2.setLongValue(val);
writer.addDocument(doc);
}
reader = writer.getReader();
searcher=newSearcher(reader);
writer.close();
}
@AfterClass
public static void afterClass() throws Exception {
searcher = null;
reader.close();
reader = null;
directory.close();
directory = null;
}
@Override
public void setUp() throws Exception {
super.setUp();
// set the theoretical maximum term count for 8bit (see docs for the number)
// super.tearDown will restore the default
BooleanQuery.setMaxClauseCount(7*255*2 + 255);
}
/** test for constant score + boolean query + filter, the other tests only use the constant score mode */
private void testRange(int precisionStep) throws Exception {
String field="field"+precisionStep;
int count=3000;
long lower=(distance*3/2)+startOffset, upper=lower + count*distance + (distance/3);
LegacyNumericRangeQuery<Long> q = LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, upper, true, true);
for (byte i=0; i<2; i++) {
TopFieldCollector collector = TopFieldCollector.create(Sort.INDEXORDER, noDocs, Integer.MAX_VALUE);
String type;
switch (i) {
case 0:
type = " (constant score filter rewrite)";
q.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_REWRITE);
break;
case 1:
type = " (constant score boolean rewrite)";
q.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_REWRITE);
break;
default:
return;
}
searcher.search(q, collector);
TopDocs topDocs = collector.topDocs();
ScoreDoc[] sd = topDocs.scoreDocs;
assertNotNull(sd);
assertEquals("Score doc count"+type, count, sd.length );
Document doc=searcher.doc(sd[0].doc);
assertEquals("First doc"+type, 2*distance+startOffset, doc.getField(field).numericValue().longValue() );
doc=searcher.doc(sd[sd.length-1].doc);
assertEquals("Last doc"+type, (1+count)*distance+startOffset, doc.getField(field).numericValue().longValue() );
}
}
@Test
public void testRange_8bit() throws Exception {
testRange(8);
}
@Test
public void testRange_6bit() throws Exception {
testRange(6);
}
@Test
public void testRange_4bit() throws Exception {
testRange(4);
}
@Test
public void testRange_2bit() throws Exception {
testRange(2);
}
@Test
public void testOneMatchQuery() throws Exception {
LegacyNumericRangeQuery<Long> q = LegacyNumericRangeQuery.newLongRange("ascfield8", 8, 1000L, 1000L, true, true);
TopDocs topDocs = searcher.search(q, noDocs);
ScoreDoc[] sd = topDocs.scoreDocs;
assertNotNull(sd);
assertEquals("Score doc count", 1, sd.length );
}
private void testLeftOpenRange(int precisionStep) throws Exception {
String field="field"+precisionStep;
int count=3000;
long upper=(count-1)*distance + (distance/3) + startOffset;
LegacyNumericRangeQuery<Long> q= LegacyNumericRangeQuery.newLongRange(field, precisionStep, null, upper, true, true);
TopDocs topDocs = searcher.search(q, noDocs, Sort.INDEXORDER);
ScoreDoc[] sd = topDocs.scoreDocs;
assertNotNull(sd);
assertEquals("Score doc count", count, sd.length );
Document doc=searcher.doc(sd[0].doc);
assertEquals("First doc", startOffset, doc.getField(field).numericValue().longValue() );
doc=searcher.doc(sd[sd.length-1].doc);
assertEquals("Last doc", (count-1)*distance+startOffset, doc.getField(field).numericValue().longValue() );
q= LegacyNumericRangeQuery.newLongRange(field, precisionStep, null, upper, false, true);
topDocs = searcher.search(q, noDocs, Sort.INDEXORDER);
sd = topDocs.scoreDocs;
assertNotNull(sd);
assertEquals("Score doc count", count, sd.length );
doc=searcher.doc(sd[0].doc);
assertEquals("First doc", startOffset, doc.getField(field).numericValue().longValue() );
doc=searcher.doc(sd[sd.length-1].doc);
assertEquals("Last doc", (count-1)*distance+startOffset, doc.getField(field).numericValue().longValue() );
}
@Test
public void testLeftOpenRange_8bit() throws Exception {
testLeftOpenRange(8);
}
@Test
public void testLeftOpenRange_6bit() throws Exception {
testLeftOpenRange(6);
}
@Test
public void testLeftOpenRange_4bit() throws Exception {
testLeftOpenRange(4);
}
@Test
public void testLeftOpenRange_2bit() throws Exception {
testLeftOpenRange(2);
}
private void testRightOpenRange(int precisionStep) throws Exception {
String field="field"+precisionStep;
int count=3000;
long lower=(count-1)*distance + (distance/3) +startOffset;
LegacyNumericRangeQuery<Long> q= LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, null, true, true);
TopDocs topDocs = searcher.search(q, noDocs, Sort.INDEXORDER);
ScoreDoc[] sd = topDocs.scoreDocs;
assertNotNull(sd);
assertEquals("Score doc count", noDocs-count, sd.length );
Document doc=searcher.doc(sd[0].doc);
assertEquals("First doc", count*distance+startOffset, doc.getField(field).numericValue().longValue() );
doc=searcher.doc(sd[sd.length-1].doc);
assertEquals("Last doc", (noDocs-1)*distance+startOffset, doc.getField(field).numericValue().longValue() );
q= LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, null, true, false);
topDocs = searcher.search(q, noDocs, Sort.INDEXORDER);
sd = topDocs.scoreDocs;
assertNotNull(sd);
assertEquals("Score doc count", noDocs-count, sd.length );
doc=searcher.doc(sd[0].doc);
assertEquals("First doc", count*distance+startOffset, doc.getField(field).numericValue().longValue() );
doc=searcher.doc(sd[sd.length-1].doc);
assertEquals("Last doc", (noDocs-1)*distance+startOffset, doc.getField(field).numericValue().longValue() );
}
@Test
public void testRightOpenRange_8bit() throws Exception {
testRightOpenRange(8);
}
@Test
public void testRightOpenRange_6bit() throws Exception {
testRightOpenRange(6);
}
@Test
public void testRightOpenRange_4bit() throws Exception {
testRightOpenRange(4);
}
@Test
public void testRightOpenRange_2bit() throws Exception {
testRightOpenRange(2);
}
@Test
public void testInfiniteValues() throws Exception {
Directory dir = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), dir,
newIndexWriterConfig(new MockAnalyzer(random())));
Document doc = new Document();
doc.add(new LegacyDoubleField("double", Double.NEGATIVE_INFINITY, Field.Store.NO));
doc.add(new LegacyLongField("long", Long.MIN_VALUE, Field.Store.NO));
writer.addDocument(doc);
doc = new Document();
doc.add(new LegacyDoubleField("double", Double.POSITIVE_INFINITY, Field.Store.NO));
doc.add(new LegacyLongField("long", Long.MAX_VALUE, Field.Store.NO));
writer.addDocument(doc);
doc = new Document();
doc.add(new LegacyDoubleField("double", 0.0, Field.Store.NO));
doc.add(new LegacyLongField("long", 0L, Field.Store.NO));
writer.addDocument(doc);
for (double d : TestLegacyNumericUtils.DOUBLE_NANs) {
doc = new Document();
doc.add(new LegacyDoubleField("double", d, Field.Store.NO));
writer.addDocument(doc);
}
writer.close();
IndexReader r = DirectoryReader.open(dir);
IndexSearcher s = newSearcher(r);
Query q= LegacyNumericRangeQuery.newLongRange("long", null, null, true, true);
TopDocs topDocs = s.search(q, 10);
assertEquals("Score doc count", 3, topDocs.scoreDocs.length );
q= LegacyNumericRangeQuery.newLongRange("long", null, null, false, false);
topDocs = s.search(q, 10);
assertEquals("Score doc count", 3, topDocs.scoreDocs.length );
q= LegacyNumericRangeQuery.newLongRange("long", Long.MIN_VALUE, Long.MAX_VALUE, true, true);
topDocs = s.search(q, 10);
assertEquals("Score doc count", 3, topDocs.scoreDocs.length );
q= LegacyNumericRangeQuery.newLongRange("long", Long.MIN_VALUE, Long.MAX_VALUE, false, false);
topDocs = s.search(q, 10);
assertEquals("Score doc count", 1, topDocs.scoreDocs.length );
q= LegacyNumericRangeQuery.newDoubleRange("double", null, null, true, true);
topDocs = s.search(q, 10);
assertEquals("Score doc count", 3, topDocs.scoreDocs.length );
q= LegacyNumericRangeQuery.newDoubleRange("double", null, null, false, false);
topDocs = s.search(q, 10);
assertEquals("Score doc count", 3, topDocs.scoreDocs.length );
q= LegacyNumericRangeQuery.newDoubleRange("double", Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, true, true);
topDocs = s.search(q, 10);
assertEquals("Score doc count", 3, topDocs.scoreDocs.length );
q= LegacyNumericRangeQuery.newDoubleRange("double", Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, false, false);
topDocs = s.search(q, 10);
assertEquals("Score doc count", 1, topDocs.scoreDocs.length );
q= LegacyNumericRangeQuery.newDoubleRange("double", Double.NaN, Double.NaN, true, true);
topDocs = s.search(q, 10);
assertEquals("Score doc count", TestLegacyNumericUtils.DOUBLE_NANs.length, topDocs.scoreDocs.length );
r.close();
dir.close();
}
private void testRangeSplit(int precisionStep) throws Exception {
String field="ascfield"+precisionStep;
// 10 random tests
int num = TestUtil.nextInt(random(), 10, 20);
for (int i = 0; i < num; i++) {
long lower=(long)(random().nextDouble()*noDocs - noDocs/2);
long upper=(long)(random().nextDouble()*noDocs - noDocs/2);
if (lower>upper) {
long a=lower; lower=upper; upper=a;
}
// test inclusive range
Query tq= LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, upper, true, true);
TopScoreDocCollector collector = TopScoreDocCollector.create(1, Integer.MAX_VALUE);
searcher.search(tq, collector);
TopDocs tTopDocs = collector.topDocs();
assertEquals("Returned count of range query must be equal to inclusive range length", upper-lower+1, tTopDocs.totalHits.value );
// test exclusive range
tq= LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, upper, false, false);
collector = TopScoreDocCollector.create(1, Integer.MAX_VALUE);
searcher.search(tq, collector);
tTopDocs = collector.topDocs();
assertEquals("Returned count of range query must be equal to exclusive range length", Math.max(upper-lower-1, 0), tTopDocs.totalHits.value );
// test left exclusive range
tq= LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, upper, false, true);
collector = TopScoreDocCollector.create(1, Integer.MAX_VALUE);
searcher.search(tq, collector);
tTopDocs = collector.topDocs();
assertEquals("Returned count of range query must be equal to half exclusive range length", upper-lower, tTopDocs.totalHits.value );
// test right exclusive range
tq= LegacyNumericRangeQuery.newLongRange(field, precisionStep, lower, upper, true, false);
collector = TopScoreDocCollector.create(1, Integer.MAX_VALUE);
searcher.search(tq, collector);
tTopDocs = collector.topDocs();
assertEquals("Returned count of range query must be equal to half exclusive range length", upper-lower, tTopDocs.totalHits.value );
}
}
@Test
public void testRangeSplit_8bit() throws Exception {
testRangeSplit(8);
}
@Test
public void testRangeSplit_6bit() throws Exception {
testRangeSplit(6);
}
@Test
public void testRangeSplit_4bit() throws Exception {
testRangeSplit(4);
}
@Test
public void testRangeSplit_2bit() throws Exception {
testRangeSplit(2);
}
/** we fake a double test using long2double conversion of LegacyNumericUtils */
private void testDoubleRange(int precisionStep) throws Exception {
final String field="ascfield"+precisionStep;
final long lower=-1000L, upper=+2000L;
Query tq= LegacyNumericRangeQuery.newDoubleRange(field, precisionStep,
NumericUtils.sortableLongToDouble(lower), NumericUtils.sortableLongToDouble(upper), true, true);
TopScoreDocCollector collector = TopScoreDocCollector.create(1, Integer.MAX_VALUE);
searcher.search(tq, collector);
TopDocs tTopDocs = collector.topDocs();
assertEquals("Returned count of range query must be equal to inclusive range length", upper-lower+1, tTopDocs.totalHits.value );
}
@Test
public void testDoubleRange_8bit() throws Exception {
testDoubleRange(8);
}
@Test
public void testDoubleRange_6bit() throws Exception {
testDoubleRange(6);
}
@Test
public void testDoubleRange_4bit() throws Exception {
testDoubleRange(4);
}
@Test
public void testDoubleRange_2bit() throws Exception {
testDoubleRange(2);
}
@Test
public void testEqualsAndHash() throws Exception {
QueryUtils.checkHashEquals(LegacyNumericRangeQuery.newLongRange("test1", 4, 10L, 20L, true, true));
QueryUtils.checkHashEquals(LegacyNumericRangeQuery.newLongRange("test2", 4, 10L, 20L, false, true));
QueryUtils.checkHashEquals(LegacyNumericRangeQuery.newLongRange("test3", 4, 10L, 20L, true, false));
QueryUtils.checkHashEquals(LegacyNumericRangeQuery.newLongRange("test4", 4, 10L, 20L, false, false));
QueryUtils.checkHashEquals(LegacyNumericRangeQuery.newLongRange("test5", 4, 10L, null, true, true));
QueryUtils.checkHashEquals(LegacyNumericRangeQuery.newLongRange("test6", 4, null, 20L, true, true));
QueryUtils.checkHashEquals(LegacyNumericRangeQuery.newLongRange("test7", 4, null, null, true, true));
QueryUtils.checkEqual(
LegacyNumericRangeQuery.newLongRange("test8", 4, 10L, 20L, true, true),
LegacyNumericRangeQuery.newLongRange("test8", 4, 10L, 20L, true, true)
);
QueryUtils.checkUnequal(
LegacyNumericRangeQuery.newLongRange("test9", 4, 10L, 20L, true, true),
LegacyNumericRangeQuery.newLongRange("test9", 8, 10L, 20L, true, true)
);
QueryUtils.checkUnequal(
LegacyNumericRangeQuery.newLongRange("test10a", 4, 10L, 20L, true, true),
LegacyNumericRangeQuery.newLongRange("test10b", 4, 10L, 20L, true, true)
);
QueryUtils.checkUnequal(
LegacyNumericRangeQuery.newLongRange("test11", 4, 10L, 20L, true, true),
LegacyNumericRangeQuery.newLongRange("test11", 4, 20L, 10L, true, true)
);
QueryUtils.checkUnequal(
LegacyNumericRangeQuery.newLongRange("test12", 4, 10L, 20L, true, true),
LegacyNumericRangeQuery.newLongRange("test12", 4, 10L, 20L, false, true)
);
QueryUtils.checkUnequal(
LegacyNumericRangeQuery.newLongRange("test13", 4, 10L, 20L, true, true),
LegacyNumericRangeQuery.newFloatRange("test13", 4, 10f, 20f, true, true)
);
// difference to int range is tested in TestNumericRangeQuery32
}
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
64be9d625fb36c9494c4306f00e4c48cc2fa23b7 | c1a318785c0f2f2ceb440feaa4354099eb5e15e0 | /src/main/java/com/blog/blog/utils/GetUUIDUtils.java | 1cab9ab375cf98c63f5bf9d5b82a50d7cbe48bc1 | [] | no_license | ice-fun/blog | 2cca3bfa603e673b7e46335d3050ccd8e9722e1a | 73289cbe25707cb7240f166174a2888f7c8d9c92 | refs/heads/main | 2022-12-30T01:35:45.128571 | 2020-10-19T08:17:51 | 2020-10-19T08:17:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,146 | java | package com.blog.blog.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class GetUUIDUtils {
/**
* 采用URL Base64字符,即把“+/”换成“-_”
*/
//static private char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=".toCharArray();
static private char[] alphabet = "01234567890123456789012345678901234567890123456789012345678901234".toCharArray();
public static void main(String[] args) {
//System.out.println(getUUIDBits(16)); //指定16位
// System.out.println(getUUID("c19b9de1-f33a-494b-afbe-f06817218d64"));
// System.out.println(getUUID22("c19b9de1-f33a-494b-afbe-f06817218d64"));
// Date d1 = new Date();
List<String> strList = new ArrayList<String>();
for (int i = 0; i < 50000; i++) {
UUID.randomUUID().toString();
String g = getUUIDBits(15);
for (int ii = 0; ii < strList.size(); ii++) {
if (g.equals(strList.get(ii))) {
System.out.println(g);
break;
}
}
strList.add(g);
//System.out.println(getUUIDBits(15));
}
// Date d2 = new Date();
// System.out.print(d2.getTime() - d1.getTime());
}
/**
* 将随机UUID转换成指定位数的字符串
*
* @param bits 指定位数
* @return
*/
// public static String getUUID22(String u) {
// UUID uuid = UUID.fromString(u);
public static String getUUIDBits(int bits) {
UUID uuid = UUID.randomUUID();
// System.out.println(uuid.toString());
long msb = uuid.getMostSignificantBits();
long lsb = uuid.getLeastSignificantBits();
char[] out = new char[32];
int tmp = 0, idx = 0;
// 循环写法
int bit = 0, bt1 = 8, bt2 = 8;
int mask = 0x00, offsetm = 0, offsetl = 0;
for (; bit < 16; bit += 3, idx += 4) {
offsetm = 64 - (bit + 3) * 8;
offsetl = 0;
tmp = 0;
if (bt1 > 3) {
mask = (1 << 8 * 3) - 1;
} else if (bt1 >= 0) {
mask = (1 << 8 * bt1) - 1;
bt2 -= 3 - bt1;
} else {
mask = (1 << 8 * ((bt2 > 3) ? 3 : bt2)) - 1;
bt2 -= 3;
}
if (bt1 > 0) {
bt1 -= 3;
tmp = (int) ((offsetm < 0) ? msb : (msb >>> offsetm) & mask);
if (bt1 < 0) {
tmp <<= Math.abs(offsetm);
mask = (1 << 8 * Math.abs(bt1)) - 1;
}
}
if (offsetm < 0) {
offsetl = 64 + offsetm;
tmp |= ((offsetl < 0) ? lsb : (lsb >>> offsetl)) & mask;
}
if (bit == 15) {
out[idx + 3] = alphabet[64];
out[idx + 2] = alphabet[64];
tmp <<= 4;
} else {
out[idx + 3] = alphabet[tmp & 0x3f];
tmp >>= 6;
out[idx + 2] = alphabet[tmp & 0x3f];
tmp >>= 6;
}
out[idx + 1] = alphabet[tmp & 0x3f];
tmp >>= 6;
out[idx] = alphabet[tmp & 0x3f];
}
return new String(out, 0, bits);
}
/**
* Base64 编码
*
* @param data
* @return
*/
private char[] encode(byte[] data) {
char[] out = new char[((data.length + 2) / 3) * 4];
boolean quad, trip;
for (int i = 0, index = 0; i < data.length; i += 3, index += 4) {
quad = trip = false;
int val = (0xFF & (int) data[i]);
val <<= 8;
if ((i + 1) < data.length) {
val |= (0xFF & (int) data[i + 1]);
trip = true;
}
val <<= 8;
if ((i + 2) < data.length) {
val |= (0xFF & (int) data[i + 2]);
quad = true;
}
out[index + 3] = alphabet[(quad ? (val & 0x3F) : 64)];
val >>= 6;
out[index + 2] = alphabet[(trip ? (val & 0x3F) : 64)];
val >>= 6;
out[index + 1] = alphabet[val & 0x3F];
val >>= 6;
out[index + 0] = alphabet[val & 0x3F];
}
return out;
}
/**
* 转成字节
*
* @return
*/
// private byte[] toBytes(String u) {
// UUID uuid = UUID.fromString(u);
private byte[] toBytes() {
UUID uuid = UUID.randomUUID();
long msb = uuid.getMostSignificantBits();
long lsb = uuid.getLeastSignificantBits();
byte[] buffer = new byte[16];
for (int i = 0; i < 8; i++) {
buffer[i] = (byte) ((msb >>> 8 * (7 - i)) & 0xFF);
buffer[i + 8] = (byte) ((lsb >>> 8 * (7 - i)) & 0xFF);
}
return buffer;
}
// public String getUUID(String u) {
// char[] res = encode(toBytes(u));
public String getUUID() {
char[] res = encode(toBytes());
System.out.println(new String(res));
return new String(res, 0, res.length - 2);
}
}
| [
"848617514@qq.com"
] | 848617514@qq.com |
dd656765f5e66183ad865ce8975c57d7728dd33a | 29832c19772448d6c829d9c30244e914903c9cdb | /student-service/src/test/java/com/test/rest/StudentServiceApplicationTests.java | 2d1a295c0693c044143f04532230f05b84fd384d | [] | no_license | kunallawand5007/zipkin-Spring-Sleuth-Distrubuted-tracing- | 58f2551bcdea5887c55db12ba5e95a55b0008614 | df7eea06f8204118ea0278499609f4c548cde121 | refs/heads/master | 2020-04-08T08:02:33.455552 | 2018-11-26T12:08:23 | 2018-11-26T12:08:23 | 159,162,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 338 | java | package com.test.rest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class StudentServiceApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"kunal.lawand@nitorinfotech.in"
] | kunal.lawand@nitorinfotech.in |
8ea12bbc81e0e80d1e21ce5ec0f3e9542bbae325 | 43e909146e59c7d816eae42b7086c824d55bfd1e | /tst1/src/main/java/nat/pruebas/tst1/pages/GTT/SetPerson.java | 761040a87c952c2859a992300671885d24d6ded8 | [] | no_license | DrakeInFire/tst_tap | 48e467d11c4cd5953dbf204736937158c4d85ce5 | 24a9b56a378f2ca922fcd460f0670450bad9a826 | refs/heads/master | 2021-01-13T01:55:51.803577 | 2013-12-17T12:17:32 | 2013-12-17T12:17:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 523 | java | package nat.pruebas.tst1.pages.GTT;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import nat.pruebas.tst1.Data.Persona;
import nat.pruebas.tst1.services.DAO.*;
public class SetPerson {
@Property
private Persona person;
private DAOPersona dao;
void onSuccess()
{
dao=new DAOPersona ();
try{
dao.Open();
dao.Store(person);
}
catch(Exception e)
{
System.out.println("ERROR en SetPerson");
}
finally
{
dao.Close();
}
}
}
| [
"mtempranom@gmail.com"
] | mtempranom@gmail.com |
aa392821e1657b48967ba868ebc46f7d4c7179dd | 23aed605b1ef92c39ad4086736038136eb8bcc44 | /src/day8_march_10/ClassWork.java | 3b373c3071c2b6f995ba4f77fd48df34766fc597 | [] | no_license | hubagit/FirstProject | 8d928f8c5817c19058d83b1f4f7c417642143759 | b18e794de750cb0394e9d89e588ca58d5fb8444f | refs/heads/master | 2020-06-04T02:34:21.950572 | 2019-07-16T20:36:21 | 2019-07-16T20:36:21 | 191,836,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package day8_march_10;
import java.util.Scanner;
public class ClassWork {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int areaCode = input.nextInt();
int localNumber = input.nextInt();
System.out.println("Calling number " + "("+areaCode+")" + "-" + localNumber);
}
}
| [
"mustafasungur18@hotmail.com"
] | mustafasungur18@hotmail.com |
503e624a2be9e39b791f142ff6c40076096db6cc | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Jetty/Jetty6977.java | 39a62a5290bf947729f08d3f922d99f2d64775a1 | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,501 | java | @Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
if (configuration.getFactory().isUpgradeRequest(request,response))
{
MappedResource<WebSocketCreator> resource = configuration.getMatch(target);
if (resource == null)
{
// no match.
response.sendError(HttpServletResponse.SC_NOT_FOUND,"No websocket endpoint matching path: " + target);
return;
}
WebSocketCreator creator = resource.getResource();
// Store PathSpec resource mapping as request attribute
request.setAttribute(PathSpec.class.getName(),resource);
// We have an upgrade request
if (configuration.getFactory().acceptWebSocket(creator,request,response))
{
// We have a socket instance created
return;
}
// If we reach this point, it means we had an incoming request to upgrade
// but it was either not a proper websocket upgrade, or it was possibly rejected
// due to incoming request constraints (controlled by WebSocketCreator)
if (response.isCommitted())
{
// not much we can do at this point.
return;
}
}
super.handle(target,baseRequest,request,response);
}
| [
"Qing.Mi@my.cityu.edu.hk"
] | Qing.Mi@my.cityu.edu.hk |
b42d03a1d5937e9b2b8066c08ef49756704f3d7a | 447520f40e82a060368a0802a391697bc00be96f | /apks/malware/app80/source/com/lepeng/utils/ConstantUtil.java | 43391fb0a8b3d1541555f535243b3537cf13adec | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 794 | java | package com.lepeng.utils;
public class ConstantUtil
{
public static final String CHARGETYPEEIGHT = "WUXIANCHUANGJIE";
public static final String CHARGETYPEELEVEN = "JIESHENGDADDO";
public static final String CHARGETYPEFIVE = "LIJU";
public static final String CHARGETYPEFOUR = "FASTFUN";
public static final String CHARGETYPENINE = "MIDIAN";
public static final String CHARGETYPEONE = "YUEWENRDO";
public static final String CHARGETYPESEVEN = "QUHEHD";
public static final String CHARGETYPESIX = "RONGYU";
public static final String CHARGETYPETEN = "FAST-FUNYEYOU";
public static final String CHARGETYPETHREE = "BAOYUE";
public static final String CHARGETYPETWELVE = "GUANGZHOUPUSHI";
public static final String CHARGETYPETWO = "TWICE";
public ConstantUtil() {}
}
| [
"antal.micky@yahoo.com"
] | antal.micky@yahoo.com |
76e67c50ec0e486d8c7242e731dba32dd3c76884 | bf1d6484f5c32625d9ff61ef407e1f7e8fbca6c8 | /ribbit/app/src/main/java/com/moritzgruber/ribbit/MessageAdapter.java | d57a16cd1192fb554095d8b035351e246edcedba | [] | no_license | MoritzGruber/AndroidDev | 2eaf720c56e2e6c535c4c65125fe8d7c4011acfd | fde0bd10fcd7cb7dd34ae9647b3362c6bf62edb7 | refs/heads/master | 2020-12-11T03:24:44.540092 | 2015-08-26T10:27:03 | 2015-08-26T10:27:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,053 | java | package com.moritzgruber.ribbit;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.parse.ParseObject;
import java.util.List;
public class MessageAdapter extends ArrayAdapter<ParseObject> {
protected Context mContext;
protected List<ParseObject> mMessages;
public MessageAdapter (Context context, List<ParseObject> messages){
super(context, R.layout.message_item, messages);
mContext= context;
mMessages = messages;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(R.layout.message_item, null);
holder = new ViewHolder();
holder.iconImageView = (ImageView)convertView.findViewById(R.id.messageIcon);
holder.nameLabel = (TextView)convertView.findViewById(R.id.senderLabel);
convertView.setTag(holder);
}else {
holder = (ViewHolder)convertView.getTag();
}
ParseObject message = mMessages.get(position);
if(message.getString(ParseConstants.KEY_FILE_TYPE).equals(ParseConstants.TYPE_IMAGE)) {
holder.iconImageView.setImageResource(R.mipmap.ic_action_picture);
holder.nameLabel.setText(message.getString(ParseConstants.KEY_SENDER_NAME));
}else {
holder.iconImageView.setImageResource(R.mipmap.ic_action_play_over_video);
holder.nameLabel.setText(message.getString(ParseConstants.KEY_SENDER_NAME));
}
return convertView;
}
private static class ViewHolder{
ImageView iconImageView;
TextView nameLabel;
}
public void refill(List<ParseObject> messages){
mMessages.clear();
mMessages.addAll(messages);
notifyDataSetChanged();
}
}
| [
"mog8017@thi.de"
] | mog8017@thi.de |
7b207394b8aab27e4f07c1a861933bf2747eb8d1 | 13a8a49058509856cea37769c012eecf9418e326 | /etms-backend/src/main/java/cn/wllnb/etms/model/entities/AdminEntity.java | 05ebdf4959643f96f0f00ff85a727d0fb368352b | [] | no_license | wllshdx/etms | 99ea435f79073719f732cdc23bbdfde74b92fc2e | 69da1d4e27cdec0f378eb13fec7c00e07a42268d | refs/heads/master | 2022-10-23T21:59:30.069844 | 2020-06-12T05:25:55 | 2020-06-12T05:25:55 | 271,705,704 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package cn.wllnb.etms.model.entities;
import cn.wllnb.etms.authentication.annotation.Admin;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* @author WLL
*/
@Data
@TableName("admin")
public class AdminEntity {
private static final String ID = "admin_id";
public static final String USERNAME = "admin_username";
public static final String PASSWORD = "admin_password";
public static final String PRIVILEGE = "admin_privilege";
@NotNull
@TableId(value = ID, type = IdType.AUTO)
private Integer id;
@NotBlank(message = "用户名不能为空")
@TableField(USERNAME)
private String username;
@NotEmpty
@TableField(PASSWORD)
private String password;
@NotNull(message = "权限不能为空")
@Range(min = Admin.NO, max = Admin.ALL)
@TableField(PRIVILEGE)
private Integer privilege;
}
| [
"wllshdx_123@163.com"
] | wllshdx_123@163.com |
1795b251ddc6501eb4ddecae310e3663d3ec76dc | 08ee9c314efd06f9af09b293519dc5635b393756 | /test/com/enation/test/shop/promotion/PromotionActivityTest.java | 42679e4218e43d846f8d427de6156be0294a18f8 | [] | no_license | zhoutanxin/dmall | b75b5b716d929d96821cc027bc7fad6a3146fddb | 4761ab0c364d1539c6b503fcba319b6f30bd5522 | refs/heads/master | 2021-01-20T12:03:44.357516 | 2015-07-12T11:41:50 | 2015-07-12T11:41:50 | 38,876,025 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,817 | java | package com.enation.test.shop.promotion;
import java.util.Date;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import com.enation.eop.resource.model.EopSite;
import com.enation.eop.sdk.context.EopContext;
import com.enation.framework.database.IDBRouter;
import com.enation.framework.database.ObjectNotFoundException;
import com.enation.framework.database.Page;
import com.enation.framework.test.SpringTestSupport;
import com.enation.javashop.core.model.PromotionActivity;
import com.enation.javashop.core.service.IPromotionActivityManager;
/**
* 促销活动管理类测试
* @author kingapex
*2010-4-15下午12:16:10
*/
public class PromotionActivityTest extends SpringTestSupport {
private IPromotionActivityManager promotionActivityManager;
protected IDBRouter shopSaasDBRouter;
@Before
public void mock(){
promotionActivityManager = this.getBean("promotionActivityManager");
shopSaasDBRouter = this.getBean("shopSaasDBRouter");
EopSite site = new EopSite();
site.setUserid(2);
site.setId(2);
EopContext context = new EopContext();
context.setCurrentSite(site);
EopContext.setContext(context);
}
/**
* 清除数据并建立表结构
*/
private void clean(){
this.jdbcTemplate.execute("drop table if exists js_promotion_activity_2");
shopSaasDBRouter.createTable( "promotion_activity");
}
/**
* 测试添加
*/
@Test
public void testAdd(){
this.clean();
PromotionActivity activity = new PromotionActivity();
activity.setName("test");
activity.setEnable(1);
activity.setBegin_time( new Date().getTime());
activity.setEnd_time(new Date().getTime()) ;
activity.setBrief("test");
promotionActivityManager.add(activity);
int count = this.jdbcTemplate.queryForInt("select count(0) from js_promotion_activity_2 ");
/**
* 验证数据库记录为1
*/
Assert.assertEquals(count, 1);
try{
PromotionActivity activity1 = new PromotionActivity();
promotionActivityManager.add(activity1);
Assert.fail("参数错误,不应正常执行");
}catch(RuntimeException e){
}
try{
PromotionActivity activity3 = new PromotionActivity();
activity3.setName("abc");
promotionActivityManager.add(activity3);
Assert.fail("参数错误,不应正常执行");
}catch(RuntimeException e){
}
try{
PromotionActivity activity2=null;
promotionActivityManager.add(activity2);
Assert.fail("参数错误,不应正常执行");
}catch(RuntimeException e){
}
}
/**
* 测试读取
*/
@Test
public void testGet(){
this.testAdd(); //模拟数据
PromotionActivity activity = promotionActivityManager.get(1);
Assert.assertEquals(activity.getName(), "test");
try{
activity = promotionActivityManager.get(132323);
Assert.fail("未正常抛出未找到记录异常");
}catch(ObjectNotFoundException e){
}
}
/**
* 测试修改
*/
@Test
public void testEdit(){
PromotionActivity activity = this.promotionActivityManager.get(1);
activity.setId(1);
activity.setName("test1");
activity.setBrief("test1");
promotionActivityManager.edit(activity);
PromotionActivity activityDb = this.promotionActivityManager.get(1);
Assert.assertEquals(activityDb.getName(), "test1");
PromotionActivity activity1 = new PromotionActivity();
activity1.setName("test2");
activity1.setBrief("test2");
try{
promotionActivityManager.edit(activity1);
Assert.fail("参数错误,不应正常执行");
}catch (RuntimeException e) {
}
}
/**
* 测试读取列表
*/
@Test
public void testList(){
this.testAdd();
Page page = this.promotionActivityManager.list(1, 20);
Assert.assertEquals(page.getTotalCount(), 1);
Assert.assertEquals( ((List)page.getResult()).size() , 1);
}
/**
* 测试删除
*/
@Test
public void testDelete(){
this.testAdd();
PromotionTest promotionTest =new PromotionTest();
promotionTest.setup();
promotionTest.mock();
promotionTest.testAddDiscount();
promotionActivityManager.delete( null );
promotionActivityManager.delete(new Integer[]{});
promotionActivityManager.delete(new Integer[]{1});
int count = this.jdbcTemplate.queryForInt("select count(0) from js_promotion_activity_2 ");
Assert.assertEquals(count, 0);
//验证规则 已清除
count = this.jdbcTemplate.queryForInt("select count(0) from js_promotion_2");
Assert.assertEquals(count, 0);
//验证关联会员 已清除
count = this.jdbcTemplate.queryForInt("select count(0) from js_pmt_member_lv_2");
Assert.assertEquals(count,0);
//验证关联 商品 已清除
count = this.jdbcTemplate.queryForInt("select count(0) from js_pmt_goods_2");
Assert.assertEquals(count,0);
}
}
| [
"zhoutanxin@hotmail.com"
] | zhoutanxin@hotmail.com |
f209dbe4006535b6490780b748142b6d145d2a9b | 06d76ab89e6cd8cc7d9281b65e0c92bfa3c32af5 | /loc/src/main/java/com/sfmap/api/location/client/bean/AddressBean.java | fc6caca58d806c3a8d4ecd4e7a0abec25921f74e | [] | no_license | onlie08/SFLocationDemo | f7042c598fdb1bd4fe5eeba791df6ae6f779d73e | 7c15f13b1d6335a6dbf20b6ee7cce62bd20c1ca9 | refs/heads/master | 2022-12-15T20:09:31.577510 | 2020-08-25T02:38:57 | 2020-08-25T02:38:57 | 217,438,626 | 1 | 0 | null | 2020-09-17T05:55:44 | 2019-10-25T02:54:37 | Java | UTF-8 | Java | false | false | 1,597 | java | /*
*
*/
package com.sfmap.api.location.client.bean;
import com.google.gson.annotations.SerializedName;
/**
*
* @author joseph
*/
public class AddressBean {
@SerializedName("region")
private String region;
@SerializedName("county")
private String county;
@SerializedName("city")
private String city;
@SerializedName("street")
private String street;
@SerializedName("street_number")
private String street_number;
@SerializedName("country")
private String country;
@SerializedName("adcode")
private int adcode;
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getStreet_number() {
return street_number;
}
public void setStreet_number(String street_number) {
this.street_number = street_number;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public int getAdcode() {
return adcode;
}
public void setAdcode(int adcode) {
this.adcode = adcode;
}
}
| [
"80005202@sf.com"
] | 80005202@sf.com |
5d785c3daa935a19744395e083fc8140e6e44367 | 5e4cdf1349c105ccb220ab44376a413cc4fbf01e | /src/main/java/com/mypal/service/quartz/RollbackJob.java | 43f7a034712a80cb68582ebfe11417d3462dbd4e | [] | no_license | VGlushchenko/TransactionService | 9d0ab217598a82ce180d3432858102bde2fc8ded | 15938787658e78430fb58e4ddbb1f77bf3a37aba | refs/heads/master | 2020-05-30T23:05:58.716981 | 2013-04-20T13:41:33 | 2013-04-20T13:41:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package com.mypal.service.quartz;
import com.mypal.service.TransactionService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class RollbackJob implements Job {
@Autowired
TransactionService transactionService;
public void execute(JobExecutionContext context)
throws JobExecutionException {
System.out.println("1");
transactionService.rollbackUncompletedTransactions();
System.out.println("Complete job");
}
}
| [
"Admin@INFINITI"
] | Admin@INFINITI |
432463e91b49f81356259db2708fc521c16d4e8f | e3162d976b3a665717b9a75c503281e501ec1b1a | /src/main/java/com/alipay/api/response/AlipayPcreditHuabeiAuthOrderUnfreezeResponse.java | 31d66526bb96a3cbfabcc2ac096f2bedd1629d17 | [
"Apache-2.0"
] | permissive | sunandy3/alipay-sdk-java-all | 16b14f3729864d74846585796a28d858c40decf8 | 30e6af80cffc0d2392133457925dc5e9ee44cbac | refs/heads/master | 2020-07-30T14:07:34.040692 | 2019-09-20T09:35:20 | 2019-09-20T09:35:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,595 | java | package com.alipay.api.response;
import java.util.Date;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.pcredit.huabei.auth.order.unfreeze response.
*
* @author auto create
* @since 1.0, 2019-02-20 22:09:56
*/
public class AlipayPcreditHuabeiAuthOrderUnfreezeResponse extends AlipayResponse {
private static final long serialVersionUID = 7375579467367986367L;
/**
* 支付宝系统中用以唯一标识用户签约记录的编号,即花呗先享协议号
*/
@ApiField("agreement_no")
private String agreementNo;
/**
* 协议状态。Y表示状态有效,N表示状态失效
*/
@ApiField("agreement_status")
private String agreementStatus;
/**
* 买家在支付宝的用户id
*/
@ApiField("alipay_user_id")
private String alipayUserId;
/**
* 支付宝侧花呗冻结解冻操作单据id
*/
@ApiField("auth_opt_id")
private String authOptId;
/**
* 解冻成功时间
*/
@ApiField("gmt_trans")
private Date gmtTrans;
/**
* 商户本次操作的请求流水号,用于标识请求流水的唯一性,不能包含除中文、英文、数字以外的字符,需要保证在商户端不重复。由商户传入,最终返回给商户。
*/
@ApiField("out_request_no")
private String outRequestNo;
/**
* 完成本次操作时,用户资金池余额快照。仅作提示用,请勿用于核对,并发情况下数值有可能不准确。两位小数,单位元。
*/
@ApiField("rest_freeze_amount")
private String restFreezeAmount;
/**
* 商户的支付宝用户id
*/
@ApiField("seller_id")
private String sellerId;
/**
* 业务操作状态,Y表示成功;N表示失败。
*/
@ApiField("trans_status")
private String transStatus;
/**
* 解冻金额
*/
@ApiField("unfreeze_amount")
private String unfreezeAmount;
public void setAgreementNo(String agreementNo) {
this.agreementNo = agreementNo;
}
public String getAgreementNo( ) {
return this.agreementNo;
}
public void setAgreementStatus(String agreementStatus) {
this.agreementStatus = agreementStatus;
}
public String getAgreementStatus( ) {
return this.agreementStatus;
}
public void setAlipayUserId(String alipayUserId) {
this.alipayUserId = alipayUserId;
}
public String getAlipayUserId( ) {
return this.alipayUserId;
}
public void setAuthOptId(String authOptId) {
this.authOptId = authOptId;
}
public String getAuthOptId( ) {
return this.authOptId;
}
public void setGmtTrans(Date gmtTrans) {
this.gmtTrans = gmtTrans;
}
public Date getGmtTrans( ) {
return this.gmtTrans;
}
public void setOutRequestNo(String outRequestNo) {
this.outRequestNo = outRequestNo;
}
public String getOutRequestNo( ) {
return this.outRequestNo;
}
public void setRestFreezeAmount(String restFreezeAmount) {
this.restFreezeAmount = restFreezeAmount;
}
public String getRestFreezeAmount( ) {
return this.restFreezeAmount;
}
public void setSellerId(String sellerId) {
this.sellerId = sellerId;
}
public String getSellerId( ) {
return this.sellerId;
}
public void setTransStatus(String transStatus) {
this.transStatus = transStatus;
}
public String getTransStatus( ) {
return this.transStatus;
}
public void setUnfreezeAmount(String unfreezeAmount) {
this.unfreezeAmount = unfreezeAmount;
}
public String getUnfreezeAmount( ) {
return this.unfreezeAmount;
}
}
| [
"ben.zy@antfin.com"
] | ben.zy@antfin.com |
7f532b3c507922431e7af681bc4d7b59569c732b | df79dbcfc869b9d2180a44e34aa1e5ef208d1655 | /hibernate/hybernateutilstudent/src/com/cjc/student/Test1.java | 6368779e645a62e67bd61a81e6243ec9365a7a31 | [] | no_license | paragkhedkar07/TotalProjects | a170e3d5455a046b62709986f3f00a95b49fee70 | 7791da688c121d2422a4f4e52e91256c9b7606e5 | refs/heads/master | 2023-03-14T23:47:43.492749 | 2021-03-27T14:59:08 | 2021-03-27T14:59:08 | 352,097,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package com.cjc.student;
import org.hibernate.Session;
public class Test1
{
public static void main(String[] args) {
Session session=HibernateUtil.getSessionFactory().openSession();
Student stu=session.get(Student.class, 1);
System.out.println(stu);
if(stu!=null)
{
System.out.println(stu.getRollno());
System.out.println(stu.getName());
System.out.println(stu.getAddr());
}
}
}
| [
"paragkhedkar07@gmail.com"
] | paragkhedkar07@gmail.com |
dd4943521167fa686ef824422991442ae654a80f | da8d9a9ba2057004b7fe55ddfc23b0cbf334a701 | /common-mybatis/src/main/java/com/kf/data/mybatis/entity/PdfCodeTemporaryExample.java | 185c9196be9d1644f2c42a89c5a5ed8709d154c7 | [] | no_license | liangyangtao/crawler | 6623a5ef089ac5bd803607b7848ccf7a3da4d6bc | 18e2497aa6262fbcc35162f16385ef535e4da6f3 | refs/heads/master | 2021-09-10T13:53:30.103009 | 2018-03-27T09:31:09 | 2018-03-27T09:31:09 | 111,069,923 | 1 | 3 | null | 2018-03-27T09:31:10 | 2017-11-17T07:04:31 | Java | UTF-8 | Java | false | false | 38,911 | java | package com.kf.data.mybatis.entity;
import java.util.ArrayList;
import java.util.List;
public class PdfCodeTemporaryExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public PdfCodeTemporaryExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andPdfTypeIsNull() {
addCriterion("pdf_type is null");
return (Criteria) this;
}
public Criteria andPdfTypeIsNotNull() {
addCriterion("pdf_type is not null");
return (Criteria) this;
}
public Criteria andPdfTypeEqualTo(String value) {
addCriterion("pdf_type =", value, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeNotEqualTo(String value) {
addCriterion("pdf_type <>", value, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeGreaterThan(String value) {
addCriterion("pdf_type >", value, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeGreaterThanOrEqualTo(String value) {
addCriterion("pdf_type >=", value, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeLessThan(String value) {
addCriterion("pdf_type <", value, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeLessThanOrEqualTo(String value) {
addCriterion("pdf_type <=", value, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeLike(String value) {
addCriterion("pdf_type like", value, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeNotLike(String value) {
addCriterion("pdf_type not like", value, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeIn(List<String> values) {
addCriterion("pdf_type in", values, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeNotIn(List<String> values) {
addCriterion("pdf_type not in", values, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeBetween(String value1, String value2) {
addCriterion("pdf_type between", value1, value2, "pdfType");
return (Criteria) this;
}
public Criteria andPdfTypeNotBetween(String value1, String value2) {
addCriterion("pdf_type not between", value1, value2, "pdfType");
return (Criteria) this;
}
public Criteria andTableNameIsNull() {
addCriterion("`table_name` is null");
return (Criteria) this;
}
public Criteria andTableNameIsNotNull() {
addCriterion("`table_name` is not null");
return (Criteria) this;
}
public Criteria andTableNameEqualTo(String value) {
addCriterion("`table_name` =", value, "tableName");
return (Criteria) this;
}
public Criteria andTableNameNotEqualTo(String value) {
addCriterion("`table_name` <>", value, "tableName");
return (Criteria) this;
}
public Criteria andTableNameGreaterThan(String value) {
addCriterion("`table_name` >", value, "tableName");
return (Criteria) this;
}
public Criteria andTableNameGreaterThanOrEqualTo(String value) {
addCriterion("`table_name` >=", value, "tableName");
return (Criteria) this;
}
public Criteria andTableNameLessThan(String value) {
addCriterion("`table_name` <", value, "tableName");
return (Criteria) this;
}
public Criteria andTableNameLessThanOrEqualTo(String value) {
addCriterion("`table_name` <=", value, "tableName");
return (Criteria) this;
}
public Criteria andTableNameLike(String value) {
addCriterion("`table_name` like", value, "tableName");
return (Criteria) this;
}
public Criteria andTableNameNotLike(String value) {
addCriterion("`table_name` not like", value, "tableName");
return (Criteria) this;
}
public Criteria andTableNameIn(List<String> values) {
addCriterion("`table_name` in", values, "tableName");
return (Criteria) this;
}
public Criteria andTableNameNotIn(List<String> values) {
addCriterion("`table_name` not in", values, "tableName");
return (Criteria) this;
}
public Criteria andTableNameBetween(String value1, String value2) {
addCriterion("`table_name` between", value1, value2, "tableName");
return (Criteria) this;
}
public Criteria andTableNameNotBetween(String value1, String value2) {
addCriterion("`table_name` not between", value1, value2, "tableName");
return (Criteria) this;
}
public Criteria andPropertyIsNull() {
addCriterion("property is null");
return (Criteria) this;
}
public Criteria andPropertyIsNotNull() {
addCriterion("property is not null");
return (Criteria) this;
}
public Criteria andPropertyEqualTo(String value) {
addCriterion("property =", value, "property");
return (Criteria) this;
}
public Criteria andPropertyNotEqualTo(String value) {
addCriterion("property <>", value, "property");
return (Criteria) this;
}
public Criteria andPropertyGreaterThan(String value) {
addCriterion("property >", value, "property");
return (Criteria) this;
}
public Criteria andPropertyGreaterThanOrEqualTo(String value) {
addCriterion("property >=", value, "property");
return (Criteria) this;
}
public Criteria andPropertyLessThan(String value) {
addCriterion("property <", value, "property");
return (Criteria) this;
}
public Criteria andPropertyLessThanOrEqualTo(String value) {
addCriterion("property <=", value, "property");
return (Criteria) this;
}
public Criteria andPropertyLike(String value) {
addCriterion("property like", value, "property");
return (Criteria) this;
}
public Criteria andPropertyNotLike(String value) {
addCriterion("property not like", value, "property");
return (Criteria) this;
}
public Criteria andPropertyIn(List<String> values) {
addCriterion("property in", values, "property");
return (Criteria) this;
}
public Criteria andPropertyNotIn(List<String> values) {
addCriterion("property not in", values, "property");
return (Criteria) this;
}
public Criteria andPropertyBetween(String value1, String value2) {
addCriterion("property between", value1, value2, "property");
return (Criteria) this;
}
public Criteria andPropertyNotBetween(String value1, String value2) {
addCriterion("property not between", value1, value2, "property");
return (Criteria) this;
}
public Criteria andPropertyNameIsNull() {
addCriterion("property_name is null");
return (Criteria) this;
}
public Criteria andPropertyNameIsNotNull() {
addCriterion("property_name is not null");
return (Criteria) this;
}
public Criteria andPropertyNameEqualTo(String value) {
addCriterion("property_name =", value, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameNotEqualTo(String value) {
addCriterion("property_name <>", value, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameGreaterThan(String value) {
addCriterion("property_name >", value, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameGreaterThanOrEqualTo(String value) {
addCriterion("property_name >=", value, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameLessThan(String value) {
addCriterion("property_name <", value, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameLessThanOrEqualTo(String value) {
addCriterion("property_name <=", value, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameLike(String value) {
addCriterion("property_name like", value, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameNotLike(String value) {
addCriterion("property_name not like", value, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameIn(List<String> values) {
addCriterion("property_name in", values, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameNotIn(List<String> values) {
addCriterion("property_name not in", values, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameBetween(String value1, String value2) {
addCriterion("property_name between", value1, value2, "propertyName");
return (Criteria) this;
}
public Criteria andPropertyNameNotBetween(String value1, String value2) {
addCriterion("property_name not between", value1, value2, "propertyName");
return (Criteria) this;
}
public Criteria andBeginPositionIsNull() {
addCriterion("begin_position is null");
return (Criteria) this;
}
public Criteria andBeginPositionIsNotNull() {
addCriterion("begin_position is not null");
return (Criteria) this;
}
public Criteria andBeginPositionEqualTo(String value) {
addCriterion("begin_position =", value, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionNotEqualTo(String value) {
addCriterion("begin_position <>", value, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionGreaterThan(String value) {
addCriterion("begin_position >", value, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionGreaterThanOrEqualTo(String value) {
addCriterion("begin_position >=", value, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionLessThan(String value) {
addCriterion("begin_position <", value, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionLessThanOrEqualTo(String value) {
addCriterion("begin_position <=", value, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionLike(String value) {
addCriterion("begin_position like", value, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionNotLike(String value) {
addCriterion("begin_position not like", value, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionIn(List<String> values) {
addCriterion("begin_position in", values, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionNotIn(List<String> values) {
addCriterion("begin_position not in", values, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionBetween(String value1, String value2) {
addCriterion("begin_position between", value1, value2, "beginPosition");
return (Criteria) this;
}
public Criteria andBeginPositionNotBetween(String value1, String value2) {
addCriterion("begin_position not between", value1, value2, "beginPosition");
return (Criteria) this;
}
public Criteria andEndPositionIsNull() {
addCriterion("end_position is null");
return (Criteria) this;
}
public Criteria andEndPositionIsNotNull() {
addCriterion("end_position is not null");
return (Criteria) this;
}
public Criteria andEndPositionEqualTo(String value) {
addCriterion("end_position =", value, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionNotEqualTo(String value) {
addCriterion("end_position <>", value, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionGreaterThan(String value) {
addCriterion("end_position >", value, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionGreaterThanOrEqualTo(String value) {
addCriterion("end_position >=", value, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionLessThan(String value) {
addCriterion("end_position <", value, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionLessThanOrEqualTo(String value) {
addCriterion("end_position <=", value, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionLike(String value) {
addCriterion("end_position like", value, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionNotLike(String value) {
addCriterion("end_position not like", value, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionIn(List<String> values) {
addCriterion("end_position in", values, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionNotIn(List<String> values) {
addCriterion("end_position not in", values, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionBetween(String value1, String value2) {
addCriterion("end_position between", value1, value2, "endPosition");
return (Criteria) this;
}
public Criteria andEndPositionNotBetween(String value1, String value2) {
addCriterion("end_position not between", value1, value2, "endPosition");
return (Criteria) this;
}
public Criteria andCodeTypeIsNull() {
addCriterion("code_type is null");
return (Criteria) this;
}
public Criteria andCodeTypeIsNotNull() {
addCriterion("code_type is not null");
return (Criteria) this;
}
public Criteria andCodeTypeEqualTo(Integer value) {
addCriterion("code_type =", value, "codeType");
return (Criteria) this;
}
public Criteria andCodeTypeNotEqualTo(Integer value) {
addCriterion("code_type <>", value, "codeType");
return (Criteria) this;
}
public Criteria andCodeTypeGreaterThan(Integer value) {
addCriterion("code_type >", value, "codeType");
return (Criteria) this;
}
public Criteria andCodeTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("code_type >=", value, "codeType");
return (Criteria) this;
}
public Criteria andCodeTypeLessThan(Integer value) {
addCriterion("code_type <", value, "codeType");
return (Criteria) this;
}
public Criteria andCodeTypeLessThanOrEqualTo(Integer value) {
addCriterion("code_type <=", value, "codeType");
return (Criteria) this;
}
public Criteria andCodeTypeIn(List<Integer> values) {
addCriterion("code_type in", values, "codeType");
return (Criteria) this;
}
public Criteria andCodeTypeNotIn(List<Integer> values) {
addCriterion("code_type not in", values, "codeType");
return (Criteria) this;
}
public Criteria andCodeTypeBetween(Integer value1, Integer value2) {
addCriterion("code_type between", value1, value2, "codeType");
return (Criteria) this;
}
public Criteria andCodeTypeNotBetween(Integer value1, Integer value2) {
addCriterion("code_type not between", value1, value2, "codeType");
return (Criteria) this;
}
public Criteria andRankIsNull() {
addCriterion("`rank` is null");
return (Criteria) this;
}
public Criteria andRankIsNotNull() {
addCriterion("`rank` is not null");
return (Criteria) this;
}
public Criteria andRankEqualTo(Integer value) {
addCriterion("`rank` =", value, "rank");
return (Criteria) this;
}
public Criteria andRankNotEqualTo(Integer value) {
addCriterion("`rank` <>", value, "rank");
return (Criteria) this;
}
public Criteria andRankGreaterThan(Integer value) {
addCriterion("`rank` >", value, "rank");
return (Criteria) this;
}
public Criteria andRankGreaterThanOrEqualTo(Integer value) {
addCriterion("`rank` >=", value, "rank");
return (Criteria) this;
}
public Criteria andRankLessThan(Integer value) {
addCriterion("`rank` <", value, "rank");
return (Criteria) this;
}
public Criteria andRankLessThanOrEqualTo(Integer value) {
addCriterion("`rank` <=", value, "rank");
return (Criteria) this;
}
public Criteria andRankIn(List<Integer> values) {
addCriterion("`rank` in", values, "rank");
return (Criteria) this;
}
public Criteria andRankNotIn(List<Integer> values) {
addCriterion("`rank` not in", values, "rank");
return (Criteria) this;
}
public Criteria andRankBetween(Integer value1, Integer value2) {
addCriterion("`rank` between", value1, value2, "rank");
return (Criteria) this;
}
public Criteria andRankNotBetween(Integer value1, Integer value2) {
addCriterion("`rank` not between", value1, value2, "rank");
return (Criteria) this;
}
public Criteria andMd5IsNull() {
addCriterion("md5 is null");
return (Criteria) this;
}
public Criteria andMd5IsNotNull() {
addCriterion("md5 is not null");
return (Criteria) this;
}
public Criteria andMd5EqualTo(String value) {
addCriterion("md5 =", value, "md5");
return (Criteria) this;
}
public Criteria andMd5NotEqualTo(String value) {
addCriterion("md5 <>", value, "md5");
return (Criteria) this;
}
public Criteria andMd5GreaterThan(String value) {
addCriterion("md5 >", value, "md5");
return (Criteria) this;
}
public Criteria andMd5GreaterThanOrEqualTo(String value) {
addCriterion("md5 >=", value, "md5");
return (Criteria) this;
}
public Criteria andMd5LessThan(String value) {
addCriterion("md5 <", value, "md5");
return (Criteria) this;
}
public Criteria andMd5LessThanOrEqualTo(String value) {
addCriterion("md5 <=", value, "md5");
return (Criteria) this;
}
public Criteria andMd5Like(String value) {
addCriterion("md5 like", value, "md5");
return (Criteria) this;
}
public Criteria andMd5NotLike(String value) {
addCriterion("md5 not like", value, "md5");
return (Criteria) this;
}
public Criteria andMd5In(List<String> values) {
addCriterion("md5 in", values, "md5");
return (Criteria) this;
}
public Criteria andMd5NotIn(List<String> values) {
addCriterion("md5 not in", values, "md5");
return (Criteria) this;
}
public Criteria andMd5Between(String value1, String value2) {
addCriterion("md5 between", value1, value2, "md5");
return (Criteria) this;
}
public Criteria andMd5NotBetween(String value1, String value2) {
addCriterion("md5 not between", value1, value2, "md5");
return (Criteria) this;
}
public Criteria andTextLengthIsNull() {
addCriterion("text_length is null");
return (Criteria) this;
}
public Criteria andTextLengthIsNotNull() {
addCriterion("text_length is not null");
return (Criteria) this;
}
public Criteria andTextLengthEqualTo(Integer value) {
addCriterion("text_length =", value, "textLength");
return (Criteria) this;
}
public Criteria andTextLengthNotEqualTo(Integer value) {
addCriterion("text_length <>", value, "textLength");
return (Criteria) this;
}
public Criteria andTextLengthGreaterThan(Integer value) {
addCriterion("text_length >", value, "textLength");
return (Criteria) this;
}
public Criteria andTextLengthGreaterThanOrEqualTo(Integer value) {
addCriterion("text_length >=", value, "textLength");
return (Criteria) this;
}
public Criteria andTextLengthLessThan(Integer value) {
addCriterion("text_length <", value, "textLength");
return (Criteria) this;
}
public Criteria andTextLengthLessThanOrEqualTo(Integer value) {
addCriterion("text_length <=", value, "textLength");
return (Criteria) this;
}
public Criteria andTextLengthIn(List<Integer> values) {
addCriterion("text_length in", values, "textLength");
return (Criteria) this;
}
public Criteria andTextLengthNotIn(List<Integer> values) {
addCriterion("text_length not in", values, "textLength");
return (Criteria) this;
}
public Criteria andTextLengthBetween(Integer value1, Integer value2) {
addCriterion("text_length between", value1, value2, "textLength");
return (Criteria) this;
}
public Criteria andTextLengthNotBetween(Integer value1, Integer value2) {
addCriterion("text_length not between", value1, value2, "textLength");
return (Criteria) this;
}
public Criteria andGroupIdIsNull() {
addCriterion("group_id is null");
return (Criteria) this;
}
public Criteria andGroupIdIsNotNull() {
addCriterion("group_id is not null");
return (Criteria) this;
}
public Criteria andGroupIdEqualTo(Integer value) {
addCriterion("group_id =", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdNotEqualTo(Integer value) {
addCriterion("group_id <>", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdGreaterThan(Integer value) {
addCriterion("group_id >", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdGreaterThanOrEqualTo(Integer value) {
addCriterion("group_id >=", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdLessThan(Integer value) {
addCriterion("group_id <", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdLessThanOrEqualTo(Integer value) {
addCriterion("group_id <=", value, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdIn(List<Integer> values) {
addCriterion("group_id in", values, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdNotIn(List<Integer> values) {
addCriterion("group_id not in", values, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdBetween(Integer value1, Integer value2) {
addCriterion("group_id between", value1, value2, "groupId");
return (Criteria) this;
}
public Criteria andGroupIdNotBetween(Integer value1, Integer value2) {
addCriterion("group_id not between", value1, value2, "groupId");
return (Criteria) this;
}
public Criteria andOrderIdIsNull() {
addCriterion("order_id is null");
return (Criteria) this;
}
public Criteria andOrderIdIsNotNull() {
addCriterion("order_id is not null");
return (Criteria) this;
}
public Criteria andOrderIdEqualTo(Integer value) {
addCriterion("order_id =", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotEqualTo(Integer value) {
addCriterion("order_id <>", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdGreaterThan(Integer value) {
addCriterion("order_id >", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdGreaterThanOrEqualTo(Integer value) {
addCriterion("order_id >=", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLessThan(Integer value) {
addCriterion("order_id <", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdLessThanOrEqualTo(Integer value) {
addCriterion("order_id <=", value, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdIn(List<Integer> values) {
addCriterion("order_id in", values, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotIn(List<Integer> values) {
addCriterion("order_id not in", values, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdBetween(Integer value1, Integer value2) {
addCriterion("order_id between", value1, value2, "orderId");
return (Criteria) this;
}
public Criteria andOrderIdNotBetween(Integer value1, Integer value2) {
addCriterion("order_id not between", value1, value2, "orderId");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table pdf_code_temporary
*
* @mbggenerated do_not_delete_during_merge Mon Sep 18 16:39:19 CST 2017
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table pdf_code_temporary
*
* @mbggenerated Mon Sep 18 16:39:19 CST 2017
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"liangyt@kaifengdata.com"
] | liangyt@kaifengdata.com |
c5311b70ef149792355d4e36e037c8fd88906a24 | fe773bcc5f2fd73d4b5b6c9c073cad8bb14e4ad9 | /src/main/java/com/trucktrans/helpers/MailService.java | 3bc29c087206b1e8a2d67b78eed3dfa21b23d470 | [] | no_license | mayurgupta/DemoWapp | ff8d28c386866c21feac5f2b0d8df6b456e4c246 | 4096bf02f98c7c0545dea28c91937237b3301dc8 | refs/heads/master | 2021-01-21T04:44:37.668163 | 2016-06-10T11:48:34 | 2016-06-10T11:48:34 | 51,855,555 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,077 | java | /**
*
*/
package com.trucktrans.helpers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailException;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.stereotype.Component;
/**
* @author Mayur
* 12:32:45 am, 13-Oct-2015
*
*/
@Component
public class MailService {
@Autowired
private MailSender mailSender;
/**
* {@inheritDoc}
*/
public void sendMail(String to, String subject, String body)
throws MailException {
SimpleMailMessage message = new SimpleMailMessage();
message.setTo(to);
message.setSubject(subject);
message.setText(body);
mailSender.send(message);
}
/**
* {@inheritDoc}
*/
public void sendMail(String[] to, String[] cc, String[] bcc,
String subject, String body) throws MailException {
SimpleMailMessage message = new SimpleMailMessage();
message.setTo(to);
message.setCc(cc);
message.setBcc(bcc);
message.setSubject(subject);
message.setText(body);
mailSender.send(message);
}
}
| [
"mayurguptacs59@gmail.com"
] | mayurguptacs59@gmail.com |
d76b37a895b9363ad343dd18d426daf2c0b769c1 | 68f3dccb32234be3fdf3f56b73a504a65ed2358e | /src/main/java/dao/AbstractDao.java | 0a211919f79d8301ed016ffb0519172a12c6ce3e | [] | no_license | Nakonechnyi/ShopsWithMongoDB | 8027dd0ca1db566302dda2f7523ee174a24d4628 | ff5574afc931fc7de2c426424230ab59120c2504 | refs/heads/master | 2021-01-20T20:32:46.272854 | 2016-06-22T16:09:30 | 2016-06-22T16:09:30 | 60,990,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package dao;
import com.mongodb.*;
import java.net.UnknownHostException;
public class AbstractDao {
private MongoClient connection = null;
private DB db = null;
private static AbstractDao mongoDao = null;
private AbstractDao() throws UnknownHostException {
connection= new MongoClient("localhost" ,27017);
db = connection.getDB("test");
}
public static AbstractDao getInstance() throws UnknownHostException{
if(mongoDao==null){
mongoDao = new AbstractDao();
}
return mongoDao;
}
public void saveToDB(String tableName, BasicDBObject dbObject)throws Exception{
DBCollection dbCollection = db.getCollection(tableName);
dbCollection.insert(dbObject);
}
public void showDB(String tableName)throws Exception{
DBCollection dbCollection = db.getCollection(tableName);
DBCursor cur = dbCollection.find();
while(cur.hasNext()) {
System.out.println(cur.next());
}
}
public DB getDB() throws UnknownHostException {
return AbstractDao.getInstance().db;
}
}
| [
"anton.nak@gmail.com"
] | anton.nak@gmail.com |
9ddbe1787dc663fa368f1f47991c44416d54df98 | fd82d723709240da02f89adc34e6c25777275e7e | /src/main/java/flare/passion/JSONmap/post/NewPost.java | dad01cb0a3f7a3b1b495b6ea9a421aecae325036 | [
"MIT"
] | permissive | Passion-Flare/passionflare-server | f448964e52a8c73d722cc8b23713e8e3baa1c9a6 | 4e56969a4851037f58b4625270112a0abc007835 | refs/heads/main | 2023-06-19T23:05:13.606818 | 2021-07-17T07:06:00 | 2021-07-17T07:06:00 | 386,863,688 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package flare.passion.JSONmap.post;
public class NewPost {
String title;
String content;
int userId;
public String getTitle() {
return title;
}
public String getContent() {
return content;
}
public int getUserId() {
return userId;
}
}
| [
"jerryloi@163.com"
] | jerryloi@163.com |
e5b61d49c73a225da51b8c854e913340064363bd | b560480aa26992570b7f08565216903035c826e2 | /src/main/java/br/uff/compiladores/lexica/StopWordsRemover.java | ed4c0db435be2e7d8b5bb20019e4f493ca4bfec2 | [] | no_license | FlavioCruz/compiladores | e00c8eb448f379dd97fdeb85f0e3bdb510716d6c | dfc5844fb0778fc77e9f0894547e9a552270ecb7 | refs/heads/master | 2020-08-28T08:11:02.527883 | 2019-11-05T00:41:15 | 2019-11-05T00:41:15 | 217,646,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,428 | java | package br.uff.compiladores.lexica;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class StopWordsRemover {
public Map<Integer, String> remove(List<String> code){
return createMap(
code
.stream()
.map(this::removeCommentsAndBlankSpaces)
.map(this::removeTabs)
.collect(Collectors.toList())
);
}
private String removeTabs(String x){
return x.replaceAll("\\t", "");
}
private String removeCommentsAndBlankSpaces(String x){
System.out.println("Comments and blank spaces\n\n");
System.out.println(x);
System.out.println("\n\n");
x = Stream.of(x).filter(y ->
!(
y.equals(" ") ||
y.equals("\\n") ||
y.matches("//(.)*") ||
y.matches("/*(.)*\\*/")
)
).collect(Collectors.joining());
System.out.println("Printing list after\n\n");
System.out.println(x);
return x;
}
private Map<Integer, String> createMap(List<String> list){
Map<Integer, String> map = new HashMap<>();
for(int i = 1; i <= list.size(); i++){
map.put(i, list.get(i - 1));
}
return map;
}
}
| [
"flaviocruz@id.uff.br"
] | flaviocruz@id.uff.br |
3f7f17e3dc2b554d280a439b357d638e89f4da3e | 7953626e89dd9cccd479c48cb3e62ed51916f31e | /MyMobApplication3/app/src/main/java/com/example/mymobapplication3/DbContext.java | 1a388bd70f9b583dbd566be89db6a4e1feb13d8c | [] | no_license | katenovakivska/MobLabs | 594baf8f50823b7c5c19c02a0106d03be20700db | 621b646f80f21cfc40e2960999e951e48008ef60 | refs/heads/master | 2021-03-18T23:03:38.057237 | 2020-06-10T10:24:11 | 2020-06-10T10:24:11 | 247,108,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,047 | java | package com.example.mymobapplication3;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
public class DbContext extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "app";
public static final String TABLE_NAME = "history";
public static final String KEY_ID = "id";
public static final String KEY_DATE = "date";
public static final String KEY_RESULT = "result";
public DbContext(@Nullable Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table " + TABLE_NAME + " ("
+ KEY_ID + " integer primary key, "
+ KEY_DATE + " text, "
+ KEY_RESULT + " text)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
| [
"kate.nova14@gmail.com"
] | kate.nova14@gmail.com |
62365c38d2cf61e7b9900ac89b154cefc84f5479 | 1438cd5f6b6d89227a85af8318b45d214f1740e8 | /src/main/java/pl/art/lach/mateusz/javaopenchess/core/pieces/implementation/King.java | 36c6085ac3595b38fb6f340d3f909d17c246ba3d | [
"MIT"
] | permissive | AmrishJhaveri/Virtual-Appliance-Unikernel_OS-Containers-AWS | 56a18fb8fae31cef9edfdd4f391f1624e3c22dc1 | 962b28e091391e6f1f3ee03b324306c91303281b | refs/heads/master | 2020-05-03T18:11:29.110720 | 2019-04-02T05:53:24 | 2019-04-02T05:53:24 | 178,757,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,614 | java | /*
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package pl.art.lach.mateusz.javaopenchess.core.pieces.implementation;
/**
* @author: Mateusz Slawomir Lach ( matlak, msl )
* Class to represent a chess pawn king. King is the
* most important piece for the game. Loose of king is the and of game. When
* king is in danger by the opponent then it's a Checked, and when have no other
* escape then stay on a square "in danger" by the opponent then it's a
* CheckedMate, and the game is over.
*/
import pl.art.lach.mateusz.javaopenchess.core.Chessboard;
import pl.art.lach.mateusz.javaopenchess.core.Square;
import pl.art.lach.mateusz.javaopenchess.core.moves.Castling;
import pl.art.lach.mateusz.javaopenchess.core.pieces.KingState;
import pl.art.lach.mateusz.javaopenchess.core.pieces.Piece;
import pl.art.lach.mateusz.javaopenchess.core.pieces.traits.behaviors.implementation.KingBehavior;
import pl.art.lach.mateusz.javaopenchess.core.players.Player;
public class King extends Piece
{
protected boolean wasMotioned = false;
public King(Chessboard chessboard, Player player)
{
super(chessboard, player);
this.value = 99;
this.symbol = "K";
this.addBehavior(new KingBehavior(this));
}
/**
* Method to check is the king is checked
*
* @return bool true if king is not save, else returns false
*/
public boolean isChecked()
{
return !isSafe(this.square);
}
/**
* Method to check is the king is checked or stalemated
*
* @return state which represents current situation
*/
public KingState getKingState()
{
if (this.getAllMoves().isEmpty())
{
if (otherPiecesCanMove())
{
return KingState.FINE;
}
else
{
if (this.isChecked())
{
return KingState.CHECKMATED;
}
else
{
return KingState.STEALMATED;
}
}
}
return KingState.FINE;
}
private boolean otherPiecesCanMove()
{
for (int i = Chessboard.FIRST_SQUARE; i <= Chessboard.LAST_SQUARE; ++i)
{
for (int j = Chessboard.FIRST_SQUARE; j <= Chessboard.LAST_SQUARE; ++j)
{
Piece piece = getChessboard().getSquare(i, j).getPiece();
if (null != piece && piece.getPlayer() == this.getPlayer()
&& !piece.getAllMoves().isEmpty())
{
return true;
}
}
}
return false;
}
/**
* Method to check is the king is checked by an opponent
*
* @return bool true if king is save, else returns false
*/
public boolean isSafe()
{
return isSafe(getSquare());
}
/**
* Method to check is the king is checked by an opponent
*
* @param kingSquare Squere where is a king
* @return bool true if king is save, else returns false
*/
public boolean isSafe(Square kingSquare)
{
Square[][] squares = chessboard.getSquares();
for (int i = 0; i < squares.length; i++)
{
for (int j = 0; j < squares[i].length; j++)
{
Square pieceSquare = squares[i][j];
if (canPieceBeDangerToKing(pieceSquare, kingSquare))
{
return false;
}
}
}
return true;
}
private boolean canPieceBeDangerToKing(Square pieceSquare, Square kingSquare)
{
Piece piece = pieceSquare.getPiece();
if (piece != null)
{
if (piece.getPlayer().getColor() != this.getPlayer().getColor()
&& piece != this)
{
if (piece.getSquaresInRange().contains(kingSquare))
{
return true;
}
}
}
return false;
}
/**
* Method to check will the king be safe when move
*
* @param currentSquare currentSquare object
* @param futureSquare futureSquare object
* @return bool true if king is save, else returns false
*/
public boolean willBeSafeAfterMove(Square currentSquare, Square futureSquare)
{
if (null == currentSquare || null == futureSquare)
{
return false;
}
Piece tmp = futureSquare.piece;
futureSquare.piece = currentSquare.piece; // move without redraw
currentSquare.piece = null;
boolean ret;
if (futureSquare.getPiece().getClass() == King.class)
{
ret = isSafe(futureSquare);
}
else
{
ret = isSafe();
}
currentSquare.piece = futureSquare.piece;
futureSquare.piece = tmp;
return ret;
}
/**
* Method to check will the king be safe when move
*
* @param futureSquare futureSquare object
* @return bool true if king is save, else returns false
*/
public boolean willBeSafeAfterMove(Square futureSquare)
{
return willBeSafeAfterMove(this.getSquare(), futureSquare);
}
/**
* @return the wasMotion
*/
public boolean getWasMotioned()
{
return wasMotioned;
}
/**
* @param wasMotioned the wasMotion to set
*/
public void setWasMotioned(boolean wasMotioned)
{
this.wasMotioned = wasMotioned;
}
public static Castling getCastling(Square begin, Square end)
{
Castling result = Castling.NONE;
if (begin.getPozX() + 2 == end.getPozX())
{
result = Castling.SHORT_CASTLING;
}
else
{
if (begin.getPozX() - 2 == end.getPozX())
{
result = Castling.LONG_CASTLING;
}
}
return result;
}
}
| [
"ajhave5@uic.edu"
] | ajhave5@uic.edu |
e0bcea8c2977c1886611295c510510f1c5d27c3a | f6b90fae50ea0cd37c457994efadbd5560a5d663 | /android/nut-dex2jar.src/rx/schedulers/t.java | af4cc2d1724fbf2a06dbdd2764c4b6bc1c0d2a1c | [] | no_license | dykdykdyk/decompileTools | 5925ae91f588fefa7c703925e4629c782174cd68 | 4de5c1a23f931008fa82b85046f733c1439f06cf | refs/heads/master | 2020-01-27T09:56:48.099821 | 2016-09-14T02:47:11 | 2016-09-14T02:47:11 | 66,894,502 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package rx.schedulers;
import java.util.concurrent.PriorityBlockingQueue;
import rx.b.a;
final class t
implements a
{
t(s params, u paramu)
{
}
public final void call()
{
this.b.b.remove(this.a);
}
}
/* Location: C:\crazyd\work\ustone\odm2016031702\baidu\android\nut-dex2jar.jar
* Qualified Name: rx.schedulers.t
* JD-Core Version: 0.6.2
*/ | [
"819468107@qq.com"
] | 819468107@qq.com |
548017d81a3599d6df34edf8b25d0de8d6307be2 | 7e275e093afdb55a7118477e1415b3c120f7db58 | /src/day52/book/Book.java | 3dece721cf98f56b61545253c9736d5f5924fa55 | [] | no_license | SCybertek/JavaProgrammingB15Online | fa9d04014fb42f003e7e2feb3c6518eb512f2e2d | 453b445ba2226c50ced6b6259286ec6db9d3ff80 | refs/heads/master | 2020-12-07T12:12:43.669212 | 2020-04-12T06:13:17 | 2020-04-12T06:13:17 | 232,718,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package day52.book;
public abstract class Book implements KnowledgeBank {
//our idea:
//Book is a n abstract idea : String name, author
//concrete idea - papar book and audio book
//attributes: paperBook - int weight
// audio : double duration
String name;
String author;
//display book info : let it be an abstract method.. so , it will be a job of concrete class!!
public abstract void displayBookInfo();
//add constructor to set the field
public Book(String name, String author) {
this.author = author;
this.name = name;
}
//we will be printing in sub class..so no need to create
//toString in super class
//public abstract void takeNotes () ; from interface
} | [
"snuryyeva@gmail.com"
] | snuryyeva@gmail.com |
c43eb88978e03c53d1f5d8ff8ab8390f7b7620ef | e1863ee623c73aebafa97a0b50e994190a0966b5 | /system/src/main/java/com/lxc/system/feign/api/LoginService.java | dfa0cc3c8c738871462290bb7839ae1cd8699281 | [
"Apache-2.0"
] | permissive | liuxianchun/weshare-SpringCloud | 62fe5952883d69c49451345879870a90038e7bbe | 3cadd94d6e1995b658652aabab3fd5e448245b61 | refs/heads/main | 2023-08-01T01:11:32.970616 | 2021-09-25T11:26:23 | 2021-09-25T11:26:23 | 410,217,137 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,170 | java | package com.lxc.system.feign.api;
import com.lxc.common.entity.ResultBean;
import com.lxc.common.entity.user.User;
import com.lxc.system.feign.fallback.LoginServiceImpl;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
/**
* @author liuxianchun
* @date 2021/5/23
* 正常调用微服务,参数必须加@RequestParam,异常时调用Impl方法.
* Feign里不用传递HttpServletResponse和HttpServletRequest.产者接口参数有HttpServletResponse
* 和HttpServletRequest就行,也不会是空的.不能写回HttpServletResponse
* */
@Service
@FeignClient(value = "user-service",contextId = "login",fallback = LoginServiceImpl.class)
public interface LoginService {
@ApiOperation("查询账号是否存在")
@GetMapping(value = "/login/findAccount")
public ResultBean findAccount(@RequestParam("account") String account);
@ApiOperation("查询用户名是否存在")
@GetMapping(value = "/login/findUserName")
public ResultBean findUserName(@RequestParam("username") String username);
@ApiOperation("用户退出登录")
@DeleteMapping(value = "/login/userLogout")
public ResultBean userLogout(@RequestParam("token") String token);
@ApiOperation("查询用户是否登录")
@GetMapping("/login/isLogin")
public ResultBean isLogin(@RequestParam("token") String token);
@ApiOperation("用户登录")
@PostMapping(value = "/login/userLogin")
public ResultBean userLogin(@RequestParam("loginCode") String loginCode, @RequestBody User user);
@ApiOperation("用户注册")
@PostMapping(value = "/login/userRegister")
public ResultBean userRegister(@RequestBody User user);
@ApiOperation("获取验证码(RPC)")
@GetMapping(value = "/login/getVerifyCodeRPC")
public ResponseEntity<byte[]> getVerifyCode();
@ApiOperation("获取邮箱注册验证码")
@GetMapping(value = "/login/getMailCode")
public ResultBean getMailCode(@RequestParam("account") String account);
}
| [
"liuxianchun"
] | liuxianchun |
3503ae8a5c5bf26342980c92a6c15315a1675f28 | 39e32f672b6ef972ebf36adcb6a0ca899f49a094 | /dcm4jboss-all/tags/dcm4jboss_0_8_5/dcm4jboss-ejb/src/java/org/dcm4chex/archive/ejb/interfaces/StudyDTO.java | 7c135bbef60d374d19b6d2da08e844236f6b8f6c | [
"Apache-2.0"
] | permissive | medicayun/medicayundicom | 6a5812254e1baf88ad3786d1b4cf544821d4ca0b | 47827007f2b3e424a1c47863bcf7d4781e15e814 | refs/heads/master | 2021-01-23T11:20:41.530293 | 2017-06-05T03:11:47 | 2017-06-05T03:11:47 | 93,123,541 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,058 | java | /* $Id: StudyDTO.java 1094 2004-04-26 21:45:20Z gunterze $
* Copyright (c) 2002,2003 by TIANI MEDGRAPH AG
*
* This file is part of dcm4che.
*
* 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 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.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.dcm4chex.archive.ejb.interfaces;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author gunter.zeilinger@tiani.com
* @version $Revision: 1094 $ $Date: 2004-04-27 05:45:20 +0800 (周二, 27 4月 2004) $
* @since 14.01.2004
*/
public class StudyDTO implements Serializable {
public static final String DATETIME_FORMAT = "yyyy/MM/dd hh:mm";
private int pk;
private String accessionNumber;
private String studyID;
private String studyIUID;
private String studyDateTime;
private String studyDescription;
private String modalitiesInStudy;
private String referringPhysician;
private int numberOfSeries;
private int numberOfInstances;
private String retrieveAETs;
private int availability;
private List series = new ArrayList();
/**
* @return
*/
public final String getAccessionNumber() {
return accessionNumber;
}
/**
* @param accessionNumber
*/
public final void setAccessionNumber(String accessionNumber) {
this.accessionNumber = accessionNumber;
}
/**
* @return
*/
public final String getModalitiesInStudy() {
return modalitiesInStudy;
}
/**
* @param modalitiesInStudy
*/
public final void setModalitiesInStudy(String modalitiesInStudy) {
this.modalitiesInStudy = modalitiesInStudy;
}
/**
* @return
*/
public final int getPk() {
return pk;
}
/**
* @param pk
*/
public final void setPk(int pk) {
this.pk = pk;
}
/**
* @return
*/
public final List getSeries() {
return series;
}
/**
* @param series
*/
public final void setSeries(List series) {
this.series = series;
}
/**
* @return
*/
public final String getStudyDateTime() {
return studyDateTime;
}
/**
* @param studyDateTime
*/
public final void setStudyDateTime(String studyDateTime) {
this.studyDateTime = studyDateTime;
}
/**
* @return
*/
public final String getStudyDescription() {
return studyDescription;
}
/**
* @param studyDescription
*/
public final void setStudyDescription(String studyDescription) {
this.studyDescription = studyDescription;
}
/**
* @return
*/
public final String getStudyID() {
return studyID;
}
/**
* @param studyID
*/
public final void setStudyID(String studyID) {
this.studyID = studyID;
}
/**
* @return
*/
public final String getStudyIUID() {
return studyIUID;
}
/**
* @param studyIUID
*/
public final void setStudyIUID(String studyIUID) {
this.studyIUID = studyIUID;
}
/**
* @return
*/
public final int getNumberOfInstances() {
return numberOfInstances;
}
/**
* @param numberOfInstances
*/
public final void setNumberOfInstances(int numberOfInstances) {
this.numberOfInstances = numberOfInstances;
}
/**
* @return
*/
public final int getNumberOfSeries() {
return numberOfSeries;
}
/**
* @param numberOfSeries
*/
public final void setNumberOfSeries(int numberOfSeries) {
this.numberOfSeries = numberOfSeries;
}
/**
* @return
*/
public String getRetrieveAETs() {
return retrieveAETs;
}
/**
* @param retrieveAETs
*/
public void setRetrieveAETs(String retrieveAETs) {
this.retrieveAETs = retrieveAETs;
}
/**
* @return
*/
public final int getAvailability() {
return availability;
}
/**
* @param availability
*/
public final void setAvailability(int availability) {
this.availability = availability;
}
public final String getReferringPhysician() {
return referringPhysician;
}
public final void setReferringPhysician(String referringPhysician) {
this.referringPhysician = referringPhysician;
}
}
| [
"liliang_lz@icloud.com"
] | liliang_lz@icloud.com |
aa5e66f45b29c3b3de57a628b798a8e63773fa22 | fae83a7a4b1f0e4bc3e28b8aaef5ca8998918183 | /src/org/daisy/util/fileset/manipulation/FilesetManipulator.java | 266ecf7daddf831e895933312503ea47a8cb268a | [] | no_license | techmilano/pipeline1 | 2bd3c64edf9773c868bbe23123b80b2302212ca5 | f4b7c92ef9d84bf9caeebc4e17870059d044d83c | refs/heads/master | 2020-04-10T14:27:46.762074 | 2018-03-09T14:35:31 | 2018-03-13T13:48:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,552 | java | /*
* org.daisy.util (C) 2005-2008 Daisy Consortium
*
* 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.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.daisy.util.fileset.manipulation;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.daisy.util.file.Directory;
import org.daisy.util.file.FileUtils;
import org.daisy.util.fileset.Fileset;
import org.daisy.util.fileset.FilesetErrorHandler;
import org.daisy.util.fileset.FilesetFile;
import org.daisy.util.fileset.exception.FilesetFileException;
import org.daisy.util.fileset.impl.FilesetImpl;
import org.daisy.util.fileset.manipulation.manipulators.UnalteringCopier;
/**
* <p>The centre class of the fileset manipulation package.</p>
* <p>This class handles i/o operations, listener exposure and filtering.</p>
* @author Markus Gylling
*/
public class FilesetManipulator implements FilesetErrorHandler {
protected Fileset inputFileset = null;
protected List<Class<?>> typeRestrictions = null;
protected Directory outFolder = null;
protected FilesetManipulatorListener listener = null;
private Directory inputBaseDir = null; //the parent folder of input manifest file
private boolean allowDestinationOverwrite = true;
/**
* Default constructor.
* @see #FilesetManipulator(boolean)
*/
public FilesetManipulator() {
}
/**
* Extended constructor.
* @param overwriteDestinations
* whether this manipulator should allow existing destination files
* to be overwritten. If this is not allowed and a destination exists, an exception will be thrown.
* Default value (by using parameterless constructor) is true (overwrite allowed).
*/
public FilesetManipulator(boolean overwriteDestinations) {
this.allowDestinationOverwrite = overwriteDestinations;
}
/**
* Set the org.daisy.util.fileset instance that
* represents the Fileset to be modified
@see #setInputFileset(URI)
*/
public void setInputFileset(Fileset fileset) throws FilesetManipulationException {
this.inputFileset = fileset;
try {
this.inputBaseDir = new Directory(this.inputFileset.getManifestMember().getFile().getParentFile());
} catch (IOException e) {
throw new FilesetManipulationException(e.getMessage(),e);
}
}
/**
* Set the URI to the manifest member of the fileset to be modified
* @see #setInputFileset(Fileset)
*/
public void setInputFileset(URI manifest) throws FilesetManipulationException {
try {
this.inputFileset = new FilesetImpl(manifest,this,false,false);
this.inputBaseDir = new Directory(this.inputFileset.getManifestMember().getFile().getParentFile());
} catch (Exception e) {
throw new FilesetManipulationException(e.getMessage(),e);
}
}
/**
* Set the destination of the manipulated Fileset
*/
public void setOutputFolder(Directory folder) throws IOException {
FileUtils.createDirectory(folder);
this.outFolder = folder;
}
/**
* Get the destination of the manipulated Fileset, null if not set
*/
public Directory getOutputFolder() {
return this.outFolder;
}
/**
* Get the org.daisy.util.fileset instance that
* represents the fileset to be modified
* @return a Fileset instance or null
*/
public Fileset getInputFileset() {
return this.inputFileset;
}
/**
* Apply a restriction on which types to expose to listener for manipulation.
* @param filesetFileInterfaces a List of FilesetFile subclass interface Class objects.
* <p>At #iterate, any match in the restriction list will result in a call to the #nextFile method on a registered listener.</p>
* <p>At #iterate, any nonmatch in the restriction list will result in the file being copied to destination dir unaltered without notifying
* the listener.</p>
* <p>If this property is not set on the instance, no exclusions are made. This is
* the same as calling this method with a list containing a FilesetFile Class entry.</p>
*/
public void setTypeRestriction(List<Class<?>> filesetFileInterfaces) {
if(this.typeRestrictions == null) this.typeRestrictions = new ArrayList<Class<?>>();
this.typeRestrictions.addAll(filesetFileInterfaces);
}
/**
* Apply a restriction on which types to expose to listener for manipulation.
* @param filesetFileInterface a FilesetFile subclass interface Class object.
* <p>At #iterate, any match in the restriction list will result in a call to the #nextFile method on a registered listener.</p>
* <p>At #iterate, any nonmatch in the restriction list will result in the file being copied to destination dir unaltered without notifying
* the listener.</p>
* <p>If this property is not set on the instance, no exclusions are made. This is
* the same as calling this method with a list containing a FilesetFile entry.</p>
*/
public void setFileTypeRestriction(Class<?> filesetFileInterface) {
if(this.typeRestrictions == null) this.typeRestrictions = new ArrayList<Class<?>>();
this.typeRestrictions.add(filesetFileInterface);
}
/**
* Empties the type restriction list
*/
public void clearTypeRestriction() {
if(this.typeRestrictions != null) this.typeRestrictions.clear();
}
/**
* Start the manipulation process. This will push #nextFile method calls to
* the registered FilesetManipulatorListener.
* @throws FilesetManipulationException
*/
public boolean iterate() throws FilesetManipulationException {
if(this.listener != null) {
if(this.inputFileset != null && (this.outFolder!=null && this.outFolder.exists())) {
try{
FilesetFileManipulator copier = new UnalteringCopier(); //for all silent moves
for (Iterator<FilesetFile> iter = this.inputFileset.getLocalMembers().iterator(); iter.hasNext();) {
FilesetFile file = iter.next();
if(this.isTypeEnabled(file)) {
//notify listener, get action impl back
FilesetFileManipulator ffm = listener.nextFile(file);
if(null!=ffm) {
ffm.manipulate(file, getDestination(file),allowDestinationOverwrite);
}else{
//copy over unaltered
copier.manipulate(file,getDestination(file),allowDestinationOverwrite);
}
} else{//if(this.isTypeEnabled(file))
//copy over unaltered
copier.manipulate(file,getDestination(file),allowDestinationOverwrite);
}//if(this.isTypeEnabled(file))
} //for iter
}catch (Exception e) {
throw new FilesetManipulationException(e.getMessage(),e);
}
}else{ //this.inputFileset != null
throw new FilesetManipulationException("input or output is null");
}//this.inputFileset != null
}else{ //this.inputFileset != null
throw new FilesetManipulationException("manipulator listener is null");
}//this.listener != null
return true;
}
/**
* the incoming file is a member of input Fileset
* determine where in outFolder it should be located
* return a file describing the location
*/
private File getDestination(FilesetFile file) throws IOException {
if(inputBaseDir!=null) {
if(file.getFile().getParentFile().getCanonicalPath().equals(inputBaseDir.getCanonicalPath())) {
//file is in same dir as manifestfile
return new File(this.outFolder, file.getName());
}
//file is in subdir
URI relative = inputBaseDir.toURI().relativize(file.getFile().getParentFile().toURI());
if(relative.toString().startsWith("..")) throw new IOException("fileset member "+file.getName()+" does not live in a sibling or descendant folder of manifest member");
Directory subdir = new Directory(this.outFolder,relative.getPath());
FileUtils.createDirectory(subdir);
return new File(subdir, file.getName());
}
throw new IOException("inputBaseDir is null");
}
/**
* @return true if inparam file is enabled for manipulation
* (depends on setTypeRestriction)
*/
protected boolean isTypeEnabled(FilesetFile file) {
//if no restriction set, always true
if(this.typeRestrictions==null)return true;
//cast to see if inparam file is related to a member
//of the restriction list
for (int i = 0; i < typeRestrictions.size(); i++) {
try{
Class<?> test = typeRestrictions.get(i);
test.cast(file);
return true; //we didnt get an exception...
}catch (Exception e) {
//just continue the loop
}
}
return false;
}
/**
* Set the FilesetManipulatorListener.
*/
public void setListener(FilesetManipulatorListener listener) {
this.listener = listener;
}
/**
* Get the FilesetManipulatorListener.
*/
public FilesetManipulatorListener getListener() {
return this.listener;
}
public void error(FilesetFileException ffe) throws FilesetFileException {
// this method when the setInputFileset(URI is used)
//just pass on to listener who extends the same interface
this.listener.error(ffe);
}
}
| [
"markus.gylling@gmail.com"
] | markus.gylling@gmail.com |
4aa0a3d83b73a4e2dd867d25bfe213f819f7a543 | a7158b46ce38c0c9995043571c7fbcfac8506b10 | /jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java | 898734125b8f6f7d0193108327fd8aa389c68fba | [] | no_license | bulejava/jetty-debug | 420d3cbf37ada85583cae2157cbd0be12eb2a868 | 70db284074d0ee3aeed4367247dc180d6905e3b5 | refs/heads/master | 2020-12-30T13:45:52.841238 | 2017-05-14T14:12:41 | 2017-05-14T14:12:41 | 91,247,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,193 | java | //
// ========================================================================
// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.websocket.api;
import java.net.HttpCookie;
import java.net.URI;
import java.security.Principal;
import java.util.List;
import java.util.Map;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
/**
* The HTTP Upgrade to WebSocket Request
*/
public interface UpgradeRequest
{
/**
* Add WebSocket Extension Configuration(s) to Upgrade Request.
* <p>
* This is merely the list of requested Extensions to use, see {@link UpgradeResponse#getExtensions()} for what was
* negotiated
*
* @param configs the configuration(s) to add
*/
void addExtensions(ExtensionConfig... configs);
/**
* Add WebSocket Extension Configuration(s) to request
* <p>
* This is merely the list of requested Extensions to use, see {@link UpgradeResponse#getExtensions()} for what was
* negotiated
*
* @param configs the configuration(s) to add
*/
void addExtensions(String... configs);
/**
* Remove all headers from request.
* @deprecated (no longer supported, as this can undo the required upgrade request headers)
*/
@Deprecated
void clearHeaders();
/**
* Get the list of Cookies on the Upgrade request
*
* @return the list of Cookies
*/
List<HttpCookie> getCookies();
/**
* Get the list of WebSocket Extension Configurations for this Upgrade Request.
* <p>
* This is merely the list of requested Extensions to use, see {@link UpgradeResponse#getExtensions()} for what was
* negotiated
*
* @return the list of Extension configurations (in the order they were specified)
*/
List<ExtensionConfig> getExtensions();
/**
* Get a specific Header value from Upgrade Request
*
* @param name the name of the header
* @return the value of the header (null if header does not exist)
*/
String getHeader(String name);
/**
* Get the specific Header value, as an <code>int</code>, from the Upgrade Request.
*
* @param name the name of the header
* @return the value of the header as an <code>int</code> (-1 if header does not exist)
* @throws NumberFormatException if unable to parse value as an int.
*/
int getHeaderInt(String name);
/**
* Get the headers as a Map of keys to value lists.
*
* @return the headers
*/
Map<String, List<String>> getHeaders();
/**
* Get the specific header values (for multi-value headers)
*
* @param name the header name
* @return the value list (null if no header exists)
*/
List<String> getHeaders(String name);
/**
* The host of the Upgrade Request URI
*
* @return host of the request URI
*/
String getHost();
/**
* The HTTP version used for this Upgrade Request
* <p>
* As of <a href="http://tools.ietf.org/html/rfc6455">RFC6455 (December 2011)</a> this is always
* <code>HTTP/1.1</code>
*
* @return the HTTP Version used
*/
String getHttpVersion();
/**
* The HTTP method for this Upgrade Request.
* <p>
* As of <a href="http://tools.ietf.org/html/rfc6455">RFC6455 (December 2011)</a> this is always <code>GET</code>
*
* @return the HTTP method used
*/
String getMethod();
/**
* The WebSocket Origin of this Upgrade Request
* <p>
* See <a href="http://tools.ietf.org/html/rfc6455#section-10.2">RFC6455: Section 10.2</a> for details.
* <p>
* Equivalent to {@link #getHeader(String)} passed the "Origin" header.
*
* @return the Origin header
*/
String getOrigin();
/**
* Returns a map of the query parameters of the request.
*
* @return a unmodifiable map of query parameters of the request.
*/
Map<String, List<String>> getParameterMap();
/**
* Get the WebSocket Protocol Version
* <p>
* As of <a href="http://tools.ietf.org/html/rfc6455#section-11.6">RFC6455</a>, Jetty only supports version
* <code>13</code>
*
* @return the WebSocket protocol version
*/
String getProtocolVersion();
/**
* Get the Query String of the request URI.
*
* @return the request uri query string
*/
String getQueryString();
/**
* Get the Request URI
*
* @return the request URI
*/
URI getRequestURI();
/**
* Access the Servlet HTTP Session (if present)
* <p>
* Note: Never present on a Client UpgradeRequest.
*
* @return the Servlet HTTPSession on server side UpgradeRequests
*/
Object getSession();
/**
* Get the list of offered WebSocket sub-protocols.
*
* @return the list of offered sub-protocols
*/
List<String> getSubProtocols();
/**
* Get the User Principal for this request.
* <p>
* Only applicable when using UpgradeRequest from server side.
*
* @return the user principal
*/
Principal getUserPrincipal();
/**
* Test if a specific sub-protocol is offered
*
* @param test the sub-protocol to test for
* @return true if sub-protocol exists on request
*/
boolean hasSubProtocol(String test);
/**
* Test if supplied Origin is the same as the Request
*
* @param test the supplied origin
* @return true if the supplied origin matches the request origin
*/
boolean isOrigin(String test);
/**
* Test if connection is secure.
*
* @return true if connection is secure.
*/
boolean isSecure();
/**
* Set the list of Cookies on the request
*
* @param cookies the cookies to use
*/
void setCookies(List<HttpCookie> cookies);
/**
* Set the list of WebSocket Extension configurations on the request.
* @param configs the list of extension configurations
*/
void setExtensions(List<ExtensionConfig> configs);
/**
* Set a specific header with multi-value field
* <p>
* Overrides any previous value for this named header
*
* @param name the name of the header
* @param values the multi-value field
*/
void setHeader(String name, List<String> values);
/**
* Set a specific header value
* <p>
* Overrides any previous value for this named header
*
* @param name the header to set
* @param value the value to set it to
*/
void setHeader(String name, String value);
/**
* Sets multiple headers on the request.
* <p>
* Only sets those headers provided, does not remove
* headers that exist on request and are not provided in the
* parameter for this method.
* <p>
* Convenience method vs calling {@link #setHeader(String, List)} multiple times.
*
* @param headers the headers to set
*/
void setHeaders(Map<String, List<String>> headers);
/**
* Set the HTTP Version to use.
* <p>
* As of <a href="http://tools.ietf.org/html/rfc6455">RFC6455 (December 2011)</a> this should always be
* <code>HTTP/1.1</code>
*
* @param httpVersion the HTTP version to use.
*/
void setHttpVersion(String httpVersion);
/**
* Set the HTTP method to use.
* <p>
* As of <a href="http://tools.ietf.org/html/rfc6455">RFC6455 (December 2011)</a> this is always <code>GET</code>
*
* @param method the HTTP method to use.
*/
void setMethod(String method);
/**
* Set the Request URI to use for this request.
* <p>
* Must be an absolute URI with scheme <code>'ws'</code> or <code>'wss'</code>
*
* @param uri the Request URI
*/
void setRequestURI(URI uri);
/**
* Set the Session associated with this request.
* <p>
* Typically used to associate the Servlet HttpSession object.
*
* @param session the session object to associate with this request
*/
void setSession(Object session);
/**
* Set the offered WebSocket Sub-Protocol list.
*
* @param protocols the offered sub-protocol list
*/
void setSubProtocols(List<String> protocols);
/**
* Set the offered WebSocket Sub-Protocol list.
*
* @param protocols the offered sub-protocol list
*/
void setSubProtocols(String... protocols);
}
| [
"bulejava@126.com"
] | bulejava@126.com |
99b5583843591960923f19a31638ec572bf72991 | 5fdb8a758ccd67afb70d67acefb21f87426051f7 | /src/main/java/edu/harvard/seas/pl/formulog/validating/ast/SimplePredicate.java | 2611ea6e82827129ff187bc7464cd8937c7b403f | [
"Apache-2.0"
] | permissive | ktrianta/formulog | 916f79aaf995477ce1599aab3feeb5720b9adfa0 | cffbdba9f4fbf4758a59c20451bdea823b464a19 | refs/heads/master | 2023-02-26T20:37:14.886739 | 2021-01-04T23:07:32 | 2021-01-04T23:07:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,236 | java | package edu.harvard.seas.pl.formulog.validating.ast;
/*-
* #%L
* Formulog
* %%
* Copyright (C) 2018 - 2020 President and Fellows of Harvard College
* %%
* 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.
* #L%
*/
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import edu.harvard.seas.pl.formulog.ast.BindingType;
import edu.harvard.seas.pl.formulog.ast.Term;
import edu.harvard.seas.pl.formulog.ast.Var;
import edu.harvard.seas.pl.formulog.eval.EvaluationException;
import edu.harvard.seas.pl.formulog.symbols.RelationSymbol;
import edu.harvard.seas.pl.formulog.unification.Substitution;
public class SimplePredicate implements SimpleLiteral {
private final RelationSymbol symbol;
private final Term[] args;
private final BindingType[] bindingPattern;
private final boolean negated;
public static SimplePredicate make(RelationSymbol symbol, Term[] args, BindingType[] bindingPattern, boolean negated) {
assert symbol.getArity() == args.length : "Symbol does not match argument arity";
return new SimplePredicate(symbol, args, bindingPattern, negated);
}
private SimplePredicate(RelationSymbol symbol, Term[] args, BindingType[] bindingPattern, boolean negated) {
this.symbol = symbol;
this.args = args;
this.bindingPattern = bindingPattern;
this.negated = negated;
}
public RelationSymbol getSymbol() {
return symbol;
}
@Override
public Term[] getArgs() {
return args;
}
public BindingType[] getBindingPattern() {
return bindingPattern;
}
public boolean isNegated() {
return negated;
}
@Override
public <I, O> O accept(SimpleLiteralVisitor<I, O> visitor, I input) {
return visitor.visit(this, input);
}
@Override
public <I, O, E extends Throwable> O accept(SimpleLiteralExnVisitor<I, O, E> visitor, I input) throws E {
return visitor.visit(this, input);
}
@Override
public String toString() {
String s = "";
if (negated) {
s += "!";
}
s += symbol;
if (args.length > 0) {
s += "(";
for (int i = 0; i < args.length; ++i) {
s += args[i] + " : ";
switch (bindingPattern[i]) {
case BOUND:
s += "b";
break;
case FREE:
s += "f";
break;
case IGNORED:
s += "i";
break;
}
if (i < args.length - 1) {
s += ", ";
}
}
s += ")";
}
return s;
}
public SimplePredicate normalize(Substitution s) throws EvaluationException {
Term[] newArgs = new Term[args.length];
for (int i = 0; i < args.length; ++i) {
newArgs[i] = args[i].normalize(s);
}
return new SimplePredicate(symbol, newArgs, bindingPattern, negated);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(args);
result = prime * result + Arrays.hashCode(bindingPattern);
result = prime * result + (negated ? 1231 : 1237);
result = prime * result + ((symbol == null) ? 0 : symbol.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SimplePredicate other = (SimplePredicate) obj;
if (!Arrays.equals(args, other.args))
return false;
if (!Arrays.equals(bindingPattern, other.bindingPattern))
return false;
if (negated != other.negated)
return false;
if (symbol == null) {
if (other.symbol != null)
return false;
} else if (!symbol.equals(other.symbol))
return false;
return true;
}
@Override
public Set<Var> varSet() {
Set<Var> vars = new HashSet<>();
for (Term arg : args) {
arg.varSet(vars);
}
return vars;
}
@Override
public SimpleLiteralTag getTag() {
return SimpleLiteralTag.PREDICATE;
}
}
| [
"aaron.bembenek@gmail.com"
] | aaron.bembenek@gmail.com |
c8ecd8ef8946949b898ab653f527da33995d5a47 | 30e3b13ca6cc3475ac4d44ae9472b4b4bd305412 | /src/main/java/com/itsherman/web/javagenerator/utils/TypeNameUtils.java | a12893a55bddd011be296ee7c75644593314f930 | [] | no_license | yumiaoxia/Jeeper | da4572e8a39525174a1f320daa4a80eff5c221b3 | 8c84c08d5d95872aae4363532f4f65881fa77ca5 | refs/heads/master | 2022-02-01T18:57:05.485512 | 2020-02-14T17:06:06 | 2020-02-14T17:06:06 | 235,539,496 | 0 | 0 | null | 2022-01-21T23:47:34 | 2020-01-22T09:30:37 | Java | UTF-8 | Java | false | false | 2,645 | java | package com.itsherman.web.javagenerator.utils;
import com.itsherman.web.javagenerator.dao.model.*;
import com.itsherman.web.javagenerator.enums.WildcardEnum;
import com.squareup.javapoet.*;
import org.apache.commons.lang3.ClassUtils;
import java.util.ArrayList;
import java.util.List;
public class TypeNameUtils {
public static TypeName getTypeName(TypeDefinition typeDefinition){
TypeName typeName;
if(typeDefinition instanceof ClassTypeDefinition){
ClassTypeDefinition classTypeDefinition = (ClassTypeDefinition)typeDefinition;
typeName = ClassName.get(classTypeDefinition.getClassType());
}else if(typeDefinition instanceof TypeVariableDefinition){
TypeVariableDefinition typeVariableDefinition = (TypeVariableDefinition)typeDefinition;
typeName = TypeVariableName.get(typeVariableDefinition.getVariable());
}else if(typeDefinition instanceof ArrayTypeDefinition){
ArrayTypeDefinition arrayTypeDefinition = (ArrayTypeDefinition)typeDefinition;
TypeDefinition typeDefinition1 = arrayTypeDefinition.getTypeDefinition();
typeName = ArrayTypeName.of(getTypeName(typeDefinition1));
}else if(typeDefinition instanceof ParameterizedTypeDefinition){
ParameterizedTypeDefinition parameterizedTypeDefinition = (ParameterizedTypeDefinition) typeDefinition;
TypeDefinition[] typeArguments = parameterizedTypeDefinition.getTypeArguments();
TypeName[] typeNames = new TypeName[typeArguments.length];
for (int i = 0; i < typeArguments.length; i++) {
typeNames[i] = getTypeName(typeArguments[i]);
}
typeName = ParameterizedTypeName.get(ClassName.get(parameterizedTypeDefinition.getRawType()),typeNames);
}else if(typeDefinition instanceof WildcardTypeDefinition){
WildcardTypeDefinition wildcardTypeDefinition = (WildcardTypeDefinition)typeDefinition;
switch (wildcardTypeDefinition.getWildcardEnum()){
case SUPPER:
typeName = WildcardTypeName.supertypeOf(wildcardTypeDefinition.getBoundClass());
break;
case SUB:
typeName = WildcardTypeName.subtypeOf(wildcardTypeDefinition.getBoundClass());
break;
default:
typeName = WildcardTypeName.get(wildcardTypeDefinition.getBoundClass());
break;
}
}else{
throw new IllegalArgumentException("No such TypeDefinition");
}
return typeName;
}
}
| [
"yumiaoxia@idaoben.com"
] | yumiaoxia@idaoben.com |
7ff4b348da3d7739dfe9ca01d868ab76e6d7f197 | 129a25390f19d55792a9c43de3d36d370e07d14f | /senla/src/second/Second.java | 4d3d529c80a4319faf459672893e105845ae265d | [] | no_license | ksugavrikovatraning/senla | 1ec4a750f4efe1676a5399a16712b5fc8e3b6b5d | d352477ed673345b8bf2911811da1b5202600d68 | refs/heads/main | 2023-06-19T09:13:51.803682 | 2021-07-19T11:42:42 | 2021-07-19T11:42:42 | 387,268,348 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 475 | java | package second;
import java.util.Scanner;
public class Second {
public static void sum() {
int result = 0;
System.out.println("Введите строку: ");
String s = new Scanner(System.in).nextLine();
for (String num : s.replaceAll("[^\\d]", "").split("")) {
result += Integer.parseInt(num);
}
System.out.println("Количество \"троек\" в строке: " + result);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
70f1990d4ef7bea3b6a75ee34f8ed598432203e6 | 60e7f545fba7f94eef4aa021ecdd800aee2fa37c | /src/main/java/com/athjt/service/TroleService.java | 0b3f25b62474365fe009231a19a6bd784597c3c8 | [] | no_license | hejiantao2020/manager | b0ff1a1cf040dda1625e7c3fa8dd9704293dec12 | 441d7fdfb01fdf6e77d9e5210ebce656651dd7ca | refs/heads/master | 2022-12-10T11:57:16.815602 | 2020-08-26T06:44:41 | 2020-08-26T06:44:41 | 288,936,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.athjt.service;
import com.athjt.entity.Trole;
import java.util.List;
public interface TroleService extends IService<Trole>{
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
List<Trole> selectRolesByUserId(Integer userid);//根据userid查询所有的角色
} | [
"627031741@qq.com"
] | 627031741@qq.com |
645e31ae471f8d27129acaa6be57617a9a52ca8e | 9b0e2dcbb59b86ada20c1ef5c78464a93874bcbe | /proxy/src/main/java/org/jboss/research/proxy/AdviceContext.java | 5258faa8cf9c8ff1c1f5009a8407c44a8ee6f9fb | [] | no_license | antoinesd/proxy-vs-invokedynamic | 8fba74b516023fa6ee7bc25cdcb15a3ac40029d9 | 11a0d57650798387546ecc0ea779aa84a0865077 | refs/heads/master | 2021-01-20T17:26:42.200911 | 2014-01-14T14:19:01 | 2014-01-14T14:19:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package org.jboss.research.proxy;
import java.lang.reflect.AnnotatedElement;
public interface AdviceContext {
public Object call(AnnotatedElement annotatedElement, Object receiver, Object[] args);
}
| [
"antoine@sabot-durand.net"
] | antoine@sabot-durand.net |
bc0891c052fc8b3c8c396d0eb9cb5497433c52ea | a4c5ec1d630fabe2ee38e133da481d453034001e | /src/Leetcode136.java | 3d8f6656d68fe538b03a364aea3038196df96e25 | [] | no_license | xuetianw/LeetCode | 77eab6ce31ae2523e56d718879662f59e58b1de8 | 630c263d4307cf005274ac5bf3ff92a81d94a517 | refs/heads/master | 2022-06-27T18:02:50.843954 | 2022-06-05T16:13:00 | 2022-06-05T16:13:00 | 219,260,991 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | import java.util.HashMap;
import java.util.Map;
public class Leetcode136 {
public int singleNumber(int[] nums) {
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < nums.length; i++) {
int num = nums[i];
if (!map.containsKey(num)) map.put(nums[i], i);
else map.put(num, -1);
}
for (int num : map.keySet()) {
int val = map.get(num);
if (val != -1) return nums[val];
}
return -1;
}
}
| [
"xuetianw@sfu.ca"
] | xuetianw@sfu.ca |
e91ba20448709e3c328bb185af0441fe3914ed9f | 343d4ad5b533f2c84ef80b501397fd1451750a42 | /src/main/java/com/hitler/dto/user/PayRolePermissionDTO.java | 9d3fdef0b5ea7368eb4c5ce183f0c875d1d0bd57 | [] | no_license | emaipay/op-pay | 2fa7e6cc2550f7a9279e32c26d2f7ace648f90d2 | 037ef48e3285dea935dcb48f81ac102d0e4ab167 | refs/heads/master | 2020-03-23T16:19:41.652569 | 2018-09-13T09:04:26 | 2018-09-13T09:04:26 | 141,804,302 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,870 | java | package com.hitler.dto.user;
import com.hitler.core.dto.support.PersistentDTO;
import com.hitler.entity.PayPermission;
import com.hitler.entity.PayRolePermission;
/**
* Created by yang on 2017/3/21.
* @version 1.0
* @description
*/
public class PayRolePermissionDTO extends PersistentDTO<Integer> {
/**
*
*/
private static final long serialVersionUID = -5885890677113965827L;
private Integer id;
/**
* 角色id
*/
private Integer roleId;
/**
* 角色名称
*/
private String roleName;
/**
* 租户代号
*/
private String tenantCode;
private Integer floor;
/**
* 是否默认
*/
private Boolean isDefault;
/**
* 权限id
*/
private Integer permissionId;
/**
* 权限名称
*/
private String permissionName;
/**
* 权限类型(0-菜单,1-权限)
*/
private PayPermission.PermissionType permissionType;
/**
* 跳转路径
*/
private String path;
/**
* 权限代码(shiro授权唯一认证) 系统名称+模块+操作 如 back:user:create
*/
private String code;
/**
* 父权限ID
*/
private Integer parentPermissionId;
/**
* 排序(深度)
*/
private Integer deep;
/**
* 是否显示(默认0-显示,1-隐藏)
*/
private PayPermission.IsDisplay isDisplay;
/**
* 图标()
*/
private String icon;
public PayRolePermissionDTO() {
}
public PayRolePermissionDTO(PayRolePermission rp) {
this.id = rp.getId();
this.roleId = rp.getRoleId().getId();
this.roleName = rp.getRoleId().getRoleName();
this.permissionId = rp.getPermissionId().getId();
this.permissionName = rp.getPermissionId().getPermissionName();
this.permissionType = rp.getPermissionId().getPermissionType();
this.path = rp.getPermissionId().getPath();
this.code = rp.getPermissionId().getCode();
this.floor=rp.getPermissionId().getFloor();
this.parentPermissionId = rp.getPermissionId().getParentPermissionId();
this.deep = rp.getPermissionId().getDeep();
this.isDisplay = rp.getPermissionId().getIsDisplay();
this.icon = rp.getPermissionId().getIcon();
}
@Override
public Integer getId() {
return id;
}
@Override
public void setId(Integer id) {
this.id = id;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getTenantCode() {
return tenantCode;
}
public void setTenantCode(String tenantCode) {
this.tenantCode = tenantCode;
}
public Integer getFloor() {
return floor;
}
public void setFloor(Integer floor) {
this.floor = floor;
}
public Boolean getIsDefault() {
return isDefault;
}
public void setIsDefault(Boolean isDefault) {
this.isDefault = isDefault;
}
public Boolean getDefault() {
return isDefault;
}
public void setDefault(Boolean aDefault) {
isDefault = aDefault;
}
public Integer getPermissionId() {
return permissionId;
}
public void setPermissionId(Integer permissionId) {
this.permissionId = permissionId;
}
public String getPermissionName() {
return permissionName;
}
public void setPermissionName(String permissionName) {
this.permissionName = permissionName;
}
public PayPermission.PermissionType getPermissionType() {
return permissionType;
}
public void setPermissionType(PayPermission.PermissionType permissionType) {
this.permissionType = permissionType;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getParentPermissionId() {
return parentPermissionId;
}
public void setParentPermissionId(Integer parentPermissionId) {
this.parentPermissionId = parentPermissionId;
}
public Integer getDeep() {
return deep;
}
public void setDeep(Integer deep) {
this.deep = deep;
}
public PayPermission.IsDisplay getIsDisplay() {
return isDisplay;
}
public void setIsDisplay(PayPermission.IsDisplay isDisplay) {
this.isDisplay = isDisplay;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
}
| [
"chenglujian@163.com"
] | chenglujian@163.com |
8bece349bc41756c01ebd297fafda7caddd21dc4 | 80f3ff33b79ae9cd84390831908e467364fb8844 | /app/src/test/java/com/example/planetario2020/ExampleUnitTest.java | 98018487d97c75b79a23ec7cc647e4ffeeb18f74 | [] | no_license | fraxito/Planetario2020 | 957f082aebe255a16200063d82131919d9de41a4 | 9cf041bb365490793b8e67f1dff437636c0632ac | refs/heads/master | 2021-03-18T04:16:30.083309 | 2020-03-13T10:26:59 | 2020-03-13T10:26:59 | 247,044,991 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.example.planetario2020;
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);
}
} | [
"fraxito@gmail.com"
] | fraxito@gmail.com |
8cff1107ce0079f773863866ff98f37fc3d80494 | ee9aa986a053e32c38d443d475d364858db86edc | /src/main/java/com/ebay/soap/eBLBaseComponents/PaidStatusCodeType.java | 2704c727e9f963227ee63f0873029e9b21812542 | [
"Apache-2.0"
] | permissive | modelccc/springarin_erp | 304db18614f69ccfd182ab90514fc1c3a678aaa8 | 42eeb70ee6989b4b985cfe20472240652ec49ab8 | refs/heads/master | 2020-05-15T13:10:21.874684 | 2018-05-24T15:39:20 | 2018-05-24T15:39:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,488 | java |
package com.ebay.soap.eBLBaseComponents;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for PaidStatusCodeType.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="PaidStatusCodeType">
* <restriction base="{http://www.w3.org/2001/XMLSchema}token">
* <enumeration value="NotPaid"/>
* <enumeration value="BuyerHasNotCompletedCheckout"/>
* <enumeration value="PaymentPendingWithPayPal"/>
* <enumeration value="PaidWithPayPal"/>
* <enumeration value="MarkedAsPaid"/>
* <enumeration value="PaymentPendingWithEscrow"/>
* <enumeration value="PaidWithEscrow"/>
* <enumeration value="EscrowPaymentCancelled"/>
* <enumeration value="PaymentPendingWithPaisaPay"/>
* <enumeration value="PaidWithPaisaPay"/>
* <enumeration value="PaymentPending"/>
* <enumeration value="PaymentPendingWithPaisaPayEscrow"/>
* <enumeration value="PaidWithPaisaPayEscrow"/>
* <enumeration value="PaisaPayNotPaid"/>
* <enumeration value="Refunded"/>
* <enumeration value="WaitingForCODPayment"/>
* <enumeration value="PaidCOD"/>
* <enumeration value="CustomCode"/>
* <enumeration value="Paid"/>
* </restriction>
* </simpleType>
* </pre>
*
* Note: Per JAXB standards, underscores are added to separate words in enumerations (e.g., PayPal becomes PAY_PAL).
*/
@XmlType(name = "PaidStatusCodeType")
@XmlEnum
public enum PaidStatusCodeType {
/**
*
* The buyer has not completed checkout, but has not paid through PayPal or
* PaisaPay (but please also see the documentation for PaymentHoldStatus and its applicable values).
* The buyer might have paid using another method, but the payment
* might not have been received or cleared.
* Important: Please see the documentation for PaymentHoldStatus and its applicable values.
* PaymentHoldStatus contains the current status of a hold on a PayPal payment.
*
*
*/
@XmlEnumValue("NotPaid")
NOT_PAID("NotPaid"),
/**
*
* The buyer has not completed the checkout process and so has not made payment.
*
*
*/
@XmlEnumValue("BuyerHasNotCompletedCheckout")
BUYER_HAS_NOT_COMPLETED_CHECKOUT("BuyerHasNotCompletedCheckout"),
/**
*
* The buyer has made a PayPal payment, but the seller has not yet received it.
*
*
*/
@XmlEnumValue("PaymentPendingWithPayPal")
PAYMENT_PENDING_WITH_PAY_PAL("PaymentPendingWithPayPal"),
/**
*
* The buyer has made a PayPal payment, and the payment is complete.
* But please also see the documentation for PaymentHoldStatus and its applicable values.
* PaymentHoldStatus contains the current status of a hold on a PayPal payment.
*
*
*/
@XmlEnumValue("PaidWithPayPal")
PAID_WITH_PAY_PAL("PaidWithPayPal"),
/**
*
* The order is marked as paid by either buyer or seller.
*
*
*/
@XmlEnumValue("MarkedAsPaid")
MARKED_AS_PAID("MarkedAsPaid"),
/**
*
* The buyer has made an escrow payment, but the seller has not yet received it.
*
*
*/
@XmlEnumValue("PaymentPendingWithEscrow")
PAYMENT_PENDING_WITH_ESCROW("PaymentPendingWithEscrow"),
/**
*
* The buyer has made an escrow payment, and the seller has received payment.
*
*
*/
@XmlEnumValue("PaidWithEscrow")
PAID_WITH_ESCROW("PaidWithEscrow"),
/**
*
* The buyer has made an escrow payment, but has cancelled the payment.
*
*
*/
@XmlEnumValue("EscrowPaymentCancelled")
ESCROW_PAYMENT_CANCELLED("EscrowPaymentCancelled"),
/**
*
* The buyer has paid with PaisaPay, but the payment is still being processed.
* The seller has not yet received payment.
*
*
*/
@XmlEnumValue("PaymentPendingWithPaisaPay")
PAYMENT_PENDING_WITH_PAISA_PAY("PaymentPendingWithPaisaPay"),
/**
*
* The buyer has paid with PaisaPay, and the payment is complete.
*
*
*/
@XmlEnumValue("PaidWithPaisaPay")
PAID_WITH_PAISA_PAY("PaidWithPaisaPay"),
/**
*
* The buyer has made a payment other than PayPal, escrow, or PaisaPay, but the
* payment is still being processed.
*
*
*/
@XmlEnumValue("PaymentPending")
PAYMENT_PENDING("PaymentPending"),
/**
*
* Payment Pending With PaisaPay Escrow
*
*
*/
@XmlEnumValue("PaymentPendingWithPaisaPayEscrow")
PAYMENT_PENDING_WITH_PAISA_PAY_ESCROW("PaymentPendingWithPaisaPayEscrow"),
/**
*
* Paid With PaisaPay Escrow
*
*
*/
@XmlEnumValue("PaidWithPaisaPayEscrow")
PAID_WITH_PAISA_PAY_ESCROW("PaidWithPaisaPayEscrow"),
/**
*
* Paisa Pay Not Paid
*
*
*/
@XmlEnumValue("PaisaPayNotPaid")
PAISA_PAY_NOT_PAID("PaisaPayNotPaid"),
/**
*
* Refunded
*
*
*/
@XmlEnumValue("Refunded")
REFUNDED("Refunded"),
/**
*
* WaitingForCODPayment
*
*
*/
@XmlEnumValue("WaitingForCODPayment")
WAITING_FOR_COD_PAYMENT("WaitingForCODPayment"),
/**
*
* PaidCOD
*
*
*/
@XmlEnumValue("PaidCOD")
PAID_COD("PaidCOD"),
/**
*
* Reserved for future use.
*
*
*/
@XmlEnumValue("CustomCode")
CUSTOM_CODE("CustomCode"),
/**
*
* Paid
*
*
*/
@XmlEnumValue("Paid")
PAID("Paid");
private final String value;
PaidStatusCodeType(String v) {
value = v;
}
public String value() {
return value;
}
public static PaidStatusCodeType fromValue(String v) {
for (PaidStatusCodeType c: PaidStatusCodeType.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
| [
"601906911@qq.com"
] | 601906911@qq.com |
72ee40b2a688a85c146900f2c7a145edc5d2dc6c | 68811750245f1069a46c4749b26378b142bafcf6 | /src/test/java/runners/TestRunner.java | 08fac3531a8dfea2d5ee8f9ea7ca36a2f376794f | [] | no_license | martyn08/acuk-project | c170585d8f6695f83e4b57cc3d4c972bee51c293 | d66ff223d078f89f1c3432cbd8669465af2965b2 | refs/heads/master | 2021-06-21T09:15:35.453266 | 2019-07-16T14:59:24 | 2019-07-16T14:59:24 | 197,215,013 | 0 | 0 | null | 2021-03-31T21:25:31 | 2019-07-16T14:57:59 | HTML | UTF-8 | Java | false | false | 1,445 | java | package runners;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.CucumberFeatureWrapper;
import cucumber.api.testng.TestNGCucumberRunner;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@CucumberOptions(
features = "src/test/resources/features",
glue = {"stepdefinitions"},
tags = {"~@Ignore"},
plugin = {
"pretty",
"html:target/cucumber-reports/cucumber-pretty",
"json:target/cucumber-reports/CucumberTestReport.json",
"rerun:target/cucumber-reports/rerun.txt"
})
public class TestRunner {
private TestNGCucumberRunner testNGCucumberRunner;
@BeforeClass(alwaysRun = true)
public void setUpClass() throws Exception {
testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
}
@Test(groups = "cucumber", description = "Runs Cucumber Feature", dataProvider = "features")
public void feature(CucumberFeatureWrapper cucumberFeature) {
testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
}
@DataProvider
public Object[][] features() {
return testNGCucumberRunner.provideFeatures();
}
@AfterClass(alwaysRun = true)
public void tearDownClass() throws Exception {
testNGCucumberRunner.finish();
}
}
| [
"harkintope@gmail.com"
] | harkintope@gmail.com |
40534fe5c2663f3f8301796321649466cc2242fa | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project71/src/main/java/org/gradle/test/performance71_5/Production71_451.java | 012827674c2b211c11a98ccc9f017a7c4fc029f4 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 305 | java | package org.gradle.test.performance71_5;
public class Production71_451 extends org.gradle.test.performance15_5.Production15_451 {
private final String property;
public Production71_451() {
this.property = "foo";
}
public String getProperty() {
return property;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
8a89e74507cf568dad3eec6393d391dd8a8436aa | 2760392ecc187ede19cebaab174283df5fb8683e | /src/niuke_aim_to_offer/niuke_fibonacci_array/FibonacciArray.java | f2e347c02c08ebc10179869631a7b72d14cb3e5c | [] | no_license | startrainee/leetcode | 1a658414395538e92a1e146bf92ae328863663ee | 8ae0f071ae9e09957e6570fdd12cf96111ce725e | refs/heads/master | 2021-08-23T09:05:19.054802 | 2017-12-04T12:27:03 | 2017-12-04T12:27:03 | 105,001,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,739 | java | package niuke_aim_to_offer.niuke_fibonacci_array;
import java.util.Arrays;
/**
* 斐波那契数列
* f(0) = 1;
* f(1) = 1;
* f(n) = f(n-1) + f(n-2);
*
* 衍生问题
* 跳台阶:可以一步走1或者2个台阶,求到n个台阶的走法有多少种方法。
* --分析:
* n台阶可以由 f(n-1) 走 1 个台阶 或者 f(n-2) 之后走2 个台阶 两种方式得到。
* 故,f(n) = f(n-1) + f(n-2),这符合Fibonacci 数列规则(设f(0) = 1,并且配合f(1) = 1,f(2) = 2)。
* --
* 变态跳台阶:可以一步走1,2,3,...,n 个台阶,求到n个台阶的走法有多少种方法。
* --分析:
* f(0) = 0,f(1) = 1;
* f(n) = f(1) + f(2) + ... + f(n-1) + 1;
* 当n >=2 ,f(n-1) = f(1) + f(2) + ... + f(n-2) + 1;
* 故,当n >=2 ,f(n) = 2 f(n -1);
* 综上,当n >=1 时, 可得到,f(n) = 2*f(n-1);
* --
* */
public class FibonacciArray {
private static int ARRAY_MAX_SIZE = 39; //设置阈值
private int[] fibonacci_array = new int[ARRAY_MAX_SIZE];
public static void main(String[] args) {
long t1 = System.currentTimeMillis();
System.out.println("Time: " + t1);
System.out.println(getFibonacci(39));
long t2 = System.currentTimeMillis();
System.out.println("Time " + (t2 - t1));
System.out.println(new FibonacciArray().getFibonacci2(39));
long t3 = System.currentTimeMillis();
System.out.println("Time " + (t3 - t2));
}
public int getFibonacci2(int n) {
if(n < 0 ){
return -1;
}
if(n >= ARRAY_MAX_SIZE){
growArray(ARRAY_MAX_SIZE);
}
if(fibonacci_array[n] == 0){
fibonacci_array[n] = _getFibonacci2(n);
}
return fibonacci_array[n];
}
private int _getFibonacci2(int n) {
if(n==0 || n==1){
fibonacci_array[n] = 1;
return fibonacci_array[n];
}
if(fibonacci_array[n-1] == 0){
fibonacci_array[n-1] = _getFibonacci2(n-1);
}
if(fibonacci_array[n-2] == 0){
fibonacci_array[n-2] = _getFibonacci2(n-2);
}
fibonacci_array[n] = fibonacci_array[n-1] + fibonacci_array[n-2];
return fibonacci_array[n];
}
private void growArray(int arrayMaxSize) {
fibonacci_array = Arrays.copyOf(fibonacci_array,fibonacci_array.length + arrayMaxSize);
}
/**
* 递归调用,但是要注意递归深度,当 n 过大时,会降低性能
* */
public static int getFibonacci(int n) {
if(n == 0 || n == 1)
return 1;
return getFibonacci(n - 1) + getFibonacci(n-2);
}
}
| [
"13149854342@163.com"
] | 13149854342@163.com |
53d30e4510e091942c520b810958d81f2b9ffb06 | 27f2c39031f50500e03d6e59dda296f2150dde0b | /FinanceManagerMobile/app/src/main/java/net/sytes/financemanagermm/financemanagermobile/Gemeinsame_Finanzen/Gemeinsame_Finanzen_Anfrage_BearbeitenDialog_Fragment_Konten.java | b4422acfa71325b779b5e1f15c6d77c574b066f1 | [] | no_license | madmaxextrem1/FinanceManagerMobile | 6a0d6fc6b69e1278342f7520ec450ff258cdaa7c | db92b49e44758d0ce40a9c6deff71d40f2a11ef8 | refs/heads/master | 2022-12-08T22:31:33.719493 | 2020-09-05T20:03:54 | 2020-09-05T20:03:54 | 271,784,550 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,564 | java | package net.sytes.financemanagermm.financemanagermobile.Gemeinsame_Finanzen;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.daimajia.swipe.SwipeLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import net.sytes.financemanagermm.financemanagermobile.R;
import net.sytes.financemanagermm.financemanagermobile.Verwaltung.Konto;
import net.sytes.financemanagermm.financemanagermobile.Verwaltung.FinanceManagerData_Edited_Interface;
import net.sytes.financemanagermm.financemanagermobile.Verwaltung.Verwaltung_Konten_Detailansicht;
import java.util.LinkedHashMap;
public class Gemeinsame_Finanzen_Anfrage_BearbeitenDialog_Fragment_Konten extends Fragment {
private ListView lvKonten;
private FloatingActionButton btnKontoHinzufügen;
private TextInputEditText txtBeschreibung;
private Gemeinsame_Finanzen_Anfrage_BearbeitenDialog_Fragment_Konten_Adapter kontoAdapter;
private Gemeinsame_Finanzen_Anfrage_BearbeitenDialog parent;
private KooperationAnfrage anfrage;
private SwipeLayout swipeLayout;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View ReturnView = inflater.inflate(R.layout.gemeinsame_finanzen_anfrage_neueanfrage_dialog_fragment_konten, container, false);
parent = (Gemeinsame_Finanzen_Anfrage_BearbeitenDialog) getParentFragment();
anfrage = parent.getAnfrage();
lvKonten = ReturnView.findViewById(R.id.lvKonten);
TextInputLayout txtBeschreibungLayout = (TextInputLayout) ReturnView.findViewById(R.id.txtAnfrage_Beschreibung);
txtBeschreibung = (TextInputEditText) txtBeschreibungLayout.getEditText();
btnKontoHinzufügen = ReturnView.findViewById(R.id.btnKonto_Hinzufügen);
View SwipeView = getLayoutInflater().inflate(R.layout.gemeinsame_finanzen_anfrage_fragment_konten_adapter_item, null);
swipeLayout = (SwipeLayout) SwipeView.findViewById(R.id.SwipeLayout);
//set show mode.
swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown);
//add drag edge.(If the BottomView has 'layout_gravity' attribute, this line is unnecessary)
swipeLayout.addDrag(SwipeLayout.DragEdge.Left, SwipeView.findViewWithTag(R.id.bottom_wrapper));
swipeLayout.addSwipeListener(new SwipeLayout.SwipeListener() {
@Override
public void onClose(SwipeLayout layout) {
//when the SurfaceView totally cover the BottomView.
}
@Override
public void onUpdate(SwipeLayout layout, int leftOffset, int topOffset) {
//you are swiping.
}
@Override
public void onStartOpen(SwipeLayout layout) {
}
@Override
public void onOpen(SwipeLayout layout) {
//when the BottomView totally show.
}
@Override
public void onStartClose(SwipeLayout layout) {
}
@Override
public void onHandRelease(SwipeLayout layout, float xvel, float yvel) {
//when user's hand released.
}
});
btnKontoHinzufügen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager fragmentManager =getChildFragmentManager();
Verwaltung_Konten_Detailansicht dialog = new Verwaltung_Konten_Detailansicht(getContext(), null, new FinanceManagerData_Edited_Interface<Konto>() {
@Override
public void onDataEdited(Konto data, boolean created) {
data.setId(kontoAdapter.getLinkedMap().size() + 1);
kontoAdapter.getLinkedMap().put(data.getIdentifier(), data);
kontoAdapter.notifyDataSetChanged();
}
}, false);
dialog.show(fragmentManager, "fragment_edit_konto");
}
});
if(parent.getAnfrage() != null) {
txtBeschreibung.setText(anfrage.getBeschreibung());
kontoAdapter = new Gemeinsame_Finanzen_Anfrage_BearbeitenDialog_Fragment_Konten_Adapter(getContext(), R.layout.gemeinsame_finanzen_anfrage_fragment_konten_adapter_item, R.id.SwipeLayout);
anfrage.getKontoMap().values().forEach(konto -> kontoAdapter.getLinkedMap().put(konto.getIdentifier(), konto.getCopy()));
lvKonten.setAdapter(kontoAdapter);
kontoAdapter.notifyDataSetChanged();
} else {
kontoAdapter = new Gemeinsame_Finanzen_Anfrage_BearbeitenDialog_Fragment_Konten_Adapter(getContext(), R.layout.gemeinsame_finanzen_anfrage_fragment_konten_adapter_item, R.id.SwipeLayout);
lvKonten.setAdapter(kontoAdapter);
kontoAdapter.notifyDataSetChanged();
}
return ReturnView;
}
public String getBeschreibung() {return txtBeschreibung.getText().toString().trim();}
public LinkedHashMap<Integer, Konto> getKontoMap(){return kontoAdapter.getLinkedMap();}
} | [
"maerkl.maximilian@gmail.com"
] | maerkl.maximilian@gmail.com |
5ae36af22bb481c8645da06e8fcbad4d987b5ce7 | 504f0ba5c18ccc7393e6715f1ce9b236c4f6d99f | /vcs-20200515/src/main/java/com/aliyun/vcs20200515/models/UnbindPersonResponse.java | fea4ba0edae2e8caf19e8fa378b052da7241253e | [
"Apache-2.0"
] | permissive | jhz-duanmeng/alibabacloud-java-sdk | 77f69351dee8050f9c40d7e19b05cf613d2448d6 | ac8bfeb15005d3eac06091bbdf50e7ed3e891c38 | refs/heads/master | 2023-01-16T04:30:12.898713 | 2020-11-25T11:45:31 | 2020-11-25T11:45:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,458 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.vcs20200515.models;
import com.aliyun.tea.*;
public class UnbindPersonResponse extends TeaModel {
@NameInMap("Code")
@Validation(required = true)
public String code;
@NameInMap("Data")
@Validation(required = true)
public Boolean data;
@NameInMap("Message")
@Validation(required = true)
public String message;
@NameInMap("RequestId")
@Validation(required = true)
public String requestId;
public static UnbindPersonResponse build(java.util.Map<String, ?> map) throws Exception {
UnbindPersonResponse self = new UnbindPersonResponse();
return TeaModel.build(map, self);
}
public UnbindPersonResponse setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public UnbindPersonResponse setData(Boolean data) {
this.data = data;
return this;
}
public Boolean getData() {
return this.data;
}
public UnbindPersonResponse setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public UnbindPersonResponse setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
d59bab8d9cce0d02f23e21ef358376e8c75c73f6 | 555a0bb163b12cc55125c1bab4b2b57aceb06a94 | /modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/planetlabIops/LrRs.java | 981683b15934a8a041b7f5969a0e572e5edad9b0 | [] | no_license | HuChundong/cloudsim | d2b7e59105a6f0e1462880b21591c3d7c8235751 | 0a1d3df11ef760f71f0ec849c3e46a5fa0f44ec3 | refs/heads/master | 2020-04-06T03:42:46.307496 | 2013-09-16T10:20:43 | 2013-09-16T10:20:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,017 | java | package org.cloudbus.cloudsim.examples.power.planetlabIops;
import java.io.IOException;
import org.cloudbus.cloudsim.Log;
/**
* A simulation of a heterogeneous power aware data center that applies the Local Regression (LR) VM
* allocation policy and Random Selection (RS) VM selection policy.
*
* This example uses a real PlanetLab workload: 20110303.
*
* The remaining configuration parameters are in the Constants and PlanetLabConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
public class LrRs {
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
boolean enableOutput = true;
boolean outputToFile = false;
String outputFolder = "output";
String workload = "20110303"; // PlanetLab workload
String vmAllocationPolicy = "lr"; // Local Regression (LR) VM allocation policy
String vmSelectionPolicy = "rs"; // Random Selection (RS) VM selection policy
String parameter = "1.2"; // the safety parameter of the LR policy
String inputFolder = LrRs.class.getClassLoader().getResource("workload/planetlab").getPath();
Log.setVmUtilOutput(vmAllocationPolicy + "_" + workload + "vmUtil.log");
new PlanetLabRunnerIops(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
workload,
vmAllocationPolicy,
vmSelectionPolicy,
parameter);
}
}
| [
"giannis.spiliopoulos@gmail.com"
] | giannis.spiliopoulos@gmail.com |
ce75a328cf4f02ecbf3fa42bbab479215c1a256a | 5ee322b49f09f5da5f55db6a29711dee586a7686 | /src/ctci/chaptereight/RobotInAGrid.java | 2caea394200e8834516cb15caab25eaec2937c7f | [] | no_license | abhiiitr/ctci-solutions | 8d6c028bf7f3f82af2732bff4da200d0c919d8e3 | b3fd278772a394b52c15302358071ef182a188b1 | refs/heads/master | 2020-07-31T14:05:28.007261 | 2020-02-10T14:52:19 | 2020-02-10T14:52:19 | 210,627,733 | 0 | 0 | null | 2019-12-17T16:58:32 | 2019-09-24T14:48:04 | Java | UTF-8 | Java | false | false | 1,587 | java | package ctci.chaptereight;
import java.util.ArrayList;
import java.util.List;
public class RobotInAGrid {
boolean end = false;
public List<Point> findPath(int[][] arr) {
if (arr == null || arr.length == 0 || arr[0].length == 0)
return null;
List<Point> result = new ArrayList<>();
findPath(arr, 0, 0, result);
return result;
}
private void findPath(int[][] arr, int r, int c, List<Point> result) {
if (r >= arr.length || c >= arr[0].length || arr[r][c] == -1)
return;
result.add(new Point(r, c));
if (r == arr.length - 1 && c == arr[0].length - 1) {
end = true;
return;
}
findPath(arr, r + 1, c, result);
if (!end) {
result.remove(result.size() - 1);
}
findPath(arr, r, c + 1, result);
if (!end) {
result.remove(result.size() - 1);
}
}
public static void main(String[] args) {
RobotInAGrid obj = new RobotInAGrid();
int arr[][] = {{0, 0, 0},
{0, -1, 0},
{0, 0, 0}};
final List<Point> path = obj.findPath(arr);
for (Point e : path)
System.out.print(e);
}
class Point {
int r;
int c;
public Point(int r, int c) {
this.r = r;
this.c = c;
}
@Override
public String toString() {
return "Point{" +
"r=" + r +
", c=" + c +
'}';
}
}
}
| [
"sahu.abhishek.iitr@gmail.com"
] | sahu.abhishek.iitr@gmail.com |
5d81e415f5fd488f62543adeec522937332ed820 | a5c6a08ea0066192ffdecf687dd848b7ba78f03c | /src/main/java/com/fx/spider/FxSpiderApplication.java | eb124c27a2bfecd115660c46898e4b937d29e391 | [] | no_license | mvyvip/fx-spider-smart | 35ec81894937650a1d1633faf0833ac1e943148b | ffa69f75e594813f5e419d79af2fa2015faebf3f | refs/heads/master | 2020-04-05T08:12:00.960103 | 2018-11-22T10:05:44 | 2018-11-22T10:05:44 | 156,705,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | package com.fx.spider;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@SpringBootApplication
@MapperScan("com.fx.spider.mapper")
@Controller
public class FxSpiderApplication {
public static void main(String[] args) {
SpringApplication.run(FxSpiderApplication.class, args);
}
@RequestMapping({"", "/"})
public String toOrder() {
return "redirect:/order.html";
}
}
| [
"litao@feedel.net"
] | litao@feedel.net |
5448d79a44434ad53fa1f220fdced53c64727749 | 035c3dcf1e082c6ab5128f039b99869dba74023c | /src/main/java/com/zhangbin/jpa/mq/consume/HelloReceiver1.java | 74bdfa92b729f374c9bb7b04b02d715447262851 | [] | no_license | yuanrong0824/testJpa | 6aae83246def87ae0542c7db9e966142f8665cb1 | 21da61f8c3121ab13e0c873e3e5ac649aea58924 | refs/heads/master | 2020-04-19T02:56:22.019886 | 2019-02-17T07:49:22 | 2019-02-17T07:49:22 | 167,919,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.zhangbin.jpa.mq.consume;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
@Component
@RabbitListener(queues = "hello")
public class HelloReceiver1 {
@RabbitHandler
public void process(String hello) {
System.out.println("Receiver1 : " + hello);
}
} | [
"qing.liu@weimob.com"
] | qing.liu@weimob.com |
b2d2129cc4ccc4948f0c997ba50f651ac7ee1df6 | 7d2bada762ff5118afb7661bd5b072a6322b6327 | /matAdd.java | e6e52f9f6cccca27b27bc46dc0298d215be4e87f | [] | no_license | bhuvanesvari/Coders-pack-java | 037221c6cf840366e674b6fddf70008e212e1d56 | f027e8d71de90e4bcaa35656654764476e6b000a | refs/heads/master | 2020-05-23T16:21:27.107406 | 2019-05-22T06:46:19 | 2019-05-22T06:46:19 | 186,846,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 968 | java | import java.util.Scanner;
class matAdd
{
public static void main(String args[])
{
int m,n;
System.out.println("Enter the row and column size of the matrix : ");
Scanner sc;
sc=new Scanner(System.in);
m=sc.nextInt();
n=sc.nextInt();
int a1[][]=new int[m][n];
int a2[][]=new int[m][n];
int sum[][]=new int[m][n];
System.out.println("Enter the elements of the matrix 1: ");
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
a1[i][j]=sc.nextInt();
}
}
System.out.println("Enter the elements of the matrix 2: ");
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
a2[i][j]=sc.nextInt();
}
}
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
sum[i][j]=a1[i][j]+a2[i][j];
}
}
System.out.println("The sum is ");
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
System.out.print(sum[i][j]+" ");
}
System.out.println();
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
3434b582571dff776285d46fa864cdc7e58131a7 | 9e632588def0ba64442d92485b6d155ccb89a283 | /source_code_billingSystem_before_update_simsV/billingSystem/billingsystem-dao/src/main/java/com/balicamp/dao/hibernate/mastermaintenance/license/LicenseSpectraDao.java | ea8217733cec9b90cb5c6a3642b89a060bbaf220 | [] | no_license | prihako/sims2019 | 6986bccbbd35ec4d1e5741aa77393f01287d752a | f5e82e3d46c405d4c3c34d529c8d67e8627adb71 | refs/heads/master | 2022-12-21T07:38:06.400588 | 2021-04-29T07:30:37 | 2021-04-29T07:30:37 | 212,565,332 | 0 | 0 | null | 2022-12-16T00:41:00 | 2019-10-03T11:41:00 | Java | UTF-8 | Java | false | false | 1,225 | java | package com.balicamp.dao.hibernate.mastermaintenance.license;
import java.util.List;
import com.balicamp.dao.admin.AdminGenericDao;
import com.balicamp.model.mastermaintenance.license.LicenseSpectra;
public interface LicenseSpectraDao extends AdminGenericDao<LicenseSpectra, Long> {
List<LicenseSpectra> findAllLicense(String addressCompany, String addressNumber,
String licenceId, String licenceNo, String serviceId,
String subServiceId);
LicenseSpectra findLicenseByClient(String addressNumber, String addressCompany,
String serviceId, String service, String subServiceId, String subService);
LicenseSpectra findLicenseByClientAndLicenceNumberID(String addressNumber,String addressCompany,
String licenceId, String licenceNo, String serviceId, String service, String subServiceId, String subService);
//------------------------------------------------------------------------------------------------------------------------------------hendy
List<LicenseSpectra> searchLicenseForCreate(final String serviceName,
final String subServiceName, final String clientName,
final String licenseId, final String licenseNumber);
List<LicenseSpectra> searchLicenseByNumber(final String licenseNumber);
} | [
"nurukat@gmail.com"
] | nurukat@gmail.com |
16cf4f987ce40b96265f18b074660d88d0be78ff | db64bc27de0fe11836c248b93dce2cde8e0b11cd | /HM03_SIMPLE_LOOP/src/HM03_SIMPLE_LOOP_05.java | 9d043dfd2c78b8133e183c86022b9c8cd45b6b89 | [] | no_license | Defalt643/Programming-Fundamental | 4d4b090f707b7d2b024584efc67c52a8e28afcd0 | 2ed5636d2303236cc1599b21b013e96b8d4f8094 | refs/heads/main | 2023-03-08T18:53:08.242259 | 2021-02-19T09:40:50 | 2021-02-19T09:40:50 | 340,320,725 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | import java.util.Scanner;
public class HM03_SIMPLE_LOOP_05 {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
double x = kb.nextInt();
int z = kb.nextInt();
int o=z;
int a=z;
double total=0;
for(int i = 0 ; i<x-1;i++) {
int y=kb.nextInt();
total=total+y;
if(z<y) {
z=y;
}else if (o>y) {
o=y;
}
}
double avg = (total+a)/x;
System.out.println(z);
System.out.println(o);
System.out.printf("%.2f",avg);
}
}
| [
"71940630+Defalt643@users.noreply.github.com"
] | 71940630+Defalt643@users.noreply.github.com |
0fe6153e4429d80844a50cd88e8a714dd8dfbe3d | 02fe52bd9873a4ec8fce874bb0d83d58974132ab | /src/main/java/com/practica/proyecto/exception/UsuarioRequestException.java | e2c042118e7455e3ff0684672d17f228f2ed5108 | [] | no_license | oscar9705/VeterinariaBackend | 199fc32bce395ae19c88207b3318d29ba91417e3 | 5cb899fa7e8afec361d9e36b5c9ecdcb86e3971d | refs/heads/master | 2023-01-11T20:57:59.086251 | 2020-10-16T00:15:55 | 2020-10-16T00:15:55 | 311,998,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | package com.practica.proyecto.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.NOT_FOUND)
public class UsuarioRequestException extends RuntimeException {
public UsuarioRequestException(String message){
super(message);
}
public UsuarioRequestException(String message, Throwable cause){
super(message, cause);
}
}
| [
"german-1-9@hotmail.com"
] | german-1-9@hotmail.com |
1769992020da2a2290ea2d6d3e234954a1cdb1a5 | ae956c3d8b7ebd42cc29feea88b86cfb04909e64 | /securitydemo/src/main/java/com/example/demo/threadtest/start/Thread1.java | 212ec217de0b649c66c8f066592e27b046ad7bc5 | [] | no_license | 870314540/springboot | c31aa1376c4c2f2daa67477d5562078d56e50595 | 78ef782c30032259345f8552db49738f0e4e258b | refs/heads/master | 2022-07-12T06:21:14.624246 | 2019-06-26T03:37:46 | 2019-06-26T03:37:46 | 97,702,301 | 0 | 0 | null | 2022-06-22T18:37:42 | 2017-07-19T10:08:05 | Java | UTF-8 | Java | false | false | 484 | java | package com.example.demo.threadtest.start;
/**
* Created by sugar on 17-7-30.
*/
public class Thread1 extends Thread{
private String name ;
public Thread1(String name ){
this.name = name ;
}
public void run(){
for (int i = 0 ; i< 100 ;i++){
System.out.println(i);
try{
this.sleep((int)Math.random()*10);
}catch (Exception e){
e.printStackTrace();
}
}
}
}
| [
"870314540@qq.com"
] | 870314540@qq.com |
1ab06bb98a62b5957dcf40be0bc92663eed09ded | e5d5c49de235674ba29599a5a4ee6da255195c62 | /src/ru/mai/example/NewInJava8.java | 5c674fd84daeeb0f3c5c1581de7b417a72afaaa9 | [] | no_license | KathrinBeaver/NewInJava | 392b58ac30d0358bbf3244116ebc241bd78051d8 | 8dc49541432488b5f9c21abe01426cb9e65c6c5a | refs/heads/master | 2023-05-12T12:56:03.025682 | 2021-05-29T05:12:14 | 2021-05-29T05:12:14 | 267,954,459 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,449 | java | package ru.mai.example;
import ru.mai.function.Function;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.function.Predicate;
public class NewInJava8 {
public static void example() {
/* Example 1. Default methods in interfaces */
System.out.println();
System.out.println("*** Example 1. Default methods in interfaces ***");
Function formula = new Function() {
@Override
public double calculate(int x) {
return sqrt(x) * 3;
}
};
System.out.println(formula.calculate(100)); // 300.0
System.out.println(formula.sqrt(16)); // 4.0
/* Example 2. Lambda */
System.out.println();
System.out.println("*** Example 2. Lambda ***");
List<String> names1 = Arrays.asList("Ivan", "Maria", "Anna", "Andrey", "Sergey");
// in Java 7
Collections.sort(names1, new Comparator<String>() {
@Override
public int compare(String name1, String name2) {
return name1.compareTo(name2);
}
});
System.out.println(names1);
List<String> names2 = Arrays.asList("Ivan", "Maria", "Anna", "Andrey", "Sergey");
// in Java 8
Collections.sort(names2,
(String name1, String name2) -> {
return name1.compareTo(name2);
});
Collections.sort(names2, (String name1, String name2) -> name2.compareTo(name1));
Collections.sort(names2, (name1, name2) -> name2.compareTo(name1));
System.out.println(names2);
/* Example 3. Methods as lambda */
System.out.println();
System.out.println("*** Example 3. Methods as lambda ***");
Set<String> set1 = new HashSet<String>();
Set<String> set2 = new HashSet<String>();
try {
// in Java 8
Files.lines(Paths.get("test.txt"), StandardCharsets.UTF_8)
.forEach(set1::add);
// in Java 7
List<String> words = Files.readAllLines(Paths.get("test.txt"), StandardCharsets.UTF_8);
for (String word : words) {
set2.add(word);
}
} catch (IOException e) {
System.out.println("Error of read second file: " + e.getMessage());
}
// for(String word: set1){
// System.out.println(word);
// }
set1.stream().forEach(System.out::println);
set2.stream().forEach(System.out::println);
/* Example 4. Standard functional interfaces. Predicates */
System.out.println();
System.out.println("*** Example 4. Standard functional interfaces. Predicates ***");
List<String> names3 = new ArrayList<>();
names3.add("Ivan");
names3.add("Maria");
names3.add("Anna");
names3.add("Andrey");
names3.add("Sergey");
// lambda
names3.removeIf(name -> {
return name.equals("Ivan");
});
// Predicates
Predicate<String> pred1 = name -> "Maria".equals(name);
Predicate<String> pred2 = name -> "Ivan".equals(name);
names3.removeIf(pred1.or(pred2));
names3.stream().forEach(System.out::println);
/* Example 5. Optional */
System.out.println();
System.out.println("*** Example 5. Optional ***");
Optional<String> optional = Optional.of("test");
System.out.println(optional.isPresent()); // true
System.out.println(optional.get()); // "test"
optional.ifPresent((s) -> System.out.println(s.charAt(0))); // "t"
optional = Optional.empty();
// System.out.println(optional.get()); // java.util.NoSuchElementException: No value present
/* Example 6. Streams */
System.out.println();
System.out.println("*** Example 6. Streams ***");
List<String> names4 = Arrays.asList("Ivan", "Maria", "Anna", "Andrey", "Sergey", "Zorro");
// Filter
names4.stream()
.filter(s -> s.startsWith("A"))
.forEach(System.out::println);
// Sorted & Filter
names4.stream()
.sorted()
.filter((s) -> s.startsWith("A"))
.forEach(System.out::println);
// Map
names4.stream()
.sorted()
.map(String::toUpperCase)
.forEach(System.out::println);
// Matches
boolean notStartsWithZ = names4
.stream()
.noneMatch((s) -> s.startsWith("Z"));
System.out.println(notStartsWithZ); // true
boolean startsWithZ = names4
.stream()
.anyMatch((s) -> s.startsWith("Z"));
System.out.println(startsWithZ); // true
boolean startsWithA = names4
.stream()
.anyMatch((s) -> s.startsWith("A"));
System.out.println(startsWithA); // true
boolean allStartsWithA = names4
.stream()
.allMatch((s) -> s.startsWith("A"));
System.out.println(allStartsWithA); // true
// Count
long count = names4.stream()
.sorted()
.filter((s) -> s.startsWith("A"))
.map(String::toUpperCase)
.count();
System.out.println(count);
// Reduce
Optional<String> reduced = names4.stream()
.sorted()
.map(String::toUpperCase)
.reduce((s1, s2) ->
s1 + " - " + s2);
reduced.ifPresent(System.out::println);
}
/*
*** Example 1. Default methods in interfaces ***
300.0
4.0
*** Example 2. Lambda ***
[Andrey, Anna, Ivan, Maria, Sergey]
[Andrey, Anna, Ivan, Maria, Sergey]
*** Example 3. Methods as lambda ***
арбуз
новое слово
слова
диван
арбуз
новое слово
слова
диван
*** Example 4. Standard functional interfaces. Predicates ***
Anna
Andrey
Sergey
*** Example 5. Optional ***
true
test
t
*** Example 6. Streams ***
Anna
Andrey
Andrey
Anna
ANDREY
ANNA
IVAN
MARIA
SERGEY
true
false
true
false
2
ANDREY - ANNA - IVAN - MARIA - SERGEY
*/
}
| [
"kathrin.beaver@mail.ru"
] | kathrin.beaver@mail.ru |
46d5cc0062a3adc81ae54c776439e9ada7780da6 | fddcd7a8ee584df9c2ec897a32da0445be13f8a0 | /src/taomp/sharedObject.java | 77597e9cfb2baebdea80049673452088e379bdf0 | [] | no_license | Anydea/taomp | ff66919ba0eb63ed1079fa54c244724c57b78ca5 | 099464a83cc15355eae16f3d8f0bcd8106ab82ff | refs/heads/master | 2020-05-20T11:01:49.326869 | 2015-08-19T16:23:12 | 2015-08-19T16:23:12 | 40,962,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package taomp;
import taomp.util.Counter;
public class sharedObject {
Counter counter = new Counter(1);
public void primePrint(int range) {
long i = 0;
long limit = range;
while( i< limit){
i = counter.getAndIncrement();
if(isPrime(i))
System.out.println(i);
}
}
public boolean isPrime(long val){
return true;
}
}
| [
"chzhen.wu@hotmail.com"
] | chzhen.wu@hotmail.com |
7b3a71afa499c44cddb824139a679c50b1e6b6a6 | 49dab7bbffcebe53329e1aee76c230d2396babf2 | /server/OS/net/violet/platform/dataobjects/NewsData.java | fb1555816f02254c1ea46409b9df1a71e78f6d9a | [
"MIT"
] | permissive | bxbxbx/nabaztag-source-code | 42870b0e91cf794728a20378e706c338ecedb7ba | 65197ea668e40fadb35d8ebd0aeb512311f9f547 | refs/heads/master | 2021-05-29T07:06:19.794006 | 2015-08-06T16:08:30 | 2015-08-06T16:08:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,628 | java | package net.violet.platform.dataobjects;
import java.lang.reflect.InvocationTargetException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import net.violet.platform.datamodel.Files;
import net.violet.platform.datamodel.Lang;
import net.violet.platform.datamodel.News;
import net.violet.platform.datamodel.Product;
import net.violet.platform.datamodel.factories.Factories;
import org.apache.log4j.Logger;
public class NewsData extends APIData<News> {
private static final Logger LOGGER = Logger.getLogger(NewsData.class);
public static NewsData getData(News inNews) {
try {
return RecordData.getData(inNews, NewsData.class, News.class);
} catch (final InstantiationException e) {
NewsData.LOGGER.fatal(e, e);
} catch (final IllegalAccessException e) {
NewsData.LOGGER.fatal(e, e);
} catch (final InvocationTargetException e) {
NewsData.LOGGER.fatal(e, e);
} catch (final NoSuchMethodException e) {
NewsData.LOGGER.fatal(e, e);
}
return null;
}
public static List<NewsData> findByLangAndProduct(Lang inLang, Product inProduct, int skip, int count) {
return NewsData.generateList(Factories.NEWS.getNewsByLangAndProduct(inLang, inProduct, skip, count));
}
private static List<NewsData> generateList(List<News> inList) {
final List<NewsData> result = new ArrayList<NewsData>();
for (final News aNews : inList) {
result.add(NewsData.getData(aNews));
}
return result;
}
protected NewsData(News inRecord) {
super(inRecord);
}
public String getTitle() {
final News thePieceOfNews = getRecord();
if ((thePieceOfNews != null) && (thePieceOfNews.getTitle() != null)) {
return thePieceOfNews.getTitle();
}
return net.violet.common.StringShop.EMPTY_STRING;
}
public String getProduct() {
final News thePieceOfNews = getRecord();
if ((thePieceOfNews != null) && (thePieceOfNews.getNewsProduct() != null)) {
return thePieceOfNews.getNewsProduct().getName();
}
return net.violet.common.StringShop.EMPTY_STRING;
}
public String getLanguage() {
final News thePieceOfNews = getRecord();
if ((thePieceOfNews != null) && (thePieceOfNews.getNewsLang() != null)) {
return thePieceOfNews.getNewsLang().getTitle();
}
return net.violet.common.StringShop.EMPTY_STRING;
}
public String getPictureBig() {
final News thePieceOfNews = getRecord();
if ((thePieceOfNews != null) && (thePieceOfNews.getPicture_b() != null)) {
return thePieceOfNews.getPicture_b().getPath();
}
return net.violet.common.StringShop.EMPTY_STRING;
}
public String getPictureSmall() {
final News thePieceOfNews = getRecord();
if ((thePieceOfNews != null) && (thePieceOfNews.getPicture_s() != null)) {
return thePieceOfNews.getPicture_s().getPath();
}
return net.violet.common.StringShop.EMPTY_STRING;
}
public String getIntro() {
final News thePieceOfNews = getRecord();
if ((thePieceOfNews != null) && (thePieceOfNews.getIntro() != null)) {
return thePieceOfNews.getIntro();
}
return net.violet.common.StringShop.EMPTY_STRING;
}
public String getBody() {
final News thePieceOfNews = getRecord();
if ((thePieceOfNews != null) && (thePieceOfNews.getBody() != null)) {
return thePieceOfNews.getBody();
}
return net.violet.common.StringShop.EMPTY_STRING;
}
public String getAbstract() {
final News thePieceOfNews = getRecord();
if ((thePieceOfNews != null) && (thePieceOfNews.getAbstract() != null)) {
return thePieceOfNews.getAbstract();
}
return net.violet.common.StringShop.EMPTY_STRING;
}
public Timestamp getDatePub() {
final News thePieceOfNews = getRecord();
if (thePieceOfNews != null) {
return thePieceOfNews.getDatePub();
}
return null;
}
public Timestamp getDateExp() {
final News thePieceOfNews = getRecord();
if (thePieceOfNews != null) {
return thePieceOfNews.getDateExp();
}
return null;
}
public static NewsData findByAPIId(String inAPIId, String inAPIKey) {
NewsData theResult = null;
final long theID = APIData.fromObjectID(inAPIId, ObjectClass.NEWS, inAPIKey);
if (theID != 0) {
final News news = Factories.NEWS.find(theID);
if (news != null) {
theResult = NewsData.getData(news);
}
}
return theResult;
}
@Override
protected ObjectClass getObjectClass() {
return ObjectClass.NEWS;
}
public static NewsData create(SiteLangData theLang, String inTitle, String inAbstract, FilesData inBigData, FilesData inSmallData, String inIntro, String inBody, Date inDatePub, Date inDateExp, ProductData inProduct) {
Files inBig = null;
Files inSmall = null;
if (inBigData != null) {
inBig = inBigData.getReference();
}
if (inSmallData != null) {
inSmall = inSmallData.getReference();
}
final News theNews = Factories.NEWS.create(theLang.getRecord(), inTitle, inAbstract, inSmall, inBig, inIntro, inBody, inDatePub, inDateExp, inProduct.getRecord());
if (theNews != null) {
return NewsData.getData(theNews);
}
return NewsData.getData(null);
}
public void update(SiteLangData inLang, String inTitle, String inAbstract, FilesData inBigData, FilesData inSmallData, String inIntro, String inBody, Date inDatePub, Date inDateExp, ProductData inProduct) {
final News theNews = this.getRecord();
Files inBig = null;
if (inBigData != null) {
inBig = inBigData.getReference();
}
Files inSmall = null;
if (inSmallData != null) {
inSmall = inSmallData.getReference();
}
if (theNews != null) {
theNews.update(inLang.getReference(), inTitle, inAbstract, inBig, inSmall, inIntro, inBody, inDatePub, inDateExp, inProduct.getReference());
}
}
}
| [
"sebastien@yoozio.com"
] | sebastien@yoozio.com |
25891936024995f0fad2d4bf25977eea76802bcc | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/haifengl--smile/a3fa23bb11330250810cfd19869050240b67a17e/after/PPCA.java | af094765ea3d39916b295f204fa6c3adcb6c2482 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,495 | java | /*******************************************************************************
* Copyright (c) 2010 Haifeng Li
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package smile.projection;
import java.io.Serializable;
import smile.math.Math;
import smile.math.matrix.ColumnMajorMatrix;
import smile.math.matrix.DenseMatrix;
import smile.math.matrix.EigenValueDecomposition;
import smile.math.matrix.LUDecomposition;
/**
* Probabilistic principal component analysis. PPCA is a simplified factor analysis
* that employs a latent variable model with linear relationship:
* <pre>
* y ∼ W * x + μ + ε
* </pre>
* where latent variables x ∼ N(0, I), error (or noise) ε ∼ N(0, Ψ),
* and μ is the location term (mean). In PPCA, an isotropic noise model is used,
* i.e., noise variances constrained to be equal (Ψ<sub>i</sub> = σ<sup>2</sup>).
* A close form of estimation of above parameters can be obtained
* by maximum likelihood method.
*
* <h2>References</h2>
* <ol>
* <li>Michael E. Tipping and Christopher M. Bishop. Probabilistic Principal Component Analysis. Journal of the Royal Statistical Society. Series B (Statistical Methodology) 61(3):611-622, 1999. </li>
* </ol>
*
* @see PCA
*
* @author Haifeng Li
*/
public class PPCA implements Projection<double[]>, Serializable {
private static final long serialVersionUID = 1L;
/**
* The sample mean.
*/
private double[] mu;
/**
* The projected sample mean.
*/
private double[] pmu;
/**
* The variance of noise part.
*/
private double noise;
/**
* Loading matrix.
*/
private DenseMatrix loading;
/**
* Projection matrix.
*/
private DenseMatrix projection;
/**
* Returns the variable loading matrix, ordered from largest to smallest
* by corresponding eigenvalues.
*/
public DenseMatrix getLoadings() {
return loading;
}
/**
* Returns the center of data.
*/
public double[] getCenter() {
return mu;
}
/**
* Returns the variance of noise.
*/
public double getNoiseVariance() {
return noise;
}
/**
* Returns the projection matrix. Note that this is not the matrix W in the
* latent model.
*/
public DenseMatrix getProjection() {
return projection;
}
@Override
public double[] project(double[] x) {
if (x.length != mu.length) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, mu.length));
}
double[] y = new double[projection.nrows()];
projection.ax(x, y);
Math.minus(y, pmu);
return y;
}
@Override
public double[][] project(double[][] x) {
if (x[0].length != mu.length) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x[0].length, mu.length));
}
double[][] y = new double[x.length][projection.nrows()];
for (int i = 0; i < x.length; i++) {
projection.ax(x[i], y[i]);
Math.minus(y[i], pmu);
}
return y;
}
/**
* Constructor. Learn probabilistic principal component analysis.
* @param data training data of which each row is a sample.
* @param k the number of principal component to learn.
*/
public PPCA(double[][] data, int k) {
int m = data.length;
int n = data[0].length;
mu = Math.colMean(data);
DenseMatrix cov = new ColumnMajorMatrix(n, n);
for (int l = 0; l < m; l++) {
for (int i = 0; i < n; i++) {
for (int j = 0; j <= i; j++) {
cov.add(i, j, (data[l][i] - mu[i]) * (data[l][j] - mu[j]));
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j <= i; j++) {
cov.div(i, j, m);
cov.set(j, i, cov.get(i, j));
}
}
EigenValueDecomposition eigen = new EigenValueDecomposition(cov);
double[] evalues = eigen.getEigenValues();
DenseMatrix evectors = eigen.getEigenVectors();
noise = 0.0;
for (int i = k; i < n; i++) {
noise += evalues[i];
}
noise /= (n - k);
loading = new ColumnMajorMatrix(n, k);
for (int i = 0; i < n; i++) {
for (int j = 0; j < k; j++) {
loading.set(i, j, evectors.get(i, j) * Math.sqrt(evalues[j] - noise));
}
}
DenseMatrix M = loading.ata();
for (int i = 0; i < k; i++) {
M.add(i, i, noise);
}
DenseMatrix Mi = M.inverse();
projection = Mi.abtmm(loading);
pmu = new double[projection.nrows()];
projection.ax(mu, pmu);
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
8303c69c5786fd7eff181d544b09aab4fff6a19b | 92f1ae040566206150fa39a455578e4790c35318 | /kodilla-patterns/src/main/java/com/kodilla/patterns/prototype/library/Book.java | 234ea8e3509a04898e16296894e8470d22b9dc81 | [] | no_license | BfDmichal/michal-przyborowski-kodilla-java | a8da7df853d25966fa2e85681e4d2e1107bd9c9d | 966f84fe07c3f0567106ee65d069ee7b80077a42 | refs/heads/master | 2020-05-03T10:33:07.309385 | 2019-11-08T18:09:37 | 2019-11-08T18:09:37 | 178,582,014 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 872 | java | package com.kodilla.patterns.prototype.library;
import java.time.LocalDate;
public final class Book {
private final String title;
private final String author;
private final LocalDate publicationDate;
public Book(final String title, final String author, final LocalDate publicationDate) {
this.title = title;
this.author = author;
this.publicationDate = publicationDate;
}
public String getTitle() {
return title;
}
public String getAuthor() {
return author;
}
public LocalDate getPublicationDate() {
return publicationDate;
}
@Override
public String toString() {
return "Book{" +
"title='" + title + '\'' +
", author='" + author + '\'' +
", publicationDate=" + publicationDate +
'}';
}
}
| [
"michal.przyborowski@o2.pl"
] | michal.przyborowski@o2.pl |
897f3c13ea078640153bd25d9a1700761e216ed5 | 523dc2f50df667f86d25f33c4e8441336f73ba21 | /src/test/java/com/Guru99/testcases/LoginPageTestCases.java | 5f188e6d6ec224338d4d9b98bade92af9c8716a8 | [] | no_license | kundanbhat/Guru | 8fcfebe03f01d21dfddea0ba7fece065d9d96550 | c28a2d50e2a77bf51f6cbed616184994b447c1d2 | refs/heads/master | 2020-04-01T02:53:26.025732 | 2018-10-13T03:39:33 | 2018-10-13T03:39:33 | 152,797,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,113 | java | package com.Guru99.testcases;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.Guru99.base.TestBase;
import com.Guru99.pages.LoginPage;
import com.Guru99.pages.ManagerPage;
public class LoginPageTestCases extends TestBase{
LoginPage loginPage;
ManagerPage managerPage;
public LoginPageTestCases() {
super();
}
@BeforeMethod
public void setUp()
{
initialization();
loginPage=new LoginPage();
}
@Test
public void LoginPageTitleTest()
{
String title= loginPage.validateTitle();
Assert.assertEquals(title.trim(), "Guru99 Bank Home Page");
}
@Test
public void LoginPageLogoTest()
{
boolean isDisplayed= loginPage.verifyLogoImage();
Assert.assertEquals(isDisplayed, true);
}
@Test
public void LoginPageLoginTest() throws InterruptedException
{
managerPage=loginPage.login(prop.getProperty("username"), prop.getProperty("password"));
}
@AfterMethod
public void tearDown()
{
driver.quit();
}
}
| [
"admin@BQ-DEV-CN03"
] | admin@BQ-DEV-CN03 |
7d58d37db2ec370d9ac942b52eaa0e506580cc42 | 1de8a36d13aa9b792c1980aed9677ae9935bead7 | /powerfin/src/com/powerfin/actions/transaction/TXConversionItemSaveAction.java | 735aa07fb661c9cdc3f8509c781ce08912a8baac | [] | no_license | ochiengisaac/sss | f5b55e53252305b97797edfb68cbcea84d4aa65a | 471c8d5f5373a2b49dde805d7f518dbcbc42014c | refs/heads/master | 2022-02-26T00:57:25.794122 | 2019-05-31T22:22:02 | 2019-05-31T22:22:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | package com.powerfin.actions.transaction;
import java.util.List;
import org.openxava.jpa.XPersistence;
import com.powerfin.helper.AccountInvoiceHelper;
import com.powerfin.model.Transaction;
import com.powerfin.model.TransactionAccount;
public class TXConversionItemSaveAction extends TXSaveAction {
public void extraValidations() throws Exception {}
@SuppressWarnings("unchecked")
public List<TransactionAccount> getTransactionAccounts(Transaction transaction) throws Exception
{
return XPersistence.getManager().createQuery("SELECT ta FROM TransactionAccount ta "
+ "WHERE ta.transaction.transactionId = :transactionId ")
.setParameter("transactionId", transaction.getTransactionId())
.getResultList();
}
public void postSaveAction(Transaction transaction) throws Exception
{
AccountInvoiceHelper.postTransferItemSaveAction(transaction);
}
}
| [
"pvalarezo@grisbi.com.ec"
] | pvalarezo@grisbi.com.ec |
ee5562270ff49e6c8d21f6c8ddd558d1b231d13e | 8f5a7680d0e65a01e9083466171880a2fd5500a4 | /bem_web/src/main/java/com/auchan/bem/bem_web/controller/AuthorizeController.java | 8569e1f3658841f6b18cdd97b79727aeb6a7eeb0 | [] | no_license | shlly/bem | bf6d2884177286e93c49e16539c61562a776b78f | 4fd7c8e0631d2eabc3f7c6a3aca38efbe4bb0bc2 | refs/heads/master | 2021-01-10T03:50:52.735034 | 2016-04-01T06:33:10 | 2016-04-01T06:33:10 | 55,209,180 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,759 | java | package com.auchan.bem.bem_web.controller;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.auchan.bem.bem_dao.LdapDAO;
import com.auchan.bem.bem_pojo.entity.UserRole;
import com.auchan.bem.bem_service.AuthorizeService;
import net.sf.json.JSONArray;
/**
* 权限管理controller
*
* @url /auth
* @date 2016-03-24
* @author 郑冉
*
*/
@Controller
@RequestMapping("auth")
public class AuthorizeController {
@Resource
AuthorizeService authorizeService;
/**
* 获取角色
*
* @url /auth/getRoles
* @method get/post
* @return json 角色列表
* @date 2016-03-28
*/
@RequestMapping("getRoles")
@ResponseBody
public String getRoles() {
return JSONArray.fromObject(authorizeService.getRole()).toString();
}
/**
* 获取功能
*
* @url /auth/getFunctions
* @method get/post
* @return json 功能列表
* @date 2016-03-28
*/
@RequestMapping("getFunctions")
@ResponseBody
public String getFunctions() {
return JSONArray.fromObject(authorizeService.getFunction()).toString();
}
/**
* 获取所有用户名
*
* @url /auth/getUserName
* @method get/post
* @param uid 用户名
* @return json 用户名列表
* @date 2016-03-24
*/
@RequestMapping("getUserName")
@ResponseBody
public String getUserName(String uid) throws Exception {
return JSONArray.fromObject(LdapDAO.getLdapDAO().searchUid("*" + uid + "*", 10)).toString();
}
/**
* 获取用户-权限
*
* @url /auth/getUserRole
* @method get/post
* @return json 用户-权限列表
* @date 2016-03-28
*/
@RequestMapping("getUserRole")
@ResponseBody
public String getUserRole() {
return JSONArray.fromObject(authorizeService.getUserRole()).toString();
}
/**
* 删除用户-权限
*
* @url /auth/delAuth
* @method post
* @param id 用户-权限id
* @return boolean 是否成功
* @date 2016-03-28
*/
@RequestMapping(value="delAuth", method=RequestMethod.POST)
@ResponseBody
public boolean delAuth(Integer id) {
return authorizeService.delAuth(id);
}
/**
* 添加用户-权限
*
* @url /auth/addAuth
* @method post
* @param username 用户名
* @param roleId 角色id
* @return Integer 用户-权限id
* @date 2016-03-28
*/
@RequestMapping(value="addAuth", method=RequestMethod.POST)
@ResponseBody
public Integer addAuth(String username, Short roleId) throws Exception {
UserRole userRole = authorizeService.addUserRole(username, roleId);
if (userRole == null)
return null;
else
return userRole.getId();
}
}
| [
"542098493@qq.com"
] | 542098493@qq.com |
2741413a8fdc07e826be951341234989ad2e33a4 | cf1aa422cccb71f0e54308f3ed7d9f3940ff96c8 | /src/main/java/com/zss/service/email/MailSenderService.java | 02065427bb32b2ae4bb064cfa2bd6561a278b377 | [
"Apache-2.0"
] | permissive | qhrking/zss | 49af9b358066d067d585e95e6a8dddfcb51eb2c7 | 8f338ec49c431c4bc2bcdf2a13b9843490075f3b | refs/heads/master | 2021-08-22T07:37:43.643355 | 2017-11-29T16:51:32 | 2017-11-29T16:51:32 | 112,499,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,548 | java | package com.zss.service.email;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import com.zss.core.Constants;
import com.zss.service.vo.MailVO;
import com.zss.web.backend.form.MailOption;
/**
* 邮件发送服务
*
* @author zhou
*
*/
@Service
public class MailSenderService{
private static final Logger logger = LoggerFactory.getLogger(MailSenderService.class);
private JavaMailSenderImpl sender = new JavaMailSenderImpl();
private boolean init = false;
public void setServerInfo(MailOption form){
sender.setHost(form.getHost());
sender.setPort(form.getPort());
sender.setUsername(form.getUsername());
sender.setPassword(form.getPassword());
init = true;
}
/**
* 发送邮件
*
* @param mail
*/
public void sendMail(MailVO mail){
if(!init)
return;
MimeMessage message = sender.createMimeMessage();
try{
MimeMessageHelper helper = new MimeMessageHelper(message, true, Constants.ENCODING_UTF_8.name());
helper.setFrom(mail.getFrom());
helper.setTo(mail.getTo().toArray(new String[]{}));
helper.setSubject(mail.getSubject());
helper.setText(mail.getContent(), true);
sender.send(message);
}catch(MessagingException e){
logger.error("send mail error", e);
}
}
}
| [
"qhrking@163.com"
] | qhrking@163.com |
a0873f363bc01f2e9a43c93d656dc3ed794c19ae | b7e6c469f45ed63d713b7e7020474dfb9ec026a7 | /src/com/lianmeng/extand/lianmeng/discover/net/NetAsyncTask.java | eedfcabb637eeb34caf5493d936966d3e0403cc0 | [] | no_license | Georgekaren/LMTrade_Android_SVN | bd5ead32c0a0f651bdc7dc4cc0158404aa7538bc | 38d76fcdfb3c781869cd525a8e837b599c0b0353 | refs/heads/master | 2021-01-10T17:31:37.042850 | 2016-03-23T02:53:47 | 2016-03-23T02:53:47 | 48,981,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,604 | java | package com.lianmeng.extand.lianmeng.discover.net;
import com.lianmeng.core.activity.R;
import com.lianmeng.extand.lianmeng.discover.utils.AppLog;
import com.lianmeng.extand.lianmeng.discover.utils.AppManager;
import android.os.AsyncTask;
import android.os.Handler;
/**
* AsyncTask 使用线程池控制线程数量,提高线程利用率 提供统一的网络访问接口 Response 提供Loading时的Dialog
* 提供网络资源的清除 提供默认的Exception处理 运行环境 Android 1.6 TargetID >= 4
*
* @author lanyj
*/
public abstract class NetAsyncTask extends AsyncTask<String, Integer, String> {
private static final String TAG = "NetThread";
public static final String HANDLE_SUCCESS = "0";
public static final String HANDLE_FAILED = "1";
private int dialogId=0; //默认的预处理
public int getDialogId() {
return dialogId;
}
public void setDialogId(int dialogId) {
this.dialogId = dialogId;
}
public NetAsyncTask(){}
public NetAsyncTask(Handler uiHandler){
this.uiHandler = uiHandler;
}
public NetAsyncTask(Handler uiHandler,int id){
this.uiHandler = uiHandler;
}
public Handler uiHandler; // 向Activity反馈相关UI更新
public void setUiHandler(Handler uiHandler) {
this.uiHandler = uiHandler;
}
public HttpTask httptask;
/**
* 自定义预处理信息
*/
abstract protected void handlePreExecute();
/**
* 相当于线程中的run函数,在线程中运行比较耗时的动作,比如访问网络,解析等
* @param arg0
* @return
* @throws Exception
*/
abstract protected String handleNetworkProcess(String... arg0) throws Exception;
/**
* 对返回结果的处理
*/
abstract protected void handleResult();
/**
* 网络请求前的预处理
*/
@Override
protected void onPreExecute() {
//设置使用哪种进度条
//1是默认,弹出框等待,2是重写handlePreExecute,进行自定义;其他均为不显示
showDialog(dialogId);
}
@Override
protected String doInBackground(String... arg0) {
String result = null;
try {
httptask=new HttpTask(uiHandler);
result = handleNetworkProcess(arg0);
} catch (Exception e) {
result = null;
AppLog.d(TAG, e.getMessage());
} finally {
//closeConnection();
}
return result;
}
@Override
protected void onPostExecute(String result) {
if ("0".equals(result)) {
handleResult();
}else if("1".equals(result)){
//没有的得到数据
//new Exception("网络异常!");
handleResult();
}else {
new Exception("网络异常!");
handleResult();
}
dismissDialog(getDialogId());
}
/**
* 显示进度
* @param dialogId
*/
private void showDialog(int dialogId) {
switch (dialogId) {
case 1:
AppManager.updateUI(uiHandler, R.id.ui_show_dialog, R.id.dialog_waiting);
break;
case 2:
handlePreExecute();
break;
default:
break;
}
}
/**
* 取消进度显示
* @param dialogId
*/
private void dismissDialog(int dialogId) {
switch (dialogId) {
case 1:
AppManager.updateUI(uiHandler, R.id.ui_dismiss_dialog, R.id.dialog_waiting);
break;
default:
break;
}
}
/**
* Positive close the running AsyncTask
* @param asyncTask
*/
public static void closeTask(final AsyncTask<?, ?, ?> asyncTask) {
if (taskIsRunning(asyncTask)) {
asyncTask.cancel(true);
}
}
public static boolean taskIsRunning(final AsyncTask<?, ?, ?> asyncTask) {
if (asyncTask != null&& (asyncTask.getStatus() == AsyncTask.Status.RUNNING)) {
return true;
} else {
return false;
}
}
}
| [
"ad181600@qq.com"
] | ad181600@qq.com |
6f9b7d4e96cc0125d35332659754edb95b330ccd | 438848e2801d5f29f9cdb53cab55775e9d479a53 | /aimlchimbs/src/org/alicebot/server/core/targeting/TargetsReaderListener.java | 733f48a7a1f7fe00dbd553d6b329edc768de307d | [] | no_license | summyfeb12/introtoai | 099b9aac2ef4f666e2cae98eb4e87d6d94dbb108 | efb3dcfbb01e33c60c6f078f4950923713cf0385 | refs/heads/master | 2016-08-08T11:31:45.358045 | 2012-12-03T18:12:07 | 2012-12-03T18:12:07 | 41,951,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,667 | java | /*
Alicebot Program D
Copyright (C) 1995-2001, A.L.I.C.E. AI Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
*/
package org.alicebot.server.core.targeting;
import java.util.HashMap;
import org.alicebot.server.core.parser.GenericReaderListener;
/**
* Reads in new targets to a given Targets object.
* This version is based on {@link org.alicebot.server.core.loader.AIMLLoader}.
* Obviously this and its companion {@link TargetsReaderListener}
* duplicate a lot from AIMLReader and AIMLLoader,
* so once this is stabilized these should all be combined.
*
* @author Noel Bush
*/
public class TargetsReaderListener implements GenericReaderListener
{
/** The set in which to load the targets. */
private static HashMap set;
/**
* Loads a target into {@link TargetMaster}.
*
* @param matchPattern the <code>pattern</code> part of the matched path
* @param matchThat the <code>that</code> part of the matched path
* @param matchTopic the <code>topic</code> part of the matched path
* @param matchTemplate the <code>template</code> associated with the matched path
* @param inputText the input text that was matched
* @param inputThat the value of the <code>that</code> predicate when the input was received
* @param inputTopic the value of the <code>topic</code> predicate when the input was received
* @param reply the reply from the bot
*/
public void loadTarget(String matchPattern, String matchThat, String matchTopic, String matchTemplate,
String inputText, String inputThat, String inputTopic, String reply)
{
// Add new target to TargetingTool.
TargetingTool.add(new Target(matchPattern, matchThat, matchTopic, matchTemplate,
inputText, inputThat, inputTopic, reply),
this.set);
}
/**
* Initializes a TargetsReaderListener with the set
* in which to load the given targets.
*
* @param set the set in which to load the targets
*/
public TargetsReaderListener(HashMap set)
{
this.set = set;
}
}
| [
"gaurav.raje07@gmail.com"
] | gaurav.raje07@gmail.com |
62bf8fae7b175db03827588f3f597303a2330d26 | 11b9a30ada6672f428c8292937dec7ce9f35c71b | /src/main/java/java/lang/invoke/CallSite.java | f462fd68d4d99b551ce6a1097a5c86b74b43ddb3 | [] | no_license | bogle-zhao/jdk8 | 5b0a3978526723b3952a0c5d7221a3686039910b | 8a66f021a824acfb48962721a20d27553523350d | refs/heads/master | 2022-12-13T10:44:17.426522 | 2020-09-27T13:37:00 | 2020-09-27T13:37:00 | 299,039,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,288 | java | /***** Lobxxx Translate Finished ******/
/*
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.lang.invoke;
import sun.invoke.empty.Empty;
import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
/**
* A {@code CallSite} is a holder for a variable {@link MethodHandle},
* which is called its {@code target}.
* An {@code invokedynamic} instruction linked to a {@code CallSite} delegates
* all calls to the site's current target.
* A {@code CallSite} may be associated with several {@code invokedynamic}
* instructions, or it may be "free floating", associated with none.
* In any case, it may be invoked through an associated method handle
* called its {@linkplain #dynamicInvoker dynamic invoker}.
* <p>
* {@code CallSite} is an abstract class which does not allow
* direct subclassing by users. It has three immediate,
* concrete subclasses that may be either instantiated or subclassed.
* <ul>
* <li>If a mutable target is not required, an {@code invokedynamic} instruction
* may be permanently bound by means of a {@linkplain ConstantCallSite constant call site}.
* <li>If a mutable target is required which has volatile variable semantics,
* because updates to the target must be immediately and reliably witnessed by other threads,
* a {@linkplain VolatileCallSite volatile call site} may be used.
* <li>Otherwise, if a mutable target is required,
* a {@linkplain MutableCallSite mutable call site} may be used.
* </ul>
* <p>
* A non-constant call site may be <em>relinked</em> by changing its target.
* The new target must have the same {@linkplain MethodHandle#type() type}
* as the previous target.
* Thus, though a call site can be relinked to a series of
* successive targets, it cannot change its type.
* <p>
* Here is a sample use of call sites and bootstrap methods which links every
* dynamic call site to print its arguments:
<blockquote><pre>{@code
static void test() throws Throwable {
// THE FOLLOWING LINE IS PSEUDOCODE FOR A JVM INSTRUCTION
InvokeDynamic[#bootstrapDynamic].baz("baz arg", 2, 3.14);
}
private static void printArgs(Object... args) {
System.out.println(java.util.Arrays.deepToString(args));
}
private static final MethodHandle printArgs;
static {
MethodHandles.Lookup lookup = MethodHandles.lookup();
Class thisClass = lookup.lookupClass(); // (who am I?)
printArgs = lookup.findStatic(thisClass,
"printArgs", MethodType.methodType(void.class, Object[].class));
}
private static CallSite bootstrapDynamic(MethodHandles.Lookup caller, String name, MethodType type) {
// ignore caller and name, but match the type:
return new ConstantCallSite(printArgs.asType(type));
}
}</pre></blockquote>
* <p>
* {@code CallSite}是变量{@link MethodHandle}的持有者,称为其{@code target}。
* 与{@code CallSite}关联的{@code invokedynamic}指令会将所有调用委派给网站的当前目标。
* {@code CallSite}可能与几个{@code invokedynamic}指令相关联,或者可能是"自由浮动",与没有相关联。
* 在任何情况下,它都可以通过一个名为其{@linkplain #dynamicInvoker动态调用者}的关联方法调用。
* <p>
* {@code CallSite}是一个抽象类,不允许用户直接进行子类化。它有三个立即,具体的子类,可以实例化或子类化。
* <ul>
* <li>如果不需要可变目标,{@code invokedynamic}指令可能会通过{@linkplain ConstantCallSite常量调用网站}永久绑定。
* <li>如果需要具有volatile变量语义的可变目标,因为目标的更新必须立即可靠地被其他线程看到,可以使用{@linkplain VolatileCallSite volatile call site}
* 。
* <li>如果不需要可变目标,{@code invokedynamic}指令可能会通过{@linkplain ConstantCallSite常量调用网站}永久绑定。
* <li>否则,如果需要可变目标,则可以使用{@linkplain MutableCallSite mutable call site}。
* </ul>
* <p>
* 可以通过更改其目标来重新链接非常量调用网站。<em> </em>新目标必须具有与先前目标相同的{@linkplain MethodHandle#type()类型}。
* 因此,尽管调用点可以重新链接到一系列连续的目标,但是它不能改变其类型。
* <p>
* 下面是调用站点和引导方法的示例使用,它链接每个动态调用站点以打印其参数:<blockquote> <pre> {@ code static void test()throws Throwable {// JVM指令的下一行是PSEUDOCODE InvokeDynamic [#bootstrapDynamic] .baz("baz arg",2,3.14); }
* private static void printArgs(Object ... args){System.out.println(java.util.Arrays.deepToString(args)); }
* private static final MethodHandle printArgs; static {MethodHandles.Lookup lookup = MethodHandles.lookup(); Class thisClass = lookup.lookupClass(); //(我是谁?)printArgs = lookup.findStatic(thisClass,"printArgs",MethodType.methodType(void.class,Object []。
* } private static CallSite bootstrapDynamic(MethodHandles.Lookup caller,String name,MethodType type){//忽略调用者和名称,但匹配类型:return new ConstantCallSite(printArgs.asType(type)); }
* } </pre> </blockquote>。
*
*
* @author John Rose, JSR 292 EG
*/
abstract
public class CallSite {
static { MethodHandleImpl.initStatics(); }
// The actual payload of this call site:
/*package-private*/
MethodHandle target; // Note: This field is known to the JVM. Do not change.
/**
* Make a blank call site object with the given method type.
* An initial target method is supplied which will throw
* an {@link IllegalStateException} if called.
* <p>
* Before this {@code CallSite} object is returned from a bootstrap method,
* it is usually provided with a more useful target method,
* via a call to {@link CallSite#setTarget(MethodHandle) setTarget}.
* <p>
* 使用给定的方法类型创建一个空白的调用网站对象。提供了一个初始目标方法,如果调用它将抛出一个{@link IllegalStateException}。
* <p>
* 在通过引导方法返回此{@code CallSite}对象之前,通常通过调用{@link CallSite#setTarget(MethodHandle)setTarget}来提供更有用的目标方法。
*
*
* @throws NullPointerException if the proposed type is null
*/
/*package-private*/
CallSite(MethodType type) {
target = makeUninitializedCallSite(type);
}
/**
* Make a call site object equipped with an initial target method handle.
* <p>
* 使呼叫站点对象配备初始目标方法句柄。
*
*
* @param target the method handle which will be the initial target of the call site
* @throws NullPointerException if the proposed target is null
*/
/*package-private*/
CallSite(MethodHandle target) {
target.type(); // null check
this.target = target;
}
/**
* Make a call site object equipped with an initial target method handle.
* <p>
* 使呼叫站点对象配备初始目标方法句柄。
*
*
* @param targetType the desired type of the call site
* @param createTargetHook a hook which will bind the call site to the target method handle
* @throws WrongMethodTypeException if the hook cannot be invoked on the required arguments,
* or if the target returned by the hook is not of the given {@code targetType}
* @throws NullPointerException if the hook returns a null value
* @throws ClassCastException if the hook returns something other than a {@code MethodHandle}
* @throws Throwable anything else thrown by the hook function
*/
/*package-private*/
CallSite(MethodType targetType, MethodHandle createTargetHook) throws Throwable {
this(targetType);
ConstantCallSite selfCCS = (ConstantCallSite) this;
MethodHandle boundTarget = (MethodHandle) createTargetHook.invokeWithArguments(selfCCS);
checkTargetChange(this.target, boundTarget);
this.target = boundTarget;
}
/**
* Returns the type of this call site's target.
* Although targets may change, any call site's type is permanent, and can never change to an unequal type.
* The {@code setTarget} method enforces this invariant by refusing any new target that does
* not have the previous target's type.
* <p>
* 返回此调用网站的目标的类型。虽然目标可能会更改,但任何调用站点的类型都是永久性的,并且永远不会更改为不等的类型。
* {@code setTarget}方法通过拒绝任何没有上一个目标类型的新目标来强制执行这个不变量。
*
*
* @return the type of the current target, which is also the type of any future target
*/
public MethodType type() {
// warning: do not call getTarget here, because CCS.getTarget can throw IllegalStateException
return target.type();
}
/**
* Returns the target method of the call site, according to the
* behavior defined by this call site's specific class.
* The immediate subclasses of {@code CallSite} document the
* class-specific behaviors of this method.
*
* <p>
* 根据此调用网站的特定类定义的行为,返回调用网站的目标方法。 {@code CallSite}的直接子类记录了此方法的特定于类的行为。
*
*
* @return the current linkage state of the call site, its target method handle
* @see ConstantCallSite
* @see VolatileCallSite
* @see #setTarget
* @see ConstantCallSite#getTarget
* @see MutableCallSite#getTarget
* @see VolatileCallSite#getTarget
*/
public abstract MethodHandle getTarget();
/**
* Updates the target method of this call site, according to the
* behavior defined by this call site's specific class.
* The immediate subclasses of {@code CallSite} document the
* class-specific behaviors of this method.
* <p>
* The type of the new target must be {@linkplain MethodType#equals equal to}
* the type of the old target.
*
* <p>
* 根据此调用网站的特定类定义的行为更新此调用网站的目标方法。 {@code CallSite}的直接子类记录了此方法的特定于类的行为。
* <p>
* 新目标的类型必须是{@linkplain MethodType#等于}旧目标的类型。
*
*
* @param newTarget the new target
* @throws NullPointerException if the proposed new target is null
* @throws WrongMethodTypeException if the proposed new target
* has a method type that differs from the previous target
* @see CallSite#getTarget
* @see ConstantCallSite#setTarget
* @see MutableCallSite#setTarget
* @see VolatileCallSite#setTarget
*/
public abstract void setTarget(MethodHandle newTarget);
void checkTargetChange(MethodHandle oldTarget, MethodHandle newTarget) {
MethodType oldType = oldTarget.type();
MethodType newType = newTarget.type(); // null check!
if (!newType.equals(oldType))
throw wrongTargetType(newTarget, oldType);
}
private static WrongMethodTypeException wrongTargetType(MethodHandle target, MethodType type) {
return new WrongMethodTypeException(String.valueOf(target)+" should be of type "+type);
}
/**
* Produces a method handle equivalent to an invokedynamic instruction
* which has been linked to this call site.
* <p>
* This method is equivalent to the following code:
* <blockquote><pre>{@code
* MethodHandle getTarget, invoker, result;
* getTarget = MethodHandles.publicLookup().bind(this, "getTarget", MethodType.methodType(MethodHandle.class));
* invoker = MethodHandles.exactInvoker(this.type());
* result = MethodHandles.foldArguments(invoker, getTarget)
* }</pre></blockquote>
*
* <p>
* 生成与已调用的动态指令等价的方法句柄,该指令已链接到此调用站点。
* <p>
* 这个方法相当于下面的代码:<blockquote> <pre> {@ code MethodHandle getTarget,invoker,result; getTarget = MethodHandles.publicLookup()。
* bind(this,"getTarget",MethodType.methodType(MethodHandle.class)); invoker = MethodHandles.exactInvoke
* r(this.type()); result = MethodHandles.foldArguments(invoker,getTarget)} </pre> </blockquote>。
*
*
* @return a method handle which always invokes this call site's current target
*/
public abstract MethodHandle dynamicInvoker();
/*non-public*/ MethodHandle makeDynamicInvoker() {
MethodHandle getTarget = GET_TARGET.bindArgumentL(0, this);
MethodHandle invoker = MethodHandles.exactInvoker(this.type());
return MethodHandles.foldArguments(invoker, getTarget);
}
private static final MethodHandle GET_TARGET;
private static final MethodHandle THROW_UCS;
static {
try {
GET_TARGET = IMPL_LOOKUP.
findVirtual(CallSite.class, "getTarget", MethodType.methodType(MethodHandle.class));
THROW_UCS = IMPL_LOOKUP.
findStatic(CallSite.class, "uninitializedCallSite", MethodType.methodType(Object.class, Object[].class));
} catch (ReflectiveOperationException e) {
throw newInternalError(e);
}
}
/* <p>
/* MethodHandle getTarget = GET_TARGET.bindArgumentL(0,this); MethodHandle invoker = MethodHandles.exac
/* tInvoker(this.type()); return MethodHandles.foldArguments(invoker,getTarget); }}。
/*
/* private static final MethodHandle GET_TARGET; private static final MethodHandle THROW_UCS; static {try {GET_TARGET = IMPL_LOOKUP。
/* findVirtual(CallSite.class,"getTarget",MethodType.methodType(MethodHandle.class)); THROW_UCS = IMPL_
/*
/** This guy is rolled into the default target if a MethodType is supplied to the constructor. */
private static Object uninitializedCallSite(Object... ignore) {
throw new IllegalStateException("uninitialized call site");
}
private MethodHandle makeUninitializedCallSite(MethodType targetType) {
MethodType basicType = targetType.basicType();
MethodHandle invoker = basicType.form().cachedMethodHandle(MethodTypeForm.MH_UNINIT_CS);
if (invoker == null) {
invoker = THROW_UCS.asType(basicType);
invoker = basicType.form().setCachedMethodHandle(MethodTypeForm.MH_UNINIT_CS, invoker);
}
// unchecked view is OK since no values will be received or returned
return invoker.viewAsType(targetType, false);
}
// unsafe stuff:
private static final long TARGET_OFFSET;
static {
try {
TARGET_OFFSET = UNSAFE.objectFieldOffset(CallSite.class.getDeclaredField("target"));
} catch (Exception ex) { throw new Error(ex); }
}
/*package-private*/
void setTargetNormal(MethodHandle newTarget) {
MethodHandleNatives.setCallSiteTargetNormal(this, newTarget);
}
/*package-private*/
MethodHandle getTargetVolatile() {
return (MethodHandle) UNSAFE.getObjectVolatile(this, TARGET_OFFSET);
}
/*package-private*/
void setTargetVolatile(MethodHandle newTarget) {
MethodHandleNatives.setCallSiteTargetVolatile(this, newTarget);
}
// this implements the upcall from the JVM, MethodHandleNatives.makeDynamicCallSite:
static CallSite makeSite(MethodHandle bootstrapMethod,
// Callee information:
String name, MethodType type,
// Extra arguments for BSM, if any:
Object info,
// Caller information:
Class<?> callerClass) {
MethodHandles.Lookup caller = IMPL_LOOKUP.in(callerClass);
CallSite site;
try {
Object binding;
info = maybeReBox(info);
if (info == null) {
binding = bootstrapMethod.invoke(caller, name, type);
} else if (!info.getClass().isArray()) {
binding = bootstrapMethod.invoke(caller, name, type, info);
} else {
Object[] argv = (Object[]) info;
maybeReBoxElements(argv);
switch (argv.length) {
case 0:
binding = bootstrapMethod.invoke(caller, name, type);
break;
case 1:
binding = bootstrapMethod.invoke(caller, name, type,
argv[0]);
break;
case 2:
binding = bootstrapMethod.invoke(caller, name, type,
argv[0], argv[1]);
break;
case 3:
binding = bootstrapMethod.invoke(caller, name, type,
argv[0], argv[1], argv[2]);
break;
case 4:
binding = bootstrapMethod.invoke(caller, name, type,
argv[0], argv[1], argv[2], argv[3]);
break;
case 5:
binding = bootstrapMethod.invoke(caller, name, type,
argv[0], argv[1], argv[2], argv[3], argv[4]);
break;
case 6:
binding = bootstrapMethod.invoke(caller, name, type,
argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
break;
default:
final int NON_SPREAD_ARG_COUNT = 3; // (caller, name, type)
if (NON_SPREAD_ARG_COUNT + argv.length > MethodType.MAX_MH_ARITY)
throw new BootstrapMethodError("too many bootstrap method arguments");
MethodType bsmType = bootstrapMethod.type();
MethodType invocationType = MethodType.genericMethodType(NON_SPREAD_ARG_COUNT + argv.length);
MethodHandle typedBSM = bootstrapMethod.asType(invocationType);
MethodHandle spreader = invocationType.invokers().spreadInvoker(NON_SPREAD_ARG_COUNT);
binding = spreader.invokeExact(typedBSM, (Object)caller, (Object)name, (Object)type, argv);
}
}
//System.out.println("BSM for "+name+type+" => "+binding);
if (binding instanceof CallSite) {
site = (CallSite) binding;
} else {
throw new ClassCastException("bootstrap method failed to produce a CallSite");
}
if (!site.getTarget().type().equals(type))
throw wrongTargetType(site.getTarget(), type);
} catch (Throwable ex) {
BootstrapMethodError bex;
if (ex instanceof BootstrapMethodError)
bex = (BootstrapMethodError) ex;
else
bex = new BootstrapMethodError("call site initialization exception", ex);
throw bex;
}
return site;
}
private static Object maybeReBox(Object x) {
if (x instanceof Integer) {
int xi = (int) x;
if (xi == (byte) xi)
x = xi; // must rebox; see JLS 5.1.7
}
return x;
}
private static void maybeReBoxElements(Object[] xa) {
for (int i = 0; i < xa.length; i++) {
xa[i] = maybeReBox(xa[i]);
}
}
}
| [
"zhaobo@MacBook-Pro.local"
] | zhaobo@MacBook-Pro.local |
420f8440d62202fe721dd2a61d1db497c2147a54 | ca8f8713e0d91c5a0c2e33328d1108f59abca102 | /src/main/java/net/wenxin/crates/procedures/DyeTerracottaCrateOrangeProcedure.java | 231f478029d95fefe07ef2ada328f099b8190b97 | [] | no_license | WenXin20/crates | 3b7044743ed47c1470ebb6468de70bc92fe276a3 | 0cb0207c33561d27ef1f47e965024b68b574b3aa | refs/heads/master | 2022-12-25T16:46:26.919657 | 2020-10-07T03:10:46 | 2020-10-07T03:10:46 | 278,702,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,571 | java | package net.wenxin.crates.procedures;
import net.wenxin.crates.block.OrangeTerracottaCrateBlock;
import net.wenxin.crates.CratesModElements;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.World;
import net.minecraft.world.IWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Hand;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.BlockTags;
import net.minecraft.state.IProperty;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.Entity;
import net.minecraft.block.BlockState;
import java.util.Map;
import java.util.HashMap;
@CratesModElements.ModElement.Tag
public class DyeTerracottaCrateOrangeProcedure extends CratesModElements.ModElement {
public DyeTerracottaCrateOrangeProcedure(CratesModElements instance) {
super(instance, 183);
MinecraftForge.EVENT_BUS.register(this);
}
public static void executeProcedure(Map<String, Object> dependencies) {
if (dependencies.get("entity") == null) {
if (!dependencies.containsKey("entity"))
System.err.println("Failed to load dependency entity for procedure DyeTerracottaCrateOrange!");
return;
}
if (dependencies.get("x") == null) {
if (!dependencies.containsKey("x"))
System.err.println("Failed to load dependency x for procedure DyeTerracottaCrateOrange!");
return;
}
if (dependencies.get("y") == null) {
if (!dependencies.containsKey("y"))
System.err.println("Failed to load dependency y for procedure DyeTerracottaCrateOrange!");
return;
}
if (dependencies.get("z") == null) {
if (!dependencies.containsKey("z"))
System.err.println("Failed to load dependency z for procedure DyeTerracottaCrateOrange!");
return;
}
if (dependencies.get("world") == null) {
if (!dependencies.containsKey("world"))
System.err.println("Failed to load dependency world for procedure DyeTerracottaCrateOrange!");
return;
}
Entity entity = (Entity) dependencies.get("entity");
double x = dependencies.get("x") instanceof Integer ? (int) dependencies.get("x") : (double) dependencies.get("x");
double y = dependencies.get("y") instanceof Integer ? (int) dependencies.get("y") : (double) dependencies.get("y");
double z = dependencies.get("z") instanceof Integer ? (int) dependencies.get("z") : (double) dependencies.get("z");
IWorld world = (IWorld) dependencies.get("world");
if (((entity.isSneaking()) && ((ItemTags.getCollection()
.getOrCreate(new ResourceLocation(("forge:dyes/orange").toLowerCase(java.util.Locale.ENGLISH)))
.contains(((entity instanceof LivingEntity) ? ((LivingEntity) entity).getHeldItemMainhand() : ItemStack.EMPTY).getItem()))
&& ((BlockTags.getCollection().getOrCreate(new ResourceLocation(("crates:terracotta_crates").toLowerCase(java.util.Locale.ENGLISH)))
.contains((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock()))
&& (!((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == OrangeTerracottaCrateBlock.block
.getDefaultState().getBlock())))))) {
{
BlockPos _bp = new BlockPos((int) x, (int) y, (int) z);
BlockState _bs = OrangeTerracottaCrateBlock.block.getDefaultState();
BlockState _bso = world.getBlockState(_bp);
for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) {
IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName());
if (_bs.has(_property))
_bs = _bs.with(_property, (Comparable) entry.getValue());
}
TileEntity _te = world.getTileEntity(_bp);
CompoundNBT _bnbt = null;
if (_te != null) {
_bnbt = _te.write(new CompoundNBT());
_te.remove();
}
world.setBlockState(_bp, _bs, 3);
if (_bnbt != null) {
_te = world.getTileEntity(_bp);
if (_te != null) {
try {
_te.read(_bnbt);
} catch (Exception ignored) {
}
}
}
}
if (entity instanceof LivingEntity) {
((LivingEntity) entity).swing(Hand.MAIN_HAND, true);
}
if ((!((entity instanceof PlayerEntity) ? ((PlayerEntity) entity).abilities.isCreativeMode : false))) {
if (entity instanceof PlayerEntity)
((PlayerEntity) entity).inventory.clearMatchingItems(
p -> ((entity instanceof LivingEntity) ? ((LivingEntity) entity).getHeldItemMainhand() : ItemStack.EMPTY).getItem() == p
.getItem(),
(int) 1);
}
} else if (((entity.isSneaking()) && ((ItemTags.getCollection()
.getOrCreate(new ResourceLocation(("forge:dyes/orange").toLowerCase(java.util.Locale.ENGLISH)))
.contains(((entity instanceof LivingEntity) ? ((LivingEntity) entity).getHeldItemOffhand() : ItemStack.EMPTY).getItem()))
&& ((BlockTags.getCollection().getOrCreate(new ResourceLocation(("crates:terracotta_crates").toLowerCase(java.util.Locale.ENGLISH)))
.contains((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock()))
&& (!((world.getBlockState(new BlockPos((int) x, (int) y, (int) z))).getBlock() == OrangeTerracottaCrateBlock.block
.getDefaultState().getBlock())))))) {
{
BlockPos _bp = new BlockPos((int) x, (int) y, (int) z);
BlockState _bs = OrangeTerracottaCrateBlock.block.getDefaultState();
BlockState _bso = world.getBlockState(_bp);
for (Map.Entry<IProperty<?>, Comparable<?>> entry : _bso.getValues().entrySet()) {
IProperty _property = _bs.getBlock().getStateContainer().getProperty(entry.getKey().getName());
if (_bs.has(_property))
_bs = _bs.with(_property, (Comparable) entry.getValue());
}
TileEntity _te = world.getTileEntity(_bp);
CompoundNBT _bnbt = null;
if (_te != null) {
_bnbt = _te.write(new CompoundNBT());
_te.remove();
}
world.setBlockState(_bp, _bs, 3);
if (_bnbt != null) {
_te = world.getTileEntity(_bp);
if (_te != null) {
try {
_te.read(_bnbt);
} catch (Exception ignored) {
}
}
}
}
if (entity instanceof LivingEntity) {
((LivingEntity) entity).swing(Hand.OFF_HAND, true);
}
if ((!((entity instanceof PlayerEntity) ? ((PlayerEntity) entity).abilities.isCreativeMode : false))) {
if (entity instanceof PlayerEntity)
((PlayerEntity) entity).inventory.clearMatchingItems(
p -> ((entity instanceof LivingEntity) ? ((LivingEntity) entity).getHeldItemOffhand() : ItemStack.EMPTY).getItem() == p
.getItem(),
(int) 1);
}
}
}
@SubscribeEvent
public void onRightClickBlock(PlayerInteractEvent.RightClickBlock event) {
PlayerEntity entity = event.getPlayer();
if (event.getHand() != entity.getActiveHand())
return;
int i = event.getPos().getX();
int j = event.getPos().getY();
int k = event.getPos().getZ();
World world = event.getWorld();
Map<String, Object> dependencies = new HashMap<>();
dependencies.put("x", i);
dependencies.put("y", j);
dependencies.put("z", k);
dependencies.put("world", world);
dependencies.put("entity", entity);
dependencies.put("event", event);
this.executeProcedure(dependencies);
}
}
| [
"newvi@ASUS-Laptop.lan"
] | newvi@ASUS-Laptop.lan |
1440a5f1155aaaff80e4f66111c3eab452f38297 | 5a520be9baaeff27b87ed9978b1793cf5f88981b | /GenerateInstance/areca-7.4.7/src/com/application/areca/impl/copypolicy/AlwaysOverwriteCopyPolicy.java | 78d4f83220ae89448dbd0d17e76b1f1539cc0d2e | [] | no_license | bugfixing0/dynamic-testing | f88f90649e52a55b0c600c5de6c78a403c3cbeaf | 25452c8704e3dcc9a75c3fbc41222f4605928ee1 | refs/heads/master | 2020-12-22T16:00:34.510535 | 2019-12-04T17:54:52 | 2019-12-04T17:54:52 | 236,783,026 | 0 | 0 | null | 2020-01-28T16:35:51 | 2020-01-28T16:35:50 | null | UTF-8 | Java | false | false | 1,121 | java | package com.application.areca.impl.copypolicy;
import java.io.File;
import com.myJava.file.copypolicy.CopyPolicyException;
/**
*
* <BR>
* @author Olivier PETRUCCI
* <BR>
*
*/
/*
Copyright 2005-2014, Olivier PETRUCCI.
This file is part of Areca.
Areca is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Areca 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 Areca; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
public class AlwaysOverwriteCopyPolicy extends AbstractCopyPolicy {
public boolean acceptImpl(File file) throws CopyPolicyException {
return true;
}
}
| [
"yanjiejiang18@163.com"
] | yanjiejiang18@163.com |
8e2157c99491d3e4afe7120399f9034e55fcb22c | eacdbb1a659c45f8aa71919681f7f0d14fad67c4 | /src/com/partyrock/temp/MenuDemo.java | c2b3de0c0dc86749a1ece9295806b0d7df279487 | [] | no_license | erazfar/Party-Master | b8e56647fd83a28ef70c53bef08ac0b86c5e7da4 | a370fedeb5d44765a33d58c22883f69c46bd6ed1 | refs/heads/master | 2021-01-15T18:59:40.590844 | 2013-03-08T13:18:56 | 2013-03-08T13:18:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,196 | java | package com.partyrock.temp;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
/**
* Demonstrates a menu, will use later
* @author Matthew
*
*/
public class MenuDemo {
public static void main(String... args) {
Display display = new Display();
Shell shell = new Shell(display);
Menu bar = new Menu(shell, SWT.BAR);
shell.setMenuBar(bar);
MenuItem fileItem = new MenuItem(bar, SWT.CASCADE);
fileItem.setText("&File");
Menu submenu = new Menu(shell, SWT.DROP_DOWN);
fileItem.setMenu(submenu);
MenuItem item = new MenuItem(submenu, SWT.PUSH);
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
System.out.println("Select All");
}
});
item.setText("Select &All\tCtrl+A");
item.setAccelerator(SWT.MOD1 + 'A');
shell.setSize(200, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
| [
"ehsan_razfar@yahoo.com"
] | ehsan_razfar@yahoo.com |
a78000fb62f996d0b958078fd0e3985b641502c1 | 5afadeab7425a769e37caab87f34b467a8f0a8b8 | /src/main/java/model/ElevatorSystem.java | efcc5e87c00294665ce064e56332189d6f186ba7 | [] | no_license | jchyzy/elevator-system | 31c490e287583dc6ebb1acfc1e07b0a1c3cb87aa | c02c38fae26de1c7c990a3c1ba00a1681b8ece9a | refs/heads/master | 2023-04-03T04:09:20.410211 | 2021-03-15T17:18:30 | 2021-03-15T17:18:30 | 347,168,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,357 | java | package model;
import java.util.*;
public class ElevatorSystem {
private final int elevatorsNumber;
private final int floorsNumber; // from 0 to floorsNumber (inclusive)
private List<Elevator> elevators;
private final ElevatorPicker elevatorPicker;
public static final int MAX_NUMBER_OF_FLOORS = 100;
public static final int MAX_NUMBER_OF_ELEVATORS = 16;
public ElevatorSystem(int elevatorsNumber, int floorsNumber) {
this.elevatorsNumber = elevatorsNumber;
this.floorsNumber = floorsNumber;
createElevators();
elevatorPicker = new ElevatorPicker(elevators);
}
private void createElevators() {
elevators = new ArrayList<>();
for (int i = 0; i < elevatorsNumber; i++) {
elevators.add(new Elevator(i));
}
}
public boolean pickup(int floor, Direction direction) {
if (floor >= 0 && floor <= floorsNumber) {
if ((floor == 0 && direction == Direction.DOWN) || (floor == floorsNumber && direction == Direction.UP)) {
return false;
}
Optional<Elevator> chosenElevator = elevatorPicker.chooseElevatorToPick(floor, direction);
chosenElevator.ifPresent(elevator -> elevator.setDestinationFloorAndActivatePickup(floor));
return true;
}
return false;
}
public boolean update(int elevatorId, int destinationFloor) { // current floor cannot be updated
if ((elevatorId >= 0) && (elevatorId < elevators.size())
&& (destinationFloor >= 0) && (destinationFloor <= floorsNumber)) {
Elevator elevator = elevators.get(elevatorId);
elevator.setDestinationFloorAndActivateUpdate(destinationFloor);
return true;
}
return false;
}
public void step() {
elevators.forEach(Elevator::performStep);
}
public void step(int steps) {
if (steps > 0) {
elevators.forEach(elevator -> elevator.performStep(steps));
}
}
public void status() {
elevators.forEach(System.out::println);
}
public List<Elevator> getElevators() {
return elevators;
}
public int getElevatorsNumber() {
return elevatorsNumber;
}
public int getFloorsNumber() {
return floorsNumber;
}
}
| [
"asiaa09@gmail.com"
] | asiaa09@gmail.com |
2a4d0d9b191149b9ecbdfb6360553bdbe58571f1 | 345de385edec736b4aaf3b370def9dc4175348ab | /android/app/src/main/java/com/videooverlay/MainActivity.java | 0c9ebf8bcfbec013d7d00ee494d77333e43882d8 | [] | no_license | davepaiva/RNffmpeg | 6611aaa0e1c5b8d5b5285488c52be75d366cd622 | 5534f53abc5b25ea3b066e9d8209009fae0bc513 | refs/heads/master | 2023-01-12T06:11:22.188281 | 2019-11-13T14:36:01 | 2019-11-13T14:36:01 | 220,456,824 | 2 | 0 | null | 2023-01-05T00:49:57 | 2019-11-08T11:52:48 | JavaScript | UTF-8 | Java | false | false | 351 | java | package com.videooverlay;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "VideoOverlay";
}
}
| [
"mrdavepaiva@gmail.com"
] | mrdavepaiva@gmail.com |
290185015d6e7155a5e3a194108ce64ecc06a7d9 | 441afca92c172826f2c6f56184bcb40c281daca7 | /app/src/main/java/com/example/android/quizapp/MainActivity.java | 0bd2daaa60ec5ffb6423f9c2faff49eb9409f0da | [] | no_license | falconeilario/QuizApp | f90d1cca1c03eba95ba5d6305d24d96bac922928 | 8d41702add3e57a7c0569bda8f8e2f41f95c4159 | refs/heads/master | 2020-03-11T21:10:11.342620 | 2018-04-19T18:38:12 | 2018-04-19T18:38:12 | 130,257,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,015 | java | package com.example.android.quizapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
int correctAnswers = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void calculateCorrectAnswers() {
RadioButton answer1 = (RadioButton) findViewById(R.id.answer1radio1);
boolean isAnswer1radio1 = answer1.isChecked();
if (isAnswer1radio1) {
correctAnswers += 1;
}
RadioButton answer2 = (RadioButton) findViewById(R.id.answer2radio2);
boolean isAnswer2radio2 = answer2.isChecked();
if (isAnswer2radio2) {
correctAnswers += 1;
}
EditText answer3 = (EditText) findViewById(R.id.answer3editText);
String ans3 = answer3.getText().toString();
boolean isAnswer3editText = ans3.contains("peregrine falcon");
if (isAnswer3editText) {
correctAnswers += 1;
}
RadioButton answer4 = (RadioButton) findViewById(R.id.answer4radio2);
boolean isAnswer4radio2 = answer4.isChecked();
if (isAnswer4radio2) {
correctAnswers += 1;
}
EditText answer5 = (EditText) findViewById(R.id.answer5editText);
String ans5 = answer5.getText().toString();
boolean isAnswer5editText = ans5.equalsIgnoreCase("one") || ans5.equalsIgnoreCase("1");
if (isAnswer5editText) {
correctAnswers += 1;
}
CheckBox answer6check1 = (CheckBox) findViewById(R.id.answer6check1);
boolean isAnswer6check1 = answer6check1.isChecked();
CheckBox answer6check2 = (CheckBox) findViewById(R.id.answer6check2);
boolean isAnswer6check2 = answer6check2.isChecked();
CheckBox answer6check3 = (CheckBox) findViewById(R.id.answer6check3);
boolean isAnswer6check3 = answer6check3.isChecked();
boolean isAnswer6 = isAnswer6check1 && isAnswer6check2 && !isAnswer6check3;
if (isAnswer6) {
correctAnswers += 1;
}
RadioButton answer7 = (RadioButton) findViewById(R.id.answer7radio2);
boolean isAnswer7radio2 = answer7.isChecked();
if (isAnswer7radio2) {
correctAnswers += 1;
}
}
public void resetNumber() {
correctAnswers = 0;
}
public void showFinalResult(View view) {
calculateCorrectAnswers();
if (correctAnswers == 7) {
Toast.makeText(this, correctAnswers + " correct answers! Congratulations!", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "Just " + correctAnswers + " correct answers. Try again!", Toast.LENGTH_LONG).show();
}
resetNumber();
}
}
| [
"falconeilario@gmail.com"
] | falconeilario@gmail.com |
1296b977bcbcef6d1aa055878067d55a34761865 | 819b99f2b09474791fbc2ca8faa59f5fb630b2af | /JavaCode/src/com/java基础/常用/MyAnnotations.java | 8096dd7dd6397eac937ac6e6074d2b3e47c95f20 | [] | no_license | terttyliu/Java | 953d10fed420fedc55329baef3774181e4fd65e8 | ff56d6f33674c382d844f817ed0a67ca25a89103 | refs/heads/main | 2023-01-31T13:37:47.639449 | 2020-12-13T03:44:20 | 2020-12-13T03:44:20 | 305,393,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 705 | java | package com.java基础.常用;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.*;
/**
* 以下四个注解都是元注解(修饰注解的注解)
*/
//生命周期
@Retention(RetentionPolicy.RUNTIME)
//标明该注解能标注那些内容
@Target(value = {TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, MODULE})
//标明该注解在javadoc解析时会保留(比如@Deprecated)
@Documented
///用于表示某个被标注的类型是被继承的。如果一个使用了@Inherited修饰的annotation类型被用于一个class,则这个annotation将被用于该class的子类。
@Inherited
public @interface MyAnnotations {
MyAnnotation[] value();
}
| [
"eieliupengjie@stu.xjtu.edu.cn"
] | eieliupengjie@stu.xjtu.edu.cn |
a4aaa8ff032ef3e6cf05d21ccf64df7145f7e83b | 1730754c54371183d6beee0f5702721bd857c379 | /YearsOfPlenty/src/cit260/yearOfPlenty/GameInfo.java | 96a9616cc0a080ccb2342fd92124674090fc327c | [] | no_license | hendersonhayley/henderson-neilson-kearns | 505e3b640d3c0bd5f596092239a3d44d43707dbb | 48bacf70c6903f59df198665e793d38406ad9d9e | refs/heads/master | 2021-08-28T03:10:09.079840 | 2017-12-11T04:59:55 | 2017-12-11T04:59:55 | 105,820,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cit260.yearOfPlenty;
/**
*
* @author brennanneilson
*/
public enum GameInfo {
ACRES,
BUSHELS,
ACREPRICE,
BUSHELRETURN;
}
| [
"bvneilson@gmail.com"
] | bvneilson@gmail.com |
d56d05af7fc3f6808deb21e5dd40dc0d6c166c4a | 152890bb305544ce595bc38d7dee02533d57b5f1 | /src/main/java/kr/team/ticketing/domain/image/product/ProductImageRepository.java | b20973f15b15fcac91eadc4d47740c7a53982e1e | [] | no_license | JAVA-KR-TEAM/ticketing | f6e32265f4262d29bdfda660006f15e12649a926 | 98ce961c73340e8c98c27ce358229a89526f7f90 | refs/heads/develop | 2020-12-27T03:46:07.069796 | 2020-03-28T10:57:20 | 2020-03-28T10:57:20 | 237,753,268 | 2 | 5 | null | 2020-05-16T06:45:00 | 2020-02-02T10:21:24 | Java | UTF-8 | Java | false | false | 198 | java | package kr.team.ticketing.domain.image.product;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ProductImageRepository extends JpaRepository<ProductImage, Long> {
}
| [
"msolo021015@naver.com"
] | msolo021015@naver.com |
8898f5e04244abbff734048284c6faff41fecba3 | d6493c5040063cc019704f9e169e012626c2774a | /src/test/java/project/controller/effects/realeffects/VictoryPointForEachBlueCardTest.java | 177dd57be4154c3bc3aca206e73ad7195a225b27 | [] | no_license | federicoBetti/Lorenzo_Magnifico_Java | ff508a722153a742eff9057da99b1a869bfbf696 | cc725e0a1cdd48117a3b9e8d56d9c50e4ef67b34 | refs/heads/master | 2021-03-16T05:28:32.326170 | 2019-04-30T21:02:56 | 2019-04-30T21:02:56 | 87,735,264 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,182 | java | package project.controller.effects.realeffects;
import org.junit.Test;
import project.controller.cardsfactory.CharacterCard;
import project.controller.cardsfactory.CharactersCost;
import project.server.network.PlayerHandler;
import project.server.network.rmi.RMIPlayerHandler;
import java.util.ArrayList;
import static org.junit.Assert.*;
/**
* effect test
*/
public class VictoryPointForEachBlueCardTest {
VictoryPointForEachBlueCard test = new VictoryPointForEachBlueCard(2);
@Test
public void doEffect() throws Exception {
PlayerHandler p = new RMIPlayerHandler();
CharacterCard characterCard = new CharacterCard("ciao",1,false,new CharactersCost(1), new ArrayList<>(), new ArrayList<>());
p.getPersonalBoardReference().getCharacters().add(characterCard);
p.getPersonalBoardReference().getCharacters().add(characterCard);
p.getScore().setVictoryPoints(10);
test.doEffect(p);
assertEquals(14, p.getScore().getVictoryPoints());
}
@Test
public void toScreen() throws Exception {
String s = "Take 2 victory points for each blue card";
assertEquals(s, test.toScreen());
}
} | [
"federico2.bett@mail.polimi.it"
] | federico2.bett@mail.polimi.it |
1b95b6c8ac137bc374f401fac2b4a77cf1ed341e | 4f39106cede497f73e47e944d8eca8e3485bfc75 | /src/main/java/bio/normal/server/ServerReadThread.java | 19dc8fb02a335a96302d93cd0a50af27bfc2ee1c | [] | no_license | Ma3querader/IO | 6cab6b6d7c392c84a09ab330d50224c00d067582 | d1e1caf418fddb7c8b04cc3e8b4ec7a289d5fc71 | refs/heads/main | 2023-04-17T12:00:05.420993 | 2021-05-01T07:07:06 | 2021-05-01T07:07:06 | 352,488,664 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | package bio.normal.server;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Socket;
/**
* @Author: panyusheng
* @Date: 2021/3/29
* @Version 1.0
*/
public class ServerReadThread extends Thread{
private Socket socket;
public ServerReadThread(Socket socket) {
this.socket = socket;
}
@Override
public void run() {
try {
// 从Socket管道中得到一个字节输入流
InputStream is = this.socket.getInputStream();
// 把字节输入流包装成自己需要的流进行数据的读取
BufferedReader br = new BufferedReader(new InputStreamReader(is));
// 读取数据
String line;
while ((line = br.readLine()) != null) {
System.out.println("服务端收到:"+ socket.getRemoteSocketAddress() + ": " + line);
}
} catch (Exception e) {
System.out.println(socket.getRemoteSocketAddress() + "下线了..");
}
}
}
| [
"593661332@qq.com"
] | 593661332@qq.com |
85a1dd224f21f255c6213dac0f050f8ddc2c997a | dcb33b5f7778952053d5a2f640f941ca8b6a724b | /src/main/java/com/app/dao/impl/GrnDaoImpl.java | e323a226e5dcd31f6e0f9b540ee24459b0e5eb0a | [] | no_license | narendradasara99/WhareHouse-Project-Final-Code | 2da43f63b941eb8ea255ecc6f89c942153e98774 | 407f60677042fbd0e14580172d57b0038fc8a90b | refs/heads/master | 2023-03-03T19:01:15.691939 | 2022-02-15T07:03:16 | 2022-02-15T07:03:16 | 226,907,772 | 0 | 0 | null | 2023-02-22T07:38:04 | 2019-12-09T15:45:37 | Java | UTF-8 | Java | false | false | 1,812 | java | package com.app.dao.impl;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;
import com.app.dao.IGrnDao;
import com.app.model.Grn;
import com.app.model.GrnDtl;
@Repository
public class GrnDaoImpl implements IGrnDao {
@Autowired
private HibernateTemplate ht;
@Override
public Integer saveGrn(Grn grn) {
return (Integer)ht.save(grn);
}
@Override
public void updateGrn(Grn grn) {
ht.update(grn);
}
@Override
public void deleteGrn(Integer id) {
ht.delete(new Grn(id));
}
@Override
public Grn getOneGrn(Integer id) {
return ht.get(Grn.class,id);
}
@Override
public List<Grn> getAllGrns() {
return ht.loadAll(Grn.class);
}
@Override
public List<Object[]> getGrnTypeAndCount() {
/*String hql=" select id, grnType "
+ " from com.app.model.Grn ";
return (List<Object[]>)ht.find(hql);
*/
DetachedCriteria dc=DetachedCriteria.forClass(Grn.class)
.setProjection(Projections.projectionList()
.add(Projections.groupProperty("grnType"))
.add(Projections.count("grnType")));
return (List<Object[]>)ht.findByCriteria(dc);
}
@Override
public List<GrnDtl> getGrnDtlByGrnId(Integer id) {
//select * from grndtl where grnIdFk=?
DetachedCriteria dc= DetachedCriteria.forClass(GrnDtl.class)
.add(Restrictions.eq("parent.id",id));
return (List<GrnDtl>) ht.findByCriteria(dc);
}
@Override
public Integer saveGrnDtl(GrnDtl dtl) {
return (Integer) ht.save(dtl);
}
}
| [
"naren@Naren-PC"
] | naren@Naren-PC |
5924fb7ef57e5a395e3f530d012b4516eacc0171 | 3f4f36053528fafaa887195603adeba2d94af0a4 | /mvp/src/main/java/com/electronclass/pda/mvp/rest/RestApi.java | c515ad0c1d48aa1e35123717c032af2c17d8b0ba | [
"Apache-2.0"
] | permissive | caofengcheng/ElectronClass | c17d1d180c8a5591f66cdbe7391c94ef9c880816 | 7c0361cc2ee53f29d5ebcc915e418c7b05aa9b26 | refs/heads/master | 2021-07-14T02:30:00.459499 | 2020-10-10T09:23:41 | 2020-10-10T09:23:41 | 213,528,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,726 | java | package com.electronclass.pda.mvp.rest;
import com.electronclass.pda.mvp.entity.Attendance;
import com.electronclass.pda.mvp.entity.ClassItem;
import com.electronclass.pda.mvp.entity.ClassMessage;
import com.electronclass.pda.mvp.entity.ClassMien;
import com.electronclass.pda.mvp.entity.ClassMienPage;
import com.electronclass.pda.mvp.entity.Coures;
import com.electronclass.pda.mvp.entity.CouresNode;
import com.electronclass.pda.mvp.entity.Duty;
import com.electronclass.pda.mvp.entity.ECardDetail;
import com.electronclass.pda.mvp.entity.Inform;
import com.electronclass.pda.mvp.entity.InformPage;
import com.electronclass.pda.mvp.entity.Jurisdiction;
import com.electronclass.pda.mvp.entity.ServiceResponse;
import java.util.List;
import io.reactivex.Single;
import retrofit2.http.POST;
import retrofit2.http.Query;
/**
* 描述:接口信息.
*/
public interface RestApi {
/**
* 获取学校班级信息
*/
@POST("/e-card/card/get")
Single<ServiceResponse<ClassMessage>> getClassAndSchool(@Query("eCardNo") String eCardNo);
/**
* 获取通知(校园/班级)
*/
@POST("/e-card/notice/get")
Single<ServiceResponse<List<Inform>>> getInform(@Query("eCardNo") String eCardNo, @Query("userId") String userId,
@Query("departId") String departId, @Query("type") int type,
@Query("isAvaliable") int isAvaliable);
/**
* 获取班级风采
*/
@POST("/e-card/catch/get")
Single<ServiceResponse<ClassMien>> getClassMien(@Query("eCardNo") String eCardNo, @Query("userId") String userId,
@Query("classId") String classId, @Query("pageStart") int pageStart,
@Query("pageSize") int pageSize);
/**
* 获取班级课表
*/
@POST("/e-card/table/get")
Single<ServiceResponse<List<Coures>>> getCoures(@Query("eCardNo") String eCardNo, @Query("userId") String userId,
@Query("classId") String classId, @Query("requestDate") String eventDate,
@Query("type") int type);
/**
* 获取班级值日表
*/
@POST("/e-card/clean/get")
Single<ServiceResponse<List<Duty>>> getDuty(@Query("eCardNo") String eCardNo, @Query("userId") String userId,
@Query("classId") String classId, @Query("eventDate") String eventDate,
@Query("type") int type);
/**
* 获取班级考勤
*/
@POST("/e-card/attendance/student/get")
Single<ServiceResponse<Attendance>> getAttendance(@Query("eCardNo") String eCardNo, @Query("userId") String userId,
@Query("classId") String classId, @Query("eventDate") String eventDate);
/**
* 获取班级列表
*/
@POST("/e-card/depart/get")
Single<ServiceResponse<List<ClassItem>>> getClassList(@Query("departId") String departId, @Query("userId") String userId);
/**
* 考勤打卡
*/
@POST("/e-card/attendance/student/send")
Single<ServiceResponse> getCardAttendance(@Query("eCardNo") String eCardNo, @Query("studentCardNo") String studentCardNo,
@Query("eventTime") String eventTime, @Query("isLate") int isLate);
/**
* 获取验证码
*/
@POST("/e-card/wxLogin/sms/code/get")
Single<ServiceResponse> sendSms(@Query("phoneNum") String phoneNum);
/**
* 通过验证码登录
*/
@POST("/e-card/wxLogin/sms/code/check")
Single<ServiceResponse<List<Jurisdiction>>> login(@Query("phoneNum") String phoneNum, @Query("smsCode") String smsCode);
/**
* 绑定班级和班牌
*/
@POST("/e-card/card/add/class")
Single<ServiceResponse> bound(@Query("eCardNo") String eCardNo, @Query("departId") String departId);
/**
* 添加值日信息
*/
@POST("/e-card/clean/set")
Single<ServiceResponse> addOrUpdateDuty(@Query("id") String id, @Query("eCardNo") String eCardNo,
@Query("password") String password,
@Query("task") String task,
@Query("name") String name,
@Query("eventDate") String eventDate);
/**
* 删除值日
*/
@POST("/e-card/clean/delete")
Single<ServiceResponse> deleteDuty(@Query("id") String id, @Query("eCardNo") String eCardNo, @Query("password") String password);
/**************************班牌新接口***************************/
/**
* 获取学校班级信息
*/
@POST("ecard/app/ecard/getDetail")
Single<ServiceResponse<ECardDetail>> getECardDetail(@Query("eCardNo") String eCardNo);
/**
* 获取通知(校园/班级)
* classId *
* string
* 班级id
* <p>
* pageNo *
* string
* 页码
* <p>
* pageSize *
* string
* 一页数量
* <p>
* type *
* string
* 0-班级通知 1-校园通知
*/
@POST("ecard/app/notice/page")
Single<ServiceResponse<InformPage>> getInform(@Query("classId") String classId, @Query("pageNo") String pageNo,
@Query("pageSize") String pageSize, @Query("type") int type);
/**
* 获取班级风采
*/
@POST("ecard/app/catch/classPage")
Single<ServiceResponse<ClassMienPage>> getClassMien(@Query("departId") String departId, @Query("pageNo") int pageNo,
@Query("pageSize") int pageSize);
/**
* 获取班级课表
*/
@POST("ecard/app/table/get")
Single<ServiceResponse<List<CouresNode>>> getCoures(@Query("classId") String classId);
/**
* 获取班级值日表
*/
@POST("ecard/app/clean/list")
Single<ServiceResponse<List<Duty>>> getDuty(@Query("classId") String classId);
/**
* 获取班级考勤
*/
@POST("ecard/app/attendance/info")
Single<ServiceResponse<Attendance>> getAttendance(@Query("classId") String classId);
/**
* 考勤打卡
*/
@POST("ecard/app/attendance/save")
Single<ServiceResponse> getCardAttendance(@Query("eCardNo") String eCardNo, @Query("studentCardNo") String studentCardNo,
@Query("eventTime") String eventTime, @Query("isLate") int isLate, @Query("schoolId") String schoolId);
}
| [
"cao18371077551@163.com"
] | cao18371077551@163.com |
e1b4332c426189338d5d3d66d136a2438311b94f | ea0a64b3dcecb9c61eede47ed058104f083e4ac6 | /android/KKShares/app/src/main/java/com/kaiser/kkshares/utils/ImageLoaderUtils.java | d381ae1e37727bb630944846ca921bbae73c36e5 | [] | no_license | kaka17/kaka-1 | d39927a5dc9ec607f0aafa342c4f956872882f27 | 3c8176267a610c8deaa464dec1a3e762433bde30 | refs/heads/master | 2021-08-22T19:39:12.596952 | 2017-12-01T03:31:07 | 2017-12-01T03:31:07 | 111,485,648 | 0 | 0 | null | 2017-11-21T02:01:35 | 2017-11-21T02:01:34 | null | UTF-8 | Java | false | false | 3,832 | java | package com.kaiser.kkshares.utils;
import android.content.Context;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.kaiser.kkshares.R;
import java.io.File;
/**
* Description : 图片加载工具类 使用glide框架封装
*/
public class ImageLoaderUtils {
public static void display(Context context, ImageView imageView, String url, int placeholder, int error) {
if (imageView == null) {
throw new IllegalArgumentException("argument error");
}
Glide.with(context).load(url).placeholder(placeholder)
.error(error).crossFade().into(imageView);
}
public static void display(Context context, ImageView imageView, String url) {
if (imageView == null) {
throw new IllegalArgumentException("argument error");
}
Glide.with(context).load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.centerCrop()
.placeholder(R.mipmap.ic_image_loading)
.error(R.mipmap.ic_empty_picture)
.crossFade().into(imageView);
}
public static void display(Context context, ImageView imageView, File url) {
if (imageView == null) {
throw new IllegalArgumentException("argument error");
}
Glide.with(context).load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.centerCrop()
.placeholder(R.mipmap.ic_image_loading)
.error(R.mipmap.ic_empty_picture)
.crossFade().into(imageView);
}
public static void displaySmallPhoto(Context context, ImageView imageView, String url) {
if (imageView == null) {
throw new IllegalArgumentException("argument error");
}
Glide.with(context).load(url).asBitmap()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.mipmap.ic_image_loading)
.error(R.mipmap.ic_empty_picture)
.thumbnail(0.5f)
.into(imageView);
}
public static void displayBigPhoto(Context context, ImageView imageView, String url) {
if (imageView == null) {
throw new IllegalArgumentException("argument error");
}
Glide.with(context).load(url).asBitmap()
.format(DecodeFormat.PREFER_ARGB_8888)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.mipmap.ic_image_loading)
.error(R.mipmap.ic_empty_picture)
.into(imageView);
}
public static void display(Context context, ImageView imageView, int url) {
if (imageView == null) {
throw new IllegalArgumentException("argument error");
}
Glide.with(context).load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.centerCrop()
.placeholder(R.mipmap.ic_image_loading)
.error(R.mipmap.ic_empty_picture)
.crossFade().into(imageView);
}
public static void displayRound(Context context, ImageView imageView, String url) {
if (imageView == null) {
throw new IllegalArgumentException("argument error");
}
Glide.with(context).load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.error(R.mipmap.toux2)
.centerCrop().transform(new GlideRoundTransformUtil(context)).into(imageView);
}
public static void disPlayGif(Context context, ImageView imageView, String url){
// Glide.with(context).load(url).asGif().into(imageView);
Glide.with(context).load(url).asGif().fitCenter().into(imageView);
}
}
| [
"841623088@qq.com"
] | 841623088@qq.com |
7bb44c732c9a250e1bc9dddcd37adb6bb2660f26 | f1df5e766c10f538e1ab0370401e6b599f9c90a6 | /app/src/main/java/com/theandroidrookie/stickstoneinventory/CatalogActivity.java | 141ba6f2478df82be35f665333a9048c92104c3f | [] | no_license | JefersonBorba/StickStoneInventory | c547803365639c5adad663b4446d62dad789f6b5 | 9ae65926d47b32e0897ac89ed2f67f6a30409051 | refs/heads/master | 2021-07-23T09:28:27.006669 | 2017-11-03T13:20:55 | 2017-11-03T13:20:55 | 109,397,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,792 | java | package com.theandroidrookie.stickstoneinventory;
/**
* Created by jeff on 11/3/2017.
*/
import android.app.LoaderManager;
import android.content.ContentUris;
import android.content.CursorLoader;
import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import com.theandroidrookie.stickstoneinventory.data.ProductContract;
/**
* Launcher Activity which displays list of products in database
*/
public class CatalogActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> {
private ProductCursorAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_catalog);
//Inansiate list and set empty view
ListView listView = (ListView) findViewById(R.id.list_products);
View emptyView = findViewById(R.id.empty_view);
listView.setEmptyView(emptyView);
//Create empty adapter and set on ListView
mAdapter = new ProductCursorAdapter(this, null);
listView.setAdapter(mAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Uri productUri = ContentUris.withAppendedId(ProductContract.ProductEntry.CONTENT_URI, l);
Intent intent = new Intent(CatalogActivity.this, DetailsActivity.class);
intent.setData(productUri);
startActivity(intent);
}
});
//Listen for click on FAB
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(CatalogActivity.this, EditorActivity.class);
startActivity(intent);
}
});
//Start loader
getLoaderManager().initLoader(0, null, this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_catalog, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here
int id = item.getItemId();
if (id == R.id.action_delete_all) {
Utils.showDeleteAllConfirmationDialog(this);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
//Only for columns required for our ListView
String[] projection = {
ProductContract.ProductEntry._ID,
ProductContract.ProductEntry.COLUMN_PRODUCT_NAME,
ProductContract.ProductEntry.COLUMN_PRODUCT_PRICE,
ProductContract.ProductEntry.COLUMN_PRODUCT_STOCK
};
return new CursorLoader(getApplicationContext(), ProductContract.ProductEntry.CONTENT_URI, projection, null, null, null);
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
mAdapter.swapCursor(cursor);
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
mAdapter.swapCursor(null);
}
} | [
"jefersonborba2009@hotmail.com"
] | jefersonborba2009@hotmail.com |
4dfd7d36075b8676dc2c3670eced53d35c93415b | 306dcb552bfedc0d29beb4d5d8390a539fe18c00 | /app/src/main/java/com/example/yls/ad0417/MyCaptureActivity.java | ed0f4464344cae8621523703dd06c11a90d06ec3 | [] | no_license | LiaoJianKui/ZxingCodeDemo | c53a19b46f5bc91414e1a249d702c5f42669eb6e | 8152c754ffd1488efbf65e7b1e14d772ebaef7fb | refs/heads/master | 2021-01-19T20:30:14.010841 | 2017-04-19T13:15:44 | 2017-04-19T13:15:44 | 88,511,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,920 | java | package com.example.yls.ad0417;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import com.journeyapps.barcodescanner.CaptureManager;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
public class MyCaptureActivity extends AppCompatActivity {
private CaptureManager capture;
private DecoratedBarcodeView barcodeScannerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
barcodeScannerView = initializeContent();
capture = new CaptureManager(this, barcodeScannerView);
capture.initializeFromIntent(getIntent(), savedInstanceState);
capture.decode();
}
/**
* Override to use a different layout.
*
* @return the DecoratedBarcodeView
*/
protected DecoratedBarcodeView initializeContent() {
setContentView(R.layout.activity_my_capture);
return (DecoratedBarcodeView)findViewById(R.id.my_barcode_scanner);
}
@Override
protected void onResume() {
super.onResume();
capture.onResume();
}
@Override
protected void onPause() {
super.onPause();
capture.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
capture.onDestroy();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
capture.onSaveInstanceState(outState);
}
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
capture.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return barcodeScannerView.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event);
}
} | [
"1710869761@qq.com"
] | 1710869761@qq.com |
623b1574e1460fef31669e476bdd4845bc89310b | fa31e66254d5e6228ff029913c1caec22d8ed66a | /jsp+servlet+jdbc/src/a/BaiduServlet.java | c883a7857c606e59e1cecdd519011fb20a3af5ad | [] | no_license | gengxianggit/Stroe | 5ace2c3895605fb83237f42939d8f674e59c48c9 | 539cf89b3628fbd44f03b2cc18198dd5aeefc3dc | refs/heads/master | 2020-04-01T20:38:27.405895 | 2018-10-18T13:40:00 | 2018-10-18T13:40:00 | 153,613,539 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,572 | java | package a;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.jasper.tagplugins.jstl.core.Out;
import dao.BaiduDao;
public class BaiduServlet extends HttpServlet {
public void doGet(HttpServletRequest request,HttpServletResponse response ) {
String type=request.getParameter("type");
if(type==null) {
show(request,response);
}if("show".equals(type)) {
show1(request,response);
}
}
private void show1(HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
try {
String content=request.getParameter("content");
PrintWriter out=response.getWriter();
BaiduDao dao=new BaiduDao();
List<String>list=new ArrayList();
list=dao.search(content);
String str="";
for(int i=0;i<list.size();i++) {
str+=list.get(i)+"<br/>";
}
out.println(str);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void show(HttpServletRequest request, HttpServletResponse response) {
try {
request.getRequestDispatcher("WEB-INF/baidu/baidu.jsp").forward(request, response);
} catch (ServletException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void doPost(HttpServletRequest request,HttpServletResponse response ) {
doGet(request, response);
}
}
| [
"gengxiangupgogo@163.com"
] | gengxiangupgogo@163.com |
f7fcf3dc95c158636b948e82f39906ce7cdedf26 | 832790d98cf5d4fa1be2b95ef1ce74c1ad9d3453 | /src/test/java/cache/subcache/HashMapCacheSetTest.java | 1f766c3e0131868c6ff116cae3b055c378341d7e | [] | no_license | wendian/cache | add6bce0c6a315340f11da818ad17def6c7399c2 | ee5740065465806c42609ee893f71d12f9b30655 | refs/heads/master | 2020-03-28T02:53:24.866803 | 2018-09-06T02:20:15 | 2018-09-06T02:20:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,853 | java | package cache.subcache;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import cache.exception.CacheMiss;
import cache.exception.EvictionNotPossible;
import cache.replacement.ReplacementAlgorithm;
@RunWith(MockitoJUnitRunner.class)
public class HashMapCacheSetTest {
private static final int MAX_BLOCKS = 10;
@Mock
private ReplacementAlgorithm<String, String> replacementAlgorithm;
private HashMapCacheSet<String, String> cacheSet;
@Before
public void setUpNewCache() {
cacheSet = new HashMapCacheSet<>(MAX_BLOCKS);
cacheSet.setReplacementAlgorithm(replacementAlgorithm);
}
@Test
public void testPut_nullKey() throws Exception {
String key = null;
String value = "value";
cacheSet.put(key, value);
verify(replacementAlgorithm, never()).evict(any());
assertEquals(value, cacheSet.get(key));
assertEquals(1, cacheSet.size());
}
@Test
public void testPut_allNewKeys() throws Exception {
String keyPrefix = "key";
String valuePrefix = "value";
for (int i = 0; i < MAX_BLOCKS; i++) {
cacheSet.put(keyPrefix + i, valuePrefix + i);
}
verify(replacementAlgorithm, never()).evict(any());
for (int i = 0; i < MAX_BLOCKS; i++) {
assertEquals(valuePrefix + i, cacheSet.get(keyPrefix + i));
}
assertEquals(MAX_BLOCKS, cacheSet.size());
}
@Test
public void testPut_repeatKeys() throws Exception {
String keyPrefix = "key";
String valuePrefix = "value";
for (int i = 0; i < MAX_BLOCKS; i++) {
cacheSet.put(keyPrefix + i, valuePrefix + i);
}
String newValuePrefix = "newValue";
for (int i = 0; i < MAX_BLOCKS; i++) {
cacheSet.put(keyPrefix + i, newValuePrefix + i);
}
verify(replacementAlgorithm, never()).evict(any());
for (int i = 0; i < MAX_BLOCKS; i++) {
String actualKey = cacheSet.get(keyPrefix + i);
assertEquals(newValuePrefix + i, actualKey);
assertNotEquals(valuePrefix + i, actualKey);
}
}
@Test
public void testPut_evictOne() throws Exception {
String keyPrefix = "key";
String valuePrefix = "value";
for (int i = 0; i < MAX_BLOCKS; i++) {
cacheSet.put(keyPrefix + i, valuePrefix + i);
}
verify(replacementAlgorithm, never()).evict(any());
String newKey = "newKey";
when(replacementAlgorithm.evict(any())).thenAnswer(new Answer<String>() {
@Override
public String answer(InvocationOnMock invocation) {
cacheSet.getBlocks().remove(keyPrefix + 0);
return valuePrefix + 0;
}
});
String oldValue = cacheSet.put(newKey, valuePrefix);
verify(replacementAlgorithm, times(1)).evict(any());
assertEquals(MAX_BLOCKS, cacheSet.size());
assertEquals(valuePrefix, cacheSet.get(newKey));
assertEquals(valuePrefix + 0, oldValue);
}
@Test(expected = EvictionNotPossible.class)
public void testPut_evictOne_notPossible() throws Exception {
String keyPrefix = "key";
String valuePrefix = "value";
for (int i = 0; i < MAX_BLOCKS; i++) {
cacheSet.put(keyPrefix + i, valuePrefix + i);
}
verify(replacementAlgorithm, never()).evict(any());
String newKey = "newKey";
when(replacementAlgorithm.evict(any())).thenThrow(new EvictionNotPossible("mock"));
try {
cacheSet.put(newKey, valuePrefix);
} catch (EvictionNotPossible e) {
verify(replacementAlgorithm, times(1)).evict(any());
assertEquals(MAX_BLOCKS, cacheSet.size());
for (int i = 0; i < MAX_BLOCKS; i++) {
assertEquals(valuePrefix + i, cacheSet.get(keyPrefix + i));
}
assertFalse(cacheSet.containsKey(newKey));
throw e;
}
}
@Test(expected = CacheMiss.class)
public void testGet_cacheMisses() throws Exception {
String keyPrefix = "key";
String valuePrefix = "value";
for (int i = 0; i < MAX_BLOCKS; i++) {
cacheSet.put(keyPrefix + i, valuePrefix + i);
}
verify(replacementAlgorithm, never()).evict(any());
keyPrefix = "nonExistent";
try {
cacheSet.get(keyPrefix);
} catch (CacheMiss e) {
assertEquals(MAX_BLOCKS, cacheSet.size());
throw e;
}
}
@Test
public void testRemove() throws Exception {
String key = "key";
String value = "value";
cacheSet.put(key, value);
String removedValue = cacheSet.remove(key);
verify(replacementAlgorithm, never()).evict(any());
assertEquals(value, removedValue);
assertFalse(cacheSet.containsKey(key));
assertEquals(0, cacheSet.size());
}
@Test
public void testRemove_noKey() throws Exception {
String key = "key";
String removedValue = cacheSet.remove(key);
verify(replacementAlgorithm, never()).evict(any());
assertNull(removedValue);
assertEquals(0, cacheSet.size());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
a14289d53a847913194f0a04dc13bacff1d3a0ef | ae9d51436e4fa2d8f1c8103f27eea526ec88c1f1 | /app/src/main/java/clinic2/activlife/com/myapplication/db/AppointmentDetailsTable.java | 1f475af16335e734287f497ef5a598a78c6c837e | [] | no_license | vinaytandasi/Clinic2 | cb979ed6fb5eaaae094ccdda9d14186a47a6e817 | 92bff80be1aaf5049dabb211b52eae68075cc709 | refs/heads/master | 2021-01-10T01:26:55.901926 | 2016-02-13T09:38:20 | 2016-02-13T09:38:20 | 51,639,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,177 | java | package clinic2.activlife.com.myapplication.db;
import clinic2.activlife.com.myapplication.helper.DatabaseHelper;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
public class AppointmentDetailsTable extends baseDB {
//DB version 2
public static String TABLE_TAG = "appointmentDetails";
public static String KEY_PATIENT_ID = "patientId";
// to be used later to support different treatment sessions for same patient.
public static String KEY_SESSION_GROUP_ID = "sessionGroupId";
public static String KEY_SESSION_GROUP_STATUS = "groupSessionStatus";
// to be used later to support different clinic locations.
public static String KEY_LOCATION_ID = "locationId";
public static String KEY_SESSION_ID = "sessionId"; //running number of sessions.
public static String KEY_SESSION_STATUS = "sessionStatus"; // Scheduled, Treatment Done, Payment Received.
public static String KEY_SESSION_START_TIME = "sessionStartTime";
public static String KEY_SESSION_END_TIME = "sessionEndTime";
public static String KEY_SESSION_AMOUNT = "sessionAmount";
public static String KEY_SESSION_PENDING_AMOUNT = "sessionPendingAmount";
public static String KEY_SESSION_TREATMENT = "sessionTreatment"; // What is the treatment ? Eg. SWT for back .
public static String KEY_SESSION_NOTES = "sessionNotes";
public static String KEY_REMINDER_SENT = "reminderSent";
// Create the new table.
private static final String CREATE_TABLE_APPOINTMENT_DETAILS = "CREATE TABLE "
+ TABLE_TAG + "(" + KEY_ID + " INTEGER PRIMARY KEY," +
KEY_CREATED_TIME + " DATETIME," +
KEY_LAST_UPDATED_TIME + " DATETIME, " +
KEY_PATIENT_ID + " INTEGER," +
/////////// to be used later.
KEY_SESSION_GROUP_ID + " INTEGER," +
KEY_SESSION_GROUP_STATUS + " TEXT," +
KEY_LOCATION_ID + " INTEGER," +
//////////
KEY_SESSION_ID + " INTEGER," +
KEY_SESSION_STATUS + " TEXT," +
KEY_SESSION_START_TIME + " TEXT," +
KEY_SESSION_END_TIME + " TEXT," +
KEY_SESSION_AMOUNT + " REAL," +
KEY_SESSION_PENDING_AMOUNT + " REAL," + // to be used later.
KEY_SESSION_TREATMENT + " TEXT," +
KEY_SESSION_NOTES + " TEXT," +
KEY_REMINDER_SENT + " TEXT" +
" )";
//Create the table in a new DB.
public static void createTable(Context context, SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_APPOINTMENT_DETAILS);
}
public static void upgradeTable(Context context, SQLiteDatabase db, int oldVersion, int newVersion ) throws Exception {
if(oldVersion > 2) { // check this condition and update when the schema version changes.
throw new Exception("upgrade script for AppointmentDetails missing");
}
else {// The table gets created in DB version = 2.
createTable(context, db);
}
}
public static Cursor fetchAppointmentsByPatientId(String[] selectColumns, String patientId, Context context) {
DatabaseHelper dbHelper = new DatabaseHelper(context.getApplicationContext());
SQLiteDatabase db = dbHelper.getReadableDatabase();
return db.query(TABLE_TAG, selectColumns,
KEY_PATIENT_ID + " = ?", new String[] {patientId}, null, null, null);
}
}
| [
"Vinay_Tandasi@intuit.com"
] | Vinay_Tandasi@intuit.com |
4f8e54d1c617d35906a1cd54a86b6db0e71ace2d | a52207b00199c0f185e2301ed0063988e0e0fdcf | /src/rpc/ItemHistory.java | ca1e149d97a41c973f89f9b86b2d8cacf87001fc | [] | no_license | jasonmy419/Jupiter | 1844dd2e45c4bb6b27107cac3a53bb65bc57575b | 2a353eae1f8545b1c2bed11e38516265246767c8 | refs/heads/master | 2020-04-16T17:25:32.533961 | 2019-01-15T03:02:48 | 2019-01-15T03:02:48 | 165,771,820 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,629 | java | package rpc;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import db.DBConnection;
import db.DBConnectionFactory;
import entity.Item;
/**
* Servlet implementation class ItemHistory
*/
@WebServlet("/history")
public class ItemHistory extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ItemHistory() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession session = request.getSession(false);
if (session == null) {
response.setStatus(403);
return;
}
String userId = request.getParameter("user_id");
JSONArray array = new JSONArray();
DBConnection conn = DBConnectionFactory.getConnection();
try {
Set<Item> items = conn.getFavoriteItems(userId);
for (Item item : items) {
JSONObject obj = item.toJSONObject();
obj.append("favorite", true);
array.put(obj);
}
RpcHelper.writeJsonArray(response, array);
} catch (JSONException e) {
e.printStackTrace();
} finally {
conn.close();
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
if (session == null) {
response.setStatus(403);
return;
}
DBConnection connection = DBConnectionFactory.getConnection();
try {
JSONObject input = RpcHelper.readJSONObject(request);
String userId = input.getString("user_id");
JSONArray array = input.getJSONArray("favorite");
List<String> itemIds = new ArrayList<>();
for(int i = 0; i < array.length(); i++) {
itemIds.add(array.getString(i));
}
connection.setFavoriteItems(userId, itemIds);
RpcHelper.writeJsonObject(response, new JSONObject().put("result", "SUCCESS"));
}catch (Exception e) {
e.printStackTrace();
}finally {
if(connection != null) {
connection.close();
}
}
}
/**
* @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)
*/
protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
if (session == null) {
response.setStatus(403);
return;
}
DBConnection connection = DBConnectionFactory.getConnection();
try {
JSONObject input = RpcHelper.readJSONObject(request);
String userId = input.getString("user_id");
JSONArray array = input.getJSONArray("favorite");
List<String> itemIds = new ArrayList<>();
for(int i = 0; i < array.length(); i++) {
itemIds.add(array.getString(i));
}
connection.unsetFavoriteItems(userId, itemIds);
RpcHelper.writeJsonObject(response, new JSONObject().put("result", "SUCCESS"));
}catch (Exception e) {
e.printStackTrace();
}finally {
if(connection != null) {
connection.close();
}
}
}
}
| [
"jasonmy419@gmail.com"
] | jasonmy419@gmail.com |
2d9f8b7230078d9ce1beee5f90bc6a63f597d618 | c73e94ef0ef53c49131418ce666db3e2569d526d | /src/com/action/learn_form_label/CheckListAction.java | 928ee21fd6c15bffa838d96686a44dd206674a72 | [] | no_license | ssthouse/LearnJavaWeb | 6a4486e15befee997e2f68b38d1625461a4d4217 | 5fa370f38e809153bc63a1c85208043aebb0f676 | refs/heads/master | 2021-01-12T01:25:46.755446 | 2017-01-26T11:23:52 | 2017-01-26T11:23:52 | 78,384,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | package com.action.learn_form_label;
import com.opensymphony.xwork2.ActionSupport;
/**
* Created by ssthouse on 17/01/2017.
*/
public class CheckListAction extends ActionSupport {
private static final long serialVersionUID = 1l;
private String[] characters;
private String[] interests;
public String[] getCharacters() {
return characters;
}
public void setCharacters(String[] characters) {
this.characters = characters;
}
public String[] getInterests() {
return interests;
}
public void setInterests(String[] interests) {
this.interests = interests;
}
@Override
public String execute() throws Exception {
return SUCCESS;
}
}
| [
"ssthouse@163.com"
] | ssthouse@163.com |
27220b68e8986a6d48ffaf7abfab8f1d4401c259 | d10584bb822e9a01d96bd8126584bdff1eb77daa | /nudge_java/src/kokkodis/utils/StreamGobbler.java | 147d25a298af64b74c650cac068ecae97a537157 | [] | no_license | mkokkodi/nudge | 30c3b3cc29ffbba9198f8a6aa6a4a5b8b3e557a5 | 462f9ce878d704cf2c1b5dcfd4a802e4d5b70a68 | refs/heads/master | 2021-01-16T19:18:33.374604 | 2012-07-25T22:33:52 | 2012-07-25T22:33:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 815 | java | package kokkodis.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class StreamGobbler extends Thread
{
InputStream is;
String type;
public StreamGobbler(InputStream is, String type)
{
this.is = is;
this.type = type;
}
public void run()
{
try
{
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null)
System.out.println(type + ">" + line);
} catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}
| [
"makhmmy@gmail.com"
] | makhmmy@gmail.com |
8418c9bb76db7a11be8506d17cf4541a3d3780c0 | 34201cb1bde5146fd13c14d9d99ed60bc5f84db4 | /src/com/company/GreenGoblin.java | 9366c41eeae6430c6a6f484e00b5756527dd2078 | [] | no_license | JanoadWatson/GoblinsNHumans | 39c2a92077139ba4a68cb80d9ea55d2cb7ea1ef8 | be633d83ce30623710b5aa2732ab440c456efdd0 | refs/heads/main | 2023-06-18T18:04:50.741561 | 2021-07-12T04:48:45 | 2021-07-12T04:48:45 | 385,121,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 276 | java | package com.company;
public class GreenGoblin extends Goblin {
public GreenGoblin(){
archetype = "Green Goblin";
health=100;
strength = 70;
weapon = "HoveCraft with Bombs";
color = "Green";
pic = "\uD83D\uDC7D";
}
}
| [
"jw1234@rutgers.edu"
] | jw1234@rutgers.edu |
acff3bcbc0d8d045136e1c61c556ccab5313eb0d | c0488d851f3079143fe87bc5e0926c8a1d72624d | /src/main/java/com/igg/boot/framework/jdbc/persistence/annotation/Reference.java | 048687972ce59f9791adc0c834411e5c050ea0de | [] | no_license | Maplejw/spring-boot | 8c2ddd187fe6982abc649e6e9666199514b87205 | e69272b200a79cc2b103c185753b5818217ee339 | refs/heads/master | 2023-02-06T03:04:34.837123 | 2020-12-29T05:40:04 | 2020-12-29T05:40:04 | 325,196,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 460 | java | package com.igg.boot.framework.jdbc.persistence.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.igg.boot.framework.jdbc.persistence.Entity;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Reference {
Class<? extends Entity> value() default Entity.class;
String column() default "";
} | [
"maple.wang@igg.com"
] | maple.wang@igg.com |
8896204e6b6422fb39d6d7968986aba4a3776636 | edea24d11f13a067733f042c7be6b45ebc54a305 | /app/src/main/java/com/example/administrator/beautifulweather/util/HttpUtil.java | 0e1a1cd8c67f45a80cee24c739ce161bb6a73e60 | [
"Apache-2.0"
] | permissive | wangwenbo0314/beautifulweather | 2b6683a829e6b47b4461e3a4b03d6e93337d6f75 | 8cb2c5bae02b53750f76df82b4669cb9bb854905 | refs/heads/master | 2021-01-20T00:29:37.485491 | 2017-04-24T10:03:20 | 2017-04-24T10:03:20 | 89,142,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.example.administrator.beautifulweather.util;
import okhttp3.OkHttpClient;
import okhttp3.Request;
/**
* Created by Administrator on 2017/4/24 0024.
*/
public class HttpUtil {
public static void sendOkHttpRequest(String address,okhttp3.Callback callback){
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(address).build();
client.newCall(request).enqueue(callback);
};
}
| [
"285562253@qq.com"
] | 285562253@qq.com |
70f5ff5f740e29ed930587096503d219ce02f15e | b629551bd6b022aa7a6ccb1c52a35bdf8ee86b32 | /app/src/main/java/com/ezlinker/app/AppApplication.java | a9f98eb9c223c02c6a9f6cdc393da5adc47eae9a | [] | no_license | athmoon/ezlinker | 43834c5f63f3f77270afdf2d08b1522f9a3d932b | 98db3efb1ee565cd428db0af1e4bf94ce0039228 | refs/heads/master | 2023-06-24T17:38:19.029774 | 2021-07-24T14:56:51 | 2021-07-24T14:56:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,427 | java | package com.ezlinker.app;
import com.ezlinker.app.common.utils.AliyunMailProperties;
import lombok.extern.java.Log;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
/**
* @author wangwenhai
*/
@EnableScheduling
@MapperScan(basePackages = "com.ezlinker.app.modules.*.mapper")
@SpringBootApplication(scanBasePackages = {"com.ezlinker.*"})
@EnableConfigurationProperties({AliyunMailProperties.class})
@EnableWebSocketMessageBroker
@EnableWebSocket
@EnableWebMvc
@Log
public class AppApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(AppApplication.class, args);
}
@Override
public void run(String... args) {
log.info("------------------------------------");
log.info("<'_'> EZLINKER started successfully!");
log.info("------------------------------------");
}
}
| [
"751957846@qq.com"
] | 751957846@qq.com |
3b28f33bbeab3ad1b360b7c10c7b75430f5f124f | c568b9aaa4f9e1883de1efacd28c544bd4970778 | /projekat/src/main/java/XmlWeb/dto/PorukaDTO.java | ad9f9256cd2a6d402627635fb098e372f8e75e0e | [] | no_license | tanjaindjic/XML | 16e452d08a181d00423eef8d91d379697f75cbd5 | c1cb2f0287150e3dde777c63c8f0d0f1c60438e8 | refs/heads/master | 2022-08-05T14:37:46.548403 | 2019-08-15T06:35:18 | 2019-08-15T06:35:18 | 129,654,632 | 1 | 2 | null | 2022-07-07T23:07:49 | 2018-04-15T22:00:16 | Java | UTF-8 | Java | false | false | 634 | java | package XmlWeb.dto;
public class PorukaDTO {
private String text;
private Long posiljalacId;
private Long primalacId;
public PorukaDTO() {
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public Long getPosiljalacId() {
return posiljalacId;
}
public void setPosiljalacId(Long posiljalacId) {
this.posiljalacId = posiljalacId;
}
public Long getPrimalacId() {
return primalacId;
}
public void setPrimalacId(Long primalacId) {
this.primalacId = primalacId;
}
}
| [
"milans995@gmail.com"
] | milans995@gmail.com |
97126d41002b2c5abb902c854c4a8392704e88c3 | 664358d9280f917b487c7c3a9970e407f0e239a4 | /java/src/main/java/com/randomtask2000/designpatterns/FactoryMethod/HiringManager.java | bee501e2e4116a94cc6943b413ee34f60a30ed13 | [
"CC-BY-4.0"
] | permissive | randomtask2000/design-patterns-for-humans | c84f9270e05b005d268b4dfbdbc250c985a1b316 | 77399ec3f96311fb5227a3069677129196e52f52 | refs/heads/master | 2021-05-09T23:40:06.717733 | 2018-02-13T17:57:39 | 2018-02-13T17:57:39 | 118,801,198 | 1 | 0 | null | 2018-02-13T17:57:40 | 2018-01-24T17:54:39 | Java | UTF-8 | Java | false | false | 315 | java | package com.randomtask2000.designpatterns.FactoryMethod;
public abstract class HiringManager {
// FactoryMethod method
protected abstract Interviewer makeInterviewer();
public void takeInterview() {
Interviewer interviewer = this.makeInterviewer();
interviewer.askQuestions();
}
}
| [
"Emilio.Nicoli@us.usana.com"
] | Emilio.Nicoli@us.usana.com |
a9b1f24ff9dfb5cb285ef81582b1a314c5a094a0 | 3ec6a5de7896ca51001a731bdf4c1724da22a989 | /IMSWeb/src/java/br/fabio/control/comando/administrador/ListarAdministradores.java | d26b98be4523bc660ec2634269426b69a7eb3fbf | [] | no_license | f4biojr/IMS | 59f0ce5c12b06586aeaf3531ab0450d97f270eeb | 179eee17779dabcee9b76b75b950302dd4fb6c9b | refs/heads/master | 2021-01-19T03:16:46.111712 | 2011-04-12T12:45:00 | 2011-04-12T12:45:00 | 1,603,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,084 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.fabio.control.comando.administrador;
import br.fabio.control.comando.Comando;
import br.fabio.model.administrador.Administrador;
import br.fabio.model.dao.AdministradorDAO;
import java.sql.Connection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author fabio
*/
public class ListarAdministradores implements Comando {
private String view;
public void executa(HttpServletRequest request, HttpServletResponse response)throws Exception {
Connection conexao = (Connection)request.getAttribute("conexao");
AdministradorDAO dao = new AdministradorDAO(conexao);
List<Administrador> listaAdministradores = dao.getTodosOsAdministradoresCadastrados();
request.setAttribute("administradores", listaAdministradores);
this.view = "listarAdministradores.jsp";
}
public String getView() {
return this.view;
}
}
| [
"fjuniorlista@gmail.com"
] | fjuniorlista@gmail.com |
b58066d2e75c40d06eef1a5e32caf84c9727acb7 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/alibaba--fastjson/38a9d30d6d220c1c3b40d82d0fca289be6bc92c3/after/JSON.java | f5b356f49137d0725bb7c64df8c6e53000747543 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,119 | java | /*
* Copyright 1999-2101 Alibaba Group.
*
* 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.fastjson;
import java.io.IOException;
import java.io.Writer;
import java.lang.reflect.Array;
import java.lang.reflect.Type;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharsetDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.parser.DefaultJSONParser;
import com.alibaba.fastjson.parser.DefaultJSONParser.ResolveTask;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.parser.JSONLexer;
import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.parser.deserializer.ExtraProcessor;
import com.alibaba.fastjson.parser.deserializer.ExtraTypeProvider;
import com.alibaba.fastjson.parser.deserializer.FieldDeserializer;
import com.alibaba.fastjson.parser.deserializer.ParseProcess;
import com.alibaba.fastjson.serializer.BeforeFilter;
import com.alibaba.fastjson.serializer.JSONSerializer;
import com.alibaba.fastjson.serializer.NameFilter;
import com.alibaba.fastjson.serializer.PropertyFilter;
import com.alibaba.fastjson.serializer.PropertyPreFilter;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.SerializeWriter;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.ValueFilter;
import com.alibaba.fastjson.util.FieldInfo;
import com.alibaba.fastjson.util.IOUtils;
import com.alibaba.fastjson.util.ThreadLocalCache;
import com.alibaba.fastjson.util.TypeUtils;
/**
* @author wenshao<szujobs@hotmail.com>
*/
public abstract class JSON implements JSONStreamAware, JSONAware {
public static String DEFAULT_TYPE_KEY = "@type";
public static int DEFAULT_PARSER_FEATURE;
static {
int features = 0;
features |= Feature.AutoCloseSource.getMask();
features |= Feature.InternFieldNames.getMask();
features |= Feature.UseBigDecimal.getMask();
features |= Feature.AllowUnQuotedFieldNames.getMask();
features |= Feature.AllowSingleQuotes.getMask();
features |= Feature.AllowArbitraryCommas.getMask();
features |= Feature.SortFeidFastMatch.getMask();
features |= Feature.IgnoreNotMatch.getMask();
DEFAULT_PARSER_FEATURE = features;
}
public static String DEFFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static int DEFAULT_GENERATE_FEATURE;
static {
int features = 0;
features |= com.alibaba.fastjson.serializer.SerializerFeature.QuoteFieldNames.getMask();
features |= com.alibaba.fastjson.serializer.SerializerFeature.SkipTransientField.getMask();
features |= com.alibaba.fastjson.serializer.SerializerFeature.WriteEnumUsingToString.getMask();
features |= com.alibaba.fastjson.serializer.SerializerFeature.SortField.getMask();
// features |=
// com.alibaba.fastjson.serializer.SerializerFeature.WriteSlashAsSpecial.getMask();
DEFAULT_GENERATE_FEATURE = features;
}
public static final Object parse(String text) {
return parse(text, DEFAULT_PARSER_FEATURE);
}
public static final Object parse(String text, int features) {
if (text == null) {
return null;
}
DefaultJSONParser parser = new DefaultJSONParser(text, ParserConfig.getGlobalInstance(), features);
Object value = parser.parse();
handleResovleTask(parser, value);
parser.close();
return value;
}
public static final Object parse(byte[] input, Feature... features) {
return parse(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), features);
}
public static final Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Feature... features) {
if (input == null || input.length == 0) {
return null;
}
int featureValues = DEFAULT_PARSER_FEATURE;
for (Feature featrue : features) {
featureValues = Feature.config(featureValues, featrue, true);
}
return parse(input, off, len, charsetDecoder, featureValues);
}
public static final Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, int features) {
charsetDecoder.reset();
int scaleLength = (int) (len * (double) charsetDecoder.maxCharsPerByte());
char[] chars = ThreadLocalCache.getChars(scaleLength);
ByteBuffer byteBuf = ByteBuffer.wrap(input, off, len);
CharBuffer charBuf = CharBuffer.wrap(chars);
IOUtils.decode(charsetDecoder, byteBuf, charBuf);
int position = charBuf.position();
DefaultJSONParser parser = new DefaultJSONParser(chars, position, ParserConfig.getGlobalInstance(), features);
Object value = parser.parse();
handleResovleTask(parser, value);
parser.close();
return value;
}
public static final Object parse(String text, Feature... features) {
int featureValues = DEFAULT_PARSER_FEATURE;
for (Feature featrue : features) {
featureValues = Feature.config(featureValues, featrue, true);
}
return parse(text, featureValues);
}
public static final JSONObject parseObject(String text, Feature... features) {
return (JSONObject) parse(text, features);
}
public static final JSONObject parseObject(String text) {
Object obj = parse(text);
if (obj instanceof JSONObject) {
return (JSONObject) obj;
}
return (JSONObject) JSON.toJSON(obj);
}
@SuppressWarnings("unchecked")
public static final <T> T parseObject(String text, TypeReference<T> type, Feature... features) {
return (T) parseObject(text, type.getType(), ParserConfig.getGlobalInstance(), DEFAULT_PARSER_FEATURE, features);
}
@SuppressWarnings("unchecked")
public static final <T> T parseObject(String text, Class<T> clazz, Feature... features) {
return (T) parseObject(text, (Type) clazz, ParserConfig.getGlobalInstance(), DEFAULT_PARSER_FEATURE, features);
}
@SuppressWarnings("unchecked")
public static final <T> T parseObject(String text, Class<T> clazz, ParseProcess processor, Feature... features) {
return (T) parseObject(text, (Type) clazz, ParserConfig.getGlobalInstance(), processor, DEFAULT_PARSER_FEATURE,
features);
}
@SuppressWarnings("unchecked")
public static final <T> T parseObject(String input, Type clazz, Feature... features) {
return (T) parseObject(input, clazz, ParserConfig.getGlobalInstance(), DEFAULT_PARSER_FEATURE, features);
}
@SuppressWarnings("unchecked")
public static final <T> T parseObject(String input, Type clazz, ParseProcess processor, Feature... features) {
return (T) parseObject(input, clazz, ParserConfig.getGlobalInstance(), DEFAULT_PARSER_FEATURE, features);
}
@SuppressWarnings("unchecked")
public static final <T> T parseObject(String input, Type clazz, int featureValues, Feature... features) {
if (input == null) {
return null;
}
for (Feature featrue : features) {
featureValues = Feature.config(featureValues, featrue, true);
}
DefaultJSONParser parser = new DefaultJSONParser(input, ParserConfig.getGlobalInstance(), featureValues);
T value = (T) parser.parseObject(clazz);
handleResovleTask(parser, value);
parser.close();
return (T) value;
}
public static final <T> T parseObject(String input, Type clazz, ParserConfig config, int featureValues,
Feature... features) {
return parseObject(input, clazz, config, null, featureValues, features);
}
@SuppressWarnings("unchecked")
public static final <T> T parseObject(String input, Type clazz, ParserConfig config, ParseProcess processor,
int featureValues, Feature... features) {
if (input == null) {
return null;
}
for (Feature featrue : features) {
featureValues = Feature.config(featureValues, featrue, true);
}
DefaultJSONParser parser = new DefaultJSONParser(input, config, featureValues);
if (processor instanceof ExtraTypeProvider) {
parser.getExtraTypeProviders().add((ExtraTypeProvider) processor);
}
if (processor instanceof ExtraProcessor) {
parser.getExtraProcessors().add((ExtraProcessor) processor);
}
T value = (T) parser.parseObject(clazz);
handleResovleTask(parser, value);
parser.close();
return (T) value;
}
public static void handleResovleTask(DefaultJSONParser parser, Object value) {
List<ResolveTask> resolveTaskList = parser.getResolveTaskListDirect();
if (resolveTaskList == null) {
return;
}
int size = resolveTaskList.size();
for (int i = 0; i < size; ++i) {
ResolveTask task = resolveTaskList.get(i);
FieldDeserializer fieldDeser = task.getFieldDeserializer();
Object object = null;
if (task.getOwnerContext() != null) {
object = task.getOwnerContext().getObject();
}
String ref = task.getReferenceValue();
Object refValue;
if (ref.startsWith("$")) {
refValue = parser.getObject(ref);
} else {
refValue = task.getContext().getObject();
}
fieldDeser.setValue(object, refValue);
}
}
@SuppressWarnings("unchecked")
public static final <T> T parseObject(byte[] input, Type clazz, Feature... features) {
return (T) parseObject(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), clazz, features);
}
@SuppressWarnings("unchecked")
public static final <T> T parseObject(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Type clazz,
Feature... features) {
charsetDecoder.reset();
int scaleLength = (int) (len * (double) charsetDecoder.maxCharsPerByte());
char[] chars = ThreadLocalCache.getChars(scaleLength);
ByteBuffer byteBuf = ByteBuffer.wrap(input, off, len);
CharBuffer charByte = CharBuffer.wrap(chars);
IOUtils.decode(charsetDecoder, byteBuf, charByte);
int position = charByte.position();
return (T) parseObject(chars, position, clazz, features);
}
@SuppressWarnings("unchecked")
public static final <T> T parseObject(char[] input, int length, Type clazz, Feature... features) {
if (input == null || input.length == 0) {
return null;
}
int featureValues = DEFAULT_PARSER_FEATURE;
for (Feature featrue : features) {
featureValues = Feature.config(featureValues, featrue, true);
}
DefaultJSONParser parser = new DefaultJSONParser(input, length, ParserConfig.getGlobalInstance(), featureValues);
T value = (T) parser.parseObject(clazz);
handleResovleTask(parser, value);
parser.close();
return (T) value;
}
public static final <T> T parseObject(String text, Class<T> clazz) {
return parseObject(text, clazz, new Feature[0]);
}
public static final JSONArray parseArray(String text) {
if (text == null) {
return null;
}
DefaultJSONParser parser = new DefaultJSONParser(text, ParserConfig.getGlobalInstance());
JSONArray array;
JSONLexer lexer = parser.getLexer();
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
array = null;
} else if (lexer.token() == JSONToken.EOF) {
array = null;
} else {
array = new JSONArray();
parser.parseArray(array);
handleResovleTask(parser, array);
}
parser.close();
return array;
}
public static final <T> List<T> parseArray(String text, Class<T> clazz) {
if (text == null) {
return null;
}
List<T> list;
DefaultJSONParser parser = new DefaultJSONParser(text, ParserConfig.getGlobalInstance());
JSONLexer lexer = parser.getLexer();
if (lexer.token() == JSONToken.NULL) {
lexer.nextToken();
list = null;
} else {
list = new ArrayList<T>();
parser.parseArray(clazz, list);
handleResovleTask(parser, list);
}
parser.close();
return list;
}
public static final List<Object> parseArray(String text, Type[] types) {
if (text == null) {
return null;
}
List<Object> list;
DefaultJSONParser parser = new DefaultJSONParser(text, ParserConfig.getGlobalInstance());
Object[] objectArray = parser.parseArray(types);
if (objectArray == null) {
list = null;
} else {
list = Arrays.asList(objectArray);
}
handleResovleTask(parser, list);
parser.close();
return list;
}
// ======================
public static final String toJSONString(Object object) {
return toJSONString(object, new SerializerFeature[0]);
}
public static final String toJSONString(Object object, SerializerFeature... features) {
SerializeWriter out = new SerializeWriter();
try {
JSONSerializer serializer = new JSONSerializer(out);
for (com.alibaba.fastjson.serializer.SerializerFeature feature : features) {
serializer.config(feature, true);
}
serializer.write(object);
return out.toString();
} finally {
out.close();
}
}
/**
* @since 1.1.14
*/
public static final String toJSONStringWithDateFormat(Object object, String dateFormat,
SerializerFeature... features) {
SerializeWriter out = new SerializeWriter();
try {
JSONSerializer serializer = new JSONSerializer(out);
for (com.alibaba.fastjson.serializer.SerializerFeature feature : features) {
serializer.config(feature, true);
}
serializer.config(SerializerFeature.WriteDateUseDateFormat, true);
if (dateFormat != null) {
serializer.setDateFormat(dateFormat);
}
serializer.write(object);
return out.toString();
} finally {
out.close();
}
}
public static final String toJSONString(Object object, SerializeFilter filter, SerializerFeature... features) {
SerializeWriter out = new SerializeWriter();
try {
JSONSerializer serializer = new JSONSerializer(out);
for (com.alibaba.fastjson.serializer.SerializerFeature feature : features) {
serializer.config(feature, true);
}
serializer.config(SerializerFeature.WriteDateUseDateFormat, true);
if (filter != null) {
if (filter instanceof PropertyPreFilter) {
serializer.getPropertyPreFilters().add((PropertyPreFilter) filter);
}
if (filter instanceof NameFilter) {
serializer.getNameFilters().add((NameFilter) filter);
}
if (filter instanceof ValueFilter) {
serializer.getValueFilters().add((ValueFilter) filter);
}
if (filter instanceof PropertyFilter) {
serializer.getPropertyFilters().add((PropertyFilter) filter);
}
if (filter instanceof BeforeFilter) {
serializer.getBeforeFilters().add((BeforeFilter) filter);
}
}
serializer.write(object);
return out.toString();
} finally {
out.close();
}
}
public static final byte[] toJSONBytes(Object object, SerializerFeature... features) {
SerializeWriter out = new SerializeWriter();
try {
JSONSerializer serializer = new JSONSerializer(out);
for (com.alibaba.fastjson.serializer.SerializerFeature feature : features) {
serializer.config(feature, true);
}
serializer.write(object);
return out.toBytes("UTF-8");
} finally {
out.close();
}
}
public static final String toJSONString(Object object, SerializeConfig config, SerializerFeature... features) {
SerializeWriter out = new SerializeWriter();
try {
JSONSerializer serializer = new JSONSerializer(out, config);
for (com.alibaba.fastjson.serializer.SerializerFeature feature : features) {
serializer.config(feature, true);
}
serializer.write(object);
return out.toString();
} finally {
out.close();
}
}
public static final String toJSONStringZ(Object object, SerializeConfig mapping, SerializerFeature... features) {
SerializeWriter out = new SerializeWriter(features);
try {
JSONSerializer serializer = new JSONSerializer(out, mapping);
serializer.write(object);
return out.toString();
} finally {
out.close();
}
}
public static final byte[] toJSONBytes(Object object, SerializeConfig config, SerializerFeature... features) {
SerializeWriter out = new SerializeWriter();
try {
JSONSerializer serializer = new JSONSerializer(out, config);
for (com.alibaba.fastjson.serializer.SerializerFeature feature : features) {
serializer.config(feature, true);
}
serializer.write(object);
return out.toBytes("UTF-8");
} finally {
out.close();
}
}
public static final String toJSONString(Object object, boolean prettyFormat) {
if (!prettyFormat) {
return toJSONString(object);
}
return toJSONString(object, SerializerFeature.PrettyFormat);
}
public static final void writeJSONStringTo(Object object, Writer writer, SerializerFeature... features) {
SerializeWriter out = new SerializeWriter(writer);
try {
JSONSerializer serializer = new JSONSerializer(out);
for (com.alibaba.fastjson.serializer.SerializerFeature feature : features) {
serializer.config(feature, true);
}
serializer.write(object);
} finally {
out.close();
}
}
// ======================================
@Override
public String toString() {
return toJSONString();
}
public String toJSONString() {
SerializeWriter out = new SerializeWriter();
try {
new JSONSerializer(out).write(this);
return out.toString();
} finally {
out.close();
}
}
public void writeJSONString(Appendable appendable) {
SerializeWriter out = new SerializeWriter();
try {
new JSONSerializer(out).write(this);
appendable.append(out.toString());
} catch (IOException e) {
throw new JSONException(e.getMessage(), e);
} finally {
out.close();
}
}
// ///////
public static final Object toJSON(Object javaObject) {
return toJSON(javaObject, ParserConfig.getGlobalInstance());
}
@SuppressWarnings("unchecked")
public static final Object toJSON(Object javaObject, ParserConfig mapping) {
if (javaObject == null) {
return null;
}
if (javaObject instanceof JSON) {
return (JSON) javaObject;
}
if (javaObject instanceof Map) {
Map<Object, Object> map = (Map<Object, Object>) javaObject;
JSONObject json = new JSONObject(map.size());
for (Map.Entry<Object, Object> entry : map.entrySet()) {
Object key = entry.getKey();
String jsonKey = TypeUtils.castToString(key);
Object jsonValue = toJSON(entry.getValue());
json.put(jsonKey, jsonValue);
}
return json;
}
if (javaObject instanceof Collection) {
Collection<Object> collection = (Collection<Object>) javaObject;
JSONArray array = new JSONArray(collection.size());
for (Object item : collection) {
Object jsonValue = toJSON(item);
array.add(jsonValue);
}
return array;
}
Class<?> clazz = javaObject.getClass();
if (clazz.isEnum()) {
return ((Enum<?>) javaObject).name();
}
if (clazz.isArray()) {
int len = Array.getLength(javaObject);
JSONArray array = new JSONArray(len);
for (int i = 0; i < len; ++i) {
Object item = Array.get(javaObject, i);
Object jsonValue = toJSON(item);
array.add(jsonValue);
}
return array;
}
if (mapping.isPrimitive(clazz)) {
return javaObject;
}
try {
List<FieldInfo> getters = TypeUtils.computeGetters(clazz, null);
JSONObject json = new JSONObject(getters.size());
for (FieldInfo field : getters) {
Object value = field.get(javaObject);
Object jsonValue = toJSON(value);
json.put(field.getName(), jsonValue);
}
return json;
} catch (Exception e) {
throw new JSONException("toJSON error", e);
}
}
public static final <T> T toJavaObject(JSON json, Class<T> clazz) {
return TypeUtils.cast(json, clazz, ParserConfig.getGlobalInstance());
}
public final static String VERSION = "1.1.34";
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.